[Mesa-dev] [PATCH v2 04/13] nvc0: reserve an area for ubos info in the driver constbuf

Samuel Pitoiset samuel.pitoiset at gmail.com
Fri Apr 1 14:21:23 UTC 2016



On 04/01/2016 07:28 AM, Ilia Mirkin wrote:
> Please see if you can't rejigger some stuff to make it all fit into
> 1024... I know it will have to grow for images, but let's try to limit
> the damage...

I already tried, but I just can't because offsets in the driver cb must 
be aligned to 0x40 and I don't have enough free space to put ubos info.

>
> On Mar 31, 2016 12:09 PM, "Samuel Pitoiset" <samuel.pitoiset at gmail.com
> <mailto:samuel.pitoiset at gmail.com>> wrote:
>
>     The compute launch descriptor only allows to set up 8 CBs, but OpenGL
>     requires at least 12 UBOs. To bypass this limitation, we store the ubos
>     info into the driver constant buffer. This will be only used for Kepler.
>
>     This bumps the size of each shader area from 1K to 2K.
>
>     Signed-off-by: Samuel Pitoiset <samuel.pitoiset at gmail.com
>     <mailto:samuel.pitoiset at gmail.com>>
>     ---
>       src/gallium/drivers/nouveau/nvc0/nvc0_compute.c        | 4 ++--
>       src/gallium/drivers/nouveau/nvc0/nvc0_context.h        | 6 +++---
>       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            | 2 +-
>       src/gallium/drivers/nouveau/nvc0/nve4_compute.c        | 2 +-
>       6 files changed, 12 insertions(+), 12 deletions(-)
>
>     diff --git a/src/gallium/drivers/nouveau/nvc0/nvc0_compute.c
>     b/src/gallium/drivers/nouveau/nvc0/nvc0_compute.c
>     index 6aaa7ce..360d25b 100644
>     --- a/src/gallium/drivers/nouveau/nvc0/nvc0_compute.c
>     +++ b/src/gallium/drivers/nouveau/nvc0/nvc0_compute.c
>     @@ -206,7 +206,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, 1024);
>     +   PUSH_DATA (push, 2048);
>          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);
>     @@ -224,7 +224,7 @@ nvc0_compute_validate_buffers(struct
>     nvc0_context *nvc0)
>          int i;
>
>          BEGIN_NVC0(push, NVC0_CP(CB_SIZE), 3);
>     -   PUSH_DATA (push, 1024);
>     +   PUSH_DATA (push, 2048);
>          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);
>     diff --git a/src/gallium/drivers/nouveau/nvc0/nvc0_context.h
>     b/src/gallium/drivers/nouveau/nvc0/nvc0_context.h
>     index 34dff6a..021caa6 100644
>     --- a/src/gallium/drivers/nouveau/nvc0/nvc0_context.h
>     +++ b/src/gallium/drivers/nouveau/nvc0/nvc0_context.h
>     @@ -101,9 +101,9 @@
>       /* 6 user uniform buffers, at 64K each */
>       #define NVC0_CB_USR_INFO(s)         (s << 16)
>       #define NVC0_CB_USR_SIZE            (6 << 16)
>     -/* 6 driver constbuts, at 1K each */
>     -#define NVC0_CB_AUX_INFO(s)         NVC0_CB_USR_SIZE + (s << 10)
>     -#define NVC0_CB_AUX_SIZE            (6 << 10)
>     +/* 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)
>       /* XXX: Figure out what this UNK data is. */
>       #define NVC0_CB_AUX_UNK_INFO        0x000
>       #define NVC0_CB_AUX_UNK_SIZE        (8 * 4)
>     diff --git a/src/gallium/drivers/nouveau/nvc0/nvc0_screen.c
>     b/src/gallium/drivers/nouveau/nvc0/nvc0_screen.c
>     index 553c001..bf011c4 100644
>     --- a/src/gallium/drivers/nouveau/nvc0/nvc0_screen.c
>     +++ b/src/gallium/drivers/nouveau/nvc0/nvc0_screen.c
>     @@ -921,7 +921,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, 1024);
>     +      PUSH_DATA (push, 2048);
>             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 9c64482..ad45323 100644
>     --- a/src/gallium/drivers/nouveau/nvc0/nvc0_state_validate.c
>     +++ b/src/gallium/drivers/nouveau/nvc0/nvc0_state_validate.c
>     @@ -183,7 +183,7 @@ nvc0_validate_fb(struct nvc0_context *nvc0)
>
>           ms = 1 << ms_mode;
>           BEGIN_NVC0(push, NVC0_3D(CB_SIZE), 3);
>     -    PUSH_DATA (push, 1024);
>     +    PUSH_DATA (push, 2048);
>           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);
>     @@ -317,7 +317,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, 1024);
>     +   PUSH_DATA (push, 2048);
>          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);
>     @@ -484,7 +484,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, 1024);
>     +      PUSH_DATA (push, 2048);
>             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);
>     @@ -551,7 +551,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, 1024);
>     +      PUSH_DATA (push, 2048);
>             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 ce6a6dc..9baebdf 100644
>     --- a/src/gallium/drivers/nouveau/nvc0/nvc0_tex.c
>     +++ b/src/gallium/drivers/nouveau/nvc0/nvc0_tex.c
>     @@ -718,7 +718,7 @@ nve4_set_tex_handles(struct nvc0_context *nvc0)
>             if (!dirty)
>                continue;
>             BEGIN_NVC0(push, NVC0_3D(CB_SIZE), 3);
>     -      PUSH_DATA (push, 1024);
>     +      PUSH_DATA (push, 2048);
>             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 {
>     diff --git a/src/gallium/drivers/nouveau/nvc0/nve4_compute.c
>     b/src/gallium/drivers/nouveau/nvc0/nve4_compute.c
>     index 5f34092..ee09abb 100644
>     --- a/src/gallium/drivers/nouveau/nvc0/nve4_compute.c
>     +++ b/src/gallium/drivers/nouveau/nvc0/nve4_compute.c
>     @@ -502,7 +502,7 @@ nve4_compute_setup_launch_desc(struct
>     nvc0_context *nvc0,
>                                        NVC0_CB_USR_INFO(5), 1 << 16);
>          }
>          nve4_cp_launch_desc_set_cb(desc, 7, screen->uniform_bo,
>     -                              NVC0_CB_AUX_INFO(5), 1 << 10);
>     +                              NVC0_CB_AUX_INFO(5), 1 << 11);
>       }
>
>       static inline struct nve4_cp_launch_desc *
>     --
>     2.7.4
>
>     _______________________________________________
>     mesa-dev mailing list
>     mesa-dev at lists.freedesktop.org <mailto:mesa-dev at lists.freedesktop.org>
>     https://lists.freedesktop.org/mailman/listinfo/mesa-dev
>

-- 
-Samuel


More information about the mesa-dev mailing list