On 4 October 2011 10:54, Ian Romanick <span dir="ltr"><<a href="mailto:idr@freedesktop.org">idr@freedesktop.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;">
<div><div></div><div class="h5">On 10/03/2011 03:11 PM, Paul Berry wrote:<br>
</div></div><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex"><div><div></div><div class="h5">
Previously, brw_compute_vue_map required an argument indicating the<br>
number of clip planes in use, but all it did with it was check if it<br>
was nonzero.<br>
<br>
This patch changes brw_compute_vue_map to take a boolean instead.<br>
This allows us to avoid some unnecessary recompilation of the Gen4/5<br>
GS and SF threads.<br>
---<br>
src/mesa/drivers/dri/i965/brw_<u></u>clip.c | 2 +-<br>
src/mesa/drivers/dri/i965/brw_<u></u>context.h | 3 ++-<br>
src/mesa/drivers/dri/i965/brw_<u></u>gs.c | 4 ++--<br>
src/mesa/drivers/dri/i965/brw_<u></u>gs.h | 3 +--<br>
src/mesa/drivers/dri/i965/brw_<u></u>sf.c | 4 ++--<br>
src/mesa/drivers/dri/i965/brw_<u></u>sf.h | 3 +--<br>
src/mesa/drivers/dri/i965/brw_<u></u>vec4_emit.cpp | 2 +-<br>
src/mesa/drivers/dri/i965/brw_<u></u>vec4_visitor.cpp | 4 ++--<br>
src/mesa/drivers/dri/i965/brw_<u></u>vs.c | 6 ++++--<br>
src/mesa/drivers/dri/i965/brw_<u></u>vs.h | 6 ++++++<br>
src/mesa/drivers/dri/i965/brw_<u></u>vs_emit.c | 10 +++++-----<br>
src/mesa/drivers/dri/i965/<u></u>gen6_sf_state.c | 6 +++---<br>
src/mesa/drivers/dri/i965/<u></u>gen7_sf_state.c | 4 ++--<br>
13 files changed, 32 insertions(+), 25 deletions(-)<br>
<br>
diff --git a/src/mesa/drivers/dri/i965/<u></u>brw_clip.c b/src/mesa/drivers/dri/i965/<u></u>brw_clip.c<br>
index 2eb6044..fde3472 100644<br>
--- a/src/mesa/drivers/dri/i965/<u></u>brw_clip.c<br>
+++ b/src/mesa/drivers/dri/i965/<u></u>brw_clip.c<br>
@@ -69,7 +69,7 @@ static void compile_clip_prog( struct brw_context *brw,<br>
c.func.single_program_flow = 1;<br>
<br>
c.key = *key;<br>
- brw_compute_vue_map(&c.vue_<u></u>map, intel, c.key.nr_userclip, c.key.attrs);<br>
+ brw_compute_vue_map(&c.vue_<u></u>map, intel, c.key.nr_userclip> 0, c.key.attrs);<br>
<br>
/* nr_regs is the number of registers filled by reading data from the VUE.<br>
* This program accesses the entire VUE, so nr_regs needs to be the size of<br>
diff --git a/src/mesa/drivers/dri/i965/<u></u>brw_context.h b/src/mesa/drivers/dri/i965/<u></u>brw_context.h<br>
index 7c5bfd0..c81713a 100644<br>
--- a/src/mesa/drivers/dri/i965/<u></u>brw_context.h<br>
+++ b/src/mesa/drivers/dri/i965/<u></u>brw_context.h<br>
@@ -965,7 +965,8 @@ int brw_disasm (FILE *file, struct brw_instruction *inst, int gen);<br>
<br>
/* brw_vs.c */<br>
void brw_compute_vue_map(struct brw_vue_map *vue_map,<br>
- const struct intel_context *intel, int nr_userclip,<br>
+ const struct intel_context *intel,<br>
+ bool userclip_active,<br>
GLbitfield64 outputs_written);<br>
GLclipplane *brw_select_clip_planes(struct gl_context *ctx);<br>
<br>
diff --git a/src/mesa/drivers/dri/i965/<u></u>brw_gs.c b/src/mesa/drivers/dri/i965/<u></u>brw_gs.c<br>
index 0a37485..3b56aae 100644<br>
--- a/src/mesa/drivers/dri/i965/<u></u>brw_gs.c<br>
+++ b/src/mesa/drivers/dri/i965/<u></u>brw_gs.c<br>
@@ -64,7 +64,7 @@ static void compile_gs_prog( struct brw_context *brw,<br>
c.key = *key;<br>
/* The geometry shader needs to access the entire VUE. */<br>
struct brw_vue_map vue_map;<br>
- brw_compute_vue_map(&vue_map, intel, c.key.nr_userclip, c.key.attrs);<br>
+ brw_compute_vue_map(&vue_map, intel, c.key.userclip_active, c.key.attrs);<br>
c.nr_regs = (vue_map.num_slots + 1)/2;<br>
<br>
mem_ctx = NULL;<br>
@@ -159,7 +159,7 @@ static void populate_key( struct brw_context *brw,<br>
}<br>
<br>
/* _NEW_TRANSFORM */<br>
- key->nr_userclip = brw_count_bits(ctx->Transform.<u></u>ClipPlanesEnabled);<br>
+ key->userclip_active = (ctx->Transform.<u></u>ClipPlanesEnabled != 0);<br>
<br>
key->need_gs_prog = (intel->gen>= 6)<br>
? 0<br>
diff --git a/src/mesa/drivers/dri/i965/<u></u>brw_gs.h b/src/mesa/drivers/dri/i965/<u></u>brw_gs.h<br>
index d8637c8..cee7467 100644<br>
--- a/src/mesa/drivers/dri/i965/<u></u>brw_gs.h<br>
+++ b/src/mesa/drivers/dri/i965/<u></u>brw_gs.h<br>
@@ -44,8 +44,7 @@ struct brw_gs_prog_key {<br>
GLuint primitive:4;<br>
GLuint pv_first:1;<br>
GLuint need_gs_prog:1;<br>
- GLuint nr_userclip:4;<br>
- GLuint pad:22;<br>
+ GLuint userclip_active:1;<br>
};<br>
<br>
struct brw_gs_compile {<br>
diff --git a/src/mesa/drivers/dri/i965/<u></u>brw_sf.c b/src/mesa/drivers/dri/i965/<u></u>brw_sf.c<br>
index 4e0434a..7a0cd92 100644<br>
--- a/src/mesa/drivers/dri/i965/<u></u>brw_sf.c<br>
+++ b/src/mesa/drivers/dri/i965/<u></u>brw_sf.c<br>
@@ -63,7 +63,7 @@ static void compile_sf_prog( struct brw_context *brw,<br></div></div>
brw_init_compile(brw,&c.func, mem_ctx);<div class="im"><br>
<br>
c.key = *key;<br>
- brw_compute_vue_map(&c.vue_<u></u>map, intel, c.key.nr_userclip, c.key.attrs);<br>
+ brw_compute_vue_map(&c.vue_<u></u>map, intel, c.key.userclip_active, c.key.attrs);<br>
c.urb_entry_read_offset = brw_sf_compute_urb_entry_read_<u></u>offset(intel);<br>
c.nr_attr_regs = (c.vue_map.num_slots + 1)/2 - c.urb_entry_read_offset;<br>
c.nr_setup_regs = c.nr_attr_regs;<br>
@@ -154,7 +154,7 @@ static void upload_sf_prog(struct brw_context *brw)<br>
}<br>
<br>
/* _NEW_TRANSFORM */<br>
- key.nr_userclip = brw_count_bits(ctx->Transform.<u></u>ClipPlanesEnabled);<br>
+ key.userclip_active = (ctx->Transform.<u></u>ClipPlanesEnabled != 0);<br>
<br>
/* _NEW_POINT */<br>
key.do_point_sprite = ctx->Point.PointSprite;<br>
diff --git a/src/mesa/drivers/dri/i965/<u></u>brw_sf.h b/src/mesa/drivers/dri/i965/<u></u>brw_sf.h<br>
index f39ad27..8de5f5a 100644<br>
--- a/src/mesa/drivers/dri/i965/<u></u>brw_sf.h<br>
+++ b/src/mesa/drivers/dri/i965/<u></u>brw_sf.h<br>
@@ -53,8 +53,7 @@ struct brw_sf_prog_key {<br>
GLuint frontface_ccw:1;<br>
GLuint do_point_sprite:1;<br>
GLuint sprite_origin_lower_left:1;<br>
- GLuint nr_userclip:4;<br>
- GLuint pad:20;<br>
+ GLuint userclip_active:1;<br>
</div></blockquote>
<br>
In the past we've had a bunch of pad elements to document how many bits were left. I've never been too fond of that as it creates extra maintenance. However, others might care, and this change is easy to miss in the rest of the patch.<br>
</blockquote><div><br>FWIW, we discussed this on list last week and both Ken and Eric were in favor of removing them--see <a href="http://lists.freedesktop.org/archives/mesa-dev/2011-September/012630.html">http://lists.freedesktop.org/archives/mesa-dev/2011-September/012630.html</a>.<br>
</div></div>