From c1111710628cc2a9dfaee0d74ea9fceee990095b Mon Sep 17 00:00:00 2001 From: Eric Anholt Date: Thu, 2 Jul 2015 13:33:01 -0700 Subject: [PATCH] glamor: Take transforms into account when preparing for a fallback. MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit This function takes the start x/y and the destination's width/height, so it only works if there's no transform. We could potentially transform this box and take its bounds with some rounding, but this at least gets us to read out enough data. Note that this does the same overshoot on destination pictures with a transform attached, but that seems unlikely to be used anyway. v2: Add XXX comment for the commit message note (Suggested by Michel). Signed-off-by: Eric Anholt Reviewed-by: Michel Dänzer (v1) Reviewed-by: Dave Airlie (v1) --- glamor/glamor_prepare.c | 18 ++++++++++++++++-- 1 file changed, 16 insertions(+), 2 deletions(-) diff --git a/glamor/glamor_prepare.c b/glamor/glamor_prepare.c index 9bfc557e1..833291c58 100644 --- a/glamor/glamor_prepare.c +++ b/glamor/glamor_prepare.c @@ -220,8 +220,22 @@ glamor_prepare_access_picture_box(PicturePtr picture, glamor_access_t access, { if (!picture || !picture->pDrawable) return TRUE; - return glamor_prepare_access_box(picture->pDrawable, access, - x, y, w, h); + + /* If a transform is set, we don't know what the bounds is on the + * source, so just prepare the whole pixmap. XXX: We could + * potentially work out where in the source would be sampled based + * on the transform, and we don't need do do this for destination + * pixmaps at all. + */ + if (picture->transform) { + return glamor_prepare_access_box(picture->pDrawable, access, + 0, 0, + picture->pDrawable->width, + picture->pDrawable->height); + } else { + return glamor_prepare_access_box(picture->pDrawable, access, + x, y, w, h); + } } void