All of lore.kernel.org
 help / color / mirror / Atom feed
From: Emil Velikov <emil.l.velikov@gmail.com>
To: Ilia Mirkin <imirkin@alum.mit.edu>
Cc: "mesa-dev@lists.freedesktop.org" <mesa-dev@lists.freedesktop.org>,
	emil.l.velikov@gmail.com,
	"nouveau@lists.freedesktop.org" <nouveau@lists.freedesktop.org>
Subject: Re: [PATCH] nv50, nvc0: only clear out the buffers that we were asked to clear
Date: Thu, 23 Jan 2014 20:31:08 +0000	[thread overview]
Message-ID: <52E17C0C.9050305@gmail.com> (raw)
In-Reply-To: <CAKb7UvgEXEUhE6FguyHGBPCBTGuNb=i1324tfibg9x__s63Fmg@mail.gmail.com>

On 23/01/14 20:15, Ilia Mirkin wrote:
> On Thu, Jan 23, 2014 at 3:11 PM, Emil Velikov <emil.l.velikov@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@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.

-Emil
>>
>> The corrected version in your github branch looks alot better, it
>> handles the above case and does not overwrite the clear buffer on rt0.
> 
> Christoph was really keen on doing the common-case color/depth clear
> all in one clear buffers command, so yeah -- I redid it that way.
> Enjoy the layered version of that in a later commit.
> 
>>
>> That one is Reviewed-by: Emil Velikov <emil.l.velikov@gmail.com>
>>>     if (buffers & PIPE_CLEAR_DEPTH) {
>>> @@ -425,12 +422,16 @@ nv50_clear(struct pipe_context *pipe, unsigned buffers,
>>>        mode |= NV50_3D_CLEAR_BUFFERS_S;
>>>     }
>>>
>>> -   BEGIN_NV04(push, NV50_3D(CLEAR_BUFFERS), 1);
>>> -   PUSH_DATA (push, mode);
>>> -
>>> -   for (i = 1; i < fb->nr_cbufs; i++) {
>>> +   if (mode) {
>>>        BEGIN_NV04(push, NV50_3D(CLEAR_BUFFERS), 1);
>>> -      PUSH_DATA (push, (i << 6) | 0x3c);
>>> +      PUSH_DATA (push, mode);
>>> +   }
>>> +
>>> +   for (i = 0; i < fb->nr_cbufs; i++) {
>>> +      if (buffers & (PIPE_CLEAR_COLOR0 << i)) {
>>> +         BEGIN_NV04(push, NV50_3D(CLEAR_BUFFERS), 1);
>>> +         PUSH_DATA (push, (i << 6) | 0x3c);
>>> +      }
>>>     }
>>>  }
>>>
>>> diff --git a/src/gallium/drivers/nouveau/nvc0/nvc0_surface.c b/src/gallium/drivers/nouveau/nvc0/nvc0_surface.c
>>> index 5375bd4..0c12bce 100644
>>> --- a/src/gallium/drivers/nouveau/nvc0/nvc0_surface.c
>>> +++ b/src/gallium/drivers/nouveau/nvc0/nvc0_surface.c
>>> @@ -427,9 +427,6 @@ nvc0_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 =
>>> -         NVC0_3D_CLEAR_BUFFERS_R | NVC0_3D_CLEAR_BUFFERS_G |
>>> -         NVC0_3D_CLEAR_BUFFERS_B | NVC0_3D_CLEAR_BUFFERS_A;
>>>     }
>>>
>>>     if (buffers & PIPE_CLEAR_DEPTH) {
>>> @@ -444,12 +441,16 @@ nvc0_clear(struct pipe_context *pipe, unsigned buffers,
>>>        mode |= NVC0_3D_CLEAR_BUFFERS_S;
>>>     }
>>>
>>> -   BEGIN_NVC0(push, NVC0_3D(CLEAR_BUFFERS), 1);
>>> -   PUSH_DATA (push, mode);
>>> -
>>> -   for (i = 1; i < fb->nr_cbufs; i++) {
>>> +   if (mode) {
>>>        BEGIN_NVC0(push, NVC0_3D(CLEAR_BUFFERS), 1);
>>> -      PUSH_DATA (push, (i << 6) | 0x3c);
>>> +      PUSH_DATA (push, mode);
>>> +   }
>>> +
>>> +   for (i = 0; i < fb->nr_cbufs; i++) {
>>> +      if (buffers & (PIPE_CLEAR_COLOR0 << i)) {
>>> +         BEGIN_NVC0(push, NVC0_3D(CLEAR_BUFFERS), 1);
>>> +         PUSH_DATA (push, (i << 6) | 0x3c);
>>> +      }
>>>     }
>>>  }
>>>
>>>
>>

  reply	other threads:[~2014-01-23 20:31 UTC|newest]

Thread overview: 10+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2014-01-15  7:30 [PATCH] nv50, nvc0: don't crash on a null cbuf Ilia Mirkin
     [not found] ` <1389771040-29447-1-git-send-email-imirkin-FrUbXkNCsVf2fBVCVOL8/A@public.gmane.org>
2014-01-17  2:23   ` [PATCH v2] nv50, nvc0: clear out RT " Ilia Mirkin
2014-01-17  2:23     ` [PATCH] nv50, nvc0: only clear out the buffers that we were asked to clear Ilia Mirkin
     [not found]       ` <1389925395-22379-2-git-send-email-imirkin-FrUbXkNCsVf2fBVCVOL8/A@public.gmane.org>
2014-01-23 20:11         ` [Mesa-dev] " Emil Velikov
     [not found]           ` <52E17757.2010807-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org>
2014-01-23 20:15             ` Ilia Mirkin
2014-01-23 20:31               ` Emil Velikov [this message]
     [not found]                 ` <52E17C0C.9050305-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org>
2014-01-23 20:33                   ` Ilia Mirkin
2014-01-23 19:40     ` [Nouveau] [PATCH v2] nv50, nvc0: clear out RT on a null cbuf Emil Velikov
     [not found]       ` <52E1701A.3060203-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org>
2014-01-23 19:39         ` Ilia Mirkin
     [not found]           ` <CAKb7UvgB_5omfkrL1mfFUYHL_3Pi8V01NzJJeo2sbKTfuNYOkA-JsoAwUIsXosN+BqQ9rBEUg@public.gmane.org>
2014-01-23 20:18             ` Emil Velikov

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=52E17C0C.9050305@gmail.com \
    --to=emil.l.velikov@gmail.com \
    --cc=imirkin@alum.mit.edu \
    --cc=mesa-dev@lists.freedesktop.org \
    --cc=nouveau@lists.freedesktop.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.