<div dir="ltr"><br><div class="gmail_extra"><br><div class="gmail_quote">On Fri, May 13, 2016 at 11:48 AM, Pohjolainen, Topi <span dir="ltr"><<a href="mailto:topi.pohjolainen@intel.com" target="_blank">topi.pohjolainen@intel.com</a>></span> wrote:<br><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex"><span class="">On Tue, May 10, 2016 at 04:16:39PM -0700, Jason Ekstrand wrote:<br>
> ---<br>
>  src/mesa/drivers/dri/i965/brw_blorp_clear.cpp | 184 ++++++--------------------<br>
>  1 file changed, 39 insertions(+), 145 deletions(-)<br>
<br>
</span>Can you also add:<br>
<br>
Bugzilla: <a href="https://bugs.freedesktop.org/show_bug.cgi?id=95373" rel="noreferrer" target="_blank">https://bugs.freedesktop.org/show_bug.cgi?id=95373</a><br></blockquote><div><br></div><div>Done<br></div><div> </div><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex">
We concluded it wasn't worth fixing the warning because you were about to<br>
delete the old compiler.<br>
<div><div class="h5"><br>
><br>
> diff --git a/src/mesa/drivers/dri/i965/brw_blorp_clear.cpp b/src/mesa/drivers/dri/i965/brw_blorp_clear.cpp<br>
> index 94b8277..3925d28 100644<br>
> --- a/src/mesa/drivers/dri/i965/brw_blorp_clear.cpp<br>
> +++ b/src/mesa/drivers/dri/i965/brw_blorp_clear.cpp<br>
> @@ -37,6 +37,8 @@<br>
>  #include "brw_eu.h"<br>
>  #include "brw_state.h"<br>
><br>
> +#include "nir_builder.h"<br>
> +<br>
>  #define FILE_DEBUG_FLAG DEBUG_BLORP<br>
><br>
>  struct brw_blorp_const_color_prog_key<br>
> @@ -45,78 +47,55 @@ struct brw_blorp_const_color_prog_key<br>
>     bool pad[3];<br>
>  };<br>
><br>
> -class brw_blorp_const_color_program<br>
> +static void<br>
> +brw_blorp_params_get_clear_kernel(struct brw_context *brw,<br>
> +                                  struct brw_blorp_params *params,<br>
> +                                  bool use_replicated_data)<br>
>  {<br>
> -public:<br>
> -   brw_blorp_const_color_program(struct brw_context *brw,<br>
> -                                 const brw_blorp_const_color_prog_key *key);<br>
> -   ~brw_blorp_const_color_program();<br>
> +   struct brw_blorp_const_color_prog_key blorp_key;<br>
> +   memset(&blorp_key, 0, sizeof(blorp_key));<br>
> +   blorp_key.use_simd16_replicated_data = use_replicated_data;<br>
><br>
> -   const GLuint *compile(struct brw_context *brw, GLuint *program_size);<br>
> +   if (brw_search_cache(&brw->cache, BRW_CACHE_BLORP_PROG,<br>
> +                        &blorp_key, sizeof(blorp_key),<br>
> +                        &params->wm_prog_kernel, &params->wm_prog_data))<br>
> +      return;<br>
><br>
> -   brw_blorp_prog_data prog_data;<br>
> +   void *mem_ctx = ralloc_context(NULL);<br>
><br>
> -private:<br>
> -   void alloc_regs();<br>
> +   nir_builder b;<br>
> +   nir_builder_init_simple_shader(&b, NULL, MESA_SHADER_FRAGMENT, NULL);<br>
> +   b.shader-><a href="http://info.name" rel="noreferrer" target="_blank">info.name</a> = ralloc_strdup(b.shader, "BLORP-clear");<br>
><br>
> -   void *mem_ctx;<br>
> -   const brw_blorp_const_color_prog_key *key;<br>
> -   struct brw_codegen func;<br>
> +   nir_variable *u_color = nir_variable_create(b.shader, nir_var_uniform,<br>
> +                                               glsl_vec4_type(), "u_color");<br>
> +   u_color->data.location = 0;<br>
><br>
> -   /* Thread dispatch header */<br>
> -   struct brw_reg R0;<br>
> +   nir_variable *frag_color = nir_variable_create(b.shader, nir_var_shader_out,<br>
> +                                                  glsl_vec4_type(),<br>
> +                                                  "gl_FragColor");<br>
> +   frag_color->data.location = FRAG_RESULT_COLOR;<br>
><br>
> -   /* Pixel X/Y coordinates (always in R1). */<br>
> -   struct brw_reg R1;<br>
> +   nir_copy_var(&b, frag_color, u_color);<br>
><br>
> -   /* Register with push constants (a single vec4) */<br>
> -   struct brw_reg clear_rgba;<br>
> +   struct brw_wm_prog_key wm_key;<br>
> +   brw_blorp_init_wm_prog_key(&wm_key);<br>
><br>
> -   /* MRF used for render target writes */<br>
> -   GLuint base_mrf;<br>
> -};<br>
> +   struct brw_blorp_prog_data prog_data;<br>
> +   brw_blorp_prog_data_init(&prog_data);<br>
><br>
> -brw_blorp_const_color_program::brw_blorp_const_color_program(<br>
> -      struct brw_context *brw,<br>
> -      const brw_blorp_const_color_prog_key *key)<br>
> -   : mem_ctx(ralloc_context(NULL)),<br>
> -     key(key),<br>
> -     R0(),<br>
> -     R1(),<br>
> -     clear_rgba(),<br>
> -     base_mrf(0)<br>
> -{<br>
> -   prog_data.first_curbe_grf_0 = 0;<br>
> -   prog_data.persample_msaa_dispatch = false;<br>
> -   brw_init_codegen(brw->intelScreen->devinfo, &func, mem_ctx);<br>
> -}<br>
> +   unsigned program_size;<br>
> +   const unsigned *program =<br>
> +      brw_blorp_compile_nir_shader(brw, b.shader, &wm_key, use_replicated_data,<br>
> +                                   &prog_data, &program_size);<br>
><br>
> -brw_blorp_const_color_program::~brw_blorp_const_color_program()<br>
> -{<br>
> -   ralloc_free(mem_ctx);<br>
> -}<br>
> -<br>
> -static void<br>
> -brw_blorp_params_get_clear_kernel(struct brw_context *brw,<br>
> -                                  struct brw_blorp_params *params,<br>
> -                                  bool use_replicated_data)<br>
> -{<br>
> -   struct brw_blorp_const_color_prog_key blorp_key;<br>
> -   memset(&blorp_key, 0, sizeof(blorp_key));<br>
> -   blorp_key.use_simd16_replicated_data = use_replicated_data;<br>
> +   brw_upload_cache(&brw->cache, BRW_CACHE_BLORP_PROG,<br>
> +                    &blorp_key, sizeof(blorp_key),<br>
> +                    program, program_size,<br>
> +                    &prog_data, sizeof(prog_data),<br>
> +                    &params->wm_prog_kernel, &params->wm_prog_data);<br>
><br>
> -   if (!brw_search_cache(&brw->cache, BRW_CACHE_BLORP_PROG,<br>
> -                         &blorp_key, sizeof(blorp_key),<br>
> -                         &params->wm_prog_kernel, &params->wm_prog_data)) {<br>
> -      brw_blorp_const_color_program prog(brw, &blorp_key);<br>
> -      GLuint program_size;<br>
> -      const GLuint *program = prog.compile(brw, &program_size);<br>
> -      brw_upload_cache(&brw->cache, BRW_CACHE_BLORP_PROG,<br>
> -                       &blorp_key, sizeof(blorp_key),<br>
> -                       program, program_size,<br>
> -                       &prog.prog_data, sizeof(prog.prog_data),<br>
> -                       &params->wm_prog_kernel, &params->wm_prog_data);<br>
> -   }<br>
> +   ralloc_free(mem_ctx);<br>
>  }<br>
><br>
>  static bool<br>
> @@ -142,91 +121,6 @@ set_write_disables(const struct intel_renderbuffer *irb,<br>
>     return disables;<br>
>  }<br>
><br>
> -void<br>
> -brw_blorp_const_color_program::alloc_regs()<br>
> -{<br>
> -   int reg = 0;<br>
> -   this->R0 = retype(brw_vec8_grf(reg++, 0), BRW_REGISTER_TYPE_UW);<br>
> -   this->R1 = retype(brw_vec8_grf(reg++, 0), BRW_REGISTER_TYPE_UW);<br>
> -<br>
> -   prog_data.first_curbe_grf_0 = reg;<br>
> -   clear_rgba = retype(brw_vec4_grf(reg++, 0), BRW_REGISTER_TYPE_F);<br>
> -   reg += BRW_BLORP_NUM_PUSH_CONST_REGS;<br>
> -<br>
> -   /* Make sure we didn't run out of registers */<br>
> -   assert(reg <= GEN7_MRF_HACK_START);<br>
> -<br>
> -   this->base_mrf = 2;<br>
> -}<br>
> -<br>
> -const GLuint *<br>
> -brw_blorp_const_color_program::compile(struct brw_context *brw,<br>
> -                                       GLuint *program_size)<br>
> -{<br>
> -   /* Set up prog_data */<br>
> -   brw_blorp_prog_data_init(&prog_data);<br>
> -   prog_data.persample_msaa_dispatch = false;<br>
> -<br>
> -   alloc_regs();<br>
> -<br>
> -   brw_set_default_compression_control(&func, BRW_COMPRESSION_COMPRESSED);<br>
> -<br>
> -   struct brw_reg mrf_rt_write =<br>
> -      retype(vec16(brw_message_reg(base_mrf)), BRW_REGISTER_TYPE_F);<br>
> -<br>
> -   uint32_t mlen, msg_type;<br>
> -   if (key->use_simd16_replicated_data) {<br>
> -      /* The message payload is a single register with the low 4 floats/ints<br>
> -       * filled with the constant clear color.<br>
> -       */<br>
> -      brw_set_default_exec_size(&func, BRW_EXECUTE_4);<br>
> -      brw_set_default_mask_control(&func, BRW_MASK_DISABLE);<br>
> -      brw_MOV(&func, vec4(brw_message_reg(base_mrf)), clear_rgba);<br>
> -      brw_set_default_mask_control(&func, BRW_MASK_ENABLE);<br>
> -      brw_set_default_exec_size(&func, BRW_EXECUTE_16);<br>
> -<br>
> -      msg_type = BRW_DATAPORT_RENDER_TARGET_WRITE_SIMD16_SINGLE_SOURCE_REPLICATED;<br>
> -      mlen = 1;<br>
> -   } else {<br>
> -      brw_set_default_exec_size(&func, BRW_EXECUTE_16);<br>
> -      for (int i = 0; i < 4; i++) {<br>
> -         /* The message payload is pairs of registers for 16 pixels each of r,<br>
> -          * g, b, and a.<br>
> -          */<br>
> -         brw_MOV(&func,<br>
> -                 brw_message_reg(base_mrf + i * 2),<br>
> -                 brw_vec1_grf(<a href="http://clear_rgba.nr" rel="noreferrer" target="_blank">clear_rgba.nr</a>, i));<br>
> -      }<br>
> -<br>
> -      msg_type = BRW_DATAPORT_RENDER_TARGET_WRITE_SIMD16_SINGLE_SOURCE;<br>
> -      mlen = 8;<br>
> -   }<br>
> -<br>
> -   /* Now write to the render target and terminate the thread */<br>
> -   brw_fb_WRITE(&func,<br>
> -                16 /* dispatch_width */,<br>
> -                base_mrf >= 0 ? brw_message_reg(base_mrf) : mrf_rt_write,<br>
> -                brw_null_reg() /* header */,<br>
> -                msg_type,<br>
> -                BRW_BLORP_RENDERBUFFER_BINDING_TABLE_INDEX,<br>
> -                mlen,<br>
> -                0 /* response_length */,<br>
> -                true /* eot */,<br>
> -                true /* last render target */,<br>
> -                false /* header present */);<br>
> -<br>
> -   if (unlikely(INTEL_DEBUG & DEBUG_BLORP)) {<br>
> -      fprintf(stderr, "Native code for BLORP clear:\n");<br>
> -      brw_disassemble(brw->intelScreen->devinfo,<br>
> -                      func.store, 0, func.next_insn_offset, stderr);<br>
> -      fprintf(stderr, "\n");<br>
> -   }<br>
> -<br>
> -   brw_compact_instructions(&func, 0, 0, NULL);<br>
> -   return brw_get_program(&func, program_size);<br>
> -}<br>
> -<br>
> -<br>
>  static bool<br>
>  do_single_blorp_clear(struct brw_context *brw, struct gl_framebuffer *fb,<br>
>                        struct gl_renderbuffer *rb, unsigned buf,<br>
> --<br>
> 2.5.0.400.gff86faf<br>
><br>
</div></div>> _______________________________________________<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/mailman/listinfo/mesa-dev</a><br>
</blockquote></div><br></div></div>