From 24f1b704bc3e0cf9a5182a281f43a2d9cea05ec2 Mon Sep 17 00:00:00 2001 From: Fedora X Ninjas Date: Fri, 17 Apr 2015 00:11:44 +0100 Subject: [PATCH] glamor: Make sure Xvideo source image data is properly --- glamor/glamor_xv.c | 24 +++++++++++------------- 1 file changed, 11 insertions(+), 13 deletions(-) diff --git a/glamor/glamor_xv.c b/glamor/glamor_xv.c index 369b02b..0309abb 100644 --- a/glamor/glamor_xv.c +++ b/glamor/glamor_xv.c @@ -229,15 +229,14 @@ glamor_xv_query_image_attributes(ScrnInfoPtr pScrn, switch (id) { case FOURCC_YV12: case FOURCC_I420: - *h = *h; - *w = *w; - size = *w; + *h = ALIGN(*h, 2); + size = ALIGN(*w, 4); if (pitches) pitches[0] = size; size *= *h; if (offsets) offsets[1] = size; - tmp = *w >> 1; + tmp = ALIGN(*w >> 1, 4); if (pitches) pitches[1] = pitches[2] = tmp; tmp *= (*h >> 1); @@ -445,9 +444,6 @@ glamor_xv_put_image(ScrnInfoPtr pScrn, if ((x1 >= x2) || (y1 >= y2)) return Success; - srcPitch = width; - srcPitch2 = width >> 1; - if (!port_priv->src_pix[0] || (width != port_priv->src_pix_w || height != port_priv->src_pix_h)) { int i; @@ -476,6 +472,8 @@ glamor_xv_put_image(ScrnInfoPtr pScrn, switch (id) { case FOURCC_YV12: case FOURCC_I420: + srcPitch = ALIGN(width, 4); + srcPitch2 = ALIGN(width >> 1, 4); s2offset = srcPitch * height; s3offset = s2offset + (srcPitch2 * ((height + 1) >> 1)); s2offset += ((top >> 1) * srcPitch2); @@ -486,18 +484,18 @@ glamor_xv_put_image(ScrnInfoPtr pScrn, s3offset = tmp; } glamor_upload_sub_pixmap_to_texture(port_priv->src_pix[0], - 0, 0, srcPitch, nlines, - port_priv->src_pix[0]->devKind, + 0, 0, width, nlines, + srcPitch, buf + (top * srcPitch), 0); glamor_upload_sub_pixmap_to_texture(port_priv->src_pix[1], - 0, 0, srcPitch2, (nlines + 1) >> 1, - port_priv->src_pix[1]->devKind, + 0, 0, width >> 1, (nlines + 1) >> 1, + srcPitch2, buf + s2offset, 0); glamor_upload_sub_pixmap_to_texture(port_priv->src_pix[2], - 0, 0, srcPitch2, (nlines + 1) >> 1, - port_priv->src_pix[2]->devKind, + 0, 0, width >> 1, (nlines + 1) >> 1, + srcPitch2, buf + s3offset, 0); break; default: -- 2.1.0