diff options
author | Chia-I Wu <[email protected]> | 2015-01-26 13:34:51 +0800 |
---|---|---|
committer | Chia-I Wu <[email protected]> | 2015-02-12 07:56:12 +0800 |
commit | 9aeee99e4da1488922c47e66709b5a3e82fcbf06 (patch) | |
tree | 4418c8e107f6fb138f2fd24e6e6ebe2fad3d8873 /src/gallium/drivers | |
parent | 6366fbc1a8055b437a97acf160596514885df6e7 (diff) |
ilo: update multisample related states for Gen8
Diffstat (limited to 'src/gallium/drivers')
-rw-r--r-- | src/gallium/drivers/ilo/ilo_builder_3d_bottom.h | 71 | ||||
-rw-r--r-- | src/gallium/drivers/ilo/ilo_render.c | 44 | ||||
-rw-r--r-- | src/gallium/drivers/ilo/ilo_render_gen.h | 2 |
3 files changed, 116 insertions, 1 deletions
diff --git a/src/gallium/drivers/ilo/ilo_builder_3d_bottom.h b/src/gallium/drivers/ilo/ilo_builder_3d_bottom.h index 9a85f2339fa..9370a6a862b 100644 --- a/src/gallium/drivers/ilo/ilo_builder_3d_bottom.h +++ b/src/gallium/drivers/ilo/ilo_builder_3d_bottom.h @@ -771,6 +771,75 @@ gen6_3DSTATE_MULTISAMPLE(struct ilo_builder *builder, } static inline void +gen8_3DSTATE_MULTISAMPLE(struct ilo_builder *builder, + int num_samples, + bool pixel_location_center) +{ + const uint8_t cmd_len = 2; + uint32_t dw1, *dw; + + ILO_DEV_ASSERT(builder->dev, 8, 8); + + dw1 = (pixel_location_center) ? GEN6_MULTISAMPLE_DW1_PIXLOC_CENTER : + GEN6_MULTISAMPLE_DW1_PIXLOC_UL_CORNER; + + switch (num_samples) { + case 0: + case 1: + dw1 |= GEN6_MULTISAMPLE_DW1_NUMSAMPLES_1; + break; + case 2: + dw1 |= GEN8_MULTISAMPLE_DW1_NUMSAMPLES_2; + break; + case 4: + dw1 |= GEN6_MULTISAMPLE_DW1_NUMSAMPLES_4; + break; + case 8: + dw1 |= GEN7_MULTISAMPLE_DW1_NUMSAMPLES_8; + break; + case 16: + dw1 |= GEN8_MULTISAMPLE_DW1_NUMSAMPLES_16; + break; + default: + assert(!"unsupported sample count"); + dw1 |= GEN6_MULTISAMPLE_DW1_NUMSAMPLES_1; + break; + } + + ilo_builder_batch_pointer(builder, cmd_len, &dw); + + dw[0] = GEN8_RENDER_CMD(3D, 3DSTATE_MULTISAMPLE) | (cmd_len - 2); + dw[1] = dw1; +} + +static inline void +gen8_3DSTATE_SAMPLE_PATTERN(struct ilo_builder *builder, + const uint32_t *pattern_1x, + const uint32_t *pattern_2x, + const uint32_t *pattern_4x, + const uint32_t *pattern_8x, + const uint32_t *pattern_16x) +{ + const uint8_t cmd_len = 9; + uint32_t *dw; + + ILO_DEV_ASSERT(builder->dev, 8, 8); + + ilo_builder_batch_pointer(builder, cmd_len, &dw); + + dw[0] = GEN8_RENDER_CMD(3D, 3DSTATE_SAMPLE_PATTERN) | (cmd_len - 2); + dw[1] = pattern_16x[3]; + dw[2] = pattern_16x[2]; + dw[3] = pattern_16x[1]; + dw[4] = pattern_16x[0]; + dw[5] = pattern_8x[1]; + dw[6] = pattern_8x[0]; + dw[7] = pattern_4x[0]; + dw[8] = pattern_1x[0] << 16 | + pattern_2x[0]; +} + +static inline void gen6_3DSTATE_SAMPLE_MASK(struct ilo_builder *builder, unsigned sample_mask) { @@ -797,7 +866,7 @@ gen7_3DSTATE_SAMPLE_MASK(struct ilo_builder *builder, const unsigned valid_mask = ((1 << num_samples) - 1) | 0x1; uint32_t *dw; - ILO_DEV_ASSERT(builder->dev, 7, 7.5); + ILO_DEV_ASSERT(builder->dev, 7, 8); /* * From the Ivy Bridge PRM, volume 2 part 1, page 294: diff --git a/src/gallium/drivers/ilo/ilo_render.c b/src/gallium/drivers/ilo/ilo_render.c index cf032728191..4799a58fd34 100644 --- a/src/gallium/drivers/ilo/ilo_render.c +++ b/src/gallium/drivers/ilo/ilo_render.c @@ -44,6 +44,11 @@ static const struct sample_position ilo_sample_pattern_1x[1] = { { 0, 0 }, }; +static const struct sample_position ilo_sample_pattern_2x[2] = { + { -4, -4 }, + { 4, 4 }, +}; + static const struct sample_position ilo_sample_pattern_4x[4] = { { -2, -6 }, { 6, -2 }, @@ -63,6 +68,25 @@ static const struct sample_position ilo_sample_pattern_8x[8] = { { -5, 7 }, }; +static const struct sample_position ilo_sample_pattern_16x[16] = { + { 0, 2 }, + { 3, 0 }, + { -3, -2 }, + { -2, -4 }, + { 4, 3 }, + { 5, 1 }, + { 6, -1 }, + { 2, -6 }, + { -4, 5 }, + { -5, -5 }, + { -1, -7 }, + { 7, -3 }, + { -7, 4 }, + { 1, -8 }, + { -6, 6 }, + { -8, 7 }, +}; + static uint8_t pack_sample_position(const struct sample_position *pos) { @@ -99,6 +123,9 @@ ilo_render_create(struct ilo_builder *builder) /* pack into dwords */ render->sample_pattern_1x = pack_sample_position(ilo_sample_pattern_1x); + render->sample_pattern_2x = + pack_sample_position(&ilo_sample_pattern_2x[1]) << 8 | + pack_sample_position(&ilo_sample_pattern_2x[0]); for (i = 0; i < 4; i++) { render->sample_pattern_4x |= pack_sample_position(&ilo_sample_pattern_4x[i]) << (8 * i); @@ -107,6 +134,15 @@ ilo_render_create(struct ilo_builder *builder) pack_sample_position(&ilo_sample_pattern_8x[i]) << (8 * i); render->sample_pattern_8x[1] |= pack_sample_position(&ilo_sample_pattern_8x[i + 4]) << (8 * i); + + render->sample_pattern_16x[0] |= + pack_sample_position(&ilo_sample_pattern_16x[i]) << (8 * i); + render->sample_pattern_16x[1] |= + pack_sample_position(&ilo_sample_pattern_16x[i + 4]) << (8 * i); + render->sample_pattern_16x[2] |= + pack_sample_position(&ilo_sample_pattern_16x[i + 8]) << (8 * i); + render->sample_pattern_16x[3] |= + pack_sample_position(&ilo_sample_pattern_16x[i + 12]) << (8 * i); } ilo_render_invalidate_hw(render); @@ -137,6 +173,10 @@ ilo_render_get_sample_position(const struct ilo_render *render, assert(sample_index < Elements(ilo_sample_pattern_1x)); pattern = ilo_sample_pattern_1x; break; + case 2: + assert(sample_index < Elements(ilo_sample_pattern_2x)); + pattern = ilo_sample_pattern_2x; + break; case 4: assert(sample_index < Elements(ilo_sample_pattern_4x)); pattern = ilo_sample_pattern_4x; @@ -145,6 +185,10 @@ ilo_render_get_sample_position(const struct ilo_render *render, assert(sample_index < Elements(ilo_sample_pattern_8x)); pattern = ilo_sample_pattern_8x; break; + case 16: + assert(sample_index < Elements(ilo_sample_pattern_16x)); + pattern = ilo_sample_pattern_16x; + break; default: assert(!"unknown sample count"); *x = 0.5f; diff --git a/src/gallium/drivers/ilo/ilo_render_gen.h b/src/gallium/drivers/ilo/ilo_render_gen.h index fef01f43591..5f62875f327 100644 --- a/src/gallium/drivers/ilo/ilo_render_gen.h +++ b/src/gallium/drivers/ilo/ilo_render_gen.h @@ -48,8 +48,10 @@ struct ilo_render { struct intel_bo *workaround_bo; uint32_t sample_pattern_1x; + uint32_t sample_pattern_2x; uint32_t sample_pattern_4x; uint32_t sample_pattern_8x[2]; + uint32_t sample_pattern_16x[4]; bool hw_ctx_changed; |