Skip to contentSkip to conversation

gen9: fix gem_render_copy 3d state setup

PATCH In review Imre Deak 5 participants 9 messages Jan 29, 2015 – Jan 30, 2015

Subsystems (3)
lore
Share & tools
lore

Imre Deak

author
#0 lore raw

PATCH 1/1 gen9: fix gem_render_copy 3d state setup

Without emitting the default 3DSTATE_WM_DEPTH_STENCIL state the test will fail.

---
 lib/rendercopy_gen9.c | 10 ++++++++--
 1 file changed, 8 insertions(+), 2 deletions(-)
lib/rendercopy_gen9.c +8 -2
index e20a84f..b7b133c 100644
@@ -821,7 +821,13 @@ gen8_emit_ps(struct intel_batchbuffer *batch, uint32_t kernel) {
 }
 
 static void
-gen8_emit_depth(struct intel_batchbuffer *batch) {
+gen9_emit_depth(struct intel_batchbuffer *batch)
+{
+	OUT_BATCH(GEN8_3DSTATE_WM_DEPTH_STENCIL | (4 - 2));
+	OUT_BATCH(0);
+	OUT_BATCH(0);
+	OUT_BATCH(0);
+
 	OUT_BATCH(GEN7_3DSTATE_DEPTH_BUFFER | (8-2));
 	OUT_BATCH(0);
 	OUT_BATCH(0);
@@ -999,7 +1005,7 @@ void gen9_render_copyfunc(struct intel_batchbuffer *batch,
 	OUT_BATCH(GEN6_3DSTATE_SCISSOR_STATE_POINTERS);
 	OUT_BATCH(scissor_state);
 
-	gen8_emit_depth(batch);
+	gen9_emit_depth(batch);
 
 	gen7_emit_clear(batch);
 
Signature · 6 lines
1.9.1

_______________________________________________
Intel-gfx mailing list
[email protected]
http://lists.freedesktop.org/mailman/listinfo/intel-gfx
#1 lore raw
Quoted 4 lines · Imre Deak

Without emitting the default 3DSTATE_WM_DEPTH_STENCIL state the test will fail.

Question: Wasn't the golden context supposed to paper over those?

Signature · 1 line
Damien
Quoted 39 lines
---
 lib/rendercopy_gen9.c | 10 ++++++++--
 1 file changed, 8 insertions(+), 2 deletions(-)
lib/rendercopy_gen9.c +8 -2
index e20a84f..b7b133c 100644
@@ -821,7 +821,13 @@ gen8_emit_ps(struct intel_batchbuffer *batch, uint32_t kernel) {
 }
 
 static void
-gen8_emit_depth(struct intel_batchbuffer *batch) {
+gen9_emit_depth(struct intel_batchbuffer *batch)
+{
+	OUT_BATCH(GEN8_3DSTATE_WM_DEPTH_STENCIL | (4 - 2));
+	OUT_BATCH(0);
+	OUT_BATCH(0);
+	OUT_BATCH(0);
+
 	OUT_BATCH(GEN7_3DSTATE_DEPTH_BUFFER | (8-2));
 	OUT_BATCH(0);
 	OUT_BATCH(0);
@@ -999,7 +1005,7 @@ void gen9_render_copyfunc(struct intel_batchbuffer *batch,
 	OUT_BATCH(GEN6_3DSTATE_SCISSOR_STATE_POINTERS);
 	OUT_BATCH(scissor_state);
 
-	gen8_emit_depth(batch);
+	gen9_emit_depth(batch);
 
 	gen7_emit_clear(batch);
 
Signature · 6 lines
1.9.1

_______________________________________________
Intel-gfx mailing list
[email protected]
http://lists.freedesktop.org/mailman/listinfo/intel-gfx

_______________________________________________
Intel-gfx mailing list
[email protected]
http://lists.freedesktop.org/mailman/listinfo/intel-gfx

author
#2 lore raw
Quoted 7 lines · Damien Lespiau
Quoted 4 lines · Imre Deak

Without emitting the default 3DSTATE_WM_DEPTH_STENCIL state the test will fail.

Question: Wasn't the golden context supposed to paper over those?

Perhaps, currently the golden context doesn't include this. I put it here to match what GEN8 copy_render does, but I agree that eventually we should move it to the golden context. I noticed that a bunch of other 3DSTATE commands are missing, which could explain the failures I see with other tests (at least piglit-mesa). I'm experimenting now with an updated golden context to see if it solves those failures.

--Imre

_______________________________________________
Intel-gfx mailing list
[email protected]
http://lists.freedesktop.org/mailman/listinfo/intel-gfx

#3 lore raw
Quoted 10 lines · Imre Deak
Quoted 7 lines · Damien Lespiau
Quoted 4 lines · Imre Deak

Without emitting the default 3DSTATE_WM_DEPTH_STENCIL state the test will fail.

Question: Wasn't the golden context supposed to paper over those?

Perhaps, currently the golden context doesn't include this.

Today, you cannot rely on the initial contents of the context even with the golden render state. There is no pristine context, every client is responsible for configuring the hardware exactly as they intend to use - at least as regards the untrusted commands (e.g. 3DSTATE). -Chris

Signature · 5 lines
Chris Wilson, Intel Open Source Technology Centre
_______________________________________________
Intel-gfx mailing list
[email protected]
http://lists.freedesktop.org/mailman/listinfo/intel-gfx
#4 lore raw
Quoted 8 lines · Chris Wilson
Quoted 7 lines · Imre Deak
Quoted 6 lines · Damien Lespiau
Quoted 4 lines · Imre Deak

Without emitting the default 3DSTATE_WM_DEPTH_STENCIL state the test will fail.

Quoted 8 lines
Quoted 3 lines
Quoted 1 line

Question: Wasn't the golden context supposed to paper over those?

Perhaps, currently the golden context doesn't include this.

Today, you cannot rely on the initial contents of the context even with the golden render state. There is no pristine context, every client is responsible for configuring the hardware exactly as they intend to use - at least as regards the untrusted commands (e.g. 3DSTATE).

Right. Now the question is, do we want to change that and have the golden context with sane defaults?

Signature · 5 lines
Damien
_______________________________________________
Intel-gfx mailing list
[email protected]
http://lists.freedesktop.org/mailman/listinfo/intel-gfx
#5 lore raw
Quoted 13 lines · Damien Lespiau
Quoted 12 lines · Chris Wilson
Quoted 10 lines · Imre Deak
Quoted 7 lines · Damien Lespiau
Quoted 4 lines · Imre Deak

Without emitting the default 3DSTATE_WM_DEPTH_STENCIL state the test will fail.

Question: Wasn't the golden context supposed to paper over those?

Perhaps, currently the golden context doesn't include this.

Quoted 7 lines
Quoted 4 lines

Today, you cannot rely on the initial contents of the context even with the golden render state. There is no pristine context, every client is responsible for configuring the hardware exactly as they intend to use - at least as regards the untrusted commands (e.g. 3DSTATE).

Right. Now the question is, do we want to change that and have the golden context with sane defaults?

You missed the point. The point is that we don't keep initialise every context from scratch. And there still doesn't seem to be any reason to be papering over userspace bugs.
-Chris

Signature · 5 lines
Chris Wilson, Intel Open Source Technology Centre
_______________________________________________
Intel-gfx mailing list
[email protected]
http://lists.freedesktop.org/mailman/listinfo/intel-gfx
#6 lore raw
Quoted 19 lines · Chris Wilson
Quoted 18 lines · Damien Lespiau
Quoted 16 lines · Chris Wilson
Quoted 10 lines · Imre Deak
Quoted 7 lines · Damien Lespiau
Quoted 4 lines · Imre Deak

Without emitting the default 3DSTATE_WM_DEPTH_STENCIL state the test will fail.

Question: Wasn't the golden context supposed to paper over those?

Perhaps, currently the golden context doesn't include this.

Today, you cannot rely on the initial contents of the context even with the golden render state. There is no pristine context, every client is responsible for configuring the hardware exactly as they intend to use - at least as regards the untrusted commands (e.g. 3DSTATE).

Quoted 6 lines
Quoted 2 lines

Right. Now the question is, do we want to change that and have the golden context with sane defaults?

You missed the point. The point is that we don't keep initialise every context from scratch. And there still doesn't seem to be any reason to be papering over userspace bugs.

That's because I still think the end of the journey is a fully initialized golden context image + copy of that context on context creation.

Signature · 5 lines
Damien
_______________________________________________
Intel-gfx mailing list
[email protected]
http://lists.freedesktop.org/mailman/listinfo/intel-gfx
#7 lore raw
Quoted 23 lines · Damien Lespiau
Quoted 22 lines · Chris Wilson
Quoted 20 lines · Damien Lespiau
Quoted 8 lines · Chris Wilson
Quoted 7 lines · Imre Deak
Quoted 6 lines · Damien Lespiau
Quoted 4 lines · Imre Deak

Without emitting the default 3DSTATE_WM_DEPTH_STENCIL state the test will fail.

Quoted 8 lines
Quoted 3 lines
Quoted 1 line

Question: Wasn't the golden context supposed to paper over those?

Perhaps, currently the golden context doesn't include this.

Today, you cannot rely on the initial contents of the context even with the golden render state. There is no pristine context, every client is responsible for configuring the hardware exactly as they intend to use - at least as regards the untrusted commands (e.g. 3DSTATE).

Right. Now the question is, do we want to change that and have the golden context with sane defaults?

Quoted 8 lines
Quoted 3 lines

You missed the point. The point is that we don't keep initialise every context from scratch. And there still doesn't seem to be any reason to be papering over userspace bugs.

That's because I still think the end of the journey is a fully initialized golden context image + copy of that context on context creation.

For me the end journey has looked like this:

For first (default) context:
- run golden/null batch
- emit workarounds
- take a master copy from ctx_obj

Then:
- copy from master (with gpu or cpu) for every new fd/ctx

-Mika

Quoted 6 lines
Signature · 5 lines
Damien
_______________________________________________
Intel-gfx mailing list
[email protected]
http://lists.freedesktop.org/mailman/listinfo/intel-gfx

_______________________________________________
Intel-gfx mailing list
[email protected]
http://lists.freedesktop.org/mailman/listinfo/intel-gfx

#8 lore raw
Quoted 36 lines · Mika Kuoppala
Quoted 23 lines · Damien Lespiau
Quoted 22 lines · Chris Wilson
Quoted 20 lines · Damien Lespiau
Quoted 8 lines · Chris Wilson
Quoted 7 lines · Imre Deak
Quoted 6 lines · Damien Lespiau
Quoted 4 lines · Imre Deak

Without emitting the default 3DSTATE_WM_DEPTH_STENCIL state the test will fail.

Quoted 8 lines
Quoted 3 lines
Quoted 1 line

Question: Wasn't the golden context supposed to paper over those?

Perhaps, currently the golden context doesn't include this.

Today, you cannot rely on the initial contents of the context even with the golden render state. There is no pristine context, every client is responsible for configuring the hardware exactly as they intend to use - at least as regards the untrusted commands (e.g. 3DSTATE).

Right. Now the question is, do we want to change that and have the golden context with sane defaults?

Quoted 8 lines
Quoted 3 lines

You missed the point. The point is that we don't keep initialise every context from scratch. And there still doesn't seem to be any reason to be papering over userspace bugs.

That's because I still think the end of the journey is a fully initialized golden context image + copy of that context on context creation.

For me the end journey has looked like this:

Quoted 7 lines

For first (default) context:
- run golden/null batch
- emit workarounds
- take a master copy from ctx_obj

Then:
- copy from master (with gpu or cpu) for every new fd/ctx

Can we just have it? I think we only need to do this here:

drivers/gpu/drm/i915/i915_gem_context.c +1 -1
index 8603bf48d3ee..e20cfa1ac88c 100644
@@ -633,7 +633,7 @@ static int do_switch(struct intel_engine_cs *ring,
 			goto unpin_out;
 	}
 
-	if (!to->legacy_hw_ctx.initialized || i915_gem_context_is_default(to))
+	if (!to->legacy_hw_ctx.initialized)
 		hw_flags |= MI_RESTORE_INHIBIT;
 
 	ret = mi_set_context(ring, to, hw_flags);

Chris doesn't like it though for the perf implications. I've sent this out a while ago but never got around to doing the microbenchmark Chris requested. So testing (and if it works, volunteers for the microbenchmark) highly welcome ...
-Daniel

Signature · 7 lines
Daniel Vetter
Software Engineer, Intel Corporation
+41 (0) 79 365 57 48 - http://blog.ffwll.ch
_______________________________________________
Intel-gfx mailing list
[email protected]
http://lists.freedesktop.org/mailman/listinfo/intel-gfx