diff options
author | Aaron Plattner <aplattner@nvidia.com> | 2010-05-28 09:35:54 -0700 |
---|---|---|
committer | Keith Packard <keithp@keithp.com> | 2010-06-02 21:02:48 -0700 |
commit | 1304b8b27cb12c803c4f51f04cb6f9d508b82c69 (patch) | |
tree | 38d7f863b7f5a3a7f70753ce3bd1b3d4f2d7569f | |
parent | 91a6359caf24d94343ff76f43ea7b7fc3223203d (diff) |
Fix pixmap validation in miDbePositionWindow.
miDbePositionWindow allocates two pixmaps: a front buffer, and a back buffer.
If the buffers are supposed to be initialized, it validates a GC against the
front buffer, then uses it to fill and/or copy both the front buffer *and* the
back buffer, without revalidating. If the acceleration architecture needs
different GC funcs for the two pixmaps -- for example if allocation of the front
buffer exhausted video memory -- then this can cause crashes because the GC is
not validated for the back buffer pixmap.
Fix this by performing the rendering for the front buffer first, then
revalidating against the back buffer before performing the back buffer
rendering.
Signed-off-by: Aaron Plattner <aplattner@nvidia.com>
Reviewed-by: Jamey Sharp <jamey@minilop.net>
Signed-off-by: Keith Packard <keithp@keithp.com>
-rw-r--r-- | dbe/midbe.c | 20 |
1 files changed, 14 insertions, 6 deletions
diff --git a/dbe/midbe.c b/dbe/midbe.c index e47a25355..49689c529 100644 --- a/dbe/midbe.c +++ b/dbe/midbe.c @@ -695,25 +695,33 @@ miDbePositionWindow(WindowPtr pWin, int x, int y) pDbeWindowPrivPriv = MI_DBE_WINDOW_PRIV_PRIV(pDbeWindowPriv); - ValidateGC((DrawablePtr)pFrontBuffer, pGC); /* I suppose this could avoid quite a bit of work if * it computed the minimal area required. */ + ValidateGC(&pFrontBuffer->drawable, pGC); if (clear) { (*pGC->ops->PolyFillRect)((DrawablePtr)pFrontBuffer, pGC, 1, &clearRect); - (*pGC->ops->PolyFillRect)((DrawablePtr)pBackBuffer , pGC, 1, - &clearRect); - } - - /* Copy the contents of the old DBE pixmaps to the new pixmaps. */ + } + /* Copy the contents of the old front pixmap to the new one. */ if (pWin->bitGravity != ForgetGravity) { (*pGC->ops->CopyArea)((DrawablePtr)pDbeWindowPrivPriv->pFrontBuffer, (DrawablePtr)pFrontBuffer, pGC, sourcex, sourcey, savewidth, saveheight, destx, desty); + } + + ValidateGC(&pBackBuffer->drawable, pGC); + if (clear) + { + (*pGC->ops->PolyFillRect)((DrawablePtr)pBackBuffer , pGC, 1, + &clearRect); + } + /* Copy the contents of the old back pixmap to the new one. */ + if (pWin->bitGravity != ForgetGravity) + { (*pGC->ops->CopyArea)((DrawablePtr)pDbeWindowPrivPriv->pBackBuffer, (DrawablePtr)pBackBuffer, pGC, sourcex, sourcey, savewidth, saveheight, destx, desty); |