[Nouveau] [Mesa-dev] [PATCH] nv50, nvc0: only clear out the buffers that we were asked to clear

Ilia Mirkin imirkin at alum.mit.edu
Thu Jan 23 12:33:20 PST 2014


On Thu, Jan 23, 2014 at 3:31 PM, Emil Velikov <emil.l.velikov at gmail.com> wrote:
> On 23/01/14 20:15, Ilia Mirkin wrote:
>> On Thu, Jan 23, 2014 at 3:11 PM, Emil Velikov <emil.l.velikov at gmail.com> wrote:
>>> On 17/01/14 02:23, Ilia Mirkin wrote:
>>>> Fixes fbo-drawbuffers-none glClearBuffer piglit test.
>>>>
>>>> Signed-off-by: Ilia Mirkin <imirkin at alum.mit.edu>
>>>> ---
>>>>
>>>> Only tested on nv50, but implementations seem similar enough.
>>>>
>>>>  src/gallium/drivers/nouveau/nv50/nv50_surface.c | 17 +++++++++--------
>>>>  src/gallium/drivers/nouveau/nvc0/nvc0_surface.c | 17 +++++++++--------
>>>>  2 files changed, 18 insertions(+), 16 deletions(-)
>>>>
>>>> diff --git a/src/gallium/drivers/nouveau/nv50/nv50_surface.c b/src/gallium/drivers/nouveau/nv50/nv50_surface.c
>>>> index 358f57a..eb27429 100644
>>>> --- a/src/gallium/drivers/nouveau/nv50/nv50_surface.c
>>>> +++ b/src/gallium/drivers/nouveau/nv50/nv50_surface.c
>>>> @@ -408,9 +408,6 @@ nv50_clear(struct pipe_context *pipe, unsigned buffers,
>>>>        PUSH_DATAf(push, color->f[1]);
>>>>        PUSH_DATAf(push, color->f[2]);
>>>>        PUSH_DATAf(push, color->f[3]);
>>>> -      mode =
>>>> -         NV50_3D_CLEAR_BUFFERS_R | NV50_3D_CLEAR_BUFFERS_G |
>>>> -         NV50_3D_CLEAR_BUFFERS_B | NV50_3D_CLEAR_BUFFERS_A;
>>>>     }
>>>>
>>> I'm not sure why you've dropped the mode from above. I'm guessing that
>>> the initial assumption was that if there is a color buffer it must be at
>>> cbuf[0].
>>
>> Because I cleared the cbufs separately in a for loop below (the 0x3c
>> == the RGBA mask). The first RT may not have been there, and that
>> seemed simpler than the thing that I have now (as evidenced by the
>> code I have now which has more complex logic).
>>
> With the original patch, you explicitly set clear_depth and
> clear_stencil for the first buffer, regardless of what is being passed
> by gallium. I'm not sure that was strictly correct.

Only if buffers & PIPE_CLEAR_DEPTH/STENCIL were set... of which there
can only be one, unlike the color buffers, of which there can be many.
Well, whatever. I think everyone's happy with the new version, right?


More information about the Nouveau mailing list