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 | |
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')
-rw-r--r-- | src/sna/gen4_render.c | 91 | ||||
-rw-r--r-- | src/sna/gen5_render.c | 92 | ||||
-rw-r--r-- | src/sna/gen6_render.c | 87 | ||||
-rw-r--r-- | src/sna/gen7_render.c | 70 |
4 files changed, 131 insertions, 209 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) { diff --git a/src/sna/gen5_render.c b/src/sna/gen5_render.c index 06123ccd..f611a51a 100644 --- a/src/sna/gen5_render.c +++ b/src/sna/gen5_render.c @@ -504,74 +504,83 @@ static uint32_t gen5_get_blend(int op, return BLEND_OFFSET(src, dst); } -static uint32_t gen5_get_dest_format(PictFormat format) +static uint32_t gen5_get_card_format(PictFormat format) { switch (format) { - case PICT_a8r8g8b8: - case PICT_x8r8g8b8: default: + return -1; + case PICT_a8r8g8b8: return GEN5_SURFACEFORMAT_B8G8R8A8_UNORM; + case PICT_x8r8g8b8: + return GEN5_SURFACEFORMAT_B8G8R8X8_UNORM; case PICT_a8b8g8r8: - case PICT_x8b8g8r8: return GEN5_SURFACEFORMAT_R8G8B8A8_UNORM; + case PICT_x8b8g8r8: + return GEN5_SURFACEFORMAT_R8G8B8X8_UNORM; case PICT_a2r10g10b10: - case PICT_x2r10g10b10: return GEN5_SURFACEFORMAT_B10G10R10A2_UNORM; + case PICT_x2r10g10b10: + return GEN5_SURFACEFORMAT_B10G10R10X2_UNORM; + case PICT_a2b10g10r10: + return GEN5_SURFACEFORMAT_R10G10B10A2_UNORM; + case PICT_r8g8b8: + return GEN5_SURFACEFORMAT_R8G8B8_UNORM; case PICT_r5g6b5: return GEN5_SURFACEFORMAT_B5G6R5_UNORM; case PICT_x1r5g5b5: + return GEN5_SURFACEFORMAT_B5G5R5X1_UNORM; case PICT_a1r5g5b5: return GEN5_SURFACEFORMAT_B5G5R5A1_UNORM; case PICT_a8: return GEN5_SURFACEFORMAT_A8_UNORM; case PICT_a4r4g4b4: - case PICT_x4r4g4b4: return GEN5_SURFACEFORMAT_B4G4R4A4_UNORM; } } -static bool gen5_check_dst_format(PictFormat format) +static uint32_t gen5_get_dest_format(PictFormat format) { switch (format) { + default: + return -1; case PICT_a8r8g8b8: case PICT_x8r8g8b8: + return GEN5_SURFACEFORMAT_B8G8R8A8_UNORM; case PICT_a8b8g8r8: case PICT_x8b8g8r8: + return GEN5_SURFACEFORMAT_R8G8B8A8_UNORM; case PICT_a2r10g10b10: case PICT_x2r10g10b10: + return GEN5_SURFACEFORMAT_B10G10R10A2_UNORM; case PICT_r5g6b5: + return GEN5_SURFACEFORMAT_B5G6R5_UNORM; case PICT_x1r5g5b5: case PICT_a1r5g5b5: + return GEN5_SURFACEFORMAT_B5G5R5A1_UNORM; case PICT_a8: + return GEN5_SURFACEFORMAT_A8_UNORM; case PICT_a4r4g4b4: case PICT_x4r4g4b4: - return true; - default: - DBG(("%s: unhandled format: %x\n", __FUNCTION__, (int)format)); - return false; + return GEN5_SURFACEFORMAT_B4G4R4A4_UNORM; } } +static bool gen5_check_dst_format(PictFormat format) +{ + if (gen5_get_dest_format(format) != -1) + return true; + + DBG(("%s: unhandled format: %x\n", __FUNCTION__, (int)format)); + return false; +} + static bool gen5_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 (gen5_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 gen5_surface_state_padded { @@ -633,33 +642,6 @@ sampler_state_init(struct gen5_sampler_state *sampler_state, } } -static uint32_t gen5_get_card_format(PictFormat format) -{ - switch (format) { - default: - return -1; - case PICT_a8r8g8b8: - case PICT_x8r8g8b8: - return GEN5_SURFACEFORMAT_B8G8R8A8_UNORM; - case PICT_a8b8g8r8: - case PICT_x8b8g8r8: - return GEN5_SURFACEFORMAT_R8G8B8A8_UNORM; - case PICT_a2r10g10b10: - case PICT_x2r10g10b10: - return GEN5_SURFACEFORMAT_B10G10R10A2_UNORM; - case PICT_r5g6b5: - return GEN5_SURFACEFORMAT_B5G6R5_UNORM; - case PICT_x1r5g5b5: - case PICT_a1r5g5b5: - return GEN5_SURFACEFORMAT_B5G5R5A1_UNORM; - case PICT_a8: - return GEN5_SURFACEFORMAT_A8_UNORM; - case PICT_a4r4g4b4: - case PICT_x4r4g4b4: - return GEN5_SURFACEFORMAT_B4G4R4A4_UNORM; - } -} - static uint32_t gen5_filter(uint32_t filter) { switch (filter) { 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) { diff --git a/src/sna/gen7_render.c b/src/sna/gen7_render.c index 5d1d93fe..9e7683eb 100644 --- a/src/sna/gen7_render.c +++ b/src/sna/gen7_render.c @@ -274,7 +274,7 @@ static uint32_t gen7_get_blend(int op, return BLEND_OFFSET(src, dst); } -static uint32_t gen7_get_dest_format(PictFormat format) +static uint32_t gen7_get_card_format(PictFormat format) { switch (format) { default: @@ -308,46 +308,49 @@ static uint32_t gen7_get_dest_format(PictFormat format) } } -static bool gen7_check_dst_format(PictFormat format) +static uint32_t gen7_get_dest_format(PictFormat format) { switch (format) { + default: + return -1; case PICT_a8r8g8b8: case PICT_x8r8g8b8: + return GEN7_SURFACEFORMAT_B8G8R8A8_UNORM; case PICT_a8b8g8r8: case PICT_x8b8g8r8: + return GEN7_SURFACEFORMAT_R8G8B8A8_UNORM; case PICT_a2r10g10b10: case PICT_x2r10g10b10: + return GEN7_SURFACEFORMAT_B10G10R10A2_UNORM; case PICT_r5g6b5: + return GEN7_SURFACEFORMAT_B5G6R5_UNORM; case PICT_x1r5g5b5: case PICT_a1r5g5b5: + return GEN7_SURFACEFORMAT_B5G5R5A1_UNORM; case PICT_a8: + return GEN7_SURFACEFORMAT_A8_UNORM; case PICT_a4r4g4b4: case PICT_x4r4g4b4: - return true; + return GEN7_SURFACEFORMAT_B4G4R4A4_UNORM; } +} + +static bool gen7_check_dst_format(PictFormat format) +{ + if (gen7_get_dest_format(format) != -1) + return true; + + DBG(("%s: unhandled format: %x\n", __FUNCTION__, (int)format)); return false; } static bool gen7_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 (gen7_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 gen7_filter(uint32_t filter) @@ -1264,33 +1267,6 @@ static uint32_t gen7_create_cc_viewport(struct sna_static_stream *stream) return sna_static_stream_add(stream, &vp, sizeof(vp), 32); } -static uint32_t gen7_get_card_format(PictFormat format) -{ - switch (format) { - default: - return -1; - case PICT_a8r8g8b8: - case PICT_x8r8g8b8: - return GEN7_SURFACEFORMAT_B8G8R8A8_UNORM; - case PICT_a8b8g8r8: - case PICT_x8b8g8r8: - return GEN7_SURFACEFORMAT_R8G8B8A8_UNORM; - case PICT_a2r10g10b10: - case PICT_x2r10g10b10: - return GEN7_SURFACEFORMAT_B10G10R10A2_UNORM; - case PICT_r5g6b5: - return GEN7_SURFACEFORMAT_B5G6R5_UNORM; - case PICT_x1r5g5b5: - case PICT_a1r5g5b5: - return GEN7_SURFACEFORMAT_B5G5R5A1_UNORM; - case PICT_a8: - return GEN7_SURFACEFORMAT_A8_UNORM; - case PICT_a4r4g4b4: - case PICT_x4r4g4b4: - return GEN7_SURFACEFORMAT_B4G4R4A4_UNORM; - } -} - static uint32_t gen7_tiling_bits(uint32_t tiling) { |