From: Kenneth Graunke Date: Sat, 8 Jun 2013 17:06:21 +0000 (-0700) Subject: i965: Allocate push constant L3 space once at startup on Gen7+. X-Git-Url: https://git.libre-soc.org/?a=commitdiff_plain;h=fc800f0c60a21bc895d1db55a41fb99c306e1544;p=mesa.git i965: Allocate push constant L3 space once at startup on Gen7+. 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 Signed-off-by: Kenneth Graunke --- diff --git a/src/mesa/drivers/dri/i965/brw_state.h b/src/mesa/drivers/dri/i965/brw_state.h index 62d5efca126..f14c44cb131 100644 --- a/src/mesa/drivers/dri/i965/brw_state.h +++ b/src/mesa/drivers/dri/i965/brw_state.h @@ -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 diff --git a/src/mesa/drivers/dri/i965/brw_state_upload.c b/src/mesa/drivers/dri/i965/brw_state_upload.c index fa9b5af2e6b..a9e269eebd6 100644 --- a/src/mesa/drivers/dri/i965/brw_state_upload.c +++ b/src/mesa/drivers/dri/i965/brw_state_upload.c @@ -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); } } diff --git a/src/mesa/drivers/dri/i965/gen7_blorp.cpp b/src/mesa/drivers/dri/i965/gen7_blorp.cpp index f83c7f23f77..aa9a3ef3759 100644 --- a/src/mesa/drivers/dri/i965/gen7_blorp.cpp +++ b/src/mesa/drivers/dri/i965/gen7_blorp.cpp @@ -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); diff --git a/src/mesa/drivers/dri/i965/gen7_urb.c b/src/mesa/drivers/dri/i965/gen7_urb.c index b9726b5ee6d..919918639c8 100644 --- a/src/mesa/drivers/dri/i965/gen7_urb.c +++ b/src/mesa/drivers/dri/i965/gen7_urb.c @@ -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) {