Re: [Mesa-dev] [PATCH 1/3] nvc0: move nvc0_validate_global_residents() to nvc0_compute.c

2016-02-24 Thread Samuel Pitoiset



On 02/24/2016 08:37 PM, Pierre Moreau wrote:

Hello Samuel,

On 06:44 PM - Feb 24 2016, Samuel Pitoiset wrote:

While we are at it, rename it to nvc0_compute_validate_globals() and
update its prototype.

Signed-off-by: Samuel Pitoiset 
---
  src/gallium/drivers/nouveau/nvc0/nvc0_compute.c| 15 +++
  src/gallium/drivers/nouveau/nvc0/nvc0_context.h|  3 +--
  src/gallium/drivers/nouveau/nvc0/nvc0_state_validate.c | 15 ---
  src/gallium/drivers/nouveau/nvc0/nve4_compute.c|  3 +--
  4 files changed, 17 insertions(+), 19 deletions(-)

diff --git a/src/gallium/drivers/nouveau/nvc0/nvc0_compute.c 
b/src/gallium/drivers/nouveau/nvc0/nvc0_compute.c
index 0f1265f..7809a11 100644
--- a/src/gallium/drivers/nouveau/nvc0/nvc0_compute.c
+++ b/src/gallium/drivers/nouveau/nvc0/nvc0_compute.c
@@ -274,6 +274,21 @@ nvc0_compute_validate_buffers(struct nvc0_context *nvc0)
 }
  }

+void
+nvc0_compute_validate_globals(struct nvc0_context *nvc0)
+{
+   unsigned i;
+
+   for (i = 0; i < nvc0->global_residents.size / sizeof(struct pipe_resource 
*);


I get that renaming `nvc0_validate_global_residents()` to
`nvc0_compte_validate_globals()` brings more consistency with the other
`nvXY_compute_validate_*()` functions, but then one might be tempted to rename
`global_residents` to only `globals`. So if we can't remove the other
`*_residents?`, I would probably keep it in
`nvc0_compute_validate_global_residents()`.


The most important thing in this patch is the prototype change. It needs 
to be consistent with the other nvXX_validate_XX() to improve the 
validation path for compute (ie. prototype has to be void 
nvXX_validate_XXstruct nvc0_context *))




Other than that, Acked-by: Pierre Moreau 

Pierre


+++i) {
+  struct pipe_resource *res = *util_dynarray_element(
+ >global_residents, struct pipe_resource *, i);
+  if (res)
+ nvc0_add_resident(nvc0->bufctx_cp, NVC0_BIND_CP_GLOBAL,
+   nv04_resource(res), NOUVEAU_BO_RDWR);
+   }
+}
+
  static bool
  nvc0_compute_state_validate(struct nvc0_context *nvc0)
  {
diff --git a/src/gallium/drivers/nouveau/nvc0/nvc0_context.h 
b/src/gallium/drivers/nouveau/nvc0/nvc0_context.h
index d3e3a81..7aa4b62 100644
--- a/src/gallium/drivers/nouveau/nvc0/nvc0_context.h
+++ b/src/gallium/drivers/nouveau/nvc0/nvc0_context.h
@@ -261,8 +261,6 @@ void nvc0_tfb_validate(struct nvc0_context *);
  extern void nvc0_init_state_functions(struct nvc0_context *);

  /* nvc0_state_validate.c */
-void nvc0_validate_global_residents(struct nvc0_context *,
-struct nouveau_bufctx *, int bin);
  bool nvc0_state_validate(struct nvc0_context *, uint32_t state_mask);

  /* nvc0_surface.c */
@@ -342,5 +340,6 @@ void nve4_launch_grid(struct pipe_context *, const struct 
pipe_grid_info *);

  /* nvc0_compute.c */
  void nvc0_launch_grid(struct pipe_context *, const struct pipe_grid_info *);
+void nvc0_compute_validate_globals(struct nvc0_context *);

  #endif
diff --git a/src/gallium/drivers/nouveau/nvc0/nvc0_state_validate.c 
b/src/gallium/drivers/nouveau/nvc0/nvc0_state_validate.c
index 18e79e36..fbf45ce 100644
--- a/src/gallium/drivers/nouveau/nvc0/nvc0_state_validate.c
+++ b/src/gallium/drivers/nouveau/nvc0/nvc0_state_validate.c
@@ -559,21 +559,6 @@ nvc0_validate_driverconst(struct nvc0_context *nvc0)
 nvc0->dirty_cp |= NVC0_NEW_CP_DRIVERCONST;
  }

-void
-nvc0_validate_global_residents(struct nvc0_context *nvc0,
-   struct nouveau_bufctx *bctx, int bin)
-{
-   unsigned i;
-
-   for (i = 0; i < nvc0->global_residents.size / sizeof(struct pipe_resource 
*);
-++i) {
-  struct pipe_resource *res = *util_dynarray_element(
- >global_residents, struct pipe_resource *, i);
-  if (res)
- nvc0_add_resident(bctx, bin, nv04_resource(res), NOUVEAU_BO_RDWR);
-   }
-}
-
  static void
  nvc0_validate_derived_1(struct nvc0_context *nvc0)
  {
diff --git a/src/gallium/drivers/nouveau/nvc0/nve4_compute.c 
b/src/gallium/drivers/nouveau/nvc0/nve4_compute.c
index 652bc6d..5c73740 100644
--- a/src/gallium/drivers/nouveau/nvc0/nve4_compute.c
+++ b/src/gallium/drivers/nouveau/nvc0/nve4_compute.c
@@ -317,8 +317,7 @@ nve4_compute_state_validate(struct nvc0_context *nvc0)
 if (nvc0->dirty_cp & NVC0_NEW_CP_SURFACES)
nve4_compute_validate_surfaces(nvc0);
 if (nvc0->dirty_cp & NVC0_NEW_CP_GLOBALS)
-  nvc0_validate_global_residents(nvc0,
- nvc0->bufctx_cp, NVC0_BIND_CP_GLOBAL);
+  nvc0_compute_validate_globals(nvc0);

 nvc0_bufctx_fence(nvc0, nvc0->bufctx_cp, false);

--
2.6.4

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

___
mesa-dev mailing list
mesa-dev@lists.freedesktop.org

Re: [Mesa-dev] [PATCH 1/3] nvc0: move nvc0_validate_global_residents() to nvc0_compute.c

2016-02-24 Thread Pierre Moreau
Hello Samuel,

On 06:44 PM - Feb 24 2016, Samuel Pitoiset wrote:
> While we are at it, rename it to nvc0_compute_validate_globals() and
> update its prototype.
> 
> Signed-off-by: Samuel Pitoiset 
> ---
>  src/gallium/drivers/nouveau/nvc0/nvc0_compute.c| 15 +++
>  src/gallium/drivers/nouveau/nvc0/nvc0_context.h|  3 +--
>  src/gallium/drivers/nouveau/nvc0/nvc0_state_validate.c | 15 ---
>  src/gallium/drivers/nouveau/nvc0/nve4_compute.c|  3 +--
>  4 files changed, 17 insertions(+), 19 deletions(-)
> 
> diff --git a/src/gallium/drivers/nouveau/nvc0/nvc0_compute.c 
> b/src/gallium/drivers/nouveau/nvc0/nvc0_compute.c
> index 0f1265f..7809a11 100644
> --- a/src/gallium/drivers/nouveau/nvc0/nvc0_compute.c
> +++ b/src/gallium/drivers/nouveau/nvc0/nvc0_compute.c
> @@ -274,6 +274,21 @@ nvc0_compute_validate_buffers(struct nvc0_context *nvc0)
> }
>  }
>  
> +void
> +nvc0_compute_validate_globals(struct nvc0_context *nvc0)
> +{
> +   unsigned i;
> +
> +   for (i = 0; i < nvc0->global_residents.size / sizeof(struct pipe_resource 
> *);

I get that renaming `nvc0_validate_global_residents()` to
`nvc0_compte_validate_globals()` brings more consistency with the other
`nvXY_compute_validate_*()` functions, but then one might be tempted to rename
`global_residents` to only `globals`. So if we can't remove the other
`*_residents?`, I would probably keep it in
`nvc0_compute_validate_global_residents()`.

Other than that, Acked-by: Pierre Moreau 

Pierre

> +++i) {
> +  struct pipe_resource *res = *util_dynarray_element(
> + >global_residents, struct pipe_resource *, i);
> +  if (res)
> + nvc0_add_resident(nvc0->bufctx_cp, NVC0_BIND_CP_GLOBAL,
> +   nv04_resource(res), NOUVEAU_BO_RDWR);
> +   }
> +}
> +
>  static bool
>  nvc0_compute_state_validate(struct nvc0_context *nvc0)
>  {
> diff --git a/src/gallium/drivers/nouveau/nvc0/nvc0_context.h 
> b/src/gallium/drivers/nouveau/nvc0/nvc0_context.h
> index d3e3a81..7aa4b62 100644
> --- a/src/gallium/drivers/nouveau/nvc0/nvc0_context.h
> +++ b/src/gallium/drivers/nouveau/nvc0/nvc0_context.h
> @@ -261,8 +261,6 @@ void nvc0_tfb_validate(struct nvc0_context *);
>  extern void nvc0_init_state_functions(struct nvc0_context *);
>  
>  /* nvc0_state_validate.c */
> -void nvc0_validate_global_residents(struct nvc0_context *,
> -struct nouveau_bufctx *, int bin);
>  bool nvc0_state_validate(struct nvc0_context *, uint32_t state_mask);
>  
>  /* nvc0_surface.c */
> @@ -342,5 +340,6 @@ void nve4_launch_grid(struct pipe_context *, const struct 
> pipe_grid_info *);
>  
>  /* nvc0_compute.c */
>  void nvc0_launch_grid(struct pipe_context *, const struct pipe_grid_info *);
> +void nvc0_compute_validate_globals(struct nvc0_context *);
>  
>  #endif
> diff --git a/src/gallium/drivers/nouveau/nvc0/nvc0_state_validate.c 
> b/src/gallium/drivers/nouveau/nvc0/nvc0_state_validate.c
> index 18e79e36..fbf45ce 100644
> --- a/src/gallium/drivers/nouveau/nvc0/nvc0_state_validate.c
> +++ b/src/gallium/drivers/nouveau/nvc0/nvc0_state_validate.c
> @@ -559,21 +559,6 @@ nvc0_validate_driverconst(struct nvc0_context *nvc0)
> nvc0->dirty_cp |= NVC0_NEW_CP_DRIVERCONST;
>  }
>  
> -void
> -nvc0_validate_global_residents(struct nvc0_context *nvc0,
> -   struct nouveau_bufctx *bctx, int bin)
> -{
> -   unsigned i;
> -
> -   for (i = 0; i < nvc0->global_residents.size / sizeof(struct pipe_resource 
> *);
> -++i) {
> -  struct pipe_resource *res = *util_dynarray_element(
> - >global_residents, struct pipe_resource *, i);
> -  if (res)
> - nvc0_add_resident(bctx, bin, nv04_resource(res), NOUVEAU_BO_RDWR);
> -   }
> -}
> -
>  static void
>  nvc0_validate_derived_1(struct nvc0_context *nvc0)
>  {
> diff --git a/src/gallium/drivers/nouveau/nvc0/nve4_compute.c 
> b/src/gallium/drivers/nouveau/nvc0/nve4_compute.c
> index 652bc6d..5c73740 100644
> --- a/src/gallium/drivers/nouveau/nvc0/nve4_compute.c
> +++ b/src/gallium/drivers/nouveau/nvc0/nve4_compute.c
> @@ -317,8 +317,7 @@ nve4_compute_state_validate(struct nvc0_context *nvc0)
> if (nvc0->dirty_cp & NVC0_NEW_CP_SURFACES)
>nve4_compute_validate_surfaces(nvc0);
> if (nvc0->dirty_cp & NVC0_NEW_CP_GLOBALS)
> -  nvc0_validate_global_residents(nvc0,
> - nvc0->bufctx_cp, NVC0_BIND_CP_GLOBAL);
> +  nvc0_compute_validate_globals(nvc0);
>  
> nvc0_bufctx_fence(nvc0, nvc0->bufctx_cp, false);
>  
> -- 
> 2.6.4
> 
> ___
> mesa-dev mailing list
> mesa-dev@lists.freedesktop.org
> https://lists.freedesktop.org/mailman/listinfo/mesa-dev


signature.asc
Description: PGP signature
___
mesa-dev mailing list
mesa-dev@lists.freedesktop.org

[Mesa-dev] [PATCH 1/3] nvc0: move nvc0_validate_global_residents() to nvc0_compute.c

2016-02-24 Thread Samuel Pitoiset
While we are at it, rename it to nvc0_compute_validate_globals() and
update its prototype.

Signed-off-by: Samuel Pitoiset 
---
 src/gallium/drivers/nouveau/nvc0/nvc0_compute.c| 15 +++
 src/gallium/drivers/nouveau/nvc0/nvc0_context.h|  3 +--
 src/gallium/drivers/nouveau/nvc0/nvc0_state_validate.c | 15 ---
 src/gallium/drivers/nouveau/nvc0/nve4_compute.c|  3 +--
 4 files changed, 17 insertions(+), 19 deletions(-)

diff --git a/src/gallium/drivers/nouveau/nvc0/nvc0_compute.c 
b/src/gallium/drivers/nouveau/nvc0/nvc0_compute.c
index 0f1265f..7809a11 100644
--- a/src/gallium/drivers/nouveau/nvc0/nvc0_compute.c
+++ b/src/gallium/drivers/nouveau/nvc0/nvc0_compute.c
@@ -274,6 +274,21 @@ nvc0_compute_validate_buffers(struct nvc0_context *nvc0)
}
 }
 
+void
+nvc0_compute_validate_globals(struct nvc0_context *nvc0)
+{
+   unsigned i;
+
+   for (i = 0; i < nvc0->global_residents.size / sizeof(struct pipe_resource 
*);
+++i) {
+  struct pipe_resource *res = *util_dynarray_element(
+ >global_residents, struct pipe_resource *, i);
+  if (res)
+ nvc0_add_resident(nvc0->bufctx_cp, NVC0_BIND_CP_GLOBAL,
+   nv04_resource(res), NOUVEAU_BO_RDWR);
+   }
+}
+
 static bool
 nvc0_compute_state_validate(struct nvc0_context *nvc0)
 {
diff --git a/src/gallium/drivers/nouveau/nvc0/nvc0_context.h 
b/src/gallium/drivers/nouveau/nvc0/nvc0_context.h
index d3e3a81..7aa4b62 100644
--- a/src/gallium/drivers/nouveau/nvc0/nvc0_context.h
+++ b/src/gallium/drivers/nouveau/nvc0/nvc0_context.h
@@ -261,8 +261,6 @@ void nvc0_tfb_validate(struct nvc0_context *);
 extern void nvc0_init_state_functions(struct nvc0_context *);
 
 /* nvc0_state_validate.c */
-void nvc0_validate_global_residents(struct nvc0_context *,
-struct nouveau_bufctx *, int bin);
 bool nvc0_state_validate(struct nvc0_context *, uint32_t state_mask);
 
 /* nvc0_surface.c */
@@ -342,5 +340,6 @@ void nve4_launch_grid(struct pipe_context *, const struct 
pipe_grid_info *);
 
 /* nvc0_compute.c */
 void nvc0_launch_grid(struct pipe_context *, const struct pipe_grid_info *);
+void nvc0_compute_validate_globals(struct nvc0_context *);
 
 #endif
diff --git a/src/gallium/drivers/nouveau/nvc0/nvc0_state_validate.c 
b/src/gallium/drivers/nouveau/nvc0/nvc0_state_validate.c
index 18e79e36..fbf45ce 100644
--- a/src/gallium/drivers/nouveau/nvc0/nvc0_state_validate.c
+++ b/src/gallium/drivers/nouveau/nvc0/nvc0_state_validate.c
@@ -559,21 +559,6 @@ nvc0_validate_driverconst(struct nvc0_context *nvc0)
nvc0->dirty_cp |= NVC0_NEW_CP_DRIVERCONST;
 }
 
-void
-nvc0_validate_global_residents(struct nvc0_context *nvc0,
-   struct nouveau_bufctx *bctx, int bin)
-{
-   unsigned i;
-
-   for (i = 0; i < nvc0->global_residents.size / sizeof(struct pipe_resource 
*);
-++i) {
-  struct pipe_resource *res = *util_dynarray_element(
- >global_residents, struct pipe_resource *, i);
-  if (res)
- nvc0_add_resident(bctx, bin, nv04_resource(res), NOUVEAU_BO_RDWR);
-   }
-}
-
 static void
 nvc0_validate_derived_1(struct nvc0_context *nvc0)
 {
diff --git a/src/gallium/drivers/nouveau/nvc0/nve4_compute.c 
b/src/gallium/drivers/nouveau/nvc0/nve4_compute.c
index 652bc6d..5c73740 100644
--- a/src/gallium/drivers/nouveau/nvc0/nve4_compute.c
+++ b/src/gallium/drivers/nouveau/nvc0/nve4_compute.c
@@ -317,8 +317,7 @@ nve4_compute_state_validate(struct nvc0_context *nvc0)
if (nvc0->dirty_cp & NVC0_NEW_CP_SURFACES)
   nve4_compute_validate_surfaces(nvc0);
if (nvc0->dirty_cp & NVC0_NEW_CP_GLOBALS)
-  nvc0_validate_global_residents(nvc0,
- nvc0->bufctx_cp, NVC0_BIND_CP_GLOBAL);
+  nvc0_compute_validate_globals(nvc0);
 
nvc0_bufctx_fence(nvc0, nvc0->bufctx_cp, false);
 
-- 
2.6.4

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