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

mesa: Changes to 'upstream-experimental'



 VERSION                                                       |    2 
 bin/.cherry-ignore                                            |    2 
 src/gallium/auxiliary/vl/vl_video_buffer.c                    |    2 
 src/gallium/drivers/nouveau/codegen/nv50_ir_bb.cpp            |    2 
 src/gallium/drivers/nouveau/codegen/nv50_ir_from_tgsi.cpp     |    6 
 src/gallium/drivers/nouveau/codegen/nv50_ir_lowering_nv50.cpp |    2 
 src/gallium/drivers/nouveau/codegen/nv50_ir_peephole.cpp      |   40 +++
 src/gallium/drivers/nouveau/codegen/nv50_ir_target_nv50.cpp   |    2 
 src/gallium/drivers/nouveau/codegen/nv50_ir_target_nvc0.cpp   |    2 
 src/gallium/drivers/r600/r600_pipe.h                          |    2 
 src/gallium/drivers/r600/r600_shader.c                        |    5 
 src/gallium/drivers/r600/r600_state.c                         |   29 ++
 src/gallium/drivers/r600/r600_state_common.c                  |   18 +
 src/gallium/drivers/r600/r600d.h                              |    1 
 src/gallium/drivers/radeon/r600_pipe_common.c                 |    3 
 src/gallium/drivers/radeon/radeon_setup_tgsi_llvm.c           |    2 
 src/gallium/state_trackers/clover/core/platform.cpp           |    3 
 src/gallium/targets/opencl/Makefile.am                        |    2 
 src/glsl/glsl_parser_extras.cpp                               |    2 
 src/glsl/standalone_scaffolding.cpp                           |    2 
 src/glsl/standalone_scaffolding.h                             |    2 
 src/mapi/glapi/gen/KHR_debug.xml                              |   25 +-
 src/mesa/drivers/dri/i965/Makefile.am                         |    3 
 src/mesa/drivers/dri/i965/brw_inst.h                          |    4 
 src/mesa/drivers/dri/i965/brw_wm_surface_state.c              |    4 
 src/mesa/main/context.c                                       |    3 
 src/mesa/main/errors.c                                        |  110 ++++++----
 src/mesa/main/errors.h                                        |    2 
 src/mesa/main/extensions_table.h                              |    2 
 src/mesa/main/get_hash_params.py                              |    4 
 src/mesa/main/mtypes.h                                        |    3 
 src/mesa/main/tests/dispatch_sanity.cpp                       |    5 
 src/mesa/main/version.c                                       |    1 
 33 files changed, 213 insertions(+), 84 deletions(-)

New commits:
commit 20db46c227fad1ccc23287d3c008d0ca24b49d5a
Author: Emil Velikov <emil.velikov@collabora.com>
Date:   Mon Dec 7 13:50:15 2015 +0000

    Update version to 11.1.0-rc3
    
    Signed-off-by: Emil Velikov <emil.velikov@collabora.com>

diff --git a/VERSION b/VERSION
index 2fdb3a1..c575419 100644
--- a/VERSION
+++ b/VERSION
@@ -1 +1 @@
-11.1.0-rc2
+11.1.0-rc3

commit b2a5efb56f612123fbaf9a10e63abf712e397807
Author: Michel Dänzer <michel.daenzer@amd.com>
Date:   Thu Nov 19 11:30:21 2015 +0900

    radeon/llvm: Use llvm.AMDIL.exp intrinsic again for now
    
    llvm.exp2.f32 doesn't work in some cases yet.
    
    Bugzilla: https://bugs.freedesktop.org/show_bug.cgi?id=92709
    
    Reviewed-by: Nicolai Hähnle <nicolai.haehnle@amd.com>
    (cherry picked from commit d09463193608009fa42e046b1fc144435d3533f6)

diff --git a/src/gallium/drivers/radeon/radeon_setup_tgsi_llvm.c b/src/gallium/drivers/radeon/radeon_setup_tgsi_llvm.c
index ac99e73..c94f109 100644
--- a/src/gallium/drivers/radeon/radeon_setup_tgsi_llvm.c
+++ b/src/gallium/drivers/radeon/radeon_setup_tgsi_llvm.c
@@ -1539,7 +1539,7 @@ void radeon_llvm_context_init(struct radeon_llvm_context * ctx)
 	bld_base->op_actions[TGSI_OPCODE_ENDIF].emit = endif_emit;
 	bld_base->op_actions[TGSI_OPCODE_ENDLOOP].emit = endloop_emit;
 	bld_base->op_actions[TGSI_OPCODE_EX2].emit = build_tgsi_intrinsic_nomem;
-	bld_base->op_actions[TGSI_OPCODE_EX2].intr_name = "llvm.exp2.f32";
+	bld_base->op_actions[TGSI_OPCODE_EX2].intr_name = "llvm.AMDIL.exp.";
 	bld_base->op_actions[TGSI_OPCODE_FLR].emit = build_tgsi_intrinsic_nomem;
 	bld_base->op_actions[TGSI_OPCODE_FLR].intr_name = "llvm.floor.f32";
 	bld_base->op_actions[TGSI_OPCODE_FMA].emit = build_tgsi_intrinsic_nomem;

commit 38c645b60a49899e58edce4a2b47ed19b25c3b08
Author: Connor Abbott <connor.w.abbott@intel.com>
Date:   Mon Aug 3 14:38:12 2015 -0700

    i965: fix 64-bit immediates in brw_inst(_set)_bits
    
    If we tried to get/set something that was exactly 64 bits, we would
    try to do (1 << 64) - 1 to calculate the mask which doesn't give us all
    1's like we want.
    
    v2 (Iago)
     - Replace ~0 by ~0ull
     - Removed unnecessary parenthesis
    
    v3 (Kristian)
     - Avoid the conditional
    
    Reviewed-by: Iago Toral Quiroga <itoral@igalia.com>
    Reviewed-by: Matt Turner <mattst88@gmail.com>
    Reviewed-by: Kristian Høgsberg <krh@bitplanet.net>
    (cherry picked from commit b1a83b5d1b677faf650a41cd2c152b4d1cd18f84)
    
    Squashed with commit
    
    i965: Use ull immediates in brw_inst_bits
    
    This fixes a regression introduced in b1a83b5d1 that caused basically all
    shaders to fail to compile on 32-bit platforms.
    
    Reported-by: Mark Janes <mark.a.janes@intel.com>
    Reviewed-by: Matt Turner <mattst88@gmail.com>
    (cherry picked from commit 9d703de85a7bdd6ae767aedd7690cb82794cb90a)
    Nominated-by: Ian Romanick <ian.d.romanick@intel.com>

diff --git a/src/mesa/drivers/dri/i965/brw_inst.h b/src/mesa/drivers/dri/i965/brw_inst.h
index 4ed95c4..cd9f6ef 100644
--- a/src/mesa/drivers/dri/i965/brw_inst.h
+++ b/src/mesa/drivers/dri/i965/brw_inst.h
@@ -694,7 +694,7 @@ brw_inst_bits(const brw_inst *inst, unsigned high, unsigned low)
    high %= 64;
    low %= 64;
 
-   const uint64_t mask = (1ull << (high - low + 1)) - 1;
+   const uint64_t mask = (~0ull >> (64 - (high - low + 1)));
 
    return (inst->data[word] >> low) & mask;
 }
@@ -713,7 +713,7 @@ brw_inst_set_bits(brw_inst *inst, unsigned high, unsigned low, uint64_t value)
    high %= 64;
    low %= 64;
 
-   const uint64_t mask = ((1ull << (high - low + 1)) - 1) << low;
+   const uint64_t mask = (~0ull >> (64 - (high - low + 1))) << low;
 
    /* Make sure the supplied value actually fits in the given bitfield. */
    assert((value & (mask >> low)) == value);

commit 2dff4c6fa76acf3c415ee406faa1005f301b09fb
Author: Emil Velikov <emil.l.velikov@gmail.com>
Date:   Thu Nov 26 00:36:17 2015 +0000

    mesa: rework the meaning of gl_debug_message::length
    
    Currently it stores strlen(buf) whenever the user originally provided a
    negative value for length.
    
    Although I've not seen any explicit text in the spec, CTS requires that
    the very same length (be that negative value or not) is returned back on
    Pop.
    
    So let's push down the length < 0 checks, tweak the meaning of
    gl_debug_message::length and fix GetDebugMessageLog to add and count the
    null terminators, as required by the spec.
    
    v2: return correct total length in GetDebugMessageLog
    v3: rebase (drop _mesa_shader_debug hunk).
    
    Signed-off-by: Emil Velikov <emil.l.velikov@gmail.com>
    Reviewed-by: Timothy Arceri <timothy.arceri@collabora.com>
    (cherry picked from commit 5a23f6bd8d8d26e0e75801df44cc228f15f9768e)

diff --git a/src/mesa/main/errors.c b/src/mesa/main/errors.c
index a6294e3..9e66109 100644
--- a/src/mesa/main/errors.c
+++ b/src/mesa/main/errors.c
@@ -76,6 +76,8 @@ struct gl_debug_message
    enum mesa_debug_type type;
    GLuint id;
    enum mesa_debug_severity severity;
+   /* length as given by the user - if message was explicitly null terminated,
+    * length can be negative */
    GLsizei length;
    GLcharARB *message;
 };
@@ -211,14 +213,19 @@ debug_message_store(struct gl_debug_message *msg,
                     enum mesa_debug_severity severity,
                     GLsizei len, const char *buf)
 {
+   GLsizei length = len;
+
    assert(!msg->message && !msg->length);
 
-   msg->message = malloc(len+1);
+   if (length < 0)
+      length = strlen(buf);
+
+   msg->message = malloc(length+1);
    if (msg->message) {
-      (void) strncpy(msg->message, buf, (size_t)len);
-      msg->message[len] = '\0';
+      (void) strncpy(msg->message, buf, (size_t)length);
+      msg->message[length] = '\0';
 
-      msg->length = len+1;
+      msg->length = len;
       msg->source = source;
       msg->type = type;
       msg->id = id;
@@ -229,7 +236,7 @@ debug_message_store(struct gl_debug_message *msg,
 
       /* malloc failed! */
       msg->message = out_of_memory;
-      msg->length = strlen(out_of_memory)+1;
+      msg->length = -1;
       msg->source = MESA_DEBUG_SOURCE_OTHER;
       msg->type = MESA_DEBUG_TYPE_ERROR;
       msg->id = oom_msg_id;
@@ -607,7 +614,7 @@ debug_log_message(struct gl_debug_state *debug,
    GLint nextEmpty;
    struct gl_debug_message *emptySlot;
 
-   assert(len >= 0 && len < MAX_DEBUG_MESSAGE_LENGTH);
+   assert(len < MAX_DEBUG_MESSAGE_LENGTH);
 
    if (log->NumMessages == MAX_DEBUG_LOGGED_MESSAGES)
       return;
@@ -1004,8 +1011,6 @@ _mesa_DebugMessageInsert(GLenum source, GLenum type, GLuint id,
    if (!validate_params(ctx, INSERT, callerstr, source, type, severity))
       return; /* GL_INVALID_ENUM */
 
-   if (length < 0)
-      length = strlen(buf);
    if (!validate_length(ctx, callerstr, length, buf))
       return; /* GL_INVALID_VALUE */
 
@@ -1047,23 +1052,28 @@ _mesa_GetDebugMessageLog(GLuint count, GLsizei logSize, GLenum *sources,
 
    for (ret = 0; ret < count; ret++) {
       const struct gl_debug_message *msg = debug_fetch_message(debug);
+      GLsizei len;
 
       if (!msg)
          break;
 
-      if (logSize < msg->length && messageLog != NULL)
+      len = msg->length;
+      if (len < 0)
+         len = strlen(msg->message);
+
+      if (logSize < len+1 && messageLog != NULL)
          break;
 
       if (messageLog) {
-         assert(msg->message[msg->length-1] == '\0');
-         (void) strncpy(messageLog, msg->message, (size_t)msg->length);
+         assert(msg->message[len] == '\0');
+         (void) strncpy(messageLog, msg->message, (size_t)len+1);
 
-         messageLog += msg->length;
-         logSize -= msg->length;
+         messageLog += len+1;
+         logSize -= len+1;
       }
 
       if (lengths)
-         *lengths++ = msg->length;
+         *lengths++ = len+1;
       if (severities)
          *severities++ = debug_severity_enums[msg->severity];
       if (sources)
@@ -1173,8 +1183,6 @@ _mesa_PushDebugGroup(GLenum source, GLuint id, GLsizei length,
       return;
    }
 
-   if (length < 0)
-      length = strlen(message);
    if (!validate_length(ctx, callerstr, length, message))
       return; /* GL_INVALID_VALUE */
 

commit d81ddb3ed8e180b08e0905c7f3b1f9ce72b9dccf
Author: Emil Velikov <emil.l.velikov@gmail.com>
Date:   Thu Nov 26 00:36:16 2015 +0000

    mesa: errors: validate the length of null terminated string
    
    We're about to rework the meaning of gl_debug_message::length to only
    store the user provided data. Thus we should add an explicit validation
    for null terminated strings.
    
    Signed-off-by: Emil Velikov <emil.l.velikov@gmail.com>
    Reviewed-by: Timothy Arceri <timothy.arceri@collabora.com>
    (cherry picked from commit 622186fbdf47e4c77aadba3e38567636ecbcccf5)

diff --git a/src/mesa/main/errors.c b/src/mesa/main/errors.c
index 9fa2c49..a6294e3 100644
--- a/src/mesa/main/errors.c
+++ b/src/mesa/main/errors.c
@@ -960,8 +960,22 @@ error:
 
 
 static GLboolean
-validate_length(struct gl_context *ctx, const char *callerstr, GLsizei length)
+validate_length(struct gl_context *ctx, const char *callerstr, GLsizei length,
+                const GLchar *buf)
 {
+
+   if (length < 0) {
+      GLsizei len = strlen(buf);
+
+      if (len >= MAX_DEBUG_MESSAGE_LENGTH) {
+         _mesa_error(ctx, GL_INVALID_VALUE,
+                    "%s(null terminated string length=%d, is not less than "
+                    "GL_MAX_DEBUG_MESSAGE_LENGTH=%d)", callerstr, len,
+                    MAX_DEBUG_MESSAGE_LENGTH);
+         return GL_FALSE;
+      }
+   }
+
    if (length >= MAX_DEBUG_MESSAGE_LENGTH) {
       _mesa_error(ctx, GL_INVALID_VALUE,
                  "%s(length=%d, which is not less than "
@@ -992,7 +1006,7 @@ _mesa_DebugMessageInsert(GLenum source, GLenum type, GLuint id,
 
    if (length < 0)
       length = strlen(buf);
-   if (!validate_length(ctx, callerstr, length))
+   if (!validate_length(ctx, callerstr, length, buf))
       return; /* GL_INVALID_VALUE */
 
    log_msg(ctx, gl_enum_to_debug_source(source),
@@ -1161,7 +1175,7 @@ _mesa_PushDebugGroup(GLenum source, GLuint id, GLsizei length,
 
    if (length < 0)
       length = strlen(message);
-   if (!validate_length(ctx, callerstr, length))
+   if (!validate_length(ctx, callerstr, length, message))
       return; /* GL_INVALID_VALUE */
 
    debug = _mesa_lock_debug_state(ctx);

commit c25c1dbf512cec97c480e26e2030d9120d83ea76
Author: Emil Velikov <emil.l.velikov@gmail.com>
Date:   Thu Nov 26 00:36:15 2015 +0000

    mesa: accept TYPE_PUSH/POP_GROUP with glDebugMessageInsert
    
    These new (relative to ARB_debug_output) tokens, have been explicitly
    separated from the existing ones in the spec text. With the reference
    to glDebugMessageInsert was dropped.
    
    At the same time, further down the spec says:
       "The value of <type> must be one of the values from Table 5.4"
    
    ... and these two are listed in Table 5.4.
    
    The GL 4.3 and GLES 3.2 do not give any hints on the former
    'definition', plus CTS requires that the tokens are valid values for
    glDebugMessageInsert.
    
    Signed-off-by: Emil Velikov <emil.l.velikov@gmail.com>
    Reviewed-by: Timothy Arceri <timothy.arceri@collabora.com>
    (cherry picked from commit 66fea8bd9662c8fc62d87cafce89adc27e3172a2)

diff --git a/src/mesa/main/errors.c b/src/mesa/main/errors.c
index a247000..9fa2c49 100644
--- a/src/mesa/main/errors.c
+++ b/src/mesa/main/errors.c
@@ -922,9 +922,9 @@ validate_params(struct gl_context *ctx, unsigned caller,
    case GL_DEBUG_TYPE_PORTABILITY_ARB:
    case GL_DEBUG_TYPE_OTHER_ARB:
    case GL_DEBUG_TYPE_MARKER:
-      break;
    case GL_DEBUG_TYPE_PUSH_GROUP:
    case GL_DEBUG_TYPE_POP_GROUP:
+      break;
    case GL_DONT_CARE:
       if (caller == CONTROL)
          break;

commit bed982c4b75e4521d33e3798bec1bda7c78f204c
Author: Emil Velikov <emil.l.velikov@gmail.com>
Date:   Thu Nov 26 00:36:14 2015 +0000

    mesa: add SEVERITY_NOTIFICATION to default state
    
    As per the spec quote:
    
        "All messages are initially enabled unless their assigned severity
        is DEBUG_SEVERITY_LOW"
    
    We already had MEDIUM and HIGH set, let's toggle NOTIFICATION as well.
    
    Signed-off-by: Emil Velikov <emil.l.velikov@gmail.com>
    Reviewed-by: Timothy Arceri <timothy.arceri@collabora.com>
    (cherry picked from commit 53be28107b44200a59c678c5d2234efeb48d0b35)

diff --git a/src/mesa/main/errors.c b/src/mesa/main/errors.c
index fda5a90..a247000 100644
--- a/src/mesa/main/errors.c
+++ b/src/mesa/main/errors.c
@@ -243,8 +243,9 @@ debug_namespace_init(struct gl_debug_namespace *ns)
    make_empty_list(&ns->Elements);
 
    /* Enable all the messages with severity HIGH or MEDIUM by default */
-   ns->DefaultState = (1 << MESA_DEBUG_SEVERITY_HIGH) |
-                      (1 << MESA_DEBUG_SEVERITY_MEDIUM);
+   ns->DefaultState = (1 << MESA_DEBUG_SEVERITY_MEDIUM ) |
+                      (1 << MESA_DEBUG_SEVERITY_HIGH) |
+                      (1 << MESA_DEBUG_SEVERITY_NOTIFICATION);
 }
 
 static void

commit dcaf3989d12602799b3d50d6068fe926509c911d
Author: Emil Velikov <emil.l.velikov@gmail.com>
Date:   Thu Nov 26 00:36:13 2015 +0000

    mesa: return the correct value for GroupStackDepth
    
    We already have one group (the default) as specified in the spec. So
    lets return its size, rather than the index of the current group.
    
    Signed-off-by: Emil Velikov <emil.l.velikov@gmail.com>
    Reviewed-by: Timothy Arceri <timothy.arceri@collabora.com>
    (cherry picked from commit 078dd6a0b4135b5181eea538473fe53a9bc61223)

diff --git a/src/mesa/main/errors.c b/src/mesa/main/errors.c
index 88fc028..fda5a90 100644
--- a/src/mesa/main/errors.c
+++ b/src/mesa/main/errors.c
@@ -775,7 +775,7 @@ _mesa_get_debug_state_int(struct gl_context *ctx, GLenum pname)
          debug->Log.Messages[debug->Log.NextMessage].length : 0;
       break;
    case GL_DEBUG_GROUP_STACK_DEPTH:
-      val = debug->CurrentGroup;
+      val = debug->CurrentGroup + 1;
       break;
    default:
       assert(!"unknown debug output param");

commit 996a4958da7ae97efff4335cae857143d5119404
Author: Emil Velikov <emil.l.velikov@gmail.com>
Date:   Thu Nov 26 00:36:12 2015 +0000

    mesa: rename GroupStackDepth to CurrentGroup
    
    The variable is used as the actual index, rather than the size of the
    group stack - rename it to reflect that.
    
    Suggested-by: Ilia Mirkin <imirkin@alum.mit.edu>
    Signed-off-by: Emil Velikov <emil.l.velikov@gmail.com>
    Reviewed-by: Timothy Arceri <timothy.arceri@collabora.com>
    (cherry picked from commit f39954bf7cf09199a1cccb71e0e858c0b2054c6d)

diff --git a/src/mesa/main/errors.c b/src/mesa/main/errors.c
index 85e5bbd..88fc028 100644
--- a/src/mesa/main/errors.c
+++ b/src/mesa/main/errors.c
@@ -98,7 +98,7 @@ struct gl_debug_state
 
    struct gl_debug_group *Groups[MAX_DEBUG_GROUP_STACK_DEPTH];
    struct gl_debug_message GroupMessages[MAX_DEBUG_GROUP_STACK_DEPTH];
-   GLint GroupStackDepth;
+   GLint CurrentGroup; // GroupStackDepth - 1
 
    struct gl_debug_log Log;
 };
@@ -422,7 +422,7 @@ debug_create(void)
 static bool
 debug_is_group_read_only(const struct gl_debug_state *debug)
 {
-   const GLint gstack = debug->GroupStackDepth;
+   const GLint gstack = debug->CurrentGroup;
    return (gstack > 0 && debug->Groups[gstack] == debug->Groups[gstack - 1]);
 }
 
@@ -432,7 +432,7 @@ debug_is_group_read_only(const struct gl_debug_state *debug)
 static bool
 debug_make_group_writable(struct gl_debug_state *debug)
 {
-   const GLint gstack = debug->GroupStackDepth;
+   const GLint gstack = debug->CurrentGroup;
    const struct gl_debug_group *src = debug->Groups[gstack];
    struct gl_debug_group *dst;
    int s, t;
@@ -472,7 +472,7 @@ debug_make_group_writable(struct gl_debug_state *debug)
 static void
 debug_clear_group(struct gl_debug_state *debug)
 {
-   const GLint gstack = debug->GroupStackDepth;
+   const GLint gstack = debug->CurrentGroup;
 
    if (!debug_is_group_read_only(debug)) {
       struct gl_debug_group *grp = debug->Groups[gstack];
@@ -496,9 +496,9 @@ debug_clear_group(struct gl_debug_state *debug)
 static void
 debug_destroy(struct gl_debug_state *debug)
 {
-   while (debug->GroupStackDepth > 0) {
+   while (debug->CurrentGroup > 0) {
       debug_clear_group(debug);
-      debug->GroupStackDepth--;
+      debug->CurrentGroup--;
    }
 
    debug_clear_group(debug);
@@ -514,7 +514,7 @@ debug_set_message_enable(struct gl_debug_state *debug,
                          enum mesa_debug_type type,
                          GLuint id, GLboolean enabled)
 {
-   const GLint gstack = debug->GroupStackDepth;
+   const GLint gstack = debug->CurrentGroup;
    struct gl_debug_namespace *ns;
 
    debug_make_group_writable(debug);
@@ -541,7 +541,7 @@ debug_set_message_enable_all(struct gl_debug_state *debug,
                              enum mesa_debug_severity severity,
                              GLboolean enabled)
 {
-   const GLint gstack = debug->GroupStackDepth;
+   const GLint gstack = debug->CurrentGroup;
    int s, t, smax, tmax;
 
    if (source == MESA_DEBUG_SOURCE_COUNT) {
@@ -579,7 +579,7 @@ debug_is_message_enabled(const struct gl_debug_state *debug,
                          GLuint id,
                          enum mesa_debug_severity severity)
 {
-   const GLint gstack = debug->GroupStackDepth;
+   const GLint gstack = debug->CurrentGroup;
    struct gl_debug_group *grp = debug->Groups[gstack];
    struct gl_debug_namespace *nspace = &grp->Namespaces[source][type];
 
@@ -657,24 +657,24 @@ debug_delete_messages(struct gl_debug_state *debug, int count)
 static struct gl_debug_message *
 debug_get_group_message(struct gl_debug_state *debug)
 {
-   return &debug->GroupMessages[debug->GroupStackDepth];
+   return &debug->GroupMessages[debug->CurrentGroup];
 }
 
 static void
 debug_push_group(struct gl_debug_state *debug)
 {
-   const GLint gstack = debug->GroupStackDepth;
+   const GLint gstack = debug->CurrentGroup;
 
    /* just point to the previous stack */
    debug->Groups[gstack + 1] = debug->Groups[gstack];
-   debug->GroupStackDepth++;
+   debug->CurrentGroup++;
 }
 
 static void
 debug_pop_group(struct gl_debug_state *debug)
 {
    debug_clear_group(debug);
-   debug->GroupStackDepth--;
+   debug->CurrentGroup--;
 }
 
 
@@ -775,7 +775,7 @@ _mesa_get_debug_state_int(struct gl_context *ctx, GLenum pname)
          debug->Log.Messages[debug->Log.NextMessage].length : 0;
       break;
    case GL_DEBUG_GROUP_STACK_DEPTH:
-      val = debug->GroupStackDepth;
+      val = debug->CurrentGroup;
       break;
    default:
       assert(!"unknown debug output param");
@@ -1167,7 +1167,7 @@ _mesa_PushDebugGroup(GLenum source, GLuint id, GLsizei length,
    if (!debug)
       return;
 
-   if (debug->GroupStackDepth >= MAX_DEBUG_GROUP_STACK_DEPTH-1) {
+   if (debug->CurrentGroup >= MAX_DEBUG_GROUP_STACK_DEPTH-1) {
       _mesa_unlock_debug_state(ctx);
       _mesa_error(ctx, GL_STACK_OVERFLOW, "%s", callerstr);
       return;
@@ -1209,7 +1209,7 @@ _mesa_PopDebugGroup(void)
    if (!debug)
       return;
 
-   if (debug->GroupStackDepth <= 0) {
+   if (debug->CurrentGroup <= 0) {
       _mesa_unlock_debug_state(ctx);
       _mesa_error(ctx, GL_STACK_UNDERFLOW, "%s", callerstr);
       return;

commit 0cf5a8159f9821425dbc63315545fbf52436e911
Author: Emil Velikov <emil.l.velikov@gmail.com>
Date:   Thu Nov 26 00:36:11 2015 +0000

    mesa: do not enable KHR_debug for ES 1.0
    
    The extension requires (cough implements) GetPointervKHR (alias of
    GetPointerv) which in itself is available for ES 1.1 enabled mesa.
    
    Anyone willing to fish around and implement it for ES 1.0 is more than
    welcome to revert this commit. Until then lets restrict things.
    
    Bugzilla: https://bugs.freedesktop.org/show_bug.cgi?id=93048
    Signed-off-by: Emil Velikov <emil.l.velikov@gmail.com>
    Reviewed-by: Timothy Arceri <timothy.arceri@collabora.com>
    (cherry picked from commit 1ca735701bb4d66c95d2ab64c0d838608f7c3f96)

diff --git a/src/mapi/glapi/gen/KHR_debug.xml b/src/mapi/glapi/gen/KHR_debug.xml
index 431a788..50daba3 100644
--- a/src/mapi/glapi/gen/KHR_debug.xml
+++ b/src/mapi/glapi/gen/KHR_debug.xml
@@ -146,7 +146,7 @@
   </function>
 
   <!-- ES extension has different suffixes -->
-  <function name="DebugMessageControlKHR" alias="DebugMessageControl" es1="1.0" es2="2.0">
+  <function name="DebugMessageControlKHR" alias="DebugMessageControl" es1="1.1" es2="2.0">
     <param name="source" type="GLenum"/>
     <param name="type" type="GLenum"/>
     <param name="severity" type="GLenum"/>
@@ -155,7 +155,7 @@
     <param name="enabled" type="GLboolean"/>
   </function>
 
-  <function name="DebugMessageInsertKHR" alias="DebugMessageInsert" es1="1.0" es2="2.0">
+  <function name="DebugMessageInsertKHR" alias="DebugMessageInsert" es1="1.1" es2="2.0">
     <param name="source" type="GLenum"/>
     <param name="type" type="GLenum"/>
     <param name="id" type="GLuint"/>
@@ -164,12 +164,12 @@
     <param name="buf" type="const GLchar *"/>
   </function>
 
-  <function name="DebugMessageCallbackKHR" alias="DebugMessageCallback" es1="1.0" es2="2.0">
+  <function name="DebugMessageCallbackKHR" alias="DebugMessageCallback" es1="1.1" es2="2.0">
     <param name="callback" type="GLDEBUGPROC"/>
     <param name="userParam" type="const GLvoid *"/>
   </function>
 
-  <function name="GetDebugMessageLogKHR" alias="GetDebugMessageLog" es1="1.0" es2="2.0">
+  <function name="GetDebugMessageLogKHR" alias="GetDebugMessageLog" es1="1.1" es2="2.0">
     <return type="GLuint"/>
     <param name="count" type="GLuint"/>
     <param name="bufsize" type="GLsizei"/>
@@ -186,23 +186,23 @@
     <param name="params" type="GLvoid **" output="true"/>
   </function>
 
-  <function name="PushDebugGroupKHR" alias="PushDebugGroup" es1="1.0" es2="2.0">
+  <function name="PushDebugGroupKHR" alias="PushDebugGroup" es1="1.1" es2="2.0">
     <param name="source" type="GLenum"/>
     <param name="id" type="GLuint"/>
     <param name="length" type="GLsizei"/>
     <param name="message" type="const GLchar *"/>
   </function>
 
-  <function name="PopDebugGroupKHR" alias="PopDebugGroup" es1="1.0" es2="2.0"/>
+  <function name="PopDebugGroupKHR" alias="PopDebugGroup" es1="1.1" es2="2.0"/>
 
-  <function name="ObjectLabelKHR" alias="ObjectLabel" es1="1.0" es2="2.0">
+  <function name="ObjectLabelKHR" alias="ObjectLabel" es1="1.1" es2="2.0">
     <param name="identifier" type="GLenum"/>
     <param name="name" type="GLuint"/>
     <param name="length" type="GLsizei"/>
     <param name="label" type="const GLchar *"/>
   </function>
 
-  <function name="GetObjectLabelKHR" alias="GetObjectLabel" es1="1.0" es2="2.0">
+  <function name="GetObjectLabelKHR" alias="GetObjectLabel" es1="1.1" es2="2.0">
     <param name="identifier" type="GLenum"/>
     <param name="name" type="GLuint"/>
     <param name="bufSize" type="GLsizei"/>
@@ -210,13 +210,13 @@
     <param name="label" type="GLchar *"/>
   </function>
 
-  <function name="ObjectPtrLabelKHR" alias="ObjectPtrLabel" es1="1.0" es2="2.0">
+  <function name="ObjectPtrLabelKHR" alias="ObjectPtrLabel" es1="1.1" es2="2.0">
     <param name="ptr" type="const GLvoid *"/>
     <param name="length" type="GLsizei"/>
     <param name="label" type="const GLchar *"/>
   </function>
 
-  <function name="GetObjectPtrLabelKHR" alias="GetObjectPtrLabel" es1="1.0" es2="2.0">
+  <function name="GetObjectPtrLabelKHR" alias="GetObjectPtrLabel" es1="1.1" es2="2.0">
     <param name="ptr" type="const GLvoid *"/>
     <param name="bufSize" type="GLsizei"/>
     <param name="length" type="GLsizei *"/>
diff --git a/src/mesa/main/extensions_table.h b/src/mesa/main/extensions_table.h
index 051d69a..52a4ed6 100644
--- a/src/mesa/main/extensions_table.h
+++ b/src/mesa/main/extensions_table.h
@@ -258,7 +258,7 @@ EXT(INGR_blend_func_separate                , EXT_blend_func_separate
 EXT(INTEL_performance_query                 , INTEL_performance_query                , GLL, GLC,  x , ES2, 2013)
 
 EXT(KHR_context_flush_control               , dummy_true                             , GLL, GLC,  x , ES2, 2014)
-EXT(KHR_debug                               , dummy_true                             , GLL, GLC, ES1, ES2, 2012)
+EXT(KHR_debug                               , dummy_true                             , GLL, GLC,  11, ES2, 2012)
 EXT(KHR_texture_compression_astc_hdr        , KHR_texture_compression_astc_hdr       , GLL, GLC,  x , ES2, 2012)
 EXT(KHR_texture_compression_astc_ldr        , KHR_texture_compression_astc_ldr       , GLL, GLC,  x , ES2, 2012)
 

commit 6cc9a53d84fba33a3557826f6fc9b34d67c44069
Author: Emil Velikov <emil.l.velikov@gmail.com>
Date:   Thu Nov 26 00:36:10 2015 +0000

    glapi: add GetPointervKHR to the ES dispatch
    
    The KHR_debug extension implements this.
    
    Strictly speaking it could be used with ES 1.0, although as the original
    function is available on ES 1.1, I'm inclined to lift the KHR_debug
    requirement to ES 1.1.
    
    Bugzilla: https://bugs.freedesktop.org/show_bug.cgi?id=93048
    Signed-off-by: Emil Velikov <emil.l.velikov@gmail.com>
    Reviewed-by: Timothy Arceri <timothy.arceri@collabora.com>
    (cherry picked from commit f53f9eb8d495a318bc8e6fd758df4ba4074599ef)
    
    Squashed with commit
    
    mesa/tests: add KHR_debug GLES glGetPointervKHR entry points
    
    Should have been part of commit f53f9eb8d49 "glapi: add GetPointervKHR
    to the ES dispatch".
    
    v2: comment out the ES1.1 symbol and use the same description (pattern)
    as elsewhere (Matt)
    
    Bugzilla: https://bugs.freedesktop.org/show_bug.cgi?id=93235
    Fixes: f53f9eb8d49 "glapi: add GetPointervKHR to the ES dispatch".
    Signed-off-by: Emil Velikov <emil.l.velikov@gmail.com>
    Tested-by: Vinson Lee <vlee@freedesktop.org> (v1)
    Tested-by: Michel Dänzer <michel.daenzer@amd.com>
    (cherry picked from commit 1074e38fbbc89a06c74f036622cbe2778bee993a)

diff --git a/src/mapi/glapi/gen/KHR_debug.xml b/src/mapi/glapi/gen/KHR_debug.xml
index e4a5a5b..431a788 100644
--- a/src/mapi/glapi/gen/KHR_debug.xml
+++ b/src/mapi/glapi/gen/KHR_debug.xml
@@ -181,6 +181,11 @@
     <param name="messageLog" type="GLchar *" output="true"/>
   </function>
 
+  <function name="GetPointervKHR" alias="GetPointerv" es1="1.1" es2="2.0">
+    <param name="pname" type="GLenum"/>
+    <param name="params" type="GLvoid **" output="true"/>
+  </function>
+
   <function name="PushDebugGroupKHR" alias="PushDebugGroup" es1="1.0" es2="2.0">
     <param name="source" type="GLenum"/>
     <param name="id" type="GLuint"/>
diff --git a/src/mesa/main/tests/dispatch_sanity.cpp b/src/mesa/main/tests/dispatch_sanity.cpp
index 97f81f9..d288b1d 100644
--- a/src/mesa/main/tests/dispatch_sanity.cpp
+++ b/src/mesa/main/tests/dispatch_sanity.cpp
@@ -1937,7 +1937,8 @@ const struct function gles11_functions_possible[] = {
    { "glGetLightxv", 11, -1 },
    { "glGetMaterialfv", 11, _gloffset_GetMaterialfv },
    { "glGetMaterialxv", 11, -1 },
-   { "glGetPointerv", 11, _gloffset_GetPointerv },
+   // We check for the aliased -KHR version in GLES 1.1
+// { "glGetPointerv", 11, _gloffset_GetPointerv },
    { "glGetRenderbufferParameterivOES", 11, -1 },
    { "glGetString", 11, _gloffset_GetString },
    { "glGetTexEnvfv", 11, _gloffset_GetTexEnvfv },
@@ -2049,6 +2050,7 @@ const struct function gles11_functions_possible[] = {
    { "glGetDebugMessageLogKHR", 11, -1 },
    { "glGetObjectLabelKHR", 11, -1 },
    { "glGetObjectPtrLabelKHR", 11, -1 },
+   { "glGetPointervKHR", 11, _gloffset_GetPointerv },
    { "glObjectLabelKHR", 11, -1 },
    { "glObjectPtrLabelKHR", 11, -1 },
 
@@ -2284,6 +2286,7 @@ const struct function gles2_functions_possible[] = {
    { "glGetDebugMessageLogKHR", 20, -1 },
    { "glGetObjectLabelKHR", 20, -1 },
    { "glGetObjectPtrLabelKHR", 20, -1 },
+   { "glGetPointervKHR", 20, -1 },
    { "glObjectLabelKHR", 20, -1 },
    { "glObjectPtrLabelKHR", 20, -1 },
 

commit 0a51e77fa1e858c0593579f2052d70bb1602e167
Author: Emil Velikov <emil.l.velikov@gmail.com>
Date:   Fri Nov 27 13:12:59 2015 +0000

    mesa: remove len argument from _mesa_shader_debug()
    
    There was only a single user which was using strlen(buf).
    As this function is not user facing (i.e. we don't need to feed back
    original length via a callback), we can simplify things.
    
    Suggested-by: Timothy Arceri <timothy.arceri@collabora.com>
    Signed-off-by: Emil Velikov <emil.l.velikov@gmail.com>
    Reviewed-by: Timothy Arceri <timothy.arceri@collabora.com>
    (cherry picked from commit d37ebed470c6c37abfc6fe42079bff027ff58e9d)

diff --git a/src/glsl/glsl_parser_extras.cpp b/src/glsl/glsl_parser_extras.cpp
index 84b3aca..2318821 100644
--- a/src/glsl/glsl_parser_extras.cpp
+++ b/src/glsl/glsl_parser_extras.cpp
@@ -477,7 +477,7 @@ _mesa_glsl_msg(const YYLTYPE *locp, _mesa_glsl_parse_state *state,
    struct gl_context *ctx = state->ctx;
 
    /* Report the error via GL_ARB_debug_output. */
-   _mesa_shader_debug(ctx, type, &msg_id, msg, strlen(msg));
+   _mesa_shader_debug(ctx, type, &msg_id, msg);
 
    ralloc_strcat(&state->info_log, "\n");
 }
diff --git a/src/glsl/standalone_scaffolding.cpp b/src/glsl/standalone_scaffolding.cpp
index f3e34c6..1f69d0d 100644
--- a/src/glsl/standalone_scaffolding.cpp
+++ b/src/glsl/standalone_scaffolding.cpp
@@ -63,7 +63,7 @@ _mesa_reference_shader(struct gl_context *ctx, struct gl_shader **ptr,
 
 void
 _mesa_shader_debug(struct gl_context *, GLenum, GLuint *,
-                   const char *, int)
+                   const char *)
 {
 }
 
diff --git a/src/glsl/standalone_scaffolding.h b/src/glsl/standalone_scaffolding.h
index a9ca5e4..f853a18 100644
--- a/src/glsl/standalone_scaffolding.h
+++ b/src/glsl/standalone_scaffolding.h
@@ -52,7 +52,7 @@ _mesa_clear_shader_program_data(struct gl_shader_program *);
 
 extern "C" void
 _mesa_shader_debug(struct gl_context *ctx, GLenum type, GLuint *id,
-                   const char *msg, int len);
+                   const char *msg);
 
 static inline gl_shader_stage
 _mesa_shader_enum_to_shader_stage(GLenum v)
diff --git a/src/mesa/main/errors.c b/src/mesa/main/errors.c
index 366b119..85e5bbd 100644
--- a/src/mesa/main/errors.c
+++ b/src/mesa/main/errors.c
@@ -1599,20 +1599,19 @@ _mesa_log(const char *fmtString, ...)
  * \param ctx GL context.
  * \param type The namespace to which this message belongs.
  * \param id The message ID within the given namespace.
- * \param msg The message to output. Need not be null-terminated.
- * \param len The length of 'msg'. If negative, 'msg' must be null-terminated.
+ * \param msg The message to output. Must be null-terminated.
  */
 void
-_mesa_shader_debug( struct gl_context *ctx, GLenum type, GLuint *id,
-                    const char *msg, int len )
+_mesa_shader_debug(struct gl_context *ctx, GLenum type, GLuint *id,
+                   const char *msg)
 {
    enum mesa_debug_source source = MESA_DEBUG_SOURCE_SHADER_COMPILER;
    enum mesa_debug_severity severity = MESA_DEBUG_SEVERITY_HIGH;
+   int len;
 
    debug_get_id(id);
 
-   if (len < 0)
-      len = strlen(msg);
+   len = strlen(msg);
 
    /* Truncate the message if necessary. */
    if (len >= MAX_DEBUG_MESSAGE_LENGTH)
diff --git a/src/mesa/main/errors.h b/src/mesa/main/errors.h
index 81e47a8..f291976 100644
--- a/src/mesa/main/errors.h
+++ b/src/mesa/main/errors.h
@@ -115,7 +115,7 @@ _mesa_get_debug_state_ptr(struct gl_context *ctx, GLenum pname);
 
 extern void
 _mesa_shader_debug(struct gl_context *ctx, GLenum type, GLuint *id,
-                   const char *msg, int len);
+                   const char *msg);
 
 void GLAPIENTRY
 _mesa_DebugMessageInsert(GLenum source, GLenum type, GLuint id,

commit ca6d0a3dbe3f875ee2098fcdd634a1f30d85c921
Author: Ilia Mirkin <imirkin@alum.mit.edu>
Date:   Thu Dec 3 22:37:22 2015 -0500

    nv50/ir: avoid looking at uninitialized srcMods entries
    
    Signed-off-by: Ilia Mirkin <imirkin@alum.mit.edu>
    Cc: "11.0 11.1" <mesa-stable@lists.freedesktop.org>
    (cherry picked from commit 2b98914fe01f1c7b2de8a096c8923b3ab0a69578)

diff --git a/src/gallium/drivers/nouveau/codegen/nv50_ir_target_nv50.cpp b/src/gallium/drivers/nouveau/codegen/nv50_ir_target_nv50.cpp
index 94cf0f0..66666cc 100644
--- a/src/gallium/drivers/nouveau/codegen/nv50_ir_target_nv50.cpp
+++ b/src/gallium/drivers/nouveau/codegen/nv50_ir_target_nv50.cpp
@@ -454,7 +454,7 @@ TargetNV50::isModSupported(const Instruction *insn, int s, Modifier mod) const
          return false;
       }
    }
-   if (s >= 3)
+   if (s >= opInfo[insn->op].srcNr || s >= 3)
       return false;
    return (mod & Modifier(opInfo[insn->op].srcMods[s])) == mod;
 }
diff --git a/src/gallium/drivers/nouveau/codegen/nv50_ir_target_nvc0.cpp b/src/gallium/drivers/nouveau/codegen/nv50_ir_target_nvc0.cpp
index 8f59d86..0f1f4f8 100644
--- a/src/gallium/drivers/nouveau/codegen/nv50_ir_target_nvc0.cpp
+++ b/src/gallium/drivers/nouveau/codegen/nv50_ir_target_nvc0.cpp
@@ -439,7 +439,7 @@ TargetNVC0::isModSupported(const Instruction *insn, int s, Modifier mod) const
          return false;
       }
    }
-   if (s >= 3)
+   if (s >= opInfo[insn->op].srcNr || s >= 3)
       return false;
    return (mod & Modifier(opInfo[insn->op].srcMods[s])) == mod;
 }

commit 4ae9142f8ba30da1e892f0d29a287dca0ed5a840
Author: Ilia Mirkin <imirkin@alum.mit.edu>
Date:   Thu Dec 3 14:04:06 2015 -0500

    nv50/ir: fix DCE to not generate 96-bit loads
    
    A situation where there's a 128-bit load where the last component gets
    DCE'd causes a 96-bit load to be generated, which no GPU can actually
    emit. Avoid generating such instructions by scaling back to 64-bit on
    the first load when splitting.
    
    Signed-off-by: Ilia Mirkin <imirkin@alum.mit.edu>
    Cc: "11.0 11.1" <mesa-stable@lists.freedesktop.org>
    (cherry picked from commit 49692f86a1b77fac4634d2a3f0502ec7451c3435)

diff --git a/src/gallium/drivers/nouveau/codegen/nv50_ir_peephole.cpp b/src/gallium/drivers/nouveau/codegen/nv50_ir_peephole.cpp
index 0f3caa8..bb7f491 100644
--- a/src/gallium/drivers/nouveau/codegen/nv50_ir_peephole.cpp
+++ b/src/gallium/drivers/nouveau/codegen/nv50_ir_peephole.cpp
@@ -2962,6 +2962,16 @@ DeadCodeElim::visit(BasicBlock *bb)
    return true;
 }
 
+// Each load can go into up to 4 destinations, any of which might potentially
+// be dead (i.e. a hole). These can always be split into 2 loads, independent
+// of where the holes are. We find the first contiguous region, put it into
+// the first load, and then put the second contiguous region into the second
+// load. There can be at most 2 contiguous regions.
+//
+// Note that there are some restrictions, for example it's not possible to do
+// a 64-bit load that's not 64-bit aligned, so such a load has to be split
+// up. Also hardware doesn't support 96-bit loads, so those also have to be
+// split into a 64-bit and 32-bit load.
 void
 DeadCodeElim::checkSplitLoad(Instruction *ld1)
 {
@@ -2982,6 +2992,8 @@ DeadCodeElim::checkSplitLoad(Instruction *ld1)
    addr1 = ld1->getSrc(0)->reg.data.offset;
    n1 = n2 = 0;
    size1 = size2 = 0;
+
+   // Compute address/width for first load
    for (d = 0; ld1->defExists(d); ++d) {
       if (mask & (1 << d)) {
          if (size1 && (addr1 & 0x7))
@@ -2995,16 +3007,34 @@ DeadCodeElim::checkSplitLoad(Instruction *ld1)
          break;
       }
    }
+
+   // Scale back the size of the first load until it can be loaded. This
+   // typically happens for TYPE_B96 loads.
+   while (n1 &&
+          !prog->getTarget()->isAccessSupported(ld1->getSrc(0)->reg.file,
+                                                typeOfSize(size1))) {
+      size1 -= def1[--n1]->reg.size;
+      d--;
+   }
+
+   // Compute address/width for second load
    for (addr2 = addr1 + size1; ld1->defExists(d); ++d) {
       if (mask & (1 << d)) {
+         assert(!size2 || !(addr2 & 0x7));
          def2[n2] = ld1->getDef(d);
          size2 += def2[n2++]->reg.size;
-      } else {
+      } else if (!n2) {
          assert(!n2);
          addr2 += ld1->getDef(d)->reg.size;
+      } else {
+         break;
       }
    }
 
+   // Make sure that we've processed all the values
+   for (; ld1->defExists(d); ++d)
+      assert(!(mask & (1 << d)));
+
    updateLdStOffset(ld1, addr1, func);
    ld1->setType(typeOfSize(size1));
    for (d = 0; d < 4; ++d)

commit aff9f8a6f7b6cf19a0ba4260dddf9cef77c02cc2
Author: Marek Olšák <marek.olsak@amd.com>
Date:   Thu Dec 3 23:50:00 2015 +0100

    radeonsi: fix Fiji for LLVM <= 3.7
    
    Cc: 11.0 11.1 <mesa-stable@lists.freedesktop.org>
    Reviewed-by: Alex Deucher <alexander.deucher@amd.com>
    (cherry picked from commit dd27825c8cf0e7b55ebaa139e299f275943d22f6)



Reply to: