diff options
author | Chris Wilson <chris@chris-wilson.co.uk> | 2012-07-14 15:03:32 +0100 |
---|---|---|
committer | Chris Wilson <chris@chris-wilson.co.uk> | 2012-07-14 15:10:56 +0100 |
commit | 9f05b0c03b1fdab474b436431c430028fca1937e (patch) | |
tree | e2f389fc6580ec34e7b0e658ef2030984774f4f4 /src/sna/gen6_render.c | |
parent | fffbc34e4621898eee9b80bf8b6b3699bcade52a (diff) |
sna/gen4+: Fix up card/dest format confusion in previous commit
That would have been much more successful had I not supplied the wrong
opaque formats to the sampler.
Signed-off-by: Chris Wilson <chris@chris-wilson.co.uk>
Diffstat (limited to 'src/sna/gen6_render.c')
-rw-r--r-- | src/sna/gen6_render.c | 87 |
1 files changed, 35 insertions, 52 deletions
diff --git a/src/sna/gen6_render.c b/src/sna/gen6_render.c index ab3e4d66..c635f4d7 100644 --- a/src/sna/gen6_render.c +++ b/src/sna/gen6_render.c @@ -241,73 +241,83 @@ static uint32_t gen6_get_blend(int op, return BLEND_OFFSET(src, dst); } -static uint32_t gen6_get_dest_format(PictFormat format) +static uint32_t gen6_get_card_format(PictFormat format) { switch (format) { default: - assert(0); + return -1; case PICT_a8r8g8b8: - case PICT_x8r8g8b8: return GEN6_SURFACEFORMAT_B8G8R8A8_UNORM; + case PICT_x8r8g8b8: + return GEN6_SURFACEFORMAT_B8G8R8X8_UNORM; case PICT_a8b8g8r8: - case PICT_x8b8g8r8: return GEN6_SURFACEFORMAT_R8G8B8A8_UNORM; + case PICT_x8b8g8r8: + return GEN6_SURFACEFORMAT_R8G8B8X8_UNORM; case PICT_a2r10g10b10: - case PICT_x2r10g10b10: return GEN6_SURFACEFORMAT_B10G10R10A2_UNORM; + case PICT_x2r10g10b10: + return GEN6_SURFACEFORMAT_B10G10R10X2_UNORM; + case PICT_a2b10g10r10: + return GEN6_SURFACEFORMAT_R10G10B10A2_UNORM; + case PICT_r8g8b8: + return GEN6_SURFACEFORMAT_R8G8B8_UNORM; case PICT_r5g6b5: return GEN6_SURFACEFORMAT_B5G6R5_UNORM; case PICT_x1r5g5b5: + return GEN6_SURFACEFORMAT_B5G5R5X1_UNORM; case PICT_a1r5g5b5: return GEN6_SURFACEFORMAT_B5G5R5A1_UNORM; case PICT_a8: return GEN6_SURFACEFORMAT_A8_UNORM; case PICT_a4r4g4b4: - case PICT_x4r4g4b4: return GEN6_SURFACEFORMAT_B4G4R4A4_UNORM; } } -static bool gen6_check_dst_format(PictFormat format) +static uint32_t gen6_get_dest_format(PictFormat format) { switch (format) { + default: + return -1; case PICT_a8r8g8b8: case PICT_x8r8g8b8: + return GEN6_SURFACEFORMAT_B8G8R8A8_UNORM; case PICT_a8b8g8r8: case PICT_x8b8g8r8: + return GEN6_SURFACEFORMAT_R8G8B8A8_UNORM; case PICT_a2r10g10b10: case PICT_x2r10g10b10: + return GEN6_SURFACEFORMAT_B10G10R10A2_UNORM; case PICT_r5g6b5: + return GEN6_SURFACEFORMAT_B5G6R5_UNORM; case PICT_x1r5g5b5: case PICT_a1r5g5b5: + return GEN6_SURFACEFORMAT_B5G5R5A1_UNORM; case PICT_a8: + return GEN6_SURFACEFORMAT_A8_UNORM; case PICT_a4r4g4b4: case PICT_x4r4g4b4: - return true; + return GEN6_SURFACEFORMAT_B4G4R4A4_UNORM; } +} + +static bool gen6_check_dst_format(PictFormat format) +{ + if (gen6_get_dest_format(format) != -1) + return true; + + DBG(("%s: unhandled format: %x\n", __FUNCTION__, (int)format)); return false; } static bool gen6_check_format(uint32_t format) { - switch (format) { - case PICT_a8r8g8b8: - case PICT_x8r8g8b8: - case PICT_a8b8g8r8: - case PICT_x8b8g8r8: - case PICT_a2r10g10b10: - case PICT_x2r10g10b10: - case PICT_r8g8b8: - case PICT_r5g6b5: - case PICT_a1r5g5b5: - case PICT_a8: - case PICT_a4r4g4b4: - case PICT_x4r4g4b4: + if (gen6_get_card_format(format) != -1) return true; - default: - DBG(("%s: unhandled format: %x\n", __FUNCTION__, format)); - return false; - } + + DBG(("%s: unhandled format: %x\n", __FUNCTION__, (int)format)); + return false; } static uint32_t gen6_filter(uint32_t filter) @@ -1116,33 +1126,6 @@ static uint32_t gen6_create_cc_viewport(struct sna_static_stream *stream) return sna_static_stream_add(stream, &vp, sizeof(vp), 32); } -static uint32_t gen6_get_card_format(PictFormat format) -{ - switch (format) { - default: - return -1; - case PICT_a8r8g8b8: - case PICT_x8r8g8b8: - return GEN6_SURFACEFORMAT_B8G8R8A8_UNORM; - case PICT_a8b8g8r8: - case PICT_x8b8g8r8: - return GEN6_SURFACEFORMAT_R8G8B8A8_UNORM; - case PICT_a2r10g10b10: - case PICT_x2r10g10b10: - return GEN6_SURFACEFORMAT_B10G10R10A2_UNORM; - case PICT_r5g6b5: - return GEN6_SURFACEFORMAT_B5G6R5_UNORM; - case PICT_x1r5g5b5: - case PICT_a1r5g5b5: - return GEN6_SURFACEFORMAT_B5G5R5A1_UNORM; - case PICT_a8: - return GEN6_SURFACEFORMAT_A8_UNORM; - case PICT_a4r4g4b4: - case PICT_x4r4g4b4: - return GEN6_SURFACEFORMAT_B4G4R4A4_UNORM; - } -} - static uint32_t gen6_tiling_bits(uint32_t tiling) { |