[Date Prev][Date Next] [Thread Prev][Thread Next] [Date Index] [Thread Index]

mesa: Changes to 'upstream-experimental'



Rebased ref, commits from common ancestor:
commit 6fc0cd2f52ddc4a1e7026c9c46fd6da3968fa439
Author: Gediminas Jakutis <gediminas@varciai.lt>
Date:   Sun Apr 12 02:58:33 2015 +0300

    gallium/hud: add more options to customize HUD panes
    
    Extends the syntax of GALLIUM_HUD environment variable to:
    - Add options to set the size and exact location of each pane.
    - Add an option to limit the maximum allowed value of the X axis on a
      pane, clamping the graph down to not go above this value.
    - Add an option to auto-adjust the value of the Y axis down to the
      highest value still visible on the graph.
    
    v2:
    - Make the patch simpler and smaller.
    - With dynamic auto-adjusting on, adjust the Y axis once per pane
      update instead of updating once every several seconds.
    - No longer mishandle pane height when having more than one graph per
      pane.

diff --git a/src/gallium/auxiliary/hud/hud_context.c b/src/gallium/auxiliary/hud/hud_context.c
index e46c68c..00ec205 100644
--- a/src/gallium/auxiliary/hud/hud_context.c
+++ b/src/gallium/auxiliary/hud/hud_context.c
@@ -569,9 +569,36 @@ hud_pane_set_max_value(struct hud_pane *pane, uint64_t value)
    pane->yscale = -(int)pane->inner_height / (float)pane->max_value;
 }
 
+static void
+hud_pane_update_dyn_ceiling(struct hud_graph *gr, struct hud_pane *pane)
+{
+   unsigned i;
+   float tmp = 0.0f;
+
+   if (pane->dyn_ceil_last_ran != gr->index) {
+      LIST_FOR_EACH_ENTRY(gr, &pane->graph_list, head) {
+         for (i = 0; i <  gr->num_vertices; ++i) {
+            tmp = gr->vertices[i * 2 + 1] > tmp ?
+                  gr->vertices[i * 2 + 1] : tmp;
+         }
+      }
+
+      /* Avoid setting it lower than the initial starting height. */
+      tmp = tmp > pane->initial_max_value ? tmp : pane->initial_max_value;
+      hud_pane_set_max_value(pane, tmp);
+   }
+
+   /*
+    * Mark this adjustment run so we could avoid repeating a full update
+    * again needlessly in case the pane has more than one graph.
+    */
+   pane->dyn_ceil_last_ran = gr->index;
+}
+
 static struct hud_pane *
 hud_pane_create(unsigned x1, unsigned y1, unsigned x2, unsigned y2,
-                unsigned period, uint64_t max_value)
+                unsigned period, uint64_t max_value, uint64_t ceiling,
+                boolean dyn_ceiling)
 {
    struct hud_pane *pane = CALLOC_STRUCT(hud_pane);
 
@@ -590,6 +617,10 @@ hud_pane_create(unsigned x1, unsigned y1, unsigned x2, unsigned y2,
    pane->inner_height = pane->inner_y2 - pane->inner_y1;
    pane->period = period;
    pane->max_num_vertices = (x2 - x1 + 2) / 2;
+   pane->ceiling = ceiling;
+   pane->dyn_ceiling = dyn_ceiling;
+   pane->dyn_ceil_last_ran = 0;
+   pane->initial_max_value = max_value;
    hud_pane_set_max_value(pane, max_value);
    LIST_INITHEAD(&pane->graph_list);
    return pane;
@@ -633,6 +664,9 @@ hud_pane_add_graph(struct hud_pane *pane, struct hud_graph *gr)
 void
 hud_graph_add_value(struct hud_graph *gr, uint64_t value)
 {
+   gr->current_value = value;
+   value = value > gr->pane->ceiling ? gr->pane->ceiling : value;
+
    if (gr->index == gr->pane->max_num_vertices) {
       gr->vertices[0] = 0;
       gr->vertices[1] = gr->vertices[(gr->index-1)*2+1];
@@ -646,7 +680,9 @@ hud_graph_add_value(struct hud_graph *gr, uint64_t value)
       gr->num_vertices++;
    }
 
-   gr->current_value = value;
+   if (gr->pane->dyn_ceiling == true) {
+      hud_pane_update_dyn_ceiling(gr, gr->pane);
+   }
    if (value > gr->pane->max_value) {
       hud_pane_set_max_value(gr->pane, value);
    }
@@ -683,6 +719,69 @@ parse_string(const char *s, char *out)
    return i;
 }
 
+static char *
+read_pane_settings(char *str, unsigned * const x, unsigned * const y,
+               unsigned * const width, unsigned * const height,
+               uint64_t * const ceiling, boolean * const dyn_ceiling)
+{
+   char *ret = str;
+   unsigned tmp;
+
+   while (*str == '.') {
+      ++str;
+      switch (*str) {
+      case 'x':
+         ++str;
+         *x = strtoul(str, &ret, 10);
+         str = ret;
+         break;
+
+      case 'y':
+         ++str;
+         *y = strtoul(str, &ret, 10);
+         str = ret;
+         break;
+
+      case 'w':
+         ++str;
+         tmp = strtoul(str, &ret, 10);
+         *width = tmp > 80 ? tmp : 80; /* 80 is chosen arbitrarily */
+         str = ret;
+         break;
+
+      /*
+       * Prevent setting height to less than 50. If the height is set to less,
+       * the text of the Y axis labels on the graph will start overlapping.
+       */
+      case 'h':
+         ++str;
+         tmp = strtoul(str, &ret, 10);
+         *height = tmp > 50 ? tmp : 50;
+         str = ret;
+         break;
+
+      case 'c':
+         ++str;
+         tmp = strtoul(str, &ret, 10);
+         *ceiling = tmp > 10 ? tmp : 10;
+         str = ret;
+         break;
+
+      case 'd':
+         ++str;
+         ret = str;
+         *dyn_ceiling = true;
+         break;
+
+      default:
+         fprintf(stderr, "gallium_hud: syntax error: unexpected '%c'\n", *str);
+      }
+
+   }
+
+   return ret;
+}
+
 static boolean
 has_occlusion_query(struct pipe_screen *screen)
 {
@@ -705,11 +804,15 @@ static void
 hud_parse_env_var(struct hud_context *hud, const char *env)
 {
    unsigned num, i;
-   char name[256], s[256];
+   char name_a[256], s[256];
+   char *name;
    struct hud_pane *pane = NULL;
    unsigned x = 10, y = 10;
    unsigned width = 251, height = 100;
    unsigned period = 500 * 1000;  /* default period (1/2 second) */
+   uint64_t ceiling = UINT64_MAX;
+   unsigned column_width = 251;
+   boolean dyn_ceiling = false;
    const char *period_env;
 
    /*
@@ -725,11 +828,23 @@ hud_parse_env_var(struct hud_context *hud, const char *env)
       }
    }
 
-   while ((num = parse_string(env, name)) != 0) {
+   while ((num = parse_string(env, name_a)) != 0) {
       env += num;
 
+      /* check for explicit location, size and etc. settings */
+      name = read_pane_settings(name_a, &x, &y, &width, &height, &ceiling,
+                         &dyn_ceiling);
+
+     /*
+      * Keep track of overall column width to avoid pane overlapping in case
+      * later we create a new column while the bottom pane in the current
+      * column is less wide than the rest of the panes in it.
+      */
+     column_width = width > column_width ? width : column_width;
+
       if (!pane) {
-         pane = hud_pane_create(x, y, x + width, y + height, period, 10);
+         pane = hud_pane_create(x, y, x + width, y + height, period, 10,
+                         ceiling, dyn_ceiling);
          if (!pane)
             return;
       }
@@ -807,6 +922,7 @@ hud_parse_env_var(struct hud_context *hud, const char *env)
 
          if (num && sscanf(s, "%u", &i) == 1) {
             hud_pane_set_max_value(pane, i);
+            pane->initial_max_value = i;
          }
          else {
             fprintf(stderr, "gallium_hud: syntax error: unexpected '%c' (%i) "
@@ -826,6 +942,7 @@ hud_parse_env_var(struct hud_context *hud, const char *env)
       case ',':
          env++;
          y += height + hud->font.glyph_height * (pane->num_graphs + 2);
+         height = 100;
 
          if (pane && pane->num_graphs) {
             LIST_ADDTAIL(&pane->head, &hud->pane_list);
@@ -836,17 +953,27 @@ hud_parse_env_var(struct hud_context *hud, const char *env)
       case ';':
          env++;
          y = 10;
-         x += width + hud->font.glyph_width * 7;
+         x += column_width + hud->font.glyph_width * 7;
+         height = 100;
 
          if (pane && pane->num_graphs) {
             LIST_ADDTAIL(&pane->head, &hud->pane_list);
             pane = NULL;
          }
+
+         /* Starting a new column; reset column width. */
+         column_width = 251;
          break;
 
       default:
          fprintf(stderr, "gallium_hud: syntax error: unexpected '%c'\n", *env);
       }
+
+      /* Reset to defaults for the next pane in case these were modified. */
+      width = 251;
+      ceiling = UINT64_MAX;
+      dyn_ceiling = false;
+
    }
 
    if (pane) {
@@ -878,6 +1005,30 @@ print_help(struct pipe_screen *screen)
    puts("");
    puts("  Example: GALLIUM_HUD=\"cpu,fps;primitives-generated\"");
    puts("");
+   puts("  Additionally, by prepending '.[identifier][value]' modifiers to");
+   puts("  a name, it is possible to explicitly set the location and size");
+   puts("  of a pane, along with limiting overall maximum value of the");
+   puts("  Y axis and activating dynamic readjustment of the Y axis.");
+   puts("  Several modifiers may be applied to the same pane simultaneously.");
+   puts("");
+   puts("  'x[value]' sets the location of the pane on the x axis relative");
+   puts("             to the upper-left corner of the viewport, in pixels.");
+   puts("  'y[value]' sets the location of the pane on the y axis relative");
+   puts("             to the upper-left corner of the viewport, in pixels.");
+   puts("  'w[value]' sets width of the graph pixels.");
+   puts("  'h[value]' sets height of the graph in pixels.");
+   puts("  'c[value]' sets the ceiling of the value of the Y axis.");
+   puts("             If the graph needs to draw values higher than");
+   puts("             the ceiling allows, the value is clamped.");
+   puts("  'd' activates dynamic Y axis readjustment to set the value of");
+   puts("      the Y axis to match the highest value still visible in the graph.");
+   puts("");
+   puts("  If 'c' and 'd' modifiers are used simultaneously, both are in effect:");
+   puts("  the Y axis does not go above the restriction imposed by 'c' while");
+   puts("  still adjusting the value of the Y axis down when appropriate.");
+   puts("");
+   puts("  Example: GALLIUM_HUD=\".w256.h64.x1600.y520.d.c1000fps+cpu,.datom-count\"");
+   puts("");
    puts("  Available names:");
    puts("    fps");
    puts("    cpu");
diff --git a/src/gallium/auxiliary/hud/hud_private.h b/src/gallium/auxiliary/hud/hud_private.h
index 1606ada..230f026 100644
--- a/src/gallium/auxiliary/hud/hud_private.h
+++ b/src/gallium/auxiliary/hud/hud_private.h
@@ -62,6 +62,10 @@ struct hud_pane {
    float yscale;
    unsigned max_num_vertices;
    uint64_t max_value;
+   uint64_t initial_max_value;
+   uint64_t ceiling;
+   unsigned dyn_ceil_last_ran;
+   boolean dyn_ceiling;
    boolean uses_byte_units;
    uint64_t period; /* in microseconds */
 

commit 30c8d8a831edcdbac0bbaccab18cf3b53dbd08c1
Author: Kenneth Graunke <kenneth@whitecape.org>
Date:   Thu Apr 23 23:17:10 2015 -0700

    i965: Fill out the rest of brw_debug_recompile_sampler_key().
    
    This makes INTEL_DEBUG=perf report shader recompiles due to CMS vs.
    UMS/IMS differences and Sandybridge textureGather workarounds.
    
    Previously, we just flagged them as "Something else".
    
    Signed-off-by: Kenneth Graunke <kenneth@whitecape.org>
    Reviewed-by: Topi Pohjolainen <topi.pohjolainen@intel.com>

diff --git a/src/mesa/drivers/dri/i965/brw_wm.c b/src/mesa/drivers/dri/i965/brw_wm.c
index 959f346..45a03bb 100644
--- a/src/mesa/drivers/dri/i965/brw_wm.c
+++ b/src/mesa/drivers/dri/i965/brw_wm.c
@@ -266,6 +266,14 @@ brw_debug_recompile_sampler_key(struct brw_context *brw,
                       old_key->gl_clamp_mask[2], key->gl_clamp_mask[2]);
    found |= key_debug(brw, "gather channel quirk on any texture unit",
                       old_key->gather_channel_quirk_mask, key->gather_channel_quirk_mask);
+   found |= key_debug(brw, "compressed multisample layout",
+                      old_key->compressed_multisample_layout_mask,
+                      key->compressed_multisample_layout_mask);
+
+   for (unsigned int i = 0; i < MAX_SAMPLERS; i++) {
+      found |= key_debug(brw, "textureGather workarounds",
+                         old_key->gen6_gather_wa[i], key->gen6_gather_wa[i]);
+   }
 
    return found;
 }

commit 19165e3b6eff3a33379af127d27c6585ffbd1028
Author: Kenneth Graunke <kenneth@whitecape.org>
Date:   Thu Apr 23 22:56:25 2015 -0700

    i965: Disassemble sampler message names on Gen5+.
    
    Previously, sampler messages were decoded as
    
    sampler (1, 0, 2, 2) mlen 6 rlen 8              { align1 1H };
    
    I don't know how much time we've collectly wasted trying to read this
    format.  I can never recall which number is the surface index, sampler
    index, message type, or...whatever that other number is.  Figuring out
    the message name from the numerical code is also painful.
    
    Now they decode as:
    
    sampler sample_l SIMD16 Surface = 1 Sampler = 0 mlen 6 rlen 8 { align1 1H };
    
    This is easy to read at a glance, and matches the format I used for
    render target formats.
    
    Signed-off-by: Kenneth Graunke <kenneth@whitecape.org>
    Reviewed-by: Matt Turner <mattst88@gmail.com>
    Reviewed-by: Chris Forbes <chrisf@ijw.co.nz>

diff --git a/src/mesa/drivers/dri/i965/brw_disasm.c b/src/mesa/drivers/dri/i965/brw_disasm.c
index d1078c0..95e262a 100644
--- a/src/mesa/drivers/dri/i965/brw_disasm.c
+++ b/src/mesa/drivers/dri/i965/brw_disasm.c
@@ -579,6 +579,34 @@ static const char *const urb_complete[2] = {
    [1] = "complete"
 };
 
+static const char *const gen5_sampler_msg_type[] = {
+   [GEN5_SAMPLER_MESSAGE_SAMPLE]              = "sample",
+   [GEN5_SAMPLER_MESSAGE_SAMPLE_BIAS]         = "sample_b",
+   [GEN5_SAMPLER_MESSAGE_SAMPLE_LOD]          = "sample_l",
+   [GEN5_SAMPLER_MESSAGE_SAMPLE_COMPARE]      = "sample_c",
+   [GEN5_SAMPLER_MESSAGE_SAMPLE_DERIVS]       = "sample_d",
+   [GEN5_SAMPLER_MESSAGE_SAMPLE_BIAS_COMPARE] = "sample_b_c",
+   [GEN5_SAMPLER_MESSAGE_SAMPLE_LOD_COMPARE]  = "sample_l_c",
+   [GEN5_SAMPLER_MESSAGE_SAMPLE_LD]           = "ld",
+   [GEN7_SAMPLER_MESSAGE_SAMPLE_GATHER4]      = "gather4",
+   [GEN5_SAMPLER_MESSAGE_LOD]                 = "lod",
+   [GEN5_SAMPLER_MESSAGE_SAMPLE_RESINFO]      = "resinfo",
+   [GEN7_SAMPLER_MESSAGE_SAMPLE_GATHER4_C]    = "gather4_c",
+   [GEN7_SAMPLER_MESSAGE_SAMPLE_GATHER4_PO]   = "gather4_po",
+   [GEN7_SAMPLER_MESSAGE_SAMPLE_GATHER4_PO_C] = "gather4_po_c",
+   [HSW_SAMPLER_MESSAGE_SAMPLE_DERIV_COMPARE] = "sample_d_c",
+   [GEN7_SAMPLER_MESSAGE_SAMPLE_LD_MCS]       = "ld_mcs",
+   [GEN7_SAMPLER_MESSAGE_SAMPLE_LD2DMS]       = "ld2dms",
+   [GEN7_SAMPLER_MESSAGE_SAMPLE_LD2DSS]       = "ld2dss",
+};
+
+static const char *const gen5_sampler_simd_mode[4] = {
+   [BRW_SAMPLER_SIMD_MODE_SIMD4X2]   = "SIMD4x2",
+   [BRW_SAMPLER_SIMD_MODE_SIMD8]     = "SIMD8",
+   [BRW_SAMPLER_SIMD_MODE_SIMD16]    = "SIMD16",
+   [BRW_SAMPLER_SIMD_MODE_SIMD32_64] = "SIMD32/64",
+};
+
 static const char *const sampler_target_format[4] = {
    [0] = "F",
    [2] = "UD",
@@ -1374,11 +1402,13 @@ brw_disassemble_inst(FILE *file, const struct brw_device_info *devinfo,
             break;
          case BRW_SFID_SAMPLER:
             if (devinfo->gen >= 5) {
-               format(file, " (%ld, %ld, %ld, %ld)",
+               err |= control(file, "sampler message", gen5_sampler_msg_type,
+                              brw_inst_sampler_msg_type(devinfo, inst), &space);
+               err |= control(file, "sampler simd mode", gen5_sampler_simd_mode,
+                              brw_inst_sampler_simd_mode(devinfo, inst), &space);
+               format(file, " Surface = %ld Sampler = %ld",
                       brw_inst_binding_table_index(devinfo, inst),
-                      brw_inst_sampler(devinfo, inst),
-                      brw_inst_sampler_msg_type(devinfo, inst),
-                      brw_inst_sampler_simd_mode(devinfo, inst));
+                      brw_inst_sampler(devinfo, inst));
             } else {
                format(file, " (%ld, %ld, %ld, ",
                       brw_inst_binding_table_index(devinfo, inst),

commit 7f5a8ac155283e78df2da5b172a65361a80d38b6
Author: Matt Turner <mattst88@gmail.com>
Date:   Sat Apr 25 01:50:04 2015 -0700

    i965/fs: Disallow constant propagation into POW on Gen 6.
    
    Fixes assertion failures in three piglit tests on Gen 6 since commit
    0087cf23e.

diff --git a/src/mesa/drivers/dri/i965/brw_fs_copy_propagation.cpp b/src/mesa/drivers/dri/i965/brw_fs_copy_propagation.cpp
index 9542d6a..c9ce2bd 100644
--- a/src/mesa/drivers/dri/i965/brw_fs_copy_propagation.cpp
+++ b/src/mesa/drivers/dri/i965/brw_fs_copy_propagation.cpp
@@ -506,9 +506,15 @@ fs_visitor::try_constant_propagate(fs_inst *inst, acp_entry *entry)
             break;
          /* fallthrough */
       case SHADER_OPCODE_POW:
-         /* Allow constant propagation into src1 regardless of generation, and
-          * let constant combining promote the constant on Gen < 8.
+         /* Allow constant propagation into src1 (except on Gen 6), and let
+          * constant combining promote the constant on Gen < 8.
+          *
+          * While Gen 6 MATH can take a scalar source, its source and
+          * destination offsets must be equal and we cannot ensure that.
           */
+         if (devinfo->gen == 6)
+            break;
+         /* fallthrough */
       case BRW_OPCODE_BFI1:
       case BRW_OPCODE_ASR:
       case BRW_OPCODE_SHL:

commit 67ba388dc06456409762e66ed7ccdffebf956459
Author: Ilia Mirkin <imirkin@alum.mit.edu>
Date:   Thu Apr 23 10:48:47 2015 -0400

    mesa: add support for exposing up to GL4.2
    
    Add the 4.0/4.1/4.2 extensions lists to compute_version. A couple of
    extensions aren't in mesa yet, so those are marked with 0 until they
    become supported.
    
    Signed-off-by: Ilia Mirkin <imirkin@alum.mit.edu>
    Reviewed-by: Matt Turner <mattst88@gmail.com>

diff --git a/src/mesa/main/version.c b/src/mesa/main/version.c
index 7c6d994..a65ace0 100644
--- a/src/mesa/main/version.c
+++ b/src/mesa/main/version.c
@@ -295,7 +295,51 @@ compute_version(const struct gl_extensions *extensions,
                               extensions->EXT_texture_swizzle);
                               /* ARB_sampler_objects is always enabled in mesa */
 
-   if (ver_3_3) {
+   const GLboolean ver_4_0 = (ver_3_3 &&
+                              consts->GLSLVersion >= 400 &&
+                              extensions->ARB_draw_buffers_blend &&
+                              extensions->ARB_draw_indirect &&
+                              extensions->ARB_gpu_shader5 &&
+                              extensions->ARB_gpu_shader_fp64 &&
+                              extensions->ARB_sample_shading &&
+                              0/*extensions->ARB_shader_subroutine*/ &&
+                              extensions->ARB_tessellation_shader &&
+                              extensions->ARB_texture_buffer_object_rgb32 &&
+                              extensions->ARB_texture_cube_map_array &&
+                              extensions->ARB_texture_query_lod &&
+                              extensions->ARB_transform_feedback2 &&
+                              extensions->ARB_transform_feedback3);
+   const GLboolean ver_4_1 = (ver_4_0 &&
+                              consts->GLSLVersion >= 410 &&
+                              extensions->ARB_ES2_compatibility &&
+                              extensions->ARB_shader_precision &&
+                              0/*extensions->ARB_vertex_attrib_64bit*/ &&
+                              extensions->ARB_viewport_array);
+   const GLboolean ver_4_2 = (ver_4_1 &&
+                              consts->GLSLVersion >= 420 &&
+                              extensions->ARB_base_instance &&
+                              extensions->ARB_conservative_depth &&
+                              extensions->ARB_internalformat_query &&
+                              extensions->ARB_shader_atomic_counters &&
+                              extensions->ARB_shader_image_load_store &&
+                              extensions->ARB_shading_language_420pack &&
+                              extensions->ARB_shading_language_packing &&
+                              extensions->ARB_texture_compression_bptc &&
+                              extensions->ARB_transform_feedback_instanced);
+
+   if (ver_4_2) {
+      major = 4;
+      minor = 2;
+   }
+   else if (ver_4_1) {
+      major = 4;
+      minor = 1;
+   }
+   else if (ver_4_0) {
+      major = 4;
+      minor = 0;
+   }
+   else if (ver_3_3) {
       major = 3;
       minor = 3;
    }

commit 11d2305d7fe2f8e8cd6a4f2ac5afe79718a4fa10
Author: Matt Turner <mattst88@gmail.com>
Date:   Fri Apr 24 16:23:46 2015 -0700

    i965/fs: Add missing pixel_x/y to brw_instruction_name().
    
    Forgotten in commit 529064f6.

diff --git a/src/mesa/drivers/dri/i965/brw_shader.cpp b/src/mesa/drivers/dri/i965/brw_shader.cpp
index 79f0e1c..0e94424 100644
--- a/src/mesa/drivers/dri/i965/brw_shader.cpp
+++ b/src/mesa/drivers/dri/i965/brw_shader.cpp
@@ -524,6 +524,11 @@ brw_instruction_name(enum opcode op)
    case FS_OPCODE_LINTERP:
       return "linterp";
 
+   case FS_OPCODE_PIXEL_X:
+      return "pixel_x";
+   case FS_OPCODE_PIXEL_Y:
+      return "pixel_y";
+
    case FS_OPCODE_UNIFORM_PULL_CONSTANT_LOAD:
       return "uniform_pull_const";
    case FS_OPCODE_UNIFORM_PULL_CONSTANT_LOAD_GEN7:

commit 51c61fff8f46472820ac413ad22e9f3edf670396
Author: Matt Turner <mattst88@gmail.com>
Date:   Fri Apr 24 13:14:56 2015 -0700

    i965/fs: Don't constant propagate into integer math instructions.
    
    Constant combining won't promote non-floats, so this isn't safe.
    
    Fixes regressions since commit 0087cf23e.

diff --git a/src/mesa/drivers/dri/i965/brw_fs_combine_constants.cpp b/src/mesa/drivers/dri/i965/brw_fs_combine_constants.cpp
index a5bacf4..aa62031 100644
--- a/src/mesa/drivers/dri/i965/brw_fs_combine_constants.cpp
+++ b/src/mesa/drivers/dri/i965/brw_fs_combine_constants.cpp
@@ -66,8 +66,6 @@ must_promote_imm(const struct brw_device_info *devinfo, const fs_inst *inst)
 {
    switch (inst->opcode) {
    case SHADER_OPCODE_POW:
-   case SHADER_OPCODE_INT_QUOTIENT:
-   case SHADER_OPCODE_INT_REMAINDER:
       return devinfo->gen < 8;
    case BRW_OPCODE_MAD:
    case BRW_OPCODE_LRP:
diff --git a/src/mesa/drivers/dri/i965/brw_fs_copy_propagation.cpp b/src/mesa/drivers/dri/i965/brw_fs_copy_propagation.cpp
index af54deb..9542d6a 100644
--- a/src/mesa/drivers/dri/i965/brw_fs_copy_propagation.cpp
+++ b/src/mesa/drivers/dri/i965/brw_fs_copy_propagation.cpp
@@ -499,9 +499,13 @@ fs_visitor::try_constant_propagate(fs_inst *inst, acp_entry *entry)
          progress = true;
          break;
 
-      case SHADER_OPCODE_POW:
       case SHADER_OPCODE_INT_QUOTIENT:
       case SHADER_OPCODE_INT_REMAINDER:
+         /* FINISHME: Promote non-float constants and remove this. */
+         if (devinfo->gen < 8)
+            break;
+         /* fallthrough */
+      case SHADER_OPCODE_POW:
          /* Allow constant propagation into src1 regardless of generation, and
           * let constant combining promote the constant on Gen < 8.
           */

commit e17018589651d449bbef5f98a6c2f65cc3ca70e5
Author: Emil Velikov <emil.l.velikov@gmail.com>
Date:   Fri Apr 24 22:58:23 2015 +0100

    docs: add news item and link release notes for mesa 10.5.4
    
    Signed-off-by: Emil Velikov <emil.l.velikov@gmail.com>

diff --git a/docs/index.html b/docs/index.html
index 9e4644c..c642604 100644
--- a/docs/index.html
+++ b/docs/index.html
@@ -16,6 +16,12 @@
 
 <h1>News</h1>
 
+<h2>April 24, 2015</h2>
+<p>
+<a href="relnotes/10.5.4.html">Mesa 10.5.4</a> is released.
+This is a bug-fix release.
+</p>
+
 <h2>April 12, 2015</h2>
 <p>
 <a href="relnotes/10.5.3.html">Mesa 10.5.3</a> is released.
diff --git a/docs/relnotes.html b/docs/relnotes.html
index 6ec35d1..7f2e1d8 100644
--- a/docs/relnotes.html
+++ b/docs/relnotes.html
@@ -21,6 +21,7 @@ The release notes summarize what's new or changed in each Mesa release.
 </p>
 
 <ul>
+<li><a href="relnotes/10.5.4.html">10.5.4 release notes</a>
 <li><a href="relnotes/10.5.3.html">10.5.3 release notes</a>
 <li><a href="relnotes/10.5.2.html">10.5.2 release notes</a>
 <li><a href="relnotes/10.4.7.html">10.4.7 release notes</a>

commit 196cf8db6571b8cf7e44a4cf9d7e827e130a568d
Author: Emil Velikov <emil.l.velikov@gmail.com>
Date:   Fri Apr 24 22:51:25 2015 +0100

    docs: Add sha256 sums for the 10.5.4 release
    
    Signed-off-by: Emil Velikov <emil.l.velikov@gmail.com>
    (cherry picked from commit adb47b5b279b6fd920151aa7926af6ffd2069339)

diff --git a/docs/relnotes/10.5.4.html b/docs/relnotes/10.5.4.html
index 78767cc..4c466d0 100644
--- a/docs/relnotes/10.5.4.html
+++ b/docs/relnotes/10.5.4.html
@@ -31,7 +31,8 @@ because compatibility contexts are not supported.
 
 <h2>SHA256 checksums</h2>
 <pre>
-TBD
+e1089567fc7bf8d9b2d8badcc9f2fc3b758701c8c0ccfe7af1805549fea53f11  mesa-10.5.4.tar.gz
+b51e723f3a20d842c88a92d809435b229fc4744ca0dbec0317d9d4a3ac4c6803  mesa-10.5.4.tar.xz
 </pre>
 
 

commit 5b39cb47366d1cfce206d4644983a4e5b2b76709
Author: Emil Velikov <emil.l.velikov@gmail.com>
Date:   Fri Apr 24 22:27:09 2015 +0100

    Add release notes for the 10.5.4 release
    
    Signed-off-by: Emil Velikov <emil.l.velikov@gmail.com>
    (cherry picked from commit ea0d1f575c214c09ba3df12644a960e86e031766)

diff --git a/docs/relnotes/10.5.4.html b/docs/relnotes/10.5.4.html
new file mode 100644
index 0000000..78767cc
--- /dev/null
+++ b/docs/relnotes/10.5.4.html
@@ -0,0 +1,124 @@
+<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd";>
+<html lang="en">
+<head>
+  <meta http-equiv="content-type" content="text/html; charset=utf-8">
+  <title>Mesa Release Notes</title>
+  <link rel="stylesheet" type="text/css" href="../mesa.css">
+</head>
+<body>
+
+<div class="header">
+  <h1>The Mesa 3D Graphics Library</h1>
+</div>
+
+<iframe src="../contents.html"></iframe>
+<div class="content">
+
+<h1>Mesa 10.5.4 Release Notes / April 24, 2015</h1>
+
+<p>
+Mesa 10.5.4 is a bug fix release which fixes bugs found since the 10.5.3 release.
+</p>
+<p>
+Mesa 10.5.4 implements the OpenGL 3.3 API, but the version reported by
+glGetString(GL_VERSION) or glGetIntegerv(GL_MAJOR_VERSION) /
+glGetIntegerv(GL_MINOR_VERSION) depends on the particular driver being used.
+Some drivers don't support all the features required in OpenGL 3.3.  OpenGL
+3.3 is <strong>only</strong> available if requested at context creation
+because compatibility contexts are not supported.
+</p>
+
+
+<h2>SHA256 checksums</h2>
+<pre>
+TBD
+</pre>
+
+
+<h2>New features</h2>
+<p>None</p>
+
+<h2>Bug fixes</h2>
+
+<p>This list is likely incomplete.</p>
+
+<ul>
+
+<li><a href="https://bugs.freedesktop.org/show_bug.cgi?id=69226";>Bug 69226</a> - Cannot enable basic shaders with Second Life aborts attempt</li>
+
+<li><a href="https://bugs.freedesktop.org/show_bug.cgi?id=71591";>Bug 71591</a> - Second Life shaders fail to compile (extension declared in middle of shader)</li>
+
+<li><a href="https://bugs.freedesktop.org/show_bug.cgi?id=81025";>Bug 81025</a> - [IVB/BYT Bisected]Piglit spec_ARB_draw_indirect_arb_draw_indirect-draw-elements-prim-restart-ugly fails</li>
+
+<li><a href="https://bugs.freedesktop.org/show_bug.cgi?id=89457";>Bug 89457</a> - [BSW Bisected]ogles3conform ES3-CTS.gtf.GL3Tests.shadow.shadow_execution_vert fails</li>
+
+<li><a href="https://bugs.freedesktop.org/show_bug.cgi?id=89957";>Bug 89957</a> - vm protection faults in piglit lest: texsubimage cube_map_array pbo</li>
+
+</ul>
+
+
+<h2>Changes</h2>
+
+<p>Brian Paul (1):</p>
+<ul>
+  <li>glsl: rewrite glsl_type::record_key_hash() to avoid buffer overflow</li>
+</ul>
+
+<p>Dave Airlie (2):</p>
+<ul>
+  <li>st/mesa: convert sub image for cube map arrays to 2d arrays for upload</li>
+  <li>st/mesa: align cube map arrays layers</li>
+</ul>
+
+<p>Emil Velikov (11):</p>
+<ul>
+  <li>docs: Add 256 sums for the 10.5.3 release</li>
+  <li>radeonsi: remove unused si_dump_key()</li>
+  <li>android: use LOCAL_SHARED_LIBRARIES over TARGET_OUT_HEADERS</li>
+  <li>android: add $(mesa_top)/src include to the whole of mesa</li>
+  <li>android: egl: add libsync_cflags to the build</li>
+  <li>android: dri/common: conditionally include drm_cflags/set __NOT_HAVE_DRM_H</li>
+  <li>android: add HAVE__BUILTIN_* and HAVE_FUNC_ATTRIBUTE_* defines</li>
+  <li>android: add $(mesa_top)/src/mesa/main to the includes list</li>
+  <li>android: dri: link against libmesa_util</li>
+  <li>android: mesa: fix the path of the SSE4_1 optimisations</li>
+  <li>Update version to 10.5.4</li>
+</ul>
+
+<p>Ian Romanick (1):</p>
+<ul>
+  <li>nir: Fix typo in "ushr by 0" algebraic replacement</li>
+</ul>
+
+<p>Kenneth Graunke (2):</p>
+<ul>
+  <li>i965: Fix software primitive restart with indirect draws.</li>
+  <li>drirc: Add "Second Life" quirk (allow_glsl_extension_directive_midshader).</li>
+</ul>
+
+<p>Kristian Høgsberg (1):</p>
+<ul>
+  <li>i965: Rewrite ir_tex to ir_txl with lod 0 for vertex shaders</li>
+</ul>
+
+<p>Marek Olšák (2):</p>
+<ul>
+  <li>glsl_to_tgsi: fix out-of-bounds constant access and crash for uniforms</li>
+  <li>glsl_to_tgsi: don't use a potentially-undefined immediate for ir_query_levels</li>
+</ul>
+
+<p>Mathias Froehlich (1):</p>
+<ul>
+  <li>i965: Flush batchbuffer containing the query on glQueryCounter.</li>
+</ul>
+
+<p>Mauro Rossi (2):</p>
+<ul>
+  <li>android: mesa: generate the format_{un,}pack.[ch] sources</li>
+  <li>android: add inital NIR build</li>
+</ul>
+
+
+</div>
+</body>
+</html>

commit 13b2e6a520d1f8979fc4da1dd2c6811585b16203
Author: Brian Paul <brianp@vmware.com>
Date:   Fri Apr 24 12:56:04 2015 -0600

    mesa: put more info in glTexImage GL_OUT_OF_MEMORY error message
    
    Give the user some idea about the size of the texture which caused
    the GL_OUT_OF_MEMORY error.
    
    Reviewed-by: Matt Turner <mattst88@gmail.com>

diff --git a/src/mesa/main/teximage.c b/src/mesa/main/teximage.c
index d07263c..7bc1da7 100644
--- a/src/mesa/main/teximage.c
+++ b/src/mesa/main/teximage.c
@@ -3320,7 +3320,9 @@ teximage(struct gl_context *ctx, GLboolean compressed, GLuint dims,
 
       if (!sizeOK) {
          _mesa_error(ctx, GL_OUT_OF_MEMORY,
-                     "glTexImage%uD(image too large)", dims);
+                     "glTexImage%uD(image too large: %d x %d x %d, %s format)",
+                     dims, width, height, depth,
+                     _mesa_lookup_enum_by_nr(internalFormat));
          return;
       }
 

commit 0087cf23e8e399778e93369d67dd543e767ab526
Author: Matt Turner <mattst88@gmail.com>
Date:   Mon Mar 16 17:53:34 2015 -0700

    i965/fs: Allow 2-src math instructions to have immediate src1.
    
    Reviewed-by: Kenneth Graunke <kenneth@whitecape.org>

diff --git a/src/mesa/drivers/dri/i965/brw_fs_combine_constants.cpp b/src/mesa/drivers/dri/i965/brw_fs_combine_constants.cpp
index a51b726..a5bacf4 100644
--- a/src/mesa/drivers/dri/i965/brw_fs_combine_constants.cpp
+++ b/src/mesa/drivers/dri/i965/brw_fs_combine_constants.cpp
@@ -62,9 +62,13 @@ could_coissue(const struct brw_device_info *devinfo, const fs_inst *inst)
  * Returns true for instructions that don't support immediate sources.
  */
 static bool
-must_promote_imm(const fs_inst *inst)
+must_promote_imm(const struct brw_device_info *devinfo, const fs_inst *inst)
 {
    switch (inst->opcode) {
+   case SHADER_OPCODE_POW:
+   case SHADER_OPCODE_INT_QUOTIENT:
+   case SHADER_OPCODE_INT_REMAINDER:
+      return devinfo->gen < 8;
    case BRW_OPCODE_MAD:
    case BRW_OPCODE_LRP:
       return true;
@@ -207,7 +211,7 @@ fs_visitor::opt_combine_constants()
    foreach_block_and_inst(block, fs_inst, inst, cfg) {
       ip++;
 
-      if (!could_coissue(devinfo, inst) && !must_promote_imm(inst))
+      if (!could_coissue(devinfo, inst) && !must_promote_imm(devinfo, inst))
          continue;
 
       for (int i = 0; i < inst->sources; i++) {
@@ -225,7 +229,7 @@ fs_visitor::opt_combine_constants()
             imm->block = intersection;
             imm->uses->push_tail(link(const_ctx, &inst->src[i]));
             imm->uses_by_coissue += could_coissue(devinfo, inst);
-            imm->must_promote = imm->must_promote || must_promote_imm(inst);
+            imm->must_promote = imm->must_promote || must_promote_imm(devinfo, inst);
             imm->last_use_ip = ip;
          } else {
             imm = new_imm(&table, const_ctx);
@@ -235,7 +239,7 @@ fs_visitor::opt_combine_constants()
             imm->uses->push_tail(link(const_ctx, &inst->src[i]));
             imm->val = val;
             imm->uses_by_coissue = could_coissue(devinfo, inst);
-            imm->must_promote = must_promote_imm(inst);
+            imm->must_promote = must_promote_imm(devinfo, inst);
             imm->first_use_ip = ip;
             imm->last_use_ip = ip;
          }
diff --git a/src/mesa/drivers/dri/i965/brw_fs_copy_propagation.cpp b/src/mesa/drivers/dri/i965/brw_fs_copy_propagation.cpp
index 6b6565f..af54deb 100644
--- a/src/mesa/drivers/dri/i965/brw_fs_copy_propagation.cpp
+++ b/src/mesa/drivers/dri/i965/brw_fs_copy_propagation.cpp
@@ -502,9 +502,9 @@ fs_visitor::try_constant_propagate(fs_inst *inst, acp_entry *entry)
       case SHADER_OPCODE_POW:
       case SHADER_OPCODE_INT_QUOTIENT:
       case SHADER_OPCODE_INT_REMAINDER:
-         if (devinfo->gen < 8)
-            break;
-         /* fallthrough */
+         /* Allow constant propagation into src1 regardless of generation, and
+          * let constant combining promote the constant on Gen < 8.
+          */
       case BRW_OPCODE_BFI1:
       case BRW_OPCODE_ASR:
       case BRW_OPCODE_SHL:

commit f251ea393bf3d01d242e2eb56cd0f2b0e140f7b2
Author: Matt Turner <mattst88@gmail.com>
Date:   Fri Apr 24 11:37:30 2015 -0700

    nir: Transform pow(x, 4) into (x*x)*(x*x).

diff --git a/src/glsl/nir/nir_opt_algebraic.py b/src/glsl/nir/nir_opt_algebraic.py
index cdb1924..2a2b956 100644
--- a/src/glsl/nir/nir_opt_algebraic.py
+++ b/src/glsl/nir/nir_opt_algebraic.py
@@ -144,6 +144,7 @@ optimizations = [
    (('fexp',  ('fmul', ('flog', a), b)),  ('fpow', a, b), '!options->lower_fpow'), # e^(ln(a)*b) = a^b
    (('fpow', a, 1.0), a),
    (('fpow', a, 2.0), ('fmul', a, a)),
+   (('fpow', a, 4.0), ('fmul', ('fmul', a, a), ('fmul', a, a))),
    (('fpow', 2.0, a), ('fexp2', a)),
    (('fsqrt', ('fexp2', a)), ('fexp2', ('fmul', 0.5, a))),
    (('fsqrt', ('fexp', a)), ('fexp', ('fmul', 0.5, a))),

commit 9b577d57029bb643f2b48b80648b4f901818e93b
Author: Matt Turner <mattst88@gmail.com>
Date:   Mon Mar 16 21:33:31 2015 -0700

    glsl: Transform pow(x, 4) into (x*x)*(x*x).
    
    Reviewed-by: Juha-Pekka Heikkila <juhapekka.heikkila@gmail.com>
    Reviewed-by: Kenneth Graunke <kenneth@whitecape.org>

diff --git a/src/glsl/opt_algebraic.cpp b/src/glsl/opt_algebraic.cpp
index 3d2f2ca..fa5db70 100644
--- a/src/glsl/opt_algebraic.cpp
+++ b/src/glsl/opt_algebraic.cpp
@@ -99,6 +99,12 @@ is_vec_two(ir_constant *ir)
 }
 
 static inline bool
+is_vec_four(ir_constant *ir)
+{
+   return (ir == NULL) ? false : ir->is_value(4.0, 4);
+}
+
+static inline bool
 is_vec_negative_one(ir_constant *ir)
 {
    return (ir == NULL) ? false : ir->is_negative_one();
@@ -774,6 +780,20 @@ ir_algebraic_visitor::handle_expression(ir_expression *ir)
          return mul(x, x);
       }
 
+      if (is_vec_four(op_const[1])) {
+         ir_variable *x = new(ir) ir_variable(ir->operands[1]->type, "x",
+                                              ir_var_temporary);
+         base_ir->insert_before(x);
+         base_ir->insert_before(assign(x, ir->operands[0]));
+
+         ir_variable *squared = new(ir) ir_variable(ir->operands[1]->type,
+                                                    "squared",
+                                                    ir_var_temporary);
+         base_ir->insert_before(squared);
+         base_ir->insert_before(assign(squared, mul(x, x)));
+         return mul(squared, squared);
+      }
+
       break;
 
    case ir_binop_min:

commit 18f44d303014c3c16084c1b15d1999833e0d55db
Author: Tapani Pälli <tapani.palli@intel.com>
Date:   Thu Apr 23 14:19:33 2015 +0300

    mesa: fix glGetActiveUniformsiv regression
    
    Commit 7519ddb caused regression to glGetActiveUniformsiv.
    Patch adds back validation loop of all given uniforms before
    writing any values, not touching params in case of errors
    is tested by the conformance suite.
    
    Signed-off-by: Tapani Pälli <tapani.palli@intel.com>
    Bugzilla: https://bugs.freedesktop.org/show_bug.cgi?id=90149
    Reviewed-by: Martin Peres <martin.peres@linux.intel.com>

diff --git a/src/mesa/main/uniform_query.cpp b/src/mesa/main/uniform_query.cpp
index 4e77b32..3e857ed 100644
--- a/src/mesa/main/uniform_query.cpp
+++ b/src/mesa/main/uniform_query.cpp
@@ -129,14 +129,26 @@ _mesa_GetActiveUniformsiv(GLuint program,
 
    res_prop = resource_prop_from_uniform_prop(pname);
 
+   /* We need to first verify that each entry exists as active uniform. If
+    * not, generate error and do not cause any other side effects.
+    *
+    * In the case of and error condition, Page 16 (section 2.3.1 Errors)
+    * of the OpenGL 4.5 spec says:
+    *
+    *     "If the generating command modifies values through a pointer argu-
+    *     ment, no change is made to these values."
+    */
    for (int i = 0; i < uniformCount; i++) {
-      res = _mesa_program_resource_find_index(shProg, GL_UNIFORM,
-                                              uniformIndices[i]);
-      if (!res) {
+      if (!_mesa_program_resource_find_index(shProg, GL_UNIFORM,
+                                              uniformIndices[i])) {
          _mesa_error(ctx, GL_INVALID_VALUE, "glGetActiveUniformsiv(index)");
-         break;
+         return;
       }
+   }


Reply to: