From: Emil Velikov <emil.l.velikov@gmail.com>
To: Ilia Mirkin <imirkin@alum.mit.edu>, mesa-dev@lists.freedesktop.org
Cc: nouveau@lists.freedesktop.org, emil.l.velikov@gmail.com
Subject: Re: [Nouveau] [PATCH v2] nv50, nvc0: clear out RT on a null cbuf
Date: Thu, 23 Jan 2014 19:40:10 +0000 [thread overview]
Message-ID: <52E1701A.3060203@gmail.com> (raw)
In-Reply-To: <1389925395-22379-1-git-send-email-imirkin@alum.mit.edu>
On 17/01/14 02:23, Ilia Mirkin wrote:
> This is needed since commit 9baa45f78b (st/mesa: bind NULL colorbuffers
> as specified by glDrawBuffers).
>
> This implementation is highly based on a larger commit by
> Christoph Bumiller <e0425955@student.tuwien.ac.at> in his gallium-nine
> branch.
>
Ilia,
Do you know why we cannot set the rt height to 64? After all you
explicitly set the format to NONE.
Either way this patch looks good afaics
Reviewed-by: Emil Velikov <emil.l.velikov@gmail.com>
> Signed-off-by: Ilia Mirkin <imirkin@alum.mit.edu>
> ---
> src/gallium/drivers/nouveau/nv50/nv50_defs.xml.h | 1 +
> src/gallium/drivers/nouveau/nv50/nv50_formats.c | 1 -
> .../drivers/nouveau/nv50/nv50_state_validate.c | 30 +++++++++++++++++++---
> .../drivers/nouveau/nvc0/nvc0_state_validate.c | 28 +++++++++++++++++---
> 4 files changed, 52 insertions(+), 8 deletions(-)
>
> diff --git a/src/gallium/drivers/nouveau/nv50/nv50_defs.xml.h b/src/gallium/drivers/nouveau/nv50/nv50_defs.xml.h
> index 2e42843..80de3be 100644
> --- a/src/gallium/drivers/nouveau/nv50/nv50_defs.xml.h
> +++ b/src/gallium/drivers/nouveau/nv50/nv50_defs.xml.h
> @@ -78,6 +78,7 @@ WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
> #define NV50_VSTATUS_BLOCKED 0x00000005
> #define NV50_VSTATUS_FAULTED 0x00000006
> #define NV50_VSTATUS_PAUSED 0x00000007
> +#define NV50_SURFACE_FORMAT_NONE 0x00000000
> #define NV50_SURFACE_FORMAT_BITMAP 0x0000001c
> #define NV50_SURFACE_FORMAT_UNK1D 0x0000001d
> #define NV50_SURFACE_FORMAT_RGBA32_FLOAT 0x000000c0
> diff --git a/src/gallium/drivers/nouveau/nv50/nv50_formats.c b/src/gallium/drivers/nouveau/nv50/nv50_formats.c
> index 0a7e812..d21905d 100644
> --- a/src/gallium/drivers/nouveau/nv50/nv50_formats.c
> +++ b/src/gallium/drivers/nouveau/nv50/nv50_formats.c
> @@ -71,7 +71,6 @@
> # define U_tV U_V
> #endif
>
> -#define NV50_SURFACE_FORMAT_NONE 0
> #define NV50_ZETA_FORMAT_NONE 0
>
> /* for vertex buffers: */
> diff --git a/src/gallium/drivers/nouveau/nv50/nv50_state_validate.c b/src/gallium/drivers/nouveau/nv50/nv50_state_validate.c
> index 86b9a23..bb05f03 100644
> --- a/src/gallium/drivers/nouveau/nv50/nv50_state_validate.c
> +++ b/src/gallium/drivers/nouveau/nv50/nv50_state_validate.c
> @@ -1,6 +1,19 @@
>
> #include "nv50/nv50_context.h"
> -#include "os/os_time.h"
> +#include "nv50/nv50_defs.xml.h"
> +
> +static INLINE void
> +nv50_fb_set_null_rt(struct nouveau_pushbuf *push, unsigned i)
> +{
> + BEGIN_NV04(push, NV50_3D(RT_ADDRESS_HIGH(i)), 4);
> + PUSH_DATA (push, 0);
> + PUSH_DATA (push, 0);
> + PUSH_DATA (push, NV50_SURFACE_FORMAT_NONE);
> + PUSH_DATA (push, 0);
> + BEGIN_NV04(push, NV50_3D(RT_HORIZ(i)), 2);
> + PUSH_DATA (push, 64);
> + PUSH_DATA (push, 0);
> +}
>
> static void
> nv50_validate_fb(struct nv50_context *nv50)
> @@ -20,9 +33,18 @@ nv50_validate_fb(struct nv50_context *nv50)
> PUSH_DATA (push, fb->height << 16);
>
> for (i = 0; i < fb->nr_cbufs; ++i) {
> - struct nv50_miptree *mt = nv50_miptree(fb->cbufs[i]->texture);
> - struct nv50_surface *sf = nv50_surface(fb->cbufs[i]);
> - struct nouveau_bo *bo = mt->base.bo;
> + struct nv50_miptree *mt;
> + struct nv50_surface *sf;
> + struct nouveau_bo *bo;
> +
> + if (!fb->cbufs[i]) {
> + nv50_fb_set_null_rt(push, i);
> + continue;
> + }
> +
> + mt = nv50_miptree(fb->cbufs[i]->texture);
> + sf = nv50_surface(fb->cbufs[i]);
> + bo = mt->base.bo;
>
> array_size = MIN2(array_size, sf->depth);
> if (mt->layout_3d)
> diff --git a/src/gallium/drivers/nouveau/nvc0/nvc0_state_validate.c b/src/gallium/drivers/nouveau/nvc0/nvc0_state_validate.c
> index 0ba4bad..dd71c65 100644
> --- a/src/gallium/drivers/nouveau/nvc0/nvc0_state_validate.c
> +++ b/src/gallium/drivers/nouveau/nvc0/nvc0_state_validate.c
> @@ -2,6 +2,7 @@
> #include "util/u_math.h"
>
> #include "nvc0/nvc0_context.h"
> +#include "nv50/nv50_defs.xml.h"
>
> #if 0
> static void
> @@ -54,6 +55,18 @@ nvc0_validate_zcull(struct nvc0_context *nvc0)
> }
> #endif
>
> +static INLINE void
> +nvc0_fb_set_null_rt(struct nouveau_pushbuf *push, unsigned i)
> +{
> + BEGIN_NVC0(push, NVC0_3D(RT_ADDRESS_HIGH(i)), 6);
> + PUSH_DATA (push, 0);
> + PUSH_DATA (push, 0);
> + PUSH_DATA (push, 64);
> + PUSH_DATA (push, 0);
> + PUSH_DATA (push, NV50_SURFACE_FORMAT_NONE);
> + PUSH_DATA (push, 0);
> +}
> +
> static void
> nvc0_validate_fb(struct nvc0_context *nvc0)
> {
> @@ -72,9 +85,18 @@ nvc0_validate_fb(struct nvc0_context *nvc0)
> PUSH_DATA (push, fb->height << 16);
>
> for (i = 0; i < fb->nr_cbufs; ++i) {
> - struct nv50_surface *sf = nv50_surface(fb->cbufs[i]);
> - struct nv04_resource *res = nv04_resource(sf->base.texture);
> - struct nouveau_bo *bo = res->bo;
> + struct nv50_surface *sf;
> + struct nv04_resource *res;
> + struct nouveau_bo *bo;
> +
> + if (!fb->cbufs[i]) {
> + nvc0_fb_set_null_rt(push, i);
> + continue;
> + }
> +
> + sf = nv50_surface(fb->cbufs[i]);
> + res = nv04_resource(sf->base.texture);
> + bo = res->bo;
>
> BEGIN_NVC0(push, NVC0_3D(RT_ADDRESS_HIGH(i)), 9);
> PUSH_DATAh(push, res->address + sf->offset);
>
next prev parent reply other threads:[~2014-01-23 19:40 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
[not found] ` <52E17C0C.9050305-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org>
2014-01-23 20:33 ` [Mesa-dev] " Ilia Mirkin
2014-01-23 19:40 ` Emil Velikov [this message]
[not found] ` <52E1701A.3060203-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org>
2014-01-23 19:39 ` [PATCH v2] nv50, nvc0: clear out RT on a null cbuf 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=52E1701A.3060203@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.