i915: Derive the correct target color from the pixmap by checking its format
Particularly noting to route alpha to the green channel when blending with a8 destinations. Fixes: rendercheck/repeat/triangles regressed http://bugs.freedesktop.org/show_bug.cgi?id=25047 introduced with commit 14109a. Signed-off-by: Chris Wilson <chris@chris-wilson.co.uk>
This commit is contained in:
parent
e9064eacb0
commit
c180baf43b
|
|
@ -259,8 +259,8 @@ typedef struct intel_screen_private {
|
|||
|
||||
PixmapPtr render_source, render_mask, render_dest;
|
||||
PicturePtr render_source_picture, render_mask_picture, render_dest_picture;
|
||||
uint32_t render_source_solid;
|
||||
uint32_t render_mask_solid;
|
||||
CARD32 render_source_solid;
|
||||
CARD32 render_mask_solid;
|
||||
Bool render_source_is_solid;
|
||||
Bool render_mask_is_solid;
|
||||
Bool needs_render_state_emit;
|
||||
|
|
|
|||
|
|
@ -375,11 +375,23 @@ i915_prepare_composite(int op, PicturePtr source_picture,
|
|||
source_picture->pDrawable->width == 1 &&
|
||||
source_picture->pDrawable->height == 1 &&
|
||||
source_picture->repeat;
|
||||
if (intel->render_source_is_solid)
|
||||
intel->render_source_solid = uxa_get_pixmap_first_pixel(source);
|
||||
else if (!intel_check_pitch_3d(source))
|
||||
|
||||
if (intel->render_source_is_solid) {
|
||||
if (! uxa_get_color_for_pixmap (source,
|
||||
source_picture->format,
|
||||
PICT_a8r8g8b8,
|
||||
&intel->render_source_solid))
|
||||
return FALSE;
|
||||
|
||||
/* route alpha to the green channel when using a8 targets */
|
||||
if (dest_picture->format == PICT_a8) {
|
||||
intel->render_source_solid >>= 24;
|
||||
intel->render_source_solid *= 0x01010101;
|
||||
}
|
||||
} else if (!intel_check_pitch_3d(source))
|
||||
return FALSE;
|
||||
|
||||
|
||||
intel->render_mask_is_solid = TRUE; /* mask == NULL => opaque */
|
||||
if (mask) {
|
||||
intel->render_mask_is_solid =
|
||||
|
|
@ -387,9 +399,19 @@ i915_prepare_composite(int op, PicturePtr source_picture,
|
|||
mask_picture->pDrawable->width == 1 &&
|
||||
mask_picture->pDrawable->height == 1 &&
|
||||
mask_picture->repeat;
|
||||
if (intel->render_mask_is_solid)
|
||||
intel->render_mask_solid = uxa_get_pixmap_first_pixel(mask);
|
||||
else if (!intel_check_pitch_3d(mask))
|
||||
if (intel->render_mask_is_solid) {
|
||||
if (! uxa_get_color_for_pixmap (mask,
|
||||
mask_picture->format,
|
||||
PICT_a8r8g8b8,
|
||||
&intel->render_mask_solid))
|
||||
return FALSE;
|
||||
|
||||
/* route alpha to the green channel when using a8 targets */
|
||||
if (dest_picture->format == PICT_a8) {
|
||||
intel->render_mask_solid >>= 24;
|
||||
intel->render_mask_solid *= 0x01010101;
|
||||
}
|
||||
} else if (!intel_check_pitch_3d(mask))
|
||||
return FALSE;
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -230,6 +230,27 @@ uxa_get_rgba_from_pixel(CARD32 pixel,
|
|||
return TRUE;
|
||||
}
|
||||
|
||||
int
|
||||
uxa_get_color_for_pixmap (PixmapPtr pixmap,
|
||||
CARD32 src_format,
|
||||
CARD32 dst_format,
|
||||
CARD32 *pixel)
|
||||
{
|
||||
CARD16 red, green, blue, alpha;
|
||||
|
||||
*pixel = uxa_get_pixmap_first_pixel(pixmap);
|
||||
|
||||
if (!uxa_get_rgba_from_pixel(*pixel, &red, &green, &blue, &alpha,
|
||||
src_format))
|
||||
return 0;
|
||||
|
||||
if (!uxa_get_pixel_from_rgba(pixel, red, green, blue, alpha,
|
||||
dst_format))
|
||||
return 0;
|
||||
|
||||
return 1;
|
||||
}
|
||||
|
||||
static int
|
||||
uxa_try_driver_solid_fill(PicturePtr pSrc,
|
||||
PicturePtr pDst,
|
||||
|
|
@ -244,7 +265,6 @@ uxa_try_driver_solid_fill(PicturePtr pSrc,
|
|||
int dst_off_x, dst_off_y;
|
||||
PixmapPtr pSrcPix, pDstPix;
|
||||
CARD32 pixel;
|
||||
CARD16 red, green, blue, alpha;
|
||||
|
||||
pDstPix = uxa_get_drawable_pixmap(pDst->pDrawable);
|
||||
pSrcPix = uxa_get_drawable_pixmap(pSrc->pDrawable);
|
||||
|
|
@ -264,21 +284,12 @@ uxa_try_driver_solid_fill(PicturePtr pSrc,
|
|||
|
||||
REGION_TRANSLATE(pScreen, ®ion, dst_off_x, dst_off_y);
|
||||
|
||||
pixel = uxa_get_pixmap_first_pixel(pSrcPix);
|
||||
|
||||
if (!uxa_pixmap_is_offscreen(pDstPix)) {
|
||||
REGION_UNINIT(pDst->pDrawable->pScreen, ®ion);
|
||||
return 0;
|
||||
}
|
||||
|
||||
if (!uxa_get_rgba_from_pixel(pixel, &red, &green, &blue, &alpha,
|
||||
pSrc->format)) {
|
||||
REGION_UNINIT(pDst->pDrawable->pScreen, ®ion);
|
||||
return -1;
|
||||
}
|
||||
|
||||
if (!uxa_get_pixel_from_rgba(&pixel, red, green, blue, alpha,
|
||||
pDst->format)) {
|
||||
if (! uxa_get_color_for_pixmap (pSrcPix, pSrc->format, pDst->format, &pixel)) {
|
||||
REGION_UNINIT(pDst->pDrawable->pScreen, ®ion);
|
||||
return -1;
|
||||
}
|
||||
|
|
|
|||
|
|
@ -521,6 +521,12 @@ void uxa_driver_fini(ScreenPtr pScreen);
|
|||
|
||||
CARD32 uxa_get_pixmap_first_pixel(PixmapPtr pPixmap);
|
||||
|
||||
Bool
|
||||
uxa_get_color_for_pixmap (PixmapPtr pixmap,
|
||||
CARD32 src_format,
|
||||
CARD32 dst_format,
|
||||
CARD32 *pixel);
|
||||
|
||||
void uxa_set_fallback_debug(ScreenPtr screen, Bool enable);
|
||||
|
||||
/**
|
||||
|
|
|
|||
Loading…
Reference in New Issue