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

mesa: Changes to 'upstream-experimental'



 configure.ac                                        |    8 -
 src/gallium/drivers/r600/evergreen_state.c          |    3 
 src/gallium/drivers/r600/evergreend.h               |   11 +
 src/gallium/drivers/r600/r600_state.c               |    3 
 src/gallium/drivers/r600/r600_state_common.c        |    2 
 src/gallium/drivers/r600/r600d.h                    |    9 +
 src/gallium/winsys/radeon/drm/radeon_drm_winsys.c   |    3 
 src/glsl/ast_to_hir.cpp                             |   19 ++-
 src/mapi/glapi/gen/glX_proto_send.py                |    4 
 src/mesa/drivers/common/meta.c                      |    8 -
 src/mesa/drivers/dri/i965/brw_fs_live_variables.cpp |   24 +++
 src/mesa/drivers/osmesa/Makefile.am                 |    4 
 src/mesa/drivers/osmesa/osmesa.pc.in                |    2 
 src/mesa/main/extensions.c                          |   11 -
 src/mesa/main/fbobject.c                            |    4 
 src/mesa/main/teximage.c                            |   48 ++++---
 src/mesa/main/teximage.h                            |    2 
 src/mesa/main/texstorage.c                          |  126 ++++++++++++++------
 18 files changed, 210 insertions(+), 81 deletions(-)

New commits:
commit c586fce4fb537e904e35cb5197b6b7fe02217acb
Author: Vadim Girlin <vadimgirlin@gmail.com>
Date:   Tue Sep 4 00:18:13 2012 +0400

    r600g: adjust QUANT_MODE for higher precision
    
    Use 1/256 for R6xx/7xx, 1/4096 for evergreen, instead of default 1/16.
    
    Helps to pass some piglit tests (fbo, multisample).
    
    Signed-off-by: Vadim Girlin <vadimgirlin@gmail.com>
    Reviewed-by: Alex Deucher <alexander.deucher@amd.com>
    (cherry picked from commit f44bda17f515c411071ca8744ebd96039d9c583b)

diff --git a/src/gallium/drivers/r600/evergreen_state.c b/src/gallium/drivers/r600/evergreen_state.c
index 28a83f2..bda8ed5 100644
--- a/src/gallium/drivers/r600/evergreen_state.c
+++ b/src/gallium/drivers/r600/evergreen_state.c
@@ -920,7 +920,8 @@ static void *evergreen_create_rs_state(struct pipe_context *ctx,
 					S_028C08_PIX_CENTER_HALF(state->gl_rasterization_rules));
 	} else {
 		r600_pipe_state_add_reg(rstate, R_028C08_PA_SU_VTX_CNTL,
-					S_028C08_PIX_CENTER_HALF(state->gl_rasterization_rules));
+					S_028C08_PIX_CENTER_HALF(state->gl_rasterization_rules) |
+					S_028C08_QUANT_MODE(V_028C08_X_1_4096TH));
 	}
 	r600_pipe_state_add_reg(rstate, R_028B7C_PA_SU_POLY_OFFSET_CLAMP, fui(state->offset_clamp));
 	r600_pipe_state_add_reg(rstate, R_028814_PA_SU_SC_MODE_CNTL,
diff --git a/src/gallium/drivers/r600/evergreend.h b/src/gallium/drivers/r600/evergreend.h
index 91d78f8..e4d72f5 100644
--- a/src/gallium/drivers/r600/evergreend.h
+++ b/src/gallium/drivers/r600/evergreend.h
@@ -1955,6 +1955,17 @@
 #define   S_028C08_PIX_CENTER_HALF(x)                  (((x) & 0x1) << 0)
 #define   G_028C08_PIX_CENTER_HALF(x)                  (((x) >> 0) & 0x1)
 #define   C_028C08_PIX_CENTER_HALF                     0xFFFFFFFE
+#define   S_028C08_QUANT_MODE(x)                       (((x) & 0x7) << 3)
+#define   G_028C08_QUANT_MODE(x)                       (((x) >> 3) & 0x7)
+#define   C_028C08_QUANT_MODE                          0xFFFFFFC7
+#define     V_028C08_X_1_16TH                          0x00
+#define     V_028C08_X_1_8TH                           0x01
+#define     V_028C08_X_1_4TH                           0x02
+#define     V_028C08_X_1_2                             0x03
+#define     V_028C08_X_1                               0x04
+#define     V_028C08_X_1_256TH                         0x05
+#define     V_028C08_X_1_1024TH                        0x06
+#define     V_028C08_X_1_4096TH                        0x07
 #define R_028C0C_PA_CL_GB_VERT_CLIP_ADJ              0x00028C0C
 #define R_028C10_PA_CL_GB_VERT_DISC_ADJ              0x00028C10
 #define R_028C14_PA_CL_GB_HORZ_CLIP_ADJ              0x00028C14
diff --git a/src/gallium/drivers/r600/r600_state.c b/src/gallium/drivers/r600/r600_state.c
index 26db24b..53bbdd9 100644
--- a/src/gallium/drivers/r600/r600_state.c
+++ b/src/gallium/drivers/r600/r600_state.c
@@ -948,7 +948,8 @@ static void *r600_create_rs_state(struct pipe_context *ctx,
 	r600_pipe_state_add_reg(rstate, R_028A4C_PA_SC_MODE_CNTL, sc_mode_cntl);
 
 	r600_pipe_state_add_reg(rstate, R_028C08_PA_SU_VTX_CNTL,
-				S_028C08_PIX_CENTER_HALF(state->gl_rasterization_rules));
+				S_028C08_PIX_CENTER_HALF(state->gl_rasterization_rules) |
+				S_028C08_QUANT_MODE(V_028C08_X_1_256TH));
 
 	r600_pipe_state_add_reg(rstate, R_028DFC_PA_SU_POLY_OFFSET_CLAMP, fui(state->offset_clamp));
 	r600_pipe_state_add_reg(rstate, R_028814_PA_SU_SC_MODE_CNTL,
diff --git a/src/gallium/drivers/r600/r600d.h b/src/gallium/drivers/r600/r600d.h
index a6da0a2..28423e1 100644
--- a/src/gallium/drivers/r600/r600d.h
+++ b/src/gallium/drivers/r600/r600d.h
@@ -2194,6 +2194,15 @@
 #define   S_028C08_PIX_CENTER_HALF(x)                  (((x) & 0x1) << 0)
 #define   G_028C08_PIX_CENTER_HALF(x)                  (((x) >> 0) & 0x1)
 #define   C_028C08_PIX_CENTER_HALF                     0xFFFFFFFE
+#define   S_028C08_QUANT_MODE(x)                       (((x) & 0x7) << 3)
+#define   G_028C08_QUANT_MODE(x)                       (((x) >> 3) & 0x7)
+#define   C_028C08_QUANT_MODE                          0xFFFFFFC7
+#define     V_028C08_X_1_16TH                          0x00
+#define     V_028C08_X_1_8TH                           0x01
+#define     V_028C08_X_1_4TH                           0x02
+#define     V_028C08_X_1_2                             0x03
+#define     V_028C08_X_1                               0x04
+#define     V_028C08_X_1_256TH                         0x05
 #define R_028C1C_PA_SC_AA_SAMPLE_LOCS_MCTX           0x028C1C
 #define R_028C48_PA_SC_AA_MASK                       0x028C48
 #define R_028810_PA_CL_CLIP_CNTL                     0x028810

commit 405d47bbe78106f44e4283925e58a1d1ebc88455
Author: Vadim Girlin <vadimgirlin@gmail.com>
Date:   Sat Sep 1 01:02:24 2012 +0400

    mesa: don't wait in _mesa_ClientWaitSync if timeout is 0
    
    From ARB_sync spec:
    
        If the value of <timeout> is zero, then ClientWaitSync does not
        block, but simply tests the current state of <sync>. TIMEOUT_EXPIRED
        will be returned in this case if <sync> is not signaled, even though
        no actual wait was performed.
    
    Fixes random fails of the arb_sync-timeout-zero piglit test on r600g.
    
    Signed-off-by: Vadim Girlin <vadimgirlin@gmail.com>
    Reviewed-by: Eric Anholt <eric@anholt.net>
    (cherry picked from commit b05a1fc156c4776d97d6ff3dcce71e6e34bac21d)

diff --git a/src/mesa/main/syncobj.c b/src/mesa/main/syncobj.c
index e1a5c6c..9f5a27e 100644
--- a/src/mesa/main/syncobj.c
+++ b/src/mesa/main/syncobj.c
@@ -326,9 +326,13 @@ _mesa_ClientWaitSync(GLsync sync, GLbitfield flags, GLuint64 timeout)
    if (syncObj->StatusFlag) {
       ret = GL_ALREADY_SIGNALED;
    } else {
-      ctx->Driver.ClientWaitSync(ctx, syncObj, flags, timeout);
+      if (timeout == 0) {
+         ret = GL_TIMEOUT_EXPIRED;
+      } else {
+         ctx->Driver.ClientWaitSync(ctx, syncObj, flags, timeout);
 
-      ret = syncObj->StatusFlag ? GL_CONDITION_SATISFIED : GL_TIMEOUT_EXPIRED;
+         ret = syncObj->StatusFlag ? GL_CONDITION_SATISFIED : GL_TIMEOUT_EXPIRED;
+      }
    }
 
    _mesa_unref_sync_object(ctx, syncObj);

commit 04f902b47226f976d3d81c66ddadb7414051c957
Author: Brian Paul <brianp@vmware.com>
Date:   Sat Sep 8 09:33:13 2012 -0600

    mesa: fix proxy texture error handling in glTexStorage()
    
    This is basically a follow-on to 1f5b1f98468d5e80be39e619ed15c422fbede8d3.
    Basically, generate GL errors for ordinary invalid parameters for proxy
    targets the same as for non-proxy targets.  Only texture size and OOM
    errors should be handled specially for proxies.
    
    Note: This is a candidate for the stable branches.
    (cherry picked from commit 35c75f6777c177a59df8a87adf0777403113ce74)

diff --git a/src/mesa/main/texstorage.c b/src/mesa/main/texstorage.c
index 8e03e5e..f8a9397 100644
--- a/src/mesa/main/texstorage.c
+++ b/src/mesa/main/texstorage.c
@@ -192,9 +192,10 @@ setup_texstorage(struct gl_context *ctx,
 
          return;
       }
-   }
 
-   texObj->Immutable = GL_TRUE;
+      /* Only set this field for non-proxy texture objects */
+      texObj->Immutable = GL_TRUE;
+   }
 }
 
 
@@ -242,7 +243,6 @@ tex_storage_error_check(struct gl_context *ctx, GLuint dims, GLenum target,
                         GLsizei levels, GLenum internalformat,
                         GLsizei width, GLsizei height, GLsizei depth)
 {
-   const GLboolean isProxy = _mesa_is_proxy_texture(target);
    struct gl_texture_object *texObj;
    GLuint maxDim;
    GLboolean legalFormat;
@@ -296,19 +296,15 @@ tex_storage_error_check(struct gl_context *ctx, GLuint dims, GLenum target,
 
    /* size check */
    if (width < 1 || height < 1 || depth < 1) {
-      if (!isProxy) {
-         _mesa_error(ctx, GL_INVALID_VALUE,
-                     "glTexStorage%uD(width, height or depth < 1)", dims);
-      }
+      _mesa_error(ctx, GL_INVALID_VALUE,
+                  "glTexStorage%uD(width, height or depth < 1)", dims);
       return GL_TRUE;
    }  
 
    /* levels check */
    if (levels < 1 || height < 1 || depth < 1) {
-      if (!isProxy) {
-         _mesa_error(ctx, GL_INVALID_VALUE, "glTexStorage%uD(levels < 1)",
-                     dims);
-      }
+      _mesa_error(ctx, GL_INVALID_VALUE, "glTexStorage%uD(levels < 1)",
+                  dims);
       return GL_TRUE;
    }  
 
@@ -322,40 +318,32 @@ tex_storage_error_check(struct gl_context *ctx, GLuint dims, GLenum target,
 
    /* check levels against maximum */
    if (levels > _mesa_max_texture_levels(ctx, target)) {
-      if (!isProxy) {
-         _mesa_error(ctx, GL_INVALID_OPERATION,
-                     "glTexStorage%uD(levels too large)", dims);
-      }
+      _mesa_error(ctx, GL_INVALID_OPERATION,
+                  "glTexStorage%uD(levels too large)", dims);
       return GL_TRUE;
    }
 
    /* check levels against width/height/depth */
    maxDim = MAX3(width, height, depth);
    if (levels > _mesa_logbase2(maxDim) + 1) {
-      if (!isProxy) {
-         _mesa_error(ctx, GL_INVALID_OPERATION,
-                     "glTexStorage%uD(too many levels for max texture dimension)",
-                     dims);
-      }
+      _mesa_error(ctx, GL_INVALID_OPERATION,
+                  "glTexStorage%uD(too many levels for max texture dimension)",
+                  dims);
       return GL_TRUE;
    }
 
    /* non-default texture object check */
    texObj = _mesa_get_current_tex_object(ctx, target);
-   if (!texObj || (texObj->Name == 0 && !isProxy)) {
-      if (!isProxy) {
-         _mesa_error(ctx, GL_INVALID_OPERATION,
-                     "glTexStorage%uD(texture object 0)", dims);
-      }
+   if (!texObj || (texObj->Name == 0)) {
+      _mesa_error(ctx, GL_INVALID_OPERATION,
+                  "glTexStorage%uD(texture object 0)", dims);
       return GL_TRUE;
    }
 
    /* Check if texObj->Immutable is set */
    if (texObj->Immutable) {
-      if (!isProxy) {
-         _mesa_error(ctx, GL_INVALID_OPERATION, "glTexStorage%uD(immutable)",
-                     dims);
-      }
+      _mesa_error(ctx, GL_INVALID_OPERATION, "glTexStorage%uD(immutable)",
+                  dims);
       return GL_TRUE;
    }
 
@@ -371,22 +359,38 @@ texstorage(GLuint dims, GLenum target, GLsizei levels, GLenum internalformat,
            GLsizei width, GLsizei height, GLsizei depth)
 {
    struct gl_texture_object *texObj;
-   GLboolean error;
+   GLboolean sizeOK;
+   GLenum proxyTarget = _mesa_get_proxy_target(target);
 
    GET_CURRENT_CONTEXT(ctx);
 
    texObj = _mesa_get_current_tex_object(ctx, target);
 
-   error = tex_storage_error_check(ctx, dims, target, levels,
-                                   internalformat, width, height, depth);
-   if (!error) {
+   if (tex_storage_error_check(ctx, dims, target, levels,
+                               internalformat, width, height, depth)) {
+      return; /* error was recorded */
+   }
+
+   sizeOK = ctx->Driver.TestProxyTexImage(ctx, proxyTarget, 0,
+                                          internalformat, GL_NONE, GL_NONE,
+                                          width, height, depth, 0);
+
+   if (!sizeOK) {
+      if (_mesa_is_proxy_texture(texObj->Target)) {
+         /* clear all image fields for [levels] */
+         clear_image_fields(ctx, dims, texObj);
+      }
+      else {
+         _mesa_error(ctx, GL_INVALID_VALUE,
+                     "glTexStorage%uD(invalid width, height or depth)",
+                     dims);
+         return;
+      }
+   }
+   else {
       setup_texstorage(ctx, texObj, dims, levels, internalformat,
                        width, height, depth);
    }
-   else if (_mesa_is_proxy_texture(target)) {
-      /* clear all image fields for [levels] */
-      clear_image_fields(ctx, dims, texObj);
-   }
 }
 
 

commit f9bb66b1cee2272b20ff3086e84d17026b8e8bb9
Author: Brian Paul <brianp@vmware.com>
Date:   Sat Sep 8 09:46:14 2012 -0600

    mesa: make _mesa_get_proxy_target() non-static
    
    Needed for the next patch.
    
    Note: This is a candidate for the stable branches.
    (cherry picked from commit d17440dcaa42ac4c19dad1be7d4c7199395135a9)

diff --git a/src/mesa/main/teximage.c b/src/mesa/main/teximage.c
index 664bb6d..cbbb8e7 100644
--- a/src/mesa/main/teximage.c
+++ b/src/mesa/main/teximage.c
@@ -660,8 +660,8 @@ _mesa_is_proxy_texture(GLenum target)
 /**
  * Return the proxy target which corresponds to the given texture target
  */
-static GLenum
-get_proxy_target(GLenum target)
+GLenum
+_mesa_get_proxy_target(GLenum target)
 {
    switch (target) {
    case GL_TEXTURE_1D:
@@ -692,7 +692,7 @@ get_proxy_target(GLenum target)
    case GL_PROXY_TEXTURE_2D_ARRAY_EXT:
       return GL_PROXY_TEXTURE_2D_ARRAY_EXT;
    default:
-      _mesa_problem(NULL, "unexpected target in get_proxy_target()");
+      _mesa_problem(NULL, "unexpected target in _mesa_get_proxy_target()");
       return 0;
    }
 }
@@ -1703,7 +1703,7 @@ texture_error_check( struct gl_context *ctx,
                      GLint width, GLint height,
                      GLint depth, GLint border )
 {
-   const GLenum proxyTarget = get_proxy_target(target);
+   const GLenum proxyTarget = _mesa_get_proxy_target(target);
    const GLboolean isProxy = target == proxyTarget;
    GLboolean sizeOK = GL_TRUE;
    GLboolean colorFormat;
@@ -1933,7 +1933,7 @@ compressed_texture_error_check(struct gl_context *ctx, GLint dimensions,
                                GLsizei height, GLsizei depth, GLint border,
                                GLsizei imageSize)
 {
-   const GLenum proxyTarget = get_proxy_target(target);
+   const GLenum proxyTarget = _mesa_get_proxy_target(target);
    const GLint maxLevels = _mesa_max_texture_levels(ctx, target);
    GLint expectedSize;
    GLenum choose_format;
@@ -2308,7 +2308,7 @@ copytexture_error_check( struct gl_context *ctx, GLuint dimensions,
                          GLenum target, GLint level, GLint internalFormat,
                          GLint width, GLint height, GLint border )
 {
-   const GLenum proxyTarget = get_proxy_target(target);
+   const GLenum proxyTarget = _mesa_get_proxy_target(target);
    const GLenum type = GL_FLOAT;
    GLboolean sizeOK;
    GLint baseFormat;
diff --git a/src/mesa/main/teximage.h b/src/mesa/main/teximage.h
index feaaf0c..36fd1c2 100644
--- a/src/mesa/main/teximage.h
+++ b/src/mesa/main/teximage.h
@@ -66,6 +66,8 @@ _mesa_base_tex_format( struct gl_context *ctx, GLint internalFormat );
 extern GLboolean
 _mesa_is_proxy_texture(GLenum target);
 
+extern GLenum
+_mesa_get_proxy_target(GLenum target);
 
 extern struct gl_texture_image *
 _mesa_new_texture_image( struct gl_context *ctx );

commit 10b9a02952ff0918c40024326228324704992329
Author: Brian Paul <brianp@vmware.com>
Date:   Sat Sep 8 09:27:46 2012 -0600

    mesa: do internal format error checking for glTexStorage()
    
    Turns out we weren't doing any format checking before.  Now check
    the internal format and, in particular, make sure that unsized internal
    formats aren't accepted.
    
    Note: This is a candidate for the stable branches.
    (cherry picked from commit 2e4fc54977977e674ee77294e6632a24e594d17f)

diff --git a/src/mesa/main/texstorage.c b/src/mesa/main/texstorage.c
index f8af8bf..8e03e5e 100644
--- a/src/mesa/main/texstorage.c
+++ b/src/mesa/main/texstorage.c
@@ -245,6 +245,54 @@ tex_storage_error_check(struct gl_context *ctx, GLuint dims, GLenum target,
    const GLboolean isProxy = _mesa_is_proxy_texture(target);
    struct gl_texture_object *texObj;
    GLuint maxDim;
+   GLboolean legalFormat;
+
+   /* check internal format - note that only sized formats are allowed */
+   switch (internalformat) {
+   case GL_ALPHA:
+   case GL_LUMINANCE:
+   case GL_LUMINANCE_ALPHA:
+   case GL_INTENSITY:
+   case GL_RED:
+   case GL_RG:
+   case GL_RGB:
+   case GL_RGBA:
+   case GL_BGRA:
+   case GL_DEPTH_COMPONENT:
+   case GL_DEPTH_STENCIL:
+   case GL_COMPRESSED_ALPHA:
+   case GL_COMPRESSED_LUMINANCE_ALPHA:
+   case GL_COMPRESSED_LUMINANCE:
+   case GL_COMPRESSED_INTENSITY:
+   case GL_COMPRESSED_RGB:
+   case GL_COMPRESSED_RGBA:
+   case GL_COMPRESSED_SRGB:
+   case GL_COMPRESSED_SRGB_ALPHA:
+   case GL_COMPRESSED_SLUMINANCE:
+   case GL_COMPRESSED_SLUMINANCE_ALPHA:
+   case GL_RED_INTEGER:
+   case GL_GREEN_INTEGER:
+   case GL_BLUE_INTEGER:
+   case GL_ALPHA_INTEGER:
+   case GL_RGB_INTEGER:
+   case GL_RGBA_INTEGER:
+   case GL_BGR_INTEGER:
+   case GL_BGRA_INTEGER:
+   case GL_LUMINANCE_INTEGER_EXT:
+   case GL_LUMINANCE_ALPHA_INTEGER_EXT:
+      /* these unsized formats are illegal */
+      legalFormat = GL_FALSE;
+      break;
+   default:
+      legalFormat = _mesa_base_tex_format(ctx, internalformat) > 0;
+   }
+
+   if (!legalFormat) {
+      _mesa_error(ctx, GL_INVALID_ENUM,
+                  "glTexStorage%uD(internalformat = %s)", dims,
+                  _mesa_lookup_enum_by_nr(internalformat));
+      return GL_TRUE;
+   }
 
    /* size check */
    if (width < 1 || height < 1 || depth < 1) {

commit 1f4d074f75055fd9591c5b5506727000e4a5526d
Author: Paul Berry <stereotype441@gmail.com>
Date:   Wed Sep 5 16:07:16 2012 -0700

    mesa/msaa: Allow X and Y flips in multisampled blits.
    
    From the GL 4.3 spec, section 18.3.1 "Blitting Pixel Rectangles":
    
        If SAMPLE_BUFFERS for either the read framebuffer or draw
        framebuffer is greater than zero, no copy is performed and an
        INVALID_OPERATION error is generated if the dimensions of the
        source and destination rectangles provided to BlitFramebuffer are
        not identical, or if the formats of the read and draw framebuffers
        are not identical.
    
    It is not clear from the spec whether "dimensions" should mean both
    sign and magnitude, or just magnitude.
    
    Previously, Mesa interpreted "dimensions" as meaning both sign and
    magnitude, so any multisampled blit that attempted to flip the image
    in the X and/or Y direction would fail.
    
    However, Y flips are likely to be commonplace in OpenGL applications
    that have been ported from DirectX applications, as a result of the
    fact that DirectX and OpenGL differ in their orientation of the Y
    axis.  Furthermore, at least one commercial driver (nVidia) permits Y
    filps, and L4D2 relies on them being permitted.  So it seems prudent
    for Mesa to permit them.
    
    This patch changes Mesa to allow both X and Y flips, since there is no
    language in the spec to indicate that X and Y flips should be treated
    differently.
    
    NOTE: This is a candidate for stable release branches.
    
    Reviewed-by: Kenneth Graunke <kenneth@whitecape.org>
    Reviewed-by: Anuj Phogat <anuj.phogat@gmail.com>
    (cherry picked from commit 5d5f0f349135786cdd76b6004f38b12e50d7f8f9)

diff --git a/src/mesa/main/fbobject.c b/src/mesa/main/fbobject.c
index 59a5ec3..abc9d83 100644
--- a/src/mesa/main/fbobject.c
+++ b/src/mesa/main/fbobject.c
@@ -2979,8 +2979,8 @@ _mesa_BlitFramebufferEXT(GLint srcX0, GLint srcY0, GLint srcX1, GLint srcY1,
    /* extra checks for multisample copies... */
    if (readFb->Visual.samples > 0 || drawFb->Visual.samples > 0) {
       /* src and dest region sizes must be the same */
-      if (srcX1 - srcX0 != dstX1 - dstX0 ||
-          srcY1 - srcY0 != dstY1 - dstY0) {
+      if (abs(srcX1 - srcX0) != abs(dstX1 - dstX0) ||
+          abs(srcY1 - srcY0) != abs(dstY1 - dstY0)) {
          _mesa_error(ctx, GL_INVALID_OPERATION,
                 "glBlitFramebufferEXT(bad src/dst multisample region sizes)");
          return;

commit 42ef3f68c9621eb713f154955dccabacd6e1e0ef
Author: Kenneth Graunke <kenneth@whitecape.org>
Date:   Fri Aug 31 16:04:19 2012 -0700

    glsl: Generate compile errors for explicit blend indices < 0 or > 1.
    
    According to the GLSL 4.30 specification, this is a compile time error.
    Earlier specifications don't specify a behavior, but since 0 and 1 are
    the only valid indices for dual source blending, it makes sense to
    generate the error.
    
    Fixes (the fixed version of) piglit's layout-12.frag.
    
    NOTE: This is a candidate for the 9.0 branch.
    
    Signed-off-by: Kenneth Graunke <kenneth@whitecape.org>
    Reviewed-by: Paul Berry <stereotype441@gmail.com>
    (cherry picked from commit 354f2cb5c7330a7d43cf0b177daf758d2aa31e0a)

diff --git a/src/glsl/ast_to_hir.cpp b/src/glsl/ast_to_hir.cpp
index 02fe66b..5157661 100644
--- a/src/glsl/ast_to_hir.cpp
+++ b/src/glsl/ast_to_hir.cpp
@@ -2086,9 +2086,24 @@ apply_type_qualifier_to_variable(const struct ast_type_qualifier *qual,
 	 } else {
 	    var->location = qual->location;
 	 }
+
 	 if (qual->flags.q.explicit_index) {
-	    var->explicit_index = true;
-	    var->index = qual->index;
+            /* From the GLSL 4.30 specification, section 4.4.2 (Output
+             * Layout Qualifiers):
+             *
+             * "It is also a compile-time error if a fragment shader
+             *  sets a layout index to less than 0 or greater than 1."
+             *
+             * Older specifications don't mandate a behavior; we take
+             * this as a clarification and always generate the error.
+             */
+            if (qual->index < 0 || qual->index > 1) {
+               _mesa_glsl_error(loc, state,
+                                "explicit index may only be 0 or 1\n");
+            } else {
+               var->explicit_index = true;
+               var->index = qual->index;
+            }
 	 }
       }
    } else if (qual->flags.q.explicit_index) {

commit e2b4f9aac38b6fcd8eacef24afab47e9d346ba22
Author: Eric Anholt <eric@anholt.net>
Date:   Wed Sep 5 22:10:41 2012 -0700

    i965: Fix virtual_grf_interferes() between calculate_live_intervals() and DCE.
    
    This fixes the blue zombies bug in l4d2.
    
    NOTE: This is a candidate for the 9.0 branch.
    Reviewed-by: Kenneth Graunke <kenneth@whitecape.org>
    (cherry picked from commit 39aca5076fa0e31d418b481167063933f5f7b74f)

diff --git a/src/mesa/drivers/dri/i965/brw_fs_live_variables.cpp b/src/mesa/drivers/dri/i965/brw_fs_live_variables.cpp
index 16480ad..392691d 100644
--- a/src/mesa/drivers/dri/i965/brw_fs_live_variables.cpp
+++ b/src/mesa/drivers/dri/i965/brw_fs_live_variables.cpp
@@ -221,6 +221,30 @@ fs_visitor::calculate_live_intervals()
    }
 
    this->live_intervals_valid = true;
+
+   /* Note in the non-control-flow code above, that we only take def[] as the
+    * first store, and use[] as the last use.  We use this in dead code
+    * elimination, to determine when a store never gets used.  However, we
+    * also use these arrays to answer the virtual_grf_interferes() question
+    * (live interval analysis), which is used for register coalescing and
+    * register allocation.
+    *
+    * So, there's a conflict over what the array should mean: if use[]
+    * considers a def after the last use, then the dead code elimination pass
+    * never does anything (and it's an important pass!).  But if we don't
+    * include dead code, then virtual_grf_interferes() lies and we'll do
+    * horrible things like coalesce the register that is dead-code-written
+    * into another register that was live across the dead write (causing the
+    * use of the second register to take the dead write's source value instead
+    * of the coalesced MOV's source value).
+    *
+    * To resolve the conflict, immediately after calculating live intervals,
+    * detect dead code, nuke it, and if we changed anything, calculate again
+    * before returning to the caller.  Now we happen to produce def[] and
+    * use[] arrays that will work for virtual_grf_interferes().
+    */
+   if (dead_code_eliminate())
+      calculate_live_intervals();
 }
 
 bool

commit 8b8416676e959d2ef4ade0d52aa7792641a5ed6c
Author: Brian Paul <brianp@vmware.com>
Date:   Thu Sep 6 08:16:56 2012 -0600

    glapi/glx: rename 'table' variable to 'disp_table'
    
    This fixes an issue where the local 'table' variable was hiding the
    function parameter name in glGetColorTable(..., void *table).
    
    This should be OK as long as there's never a GL entrypoint that uses
    'disp_table' as a parameter name.
    
    Note: This is a candidate for the 9.0 branch.
    
    Reviewed-by: Jose Fonseca <jfonseca@vmware.com>
    (cherry picked from commit 043f66204b1a190e18747c3befa8826c82dd87a7)

diff --git a/src/mapi/glapi/gen/glX_proto_send.py b/src/mapi/glapi/gen/glX_proto_send.py
index c533592..ae12c45 100644
--- a/src/mapi/glapi/gen/glX_proto_send.py
+++ b/src/mapi/glapi/gen/glX_proto_send.py
@@ -423,9 +423,9 @@ __indirect_get_proc_address(const char *name)
 				print ''
 				print '#if defined(GLX_DIRECT_RENDERING) && !defined(GLX_USE_APPLEGL)'
 				print '    if (gc->isDirect) {'
-				print '        const _glapi_proc *const table = GET_DISPATCH();'
+				print '        const _glapi_proc *const disp_table = GET_DISPATCH();'
 				print '        PFNGL%sPROC p =' % (name.upper())
-				print '            (PFNGL%sPROC) table[%d];' % (name.upper(), func.offset)
+				print '            (PFNGL%sPROC) disp_table[%d];' % (name.upper(), func.offset)
 				print '    %sp(%s);' % (ret_string, func.get_called_parameter_string())
 				print '    } else'
 				print '#endif'

commit 6e9baa85a95495e9343ca899a808d264076d67f8
Author: Brian Paul <brianp@vmware.com>
Date:   Tue Sep 4 20:17:15 2012 -0600

    mesa: fix per-level max texture size error checking
    
    This is a long-standing omission in Mesa's texture image size checking.
    We need to take the mipmap level into consideration when checking if the
    width, height and depth are too large.
    
    Fixes the new piglit max-texture-size-level test.
    Thanks to Stéphane Marchesin for finding this problem.
    
    Note: This is a candidate for the stable branches.
    
    Reviewed-by: Michel Dänzer <michel.daenzer@amd.com>
    (cherry picked from commit 771e7b6d884bb4294a89f276a904d90b28efb90a)

diff --git a/src/mesa/main/teximage.c b/src/mesa/main/teximage.c
index 11b1b30..664bb6d 100644
--- a/src/mesa/main/teximage.c
+++ b/src/mesa/main/teximage.c
@@ -1247,11 +1247,12 @@ _mesa_test_proxy_teximage(struct gl_context *ctx, GLenum target, GLint level,
 
    switch (target) {
    case GL_PROXY_TEXTURE_1D:
-      maxSize = 1 << (ctx->Const.MaxTextureLevels - 1);
-      if (width < 2 * border || width > 2 * border + maxSize)
-         return GL_FALSE;
       if (level >= ctx->Const.MaxTextureLevels)
          return GL_FALSE;
+      maxSize = 1 << (ctx->Const.MaxTextureLevels - 1); /* level zero size */
+      maxSize >>= level;  /* level size */
+      if (width < 2 * border || width > 2 * border + maxSize)
+         return GL_FALSE;
       if (!ctx->Extensions.ARB_texture_non_power_of_two) {
          if (width > 0 && !_mesa_is_pow_two(width - 2 * border))
             return GL_FALSE;
@@ -1259,13 +1260,14 @@ _mesa_test_proxy_teximage(struct gl_context *ctx, GLenum target, GLint level,
       return GL_TRUE;
 
    case GL_PROXY_TEXTURE_2D:
+      if (level >= ctx->Const.MaxTextureLevels)
+         return GL_FALSE;
       maxSize = 1 << (ctx->Const.MaxTextureLevels - 1);
+      maxSize >>= level;
       if (width < 2 * border || width > 2 * border + maxSize)
          return GL_FALSE;
       if (height < 2 * border || height > 2 * border + maxSize)
          return GL_FALSE;
-      if (level >= ctx->Const.MaxTextureLevels)
-         return GL_FALSE;
       if (!ctx->Extensions.ARB_texture_non_power_of_two) {
          if (width > 0 && !_mesa_is_pow_two(width - 2 * border))
             return GL_FALSE;
@@ -1275,15 +1277,16 @@ _mesa_test_proxy_teximage(struct gl_context *ctx, GLenum target, GLint level,
       return GL_TRUE;
 
    case GL_PROXY_TEXTURE_3D:
+      if (level >= ctx->Const.Max3DTextureLevels)
+         return GL_FALSE;
       maxSize = 1 << (ctx->Const.Max3DTextureLevels - 1);
+      maxSize >>= level;
       if (width < 2 * border || width > 2 * border + maxSize)
          return GL_FALSE;
       if (height < 2 * border || height > 2 * border + maxSize)
          return GL_FALSE;
       if (depth < 2 * border || depth > 2 * border + maxSize)
          return GL_FALSE;
-      if (level >= ctx->Const.Max3DTextureLevels)
-         return GL_FALSE;
       if (!ctx->Extensions.ARB_texture_non_power_of_two) {
          if (width > 0 && !_mesa_is_pow_two(width - 2 * border))
             return GL_FALSE;
@@ -1295,23 +1298,24 @@ _mesa_test_proxy_teximage(struct gl_context *ctx, GLenum target, GLint level,
       return GL_TRUE;
 
    case GL_PROXY_TEXTURE_RECTANGLE_NV:
+      if (level != 0)
+         return GL_FALSE;
       maxSize = ctx->Const.MaxTextureRectSize;
       if (width < 0 || width > maxSize)
          return GL_FALSE;
       if (height < 0 || height > maxSize)
          return GL_FALSE;
-      if (level != 0)
-         return GL_FALSE;
       return GL_TRUE;
 
    case GL_PROXY_TEXTURE_CUBE_MAP_ARB:
+      if (level >= ctx->Const.MaxCubeTextureLevels)
+         return GL_FALSE;
       maxSize = 1 << (ctx->Const.MaxCubeTextureLevels - 1);
+      maxSize >>= level;
       if (width < 2 * border || width > 2 * border + maxSize)
          return GL_FALSE;
       if (height < 2 * border || height > 2 * border + maxSize)
          return GL_FALSE;
-      if (level >= ctx->Const.MaxCubeTextureLevels)
-         return GL_FALSE;
       if (!ctx->Extensions.ARB_texture_non_power_of_two) {
          if (width > 0 && !_mesa_is_pow_two(width - 2 * border))
             return GL_FALSE;
@@ -1321,13 +1325,14 @@ _mesa_test_proxy_teximage(struct gl_context *ctx, GLenum target, GLint level,
       return GL_TRUE;
 
    case GL_PROXY_TEXTURE_1D_ARRAY_EXT:
+      if (level >= ctx->Const.MaxTextureLevels)
+         return GL_FALSE;
       maxSize = 1 << (ctx->Const.MaxTextureLevels - 1);
+      maxSize >>= level;
       if (width < 2 * border || width > 2 * border + maxSize)
          return GL_FALSE;
       if (height < 1 || height > ctx->Const.MaxArrayTextureLayers)
          return GL_FALSE;
-      if (level >= ctx->Const.MaxTextureLevels)
-         return GL_FALSE;
       if (!ctx->Extensions.ARB_texture_non_power_of_two) {
          if (width > 0 && !_mesa_is_pow_two(width - 2 * border))
             return GL_FALSE;
@@ -1335,15 +1340,16 @@ _mesa_test_proxy_teximage(struct gl_context *ctx, GLenum target, GLint level,
       return GL_TRUE;
 
    case GL_PROXY_TEXTURE_2D_ARRAY_EXT:
+      if (level >= ctx->Const.MaxTextureLevels)
+         return GL_FALSE;
       maxSize = 1 << (ctx->Const.MaxTextureLevels - 1);
+      maxSize >>= level;
       if (width < 2 * border || width > 2 * border + maxSize)
          return GL_FALSE;
       if (height < 2 * border || height > 2 * border + maxSize)
          return GL_FALSE;
       if (depth < 1 || depth > ctx->Const.MaxArrayTextureLayers)
          return GL_FALSE;
-      if (level >= ctx->Const.MaxTextureLevels)
-         return GL_FALSE;
       if (!ctx->Extensions.ARB_texture_non_power_of_two) {
          if (width > 0 && !_mesa_is_pow_two(width - 2 * border))
             return GL_FALSE;

commit 3f6ce3454f4d1331234f74670c82595f84269b1b
Author: Brian Paul <brianp@vmware.com>
Date:   Thu Aug 30 16:12:53 2012 -0600

    st/mesa: s/CALLOC/calloc/ to fix allocation bug
    
    The CALLOC() macro only takes one argument so this was being treated
    as a comma expression.  Simply use calloc() instead.
    
    A follow-on patch will replace all CALLOC() calls with calloc().
    
    NOTE: This is a candidate for the 8.0 and 9.0 branches.
    (cherry picked from commit 43ed822a50db6b980041ddf91c16c7f8fccc4092)

diff --git a/src/mesa/state_tracker/st_mesa_to_tgsi.c b/src/mesa/state_tracker/st_mesa_to_tgsi.c
index 4d99b17..5604714 100644
--- a/src/mesa/state_tracker/st_mesa_to_tgsi.c
+++ b/src/mesa/state_tracker/st_mesa_to_tgsi.c
@@ -1198,7 +1198,7 @@ st_translate_mesa_program(
     * for these, so we put all the translated regs in t->constants.
     */
    if (program->Parameters) {
-      t->constants = CALLOC( program->Parameters->NumParameters,
+      t->constants = calloc( program->Parameters->NumParameters,
                              sizeof t->constants[0] );
       if (t->constants == NULL) {
          ret = PIPE_ERROR_OUT_OF_MEMORY;

commit 7f011e20758b1f4552d56dd40204605f7ae0e3c3
Author: Johannes Obermayr <johannesobermayr@gmx.de>
Date:   Sun Sep 2 01:35:47 2012 +0200

    Set OSMESA_VERSION=8.
    
    VERSION_NUMBER is not required anymore. So it will be removed.
    
    Reviewed-by: Adam Jackson <ajax@redhat.com>
    (cherry picked from commit 10a96f4a4d3d3166fa6907d4b302e01ece5ccd7e)

diff --git a/configure.ac b/configure.ac
index 82fe225..55e5251 100644
--- a/configure.ac
+++ b/configure.ac
@@ -26,6 +26,10 @@ m4_ifdef([AM_PROG_AR], [AM_PROG_AR])
 LT_PREREQ([2.2])
 LT_INIT([disable-static])
 
+dnl Set internal versions
+OSMESA_VERSION=8
+AC_SUBST([OSMESA_VERSION])
+
 dnl Versions for external dependencies
 LIBDRM_REQUIRED=2.4.24
 LIBDRM_RADEON_REQUIRED=2.4.39
@@ -1920,10 +1924,6 @@ AM_CONDITIONAL(HAVE_X86_ASM, echo "$DEFINES" | grep 'X86_ASM' >/dev/null 2>&1)
 AM_CONDITIONAL(HAVE_X86_64_ASM, echo "$DEFINES" | grep 'X86_64_ASM' >/dev/null 2>&1)
 AM_CONDITIONAL(HAVE_SPARC_ASM, echo "$DEFINES" | grep 'SPARC_ASM' >/dev/null 2>&1)
 
-# To pass as an argument to libtool's -version-number flag
-VERSION_NUMBER=`echo "$VERSION" | $SED 's/\./:/g'`
-AC_SUBST([VERSION_NUMBER])
-
 dnl prepend CORE_DIRS to SRC_DIRS
 SRC_DIRS="$CORE_DIRS $SRC_DIRS"
 
diff --git a/src/mesa/drivers/osmesa/Makefile.am b/src/mesa/drivers/osmesa/Makefile.am
index db1d14f..6d087f2 100644
--- a/src/mesa/drivers/osmesa/Makefile.am
+++ b/src/mesa/drivers/osmesa/Makefile.am
@@ -35,7 +35,7 @@ lib_LTLIBRARIES = lib@OSMESA_LIB@.la
 
 lib@OSMESA_LIB@_la_SOURCES = osmesa.c
 
-lib@OSMESA_LIB@_la_LDFLAGS = -module -version-number @VERSION_NUMBER@ -no-undefined
+lib@OSMESA_LIB@_la_LDFLAGS = -module -version-number @OSMESA_VERSION@ -no-undefined
 lib@OSMESA_LIB@_la_LIBADD = \
 	$(top_builddir)/src/mesa/libmesa.la \
 	$(top_builddir)/src/mapi/glapi/libglapi.la
@@ -46,7 +46,7 @@ if BUILD_SHARED
 all-local: lib@OSMESA_LIB@.la
 	$(MKDIR_P) $(top_builddir)/$(LIB_DIR);
 	ln -f .libs/lib@OSMESA_LIB@.so $(top_builddir)/$(LIB_DIR)/lib@OSMESA_LIB@.so;
-	ln -f .libs/lib@OSMESA_LIB@.so.@VERSION@ $(top_builddir)/$(LIB_DIR)/lib@OSMESA_LIB@.so.@VERSION@;
+	ln -f .libs/lib@OSMESA_LIB@.so.@OSMESA_VERSION@ $(top_builddir)/$(LIB_DIR)/lib@OSMESA_LIB@.so.@OSMESA_VERSION@;
 endif
 
 pkgconfigdir = $(libdir)/pkgconfig
diff --git a/src/mesa/drivers/osmesa/osmesa.pc.in b/src/mesa/drivers/osmesa/osmesa.pc.in
index 307255f..cd77fd7 100644
--- a/src/mesa/drivers/osmesa/osmesa.pc.in
+++ b/src/mesa/drivers/osmesa/osmesa.pc.in
@@ -6,7 +6,7 @@ includedir=@includedir@
 Name: osmesa
 Description: Mesa Off-screen Rendering library
 Requires: @OSMESA_PC_REQ@
-Version: @PACKAGE_VERSION@
+Version: @OSMESA_VERSION@
 Libs: -L${libdir} -l@OSMESA_LIB@
 Libs.private: @OSMESA_PC_LIB_PRIV@
 Cflags: -I${includedir}

commit 41d14eaf193c6b1eb87fe1998808a887f1c6c698
Author: Jerome Glisse <jglisse@redhat.com>
Date:   Thu Sep 6 15:09:21 2012 -0400

    r600g: fix num of dwords needed for alphatest_state atom
    
    Signed-off-by: Jerome Glisse <jglisse@redhat.com>

diff --git a/src/gallium/drivers/r600/r600_state_common.c b/src/gallium/drivers/r600/r600_state_common.c
index 68f53c6..26af6f6 100644
--- a/src/gallium/drivers/r600/r600_state_common.c
+++ b/src/gallium/drivers/r600/r600_state_common.c
@@ -108,7 +108,7 @@ void r600_init_common_atoms(struct r600_context *rctx)
 {
 	r600_init_atom(&rctx->surface_sync_cmd.atom,	r600_emit_surface_sync,		5, EMIT_EARLY);
 	r600_init_atom(&rctx->r6xx_flush_and_inv_cmd,	r600_emit_r6xx_flush_and_inv,	2, EMIT_EARLY);
-	r600_init_atom(&rctx->alphatest_state.atom,	r600_emit_alphatest_state,	3, 0);
+	r600_init_atom(&rctx->alphatest_state.atom,	r600_emit_alphatest_state,	6, 0);
 	r600_atom_dirty(rctx, &rctx->alphatest_state.atom);
 }
 

commit 13b8eb64523a70af30b576271886a737f51dbe40
Author: Chad Versace <chad.versace@linux.intel.com>
Date:   Tue Sep 4 10:02:43 2012 -0700

    mesa: Don't advertise GLES extensions in GL contexts
    
    glGetStringi(GL_EXTENSIONS) failed to respect the context's API, and so
    returned all internally enabled GLES extensions from a GL context.
    Likewise, glGetIntegerv(GL_NUM_EXTENSIONS) also failed to repsect the
    context's API.
    
    Note: This is a candidate for the 8.0 and 9.0 branches.
    Reviewed-by: Kenneth Graunke <kenneth@whitecape.org>
    Reviewed-by: Ian Romanick <ian.d.romanick@intel.com>
    Signed-off-by: Chad Versace <chad.versace@linux.intel.com>
    (cherry picked from commit f29a4b0157c6a7a31d2a2991a431b4211d01d162)

diff --git a/src/mesa/main/extensions.c b/src/mesa/main/extensions.c
index 7e116bd..3d52eb8 100644
--- a/src/mesa/main/extensions.c
+++ b/src/mesa/main/extensions.c
@@ -927,7 +927,7 @@ _mesa_get_extension_count(struct gl_context *ctx)
 
    base = (GLboolean *) &ctx->Extensions;
    for (i = extension_table; i->name != 0; ++i) {
-      if (base[i->offset]) {
+      if (base[i->offset] && (i->api_set & (1 << ctx->API))) {
 	 ctx->Extensions.Count++;
       }
    }
@@ -947,10 +947,11 @@ _mesa_get_enabled_extension(struct gl_context *ctx, GLuint index)
    base = (GLboolean*) &ctx->Extensions;
    n = 0;
    for (i = extension_table; i->name != 0; ++i) {
-      if (n == index && base[i->offset]) {
-	 return (const GLubyte*) i->name;
-      } else if (base[i->offset]) {
-	 ++n;
+      if (base[i->offset] & (i->api_set & (1 << ctx->API))) {
+         if (n == index)
+            return (const GLubyte*) i->name;
+         else
+            ++n;
       }
    }
 

commit c7775e842bec815ede6badc35dbfe4991c183e3a
Author: Tapani Pälli <tapani.palli@intel.com>
Date:   Mon Aug 13 16:47:52 2012 +0300

    android: do not expose single buffered eglconfigs
    
    On Android we want to add only double buffered configs for visuals.
    Earlier implementation set the SurfaceType as 0 for single buffered
    configs but driver still exposed these configs that were not compatible
    with any egl surface type.  This caused Khronos conformance test runs to
    fail on Android. This patch fixes the issue by skipping single buffered
    configs earlier and not exposing them.
    
    Signed-off-by: Tapani Pälli <tapani.palli@intel.com>
    Signed-off-by: Chad Versace <chad.versace@linux.intel.com>
    (cherry picked from commit d58ca43b809593314907694e744780ab9b28d590)

diff --git a/src/egl/drivers/dri2/platform_android.c b/src/egl/drivers/dri2/platform_android.c
index 7e57295..15bf054 100644
--- a/src/egl/drivers/dri2/platform_android.c
+++ b/src/egl/drivers/dri2/platform_android.c
@@ -500,6 +500,14 @@ droid_add_configs_for_visuals(_EGLDriver *drv, _EGLDisplay *dpy)
       for (j = 0; dri2_dpy->driver_configs[j]; j++) {
          const EGLint surface_type = EGL_WINDOW_BIT | EGL_PBUFFER_BIT;
          struct dri2_egl_config *dri2_conf;
+         unsigned int double_buffered = 0;
+
+         dri2_dpy->core->getConfigAttrib(dri2_dpy->driver_configs[j],
+            __DRI_ATTRIB_DOUBLE_BUFFER, &double_buffered);
+
+         /* support only double buffered configs */
+         if (!double_buffered)
+            continue;
 
          dri2_conf = dri2_add_config(dpy, dri2_dpy->driver_configs[j],
                count + 1, visuals[i].size, surface_type, NULL,
@@ -525,17 +533,6 @@ droid_add_configs_for_visuals(_EGLDriver *drv, _EGLDisplay *dpy)
       /* there is no front buffer so no OpenGL */
       dri2_conf->base.RenderableType &= ~EGL_OPENGL_BIT;
       dri2_conf->base.Conformant &= ~EGL_OPENGL_BIT;
-
-      /*
-       * We want to make sure GL_DRAW_BUFFER for windows or pbuffers is always
-       * GL_BACK.  For EGL configs that do not have a double DRI config, clear
-       * the surface type.


Reply to: