diff options
author | Chris Wilson <chris@chris-wilson.co.uk> | 2010-05-11 11:26:33 +0100 |
---|---|---|
committer | Owain G. Ainsworth <oga@openbsd.org> | 2010-05-17 20:20:59 +0100 |
commit | 639728c14b2bf58032a2710cf0fb214204b83e27 (patch) | |
tree | 088aba5dd3e0b1bdf579226122b82749802b03f8 | |
parent | 4012acc43ea106ef8f64e59c7b3dd0739ace0af9 (diff) |
uxa: Recheck texture after acquiring pattern.
As the first step to handling unsupported texture formats, double check
that the converted pattern can be used as a texture by the card.
Fixes: rendercheck -t repeat
Signed-off-by: Chris Wilson <chris@chris-wilson.co.uk>
(cherry picked from commit a35afd4a2df8bab543700d874274228eddccae5b)
Signed-off-by: Owain G. Ainsworth <oga@openbsd.org>
-rw-r--r-- | uxa/uxa-render.c | 106 |
1 files changed, 57 insertions, 49 deletions
diff --git a/uxa/uxa-render.c b/uxa/uxa-render.c index e0581b07..2086ae5c 100644 --- a/uxa/uxa-render.c +++ b/uxa/uxa-render.c @@ -605,16 +605,13 @@ transform_is_integer_translation(PictTransformPtr t, int *tx, int *ty) static PicturePtr uxa_render_picture(ScreenPtr screen, PicturePtr src, + pixman_format_code_t format, INT16 x, INT16 y, CARD16 width, CARD16 height) { PicturePtr picture; - pixman_format_code_t format; int ret = 0; - format = src->format | - (BitsPerPixel(src->pDrawable->depth) << 24); - picture = uxa_picture_for_pixman_format(screen, format, width, height); if (!picture) return 0; @@ -653,7 +650,10 @@ uxa_acquire_drawable(ScreenPtr pScreen, depth = pSrc->pDrawable->depth; if (depth == 1 || !transform_is_integer_translation(pSrc->transform, &tx, &ty)) { /* XXX extract the sample extents and do the transformation on the GPU */ - pDst = uxa_render_picture(pScreen, pSrc, x, y, width, height); + pDst = uxa_render_picture(pScreen, pSrc, + pSrc->format | (BitsPerPixel(pSrc->pDrawable->depth) << 24), + x, y, width, height); + goto done; } else { if (width == pSrc->pDrawable->width && height == pSrc->pDrawable->depth) { @@ -698,67 +698,75 @@ done: } static PicturePtr -uxa_acquire_source(ScreenPtr pScreen, - PicturePtr pPict, - INT16 x, INT16 y, - CARD16 width, CARD16 height, - INT16 * out_x, INT16 * out_y) +uxa_acquire_picture(ScreenPtr screen, + PicturePtr src, + pixman_format_code_t format, + INT16 x, INT16 y, + CARD16 width, CARD16 height, + INT16 * out_x, INT16 * out_y) { - uxa_screen_t *uxa_screen = uxa_get_screen(pScreen); + uxa_screen_t *uxa_screen = uxa_get_screen(screen); if (uxa_screen->info->check_composite_texture && - uxa_screen->info->check_composite_texture(pScreen, pPict)) { - if (pPict->pDrawable) { - *out_x = x + pPict->pDrawable->x; - *out_y = y + pPict->pDrawable->y; + uxa_screen->info->check_composite_texture(screen, src)) { + if (src->pDrawable) { + *out_x = x + src->pDrawable->x; + *out_y = y + src->pDrawable->y; } else { *out_x = x; *out_y = y; } - return pPict; + return src; } - if (pPict->pDrawable) - return uxa_acquire_drawable(pScreen, pPict, - x, y, width, height, - out_x, out_y); + if (src->pDrawable) { + PicturePtr dst; + + dst = uxa_acquire_drawable(screen, src, + x, y, width, height, + out_x, out_y); + if (uxa_screen->info->check_composite_texture && + !uxa_screen->info->check_composite_texture(screen, dst)) { + if (dst != src) + FreePicture(dst, 0); + return 0; + } + + return dst; + } + + *out_x = x; + *out_y = y; + return uxa_acquire_pattern(screen, src, + format, x, y, width, height); +} - *out_x = 0; - *out_y = 0; - return uxa_acquire_pattern(pScreen, pPict, - PICT_a8r8g8b8, x, y, width, height); +static PicturePtr +uxa_acquire_source(ScreenPtr screen, + PicturePtr pict, + INT16 x, INT16 y, + CARD16 width, CARD16 height, + INT16 * out_x, INT16 * out_y) +{ + return uxa_acquire_picture (screen, pict, + PICT_a8r8g8b8, + x, y, + width, height, + out_x, out_y); } static PicturePtr -uxa_acquire_mask(ScreenPtr pScreen, - PicturePtr pPict, +uxa_acquire_mask(ScreenPtr screen, + PicturePtr pict, INT16 x, INT16 y, INT16 width, INT16 height, INT16 * out_x, INT16 * out_y) { - uxa_screen_t *uxa_screen = uxa_get_screen(pScreen); - - if (uxa_screen->info->check_composite_texture && - uxa_screen->info->check_composite_texture(pScreen, pPict)) { - if (pPict->pDrawable) { - *out_x = x + pPict->pDrawable->x; - *out_y = y + pPict->pDrawable->y; - } else { - *out_x = x; - *out_y = y; - } - return pPict; - } - - if (pPict->pDrawable) - return uxa_acquire_drawable(pScreen, pPict, - x, y, width, height, - out_x, out_y); - - *out_x = 0; - *out_y = 0; - return uxa_acquire_pattern(pScreen, pPict, - PICT_a8, x, y, width, height); + return uxa_acquire_picture (screen, pict, + PICT_a8, + x, y, + width, height, + out_x, out_y); } static int |