summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorMartin Krastev <krastevm@vmware.com>2022-01-25 15:11:08 +0200
committerZack Rusin <zackr@vmware.com>2022-06-21 11:31:11 -0400
commitff5637a14c52e6ec592592c88938104b087e925c (patch)
tree32093db9b241b9e87793625bdb8a384095728ef1
parent77b8183b3395333d5d4c73e25c2d011748f15eda (diff)
Garbled XvPutImage output for FOURCC_YV12 when using 3D-accel-texture adaptor
A helper for the PutImage callback in adaptor 'XA G3D Textured Video' was not taking into account the source data pitches for YV12 format, resulting in garbled frames for misaligned frame widths. Issue reported by Doug Brown. This patch is based off the patch proposed by Doug. Repro of the original issue: gst-launch-1.0 videotestsrc ! video/x-raw,format=YV12,width=449,height=240 ! xvimagesink Reported-by: Doug Brown <doug@schmorgal.com> Signed-off-by: Martin Krastev <krastevm@vmware.com> Reviewed-by: Zack Rusin <zackr@vmware.com>
-rw-r--r--vmwgfx/vmwgfx_tex_video.c13
1 files changed, 10 insertions, 3 deletions
diff --git a/vmwgfx/vmwgfx_tex_video.c b/vmwgfx/vmwgfx_tex_video.c
index 480a5f1..260494d 100644
--- a/vmwgfx/vmwgfx_tex_video.c
+++ b/vmwgfx/vmwgfx_tex_video.c
@@ -634,9 +634,16 @@ copy_packed_data(ScrnInfoPtr pScrn,
yp = buf + offsets[0];
vp = buf + offsets[1];
up = buf + offsets[2];
- memcpy(ymap, yp, w*h);
- memcpy(vmap, vp, w*h/4);
- memcpy(umap, up, w*h/4);
+ for (i = 0; i < h; ++i) {
+ memcpy(ymap + w * i, yp, w);
+ yp += pitches[0];
+ }
+ for (i = 0; i < h / 2; ++i) {
+ memcpy(vmap + w * i / 2, vp, w / 2);
+ memcpy(umap + w * i / 2, up, w / 2);
+ vp += pitches[1];
+ up += pitches[2];
+ }
break;
}
case FOURCC_UYVY: