[Mesa-dev] [PATCH] nvc0: use a define for the driver constant buffer size

Ilia Mirkin imirkin at alum.mit.edu
Mon Jul 11 20:28:10 UTC 2016


Reviewed-by: Ilia Mirkin <imirkin at alum.mit.edu>

On Mon, Jul 11, 2016 at 4:25 PM, Samuel Pitoiset
<samuel.pitoiset at gmail.com> wrote:
> This might avoid mistakes if the size is bumped in the future.
>
> Signed-off-by: Samuel Pitoiset <samuel.pitoiset at gmail.com>
> ---
>  src/gallium/drivers/nouveau/nvc0/nvc0_compute.c        | 8 ++++----
>  src/gallium/drivers/nouveau/nvc0/nvc0_context.h        | 4 ++--
>  src/gallium/drivers/nouveau/nvc0/nvc0_query_hw_sm.c    | 2 +-
>  src/gallium/drivers/nouveau/nvc0/nvc0_screen.c         | 2 +-
>  src/gallium/drivers/nouveau/nvc0/nvc0_state_validate.c | 8 ++++----
>  src/gallium/drivers/nouveau/nvc0/nvc0_tex.c            | 6 +++---
>  src/gallium/drivers/nouveau/nvc0/nvc0_vbo.c            | 4 ++--
>  7 files changed, 17 insertions(+), 17 deletions(-)
>
> diff --git a/src/gallium/drivers/nouveau/nvc0/nvc0_compute.c b/src/gallium/drivers/nouveau/nvc0/nvc0_compute.c
> index 10a4c83..dc4d1b3 100644
> --- a/src/gallium/drivers/nouveau/nvc0/nvc0_compute.c
> +++ b/src/gallium/drivers/nouveau/nvc0/nvc0_compute.c
> @@ -115,7 +115,7 @@ nvc0_screen_compute_setup(struct nvc0_screen *screen,
>
>     /* MS sample coordinate offsets */
>     BEGIN_NVC0(push, NVC0_CP(CB_SIZE), 3);
> -   PUSH_DATA (push, 2048);
> +   PUSH_DATA (push, NVC0_CB_AUX_SIZE);
>     PUSH_DATAh(push, screen->uniform_bo->offset + NVC0_CB_AUX_INFO(5));
>     PUSH_DATA (push, screen->uniform_bo->offset + NVC0_CB_AUX_INFO(5));
>     BEGIN_1IC0(push, NVC0_CP(CB_POS), 1 + 2 * 8);
> @@ -253,7 +253,7 @@ nvc0_compute_validate_driverconst(struct nvc0_context *nvc0)
>     struct nvc0_screen *screen = nvc0->screen;
>
>     BEGIN_NVC0(push, NVC0_CP(CB_SIZE), 3);
> -   PUSH_DATA (push, 2048);
> +   PUSH_DATA (push, NVC0_CB_AUX_SIZE);
>     PUSH_DATAh(push, screen->uniform_bo->offset + NVC0_CB_AUX_INFO(5));
>     PUSH_DATA (push, screen->uniform_bo->offset + NVC0_CB_AUX_INFO(5));
>     BEGIN_NVC0(push, NVC0_CP(CB_BIND), 1);
> @@ -271,7 +271,7 @@ nvc0_compute_validate_buffers(struct nvc0_context *nvc0)
>     int i;
>
>     BEGIN_NVC0(push, NVC0_CP(CB_SIZE), 3);
> -   PUSH_DATA (push, 2048);
> +   PUSH_DATA (push, NVC0_CB_AUX_SIZE);
>     PUSH_DATAh(push, screen->uniform_bo->offset + NVC0_CB_AUX_INFO(s));
>     PUSH_DATA (push, screen->uniform_bo->offset + NVC0_CB_AUX_INFO(s));
>     BEGIN_1IC0(push, NVC0_CP(CB_POS), 1 + 4 * NVC0_MAX_BUFFERS);
> @@ -406,7 +406,7 @@ nvc0_compute_upload_input(struct nvc0_context *nvc0,
>     }
>
>     BEGIN_NVC0(push, NVC0_CP(CB_SIZE), 3);
> -   PUSH_DATA (push, 2048);
> +   PUSH_DATA (push, NVC0_CB_AUX_SIZE);
>     PUSH_DATAh(push, screen->uniform_bo->offset + NVC0_CB_AUX_INFO(5));
>     PUSH_DATA (push, screen->uniform_bo->offset + NVC0_CB_AUX_INFO(5));
>
> diff --git a/src/gallium/drivers/nouveau/nvc0/nvc0_context.h b/src/gallium/drivers/nouveau/nvc0/nvc0_context.h
> index f6d535a..7acd477 100644
> --- a/src/gallium/drivers/nouveau/nvc0/nvc0_context.h
> +++ b/src/gallium/drivers/nouveau/nvc0/nvc0_context.h
> @@ -104,7 +104,7 @@
>  #define NVC0_CB_USR_SIZE            (6 << 16)
>  /* 6 driver constbuts, at 2K each */
>  #define NVC0_CB_AUX_INFO(s)         NVC0_CB_USR_SIZE + (s << 11)
> -#define NVC0_CB_AUX_SIZE            (6 << 11)
> +#define NVC0_CB_AUX_SIZE            (1 << 11)
>  /* XXX: Figure out what this UNK data is. */
>  #define NVC0_CB_AUX_UNK_INFO        0x000
>  #define NVC0_CB_AUX_UNK_SIZE        (8 * 4)
> @@ -138,7 +138,7 @@
>  #define NVC0_CB_AUX_MP_INFO         0x600
>  #define NVC0_CB_AUX_MP_SIZE         3 * 4
>  /* 4 32-bits floats for the vertex runout, put at the end */
> -#define NVC0_CB_AUX_RUNOUT_INFO     NVC0_CB_USR_SIZE + NVC0_CB_AUX_SIZE
> +#define NVC0_CB_AUX_RUNOUT_INFO     NVC0_CB_USR_SIZE + (NVC0_CB_AUX_SIZE * 6)
>
>  struct nvc0_blitctx;
>
> diff --git a/src/gallium/drivers/nouveau/nvc0/nvc0_query_hw_sm.c b/src/gallium/drivers/nouveau/nvc0/nvc0_query_hw_sm.c
> index 27cbbc4..944349d 100644
> --- a/src/gallium/drivers/nouveau/nvc0/nvc0_query_hw_sm.c
> +++ b/src/gallium/drivers/nouveau/nvc0/nvc0_query_hw_sm.c
> @@ -1836,7 +1836,7 @@ nvc0_hw_sm_upload_input(struct nvc0_context *nvc0, struct nvc0_hw_query *hq)
>        PUSH_DATA (push, NVE4_COMPUTE_UPLOAD_EXEC_LINEAR | (0x20 << 1));
>     } else {
>        BEGIN_NVC0(push, NVC0_CP(CB_SIZE), 3);
> -      PUSH_DATA (push, 2048);
> +      PUSH_DATA (push, NVC0_CB_AUX_SIZE);
>        PUSH_DATAh(push, address);
>        PUSH_DATA (push, address);
>        BEGIN_1IC0(push, NVC0_CP(CB_POS), 1 + 3);
> diff --git a/src/gallium/drivers/nouveau/nvc0/nvc0_screen.c b/src/gallium/drivers/nouveau/nvc0/nvc0_screen.c
> index e0bfd3b..d22150a 100644
> --- a/src/gallium/drivers/nouveau/nvc0/nvc0_screen.c
> +++ b/src/gallium/drivers/nouveau/nvc0/nvc0_screen.c
> @@ -960,7 +960,7 @@ nvc0_screen_create(struct nouveau_device *dev)
>        /* TIC and TSC entries for each unit (nve4+ only) */
>        /* auxiliary constants (6 user clip planes, base instance id) */
>        BEGIN_NVC0(push, NVC0_3D(CB_SIZE), 3);
> -      PUSH_DATA (push, 2048);
> +      PUSH_DATA (push, NVC0_CB_AUX_SIZE);
>        PUSH_DATAh(push, screen->uniform_bo->offset + NVC0_CB_AUX_INFO(i));
>        PUSH_DATA (push, screen->uniform_bo->offset + NVC0_CB_AUX_INFO(i));
>        BEGIN_NVC0(push, NVC0_3D(CB_BIND(i)), 1);
> diff --git a/src/gallium/drivers/nouveau/nvc0/nvc0_state_validate.c b/src/gallium/drivers/nouveau/nvc0/nvc0_state_validate.c
> index 558133f..7ccb601 100644
> --- a/src/gallium/drivers/nouveau/nvc0/nvc0_state_validate.c
> +++ b/src/gallium/drivers/nouveau/nvc0/nvc0_state_validate.c
> @@ -199,7 +199,7 @@ nvc0_validate_fb(struct nvc0_context *nvc0)
>
>      ms = 1 << ms_mode;
>      BEGIN_NVC0(push, NVC0_3D(CB_SIZE), 3);
> -    PUSH_DATA (push, 2048);
> +    PUSH_DATA (push, NVC0_CB_AUX_SIZE);
>      PUSH_DATAh(push, screen->uniform_bo->offset + NVC0_CB_AUX_INFO(4));
>      PUSH_DATA (push, screen->uniform_bo->offset + NVC0_CB_AUX_INFO(4));
>      BEGIN_1IC0(push, NVC0_3D(CB_POS), 1 + 2 * ms);
> @@ -357,7 +357,7 @@ nvc0_upload_uclip_planes(struct nvc0_context *nvc0, unsigned s)
>     struct nvc0_screen *screen = nvc0->screen;
>
>     BEGIN_NVC0(push, NVC0_3D(CB_SIZE), 3);
> -   PUSH_DATA (push, 2048);
> +   PUSH_DATA (push, NVC0_CB_AUX_SIZE);
>     PUSH_DATAh(push, screen->uniform_bo->offset + NVC0_CB_AUX_INFO(s));
>     PUSH_DATA (push, screen->uniform_bo->offset + NVC0_CB_AUX_INFO(s));
>     BEGIN_1IC0(push, NVC0_3D(CB_POS), PIPE_MAX_CLIP_PLANES * 4 + 1);
> @@ -527,7 +527,7 @@ nvc0_validate_buffers(struct nvc0_context *nvc0)
>
>     for (s = 0; s < 5; s++) {
>        BEGIN_NVC0(push, NVC0_3D(CB_SIZE), 3);
> -      PUSH_DATA (push, 2048);
> +      PUSH_DATA (push, NVC0_CB_AUX_SIZE);
>        PUSH_DATAh(push, screen->uniform_bo->offset + NVC0_CB_AUX_INFO(s));
>        PUSH_DATA (push, screen->uniform_bo->offset + NVC0_CB_AUX_INFO(s));
>        BEGIN_1IC0(push, NVC0_3D(CB_POS), 1 + 4 * NVC0_MAX_BUFFERS);
> @@ -603,7 +603,7 @@ nvc0_validate_driverconst(struct nvc0_context *nvc0)
>
>     for (i = 0; i < 5; ++i) {
>        BEGIN_NVC0(push, NVC0_3D(CB_SIZE), 3);
> -      PUSH_DATA (push, 2048);
> +      PUSH_DATA (push, NVC0_CB_AUX_SIZE);
>        PUSH_DATAh(push, screen->uniform_bo->offset + NVC0_CB_AUX_INFO(i));
>        PUSH_DATA (push, screen->uniform_bo->offset + NVC0_CB_AUX_INFO(i));
>        BEGIN_NVC0(push, NVC0_3D(CB_BIND(i)), 1);
> diff --git a/src/gallium/drivers/nouveau/nvc0/nvc0_tex.c b/src/gallium/drivers/nouveau/nvc0/nvc0_tex.c
> index 21d8e9d..5f7bba8 100644
> --- a/src/gallium/drivers/nouveau/nvc0/nvc0_tex.c
> +++ b/src/gallium/drivers/nouveau/nvc0/nvc0_tex.c
> @@ -735,7 +735,7 @@ nve4_set_tex_handles(struct nvc0_context *nvc0)
>        if (!dirty)
>           continue;
>        BEGIN_NVC0(push, NVC0_3D(CB_SIZE), 3);
> -      PUSH_DATA (push, 2048);
> +      PUSH_DATA (push, NVC0_CB_AUX_SIZE);
>        PUSH_DATAh(push, screen->uniform_bo->offset + NVC0_CB_AUX_INFO(s));
>        PUSH_DATA (push, screen->uniform_bo->offset + NVC0_CB_AUX_INFO(s));
>        do {
> @@ -1075,7 +1075,7 @@ nvc0_validate_suf(struct nvc0_context *nvc0, int s)
>           BEGIN_NVC0(push, NVC0_CP(CB_SIZE), 3);
>        else
>           BEGIN_NVC0(push, NVC0_3D(CB_SIZE), 3);
> -      PUSH_DATA (push, 2048);
> +      PUSH_DATA (push, NVC0_CB_AUX_SIZE);
>        PUSH_DATAh(push, screen->uniform_bo->offset + NVC0_CB_AUX_INFO(s));
>        PUSH_DATA (push, screen->uniform_bo->offset + NVC0_CB_AUX_INFO(s));
>        if (s == 5)
> @@ -1111,7 +1111,7 @@ nve4_update_surface_bindings(struct nvc0_context *nvc0)
>           continue;
>
>        BEGIN_NVC0(push, NVC0_3D(CB_SIZE), 3);
> -      PUSH_DATA (push, 2048);
> +      PUSH_DATA (push, NVC0_CB_AUX_SIZE);
>        PUSH_DATAh(push, screen->uniform_bo->offset + NVC0_CB_AUX_INFO(s));
>        PUSH_DATA (push, screen->uniform_bo->offset + NVC0_CB_AUX_INFO(s));
>        BEGIN_1IC0(push, NVC0_3D(CB_POS), 1 + 16 * NVC0_MAX_IMAGES);
> diff --git a/src/gallium/drivers/nouveau/nvc0/nvc0_vbo.c b/src/gallium/drivers/nouveau/nvc0/nvc0_vbo.c
> index 94274bc..69ca091 100644
> --- a/src/gallium/drivers/nouveau/nvc0/nvc0_vbo.c
> +++ b/src/gallium/drivers/nouveau/nvc0/nvc0_vbo.c
> @@ -835,7 +835,7 @@ nvc0_draw_indirect(struct nvc0_context *nvc0, const struct pipe_draw_info *info)
>
>     /* Queue things up to let the macros write params to the driver constbuf */
>     BEGIN_NVC0(push, NVC0_3D(CB_SIZE), 3);
> -   PUSH_DATA (push, 2048);
> +   PUSH_DATA (push, NVC0_CB_AUX_SIZE);
>     PUSH_DATAh(push, screen->uniform_bo->offset + NVC0_CB_AUX_INFO(0));
>     PUSH_DATA (push, screen->uniform_bo->offset + NVC0_CB_AUX_INFO(0));
>     BEGIN_NVC0(push, NVC0_3D(CB_POS), 1);
> @@ -979,7 +979,7 @@ nvc0_draw_vbo(struct pipe_context *pipe, const struct pipe_draw_info *info)
>     if (nvc0->vertprog->vp.need_draw_parameters) {
>        PUSH_SPACE(push, 9);
>        BEGIN_NVC0(push, NVC0_3D(CB_SIZE), 3);
> -      PUSH_DATA (push, 2048);
> +      PUSH_DATA (push, NVC0_CB_AUX_SIZE);
>        PUSH_DATAh(push, screen->uniform_bo->offset + NVC0_CB_AUX_INFO(0));
>        PUSH_DATA (push, screen->uniform_bo->offset + NVC0_CB_AUX_INFO(0));
>        if (!info->indirect) {
> --
> 2.8.0
>
> _______________________________________________
> 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