[Mesa-stable] [Mesa-dev] [PATCH 1/2] mesa/st: fix color outputs in presence of sample mask output

Ilia Mirkin imirkin at alum.mit.edu
Fri May 23 11:22:32 PDT 2014


On Fri, May 23, 2014 at 2:13 PM, Marek Olšák <maraeo at gmail.com> wrote:
> Thank you, it fixes the hangs!!

Great :)

>
> Do the sample mask tests pass on nouveau now? They fail on radeonsi.

Nope. I've spent some time to try to reproduce more and more of the
blob's command stream, with no effect. The last thing I noticed is
that they seem to enable CSAA when writing to the sample mask output
-- might just be an artifact of how their driver is written though.
Doing the same thing in nouveau didn't help. But we've never enabled
CSAA in nouveau before, perhaps there are other bits that need
setting. Or perhaps it's a dead end and it's something entirely
different that needs to happen to make it work.

The tests _do_ pass with the nvidia blob though, so it's a question of
identifying what it is we're doing wrong...

I'm actually a little hopeful that it's some issue totally unrelated
to the sample mask output itself, but I've looked at the generated
shader code and it seems like an accurate representation of what the
glsl code is doing... One of the issues with some of the other tests
was that we were doing resolves on blits between (same-)MS surfaces.
Perhaps something similar is happening here. We still fail a number of
EXT_framebuffer_multisample tests... the nouveau blit logic is beyond
fragile...

>
> Marek
>
> On Fri, May 23, 2014 at 5:39 PM, Ilia Mirkin <imirkin at alum.mit.edu> wrote:
>> Commit c5d822dad90 added support for sample mask incorrectly. It became
>> treated as a color output, and messed up the color output indices.
>> Revert the hunk that did that, and add explicit support just like for
>> depth/stencil writes.
>>
>> Signed-off-by: Ilia Mirkin <imirkin at alum.mit.edu>
>> Cc: "10.2" <mesa-stable at lists.freedesktop.org>
>> ---
>>
>> Marek, perhaps this is what was causing your sample mask hangs? Not sure if
>> this would be enough.
>>
>>  src/mesa/state_tracker/st_program.c | 30 +++++++++++++++++-------------
>>  1 file changed, 17 insertions(+), 13 deletions(-)
>>
>> diff --git a/src/mesa/state_tracker/st_program.c b/src/mesa/state_tracker/st_program.c
>> index f9887a2..26eb978 100644
>> --- a/src/mesa/state_tracker/st_program.c
>> +++ b/src/mesa/state_tracker/st_program.c
>> @@ -679,32 +679,36 @@ st_translate_fragment_program(struct st_context *st,
>>           outputsWritten &= ~(1 << FRAG_RESULT_STENCIL);
>>        }
>>
>> +      if (outputsWritten & BITFIELD64_BIT(FRAG_RESULT_SAMPLE_MASK)) {
>> +         fs_output_semantic_name[fs_num_outputs] = TGSI_SEMANTIC_SAMPLEMASK;
>> +         fs_output_semantic_index[fs_num_outputs] = 0;
>> +         outputMapping[FRAG_RESULT_SAMPLE_MASK] = fs_num_outputs;
>> +         fs_num_outputs++;
>> +         outputsWritten &= ~(1 << FRAG_RESULT_SAMPLE_MASK);
>> +      }
>> +
>>        /* handle remaining outputs (color) */
>>        for (attr = 0; attr < FRAG_RESULT_MAX; attr++) {
>>           if (outputsWritten & BITFIELD64_BIT(attr)) {
>> -            int semantic = TGSI_SEMANTIC_COLOR;
>>              switch (attr) {
>>              case FRAG_RESULT_DEPTH:
>>              case FRAG_RESULT_STENCIL:
>> +            case FRAG_RESULT_SAMPLE_MASK:
>>                 /* handled above */
>>                 assert(0);
>>                 break;
>>              case FRAG_RESULT_COLOR:
>> -               write_all = GL_TRUE;
>> -               break;
>> -            case FRAG_RESULT_SAMPLE_MASK:
>> -               semantic = TGSI_SEMANTIC_SAMPLEMASK;
>> +               write_all = GL_TRUE; /* fallthrough */
>> +            default:
>> +               assert(attr == FRAG_RESULT_COLOR ||
>> +                      (FRAG_RESULT_DATA0 <= attr && attr < FRAG_RESULT_MAX));
>> +               fs_output_semantic_name[fs_num_outputs] = TGSI_SEMANTIC_COLOR;
>> +               fs_output_semantic_index[fs_num_outputs] = numColors;
>> +               outputMapping[attr] = fs_num_outputs;
>> +               numColors++;
>>                 break;
>>              }
>>
>> -            assert(attr == FRAG_RESULT_COLOR ||
>> -                   attr == FRAG_RESULT_SAMPLE_MASK ||
>> -                   (FRAG_RESULT_DATA0 <= attr && attr < FRAG_RESULT_MAX));
>> -            fs_output_semantic_name[fs_num_outputs] = semantic;
>> -            fs_output_semantic_index[fs_num_outputs] = numColors;
>> -            outputMapping[attr] = fs_num_outputs;
>> -            numColors++;
>> -
>>              fs_num_outputs++;
>>           }
>>        }
>> --
>> 1.8.5.5
>>
>> _______________________________________________
>> mesa-dev mailing list
>> mesa-dev at lists.freedesktop.org
>> http://lists.freedesktop.org/mailman/listinfo/mesa-dev


More information about the mesa-stable mailing list