[Mesa-dev] [PATCH 4/6] nvc0: introduce a flushed flag for compute validation path

Ilia Mirkin imirkin at alum.mit.edu
Sun Feb 21 23:28:50 UTC 2016


On Sun, Feb 21, 2016 at 9:19 AM, Samuel Pitoiset
<samuel.pitoiset at gmail.com> wrote:
> Signed-off-by: Samuel Pitoiset <samuel.pitoiset at gmail.com>
> ---
>  src/gallium/drivers/nouveau/nvc0/nvc0_compute.c | 4 +++-
>  src/gallium/drivers/nouveau/nvc0/nvc0_context.c | 4 +++-
>  src/gallium/drivers/nouveau/nvc0/nvc0_screen.h  | 1 +
>  src/gallium/drivers/nouveau/nvc0/nve4_compute.c | 4 +++-
>  4 files changed, 10 insertions(+), 3 deletions(-)
>
> diff --git a/src/gallium/drivers/nouveau/nvc0/nvc0_compute.c b/src/gallium/drivers/nouveau/nvc0/nvc0_compute.c
> index 0717583..f76a10c 100644
> --- a/src/gallium/drivers/nouveau/nvc0/nvc0_compute.c
> +++ b/src/gallium/drivers/nouveau/nvc0/nvc0_compute.c
> @@ -281,8 +281,10 @@ nvc0_compute_state_validate(struct nvc0_context *nvc0)
>     nouveau_pushbuf_bufctx(nvc0->base.pushbuf, nvc0->bufctx_cp);
>     if (unlikely(nouveau_pushbuf_validate(nvc0->base.pushbuf)))
>        return false;
> -   if (unlikely(nvc0->state.flushed_3d))
> +   if (unlikely(nvc0->state.flushed_cp)) {
> +      nvc0->state.flushed_cp = false;
>        nvc0_bufctx_fence(nvc0, nvc0->bufctx_cp, true);
> +   }
>
>     return true;
>
> diff --git a/src/gallium/drivers/nouveau/nvc0/nvc0_context.c b/src/gallium/drivers/nouveau/nvc0/nvc0_context.c
> index 683fc20..cfd4cab 100644
> --- a/src/gallium/drivers/nouveau/nvc0/nvc0_context.c
> +++ b/src/gallium/drivers/nouveau/nvc0/nvc0_context.c
> @@ -176,8 +176,10 @@ nvc0_default_kick_notify(struct nouveau_pushbuf *push)
>     if (screen) {
>        nouveau_fence_next(&screen->base);
>        nouveau_fence_update(&screen->base, true);
> -      if (screen->cur_ctx)
> +      if (screen->cur_ctx) {
>           screen->cur_ctx->state.flushed_3d = true;
> +         screen->cur_ctx->state.flushed_cp = true;

I think that this basically makes it meaningless to have two separate
flags. This whole flushed thing is pretty confusing... please think
about how and why it exists, and then document it :) I don't fully
remember TBH. I think it has to do with not wanting to flush at the
end of every draw, but handling the case where a flush happens in the
middle of a draw (which means that a fence most likely went by and all
the current draw's objects need to be fenced on the new upcoming
fence). Or something. I don't think having a separate one for compute
makes sense. Although it's entirely possible that the way it's
currently handled in compute is buggy.

  -ilia

> +      }
>        NOUVEAU_DRV_STAT(&screen->base, pushbuf_count, 1);
>     }
>  }
> diff --git a/src/gallium/drivers/nouveau/nvc0/nvc0_screen.h b/src/gallium/drivers/nouveau/nvc0/nvc0_screen.h
> index 9a58da5..f47beee 100644
> --- a/src/gallium/drivers/nouveau/nvc0/nvc0_screen.h
> +++ b/src/gallium/drivers/nouveau/nvc0/nvc0_screen.h
> @@ -31,6 +31,7 @@ struct nvc0_blitter;
>
>  struct nvc0_graph_state {
>     bool flushed_3d;
> +   bool flushed_cp;
>     bool rasterizer_discard;
>     bool early_z_forced;
>     bool prim_restart;
> diff --git a/src/gallium/drivers/nouveau/nvc0/nve4_compute.c b/src/gallium/drivers/nouveau/nvc0/nve4_compute.c
> index e33458b..fae8c60 100644
> --- a/src/gallium/drivers/nouveau/nvc0/nve4_compute.c
> +++ b/src/gallium/drivers/nouveau/nvc0/nve4_compute.c
> @@ -338,8 +338,10 @@ nve4_compute_state_validate(struct nvc0_context *nvc0)
>     nouveau_pushbuf_bufctx(nvc0->base.pushbuf, nvc0->bufctx_cp);
>     if (unlikely(nouveau_pushbuf_validate(nvc0->base.pushbuf)))
>        return false;
> -   if (unlikely(nvc0->state.flushed_3d))
> +   if (unlikely(nvc0->state.flushed_cp)) {
> +      nvc0->state.flushed_cp = false;
>        nvc0_bufctx_fence(nvc0, nvc0->bufctx_cp, true);
> +   }
>
>     return true;
>  }
> --
> 2.6.4
>
> _______________________________________________
> 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