<div dir="ltr">Would I be too much of a pedant if I asked for uint32_t for flags?<br></div><div class="gmail_extra"><br><div class="gmail_quote">On Tue, Sep 6, 2016 at 12:28 AM, Topi Pohjolainen <span dir="ltr"><<a href="mailto:topi.pohjolainen@gmail.com" target="_blank">topi.pohjolainen@gmail.com</a>></span> wrote:<br><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex">And add plumbing to provide it all the way to surface state emitter.<br>
This is not used yet but will be in subsequent patches to carry<br>
additional constraints.<br>
<br>
Signed-off-by: Topi Pohjolainen <<a href="mailto:topi.pohjolainen@intel.com">topi.pohjolainen@intel.com</a>><br>
---<br>
 src/mesa/drivers/dri/i965/brw_<wbr>context.h          |  2 +-<br>
 src/mesa/drivers/dri/i965/brw_<wbr>state.h            |  2 +-<br>
 src/mesa/drivers/dri/i965/brw_<wbr>wm_surface_state.c | 28 +++++++++++++++---------<br>
 3 files changed, 20 insertions(+), 12 deletions(-)<br>
<br>
diff --git a/src/mesa/drivers/dri/i965/<wbr>brw_context.h b/src/mesa/drivers/dri/i965/<wbr>brw_context.h<br>
index e7c90b7..12ac8af 100644<br>
--- a/src/mesa/drivers/dri/i965/<wbr>brw_context.h<br>
+++ b/src/mesa/drivers/dri/i965/<wbr>brw_context.h<br>
@@ -747,7 +747,7 @@ struct brw_context<br>
    {<br>
       uint32_t (*update_renderbuffer_surface)<wbr>(struct brw_context *brw,<br>
                                               struct gl_renderbuffer *rb,<br>
-                                              bool layered, unsigned unit,<br>
+                                              int flags, unsigned unit,<br>
                                               uint32_t surf_index);<br>
       void (*emit_null_surface_state)(<wbr>struct brw_context *brw,<br>
                                       unsigned width,<br>
diff --git a/src/mesa/drivers/dri/i965/<wbr>brw_state.h b/src/mesa/drivers/dri/i965/<wbr>brw_state.h<br>
index bfcdf29..1d370c3 100644<br>
--- a/src/mesa/drivers/dri/i965/<wbr>brw_state.h<br>
+++ b/src/mesa/drivers/dri/i965/<wbr>brw_state.h<br>
@@ -288,7 +288,7 @@ void brw_update_texture_surface(<wbr>struct gl_context *ctx,<br>
<br>
 uint32_t brw_update_renderbuffer_<wbr>surface(struct brw_context *brw,<br>
                                          struct gl_renderbuffer *rb,<br>
-                                         bool layered, unsigned unit,<br>
+                                         int flags, unsigned unit,<br>
                                          uint32_t surf_index);<br>
<br>
 void brw_update_renderbuffer_<wbr>surfaces(struct brw_context *brw,<br>
diff --git a/src/mesa/drivers/dri/i965/<wbr>brw_wm_surface_state.c b/src/mesa/drivers/dri/i965/<wbr>brw_wm_surface_state.c<br>
index c347b5d..073919e 100644<br>
--- a/src/mesa/drivers/dri/i965/<wbr>brw_wm_surface_state.c<br>
+++ b/src/mesa/drivers/dri/i965/<wbr>brw_wm_surface_state.c<br>
@@ -54,6 +54,10 @@<br>
 #include "brw_defines.h"<br>
 #include "brw_wm.h"<br>
<br>
+enum {<br>
+   INTEL_RENDERBUFFER_LAYERED = 1 << 0,<br>
+};<br>
+<br>
 struct surface_state_info {<br>
    unsigned num_dwords;<br>
    unsigned ss_align; /* Required alignment of RENDER_SURFACE_STATE in bytes */<br>
@@ -74,7 +78,7 @@ static const struct surface_state_info surface_state_infos[] = {<br>
<br>
 static void<br>
 brw_emit_surface_state(struct brw_context *brw,<br>
-                       struct intel_mipmap_tree *mt,<br>
+                       struct intel_mipmap_tree *mt, int flags,<br>
                        GLenum target, struct isl_view view,<br>
                        uint32_t mocs, uint32_t *surf_offset, int surf_index,<br>
                        unsigned read_domains, unsigned write_domains)<br>
@@ -183,7 +187,7 @@ brw_emit_surface_state(struct brw_context *brw,<br>
 uint32_t<br>
 brw_update_renderbuffer_<wbr>surface(struct brw_context *brw,<br>
                                 struct gl_renderbuffer *rb,<br>
-                                bool layered, unsigned unit /* unused */,<br>
+                                int flags, unsigned unit /* unused */,<br>
                                 uint32_t surf_index)<br>
 {<br>
    struct gl_context *ctx = &brw->ctx;<br>
@@ -220,7 +224,7 @@ brw_update_renderbuffer_<wbr>surface(struct brw_context *brw,<br>
    };<br>
<br>
    uint32_t offset;<br>
-   brw_emit_surface_state(brw, mt, mt->target, view,<br>
+   brw_emit_surface_state(brw, mt, flags, mt->target, view,<br>
                           surface_state_infos[brw->gen].<wbr>rb_mocs,<br>
                           &offset, surf_index,<br>
                           I915_GEM_DOMAIN_RENDER,<br>
@@ -533,7 +537,8 @@ brw_update_texture_surface(<wbr>struct gl_context *ctx,<br>
           obj->Target == GL_TEXTURE_CUBE_MAP_ARRAY)<br>
          view.usage |= ISL_SURF_USAGE_CUBE_BIT;<br>
<br>
-      brw_emit_surface_state(brw, mt, mt->target, view,<br>
+      const int flags = 0;<br>
+      brw_emit_surface_state(brw, mt, flags, mt->target, view,<br>
                              surface_state_infos[brw->gen].<wbr>tex_mocs,<br>
                              surf_offset, surf_index,<br>
                              I915_GEM_DOMAIN_SAMPLER, 0);<br>
@@ -865,7 +870,7 @@ brw_emit_null_surface_state(<wbr>struct brw_context *brw,<br>
 static uint32_t<br>
 gen4_update_renderbuffer_<wbr>surface(struct brw_context *brw,<br>
                                  struct gl_renderbuffer *rb,<br>
-                                 bool layered, unsigned unit,<br>
+                                 int flags, unsigned unit,<br>
                                  uint32_t surf_index)<br>
 {<br>
    struct gl_context *ctx = &brw->ctx;<br>
@@ -879,7 +884,7 @@ gen4_update_renderbuffer_<wbr>surface(struct brw_context *brw,<br>
    mesa_format rb_format = _mesa_get_render_format(ctx, intel_rb_format(irb));<br>
    /* BRW_NEW_FS_PROG_DATA */<br>
<br>
-   assert(!layered);<br>
+   assert(!(flags & INTEL_RENDERBUFFER_LAYERED));<br>
<br>
    if (rb->TexImage && !brw->has_surface_tile_offset) {<br>
       intel_renderbuffer_get_tile_<wbr>offsets(irb, &tile_x, &tile_y);<br>
@@ -982,12 +987,13 @@ brw_update_renderbuffer_<wbr>surfaces(struct brw_context *brw,<br>
    if (fb->_NumColorDrawBuffers >= 1) {<br>
       for (i = 0; i < fb->_NumColorDrawBuffers; i++) {<br>
          const uint32_t surf_index = render_target_start + i;<br>
+         const int flags =<br>
+            _mesa_geometric_layers(fb) > 0 ? INTEL_RENDERBUFFER_LAYERED : 0;<br>
<br>
         if (intel_renderbuffer(fb->_<wbr>ColorDrawBuffers[i])) {<br>
             surf_offset[surf_index] =<br>
                brw->vtbl.update_renderbuffer_<wbr>surface(<br>
-                  brw, fb->_ColorDrawBuffers[i],<br>
-                  _mesa_geometric_layers(fb) > 0, i, surf_index);<br>
+                  brw, fb->_ColorDrawBuffers[i], flags, i, surf_index);<br>
         } else {<br>
             brw->vtbl.emit_null_surface_<wbr>state(brw, w, h, s,<br>
                &surf_offset[surf_index]);<br>
@@ -1099,7 +1105,8 @@ update_renderbuffer_read_<wbr>surfaces(struct brw_context *brw)<br>
                .usage = ISL_SURF_USAGE_TEXTURE_BIT,<br>
             };<br>
<br>
-            brw_emit_surface_state(brw, irb->mt, target, view,<br>
+            const int flags = 0;<br>
+            brw_emit_surface_state(brw, irb->mt, flags, target, view,<br>
                                    surface_state_infos[brw->gen].<wbr>tex_mocs,<br>
                                    surf_offset, surf_index,<br>
                                    I915_GEM_DOMAIN_SAMPLER, 0);<br>
@@ -1658,7 +1665,8 @@ update_image_surface(struct brw_context *brw,<br>
<br>
             const int surf_index = surf_offset - &brw->wm.base.surf_offset[0];<br>
<br>
-            brw_emit_surface_state(brw, mt, mt->target, view,<br>
+            const int flags = 0;<br>
+            brw_emit_surface_state(brw, mt, flags, mt->target, view,<br>
                                    surface_state_infos[brw->gen].<wbr>tex_mocs,<br>
                                    surf_offset, surf_index,<br>
                                    I915_GEM_DOMAIN_SAMPLER,<br>
<span class="HOEnZb"><font color="#888888">--<br>
2.5.5<br>
<br>
______________________________<wbr>_________________<br>
mesa-dev mailing list<br>
<a href="mailto:mesa-dev@lists.freedesktop.org">mesa-dev@lists.freedesktop.org</a><br>
<a href="https://lists.freedesktop.org/mailman/listinfo/mesa-dev" rel="noreferrer" target="_blank">https://lists.freedesktop.org/<wbr>mailman/listinfo/mesa-dev</a><br>
</font></span></blockquote></div><br></div>