Mesa (master): mesa: fix error handling in DrawBuffers

2016-10-24 Thread Tapani Pälli
Module: Mesa
Branch: master
Commit: a1652a059edc5a5f0f4b0836ba310a22e094bd85
URL:
http://cgit.freedesktop.org/mesa/mesa/commit/?id=a1652a059edc5a5f0f4b0836ba310a22e094bd85

Author: Tapani Pälli 
Date:   Fri Oct  7 10:08:21 2016 +0300

mesa: fix error handling in DrawBuffers

Patch rearranges error checking so that enum checking provided via
destmask happens before other checks. It needs to be done in this
order because other error checks do not work properly if there were
invalid enums passed.

Patch also refines one existing check and it's documentation to match
GLES 3.0 spec (also in later specs). This was somewhat mysteriously
referring to desktop GL but had a check for gles3.

Fixes following dEQP tests:

   dEQP-GLES31.functional.debug.negative_coverage.get_error.buffer.draw_buffers

no CI regressions observed.

Signed-off-by: Tapani Pälli 
Bugzilla: https://bugs.freedesktop.org/show_bug.cgi?id=98134
Cc: "12.0 13.0" 
Reviewed-by: Emil Velikov 

---

 src/mesa/main/buffers.c | 71 ++---
 1 file changed, 37 insertions(+), 34 deletions(-)

diff --git a/src/mesa/main/buffers.c b/src/mesa/main/buffers.c
index 86696b8..2b24e5a 100644
--- a/src/mesa/main/buffers.c
+++ b/src/mesa/main/buffers.c
@@ -389,17 +389,48 @@ draw_buffers(struct gl_context *ctx, struct 
gl_framebuffer *fb,
 
/* complicated error checking... */
for (output = 0; output < n; output++) {
-  /* Section 4.2 (Whole Framebuffer Operations) of the OpenGL 3.0
+  destMask[output] = draw_buffer_enum_to_bitmask(ctx, buffers[output]);
+
+  /* From the OpenGL 3.0 specification, page 258:
+   * "Each buffer listed in bufs must be one of the values from tables
+   *  4.5 or 4.6.  Otherwise, an INVALID_ENUM error is generated.
+   */
+  if (destMask[output] == BAD_MASK) {
+ _mesa_error(ctx, GL_INVALID_ENUM, "%s(invalid buffer %s)",
+ caller, _mesa_enum_to_string(buffers[output]));
+ return;
+  }
+
+  /* From the OpenGL 4.0 specification, page 256:
+   * "For both the default framebuffer and framebuffer objects, the
+   *  constants FRONT, BACK, LEFT, RIGHT, and FRONT_AND_BACK are not
+   *  valid in the bufs array passed to DrawBuffers, and will result in
+   *  the error INVALID_ENUM. This restriction is because these
+   *  constants may themselves refer to multiple buffers, as shown in
+   *  table 4.4."
+   *  Previous versions of the OpenGL specification say INVALID_OPERATION,
+   *  but the Khronos conformance tests expect INVALID_ENUM.
+   */
+  if (_mesa_bitcount(destMask[output]) > 1) {
+ _mesa_error(ctx, GL_INVALID_ENUM, "%s(invalid buffer %s)",
+ caller, _mesa_enum_to_string(buffers[output]));
+ return;
+  }
+
+  /* Section 4.2 (Whole Framebuffer Operations) of the OpenGL ES 3.0
* specification says:
*
-   * "Each buffer listed in bufs must be BACK, NONE, or one of the 
values
-   *  from table 4.3 (NONE, COLOR_ATTACHMENTi)"
+   * "If the GL is bound to a draw framebuffer object, the ith buffer
+   * listed in bufs must be COLOR_ATTACHMENTi or NONE . Specifying a
+   * buffer out of order, BACK , or COLOR_ATTACHMENTm where m is 
greater
+   * than or equal to the value of MAX_- COLOR_ATTACHMENTS , will
+   * generate the error INVALID_OPERATION .
*/
-  if (_mesa_is_gles3(ctx) && buffers[output] != GL_NONE &&
-  buffers[output] != GL_BACK &&
+  if (_mesa_is_gles3(ctx) && _mesa_is_user_fbo(fb) &&
+  buffers[output] != GL_NONE &&
   (buffers[output] < GL_COLOR_ATTACHMENT0 ||
buffers[output] >= GL_COLOR_ATTACHMENT0 + 
ctx->Const.MaxColorAttachments)) {
- _mesa_error(ctx, GL_INVALID_ENUM, "glDrawBuffers(buffer)");
+ _mesa_error(ctx, GL_INVALID_OPERATION, "glDrawBuffers(buffer)");
  return;
   }
 
@@ -423,34 +454,6 @@ draw_buffers(struct gl_context *ctx, struct gl_framebuffer 
*fb,
 return;
  }
 
- destMask[output] = draw_buffer_enum_to_bitmask(ctx, buffers[output]);
-
- /* From the OpenGL 3.0 specification, page 258:
-  * "Each buffer listed in bufs must be one of the values from tables
-  *  4.5 or 4.6.  Otherwise, an INVALID_ENUM error is generated.
-  */
- if (destMask[output] == BAD_MASK) {
-_mesa_error(ctx, GL_INVALID_ENUM, "%s(invalid buffer %s)",
-caller, _mesa_enum_to_string(buffers[output]));
-return;
- }
-
- /* From the OpenGL 4.0 specification, page 256:
-  * "For both the default framebuffer and framebuffer objects, the
-  *  constants FRONT, BACK, LEFT, RIGHT, and FRONT_AND_BACK are not
-  *  valid in the bufs array 

Mesa (master): mesa: add missing formats to driGLFormatToImageFormat

2016-10-24 Thread Tapani Pälli
Module: Mesa
Branch: master
Commit: 58b4fef8bb7b959ac0918d08a76c92c4c86cb262
URL:
http://cgit.freedesktop.org/mesa/mesa/commit/?id=58b4fef8bb7b959ac0918d08a76c92c4c86cb262

Author: Tapani Pälli 
Date:   Thu Oct 20 11:03:26 2016 +0300

mesa: add missing formats to driGLFormatToImageFormat

Fixes following dEQP tests:

   dEQP-EGL.functional.image.api.create_image_gles2_tex2d_luminance
   dEQP-EGL.functional.image.api.create_image_gles2_tex2d_luminance_alpha

Signed-off-by: Tapani Pälli 
Reviewed-by: Emil Velikov 
Bugzilla: https://bugs.freedesktop.org/show_bug.cgi?id=98328

---

 src/mesa/drivers/dri/common/dri_util.c | 2 ++
 1 file changed, 2 insertions(+)

diff --git a/src/mesa/drivers/dri/common/dri_util.c 
b/src/mesa/drivers/dri/common/dri_util.c
index 79cb050..3b81799 100644
--- a/src/mesa/drivers/dri/common/dri_util.c
+++ b/src/mesa/drivers/dri/common/dri_util.c
@@ -842,8 +842,10 @@ driGLFormatToImageFormat(mesa_format format)
   return __DRI_IMAGE_FORMAT_ABGR;
case MESA_FORMAT_R8G8B8X8_UNORM:
   return __DRI_IMAGE_FORMAT_XBGR;
+   case MESA_FORMAT_L_UNORM8:
case MESA_FORMAT_R_UNORM8:
   return __DRI_IMAGE_FORMAT_R8;
+   case MESA_FORMAT_L8A8_UNORM:
case MESA_FORMAT_R8G8_UNORM:
   return __DRI_IMAGE_FORMAT_GR88;
case MESA_FORMAT_NONE:

___
mesa-commit mailing list
mesa-commit@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/mesa-commit


Mesa (master): Revert "egl/android: Set EGL_MAX_PBUFFER_WIDTH and EGL_MAX_PBUFFER_HEIGHT"

2016-10-24 Thread Tapani Pälli
Module: Mesa
Branch: master
Commit: 1ef787339774bc7f1cc9c1615722f944005e070c
URL:
http://cgit.freedesktop.org/mesa/mesa/commit/?id=1ef787339774bc7f1cc9c1615722f944005e070c

Author: Tapani Pälli 
Date:   Thu Oct 20 19:57:01 2016 +0300

Revert "egl/android: Set EGL_MAX_PBUFFER_WIDTH and EGL_MAX_PBUFFER_HEIGHT"

This reverts commit b1d636aa007c0c354a217024b4befe15cfb5149f, previous
commit sets these values for all egl configs.

Signed-off-by: Tapani Pälli 
Cc: "12.0 13.0" 
Suggested-by: Emil Velikov 
Reviewed-by: Emil Velikov 

---

 src/egl/drivers/dri2/platform_android.c | 2 --
 1 file changed, 2 deletions(-)

diff --git a/src/egl/drivers/dri2/platform_android.c 
b/src/egl/drivers/dri2/platform_android.c
index 2dcc5b5..cf60f1d 100644
--- a/src/egl/drivers/dri2/platform_android.c
+++ b/src/egl/drivers/dri2/platform_android.c
@@ -766,8 +766,6 @@ droid_add_configs_for_visuals(_EGLDriver *drv, _EGLDisplay 
*dpy)
  EGL_NATIVE_VISUAL_TYPE, 0,
  EGL_FRAMEBUFFER_TARGET_ANDROID, EGL_TRUE,
  EGL_RECORDABLE_ANDROID, EGL_TRUE,
- EGL_MAX_PBUFFER_WIDTH, _EGL_MAX_PBUFFER_WIDTH,
- EGL_MAX_PBUFFER_HEIGHT, _EGL_MAX_PBUFFER_HEIGHT,
  EGL_NONE
};
unsigned int format_count[ARRAY_SIZE(visuals)] = { 0 };

___
mesa-commit mailing list
mesa-commit@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/mesa-commit


Mesa (master): egl: fix type mismatch error type in _eglInitSurface

2016-10-24 Thread Tapani Pälli
Module: Mesa
Branch: master
Commit: 282b87dd03317ff39eb409b0ac2cbdc17d7e5aa3
URL:
http://cgit.freedesktop.org/mesa/mesa/commit/?id=282b87dd03317ff39eb409b0ac2cbdc17d7e5aa3

Author: Tapani Pälli 
Date:   Thu Oct 20 13:51:40 2016 +0300

egl: fix type mismatch error type in _eglInitSurface

EGL spec defines EGL_BAD_MATCH for windows, pixmaps and pbuffers in
case where user creates a surface but config does not support rendering
to such surface type.

Following quotes are from EGL 1.5 spec 3.5 "Rendering Surfaces" :

for eglCreatePlatformWindowSurface, eglCreateWindowSurface:

   "If config does not support rendering to windows (the EGL_SURFACE_TYPE
   attribute does not contain EGL_WINDOW_BIT ), an EGL_BAD_MATCH error is
   generated."

for eglCreatePbufferSurface:

   "If config does not support pbuffers, an EGL_BAD_MATCH error is
   generated."

for eglCreatePlatformPixmapSurface, eglCreatePixmapSurface:

   "If config does not support rendering to pixmaps (the EGL_SURFACE_TYPE
   attribute does not contain EGL_PIXMAP_BIT ), an EGL_BAD_MATCH error is
   generated."

Fixes following dEQP test:

   dEQP-EGL.functional.negative_api.create_pbuffer_surface

Signed-off-by: Tapani Pälli 
Reviewed-by: Eric Engestrom 

---

 src/egl/main/eglsurface.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/src/egl/main/eglsurface.c b/src/egl/main/eglsurface.c
index 231a5f0..eb0bdfe 100644
--- a/src/egl/main/eglsurface.c
+++ b/src/egl/main/eglsurface.c
@@ -284,7 +284,7 @@ _eglInitSurface(_EGLSurface *surf, _EGLDisplay *dpy, EGLint 
type,
 
if ((conf->SurfaceType & type) == 0) {
   /* The config can't be used to create a surface of this type */
-  _eglError(EGL_BAD_CONFIG, func);
+  _eglError(EGL_BAD_MATCH, func);
   return EGL_FALSE;
}
 

___
mesa-commit mailing list
mesa-commit@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/mesa-commit


Mesa (master): egl/dri2: set max values for pbuffer width and height

2016-10-24 Thread Tapani Pälli
Module: Mesa
Branch: master
Commit: b91e1e38e87b372d409469dfe00ace76c8febd34
URL:
http://cgit.freedesktop.org/mesa/mesa/commit/?id=b91e1e38e87b372d409469dfe00ace76c8febd34

Author: Tapani Pälli 
Date:   Thu Oct 20 10:33:33 2016 +0300

egl/dri2: set max values for pbuffer width and height

While these max values were previously fixed for pbuffer creation, this
change makes also eglGetConfigAttrib() return correct values.

Fixes following dEQP tests:

   dEQP-EGL.functional.create_surface.pbuffer.rgb888_no_depth_no_stencil
   dEQP-EGL.functional.create_surface.pbuffer.rgb888_depth_stencil
   dEQP-EGL.functional.create_surface.pbuffer.rgba_no_depth_no_stencil
   dEQP-EGL.functional.create_surface.pbuffer.rgba_depth_stencil

Signed-off-by: Tapani Pälli 
Bugzilla: https://bugs.freedesktop.org/show_bug.cgi?id=98326
Reviewed-by: Eric Engestrom 
Reviewed-by: Emil Velikov 
Cc: "12.0 13.0" 

---

 src/egl/drivers/dri2/egl_dri2.c | 9 +
 1 file changed, 9 insertions(+)

diff --git a/src/egl/drivers/dri2/egl_dri2.c b/src/egl/drivers/dri2/egl_dri2.c
index 4ed8c12..d9e2ad7 100644
--- a/src/egl/drivers/dri2/egl_dri2.c
+++ b/src/egl/drivers/dri2/egl_dri2.c
@@ -241,6 +241,15 @@ dri2_add_config(_EGLDisplay *disp, const __DRIconfig 
*dri_config, int id,
 return NULL;
  break;
 
+  case __DRI_ATTRIB_MAX_PBUFFER_WIDTH:
+ _eglSetConfigKey(, EGL_MAX_PBUFFER_WIDTH,
+  _EGL_MAX_PBUFFER_WIDTH);
+ break;
+  case __DRI_ATTRIB_MAX_PBUFFER_HEIGHT:
+ _eglSetConfigKey(, EGL_MAX_PBUFFER_HEIGHT,
+  _EGL_MAX_PBUFFER_HEIGHT);
+ break;
+
   default:
  key = dri2_to_egl_attribute_map[attrib];
  if (key != 0)

___
mesa-commit mailing list
mesa-commit@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/mesa-commit


Mesa (master): egl: add check that eglCreateContext gets a valid config

2016-10-24 Thread Tapani Pälli
Module: Mesa
Branch: master
Commit: 5876f3c85a61d73bb4863331bd641152a40a7b0c
URL:
http://cgit.freedesktop.org/mesa/mesa/commit/?id=5876f3c85a61d73bb4863331bd641152a40a7b0c

Author: Tapani Pälli 
Date:   Thu Oct 20 14:11:16 2016 +0300

egl: add check that eglCreateContext gets a valid config

Fixes following dEQP test:

   dEQP-EGL.functional.negative_api.create_context

v2: don't break EGL_KHR_no_config_context (Eric Engestrom)

Signed-off-by: Tapani Pälli 
Reviewed-by: Emil Velikov 
Reviewed-by: Eric Engestrom 
Cc: "12.0 13.0" 

---

 src/egl/main/eglapi.c | 4 +++-
 1 file changed, 3 insertions(+), 1 deletion(-)

diff --git a/src/egl/main/eglapi.c b/src/egl/main/eglapi.c
index d8bd76d..9db9964 100644
--- a/src/egl/main/eglapi.c
+++ b/src/egl/main/eglapi.c
@@ -734,7 +734,9 @@ eglCreateContext(EGLDisplay dpy, EGLConfig config, 
EGLContext share_list,
 
_EGL_CHECK_DISPLAY(disp, EGL_NO_CONTEXT, drv);
 
-   if (!config && !disp->Extensions.KHR_no_config_context)
+   if (config != EGL_NO_CONFIG_KHR)
+  _EGL_CHECK_CONFIG(disp, conf, EGL_NO_CONTEXT, drv);
+   else if (!disp->Extensions.KHR_no_config_context)
   RETURN_EGL_ERROR(disp, EGL_BAD_CONFIG, EGL_NO_CONTEXT);
 
if (!share && share_list != EGL_NO_CONTEXT)

___
mesa-commit mailing list
mesa-commit@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/mesa-commit


Mesa (master): gallium/stapi: fix comment for st_visual::buffer_mask

2016-10-24 Thread Brian Paul
Module: Mesa
Branch: master
Commit: 76c3f1bbbe4430da6c55b184266f7d0133f66084
URL:
http://cgit.freedesktop.org/mesa/mesa/commit/?id=76c3f1bbbe4430da6c55b184266f7d0133f66084

Author: Brian Paul 
Date:   Mon Oct 24 15:52:35 2016 -0700

gallium/stapi: fix comment for st_visual::buffer_mask

Trivial.

---

 src/gallium/include/state_tracker/st_api.h | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/src/gallium/include/state_tracker/st_api.h 
b/src/gallium/include/state_tracker/st_api.h
index 06abfc5..a2e37d2 100644
--- a/src/gallium/include/state_tracker/st_api.h
+++ b/src/gallium/include/state_tracker/st_api.h
@@ -213,7 +213,7 @@ struct st_egl_image
 struct st_visual
 {
/**
-* Available buffers.  Tested with ST_FRAMEBUFFER_*_MASK.
+* Available buffers.  Bitfield of ST_ATTACHMENT_*_MASK bits.
 */
unsigned buffer_mask;
 

___
mesa-commit mailing list
mesa-commit@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/mesa-commit


Mesa (master): isl/format: Correct ASTC entries of format info table

2016-10-24 Thread Nanley Chery
Module: Mesa
Branch: master
Commit: 59385da39dbe15dd4d1905953464b2fe34b07e16
URL:
http://cgit.freedesktop.org/mesa/mesa/commit/?id=59385da39dbe15dd4d1905953464b2fe34b07e16

Author: Nanley Chery 
Date:   Fri Oct 21 14:42:51 2016 -0700

isl/format: Correct ASTC entries of format info table

With the isl_format_supports* helpers, we can now conveniently
report support for this format on Cherry View.

Bugzilla: https://bugs.freedesktop.org/show_bug.cgi?id=92925
Signed-off-by: Nanley Chery 
Reviewed-by: Jason Ekstrand 

---

 src/intel/isl/isl_format.c | 70 +++---
 1 file changed, 42 insertions(+), 28 deletions(-)

diff --git a/src/intel/isl/isl_format.c b/src/intel/isl/isl_format.c
index daf2d81..98806f4 100644
--- a/src/intel/isl/isl_format.c
+++ b/src/intel/isl/isl_format.c
@@ -307,34 +307,34 @@ static const struct surface_format_info format_info[] = {
SF(80, 80,  x,  x,  x,  x,  x,  x,  x,x,   ETC2_EAC_SRGB8_A8)
SF(90,  x,  x,  x,  x,  x, 75,  x,  x,x,   R8G8B8_UINT)
SF(90,  x,  x,  x,  x,  x, 75,  x,  x,x,   R8G8B8_SINT)
-   SF(80, 80,  x,  x,  x,  x,  x,  x,  x,x,   ASTC_LDR_2D_4X4_FLT16)
-   SF(80, 80,  x,  x,  x,  x,  x,  x,  x,x,   ASTC_LDR_2D_5X4_FLT16)
-   SF(80, 80,  x,  x,  x,  x,  x,  x,  x,x,   ASTC_LDR_2D_5X5_FLT16)
-   SF(80, 80,  x,  x,  x,  x,  x,  x,  x,x,   ASTC_LDR_2D_6X5_FLT16)
-   SF(80, 80,  x,  x,  x,  x,  x,  x,  x,x,   ASTC_LDR_2D_6X6_FLT16)
-   SF(80, 80,  x,  x,  x,  x,  x,  x,  x,x,   ASTC_LDR_2D_8X5_FLT16)
-   SF(80, 80,  x,  x,  x,  x,  x,  x,  x,x,   ASTC_LDR_2D_8X6_FLT16)
-   SF(80, 80,  x,  x,  x,  x,  x,  x,  x,x,   ASTC_LDR_2D_8X8_FLT16)
-   SF(80, 80,  x,  x,  x,  x,  x,  x,  x,x,   ASTC_LDR_2D_10X5_FLT16)
-   SF(80, 80,  x,  x,  x,  x,  x,  x,  x,x,   ASTC_LDR_2D_10X6_FLT16)
-   SF(80, 80,  x,  x,  x,  x,  x,  x,  x,x,   ASTC_LDR_2D_10X8_FLT16)
-   SF(80, 80,  x,  x,  x,  x,  x,  x,  x,x,   ASTC_LDR_2D_10X10_FLT16)
-   SF(80, 80,  x,  x,  x,  x,  x,  x,  x,x,   ASTC_LDR_2D_12X10_FLT16)
-   SF(80, 80,  x,  x,  x,  x,  x,  x,  x,x,   ASTC_LDR_2D_12X12_FLT16)
-   SF(80, 80,  x,  x,  x,  x,  x,  x,  x,x,   ASTC_LDR_2D_4X4_U8SRGB)
-   SF(80, 80,  x,  x,  x,  x,  x,  x,  x,x,   ASTC_LDR_2D_5X4_U8SRGB)
-   SF(80, 80,  x,  x,  x,  x,  x,  x,  x,x,   ASTC_LDR_2D_5X5_U8SRGB)
-   SF(80, 80,  x,  x,  x,  x,  x,  x,  x,x,   ASTC_LDR_2D_6X5_U8SRGB)
-   SF(80, 80,  x,  x,  x,  x,  x,  x,  x,x,   ASTC_LDR_2D_6X6_U8SRGB)
-   SF(80, 80,  x,  x,  x,  x,  x,  x,  x,x,   ASTC_LDR_2D_8X5_U8SRGB)
-   SF(80, 80,  x,  x,  x,  x,  x,  x,  x,x,   ASTC_LDR_2D_8X6_U8SRGB)
-   SF(80, 80,  x,  x,  x,  x,  x,  x,  x,x,   ASTC_LDR_2D_8X8_U8SRGB)
-   SF(80, 80,  x,  x,  x,  x,  x,  x,  x,x,   ASTC_LDR_2D_10X5_U8SRGB)
-   SF(80, 80,  x,  x,  x,  x,  x,  x,  x,x,   ASTC_LDR_2D_10X6_U8SRGB)
-   SF(80, 80,  x,  x,  x,  x,  x,  x,  x,x,   ASTC_LDR_2D_10X8_U8SRGB)
-   SF(80, 80,  x,  x,  x,  x,  x,  x,  x,x,   ASTC_LDR_2D_10X10_U8SRGB)
-   SF(80, 80,  x,  x,  x,  x,  x,  x,  x,x,   ASTC_LDR_2D_12X10_U8SRGB)
-   SF(80, 80,  x,  x,  x,  x,  x,  x,  x,x,   ASTC_LDR_2D_12X12_U8SRGB)
+   SF(90, 90,  x,  x,  x,  x,  x,  x,  x,x,   ASTC_LDR_2D_4X4_FLT16)
+   SF(90, 90,  x,  x,  x,  x,  x,  x,  x,x,   ASTC_LDR_2D_5X4_FLT16)
+   SF(90, 90,  x,  x,  x,  x,  x,  x,  x,x,   ASTC_LDR_2D_5X5_FLT16)
+   SF(90, 90,  x,  x,  x,  x,  x,  x,  x,x,   ASTC_LDR_2D_6X5_FLT16)
+   SF(90, 90,  x,  x,  x,  x,  x,  x,  x,x,   ASTC_LDR_2D_6X6_FLT16)
+   SF(90, 90,  x,  x,  x,  x,  x,  x,  x,x,   ASTC_LDR_2D_8X5_FLT16)
+   SF(90, 90,  x,  x,  x,  x,  x,  x,  x,x,   ASTC_LDR_2D_8X6_FLT16)
+   SF(90, 90,  x,  x,  x,  x,  x,  x,  x,x,   ASTC_LDR_2D_8X8_FLT16)
+   SF(90, 90,  x,  x,  x,  x,  x,  x,  x,x,   ASTC_LDR_2D_10X5_FLT16)
+   SF(90, 90,  x,  x,  x,  x,  x,  x,  x,x,   ASTC_LDR_2D_10X6_FLT16)
+   SF(90, 90,  x,  x,  x,  x,  x,  x,  x,x,   ASTC_LDR_2D_10X8_FLT16)
+   SF(90, 90,  x,  x,  x,  x,  x,  x,  x,x,   ASTC_LDR_2D_10X10_FLT16)
+   SF(90, 90,  x,  x,  x,  x,  x,  x,  x,x,   ASTC_LDR_2D_12X10_FLT16)
+   SF(90, 90,  x,  x,  x,  x,  x,  x,  x,x,   ASTC_LDR_2D_12X12_FLT16)
+   SF(90, 90,  x,  x,  x,  x,  x,  x,  x,x,   ASTC_LDR_2D_4X4_U8SRGB)
+   SF(90, 90,  x,  x,  x,  x,  x,  x,  x,x,   ASTC_LDR_2D_5X4_U8SRGB)
+   SF(90, 90,  x,  x,  x,  x,  x,  x,  x,x,   ASTC_LDR_2D_5X5_U8SRGB)
+   SF(90, 90,  x,  x,  x,  x,  x,  x,  x,x,   ASTC_LDR_2D_6X5_U8SRGB)
+   SF(90, 90,  x,  x,  x,  x,  x,  x,  x,x,   ASTC_LDR_2D_6X6_U8SRGB)
+   SF(90, 90,  x,  x,  x,  x,  x,  x,  x,x,   ASTC_LDR_2D_8X5_U8SRGB)
+   SF(90, 90,  x,  x,  x,  x,  x,  x,  x,x,   ASTC_LDR_2D_8X6_U8SRGB)
+   SF(90, 90,  x,  x,  x,  x,  x,  x,  x,x,   ASTC_LDR_2D_8X8_U8SRGB)
+   SF(90, 90,  x,  x,  x,  x,  x,  x,  x,x,   

Mesa (master): i965: Drop unnecessary switch statement in nir_setup_outputs()

2016-10-24 Thread Kenneth Graunke
Module: Mesa
Branch: master
Commit: 3728ee000aecb19793dec56d45aff9d6cfce3e5b
URL:
http://cgit.freedesktop.org/mesa/mesa/commit/?id=3728ee000aecb19793dec56d45aff9d6cfce3e5b

Author: Kenneth Graunke 
Date:   Wed Oct 12 22:30:30 2016 -0700

i965: Drop unnecessary switch statement in nir_setup_outputs()

TCS and FS are skipped above.  CS has no output variables.
All remaining cases take the same path.

Cc: mesa-sta...@lists.freedesktop.org
Signed-off-by: Kenneth Graunke 
Reviewed-by: Iago Toral Quiroga 
Reviewed-by: Timothy Arceri 

---

 src/mesa/drivers/dri/i965/brw_fs_nir.cpp | 15 +++
 1 file changed, 3 insertions(+), 12 deletions(-)

diff --git a/src/mesa/drivers/dri/i965/brw_fs_nir.cpp 
b/src/mesa/drivers/dri/i965/brw_fs_nir.cpp
index 4e68ffb..9cad1a6 100644
--- a/src/mesa/drivers/dri/i965/brw_fs_nir.cpp
+++ b/src/mesa/drivers/dri/i965/brw_fs_nir.cpp
@@ -87,18 +87,9 @@ fs_visitor::nir_setup_outputs()
nir_outputs = bld.vgrf(BRW_REGISTER_TYPE_F, nir->num_outputs);
 
nir_foreach_variable(var, >outputs) {
-  switch (stage) {
-  case MESA_SHADER_VERTEX:
-  case MESA_SHADER_TESS_EVAL:
-  case MESA_SHADER_GEOMETRY: {
- fs_reg reg = offset(nir_outputs, bld, var->data.driver_location);
- unsigned location = var->data.location;
- nir_setup_single_output_varying(, var->type, );
- break;
-  }
-  default:
- unreachable("unhandled shader stage");
-  }
+  fs_reg reg = offset(nir_outputs, bld, var->data.driver_location);
+  unsigned location = var->data.location;
+  nir_setup_single_output_varying(, var->type, );
}
 }
 

___
mesa-commit mailing list
mesa-commit@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/mesa-commit


Mesa (master): i965: Don't use nir_assign_var_locations for VS/TES/ GS outputs.

2016-10-24 Thread Kenneth Graunke
Module: Mesa
Branch: master
Commit: 59864e8e02057cc6fa0448a8af067a3cf53389da
URL:
http://cgit.freedesktop.org/mesa/mesa/commit/?id=59864e8e02057cc6fa0448a8af067a3cf53389da

Author: Kenneth Graunke 
Date:   Wed Oct 12 22:41:09 2016 -0700

i965: Don't use nir_assign_var_locations for VS/TES/GS outputs.

Fixes spec/arb_enhanced_layouts/execution/component-layout/vs-fs-array-dvec3.

v2: Remove nir_outputs field from fs_visitor (caught by Tim and Iago).

Cc: mesa-sta...@lists.freedesktop.org
Signed-off-by: Kenneth Graunke 
Reviewed-by: Iago Toral Quiroga 
Reviewed-by: Timothy Arceri 

---

 src/mesa/drivers/dri/i965/brw_fs.cpp | 13 -
 src/mesa/drivers/dri/i965/brw_fs.h   |  1 -
 src/mesa/drivers/dri/i965/brw_fs_nir.cpp | 46 ++--
 src/mesa/drivers/dri/i965/brw_nir.c  | 13 +++--
 src/mesa/drivers/dri/i965/brw_nir.h  |  1 -
 5 files changed, 12 insertions(+), 62 deletions(-)

diff --git a/src/mesa/drivers/dri/i965/brw_fs.cpp 
b/src/mesa/drivers/dri/i965/brw_fs.cpp
index 7738a47..921cc00 100644
--- a/src/mesa/drivers/dri/i965/brw_fs.cpp
+++ b/src/mesa/drivers/dri/i965/brw_fs.cpp
@@ -492,19 +492,6 @@ type_size_scalar(const struct glsl_type *type)
return 0;
 }
 
-/**
- * Returns the number of scalar components needed to store type, assuming
- * that vectors are padded out to vec4.
- *
- * This has the packing rules of type_size_vec4(), but counts components
- * similar to type_size_scalar().
- */
-extern "C" int
-type_size_vec4_times_4(const struct glsl_type *type)
-{
-   return 4 * type_size_vec4(type);
-}
-
 /* Attribute arrays are loaded as one vec4 per element (or matrix column),
  * except for double-precision types, which are loaded as one dvec4.
  */
diff --git a/src/mesa/drivers/dri/i965/brw_fs.h 
b/src/mesa/drivers/dri/i965/brw_fs.h
index 663b3ea..aad2160 100644
--- a/src/mesa/drivers/dri/i965/brw_fs.h
+++ b/src/mesa/drivers/dri/i965/brw_fs.h
@@ -325,7 +325,6 @@ public:
fs_reg *nir_locals;
fs_reg *nir_ssa_values;
fs_reg nir_inputs;
-   fs_reg nir_outputs;
fs_reg *nir_system_values;
 
bool failed;
diff --git a/src/mesa/drivers/dri/i965/brw_fs_nir.cpp 
b/src/mesa/drivers/dri/i965/brw_fs_nir.cpp
index 9cad1a6..4baadc9 100644
--- a/src/mesa/drivers/dri/i965/brw_fs_nir.cpp
+++ b/src/mesa/drivers/dri/i965/brw_fs_nir.cpp
@@ -49,47 +49,18 @@ fs_visitor::emit_nir_code()
 }
 
 void
-fs_visitor::nir_setup_single_output_varying(fs_reg *reg,
-const glsl_type *type,
-unsigned *location)
-{
-   if (type->is_array() || type->is_matrix()) {
-  const struct glsl_type *elem_type = glsl_get_array_element(type);
-  const unsigned length = glsl_get_length(type);
-
-  for (unsigned i = 0; i < length; i++) {
- nir_setup_single_output_varying(reg, elem_type, location);
-  }
-   } else if (type->is_record()) {
-  for (unsigned i = 0; i < type->length; i++) {
- const struct glsl_type *field_type = type->fields.structure[i].type;
- nir_setup_single_output_varying(reg, field_type, location);
-  }
-   } else {
-  assert(type->is_scalar() || type->is_vector());
-  unsigned num_iter = 1;
-  if (type->is_dual_slot())
- num_iter = 2;
-  for (unsigned count = 0; count < num_iter; count++) {
- this->outputs[*location] = *reg;
- *reg = offset(*reg, bld, 4);
- (*location)++;
-  }
-   }
-}
-
-void
 fs_visitor::nir_setup_outputs()
 {
if (stage == MESA_SHADER_TESS_CTRL || stage == MESA_SHADER_FRAGMENT)
   return;
 
-   nir_outputs = bld.vgrf(BRW_REGISTER_TYPE_F, nir->num_outputs);
-
nir_foreach_variable(var, >outputs) {
-  fs_reg reg = offset(nir_outputs, bld, var->data.driver_location);
-  unsigned location = var->data.location;
-  nir_setup_single_output_varying(, var->type, );
+  const unsigned vec4s = type_size_vec4(var->type);
+  fs_reg reg = bld.vgrf(BRW_REGISTER_TYPE_F, 4 * vec4s);
+  for (unsigned i = 0; i < vec4s; i++) {
+ if (outputs[var->data.driver_location + i].file == BAD_FILE)
+outputs[var->data.driver_location + i] = offset(reg, bld, 4 * i);
+  }
}
 }
 
@@ -4242,12 +4213,11 @@ fs_visitor::nir_emit_intrinsic(const fs_builder , 
nir_intrinsic_instr *instr
 
case nir_intrinsic_store_output: {
   fs_reg src = get_nir_src(instr->src[0]);
-  fs_reg new_dest = offset(retype(nir_outputs, src.type), bld,
-   instr->const_index[0]);
 
   nir_const_value *const_offset = nir_src_as_const_value(instr->src[1]);
   assert(const_offset && "Indirect output stores not allowed");
-  new_dest = offset(new_dest, bld, const_offset->u32[0]);
+  fs_reg new_dest = retype(offset(outputs[instr->const_index[0]], bld,
+  4 * const_offset->u32[0]), 

Mesa (master): i965: Drop nir_inputs from fs_visitor.

2016-10-24 Thread Kenneth Graunke
Module: Mesa
Branch: master
Commit: 41034abfe63012784c9e9e36856d878928cecd99
URL:
http://cgit.freedesktop.org/mesa/mesa/commit/?id=41034abfe63012784c9e9e36856d878928cecd99

Author: Kenneth Graunke 
Date:   Mon Oct 24 11:25:25 2016 -0700

i965: Drop nir_inputs from fs_visitor.

It's unused.

Cc: mesa-sta...@lists.freedesktop.org
Signed-off-by: Kenneth Graunke 
Reviewed-by: Timothy Arceri 

---

 src/mesa/drivers/dri/i965/brw_fs.h | 1 -
 1 file changed, 1 deletion(-)

diff --git a/src/mesa/drivers/dri/i965/brw_fs.h 
b/src/mesa/drivers/dri/i965/brw_fs.h
index aad2160..da01174 100644
--- a/src/mesa/drivers/dri/i965/brw_fs.h
+++ b/src/mesa/drivers/dri/i965/brw_fs.h
@@ -324,7 +324,6 @@ public:
 
fs_reg *nir_locals;
fs_reg *nir_ssa_values;
-   fs_reg nir_inputs;
fs_reg *nir_system_values;
 
bool failed;

___
mesa-commit mailing list
mesa-commit@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/mesa-commit


Mesa (master): i965: Make split_virtual_grfs() call compact_virtual_grfs() .

2016-10-24 Thread Kenneth Graunke
Module: Mesa
Branch: master
Commit: 27715c73ff84349466f62df0023863acd477f262
URL:
http://cgit.freedesktop.org/mesa/mesa/commit/?id=27715c73ff84349466f62df0023863acd477f262

Author: Kenneth Graunke 
Date:   Sat Oct 15 03:18:36 2016 -0700

i965: Make split_virtual_grfs() call compact_virtual_grfs().

Post-splitting, VGRFs have a maximum size (MAX_VGRF_SIZE).  This is
required by the register allocator, as we have to create classes for
each size of VGRF.

We can (and do) allocate virtual registers larger than MAX_VGRF_SIZE,
but we must ensure that they are splittable.  split_virtual_grfs()
asserts that the post-splitting register size is in range.

Unfortunately, these trip for completely dead registers which are too
large - we only set split points for live registers.  So dead ones are
never split, and if they happened to be too large, they'd trip asserts.

To fix this, call compact_virtual_grfs() to eliminate dead registers
before splitting.

v2: Add a comment written by Iago.

Cc: mesa-sta...@lists.freedesktop.org
Signed-off-by: Kenneth Graunke 
Reviewed-by: Iago Toral Quiroga 
Reviewed-by: Timothy Arceri 

---

 src/mesa/drivers/dri/i965/brw_fs.cpp | 6 ++
 1 file changed, 6 insertions(+)

diff --git a/src/mesa/drivers/dri/i965/brw_fs.cpp 
b/src/mesa/drivers/dri/i965/brw_fs.cpp
index 1c7a6e6..7738a47 100644
--- a/src/mesa/drivers/dri/i965/brw_fs.cpp
+++ b/src/mesa/drivers/dri/i965/brw_fs.cpp
@@ -1687,6 +1687,12 @@ fs_visitor::assign_gs_urb_setup()
 void
 fs_visitor::split_virtual_grfs()
 {
+   /* Compact the register file so we eliminate dead vgrfs.  This
+* only defines split points for live registers, so if we have
+* too large dead registers they will hit assertions later.
+*/
+   compact_virtual_grfs();
+
int num_vars = this->alloc.count;
 
/* Count the total number of registers */

___
mesa-commit mailing list
mesa-commit@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/mesa-commit


Mesa (master): tgsi: trivial build fix for MSVC

2016-10-24 Thread Brian Paul
Module: Mesa
Branch: master
Commit: 88a618ce86602e962343683eacea60ebdd20e4e1
URL:
http://cgit.freedesktop.org/mesa/mesa/commit/?id=88a618ce86602e962343683eacea60ebdd20e4e1

Author: Brian Paul 
Date:   Mon Oct 24 13:42:09 2016 -0700

tgsi: trivial build fix for MSVC

Reviewed-by: Marek Olšák 

---

 src/gallium/auxiliary/tgsi/tgsi_scan.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/src/gallium/auxiliary/tgsi/tgsi_scan.c 
b/src/gallium/auxiliary/tgsi/tgsi_scan.c
index cbb3eec..aeb326a 100644
--- a/src/gallium/auxiliary/tgsi/tgsi_scan.c
+++ b/src/gallium/auxiliary/tgsi/tgsi_scan.c
@@ -370,7 +370,7 @@ scan_instruction(struct tgsi_shader_info *info,
 
if (fullinst->Instruction.Texture) {
   for (i = 0; i < fullinst->Texture.NumOffsets; i++) {
- struct tgsi_full_src_register src = {};
+ struct tgsi_full_src_register src = {{0}};
 
  src.Register.File = fullinst->TexOffsets[i].File;
  src.Register.Index = fullinst->TexOffsets[i].Index;

___
mesa-commit mailing list
mesa-commit@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/mesa-commit


Mesa (master): nv50/ir: do not perform global membar for shared memory

2016-10-24 Thread Samuel Pitoiset
Module: Mesa
Branch: master
Commit: 6dbb8d12a8b78769b9803884fad5f0d9923023bc
URL:
http://cgit.freedesktop.org/mesa/mesa/commit/?id=6dbb8d12a8b78769b9803884fad5f0d9923023bc

Author: Samuel Pitoiset 
Date:   Mon Oct 24 21:41:11 2016 +0200

nv50/ir: do not perform global membar for shared memory

Shared memory is local to CTA, thus we should only wait for
prior memory writes which are visible to other threads in
the same CTA, and not at global level. This should speedup
compute shaders which use shared memory.

Signed-off-by: Samuel Pitoiset 
Reviewed-by: Ilia Mirkin 

---

 src/gallium/drivers/nouveau/codegen/nv50_ir_from_tgsi.cpp | 5 -
 1 file changed, 4 insertions(+), 1 deletion(-)

diff --git a/src/gallium/drivers/nouveau/codegen/nv50_ir_from_tgsi.cpp 
b/src/gallium/drivers/nouveau/codegen/nv50_ir_from_tgsi.cpp
index b47fc49..91cef81 100644
--- a/src/gallium/drivers/nouveau/codegen/nv50_ir_from_tgsi.cpp
+++ b/src/gallium/drivers/nouveau/codegen/nv50_ir_from_tgsi.cpp
@@ -3561,12 +3561,15 @@ Converter::handleInstruction(const struct 
tgsi_full_instruction *insn)
   geni->subOp = tgsi::opcodeToSubOp(tgsi.getOpcode());
   break;
case TGSI_OPCODE_MEMBAR:
+   {
+  uint32_t level = tgsi.getSrc(0).getValueU32(0, info);
   geni = mkOp(OP_MEMBAR, TYPE_NONE, NULL);
   geni->fixed = 1;
-  if (tgsi.getSrc(0).getValueU32(0, info) & TGSI_MEMBAR_THREAD_GROUP)
+  if (!(level & ~(TGSI_MEMBAR_THREAD_GROUP | TGSI_MEMBAR_SHARED)))
  geni->subOp = NV50_IR_SUBOP_MEMBAR(M, CTA);
   else
  geni->subOp = NV50_IR_SUBOP_MEMBAR(M, GL);
+   }
   break;
case TGSI_OPCODE_ATOMUADD:
case TGSI_OPCODE_ATOMXCHG:

___
mesa-commit mailing list
mesa-commit@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/mesa-commit


Mesa (master): st/nine: Use align_calloc instead of align_malloc

2016-10-24 Thread Axel Davy
Module: Mesa
Branch: master
Commit: 942778099ea597ee6b04ebdc74f506667fc7782c
URL:
http://cgit.freedesktop.org/mesa/mesa/commit/?id=942778099ea597ee6b04ebdc74f506667fc7782c

Author: Axel Davy 
Date:   Fri Oct 21 17:27:10 2016 +0200

st/nine: Use align_calloc instead of align_malloc

We are not sure exactly what needs to be 0 initialized,
but we are missing some cases. 0 initialize all our current
aligned allocation.

Fixes Tree of Savior visual issues.

Signed-off-by: Axel Davy 

---

 src/gallium/state_trackers/nine/buffer9.c  | 2 +-
 src/gallium/state_trackers/nine/cubetexture9.c | 2 +-
 src/gallium/state_trackers/nine/surface9.c | 4 ++--
 src/gallium/state_trackers/nine/texture9.c | 2 +-
 src/gallium/state_trackers/nine/volume9.c  | 4 ++--
 5 files changed, 7 insertions(+), 7 deletions(-)

diff --git a/src/gallium/state_trackers/nine/buffer9.c 
b/src/gallium/state_trackers/nine/buffer9.c
index e7c6a2f..cbf410b 100644
--- a/src/gallium/state_trackers/nine/buffer9.c
+++ b/src/gallium/state_trackers/nine/buffer9.c
@@ -125,7 +125,7 @@ NineBuffer9_ctor( struct NineBuffer9 *This,
 return hr;
 
 if (Pool == D3DPOOL_MANAGED) {
-This->managed.data = align_malloc(
+This->managed.data = align_calloc(
 nine_format_get_level_alloc_size(This->base.info.format,
  Size, 1, 0), 32);
 if (!This->managed.data)
diff --git a/src/gallium/state_trackers/nine/cubetexture9.c 
b/src/gallium/state_trackers/nine/cubetexture9.c
index 912d508..0a834eb 100644
--- a/src/gallium/state_trackers/nine/cubetexture9.c
+++ b/src/gallium/state_trackers/nine/cubetexture9.c
@@ -111,7 +111,7 @@ NineCubeTexture9_ctor( struct NineCubeTexture9 *This,
 face_size = nine_format_get_size_and_offsets(pf, level_offsets,
  EdgeLength, EdgeLength,
  info->last_level);
-This->managed_buffer = align_malloc(6 * face_size, 32);
+This->managed_buffer = align_calloc(6 * face_size, 32);
 if (!This->managed_buffer)
 return E_OUTOFMEMORY;
 }
diff --git a/src/gallium/state_trackers/nine/surface9.c 
b/src/gallium/state_trackers/nine/surface9.c
index 664b78f..1b00b96 100644
--- a/src/gallium/state_trackers/nine/surface9.c
+++ b/src/gallium/state_trackers/nine/surface9.c
@@ -146,7 +146,7 @@ NineSurface9_ctor( struct NineSurface9 *This,
  FALSE,
  TRUE);
 if (This->base.info.format != This->format_conversion) {
-This->data_conversion = align_malloc(
+This->data_conversion = align_calloc(
 nine_format_get_level_alloc_size(This->format_conversion,
  pDesc->Width,
  pDesc->Height,
@@ -160,7 +160,7 @@ NineSurface9_ctor( struct NineSurface9 *This,
 if ((allocate && pDesc->Pool != D3DPOOL_DEFAULT) || pDesc->Format == 
D3DFMT_NULL) {
 /* Ram buffer with no parent. Has to allocate the resource itself */
 assert(!user_buffer);
-This->data = align_malloc(
+This->data = align_calloc(
 nine_format_get_level_alloc_size(This->base.info.format,
  pDesc->Width,
  pDesc->Height,
diff --git a/src/gallium/state_trackers/nine/texture9.c 
b/src/gallium/state_trackers/nine/texture9.c
index a13d7f4..bf054cc 100644
--- a/src/gallium/state_trackers/nine/texture9.c
+++ b/src/gallium/state_trackers/nine/texture9.c
@@ -161,7 +161,7 @@ NineTexture9_ctor( struct NineTexture9 *This,
  * apps access sublevels of texture even if they locked only first
  * level) */
 level_offsets = alloca(sizeof(unsigned) * (info->last_level + 1));
-user_buffer = align_malloc(
+user_buffer = align_calloc(
 nine_format_get_size_and_offsets(pf, level_offsets,
  Width, Height,
  info->last_level), 32);
diff --git a/src/gallium/state_trackers/nine/volume9.c 
b/src/gallium/state_trackers/nine/volume9.c
index e2201af..89565f2 100644
--- a/src/gallium/state_trackers/nine/volume9.c
+++ b/src/gallium/state_trackers/nine/volume9.c
@@ -42,7 +42,7 @@ NineVolume9_AllocateData( struct NineVolume9 *This )
 DBG("(%p(This=%p),level=%u) Allocating 0x%x bytes of system memory.\n",
 This->base.container, This, This->level, size);
 
-This->data = (uint8_t *)align_malloc(size, 32);
+This->data = (uint8_t *)align_calloc(size, 32);
 if (!This->data)
 return E_OUTOFMEMORY;
 return D3D_OK;
@@ -124,7 +124,7 @@ NineVolume9_ctor( struct NineVolume9 *This,
 This->layer_stride_conversion = 

Mesa (master): gallium/util: Add align_calloc

2016-10-24 Thread Axel Davy
Module: Mesa
Branch: master
Commit: 54010cf8b6da71a1b14c0dc586bb7e6be27052de
URL:
http://cgit.freedesktop.org/mesa/mesa/commit/?id=54010cf8b6da71a1b14c0dc586bb7e6be27052de

Author: Axel Davy 
Date:   Fri Oct 21 17:25:08 2016 +0200

gallium/util: Add align_calloc

Add implementation for align_calloc,
which is align_malloc + memset.

v2: add if (ptr) before memset.
Fix indentation.

Signed-off-by: Axel Davy 
Reviewed-by: Nicolai Hähnle 

---

 src/gallium/auxiliary/util/u_memory.h | 8 
 1 file changed, 8 insertions(+)

diff --git a/src/gallium/auxiliary/util/u_memory.h 
b/src/gallium/auxiliary/util/u_memory.h
index 597df62..66c3ba4 100644
--- a/src/gallium/auxiliary/util/u_memory.h
+++ b/src/gallium/auxiliary/util/u_memory.h
@@ -63,6 +63,14 @@ extern "C" {
 #define align_malloc(_size, _alignment) os_malloc_aligned(_size, _alignment)
 #define align_free(_ptr) os_free_aligned(_ptr)
 
+static inline void *
+align_calloc(size_t size, unsigned long alignment)
+{
+   void *ptr = align_malloc(size, alignment);
+   if (ptr)
+  memset(ptr, 0, size);
+   return ptr;
+}
 
 /**
  * Duplicate a block of memory.

___
mesa-commit mailing list
mesa-commit@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/mesa-commit


Mesa (master): st/nine: Fix locking CubeTexture surfaces.

2016-10-24 Thread Axel Davy
Module: Mesa
Branch: master
Commit: eed605a473554575305e1bf10c3641761a85feb9
URL:
http://cgit.freedesktop.org/mesa/mesa/commit/?id=eed605a473554575305e1bf10c3641761a85feb9

Author: Axel Davy 
Date:   Sat Oct 22 12:00:40 2016 +0200

st/nine: Fix locking CubeTexture surfaces.

Only one face of Cubetextures was locked when in DEFAULT Pool.
Fixes:
https://github.com/iXit/Mesa-3D/issues/129

CC: "12.0 13.0" 

Signed-off-by: Axel Davy 

---

 src/gallium/state_trackers/nine/surface9.c | 1 +
 1 file changed, 1 insertion(+)

diff --git a/src/gallium/state_trackers/nine/surface9.c 
b/src/gallium/state_trackers/nine/surface9.c
index 1b00b96..2efdfd1 100644
--- a/src/gallium/state_trackers/nine/surface9.c
+++ b/src/gallium/state_trackers/nine/surface9.c
@@ -447,6 +447,7 @@ NineSurface9_LockRect( struct NineSurface9 *This,
 } else {
 u_box_origin_2d(This->desc.Width, This->desc.Height, );
 }
+box.z = This->layer;
 
 user_warn(This->desc.Format == D3DFMT_NULL);
 

___
mesa-commit mailing list
mesa-commit@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/mesa-commit


Mesa (master): st/nine: Fix mistake in Volume9 UnlockBox

2016-10-24 Thread Axel Davy
Module: Mesa
Branch: master
Commit: fe7bb46134162c9a9a18832f1746991aa78121e8
URL:
http://cgit.freedesktop.org/mesa/mesa/commit/?id=fe7bb46134162c9a9a18832f1746991aa78121e8

Author: Axel Davy 
Date:   Sat Oct 22 11:59:11 2016 +0200

st/nine: Fix mistake in Volume9 UnlockBox

In the format fallback path,
the height was used instead of the depth.

CC: "12.0 13.0" 

Signed-off-by: Axel Davy 

---

 src/gallium/state_trackers/nine/volume9.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/src/gallium/state_trackers/nine/volume9.c 
b/src/gallium/state_trackers/nine/volume9.c
index 89565f2..a31dc0a 100644
--- a/src/gallium/state_trackers/nine/volume9.c
+++ b/src/gallium/state_trackers/nine/volume9.c
@@ -373,7 +373,7 @@ NineVolume9_UnlockBox( struct NineVolume9 *This )
 This->layer_stride_conversion,
 0, 0, 0,
 This->desc.Width, This->desc.Height,
-This->desc.Height);
+This->desc.Depth);
 
 if (!This->data)
 pipe_transfer_unmap(This->pipe, transfer);

___
mesa-commit mailing list
mesa-commit@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/mesa-commit


Mesa (master): st/nine: Fix leak with integer and boolean constants

2016-10-24 Thread Axel Davy
Module: Mesa
Branch: master
Commit: 25beccb379731b0e6fc728982190779da47aa6fd
URL:
http://cgit.freedesktop.org/mesa/mesa/commit/?id=25beccb379731b0e6fc728982190779da47aa6fd

Author: Axel Davy 
Date:   Tue Oct 18 23:05:02 2016 +0200

st/nine: Fix leak with integer and boolean constants

Leak introduced by:
a83dce01284f220b1bf932774730e13fca6cdd20

The patch also moves the part to
release changed.vs_const_i and changed.vs_const_b
before the if (!cb.buffer_size) check,
to avoid reuploading every draw call if
integer or boolean constants are dirty, but the shaders
use no constants.

Signed-off-by: Axel Davy 
CC: "13.0" 

---

 src/gallium/state_trackers/nine/nine_state.c | 39 +---
 1 file changed, 18 insertions(+), 21 deletions(-)

diff --git a/src/gallium/state_trackers/nine/nine_state.c 
b/src/gallium/state_trackers/nine/nine_state.c
index f6bf51e..ea72c77 100644
--- a/src/gallium/state_trackers/nine/nine_state.c
+++ b/src/gallium/state_trackers/nine/nine_state.c
@@ -126,7 +126,6 @@ prepare_vs_constants_userbuf_swvp(struct NineDevice9 
*device)
 cb.user_buffer = state->vs_const_i;
 
 state->pipe.cb2_swvp = cb;
-state->changed.vs_const_i = 0;
 }
 
 if (state->changed.vs_const_b || state->changed.group & NINE_STATE_SWVP) {
@@ -138,7 +137,6 @@ prepare_vs_constants_userbuf_swvp(struct NineDevice9 
*device)
 cb.user_buffer = state->vs_const_b;
 
 state->pipe.cb3_swvp = cb;
-state->changed.vs_const_b = 0;
 }
 
 if (!device->driver_caps.user_cbufs) {
@@ -236,14 +234,30 @@ prepare_vs_constants_userbuf(struct NineDevice9 *device)
 if (state->changed.vs_const_i || state->changed.group & NINE_STATE_SWVP) {
 int *idst = (int *)>vs_const_f[4 * device->max_vs_const_f];
 memcpy(idst, state->vs_const_i, NINE_MAX_CONST_I * sizeof(int[4]));
-state->changed.vs_const_i = 0;
 }
 
 if (state->changed.vs_const_b || state->changed.group & NINE_STATE_SWVP) {
 int *idst = (int *)>vs_const_f[4 * device->max_vs_const_f];
 uint32_t *bdst = (uint32_t *)[4 * NINE_MAX_CONST_I];
 memcpy(bdst, state->vs_const_b, NINE_MAX_CONST_B * sizeof(BOOL));
-state->changed.vs_const_b = 0;
+}
+
+if (device->state.changed.vs_const_i) {
+struct nine_range *r = device->state.changed.vs_const_i;
+struct nine_range *p = r;
+while (p->next)
+p = p->next;
+nine_range_pool_put_chain(>range_pool, r, p);
+device->state.changed.vs_const_i = NULL;
+}
+
+if (device->state.changed.vs_const_b) {
+struct nine_range *r = device->state.changed.vs_const_b;
+struct nine_range *p = r;
+while (p->next)
+p = p->next;
+nine_range_pool_put_chain(>range_pool, r, p);
+device->state.changed.vs_const_b = NULL;
 }
 
 if (!cb.buffer_size)
@@ -290,23 +304,6 @@ prepare_vs_constants_userbuf(struct NineDevice9 *device)
 device->state.changed.vs_const_f = NULL;
 }
 
-if (device->state.changed.vs_const_i) {
-struct nine_range *r = device->state.changed.vs_const_i;
-struct nine_range *p = r;
-while (p->next)
-p = p->next;
-nine_range_pool_put_chain(>range_pool, r, p);
-device->state.changed.vs_const_i = NULL;
-}
-
-if (device->state.changed.vs_const_b) {
-struct nine_range *r = device->state.changed.vs_const_b;
-struct nine_range *p = r;
-while (p->next)
-p = p->next;
-nine_range_pool_put_chain(>range_pool, r, p);
-device->state.changed.vs_const_b = NULL;
-}
 state->changed.group &= ~NINE_STATE_VS_CONST;
 state->commit |= NINE_STATE_COMMIT_CONST_VS;
 }

___
mesa-commit mailing list
mesa-commit@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/mesa-commit


Mesa (master): tgsi/scan: get information about indirect CONST access

2016-10-24 Thread Marek Olšák
Module: Mesa
Branch: master
Commit: 965a5f181047846b081bf1d510ddc4e5424f6b32
URL:
http://cgit.freedesktop.org/mesa/mesa/commit/?id=965a5f181047846b081bf1d510ddc4e5424f6b32

Author: Marek Olšák 
Date:   Thu Oct 20 00:56:08 2016 +0200

tgsi/scan: get information about indirect CONST access

Reviewed-by: Nicolai Hähnle 

---

 src/gallium/auxiliary/tgsi/tgsi_scan.c | 13 +
 src/gallium/auxiliary/tgsi/tgsi_scan.h |  2 ++
 2 files changed, 15 insertions(+)

diff --git a/src/gallium/auxiliary/tgsi/tgsi_scan.c 
b/src/gallium/auxiliary/tgsi/tgsi_scan.c
index b862078..0c81005 100644
--- a/src/gallium/auxiliary/tgsi/tgsi_scan.c
+++ b/src/gallium/auxiliary/tgsi/tgsi_scan.c
@@ -271,6 +271,18 @@ scan_instruction(struct tgsi_shader_info *info,
   if (src->Register.Indirect) {
  info->indirect_files |= (1 << src->Register.File);
  info->indirect_files_read |= (1 << src->Register.File);
+
+ /* record indirect constant buffer indexing */
+ if (src->Register.File == TGSI_FILE_CONSTANT) {
+if (src->Register.Dimension) {
+   if (src->Dimension.Indirect)
+  info->const_buffers_indirect = info->const_buffers_declared;
+   else
+  info->const_buffers_indirect |= 1u << src->Dimension.Index;
+} else {
+   info->const_buffers_indirect |= 1;
+}
+ }
   }
 
   /* Texture samplers */
@@ -392,6 +404,7 @@ scan_declaration(struct tgsi_shader_info *info,
 
  info->const_file_max[buffer] =
 MAX2(info->const_file_max[buffer], (int)reg);
+ info->const_buffers_declared |= 1u << buffer;
   }
   else if (file == TGSI_FILE_INPUT) {
  info->input_semantic_name[reg] = (ubyte) semName;
diff --git a/src/gallium/auxiliary/tgsi/tgsi_scan.h 
b/src/gallium/auxiliary/tgsi/tgsi_scan.h
index 0c5f2ba..2e61dc7 100644
--- a/src/gallium/auxiliary/tgsi/tgsi_scan.h
+++ b/src/gallium/auxiliary/tgsi/tgsi_scan.h
@@ -64,6 +64,7 @@ struct tgsi_shader_info
uint file_count[TGSI_FILE_COUNT];  /**< number of declared registers */
int file_max[TGSI_FILE_COUNT];  /**< highest index of declared registers */
int const_file_max[PIPE_MAX_CONSTANT_BUFFERS];
+   unsigned const_buffers_declared; /**< bitmask of declared const buffers */
unsigned samplers_declared; /**< bitmask of declared samplers */
ubyte sampler_targets[PIPE_MAX_SHADER_SAMPLER_VIEWS];  /**< TGSI_TEXTURE_x 
values */
ubyte sampler_type[PIPE_MAX_SHADER_SAMPLER_VIEWS]; /**< TGSI_RETURN_TYPE_x 
*/
@@ -141,6 +142,7 @@ struct tgsi_shader_info
 */
unsigned indirect_files_read;
unsigned indirect_files_written;
+   unsigned const_buffers_indirect; /**< const buffers using indirect 
addressing */
 
unsigned properties[TGSI_PROPERTY_COUNT]; /* index with TGSI_PROPERTY_ */
 

___
mesa-commit mailing list
mesa-commit@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/mesa-commit


Mesa (master): tgsi/scan: don't treat RESQ etc. as memory instructions

2016-10-24 Thread Marek Olšák
Module: Mesa
Branch: master
Commit: ac37720f51310ad0398c4cd5c8921da5c96a7c9d
URL:
http://cgit.freedesktop.org/mesa/mesa/commit/?id=ac37720f51310ad0398c4cd5c8921da5c96a7c9d

Author: Marek Olšák 
Date:   Sun Oct  9 19:18:51 2016 +0200

tgsi/scan: don't treat RESQ etc. as memory instructions

Reviewed-by: Nicolai Hähnle 

---

 src/gallium/auxiliary/tgsi/tgsi_scan.c | 18 +-
 1 file changed, 13 insertions(+), 5 deletions(-)

diff --git a/src/gallium/auxiliary/tgsi/tgsi_scan.c 
b/src/gallium/auxiliary/tgsi/tgsi_scan.c
index e5edea8..66f1fdf 100644
--- a/src/gallium/auxiliary/tgsi/tgsi_scan.c
+++ b/src/gallium/auxiliary/tgsi/tgsi_scan.c
@@ -54,6 +54,16 @@ is_memory_file(unsigned file)
 }
 
 
+static bool
+is_mem_query_inst(unsigned opcode)
+{
+   return opcode == TGSI_OPCODE_RESQ ||
+  opcode == TGSI_OPCODE_TXQ ||
+  opcode == TGSI_OPCODE_TXQS ||
+  opcode == TGSI_OPCODE_TXQ_LZ ||
+  opcode == TGSI_OPCODE_LODQ;
+}
+
 /**
  * Is the opcode a "true" texture instruction which samples from a
  * texture map?
@@ -61,10 +71,7 @@ is_memory_file(unsigned file)
 static bool
 is_texture_inst(unsigned opcode)
 {
-   return (opcode != TGSI_OPCODE_TXQ &&
-   opcode != TGSI_OPCODE_TXQS &&
-   opcode != TGSI_OPCODE_TXQ_LZ &&
-   opcode != TGSI_OPCODE_LODQ &&
+   return (!is_mem_query_inst(opcode) &&
tgsi_get_opcode_info(opcode)->is_tex);
 }
 
@@ -320,7 +327,8 @@ scan_instruction(struct tgsi_shader_info *info,
  }
   }
 
-  if (is_memory_file(src->Register.File)) {
+  if (is_memory_file(src->Register.File) &&
+  !is_mem_query_inst(fullinst->Instruction.Opcode)) {
  is_mem_inst = true;
 
  if (tgsi_get_opcode_info(fullinst->Instruction.Opcode)->is_store) {

___
mesa-commit mailing list
mesa-commit@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/mesa-commit


Mesa (master): tgsi/scan: handle indirect image indexing correctly

2016-10-24 Thread Marek Olšák
Module: Mesa
Branch: master
Commit: d89890d000da36c51484ee170b2d9727d2766a93
URL:
http://cgit.freedesktop.org/mesa/mesa/commit/?id=d89890d000da36c51484ee170b2d9727d2766a93

Author: Marek Olšák 
Date:   Sun Oct  9 19:21:33 2016 +0200

tgsi/scan: handle indirect image indexing correctly

Reviewed-by: Nicolai Hähnle 

---

 src/gallium/auxiliary/tgsi/tgsi_scan.c | 23 +++
 src/gallium/auxiliary/tgsi/tgsi_scan.h |  2 ++
 2 files changed, 17 insertions(+), 8 deletions(-)

diff --git a/src/gallium/auxiliary/tgsi/tgsi_scan.c 
b/src/gallium/auxiliary/tgsi/tgsi_scan.c
index 66f1fdf..c27f0c6 100644
--- a/src/gallium/auxiliary/tgsi/tgsi_scan.c
+++ b/src/gallium/auxiliary/tgsi/tgsi_scan.c
@@ -334,9 +334,12 @@ scan_instruction(struct tgsi_shader_info *info,
  if (tgsi_get_opcode_info(fullinst->Instruction.Opcode)->is_store) {
 info->writes_memory = TRUE;
 
-if (src->Register.File == TGSI_FILE_IMAGE &&
-!src->Register.Indirect)
-   info->images_writemask |= 1 << src->Register.Index;
+if (src->Register.File == TGSI_FILE_IMAGE) {
+   if (src->Register.Indirect)
+  info->images_writemask = info->images_declared;
+   else
+  info->images_writemask |= 1 << src->Register.Index;
+}
  }
   }
}
@@ -358,9 +361,12 @@ scan_instruction(struct tgsi_shader_info *info,
  is_mem_inst = true;
  info->writes_memory = TRUE;
 
- if (dst->Register.File == TGSI_FILE_IMAGE &&
- !dst->Register.Indirect)
-info->images_writemask |= 1 << dst->Register.Index;
+ if (dst->Register.File == TGSI_FILE_IMAGE) {
+if (dst->Register.Indirect)
+   info->images_writemask = info->images_declared;
+else
+   info->images_writemask |= 1 << dst->Register.Index;
+ }
   }
}
 
@@ -419,8 +425,9 @@ scan_declaration(struct tgsi_shader_info *info,
  info->const_file_max[buffer] =
 MAX2(info->const_file_max[buffer], (int)reg);
  info->const_buffers_declared |= 1u << buffer;
-  }
-  else if (file == TGSI_FILE_INPUT) {
+  } else if (file == TGSI_FILE_IMAGE) {
+ info->images_declared |= 1u << reg;
+  } else if (file == TGSI_FILE_INPUT) {
  info->input_semantic_name[reg] = (ubyte) semName;
  info->input_semantic_index[reg] = (ubyte) semIndex;
  info->input_interpolate[reg] = (ubyte)fulldecl->Interp.Interpolate;
diff --git a/src/gallium/auxiliary/tgsi/tgsi_scan.h 
b/src/gallium/auxiliary/tgsi/tgsi_scan.h
index 47528d5..16f0034 100644
--- a/src/gallium/auxiliary/tgsi/tgsi_scan.h
+++ b/src/gallium/auxiliary/tgsi/tgsi_scan.h
@@ -122,6 +122,8 @@ struct tgsi_shader_info
unsigned culldist_writemask;
unsigned num_written_culldistance;
unsigned num_written_clipdistance;
+
+   unsigned images_declared; /**< bitmask of declared images */
/**
 * Bitmask indicating which images are written to (STORE / ATOM*).
 * Indirect image accesses are not reflected in this mask.

___
mesa-commit mailing list
mesa-commit@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/mesa-commit


Mesa (master): tgsi/scan: move src operand processing into a separate function

2016-10-24 Thread Marek Olšák
Module: Mesa
Branch: master
Commit: a2f98dff140c0eebaddadcf70b571bb82872ac42
URL:
http://cgit.freedesktop.org/mesa/mesa/commit/?id=a2f98dff140c0eebaddadcf70b571bb82872ac42

Author: Marek Olšák 
Date:   Thu Oct 20 01:02:00 2016 +0200

tgsi/scan: move src operand processing into a separate function

the next commit will need this

Reviewed-by: Nicolai Hähnle 

---

 src/gallium/auxiliary/tgsi/tgsi_scan.c | 354 +
 1 file changed, 183 insertions(+), 171 deletions(-)

diff --git a/src/gallium/auxiliary/tgsi/tgsi_scan.c 
b/src/gallium/auxiliary/tgsi/tgsi_scan.c
index 517b983..00f55c7 100644
--- a/src/gallium/auxiliary/tgsi/tgsi_scan.c
+++ b/src/gallium/auxiliary/tgsi/tgsi_scan.c
@@ -103,6 +103,186 @@ computes_derivative(unsigned opcode)
 
 
 static void
+scan_src_operand(struct tgsi_shader_info *info,
+ const struct tgsi_full_instruction *fullinst,
+ const struct tgsi_full_src_register *src,
+ unsigned src_index,
+ unsigned usage_mask,
+ bool is_interp_instruction,
+ bool *is_mem_inst)
+{
+   int ind = src->Register.Index;
+
+   /* Mark which inputs are effectively used */
+   if (src->Register.File == TGSI_FILE_INPUT) {
+  if (src->Register.Indirect) {
+ for (ind = 0; ind < info->num_inputs; ++ind) {
+info->input_usage_mask[ind] |= usage_mask;
+ }
+  } else {
+ assert(ind >= 0);
+ assert(ind < PIPE_MAX_SHADER_INPUTS);
+ info->input_usage_mask[ind] |= usage_mask;
+  }
+
+  if (info->processor == PIPE_SHADER_FRAGMENT) {
+ unsigned name, index, input;
+
+ if (src->Register.Indirect && src->Indirect.ArrayID)
+input = info->input_array_first[src->Indirect.ArrayID];
+ else
+input = src->Register.Index;
+
+ name = info->input_semantic_name[input];
+ index = info->input_semantic_index[input];
+
+ if (name == TGSI_SEMANTIC_POSITION &&
+ (src->Register.SwizzleX == TGSI_SWIZZLE_Z ||
+  src->Register.SwizzleY == TGSI_SWIZZLE_Z ||
+  src->Register.SwizzleZ == TGSI_SWIZZLE_Z ||
+  src->Register.SwizzleW == TGSI_SWIZZLE_Z))
+info->reads_z = TRUE;
+
+ if (name == TGSI_SEMANTIC_COLOR) {
+unsigned mask =
+   (1 << src->Register.SwizzleX) |
+   (1 << src->Register.SwizzleY) |
+   (1 << src->Register.SwizzleZ) |
+   (1 << src->Register.SwizzleW);
+
+info->colors_read |= mask << (index * 4);
+ }
+
+ /* Process only interpolated varyings. Don't include POSITION.
+  * Don't include integer varyings, because they are not
+  * interpolated. Don't process inputs interpolated by INTERP
+  * opcodes. Those are tracked separately.
+  */
+ if ((!is_interp_instruction || src_index != 0) &&
+ (name == TGSI_SEMANTIC_GENERIC ||
+  name == TGSI_SEMANTIC_TEXCOORD ||
+  name == TGSI_SEMANTIC_COLOR ||
+  name == TGSI_SEMANTIC_BCOLOR ||
+  name == TGSI_SEMANTIC_FOG ||
+  name == TGSI_SEMANTIC_CLIPDIST)) {
+switch (info->input_interpolate[input]) {
+case TGSI_INTERPOLATE_COLOR:
+case TGSI_INTERPOLATE_PERSPECTIVE:
+   switch (info->input_interpolate_loc[input]) {
+   case TGSI_INTERPOLATE_LOC_CENTER:
+  info->uses_persp_center = TRUE;
+  break;
+   case TGSI_INTERPOLATE_LOC_CENTROID:
+  info->uses_persp_centroid = TRUE;
+  break;
+   case TGSI_INTERPOLATE_LOC_SAMPLE:
+  info->uses_persp_sample = TRUE;
+  break;
+   }
+   break;
+case TGSI_INTERPOLATE_LINEAR:
+   switch (info->input_interpolate_loc[input]) {
+   case TGSI_INTERPOLATE_LOC_CENTER:
+  info->uses_linear_center = TRUE;
+  break;
+   case TGSI_INTERPOLATE_LOC_CENTROID:
+  info->uses_linear_centroid = TRUE;
+  break;
+   case TGSI_INTERPOLATE_LOC_SAMPLE:
+  info->uses_linear_sample = TRUE;
+  break;
+   }
+   break;
+   /* TGSI_INTERPOLATE_CONSTANT doesn't do any interpolation. */
+}
+ }
+  }
+   }
+
+   /* check for indirect register reads */
+   if (src->Register.Indirect) {
+  info->indirect_files |= (1 << src->Register.File);
+  info->indirect_files_read |= (1 << src->Register.File);
+
+  /* record indirect constant buffer indexing */
+  if (src->Register.File == TGSI_FILE_CONSTANT) {
+ if (src->Register.Dimension) {
+if (src->Dimension.Indirect)
+   

Mesa (master): tgsi/scan: scan texture offset operands

2016-10-24 Thread Marek Olšák
Module: Mesa
Branch: master
Commit: f35b1d156b302f3a8ac9f084f3db0394c35e6597
URL:
http://cgit.freedesktop.org/mesa/mesa/commit/?id=f35b1d156b302f3a8ac9f084f3db0394c35e6597

Author: Marek Olšák 
Date:   Thu Oct 20 01:22:07 2016 +0200

tgsi/scan: scan texture offset operands

This seems important considering how much we depend on some of the flags.

Reviewed-by: Nicolai Hähnle 

---

 src/gallium/auxiliary/tgsi/tgsi_scan.c | 16 
 1 file changed, 16 insertions(+)

diff --git a/src/gallium/auxiliary/tgsi/tgsi_scan.c 
b/src/gallium/auxiliary/tgsi/tgsi_scan.c
index 00f55c7..cbb3eec 100644
--- a/src/gallium/auxiliary/tgsi/tgsi_scan.c
+++ b/src/gallium/auxiliary/tgsi/tgsi_scan.c
@@ -368,6 +368,22 @@ scan_instruction(struct tgsi_shader_info *info,
is_interp_instruction, _mem_inst);
}
 
+   if (fullinst->Instruction.Texture) {
+  for (i = 0; i < fullinst->Texture.NumOffsets; i++) {
+ struct tgsi_full_src_register src = {};
+
+ src.Register.File = fullinst->TexOffsets[i].File;
+ src.Register.Index = fullinst->TexOffsets[i].Index;
+ src.Register.SwizzleX = fullinst->TexOffsets[i].SwizzleX;
+ src.Register.SwizzleY = fullinst->TexOffsets[i].SwizzleY;
+ src.Register.SwizzleZ = fullinst->TexOffsets[i].SwizzleZ;
+
+ /* The usage mask is suboptimal but should be safe. */
+ scan_src_operand(info, fullinst, , 0, TGSI_WRITEMASK_XYZ,
+  false, _mem_inst);
+  }
+   }
+
/* check for indirect register writes */
for (i = 0; i < fullinst->Instruction.NumDstRegs; i++) {
   const struct tgsi_full_dst_register *dst = >Dst[i];

___
mesa-commit mailing list
mesa-commit@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/mesa-commit


Mesa (master): tgsi/scan: get information about shader buffer usage

2016-10-24 Thread Marek Olšák
Module: Mesa
Branch: master
Commit: 72267a25db6d5abae80f785b8c3742a38d57767a
URL:
http://cgit.freedesktop.org/mesa/mesa/commit/?id=72267a25db6d5abae80f785b8c3742a38d57767a

Author: Marek Olšák 
Date:   Sun Oct  9 19:26:43 2016 +0200

tgsi/scan: get information about shader buffer usage

Reviewed-by: Nicolai Hähnle 

---

 src/gallium/auxiliary/tgsi/tgsi_scan.c | 19 +++
 src/gallium/auxiliary/tgsi/tgsi_scan.h |  4 
 2 files changed, 23 insertions(+)

diff --git a/src/gallium/auxiliary/tgsi/tgsi_scan.c 
b/src/gallium/auxiliary/tgsi/tgsi_scan.c
index c27f0c6..517b983 100644
--- a/src/gallium/auxiliary/tgsi/tgsi_scan.c
+++ b/src/gallium/auxiliary/tgsi/tgsi_scan.c
@@ -339,6 +339,18 @@ scan_instruction(struct tgsi_shader_info *info,
   info->images_writemask = info->images_declared;
else
   info->images_writemask |= 1 << src->Register.Index;
+} else if (src->Register.File == TGSI_FILE_BUFFER) {
+   if (src->Register.Indirect)
+  info->shader_buffers_atomic = info->shader_buffers_declared;
+   else
+  info->shader_buffers_atomic |= 1 << src->Register.Index;
+}
+ } else {
+if (src->Register.File == TGSI_FILE_BUFFER) {
+   if (src->Register.Indirect)
+  info->shader_buffers_load = info->shader_buffers_declared;
+   else
+  info->shader_buffers_load |= 1 << src->Register.Index;
 }
  }
   }
@@ -366,6 +378,11 @@ scan_instruction(struct tgsi_shader_info *info,
info->images_writemask = info->images_declared;
 else
info->images_writemask |= 1 << dst->Register.Index;
+ } else if (dst->Register.File == TGSI_FILE_BUFFER) {
+if (dst->Register.Indirect)
+   info->shader_buffers_store = info->shader_buffers_declared;
+else
+   info->shader_buffers_store |= 1 << dst->Register.Index;
  }
   }
}
@@ -427,6 +444,8 @@ scan_declaration(struct tgsi_shader_info *info,
  info->const_buffers_declared |= 1u << buffer;
   } else if (file == TGSI_FILE_IMAGE) {
  info->images_declared |= 1u << reg;
+  } else if (file == TGSI_FILE_BUFFER) {
+ info->shader_buffers_declared |= 1u << reg;
   } else if (file == TGSI_FILE_INPUT) {
  info->input_semantic_name[reg] = (ubyte) semName;
  info->input_semantic_index[reg] = (ubyte) semIndex;
diff --git a/src/gallium/auxiliary/tgsi/tgsi_scan.h 
b/src/gallium/auxiliary/tgsi/tgsi_scan.h
index 16f0034..602a870 100644
--- a/src/gallium/auxiliary/tgsi/tgsi_scan.h
+++ b/src/gallium/auxiliary/tgsi/tgsi_scan.h
@@ -133,6 +133,10 @@ struct tgsi_shader_info
 * Bitmask indicating which declared image is a buffer.
 */
unsigned images_buffers;
+   unsigned shader_buffers_declared; /**< bitmask of declared shader buffers */
+   unsigned shader_buffers_load; /**< bitmask of shader buffers using loads */
+   unsigned shader_buffers_store; /**< bitmask of shader buffers using stores 
*/
+   unsigned shader_buffers_atomic; /**< bitmask of shader buffers using 
atomics */
/**
 * Bitmask indicating which register files are accessed with
 * indirect addressing.  The bits are (1 << TGSI_FILE_x), etc.

___
mesa-commit mailing list
mesa-commit@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/mesa-commit


Mesa (master): tgsi/scan: get information about indirect 2D file access

2016-10-24 Thread Marek Olšák
Module: Mesa
Branch: master
Commit: f095a4eb171aadf525198e6583a1796ffe5a07b7
URL:
http://cgit.freedesktop.org/mesa/mesa/commit/?id=f095a4eb171aadf525198e6583a1796ffe5a07b7

Author: Marek Olšák 
Date:   Thu Oct 20 00:57:07 2016 +0200

tgsi/scan: get information about indirect 2D file access

Reviewed-by: Nicolai Hähnle 

---

 src/gallium/auxiliary/tgsi/tgsi_scan.c | 6 ++
 src/gallium/auxiliary/tgsi/tgsi_scan.h | 1 +
 2 files changed, 7 insertions(+)

diff --git a/src/gallium/auxiliary/tgsi/tgsi_scan.c 
b/src/gallium/auxiliary/tgsi/tgsi_scan.c
index 0c81005..e5edea8 100644
--- a/src/gallium/auxiliary/tgsi/tgsi_scan.c
+++ b/src/gallium/auxiliary/tgsi/tgsi_scan.c
@@ -285,6 +285,9 @@ scan_instruction(struct tgsi_shader_info *info,
  }
   }
 
+  if (src->Register.Dimension && src->Dimension.Indirect)
+ info->dim_indirect_files |= 1u << src->Register.File;
+
   /* Texture samplers */
   if (src->Register.File == TGSI_FILE_SAMPLER) {
  const unsigned index = src->Register.Index;
@@ -338,6 +341,9 @@ scan_instruction(struct tgsi_shader_info *info,
  info->indirect_files_written |= (1 << dst->Register.File);
   }
 
+  if (dst->Register.Dimension && dst->Dimension.Indirect)
+ info->dim_indirect_files |= 1u << dst->Register.File;
+
   if (is_memory_file(dst->Register.File)) {
  assert(fullinst->Instruction.Opcode == TGSI_OPCODE_STORE);
 
diff --git a/src/gallium/auxiliary/tgsi/tgsi_scan.h 
b/src/gallium/auxiliary/tgsi/tgsi_scan.h
index 2e61dc7..47528d5 100644
--- a/src/gallium/auxiliary/tgsi/tgsi_scan.h
+++ b/src/gallium/auxiliary/tgsi/tgsi_scan.h
@@ -142,6 +142,7 @@ struct tgsi_shader_info
 */
unsigned indirect_files_read;
unsigned indirect_files_written;
+   unsigned dim_indirect_files; /**< shader resource indexing */
unsigned const_buffers_indirect; /**< const buffers using indirect 
addressing */
 
unsigned properties[TGSI_PROPERTY_COUNT]; /* index with TGSI_PROPERTY_ */

___
mesa-commit mailing list
mesa-commit@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/mesa-commit


Mesa (master): i965/gen8: Use DrawBuffer-> _IntegerBuffers in gen8_upload_ps_blend()

2016-10-24 Thread Anuj Phogat
Module: Mesa
Branch: master
Commit: 93b84cae54d1af7ecd0db3bc9f3bb5ab7c09ef55
URL:
http://cgit.freedesktop.org/mesa/mesa/commit/?id=93b84cae54d1af7ecd0db3bc9f3bb5ab7c09ef55

Author: Anuj Phogat 
Date:   Tue Oct 18 15:47:32 2016 -0700

i965/gen8: Use DrawBuffer->_IntegerBuffers in gen8_upload_ps_blend()

No functional changes in this patch.

Signed-off-by: Anuj Phogat 
Reviewed-by: Kenneth Graunke 

---

 src/mesa/drivers/dri/i965/gen8_blend_state.c | 7 ++-
 1 file changed, 2 insertions(+), 5 deletions(-)

diff --git a/src/mesa/drivers/dri/i965/gen8_blend_state.c 
b/src/mesa/drivers/dri/i965/gen8_blend_state.c
index 8aca8b8..84cbf60 100644
--- a/src/mesa/drivers/dri/i965/gen8_blend_state.c
+++ b/src/mesa/drivers/dri/i965/gen8_blend_state.c
@@ -212,6 +212,7 @@ gen8_upload_ps_blend(struct brw_context *brw)
 
/* _NEW_BUFFERS */
struct gl_renderbuffer *rb = ctx->DrawBuffer->_ColorDrawBuffers[0];
+   const bool buffer0_is_integer = ctx->DrawBuffer->_IntegerBuffers & 0x1;
 
/* BRW_NEW_FRAGMENT_PROGRAM | _NEW_BUFFERS | _NEW_COLOR */
if (brw_color_buffer_write_enabled(brw))
@@ -236,11 +237,7 @@ gen8_upload_ps_blend(struct brw_context *brw)
 *  integer format, the SAMPLE_ALPHA_TO_COVERAGE and SAMPLE_ALPHA_TO_ONE
 *  operations are skipped."
 */
-   GLenum rb_type =
-  rb ? _mesa_get_format_datatype(rb->Format) : GL_UNSIGNED_NORMALIZED;
-
-   if (rb && rb_type != GL_INT && rb_type != GL_UNSIGNED_INT &&
-   (ctx->Color.BlendEnabled & 1)) {
+   if (rb && !buffer0_is_integer && (ctx->Color.BlendEnabled & 1)) {
   GLenum eqRGB = ctx->Color.Blend[0].EquationRGB;
   GLenum eqA = ctx->Color.Blend[0].EquationA;
   GLenum srcRGB = ctx->Color.Blend[0].SrcRGB;

___
mesa-commit mailing list
mesa-commit@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/mesa-commit


Mesa (master): i965/gen8: Don' t enable alpha test and alpha to coverage if draw bufer zero is integer type

2016-10-24 Thread Anuj Phogat
Module: Mesa
Branch: master
Commit: 35010718bc64c169b19268ec988b3e358272c302
URL:
http://cgit.freedesktop.org/mesa/mesa/commit/?id=35010718bc64c169b19268ec988b3e358272c302

Author: Anuj Phogat 
Date:   Tue Oct 18 15:52:19 2016 -0700

i965/gen8: Don't enable alpha test and alpha to coverage if draw bufer zero is 
integer type

We follow this rule at multiple places in i965 driver. This patch
doesn't fix any testcase.

Signed-off-by: Anuj Phogat 
Reviewed-by: Kenneth Graunke 

---

 src/mesa/drivers/dri/i965/gen8_blend_state.c | 15 +--
 1 file changed, 9 insertions(+), 6 deletions(-)

diff --git a/src/mesa/drivers/dri/i965/gen8_blend_state.c 
b/src/mesa/drivers/dri/i965/gen8_blend_state.c
index 84cbf60..c721da1 100644
--- a/src/mesa/drivers/dri/i965/gen8_blend_state.c
+++ b/src/mesa/drivers/dri/i965/gen8_blend_state.c
@@ -218,13 +218,16 @@ gen8_upload_ps_blend(struct brw_context *brw)
if (brw_color_buffer_write_enabled(brw))
   dw1 |= GEN8_PS_BLEND_HAS_WRITEABLE_RT;
 
-   /* _NEW_COLOR */
-   if (ctx->Color.AlphaEnabled)
-  dw1 |= GEN8_PS_BLEND_ALPHA_TEST_ENABLE;
+   if(!buffer0_is_integer) {
+  /* _NEW_COLOR */
+  if (ctx->Color.AlphaEnabled)
+ dw1 |= GEN8_PS_BLEND_ALPHA_TEST_ENABLE;
 
-   /* _NEW_MULTISAMPLE */
-   if (_mesa_is_multisample_enabled(ctx) && 
ctx->Multisample.SampleAlphaToCoverage)
-  dw1 |= GEN8_PS_BLEND_ALPHA_TO_COVERAGE_ENABLE;
+  /* _NEW_MULTISAMPLE */
+  if (_mesa_is_multisample_enabled(ctx) &&
+  ctx->Multisample.SampleAlphaToCoverage)
+ dw1 |= GEN8_PS_BLEND_ALPHA_TO_COVERAGE_ENABLE;
+   }
 
/* Used for implementing the following bit of GL_EXT_texture_integer:
 * "Per-fragment operations that require floating-point color

___
mesa-commit mailing list
mesa-commit@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/mesa-commit


Mesa (master): i965/gen8: Use DrawBuffer-> _IntegerBuffers in gen8_upload_blend_state()

2016-10-24 Thread Anuj Phogat
Module: Mesa
Branch: master
Commit: e2dd582de8eb5ccba669daddf0bd1cb5f72c6bd4
URL:
http://cgit.freedesktop.org/mesa/mesa/commit/?id=e2dd582de8eb5ccba669daddf0bd1cb5f72c6bd4

Author: Anuj Phogat 
Date:   Tue Oct 18 15:41:49 2016 -0700

i965/gen8: Use DrawBuffer->_IntegerBuffers in gen8_upload_blend_state()

No functional changes in this patch.

Signed-off-by: Anuj Phogat 
Reviewed-by: Kenneth Graunke 

---

 src/mesa/drivers/dri/i965/gen8_blend_state.c | 10 ++
 1 file changed, 2 insertions(+), 8 deletions(-)

diff --git a/src/mesa/drivers/dri/i965/gen8_blend_state.c 
b/src/mesa/drivers/dri/i965/gen8_blend_state.c
index 4935d82..8aca8b8 100644
--- a/src/mesa/drivers/dri/i965/gen8_blend_state.c
+++ b/src/mesa/drivers/dri/i965/gen8_blend_state.c
@@ -59,11 +59,7 @@ gen8_upload_blend_state(struct brw_context *brw)
 * integer format, the SAMPLE_ALPHA_TO_COVERAGE and SAMPLE_ALPHA_TO_ONE
 * operations are skipped."
 */
-   struct gl_renderbuffer *rb0 = ctx->DrawBuffer->_ColorDrawBuffers[0];
-   GLenum rb_zero_type =
-  rb0 ? _mesa_get_format_datatype(rb0->Format) : GL_UNSIGNED_NORMALIZED;
-
-   if (rb_zero_type != GL_INT && rb_zero_type != GL_UNSIGNED_INT) {
+   if (!(ctx->DrawBuffer->_IntegerBuffers & 0x1)) {
   /* _NEW_MULTISAMPLE */
   if (_mesa_is_multisample_enabled(ctx)) {
  if (ctx->Multisample.SampleAlphaToCoverage) {
@@ -90,8 +86,6 @@ gen8_upload_blend_state(struct brw_context *brw)
for (int i = 0; i < nr_draw_buffers; i++) {
   /* _NEW_BUFFERS */
   struct gl_renderbuffer *rb = ctx->DrawBuffer->_ColorDrawBuffers[i];
-  GLenum rb_type =
- rb ? _mesa_get_format_datatype(rb->Format) : GL_UNSIGNED_NORMALIZED;
 
   /* Used for implementing the following bit of GL_EXT_texture_integer:
* "Per-fragment operations that require floating-point color
@@ -99,7 +93,7 @@ gen8_upload_blend_state(struct brw_context *brw)
*  blending, and dithering, have no effect when the corresponding
*  colors are written to an integer color buffer."
   */
-  bool integer = rb_type == GL_INT || rb_type == GL_UNSIGNED_INT;
+  bool integer = ctx->DrawBuffer->_IntegerBuffers & (0x1 << i);
 
   /* _NEW_COLOR */
   if (ctx->Color.ColorLogicOpEnabled) {

___
mesa-commit mailing list
mesa-commit@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/mesa-commit


Mesa (master): nv50/ir: display OP_BAR subops in debug mode

2016-10-24 Thread Samuel Pitoiset
Module: Mesa
Branch: master
Commit: d588e4f1925c5a2fc3efbf9ab192f0f6494be57b
URL:
http://cgit.freedesktop.org/mesa/mesa/commit/?id=d588e4f1925c5a2fc3efbf9ab192f0f6494be57b

Author: Samuel Pitoiset 
Date:   Mon Oct 24 16:55:17 2016 +0200

nv50/ir: display OP_BAR subops in debug mode

Signed-off-by: Samuel Pitoiset 
Reviewed-by: Ilia Mirkin 

---

 src/gallium/drivers/nouveau/codegen/nv50_ir_print.cpp | 9 +
 1 file changed, 9 insertions(+)

diff --git a/src/gallium/drivers/nouveau/codegen/nv50_ir_print.cpp 
b/src/gallium/drivers/nouveau/codegen/nv50_ir_print.cpp
index 0c143e5..78c0757 100644
--- a/src/gallium/drivers/nouveau/codegen/nv50_ir_print.cpp
+++ b/src/gallium/drivers/nouveau/codegen/nv50_ir_print.cpp
@@ -236,6 +236,11 @@ static const char *cctlOpStr[] =
"", "", "", "", "", "iv", "ivall"
 };
 
+static const char *barOpStr[] =
+{
+   "sync", "arrive", "red and", "red or", "red popc"
+};
+
 static const char *DataTypeStr[] =
 {
"-",
@@ -611,6 +616,10 @@ void Instruction::print() const
  if (subOp < ARRAY_SIZE(cctlOpStr))
 PRINT("%s ", cctlOpStr[subOp]);
  break;
+  case OP_BAR:
+ if (subOp < ARRAY_SIZE(barOpStr))
+PRINT("%s ", barOpStr[subOp]);
+ break;
   default:
  if (subOp)
 PRINT("(SUBOP:%u) ", subOp);

___
mesa-commit mailing list
mesa-commit@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/mesa-commit


Mesa: tag mesa-13.0.0-rc2: mesa-13.0.0-rc2

2016-10-24 Thread Emil Velikov
Module: Mesa
Branch: refs/tags/mesa-13.0.0-rc2
Tag:0fb144993d637df68d8b2e6b4f30d1faeb0fe6e1
URL:
http://cgit.freedesktop.org/mesa/mesa/tag/?id=0fb144993d637df68d8b2e6b4f30d1faeb0fe6e1

Tagger: Emil Velikov 
Date:   Mon Oct 24 12:33:46 2016 +0100

mesa-13.0.0-rc2
___
mesa-commit mailing list
mesa-commit@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/mesa-commit


Mesa (master): glsl: add matrix layout information to interface block types

2016-10-24 Thread Iago Toral Quiroga
Module: Mesa
Branch: master
Commit: 537dce06ec8e0fa4becd42d5e4b3d07cf722387f
URL:
http://cgit.freedesktop.org/mesa/mesa/commit/?id=537dce06ec8e0fa4becd42d5e4b3d07cf722387f

Author: Iago Toral Quiroga 
Date:   Fri Oct 21 13:15:41 2016 +0200

glsl: add matrix layout information to interface block types

So far we have been checking that interface block definitions had matching
matrix layouts by comparing the definitions of their fields, however, this
does not cover the case where the interface blocks are defined with
mismatching matrix layouts but don't define any field with a matrix type.
In this case Mesa will not fail to link because none of the fields will
inherit the mismatching layout qualifier.

This patch fixes the problem in the same way we fixed it for packing layout
information: we add the the layout information to the interface type and then
we check it matches during the uniform block linking process.

v2: Fix unit tests so they pass the new parameter to
glsl_type::get_interface_instance()

Fixes:
dEQP-GLES31.functional.shaders.linkage.uniform.block.layout_qualifier_mismatch_3

Bugzilla: https://bugs.freedesktop.org/show_bug.cgi?id=98245
Reviewed-by: Nicolai Hähnle  (v1)

---

 src/compiler/glsl/ast_to_hir.cpp|  2 ++
 src/compiler/glsl/builtin_variables.cpp |  1 +
 src/compiler/glsl/link_uniform_blocks.cpp   |  5 +
 src/compiler/glsl/linker.cpp|  6 --
 src/compiler/glsl/tests/general_ir_test.cpp |  2 ++
 src/compiler/glsl/tests/varyings_test.cpp   |  1 +
 src/compiler/glsl_types.cpp | 24 +++-
 src/compiler/glsl_types.h   | 13 -
 src/mesa/main/mtypes.h  |  1 +
 9 files changed, 43 insertions(+), 12 deletions(-)

diff --git a/src/compiler/glsl/ast_to_hir.cpp b/src/compiler/glsl/ast_to_hir.cpp
index 6e2f253..adedcbb 100644
--- a/src/compiler/glsl/ast_to_hir.cpp
+++ b/src/compiler/glsl/ast_to_hir.cpp
@@ -7516,6 +7516,8 @@ ast_interface_block::hir(exec_list *instructions,
   glsl_type::get_interface_instance(fields,
 num_variables,
 packing,
+matrix_layout ==
+   GLSL_MATRIX_LAYOUT_ROW_MAJOR,
 this->block_name);
 
unsigned component_size = block_type->contains_double() ? 8 : 4;
diff --git a/src/compiler/glsl/builtin_variables.cpp 
b/src/compiler/glsl/builtin_variables.cpp
index 10a8750..ca266a4 100644
--- a/src/compiler/glsl/builtin_variables.cpp
+++ b/src/compiler/glsl/builtin_variables.cpp
@@ -352,6 +352,7 @@ per_vertex_accumulator::construct_interface_instance() const
 {
return glsl_type::get_interface_instance(this->fields, this->num_fields,
 GLSL_INTERFACE_PACKING_STD140,
+false,
 "gl_PerVertex");
 }
 
diff --git a/src/compiler/glsl/link_uniform_blocks.cpp 
b/src/compiler/glsl/link_uniform_blocks.cpp
index bb423c5..c0bdfa9 100644
--- a/src/compiler/glsl/link_uniform_blocks.cpp
+++ b/src/compiler/glsl/link_uniform_blocks.cpp
@@ -247,6 +247,7 @@ process_block_array(struct uniform_block_array_elements 
*ub_array, char **name,
 
   blocks[i].UniformBufferSize = 0;
   blocks[i]._Packing = gl_uniform_block_packing(type->interface_packing);
+  blocks[i]._RowMajor = type->get_interface_row_major();
 
   parcel->process(type, blocks[i].Name);
 
@@ -354,6 +355,7 @@ create_buffer_blocks(void *mem_ctx, struct gl_context *ctx,
 blocks[i].UniformBufferSize = 0;
 blocks[i]._Packing =
gl_uniform_block_packing(block_type->interface_packing);
+blocks[i]._RowMajor = block_type->get_interface_row_major();
 
 parcel.process(block_type,
b->has_instance_name ? block_type->name : "");
@@ -486,6 +488,9 @@ link_uniform_blocks_are_compatible(const gl_uniform_block 
*a,
if (a->_Packing != b->_Packing)
   return false;
 
+   if (a->_RowMajor != b->_RowMajor)
+  return false;
+
for (unsigned i = 0; i < a->NumUniforms; i++) {
   if (strcmp(a->Uniforms[i].Name, b->Uniforms[i].Name) != 0)
  return false;
diff --git a/src/compiler/glsl/linker.cpp b/src/compiler/glsl/linker.cpp
index 0b3c195..af0e29d 100644
--- a/src/compiler/glsl/linker.cpp
+++ b/src/compiler/glsl/linker.cpp
@@ -1513,9 +1513,10 @@ private:
   }
   glsl_interface_packing packing =
  (glsl_interface_packing) type->interface_packing;
+  bool row_major = (bool) type->interface_row_major;
   const glsl_type *new_ifc_type =
  glsl_type::get_interface_instance(fields, num_fields,
-   packing, type->name);
+   

Mesa (master): st/mesa: cleanup and fix primitive restart for indirect draws

2016-10-24 Thread Nicolai Hähnle
Module: Mesa
Branch: master
Commit: 3d6b5dee3a0c9c077d68e5567b95f22b627be07e
URL:
http://cgit.freedesktop.org/mesa/mesa/commit/?id=3d6b5dee3a0c9c077d68e5567b95f22b627be07e

Author: Nicolai Hähnle 
Date:   Thu Oct 20 13:02:22 2016 +0200

st/mesa: cleanup and fix primitive restart for indirect draws

There are three intended functional changes here:

1. OpenGL 4.5 clarifies that primitive restart should only apply with index
   buffers, so make that change explicit in the indirect draw path.

2. Make PrimitiveRestartFixedIndex work with indirect draws.

3. The change where primitive_restart is only set when the restart index can
   actually have an effect (based on the size of indices) is also applied for
   indirect draws.

Cc: 13.0 
Reviewed-by: Marek Olšák 

---

 src/mesa/state_tracker/st_draw.c | 45 +---
 1 file changed, 28 insertions(+), 17 deletions(-)

diff --git a/src/mesa/state_tracker/st_draw.c b/src/mesa/state_tracker/st_draw.c
index 5dcaff0..e9f25b6 100644
--- a/src/mesa/state_tracker/st_draw.c
+++ b/src/mesa/state_tracker/st_draw.c
@@ -127,6 +127,30 @@ setup_index_buffer(struct st_context *st,
 
 
 /**
+ * Set the restart index.
+ */
+static void
+setup_primitive_restart(struct gl_context *ctx,
+const struct _mesa_index_buffer *ib,
+struct pipe_draw_info *info)
+{
+   if (ctx->Array._PrimitiveRestart) {
+  info->restart_index = _mesa_primitive_restart_index(ctx, ib->type);
+
+  /* Enable primitive restart only when the restart index can have an
+   * effect. This is required for correctness in radeonsi VI support.
+   * Other hardware may also benefit from taking a faster, non-restart path
+   * when possible.
+   */
+  if ((ib->type == GL_UNSIGNED_INT) ||
+  (ib->type == GL_UNSIGNED_SHORT && info->restart_index <= 0x) ||
+  (ib->type == GL_UNSIGNED_BYTE && info->restart_index <= 0xff))
+ info->primitive_restart = true;
+   }
+}
+
+
+/**
  * Translate OpenGL primtive type (GL_POINTS, GL_TRIANGLE_STRIP, etc) to
  * the corresponding Gallium type.
  */
@@ -205,19 +229,7 @@ st_draw_vbo(struct gl_context *ctx,
   /* The VBO module handles restart for the non-indexed GLDrawArrays
* so we only set these fields for indexed drawing:
*/
-  if (ctx->Array._PrimitiveRestart) {
- info.restart_index = _mesa_primitive_restart_index(ctx, ib->type);
-
- /* Enable primitive restart only when the restart index can have an
-  * effect. This is required for correctness in radeonsi VI support,
-  * though other hardware may also benefit from taking a faster,
-  * non-restart path when possible.
-  */
- if ((ibuffer.index_size >= 4) ||
- (ibuffer.index_size >= 2 && info.restart_index <= 0x) ||
- (info.restart_index <= 0xff))
-info.primitive_restart = true;
-  }
+  setup_primitive_restart(ctx, ib, );
}
else {
   /* Transform feedback drawing is always non-indexed. */
@@ -310,6 +322,9 @@ st_indirect_draw_vbo(struct gl_context *ctx,
   }
 
   info.indexed = TRUE;
+
+  /* Primitive restart is not handled by the VBO module in this case. */
+  setup_primitive_restart(ctx, ib, );
}
 
info.mode = translate_prim(ctx, mode);
@@ -317,10 +332,6 @@ st_indirect_draw_vbo(struct gl_context *ctx,
info.indirect = st_buffer_object(indirect_data)->buffer;
info.indirect_offset = indirect_offset;
 
-   /* Primitive restart is not handled by the VBO module in this case. */
-   info.primitive_restart = ctx->Array._PrimitiveRestart;
-   info.restart_index = ctx->Array.RestartIndex;
-
if (ST_DEBUG & DEBUG_DRAW) {
   debug_printf("st/draw indirect: mode %s drawcount %d indexed %d\n",
u_prim_name(info.mode),

___
mesa-commit mailing list
mesa-commit@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/mesa-commit


Mesa (13.0): anv: Suffix the intel_icd file with the host CPU

2016-10-24 Thread Emil Velikov
Module: Mesa
Branch: 13.0
Commit: abf5327b86e53e664f312b3b441d0505d2b40032
URL:
http://cgit.freedesktop.org/mesa/mesa/commit/?id=abf5327b86e53e664f312b3b441d0505d2b40032

Author: Jason Ekstrand 
Date:   Thu Oct 20 15:46:21 2016 -0700

anv: Suffix the intel_icd file with the host CPU

Vulkan has a multi-arch problem... The idea behind the Vulkan loader is
that you have a little json file on your disk that tells the loader where
to find drivers.  The loader looks for these json files in standard
locations, and then goes and loads the my_driver.so's that they specify.
This allows you as a driver implementer to put their driver wherever on the
disk they want so long as the ICD points in the right place.

For a multi-arch system, however, you may have multiple libvulkan_intel.so
files installed that the loader needs to pick depending on architecture.
Since the ICD file format does not specify any architecture information,
you can't tell the loader where to find the 32-bit version vs. the 64-bit
version.  The way that packagers have been dealing with this is to place
libvulkan_intel.so in the top level lib directory and provide just a name
(and no path) to the loader.  It will then use the regular system search
paths and find the correct driver.  While this solution works fine for
distro-installed Vulkan drivers, it doesn't work so well for user-installed
drivers because they may put it in /opt or $HOME/.local or some other more
exotic location.  In this case, you can't use an ICD json file with just a
library name because it doesn't know where to find it; you also have to add
that to your library lookup path via LD_LIBRARY_PATH or similar.

This patch handles both use-cases by taking advantage of the fact that the
loader dlopen()s each of the drivers and, if one dlopen() calls fails, it
silently continues on to open other drivers.  By suffixing the icd file, we
can provide two different json files: intel_icd.x86_64.json and
intel_icd.i686.json with different paths.  Since dlopen() will only succeed
on the libvulkan_intel.so of the right arch, the loader will happily ignore
the others and load that one.  This allows us to properly handle multi-arch
while still providing a full path so user installs will work fine.

I tested this on my Fedora 25 machine with 32 and 64-bit builds of our
Vulkan driver installed and 32 and 64-bit builds of crucible.  It seems to
work just fine.

Signed-off-by: Jason Ekstrand 
Reviewed-by: Emil Velikov 
Cc: "13.0" 
(cherry picked from commit d96345de989c8f9a0328cdc3588bfe186154c8ea)

Squashed with commit:

anv: Always use the full driver path in the intel_icd.*.json

Signed-off-by: Jason Ekstrand 
Reviewed-by: Emil Velikov 
Cc: "13.0" 
(cherry picked from commit 7ea4ef8849c5cc158adbdff1187b91f591552196)

Squashed with commit:

configure: Get rid of the --disable-vulkan-icd-full-driver-path flag

Signed-off-by: Jason Ekstrand 
Reviewed-by: Emil Velikov 
Cc: "13.0" 
(cherry picked from commit 3f05fc62f924c051bdb883482452fb37650d5768)

---

 src/intel/vulkan/.gitignore| 1 +
 src/intel/vulkan/Makefile.am   | 9 +++--
 src/intel/vulkan/{intel_icd.json => intel_icd.json.in} | 2 +-
 3 files changed, 9 insertions(+), 3 deletions(-)

diff --git a/src/intel/vulkan/.gitignore b/src/intel/vulkan/.gitignore
index bde5cd8..725a858 100644
--- a/src/intel/vulkan/.gitignore
+++ b/src/intel/vulkan/.gitignore
@@ -3,3 +3,4 @@
 /anv_entrypoints.h
 /anv_timestamp.h
 /dev_icd.json
+/intel_icd.*.json
diff --git a/src/intel/vulkan/Makefile.am b/src/intel/vulkan/Makefile.am
index 6e17188..7bf68a0 100644
--- a/src/intel/vulkan/Makefile.am
+++ b/src/intel/vulkan/Makefile.am
@@ -152,7 +152,7 @@ EXTRA_DIST = \
$(top_srcdir)/include/vulkan/vk_icd.h \
anv_entrypoints_gen.py \
dev_icd.json.in \
-   intel_icd.json
+   intel_icd.json.in
 
 libvulkan_intel_la_LIBADD = $(VULKAN_LIB_DEPS)
 
@@ -167,7 +167,7 @@ libvulkan_intel_la_LDFLAGS = \
 
 
 icdconfdir = @VULKAN_ICD_INSTALL_DIR@
-icdconf_DATA = intel_icd.json
+icdconf_DATA = intel_icd.@host_cpu@.json
 # The following is used for development purposes, by setting VK_ICD_FILENAMES.
 noinst_DATA = dev_icd.json
 
@@ -176,6 +176,11 @@ dev_icd.json : dev_icd.json.in
-e "s#@build_libdir@#${abs_top_builddir}/${LIB_DIR}#" \
< $(srcdir)/dev_icd.json.in > $@
 
+intel_icd.@host_cpu@.json : intel_icd.json.in
+   $(AM_V_GEN) $(SED) \
+   -e "s#@install_libdir@#${libdir}#" \
+   < $(srcdir)/intel_icd.json.in > $@
+
 # Libvulkan with dummy gem. Used for unit tests.
 libvulkan_test_la_SOURCES = $(VULKAN_GEM_STUB_FILES)
 libvulkan_test_la_LIBADD = 

Mesa (13.0): radeonsi: fix 64-bit loads from LDS

2016-10-24 Thread Emil Velikov
Module: Mesa
Branch: 13.0
Commit: 039d1e6f11c69dfe5d380e1cf568ab579507ef07
URL:
http://cgit.freedesktop.org/mesa/mesa/commit/?id=039d1e6f11c69dfe5d380e1cf568ab579507ef07

Author: Nicolai Hähnle 
Date:   Tue Oct 18 18:40:38 2016 +0200

radeonsi: fix 64-bit loads from LDS

Fixes spec/arb_tessellation_shader/execution/dvec[23]-vs-tcs-tes, among
others.

Cc: "12.0 13.0" 
Reviewed-by: Bas Nieuwenhuizen 
Reviewed-by: Marek Olšák 
(cherry picked from commit 4a2dbfff05f7be271c2aa72e783e24b31906db51)

---

 src/gallium/drivers/radeonsi/si_shader.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/src/gallium/drivers/radeonsi/si_shader.c 
b/src/gallium/drivers/radeonsi/si_shader.c
index 6a42a8f..0ee760f 100644
--- a/src/gallium/drivers/radeonsi/si_shader.c
+++ b/src/gallium/drivers/radeonsi/si_shader.c
@@ -911,7 +911,7 @@ static LLVMValueRef lds_load(struct lp_build_tgsi_context 
*bld_base,
if (tgsi_type_is_64bit(type)) {
LLVMValueRef value2;
dw_addr = lp_build_add(_base->uint_bld, dw_addr,
-  lp_build_const_int32(gallivm, swizzle + 
1));
+  lp_build_const_int32(gallivm, 1));
value2 = build_indexed_load(ctx, ctx->lds, dw_addr, false);
return si_llvm_emit_fetch_64bit(bld_base, type, value, value2);
}

___
mesa-commit mailing list
mesa-commit@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/mesa-commit


Mesa (13.0): st/glsl_to_tgsi: fix block copies of arrays of structs

2016-10-24 Thread Emil Velikov
Module: Mesa
Branch: 13.0
Commit: 8f807e914f8c7f30f8d57e1829d4cb0bd8836a21
URL:
http://cgit.freedesktop.org/mesa/mesa/commit/?id=8f807e914f8c7f30f8d57e1829d4cb0bd8836a21

Author: Nicolai Hähnle 
Date:   Sun Oct 16 17:34:33 2016 +0200

st/glsl_to_tgsi: fix block copies of arrays of structs

Use a full writemask in this case. This is relevant e.g. when a function
has an inout argument which is an array of structs.

v2: use C-style comment (Timothy Arceri)

Reviewed-by: Marek Olšák  (v1)
Cc: 13.0 
(cherry picked from commit a1895685f8f341e7facf3c5705bdee99860e3082)

---

 src/mesa/state_tracker/st_glsl_to_tgsi.cpp | 6 --
 1 file changed, 4 insertions(+), 2 deletions(-)

diff --git a/src/mesa/state_tracker/st_glsl_to_tgsi.cpp 
b/src/mesa/state_tracker/st_glsl_to_tgsi.cpp
index 562587e..854decc 100644
--- a/src/mesa/state_tracker/st_glsl_to_tgsi.cpp
+++ b/src/mesa/state_tracker/st_glsl_to_tgsi.cpp
@@ -2941,10 +2941,12 @@ glsl_to_tgsi_visitor::visit(ir_assignment *ir)
   } else if (ir->write_mask == 0) {
  assert(!ir->lhs->type->is_scalar() && !ir->lhs->type->is_vector());
 
- if (ir->lhs->type->is_array() || ir->lhs->type->is_matrix()) {
-unsigned num_elements = 
ir->lhs->type->without_array()->vector_elements;
+ unsigned num_elements = 
ir->lhs->type->without_array()->vector_elements;
+
+ if (num_elements) {
 l.writemask = u_bit_consecutive(0, num_elements);
  } else {
+/* The type is a struct or an array of (array of) structs. */
 l.writemask = WRITEMASK_XYZW;
  }
   } else {

___
mesa-commit mailing list
mesa-commit@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/mesa-commit


Mesa (13.0): nv50,nvc0: avoid reading out of bounds when getting bogus so info

2016-10-24 Thread Emil Velikov
Module: Mesa
Branch: 13.0
Commit: 05b89cf40e1f1c2a31fac1aed389764a9b1141b0
URL:
http://cgit.freedesktop.org/mesa/mesa/commit/?id=05b89cf40e1f1c2a31fac1aed389764a9b1141b0

Author: Ilia Mirkin 
Date:   Wed Oct 19 00:05:26 2016 -0400

nv50,nvc0: avoid reading out of bounds when getting bogus so info

The state tracker tries to attach the info to the wrong shader. This is
easy enough to protect against.

Signed-off-by: Ilia Mirkin 
Reviewed-by: Samuel Pitoiset 
Cc: 12.0 13.0 
(cherry picked from commit 313fba5ee1de9416930e45da8aff63a24763940b)

---

 src/gallium/drivers/nouveau/nv50/nv50_program.c | 3 +++
 src/gallium/drivers/nouveau/nvc0/nvc0_program.c | 7 +--
 2 files changed, 8 insertions(+), 2 deletions(-)

diff --git a/src/gallium/drivers/nouveau/nv50/nv50_program.c 
b/src/gallium/drivers/nouveau/nv50/nv50_program.c
index 2b66877..ea5febd 100644
--- a/src/gallium/drivers/nouveau/nv50/nv50_program.c
+++ b/src/gallium/drivers/nouveau/nv50/nv50_program.c
@@ -307,6 +307,9 @@ nv50_program_create_strmout_state(const struct 
nv50_ir_prog_info *info,
   const unsigned r = pso->output[i].register_index;
   b = pso->output[i].output_buffer;
 
+  if (r >= info->numOutputs)
+ continue;
+
   for (c = 0; c < pso->output[i].num_components; ++c)
  so->map[base[b] + p + c] = info->out[r].slot[s + c];
}
diff --git a/src/gallium/drivers/nouveau/nvc0/nvc0_program.c 
b/src/gallium/drivers/nouveau/nvc0/nvc0_program.c
index f52cbd2..a4a164f 100644
--- a/src/gallium/drivers/nouveau/nvc0/nvc0_program.c
+++ b/src/gallium/drivers/nouveau/nvc0/nvc0_program.c
@@ -509,11 +509,14 @@ nvc0_program_create_tfb_state(const struct 
nv50_ir_prog_info *info,
for (i = 0; i < pso->num_outputs; ++i) {
   unsigned s = pso->output[i].start_component;
   unsigned p = pso->output[i].dst_offset;
+  const unsigned r = pso->output[i].register_index;
   b = pso->output[i].output_buffer;
 
+  if (r >= info->numOutputs)
+ continue;
+
   for (c = 0; c < pso->output[i].num_components; ++c)
- tfb->varying_index[b][p++] =
-info->out[pso->output[i].register_index].slot[s + c];
+ tfb->varying_index[b][p++] = info->out[r].slot[s + c];
 
   tfb->varying_count[b] = MAX2(tfb->varying_count[b], p);
   tfb->stream[b] = pso->output[i].stream;

___
mesa-commit mailing list
mesa-commit@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/mesa-commit


Mesa (13.0): Revert "Revert "mapi: export all GLES 3.2 functions in libGLESv2.so""

2016-10-24 Thread Emil Velikov
Module: Mesa
Branch: 13.0
Commit: d0d3e721d02cc49693cc7518de9691bba2a7e471
URL:
http://cgit.freedesktop.org/mesa/mesa/commit/?id=d0d3e721d02cc49693cc7518de9691bba2a7e471

Author: Francisco Jerez 
Date:   Tue Oct 18 20:44:10 2016 -0700

Revert "Revert "mapi: export all GLES 3.2 functions in libGLESv2.so""

This reverts commit 85e9bbc14d93fa7166c9ae075ee7ae29a8313e3f.  The
previous commit should help with the scons build failure caused by the
original commit.

Cc: mesa-sta...@lists.freedesktop.org
Reviewed-by: Dylan Baker 
(cherry picked from commit 811eb7f178b8b85ac299121ac09a3180b9b55da2)

---

 src/mapi/glapi/gen/static_data.py | 12 
 1 file changed, 12 insertions(+)

diff --git a/src/mapi/glapi/gen/static_data.py 
b/src/mapi/glapi/gen/static_data.py
index 2f403e9..25e78bf 100644
--- a/src/mapi/glapi/gen/static_data.py
+++ b/src/mapi/glapi/gen/static_data.py
@@ -484,17 +484,22 @@ functions = [
 "BindVertexBuffer",
 "BindVertexBuffers",
 "Bitmap",
+"BlendBarrier",
 "BlendColor",
 "BlendColorEXT",
 "BlendEquation",
 "BlendEquationEXT",
+"BlendEquationi",
 "BlendEquationiARB",
 "BlendEquationSeparate",
+"BlendEquationSeparatei",
 "BlendEquationSeparateiARB",
 "BlendFunc",
+"BlendFunci",
 "BlendFunciARB",
 "BlendFuncSeparate",
 "BlendFuncSeparateEXT",
+"BlendFuncSeparatei",
 "BlendFuncSeparateiARB",
 "BlitFramebuffer",
 "BufferData",
@@ -825,6 +830,7 @@ functions = [
 "GetFramebufferAttachmentParameteriv",
 "GetFramebufferAttachmentParameterivEXT",
 "GetFramebufferParameteriv",
+"GetGraphicsResetStatus",
 "GetGraphicsResetStatusARB",
 "GetHandleARB",
 "GetHistogram",
@@ -864,8 +870,11 @@ functions = [
 "GetnSeparableFilterARB",
 "GetnTexImageARB",
 "GetnUniformdvARB",
+"GetnUniformfv",
 "GetnUniformfvARB",
+"GetnUniformiv",
 "GetnUniformivARB",
+"GetnUniformuiv",
 "GetnUniformuivARB",
 "GetObjectLabel",
 "GetObjectParameterfvARB",
@@ -1160,6 +1169,7 @@ functions = [
 "Orthof",
 "Orthox",
 "PassThrough",
+"PatchParameteri",
 "PauseTransformFeedback",
 "PixelMapfv",
 "PixelMapuiv",
@@ -1191,6 +1201,7 @@ functions = [
 "PopDebugGroup",
 "PopMatrix",
 "PopName",
+"PrimitiveBoundingBox",
 "PrimitiveRestartIndex",
 "PrimitiveRestartIndexNV",
 "PrimitiveRestartNV",
@@ -1273,6 +1284,7 @@ functions = [
 "RasterPos4s",
 "RasterPos4sv",
 "ReadBuffer",
+"ReadnPixels",
 "ReadnPixelsARB",
 "ReadPixels",
 "Rectd",

___
mesa-commit mailing list
mesa-commit@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/mesa-commit


Mesa (13.0): glapi: Move PrimitiveBoundingBox and BlendBarrier definitions into ES3.2 category.

2016-10-24 Thread Emil Velikov
Module: Mesa
Branch: 13.0
Commit: 293e4585587b6e080ad637ec765260782630a872
URL:
http://cgit.freedesktop.org/mesa/mesa/commit/?id=293e4585587b6e080ad637ec765260782630a872

Author: Francisco Jerez 
Date:   Tue Oct 18 14:53:20 2016 -0700

glapi: Move PrimitiveBoundingBox and BlendBarrier definitions into ES3.2 
category.

These two GLES 3.2 entry points were being defined in the category of
the ARB_ES3_2_compatibility and KHR_blend_equation_advanced extensions
respectively instead of in the ES3.2 category.  Defining them in the
ES3.2 category makes sure that the gl_procs.py generator emits
declarations in the glprocs.h header file for the unsuffixed GLES-only
entry points that PrimitiveBoundingBoxARB and BlendBarrierKHR
respectively alias.  This should avoid a compilation failure during
scons builds in combination with "mapi: export all GLES 3.2 functions
in libGLESv2.so".

Cc: mesa-sta...@lists.freedesktop.org
Reviewed-by: Dylan Baker 
(cherry picked from commit 15a084a03998c5c86206137fdaf6f43b5f98485a)

---

 src/mapi/glapi/gen/gl_API.xml | 30 +-
 1 file changed, 17 insertions(+), 13 deletions(-)

diff --git a/src/mapi/glapi/gen/gl_API.xml b/src/mapi/glapi/gen/gl_API.xml
index 5998ccf..00c9bb7 100644
--- a/src/mapi/glapi/gen/gl_API.xml
+++ b/src/mapi/glapi/gen/gl_API.xml
@@ -8296,6 +8296,23 @@
 
 http://www.w3.org/2001/XInclude"/>
 
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
 
 
 
@@ -8316,7 +8333,6 @@
 
 
 
-
 
 
 
@@ -8332,18 +8348,6 @@
 
 
 
-
-
-
-
-
-
-
-
-
-
-
 
 
 

___
mesa-commit mailing list
mesa-commit@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/mesa-commit


Mesa (13.0): st/glsl_to_tgsi: fix block copies of arrays of doubles

2016-10-24 Thread Emil Velikov
Module: Mesa
Branch: 13.0
Commit: 3581e21d5b0c90a3f3858f0b92f7fe58ead95560
URL:
http://cgit.freedesktop.org/mesa/mesa/commit/?id=3581e21d5b0c90a3f3858f0b92f7fe58ead95560

Author: Nicolai Hähnle 
Date:   Sun Oct 16 17:33:51 2016 +0200

st/glsl_to_tgsi: fix block copies of arrays of doubles

Set the type of the left-hand side to the same as the right-hand side,
so that when the base type is double, the writemask of the MOV instruction
is properly fixed up.

Reviewed-by: Marek Olšák 
Cc: 13.0 
(cherry picked from commit ca592af880b71feb8ebbf79f704380d0deb47b33)

---

 src/mesa/state_tracker/st_glsl_to_tgsi.cpp | 1 +
 1 file changed, 1 insertion(+)

diff --git a/src/mesa/state_tracker/st_glsl_to_tgsi.cpp 
b/src/mesa/state_tracker/st_glsl_to_tgsi.cpp
index 98ebe54..562587e 100644
--- a/src/mesa/state_tracker/st_glsl_to_tgsi.cpp
+++ b/src/mesa/state_tracker/st_glsl_to_tgsi.cpp
@@ -2880,6 +2880,7 @@ glsl_to_tgsi_visitor::emit_block_mov(ir_assignment *ir, 
const struct glsl_type *
 
assert(type->is_scalar() || type->is_vector());
 
+   l->type = type->base_type;
r->type = type->base_type;
if (cond) {
   st_src_reg l_src = st_src_reg(*l);

___
mesa-commit mailing list
mesa-commit@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/mesa-commit


Mesa (13.0): radv: use emit_icmp for samples_identical

2016-10-24 Thread Emil Velikov
Module: Mesa
Branch: 13.0
Commit: 554a99ebdecd6e2fb88e2aa05308e06372886c36
URL:
http://cgit.freedesktop.org/mesa/mesa/commit/?id=554a99ebdecd6e2fb88e2aa05308e06372886c36

Author: Dave Airlie 
Date:   Thu Oct 20 01:42:22 2016 +0100

radv: use emit_icmp for samples_identical

On a debug llvm build we'd assert on the next compare
when the return from samples_identical was i1 instead
of i32.

Cc: "13.0" 
Signed-off-by: Dave Airlie 
(cherry picked from commit d842546ad1ebdb4825f0cbca2d68a56139d88e2a)

---

 src/amd/common/ac_nir_to_llvm.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/src/amd/common/ac_nir_to_llvm.c b/src/amd/common/ac_nir_to_llvm.c
index e2f6bca..08dac80 100644
--- a/src/amd/common/ac_nir_to_llvm.c
+++ b/src/amd/common/ac_nir_to_llvm.c
@@ -3412,7 +3412,7 @@ static void visit_tex(struct nir_to_llvm_context *ctx, 
nir_tex_instr *instr)
result = build_tex_intrinsic(ctx, instr, _info);
 
result = LLVMBuildExtractElement(ctx->builder, result, 
ctx->i32zero, "");
-   result = LLVMBuildICmp(ctx->builder, LLVMIntEQ, result, 
ctx->i32zero, "");
+   result = emit_int_cmp(ctx, LLVMIntEQ, result, ctx->i32zero);
goto write_result;
}
 

___
mesa-commit mailing list
mesa-commit@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/mesa-commit


Mesa (13.0): mapi: automake: set VISIBILITY_CFLAGS for shared glapi

2016-10-24 Thread Emil Velikov
Module: Mesa
Branch: 13.0
Commit: af81cdfec045f9e175edd5b5e8fcaa9e91f0dd38
URL:
http://cgit.freedesktop.org/mesa/mesa/commit/?id=af81cdfec045f9e175edd5b5e8fcaa9e91f0dd38

Author: Jonathan Gray 
Date:   Sat Oct 22 18:19:53 2016 +1100

mapi: automake: set VISIBILITY_CFLAGS for shared glapi

shared glapi was previously built without setting CFLAGS for
AM_CFLAGS and VISIBILITY_CFLAGS.

This resulted in symbols being exported that shouldn't be.

The x86 and sparc assembly versions of the dispatch table partially
mitigated this by using .hidden.  Otherwise shared_dispatch_stub_*
were being exported.

Signed-off-by: Jonathan Gray 
Cc: "11.2 12.0 13.0" 
Reviewed-by: Emil Velikov 
Reviewed-by: Eric Engestrom 

---

 src/mapi/Makefile.am | 3 +++
 1 file changed, 3 insertions(+)

diff --git a/src/mapi/Makefile.am b/src/mapi/Makefile.am
index 46afe3b..5013e9a 100644
--- a/src/mapi/Makefile.am
+++ b/src/mapi/Makefile.am
@@ -64,6 +64,9 @@ BUILT_SOURCES += shared-glapi/glapi_mapi_tmp.h
 
 lib_LTLIBRARIES += shared-glapi/libglapi.la
 shared_glapi_libglapi_la_SOURCES = $(MAPI_GLAPI_FILES) 
shared-glapi/glapi_mapi_tmp.h
+shared_glapi_libglapi_la_CFLAGS = \
+   $(AM_CFLAGS) \
+   $(VISIBILITY_CFLAGS)
 shared_glapi_libglapi_la_CPPFLAGS = \
$(AM_CPPFLAGS) \
-DMAPI_MODE_GLAPI \

___
mesa-commit mailing list
mesa-commit@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/mesa-commit


Mesa (13.0): nvc0: do not break 3D state by pushing MS coordinates on Fermi

2016-10-24 Thread Emil Velikov
Module: Mesa
Branch: 13.0
Commit: 5798d602e0d7604cef6b9772ce794b6c409ca011
URL:
http://cgit.freedesktop.org/mesa/mesa/commit/?id=5798d602e0d7604cef6b9772ce794b6c409ca011

Author: Samuel Pitoiset 
Date:   Thu Oct 20 00:41:00 2016 +0200

nvc0: do not break 3D state by pushing MS coordinates on Fermi

Long story short, 3D and CP are aliased on Fermi and initializing
compute after pushing the MS sample coordinate offsets seems to
corrupt 3D state for weird reasons.

I still don't have the faintest clue what is going on, but
this seems to only affect Fermi generation. A possible fix
could be to use two different channels, one for 3D and one
for CP.

This fixes a bunch of regressions pinpointed by piglit.

Fixes: "nvc0: fix up image support for allowing multiple samples"
Cc: "13.0" 
Signed-off-by: Samuel Pitoiset 
Reviewed-by: Ilia Mirkin 
(cherry picked from commit 42273edf79c2500957f51690499aa3405cc689db)

---

 src/gallium/drivers/nouveau/nvc0/nvc0_screen.c | 87 +-
 1 file changed, 44 insertions(+), 43 deletions(-)

diff --git a/src/gallium/drivers/nouveau/nvc0/nvc0_screen.c 
b/src/gallium/drivers/nouveau/nvc0/nvc0_screen.c
index cfa2f76..2cac3c7 100644
--- a/src/gallium/drivers/nouveau/nvc0/nvc0_screen.c
+++ b/src/gallium/drivers/nouveau/nvc0/nvc0_screen.c
@@ -1002,49 +1002,6 @@ nvc0_screen_create(struct nouveau_device *dev)
 
PUSH_REFN (push, screen->uniform_bo, NV_VRAM_DOMAIN(>base) | 
NOUVEAU_BO_WR);
 
-   for (i = 0; i < 5; ++i) {
-  /* TIC and TSC entries for each unit (nve4+ only) */
-  /* auxiliary constants (6 user clip planes, base instance id) */
-  BEGIN_NVC0(push, NVC0_3D(CB_SIZE), 3);
-  PUSH_DATA (push, NVC0_CB_AUX_SIZE);
-  PUSH_DATAh(push, screen->uniform_bo->offset + NVC0_CB_AUX_INFO(i));
-  PUSH_DATA (push, screen->uniform_bo->offset + NVC0_CB_AUX_INFO(i));
-  BEGIN_NVC0(push, NVC0_3D(CB_BIND(i)), 1);
-  PUSH_DATA (push, (15 << 4) | 1);
-  if (screen->eng3d->oclass >= NVE4_3D_CLASS) {
- unsigned j;
- BEGIN_1IC0(push, NVC0_3D(CB_POS), 9);
- PUSH_DATA (push, NVC0_CB_AUX_UNK_INFO);
- for (j = 0; j < 8; ++j)
-PUSH_DATA(push, j);
-  } else {
- BEGIN_NVC0(push, NVC0_3D(TEX_LIMITS(i)), 1);
- PUSH_DATA (push, 0x54);
-  }
-
-  /* MS sample coordinate offsets: these do not work with _ALT modes ! */
-  BEGIN_1IC0(push, NVC0_3D(CB_POS), 1 + 2 * 8);
-  PUSH_DATA (push, NVC0_CB_AUX_MS_INFO);
-  PUSH_DATA (push, 0); /* 0 */
-  PUSH_DATA (push, 0);
-  PUSH_DATA (push, 1); /* 1 */
-  PUSH_DATA (push, 0);
-  PUSH_DATA (push, 0); /* 2 */
-  PUSH_DATA (push, 1);
-  PUSH_DATA (push, 1); /* 3 */
-  PUSH_DATA (push, 1);
-  PUSH_DATA (push, 2); /* 4 */
-  PUSH_DATA (push, 0);
-  PUSH_DATA (push, 3); /* 5 */
-  PUSH_DATA (push, 0);
-  PUSH_DATA (push, 2); /* 6 */
-  PUSH_DATA (push, 1);
-  PUSH_DATA (push, 3); /* 7 */
-  PUSH_DATA (push, 1);
-   }
-   BEGIN_NVC0(push, NVC0_3D(LINKED_TSC), 1);
-   PUSH_DATA (push, 0);
-
/* return { 0.0, 0.0, 0.0, 0.0 } for out-of-bounds vtxbuf access */
BEGIN_NVC0(push, NVC0_3D(CB_SIZE), 3);
PUSH_DATA (push, 256);
@@ -1214,6 +1171,50 @@ nvc0_screen_create(struct nouveau_device *dev)
if (nvc0_screen_init_compute(screen))
   goto fail;
 
+   /* XXX: Compute and 3D are somehow aliased on Fermi. */
+   for (i = 0; i < 5; ++i) {
+  /* TIC and TSC entries for each unit (nve4+ only) */
+  /* auxiliary constants (6 user clip planes, base instance id) */
+  BEGIN_NVC0(push, NVC0_3D(CB_SIZE), 3);
+  PUSH_DATA (push, NVC0_CB_AUX_SIZE);
+  PUSH_DATAh(push, screen->uniform_bo->offset + NVC0_CB_AUX_INFO(i));
+  PUSH_DATA (push, screen->uniform_bo->offset + NVC0_CB_AUX_INFO(i));
+  BEGIN_NVC0(push, NVC0_3D(CB_BIND(i)), 1);
+  PUSH_DATA (push, (15 << 4) | 1);
+  if (screen->eng3d->oclass >= NVE4_3D_CLASS) {
+ unsigned j;
+ BEGIN_1IC0(push, NVC0_3D(CB_POS), 9);
+ PUSH_DATA (push, NVC0_CB_AUX_UNK_INFO);
+ for (j = 0; j < 8; ++j)
+PUSH_DATA(push, j);
+  } else {
+ BEGIN_NVC0(push, NVC0_3D(TEX_LIMITS(i)), 1);
+ PUSH_DATA (push, 0x54);
+  }
+
+  /* MS sample coordinate offsets: these do not work with _ALT modes ! */
+  BEGIN_1IC0(push, NVC0_3D(CB_POS), 1 + 2 * 8);
+  PUSH_DATA (push, NVC0_CB_AUX_MS_INFO);
+  PUSH_DATA (push, 0); /* 0 */
+  PUSH_DATA (push, 0);
+  PUSH_DATA (push, 1); /* 1 */
+  PUSH_DATA (push, 0);
+  PUSH_DATA (push, 0); /* 2 */
+  PUSH_DATA (push, 1);
+  PUSH_DATA (push, 1); /* 3 */
+  PUSH_DATA (push, 1);
+  PUSH_DATA (push, 2); /* 4 */
+  PUSH_DATA (push, 0);
+  PUSH_DATA (push, 3); /* 5 */
+  PUSH_DATA (push, 0);
+  PUSH_DATA (push, 2); /* 6 */
+  PUSH_DATA (push, 1);
+  

Mesa (13.0): egl/wayland: add missing destroy_window callback

2016-10-24 Thread Emil Velikov
Module: Mesa
Branch: 13.0
Commit: 19e8270fe0333e1087653c4c1a46ac5052f58670
URL:
http://cgit.freedesktop.org/mesa/mesa/commit/?id=19e8270fe0333e1087653c4c1a46ac5052f58670

Author: Stencel, Joanna 
Date:   Mon Oct 24 09:48:11 2016 +0100

egl/wayland: add missing destroy_window callback

The original patch by Joanna added the function pointer and callback yet
things got only partially applied - the infra was added, but the
implementation was missing.

Cc: "12.0 13.0" 
Fixes: 690ead4a135 ("egl/wayland-egl: Fix for segfault in
dri2_wl_destroy_surface.")
Signed-off-by: Emil Velikov 

(cherry picked from commit 2e0ab61e29c4b44d349ab433c899b691a9b12f68)

---

 src/egl/drivers/dri2/platform_wayland.c | 15 +--
 1 file changed, 13 insertions(+), 2 deletions(-)

diff --git a/src/egl/drivers/dri2/platform_wayland.c 
b/src/egl/drivers/dri2/platform_wayland.c
index ccab192..789e035 100644
--- a/src/egl/drivers/dri2/platform_wayland.c
+++ b/src/egl/drivers/dri2/platform_wayland.c
@@ -118,6 +118,13 @@ resize_callback(struct wl_egl_window *wl_win, void *data)
(*dri2_dpy->flush->invalidate)(dri2_surf->dri_drawable);
 }
 
+static void
+destroy_window_callback(void *data)
+{
+   struct dri2_egl_surface *dri2_surf = data;
+   dri2_surf->wl_win = NULL;
+}
+
 /**
  * Called via eglCreateWindowSurface(), drv->API.CreateWindowSurface().
  */
@@ -159,6 +166,7 @@ dri2_wl_create_surface(_EGLDriver *drv, _EGLDisplay *disp,
 
dri2_surf->wl_win->private = dri2_surf;
dri2_surf->wl_win->resize_callback = resize_callback;
+   dri2_surf->wl_win->destroy_window_callback = destroy_window_callback;
 
dri2_surf->base.Width =  -1;
dri2_surf->base.Height = -1;
@@ -254,8 +262,11 @@ dri2_wl_destroy_surface(_EGLDriver *drv, _EGLDisplay 
*disp, _EGLSurface *surf)
if (dri2_surf->throttle_callback)
   wl_callback_destroy(dri2_surf->throttle_callback);
 
-   dri2_surf->wl_win->private = NULL;
-   dri2_surf->wl_win->resize_callback = NULL;
+   if (dri2_surf->wl_win) {
+  dri2_surf->wl_win->private = NULL;
+  dri2_surf->wl_win->resize_callback = NULL;
+  dri2_surf->wl_win->destroy_window_callback = NULL;
+   }
 
free(surf);
 

___
mesa-commit mailing list
mesa-commit@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/mesa-commit


Mesa (13.0): wsi/wayland: fix error path

2016-10-24 Thread Emil Velikov
Module: Mesa
Branch: 13.0
Commit: 4768b7353ff47eb6d80093b0c6f5e35747365411
URL:
http://cgit.freedesktop.org/mesa/mesa/commit/?id=4768b7353ff47eb6d80093b0c6f5e35747365411

Author: Eric Engestrom 
Date:   Thu Oct 20 00:09:11 2016 +0100

wsi/wayland: fix error path

Fixes: 1720bbd353d87412754f ("anv/wsi: split image alloc/free out to separate 
fns.")
Cc: "13.0" 
Signed-off-by: Eric Engestrom 
Signed-off-by: Dave Airlie 
(cherry picked from commit 8bf7717e1f84d180f42fb665772878d3b6d27459)

---

 src/vulkan/wsi/wsi_common_wayland.c | 4 
 1 file changed, 4 insertions(+)

diff --git a/src/vulkan/wsi/wsi_common_wayland.c 
b/src/vulkan/wsi/wsi_common_wayland.c
index 32a0a51..fc13bde 100644
--- a/src/vulkan/wsi/wsi_common_wayland.c
+++ b/src/vulkan/wsi/wsi_common_wayland.c
@@ -635,11 +635,15 @@ wsi_wl_image_init(struct wsi_wl_swapchain *chain,
wl_display_roundtrip(chain->display->display);
close(fd);
 
+   if (!image->buffer)
+  goto fail_image;
+
wl_proxy_set_queue((struct wl_proxy *)image->buffer, chain->queue);
wl_buffer_add_listener(image->buffer, _listener, image);
 
return VK_SUCCESS;
 
+fail_image:
chain->base.image_fns->free_wsi_image(vk_device, pAllocator,
  image->image, image->memory);
 

___
mesa-commit mailing list
mesa-commit@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/mesa-commit


Mesa (13.0): Update version to 13.0.0-rc2

2016-10-24 Thread Emil Velikov
Module: Mesa
Branch: 13.0
Commit: f623a8be3edc898dd13040cd06f91763b5973e48
URL:
http://cgit.freedesktop.org/mesa/mesa/commit/?id=f623a8be3edc898dd13040cd06f91763b5973e48

Author: Emil Velikov 
Date:   Mon Oct 24 12:09:15 2016 +0100

Update version to 13.0.0-rc2

Signed-off-by: Emil Velikov 

---

 VERSION | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/VERSION b/VERSION
index 0ee82ac..4bb1cb3 100644
--- a/VERSION
+++ b/VERSION
@@ -1 +1 @@
-13.0.0-rc1
+13.0.0-rc2

___
mesa-commit mailing list
mesa-commit@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/mesa-commit


Mesa (13.0): automake: don't forget to pick wglext.h in the tarball

2016-10-24 Thread Emil Velikov
Module: Mesa
Branch: 13.0
Commit: cac49ee2cd2998a27c49188101f3f1ba7196fcb5
URL:
http://cgit.freedesktop.org/mesa/mesa/commit/?id=cac49ee2cd2998a27c49188101f3f1ba7196fcb5

Author: Emil Velikov 
Date:   Thu Oct 20 18:41:22 2016 +0100

automake: don't forget to pick wglext.h in the tarball

Earlier commit reworked the header install rules, to ensure that the
correct ones are installed only as needed.

By doing so it dropped a wildcard which was effectively including the
wglext.h header in the tarball.

Add the header to the top-level noinst_HEADERS, since the it is not
meant to be installed (autoconf is not used on Windows plaforms).

Fixes: a89faa2022f ("autoconf: Make header install distinct for various
APIs (v2)")
Cc: "12.0 13.0" 
Cc: Chuck Atkins 
Signed-off-by: Emil Velikov 
Reviewed-by: Matt Turner 

(cherry picked from commit 3511a86111866f7233a337a24c9c6442b9aa05e6)

---

 Makefile.am | 1 +
 1 file changed, 1 insertion(+)

diff --git a/Makefile.am b/Makefile.am
index 49b99de..e6d1969 100644
--- a/Makefile.am
+++ b/Makefile.am
@@ -62,6 +62,7 @@ noinst_HEADERS = \
include/c99_math.h \
include/c11 \
include/D3D9 \
+   include/GL/wglext.h \
include/HaikuGL \
include/no_extern_c.h \
include/pci_ids

___
mesa-commit mailing list
mesa-commit@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/mesa-commit


Mesa (13.0): nv50/ir: process texture offset sources as regular sources

2016-10-24 Thread Emil Velikov
Module: Mesa
Branch: 13.0
Commit: 52df379d6b3a3485bf2814f8a0fb54c90b0af6ad
URL:
http://cgit.freedesktop.org/mesa/mesa/commit/?id=52df379d6b3a3485bf2814f8a0fb54c90b0af6ad

Author: Ilia Mirkin 
Date:   Wed Oct 19 01:20:03 2016 -0400

nv50/ir: process texture offset sources as regular sources

With ARB_gpu_shader5, texture offsets can be any source, including TEMPs
and IN's. Make sure to process them as regular sources so that we pick
up masks, etc.

This should fix some CTS tests that feed offsets directly to
textureGatherOffset, and we were not picking up the input use, thus not
advertising it in the shader header.

Signed-off-by: Ilia Mirkin 
Reviewed-by: Samuel Pitoiset 
Tested-by: Dave Airlie 
Cc: 12.0 13.0 
(cherry picked from commit cd45d758ff87305ceecca899fe7325779bb6755b)

---

 .../drivers/nouveau/codegen/nv50_ir_from_tgsi.cpp  | 147 +
 1 file changed, 94 insertions(+), 53 deletions(-)

diff --git a/src/gallium/drivers/nouveau/codegen/nv50_ir_from_tgsi.cpp 
b/src/gallium/drivers/nouveau/codegen/nv50_ir_from_tgsi.cpp
index db03281..01e5808 100644
--- a/src/gallium/drivers/nouveau/codegen/nv50_ir_from_tgsi.cpp
+++ b/src/gallium/drivers/nouveau/codegen/nv50_ir_from_tgsi.cpp
@@ -182,6 +182,7 @@ public:
 
// mask of used components of source s
unsigned int srcMask(unsigned int s) const;
+   unsigned int texOffsetMask() const;
 
SrcRegister getSrc(unsigned int s) const
{
@@ -234,6 +235,35 @@ private:
const struct tgsi_full_instruction *insn;
 };
 
+unsigned int Instruction::texOffsetMask() const
+{
+   const struct tgsi_instruction_texture *tex = >Texture;
+   assert(insn->Instruction.Texture);
+
+   switch (tex->Texture) {
+   case TGSI_TEXTURE_BUFFER:
+   case TGSI_TEXTURE_1D:
+   case TGSI_TEXTURE_SHADOW1D:
+   case TGSI_TEXTURE_1D_ARRAY:
+   case TGSI_TEXTURE_SHADOW1D_ARRAY:
+  return 0x1;
+   case TGSI_TEXTURE_2D:
+   case TGSI_TEXTURE_SHADOW2D:
+   case TGSI_TEXTURE_2D_ARRAY:
+   case TGSI_TEXTURE_SHADOW2D_ARRAY:
+   case TGSI_TEXTURE_RECT:
+   case TGSI_TEXTURE_SHADOWRECT:
+   case TGSI_TEXTURE_2D_MSAA:
+   case TGSI_TEXTURE_2D_ARRAY_MSAA:
+  return 0x3;
+   case TGSI_TEXTURE_3D:
+  return 0x7;
+   default:
+  assert(!"Unexpected texture target");
+  return 0xf;
+   }
+}
+
 unsigned int Instruction::srcMask(unsigned int s) const
 {
unsigned int mask = insn->Dst[0].Register.WriteMask;
@@ -955,6 +985,9 @@ private:
int inferSysValDirection(unsigned sn) const;
bool scanDeclaration(const struct tgsi_full_declaration *);
bool scanInstruction(const struct tgsi_full_instruction *);
+   void scanInstructionSrc(const Instruction& insn,
+   const Instruction::SrcRegister& src,
+   unsigned mask);
void scanProperty(const struct tgsi_full_property *);
void scanImmediate(const struct tgsi_full_immediate *);
 
@@ -1364,6 +1397,61 @@ inline bool Source::isEdgeFlagPassthrough(const 
Instruction& insn) const
   insn.getSrc(0).getFile() == TGSI_FILE_INPUT;
 }
 
+void Source::scanInstructionSrc(const Instruction& insn,
+const Instruction::SrcRegister& src,
+unsigned mask)
+{
+   if (src.getFile() == TGSI_FILE_TEMPORARY) {
+  if (src.isIndirect(0))
+ indirectTempArrays.insert(src.getArrayId());
+   } else
+   if (src.getFile() == TGSI_FILE_BUFFER ||
+   src.getFile() == TGSI_FILE_IMAGE ||
+   (src.getFile() == TGSI_FILE_MEMORY &&
+memoryFiles[src.getIndex(0)].mem_type == TGSI_MEMORY_TYPE_GLOBAL)) {
+  info->io.globalAccess |= (insn.getOpcode() == TGSI_OPCODE_LOAD) ?
+ 0x1 : 0x2;
+   } else
+   if (src.getFile() == TGSI_FILE_OUTPUT) {
+  if (src.isIndirect(0)) {
+ // We don't know which one is accessed, just mark everything for
+ // reading. This is an extremely unlikely occurrence.
+ for (unsigned i = 0; i < info->numOutputs; ++i)
+info->out[i].oread = 1;
+  } else {
+ info->out[src.getIndex(0)].oread = 1;
+  }
+   }
+   if (src.getFile() != TGSI_FILE_INPUT)
+  return;
+
+   if (src.isIndirect(0)) {
+  for (unsigned i = 0; i < info->numInputs; ++i)
+ info->in[i].mask = 0xf;
+   } else {
+  const int i = src.getIndex(0);
+  for (unsigned c = 0; c < 4; ++c) {
+ if (!(mask & (1 << c)))
+continue;
+ int k = src.getSwizzle(c);
+ if (k <= TGSI_SWIZZLE_W)
+info->in[i].mask |= 1 << k;
+  }
+  switch (info->in[i].sn) {
+  case TGSI_SEMANTIC_PSIZE:
+  case TGSI_SEMANTIC_PRIMID:
+  case TGSI_SEMANTIC_FOG:
+ info->in[i].mask &= 0x1;
+ break;
+  case TGSI_SEMANTIC_PCOORD:
+ info->in[i].mask &= 0x3;
+ break;
+  default:
+ break;
+  }
+   }
+}
+
 bool 

Mesa (13.0): st/mesa: only set primitive_restart when the restart index is in range

2016-10-24 Thread Emil Velikov
Module: Mesa
Branch: 13.0
Commit: ba6efd48c3ab36ea532d0b1b2f5493b6d9b1937b
URL:
http://cgit.freedesktop.org/mesa/mesa/commit/?id=ba6efd48c3ab36ea532d0b1b2f5493b6d9b1937b

Author: Nicolai Hähnle 
Date:   Wed Oct 19 18:14:48 2016 +0200

st/mesa: only set primitive_restart when the restart index is in range

Even when enabled, primitive restart has no effect when the restart index
is larger than the representable values in the index buffer.

Fixes GL45-CTS.gtf31.GL3Tests.primitive_restart.primitive_restart_upconvert
for radeonsi VI.

v2: add an explanatory comment

Cc: "12.0 13.0" 
Reviewed-by: Marek Olšák  (v1)
(cherry picked from commit bfa50f88cea2ba9f4dc4b825828d2c8f02866fc3)

---

 src/mesa/state_tracker/st_draw.c | 15 +--
 1 file changed, 13 insertions(+), 2 deletions(-)

diff --git a/src/mesa/state_tracker/st_draw.c b/src/mesa/state_tracker/st_draw.c
index f4af23d..5dcaff0 100644
--- a/src/mesa/state_tracker/st_draw.c
+++ b/src/mesa/state_tracker/st_draw.c
@@ -205,8 +205,19 @@ st_draw_vbo(struct gl_context *ctx,
   /* The VBO module handles restart for the non-indexed GLDrawArrays
* so we only set these fields for indexed drawing:
*/
-  info.primitive_restart = ctx->Array._PrimitiveRestart;
-  info.restart_index = _mesa_primitive_restart_index(ctx, ib->type);
+  if (ctx->Array._PrimitiveRestart) {
+ info.restart_index = _mesa_primitive_restart_index(ctx, ib->type);
+
+ /* Enable primitive restart only when the restart index can have an
+  * effect. This is required for correctness in radeonsi VI support,
+  * though other hardware may also benefit from taking a faster,
+  * non-restart path when possible.
+  */
+ if ((ibuffer.index_size >= 4) ||
+ (ibuffer.index_size >= 2 && info.restart_index <= 0x) ||
+ (info.restart_index <= 0xff))
+info.primitive_restart = true;
+  }
}
else {
   /* Transform feedback drawing is always non-indexed. */

___
mesa-commit mailing list
mesa-commit@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/mesa-commit


Mesa (13.0): radv: allow cmask transitions without fast clear

2016-10-24 Thread Emil Velikov
Module: Mesa
Branch: 13.0
Commit: 0f8b7f90d1e52343e04128bc55948c141a71d0ca
URL:
http://cgit.freedesktop.org/mesa/mesa/commit/?id=0f8b7f90d1e52343e04128bc55948c141a71d0ca

Author: Dave Airlie 
Date:   Thu Oct 20 12:05:44 2016 +1000

radv: allow cmask transitions without fast clear

This fixes
dEQP-VK.pipeline.multisample.sampled_image*

These all render to multisampled image, and then
sample from it, so we must transition it correctly,
since we have a cmask and fmask this will cause
the correct transition.

Cc: "13.0" 
Reviewed-by: Bas Nieuwenhuizen 
Signed-off-by: Dave Airlie 
(cherry picked from commit a969548f59342330badf78ec7721a1ead7599a29)

---

 src/amd/vulkan/radv_cmd_buffer.c | 3 ---
 1 file changed, 3 deletions(-)

diff --git a/src/amd/vulkan/radv_cmd_buffer.c b/src/amd/vulkan/radv_cmd_buffer.c
index 3f1a6f4..690c739 100644
--- a/src/amd/vulkan/radv_cmd_buffer.c
+++ b/src/amd/vulkan/radv_cmd_buffer.c
@@ -2163,9 +2163,6 @@ static void radv_handle_cmask_image_transition(struct 
radv_cmd_buffer *cmd_buffe
radv_initialise_cmask(cmd_buffer, image, 0xu);
} else if (radv_layout_has_cmask(image, src_layout) &&
   !radv_layout_has_cmask(image, dst_layout)) {
-
-   if (!cmd_buffer->device->allow_fast_clears)
-   return;
radv_fast_clear_flush_image_inplace(cmd_buffer, image);
}
 }

___
mesa-commit mailing list
mesa-commit@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/mesa-commit


Mesa (master): glsl/mesa: remove unused namespace support from the symbol table

2016-10-24 Thread Timothy Arceri
Module: Mesa
Branch: master
Commit: 6dbe8a1b9fd750b4c1bb600a0bb43129d95e6eca
URL:
http://cgit.freedesktop.org/mesa/mesa/commit/?id=6dbe8a1b9fd750b4c1bb600a0bb43129d95e6eca

Author: Timothy Arceri 
Date:   Fri Oct 21 16:50:52 2016 +1100

glsl/mesa: remove unused namespace support from the symbol table

Namespace support seems to have been unused for a very long time.

Previously the hash table entry was never removed and the symbol name
wasn't freed until the symbol table was destroyed.

In theory this could reduced the number of times we need to copy a string
as duplicate names are reused. However in practice there is likely only a
limited number of symbols that are the same and this is likely to cause
other less than optimal behaviour such as the hash_table continuously
growing.

Along with dropping namespace support this change removes entries from
the hash table as they become unused.

Reviewed-by: Samuel Iglesias Gonsálvez 

---

 src/compiler/glsl/glsl_symbol_table.cpp |  18 +-
 src/compiler/glsl/ir_print_visitor.cpp  |   4 +-
 src/mesa/program/program_lexer.l|   2 +-
 src/mesa/program/program_parse.y|  18 +-
 src/mesa/program/symbol_table.c | 336 ++--
 src/mesa/program/symbol_table.h |  15 +-
 6 files changed, 128 insertions(+), 265 deletions(-)

diff --git a/src/compiler/glsl/glsl_symbol_table.cpp 
b/src/compiler/glsl/glsl_symbol_table.cpp
index 6d7baad..3162bb6 100644
--- a/src/compiler/glsl/glsl_symbol_table.cpp
+++ b/src/compiler/glsl/glsl_symbol_table.cpp
@@ -126,7 +126,7 @@ void glsl_symbol_table::pop_scope()
 
 bool glsl_symbol_table::name_declared_this_scope(const char *name)
 {
-   return _mesa_symbol_table_symbol_scope(table, -1, name) == 0;
+   return _mesa_symbol_table_symbol_scope(table, name) == 0;
 }
 
 bool glsl_symbol_table::add_variable(ir_variable *v)
@@ -152,7 +152,7 @@ bool glsl_symbol_table::add_variable(ir_variable *v)
 symbol_table_entry *entry = new(mem_ctx) symbol_table_entry(v);
 if (existing != NULL)
entry->f = existing->f;
-int added = _mesa_symbol_table_add_symbol(table, -1, v->name, entry);
+int added = _mesa_symbol_table_add_symbol(table, v->name, entry);
 assert(added == 0);
 (void)added;
 return true;
@@ -162,13 +162,13 @@ bool glsl_symbol_table::add_variable(ir_variable *v)
 
/* 1.20+ rules: */
symbol_table_entry *entry = new(mem_ctx) symbol_table_entry(v);
-   return _mesa_symbol_table_add_symbol(table, -1, v->name, entry) == 0;
+   return _mesa_symbol_table_add_symbol(table, v->name, entry) == 0;
 }
 
 bool glsl_symbol_table::add_type(const char *name, const glsl_type *t)
 {
symbol_table_entry *entry = new(mem_ctx) symbol_table_entry(t);
-   return _mesa_symbol_table_add_symbol(table, -1, name, entry) == 0;
+   return _mesa_symbol_table_add_symbol(table, name, entry) == 0;
 }
 
 bool glsl_symbol_table::add_interface(const char *name, const glsl_type *i,
@@ -180,7 +180,7 @@ bool glsl_symbol_table::add_interface(const char *name, 
const glsl_type *i,
   symbol_table_entry *entry =
  new(mem_ctx) symbol_table_entry(i, mode);
   bool add_interface_symbol_result =
- _mesa_symbol_table_add_symbol(table, -1, name, entry) == 0;
+ _mesa_symbol_table_add_symbol(table, name, entry) == 0;
   assert(add_interface_symbol_result);
   return add_interface_symbol_result;
} else {
@@ -199,7 +199,7 @@ bool glsl_symbol_table::add_function(ir_function *f)
   }
}
symbol_table_entry *entry = new(mem_ctx) symbol_table_entry(f);
-   return _mesa_symbol_table_add_symbol(table, -1, f->name, entry) == 0;
+   return _mesa_symbol_table_add_symbol(table, f->name, entry) == 0;
 }
 
 bool glsl_symbol_table::add_default_precision_qualifier(const char *type_name,
@@ -213,13 +213,13 @@ bool 
glsl_symbol_table::add_default_precision_qualifier(const char *type_name,
symbol_table_entry *entry =
   new(mem_ctx) symbol_table_entry(default_specifier);
 
-   return _mesa_symbol_table_add_symbol(table, -1, name, entry) == 0;
+   return _mesa_symbol_table_add_symbol(table, name, entry) == 0;
 }
 
 void glsl_symbol_table::add_global_function(ir_function *f)
 {
symbol_table_entry *entry = new(mem_ctx) symbol_table_entry(f);
-   int added = _mesa_symbol_table_add_global_symbol(table, -1, f->name, entry);
+   int added = _mesa_symbol_table_add_global_symbol(table, f->name, entry);
assert(added == 0);
(void)added;
 }
@@ -261,7 +261,7 @@ int 
glsl_symbol_table::get_default_precision_qualifier(const char *type_name)
 symbol_table_entry *glsl_symbol_table::get_entry(const char *name)
 {
return (symbol_table_entry *)
-  _mesa_symbol_table_find_symbol(table, -1, name);
+  _mesa_symbol_table_find_symbol(table, name);
 }
 
 void
diff --git a/src/compiler/glsl/ir_print_visitor.cpp 
b/src/compiler/glsl/ir_print_visitor.cpp
index 

Mesa (master): anv: automake: cleanup the generated json file during make clean

2016-10-24 Thread Emil Velikov
Module: Mesa
Branch: master
Commit: 8df581520a823564be0ab5af7dbb7d501b1c9670
URL:
http://cgit.freedesktop.org/mesa/mesa/commit/?id=8df581520a823564be0ab5af7dbb7d501b1c9670

Author: Emil Velikov 
Date:   Mon Oct 24 11:27:44 2016 +0100

anv: automake: cleanup the generated json file during make clean

Signed-off-by: Emil Velikov 

---

 src/intel/vulkan/Makefile.am | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/src/intel/vulkan/Makefile.am b/src/intel/vulkan/Makefile.am
index 069e363..4a7bb18 100644
--- a/src/intel/vulkan/Makefile.am
+++ b/src/intel/vulkan/Makefile.am
@@ -147,7 +147,7 @@ anv_timestamp.h:
$(AM_V_GEN) echo "#define ANV_TIMESTAMP \"$(TIMESTAMP_CMD)\"" > $@
 
 BUILT_SOURCES = $(VULKAN_GENERATED_FILES)
-CLEANFILES = $(BUILT_SOURCES) dev_icd.json intel_icd.json
+CLEANFILES = $(BUILT_SOURCES) dev_icd.json intel_icd.@host_cpu@.json
 EXTRA_DIST = \
$(top_srcdir)/include/vulkan/vk_icd.h \
anv_entrypoints_gen.py \

___
mesa-commit mailing list
mesa-commit@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/mesa-commit


Mesa (master): mapi: automake: set VISIBILITY_CFLAGS for shared glapi

2016-10-24 Thread Emil Velikov
Module: Mesa
Branch: master
Commit: 907ace57986733add2aebfa9dd7c83c67efed70e
URL:
http://cgit.freedesktop.org/mesa/mesa/commit/?id=907ace57986733add2aebfa9dd7c83c67efed70e

Author: Jonathan Gray 
Date:   Sat Oct 22 18:19:53 2016 +1100

mapi: automake: set VISIBILITY_CFLAGS for shared glapi

shared glapi was previously built without setting CFLAGS for
AM_CFLAGS and VISIBILITY_CFLAGS.

This resulted in symbols being exported that shouldn't be.

The x86 and sparc assembly versions of the dispatch table partially
mitigated this by using .hidden.  Otherwise shared_dispatch_stub_*
were being exported.

Signed-off-by: Jonathan Gray 
Cc: "11.2 12.0 13.0" 
Reviewed-by: Emil Velikov 
Reviewed-by: Eric Engestrom 

---

 src/mapi/Makefile.am | 3 +++
 1 file changed, 3 insertions(+)

diff --git a/src/mapi/Makefile.am b/src/mapi/Makefile.am
index 46afe3b..5013e9a 100644
--- a/src/mapi/Makefile.am
+++ b/src/mapi/Makefile.am
@@ -64,6 +64,9 @@ BUILT_SOURCES += shared-glapi/glapi_mapi_tmp.h
 
 lib_LTLIBRARIES += shared-glapi/libglapi.la
 shared_glapi_libglapi_la_SOURCES = $(MAPI_GLAPI_FILES) 
shared-glapi/glapi_mapi_tmp.h
+shared_glapi_libglapi_la_CFLAGS = \
+   $(AM_CFLAGS) \
+   $(VISIBILITY_CFLAGS)
 shared_glapi_libglapi_la_CPPFLAGS = \
$(AM_CPPFLAGS) \
-DMAPI_MODE_GLAPI \

___
mesa-commit mailing list
mesa-commit@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/mesa-commit


Mesa (master): automake: don't forget to pick wglext.h in the tarball

2016-10-24 Thread Emil Velikov
Module: Mesa
Branch: master
Commit: 3511a86111866f7233a337a24c9c6442b9aa05e6
URL:
http://cgit.freedesktop.org/mesa/mesa/commit/?id=3511a86111866f7233a337a24c9c6442b9aa05e6

Author: Emil Velikov 
Date:   Thu Oct 20 18:41:22 2016 +0100

automake: don't forget to pick wglext.h in the tarball

Earlier commit reworked the header install rules, to ensure that the
correct ones are installed only as needed.

By doing so it dropped a wildcard which was effectively including the
wglext.h header in the tarball.

Add the header to the top-level noinst_HEADERS, since the it is not
meant to be installed (autoconf is not used on Windows plaforms).

Fixes: a89faa2022f ("autoconf: Make header install distinct for various
APIs (v2)")
Cc: "12.0 13.0" 
Cc: Chuck Atkins 
Signed-off-by: Emil Velikov 
Reviewed-by: Matt Turner 

---

 Makefile.am | 1 +
 1 file changed, 1 insertion(+)

diff --git a/Makefile.am b/Makefile.am
index 49b99de..e6d1969 100644
--- a/Makefile.am
+++ b/Makefile.am
@@ -62,6 +62,7 @@ noinst_HEADERS = \
include/c99_math.h \
include/c11 \
include/D3D9 \
+   include/GL/wglext.h \
include/HaikuGL \
include/no_extern_c.h \
include/pci_ids

___
mesa-commit mailing list
mesa-commit@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/mesa-commit


Mesa (master): egl/wayland: add missing destroy_window callback

2016-10-24 Thread Emil Velikov
Module: Mesa
Branch: master
Commit: 2e0ab61e29c4b44d349ab433c899b691a9b12f68
URL:
http://cgit.freedesktop.org/mesa/mesa/commit/?id=2e0ab61e29c4b44d349ab433c899b691a9b12f68

Author: Stencel, Joanna 
Date:   Mon Oct 24 09:48:11 2016 +0100

egl/wayland: add missing destroy_window callback

The original patch by Joanna added the function pointer and callback yet
things got only partially applied - the infra was added, but the
implementation was missing.

Cc: "12.0 13.0" 
Fixes: 690ead4a135 ("egl/wayland-egl: Fix for segfault in
dri2_wl_destroy_surface.")
Signed-off-by: Emil Velikov 

---

 src/egl/drivers/dri2/platform_wayland.c | 15 +--
 1 file changed, 13 insertions(+), 2 deletions(-)

diff --git a/src/egl/drivers/dri2/platform_wayland.c 
b/src/egl/drivers/dri2/platform_wayland.c
index ccab192..789e035 100644
--- a/src/egl/drivers/dri2/platform_wayland.c
+++ b/src/egl/drivers/dri2/platform_wayland.c
@@ -118,6 +118,13 @@ resize_callback(struct wl_egl_window *wl_win, void *data)
(*dri2_dpy->flush->invalidate)(dri2_surf->dri_drawable);
 }
 
+static void
+destroy_window_callback(void *data)
+{
+   struct dri2_egl_surface *dri2_surf = data;
+   dri2_surf->wl_win = NULL;
+}
+
 /**
  * Called via eglCreateWindowSurface(), drv->API.CreateWindowSurface().
  */
@@ -159,6 +166,7 @@ dri2_wl_create_surface(_EGLDriver *drv, _EGLDisplay *disp,
 
dri2_surf->wl_win->private = dri2_surf;
dri2_surf->wl_win->resize_callback = resize_callback;
+   dri2_surf->wl_win->destroy_window_callback = destroy_window_callback;
 
dri2_surf->base.Width =  -1;
dri2_surf->base.Height = -1;
@@ -254,8 +262,11 @@ dri2_wl_destroy_surface(_EGLDriver *drv, _EGLDisplay 
*disp, _EGLSurface *surf)
if (dri2_surf->throttle_callback)
   wl_callback_destroy(dri2_surf->throttle_callback);
 
-   dri2_surf->wl_win->private = NULL;
-   dri2_surf->wl_win->resize_callback = NULL;
+   if (dri2_surf->wl_win) {
+  dri2_surf->wl_win->private = NULL;
+  dri2_surf->wl_win->resize_callback = NULL;
+  dri2_surf->wl_win->destroy_window_callback = NULL;
+   }
 
free(surf);
 

___
mesa-commit mailing list
mesa-commit@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/mesa-commit