Re: [Mesa-dev] [PATCH 1/2] etnaviv: don't flush own context when updating resource use

2019-03-29 Thread Guido Günther
Hi,
On Wed, Mar 27, 2019 at 12:22:57PM +0100, Lucas Stach wrote:
> The context is self synchronizing at the GPU side, as commands are
> executed in order. We must not flush our own context when updating the
> resource use, as that leads to excessive flushing on effectively every
> draw call, causing huge CPU overhead.
> 
> Fixes: 64813541d575 (etnaviv: fix resource usage tracking across
> different pipe_context's)
> Signed-off-by: Lucas Stach 
> ---
>  src/gallium/drivers/etnaviv/etnaviv_resource.c | 11 ++-
>  1 file changed, 10 insertions(+), 1 deletion(-)
> 
> diff --git a/src/gallium/drivers/etnaviv/etnaviv_resource.c 
> b/src/gallium/drivers/etnaviv/etnaviv_resource.c
> index ab40414fbe2c..c7eedab74187 100644
> --- a/src/gallium/drivers/etnaviv/etnaviv_resource.c
> +++ b/src/gallium/drivers/etnaviv/etnaviv_resource.c
> @@ -666,9 +666,18 @@ etna_resource_used(struct etna_context *ctx, struct 
> pipe_resource *prsc,
>   struct etna_context *extctx = (struct etna_context *)entry->key;
>   struct pipe_context *pctx = >base;
>  
> + if (extctx == ctx)
> +continue;
> +
>   pctx->flush(pctx, NULL, 0);
> + /* It's safe to clear the status here. If we need to flush it means
> +  * either another context had the resource in exclusive (write) use,
> +  * or we transition the resource to exclusive use in our context.
> +  * In both cases the new status accurately reflects the resource use
> +  * after the flush.
> +  */
> + rsc->status = 0;
>}
> -  rsc->status = 0;
> }
>  
> rsc->status |= status;

Reviewed-By: Guido Günther  
___
mesa-dev mailing list
mesa-dev@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/mesa-dev

Re: [Mesa-dev] [PATCH 1/2] etnaviv: don't flush own context when updating resource use

2019-03-27 Thread Christian Gmeiner
Am Mi., 27. März 2019 um 12:23 Uhr schrieb Lucas Stach :
>
> The context is self synchronizing at the GPU side, as commands are
> executed in order. We must not flush our own context when updating the
> resource use, as that leads to excessive flushing on effectively every
> draw call, causing huge CPU overhead.
>
> Fixes: 64813541d575 (etnaviv: fix resource usage tracking across
> different pipe_context's)
> Signed-off-by: Lucas Stach 

Reviewed-by: Christian Gmeiner 

> ---
>  src/gallium/drivers/etnaviv/etnaviv_resource.c | 11 ++-
>  1 file changed, 10 insertions(+), 1 deletion(-)
>
> diff --git a/src/gallium/drivers/etnaviv/etnaviv_resource.c 
> b/src/gallium/drivers/etnaviv/etnaviv_resource.c
> index ab40414fbe2c..c7eedab74187 100644
> --- a/src/gallium/drivers/etnaviv/etnaviv_resource.c
> +++ b/src/gallium/drivers/etnaviv/etnaviv_resource.c
> @@ -666,9 +666,18 @@ etna_resource_used(struct etna_context *ctx, struct 
> pipe_resource *prsc,
>   struct etna_context *extctx = (struct etna_context *)entry->key;
>   struct pipe_context *pctx = >base;
>
> + if (extctx == ctx)
> +continue;
> +
>   pctx->flush(pctx, NULL, 0);
> + /* It's safe to clear the status here. If we need to flush it means
> +  * either another context had the resource in exclusive (write) use,
> +  * or we transition the resource to exclusive use in our context.
> +  * In both cases the new status accurately reflects the resource use
> +  * after the flush.
> +  */
> + rsc->status = 0;
>}
> -  rsc->status = 0;
> }
>
> rsc->status |= status;
> --
> 2.20.1
>


-- 
greets
--
Christian Gmeiner, MSc

https://christian-gmeiner.info
___
mesa-dev mailing list
mesa-dev@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/mesa-dev

[Mesa-dev] [PATCH 1/2] etnaviv: don't flush own context when updating resource use

2019-03-27 Thread Lucas Stach
The context is self synchronizing at the GPU side, as commands are
executed in order. We must not flush our own context when updating the
resource use, as that leads to excessive flushing on effectively every
draw call, causing huge CPU overhead.

Fixes: 64813541d575 (etnaviv: fix resource usage tracking across
different pipe_context's)
Signed-off-by: Lucas Stach 
---
 src/gallium/drivers/etnaviv/etnaviv_resource.c | 11 ++-
 1 file changed, 10 insertions(+), 1 deletion(-)

diff --git a/src/gallium/drivers/etnaviv/etnaviv_resource.c 
b/src/gallium/drivers/etnaviv/etnaviv_resource.c
index ab40414fbe2c..c7eedab74187 100644
--- a/src/gallium/drivers/etnaviv/etnaviv_resource.c
+++ b/src/gallium/drivers/etnaviv/etnaviv_resource.c
@@ -666,9 +666,18 @@ etna_resource_used(struct etna_context *ctx, struct 
pipe_resource *prsc,
  struct etna_context *extctx = (struct etna_context *)entry->key;
  struct pipe_context *pctx = >base;
 
+ if (extctx == ctx)
+continue;
+
  pctx->flush(pctx, NULL, 0);
+ /* It's safe to clear the status here. If we need to flush it means
+  * either another context had the resource in exclusive (write) use,
+  * or we transition the resource to exclusive use in our context.
+  * In both cases the new status accurately reflects the resource use
+  * after the flush.
+  */
+ rsc->status = 0;
   }
-  rsc->status = 0;
}
 
rsc->status |= status;
-- 
2.20.1

___
mesa-dev mailing list
mesa-dev@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/mesa-dev