[Mesa-dev] [PATCH 05/13] nouveau: Enable EXT_texture_env_dot3 on NV10 and NV20

Ilia Mirkin imirkin at alum.mit.edu
Mon Aug 29 01:17:19 UTC 2016


On Sun, Aug 28, 2016 at 9:05 PM, Ian Romanick <idr at freedesktop.org> wrote:
> On 08/28/2016 08:56 AM, Ilia Mirkin wrote:
>> FWIW this fails for GL_DOT3_RGBA_EXT but works for GL_DOT3_RGB_EXT
>> [according to glean's texCombine test]. (I suspect the existing
>
> Looking at the test results... any idea what it's actually doing?
> Ignoring alpha and using 1.0?  Using garbage?  Other?

Wellll... it's unclear that the results can be trusted. There's an
error in setting the RC_OUT_ALPHA value which means that the hardware
is in some pseudo-inconsistent state, potentially. (The error is
thrown when the graph engine processes the register write request from
the command FIFO, in the form of an interrupt.) For a while I was
getting 0,0,0,0.25, and then I started getting 1,1,1,0.25. The "real"
answer was supposed to be 1,1,1,1:

$ NOUVEAU_VIEUX=1 bin/glean -o -v -v -v -t +texCombine  --quick
texCombine:  FAIL rgba8, db, z24, s8, win+pmap, id 33
        expected 1, 1, 1, 1, got 0, 0, 0, 0.247059 in Single Texture Test
        Current combine state:
        Incoming Fragment RGBA = 0, 0.25, 0.5, 0.75
        Texture Unit 0:
          GL_COMBINE_RGB_EXT = GL_DOT3_RGBA_EXT
          GL_COMBINE_ALPHA_EXT = GL_MODULATE
          GL_SOURCE0_RGB_EXT = GL_TEXTURE
          GL_SOURCE1_RGB_EXT = GL_TEXTURE
          GL_SOURCE2_RGB_EXT = GL_CONSTANT_EXT
          GL_SOURCE0_ALPHA_EXT = GL_TEXTURE
          GL_SOURCE1_ALPHA_EXT = GL_TEXTURE
          GL_SOURCE2_ALPHA_EXT = GL_CONSTANT_EXT
          GL_OPERAND0_RGB_EXT = GL_SRC_COLOR
          GL_OPERAND1_RGB_EXT = GL_SRC_COLOR
          GL_OPERAND2_RGB_EXT = GL_SRC_ALPHA
          GL_OPERAND0_ALPHA_EXT = GL_SRC_ALPHA
          GL_OPERAND1_ALPHA_EXT = GL_SRC_ALPHA
          GL_OPERAND2_ALPHA_EXT = GL_SRC_ALPHA
          GL_RGB_SCALE_EXT = 1
          GL_ALPHA_SCALE = 1
          Tex Env RGBA = 0.25, 0.5, 0.75, 1
          Texture RGBA = 1, 0, 0.25, 0.5

To be super-clear - this is not your fault - it was already like that
for the non-EXT version. But I'm hoping you could provide some hints
as to why it's happening and/or how I could fix it.

And I'm pretty sure the RGB_EXT thing works, because the texcombine
test runs that first and there are no errors from it.

  -ilia

>
>> GL_DOT3_RGBA/RGB had a similar behavior.) I'm testing in a slightly
>> unsupported environment - the NV25 graph class running on a NV34
>> (GeForce FX 5200), but I think it's legit.
>>
>> Unfortunately I know *nothing* about register combiners. Any chance
>> you could explain what *should* be happening wrt their hookup? [Or
>> even better, glance at the code.]
>>
>> As part of the test, I'm getting this error:
>>
>> nouveau 0000:09:01.0: gr: intr 00100000 [ERROR] nsource 00000002
>> [DATA_ERROR] nstatus 02000000 [BAD_ARGUMENT] ch 3 [glean[1436]] subc 7
>> class 0597 mthd 0aa0 data 000020c0
>>
>> Method 0aa0 is RC_OUT_ALPHA(0)
>> [https://github.com/envytools/envytools/blob/master/rnndb/graph/nv20_3d.xml#L485],
>> and data 20c0 decodes as
>>
>> $ lookup -a 25 -d SUBCHAN -- -v obj-class NV25_3D 0aa0 000020c0
>> RC_OUT_ALPHA[0] => { CD_OUTPUT = ZERO | AB_OUTPUT = SPARE0 |
>> SUM_OUTPUT = ZERO | AB_DOT_PRODUCT | BIAS = NONE | SCALE = NONE }
>>
>> Thanks,
>>
>>   -ilia
>>
>> On Wed, Aug 24, 2016 at 2:57 PM, Ilia Mirkin <imirkin at alum.mit.edu> wrote:
>>> On Wed, Aug 24, 2016 at 2:46 PM, Ian Romanick <idr at freedesktop.org> wrote:
>>>> From: Ian Romanick <ian.d.romanick at intel.com>
>>>>
>>>> GL_DOT3_RGB_EXT and GL_DOT3_RGBA_EXT. are nearly identical to
>>>> GL_DOT3_RGB and GL_DOT3_RGBA.  The only difference is the _EXT
>>>> versions do not apply the post-scale.  Just smash logscale to 0 so
>>>> that RC_OUT_SCALE_1 is always used.
>>>>
>>>> NOTE: I have not actually tested this.
>>>>
>>>> Signed-off-by: Ian Romanick <ian.d.romanick at intel.com>
>>>> ---
>>>>  src/mesa/drivers/dri/nouveau/nv10_context.c    |  1 +
>>>>  src/mesa/drivers/dri/nouveau/nv10_state_frag.c | 16 +++++++++++++++-
>>>>  src/mesa/drivers/dri/nouveau/nv20_context.c    |  1 +
>>>>  3 files changed, 17 insertions(+), 1 deletion(-)
>>>>
>>>> diff --git a/src/mesa/drivers/dri/nouveau/nv10_context.c b/src/mesa/drivers/dri/nouveau/nv10_context.c
>>>> index 00a9358..7a86ba2 100644
>>>> --- a/src/mesa/drivers/dri/nouveau/nv10_context.c
>>>> +++ b/src/mesa/drivers/dri/nouveau/nv10_context.c
>>>> @@ -448,6 +448,7 @@ nv10_context_create(struct nouveau_screen *screen, gl_api api,
>>>>         ctx->Extensions.ARB_texture_env_crossbar = true;
>>>>         ctx->Extensions.ARB_texture_env_combine = true;
>>>>         ctx->Extensions.ARB_texture_env_dot3 = true;
>>>> +       ctx->Extensions.EXT_texture_env_dot3 = true;
>>>>         ctx->Extensions.NV_fog_distance = true;
>>>>         ctx->Extensions.NV_texture_rectangle = true;
>>>>         if (ctx->Mesa_DXTn) {
>>>> diff --git a/src/mesa/drivers/dri/nouveau/nv10_state_frag.c b/src/mesa/drivers/dri/nouveau/nv10_state_frag.c
>>>> index e78eac3..c6e4bb0 100644
>>>> --- a/src/mesa/drivers/dri/nouveau/nv10_state_frag.c
>>>> +++ b/src/mesa/drivers/dri/nouveau/nv10_state_frag.c
>>>> @@ -276,6 +276,20 @@ setup_combiner(struct combiner_state *rc)
>>>>                 rc->out = RC_OUT_DOT_AB;
>>>>                 break;
>>>>
>>>> +       case GL_DOT3_RGB_EXT:
>>>> +       case GL_DOT3_RGBA_EXT:
>>>> +               INPUT_ARG(rc, A, 0, NORMALIZE);
>>>> +               INPUT_ARG(rc, B, 1, NORMALIZE);
>>>> +
>>>> +               rc->out = RC_OUT_DOT_AB;
>>>> +
>>>> +               /* The EXT version of the DOT3 extension does not support the
>>>> +                * scale factor, but the ARB version (and the version in
>>>> +                * OpenGL 1.3) does.
>>>> +                */
>>>> +               rc->logscale = 0;
>>>
>>> rc->logscale comes from _CurrentCombine->ScaleShiftRGB/A -- I guess
>>> not a lot of harm in just forcing it here, but it'd be a little
>>> cleaner if that were not necessary. In the current state, though, this
>>> is
>>>
>>> Acked-by: Ilia Mirkin <imirkin at alum.mit.edu>
>>>
>>>> +               break;
>>>> +
>>>>         default:
>>>>                 assert(0);
>>>>         }
>>>> @@ -305,7 +319,7 @@ nv10_get_general_combiner(struct gl_context *ctx, int i,
>>>>         if (ctx->Texture.Unit[i]._Current) {
>>>>                 INIT_COMBINER(RGB, ctx, &rc_c, i);
>>>>
>>>> -               if (rc_c.mode == GL_DOT3_RGBA)
>>>> +               if (rc_c.mode == GL_DOT3_RGBA || rc_c.mode == GL_DOT3_RGBA_EXT)
>>>>                         rc_a = rc_c;
>>>>                 else
>>>>                         INIT_COMBINER(A, ctx, &rc_a, i);
>>>> diff --git a/src/mesa/drivers/dri/nouveau/nv20_context.c b/src/mesa/drivers/dri/nouveau/nv20_context.c
>>>> index 14329a2..ec638c0 100644
>>>> --- a/src/mesa/drivers/dri/nouveau/nv20_context.c
>>>> +++ b/src/mesa/drivers/dri/nouveau/nv20_context.c
>>>> @@ -459,6 +459,7 @@ nv20_context_create(struct nouveau_screen *screen, gl_api api,
>>>>         ctx->Extensions.ARB_texture_env_crossbar = true;
>>>>         ctx->Extensions.ARB_texture_env_combine = true;
>>>>         ctx->Extensions.ARB_texture_env_dot3 = true;
>>>> +       ctx->Extensions.EXT_texture_env_dot3 = true;
>>>>         ctx->Extensions.NV_fog_distance = true;
>>>>         ctx->Extensions.NV_texture_rectangle = true;
>>>>         if (ctx->Mesa_DXTn) {
>>>> --
>>>> 2.5.5
>>>>
>>>> _______________________________________________
>>>> mesa-dev mailing list
>>>> mesa-dev at lists.freedesktop.org
>>>> https://lists.freedesktop.org/mailman/listinfo/mesa-dev
>>
>


More information about the mesa-dev mailing list