<div dir="ltr">On 17 May 2013 10:18, Kenneth Graunke <span dir="ltr"><<a href="mailto:kenneth@whitecape.org" target="_blank">kenneth@whitecape.org</a>></span> wrote:<br><div class="gmail_extra"><div class="gmail_quote">
<blockquote class="gmail_quote" style="margin:0px 0px 0px 0.8ex;border-left:1px solid rgb(204,204,204);padding-left:1ex">This has more of a negative impact than the previous patch, as on Gen6<br>
passing primitives through to the clipper means we actually have to make<br>
the GS thread write them to the URB.<br>
<br>
I don't see another good solution though, and rasterizer discard is not<br>
the most common of cases, so hopefully it won't be too terrible.<br>
<br>
Cc: Eric Anholt <<a href="mailto:eric@anholt.net">eric@anholt.net</a>><br>
Cc: Paul Berry <<a href="mailto:stereotype441@gmail.com">stereotype441@gmail.com</a>><br>
Signed-off-by: Kenneth Graunke <<a href="mailto:kenneth@whitecape.org">kenneth@whitecape.org</a>><br>
---<br>
src/mesa/drivers/dri/i965/brw_gs.c | 9 +--------<br>
src/mesa/drivers/dri/i965/brw_gs_emit.c | 30 -----------------------------<br>
src/mesa/drivers/dri/i965/gen6_clip_state.c | 6 +++++-<br>
3 files changed, 6 insertions(+), 39 deletions(-)<br>
<br>
This patch prevents breakage in patch 10. See patch 10 for the rationale.<br></blockquote><div><br></div><div>This patch removes the last use of brw_gs_prog_key::rasterizer_discard. Let's remove that unused field to avoid future confusion.<br>
<br>With that change, this patch is:<br><br>Reviewed-by: Paul Berry <<a href="mailto:stereotype441@gmail.com">stereotype441@gmail.com</a>><br></div><div> </div><blockquote class="gmail_quote" style="margin:0px 0px 0px 0.8ex;border-left:1px solid rgb(204,204,204);padding-left:1ex">
<br>
diff --git a/src/mesa/drivers/dri/i965/brw_gs.c b/src/mesa/drivers/dri/i965/brw_gs.c<br>
index a432b76..f354dd9 100644<br>
--- a/src/mesa/drivers/dri/i965/brw_gs.c<br>
+++ b/src/mesa/drivers/dri/i965/brw_gs.c<br>
@@ -214,12 +214,6 @@ static void populate_key( struct brw_context *brw,<br>
swizzle_for_offset[linked_xfb_info->Outputs[i].ComponentOffset];<br>
}<br>
}<br>
- /* On Gen6, GS is also used for rasterizer discard. */<br>
- /* BRW_NEW_RASTERIZER_DISCARD */<br>
- if (ctx->RasterDiscard) {<br>
- key->need_gs_prog = true;<br>
- key->rasterizer_discard = true;<br>
- }<br>
} else {<br>
/* Pre-gen6, GS is used to transform QUADLIST, QUADSTRIP, and LINELOOP<br>
* into simpler primitives.<br>
@@ -259,8 +253,7 @@ const struct brw_tracked_state brw_gs_prog = {<br>
.dirty = {<br>
.mesa = (_NEW_LIGHT),<br>
.brw = (BRW_NEW_PRIMITIVE |<br>
- BRW_NEW_TRANSFORM_FEEDBACK |<br>
- BRW_NEW_RASTERIZER_DISCARD),<br>
+ BRW_NEW_TRANSFORM_FEEDBACK),<br>
.cache = CACHE_NEW_VS_PROG<br>
},<br>
.emit = brw_upload_gs_prog<br>
diff --git a/src/mesa/drivers/dri/i965/brw_gs_emit.c b/src/mesa/drivers/dri/i965/brw_gs_emit.c<br>
index 87ff9f0..cbfc6aa 100644<br>
--- a/src/mesa/drivers/dri/i965/brw_gs_emit.c<br>
+++ b/src/mesa/drivers/dri/i965/brw_gs_emit.c<br>
@@ -201,28 +201,6 @@ static void brw_gs_emit_vue(struct brw_gs_compile *c,<br>
}<br>
<br>
/**<br>
- * De-allocate the URB entry that was previously allocated to this thread<br>
- * (without writing any vertex data to it), and terminate the thread. This is<br>
- * used to implement RASTERIZER_DISCARD functionality.<br>
- */<br>
-static void brw_gs_terminate(struct brw_gs_compile *c)<br>
-{<br>
- struct brw_compile *p = &c->func;<br>
- brw_urb_WRITE(p,<br>
- retype(brw_null_reg(), BRW_REGISTER_TYPE_UD), /* dest */<br>
- 0, /* msg_reg_nr */<br>
- c->reg.header, /* src0 */<br>
- false, /* allocate */<br>
- false, /* used */<br>
- 1, /* msg_length */<br>
- 0, /* response_length */<br>
- true, /* eot */<br>
- true, /* writes_complete */<br>
- 0, /* offset */<br>
- BRW_URB_SWIZZLE_NONE);<br>
-}<br>
-<br>
-/**<br>
* Send an FF_SYNC message to ensure that all previously spawned GS threads<br>
* have finished sending primitives down the pipeline, and to allocate a URB<br>
* entry for the first output vertex. Only needed when intel->needs_ff_sync<br>
@@ -484,14 +462,6 @@ gen6_sol_program(struct brw_gs_compile *c, struct brw_gs_prog_key *key,<br>
<br>
brw_gs_ff_sync(c, 1);<br>
<br>
- /* If RASTERIZER_DISCARD is enabled, we have nothing further to do, so<br>
- * release the URB that was just allocated, and terminate the thread.<br>
- */<br>
- if (key->rasterizer_discard) {<br>
- brw_gs_terminate(c);<br>
- return;<br>
- }<br>
-<br>
brw_gs_overwrite_header_dw2_from_r0(c);<br>
switch (num_verts) {<br>
case 1:<br>
diff --git a/src/mesa/drivers/dri/i965/gen6_clip_state.c b/src/mesa/drivers/dri/i965/gen6_clip_state.c<br>
index 1811a3f..b5e22dc 100644<br>
--- a/src/mesa/drivers/dri/i965/gen6_clip_state.c<br>
+++ b/src/mesa/drivers/dri/i965/gen6_clip_state.c<br>
@@ -77,6 +77,10 @@ upload_clip_state(struct brw_context *brw)<br>
dw2 |= GEN6_CLIP_GB_TEST;<br>
}<br>
<br>
+ /* BRW_NEW_RASTERIZER_DISCARD */<br>
+ if (ctx->RasterDiscard)<br>
+ dw2 |= GEN6_CLIP_MODE_REJECT_ALL;<br>
+<br>
BEGIN_BATCH(4);<br>
OUT_BATCH(_3DSTATE_CLIP << 16 | (4 - 2));<br>
OUT_BATCH(dw1);<br>
@@ -94,7 +98,7 @@ upload_clip_state(struct brw_context *brw)<br>
const struct brw_tracked_state gen6_clip_state = {<br>
.dirty = {<br>
.mesa = _NEW_TRANSFORM | _NEW_LIGHT | _NEW_BUFFERS,<br>
- .brw = (BRW_NEW_CONTEXT),<br>
+ .brw = BRW_NEW_CONTEXT | BRW_NEW_RASTERIZER_DISCARD,<br>
.cache = CACHE_NEW_WM_PROG<br>
},<br>
.emit = upload_clip_state,<br>
<span class=""><font color="#888888">--<br>
1.8.2.3<br>
<br>
</font></span></blockquote></div><br></div></div>