summaryrefslogtreecommitdiff
path: root/src/i915_render.c
diff options
context:
space:
mode:
authorChris Wilson <chris@chris-wilson.co.uk>2009-11-13 19:35:23 +0000
committerChris Wilson <chris@chris-wilson.co.uk>2009-11-13 20:20:52 +0000
commitc180baf43b8a0e407448018f3a7e42491cf974ae (patch)
treed9eb5d6fe15d123de83643b84fa08dfb849f6413 /src/i915_render.c
parente9064eacb0ad8867e320597453facbb3c376522c (diff)
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>
Diffstat (limited to 'src/i915_render.c')
-rw-r--r--src/i915_render.c34
1 files changed, 28 insertions, 6 deletions
diff --git a/src/i915_render.c b/src/i915_render.c
index f64e0316..c720f2f3 100644
--- a/src/i915_render.c
+++ b/src/i915_render.c
@@ -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;
}