i965: Allocate push constant L3 space once at startup on Gen7+.
authorKenneth Graunke <kenneth@whitecape.org>
Sat, 8 Jun 2013 17:06:21 +0000 (10:06 -0700)
committerKenneth Graunke <kenneth@whitecape.org>
Mon, 10 Jun 2013 17:58:47 +0000 (10:58 -0700)
We always allocate the maximum amount of space and never change it, so
it makes sense to do it once.  Programming it on startup also lets us
skip re-programming it from BLORP.

This removes a tiny amount of overhead from our drawing loop.

Reviewed-by: Eric Anholt <eric@anholt.net>
Signed-off-by: Kenneth Graunke <kenneth@whitecape.org>
src/mesa/drivers/dri/i965/brw_state.h
src/mesa/drivers/dri/i965/brw_state_upload.c
src/mesa/drivers/dri/i965/gen7_blorp.cpp
src/mesa/drivers/dri/i965/gen7_urb.c

index 62d5efca126d202ae4ffa652a35690c72a00c1fb..f14c44cb13169ba4d4133f631d79c038a455295f 100644 (file)
@@ -112,7 +112,6 @@ extern const struct brw_tracked_state gen7_cc_viewport_state_pointer;
 extern const struct brw_tracked_state gen7_clip_state;
 extern const struct brw_tracked_state gen7_depth_stencil_state_pointer;
 extern const struct brw_tracked_state gen7_ps_state;
-extern const struct brw_tracked_state gen7_push_constant_alloc;
 extern const struct brw_tracked_state gen7_samplers;
 extern const struct brw_tracked_state gen7_sbe_state;
 extern const struct brw_tracked_state gen7_sf_clip_viewport;
@@ -217,6 +216,9 @@ get_attr_override(const struct brw_vue_map *vue_map, int urb_entry_read_offset,
 /* gen7_disable.c */
 void gen7_disable_unused_stages(struct brw_context *brw);
 
+/* gen7_urb.c */
+void gen7_allocate_push_constants(struct brw_context *brw);
+
 #ifdef __cplusplus
 }
 #endif
index fa9b5af2e6ba4d63f1719002e585d5092c722a50..a9e269eebd67300ea5d902b16671b9cec6ef0f0e 100644 (file)
@@ -176,7 +176,6 @@ static const struct brw_tracked_state *gen7_atoms[] =
    &brw_wm_prog,
 
    /* Command packets: */
-   &gen7_push_constant_alloc,
 
    /* must do before binding table pointers, cc state ptrs */
    &brw_state_base_address,
@@ -253,6 +252,7 @@ brw_upload_initial_gpu_state(struct brw_context *brw)
    brw_upload_invariant_state(brw);
 
    if (intel->gen >= 7) {
+      gen7_allocate_push_constants(brw);
       gen7_disable_unused_stages(brw);
    }
 }
index f83c7f23f778d030673b496d70f01684c98f7ae7..aa9a3ef37593b573b779ab0134e7ad3f9162a102 100644 (file)
@@ -844,7 +844,6 @@ gen7_blorp_exec(struct intel_context *intel,
 
    uint32_t prog_offset = params->get_wm_prog(brw, &prog_data);
    gen6_blorp_emit_batch_head(brw, params);
-   gen7_allocate_push_constants(brw);
    gen6_emit_3dstate_multisample(brw, params->num_samples);
    gen6_emit_3dstate_sample_mask(brw, params->num_samples, 1.0, false, ~0u);
    gen6_blorp_emit_state_base_address(brw, params);
index b9726b5ee6da495629fcf5dfc75b86e4d2f5ee87..919918639c89f3647c8ff20ee9308321440236f1 100644 (file)
@@ -73,15 +73,6 @@ gen7_allocate_push_constants(struct brw_context *brw)
    ADVANCE_BATCH();
 }
 
-const struct brw_tracked_state gen7_push_constant_alloc = {
-   .dirty = {
-      .mesa = 0,
-      .brw = BRW_NEW_CONTEXT,
-      .cache = 0,
-   },
-   .emit = gen7_allocate_push_constants,
-};
-
 static void
 gen7_upload_urb(struct brw_context *brw)
 {