From 0c74799af4f924ba64ebd6052802b73547f55c72 Mon Sep 17 00:00:00 2001 From: Eric Anholt Date: Tue, 30 Aug 2005 04:41:04 +0000 Subject: [PATCH] Remove existing broken maxX/maxY code for composite (results in infinite loops, doesn't deal with failure, doesn't present the interface to drivers that I expected) and instead replace it with a simple fallback to software when coordinate limits could be violated. Act similarly in other acceleration cases as well. The solution I want to see (and intend to do soon) is to (when necessary) create temporary pictures/pixmaps pointing towards the real ones' bits, with the offsets adjusted, then render from/to those using adjusted coordinates. --- exa/exa.c | 29 ++++++++++++++- exa/exa_accel.c | 29 ++++++++++++++- exa/exa_migration.c | 29 ++++++++++++++- exa/exa_render.c | 67 ++++++---------------------------- hw/xfree86/exa/exa.c | 29 ++++++++++++++- hw/xfree86/exa/exa_accel.c | 29 ++++++++++++++- hw/xfree86/exa/exa_migration.c | 29 ++++++++++++++- hw/xfree86/exa/exa_render.c | 67 ++++++---------------------------- hw/xfree86/exa/exapict.c | 67 ++++++---------------------------- 9 files changed, 201 insertions(+), 174 deletions(-) diff --git a/exa/exa.c b/exa/exa.c index 9c608d6ab..29a94b31d 100644 --- a/exa/exa.c +++ b/exa/exa.c @@ -517,6 +517,8 @@ exaFillSpans(DrawablePtr pDrawable, GCPtr pGC, int n, STRACE; if (pGC->fillStyle != FillSolid || + pDrawable->width > pExaScr->info->card.maxX || + pDrawable->height > pExaScr->info->card.maxY || !(pPixmap = exaGetOffscreenPixmap (pDrawable, &off_x, &off_y)) || !(*pExaScr->info->accel.PrepareSolid) (pPixmap, pGC->alu, @@ -605,6 +607,25 @@ exaCopyNtoN (DrawablePtr pSrcDrawable, int dst_off_x, dst_off_y; STRACE; + /* Respect maxX/maxY in a trivial way: don't set up drawing when we might + * violate the limits. The proper solution would be a temporary pixmap + * adjusted so that the drawing happened within limits. + */ + if (pSrcDrawable->width > pExaScr->info->card.maxX || + pSrcDrawable->height > pExaScr->info->card.maxY || + pDstDrawable->width > pExaScr->info->card.maxX || + pDstDrawable->height > pExaScr->info->card.maxY) + { + if (pSrcDrawable->type == DRAWABLE_PIXMAP) + exaPixmapUseMemory ((PixmapPtr) pSrcDrawable); + if (pDstDrawable->type == DRAWABLE_PIXMAP) + exaPixmapUseMemory ((PixmapPtr) pDstDrawable); + exaWaitSync (pDstDrawable->pScreen); + fbCopyNtoN (pSrcDrawable, pDstDrawable, pGC, + pbox, nbox, dx, dy, reverse, upsidedown, + bitplane, closure); + } + /* If either drawable is already in framebuffer, try to get both of them * there. Otherwise, be happy with where they are. */ @@ -691,6 +712,8 @@ exaPolyFillRect(DrawablePtr pDrawable, STRACE; if (!pScrn->vtSema || pGC->fillStyle != FillSolid || + pDrawable->width > pExaScr->info->card.maxX || + pDrawable->height > pExaScr->info->card.maxY || !(pPixmap = exaGetOffscreenPixmap (pDrawable, &xoff, &yoff)) || !(*pExaScr->info->accel.PrepareSolid) (pPixmap, pGC->alu, @@ -794,6 +817,8 @@ exaSolidBoxClipped (DrawablePtr pDrawable, STRACE; if (!pScrn->vtSema || + pDrawable->width > pExaScr->info->card.maxX || + pDrawable->height > pExaScr->info->card.maxY || !(pPixmap = exaGetOffscreenPixmap (pDrawable, &xoff, &yoff)) || !(*pExaScr->info->accel.PrepareSolid) (pPixmap, GXcopy, pm, fg)) { @@ -1079,7 +1104,9 @@ exaFillRegionSolid (DrawablePtr pDrawable, int xoff, yoff; STRACE; - if ((pPixmap = exaGetOffscreenPixmap (pDrawable, &xoff, &yoff)) && + if (pDrawable->width <= pExaScr->info->card.maxX && + pDrawable->height <= pExaScr->info->card.maxY && + (pPixmap = exaGetOffscreenPixmap (pDrawable, &xoff, &yoff)) && (*pExaScr->info->accel.PrepareSolid) (pPixmap, GXcopy, FB_ALLONES, pixel)) { int nbox = REGION_NUM_RECTS (pRegion); diff --git a/exa/exa_accel.c b/exa/exa_accel.c index 9c608d6ab..29a94b31d 100644 --- a/exa/exa_accel.c +++ b/exa/exa_accel.c @@ -517,6 +517,8 @@ exaFillSpans(DrawablePtr pDrawable, GCPtr pGC, int n, STRACE; if (pGC->fillStyle != FillSolid || + pDrawable->width > pExaScr->info->card.maxX || + pDrawable->height > pExaScr->info->card.maxY || !(pPixmap = exaGetOffscreenPixmap (pDrawable, &off_x, &off_y)) || !(*pExaScr->info->accel.PrepareSolid) (pPixmap, pGC->alu, @@ -605,6 +607,25 @@ exaCopyNtoN (DrawablePtr pSrcDrawable, int dst_off_x, dst_off_y; STRACE; + /* Respect maxX/maxY in a trivial way: don't set up drawing when we might + * violate the limits. The proper solution would be a temporary pixmap + * adjusted so that the drawing happened within limits. + */ + if (pSrcDrawable->width > pExaScr->info->card.maxX || + pSrcDrawable->height > pExaScr->info->card.maxY || + pDstDrawable->width > pExaScr->info->card.maxX || + pDstDrawable->height > pExaScr->info->card.maxY) + { + if (pSrcDrawable->type == DRAWABLE_PIXMAP) + exaPixmapUseMemory ((PixmapPtr) pSrcDrawable); + if (pDstDrawable->type == DRAWABLE_PIXMAP) + exaPixmapUseMemory ((PixmapPtr) pDstDrawable); + exaWaitSync (pDstDrawable->pScreen); + fbCopyNtoN (pSrcDrawable, pDstDrawable, pGC, + pbox, nbox, dx, dy, reverse, upsidedown, + bitplane, closure); + } + /* If either drawable is already in framebuffer, try to get both of them * there. Otherwise, be happy with where they are. */ @@ -691,6 +712,8 @@ exaPolyFillRect(DrawablePtr pDrawable, STRACE; if (!pScrn->vtSema || pGC->fillStyle != FillSolid || + pDrawable->width > pExaScr->info->card.maxX || + pDrawable->height > pExaScr->info->card.maxY || !(pPixmap = exaGetOffscreenPixmap (pDrawable, &xoff, &yoff)) || !(*pExaScr->info->accel.PrepareSolid) (pPixmap, pGC->alu, @@ -794,6 +817,8 @@ exaSolidBoxClipped (DrawablePtr pDrawable, STRACE; if (!pScrn->vtSema || + pDrawable->width > pExaScr->info->card.maxX || + pDrawable->height > pExaScr->info->card.maxY || !(pPixmap = exaGetOffscreenPixmap (pDrawable, &xoff, &yoff)) || !(*pExaScr->info->accel.PrepareSolid) (pPixmap, GXcopy, pm, fg)) { @@ -1079,7 +1104,9 @@ exaFillRegionSolid (DrawablePtr pDrawable, int xoff, yoff; STRACE; - if ((pPixmap = exaGetOffscreenPixmap (pDrawable, &xoff, &yoff)) && + if (pDrawable->width <= pExaScr->info->card.maxX && + pDrawable->height <= pExaScr->info->card.maxY && + (pPixmap = exaGetOffscreenPixmap (pDrawable, &xoff, &yoff)) && (*pExaScr->info->accel.PrepareSolid) (pPixmap, GXcopy, FB_ALLONES, pixel)) { int nbox = REGION_NUM_RECTS (pRegion); diff --git a/exa/exa_migration.c b/exa/exa_migration.c index 9c608d6ab..29a94b31d 100644 --- a/exa/exa_migration.c +++ b/exa/exa_migration.c @@ -517,6 +517,8 @@ exaFillSpans(DrawablePtr pDrawable, GCPtr pGC, int n, STRACE; if (pGC->fillStyle != FillSolid || + pDrawable->width > pExaScr->info->card.maxX || + pDrawable->height > pExaScr->info->card.maxY || !(pPixmap = exaGetOffscreenPixmap (pDrawable, &off_x, &off_y)) || !(*pExaScr->info->accel.PrepareSolid) (pPixmap, pGC->alu, @@ -605,6 +607,25 @@ exaCopyNtoN (DrawablePtr pSrcDrawable, int dst_off_x, dst_off_y; STRACE; + /* Respect maxX/maxY in a trivial way: don't set up drawing when we might + * violate the limits. The proper solution would be a temporary pixmap + * adjusted so that the drawing happened within limits. + */ + if (pSrcDrawable->width > pExaScr->info->card.maxX || + pSrcDrawable->height > pExaScr->info->card.maxY || + pDstDrawable->width > pExaScr->info->card.maxX || + pDstDrawable->height > pExaScr->info->card.maxY) + { + if (pSrcDrawable->type == DRAWABLE_PIXMAP) + exaPixmapUseMemory ((PixmapPtr) pSrcDrawable); + if (pDstDrawable->type == DRAWABLE_PIXMAP) + exaPixmapUseMemory ((PixmapPtr) pDstDrawable); + exaWaitSync (pDstDrawable->pScreen); + fbCopyNtoN (pSrcDrawable, pDstDrawable, pGC, + pbox, nbox, dx, dy, reverse, upsidedown, + bitplane, closure); + } + /* If either drawable is already in framebuffer, try to get both of them * there. Otherwise, be happy with where they are. */ @@ -691,6 +712,8 @@ exaPolyFillRect(DrawablePtr pDrawable, STRACE; if (!pScrn->vtSema || pGC->fillStyle != FillSolid || + pDrawable->width > pExaScr->info->card.maxX || + pDrawable->height > pExaScr->info->card.maxY || !(pPixmap = exaGetOffscreenPixmap (pDrawable, &xoff, &yoff)) || !(*pExaScr->info->accel.PrepareSolid) (pPixmap, pGC->alu, @@ -794,6 +817,8 @@ exaSolidBoxClipped (DrawablePtr pDrawable, STRACE; if (!pScrn->vtSema || + pDrawable->width > pExaScr->info->card.maxX || + pDrawable->height > pExaScr->info->card.maxY || !(pPixmap = exaGetOffscreenPixmap (pDrawable, &xoff, &yoff)) || !(*pExaScr->info->accel.PrepareSolid) (pPixmap, GXcopy, pm, fg)) { @@ -1079,7 +1104,9 @@ exaFillRegionSolid (DrawablePtr pDrawable, int xoff, yoff; STRACE; - if ((pPixmap = exaGetOffscreenPixmap (pDrawable, &xoff, &yoff)) && + if (pDrawable->width <= pExaScr->info->card.maxX && + pDrawable->height <= pExaScr->info->card.maxY && + (pPixmap = exaGetOffscreenPixmap (pDrawable, &xoff, &yoff)) && (*pExaScr->info->accel.PrepareSolid) (pPixmap, GXcopy, FB_ALLONES, pixel)) { int nbox = REGION_NUM_RECTS (pRegion); diff --git a/exa/exa_render.c b/exa/exa_render.c index 438c876e8..9909d7f46 100644 --- a/exa/exa_render.c +++ b/exa/exa_render.c @@ -327,65 +327,20 @@ exaTryDriverComposite(CARD8 op, PixmapPtr pSrcPix, pMaskPix = NULL, pDstPix; struct _Pixmap scratch; - if (pExaScr->info->card.maxX < width || - pExaScr->info->card.maxY < height) + /* Bail if we might exceed coord limits by rendering from/to these. We + * should really be making some scratch pixmaps with offsets and coords + * adjusted to deal with this, but it hasn't been done yet. + */ + if (pSrc->pDrawable->width > pExaScr->info->card.maxX || + pSrc->pDrawable->height > pExaScr->info->card.maxY || + pDst->pDrawable->width > pExaScr->info->card.maxX || + pDst->pDrawable->height > pExaScr->info->card.maxY || + (pMask && (pMask->pDrawable->width > pExaScr->info->card.maxX || + pMask->pDrawable->height > pExaScr->info->card.maxY))) { - int total_width = width; - int total_height = height; - int xOff = 0; - int yOff = 0; - while (total_width > pExaScr->info->card.maxX) { - while (total_height > pExaScr->info->card.maxY) { - exaTryDriverComposite(op, - pSrc, - pMask, - pDst, - xSrc + xOff, - ySrc + yOff, - xMask + xOff, - yMask + yOff, - xDst + xOff, - yDst + yOff, - pExaScr->info->card.maxX, - pExaScr->info->card.maxY); - total_width -= pExaScr->info->card.maxX; - xOff += pExaScr->info->card.maxX; - yOff = 0; - } - if (total_height) - exaTryDriverComposite(op, - pSrc, - pMask, - pDst, - xSrc + xOff, - ySrc + yOff, - xMask + xOff, - yMask + yOff, - xDst + xOff, - yDst + yOff, - pExaScr->info->card.maxX, - total_height); - total_height -= pExaScr->info->card.maxY; - yOff += pExaScr->info->card.maxY; - } - if (total_width && total_height) - exaTryDriverComposite(op, - pSrc, - pMask, - pDst, - xSrc + xOff, - ySrc + yOff, - xMask + xOff, - yMask + yOff, - xDst + xOff, - yDst + yOff, - total_width, - total_height); - - return -1; + return -1; } - xDst += pDst->pDrawable->x; yDst += pDst->pDrawable->y; diff --git a/hw/xfree86/exa/exa.c b/hw/xfree86/exa/exa.c index 9c608d6ab..29a94b31d 100644 --- a/hw/xfree86/exa/exa.c +++ b/hw/xfree86/exa/exa.c @@ -517,6 +517,8 @@ exaFillSpans(DrawablePtr pDrawable, GCPtr pGC, int n, STRACE; if (pGC->fillStyle != FillSolid || + pDrawable->width > pExaScr->info->card.maxX || + pDrawable->height > pExaScr->info->card.maxY || !(pPixmap = exaGetOffscreenPixmap (pDrawable, &off_x, &off_y)) || !(*pExaScr->info->accel.PrepareSolid) (pPixmap, pGC->alu, @@ -605,6 +607,25 @@ exaCopyNtoN (DrawablePtr pSrcDrawable, int dst_off_x, dst_off_y; STRACE; + /* Respect maxX/maxY in a trivial way: don't set up drawing when we might + * violate the limits. The proper solution would be a temporary pixmap + * adjusted so that the drawing happened within limits. + */ + if (pSrcDrawable->width > pExaScr->info->card.maxX || + pSrcDrawable->height > pExaScr->info->card.maxY || + pDstDrawable->width > pExaScr->info->card.maxX || + pDstDrawable->height > pExaScr->info->card.maxY) + { + if (pSrcDrawable->type == DRAWABLE_PIXMAP) + exaPixmapUseMemory ((PixmapPtr) pSrcDrawable); + if (pDstDrawable->type == DRAWABLE_PIXMAP) + exaPixmapUseMemory ((PixmapPtr) pDstDrawable); + exaWaitSync (pDstDrawable->pScreen); + fbCopyNtoN (pSrcDrawable, pDstDrawable, pGC, + pbox, nbox, dx, dy, reverse, upsidedown, + bitplane, closure); + } + /* If either drawable is already in framebuffer, try to get both of them * there. Otherwise, be happy with where they are. */ @@ -691,6 +712,8 @@ exaPolyFillRect(DrawablePtr pDrawable, STRACE; if (!pScrn->vtSema || pGC->fillStyle != FillSolid || + pDrawable->width > pExaScr->info->card.maxX || + pDrawable->height > pExaScr->info->card.maxY || !(pPixmap = exaGetOffscreenPixmap (pDrawable, &xoff, &yoff)) || !(*pExaScr->info->accel.PrepareSolid) (pPixmap, pGC->alu, @@ -794,6 +817,8 @@ exaSolidBoxClipped (DrawablePtr pDrawable, STRACE; if (!pScrn->vtSema || + pDrawable->width > pExaScr->info->card.maxX || + pDrawable->height > pExaScr->info->card.maxY || !(pPixmap = exaGetOffscreenPixmap (pDrawable, &xoff, &yoff)) || !(*pExaScr->info->accel.PrepareSolid) (pPixmap, GXcopy, pm, fg)) { @@ -1079,7 +1104,9 @@ exaFillRegionSolid (DrawablePtr pDrawable, int xoff, yoff; STRACE; - if ((pPixmap = exaGetOffscreenPixmap (pDrawable, &xoff, &yoff)) && + if (pDrawable->width <= pExaScr->info->card.maxX && + pDrawable->height <= pExaScr->info->card.maxY && + (pPixmap = exaGetOffscreenPixmap (pDrawable, &xoff, &yoff)) && (*pExaScr->info->accel.PrepareSolid) (pPixmap, GXcopy, FB_ALLONES, pixel)) { int nbox = REGION_NUM_RECTS (pRegion); diff --git a/hw/xfree86/exa/exa_accel.c b/hw/xfree86/exa/exa_accel.c index 9c608d6ab..29a94b31d 100644 --- a/hw/xfree86/exa/exa_accel.c +++ b/hw/xfree86/exa/exa_accel.c @@ -517,6 +517,8 @@ exaFillSpans(DrawablePtr pDrawable, GCPtr pGC, int n, STRACE; if (pGC->fillStyle != FillSolid || + pDrawable->width > pExaScr->info->card.maxX || + pDrawable->height > pExaScr->info->card.maxY || !(pPixmap = exaGetOffscreenPixmap (pDrawable, &off_x, &off_y)) || !(*pExaScr->info->accel.PrepareSolid) (pPixmap, pGC->alu, @@ -605,6 +607,25 @@ exaCopyNtoN (DrawablePtr pSrcDrawable, int dst_off_x, dst_off_y; STRACE; + /* Respect maxX/maxY in a trivial way: don't set up drawing when we might + * violate the limits. The proper solution would be a temporary pixmap + * adjusted so that the drawing happened within limits. + */ + if (pSrcDrawable->width > pExaScr->info->card.maxX || + pSrcDrawable->height > pExaScr->info->card.maxY || + pDstDrawable->width > pExaScr->info->card.maxX || + pDstDrawable->height > pExaScr->info->card.maxY) + { + if (pSrcDrawable->type == DRAWABLE_PIXMAP) + exaPixmapUseMemory ((PixmapPtr) pSrcDrawable); + if (pDstDrawable->type == DRAWABLE_PIXMAP) + exaPixmapUseMemory ((PixmapPtr) pDstDrawable); + exaWaitSync (pDstDrawable->pScreen); + fbCopyNtoN (pSrcDrawable, pDstDrawable, pGC, + pbox, nbox, dx, dy, reverse, upsidedown, + bitplane, closure); + } + /* If either drawable is already in framebuffer, try to get both of them * there. Otherwise, be happy with where they are. */ @@ -691,6 +712,8 @@ exaPolyFillRect(DrawablePtr pDrawable, STRACE; if (!pScrn->vtSema || pGC->fillStyle != FillSolid || + pDrawable->width > pExaScr->info->card.maxX || + pDrawable->height > pExaScr->info->card.maxY || !(pPixmap = exaGetOffscreenPixmap (pDrawable, &xoff, &yoff)) || !(*pExaScr->info->accel.PrepareSolid) (pPixmap, pGC->alu, @@ -794,6 +817,8 @@ exaSolidBoxClipped (DrawablePtr pDrawable, STRACE; if (!pScrn->vtSema || + pDrawable->width > pExaScr->info->card.maxX || + pDrawable->height > pExaScr->info->card.maxY || !(pPixmap = exaGetOffscreenPixmap (pDrawable, &xoff, &yoff)) || !(*pExaScr->info->accel.PrepareSolid) (pPixmap, GXcopy, pm, fg)) { @@ -1079,7 +1104,9 @@ exaFillRegionSolid (DrawablePtr pDrawable, int xoff, yoff; STRACE; - if ((pPixmap = exaGetOffscreenPixmap (pDrawable, &xoff, &yoff)) && + if (pDrawable->width <= pExaScr->info->card.maxX && + pDrawable->height <= pExaScr->info->card.maxY && + (pPixmap = exaGetOffscreenPixmap (pDrawable, &xoff, &yoff)) && (*pExaScr->info->accel.PrepareSolid) (pPixmap, GXcopy, FB_ALLONES, pixel)) { int nbox = REGION_NUM_RECTS (pRegion); diff --git a/hw/xfree86/exa/exa_migration.c b/hw/xfree86/exa/exa_migration.c index 9c608d6ab..29a94b31d 100644 --- a/hw/xfree86/exa/exa_migration.c +++ b/hw/xfree86/exa/exa_migration.c @@ -517,6 +517,8 @@ exaFillSpans(DrawablePtr pDrawable, GCPtr pGC, int n, STRACE; if (pGC->fillStyle != FillSolid || + pDrawable->width > pExaScr->info->card.maxX || + pDrawable->height > pExaScr->info->card.maxY || !(pPixmap = exaGetOffscreenPixmap (pDrawable, &off_x, &off_y)) || !(*pExaScr->info->accel.PrepareSolid) (pPixmap, pGC->alu, @@ -605,6 +607,25 @@ exaCopyNtoN (DrawablePtr pSrcDrawable, int dst_off_x, dst_off_y; STRACE; + /* Respect maxX/maxY in a trivial way: don't set up drawing when we might + * violate the limits. The proper solution would be a temporary pixmap + * adjusted so that the drawing happened within limits. + */ + if (pSrcDrawable->width > pExaScr->info->card.maxX || + pSrcDrawable->height > pExaScr->info->card.maxY || + pDstDrawable->width > pExaScr->info->card.maxX || + pDstDrawable->height > pExaScr->info->card.maxY) + { + if (pSrcDrawable->type == DRAWABLE_PIXMAP) + exaPixmapUseMemory ((PixmapPtr) pSrcDrawable); + if (pDstDrawable->type == DRAWABLE_PIXMAP) + exaPixmapUseMemory ((PixmapPtr) pDstDrawable); + exaWaitSync (pDstDrawable->pScreen); + fbCopyNtoN (pSrcDrawable, pDstDrawable, pGC, + pbox, nbox, dx, dy, reverse, upsidedown, + bitplane, closure); + } + /* If either drawable is already in framebuffer, try to get both of them * there. Otherwise, be happy with where they are. */ @@ -691,6 +712,8 @@ exaPolyFillRect(DrawablePtr pDrawable, STRACE; if (!pScrn->vtSema || pGC->fillStyle != FillSolid || + pDrawable->width > pExaScr->info->card.maxX || + pDrawable->height > pExaScr->info->card.maxY || !(pPixmap = exaGetOffscreenPixmap (pDrawable, &xoff, &yoff)) || !(*pExaScr->info->accel.PrepareSolid) (pPixmap, pGC->alu, @@ -794,6 +817,8 @@ exaSolidBoxClipped (DrawablePtr pDrawable, STRACE; if (!pScrn->vtSema || + pDrawable->width > pExaScr->info->card.maxX || + pDrawable->height > pExaScr->info->card.maxY || !(pPixmap = exaGetOffscreenPixmap (pDrawable, &xoff, &yoff)) || !(*pExaScr->info->accel.PrepareSolid) (pPixmap, GXcopy, pm, fg)) { @@ -1079,7 +1104,9 @@ exaFillRegionSolid (DrawablePtr pDrawable, int xoff, yoff; STRACE; - if ((pPixmap = exaGetOffscreenPixmap (pDrawable, &xoff, &yoff)) && + if (pDrawable->width <= pExaScr->info->card.maxX && + pDrawable->height <= pExaScr->info->card.maxY && + (pPixmap = exaGetOffscreenPixmap (pDrawable, &xoff, &yoff)) && (*pExaScr->info->accel.PrepareSolid) (pPixmap, GXcopy, FB_ALLONES, pixel)) { int nbox = REGION_NUM_RECTS (pRegion); diff --git a/hw/xfree86/exa/exa_render.c b/hw/xfree86/exa/exa_render.c index 438c876e8..9909d7f46 100644 --- a/hw/xfree86/exa/exa_render.c +++ b/hw/xfree86/exa/exa_render.c @@ -327,65 +327,20 @@ exaTryDriverComposite(CARD8 op, PixmapPtr pSrcPix, pMaskPix = NULL, pDstPix; struct _Pixmap scratch; - if (pExaScr->info->card.maxX < width || - pExaScr->info->card.maxY < height) + /* Bail if we might exceed coord limits by rendering from/to these. We + * should really be making some scratch pixmaps with offsets and coords + * adjusted to deal with this, but it hasn't been done yet. + */ + if (pSrc->pDrawable->width > pExaScr->info->card.maxX || + pSrc->pDrawable->height > pExaScr->info->card.maxY || + pDst->pDrawable->width > pExaScr->info->card.maxX || + pDst->pDrawable->height > pExaScr->info->card.maxY || + (pMask && (pMask->pDrawable->width > pExaScr->info->card.maxX || + pMask->pDrawable->height > pExaScr->info->card.maxY))) { - int total_width = width; - int total_height = height; - int xOff = 0; - int yOff = 0; - while (total_width > pExaScr->info->card.maxX) { - while (total_height > pExaScr->info->card.maxY) { - exaTryDriverComposite(op, - pSrc, - pMask, - pDst, - xSrc + xOff, - ySrc + yOff, - xMask + xOff, - yMask + yOff, - xDst + xOff, - yDst + yOff, - pExaScr->info->card.maxX, - pExaScr->info->card.maxY); - total_width -= pExaScr->info->card.maxX; - xOff += pExaScr->info->card.maxX; - yOff = 0; - } - if (total_height) - exaTryDriverComposite(op, - pSrc, - pMask, - pDst, - xSrc + xOff, - ySrc + yOff, - xMask + xOff, - yMask + yOff, - xDst + xOff, - yDst + yOff, - pExaScr->info->card.maxX, - total_height); - total_height -= pExaScr->info->card.maxY; - yOff += pExaScr->info->card.maxY; - } - if (total_width && total_height) - exaTryDriverComposite(op, - pSrc, - pMask, - pDst, - xSrc + xOff, - ySrc + yOff, - xMask + xOff, - yMask + yOff, - xDst + xOff, - yDst + yOff, - total_width, - total_height); - - return -1; + return -1; } - xDst += pDst->pDrawable->x; yDst += pDst->pDrawable->y; diff --git a/hw/xfree86/exa/exapict.c b/hw/xfree86/exa/exapict.c index 438c876e8..9909d7f46 100644 --- a/hw/xfree86/exa/exapict.c +++ b/hw/xfree86/exa/exapict.c @@ -327,65 +327,20 @@ exaTryDriverComposite(CARD8 op, PixmapPtr pSrcPix, pMaskPix = NULL, pDstPix; struct _Pixmap scratch; - if (pExaScr->info->card.maxX < width || - pExaScr->info->card.maxY < height) + /* Bail if we might exceed coord limits by rendering from/to these. We + * should really be making some scratch pixmaps with offsets and coords + * adjusted to deal with this, but it hasn't been done yet. + */ + if (pSrc->pDrawable->width > pExaScr->info->card.maxX || + pSrc->pDrawable->height > pExaScr->info->card.maxY || + pDst->pDrawable->width > pExaScr->info->card.maxX || + pDst->pDrawable->height > pExaScr->info->card.maxY || + (pMask && (pMask->pDrawable->width > pExaScr->info->card.maxX || + pMask->pDrawable->height > pExaScr->info->card.maxY))) { - int total_width = width; - int total_height = height; - int xOff = 0; - int yOff = 0; - while (total_width > pExaScr->info->card.maxX) { - while (total_height > pExaScr->info->card.maxY) { - exaTryDriverComposite(op, - pSrc, - pMask, - pDst, - xSrc + xOff, - ySrc + yOff, - xMask + xOff, - yMask + yOff, - xDst + xOff, - yDst + yOff, - pExaScr->info->card.maxX, - pExaScr->info->card.maxY); - total_width -= pExaScr->info->card.maxX; - xOff += pExaScr->info->card.maxX; - yOff = 0; - } - if (total_height) - exaTryDriverComposite(op, - pSrc, - pMask, - pDst, - xSrc + xOff, - ySrc + yOff, - xMask + xOff, - yMask + yOff, - xDst + xOff, - yDst + yOff, - pExaScr->info->card.maxX, - total_height); - total_height -= pExaScr->info->card.maxY; - yOff += pExaScr->info->card.maxY; - } - if (total_width && total_height) - exaTryDriverComposite(op, - pSrc, - pMask, - pDst, - xSrc + xOff, - ySrc + yOff, - xMask + xOff, - yMask + yOff, - xDst + xOff, - yDst + yOff, - total_width, - total_height); - - return -1; + return -1; } - xDst += pDst->pDrawable->x; yDst += pDst->pDrawable->y;