diff options
author | Russell King <rmk@armlinux.org.uk> | 2018-06-22 10:45:59 +0100 |
---|---|---|
committer | Russell King <rmk@armlinux.org.uk> | 2018-06-25 16:07:46 +0100 |
commit | eabc5d5a73a9e0183bf26e8016d6cf2947c76eb0 (patch) | |
tree | 3bac5abd8270c6ed3b96925f76f417c5f3bdb310 | |
parent | e41e405a8e03f88c614b1b42db4aa838acf9063c (diff) |
etnaviv: prepare to support rotations in source acquire
Prepare to support rotations when acquiring a source. When checking
whether the pixmap contains all the required pixels, we need to
translate the untransformed coordinates to the coordinates on the
source pixmap.
Signed-off-by: Russell King <rmk@armlinux.org.uk>
-rw-r--r-- | common/pixmaputil.h | 7 | ||||
-rw-r--r-- | configure.ac | 2 | ||||
-rw-r--r-- | etnaviv/etnaviv_render.c | 43 |
3 files changed, 30 insertions, 22 deletions
diff --git a/common/pixmaputil.h b/common/pixmaputil.h index 086e5dd..fb40890 100644 --- a/common/pixmaputil.h +++ b/common/pixmaputil.h @@ -42,4 +42,11 @@ static inline Bool drawable_contains(DrawablePtr drawable, return TRUE; } +static inline Bool drawable_contains_box(DrawablePtr drawable, const BoxRec *box) +{ + return box->x1 >= 0 && box->y1 >= 0 && + box->x2 <= drawable->width && + box->y2 <= drawable->height; +} + #endif diff --git a/configure.ac b/configure.ac index 6df5c32..a62169c 100644 --- a/configure.ac +++ b/configure.ac @@ -242,7 +242,7 @@ AC_ARG_ENABLE(present, AC_HELP_STRING([--disable-present], [PRESENT=no]) # Checks for pkg-config packages -PKG_CHECK_MODULES(XORG, [xorg-server >= 1.9.99.1 xproto fontsproto]) +PKG_CHECK_MODULES(XORG, [xorg-server >= 1.9.99.1 xproto fontsproto pixman-1]) sdkdir=$(pkg-config --variable=sdkdir xorg-server) # Checks for required extensions diff --git a/etnaviv/etnaviv_render.c b/etnaviv/etnaviv_render.c index 3d125c0..484e9f1 100644 --- a/etnaviv/etnaviv_render.c +++ b/etnaviv/etnaviv_render.c @@ -120,22 +120,31 @@ static void etnaviv_debug_blend_op(const char *func, } #endif -static Bool picture_has_pixels(PicturePtr pPict, int x, int y, +static Bool picture_has_pixels(PicturePtr pPict, xPoint origin, const BoxRec *box) { DrawablePtr pDrawable; + BoxRec b; /* If there is no drawable, there are no pixels that can be fetched */ pDrawable = pPict->pDrawable; if (!pDrawable) return FALSE; - /* Does the drawable contain all the pixels we want? */ - if (pPict->filter != PictFilterConvolution && - drawable_contains(pDrawable, x, y, box->x2, box->y2)) - return TRUE; + if (pPict->filter == PictFilterConvolution) + return FALSE; - return FALSE; + b.x1 = origin.x; + b.y1 = origin.y; + b.x2 = origin.x + box->x2; + b.y2 = origin.y + box->y2; + + /* transform to the source coordinates if required */ + if (pPict->transform) + pixman_transform_bounds(pPict->transform, &b); + + /* Does the drawable contain all the pixels we want? */ + return drawable_contains_box(pDrawable, &b); } static const struct etnaviv_blend_op etnaviv_composite_op[] = { @@ -408,18 +417,14 @@ static struct etnaviv_pixmap *etnaviv_acquire_src(ScreenPtr pScreen, if (!vSrc) goto fallback; - if (vSrc->width < clip->x2 || vSrc->height < clip->y2) - goto fallback; - etnaviv_set_format(vSrc, pict); if (!etnaviv_src_format_valid(etnaviv, vSrc->pict_format)) goto fallback; - if (!transform_is_integer_translation(pict->transform, &tx, &ty)) + if (!picture_has_pixels(pict, *src_topleft, clip)) goto fallback; - if (!picture_has_pixels(pict, src_topleft->x + tx, src_topleft->y + ty, - clip)) + if (!transform_is_integer_translation(pict->transform, &tx, &ty)) goto fallback; src_topleft->x += drawable->x + src_offset.x + tx; @@ -647,19 +652,15 @@ static int etnaviv_accel_composite_masked(PicturePtr pSrc, PicturePtr pMask, xPoint mo; int tx, ty; - if (!transform_is_integer_translation(pMask->transform, &tx, &ty)) + /* We don't handle mask repeats (yet) */ + if (!picture_has_pixels(pMask, mask_offset, &clip_temp)) goto fallback; - mask_offset.x += tx; - mask_offset.y += ty; - - /* We don't handle mask repeats (yet) */ - if (!picture_has_pixels(pMask, mask_offset.x, mask_offset.y, - &clip_temp)) + if (!transform_is_integer_translation(pMask->transform, &tx, &ty)) goto fallback; - mask_offset.x += pMask->pDrawable->x; - mask_offset.y += pMask->pDrawable->y; + mask_offset.x += pMask->pDrawable->x + tx; + mask_offset.y += pMask->pDrawable->y + ty; /* * Check whether the mask has a etna bo backing it. If not, |