[Mesa-dev] [PATCH 2/3] r600g: fix the CB_SHADER_MASK setup

Marek Olšák maraeo at gmail.com
Mon Aug 3 05:13:59 PDT 2015


On Mon, Aug 3, 2015 at 1:28 PM, Emil Velikov <emil.l.velikov at gmail.com> wrote:
> On 2 August 2015 at 14:36, Marek Olšák <maraeo at gmail.com> wrote:
>> From: Marek Olšák <marek.olsak at amd.com>
>>
>> This fixes the single-sample fast clear hang.
>>
>> Cc: 10.6 <mesa-stable at lists.freedesktop.org>
>> ---
>>  src/gallium/drivers/r600/evergreen_state.c | 8 ++++----
>>  src/gallium/drivers/r600/r600_shader.c     | 1 +
>>  2 files changed, 5 insertions(+), 4 deletions(-)
>>
>> diff --git a/src/gallium/drivers/r600/evergreen_state.c b/src/gallium/drivers/r600/evergreen_state.c
>> index 5c8fd0d..13ecc46 100644
>> --- a/src/gallium/drivers/r600/evergreen_state.c
>> +++ b/src/gallium/drivers/r600/evergreen_state.c
>> @@ -1736,10 +1736,10 @@ static void evergreen_emit_cb_misc_state(struct r600_context *rctx, struct r600_
>>
>>         r600_write_context_reg_seq(cs, R_028238_CB_TARGET_MASK, 2);
>>         radeon_emit(cs, a->blend_colormask & fb_colormask); /* R_028238_CB_TARGET_MASK */
>> -       /* Always enable the first colorbuffer in CB_SHADER_MASK. This
>> -        * will assure that the alpha-test will work even if there is
>> -        * no colorbuffer bound. */
>> -       radeon_emit(cs, 0xf | (a->dual_src_blend ? ps_colormask : 0) | fb_colormask); /* R_02823C_CB_SHADER_MASK */
>> +       /* This must match the used export instructions exactly.
>> +        * Other values may lead to undefined behavior and hangs.
>> +        */
>> +       radeon_emit(cs, ps_colormask); /* R_02823C_CB_SHADER_MASK */
>>  }
>>
>>  static void evergreen_emit_db_state(struct r600_context *rctx, struct r600_atom *atom)
>> diff --git a/src/gallium/drivers/r600/r600_shader.c b/src/gallium/drivers/r600/r600_shader.c
>> index 09f50f5..8d1f95a 100644
>> --- a/src/gallium/drivers/r600/r600_shader.c
>> +++ b/src/gallium/drivers/r600/r600_shader.c
>> @@ -2490,6 +2490,7 @@ static int r600_shader_from_tgsi(struct r600_context *rctx,
>>                         output[j].array_base = 0;
>>                         output[j].op = CF_OP_EXPORT;
>>                         j++;
>> +                       shader->nr_ps_color_exports++;
> Perhaps a silly question but: is this intentional ? The commit message
> seems silent about it.
> Any chance you can add a couple of words for such bits in the future ?

Yes, it is intentional. The old code was working around it by OR'ing
0xf to CB_SHADER_MASK. When I removed that hack, nr_ps_color_exports
had to be incremented in every place where the driver emits color
exports and this was missing.

Marek


More information about the mesa-dev mailing list