diff options
author | Chris Wilson <chris@chris-wilson.co.uk> | 2011-02-17 16:48:24 +0000 |
---|---|---|
committer | Owain G. Ainsworth <oga@openbsd.org> | 2011-03-16 20:17:55 +0000 |
commit | ac7ace08f2396c426cab4cc1a836b406eb272514 (patch) | |
tree | 297e22d059d669b99c8f4bcfa1a78eaaa20d642c | |
parent | 10fb2aa68e87c8d5ae5682a4fbeee482ddbb275b (diff) |
uxa: Fallback if the temporary is too large
If the render operation requires a temporary source Picture and the
operation is large, larger than the maximum permitted bo, then we will
fail to allocate the bo. In this case, we need to fallback and perform
the operation on the CPU rather than dereference a NULL bo.
Bugzilla: https://bugs.freedesktop.org/show_bug.cgi?id=34399
Signed-off-by: Chris Wilson <chris@chris-wilson.co.uk>
(cherry picked from commit 4c66b28870b050493ad96f7b0fe2d70d7ee539c7)
Signed-off-by: Owain G. Ainsworth <oga@openbsd.org>
-rw-r--r-- | uxa/uxa-render.c | 37 |
1 files changed, 21 insertions, 16 deletions
diff --git a/uxa/uxa-render.c b/uxa/uxa-render.c index 8756c0a8..ae049473 100644 --- a/uxa/uxa-render.c +++ b/uxa/uxa-render.c @@ -452,12 +452,12 @@ uxa_try_driver_solid_fill(PicturePtr pSrc, } static PicturePtr -uxa_picture_for_pixman_format(ScreenPtr pScreen, +uxa_picture_for_pixman_format(ScreenPtr screen, pixman_format_code_t format, int width, int height) { - PicturePtr pPicture; - PixmapPtr pPixmap; + PicturePtr picture; + PixmapPtr pixmap; int error; if (format == PIXMAN_a1) @@ -467,24 +467,29 @@ uxa_picture_for_pixman_format(ScreenPtr pScreen, if (PIXMAN_FORMAT_A(format) == 0) format = PIXMAN_a8r8g8b8; - pPixmap = (*pScreen->CreatePixmap)(pScreen, width, height, - PIXMAN_FORMAT_DEPTH(format), - UXA_CREATE_PIXMAP_FOR_MAP); - if (!pPixmap) + pixmap = screen->CreatePixmap(screen, width, height, + PIXMAN_FORMAT_DEPTH(format), + UXA_CREATE_PIXMAP_FOR_MAP); + if (!pixmap) return 0; - pPicture = CreatePicture(0, &pPixmap->drawable, - PictureMatchFormat(pScreen, - PIXMAN_FORMAT_DEPTH(format), - format), - 0, 0, serverClient, &error); - (*pScreen->DestroyPixmap) (pPixmap); - if (!pPicture) + if (!uxa_pixmap_is_offscreen(pixmap)) { + screen->DestroyPixmap(pixmap); + return 0; + } + + picture = CreatePicture(0, &pixmap->drawable, + PictureMatchFormat(screen, + PIXMAN_FORMAT_DEPTH(format), + format), + 0, 0, serverClient, &error); + screen->DestroyPixmap(pixmap); + if (!picture) return 0; - ValidatePicture(pPicture); + ValidatePicture(picture); - return pPicture; + return picture; } static PicturePtr |