glamor: Make sure Xvideo source image data is properly aligned
_glamor_upload_bits_to_pixmap_texture currently ignores the stride parameter, but __glamor_upload_pixmap_to_texture uses 4-byte alignment via glPixelStorei(GL_UNPACK_ALIGNMENT, 4). Also fix up the stride argument passed in though, in case it starts being used properly in the future. Bugzilla: https://bugs.freedesktop.org/show_bug.cgi?id=87455 Signed-off-by: Michel Dänzer <michel.daenzer@amd.com> Reviewed-by: Keith Packard <keithp@keithp.com> Signed-off-by: Keith Packard <keithp@keithp.com>
This commit is contained in:
parent
11b85ab2fc
commit
70a6f65f9e
|
@ -208,15 +208,14 @@ glamor_xv_query_image_attributes(int id,
|
||||||
switch (id) {
|
switch (id) {
|
||||||
case FOURCC_YV12:
|
case FOURCC_YV12:
|
||||||
case FOURCC_I420:
|
case FOURCC_I420:
|
||||||
*h = *h;
|
*h = ALIGN(*h, 2);
|
||||||
*w = *w;
|
size = ALIGN(*w, 4);
|
||||||
size = *w;
|
|
||||||
if (pitches)
|
if (pitches)
|
||||||
pitches[0] = size;
|
pitches[0] = size;
|
||||||
size *= *h;
|
size *= *h;
|
||||||
if (offsets)
|
if (offsets)
|
||||||
offsets[1] = size;
|
offsets[1] = size;
|
||||||
tmp = *w >> 1;
|
tmp = ALIGN(*w >> 1, 4);
|
||||||
if (pitches)
|
if (pitches)
|
||||||
pitches[1] = pitches[2] = tmp;
|
pitches[1] = pitches[2] = tmp;
|
||||||
tmp *= (*h >> 1);
|
tmp *= (*h >> 1);
|
||||||
|
@ -413,9 +412,6 @@ glamor_xv_put_image(glamor_port_private *port_priv,
|
||||||
|
|
||||||
s2offset = s3offset = srcPitch2 = 0;
|
s2offset = s3offset = srcPitch2 = 0;
|
||||||
|
|
||||||
srcPitch = width;
|
|
||||||
srcPitch2 = width >> 1;
|
|
||||||
|
|
||||||
if (!port_priv->src_pix[0] ||
|
if (!port_priv->src_pix[0] ||
|
||||||
(width != port_priv->src_pix_w || height != port_priv->src_pix_h)) {
|
(width != port_priv->src_pix_w || height != port_priv->src_pix_h)) {
|
||||||
int i;
|
int i;
|
||||||
|
@ -444,6 +440,8 @@ glamor_xv_put_image(glamor_port_private *port_priv,
|
||||||
switch (id) {
|
switch (id) {
|
||||||
case FOURCC_YV12:
|
case FOURCC_YV12:
|
||||||
case FOURCC_I420:
|
case FOURCC_I420:
|
||||||
|
srcPitch = ALIGN(width, 4);
|
||||||
|
srcPitch2 = ALIGN(width >> 1, 4);
|
||||||
s2offset = srcPitch * height;
|
s2offset = srcPitch * height;
|
||||||
s3offset = s2offset + (srcPitch2 * ((height + 1) >> 1));
|
s3offset = s2offset + (srcPitch2 * ((height + 1) >> 1));
|
||||||
s2offset += ((top >> 1) * srcPitch2);
|
s2offset += ((top >> 1) * srcPitch2);
|
||||||
|
@ -454,18 +452,18 @@ glamor_xv_put_image(glamor_port_private *port_priv,
|
||||||
s3offset = tmp;
|
s3offset = tmp;
|
||||||
}
|
}
|
||||||
glamor_upload_sub_pixmap_to_texture(port_priv->src_pix[0],
|
glamor_upload_sub_pixmap_to_texture(port_priv->src_pix[0],
|
||||||
0, 0, srcPitch, nlines,
|
0, 0, width, nlines,
|
||||||
port_priv->src_pix[0]->devKind,
|
srcPitch,
|
||||||
buf + (top * srcPitch), 0);
|
buf + (top * srcPitch), 0);
|
||||||
|
|
||||||
glamor_upload_sub_pixmap_to_texture(port_priv->src_pix[1],
|
glamor_upload_sub_pixmap_to_texture(port_priv->src_pix[1],
|
||||||
0, 0, srcPitch2, (nlines + 1) >> 1,
|
0, 0, width >> 1, (nlines + 1) >> 1,
|
||||||
port_priv->src_pix[1]->devKind,
|
srcPitch2,
|
||||||
buf + s2offset, 0);
|
buf + s2offset, 0);
|
||||||
|
|
||||||
glamor_upload_sub_pixmap_to_texture(port_priv->src_pix[2],
|
glamor_upload_sub_pixmap_to_texture(port_priv->src_pix[2],
|
||||||
0, 0, srcPitch2, (nlines + 1) >> 1,
|
0, 0, width >> 1, (nlines + 1) >> 1,
|
||||||
port_priv->src_pix[2]->devKind,
|
srcPitch2,
|
||||||
buf + s3offset, 0);
|
buf + s3offset, 0);
|
||||||
break;
|
break;
|
||||||
default:
|
default:
|
||||||
|
|
Loading…
Reference in New Issue