diff options
author | Chris Wilson <chris@chris-wilson.co.uk> | 2011-11-03 19:27:23 +0000 |
---|---|---|
committer | Chris Wilson <chris@chris-wilson.co.uk> | 2011-11-03 20:40:07 +0000 |
commit | a1b40a20bbba4b70990a8983a2916d3d5850d828 (patch) | |
tree | 3c7f77e5d2f4f8967eb74cb3476fcb110b14520a /src/sna/gen7_render.c | |
parent | 31c5eb8e906bf8e59743372edb2d703b50cd311e (diff) |
sna: Support binding of a bo for multiple formats
Applications may use the same pixmap with multiple formats within the
same operation. For instance, you can premultiply and composite a normal
pixmap in this manner. However, as we reused the sampler binding
locations of the source (without an alpha channel) for the mask, we
failed to read and multiply by the alpha channel causing it to remain
black instead of transparent.
Bugzilla: https://bugs.freedesktop.org/show_bug.cgi?id=40926
Signed-off-by: Chris Wilson <chris@chris-wilson.co.uk>
Diffstat (limited to 'src/sna/gen7_render.c')
-rw-r--r-- | src/sna/gen7_render.c | 38 |
1 files changed, 7 insertions, 31 deletions
diff --git a/src/sna/gen7_render.c b/src/sna/gen7_render.c index 3be87b71..ba6e9d54 100644 --- a/src/sna/gen7_render.c +++ b/src/sna/gen7_render.c @@ -342,22 +342,6 @@ static uint32_t gen7_get_card_format_for_depth(int depth) } } -static bool gen7_format_is_dst(uint32_t format) -{ - switch (format) { - case GEN7_SURFACEFORMAT_B8G8R8A8_UNORM: - case GEN7_SURFACEFORMAT_R8G8B8A8_UNORM: - case GEN7_SURFACEFORMAT_B10G10R10A2_UNORM: - case GEN7_SURFACEFORMAT_B5G6R5_UNORM: - case GEN7_SURFACEFORMAT_B5G5R5A1_UNORM: - case GEN7_SURFACEFORMAT_A8_UNORM: - case GEN7_SURFACEFORMAT_B4G4R4A4_UNORM: - return true; - default: - return false; - } -} - static uint32_t gen7_filter(uint32_t filter) { switch (filter) { @@ -1208,26 +1192,16 @@ gen7_bind_bo(struct sna *sna, if (is_dst) { domains = I915_GEM_DOMAIN_RENDER << 16 |I915_GEM_DOMAIN_RENDER; kgem_bo_mark_dirty(bo); - } else { + } else domains = I915_GEM_DOMAIN_SAMPLER << 16; - is_dst = gen7_format_is_dst(format); - } + + offset = kgem_bo_get_binding(bo, format); + if (offset) + return offset; offset = sna->kgem.surface - sizeof(struct gen7_surface_state_padded) / sizeof(uint32_t); offset *= sizeof(uint32_t); - if (is_dst) { - if (bo->dst_bound) - return bo->dst_bound; - - bo->dst_bound = offset; - } else { - if (bo->src_bound) - return bo->src_bound; - - bo->src_bound = offset; - } - sna->kgem.surface -= sizeof(struct gen7_surface_state_padded) / sizeof(uint32_t); ss = sna->kgem.batch + sna->kgem.surface; @@ -1245,6 +1219,8 @@ gen7_bind_bo(struct sna *sna, ss[6] = 0; ss[7] = 0; + kgem_bo_set_binding(bo, format, offset); + DBG(("[%x] bind bo(handle=%d, addr=%d), format=%d, width=%d, height=%d, pitch=%d, tiling=%d -> %s\n", offset, bo->handle, ss[1], format, width, height, bo->pitch, bo->tiling, |