From 23123f543bfe409ce3318d19920de706a0bf7a96 Mon Sep 17 00:00:00 2001 From: Alex Deucher Date: Fri, 25 Feb 2011 17:00:45 -0500 Subject: [PATCH] exa: take drawable offsets into account in composite May fix: https://bugs.freedesktop.org/show_bug.cgi?id=27016 Signed-off-by: Alex Deucher --- src/evergreen_exa.c | 28 ++++++++++++++++++++++++++++ src/r600_exa.c | 28 ++++++++++++++++++++++++++++ src/radeon.h | 7 +++++++ src/radeon_exa_render.c | 28 +++++++++++++++++++++++++++- 4 files changed, 90 insertions(+), 1 deletions(-) diff --git a/src/evergreen_exa.c b/src/evergreen_exa.c index e5e7559..155490f 100644 --- a/src/evergreen_exa.c +++ b/src/evergreen_exa.c @@ -1089,6 +1089,27 @@ static Bool EVERGREENPrepareComposite(int op, PicturePtr pSrcPicture, if (pDst->drawable.bitsPerPixel < 8 || pSrc->drawable.bitsPerPixel < 8) return FALSE; +#ifdef COMPOSITE + info->accel_state->dst_xoff = -pDst->screen_x + pDst->drawable.x; + info->accel_state->dst_yoff = -pDst->screen_y + pDst->drawable.y; + info->accel_state->src_xoff = -pSrc->screen_x + pSrc->drawable.x; + info->accel_state->src_yoff = -pSrc->screen_y + pSrc->drawable.y; + if (pMask) { + info->accel_state->mask_xoff = -pMask->screen_x + pMask->drawable.x; + info->accel_state->mask_yoff = -pMask->screen_y + pMask->drawable.y; + } else { + info->accel_state->mask_xoff = 0; + info->accel_state->mask_yoff = 0; + } +#else + info->accel_state->dst_xoff = 0; + info->accel_state->dst_yoff = 0; + info->accel_state->src_xoff = 0; + info->accel_state->src_yoff = 0; + info->accel_state->mask_xoff = 0; + info->accel_state->mask_yoff = 0; +#endif + src_obj.offset = 0; dst_obj.offset = 0; src_obj.bo = radeon_get_pixmap_bo(pSrc); @@ -1305,6 +1326,13 @@ static void EVERGREENComposite(PixmapPtr pDst, struct radeon_accel_state *accel_state = info->accel_state; float *vb; + srcX += info->accel_state->src_xoff; + srcY += info->accel_state->src_yoff; + maskX += info->accel_state->mask_xoff; + maskY += info->accel_state->mask_yoff; + dstX += info->accel_state->dst_xoff; + dstY += info->accel_state->dst_yoff; + if (accel_state->vsync) RADEONVlineHelperSet(pScrn, dstX, dstY, dstX + w, dstY + h); diff --git a/src/r600_exa.c b/src/r600_exa.c index ab5e33b..51e3bb4 100644 --- a/src/r600_exa.c +++ b/src/r600_exa.c @@ -1257,6 +1257,27 @@ static Bool R600PrepareComposite(int op, PicturePtr pSrcPicture, if (pDst->drawable.bitsPerPixel < 8 || pSrc->drawable.bitsPerPixel < 8) return FALSE; +#ifdef COMPOSITE + info->accel_state->dst_xoff = -pDst->screen_x + pDst->drawable.x; + info->accel_state->dst_yoff = -pDst->screen_y + pDst->drawable.y; + info->accel_state->src_xoff = -pSrc->screen_x + pSrc->drawable.x; + info->accel_state->src_yoff = -pSrc->screen_y + pSrc->drawable.y; + if (pMask) { + info->accel_state->mask_xoff = -pMask->screen_x + pMask->drawable.x; + info->accel_state->mask_yoff = -pMask->screen_y + pMask->drawable.y; + } else { + info->accel_state->mask_xoff = 0; + info->accel_state->mask_yoff = 0; + } +#else + info->accel_state->dst_xoff = 0; + info->accel_state->dst_yoff = 0; + info->accel_state->src_xoff = 0; + info->accel_state->src_yoff = 0; + info->accel_state->mask_xoff = 0; + info->accel_state->mask_yoff = 0; +#endif + #if defined(XF86DRM_MODE) if (info->cs) { src_obj.offset = 0; @@ -1470,6 +1491,13 @@ static void R600Composite(PixmapPtr pDst, struct radeon_accel_state *accel_state = info->accel_state; float *vb; + srcX += info->accel_state->src_xoff; + srcY += info->accel_state->src_yoff; + maskX += info->accel_state->mask_xoff; + maskY += info->accel_state->mask_yoff; + dstX += info->accel_state->dst_xoff; + dstY += info->accel_state->dst_yoff; + /* ErrorF("R600Composite (%d,%d) (%d,%d) (%d,%d) (%d,%d)\n", srcX, srcY, maskX, maskY,dstX, dstY, w, h); */ diff --git a/src/radeon.h b/src/radeon.h index 4c43717..846c525 100644 --- a/src/radeon.h +++ b/src/radeon.h @@ -734,6 +734,13 @@ struct radeon_accel_state { PixmapPtr dst_pix; PixmapPtr msk_pix; PixmapPtr src_pix; + /* drawable clipping */ + int src_xoff; + int src_yoff; + int mask_xoff; + int mask_yoff; + int dst_xoff; + int dst_yoff; Bool is_transform[2]; PictTransform *transform[2]; /* Whether we are tiling horizontally and vertically */ diff --git a/src/radeon_exa_render.c b/src/radeon_exa_render.c index 2e13b00..cf13352 100644 --- a/src/radeon_exa_render.c +++ b/src/radeon_exa_render.c @@ -590,7 +590,26 @@ RADEONPrepareCompositeCS(int op, PicturePtr pSrcPicture, PicturePtr pMaskPicture info->accel_state->dst_pix = pDst; info->accel_state->msk_pix = pMask; info->accel_state->src_pix = pSrc; - +#ifdef COMPOSITE + info->accel_state->dst_xoff = -pDst->screen_x + pDst->drawable.x; + info->accel_state->dst_yoff = -pDst->screen_y + pDst->drawable.y; + info->accel_state->src_xoff = -pSrc->screen_x + pSrc->drawable.x; + info->accel_state->src_yoff = -pSrc->screen_y + pSrc->drawable.y; + if (pMask) { + info->accel_state->mask_xoff = -pMask->screen_x + pMask->drawable.x; + info->accel_state->mask_yoff = -pMask->screen_y + pMask->drawable.y; + } else { + info->accel_state->mask_xoff = 0; + info->accel_state->mask_yoff = 0; + } +#else + info->accel_state->dst_xoff = 0; + info->accel_state->dst_yoff = 0; + info->accel_state->src_xoff = 0; + info->accel_state->src_yoff = 0; + info->accel_state->mask_xoff = 0; + info->accel_state->mask_yoff = 0; +#endif #ifdef XF86DRM_MODE if (info->cs) { int ret; @@ -2224,6 +2243,13 @@ static void FUNC_NAME(RadeonCompositeTile)(ScrnInfoPtr pScrn, static xPointFixed maskTopLeft, maskTopRight, maskBottomLeft, maskBottomRight; ACCEL_PREAMBLE(); + srcX += info->accel_state->src_xoff; + srcY += info->accel_state->src_yoff; + maskX += info->accel_state->mask_xoff; + maskY += info->accel_state->mask_yoff; + dstX += info->accel_state->dst_xoff; + dstY += info->accel_state->dst_yoff; + ENTER_DRAW(0); /* ErrorF("RadeonComposite (%d,%d) (%d,%d) (%d,%d) (%d,%d)\n", -- 1.7.1.1