summaryrefslogtreecommitdiff
path: root/src/sna/gen3_render.c
diff options
context:
space:
mode:
authorChris Wilson <chris@chris-wilson.co.uk>2013-03-04 10:10:39 +0000
committerChris Wilson <chris@chris-wilson.co.uk>2013-03-04 10:10:39 +0000
commit59f030dd27eff5fbf9ddcd22faa3087bc9c5ff54 (patch)
tree566769459ecca94c46bf39dce023650eea8ef757 /src/sna/gen3_render.c
parent48a733a35a2de36664a42384d066c06f54cf2ad7 (diff)
sna/gen3: Perform alpha-fixup upon copy sources
This is required for copying from depth-15 surfaces onto other depths. Reported-by: Reinis Danne Signed-off-by: Chris Wilson <chris@chris-wilson.co.uk>
Diffstat (limited to 'src/sna/gen3_render.c')
-rw-r--r--src/sna/gen3_render.c17
1 files changed, 15 insertions, 2 deletions
diff --git a/src/sna/gen3_render.c b/src/sna/gen3_render.c
index 68dcc72e..17b114de 100644
--- a/src/sna/gen3_render.c
+++ b/src/sna/gen3_render.c
@@ -5554,6 +5554,8 @@ gen3_render_copy_setup_source(struct sna_composite_channel *channel,
PixmapPtr pixmap,
struct kgem_bo *bo)
{
+ int i;
+
channel->u.gen3.type = SHADER_TEXTURE;
channel->filter = gen3_filter(PictFilterNearest);
channel->repeat = gen3_texture_repeat(RepeatNone);
@@ -5563,9 +5565,20 @@ gen3_render_copy_setup_source(struct sna_composite_channel *channel,
channel->scale[1] = 1.f/pixmap->drawable.height;
channel->offset[0] = 0;
channel->offset[1] = 0;
- gen3_composite_channel_set_format(channel,
- sna_format_for_depth(pixmap->drawable.depth));
+
+ channel->pict_format = sna_format_for_depth(pixmap->drawable.depth);
+ if (!gen3_composite_channel_set_format(channel, channel->pict_format)) {
+ for (i = 0; i < ARRAY_SIZE(gen3_tex_formats); i++) {
+ if (gen3_tex_formats[i].xfmt == channel->pict_format) {
+ channel->card_format = gen3_tex_formats[i].card_fmt;
+ channel->rb_reversed = gen3_tex_formats[i].rb_reversed;
+ channel->alpha_fixup = true;
+ break;
+ }
+ }
+ }
assert(channel->card_format);
+
channel->bo = bo;
channel->is_affine = 1;
}