intel: Take a gen_l3_config in gen_get_urb_config
authorJason Ekstrand <jason@jlekstrand.net>
Thu, 16 Jan 2020 23:02:26 +0000 (17:02 -0600)
committerJason Ekstrand <jason@jlekstrand.net>
Fri, 31 Jan 2020 00:46:18 +0000 (18:46 -0600)
Instead of making each driver pass in the same push constant size and do
it's own L3$ config URB size calculation, just make them pass in their
L3$ configuration.

Cc: "20.0" mesa-stable@lists.freedesktop.org
Reviewed-by: Kenneth Graunke <kenneth@whitecape.org>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/merge_requests/3454>

src/gallium/drivers/iris/iris_state.c
src/intel/common/gen_l3_config.h
src/intel/common/gen_urb_config.c
src/intel/vulkan/genX_pipeline.c
src/mesa/drivers/dri/i965/gen7_urb.c

index 9467f5d17421f92ab56cbcb7308a02f5557296cf..2593bf45b2a6051149313570444f95aebdea82f9 100644 (file)
@@ -7225,15 +7225,12 @@ genX(emit_urb_setup)(struct iris_context *ice,
                      bool tess_present, bool gs_present)
 {
    const struct gen_device_info *devinfo = &batch->screen->devinfo;
-   const struct gen_l3_config *l3_config = batch->screen->l3_config_3d;
-   const unsigned push_size_kB = 32;
    unsigned entries[4];
    unsigned start[4];
 
    ice->shaders.last_vs_entry_size = size[MESA_SHADER_VERTEX];
 
-   gen_get_urb_config(devinfo, 1024 * push_size_kB,
-                      1024 * gen_get_l3_config_urb_size(devinfo, l3_config),
+   gen_get_urb_config(devinfo, batch->screen->l3_config_3d,
                       tess_present, gs_present,
                       size, entries, start);
 
index 33da8bb19de2da2069819174e96e63eb17ca5d03..36414321c49663681ae6eaa1f2dd4ad6592fb1b3 100644 (file)
@@ -93,7 +93,7 @@ gen_get_l3_config_urb_size(const struct gen_device_info *devinfo,
 void gen_dump_l3_config(const struct gen_l3_config *cfg, FILE *fp);
 
 void gen_get_urb_config(const struct gen_device_info *devinfo,
-                        unsigned push_constant_bytes, unsigned urb_size_bytes,
+                        const struct gen_l3_config *l3_cfg,
                         bool tess_present, bool gs_present,
                         const unsigned entry_size[4],
                         unsigned entries[4], unsigned start[4]);
index 1440dd713e92866a628ea4a58075bae4332d8580..ba96966dff1c639af64cfa70b9a39ade3d9fc2dc 100644 (file)
  */
 void
 gen_get_urb_config(const struct gen_device_info *devinfo,
-                   unsigned push_constant_bytes, unsigned urb_size_bytes,
+                   const struct gen_l3_config *l3_cfg,
                    bool tess_present, bool gs_present,
                    const unsigned entry_size[4],
                    unsigned entries[4], unsigned start[4])
 {
+   const unsigned urb_size_kB = gen_get_l3_config_urb_size(devinfo, l3_cfg);
+   const unsigned push_constant_kB =
+      (devinfo->gen >= 8 || (devinfo->is_haswell && devinfo->gt == 3)) ? 32 : 16;
+
    const bool active[4] = { true, tess_present, tess_present, gs_present };
 
    /* URB allocations must be done in 8k chunks. */
-   const unsigned chunk_size_bytes = 8192;
+   const unsigned chunk_size_kB = 8;
+   const unsigned chunk_size_bytes = chunk_size_kB * 1024;
 
-   const unsigned push_constant_chunks =
-      push_constant_bytes / chunk_size_bytes;
-   const unsigned urb_chunks = urb_size_bytes / chunk_size_bytes;
+   const unsigned push_constant_chunks = push_constant_kB / chunk_size_kB;
+   const unsigned urb_chunks = urb_size_kB / chunk_size_kB;
 
    /* From p35 of the Ivy Bridge PRM (section 1.7.1: 3DSTATE_URB_GS):
     *
index 0a91e1d009c0cdd79540681d6cd51e4fe5ae0423..92bb04d07d3fa30534df76f6200e75ab7a19fed1 100644 (file)
@@ -262,18 +262,10 @@ genX(emit_urb_setup)(struct anv_device *device, struct anv_batch *batch,
                      const unsigned entry_size[4])
 {
    const struct gen_device_info *devinfo = &device->info;
-#if GEN_IS_HASWELL
-   const unsigned push_constant_kb = devinfo->gt == 3 ? 32 : 16;
-#else
-   const unsigned push_constant_kb = GEN_GEN >= 8 ? 32 : 16;
-#endif
-
-   const unsigned urb_size_kb = gen_get_l3_config_urb_size(devinfo, l3_config);
 
    unsigned entries[4];
    unsigned start[4];
-   gen_get_urb_config(devinfo,
-                      1024 * push_constant_kb, 1024 * urb_size_kb,
+   gen_get_urb_config(devinfo, l3_config,
                       active_stages &
                          VK_SHADER_STAGE_TESSELLATION_EVALUATION_BIT,
                       active_stages & VK_SHADER_STAGE_GEOMETRY_BIT,
index e7259fc1b8d2f8fbc3212a5f5aaf005919fbe373..e04c29c833b3ba39c704696ad4801421427b8752 100644 (file)
@@ -208,8 +208,6 @@ gen7_upload_urb(struct brw_context *brw, unsigned vs_size,
                 bool gs_present, bool tess_present)
 {
    const struct gen_device_info *devinfo = &brw->screen->devinfo;
-   const int push_size_kB =
-      (devinfo->gen >= 8 || (devinfo->is_haswell && devinfo->gt == 3)) ? 32 : 16;
 
    /* BRW_NEW_{VS,TCS,TES,GS}_PROG_DATA */
    struct brw_vue_prog_data *prog_data[4] = {
@@ -249,7 +247,7 @@ gen7_upload_urb(struct brw_context *brw, unsigned vs_size,
 
    unsigned entries[4];
    unsigned start[4];
-   gen_get_urb_config(devinfo, 1024 * push_size_kB, 1024 * brw->urb.size,
+   gen_get_urb_config(devinfo, brw->l3.config,
                       tess_present, gs_present, entry_size, entries, start);
 
    if (devinfo->gen == 7 && !devinfo->is_haswell && !devinfo->is_baytrail)