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/gen4_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/gen4_render.c')
-rw-r--r-- | src/sna/gen4_render.c | 91 |
1 files changed, 36 insertions, 55 deletions
diff --git a/src/sna/gen4_render.c b/src/sna/gen4_render.c index 9cd02500..d6623f7b 100644 --- a/src/sna/gen4_render.c +++ b/src/sna/gen4_render.c @@ -510,75 +510,83 @@ static uint32_t gen4_get_blend(int op, return BLEND_OFFSET(src, dst); } -static uint32_t gen4_get_dest_format(PictFormat format) +static uint32_t gen4_get_card_format(PictFormat format) { switch (format) { default: - assert(0); + return -1; case PICT_a8r8g8b8: - case PICT_x8r8g8b8: return GEN4_SURFACEFORMAT_B8G8R8A8_UNORM; + case PICT_x8r8g8b8: + return GEN4_SURFACEFORMAT_B8G8R8X8_UNORM; case PICT_a8b8g8r8: - case PICT_x8b8g8r8: return GEN4_SURFACEFORMAT_R8G8B8A8_UNORM; + case PICT_x8b8g8r8: + return GEN4_SURFACEFORMAT_R8G8B8X8_UNORM; case PICT_a2r10g10b10: - case PICT_x2r10g10b10: return GEN4_SURFACEFORMAT_B10G10R10A2_UNORM; + case PICT_x2r10g10b10: + return GEN4_SURFACEFORMAT_B10G10R10X2_UNORM; + case PICT_a2b10g10r10: + return GEN4_SURFACEFORMAT_R10G10B10A2_UNORM; + case PICT_r8g8b8: + return GEN4_SURFACEFORMAT_R8G8B8_UNORM; case PICT_r5g6b5: return GEN4_SURFACEFORMAT_B5G6R5_UNORM; case PICT_x1r5g5b5: + return GEN4_SURFACEFORMAT_B5G5R5X1_UNORM; case PICT_a1r5g5b5: return GEN4_SURFACEFORMAT_B5G5R5A1_UNORM; case PICT_a8: return GEN4_SURFACEFORMAT_A8_UNORM; case PICT_a4r4g4b4: - case PICT_x4r4g4b4: return GEN4_SURFACEFORMAT_B4G4R4A4_UNORM; } } -static bool gen4_check_dst_format(PictFormat format) +static uint32_t gen4_get_dest_format(PictFormat format) { switch (format) { + default: + return -1; case PICT_a8r8g8b8: case PICT_x8r8g8b8: + return GEN4_SURFACEFORMAT_B8G8R8A8_UNORM; case PICT_a8b8g8r8: case PICT_x8b8g8r8: + return GEN4_SURFACEFORMAT_R8G8B8A8_UNORM; case PICT_a2r10g10b10: case PICT_x2r10g10b10: + return GEN4_SURFACEFORMAT_B10G10R10A2_UNORM; case PICT_r5g6b5: + return GEN4_SURFACEFORMAT_B5G6R5_UNORM; case PICT_x1r5g5b5: case PICT_a1r5g5b5: + return GEN4_SURFACEFORMAT_B5G5R5A1_UNORM; case PICT_a8: + return GEN4_SURFACEFORMAT_A8_UNORM; case PICT_a4r4g4b4: case PICT_x4r4g4b4: - return true; - default: - DBG(("%s: unhandled format: %x\n", __FUNCTION__, (int)format)); - return false; + return GEN4_SURFACEFORMAT_B4G4R4A4_UNORM; } } +static bool gen4_check_dst_format(PictFormat format) +{ + if (gen4_check_dst_format(format) != -1) + return true; + + DBG(("%s: unhandled format: %x\n", __FUNCTION__, (int)format)); + return false; +} + static bool gen4_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 (gen4_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; } typedef struct gen4_surface_state_padded { @@ -640,33 +648,6 @@ sampler_state_init(struct gen4_sampler_state *sampler_state, } } -static uint32_t gen4_get_card_format(PictFormat format) -{ - switch (format) { - default: - return -1; - case PICT_a8r8g8b8: - case PICT_x8r8g8b8: - return GEN4_SURFACEFORMAT_B8G8R8A8_UNORM; - case PICT_a8b8g8r8: - case PICT_x8b8g8r8: - return GEN4_SURFACEFORMAT_R8G8B8A8_UNORM; - case PICT_a2r10g10b10: - case PICT_x2r10g10b10: - return GEN4_SURFACEFORMAT_B10G10R10A2_UNORM; - case PICT_r5g6b5: - return GEN4_SURFACEFORMAT_B5G6R5_UNORM; - case PICT_x1r5g5b5: - case PICT_a1r5g5b5: - return GEN4_SURFACEFORMAT_B5G5R5A1_UNORM; - case PICT_a8: - return GEN4_SURFACEFORMAT_A8_UNORM; - case PICT_a4r4g4b4: - case PICT_x4r4g4b4: - return GEN4_SURFACEFORMAT_B4G4R4A4_UNORM; - } -} - static uint32_t gen4_filter(uint32_t filter) { switch (filter) { |