diff options
author | Kenneth Graunke <kenneth@whitecape.org> | 2017-11-15 22:40:16 -0800 |
---|---|---|
committer | Andres Gomez <agomez@igalia.com> | 2017-11-22 18:41:23 +0200 |
commit | a4456581781de64beaf5928d1f18a91efbb824e3 (patch) | |
tree | b6418b2e4d5f2a09da90cc390a3d82dc5e1dc2ec | |
parent | 0d02e91c2cd43f0ca0ef658997785b5dddbfb417 (diff) | |
download | mesa-a4456581781de64beaf5928d1f18a91efbb824e3.tar.gz |
i965: Upload invariant state once at the start of the batch on Gen4-5.
We want to emit invariant state at the start of a render batch. In the
past, this more or less happened: a new batch flagged BRW_NEW_CONTEXT
(because we don't have hardware contexts), which triggered the
brw_invariant_state atom. So, it would be emitted before any 3D
drawing. (Technically, there might be some BLT commands in the batch
because Gen4-5 have a single combined render/BLT ring, but that should
be harmless).
With the advent of BLORP, this broke. The first item in a batch might
be a BLORP operation, which bypasses the normal draw upload path. So,
we need to ensure invariant state happens first. To do that, we just
upload it when creating a new batch. On Gen6+ we'd need to worry about
whether it's a RENDER or BLT batch, but because we have a combined ring,
this approach should work fine on Gen4-5.
Seems to fix GPU hangs when playing hardware accelerated video with
mpv -hwdec=vaapi on Ironlake.
Cc: mesa-stable@lists.freedesktop.org
Bugzilla: https://bugs.freedesktop.org/show_bug.cgi?id=103529
Reviewed-by: Jason Ekstrand <jason@jlekstrand.net>
(cherry picked from commit 8f91aa35a54e127b68415376ef2b577ea8fc30f9)
-rw-r--r-- | src/mesa/drivers/dri/i965/brw_misc_state.c | 9 | ||||
-rw-r--r-- | src/mesa/drivers/dri/i965/brw_state.h | 1 | ||||
-rw-r--r-- | src/mesa/drivers/dri/i965/genX_state_upload.c | 2 | ||||
-rw-r--r-- | src/mesa/drivers/dri/i965/intel_batchbuffer.c | 4 |
4 files changed, 3 insertions, 13 deletions
diff --git a/src/mesa/drivers/dri/i965/brw_misc_state.c b/src/mesa/drivers/dri/i965/brw_misc_state.c index 1e3be784c5b..c4af9ddae6c 100644 --- a/src/mesa/drivers/dri/i965/brw_misc_state.c +++ b/src/mesa/drivers/dri/i965/brw_misc_state.c @@ -560,15 +560,6 @@ brw_upload_invariant_state(struct brw_context *brw) ADVANCE_BATCH(); } -const struct brw_tracked_state brw_invariant_state = { - .dirty = { - .mesa = 0, - .brw = BRW_NEW_BLORP | - BRW_NEW_CONTEXT, - }, - .emit = brw_upload_invariant_state -}; - /** * Define the base addresses which some state is referenced from. * diff --git a/src/mesa/drivers/dri/i965/brw_state.h b/src/mesa/drivers/dri/i965/brw_state.h index 1432a6888f7..a7aee7a0aa8 100644 --- a/src/mesa/drivers/dri/i965/brw_state.h +++ b/src/mesa/drivers/dri/i965/brw_state.h @@ -51,7 +51,6 @@ extern const struct brw_tracked_state brw_wm_pull_constants; extern const struct brw_tracked_state brw_cs_pull_constants; extern const struct brw_tracked_state brw_constant_buffer; extern const struct brw_tracked_state brw_curbe_offsets; -extern const struct brw_tracked_state brw_invariant_state; extern const struct brw_tracked_state brw_binding_table_pointers; extern const struct brw_tracked_state brw_depthbuffer; extern const struct brw_tracked_state brw_recalculate_urb_fence; diff --git a/src/mesa/drivers/dri/i965/genX_state_upload.c b/src/mesa/drivers/dri/i965/genX_state_upload.c index ef04603df8e..6f3826aa8a1 100644 --- a/src/mesa/drivers/dri/i965/genX_state_upload.c +++ b/src/mesa/drivers/dri/i965/genX_state_upload.c @@ -5341,8 +5341,6 @@ genX(init_atoms)(struct brw_context *brw) /* Command packets: */ - &brw_invariant_state, - &brw_binding_table_pointers, &genX(blend_constant_color), diff --git a/src/mesa/drivers/dri/i965/intel_batchbuffer.c b/src/mesa/drivers/dri/i965/intel_batchbuffer.c index e2f208a3d1f..0aa08f96329 100644 --- a/src/mesa/drivers/dri/i965/intel_batchbuffer.c +++ b/src/mesa/drivers/dri/i965/intel_batchbuffer.c @@ -403,8 +403,10 @@ brw_new_batch(struct brw_context *brw) * would otherwise be stored in the context (which for all intents and * purposes means everything). */ - if (brw->hw_ctx == 0) + if (brw->hw_ctx == 0) { brw->ctx.NewDriverState |= BRW_NEW_CONTEXT; + brw_upload_invariant_state(brw); + } brw->ctx.NewDriverState |= BRW_NEW_BATCH; |