On 6 December 2011 23:54, Kenneth Graunke <span dir="ltr"><<a href="mailto:kenneth@whitecape.org">kenneth@whitecape.org</a>></span> wrote:<br><div class="gmail_quote"><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex;">
> + if (intel->gen == 6) {<br><div><div class="h5">
> + /* On Gen6, GS is used for transform feedback. */<br>
> + key->need_gs_prog = ctx->TransformFeedback.CurrentObject->Active;<br>
> + } else if (intel->gen >= 7) {<br>
> + /* On Gen7 and later, we don't use GS (yet). */<br>
> + key->need_gs_prog = false;<br>
<br>
</div></div>Could you please put these in order? 6, 7+, 4-5 is just asking for OCD<br>
issues. :) I'd probably move the >= 7 check to the top.<br></blockquote><div><br>Oh, whoops. Normally I am sufficiently OCD to notice stuff like this. I must be cured!<br><br>I assume when you say "I'd probably move the >= 7 check to the top" you mean that the order you'd prefer is 7+, then 6, then 4-5. That works for me--it's nice to have the most recent stuff first.<br>
</div><blockquote class="gmail_quote" style="margin: 0pt 0pt 0pt 0.8ex; border-left: 1px solid rgb(204, 204, 204); padding-left: 1ex;">
<div><div class="h5">> diff --git a/src/mesa/drivers/dri/i965/gen6_gs_state.c b/src/mesa/drivers/dri/i965/gen6_gs_state.c<br>
> index d29f029..b041140 100644<br>
> --- a/src/mesa/drivers/dri/i965/gen6_gs_state.c<br>
> +++ b/src/mesa/drivers/dri/i965/gen6_gs_state.c<br>
> @@ -44,22 +44,36 @@ upload_gs_state(struct brw_context *brw)<br>
> OUT_BATCH(0);<br>
> ADVANCE_BATCH();<br>
><br>
> - // GS should never be used on Gen6. Disable it.<br>
> - assert(!brw->gs.prog_active);<br>
> - BEGIN_BATCH(7);<br>
> - OUT_BATCH(_3DSTATE_GS << 16 | (7 - 2));<br>
> - OUT_BATCH(0); /* prog_bo */<br>
> - OUT_BATCH((0 << GEN6_GS_SAMPLER_COUNT_SHIFT) |<br>
> - (0 << GEN6_GS_BINDING_TABLE_ENTRY_COUNT_SHIFT));<br>
> - OUT_BATCH(0); /* scratch space base offset */<br>
> - OUT_BATCH((1 << GEN6_GS_DISPATCH_START_GRF_SHIFT) |<br>
> - (0 << GEN6_GS_URB_READ_LENGTH_SHIFT) |<br>
> - (0 << GEN6_GS_URB_ENTRY_READ_OFFSET_SHIFT));<br>
> - OUT_BATCH((0 << GEN6_GS_MAX_THREADS_SHIFT) |<br>
> - GEN6_GS_STATISTICS_ENABLE |<br>
> - GEN6_GS_RENDERING_ENABLE);<br>
> - OUT_BATCH(0);<br>
> - ADVANCE_BATCH();<br>
> + if (brw->gs.prog_active) {<br>
> + BEGIN_BATCH(7);<br>
> + OUT_BATCH(_3DSTATE_GS << 16 | (7 - 2));<br>
> + OUT_BATCH(brw->gs.prog_offset);<br>
> + OUT_BATCH(GEN6_GS_SPF_MODE | GEN6_GS_VECTOR_MASK_ENABLE);<br>
> + OUT_BATCH(0); /* no scratch space */<br>
> + OUT_BATCH((1 << GEN6_GS_DISPATCH_START_GRF_SHIFT) |<br>
> + (brw->gs.prog_data->urb_read_length << GEN6_GS_URB_READ_LENGTH_SHIFT));<br>
> + OUT_BATCH(((brw->max_gs_threads - 1) << GEN6_GS_MAX_THREADS_SHIFT) |<br>
> + GEN6_GS_STATISTICS_ENABLE |<br>
> + GEN6_GS_SO_STATISTICS_ENABLE |<br>
> + 0); //GEN6_GS_RENDERING_ENABLE);<br>
<br>
</div></div>I'm rather surprised this works. I thought you needed the<br>
GEN6_GS_RENDERING_ENABLE bit set in order to draw anything at all.<br>
<br>
The commented out code looks like it came from a half-baked patch of<br>
mine, so I'm guessing it's unintentional. Still, do you have any idea<br>
why it would work?<br></blockquote><div><br>Whoops. You're right of course. My best guess for why it worked is that when the GS is enabled, this bit doesn't have much effect--it just gets passed on to the GS program, which is supposed to use it to decide whether to pass vertices down the pipeline. Since I haven't written the part of the GS program that disables rendering yet, the GS program was just ignoring the incorrect bit and sending the vertices anyway.<br>
<br>Still, it's asking for trouble to set this bit incorrectly--the PRM clearly states "This bit must be set if the thread will attempt to allocate a handle. If clear, the GS thread must not allocate handles (e.g., when only performing stream output without concurrent rendering)." It's probably sheer luck that I didn't crash the GPU. I'll fix it.<br>
</div></div>