i965: get rid of duplicated values from gen_device_info
authorLionel Landwerlin <lionel.g.landwerlin@intel.com>
Thu, 22 Sep 2016 21:41:23 +0000 (00:41 +0300)
committerLionel Landwerlin <lionel.g.landwerlin@intel.com>
Fri, 23 Sep 2016 07:12:06 +0000 (10:12 +0300)
Now that we have gen_device_info mutable, we can update its values and drop
all copies we had in brw_context.

Signed-off-by: Lionel Landwerlin <lionel.g.landwerlin@intel.com>
Reviewed-by: Kenneth Graunke <kenneth@whitecape.org>
26 files changed:
src/mesa/drivers/dri/i965/brw_compute.c
src/mesa/drivers/dri/i965/brw_context.c
src/mesa/drivers/dri/i965/brw_context.h
src/mesa/drivers/dri/i965/brw_cs.c
src/mesa/drivers/dri/i965/brw_gs.c
src/mesa/drivers/dri/i965/brw_tcs.c
src/mesa/drivers/dri/i965/brw_tes.c
src/mesa/drivers/dri/i965/brw_vs.c
src/mesa/drivers/dri/i965/brw_vs_state.c
src/mesa/drivers/dri/i965/brw_wm.c
src/mesa/drivers/dri/i965/brw_wm_state.c
src/mesa/drivers/dri/i965/gen6_gs_state.c
src/mesa/drivers/dri/i965/gen6_urb.c
src/mesa/drivers/dri/i965/gen6_vs_state.c
src/mesa/drivers/dri/i965/gen6_wm_state.c
src/mesa/drivers/dri/i965/gen7_cs_state.c
src/mesa/drivers/dri/i965/gen7_ds_state.c
src/mesa/drivers/dri/i965/gen7_gs_state.c
src/mesa/drivers/dri/i965/gen7_hs_state.c
src/mesa/drivers/dri/i965/gen7_urb.c
src/mesa/drivers/dri/i965/gen7_vs_state.c
src/mesa/drivers/dri/i965/gen7_wm_state.c
src/mesa/drivers/dri/i965/gen8_ds_state.c
src/mesa/drivers/dri/i965/gen8_gs_state.c
src/mesa/drivers/dri/i965/gen8_hs_state.c
src/mesa/drivers/dri/i965/gen8_vs_state.c

index 0d2aca5b78addfc320de46ba12582fa8e18485b8..cde3bad7ebfa006c1eaebd5c064e3fae5ba8cabe 100644 (file)
@@ -116,6 +116,7 @@ static void
 brw_emit_gpgpu_walker(struct brw_context *brw)
 {
    const struct brw_cs_prog_data *prog_data = brw->cs.prog_data;
+   const struct gen_device_info *devinfo = &brw->screen->devinfo;
 
    const GLuint *num_groups = brw->compute.num_work_groups;
    uint32_t indirect_flag;
@@ -148,7 +149,7 @@ brw_emit_gpgpu_walker(struct brw_context *brw)
       OUT_BATCH(0);                     /* Indirect Data Length */
       OUT_BATCH(0);                     /* Indirect Data Start Address */
    }
-   assert(thread_width_max <= brw->max_cs_threads);
+   assert(thread_width_max <= devinfo->max_cs_threads);
    OUT_BATCH(SET_FIELD(simd_size / 16, GPGPU_WALKER_SIMD_SIZE) |
              SET_FIELD(thread_width_max - 1, GPGPU_WALKER_THREAD_WIDTH_MAX));
    OUT_BATCH(0);                        /* Thread Group ID Starting X */
index 9b72e8481319e0c37c96922a69fab8ca8ffb16c4..6efad7849d6e18c773ccf461a2413ddb8f93a206 100644 (file)
@@ -806,19 +806,17 @@ brw_initialize_cs_context_constants(struct brw_context *brw)
 {
    struct gl_context *ctx = &brw->ctx;
    const struct intel_screen *screen = brw->screen;
-   const struct gen_device_info *devinfo = &screen->devinfo;
+   struct gen_device_info *devinfo = &brw->screen->devinfo;
 
    /* FINISHME: Do this for all platforms that the kernel supports */
    if (brw->is_cherryview &&
        screen->subslice_total > 0 && screen->eu_total > 0) {
       /* Logical CS threads = EUs per subslice * 7 threads per EU */
-      brw->max_cs_threads = screen->eu_total / screen->subslice_total * 7;
+      uint32_t max_cs_threads = screen->eu_total / screen->subslice_total * 7;
 
       /* Fuse configurations may give more threads than expected, never less. */
-      if (brw->max_cs_threads < devinfo->max_cs_threads)
-         brw->max_cs_threads = devinfo->max_cs_threads;
-   } else {
-      brw->max_cs_threads = devinfo->max_cs_threads;
+      if (max_cs_threads > devinfo->max_cs_threads)
+         devinfo->max_cs_threads = max_cs_threads;
    }
 
    /* Maximum number of scalar compute shader invocations that can be run in
@@ -830,7 +828,7 @@ brw_initialize_cs_context_constants(struct brw_context *brw)
     * threads. With SIMD32 and 64 threads, Haswell still provides twice the
     * required the number of invocation needed for ARB_compute_shader.
     */
-   const unsigned max_threads = MIN2(64, brw->max_cs_threads);
+   const unsigned max_threads = MIN2(64, devinfo->max_cs_threads);
    const uint32_t max_invocations = 32 * max_threads;
    ctx->Const.MaxComputeWorkGroupSize[0] = max_invocations;
    ctx->Const.MaxComputeWorkGroupSize[1] = max_invocations;
@@ -1078,17 +1076,7 @@ brwCreateContext(gl_api api,
    if (brw->gen >= 6)
       brw_blorp_init(brw);
 
-   brw->max_vs_threads = devinfo->max_vs_threads;
-   brw->max_hs_threads = devinfo->max_hs_threads;
-   brw->max_ds_threads = devinfo->max_ds_threads;
-   brw->max_gs_threads = devinfo->max_gs_threads;
-   brw->max_wm_threads = devinfo->max_wm_threads;
    brw->urb.size = devinfo->urb.size;
-   brw->urb.min_vs_entries = devinfo->urb.min_vs_entries;
-   brw->urb.max_vs_entries = devinfo->urb.max_vs_entries;
-   brw->urb.max_hs_entries = devinfo->urb.max_hs_entries;
-   brw->urb.max_ds_entries = devinfo->urb.max_ds_entries;
-   brw->urb.max_gs_entries = devinfo->urb.max_gs_entries;
 
    if (brw->gen == 6)
       brw->urb.gs_present = false;
index eb1df40cfe112cf2ba24fe8b6ab7ff32c7131808..00f0adca4d5c04b5e5e9eef6f3b96de15e179326 100644 (file)
@@ -1017,17 +1017,6 @@ struct brw_context
     */
    int num_samples;
 
-   /**
-    * Platform specific constants containing the maximum number of threads
-    * for each pipeline stage.
-    */
-   unsigned max_vs_threads;
-   unsigned max_hs_threads;
-   unsigned max_ds_threads;
-   unsigned max_gs_threads;
-   unsigned max_wm_threads;
-   unsigned max_cs_threads;
-
    /* BRW_NEW_URB_ALLOCATIONS:
     */
    struct {
@@ -1040,12 +1029,6 @@ struct brw_context
 
       bool constrained;
 
-      GLuint min_vs_entries;    /* Minimum number of VS entries */
-      GLuint max_vs_entries;   /* Maximum number of VS entries */
-      GLuint max_hs_entries;   /* Maximum number of HS entries */
-      GLuint max_ds_entries;   /* Maximum number of DS entries */
-      GLuint max_gs_entries;   /* Maximum number of GS entries */
-
       GLuint nr_vs_entries;
       GLuint nr_hs_entries;
       GLuint nr_ds_entries;
index e79668f8f026c0773e417974ce8c86b96de109ea..4e746fe478f12b15f8f8d259da54231c41229035 100644 (file)
@@ -57,6 +57,7 @@ brw_codegen_cs_prog(struct brw_context *brw,
                     struct brw_compute_program *cp,
                     struct brw_cs_prog_key *key)
 {
+   const struct gen_device_info *devinfo = &brw->screen->devinfo;
    struct gl_context *ctx = &brw->ctx;
    const GLuint *program;
    void *mem_ctx = ralloc_context(NULL);
@@ -84,7 +85,7 @@ brw_codegen_cs_prog(struct brw_context *brw,
       prog_data.base.total_shared = prog->Comp.SharedSize;
    }
 
-   assign_cs_binding_table_offsets(&brw->screen->devinfo, prog,
+   assign_cs_binding_table_offsets(devinfo, prog,
                                    &cp->program.Base, &prog_data);
 
    /* Allocate the references to the uniforms that will end up in the
@@ -166,7 +167,7 @@ brw_codegen_cs_prog(struct brw_context *brw,
     * number of threads per subslice.
     */
    const unsigned scratch_ids_per_subslice =
-      brw->is_haswell ? 16 * 8 : brw->max_cs_threads;
+      brw->is_haswell ? 16 * 8 : devinfo->max_cs_threads;
 
    brw_alloc_stage_scratch(brw, &brw->cs.base,
                            prog_data.base.total_scratch,
index 93a909c1c65972ff976967409c6abaa887bf8201..741216c5b12ef7feecf689d6e1144edc4c3d6a86 100644 (file)
@@ -98,6 +98,7 @@ brw_codegen_gs_prog(struct brw_context *brw,
                     struct brw_gs_prog_key *key)
 {
    struct brw_compiler *compiler = brw->screen->compiler;
+   const struct gen_device_info *devinfo = &brw->screen->devinfo;
    struct brw_stage_state *stage_state = &brw->gs.base;
    struct brw_gs_prog_data prog_data;
    bool start_busy = false;
@@ -105,7 +106,7 @@ brw_codegen_gs_prog(struct brw_context *brw,
 
    memset(&prog_data, 0, sizeof(prog_data));
 
-   assign_gs_binding_table_offsets(&brw->screen->devinfo, prog,
+   assign_gs_binding_table_offsets(devinfo, prog,
                                    &gp->program.Base, &prog_data);
 
    /* Allocate the references to the uniforms that will end up in the
@@ -139,7 +140,7 @@ brw_codegen_gs_prog(struct brw_context *brw,
       ((1 << gp->program.Base.CullDistanceArraySize) - 1) <<
       gp->program.Base.ClipDistanceArraySize;
 
-   brw_compute_vue_map(&brw->screen->devinfo,
+   brw_compute_vue_map(devinfo,
                        &prog_data.base.vue_map, outputs_written,
                        prog->SeparateShader);
 
@@ -184,7 +185,7 @@ brw_codegen_gs_prog(struct brw_context *brw,
    /* Scratch space is used for register spilling */
    brw_alloc_stage_scratch(brw, stage_state,
                            prog_data.base.base.total_scratch,
-                           brw->max_gs_threads);
+                           devinfo->max_gs_threads);
 
    brw_upload_cache(&brw->cache, BRW_CACHE_GS_PROG,
                     key, sizeof(*key),
index 61d64e6cdfd9458f871e54615fef920374937094..7e6c69adb2c394be6b9b9de0d368790536cb9f53 100644 (file)
@@ -298,7 +298,7 @@ brw_codegen_tcs_prog(struct brw_context *brw,
    /* Scratch space is used for register spilling */
    brw_alloc_stage_scratch(brw, stage_state,
                            prog_data.base.base.total_scratch,
-                           brw->max_hs_threads);
+                           devinfo->max_hs_threads);
 
    brw_upload_cache(&brw->cache, BRW_CACHE_TCS_PROG,
                     key, sizeof(*key),
index 5c3c9a6ef26027c423a9264bc208d14ea282c8ce..87ada174e82a63f7a9fa2f8e8be1cc950e34cb40 100644 (file)
@@ -217,7 +217,7 @@ brw_codegen_tes_prog(struct brw_context *brw,
    /* Scratch space is used for register spilling */
    brw_alloc_stage_scratch(brw, stage_state,
                            prog_data.base.base.total_scratch,
-                           brw->max_ds_threads);
+                           devinfo->max_ds_threads);
 
    brw_upload_cache(&brw->cache, BRW_CACHE_TES_PROG,
                     key, sizeof(*key),
index a51e4a250464cc64c17c1488f3fe01eef1f91e81..ba7315e078fb5048ccf06911118a527a08007a47 100644 (file)
@@ -91,6 +91,7 @@ brw_codegen_vs_prog(struct brw_context *brw,
                     struct brw_vs_prog_key *key)
 {
    const struct brw_compiler *compiler = brw->screen->compiler;
+   const struct gen_device_info *devinfo = &brw->screen->devinfo;
    GLuint program_size;
    const GLuint *program;
    struct brw_vs_prog_data prog_data;
@@ -112,7 +113,7 @@ brw_codegen_vs_prog(struct brw_context *brw,
    mem_ctx = ralloc_context(NULL);
 
    brw_assign_common_binding_table_offsets(MESA_SHADER_VERTEX,
-                                           &brw->screen->devinfo,
+                                           devinfo,
                                            prog, &vp->program.Base,
                                            &prog_data.base.base, 0);
 
@@ -160,7 +161,7 @@ brw_codegen_vs_prog(struct brw_context *brw,
       ((1 << vp->program.Base.CullDistanceArraySize) - 1) <<
       vp->program.Base.ClipDistanceArraySize;
 
-   brw_compute_vue_map(&brw->screen->devinfo,
+   brw_compute_vue_map(devinfo,
                        &prog_data.base.vue_map, outputs_written,
                        prog ? prog->SeparateShader ||
                               prog->_LinkedShaders[MESA_SHADER_TESS_EVAL]
@@ -222,7 +223,7 @@ brw_codegen_vs_prog(struct brw_context *brw,
    /* Scratch space is used for register spilling */
    brw_alloc_stage_scratch(brw, &brw->vs.base,
                            prog_data.base.base.total_scratch,
-                           brw->max_vs_threads);
+                           devinfo->max_vs_threads);
 
    brw_upload_cache(&brw->cache, BRW_CACHE_VS_PROG,
                    key, sizeof(struct brw_vs_prog_key),
index 331949aa1f131660fd1cb08a46d055c378b33c00..25ecbbd96d72d33189f8e66e158df716e6eb72d9 100644 (file)
@@ -39,6 +39,7 @@
 static void
 brw_upload_vs_unit(struct brw_context *brw)
 {
+   const struct gen_device_info *devinfo = &brw->screen->devinfo;
    struct brw_stage_state *stage_state = &brw->vs.base;
 
    struct brw_vs_unit_state *vs;
@@ -137,7 +138,7 @@ brw_upload_vs_unit(struct brw_context *brw)
    vs->thread4.urb_entry_allocation_size = brw->urb.vsize - 1;
 
    vs->thread4.max_threads = CLAMP(brw->urb.nr_vs_entries / 2,
-                                  1, brw->max_vs_threads) - 1;
+                                  1, devinfo->max_vs_threads) - 1;
 
    if (brw->gen == 5)
       vs->vs5.sampler_count = 0; /* hardware requirement */
index ba8e4aded060240040e5d21afdb1c5e3a2e786da..6ffe7c8b9cfce2629b5e2ed5bb2a7c25ff2b1720 100644 (file)
@@ -79,6 +79,7 @@ brw_codegen_wm_prog(struct brw_context *brw,
                     struct brw_fragment_program *fp,
                     struct brw_wm_prog_key *key)
 {
+   const struct gen_device_info *devinfo = &brw->screen->devinfo;
    struct gl_context *ctx = &brw->ctx;
    void *mem_ctx = ralloc_context(NULL);
    struct brw_wm_prog_data prog_data;
@@ -97,7 +98,7 @@ brw_codegen_wm_prog(struct brw_context *brw,
    if (!prog)
       prog_data.base.use_alt_mode = true;
 
-   assign_fs_binding_table_offsets(&brw->screen->devinfo, prog,
+   assign_fs_binding_table_offsets(devinfo, prog,
                                    &fp->program.Base, key, &prog_data);
 
    /* Allocate the references to the uniforms that will end up in the
@@ -172,7 +173,7 @@ brw_codegen_wm_prog(struct brw_context *brw,
 
    brw_alloc_stage_scratch(brw, &brw->wm.base,
                            prog_data.base.total_scratch,
-                           brw->max_wm_threads);
+                           devinfo->max_wm_threads);
 
    if (unlikely(INTEL_DEBUG & DEBUG_WM))
       fprintf(stderr, "\n");
index dda4f23e5541b4ef0cc007325ffc09cd0a2d387f..32de7b57216a76ed294b2d34f44e5db55f6ae11a 100644 (file)
@@ -75,6 +75,7 @@ brw_color_buffer_write_enabled(struct brw_context *brw)
 static void
 brw_upload_wm_unit(struct brw_context *brw)
 {
+   const struct gen_device_info *devinfo = &brw->screen->devinfo;
    struct gl_context *ctx = &brw->ctx;
    /* BRW_NEW_FRAGMENT_PROGRAM */
    const struct gl_fragment_program *fp = brw->fragment_program;
@@ -178,7 +179,7 @@ brw_upload_wm_unit(struct brw_context *brw)
    wm->wm5.program_uses_killpixel =
       prog_data->uses_kill || ctx->Color.AlphaEnabled;
 
-   wm->wm5.max_threads = brw->max_wm_threads - 1;
+   wm->wm5.max_threads = devinfo->max_wm_threads - 1;
 
    /* _NEW_BUFFERS | _NEW_COLOR */
    if (brw_color_buffer_write_enabled(brw) ||
@@ -270,4 +271,3 @@ const struct brw_tracked_state brw_wm_unit = {
    },
    .emit = brw_upload_wm_unit,
 };
-
index 67a3e18b8bec23651bb45243eef087f3b32e04eb..2a16d22600c02a12215e5b12d669acacf94aa6d0 100644 (file)
@@ -69,6 +69,8 @@ const struct brw_tracked_state gen6_gs_push_constants = {
 static void
 upload_gs_state_for_tf(struct brw_context *brw)
 {
+   const struct gen_device_info *devinfo = &brw->screen->devinfo;
+
    BEGIN_BATCH(7);
    OUT_BATCH(_3DSTATE_GS << 16 | (7 - 2));
    OUT_BATCH(brw->ff_gs.prog_offset);
@@ -76,7 +78,7 @@ upload_gs_state_for_tf(struct brw_context *brw)
    OUT_BATCH(0); /* no scratch space */
    OUT_BATCH((2 << GEN6_GS_DISPATCH_START_GRF_SHIFT) |
              (brw->ff_gs.prog_data->urb_read_length << GEN6_GS_URB_READ_LENGTH_SHIFT));
-   OUT_BATCH(((brw->max_gs_threads - 1) << GEN6_GS_MAX_THREADS_SHIFT) |
+   OUT_BATCH(((devinfo->max_gs_threads - 1) << GEN6_GS_MAX_THREADS_SHIFT) |
              GEN6_GS_STATISTICS_ENABLE |
              GEN6_GS_SO_STATISTICS_ENABLE |
              GEN6_GS_RENDERING_ENABLE);
@@ -91,6 +93,7 @@ upload_gs_state_for_tf(struct brw_context *brw)
 static void
 upload_gs_state(struct brw_context *brw)
 {
+   const struct gen_device_info *devinfo = &brw->screen->devinfo;
    /* BRW_NEW_GEOMETRY_PROGRAM */
    bool active = brw->geometry_program;
    /* BRW_NEW_GS_PROG_DATA */
@@ -153,7 +156,7 @@ upload_gs_state(struct brw_context *brw)
                 (prog_data->base.dispatch_grf_start_reg <<
                  GEN6_GS_DISPATCH_START_GRF_SHIFT));
 
-      OUT_BATCH(((brw->max_gs_threads - 1) << GEN6_GS_MAX_THREADS_SHIFT) |
+      OUT_BATCH(((devinfo->max_gs_threads - 1) << GEN6_GS_MAX_THREADS_SHIFT) |
                 GEN6_GS_STATISTICS_ENABLE |
                 GEN6_GS_SO_STATISTICS_ENABLE |
                 GEN6_GS_RENDERING_ENABLE);
index 4370fedb82059911369e0557cf5ebcffed84ea53..df12ea66fe9dcfaa615b45c5a56cafc3f7f26658 100644 (file)
@@ -52,6 +52,7 @@ gen6_upload_urb(struct brw_context *brw, unsigned vs_size,
 {
    int nr_vs_entries, nr_gs_entries;
    int total_urb_size = brw->urb.size * 1024; /* in bytes */
+   const struct gen_device_info *devinfo = &brw->screen->devinfo;
 
    /* Calculate how many entries fit in each stage's section of the URB */
    if (gs_present) {
@@ -63,17 +64,17 @@ gen6_upload_urb(struct brw_context *brw, unsigned vs_size,
    }
 
    /* Then clamp to the maximum allowed by the hardware */
-   if (nr_vs_entries > brw->urb.max_vs_entries)
-      nr_vs_entries = brw->urb.max_vs_entries;
+   if (nr_vs_entries > devinfo->urb.max_vs_entries)
+      nr_vs_entries = devinfo->urb.max_vs_entries;
 
-   if (nr_gs_entries > brw->urb.max_gs_entries)
-      nr_gs_entries = brw->urb.max_gs_entries;
+   if (nr_gs_entries > devinfo->urb.max_gs_entries)
+      nr_gs_entries = devinfo->urb.max_gs_entries;
 
    /* Finally, both must be a multiple of 4 (see 3DSTATE_URB in the PRM). */
    brw->urb.nr_vs_entries = ROUND_DOWN_TO(nr_vs_entries, 4);
    brw->urb.nr_gs_entries = ROUND_DOWN_TO(nr_gs_entries, 4);
 
-   assert(brw->urb.nr_vs_entries >= brw->urb.min_vs_entries);
+   assert(brw->urb.nr_vs_entries >= devinfo->urb.min_vs_entries);
    assert(brw->urb.nr_vs_entries % 4 == 0);
    assert(brw->urb.nr_gs_entries % 4 == 0);
    assert(vs_size <= 5);
index 5446ef90509a9d8eb24eefd9244bad79e165fb43..15644b615578f7a6f9a3b693e28d984d6ec5fb8e 100644 (file)
@@ -74,6 +74,7 @@ const struct brw_tracked_state gen6_vs_push_constants = {
 static void
 upload_vs_state(struct brw_context *brw)
 {
+   const struct gen_device_info *devinfo = &brw->screen->devinfo;
    const struct brw_stage_state *stage_state = &brw->vs.base;
    uint32_t floating_point_mode = 0;
 
@@ -138,7 +139,7 @@ upload_vs_state(struct brw_context *brw)
             (brw->vs.prog_data->base.urb_read_length << GEN6_VS_URB_READ_LENGTH_SHIFT) |
             (0 << GEN6_VS_URB_ENTRY_READ_OFFSET_SHIFT));
 
-   OUT_BATCH(((brw->max_vs_threads - 1) << GEN6_VS_MAX_THREADS_SHIFT) |
+   OUT_BATCH(((devinfo->max_vs_threads - 1) << GEN6_VS_MAX_THREADS_SHIFT) |
             GEN6_VS_STATISTICS_ENABLE |
             GEN6_VS_ENABLE);
    ADVANCE_BATCH();
index b5198b16260f79e0feb5e9d8210c79608292ba14..eecbbe9ff44bdfd99e7676192d538fbeb6397155 100644 (file)
@@ -80,6 +80,7 @@ gen6_upload_wm_state(struct brw_context *brw,
                      bool line_stipple_enable, bool polygon_stipple_enable,
                      bool statistic_enable)
 {
+   const struct gen_device_info *devinfo = &brw->screen->devinfo;
    uint32_t dw2, dw4, dw5, dw6, ksp0, ksp2;
 
    /* We can't fold this into gen6_upload_wm_push_constants(), because
@@ -130,7 +131,7 @@ gen6_upload_wm_state(struct brw_context *brw,
    dw2 |= ((prog_data->base.binding_table.size_bytes / 4) <<
            GEN6_WM_BINDING_TABLE_ENTRY_COUNT_SHIFT);
 
-   dw5 |= (brw->max_wm_threads - 1) << GEN6_WM_MAX_THREADS_SHIFT;
+   dw5 |= (devinfo->max_wm_threads - 1) << GEN6_WM_MAX_THREADS_SHIFT;
 
    if (prog_data->dispatch_8)
       dw5 |= GEN6_WM_8_DISPATCH_ENABLE;
index 862b91553ec55155ee0a478cc67e4d48a42b6067..9ba5dd227f7e39043d504856f93efb370bfddb4e 100644 (file)
@@ -97,7 +97,7 @@ brw_upload_cs_state(struct brw_context *brw)
    const uint32_t vfe_gpgpu_mode =
       brw->gen == 7 ? SET_FIELD(1, GEN7_MEDIA_VFE_STATE_GPGPU_MODE) : 0;
    const uint32_t subslices = MAX2(brw->screen->subslice_total, 1);
-   OUT_BATCH(SET_FIELD(brw->max_cs_threads * subslices - 1,
+   OUT_BATCH(SET_FIELD(devinfo->max_cs_threads * subslices - 1,
                        MEDIA_VFE_STATE_MAX_THREADS) |
              SET_FIELD(vfe_num_urb_entries, MEDIA_VFE_STATE_URB_ENTRIES) |
              SET_FIELD(1, MEDIA_VFE_STATE_RESET_GTW_TIMER) |
@@ -163,7 +163,7 @@ brw_upload_cs_state(struct brw_context *brw)
       brw->gen >= 8 ?
       SET_FIELD(cs_prog_data->threads, GEN8_MEDIA_GPGPU_THREAD_COUNT) :
       SET_FIELD(cs_prog_data->threads, MEDIA_GPGPU_THREAD_COUNT);
-   assert(cs_prog_data->threads <= brw->max_cs_threads);
+   assert(cs_prog_data->threads <= devinfo->max_cs_threads);
 
    const uint32_t slm_size =
       encode_slm_size(devinfo->gen, prog_data->total_shared);
index a31949c8128765bc52c38dd2869725063b82e232..57b187c5339c966c1d4f0932d452c0e2e83ecd23 100644 (file)
@@ -61,6 +61,7 @@ const struct brw_tracked_state gen7_tes_push_constants = {
 static void
 gen7_upload_ds_state(struct brw_context *brw)
 {
+   const struct gen_device_info *devinfo = &brw->screen->devinfo;
    const struct brw_stage_state *stage_state = &brw->tes.base;
    /* BRW_NEW_TESS_PROGRAMS */
    bool active = brw->tess_eval_program;
@@ -70,7 +71,7 @@ gen7_upload_ds_state(struct brw_context *brw)
    const struct brw_vue_prog_data *vue_prog_data = &tes_prog_data->base;
    const struct brw_stage_prog_data *prog_data = &vue_prog_data->base;
 
-   const unsigned thread_count = (brw->max_ds_threads - 1) <<
+   const unsigned thread_count = (devinfo->max_ds_threads - 1) <<
       (brw->is_haswell ? HSW_DS_MAX_THREADS_SHIFT : GEN7_DS_MAX_THREADS_SHIFT);
 
    if (active) {
index 7d733933e2b0035f80e6743718e148214404b393..2f740e6436e4dfbabc937f566bc32d148112a80b 100644 (file)
@@ -29,6 +29,7 @@
 static void
 upload_gs_state(struct brw_context *brw)
 {
+   const struct gen_device_info *devinfo = &brw->screen->devinfo;
    const struct brw_stage_state *stage_state = &brw->gs.base;
    const int max_threads_shift = brw->is_haswell ?
       HSW_GS_MAX_THREADS_SHIFT : GEN6_GS_MAX_THREADS_SHIFT;
@@ -107,7 +108,7 @@ upload_gs_state(struct brw_context *brw)
        * Bridge this will get the order close to correct but not perfect.
        */
       uint32_t dw5 =
-         ((brw->max_gs_threads - 1) << max_threads_shift) |
+         ((devinfo->max_gs_threads - 1) << max_threads_shift) |
          (brw->gs.prog_data->control_data_header_size_hwords <<
           GEN7_GS_CONTROL_DATA_HEADER_SIZE_SHIFT) |
          ((brw->gs.prog_data->invocations - 1) <<
index 7cde0300710037c4a6ddc7ca58ded0e9fb03394e..759655b1966c0cc01603fa5f68fcbacb17f58ad6 100644 (file)
@@ -64,6 +64,7 @@ const struct brw_tracked_state gen7_tcs_push_constants = {
 static void
 gen7_upload_hs_state(struct brw_context *brw)
 {
+   const struct gen_device_info *devinfo = &brw->screen->devinfo;
    const struct brw_stage_state *stage_state = &brw->tcs.base;
    /* BRW_NEW_TESS_PROGRAMS */
    bool active = brw->tess_eval_program;
@@ -77,7 +78,7 @@ gen7_upload_hs_state(struct brw_context *brw)
                           GEN7_HS_SAMPLER_COUNT) |
                 SET_FIELD(prog_data->base.binding_table.size_bytes / 4,
                           GEN7_HS_BINDING_TABLE_ENTRY_COUNT) |
-                (brw->max_hs_threads - 1));
+                (devinfo->max_hs_threads - 1));
       OUT_BATCH(GEN7_HS_ENABLE |
                 GEN7_HS_STATISTICS_ENABLE |
                 SET_FIELD(brw->tcs.prog_data->instances - 1,
index 4216af853cca10eba0754077c7ed6d7c22bb5a99..7eb587ca67140f9d9160192d22abc31e65bde955 100644 (file)
@@ -276,14 +276,14 @@ gen7_upload_urb(struct brw_context *brw, unsigned vs_size,
     *  greater than or equal to 192."
     */
    unsigned vs_min_entries =
-      tess_present && brw->gen == 8 ? 192 : brw->urb.min_vs_entries;
+      tess_present && brw->gen == 8 ? 192 : devinfo->urb.min_vs_entries;
    /* Min VS Entries isn't a multiple of 8 on Cherryview/Broxton; round up */
    vs_min_entries = ALIGN(vs_min_entries, vs_granularity);
 
    unsigned vs_chunks =
       DIV_ROUND_UP(vs_min_entries * vs_entry_size_bytes, chunk_size_bytes);
    unsigned vs_wants =
-      DIV_ROUND_UP(brw->urb.max_vs_entries * vs_entry_size_bytes,
+      DIV_ROUND_UP(devinfo->urb.max_vs_entries * vs_entry_size_bytes,
                    chunk_size_bytes) - vs_chunks;
 
    unsigned gs_chunks = 0;
@@ -299,7 +299,7 @@ gen7_upload_urb(struct brw_context *brw, unsigned vs_size,
        */
       gs_chunks = DIV_ROUND_UP(MAX2(gs_granularity, 2) * gs_entry_size_bytes,
                                chunk_size_bytes);
-      gs_wants = DIV_ROUND_UP(brw->urb.max_gs_entries * gs_entry_size_bytes,
+      gs_wants = DIV_ROUND_UP(devinfo->urb.max_gs_entries * gs_entry_size_bytes,
                               chunk_size_bytes) - gs_chunks;
    }
 
@@ -320,7 +320,7 @@ gen7_upload_urb(struct brw_context *brw, unsigned vs_size,
          DIV_ROUND_UP(devinfo->urb.min_ds_entries * ds_entry_size_bytes,
                       chunk_size_bytes);
       ds_wants =
-         DIV_ROUND_UP(brw->urb.max_ds_entries * ds_entry_size_bytes,
+         DIV_ROUND_UP(devinfo->urb.max_ds_entries * ds_entry_size_bytes,
                       chunk_size_bytes) - ds_chunks;
    }
 
@@ -377,10 +377,10 @@ gen7_upload_urb(struct brw_context *brw, unsigned vs_size,
    /* Since we rounded up when computing *_wants, this may be slightly more
     * than the maximum allowed amount, so correct for that.
     */
-   nr_vs_entries = MIN2(nr_vs_entries, brw->urb.max_vs_entries);
-   nr_hs_entries = MIN2(nr_hs_entries, brw->urb.max_hs_entries);
-   nr_ds_entries = MIN2(nr_ds_entries, brw->urb.max_ds_entries);
-   nr_gs_entries = MIN2(nr_gs_entries, brw->urb.max_gs_entries);
+   nr_vs_entries = MIN2(nr_vs_entries, devinfo->urb.max_vs_entries);
+   nr_hs_entries = MIN2(nr_hs_entries, devinfo->urb.max_hs_entries);
+   nr_ds_entries = MIN2(nr_ds_entries, devinfo->urb.max_ds_entries);
+   nr_gs_entries = MIN2(nr_gs_entries, devinfo->urb.max_gs_entries);
 
    /* Ensure that we program a multiple of the granularity. */
    nr_vs_entries = ROUND_DOWN_TO(nr_vs_entries, vs_granularity);
index 2715b37118adc1ec50430c6671b7b93724cebe8f..57e041938fa1f303cdd3715f7b1917df4bc2d39e 100644 (file)
@@ -32,6 +32,7 @@
 static void
 upload_vs_state(struct brw_context *brw)
 {
+   const struct gen_device_info *devinfo = &brw->screen->devinfo;
    const struct brw_stage_state *stage_state = &brw->vs.base;
    uint32_t floating_point_mode = 0;
    const int max_threads_shift = brw->is_haswell ?
@@ -66,7 +67,7 @@ upload_vs_state(struct brw_context *brw)
             (prog_data->urb_read_length << GEN6_VS_URB_READ_LENGTH_SHIFT) |
             (0 << GEN6_VS_URB_ENTRY_READ_OFFSET_SHIFT));
 
-   OUT_BATCH(((brw->max_vs_threads - 1) << max_threads_shift) |
+   OUT_BATCH(((devinfo->max_vs_threads - 1) << max_threads_shift) |
             GEN6_VS_STATISTICS_ENABLE |
             GEN6_VS_ENABLE);
    ADVANCE_BATCH();
index 8243905a8df2e3c11edc0e46fd2cfdf0007130c2..14f8a23f6eea9435f25bed8b6f18a435d7986646 100644 (file)
@@ -149,6 +149,7 @@ gen7_upload_ps_state(struct brw_context *brw,
                      bool enable_dual_src_blend, unsigned sample_mask,
                      unsigned fast_clear_op)
 {
+   const struct gen_device_info *devinfo = &brw->screen->devinfo;
    uint32_t dw2, dw4, dw5, ksp0, ksp2;
    const int max_threads_shift = brw->is_haswell ?
       HSW_PS_MAX_THREADS_SHIFT : IVB_PS_MAX_THREADS_SHIFT;
@@ -171,7 +172,7 @@ gen7_upload_ps_state(struct brw_context *brw,
    if (brw->is_haswell)
       dw4 |= SET_FIELD(sample_mask, HSW_PS_SAMPLE_MASK);
 
-   dw4 |= (brw->max_wm_threads - 1) << max_threads_shift;
+   dw4 |= (devinfo->max_wm_threads - 1) << max_threads_shift;
 
    if (prog_data->base.nr_params > 0)
       dw4 |= GEN7_PS_PUSH_CONSTANT_ENABLE;
index 6f01abb76fe265682eaee017024d49c447906dd9..f7dbcec048035ae35c9633c2bccafb1a44f7182c 100644 (file)
@@ -29,6 +29,7 @@
 static void
 gen8_upload_ds_state(struct brw_context *brw)
 {
+   const struct gen_device_info *devinfo = &brw->screen->devinfo;
    struct gl_context *ctx = &brw->ctx;
    const struct brw_stage_state *stage_state = &brw->tes.base;
    /* BRW_NEW_TESS_PROGRAMS */
@@ -64,7 +65,7 @@ gen8_upload_ds_state(struct brw_context *brw)
 
       OUT_BATCH(GEN7_DS_ENABLE |
                 GEN7_DS_STATISTICS_ENABLE |
-                (brw->max_ds_threads - 1) << HSW_DS_MAX_THREADS_SHIFT |
+                (devinfo->max_ds_threads - 1) << HSW_DS_MAX_THREADS_SHIFT |
                 (vue_prog_data->dispatch_mode == DISPATCH_MODE_SIMD8 ?
                  GEN7_DS_SIMD8_DISPATCH_ENABLE : 0) |
                 (tes_prog_data->domain == BRW_TESS_DOMAIN_TRI ?
index eb0c3dff9cb29a43d6b11b4542a38c29ea929d38..d078ab603959eb4cd775733ebcd5fd56f580d441 100644 (file)
@@ -29,6 +29,7 @@
 static void
 gen8_upload_gs_state(struct brw_context *brw)
 {
+   const struct gen_device_info *devinfo = &brw->screen->devinfo;
    struct gl_context *ctx = &brw->ctx;
    const struct brw_stage_state *stage_state = &brw->gs.base;
    /* BRW_NEW_GEOMETRY_PROGRAM */
@@ -97,9 +98,9 @@ gen8_upload_gs_state(struct brw_context *brw)
       }
 
       if (brw->gen < 9)
-         dw7 |= (brw->max_gs_threads / 2 - 1) << HSW_GS_MAX_THREADS_SHIFT;
+         dw7 |= (devinfo->max_gs_threads / 2 - 1) << HSW_GS_MAX_THREADS_SHIFT;
       else
-         dw8 |= brw->max_gs_threads - 1;
+         dw8 |= devinfo->max_gs_threads - 1;
 
       /* DW7 */
       OUT_BATCH(dw7);
index e759a648af32eceda093c710d084e5e0ba6d3d3c..7b9f6341e6c142644f20fd232c05a309d3ff6e89 100644 (file)
@@ -29,6 +29,7 @@
 static void
 gen8_upload_hs_state(struct brw_context *brw)
 {
+   const struct gen_device_info *devinfo = &brw->screen->devinfo;
    const struct brw_stage_state *stage_state = &brw->tcs.base;
    /* BRW_NEW_TESS_PROGRAMS */
    bool active = brw->tess_eval_program;
@@ -44,7 +45,7 @@ gen8_upload_hs_state(struct brw_context *brw)
                           GEN7_HS_BINDING_TABLE_ENTRY_COUNT));
       OUT_BATCH(GEN7_HS_ENABLE |
                 GEN7_HS_STATISTICS_ENABLE |
-                (brw->max_hs_threads - 1) << GEN8_HS_MAX_THREADS_SHIFT |
+                (devinfo->max_hs_threads - 1) << GEN8_HS_MAX_THREADS_SHIFT |
                 SET_FIELD(brw->tcs.prog_data->instances - 1,
                           GEN7_HS_INSTANCE_COUNT));
       OUT_BATCH(stage_state->prog_offset);
index b7682b553b49bc8b0e6c9c63248e97e5cb12e593..963647cdf3afa815aa5cb002c5aedcc86c536621 100644 (file)
@@ -32,6 +32,7 @@
 static void
 upload_vs_state(struct brw_context *brw)
 {
+   const struct gen_device_info *devinfo = &brw->screen->devinfo;
    struct gl_context *ctx = &brw->ctx;
    const struct brw_stage_state *stage_state = &brw->vs.base;
    uint32_t floating_point_mode = 0;
@@ -71,7 +72,7 @@ upload_vs_state(struct brw_context *brw)
 
    uint32_t simd8_enable = prog_data->dispatch_mode == DISPATCH_MODE_SIMD8 ?
       GEN8_VS_SIMD8_ENABLE : 0;
-   OUT_BATCH(((brw->max_vs_threads - 1) << HSW_VS_MAX_THREADS_SHIFT) |
+   OUT_BATCH(((devinfo->max_vs_threads - 1) << HSW_VS_MAX_THREADS_SHIFT) |
              GEN6_VS_STATISTICS_ENABLE |
              simd8_enable |
              GEN6_VS_ENABLE);