Re: [Mesa-dev] [PATCH] st/dri: Use packed RGB formats

2015-08-13 Thread Michel Dänzer
On 12.08.2015 19:32, Marek Olšák wrote:
 On Wed, Aug 12, 2015 at 11:30 AM, Michel Dänzer mic...@daenzer.net wrote:
 On 11.08.2015 01:56, Marek Olšák wrote:
 Reviewed-by: Marek Olšák marek.ol...@amd.com

 Thanks Marek. Unfortunately, I remembered in the meantime that this
 patch alone won't help for r300g, because it doesn't support
 PIPE_FORMAT_x8R8G8B8_UNORM. It should help at least for r600g though,
 not sure about nouveau.
 
 I wonder if the r300 hw interprets the formats as packed, in which
 case we should use packed formats in r300g. Just a thought.

Since IME we can only have the GPU access data in little endian, it
doesn't make any difference.


-- 
Earthling Michel Dänzer   |   http://www.amd.com
Libre software enthusiast | Mesa and X developer
___
mesa-dev mailing list
mesa-dev@lists.freedesktop.org
http://lists.freedesktop.org/mailman/listinfo/mesa-dev


Re: [Mesa-dev] [PATCH v2 1/3] mesa: expose dimension check for glTex*Storage functions

2015-08-13 Thread Timothy Arceri
Reviewed-by: Timothy Arceri t_arc...@yahoo.com.au
___
mesa-dev mailing list
mesa-dev@lists.freedesktop.org
http://lists.freedesktop.org/mailman/listinfo/mesa-dev


Re: [Mesa-dev] [PATCH] gallium: add support for GLES texture float extensions (v2)

2015-08-13 Thread Edward O'Callaghan
Reviewed-by: Edward O'Callaghan eocallag...@alterapraxis.com

-- 
  Edward O'Callaghan
  edward.ocallag...@koparo.com

On Wed, Aug 12, 2015, at 08:45 PM, Marek Olšák wrote:
 From: Marek Olšák marek.ol...@amd.com
 
 Bugzilla: https://bugs.freedesktop.org/show_bug.cgi?id=74329
 
 v2: add a CAP for half floats
 drivers should not expose the CAPs if they don't support the formats
 ---
  src/gallium/docs/source/screen.rst   | 6 ++
  src/gallium/drivers/freedreno/freedreno_screen.c | 2 ++
  src/gallium/drivers/i915/i915_screen.c   | 2 ++
  src/gallium/drivers/ilo/ilo_screen.c | 2 ++
  src/gallium/drivers/llvmpipe/lp_screen.c | 2 ++
  src/gallium/drivers/nouveau/nv30/nv30_screen.c   | 2 ++
  src/gallium/drivers/nouveau/nv50/nv50_screen.c   | 2 ++
  src/gallium/drivers/nouveau/nvc0/nvc0_screen.c   | 2 ++
  src/gallium/drivers/r300/r300_screen.c   | 2 ++
  src/gallium/drivers/r600/r600_pipe.c | 2 ++
  src/gallium/drivers/radeonsi/si_pipe.c   | 2 ++
  src/gallium/drivers/softpipe/sp_screen.c | 2 ++
  src/gallium/drivers/svga/svga_screen.c   | 2 ++
  src/gallium/drivers/vc4/vc4_screen.c | 2 ++
  src/gallium/include/pipe/p_defines.h | 2 ++
  src/mesa/state_tracker/st_extensions.c   | 8 
  16 files changed, 42 insertions(+)
 
 diff --git a/src/gallium/docs/source/screen.rst
 b/src/gallium/docs/source/screen.rst
 index dbdccc7..c0b5eb3 100644
 --- a/src/gallium/docs/source/screen.rst
 +++ b/src/gallium/docs/source/screen.rst
 @@ -258,6 +258,12 @@ The integer capabilities:
How many per-patch outputs and inputs are supported between
tessellation
control and tessellation evaluation shaders, not counting in TESSINNER
and
TESSOUTER. The minimum allowed value for OpenGL is 30.
 +* ``PIPE_CAP_TEXTURE_FLOAT_LINEAR``: Whether the linear minification and
 +  magnification filters are supported with single-precision
 floating-point
 +  textures.
 +* ``PIPE_CAP_TEXTURE_HALF_FLOAT_LINEAR``: Whether the linear
 minification and
 +  magnification filters are supported with half-precision floating-point
 +  textures.
  
  
  .. _pipe_capf:
 diff --git a/src/gallium/drivers/freedreno/freedreno_screen.c
 b/src/gallium/drivers/freedreno/freedreno_screen.c
 index 417d7c6..b267fd0 100644
 --- a/src/gallium/drivers/freedreno/freedreno_screen.c
 +++ b/src/gallium/drivers/freedreno/freedreno_screen.c
 @@ -222,6 +222,8 @@ fd_screen_get_param(struct pipe_screen *pscreen, enum
 pipe_cap param)
   case PIPE_CAP_RESOURCE_FROM_USER_MEMORY:
   case PIPE_CAP_DEVICE_RESET_STATUS_QUERY:
   case PIPE_CAP_MAX_SHADER_PATCH_VARYINGS:
 +   case PIPE_CAP_TEXTURE_FLOAT_LINEAR:
 +   case PIPE_CAP_TEXTURE_HALF_FLOAT_LINEAR:
   return 0;
  
   case PIPE_CAP_MAX_VIEWPORTS:
 diff --git a/src/gallium/drivers/i915/i915_screen.c
 b/src/gallium/drivers/i915/i915_screen.c
 index 6083687..7608ca5 100644
 --- a/src/gallium/drivers/i915/i915_screen.c
 +++ b/src/gallium/drivers/i915/i915_screen.c
 @@ -244,6 +244,8 @@ i915_get_param(struct pipe_screen *screen, enum
 pipe_cap cap)
 case PIPE_CAP_RESOURCE_FROM_USER_MEMORY:
 case PIPE_CAP_DEVICE_RESET_STATUS_QUERY:
 case PIPE_CAP_MAX_SHADER_PATCH_VARYINGS:
 +   case PIPE_CAP_TEXTURE_FLOAT_LINEAR:
 +   case PIPE_CAP_TEXTURE_HALF_FLOAT_LINEAR:
return 0;
  
 case PIPE_CAP_MAX_DUAL_SOURCE_RENDER_TARGETS:
 diff --git a/src/gallium/drivers/ilo/ilo_screen.c
 b/src/gallium/drivers/ilo/ilo_screen.c
 index 338643e..9f150bb 100644
 --- a/src/gallium/drivers/ilo/ilo_screen.c
 +++ b/src/gallium/drivers/ilo/ilo_screen.c
 @@ -451,6 +451,8 @@ ilo_get_param(struct pipe_screen *screen, enum
 pipe_cap param)
 case PIPE_CAP_TEXTURE_GATHER_SM5:
return 0;
 case PIPE_CAP_BUFFER_MAP_PERSISTENT_COHERENT:
 +   case PIPE_CAP_TEXTURE_FLOAT_LINEAR:
 +   case PIPE_CAP_TEXTURE_HALF_FLOAT_LINEAR:
return true;
 case PIPE_CAP_FAKE_SW_MSAA:
 case PIPE_CAP_TEXTURE_QUERY_LOD:
 diff --git a/src/gallium/drivers/llvmpipe/lp_screen.c
 b/src/gallium/drivers/llvmpipe/lp_screen.c
 index 1c6c82e..539bb44 100644
 --- a/src/gallium/drivers/llvmpipe/lp_screen.c
 +++ b/src/gallium/drivers/llvmpipe/lp_screen.c
 @@ -288,6 +288,8 @@ llvmpipe_get_param(struct pipe_screen *screen, enum
 pipe_cap param)
 case PIPE_CAP_VERTEXID_NOBASE:
return 0;
 case PIPE_CAP_POLYGON_OFFSET_CLAMP:
 +   case PIPE_CAP_TEXTURE_FLOAT_LINEAR:
 +   case PIPE_CAP_TEXTURE_HALF_FLOAT_LINEAR:
return 1;
 case PIPE_CAP_MULTISAMPLE_Z_RESOLVE:
 case PIPE_CAP_RESOURCE_FROM_USER_MEMORY:
 diff --git a/src/gallium/drivers/nouveau/nv30/nv30_screen.c
 b/src/gallium/drivers/nouveau/nv30/nv30_screen.c
 index 97cf058..73bcd5b 100644
 --- a/src/gallium/drivers/nouveau/nv30/nv30_screen.c
 +++ b/src/gallium/drivers/nouveau/nv30/nv30_screen.c
 @@ -164,6 +164,8 @@ nv30_screen_get_param(struct pipe_screen *pscreen,
 enum pipe_cap param)
 case 

Re: [Mesa-dev] [PATCH] gl-2.0: Add test for re-using shader objects

2015-08-13 Thread Kenneth Graunke
On Friday, June 26, 2015 05:50:52 PM Topi Pohjolainen wrote:
 This is stimulating the shader binary re-use logic in i965 buffer
 object uploading. Without relaxing the current constraints there
 will be two identical copies in the cache. With the introduced
 three patches the logic begins to share only one copy between
 two entries in the cache.
 
 CC: Kenneth Graunke kenn...@whitecape.org
 Signed-off-by: Topi Pohjolainen topi.pohjolai...@intel.com
 ---
  tests/spec/gl-2.0/CMakeLists.gl.txt   |   1 +
  tests/spec/gl-2.0/reuse_fragment_shader.c | 105 
 ++
  2 files changed, 106 insertions(+)
  create mode 100644 tests/spec/gl-2.0/reuse_fragment_shader.c

Assuming you add this to all.py like Ilia mentioned, this is:
Reviewed-by: Kenneth Graunke kenn...@whitecape.org


signature.asc
Description: This is a digitally signed message part.
___
mesa-dev mailing list
mesa-dev@lists.freedesktop.org
http://lists.freedesktop.org/mailman/listinfo/mesa-dev


Re: [Mesa-dev] [PATCH v2 3/3] mesa: set correct error for non-renderable multisample textures

2015-08-13 Thread Timothy Arceri
Reviewed-by: Timothy Arceri t_arc...@yahoo.com.au
___
mesa-dev mailing list
mesa-dev@lists.freedesktop.org
http://lists.freedesktop.org/mailman/listinfo/mesa-dev


Re: [Mesa-dev] [PATCH v4 (part2) 46/59] glsl: Allow use of memory qualifiers with ARB_shader_storage_buffer_object.

2015-08-13 Thread Tapani Pälli

Hi;

I believe something more needs to be done here, it may be generic 
changes to the memory qualifier parsing. I wrote a Piglit test that 
fails with these changes (I tested against 
itoral-ARB_shader_storage_buffer_object-v4.1 branch), here:


http://lists.freedesktop.org/archives/piglit/2015-August/016777.html


On 08/05/2015 11:30 AM, Iago Toral Quiroga wrote:

---
  src/glsl/glsl_lexer.ll | 10 +-
  1 file changed, 5 insertions(+), 5 deletions(-)

diff --git a/src/glsl/glsl_lexer.ll b/src/glsl/glsl_lexer.ll
index efa0bb6..b9d700a 100644
--- a/src/glsl/glsl_lexer.ll
+++ b/src/glsl/glsl_lexer.ll
@@ -405,11 +405,11 @@ image2DShadow   KEYWORD(130, 300, 0, 0, 
IMAGE2DSHADOW);
  image1DArrayShadow  KEYWORD(130, 300, 0, 0, IMAGE1DARRAYSHADOW);
  image2DArrayShadow  KEYWORD(130, 300, 0, 0, IMAGE2DARRAYSHADOW);

-coherent   KEYWORD_WITH_ALT(420, 300, 420, 0, 
yyextra-ARB_shader_image_load_store_enable, COHERENT);
-volatile   KEYWORD_WITH_ALT(110, 100, 420, 0, 
yyextra-ARB_shader_image_load_store_enable, VOLATILE);
-restrict   KEYWORD_WITH_ALT(420, 300, 420, 0, 
yyextra-ARB_shader_image_load_store_enable, RESTRICT);
-readonly   KEYWORD_WITH_ALT(420, 300, 420, 0, 
yyextra-ARB_shader_image_load_store_enable, READONLY);
-writeonly  KEYWORD_WITH_ALT(420, 300, 420, 0, 
yyextra-ARB_shader_image_load_store_enable, WRITEONLY);
+coherent   KEYWORD_WITH_ALT(420, 300, 420, 0, 
yyextra-ARB_shader_image_load_store_enable || 
yyextra-ARB_shader_storage_buffer_object_enable, COHERENT);
+volatile   KEYWORD_WITH_ALT(110, 100, 420, 0, 
yyextra-ARB_shader_image_load_store_enable || 
yyextra-ARB_shader_storage_buffer_object_enable, VOLATILE);
+restrict   KEYWORD_WITH_ALT(420, 300, 420, 0, 
yyextra-ARB_shader_image_load_store_enable || 
yyextra-ARB_shader_storage_buffer_object_enable, RESTRICT);
+readonly   KEYWORD_WITH_ALT(420, 300, 420, 0, 
yyextra-ARB_shader_image_load_store_enable || 
yyextra-ARB_shader_storage_buffer_object_enable, READONLY);
+writeonly  KEYWORD_WITH_ALT(420, 300, 420, 0, 
yyextra-ARB_shader_image_load_store_enable || 
yyextra-ARB_shader_storage_buffer_object_enable, WRITEONLY);

  atomic_uint KEYWORD_WITH_ALT(420, 300, 420, 310, 
yyextra-ARB_shader_atomic_counters_enable, ATOMIC_UINT);



___
mesa-dev mailing list
mesa-dev@lists.freedesktop.org
http://lists.freedesktop.org/mailman/listinfo/mesa-dev


[Mesa-dev] [PATCH 1/2] mesa: remove extern from texture function

2015-08-13 Thread Timothy Arceri
---
 src/mesa/main/teximage.c | 2 +-
 src/mesa/main/teximage.h | 9 -
 2 files changed, 1 insertion(+), 10 deletions(-)

diff --git a/src/mesa/main/teximage.c b/src/mesa/main/teximage.c
index fc69387..55cbb37 100644
--- a/src/mesa/main/teximage.c
+++ b/src/mesa/main/teximage.c
@@ -5595,7 +5595,7 @@ check_multisample_target(GLuint dims, GLenum target, bool 
dsa)
 }
 
 
-void
+static void
 _mesa_texture_image_multisample(struct gl_context *ctx, GLuint dims,
 struct gl_texture_object *texObj,
 GLenum target, GLsizei samples,
diff --git a/src/mesa/main/teximage.h b/src/mesa/main/teximage.h
index 1eebaa8..bf729da 100644
--- a/src/mesa/main/teximage.h
+++ b/src/mesa/main/teximage.h
@@ -200,15 +200,6 @@ _mesa_copy_texture_sub_image(struct gl_context *ctx, 
GLuint dims,
  const char *caller);
 
 extern void
-_mesa_texture_image_multisample(struct gl_context *ctx, GLuint dims,
-struct gl_texture_object *texObj,
-GLenum target, GLsizei samples,
-GLint internalformat, GLsizei width,
-GLsizei height, GLsizei depth,
-GLboolean fixedsamplelocations,
-GLboolean immutable, const char *func);
-
-extern void
 _mesa_texture_buffer_range(struct gl_context *ctx,
struct gl_texture_object *texObj,
GLenum internalFormat,
-- 
2.4.3

___
mesa-dev mailing list
mesa-dev@lists.freedesktop.org
http://lists.freedesktop.org/mailman/listinfo/mesa-dev


Re: [Mesa-dev] [PATCH v2 2/3] mesa: validate size parameters for glTexStorage*Multisample

2015-08-13 Thread Timothy Arceri
I've sent a couple of follow-up patches I notice when reviewing this.


On Thu, 2015-08-13 at 09:30 +0300, Tapani Pälli wrote:
 v2: code cleanup
 
 Signed-off-by: Tapani Pälli tapani.pa...@intel.com
 ---
  src/mesa/main/teximage.c | 24 
  1 file changed, 24 insertions(+)
 
 diff --git a/src/mesa/main/teximage.c b/src/mesa/main/teximage.c
 index d35dc12..add7438 100644
 --- a/src/mesa/main/teximage.c
 +++ b/src/mesa/main/teximage.c
 @@ -5782,6 +5782,18 @@ _mesa_TexImage3DMultisample(GLenum target, GLsizei 
 samples,
 glTexImage3DMultisample);
  }
  
 +static bool
 +valid_texstorage_ms_parameters(GLsizei width, GLsizei height, GLsizei 
 depth,
 +   GLsizei samples, unsigned dims)
 +{
 +   GET_CURRENT_CONTEXT(ctx);
 +
 +   if (_mesa_tex_storage_invalid_dim(width, height, depth) || samples  1) 


Rather than do the samples  1 check here you should move it to
 _mesa_texture_image_multisample as the spec says An INVALID_VALUE error is
generated ifsamplesis zero. for glTexImage*Multisample too.

With that change you could change all the calls below to something like

   if (_mesa_tex_storage_invalid_dim(width, height, depth)) {
  _mesa_error(ctx, GL_INVALID_VALUE, glTexStorage2DMultisample()
  return;
   }

 {
 +  _mesa_error(ctx, GL_INVALID_VALUE, glTexStorage%uDMultisample(), 
 dims);
 +  return false;
 +   }
 +   return true;
 +} 
  void GLAPIENTRY
  _mesa_TexStorage2DMultisample(GLenum target, GLsizei samples,
 @@ -5795,6 +5807,9 @@ _mesa_TexStorage2DMultisample(GLenum target, GLsizei 
 samples,
 if (!texObj)
return;
  
 +   if (!valid_texstorage_ms_parameters(width, height, 1, samples, 2))
 +  return;
 +
 _mesa_texture_image_multisample(ctx, 2, texObj, target, samples,
 internalformat, width, height, 1,
 fixedsamplelocations, GL_TRUE,
 @@ -5814,6 +5829,9 @@ _mesa_TexStorage3DMultisample(GLenum target, GLsizei 
 samples,
 if (!texObj)
return;
  
 +   if (!valid_texstorage_ms_parameters(width, height, depth, samples, 3))
 +  return;
 +
 _mesa_texture_image_multisample(ctx, 3, texObj, target, samples,
 internalformat, width, height, depth,
 fixedsamplelocations, GL_TRUE,
 @@ -5834,6 +5852,9 @@ _mesa_TextureStorage2DMultisample(GLuint texture, 
 GLsizei samples,
 if (!texObj)
return;
  
 +   if (!valid_texstorage_ms_parameters(width, height, 1, samples, 2))
 +  return;
 +
 _mesa_texture_image_multisample(ctx, 2, texObj, texObj-Target, samples,
 internalformat, width, height, 1,
 fixedsamplelocations, GL_TRUE,
 @@ -5855,6 +5876,9 @@ _mesa_TextureStorage3DMultisample(GLuint texture, 
 GLsizei samples,
 if (!texObj)
return;
  
 +   if (!valid_texstorage_ms_parameters(width, height, depth, samples, 3))
 +  return;
 +
 _mesa_texture_image_multisample(ctx, 3, texObj, texObj-Target, samples,
 internalformat, width, height, depth,
 fixedsamplelocations, GL_TRUE,
___
mesa-dev mailing list
mesa-dev@lists.freedesktop.org
http://lists.freedesktop.org/mailman/listinfo/mesa-dev


[Mesa-dev] [PATCH V2 2/2] mesa: move non-generic multisample validation

2015-08-13 Thread Timothy Arceri
V2: remove the validation from it old location.
---
 src/mesa/main/fbobject.c| 10 ++
 src/mesa/main/multisample.c |  9 -
 2 files changed, 10 insertions(+), 9 deletions(-)

diff --git a/src/mesa/main/fbobject.c b/src/mesa/main/fbobject.c
index 8418340..07db195 100644
--- a/src/mesa/main/fbobject.c
+++ b/src/mesa/main/fbobject.c
@@ -2033,6 +2033,16 @@ renderbuffer_storage(struct gl_context *ctx, struct 
gl_renderbuffer *rb,
*/
   sample_count_error = _mesa_check_sample_count(ctx, GL_RENDERBUFFER,
 internalFormat, samples);
+
+  /* Section 2.5 (GL Errors) of OpenGL 3.0 specification, page 16:
+   *
+   * If a negative number is provided where an argument of type sizei or
+   * sizeiptr is specified, the error INVALID VALUE is generated.
+   */
+  if (samples  0) {
+ sample_count_error = GL_INVALID_VALUE;
+  }
+
   if (sample_count_error != GL_NO_ERROR) {
  _mesa_error(ctx, sample_count_error, %s(samples), func);
  return;
diff --git a/src/mesa/main/multisample.c b/src/mesa/main/multisample.c
index 09e6154..e7783ea 100644
--- a/src/mesa/main/multisample.c
+++ b/src/mesa/main/multisample.c
@@ -150,15 +150,6 @@ GLenum
 _mesa_check_sample_count(struct gl_context *ctx, GLenum target,
  GLenum internalFormat, GLsizei samples)
 {
-   /* Section 2.5 (GL Errors) of OpenGL 3.0 specification, page 16:
-*
-* If a negative number is provided where an argument of type sizei or
-* sizeiptr is specified, the error INVALID VALUE is generated.
-*/
-   if (samples  0) {
-  return GL_INVALID_VALUE;
-   }
-
/* Section 4.4 (Framebuffer objects), page 198 of the OpenGL ES 3.0.0
 * specification says:
 *
-- 
2.4.3

___
mesa-dev mailing list
mesa-dev@lists.freedesktop.org
http://lists.freedesktop.org/mailman/listinfo/mesa-dev


Re: [Mesa-dev] [PATCH v2 2/3] mesa: validate size parameters for glTexStorage*Multisample

2015-08-13 Thread Tapani Pälli



On 08/13/2015 11:54 AM, Timothy Arceri wrote:

I've sent a couple of follow-up patches I notice when reviewing this.


On Thu, 2015-08-13 at 09:30 +0300, Tapani Pälli wrote:

v2: code cleanup

Signed-off-by: Tapani Pälli tapani.pa...@intel.com
---
  src/mesa/main/teximage.c | 24 
  1 file changed, 24 insertions(+)

diff --git a/src/mesa/main/teximage.c b/src/mesa/main/teximage.c
index d35dc12..add7438 100644
--- a/src/mesa/main/teximage.c
+++ b/src/mesa/main/teximage.c
@@ -5782,6 +5782,18 @@ _mesa_TexImage3DMultisample(GLenum target, GLsizei
samples,
 glTexImage3DMultisample);
  }

+static bool
+valid_texstorage_ms_parameters(GLsizei width, GLsizei height, GLsizei
depth,
+   GLsizei samples, unsigned dims)
+{
+   GET_CURRENT_CONTEXT(ctx);
+
+   if (_mesa_tex_storage_invalid_dim(width, height, depth) || samples  1)



Rather than do the samples  1 check here you should move it to
  _mesa_texture_image_multisample as the spec says An INVALID_VALUE error is
generated ifsamplesis zero. for glTexImage*Multisample too.


_mesa_texture_image_multisample uses _mesa_check_sample_count() which 
errors on negative values like some of the functions are specified, I'll 
need to go through the funcs again to see which one it was but there was 
inconsistency, some require  0 and some already error on 0.




With that change you could change all the calls below to something like

if (_mesa_tex_storage_invalid_dim(width, height, depth)) {
   _mesa_error(ctx, GL_INVALID_VALUE, glTexStorage2DMultisample()
   return;
}


{
+  _mesa_error(ctx, GL_INVALID_VALUE, glTexStorage%uDMultisample(),
dims);
+  return false;
+   }
+   return true;
+}
  void GLAPIENTRY
  _mesa_TexStorage2DMultisample(GLenum target, GLsizei samples,
@@ -5795,6 +5807,9 @@ _mesa_TexStorage2DMultisample(GLenum target, GLsizei
samples,
 if (!texObj)
return;

+   if (!valid_texstorage_ms_parameters(width, height, 1, samples, 2))
+  return;
+
 _mesa_texture_image_multisample(ctx, 2, texObj, target, samples,
 internalformat, width, height, 1,
 fixedsamplelocations, GL_TRUE,
@@ -5814,6 +5829,9 @@ _mesa_TexStorage3DMultisample(GLenum target, GLsizei
samples,
 if (!texObj)
return;

+   if (!valid_texstorage_ms_parameters(width, height, depth, samples, 3))
+  return;
+
 _mesa_texture_image_multisample(ctx, 3, texObj, target, samples,
 internalformat, width, height, depth,
 fixedsamplelocations, GL_TRUE,
@@ -5834,6 +5852,9 @@ _mesa_TextureStorage2DMultisample(GLuint texture,
GLsizei samples,
 if (!texObj)
return;

+   if (!valid_texstorage_ms_parameters(width, height, 1, samples, 2))
+  return;
+
 _mesa_texture_image_multisample(ctx, 2, texObj, texObj-Target, samples,
 internalformat, width, height, 1,
 fixedsamplelocations, GL_TRUE,
@@ -5855,6 +5876,9 @@ _mesa_TextureStorage3DMultisample(GLuint texture,
GLsizei samples,
 if (!texObj)
return;

+   if (!valid_texstorage_ms_parameters(width, height, depth, samples, 3))
+  return;
+
 _mesa_texture_image_multisample(ctx, 3, texObj, texObj-Target, samples,
 internalformat, width, height, depth,
 fixedsamplelocations, GL_TRUE,

___
mesa-dev mailing list
mesa-dev@lists.freedesktop.org
http://lists.freedesktop.org/mailman/listinfo/mesa-dev


Re: [Mesa-dev] [PATCH 1/3] i965: Rename brw_upload_item_data to brw_alloc_item_data

2015-08-13 Thread Kenneth Graunke
On Thursday, June 25, 2015 03:45:36 PM Topi Pohjolainen wrote:
 and simplify the interface to take directly the size and to return
 the offset. The routine does nothing more than allocate, it doesn't
 upload anything.
 
 CC: Kenneth Graunke kenn...@whitecape.org
 Signed-off-by: Topi Pohjolainen topi.pohjolai...@intel.com
 ---
  src/mesa/drivers/dri/i965/brw_state_cache.c | 19 ++-
  1 file changed, 10 insertions(+), 9 deletions(-)
 
 diff --git a/src/mesa/drivers/dri/i965/brw_state_cache.c 
 b/src/mesa/drivers/dri/i965/brw_state_cache.c
 index 157b33d..97a41b9 100644
 --- a/src/mesa/drivers/dri/i965/brw_state_cache.c
 +++ b/src/mesa/drivers/dri/i965/brw_state_cache.c
 @@ -248,18 +248,17 @@ brw_try_upload_using_copy(struct brw_cache *cache,
 return false;
  }
  
 -static void
 -brw_upload_item_data(struct brw_cache *cache,
 -  struct brw_cache_item *item,
 -  const void *data)
 +static uint32_t
 +brw_alloc_item_data(struct brw_cache *cache, uint32_t size)
  {
 +   uint32_t offset;
 struct brw_context *brw = cache-brw;
  
 /* Allocate space in the cache BO for our new program. */
 -   if (cache-next_offset + item-size  cache-bo-size) {
 +   if (cache-next_offset + size  cache-bo-size) {
uint32_t new_size = cache-bo-size * 2;
  
 -  while (cache-next_offset + item-size  new_size)
 +  while (cache-next_offset + size  new_size)
new_size *= 2;
  
brw_cache_new_bo(cache, new_size);
 @@ -273,10 +272,12 @@ brw_upload_item_data(struct brw_cache *cache,
brw_cache_new_bo(cache, cache-bo-size);
 }
  
 -   item-offset = cache-next_offset;
 +   offset = cache-next_offset;
  
 /* Programs are always 64-byte aligned, so set up the next one now */
 -   cache-next_offset = ALIGN(item-offset + item-size, 64);
 +   cache-next_offset = ALIGN(offset + size, 64);
 +
 +   return offset;
  }
  
  void
 @@ -312,7 +313,7 @@ brw_upload_cache(struct brw_cache *cache,
  * compile to the thing in our backend.
  */
 if (!brw_try_upload_using_copy(cache, item, data, aux)) {
 -  brw_upload_item_data(cache, item, data);
 +  item-offset = brw_alloc_item_data(cache, data_size);
 }
  
 /* Set up the memory containing the key and aux_data */
 

These three patches are:
Reviewed-by: Kenneth Graunke kenn...@whitecape.org

I believe Eric's optimization to avoid flagging BRW_NEW_FS_PROG_DATA did
take effect at one point in the past...but I really can't see how it
would now.  A lot has changed since then.

We may want to look into reimplementing that optimization - it's
probably still valuable.  But let's go with this and simplify for now;
we can rebuild it right later.


signature.asc
Description: This is a digitally signed message part.
___
mesa-dev mailing list
mesa-dev@lists.freedesktop.org
http://lists.freedesktop.org/mailman/listinfo/mesa-dev


[Mesa-dev] [PATCH v2 1/3] mesa: expose dimension check for glTex*Storage functions

2015-08-13 Thread Tapani Pälli
This is done so that following patch can use it to verify dimensions
for multisample variants of glTex*Storage.

v2: move function to header, use bool instead GLboolean

Signed-off-by: Tapani Pälli tapani.pa...@intel.com
---
 src/mesa/main/texstorage.c |  2 +-
 src/mesa/main/texstorage.h | 21 +
 2 files changed, 22 insertions(+), 1 deletion(-)

diff --git a/src/mesa/main/texstorage.c b/src/mesa/main/texstorage.c
index 4a2cc60..50a980f 100644
--- a/src/mesa/main/texstorage.c
+++ b/src/mesa/main/texstorage.c
@@ -287,7 +287,7 @@ tex_storage_error_check(struct gl_context *ctx,
 * order to allow meta functions to use legacy formats. */
 
/* size check */
-   if (width  1 || height  1 || depth  1) {
+   if (_mesa_tex_storage_invalid_dim(width, height, depth)) {
   _mesa_error(ctx, GL_INVALID_VALUE,
   glTex%sStorage%uD(width, height or depth  1),
   suffix, dims);
diff --git a/src/mesa/main/texstorage.h b/src/mesa/main/texstorage.h
index 6f5495f..e23d53a 100644
--- a/src/mesa/main/texstorage.h
+++ b/src/mesa/main/texstorage.h
@@ -38,6 +38,27 @@ _mesa_texture_storage(struct gl_context *ctx, GLuint dims,
   GLenum internalformat, GLsizei width,
   GLsizei height, GLsizei depth, bool dsa);
 
+/**
+ * Texture width, height and depth check shared with the
+ * multisample variants of TexStorage functions.
+ *
+ * From OpenGL 4.5 Core spec, page 260 (section 8.19)
+ *
+ * An INVALID_VALUE error is generated if width, height, depth
+ * or levels are less than 1, for commands with the corresponding
+ * parameters.
+ *
+ * (referring to TextureStorage* commands, these also match values
+ * specified for OpenGL ES 3.1.)
+ */
+static inline bool
+_mesa_tex_storage_invalid_dim(GLsizei width, GLsizei height, GLsizei depth)
+{
+   if (width  1 || height  1 || depth  1)
+  return true;
+   return false;
+}
+
 /*@}*/
 
 /**
-- 
2.1.0

___
mesa-dev mailing list
mesa-dev@lists.freedesktop.org
http://lists.freedesktop.org/mailman/listinfo/mesa-dev


[Mesa-dev] [PATCH v2 0/3] OpenGL ES 3.1 texture storage changes

2015-08-13 Thread Tapani Pälli
Here's bunch of changes to texture storage with the fixes from review.

Thanks;

Tapani Pälli (3):
  mesa: expose dimension check for glTex*Storage functions
  mesa: validate size parameters for glTexStorage*Multisample
  mesa: set correct error for non-renderable multisample textures

 src/mesa/main/teximage.c   | 37 ++---
 src/mesa/main/texstorage.c |  2 +-
 src/mesa/main/texstorage.h | 21 +
 3 files changed, 56 insertions(+), 4 deletions(-)

-- 
2.1.0

___
mesa-dev mailing list
mesa-dev@lists.freedesktop.org
http://lists.freedesktop.org/mailman/listinfo/mesa-dev


[Mesa-dev] [PATCH v2 3/3] mesa: set correct error for non-renderable multisample textures

2015-08-13 Thread Tapani Pälli
v2: same common error on gles31 and desktop OpenGL
(spotted by Erik Faye-Lund)

Signed-off-by: Marta Lofstedt marta.lofst...@linux.intel.com
Signed-off-by: Tapani Pälli tapani.pa...@intel.com
---
 src/mesa/main/teximage.c | 13 ++---
 1 file changed, 10 insertions(+), 3 deletions(-)

diff --git a/src/mesa/main/teximage.c b/src/mesa/main/teximage.c
index add7438..422c148 100644
--- a/src/mesa/main/teximage.c
+++ b/src/mesa/main/teximage.c
@@ -5639,9 +5639,16 @@ _mesa_texture_image_multisample(struct gl_context *ctx, 
GLuint dims,
}
 
if (!is_renderable_texture_format(ctx, internalformat)) {
-  _mesa_error(ctx, GL_INVALID_OPERATION,
-%s(internalformat=%s),
-func, _mesa_enum_to_string(internalformat));
+  /* Page 172 of OpenGL ES 3.1 spec says:
+   *   An INVALID_ENUM error is generated if sizedinternalformat is not
+   *   color-renderable, depth-renderable, or stencil-renderable (as
+   *   defined in section 9.4).
+   *
+   *  (Same error is also defined for desktop OpenGL for multisample
+   *  teximage/texstorage functions.)
+   */
+  _mesa_error(ctx, GL_INVALID_ENUM, %s(internalformat=%s), func,
+  _mesa_enum_to_string(internalformat));
   return;
}
 
-- 
2.1.0

___
mesa-dev mailing list
mesa-dev@lists.freedesktop.org
http://lists.freedesktop.org/mailman/listinfo/mesa-dev


[Mesa-dev] [PATCH v2 2/3] mesa: validate size parameters for glTexStorage*Multisample

2015-08-13 Thread Tapani Pälli
v2: code cleanup

Signed-off-by: Tapani Pälli tapani.pa...@intel.com
---
 src/mesa/main/teximage.c | 24 
 1 file changed, 24 insertions(+)

diff --git a/src/mesa/main/teximage.c b/src/mesa/main/teximage.c
index d35dc12..add7438 100644
--- a/src/mesa/main/teximage.c
+++ b/src/mesa/main/teximage.c
@@ -5782,6 +5782,18 @@ _mesa_TexImage3DMultisample(GLenum target, GLsizei 
samples,
glTexImage3DMultisample);
 }
 
+static bool
+valid_texstorage_ms_parameters(GLsizei width, GLsizei height, GLsizei depth,
+   GLsizei samples, unsigned dims)
+{
+   GET_CURRENT_CONTEXT(ctx);
+
+   if (_mesa_tex_storage_invalid_dim(width, height, depth) || samples  1) {
+  _mesa_error(ctx, GL_INVALID_VALUE, glTexStorage%uDMultisample(), dims);
+  return false;
+   }
+   return true;
+}
 
 void GLAPIENTRY
 _mesa_TexStorage2DMultisample(GLenum target, GLsizei samples,
@@ -5795,6 +5807,9 @@ _mesa_TexStorage2DMultisample(GLenum target, GLsizei 
samples,
if (!texObj)
   return;
 
+   if (!valid_texstorage_ms_parameters(width, height, 1, samples, 2))
+  return;
+
_mesa_texture_image_multisample(ctx, 2, texObj, target, samples,
internalformat, width, height, 1,
fixedsamplelocations, GL_TRUE,
@@ -5814,6 +5829,9 @@ _mesa_TexStorage3DMultisample(GLenum target, GLsizei 
samples,
if (!texObj)
   return;
 
+   if (!valid_texstorage_ms_parameters(width, height, depth, samples, 3))
+  return;
+
_mesa_texture_image_multisample(ctx, 3, texObj, target, samples,
internalformat, width, height, depth,
fixedsamplelocations, GL_TRUE,
@@ -5834,6 +5852,9 @@ _mesa_TextureStorage2DMultisample(GLuint texture, GLsizei 
samples,
if (!texObj)
   return;
 
+   if (!valid_texstorage_ms_parameters(width, height, 1, samples, 2))
+  return;
+
_mesa_texture_image_multisample(ctx, 2, texObj, texObj-Target, samples,
internalformat, width, height, 1,
fixedsamplelocations, GL_TRUE,
@@ -5855,6 +5876,9 @@ _mesa_TextureStorage3DMultisample(GLuint texture, GLsizei 
samples,
if (!texObj)
   return;
 
+   if (!valid_texstorage_ms_parameters(width, height, depth, samples, 3))
+  return;
+
_mesa_texture_image_multisample(ctx, 3, texObj, texObj-Target, samples,
internalformat, width, height, depth,
fixedsamplelocations, GL_TRUE,
-- 
2.1.0

___
mesa-dev mailing list
mesa-dev@lists.freedesktop.org
http://lists.freedesktop.org/mailman/listinfo/mesa-dev


[Mesa-dev] [PATCH 2/2] mesa: move non-generic multisample validation

2015-08-13 Thread Timothy Arceri
---
 src/mesa/main/fbobject.c | 10 ++
 1 file changed, 10 insertions(+)

diff --git a/src/mesa/main/fbobject.c b/src/mesa/main/fbobject.c
index 8418340..07db195 100644
--- a/src/mesa/main/fbobject.c
+++ b/src/mesa/main/fbobject.c
@@ -2033,6 +2033,16 @@ renderbuffer_storage(struct gl_context *ctx, struct 
gl_renderbuffer *rb,
*/
   sample_count_error = _mesa_check_sample_count(ctx, GL_RENDERBUFFER,
 internalFormat, samples);
+
+  /* Section 2.5 (GL Errors) of OpenGL 3.0 specification, page 16:
+   *
+   * If a negative number is provided where an argument of type sizei or
+   * sizeiptr is specified, the error INVALID VALUE is generated.
+   */
+  if (samples  0) {
+ sample_count_error = GL_INVALID_VALUE;
+  }
+
   if (sample_count_error != GL_NO_ERROR) {
  _mesa_error(ctx, sample_count_error, %s(samples), func);
  return;
-- 
2.4.3

___
mesa-dev mailing list
mesa-dev@lists.freedesktop.org
http://lists.freedesktop.org/mailman/listinfo/mesa-dev


Re: [Mesa-dev] [PATCH 1/2] mesa: remove extern from texture function

2015-08-13 Thread Tapani Pälli

Reviewed-by: Tapani Pälli tapani.pa...@intel.com

On 08/13/2015 11:53 AM, Timothy Arceri wrote:

---
  src/mesa/main/teximage.c | 2 +-
  src/mesa/main/teximage.h | 9 -
  2 files changed, 1 insertion(+), 10 deletions(-)

diff --git a/src/mesa/main/teximage.c b/src/mesa/main/teximage.c
index fc69387..55cbb37 100644
--- a/src/mesa/main/teximage.c
+++ b/src/mesa/main/teximage.c
@@ -5595,7 +5595,7 @@ check_multisample_target(GLuint dims, GLenum target, bool 
dsa)
  }


-void
+static void
  _mesa_texture_image_multisample(struct gl_context *ctx, GLuint dims,
  struct gl_texture_object *texObj,
  GLenum target, GLsizei samples,
diff --git a/src/mesa/main/teximage.h b/src/mesa/main/teximage.h
index 1eebaa8..bf729da 100644
--- a/src/mesa/main/teximage.h
+++ b/src/mesa/main/teximage.h
@@ -200,15 +200,6 @@ _mesa_copy_texture_sub_image(struct gl_context *ctx, 
GLuint dims,
   const char *caller);

  extern void
-_mesa_texture_image_multisample(struct gl_context *ctx, GLuint dims,
-struct gl_texture_object *texObj,
-GLenum target, GLsizei samples,
-GLint internalformat, GLsizei width,
-GLsizei height, GLsizei depth,
-GLboolean fixedsamplelocations,
-GLboolean immutable, const char *func);
-
-extern void
  _mesa_texture_buffer_range(struct gl_context *ctx,
 struct gl_texture_object *texObj,
 GLenum internalFormat,


___
mesa-dev mailing list
mesa-dev@lists.freedesktop.org
http://lists.freedesktop.org/mailman/listinfo/mesa-dev


Re: [Mesa-dev] [PATCH 2/2][RFC] docs: Add the 2015 ARB extensions

2015-08-13 Thread Thomas Helland
On Aug 13, 2015 12:33 PM, Marek Olšák mar...@gmail.com wrote:

 On Wed, Aug 12, 2015 at 11:23 PM, Thomas Helland
 thomashellan...@gmail.com wrote:
  2015-08-12 18:56 GMT+02:00 Kenneth Graunke kenn...@whitecape.org:
  On Wednesday, August 12, 2015 06:32:50 PM Thomas Helland wrote:
  2015-08-12 17:48 GMT+02:00 Ilia Mirkin imir...@alum.mit.edu:
   On Tue, Aug 11, 2015 at 1:48 PM, Thomas Helland
   thomashellan...@gmail.com wrote:
   Signed-off-by: Thomas Helland thomashellan...@gmail.com
   ---
   This adds a section for the extensions nvidia has chosen to
   call the GL ARB 2015 Extensions unveiled at SIGGRAPH.
  
   There are ARB extensions released every year (or more often, not
   sure)... we don't track all ARB extensions. Why are these so special
   vs e.g. the ones released along with GL 4.5 but that weren't
included
   in the spec? Or any of the other ones...
  
 
  Well. They're not really special I guess. This just follows from the
  discussion that went down on irc between me, glennk, fredrikh, ++.
 
   Should GL3.txt just become extension-implementation-status.txt and
   list all non-vendor-specific extensions? So far it has stuck to
actual
   GL versions (and more recently GLES).
  
 
  We can keep it GL / GLES versions only. Or we can extend it to a
  extension-implementation-status.txt thing. Or we can split it
  into two different files. I really don't care to much either way.
 
  If we end up adding these extensions to the file then a rename
  and adding other ARB's is probably the way to go. There are
  positive and negative sides to both approaches, and its not
  my call to decide how, and if, we want this. It gives a nice overview
  but at the same time it has PR- and needs-to-be-kept-updated-
  implications that we may not want. I'm all ears for suggestions.
 
  -Thomas
 
  I like the idea of adding an ARB Extensions section and listing all
  the ARB extensions that aren't part of a particular GL version - simply
  in addition to the existing content, rather than reorganizing it.
 
  GL3.txt has been a misnomer for a while, but I don't care whether we
  rename it or not; it doesn't bother me.
 
  --Ken
 
  I've assembled a list of extensions I *think* are not demanded by
  any current openGL specs, but I may have missed some.
  (I find it weird that I VAO's in any of the specs, for example)
  I could add all of them to a separate section to track them,
  or I can leave it as is and drop this patch. Up to you guys.
 
  2.  GLX_ARB_get_proc_address
  4.  WGL_ARB_buffer_region
  8.  WGL_ARB_extensions_string
  9.  WGL_ARB_pixel_format
  10. WGL_ARB_make_current_read
  11. WGL_ARB_pbuffer
  15. GL_ARB_vertex_blend
  16. GL_ARB_matrix_palette
  20. WGL_ARB_render_texture
  24. GL_ARB_shadow_ambient
  36. GL_ARB_fragment_program_shadow

 All extensions above are considered old crap. Also, WGL extensions?
Seriously?


There's a revised version of the patch with only
2012 and onwards extensions listed.
I sent it in reply to the last patch, but should've
probably nested it in this discussion.
Sorry about that. I really need to set up a mail
client that allows me to see the message headers.

 I personally think adding a list of non-core extensions to docs is
 useless and will only distract people.


That is a completely valid point.
I'm not gonna push to get this merged,
I was just proposing a solution after some irc'ing
about the newly released extensions

 Marek
___
mesa-dev mailing list
mesa-dev@lists.freedesktop.org
http://lists.freedesktop.org/mailman/listinfo/mesa-dev


Re: [Mesa-dev] [PATCH v2 2/3] mesa: validate size parameters for glTexStorage*Multisample

2015-08-13 Thread Timothy Arceri
On Thu, 2015-08-13 at 12:28 +0300, Tapani Pälli wrote:
 
 On 08/13/2015 12:14 PM, Tapani Pälli wrote:
  
  
  On 08/13/2015 11:54 AM, Timothy Arceri wrote:
   I've sent a couple of follow-up patches I notice when reviewing this.
   
   
   On Thu, 2015-08-13 at 09:30 +0300, Tapani Pälli wrote:
v2: code cleanup

Signed-off-by: Tapani Pälli tapani.pa...@intel.com
---
  src/mesa/main/teximage.c | 24 
  1 file changed, 24 insertions(+)

diff --git a/src/mesa/main/teximage.c b/src/mesa/main/teximage.c
index d35dc12..add7438 100644
--- a/src/mesa/main/teximage.c
+++ b/src/mesa/main/teximage.c
@@ -5782,6 +5782,18 @@ _mesa_TexImage3DMultisample(GLenum target,
GLsizei
samples,
 glTexImage3DMultisample);
  }

+static bool
+valid_texstorage_ms_parameters(GLsizei width, GLsizei height, GLsizei
depth,
+   GLsizei samples, unsigned dims)
+{
+   GET_CURRENT_CONTEXT(ctx);
+
+   if (_mesa_tex_storage_invalid_dim(width, height, depth) ||
samples  1)
   
   
   Rather than do the samples  1 check here you should move it to
 _mesa_texture_image_multisample as the spec says An INVALID_VALUE
   error is
   generated ifsamplesis zero. for glTexImage*Multisample too.
  
  _mesa_texture_image_multisample uses _mesa_check_sample_count() which
  errors on negative values like some of the functions are specified, I'll
  need to go through the funcs again to see which one it was but there was
  inconsistency, some require  0 and some already error on 0.
 
 It was RenderbufferStorageMultisample that should error on  0, I guess 
 nothing else (?) It could use it's own check and rest could use generic 
 sample check. Would need to see also what possible Piglit tests for 
 these are expecting and correct those if they are according to old specs.

Right, I should have mentioned thats what my second patch was about, was in a
hurry.

I haven't run piglit on it yet but, yeah we should fix anything if it breaks.


 
 
  
   With that change you could change all the calls below to something like
   
   if (_mesa_tex_storage_invalid_dim(width, height, depth)) {
  _mesa_error(ctx, GL_INVALID_VALUE, glTexStorage2DMultisample()
  return;
   }
   
{
+  _mesa_error(ctx, GL_INVALID_VALUE,
glTexStorage%uDMultisample(),
dims);
+  return false;
+   }
+   return true;
+}
  void GLAPIENTRY
  _mesa_TexStorage2DMultisample(GLenum target, GLsizei samples,
@@ -5795,6 +5807,9 @@ _mesa_TexStorage2DMultisample(GLenum target,
GLsizei
samples,
 if (!texObj)
return;

+   if (!valid_texstorage_ms_parameters(width, height, 1, samples, 2))
+  return;
+
 _mesa_texture_image_multisample(ctx, 2, texObj, target, samples,
 internalformat, width, height, 1,
 fixedsamplelocations, GL_TRUE,
@@ -5814,6 +5829,9 @@ _mesa_TexStorage3DMultisample(GLenum target,
GLsizei
samples,
 if (!texObj)
return;

+   if (!valid_texstorage_ms_parameters(width, height, depth,
samples, 3))
+  return;
+
 _mesa_texture_image_multisample(ctx, 3, texObj, target, samples,
 internalformat, width, height,
depth,
 fixedsamplelocations, GL_TRUE,
@@ -5834,6 +5852,9 @@ _mesa_TextureStorage2DMultisample(GLuint 
texture,
GLsizei samples,
 if (!texObj)
return;

+   if (!valid_texstorage_ms_parameters(width, height, 1, samples, 2))
+  return;
+
 _mesa_texture_image_multisample(ctx, 2, texObj, texObj-Target,
samples,
 internalformat, width, height, 1,
 fixedsamplelocations, GL_TRUE,
@@ -5855,6 +5876,9 @@ _mesa_TextureStorage3DMultisample(GLuint 
texture,
GLsizei samples,
 if (!texObj)
return;

+   if (!valid_texstorage_ms_parameters(width, height, depth,
samples, 3))
+  return;
+
 _mesa_texture_image_multisample(ctx, 3, texObj, texObj-Target,
samples,
 internalformat, width, height,
depth,
 fixedsamplelocations, GL_TRUE,
  ___
  mesa-dev mailing list
  mesa-dev@lists.freedesktop.org
  http://lists.freedesktop.org/mailman/listinfo/mesa-dev
___
mesa-dev mailing list
mesa-dev@lists.freedesktop.org
http://lists.freedesktop.org/mailman/listinfo/mesa-dev


Re: [Mesa-dev] [PATCH v2 2/3] mesa: validate size parameters for glTexStorage*Multisample

2015-08-13 Thread Tapani Pälli



On 08/13/2015 12:14 PM, Tapani Pälli wrote:



On 08/13/2015 11:54 AM, Timothy Arceri wrote:

I've sent a couple of follow-up patches I notice when reviewing this.


On Thu, 2015-08-13 at 09:30 +0300, Tapani Pälli wrote:

v2: code cleanup

Signed-off-by: Tapani Pälli tapani.pa...@intel.com
---
  src/mesa/main/teximage.c | 24 
  1 file changed, 24 insertions(+)

diff --git a/src/mesa/main/teximage.c b/src/mesa/main/teximage.c
index d35dc12..add7438 100644
--- a/src/mesa/main/teximage.c
+++ b/src/mesa/main/teximage.c
@@ -5782,6 +5782,18 @@ _mesa_TexImage3DMultisample(GLenum target,
GLsizei
samples,
 glTexImage3DMultisample);
  }

+static bool
+valid_texstorage_ms_parameters(GLsizei width, GLsizei height, GLsizei
depth,
+   GLsizei samples, unsigned dims)
+{
+   GET_CURRENT_CONTEXT(ctx);
+
+   if (_mesa_tex_storage_invalid_dim(width, height, depth) ||
samples  1)



Rather than do the samples  1 check here you should move it to
  _mesa_texture_image_multisample as the spec says An INVALID_VALUE
error is
generated ifsamplesis zero. for glTexImage*Multisample too.


_mesa_texture_image_multisample uses _mesa_check_sample_count() which
errors on negative values like some of the functions are specified, I'll
need to go through the funcs again to see which one it was but there was
inconsistency, some require  0 and some already error on 0.


It was RenderbufferStorageMultisample that should error on  0, I guess 
nothing else (?) It could use it's own check and rest could use generic 
sample check. Would need to see also what possible Piglit tests for 
these are expecting and correct those if they are according to old specs.






With that change you could change all the calls below to something like

if (_mesa_tex_storage_invalid_dim(width, height, depth)) {
   _mesa_error(ctx, GL_INVALID_VALUE, glTexStorage2DMultisample()
   return;
}


{
+  _mesa_error(ctx, GL_INVALID_VALUE,
glTexStorage%uDMultisample(),
dims);
+  return false;
+   }
+   return true;
+}
  void GLAPIENTRY
  _mesa_TexStorage2DMultisample(GLenum target, GLsizei samples,
@@ -5795,6 +5807,9 @@ _mesa_TexStorage2DMultisample(GLenum target,
GLsizei
samples,
 if (!texObj)
return;

+   if (!valid_texstorage_ms_parameters(width, height, 1, samples, 2))
+  return;
+
 _mesa_texture_image_multisample(ctx, 2, texObj, target, samples,
 internalformat, width, height, 1,
 fixedsamplelocations, GL_TRUE,
@@ -5814,6 +5829,9 @@ _mesa_TexStorage3DMultisample(GLenum target,
GLsizei
samples,
 if (!texObj)
return;

+   if (!valid_texstorage_ms_parameters(width, height, depth,
samples, 3))
+  return;
+
 _mesa_texture_image_multisample(ctx, 3, texObj, target, samples,
 internalformat, width, height,
depth,
 fixedsamplelocations, GL_TRUE,
@@ -5834,6 +5852,9 @@ _mesa_TextureStorage2DMultisample(GLuint texture,
GLsizei samples,
 if (!texObj)
return;

+   if (!valid_texstorage_ms_parameters(width, height, 1, samples, 2))
+  return;
+
 _mesa_texture_image_multisample(ctx, 2, texObj, texObj-Target,
samples,
 internalformat, width, height, 1,
 fixedsamplelocations, GL_TRUE,
@@ -5855,6 +5876,9 @@ _mesa_TextureStorage3DMultisample(GLuint texture,
GLsizei samples,
 if (!texObj)
return;

+   if (!valid_texstorage_ms_parameters(width, height, depth,
samples, 3))
+  return;
+
 _mesa_texture_image_multisample(ctx, 3, texObj, texObj-Target,
samples,
 internalformat, width, height,
depth,
 fixedsamplelocations, GL_TRUE,

___
mesa-dev mailing list
mesa-dev@lists.freedesktop.org
http://lists.freedesktop.org/mailman/listinfo/mesa-dev

___
mesa-dev mailing list
mesa-dev@lists.freedesktop.org
http://lists.freedesktop.org/mailman/listinfo/mesa-dev


Re: [Mesa-dev] [PATCH 2/2][RFC] docs: Add the 2015 ARB extensions

2015-08-13 Thread Marek Olšák
On Wed, Aug 12, 2015 at 11:23 PM, Thomas Helland
thomashellan...@gmail.com wrote:
 2015-08-12 18:56 GMT+02:00 Kenneth Graunke kenn...@whitecape.org:
 On Wednesday, August 12, 2015 06:32:50 PM Thomas Helland wrote:
 2015-08-12 17:48 GMT+02:00 Ilia Mirkin imir...@alum.mit.edu:
  On Tue, Aug 11, 2015 at 1:48 PM, Thomas Helland
  thomashellan...@gmail.com wrote:
  Signed-off-by: Thomas Helland thomashellan...@gmail.com
  ---
  This adds a section for the extensions nvidia has chosen to
  call the GL ARB 2015 Extensions unveiled at SIGGRAPH.
 
  There are ARB extensions released every year (or more often, not
  sure)... we don't track all ARB extensions. Why are these so special
  vs e.g. the ones released along with GL 4.5 but that weren't included
  in the spec? Or any of the other ones...
 

 Well. They're not really special I guess. This just follows from the
 discussion that went down on irc between me, glennk, fredrikh, ++.

  Should GL3.txt just become extension-implementation-status.txt and
  list all non-vendor-specific extensions? So far it has stuck to actual
  GL versions (and more recently GLES).
 

 We can keep it GL / GLES versions only. Or we can extend it to a
 extension-implementation-status.txt thing. Or we can split it
 into two different files. I really don't care to much either way.

 If we end up adding these extensions to the file then a rename
 and adding other ARB's is probably the way to go. There are
 positive and negative sides to both approaches, and its not
 my call to decide how, and if, we want this. It gives a nice overview
 but at the same time it has PR- and needs-to-be-kept-updated-
 implications that we may not want. I'm all ears for suggestions.

 -Thomas

 I like the idea of adding an ARB Extensions section and listing all
 the ARB extensions that aren't part of a particular GL version - simply
 in addition to the existing content, rather than reorganizing it.

 GL3.txt has been a misnomer for a while, but I don't care whether we
 rename it or not; it doesn't bother me.

 --Ken

 I've assembled a list of extensions I *think* are not demanded by
 any current openGL specs, but I may have missed some.
 (I find it weird that I VAO's in any of the specs, for example)
 I could add all of them to a separate section to track them,
 or I can leave it as is and drop this patch. Up to you guys.

 2.  GLX_ARB_get_proc_address
 4.  WGL_ARB_buffer_region
 8.  WGL_ARB_extensions_string
 9.  WGL_ARB_pixel_format
 10. WGL_ARB_make_current_read
 11. WGL_ARB_pbuffer
 15. GL_ARB_vertex_blend
 16. GL_ARB_matrix_palette
 20. WGL_ARB_render_texture
 24. GL_ARB_shadow_ambient
 36. GL_ARB_fragment_program_shadow

All extensions above are considered old crap. Also, WGL extensions? Seriously?

I personally think adding a list of non-core extensions to docs is
useless and will only distract people.

Marek
___
mesa-dev mailing list
mesa-dev@lists.freedesktop.org
http://lists.freedesktop.org/mailman/listinfo/mesa-dev


[Mesa-dev] [PATCH v2] mesa: AtomicBufferBindings should be initialized to zero.

2015-08-13 Thread Marta Lofstedt
From: Marta Lofstedt marta.lofst...@intel.com

According to OpenGL specification version 4.5 table 23.46
and OpenGL ES specification version 3.1 table 20.31:
ATOMIC_COUNTER_BUFFER_START and ATOMIC_COUNTER_BUFFER_SIZE
should have the initial value of zero.

Signed-off-by: Marta Lofstedt marta.lofst...@intel.com
---
 src/mesa/main/bufferobj.c | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

diff --git a/src/mesa/main/bufferobj.c b/src/mesa/main/bufferobj.c
index 1cdea93..e17b41c 100644
--- a/src/mesa/main/bufferobj.c
+++ b/src/mesa/main/bufferobj.c
@@ -866,8 +866,8 @@ _mesa_init_buffer_objects( struct gl_context *ctx )
   _mesa_reference_buffer_object(ctx,
ctx-AtomicBufferBindings[i].BufferObject,
ctx-Shared-NullBufferObj);
-  ctx-AtomicBufferBindings[i].Offset = -1;
-  ctx-AtomicBufferBindings[i].Size = -1;
+  ctx-AtomicBufferBindings[i].Offset = 0;
+  ctx-AtomicBufferBindings[i].Size = 0;
}
 }
 
-- 
1.9.1

___
mesa-dev mailing list
mesa-dev@lists.freedesktop.org
http://lists.freedesktop.org/mailman/listinfo/mesa-dev


[Mesa-dev] [PATCH] mesa: refactor target error checking in glGetTexLevelParameter

2015-08-13 Thread Tapani Pälli
With non-dsa functions we need to do target error checking before
_mesa_get_current_tex_object which would just call _mesa_problem without
raising GL_INVALID_ENUM error. In other places of Mesa, target gets checked
before this call. For dsa functions, we do not need this check. Texture
has been created already with a proper target value.

Fixes failures in:
   ES31-CTS.texture_storage_multisample.APIGLGetTexLevelParameterifv.*

Signed-off-by: Tapani Pälli tapani.pa...@intel.com
---
 src/mesa/main/texparam.c | 26 +++---
 1 file changed, 19 insertions(+), 7 deletions(-)

diff --git a/src/mesa/main/texparam.c b/src/mesa/main/texparam.c
index c0611c3..81c209f 100644
--- a/src/mesa/main/texparam.c
+++ b/src/mesa/main/texparam.c
@@ -1562,6 +1562,19 @@ invalid_pname:
_mesa_enum_to_string(pname));
 }
 
+static bool
+valid_tex_level_parameteriv_target(struct gl_context *ctx, GLenum target,
+   bool dsa)
+{
+   const char *suffix = dsa ? ture : ;
+   if (!legal_get_tex_level_parameter_target(ctx, target, dsa)) {
+  _mesa_error(ctx, GL_INVALID_ENUM,
+  glGetTex%sLevelParameter[if]v(target=%s), suffix,
+  _mesa_enum_to_string(target));
+  return false;
+   }
+   return true;
+}
 
 /**
  * This isn't exposed to the rest of the driver because it is a part of the
@@ -1585,13 +1598,6 @@ get_tex_level_parameteriv(struct gl_context *ctx,
   return;
}
 
-   if (!legal_get_tex_level_parameter_target(ctx, target, dsa)) {
-  _mesa_error(ctx, GL_INVALID_ENUM,
-  glGetTex%sLevelParameter[if]v(target=%s), suffix,
-  _mesa_enum_to_string(target));
-  return;
-   }
-
maxLevels = _mesa_max_texture_levels(ctx, target);
assert(maxLevels != 0);
 
@@ -1619,6 +1625,9 @@ _mesa_GetTexLevelParameterfv( GLenum target, GLint level,
GLint iparam;
GET_CURRENT_CONTEXT(ctx);
 
+   if (!valid_tex_level_parameteriv_target(ctx, target, false))
+  return;
+
texObj = _mesa_get_current_tex_object(ctx, target);
if (!texObj)
   return;
@@ -1636,6 +1645,9 @@ _mesa_GetTexLevelParameteriv( GLenum target, GLint level,
struct gl_texture_object *texObj;
GET_CURRENT_CONTEXT(ctx);
 
+   if (!valid_tex_level_parameteriv_target(ctx, target, false))
+  return;
+
texObj = _mesa_get_current_tex_object(ctx, target);
if (!texObj)
   return;
-- 
2.1.0

___
mesa-dev mailing list
mesa-dev@lists.freedesktop.org
http://lists.freedesktop.org/mailman/listinfo/mesa-dev


Re: [Mesa-dev] [PATCH 5/6] mesa/es31: AtomicBufferBindings should be initialized to zero.

2015-08-13 Thread Lofstedt, Marta
 -Original Message-
 From: mesa-dev [mailto:mesa-dev-boun...@lists.freedesktop.org] On
 Behalf Of Erik Faye-Lund
 Sent: Tuesday, June 23, 2015 3:41 PM
 To: Marta Lofstedt
 Cc: mesa-dev@lists.freedesktop.org
 Subject: Re: [Mesa-dev] [PATCH 5/6] mesa/es31: AtomicBufferBindings
 should be initialized to zero.
 
 On Tue, Jun 23, 2015 at 2:23 PM, Marta Lofstedt
 marta.lofst...@linux.intel.com wrote:
  From: Marta Lofstedt marta.lofst...@intel.com
 
  Accoring to GLES 3.1 CTS:
  GLES 3.1 CTS: ES31-CTS.shader_atomic_counters.
  basic-buffer-bind.
 
  AtomicBufferBindings size and start should be initialized to zero.
 
 
 OpenGL 3.1 says:
 
 Buffer variables in shader storage blocks are represented in memory in the
 same way as uniforms stored in uniform blocks, as described in section
 7.6.2.1.
 
 Table 6.2, Buffer object parameters and their values defines what seems
 like the initial values for this. And OpenGL 4.5 defines the same.
 
 But I guess someone who knows atomic buffers better than me should
 clarify.


Thanks for the comments Erik, I found tables in both GL 4.5 and GLES 3.1 that 
states that initial values should be 0. 
A V2 is up at: http://patchwork.freedesktop.org/patch/57023/

 
  Signed-off-by: Marta Lofstedt marta.lofst...@intel.com
  ---
   src/mesa/main/bufferobj.c | 11 ---
   1 file changed, 8 insertions(+), 3 deletions(-)
 
  diff --git a/src/mesa/main/bufferobj.c b/src/mesa/main/bufferobj.c
  index 66dee68..94629b3 100644
  --- a/src/mesa/main/bufferobj.c
  +++ b/src/mesa/main/bufferobj.c
  @@ -849,9 +849,14 @@ _mesa_init_buffer_objects( struct gl_context *ctx
 )
 _mesa_reference_buffer_object(ctx,
  
  ctx-AtomicBufferBindings[i].BufferObject,
  ctx-Shared-NullBufferObj);
  -  ctx-AtomicBufferBindings[i].Offset = -1;
  -  ctx-AtomicBufferBindings[i].Size = -1;
  -   }
  +  if (_mesa_is_gles31(ctx)) {
  + ctx-AtomicBufferBindings[i].Offset = 0;
  + ctx-AtomicBufferBindings[i].Size = 0;
  +  }
  +  else {
  + ctx-AtomicBufferBindings[i].Offset = -1;
  + ctx-AtomicBufferBindings[i].Size = -1;
  +  }
   }
 
 
  --
  1.9.1
 
  ___
  mesa-dev mailing list
  mesa-dev@lists.freedesktop.org
  http://lists.freedesktop.org/mailman/listinfo/mesa-dev
 ___
 mesa-dev mailing list
 mesa-dev@lists.freedesktop.org
 http://lists.freedesktop.org/mailman/listinfo/mesa-dev
___
mesa-dev mailing list
mesa-dev@lists.freedesktop.org
http://lists.freedesktop.org/mailman/listinfo/mesa-dev


Re: [Mesa-dev] [PATCH 1/5] utils: automake: remove uncommon $()

2015-08-13 Thread Emil Velikov
On 7 August 2015 at 19:22, Matt Turner matts...@gmail.com wrote:
 On Fri, Aug 7, 2015 at 11:05 AM, Emil Velikov emil.l.veli...@gmail.com 
 wrote:
 On 21 July 2015 at 13:12, Emil Velikov emil.l.veli...@gmail.com wrote:
 On 20/07/15 21:25, Chad Versace wrote:
 On Fri 17 Jul 2015, Emil Velikov wrote:
 On 17 July 2015 at 19:11, Ilia Mirkin imir...@alum.mit.edu wrote:
 On Fri, Jul 17, 2015 at 2:11 PM, Eric Anholt e...@anholt.net wrote:
 Matt Turner matts...@gmail.com writes:

 On Fri, Jul 17, 2015 at 10:17 AM, Emil Velikov 
 emil.l.veli...@gmail.com wrote:
 Cc: Eric Anholt e...@anholt.net
 Signed-off-by: Emil Velikov emil.l.veli...@gmail.com
 ---
  src/util/tests/hash_table/Makefile.am | 3 +--
  1 file changed, 1 insertion(+), 2 deletions(-)

 diff --git a/src/util/tests/hash_table/Makefile.am 
 b/src/util/tests/hash_table/Makefile.am
 index 04a77e3..0c99e7b 100644
 --- a/src/util/tests/hash_table/Makefile.am
 +++ b/src/util/tests/hash_table/Makefile.am
 @@ -38,7 +38,6 @@ TESTS = \
 null_destroy \
 random_entry \
 remove_null \
 -   replacement \
 -   $()
 +   replacement

 To get the benefit of $() without some unknown incompatibility, pixman
 uses $(NULL) which of course relies on not having a variable named
 NULL.

 I might suggest that instead of removing them, but I'm not much
 opposed to removing them either.

 I do really like having a terminator on these lists.  I find that
 without them, I'll end up copy-and-pasting the wrong thing and missing
 the trailing backslash on a line.

 Also makes diffs easier to read since you don't have spurious changes
 which just add a \ .

 I second Anholt. I prefer the sentinel too, but don't feel too strongly
 about it.

 I find that a sentinel helps me avoid making mistakes when adding new
 list members or when sorting the lists in $EDITOR.

 In case it's not (too) obvious I'm nuking these for consistency sake, as
 there are five of these in over 80 makefiles. If people like/prefer them
 can we have a volunteer that adds them everywhere ?

 Can we have some volunteers, please ?

 I don't think we should require consistency here.

Genuine question - what does this case makes it different from any other ?
We do config/build check before pushing which easily catches the
problem of missing \. Do we not ?

 Just make them $(NULL) like I suggested. That'll keep people who want
 the sentinels happy and it'll work for whatever silly version of Make
 you're using. :)
I never mentioned (nor hinted) that it was causing problems. I'm just
a sucker for consistency :P

-Emil
___
mesa-dev mailing list
mesa-dev@lists.freedesktop.org
http://lists.freedesktop.org/mailman/listinfo/mesa-dev


Re: [Mesa-dev] [PATCH 2/2][RFC] docs: Add the 2015 ARB extensions

2015-08-13 Thread Emil Velikov
On 13 August 2015 at 11:32, Marek Olšák mar...@gmail.com wrote:
 On Wed, Aug 12, 2015 at 11:23 PM, Thomas Helland
 thomashellan...@gmail.com wrote:

 2.  GLX_ARB_get_proc_address
 4.  WGL_ARB_buffer_region
 8.  WGL_ARB_extensions_string
 9.  WGL_ARB_pixel_format
 10. WGL_ARB_make_current_read
 11. WGL_ARB_pbuffer
 15. GL_ARB_vertex_blend
 16. GL_ARB_matrix_palette
 20. WGL_ARB_render_texture
 24. GL_ARB_shadow_ambient
 36. GL_ARB_fragment_program_shadow

 All extensions above are considered old crap.
And some were even explicitly removed from mesa (GL_ARB_shadow_ambient)

 Also, WGL extensions? Seriously?
Considering he went for a complete list, there is no problem with
mentioning WGL extensions. After all mesa does provide opengl32.dll :)
Although the list is a bit off - WGL_ARB_extensions_string,
WGL_ARB_pixel_format, WGL_ARB_pbuffer and others(?) are already
implemented in st/wgl. They have no mapi/glapi counterpart, as the
latter is the latter is not used on Windows (and OSmesa).

-Emil
___
mesa-dev mailing list
mesa-dev@lists.freedesktop.org
http://lists.freedesktop.org/mailman/listinfo/mesa-dev


Re: [Mesa-dev] [PATCH] Add mesa.icd to the .gitignore

2015-08-13 Thread Tapani Pälli

Reviewed-by: Tapani Palli tapani.pa...@intel.com

On 08/10/2015 07:31 PM, Neil Roberts wrote:

Since 4d7e0fa8c731776 this file is generated by the configure script.
---
  src/gallium/targets/opencl/.gitignore | 1 +
  1 file changed, 1 insertion(+)
  create mode 100644 src/gallium/targets/opencl/.gitignore

diff --git a/src/gallium/targets/opencl/.gitignore 
b/src/gallium/targets/opencl/.gitignore
new file mode 100644
index 000..dad573f
--- /dev/null
+++ b/src/gallium/targets/opencl/.gitignore
@@ -0,0 +1 @@
+/mesa.icd


___
mesa-dev mailing list
mesa-dev@lists.freedesktop.org
http://lists.freedesktop.org/mailman/listinfo/mesa-dev


Re: [Mesa-dev] [PATCH v2] mesa: AtomicBufferBindings should be initialized to zero.

2015-08-13 Thread Erik Faye-Lund
On Thu, Aug 13, 2015 at 12:59 PM, Marta Lofstedt
marta.lofst...@linux.intel.com wrote:
 From: Marta Lofstedt marta.lofst...@intel.com

 According to OpenGL specification version 4.5 table 23.46
 and OpenGL ES specification version 3.1 table 20.31:
 ATOMIC_COUNTER_BUFFER_START and ATOMIC_COUNTER_BUFFER_SIZE
 should have the initial value of zero.

 Signed-off-by: Marta Lofstedt marta.lofst...@intel.com
 ---
  src/mesa/main/bufferobj.c | 4 ++--
  1 file changed, 2 insertions(+), 2 deletions(-)

 diff --git a/src/mesa/main/bufferobj.c b/src/mesa/main/bufferobj.c
 index 1cdea93..e17b41c 100644
 --- a/src/mesa/main/bufferobj.c
 +++ b/src/mesa/main/bufferobj.c
 @@ -866,8 +866,8 @@ _mesa_init_buffer_objects( struct gl_context *ctx )
_mesa_reference_buffer_object(ctx,
 
 ctx-AtomicBufferBindings[i].BufferObject,
 ctx-Shared-NullBufferObj);
 -  ctx-AtomicBufferBindings[i].Offset = -1;
 -  ctx-AtomicBufferBindings[i].Size = -1;
 +  ctx-AtomicBufferBindings[i].Offset = 0;
 +  ctx-AtomicBufferBindings[i].Size = 0;
 }
  }


Looks good to me!

Reviewed-by: Erik Faye-Lund kusmab...@gmail.com
___
mesa-dev mailing list
mesa-dev@lists.freedesktop.org
http://lists.freedesktop.org/mailman/listinfo/mesa-dev


Re: [Mesa-dev] [PATCH v2 2/5] glsl: add support for the imageSize builtin

2015-08-13 Thread Martin Peres

On 13/08/15 15:53, Francisco Jerez wrote:

Martin Peres martin.pe...@linux.intel.com writes:


The code is heavily inspired from Francisco Jerez's code supporting the
image_load_store extension.

I moved out image_types[] out of builtin_builder::add_image_function to
share it with the newly-added builtin_builder::add_image_size_functions.

Backends willing to support this builtin should handle
__intrinsic_image_size.

v2: Based on the review of Ilia Mirkin
- Enable the extension for GLES 3.1
- Fix indentation
- Fix the return type (float to int, number of components for CubeImages)
- Add a warning related to GLES 3.1

Signed-off-by: Martin Peres martin.pe...@linux.intel.com
---
  src/glsl/builtin_functions.cpp | 179 +++--
  1 file changed, 136 insertions(+), 43 deletions(-)

diff --git a/src/glsl/builtin_functions.cpp b/src/glsl/builtin_functions.cpp
index 2175c66..b59baa6 100644
--- a/src/glsl/builtin_functions.cpp
+++ b/src/glsl/builtin_functions.cpp
@@ -399,6 +399,13 @@ shader_image_load_store(const _mesa_glsl_parse_state 
*state)
  }
  
  static bool

+shader_image_size(const _mesa_glsl_parse_state *state)
+{
+   return (state-is_version(430, 310) ||
+   state-ARB_shader_image_size_enable);
+}
+
+static bool
  gs_streams(const _mesa_glsl_parse_state *state)
  {
 return gpu_shader5(state)  gs_only(state);
@@ -502,8 +509,8 @@ private:
 };
  
 /**

-* Create a new image built-in function for all known image types.
-* \p flags is a bitfield of \c image_function_flags flags.
+* Create a new image built-in function for image load/store for all known
+* image types. \p flags is a bitfield of \c image_function_flags flags.
  */
 void add_image_function(const char *name,
 const char *intrinsic_name,
@@ -511,14 +518,24 @@ private:
 unsigned flags);
  
 /**

-* Create new functions for all known image built-ins and types.
-* If \p glsl is \c true, use the GLSL built-in names and emit code
-* to call into the actual compiler intrinsic.  If \p glsl is
+* Create a new image built-in function for image load/store for all known
+* image types. If \p glsl is \c true, use the GLSL built-in names and emit
+* code to call into the actual compiler intrinsic.  If \p glsl is
  * false, emit a function prototype with no body for each image
  * intrinsic name.
  */
 void add_image_functions(bool glsl);
  
+   /**

+* Create the imageSize built-in function for all known image built-ins and
+* types. If \p glsl is \c true, use the GLSL built-in names and emit code
+* to call into the actual compiler intrinsic.  If \p glsl is
+* false, emit a function prototype with no body for each image
+* intrinsic name.
+*/
+   void add_image_size_functions(const char *name, const char *intrinsic_name,
+ unsigned flags);
+
 ir_function_signature *new_sig(const glsl_type *return_type,
builtin_available_predicate avail,
int num_params, ...);
@@ -718,6 +735,10 @@ private:
 ir_function_signature *_memory_barrier(
builtin_available_predicate avail);
  
+   ir_function_signature *_image_size(const glsl_type *image_type,

+  const char *intrinsic_name,
+  unsigned flags);
+
  #undef B0
  #undef B1
  #undef B2
@@ -2549,53 +2570,54 @@ builtin_builder::add_function(const char *name, ...)
 shader-symbols-add_function(f);
  }
  
+static const glsl_type *const image_types[] = {

+   glsl_type::image1D_type,
+   glsl_type::image2D_type,
+   glsl_type::image3D_type,
+   glsl_type::image2DRect_type,
+   glsl_type::imageCube_type,
+   glsl_type::imageBuffer_type,
+   glsl_type::image1DArray_type,
+   glsl_type::image2DArray_type,
+   glsl_type::imageCubeArray_type,
+   glsl_type::image2DMS_type,
+   glsl_type::image2DMSArray_type,
+   glsl_type::iimage1D_type,
+   glsl_type::iimage2D_type,
+   glsl_type::iimage3D_type,
+   glsl_type::iimage2DRect_type,
+   glsl_type::iimageCube_type,
+   glsl_type::iimageBuffer_type,
+   glsl_type::iimage1DArray_type,
+   glsl_type::iimage2DArray_type,
+   glsl_type::iimageCubeArray_type,
+   glsl_type::iimage2DMS_type,
+   glsl_type::iimage2DMSArray_type,
+   glsl_type::uimage1D_type,
+   glsl_type::uimage2D_type,
+   glsl_type::uimage3D_type,
+   glsl_type::uimage2DRect_type,
+   glsl_type::uimageCube_type,
+   glsl_type::uimageBuffer_type,
+   glsl_type::uimage1DArray_type,
+   glsl_type::uimage2DArray_type,
+   glsl_type::uimageCubeArray_type,
+   glsl_type::uimage2DMS_type,
+   glsl_type::uimage2DMSArray_type
+};
+
  void
  builtin_builder::add_image_function(const char *name,
  const char *intrinsic_name,
  unsigned num_arguments,
 

[Mesa-dev] [PATCH v2] mesa: Raise INVALID_VALUE from glCreateShaderProgramv if count 0

2015-08-13 Thread Marta Lofstedt
From: Marta Lofstedt marta.lofst...@intel.com

According to OpenGL version 4.5 and OpenGL ES 3.1 standards,
section 7.3:
GL_INVALID_VALUE should be generated, if count is less than 0.

V2: Changed title, eased Open GL ES 3.1 restriction
and added comments.
---
 src/mesa/main/shaderapi.c | 9 +
 1 file changed, 9 insertions(+)

diff --git a/src/mesa/main/shaderapi.c b/src/mesa/main/shaderapi.c
index f9a7d13..1622274 100644
--- a/src/mesa/main/shaderapi.c
+++ b/src/mesa/main/shaderapi.c
@@ -2003,6 +2003,15 @@ _mesa_create_shader_program(struct gl_context* ctx, 
GLboolean separate,
const GLuint shader = create_shader(ctx, type);
GLuint program = 0;
 
+   /*
+* According to OpenGL 4.5 and OpenGL ES 3.1 standards, section 7.3:
+* GL_INVALID_VALUE should be generated if count  0
+*/
+   if (count  0) {
+  _mesa_error(ctx, GL_INVALID_VALUE, glCreateShaderProgram (count  0));
+  return program;
+   }
+
if (shader) {
   _mesa_ShaderSource(shader, count, strings, NULL);
 
-- 
1.9.1

___
mesa-dev mailing list
mesa-dev@lists.freedesktop.org
http://lists.freedesktop.org/mailman/listinfo/mesa-dev


Re: [Mesa-dev] [PATCH v2 2/5] glsl: add support for the imageSize builtin

2015-08-13 Thread Francisco Jerez
Martin Peres martin.pe...@linux.intel.com writes:

 The code is heavily inspired from Francisco Jerez's code supporting the
 image_load_store extension.

 I moved out image_types[] out of builtin_builder::add_image_function to
 share it with the newly-added builtin_builder::add_image_size_functions.

 Backends willing to support this builtin should handle
 __intrinsic_image_size.

 v2: Based on the review of Ilia Mirkin
 - Enable the extension for GLES 3.1
 - Fix indentation
 - Fix the return type (float to int, number of components for CubeImages)
 - Add a warning related to GLES 3.1

 Signed-off-by: Martin Peres martin.pe...@linux.intel.com
 ---
  src/glsl/builtin_functions.cpp | 179 
 +++--
  1 file changed, 136 insertions(+), 43 deletions(-)

 diff --git a/src/glsl/builtin_functions.cpp b/src/glsl/builtin_functions.cpp
 index 2175c66..b59baa6 100644
 --- a/src/glsl/builtin_functions.cpp
 +++ b/src/glsl/builtin_functions.cpp
 @@ -399,6 +399,13 @@ shader_image_load_store(const _mesa_glsl_parse_state 
 *state)
  }
  
  static bool
 +shader_image_size(const _mesa_glsl_parse_state *state)
 +{
 +   return (state-is_version(430, 310) ||
 +   state-ARB_shader_image_size_enable);
 +}
 +
 +static bool
  gs_streams(const _mesa_glsl_parse_state *state)
  {
 return gpu_shader5(state)  gs_only(state);
 @@ -502,8 +509,8 @@ private:
 };
  
 /**
 -* Create a new image built-in function for all known image types.
 -* \p flags is a bitfield of \c image_function_flags flags.
 +* Create a new image built-in function for image load/store for all known
 +* image types. \p flags is a bitfield of \c image_function_flags flags.
  */
 void add_image_function(const char *name,
 const char *intrinsic_name,
 @@ -511,14 +518,24 @@ private:
 unsigned flags);
  
 /**
 -* Create new functions for all known image built-ins and types.
 -* If \p glsl is \c true, use the GLSL built-in names and emit code
 -* to call into the actual compiler intrinsic.  If \p glsl is
 +* Create a new image built-in function for image load/store for all known
 +* image types. If \p glsl is \c true, use the GLSL built-in names and 
 emit
 +* code to call into the actual compiler intrinsic.  If \p glsl is
  * false, emit a function prototype with no body for each image
  * intrinsic name.
  */
 void add_image_functions(bool glsl);
  
 +   /**
 +* Create the imageSize built-in function for all known image built-ins 
 and
 +* types. If \p glsl is \c true, use the GLSL built-in names and emit code
 +* to call into the actual compiler intrinsic.  If \p glsl is
 +* false, emit a function prototype with no body for each image
 +* intrinsic name.
 +*/
 +   void add_image_size_functions(const char *name, const char 
 *intrinsic_name,
 + unsigned flags);
 +
 ir_function_signature *new_sig(const glsl_type *return_type,
builtin_available_predicate avail,
int num_params, ...);
 @@ -718,6 +735,10 @@ private:
 ir_function_signature *_memory_barrier(
builtin_available_predicate avail);
  
 +   ir_function_signature *_image_size(const glsl_type *image_type,
 +  const char *intrinsic_name,
 +  unsigned flags);
 +
  #undef B0
  #undef B1
  #undef B2
 @@ -2549,53 +2570,54 @@ builtin_builder::add_function(const char *name, ...)
 shader-symbols-add_function(f);
  }
  
 +static const glsl_type *const image_types[] = {
 +   glsl_type::image1D_type,
 +   glsl_type::image2D_type,
 +   glsl_type::image3D_type,
 +   glsl_type::image2DRect_type,
 +   glsl_type::imageCube_type,
 +   glsl_type::imageBuffer_type,
 +   glsl_type::image1DArray_type,
 +   glsl_type::image2DArray_type,
 +   glsl_type::imageCubeArray_type,
 +   glsl_type::image2DMS_type,
 +   glsl_type::image2DMSArray_type,
 +   glsl_type::iimage1D_type,
 +   glsl_type::iimage2D_type,
 +   glsl_type::iimage3D_type,
 +   glsl_type::iimage2DRect_type,
 +   glsl_type::iimageCube_type,
 +   glsl_type::iimageBuffer_type,
 +   glsl_type::iimage1DArray_type,
 +   glsl_type::iimage2DArray_type,
 +   glsl_type::iimageCubeArray_type,
 +   glsl_type::iimage2DMS_type,
 +   glsl_type::iimage2DMSArray_type,
 +   glsl_type::uimage1D_type,
 +   glsl_type::uimage2D_type,
 +   glsl_type::uimage3D_type,
 +   glsl_type::uimage2DRect_type,
 +   glsl_type::uimageCube_type,
 +   glsl_type::uimageBuffer_type,
 +   glsl_type::uimage1DArray_type,
 +   glsl_type::uimage2DArray_type,
 +   glsl_type::uimageCubeArray_type,
 +   glsl_type::uimage2DMS_type,
 +   glsl_type::uimage2DMSArray_type
 +};
 +
  void
  builtin_builder::add_image_function(const char *name,
  const char *intrinsic_name,
  

Re: [Mesa-dev] [PATCH] mesa: refactor target error checking in glGetTexLevelParameter

2015-08-13 Thread Timothy Arceri
On Thu, 2015-08-13 at 14:05 +0300, Tapani Pälli wrote:
 With non-dsa functions we need to do target error checking before
 _mesa_get_current_tex_object which would just call _mesa_problem without
 raising GL_INVALID_ENUM error. In other places of Mesa, target gets checked
 before this call. For dsa functions, we do not need this check. Texture
 has been created already with a proper target value.
 
 Fixes failures in:
ES31-CTS.texture_storage_multisample.APIGLGetTexLevelParameterifv.*
 
 Signed-off-by: Tapani Pälli tapani.pa...@intel.com
 ---
  src/mesa/main/texparam.c | 26 +++---
  1 file changed, 19 insertions(+), 7 deletions(-)
 
 diff --git a/src/mesa/main/texparam.c b/src/mesa/main/texparam.c
 index c0611c3..81c209f 100644
 --- a/src/mesa/main/texparam.c
 +++ b/src/mesa/main/texparam.c
 @@ -1562,6 +1562,19 @@ invalid_pname:
 _mesa_enum_to_string(pname));
  }
  
 +static bool
 +valid_tex_level_parameteriv_target(struct gl_context *ctx, GLenum target,
 +   bool dsa)
 +{
 +   const char *suffix = dsa ? ture : ;
 +   if (!legal_get_tex_level_parameter_target(ctx, target, dsa)) {
 +  _mesa_error(ctx, GL_INVALID_ENUM,
 +  glGetTex%sLevelParameter[if]v(target=%s), suffix,
 +  _mesa_enum_to_string(target));
 +  return false;
 +   }
 +   return true;
 +}
  
  /**
   * This isn't exposed to the rest of the driver because it is a part of the
 @@ -1585,13 +1598,6 @@ get_tex_level_parameteriv(struct gl_context *ctx,
return;
 }
  
 -   if (!legal_get_tex_level_parameter_target(ctx, target, dsa)) {
 -  _mesa_error(ctx, GL_INVALID_ENUM,
 -  glGetTex%sLevelParameter[if]v(target=%s), suffix,
 -  _mesa_enum_to_string(target));
 -  return;
 -   }
 -_mesa_GetTexLevelParameterfv( GLenum target, GLint
 level,
 GLint iparam;
 GET_CURRENT_CONTEXT(ctx);
  
 +   if (!valid_tex_level_parameteriv_target(ctx, target, false))
 +  return;
 +
 texObj = _mesa_get_current_tex_object(ctx, target);
 if (!texObj)
return;
 @@ -1636,6 +1645,9 @@ _mesa_GetTexLevelParameteriv( GLenum target, GLint 
 level,
 struct gl_texture_object *texObj;
 GET_CURRENT_CONTEXT(ctx);
  
 +   if (!valid_tex_level_parameteriv_target(ctx, target, false))
 +  return;
 +
 texObj = _mesa_get_current_tex_object(ctx, target);
 if (!texObj)
return;


I think you forgot to add calls to the new validation for the dsa functions.

___
mesa-dev mailing list
mesa-dev@lists.freedesktop.org
http://lists.freedesktop.org/mailman/listinfo/mesa-dev


Re: [Mesa-dev] [PATCH 08/70] i965: Remove early release of DRI2 miptree

2015-08-13 Thread Martin Peres

On 07/08/15 23:13, Chris Wilson wrote:

intel_update_winsys_renderbuffer_miptree() will release the existing
miptree when wrapping a new DRI2 buffer, so we can remove the early
release and so prevent a NULL mt dereference should importing the new
DRI2 name fail for any reason. (Reusing the old DRI2 name will result
in the rendering going astray, to a stale buffer, and not shown on the
screen, but it allows us to issue a warning and not crash much later in
innocent code.)

Signed-off-by: Chris Wilson ch...@chris-wilson.co.uk
---
  src/mesa/drivers/dri/i965/brw_context.c | 1 -
  1 file changed, 1 deletion(-)

diff --git a/src/mesa/drivers/dri/i965/brw_context.c 
b/src/mesa/drivers/dri/i965/brw_context.c
index e8d1396..72f3897 100644
--- a/src/mesa/drivers/dri/i965/brw_context.c
+++ b/src/mesa/drivers/dri/i965/brw_context.c
@@ -1388,7 +1388,6 @@ intel_process_dri2_buffer(struct brw_context *brw,
buffer-cpp, buffer-pitch);
 }
  
-   intel_miptree_release(rb-mt);

 bo = drm_intel_bo_gem_create_from_name(brw-bufmgr, buffer_name,
buffer-name);
 if (!bo) {


Bugzilla: https://bugs.freedesktop.org/show_bug.cgi?id=86281
Reviewed-by: Martin Peres martin.pe...@linux.intel.com

If no-one has any objection, I will push the patch tomorrow to avoid the 
crashes experienced by a lot of users, myself included!


___
mesa-dev mailing list
mesa-dev@lists.freedesktop.org
http://lists.freedesktop.org/mailman/listinfo/mesa-dev


Re: [Mesa-dev] [PATCH] mesa: refactor target error checking in glGetTexLevelParameter

2015-08-13 Thread Tapani Pälli



On 08/13/2015 02:51 PM, Timothy Arceri wrote:

On Thu, 2015-08-13 at 14:05 +0300, Tapani Pälli wrote:

With non-dsa functions we need to do target error checking before
_mesa_get_current_tex_object which would just call _mesa_problem without
raising GL_INVALID_ENUM error. In other places of Mesa, target gets checked
before this call. For dsa functions, we do not need this check. Texture
has been created already with a proper target value.

Fixes failures in:
ES31-CTS.texture_storage_multisample.APIGLGetTexLevelParameterifv.*

Signed-off-by: Tapani Pälli tapani.pa...@intel.com
---
  src/mesa/main/texparam.c | 26 +++---
  1 file changed, 19 insertions(+), 7 deletions(-)

diff --git a/src/mesa/main/texparam.c b/src/mesa/main/texparam.c
index c0611c3..81c209f 100644
--- a/src/mesa/main/texparam.c
+++ b/src/mesa/main/texparam.c
@@ -1562,6 +1562,19 @@ invalid_pname:
 _mesa_enum_to_string(pname));
  }

+static bool
+valid_tex_level_parameteriv_target(struct gl_context *ctx, GLenum target,
+   bool dsa)
+{
+   const char *suffix = dsa ? ture : ;
+   if (!legal_get_tex_level_parameter_target(ctx, target, dsa)) {
+  _mesa_error(ctx, GL_INVALID_ENUM,
+  glGetTex%sLevelParameter[if]v(target=%s), suffix,
+  _mesa_enum_to_string(target));
+  return false;
+   }
+   return true;
+}

  /**
   * This isn't exposed to the rest of the driver because it is a part of the
@@ -1585,13 +1598,6 @@ get_tex_level_parameteriv(struct gl_context *ctx,
return;
 }

-   if (!legal_get_tex_level_parameter_target(ctx, target, dsa)) {
-  _mesa_error(ctx, GL_INVALID_ENUM,
-  glGetTex%sLevelParameter[if]v(target=%s), suffix,
-  _mesa_enum_to_string(target));
-  return;
-   }
-_mesa_GetTexLevelParameterfv( GLenum target, GLint
level,
 GLint iparam;
 GET_CURRENT_CONTEXT(ctx);

+   if (!valid_tex_level_parameteriv_target(ctx, target, false))
+  return;
+
 texObj = _mesa_get_current_tex_object(ctx, target);
 if (!texObj)
return;
@@ -1636,6 +1645,9 @@ _mesa_GetTexLevelParameteriv( GLenum target, GLint
level,
 struct gl_texture_object *texObj;
 GET_CURRENT_CONTEXT(ctx);

+   if (!valid_tex_level_parameteriv_target(ctx, target, false))
+  return;
+
 texObj = _mesa_get_current_tex_object(ctx, target);
 if (!texObj)
return;



I think you forgot to add calls to the new validation for the dsa functions.



Nope, the motivation for leaving out the checks for dsa functions is 
that the texture target enum has been validated already for existing 
textures, it cannot be invalid at this point. At least this is how I 
understand it.


// Tapani
___
mesa-dev mailing list
mesa-dev@lists.freedesktop.org
http://lists.freedesktop.org/mailman/listinfo/mesa-dev


Re: [Mesa-dev] [PATCH 1/5] main: add extension GL_ARB_shader_image_size

2015-08-13 Thread Francisco Jerez
Martin Peres martin.pe...@linux.intel.com writes:

 Signed-off-by: Martin Peres martin.pe...@linux.intel.com

Reviewed-by: Francisco Jerez curroje...@riseup.net

 ---
  src/glsl/glcpp/glcpp-parse.y| 3 +++
  src/glsl/glsl_parser_extras.cpp | 1 +
  src/glsl/glsl_parser_extras.h   | 2 ++
  src/mesa/main/extensions.c  | 1 +
  src/mesa/main/mtypes.h  | 1 +
  5 files changed, 8 insertions(+)

 diff --git a/src/glsl/glcpp/glcpp-parse.y b/src/glsl/glcpp/glcpp-parse.y
 index dd5ec2a..18e50af 100644
 --- a/src/glsl/glcpp/glcpp-parse.y
 +++ b/src/glsl/glcpp/glcpp-parse.y
 @@ -2478,6 +2478,9 @@ _glcpp_parser_handle_version_declaration(glcpp_parser_t 
 *parser, intmax_t versio
 if (extensions-ARB_shader_image_load_store)
add_builtin_define(parser, GL_ARB_shader_image_load_store, 
 1);
  
 +  if (extensions-ARB_shader_image_size)
 + add_builtin_define(parser, GL_ARB_shader_image_size, 1);
 +
if (extensions-ARB_derivative_control)
   add_builtin_define(parser, GL_ARB_derivative_control, 1);
  
 diff --git a/src/glsl/glsl_parser_extras.cpp b/src/glsl/glsl_parser_extras.cpp
 index 46896d7..a4fbb33 100644
 --- a/src/glsl/glsl_parser_extras.cpp
 +++ b/src/glsl/glsl_parser_extras.cpp
 @@ -599,6 +599,7 @@ static const _mesa_glsl_extension 
 _mesa_glsl_supported_extensions[] = {
 EXT(ARB_shader_atomic_counters,   true,  false, 
 ARB_shader_atomic_counters),
 EXT(ARB_shader_bit_encoding,  true,  false, 
 ARB_shader_bit_encoding),
 EXT(ARB_shader_image_load_store,  true,  false, 
 ARB_shader_image_load_store),
 +   EXT(ARB_shader_image_size,true,  false, 
 ARB_shader_image_size),
 EXT(ARB_shader_precision, true,  false, 
 ARB_shader_precision),
 EXT(ARB_shader_stencil_export,true,  false, 
 ARB_shader_stencil_export),
 EXT(ARB_shader_storage_buffer_object, true,  false, 
 ARB_shader_storage_buffer_object),
 diff --git a/src/glsl/glsl_parser_extras.h b/src/glsl/glsl_parser_extras.h
 index eb325f0..f018f1d 100644
 --- a/src/glsl/glsl_parser_extras.h
 +++ b/src/glsl/glsl_parser_extras.h
 @@ -495,6 +495,8 @@ struct _mesa_glsl_parse_state {
 bool ARB_shader_bit_encoding_warn;
 bool ARB_shader_image_load_store_enable;
 bool ARB_shader_image_load_store_warn;
 +   bool ARB_shader_image_size_enable;
 +   bool ARB_shader_image_size_warn;
 bool ARB_shader_precision_enable;
 bool ARB_shader_precision_warn;
 bool ARB_shader_stencil_export_enable;
 diff --git a/src/mesa/main/extensions.c b/src/mesa/main/extensions.c
 index 2dbfabd..038a438 100644
 --- a/src/mesa/main/extensions.c
 +++ b/src/mesa/main/extensions.c
 @@ -152,6 +152,7 @@ static const struct extension extension_table[] = {
 { GL_ARB_shader_atomic_counters,  
 o(ARB_shader_atomic_counters),  GL, 2011 },
 { GL_ARB_shader_bit_encoding, 
 o(ARB_shader_bit_encoding), GL, 2010 },
 { GL_ARB_shader_image_load_store, 
 o(ARB_shader_image_load_store), GL, 2011 },
 +   { GL_ARB_shader_image_size,   o(ARB_shader_image_size), 
   GL, 2012 },
 { GL_ARB_shader_objects,  o(dummy_true),
   GL, 2002 },
 { GL_ARB_shader_precision,o(ARB_shader_precision),  
   GL, 2010 },
 { GL_ARB_shader_stencil_export,   
 o(ARB_shader_stencil_export),   GL, 2009 },
 diff --git a/src/mesa/main/mtypes.h b/src/mesa/main/mtypes.h
 index 4e00fb6..6a0065c 100644
 --- a/src/mesa/main/mtypes.h
 +++ b/src/mesa/main/mtypes.h
 @@ -3862,6 +3862,7 @@ struct gl_extensions
 GLboolean ARB_shader_atomic_counters;
 GLboolean ARB_shader_bit_encoding;
 GLboolean ARB_shader_image_load_store;
 +   GLboolean ARB_shader_image_size;
 GLboolean ARB_shader_precision;
 GLboolean ARB_shader_stencil_export;
 GLboolean ARB_shader_storage_buffer_object;
 -- 
 2.5.0

 ___
 mesa-dev mailing list
 mesa-dev@lists.freedesktop.org
 http://lists.freedesktop.org/mailman/listinfo/mesa-dev


signature.asc
Description: PGP signature
___
mesa-dev mailing list
mesa-dev@lists.freedesktop.org
http://lists.freedesktop.org/mailman/listinfo/mesa-dev


Re: [Mesa-dev] [PATCH] mesa: refactor target error checking in glGetTexLevelParameter

2015-08-13 Thread Timothy Arceri
On Thu, 2015-08-13 at 15:01 +0300, Tapani Pälli wrote:
 
 On 08/13/2015 02:51 PM, Timothy Arceri wrote:
  On Thu, 2015-08-13 at 14:05 +0300, Tapani Pälli wrote:
   With non-dsa functions we need to do target error checking before
   _mesa_get_current_tex_object which would just call _mesa_problem without
   raising GL_INVALID_ENUM error. In other places of Mesa, target gets 
   checked
   before this call. For dsa functions, we do not need this check. Texture
   has been created already with a proper target value.
   
   Fixes failures in:
   ES31-CTS.texture_storage_multisample.APIGLGetTexLevelParameterifv.*
   
   Signed-off-by: Tapani Pälli tapani.pa...@intel.com
   ---
 src/mesa/main/texparam.c | 26 +++---
 1 file changed, 19 insertions(+), 7 deletions(-)
   
   diff --git a/src/mesa/main/texparam.c b/src/mesa/main/texparam.c
   index c0611c3..81c209f 100644
   --- a/src/mesa/main/texparam.c
   +++ b/src/mesa/main/texparam.c
   @@ -1562,6 +1562,19 @@ invalid_pname:
_mesa_enum_to_string(pname));
 }
   
   +static bool
   +valid_tex_level_parameteriv_target(struct gl_context *ctx, GLenum 
   target,
   +   bool dsa)
   +{
   +   const char *suffix = dsa ? ture : ;
   +   if (!legal_get_tex_level_parameter_target(ctx, target, dsa)) {
   +  _mesa_error(ctx, GL_INVALID_ENUM,
   +  glGetTex%sLevelParameter[if]v(target=%s), suffix,
   +  _mesa_enum_to_string(target));
   +  return false;
   +   }
   +   return true;
   +}
   
 /**
  * This isn't exposed to the rest of the driver because it is a part 
   of the
   @@ -1585,13 +1598,6 @@ get_tex_level_parameteriv(struct gl_context *ctx,
   return;
}
   
   -   if (!legal_get_tex_level_parameter_target(ctx, target, dsa)) {
   -  _mesa_error(ctx, GL_INVALID_ENUM,
   -  glGetTex%sLevelParameter[if]v(target=%s), suffix,
   -  _mesa_enum_to_string(target));
   -  return;
   -   }
   -_mesa_GetTexLevelParameterfv( GLenum target, GLint
   level,
GLint iparam;
GET_CURRENT_CONTEXT(ctx);
   
   +   if (!valid_tex_level_parameteriv_target(ctx, target, false))
   +  return;
   +
texObj = _mesa_get_current_tex_object(ctx, target);
if (!texObj)
   return;
   @@ -1636,6 +1645,9 @@ _mesa_GetTexLevelParameteriv( GLenum target, GLint
   level,
struct gl_texture_object *texObj;
GET_CURRENT_CONTEXT(ctx);
   
   +   if (!valid_tex_level_parameteriv_target(ctx, target, false))
   +  return;
   +
texObj = _mesa_get_current_tex_object(ctx, target);
if (!texObj)
   return;
  
  
  I think you forgot to add calls to the new validation for the dsa 
  functions.
  
 
 Nope, the motivation for leaving out the checks for dsa functions is 
 that the texture target enum has been validated already for existing 
 textures, it cannot be invalid at this point. At least this is how I 
 understand it.

I don't think thats right. The dsa functions are just passed a texture id, the
id may find you a texture that exists but you need to make sure the texture is
a valid type for use with the LevelParameter*


 
 // Tapani
___
mesa-dev mailing list
mesa-dev@lists.freedesktop.org
http://lists.freedesktop.org/mailman/listinfo/mesa-dev


Re: [Mesa-dev] [PATCH v2] mesa: Raise INVALID_VALUE from glCreateShaderProgramv if count 0

2015-08-13 Thread Timothy Arceri
On Thu, 2015-08-13 at 14:38 +0200, Marta Lofstedt wrote:
 From: Marta Lofstedt marta.lofst...@intel.com
 
 According to OpenGL version 4.5 and OpenGL ES 3.1 standards,
 section 7.3:
 GL_INVALID_VALUE should be generated, if count is less than 0.
 
 V2: Changed title, eased Open GL ES 3.1 restriction
 and added comments.
 ---
  src/mesa/main/shaderapi.c | 9 +
  1 file changed, 9 insertions(+)
 
 diff --git a/src/mesa/main/shaderapi.c b/src/mesa/main/shaderapi.c
 index f9a7d13..1622274 100644
 --- a/src/mesa/main/shaderapi.c
 +++ b/src/mesa/main/shaderapi.c
 @@ -2003,6 +2003,15 @@ _mesa_create_shader_program(struct gl_context* ctx, 
 GLboolean separate,
 const GLuint shader = create_shader(ctx, type);
 GLuint program = 0;
  
 +   /*
 +* According to OpenGL 4.5 and OpenGL ES 3.1 standards, section 7.3:
 +* GL_INVALID_VALUE should be generated if count  0
 +*/
 +   if (count  0) {
 +  _mesa_error(ctx, GL_INVALID_VALUE, glCreateShaderProgram (count  
 0));
 +  return program;
 +   }
 +

It looks like this should be checked in ShaderSource() but it doesn't hurt
much to check here too since this shouldn't be called too often. Did you want
to add it to ShaderSource() in a follow up patch?

For this patch: Reviewed-by: Timothy Arceri t_arc...@yahoo.com.au

 if (shader) {
_mesa_ShaderSource(shader, count, strings, NULL);
  
___
mesa-dev mailing list
mesa-dev@lists.freedesktop.org
http://lists.freedesktop.org/mailman/listinfo/mesa-dev


[Mesa-dev] [PATCH v2] mesa: refactor target error checking in glGetTexLevelParameter

2015-08-13 Thread Tapani Pälli
With non-dsa functions we need to do target error checking before
_mesa_get_current_tex_object which would just call _mesa_problem without
raising GL_INVALID_ENUM error. In other places of Mesa, target gets checked
before this call.

Fixes failures in:
   ES31-CTS.texture_storage_multisample.APIGLGetTexLevelParameterifv.*

v2: do the check also for dsa functions (Timothy)

Signed-off-by: Tapani Pälli tapani.pa...@intel.com
---
 src/mesa/main/texparam.c | 32 +---
 1 file changed, 25 insertions(+), 7 deletions(-)

diff --git a/src/mesa/main/texparam.c b/src/mesa/main/texparam.c
index d9efd15..76edcca 100644
--- a/src/mesa/main/texparam.c
+++ b/src/mesa/main/texparam.c
@@ -1574,6 +1574,19 @@ invalid_pname:
_mesa_enum_to_string(pname));
 }
 
+static bool
+valid_tex_level_parameteriv_target(struct gl_context *ctx, GLenum target,
+   bool dsa)
+{
+   const char *suffix = dsa ? ture : ;
+   if (!legal_get_tex_level_parameter_target(ctx, target, dsa)) {
+  _mesa_error(ctx, GL_INVALID_ENUM,
+  glGetTex%sLevelParameter[if]v(target=%s), suffix,
+  _mesa_enum_to_string(target));
+  return false;
+   }
+   return true;
+}
 
 /**
  * This isn't exposed to the rest of the driver because it is a part of the
@@ -1597,13 +1610,6 @@ get_tex_level_parameteriv(struct gl_context *ctx,
   return;
}
 
-   if (!legal_get_tex_level_parameter_target(ctx, target, dsa)) {
-  _mesa_error(ctx, GL_INVALID_ENUM,
-  glGetTex%sLevelParameter[if]v(target=%s), suffix,
-  _mesa_enum_to_string(target));
-  return;
-   }
-
maxLevels = _mesa_max_texture_levels(ctx, target);
assert(maxLevels != 0);
 
@@ -1631,6 +1637,9 @@ _mesa_GetTexLevelParameterfv( GLenum target, GLint level,
GLint iparam;
GET_CURRENT_CONTEXT(ctx);
 
+   if (!valid_tex_level_parameteriv_target(ctx, target, false))
+  return;
+
texObj = _mesa_get_current_tex_object(ctx, target);
if (!texObj)
   return;
@@ -1648,6 +1657,9 @@ _mesa_GetTexLevelParameteriv( GLenum target, GLint level,
struct gl_texture_object *texObj;
GET_CURRENT_CONTEXT(ctx);
 
+   if (!valid_tex_level_parameteriv_target(ctx, target, false))
+  return;
+
texObj = _mesa_get_current_tex_object(ctx, target);
if (!texObj)
   return;
@@ -1669,6 +1681,9 @@ _mesa_GetTextureLevelParameterfv(GLuint texture, GLint 
level,
if (!texObj)
   return;
 
+   if (!valid_tex_level_parameteriv_target(ctx, texObj-Target, true))
+  return;
+
get_tex_level_parameteriv(ctx, texObj, texObj-Target, level,
  pname, iparam, true);
 
@@ -1687,6 +1702,9 @@ _mesa_GetTextureLevelParameteriv(GLuint texture, GLint 
level,
if (!texObj)
   return;
 
+   if (!valid_tex_level_parameteriv_target(ctx, texObj-Target, true))
+  return;
+
get_tex_level_parameteriv(ctx, texObj, texObj-Target, level,
  pname, params, true);
 }
-- 
2.1.0

___
mesa-dev mailing list
mesa-dev@lists.freedesktop.org
http://lists.freedesktop.org/mailman/listinfo/mesa-dev


Re: [Mesa-dev] [Nouveau] [PATCH mesa] nv30: Fix creation of scanout buffers

2015-08-13 Thread poma
On 12.08.2015 14:24, Hans de Goede wrote:
 Scanout buffers on nv30 must always be non-swizzled and have special
 width alignment constraints.
 
 These constrains have been taken from the xf86-video-nouveau
 src/nv_accel_common.c: nouveau_allocate_surface() function.
 
 nouveau_allocate_surface() applies these width constraints only when a
 tiled attribute is set, which it sets for all surfaces allocated via
 dri, and this tiling is not the same as swizzling, scanout surfaces
 must be linear / have a uniform_pitch or only complete garbage is shown.
 
 This commit fixes dri3 on nv30 showing a garbled display, with dri3 the
 scanout buffers are allocated by mesa, rather then by the ddx, and the
 wrong stride of these buffers was causing the garbled display.
 
 Signed-off-by: Hans de Goede hdego...@redhat.com
 ---
  src/gallium/drivers/nouveau/nv30/nv30_miptree.c | 10 ++
  1 file changed, 10 insertions(+)
 
 diff --git a/src/gallium/drivers/nouveau/nv30/nv30_miptree.c 
 b/src/gallium/drivers/nouveau/nv30/nv30_miptree.c
 index c75b4b9..2276347 100644
 --- a/src/gallium/drivers/nouveau/nv30/nv30_miptree.c
 +++ b/src/gallium/drivers/nouveau/nv30/nv30_miptree.c
 @@ -28,6 +28,7 @@
  #include util/u_surface.h
  
  #include nv_m2mf.xml.h
 +#include nv_object.xml.h
  #include nv30/nv30_screen.h
  #include nv30/nv30_context.h
  #include nv30/nv30_resource.h
 @@ -362,6 +363,7 @@ nv30_miptree_create(struct pipe_screen *pscreen,
 blocksz = util_format_get_blocksize(pt-format);
  
 if ((pt-target == PIPE_TEXTURE_RECT) ||
 +   (pt-bind  PIPE_BIND_SCANOUT) ||
 !util_is_power_of_two(pt-width0) ||
 !util_is_power_of_two(pt-height0) ||
 !util_is_power_of_two(pt-depth0) ||
 @@ -369,6 +371,14 @@ nv30_miptree_create(struct pipe_screen *pscreen,
 util_format_is_float(pt-format) || mt-ms_mode) {
mt-uniform_pitch = util_format_get_nblocksx(pt-format, w) * blocksz;
mt-uniform_pitch = align(mt-uniform_pitch, 64);
 +  if (pt-bind  PIPE_BIND_SCANOUT) {
 + struct nv30_screen *screen = nv30_screen(pscreen);
 + int pitch_align = MAX2(
 +   screen-eng3d-oclass = NV40_3D_CLASS ? 1024 : 256,
 +   /* round_down_pow2(mt-uniform_pitch / 4) */
 +   1  (util_last_bit(mt-uniform_pitch / 4) - 1));
 + mt-uniform_pitch = align(mt-uniform_pitch, pitch_align);
 +  }
 }
  
 if (!mt-uniform_pitch)
 


I patched mesa 10.6.4 with it, did not help to solve
https://bugs.freedesktop.org/show_bug.cgi?id=90871


___
mesa-dev mailing list
mesa-dev@lists.freedesktop.org
http://lists.freedesktop.org/mailman/listinfo/mesa-dev


Re: [Mesa-dev] [PATCH] i915: BINDING_TABLE_POINTER_* after CONSTANT_* for SKL BXT

2015-08-13 Thread Joonas Lahtinen
Hi,

On ke, 2015-08-12 at 18:34 -0700, Ben Widawsky wrote:
 On Wed, Aug 12, 2015 at 03:09:44PM +0300, Joonas Lahtinen wrote:
  Add a comment about reinforcing command order so that
  3DSTATE_BINDING_TABLE_POINTER_* commands are after
  3DSTATE_CONSTANT_* commands for SKL  BXT, otherwise the
  GPU might hang.
  
  Changing the BLORP code is not relevant (where the order
  is wrong), as it is not used for GEN8 or up.
  
  Cc: Mika Kuoppala mika.kuopp...@linux.intel.com
  Cc: Arun Siluvery arun.siluv...@linux.intel.com
  Signed-off-by: Joonas Lahtinen joonas.lahti...@linux.intel.com
  ---
   src/mesa/drivers/dri/i965/brw_state_upload.c | 6 +++---
   1 file changed, 3 insertions(+), 3 deletions(-)
  
  diff --git a/src/mesa/drivers/dri/i965/brw_state_upload.c 
  b/src/mesa/drivers/dri/i965/brw_state_upload.c
  index 9de42ce..9078e11 100644
  --- a/src/mesa/drivers/dri/i965/brw_state_upload.c
  +++ b/src/mesa/drivers/dri/i965/brw_state_upload.c
  @@ -299,9 +299,9 @@ static const struct brw_tracked_state 
  *gen8_render_atoms[] =
  brw_wm_abo_surfaces,
  gen6_renderbuffer_surfaces,
  brw_texture_surfaces,
  -   brw_vs_binding_table,
  -   brw_gs_binding_table,
  -   brw_wm_binding_table,
  +   brw_vs_binding_table, /* Must come after vs_push_constants for 
  Skylake and Broxton. */
  +   brw_gs_binding_table, /* Must come after gs_push_constants for 
  Skylake and Broxton. */
  +   brw_wm_binding_table, /* Must come after wm_push_constants for 
  Skylake and Broxton. */
   
  brw_fs_samplers,
  brw_vs_samplers,
 
 Does anyone understand why this actually causes a hang on the IGT 
 test? I
 certainly don't. The docs are pretty clear that the constant command 
 is not
 committed until the BTP command, but I can't make any sense of how it 
 related to
 a GPU hang.
 

Discussion about this continued in the driver list.

 In any event, I don't think the comments are super useful, but 
 they're not
 harmful either. I'd suggest one line instead:
 NOTE: push_constant_ff must precede binding table pointer upload
 

The table previously seemed to contain per-line comments for other
ordering restrictions, so I just went with style that looks consitent
with the rest. Also it makes some sense, as it's only the respective
3DSTATE_CONSTANT_* whose parsing is triggered by matching a
3DSTATE_BINDING_TABLE_POINTER_* command. They could be interleaved too.

I'll correct the s/i915/i965/ as noted by Matt. How about the comments?

Regards, Joonas

 Reviewed-by: Ben Widawsky b...@bwidawsk.net
___
mesa-dev mailing list
mesa-dev@lists.freedesktop.org
http://lists.freedesktop.org/mailman/listinfo/mesa-dev


Re: [Mesa-dev] [PATCH] mesa: refactor target error checking in glGetTexLevelParameter

2015-08-13 Thread Tapani Pälli

On 08/13/2015 03:47 PM, Timothy Arceri wrote:

On Thu, 2015-08-13 at 15:01 +0300, Tapani Pälli wrote:

On 08/13/2015 02:51 PM, Timothy Arceri wrote:

On Thu, 2015-08-13 at 14:05 +0300, Tapani Pälli wrote:

With non-dsa functions we need to do target error checking before
_mesa_get_current_tex_object which would just call _mesa_problem without
raising GL_INVALID_ENUM error. In other places of Mesa, target gets
checked
before this call. For dsa functions, we do not need this check. Texture
has been created already with a proper target value.

Fixes failures in:
 ES31-CTS.texture_storage_multisample.APIGLGetTexLevelParameterifv.*

Signed-off-by: Tapani Pälli tapani.pa...@intel.com
---
   src/mesa/main/texparam.c | 26 +++---
   1 file changed, 19 insertions(+), 7 deletions(-)

diff --git a/src/mesa/main/texparam.c b/src/mesa/main/texparam.c
index c0611c3..81c209f 100644
--- a/src/mesa/main/texparam.c
+++ b/src/mesa/main/texparam.c
@@ -1562,6 +1562,19 @@ invalid_pname:
  _mesa_enum_to_string(pname));
   }

+static bool
+valid_tex_level_parameteriv_target(struct gl_context *ctx, GLenum
target,
+   bool dsa)
+{
+   const char *suffix = dsa ? ture : ;
+   if (!legal_get_tex_level_parameter_target(ctx, target, dsa)) {
+  _mesa_error(ctx, GL_INVALID_ENUM,
+  glGetTex%sLevelParameter[if]v(target=%s), suffix,
+  _mesa_enum_to_string(target));
+  return false;
+   }
+   return true;
+}

   /**
* This isn't exposed to the rest of the driver because it is a part
of the
@@ -1585,13 +1598,6 @@ get_tex_level_parameteriv(struct gl_context *ctx,
 return;
  }

-   if (!legal_get_tex_level_parameter_target(ctx, target, dsa)) {
-  _mesa_error(ctx, GL_INVALID_ENUM,
-  glGetTex%sLevelParameter[if]v(target=%s), suffix,
-  _mesa_enum_to_string(target));
-  return;
-   }
-_mesa_GetTexLevelParameterfv( GLenum target, GLint
level,
  GLint iparam;
  GET_CURRENT_CONTEXT(ctx);

+   if (!valid_tex_level_parameteriv_target(ctx, target, false))
+  return;
+
  texObj = _mesa_get_current_tex_object(ctx, target);
  if (!texObj)
 return;
@@ -1636,6 +1645,9 @@ _mesa_GetTexLevelParameteriv( GLenum target, GLint
level,
  struct gl_texture_object *texObj;
  GET_CURRENT_CONTEXT(ctx);

+   if (!valid_tex_level_parameteriv_target(ctx, target, false))
+  return;
+
  texObj = _mesa_get_current_tex_object(ctx, target);
  if (!texObj)
 return;


I think you forgot to add calls to the new validation for the dsa
functions.


Nope, the motivation for leaving out the checks for dsa functions is
that the texture target enum has been validated already for existing
textures, it cannot be invalid at this point. At least this is how I
understand it.

I don't think thats right. The dsa functions are just passed a texture id, the
id may find you a texture that exists but you need to make sure the texture is
a valid type for use with the LevelParameter*


Ah right, yep a check is required. I'll send a v2




// Tapani


___
mesa-dev mailing list
mesa-dev@lists.freedesktop.org
http://lists.freedesktop.org/mailman/listinfo/mesa-dev


Re: [Mesa-dev] [PATCH 1/2] mesa: remove extern from texture function

2015-08-13 Thread Brian Paul
On Thu, Aug 13, 2015 at 2:53 AM, Timothy Arceri t_arc...@yahoo.com.au
wrote:

 ---
  src/mesa/main/teximage.c | 2 +-
  src/mesa/main/teximage.h | 9 -
  2 files changed, 1 insertion(+), 10 deletions(-)

 diff --git a/src/mesa/main/teximage.c b/src/mesa/main/teximage.c
 index fc69387..55cbb37 100644
 --- a/src/mesa/main/teximage.c
 +++ b/src/mesa/main/teximage.c
 @@ -5595,7 +5595,7 @@ check_multisample_target(GLuint dims, GLenum target,
 bool dsa)
  }


 -void
 +static void
  _mesa_texture_image_multisample(struct gl_context *ctx, GLuint dims,


You can drop the _mesa_ prefix on static functions.  Looks OK otherwise.
Reviewed-by: Brian Paul bri...@vmware.com



  struct gl_texture_object *texObj,
  GLenum target, GLsizei samples,
 diff --git a/src/mesa/main/teximage.h b/src/mesa/main/teximage.h
 index 1eebaa8..bf729da 100644
 --- a/src/mesa/main/teximage.h
 +++ b/src/mesa/main/teximage.h
 @@ -200,15 +200,6 @@ _mesa_copy_texture_sub_image(struct gl_context *ctx,
 GLuint dims,
   const char *caller);

  extern void
 -_mesa_texture_image_multisample(struct gl_context *ctx, GLuint dims,
 -struct gl_texture_object *texObj,
 -GLenum target, GLsizei samples,
 -GLint internalformat, GLsizei width,
 -GLsizei height, GLsizei depth,
 -GLboolean fixedsamplelocations,
 -GLboolean immutable, const char *func);
 -
 -extern void
  _mesa_texture_buffer_range(struct gl_context *ctx,
 struct gl_texture_object *texObj,
 GLenum internalFormat,
 --
 2.4.3

 ___
 mesa-dev mailing list
 mesa-dev@lists.freedesktop.org
 http://lists.freedesktop.org/mailman/listinfo/mesa-dev

___
mesa-dev mailing list
mesa-dev@lists.freedesktop.org
http://lists.freedesktop.org/mailman/listinfo/mesa-dev


Re: [Mesa-dev] [PATCH] gallium: add support for GLES texture float extensions (v2)

2015-08-13 Thread Roland Scheidegger
Makes sense.
Reviewed-by: Roland Scheidegger srol...@vmware.com


Am 12.08.2015 um 12:45 schrieb Marek Olšák:
 From: Marek Olšák marek.ol...@amd.com
 
 Bugzilla: https://bugs.freedesktop.org/show_bug.cgi?id=74329
 
 v2: add a CAP for half floats
 drivers should not expose the CAPs if they don't support the formats
 ---
  src/gallium/docs/source/screen.rst   | 6 ++
  src/gallium/drivers/freedreno/freedreno_screen.c | 2 ++
  src/gallium/drivers/i915/i915_screen.c   | 2 ++
  src/gallium/drivers/ilo/ilo_screen.c | 2 ++
  src/gallium/drivers/llvmpipe/lp_screen.c | 2 ++
  src/gallium/drivers/nouveau/nv30/nv30_screen.c   | 2 ++
  src/gallium/drivers/nouveau/nv50/nv50_screen.c   | 2 ++
  src/gallium/drivers/nouveau/nvc0/nvc0_screen.c   | 2 ++
  src/gallium/drivers/r300/r300_screen.c   | 2 ++
  src/gallium/drivers/r600/r600_pipe.c | 2 ++
  src/gallium/drivers/radeonsi/si_pipe.c   | 2 ++
  src/gallium/drivers/softpipe/sp_screen.c | 2 ++
  src/gallium/drivers/svga/svga_screen.c   | 2 ++
  src/gallium/drivers/vc4/vc4_screen.c | 2 ++
  src/gallium/include/pipe/p_defines.h | 2 ++
  src/mesa/state_tracker/st_extensions.c   | 8 
  16 files changed, 42 insertions(+)
 
 diff --git a/src/gallium/docs/source/screen.rst 
 b/src/gallium/docs/source/screen.rst
 index dbdccc7..c0b5eb3 100644
 --- a/src/gallium/docs/source/screen.rst
 +++ b/src/gallium/docs/source/screen.rst
 @@ -258,6 +258,12 @@ The integer capabilities:
How many per-patch outputs and inputs are supported between tessellation
control and tessellation evaluation shaders, not counting in TESSINNER and
TESSOUTER. The minimum allowed value for OpenGL is 30.
 +* ``PIPE_CAP_TEXTURE_FLOAT_LINEAR``: Whether the linear minification and
 +  magnification filters are supported with single-precision floating-point
 +  textures.
 +* ``PIPE_CAP_TEXTURE_HALF_FLOAT_LINEAR``: Whether the linear minification and
 +  magnification filters are supported with half-precision floating-point
 +  textures.
  
  
  .. _pipe_capf:
 diff --git a/src/gallium/drivers/freedreno/freedreno_screen.c 
 b/src/gallium/drivers/freedreno/freedreno_screen.c
 index 417d7c6..b267fd0 100644
 --- a/src/gallium/drivers/freedreno/freedreno_screen.c
 +++ b/src/gallium/drivers/freedreno/freedreno_screen.c
 @@ -222,6 +222,8 @@ fd_screen_get_param(struct pipe_screen *pscreen, enum 
 pipe_cap param)
   case PIPE_CAP_RESOURCE_FROM_USER_MEMORY:
   case PIPE_CAP_DEVICE_RESET_STATUS_QUERY:
   case PIPE_CAP_MAX_SHADER_PATCH_VARYINGS:
 + case PIPE_CAP_TEXTURE_FLOAT_LINEAR:
 + case PIPE_CAP_TEXTURE_HALF_FLOAT_LINEAR:
   return 0;
  
   case PIPE_CAP_MAX_VIEWPORTS:
 diff --git a/src/gallium/drivers/i915/i915_screen.c 
 b/src/gallium/drivers/i915/i915_screen.c
 index 6083687..7608ca5 100644
 --- a/src/gallium/drivers/i915/i915_screen.c
 +++ b/src/gallium/drivers/i915/i915_screen.c
 @@ -244,6 +244,8 @@ i915_get_param(struct pipe_screen *screen, enum pipe_cap 
 cap)
 case PIPE_CAP_RESOURCE_FROM_USER_MEMORY:
 case PIPE_CAP_DEVICE_RESET_STATUS_QUERY:
 case PIPE_CAP_MAX_SHADER_PATCH_VARYINGS:
 +   case PIPE_CAP_TEXTURE_FLOAT_LINEAR:
 +   case PIPE_CAP_TEXTURE_HALF_FLOAT_LINEAR:
return 0;
  
 case PIPE_CAP_MAX_DUAL_SOURCE_RENDER_TARGETS:
 diff --git a/src/gallium/drivers/ilo/ilo_screen.c 
 b/src/gallium/drivers/ilo/ilo_screen.c
 index 338643e..9f150bb 100644
 --- a/src/gallium/drivers/ilo/ilo_screen.c
 +++ b/src/gallium/drivers/ilo/ilo_screen.c
 @@ -451,6 +451,8 @@ ilo_get_param(struct pipe_screen *screen, enum pipe_cap 
 param)
 case PIPE_CAP_TEXTURE_GATHER_SM5:
return 0;
 case PIPE_CAP_BUFFER_MAP_PERSISTENT_COHERENT:
 +   case PIPE_CAP_TEXTURE_FLOAT_LINEAR:
 +   case PIPE_CAP_TEXTURE_HALF_FLOAT_LINEAR:
return true;
 case PIPE_CAP_FAKE_SW_MSAA:
 case PIPE_CAP_TEXTURE_QUERY_LOD:
 diff --git a/src/gallium/drivers/llvmpipe/lp_screen.c 
 b/src/gallium/drivers/llvmpipe/lp_screen.c
 index 1c6c82e..539bb44 100644
 --- a/src/gallium/drivers/llvmpipe/lp_screen.c
 +++ b/src/gallium/drivers/llvmpipe/lp_screen.c
 @@ -288,6 +288,8 @@ llvmpipe_get_param(struct pipe_screen *screen, enum 
 pipe_cap param)
 case PIPE_CAP_VERTEXID_NOBASE:
return 0;
 case PIPE_CAP_POLYGON_OFFSET_CLAMP:
 +   case PIPE_CAP_TEXTURE_FLOAT_LINEAR:
 +   case PIPE_CAP_TEXTURE_HALF_FLOAT_LINEAR:
return 1;
 case PIPE_CAP_MULTISAMPLE_Z_RESOLVE:
 case PIPE_CAP_RESOURCE_FROM_USER_MEMORY:
 diff --git a/src/gallium/drivers/nouveau/nv30/nv30_screen.c 
 b/src/gallium/drivers/nouveau/nv30/nv30_screen.c
 index 97cf058..73bcd5b 100644
 --- a/src/gallium/drivers/nouveau/nv30/nv30_screen.c
 +++ b/src/gallium/drivers/nouveau/nv30/nv30_screen.c
 @@ -164,6 +164,8 @@ nv30_screen_get_param(struct pipe_screen *pscreen, enum 
 pipe_cap param)
 case PIPE_CAP_RESOURCE_FROM_USER_MEMORY:
 case 

Re: [Mesa-dev] [Mesa-stable] [PATCH] radeonsi: add new OLAND pci id

2015-08-13 Thread Emil Velikov
Hi Alex,

On 10 August 2015 at 20:36, Alex Deucher alexdeuc...@gmail.com wrote:
 Signed-off-by: Alex Deucher alexander.deuc...@amd.com
 Cc: mesa-sta...@lists.freedesktop.org
 ---
  include/pci_ids/radeonsi_pci_ids.h | 1 +
  1 file changed, 1 insertion(+)

 diff --git a/include/pci_ids/radeonsi_pci_ids.h 
 b/include/pci_ids/radeonsi_pci_ids.h
 index c01ee20..52eada1 100644
 --- a/include/pci_ids/radeonsi_pci_ids.h
 +++ b/include/pci_ids/radeonsi_pci_ids.h
 @@ -63,6 +63,7 @@ CHIPSET(0x6608, OLAND_6608, OLAND)
  CHIPSET(0x6610, OLAND_6610, OLAND)
  CHIPSET(0x6611, OLAND_6611, OLAND)
  CHIPSET(0x6613, OLAND_6613, OLAND)
 +CHIPSET(0x6617, OLAND_6617, OLAND)
Has there been any ideas/plans on getting this information
consolidated in a single place ?

It feels a bit dirty having the same information in four places -
kernel, libdrm, ddx, mesa.

Thanks
Emil
___
mesa-dev mailing list
mesa-dev@lists.freedesktop.org
http://lists.freedesktop.org/mailman/listinfo/mesa-dev


Re: [Mesa-dev] [PATCH 1/5] utils: automake: remove uncommon $()

2015-08-13 Thread Matt Turner
On Thu, Aug 13, 2015 at 4:31 AM, Emil Velikov emil.l.veli...@gmail.com wrote:
 On 7 August 2015 at 19:22, Matt Turner matts...@gmail.com wrote:
 On Fri, Aug 7, 2015 at 11:05 AM, Emil Velikov emil.l.veli...@gmail.com 
 wrote:
 On 21 July 2015 at 13:12, Emil Velikov emil.l.veli...@gmail.com wrote:
 On 20/07/15 21:25, Chad Versace wrote:
 On Fri 17 Jul 2015, Emil Velikov wrote:
 On 17 July 2015 at 19:11, Ilia Mirkin imir...@alum.mit.edu wrote:
 On Fri, Jul 17, 2015 at 2:11 PM, Eric Anholt e...@anholt.net wrote:
 Matt Turner matts...@gmail.com writes:

 On Fri, Jul 17, 2015 at 10:17 AM, Emil Velikov 
 emil.l.veli...@gmail.com wrote:
 Cc: Eric Anholt e...@anholt.net
 Signed-off-by: Emil Velikov emil.l.veli...@gmail.com
 ---
  src/util/tests/hash_table/Makefile.am | 3 +--
  1 file changed, 1 insertion(+), 2 deletions(-)

 diff --git a/src/util/tests/hash_table/Makefile.am 
 b/src/util/tests/hash_table/Makefile.am
 index 04a77e3..0c99e7b 100644
 --- a/src/util/tests/hash_table/Makefile.am
 +++ b/src/util/tests/hash_table/Makefile.am
 @@ -38,7 +38,6 @@ TESTS = \
 null_destroy \
 random_entry \
 remove_null \
 -   replacement \
 -   $()
 +   replacement

 To get the benefit of $() without some unknown incompatibility, pixman
 uses $(NULL) which of course relies on not having a variable named
 NULL.

 I might suggest that instead of removing them, but I'm not much
 opposed to removing them either.

 I do really like having a terminator on these lists.  I find that
 without them, I'll end up copy-and-pasting the wrong thing and missing
 the trailing backslash on a line.

 Also makes diffs easier to read since you don't have spurious changes
 which just add a \ .

 I second Anholt. I prefer the sentinel too, but don't feel too strongly
 about it.

 I find that a sentinel helps me avoid making mistakes when adding new
 list members or when sorting the lists in $EDITOR.

 In case it's not (too) obvious I'm nuking these for consistency sake, as
 there are five of these in over 80 makefiles. If people like/prefer them
 can we have a volunteer that adds them everywhere ?

 Can we have some volunteers, please ?

 I don't think we should require consistency here.

 Genuine question - what does this case makes it different from any other ?

I think your question is why shouldn't we require consistency?

There are many things in the code base that don't match with our
current style. We fix them when we modify the code, but otherwise
don't force changes just for the sake of style. For instance, we don't
use tabs for indentation but we haven't removed all the tabs either. I
think this situation is the same.

 We do config/build check before pushing which easily catches the
 problem of missing \. Do we not ?

That's only partially the point of $(NULL). It's purpose is to avoid
mistakes, but it also allows you to sort the list very easily, and
using it means that the tail of the list isn't changed when new items
are appended (reduces git blame noise).
___
mesa-dev mailing list
mesa-dev@lists.freedesktop.org
http://lists.freedesktop.org/mailman/listinfo/mesa-dev


[Mesa-dev] [PATCH v3 3/5] nir: convert the glsl intrinsic image_size to nir_intrinsic_image_size

2015-08-13 Thread Martin Peres
v2, review from Francisco Jerez:
 - make the destination variable as large as what the nir instrinsic
   defines (4) instead of the size of the return variable of glsl. This
   is still safe for the already existing code because all the intrinsics
   affected returned the same amount of components as expected by glsl IR.
   In the case of image_size, it is not possible to do so because the
   returned number of component depends on the image type and this case
   is not well handled by nir.

Signed-off-by: Martin Peres martin.pe...@linux.intel.com
---
 src/glsl/nir/glsl_to_nir.cpp  | 21 +++--
 src/glsl/nir/nir_intrinsics.h |  2 ++
 2 files changed, 17 insertions(+), 6 deletions(-)

diff --git a/src/glsl/nir/glsl_to_nir.cpp b/src/glsl/nir/glsl_to_nir.cpp
index 77327b6..3063243 100644
--- a/src/glsl/nir/glsl_to_nir.cpp
+++ b/src/glsl/nir/glsl_to_nir.cpp
@@ -641,6 +641,8 @@ nir_visitor::visit(ir_call *ir)
  op = nir_intrinsic_image_atomic_comp_swap;
   } else if (strcmp(ir-callee_name(), __intrinsic_memory_barrier) == 0) 
{
  op = nir_intrinsic_memory_barrier;
+  } else if (strcmp(ir-callee_name(), __intrinsic_image_size) == 0) {
+ op = nir_intrinsic_image_size;
   } else {
  unreachable(not reached);
   }
@@ -666,7 +668,8 @@ nir_visitor::visit(ir_call *ir)
   case nir_intrinsic_image_atomic_or:
   case nir_intrinsic_image_atomic_xor:
   case nir_intrinsic_image_atomic_exchange:
-  case nir_intrinsic_image_atomic_comp_swap: {
+  case nir_intrinsic_image_atomic_comp_swap:
+  case nir_intrinsic_image_size: {
  nir_ssa_undef_instr *instr_undef =
 nir_ssa_undef_instr_create(shader, 1);
  nir_instr_insert_after_cf_list(this-cf_node_list,
@@ -681,6 +684,17 @@ nir_visitor::visit(ir_call *ir)
  instr-variables[0] = evaluate_deref(instr-instr, image);
  param = param-get_next();
 
+ /* Set the intrinsic destination. */
+ if (ir-return_deref) {
+const nir_intrinsic_info *info;
+info = nir_intrinsic_infos[instr-intrinsic];
+nir_ssa_dest_init(instr-instr, instr-dest,
+  info-dest_components, NULL);
+ }
+
+ if (op == nir_intrinsic_image_size)
+break;
+
  /* Set the address argument, extending the coordinate vector to four
   * components.
   */
@@ -721,11 +735,6 @@ nir_visitor::visit(ir_call *ir)
 instr-src[3] = evaluate_rvalue((ir_dereference *)param);
 param = param-get_next();
  }
-
- /* Set the intrinsic destination. */
- if (ir-return_deref)
-nir_ssa_dest_init(instr-instr, instr-dest,
-  ir-return_deref-type-vector_elements, NULL);
  break;
   }
   case nir_intrinsic_memory_barrier:
diff --git a/src/glsl/nir/nir_intrinsics.h b/src/glsl/nir/nir_intrinsics.h
index bc6e6b8..6c7a61a 100644
--- a/src/glsl/nir/nir_intrinsics.h
+++ b/src/glsl/nir/nir_intrinsics.h
@@ -123,6 +123,8 @@ INTRINSIC(image_atomic_or, 3, ARR(4, 1, 1), true, 1, 1, 0, 
0)
 INTRINSIC(image_atomic_xor, 3, ARR(4, 1, 1), true, 1, 1, 0, 0)
 INTRINSIC(image_atomic_exchange, 3, ARR(4, 1, 1), true, 1, 1, 0, 0)
 INTRINSIC(image_atomic_comp_swap, 4, ARR(4, 1, 1, 1), true, 1, 1, 0, 0)
+INTRINSIC(image_size, 0, ARR(), true, 4, 1, 0,
+  NIR_INTRINSIC_CAN_ELIMINATE | NIR_INTRINSIC_CAN_REORDER)
 
 #define SYSTEM_VALUE(name, components) \
INTRINSIC(load_##name, 0, ARR(), true, components, 0, 0, \
-- 
2.5.0

___
mesa-dev mailing list
mesa-dev@lists.freedesktop.org
http://lists.freedesktop.org/mailman/listinfo/mesa-dev


Re: [Mesa-dev] [PATCH v3 4/5] i965: handle nir_intrinsic_image_size

2015-08-13 Thread Ilia Mirkin
On Thu, Aug 13, 2015 at 1:00 PM, Martin Peres
martin.pe...@linux.intel.com wrote:
 v2, Review from Francisco Jerez:
 - avoid the camelCase for the booleans
 - init the booleans using the sampler type
 - force the initialization of all the components of the output register

 Signed-off-by: Martin Peres martin.pe...@linux.intel.com
 ---
  src/mesa/drivers/dri/i965/brw_fs_nir.cpp | 48 
 
  1 file changed, 48 insertions(+)

 diff --git a/src/mesa/drivers/dri/i965/brw_fs_nir.cpp 
 b/src/mesa/drivers/dri/i965/brw_fs_nir.cpp
 index ce4153d..cc0a5a6 100644
 --- a/src/mesa/drivers/dri/i965/brw_fs_nir.cpp
 +++ b/src/mesa/drivers/dri/i965/brw_fs_nir.cpp
 @@ -1406,6 +1406,54 @@ fs_visitor::nir_emit_intrinsic(const fs_builder bld, 
 nir_intrinsic_instr *instr
break;
 }

 +   case nir_intrinsic_image_size: {
 +  /* Get the referenced image variable and type. */
 +  const nir_variable *var = instr-variables[0]-var;
 +  const glsl_type *type = var-type-without_array();
 +  const brw_reg_type base_type = get_image_base_type(type);
 +
 +  /* Get the size of the image. */
 +  const fs_reg image = get_nir_image_deref(instr-variables[0]);
 +  const fs_reg size = offset(image, bld, BRW_IMAGE_PARAM_SIZE_OFFSET);
 +
 +  /*
 +   * For 1DArray image types, the array index is stored in the Z 
 component.
 +   * Fix this by swizzling the Z component to the Y component.
 +   */
 +  const bool is_1d_array_image =
 +  (type-sampler_dimensionality == GLSL_SAMPLER_DIM_1D 
 +   type-sampler_array);
 +
 +  /*
 +   * For CubeMapArray images, we should count the number of cubes instead

I think you're trying to use the actual glsl image type names? In that
case it should be CubeArray, not CubeMapArray. (It's imageCubeArray.)

 +   * of the number of faces. Fix it by dividing the (Z component) by 6.
 +   */
 +  const bool is_cube_map_array_image =
 +  (type-sampler_dimensionality == GLSL_SAMPLER_DIM_CUBE 
 +   type-sampler_array);
 +
 +  /* Copy all the components. */
 +  const nir_intrinsic_info *info = 
 nir_intrinsic_infos[instr-intrinsic];
 +  for (int c = 0; c  info-dest_components; ++c) {
 + if (c  type-coordinate_components()) {
 + bld.MOV(offset(retype(dest, base_type), bld, c),
 + fs_reg(1));
 + } else if (c == 1  is_1d_array_image) {
 +bld.MOV(offset(retype(dest, base_type), bld, c),
 +offset(size, bld, 2));
 + } else if (c == 2  is_cube_map_array_image) {
 +bld.emit(SHADER_OPCODE_INT_QUOTIENT,
 + offset(retype(dest, base_type), bld, c),
 + offset(size, bld, c), fs_reg(6));
 + } else {
 +bld.MOV(offset(retype(dest, base_type), bld, c),
 +offset(size, bld, c));
 + }
 +   }
 +
 +  break;
 +   }
 +
 case nir_intrinsic_load_front_face:
bld.MOV(retype(dest, BRW_REGISTER_TYPE_D),
*emit_frontfacing_interpolation());
 --
 2.5.0

 ___
 mesa-dev mailing list
 mesa-dev@lists.freedesktop.org
 http://lists.freedesktop.org/mailman/listinfo/mesa-dev
___
mesa-dev mailing list
mesa-dev@lists.freedesktop.org
http://lists.freedesktop.org/mailman/listinfo/mesa-dev


[Mesa-dev] [PATCH v3 4/5] i965: handle nir_intrinsic_image_size

2015-08-13 Thread Martin Peres
v2, Review from Francisco Jerez:
- avoid the camelCase for the booleans
- init the booleans using the sampler type
- force the initialization of all the components of the output register

Signed-off-by: Martin Peres martin.pe...@linux.intel.com
---
 src/mesa/drivers/dri/i965/brw_fs_nir.cpp | 48 
 1 file changed, 48 insertions(+)

diff --git a/src/mesa/drivers/dri/i965/brw_fs_nir.cpp 
b/src/mesa/drivers/dri/i965/brw_fs_nir.cpp
index ce4153d..cc0a5a6 100644
--- a/src/mesa/drivers/dri/i965/brw_fs_nir.cpp
+++ b/src/mesa/drivers/dri/i965/brw_fs_nir.cpp
@@ -1406,6 +1406,54 @@ fs_visitor::nir_emit_intrinsic(const fs_builder bld, 
nir_intrinsic_instr *instr
   break;
}
 
+   case nir_intrinsic_image_size: {
+  /* Get the referenced image variable and type. */
+  const nir_variable *var = instr-variables[0]-var;
+  const glsl_type *type = var-type-without_array();
+  const brw_reg_type base_type = get_image_base_type(type);
+
+  /* Get the size of the image. */
+  const fs_reg image = get_nir_image_deref(instr-variables[0]);
+  const fs_reg size = offset(image, bld, BRW_IMAGE_PARAM_SIZE_OFFSET);
+
+  /*
+   * For 1DArray image types, the array index is stored in the Z component.
+   * Fix this by swizzling the Z component to the Y component.
+   */
+  const bool is_1d_array_image =
+  (type-sampler_dimensionality == GLSL_SAMPLER_DIM_1D 
+   type-sampler_array);
+
+  /*
+   * For CubeMapArray images, we should count the number of cubes instead
+   * of the number of faces. Fix it by dividing the (Z component) by 6.
+   */
+  const bool is_cube_map_array_image =
+  (type-sampler_dimensionality == GLSL_SAMPLER_DIM_CUBE 
+   type-sampler_array);
+
+  /* Copy all the components. */
+  const nir_intrinsic_info *info = nir_intrinsic_infos[instr-intrinsic];
+  for (int c = 0; c  info-dest_components; ++c) {
+ if (c  type-coordinate_components()) {
+ bld.MOV(offset(retype(dest, base_type), bld, c),
+ fs_reg(1));
+ } else if (c == 1  is_1d_array_image) {
+bld.MOV(offset(retype(dest, base_type), bld, c),
+offset(size, bld, 2));
+ } else if (c == 2  is_cube_map_array_image) {
+bld.emit(SHADER_OPCODE_INT_QUOTIENT,
+ offset(retype(dest, base_type), bld, c),
+ offset(size, bld, c), fs_reg(6));
+ } else {
+bld.MOV(offset(retype(dest, base_type), bld, c),
+offset(size, bld, c));
+ }
+   }
+
+  break;
+   }
+
case nir_intrinsic_load_front_face:
   bld.MOV(retype(dest, BRW_REGISTER_TYPE_D),
   *emit_frontfacing_interpolation());
-- 
2.5.0

___
mesa-dev mailing list
mesa-dev@lists.freedesktop.org
http://lists.freedesktop.org/mailman/listinfo/mesa-dev


Re: [Mesa-dev] [PATCH] r600g: Fix handling of TGSI_OPCODE_ARR with SB

2015-08-13 Thread Nick Sarnie
Tested-by: Nick Sarnie commendsar...@gmail.com

On Thu, Aug 13, 2015 at 2:49 PM, Nick Sarnie commendsar...@gmail.com
wrote:

 Tested-by: Nick Sarnie commendsar...@gmail.com

 On Thu, Aug 13, 2015 at 2:30 PM, Glenn Kennard glenn.kenn...@gmail.com
 wrote:

 FLT_TO_INT goes in the vector pipes on evergreen/NI,
 not the trans unit as on earlier chips.

 Signed-off-by: Glenn Kennard glenn.kenn...@gmail.com
 ---
 Fixes issue found on nine: https://github.com/iXit/Mesa-3D/issues/119

  src/gallium/drivers/r600/r600_isa.h | 2 +-
  1 file changed, 1 insertion(+), 1 deletion(-)

 diff --git a/src/gallium/drivers/r600/r600_isa.h
 b/src/gallium/drivers/r600/r600_isa.h
 index 381f06d..fdbe1c0 100644
 --- a/src/gallium/drivers/r600/r600_isa.h
 +++ b/src/gallium/drivers/r600/r600_isa.h
 @@ -262,7 +262,7 @@ static const struct alu_op_info alu_op_table[] = {
 {PRED_SETNE_PUSH_INT,   2, { 0x4D, 0x4D },{  AF_VS,
 AF_VS, AF_VS, AF_VS},  AF_PRED_PUSH | AF_CC_NE | AF_INT_CMP },
 {PRED_SETLT_PUSH_INT,   2, { 0x4E, 0x4E },{  AF_VS,
 AF_VS, AF_VS, AF_VS},  AF_PRED_PUSH | AF_CC_LT | AF_INT_CMP },
 {PRED_SETLE_PUSH_INT,   2, { 0x4F, 0x4F },{  AF_VS,
 AF_VS, AF_VS, AF_VS},  AF_PRED_PUSH | AF_CC_LE | AF_INT_CMP },
 -   {FLT_TO_INT,1, { 0x6B, 0x50 },{
  AF_S,  AF_S, AF_VS, AF_VS},  AF_INT_DST | AF_CVT },
 +   {FLT_TO_INT,1, { 0x6B, 0x50 },{
  AF_S,  AF_S,  AF_V,  AF_V},  AF_INT_DST | AF_CVT },
 {BFREV_INT, 1, {   -1, 0x51 },{
 0, 0, AF_VS, AF_VS},  AF_INT_DST },
 {ADDC_UINT, 2, {   -1, 0x52 },{
 0, 0, AF_VS, AF_VS},  AF_UINT_DST },
 {SUBB_UINT, 2, {   -1, 0x53 },{
 0, 0, AF_VS, AF_VS},  AF_UINT_DST },
 --
 1.9.1

 ___
 mesa-dev mailing list
 mesa-dev@lists.freedesktop.org
 http://lists.freedesktop.org/mailman/listinfo/mesa-dev



___
mesa-dev mailing list
mesa-dev@lists.freedesktop.org
http://lists.freedesktop.org/mailman/listinfo/mesa-dev


Re: [Mesa-dev] [PATCH 2/2] egl: improve attribute checking for eglCreateContext

2015-08-13 Thread Emil Velikov
On 12 August 2015 at 18:53, Matt Turner matts...@gmail.com wrote:
 On Wed, Aug 12, 2015 at 8:36 AM, Frank Binns frank.bi...@imgtec.com wrote:
 The EGL 1.4 spec states for eglCreateContext:

 attribute EGL_CONTEXT_CLIENT_VERSION is only valid when the current
  rendering API is EGL_OPENGL_ES_API

 Additionally, if the EGL_KHR_create_context EGL extension is supported
 (this is mandatory in EGL 1.5) then the EGL_CONTEXT_MAJOR_VERSION_KHR,
 which is an alias for EGL_CONTEXT_CLIENT_VERSION, and
 EGL_CONTEXT_MINOR_VERSION_KHR attributes are also accepted by
 eglCreateContext with the extension spec stating:

 The values for attributes EGL_CONTEXT_MAJOR_VERSION_KHR and
  EGL_CONTEXT_MINOR_VERSION_KHR specify the requested client API
  version. They are only meaningful for OpenGL and OpenGL ES
  contexts, and specifying them for other types of contexts will
  generate an error.

 Add the necessary checks against the extension and rendering APIs when
 validating these attributes as part of eglCreateContext.

 Signed-off-by: Frank Binns frank.bi...@imgtec.com
 ---
  src/egl/main/eglcontext.c | 30 +-
  1 file changed, 29 insertions(+), 1 deletion(-)

 diff --git a/src/egl/main/eglcontext.c b/src/egl/main/eglcontext.c
 index e767f4b..01781a9 100644
 --- a/src/egl/main/eglcontext.c
 +++ b/src/egl/main/eglcontext.c
 @@ -101,11 +101,39 @@ _eglParseContextAttribList(_EGLContext *ctx, 
 _EGLDisplay *dpy,

switch (attr) {
case EGL_CONTEXT_CLIENT_VERSION:
 + /* The EGL 1.4 spec says:

 I'd put a  new line here.

 +  * attribute EGL_CONTEXT_CLIENT_VERSION is only valid when the
 +  *  current rendering API is EGL_OPENGL_ES_API
 +  *
 +  * The EGL_KHR_create_context spec says:

 here

 +  * EGL_CONTEXT_MAJOR_VERSION_KHR   0x3098
 +  *  (this token is an alias for EGL_CONTEXT_CLIENT_VERSION)
 +  *
 +  * The values for attributes EGL_CONTEXT_MAJOR_VERSION_KHR and
 +  *  EGL_CONTEXT_MINOR_VERSION_KHR specify the requested client 
 API
 +  *  version. They are only meaningful for OpenGL and OpenGL ES
 +  *  contexts, and specifying them for other types of contexts 
 will
 +  *  generate an error.
 +  */
 + if ((api != EGL_OPENGL_ES_API 
 + (!dpy-Extensions.KHR_create_context || api != 
 EGL_OPENGL_API))) {
 +   err = EGL_BAD_ATTRIBUTE;
 +   break;
 + }
 +
   ctx-ClientMajorVersion = val;
   break;

case EGL_CONTEXT_MINOR_VERSION_KHR:
 - if (!dpy-Extensions.KHR_create_context) {
 + /* The EGL_KHR_create_context spec says:

 and here.

 +  * The values for attributes EGL_CONTEXT_MAJOR_VERSION_KHR and
 +  *  EGL_CONTEXT_MINOR_VERSION_KHR specify the requested client 
 API
 +  *  version. They are only meaningful for OpenGL and OpenGL ES
 +  *  contexts, and specifying them for other types of contexts 
 will
 +  *  generate an error.
 +  */
 + if (!dpy-Extensions.KHR_create_context ||
 + (api != EGL_OPENGL_ES_API  api != EGL_OPENGL_API)) {
  err = EGL_BAD_ATTRIBUTE;
  break;
   }
 --

 But I can do that myself before pushing.

 Reviewed-by: Matt Turner matts...@gmail.com
I've addressed the new line comments and pushed all this (and earlier)
set to master.

Thanks Frank !

-Emil
___
mesa-dev mailing list
mesa-dev@lists.freedesktop.org
http://lists.freedesktop.org/mailman/listinfo/mesa-dev


[Mesa-dev] [PATCH v3 2/5] glsl: add support for the imageSize builtin

2015-08-13 Thread Martin Peres
The code is heavily inspired from Francisco Jerez's code supporting the
image_load_store extension.

Backends willing to support this builtin should handle
__intrinsic_image_size.

v2: Based on the review of Ilia Mirkin
- Enable the extension for GLES 3.1
- Fix indentation
- Fix the return type (float to int, number of components for CubeImages)
- Add a warning related to GLES 3.1

v3: Based on the review of Francisco Jerez
- Refactor the code to share both add_image_function and _image with the other
  image-related functions

Signed-off-by: Martin Peres martin.pe...@linux.intel.com
---
 src/glsl/builtin_functions.cpp | 109 +++--
 1 file changed, 93 insertions(+), 16 deletions(-)

diff --git a/src/glsl/builtin_functions.cpp b/src/glsl/builtin_functions.cpp
index 2175c66..5d0a825 100644
--- a/src/glsl/builtin_functions.cpp
+++ b/src/glsl/builtin_functions.cpp
@@ -399,6 +399,13 @@ shader_image_load_store(const _mesa_glsl_parse_state 
*state)
 }
 
 static bool
+shader_image_size(const _mesa_glsl_parse_state *state)
+{
+   return (state-is_version(430, 310) ||
+   state-ARB_shader_image_size_enable);
+}
+
+static bool
 gs_streams(const _mesa_glsl_parse_state *state)
 {
return gpu_shader5(state)  gs_only(state);
@@ -492,6 +499,11 @@ private:
/** Create a new function and add the given signatures. */
void add_function(const char *name, ...);
 
+   typedef ir_function_signature 
*(builtin_builder::*image_prototype_ctr)(const glsl_type *image_type,
+  
const char *intrinsic_name,
+  
unsigned num_arguments,
+  
unsigned flags);
+
enum image_function_flags {
   IMAGE_FUNCTION_EMIT_STUB = (1  0),
   IMAGE_FUNCTION_RETURNS_VOID = (1  1),
@@ -507,6 +519,7 @@ private:
 */
void add_image_function(const char *name,
const char *intrinsic_name,
+   image_prototype_ctr prototype,
unsigned num_arguments,
unsigned flags);
 
@@ -708,7 +721,12 @@ private:
const char *intrinsic_name,
unsigned num_arguments,
unsigned flags);
-   ir_function_signature *_image(const glsl_type *image_type,
+   ir_function_signature *_image_size_prototype(const glsl_type *image_type,
+   const char *intrinsic_name,
+   unsigned num_arguments,
+   unsigned flags);
+   ir_function_signature *_image(image_prototype_ctr prototype,
+ const glsl_type *image_type,
  const char *intrinsic_name,
  unsigned num_arguments,
  unsigned flags);
@@ -2552,6 +2570,7 @@ builtin_builder::add_function(const char *name, ...)
 void
 builtin_builder::add_image_function(const char *name,
 const char *intrinsic_name,
+image_prototype_ctr prototype,
 unsigned num_arguments,
 unsigned flags)
 {
@@ -2590,12 +2609,13 @@ builtin_builder::add_image_function(const char *name,
   glsl_type::uimage2DMS_type,
   glsl_type::uimage2DMSArray_type
};
+
ir_function *f = new(mem_ctx) ir_function(name);
 
for (unsigned i = 0; i  ARRAY_SIZE(types); ++i) {
   if (types[i]-sampler_type != GLSL_TYPE_FLOAT ||
   (flags  IMAGE_FUNCTION_SUPPORTS_FLOAT_DATA_TYPE))
- f-add_signature(_image(types[i], intrinsic_name,
+ f-add_signature(_image(prototype, types[i], intrinsic_name,
  num_arguments, flags));
}
 
@@ -2608,43 +2628,57 @@ builtin_builder::add_image_functions(bool glsl)
const unsigned flags = (glsl ? IMAGE_FUNCTION_EMIT_STUB : 0);
 
add_image_function(glsl ? imageLoad : __intrinsic_image_load,
-  __intrinsic_image_load, 0,
-  (flags | IMAGE_FUNCTION_HAS_VECTOR_DATA_TYPE |
+   __intrinsic_image_load,
+   builtin_builder::_image_prototype, 0,
+   (flags | IMAGE_FUNCTION_HAS_VECTOR_DATA_TYPE |
IMAGE_FUNCTION_SUPPORTS_FLOAT_DATA_TYPE |
IMAGE_FUNCTION_READ_ONLY));
 
add_image_function(glsl ? imageStore : __intrinsic_image_store,
-  __intrinsic_image_store, 1,
+  __intrinsic_image_store,
+  builtin_builder::_image_prototype, 1,
   (flags | IMAGE_FUNCTION_RETURNS_VOID |
  

[Mesa-dev] [PATCH] r600g: Fix handling of TGSI_OPCODE_ARR with SB

2015-08-13 Thread Glenn Kennard
FLT_TO_INT goes in the vector pipes on evergreen/NI,
not the trans unit as on earlier chips.

Signed-off-by: Glenn Kennard glenn.kenn...@gmail.com
---
Fixes issue found on nine: https://github.com/iXit/Mesa-3D/issues/119

 src/gallium/drivers/r600/r600_isa.h | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/src/gallium/drivers/r600/r600_isa.h 
b/src/gallium/drivers/r600/r600_isa.h
index 381f06d..fdbe1c0 100644
--- a/src/gallium/drivers/r600/r600_isa.h
+++ b/src/gallium/drivers/r600/r600_isa.h
@@ -262,7 +262,7 @@ static const struct alu_op_info alu_op_table[] = {
{PRED_SETNE_PUSH_INT,   2, { 0x4D, 0x4D },{  AF_VS, 
AF_VS, AF_VS, AF_VS},  AF_PRED_PUSH | AF_CC_NE | AF_INT_CMP },
{PRED_SETLT_PUSH_INT,   2, { 0x4E, 0x4E },{  AF_VS, 
AF_VS, AF_VS, AF_VS},  AF_PRED_PUSH | AF_CC_LT | AF_INT_CMP },
{PRED_SETLE_PUSH_INT,   2, { 0x4F, 0x4F },{  AF_VS, 
AF_VS, AF_VS, AF_VS},  AF_PRED_PUSH | AF_CC_LE | AF_INT_CMP },
-   {FLT_TO_INT,1, { 0x6B, 0x50 },{   AF_S,  
AF_S, AF_VS, AF_VS},  AF_INT_DST | AF_CVT },
+   {FLT_TO_INT,1, { 0x6B, 0x50 },{   AF_S,  
AF_S,  AF_V,  AF_V},  AF_INT_DST | AF_CVT },
{BFREV_INT, 1, {   -1, 0x51 },{  0, 
0, AF_VS, AF_VS},  AF_INT_DST },
{ADDC_UINT, 2, {   -1, 0x52 },{  0, 
0, AF_VS, AF_VS},  AF_UINT_DST },
{SUBB_UINT, 2, {   -1, 0x53 },{  0, 
0, AF_VS, AF_VS},  AF_UINT_DST },
-- 
1.9.1

___
mesa-dev mailing list
mesa-dev@lists.freedesktop.org
http://lists.freedesktop.org/mailman/listinfo/mesa-dev


Re: [Mesa-dev] [Mesa-stable] [PATCH] radeonsi: add new OLAND pci id

2015-08-13 Thread Alex Deucher
On Thu, Aug 13, 2015 at 12:06 PM, Emil Velikov emil.l.veli...@gmail.com wrote:
 On 13 August 2015 at 16:42, Alex Deucher alexdeuc...@gmail.com wrote:
 On Thu, Aug 13, 2015 at 11:11 AM, Emil Velikov emil.l.veli...@gmail.com 
 wrote:
 Hi Alex,

 On 10 August 2015 at 20:36, Alex Deucher alexdeuc...@gmail.com wrote:
 Signed-off-by: Alex Deucher alexander.deuc...@amd.com
 Cc: mesa-sta...@lists.freedesktop.org
 ---
  include/pci_ids/radeonsi_pci_ids.h | 1 +
  1 file changed, 1 insertion(+)

 diff --git a/include/pci_ids/radeonsi_pci_ids.h 
 b/include/pci_ids/radeonsi_pci_ids.h
 index c01ee20..52eada1 100644
 --- a/include/pci_ids/radeonsi_pci_ids.h
 +++ b/include/pci_ids/radeonsi_pci_ids.h
 @@ -63,6 +63,7 @@ CHIPSET(0x6608, OLAND_6608, OLAND)
  CHIPSET(0x6610, OLAND_6610, OLAND)
  CHIPSET(0x6611, OLAND_6611, OLAND)
  CHIPSET(0x6613, OLAND_6613, OLAND)
 +CHIPSET(0x6617, OLAND_6617, OLAND)
 Has there been any ideas/plans on getting this information
 consolidated in a single place ?

 It feels a bit dirty having the same information in four places -
 kernel, libdrm, ddx, mesa.

 There's not really a good solution that I know of due to the way X
 works.
 If I have to guess, obtaining OLAND via DRM_IOCTL_RADEON_INFO won't be
 impacted by (nor have any impact on) how X works. Shouldn't this just
 work or there is something subtly off with the idea ? Can you
 elaborate what part of X might be an obstacle ?

IIRC, X decides what driver to load based on the pci ids they support
rather than letting drivers claim their devices.  It's remnant of the
UMS days.

Alex


 Using xf86-video-modesetting saves one at least. And for
 amdgpu, we merged the surface manager into mesa rather than having it
 on libdrm since we always use glamor so we didn't need access to it in
 the ddx to support EXA.

 True. Even if one day you want/have to do EXA xf86-video-amdgpu one
 can always re-factor it out into libdrm_amdgpu. So the surface manager
 is a win-win atm :)

 Thanks
 Emil
___
mesa-dev mailing list
mesa-dev@lists.freedesktop.org
http://lists.freedesktop.org/mailman/listinfo/mesa-dev


[Mesa-dev] [PATCH 3/7] i965/gen9: Handle the GL_TEXTURE_{1D, 1D_ARRAY} targets inside switch

2015-08-13 Thread Anuj Phogat
Signed-off-by: Anuj Phogat anuj.pho...@gmail.com
---
 src/mesa/drivers/dri/i965/brw_tex_layout.c | 8 
 1 file changed, 4 insertions(+), 4 deletions(-)

diff --git a/src/mesa/drivers/dri/i965/brw_tex_layout.c 
b/src/mesa/drivers/dri/i965/brw_tex_layout.c
index edd7518..6ac4024 100644
--- a/src/mesa/drivers/dri/i965/brw_tex_layout.c
+++ b/src/mesa/drivers/dri/i965/brw_tex_layout.c
@@ -194,9 +194,7 @@ tr_mode_vertical_texture_alignment(const struct brw_context 
*brw,
const unsigned align_3d_ys[] = {32, 32, 32, 16, 16};
int i = 0;
 
-   assert(brw-gen = 9 
-  mt-target != GL_TEXTURE_1D 
-  mt-target != GL_TEXTURE_1D_ARRAY);
+   assert(brw-gen = 9);
 
/* Alignment computations below assume bpp = 8 and a power of 2. */
assert (bpp = 8  bpp = 128  _mesa_is_pow_two(bpp)) ;
@@ -216,8 +214,10 @@ tr_mode_vertical_texture_alignment(const struct 
brw_context *brw,
   align_yf = align_3d_yf;
   align_ys = align_3d_ys;
   break;
+   case GL_TEXTURE_1D:
+   case GL_TEXTURE_1D_ARRAY:
default:
-  unreachable(not reached);
+  unreachable(Unexpected miptree target);
}
 
/* Compute array index. */
-- 
2.4.3

___
mesa-dev mailing list
mesa-dev@lists.freedesktop.org
http://lists.freedesktop.org/mailman/listinfo/mesa-dev


[Mesa-dev] [PATCH 4/7] i965/gen9: Reuse YF alignment tables in tr_mode_..._texture_alignment()

2015-08-13 Thread Anuj Phogat
Patch just does some refactoring to make the code look better. No
functional changes in here.

Cc: Ben Widawsky b...@bwidawsk.net
Signed-off-by: Anuj Phogat anuj.pho...@gmail.com
---
 src/mesa/drivers/dri/i965/brw_tex_layout.c | 46 ++
 1 file changed, 22 insertions(+), 24 deletions(-)

diff --git a/src/mesa/drivers/dri/i965/brw_tex_layout.c 
b/src/mesa/drivers/dri/i965/brw_tex_layout.c
index 6ac4024..53f7698 100644
--- a/src/mesa/drivers/dri/i965/brw_tex_layout.c
+++ b/src/mesa/drivers/dri/i965/brw_tex_layout.c
@@ -43,23 +43,19 @@ static unsigned int
 tr_mode_horizontal_texture_alignment(const struct brw_context *brw,
  const struct intel_mipmap_tree *mt)
 {
-   const unsigned *align_yf, *align_ys;
+   const unsigned *align_yf;
const unsigned bpp = _mesa_get_format_bytes(mt-format) * 8;
-   unsigned ret_align, divisor;
+   unsigned ret_align, divisor, multiplier;
 
-   /* Horizontal alignment tables for TRMODE_{YF,YS}. Value in below
-* tables specifies the horizontal alignment requirement in elements
-* for the surface. An element is defined as a pixel in uncompressed
-* surface formats, and as a compression block in compressed surface
-* formats. For MSFMT_DEPTH_STENCIL type multisampled surfaces, an
+   /* Values in below tables specifiy the horizontal alignment requirement
+* in elements for TRMODE_YF surface. An element is defined as a pixel in
+* uncompressed surface formats, and as a compression block in compressed
+* surface formats. For MSFMT_DEPTH_STENCIL type multisampled surfaces, an
 * element is a sample.
 */
const unsigned align_1d_yf[] = {4096, 2048, 1024, 512, 256};
-   const unsigned align_1d_ys[] = {65536, 32768, 16384, 8192, 4096};
const unsigned align_2d_yf[] = {64, 64, 32, 32, 16};
-   const unsigned align_2d_ys[] = {256, 256, 128, 128, 64};
const unsigned align_3d_yf[] = {16, 8, 8, 8, 4};
-   const unsigned align_3d_ys[] = {64, 32, 32, 32, 16};
int i = 0;
 
/* Alignment computations below assume bpp = 8 and a power of 2. */
@@ -69,7 +65,7 @@ tr_mode_horizontal_texture_alignment(const struct brw_context 
*brw,
case GL_TEXTURE_1D:
case GL_TEXTURE_1D_ARRAY:
   align_yf = align_1d_yf;
-  align_ys = align_1d_ys;
+  multiplier = 16;
   break;
case GL_TEXTURE_2D:
case GL_TEXTURE_RECTANGLE:
@@ -79,11 +75,11 @@ tr_mode_horizontal_texture_alignment(const struct 
brw_context *brw,
case GL_TEXTURE_2D_MULTISAMPLE:
case GL_TEXTURE_2D_MULTISAMPLE_ARRAY:
   align_yf = align_2d_yf;
-  align_ys = align_2d_ys;
+  multiplier = 4;
   break;
case GL_TEXTURE_3D:
   align_yf = align_3d_yf;
-  align_ys = align_3d_ys;
+  multiplier = 4;
   break;
default:
   unreachable(not reached);
@@ -92,8 +88,10 @@ tr_mode_horizontal_texture_alignment(const struct 
brw_context *brw,
/* Compute array index. */
i = ffs(bpp/8) - 1;
 
-   ret_align = mt-tr_mode == INTEL_MIPTREE_TRMODE_YF ?
-   align_yf[i] : align_ys[i];
+   ret_align = align_yf[i];
+
+   if (mt-tr_mode == INTEL_MIPTREE_TRMODE_YS)
+  ret_align *= multiplier;
 
assert(_mesa_is_pow_two(mt-num_samples));
 
@@ -183,15 +181,13 @@ static unsigned int
 tr_mode_vertical_texture_alignment(const struct brw_context *brw,
const struct intel_mipmap_tree *mt)
 {
-   const unsigned *align_yf, *align_ys;
+   const unsigned *align_yf;
const unsigned bpp = _mesa_get_format_bytes(mt-format) * 8;
-   unsigned ret_align, divisor;
+   unsigned ret_align, divisor, multiplier;
 
-   /* Vertical alignment tables for TRMODE_YF and TRMODE_YS. */
+   /* Vertical alignment tables for TRMODE_YF */
const unsigned align_2d_yf[] = {64, 32, 32, 16, 16};
-   const unsigned align_2d_ys[] = {256, 128, 128, 64, 64};
const unsigned align_3d_yf[] = {16, 16, 16, 8, 8};
-   const unsigned align_3d_ys[] = {32, 32, 32, 16, 16};
int i = 0;
 
assert(brw-gen = 9);
@@ -208,11 +204,11 @@ tr_mode_vertical_texture_alignment(const struct 
brw_context *brw,
case GL_TEXTURE_2D_MULTISAMPLE:
case GL_TEXTURE_2D_MULTISAMPLE_ARRAY:
   align_yf = align_2d_yf;
-  align_ys = align_2d_ys;
+  multiplier = 4;
   break;
case GL_TEXTURE_3D:
   align_yf = align_3d_yf;
-  align_ys = align_3d_ys;
+  multiplier = 2;
   break;
case GL_TEXTURE_1D:
case GL_TEXTURE_1D_ARRAY:
@@ -223,8 +219,10 @@ tr_mode_vertical_texture_alignment(const struct 
brw_context *brw,
/* Compute array index. */
i = ffs(bpp / 8) - 1;
 
-   ret_align = mt-tr_mode == INTEL_MIPTREE_TRMODE_YF ?
-   align_yf[i] : align_ys[i];
+   ret_align = align_yf[i];
+
+   if (mt-tr_mode == INTEL_MIPTREE_TRMODE_YS)
+  ret_align *= multiplier;
 
assert(_mesa_is_pow_two(mt-num_samples));
 
-- 
2.4.3

___
mesa-dev mailing list
mesa-dev@lists.freedesktop.org

[Mesa-dev] [PATCH 2/7] i965/gen9: Don't call tr_mode_vertical_texture_alignment() for 1D textures

2015-08-13 Thread Anuj Phogat
Vertical alignment is not applicable to 1D textures.

Signed-off-by: Anuj Phogat anuj.pho...@gmail.com
---
 src/mesa/drivers/dri/i965/brw_tex_layout.c | 4 +++-
 1 file changed, 3 insertions(+), 1 deletion(-)

diff --git a/src/mesa/drivers/dri/i965/brw_tex_layout.c 
b/src/mesa/drivers/dri/i965/brw_tex_layout.c
index 4e44b15..edd7518 100644
--- a/src/mesa/drivers/dri/i965/brw_tex_layout.c
+++ b/src/mesa/drivers/dri/i965/brw_tex_layout.c
@@ -277,7 +277,9 @@ intel_vertical_texture_alignment_unit(struct brw_context 
*brw,
if (mt-format == MESA_FORMAT_S_UINT8)
   return brw-gen = 7 ? 8 : 4;
 
-   if (mt-tr_mode != INTEL_MIPTREE_TRMODE_NONE) {
+   if (mt-tr_mode != INTEL_MIPTREE_TRMODE_NONE 
+   mt-target != GL_TEXTURE_1D 
+   mt-target != GL_TEXTURE_1D_ARRAY) {
   uint32_t align = tr_mode_vertical_texture_alignment(brw, mt);
   /* XY_FAST_COPY_BLT doesn't support vertical alignment  64 */
   return align  64 ? 64 : align;
-- 
2.4.3

___
mesa-dev mailing list
mesa-dev@lists.freedesktop.org
http://lists.freedesktop.org/mailman/listinfo/mesa-dev


[Mesa-dev] [PATCH 5/7] i965/gen9: Remove parameter 'brw' from tr_mode_..._texture_alignment()

2015-08-13 Thread Anuj Phogat
Signed-off-by: Anuj Phogat anuj.pho...@gmail.com
---
 src/mesa/drivers/dri/i965/brw_tex_layout.c | 14 +++---
 1 file changed, 7 insertions(+), 7 deletions(-)

diff --git a/src/mesa/drivers/dri/i965/brw_tex_layout.c 
b/src/mesa/drivers/dri/i965/brw_tex_layout.c
index 53f7698..9a3c844 100644
--- a/src/mesa/drivers/dri/i965/brw_tex_layout.c
+++ b/src/mesa/drivers/dri/i965/brw_tex_layout.c
@@ -40,8 +40,7 @@
 #define FILE_DEBUG_FLAG DEBUG_MIPTREE
 
 static unsigned int
-tr_mode_horizontal_texture_alignment(const struct brw_context *brw,
- const struct intel_mipmap_tree *mt)
+tr_mode_horizontal_texture_alignment(const struct intel_mipmap_tree *mt)
 {
const unsigned *align_yf;
const unsigned bpp = _mesa_get_format_bytes(mt-format) * 8;
@@ -58,6 +57,8 @@ tr_mode_horizontal_texture_alignment(const struct brw_context 
*brw,
const unsigned align_3d_yf[] = {16, 8, 8, 8, 4};
int i = 0;
 
+   assert(mt-tr_mode != INTEL_MIPTREE_TRMODE_NONE);
+
/* Alignment computations below assume bpp = 8 and a power of 2. */
assert (bpp = 8  bpp = 128  _mesa_is_pow_two(bpp));
 
@@ -166,7 +167,7 @@ intel_horizontal_texture_alignment_unit(struct brw_context 
*brw,
   return 8;
 
if (brw-gen = 9  mt-tr_mode != INTEL_MIPTREE_TRMODE_NONE) {
-  uint32_t align = tr_mode_horizontal_texture_alignment(brw, mt);
+  uint32_t align = tr_mode_horizontal_texture_alignment(mt);
   /* XY_FAST_COPY_BLT doesn't support horizontal alignment  32. */
   return align  32 ? 32 : align;
}
@@ -178,8 +179,7 @@ intel_horizontal_texture_alignment_unit(struct brw_context 
*brw,
 }
 
 static unsigned int
-tr_mode_vertical_texture_alignment(const struct brw_context *brw,
-   const struct intel_mipmap_tree *mt)
+tr_mode_vertical_texture_alignment(const struct intel_mipmap_tree *mt)
 {
const unsigned *align_yf;
const unsigned bpp = _mesa_get_format_bytes(mt-format) * 8;
@@ -190,7 +190,7 @@ tr_mode_vertical_texture_alignment(const struct brw_context 
*brw,
const unsigned align_3d_yf[] = {16, 16, 16, 8, 8};
int i = 0;
 
-   assert(brw-gen = 9);
+   assert(mt-tr_mode != INTEL_MIPTREE_TRMODE_NONE);
 
/* Alignment computations below assume bpp = 8 and a power of 2. */
assert (bpp = 8  bpp = 128  _mesa_is_pow_two(bpp)) ;
@@ -278,7 +278,7 @@ intel_vertical_texture_alignment_unit(struct brw_context 
*brw,
if (mt-tr_mode != INTEL_MIPTREE_TRMODE_NONE 
mt-target != GL_TEXTURE_1D 
mt-target != GL_TEXTURE_1D_ARRAY) {
-  uint32_t align = tr_mode_vertical_texture_alignment(brw, mt);
+  uint32_t align = tr_mode_vertical_texture_alignment(mt);
   /* XY_FAST_COPY_BLT doesn't support vertical alignment  64 */
   return align  64 ? 64 : align;
}
-- 
2.4.3

___
mesa-dev mailing list
mesa-dev@lists.freedesktop.org
http://lists.freedesktop.org/mailman/listinfo/mesa-dev


[Mesa-dev] [PATCH 7/7] i965/gen9: Remove temporary variable 'bpp' in tr_mode_..._texture_alignment()

2015-08-13 Thread Anuj Phogat
Signed-off-by: Anuj Phogat anuj.pho...@gmail.com
---
 src/mesa/drivers/dri/i965/brw_tex_layout.c | 14 ++
 1 file changed, 6 insertions(+), 8 deletions(-)

diff --git a/src/mesa/drivers/dri/i965/brw_tex_layout.c 
b/src/mesa/drivers/dri/i965/brw_tex_layout.c
index 01516d1..f914cf8 100644
--- a/src/mesa/drivers/dri/i965/brw_tex_layout.c
+++ b/src/mesa/drivers/dri/i965/brw_tex_layout.c
@@ -42,7 +42,6 @@
 static unsigned int
 tr_mode_horizontal_texture_alignment(const struct intel_mipmap_tree *mt)
 {
-   const unsigned bpp = _mesa_get_format_bytes(mt-format) * 8;
unsigned ret_align, divisor, multiplier;
 
/* Values in below tables specifiy the horizontal alignment requirement
@@ -58,10 +57,10 @@ tr_mode_horizontal_texture_alignment(const struct 
intel_mipmap_tree *mt)
 
assert(mt-tr_mode != INTEL_MIPTREE_TRMODE_NONE);
 
-   /* Alignment computations below assume bpp = 8 and a power of 2. */
-   assert (bpp = 8  bpp = 128  _mesa_is_pow_two(bpp));
+   /* Alignment computations below assume a power of 2 cpp. */
+   assert (mt-cpp = 1  mt-cpp = 16  _mesa_is_pow_two(mt-cpp));
/* Compute array index. */
-   i = ffs(bpp/8) - 1;
+   i = ffs(mt-cpp) - 1;
 
switch(mt-target) {
case GL_TEXTURE_1D:
@@ -177,7 +176,6 @@ intel_horizontal_texture_alignment_unit(struct brw_context 
*brw,
 static unsigned int
 tr_mode_vertical_texture_alignment(const struct intel_mipmap_tree *mt)
 {
-   const unsigned bpp = _mesa_get_format_bytes(mt-format) * 8;
unsigned ret_align, divisor, multiplier;
 
/* Vertical alignment tables for TRMODE_YF */
@@ -187,10 +185,10 @@ tr_mode_vertical_texture_alignment(const struct 
intel_mipmap_tree *mt)
 
assert(mt-tr_mode != INTEL_MIPTREE_TRMODE_NONE);
 
-   /* Alignment computations below assume bpp = 8 and a power of 2. */
-   assert (bpp = 8  bpp = 128  _mesa_is_pow_two(bpp)) ;
+   /* Alignment computations below assume a power of 2 cpp. */
+   assert (mt-cpp = 1  mt-cpp = 16  _mesa_is_pow_two(mt-cpp)) ;
/* Compute array index. */
-   i = ffs(bpp / 8) - 1;
+   i = ffs(mt-cpp) - 1;
 
switch(mt-target) {
case GL_TEXTURE_2D:
-- 
2.4.3

___
mesa-dev mailing list
mesa-dev@lists.freedesktop.org
http://lists.freedesktop.org/mailman/listinfo/mesa-dev


[Mesa-dev] [PATCH 6/7] i965/gen9: Remove temporary variable 'align_yf' in tr_mode_..._texture_alignment()

2015-08-13 Thread Anuj Phogat
Signed-off-by: Anuj Phogat anuj.pho...@gmail.com
---
 src/mesa/drivers/dri/i965/brw_tex_layout.c | 26 +-
 1 file changed, 9 insertions(+), 17 deletions(-)

diff --git a/src/mesa/drivers/dri/i965/brw_tex_layout.c 
b/src/mesa/drivers/dri/i965/brw_tex_layout.c
index 9a3c844..01516d1 100644
--- a/src/mesa/drivers/dri/i965/brw_tex_layout.c
+++ b/src/mesa/drivers/dri/i965/brw_tex_layout.c
@@ -42,7 +42,6 @@
 static unsigned int
 tr_mode_horizontal_texture_alignment(const struct intel_mipmap_tree *mt)
 {
-   const unsigned *align_yf;
const unsigned bpp = _mesa_get_format_bytes(mt-format) * 8;
unsigned ret_align, divisor, multiplier;
 
@@ -61,11 +60,13 @@ tr_mode_horizontal_texture_alignment(const struct 
intel_mipmap_tree *mt)
 
/* Alignment computations below assume bpp = 8 and a power of 2. */
assert (bpp = 8  bpp = 128  _mesa_is_pow_two(bpp));
+   /* Compute array index. */
+   i = ffs(bpp/8) - 1;
 
switch(mt-target) {
case GL_TEXTURE_1D:
case GL_TEXTURE_1D_ARRAY:
-  align_yf = align_1d_yf;
+  ret_align = align_1d_yf[i];
   multiplier = 16;
   break;
case GL_TEXTURE_2D:
@@ -75,22 +76,17 @@ tr_mode_horizontal_texture_alignment(const struct 
intel_mipmap_tree *mt)
case GL_TEXTURE_CUBE_MAP_ARRAY:
case GL_TEXTURE_2D_MULTISAMPLE:
case GL_TEXTURE_2D_MULTISAMPLE_ARRAY:
-  align_yf = align_2d_yf;
+  ret_align = align_2d_yf[i];
   multiplier = 4;
   break;
case GL_TEXTURE_3D:
-  align_yf = align_3d_yf;
+  ret_align = align_3d_yf[i];
   multiplier = 4;
   break;
default:
   unreachable(not reached);
}
 
-   /* Compute array index. */
-   i = ffs(bpp/8) - 1;
-
-   ret_align = align_yf[i];
-
if (mt-tr_mode == INTEL_MIPTREE_TRMODE_YS)
   ret_align *= multiplier;
 
@@ -181,7 +177,6 @@ intel_horizontal_texture_alignment_unit(struct brw_context 
*brw,
 static unsigned int
 tr_mode_vertical_texture_alignment(const struct intel_mipmap_tree *mt)
 {
-   const unsigned *align_yf;
const unsigned bpp = _mesa_get_format_bytes(mt-format) * 8;
unsigned ret_align, divisor, multiplier;
 
@@ -194,6 +189,8 @@ tr_mode_vertical_texture_alignment(const struct 
intel_mipmap_tree *mt)
 
/* Alignment computations below assume bpp = 8 and a power of 2. */
assert (bpp = 8  bpp = 128  _mesa_is_pow_two(bpp)) ;
+   /* Compute array index. */
+   i = ffs(bpp / 8) - 1;
 
switch(mt-target) {
case GL_TEXTURE_2D:
@@ -203,11 +200,11 @@ tr_mode_vertical_texture_alignment(const struct 
intel_mipmap_tree *mt)
case GL_TEXTURE_CUBE_MAP_ARRAY:
case GL_TEXTURE_2D_MULTISAMPLE:
case GL_TEXTURE_2D_MULTISAMPLE_ARRAY:
-  align_yf = align_2d_yf;
+  ret_align = align_2d_yf[i];
   multiplier = 4;
   break;
case GL_TEXTURE_3D:
-  align_yf = align_3d_yf;
+  ret_align = align_3d_yf[i];
   multiplier = 2;
   break;
case GL_TEXTURE_1D:
@@ -216,11 +213,6 @@ tr_mode_vertical_texture_alignment(const struct 
intel_mipmap_tree *mt)
   unreachable(Unexpected miptree target);
}
 
-   /* Compute array index. */
-   i = ffs(bpp / 8) - 1;
-
-   ret_align = align_yf[i];
-
if (mt-tr_mode == INTEL_MIPTREE_TRMODE_YS)
   ret_align *= multiplier;
 
-- 
2.4.3

___
mesa-dev mailing list
mesa-dev@lists.freedesktop.org
http://lists.freedesktop.org/mailman/listinfo/mesa-dev


[Mesa-dev] [PATCH v4] mesa/teximage: accept ASTC formats for 3D texture specification

2015-08-13 Thread Nanley Chery
From: Nanley Chery nanley.g.ch...@intel.com

The ASTC spec was revised as follows:

   Revision 2, April 28, 2015 - added CompressedTex{Sub,}Image3D to
   commands accepting ASTC format tokens in the New Tokens section [...].

Support only exists in the HDR submode:

   Add a second new column 3D Tex. which is empty for all non-ASTC
   formats. If only the LDR profile is supported by the implementation,
   this column is also empty for all ASTC formats. If both the LDR and HDR
   profiles are supported only, this column is checked for all ASTC
   formats.

LDR-only systems should generate an INVALID_OPERATION error when
attempting to call CompressedTexImage3D with the TEXTURE_3D target.

v2. return the proper error for LDR-only systems.
v3. update is_astc_format().
v4. use _mesa_is_astc_format().

Signed-off-by: Nanley Chery nanley.g.ch...@intel.com
---
 src/mesa/main/teximage.c | 22 +-
 1 file changed, 21 insertions(+), 1 deletion(-)

diff --git a/src/mesa/main/teximage.c b/src/mesa/main/teximage.c
index f372059..a8c4eff 100644
--- a/src/mesa/main/teximage.c
+++ b/src/mesa/main/teximage.c
@@ -1829,6 +1829,8 @@ _mesa_target_can_be_compressed(const struct gl_context 
*ctx, GLenum target,
   case GL_COMPRESSED_RGB_BPTC_UNSIGNED_FLOAT:
  return ctx-Extensions.ARB_texture_compression_bptc;
   default:
+ if (_mesa_is_astc_format(intFormat))
+return ctx-Extensions.KHR_texture_compression_astc_hdr;
  return GL_FALSE;
   }
default:
@@ -2330,6 +2332,13 @@ texture_error_check( struct gl_context *ctx,
return GL_FALSE;
 }
 
+static inline bool
+is_astc_format(const struct gl_context *ctx, GLenum internalFormat)
+{
+  return ctx-Extensions.KHR_texture_compression_astc_ldr 
+ _mesa_is_astc_format(internalFormat);
+}
+
 
 /**
  * Error checking for glCompressedTexImage[123]D().
@@ -2358,7 +2367,18 @@ compressed_texture_error_check(struct gl_context *ctx, 
GLint dimensions,
* CompressedTexImage3D will generate an INVALID_OPERATION error if
* target is not TEXTURE_2D_ARRAY.
*/
-  error = _mesa_is_desktop_gl(ctx) ? GL_INVALID_ENUM : 
GL_INVALID_OPERATION;
+  /* From the KHR_texture_compression_astc_hdr spec:
+   *
+   * 'An INVALID_OPERATION error is generated by CompressedTexImage3D
+   *  if internalformat is TEXTURE_CUBE_MAP_ARRAY and the
+   *  Cube Map Array column of table 8.19 is *not* checked, or if
+   *  internalformat is TEXTURE_3D and the 3D Tex. column of table
+   *  8.19 is *not* checked'
+   *
+   * The instances of internalformat above should say target.
+   */
+  error = _mesa_is_desktop_gl(ctx)  !is_astc_format(ctx, internalFormat) 
?
+  GL_INVALID_ENUM : GL_INVALID_OPERATION;
   goto error;
}
 
-- 
2.4.2

___
mesa-dev mailing list
mesa-dev@lists.freedesktop.org
http://lists.freedesktop.org/mailman/listinfo/mesa-dev


Re: [Mesa-dev] [Mesa-stable] [PATCH] radeonsi: add new OLAND pci id

2015-08-13 Thread Alex Deucher
On Thu, Aug 13, 2015 at 5:29 PM, Emil Velikov emil.l.veli...@gmail.com wrote:
 On 13/08/15 22:22, Emil Velikov wrote:
 On 13/08/15 18:11, Alex Deucher wrote:
 On Thu, Aug 13, 2015 at 12:06 PM, Emil Velikov emil.l.veli...@gmail.com 
 wrote:
 On 13 August 2015 at 16:42, Alex Deucher alexdeuc...@gmail.com wrote:
 On Thu, Aug 13, 2015 at 11:11 AM, Emil Velikov emil.l.veli...@gmail.com 
 wrote:
 Hi Alex,

 On 10 August 2015 at 20:36, Alex Deucher alexdeuc...@gmail.com wrote:
 Signed-off-by: Alex Deucher alexander.deuc...@amd.com
 Cc: mesa-sta...@lists.freedesktop.org
 ---
  include/pci_ids/radeonsi_pci_ids.h | 1 +
  1 file changed, 1 insertion(+)

 diff --git a/include/pci_ids/radeonsi_pci_ids.h 
 b/include/pci_ids/radeonsi_pci_ids.h
 index c01ee20..52eada1 100644
 --- a/include/pci_ids/radeonsi_pci_ids.h
 +++ b/include/pci_ids/radeonsi_pci_ids.h
 @@ -63,6 +63,7 @@ CHIPSET(0x6608, OLAND_6608, OLAND)
  CHIPSET(0x6610, OLAND_6610, OLAND)
  CHIPSET(0x6611, OLAND_6611, OLAND)
  CHIPSET(0x6613, OLAND_6613, OLAND)
 +CHIPSET(0x6617, OLAND_6617, OLAND)
 Has there been any ideas/plans on getting this information
 consolidated in a single place ?

 It feels a bit dirty having the same information in four places -
 kernel, libdrm, ddx, mesa.

 There's not really a good solution that I know of due to the way X
 works.
 If I have to guess, obtaining OLAND via DRM_IOCTL_RADEON_INFO won't be
 impacted by (nor have any impact on) how X works. Shouldn't this just
 work or there is something subtly off with the idea ? Can you
 elaborate what part of X might be an obstacle ?

 IIRC, X decides what driver to load based on the pci ids they support
 rather than letting drivers claim their devices.  It's remnant of the
 UMS days.

 I think we're talking about different things here.

 * The (dare I say it) detection code used to determine the ddx/dri
 module name happens before (and afaics is unrelated to) the driver
 internals, which depend on the OLAND{,_foo} values.

 Obviously there is a handfull of extra information about all the
 supported vendor/device ids in the ddx that you're thinking about, that
 I'm afraid one cannot get rid of, unless...

 * The DDX uses a nouveau-like approach, accepting every device id. At
 PreInit stage, one does a quick check with libdrm_radeon/amdgpu
 (amdgpu_device_initialize?). The latter of which already has a
 comprehensive enough list of device ids.

 Actually scratch this part, libdrm_radeon does have a list of the
 devices, but does not have a device_init type API. On the other hand
 amdgpu has the API, but doesn't have the device ids.

 The earlier (original) idea still stands though:
 By the time OLAND* is queried/used in the ddx/mesa, the ddx/dri module
 has already been picked up, irrespective of that extra info

I don't think that will work.  The X server attempts to load the ddxes
based on the pci vendor id unless you manually specify the driver in
your xorg.conf.  In the case of 0x1002 AMD/ATI, there are 5 drivers
for device ids for that vendor id: ati_misc, mach64, r128, radeon, and
amdgpu.  The ddx then tells mesa what driver to load via dri2 based on
the pci id in the ddx.

Alex
___
mesa-dev mailing list
mesa-dev@lists.freedesktop.org
http://lists.freedesktop.org/mailman/listinfo/mesa-dev


Re: [Mesa-dev] [PATCH] i965: add ARB_texture_barrier support

2015-08-13 Thread Ilia Mirkin
On Thu, Aug 13, 2015 at 7:19 PM, Eric Anholt e...@anholt.net wrote:
 Ilia Mirkin imir...@alum.mit.edu writes:

 Signed-off-by: Ilia Mirkin imir...@alum.mit.edu
 ---

 The blending-in-shader piglit test passed even without the flush,
 which doesn't inspire me with confidence, but those piglit_draw_rect
 things are pretty heavy so perhaps cause a flush on their own anyways.

 I think you don't actually need the hook, because of the
 brw_render_cache_set_check_flush(brw, tex_obj-mt-bo) in
 intel_update_state().  You should be able to confirm that you're getting
 those pipe controls between your draws using INTEL_DEBUG=batch

I'm a complete newbie when it comes to the i965 driver, but why would
intel_update_state() get called in between sequential draws? The idea
is that you can do things like

tex0 = tex;
fb = tex;
draw;
barrier;
draw;
barrier;
draw;

which is actually exactly what the blending-in-shader piglit does. So
there should be no extra state updates between them. Am I missing
something?

However blending-in-shader uses piglit_draw_rect, which probably does
horrible things like immediate vertices and/or changing vbo's, which
in turn could trigger a flush?

  -ilia
___
mesa-dev mailing list
mesa-dev@lists.freedesktop.org
http://lists.freedesktop.org/mailman/listinfo/mesa-dev


Re: [Mesa-dev] [PATCH] i965/skl: Remove early platform support

2015-08-13 Thread Ben Widawsky
On Tue, Aug 11, 2015 at 03:04:17PM +0100, Neil Roberts wrote:
 Ben Widawsky b...@bwidawsk.net writes:
 
  Either of you opposed to doing it as a follow-on patch? (This failure
  you speak of was the primary goal for removing it). Initially, I tried
  to remove it, but we do still seem to use this logic pre-HSW, and so
  things got messier than I initially anticipated.
 
 Doing a follow-on patch is fine by me. I'm not sure what you mean by the
 logic being used pre-HSW, but I guess I'll see when you post the patch
 :)
 

I'm looking at this again. It looks to me like leaving this as it is works best.
Here is the rough idea of what you get if you remove it (I didn't actually give
this a second glance, I just made it compile).

diff --git a/src/mesa/drivers/dri/i965/brw_device_info.c 
b/src/mesa/drivers/dri/i965/brw_device_info.c
index 7ad3a2f..9d47553 100644
--- a/src/mesa/drivers/dri/i965/brw_device_info.c
+++ b/src/mesa/drivers/dri/i965/brw_device_info.c
@@ -172,3 +172,2 @@ static const struct brw_device_info brw_device_info_byt = {
.is_haswell = true,   \
-   .supports_simd16_3src = true, \
.has_resource_streamer = true
@@ -236,3 +235,2 @@ static const struct brw_device_info brw_device_info_hsw_gt3 
= {
.has_pln = true, \
-   .supports_simd16_3src = true,\
.max_vs_threads = 504,   \
@@ -308,3 +306,2 @@ static const struct brw_device_info brw_device_info_chv = {
.has_pln = true, \
-   .supports_simd16_3src = true,\
.max_vs_threads = 336,   \
diff --git a/src/mesa/drivers/dri/i965/brw_device_info.h 
b/src/mesa/drivers/dri/i965/brw_device_info.h
index 2a73e93..5c976b1 100644
--- a/src/mesa/drivers/dri/i965/brw_device_info.h
+++ b/src/mesa/drivers/dri/i965/brw_device_info.h
@@ -47,3 +47,2 @@ struct brw_device_info
bool has_surface_tile_offset;
-   bool supports_simd16_3src;
bool has_resource_streamer;
diff --git a/src/mesa/drivers/dri/i965/brw_fs_generator.cpp 
b/src/mesa/drivers/dri/i965/brw_fs_generator.cpp
index c86ca04..45a3544 100644
--- a/src/mesa/drivers/dri/i965/brw_fs_generator.cpp
+++ b/src/mesa/drivers/dri/i965/brw_fs_generator.cpp
@@ -1609,3 +1609,5 @@ fs_generator::generate_code(const cfg_t *cfg, int 
dispatch_width)
 brw_set_default_access_mode(p, BRW_ALIGN_16);
- if (dispatch_width == 16  !devinfo-supports_simd16_3src) {
+ /* SNB and IVB only */
+ if (dispatch_width == 16  devinfo-gen  8  !devinfo-is_haswell 

+ !devinfo-is_baytrail) {
 brw_set_default_exec_size(p, BRW_EXECUTE_8);
@@ -1631,3 +1633,4 @@ fs_generator::generate_code(const cfg_t *cfg, int 
dispatch_width)
 brw_set_default_access_mode(p, BRW_ALIGN_16);
- if (dispatch_width == 16  !devinfo-supports_simd16_3src) {
+ if (dispatch_width == 16  devinfo-gen  8  !devinfo-is_haswell 

+ !devinfo-is_baytrail) {
 brw_set_default_exec_size(p, BRW_EXECUTE_8);
@@ -1770,3 +1773,4 @@ fs_generator::generate_code(const cfg_t *cfg, int 
dispatch_width)
  brw_set_default_access_mode(p, BRW_ALIGN_16);
- if (dispatch_width == 16  !devinfo-supports_simd16_3src) {
+ if (dispatch_width == 16  devinfo-gen  8  !devinfo-is_haswell 

+ !devinfo-is_baytrail) {
 brw_set_default_exec_size(p, BRW_EXECUTE_8);
@@ -1812,4 +1816,6 @@ fs_generator::generate_code(const cfg_t *cfg, int 
dispatch_width)
   */
+ /* haswell, or ivybridge */
  if (dispatch_width == 16 
- (devinfo-is_haswell || !devinfo-supports_simd16_3src)) {
+ (devinfo-is_haswell ||
+  (devinfo-gen == 7  !devinfo-is_baytrail))) {
 brw_set_default_exec_size(p, BRW_EXECUTE_8);




  Neil, you said if we go with this patch - I haven't heard any
  opposition, do you have any?
 
 No, it seems like a good idea to me.
 
 Reviewed-by: Neil Roberts n...@linux.intel.com
 
 - Neil

Thanks.
___
mesa-dev mailing list
mesa-dev@lists.freedesktop.org
http://lists.freedesktop.org/mailman/listinfo/mesa-dev


Re: [Mesa-dev] [PATCH] tgsi/nouveau: Add support for tesselation ctrl and tesselation eval

2015-08-13 Thread Ilia Mirkin
[mesa-dev readded, please don't drop CC's]

I found it by feeding the shader to nouveau_compiler with
NV50_PROG_DEBUG=1 set, which dumps the input tgsi. Those two should
match up.

On Thu, Aug 13, 2015 at 5:39 PM, Marcos Paulo de souza
marcos.souza@gmail.com wrote:
 Hi Ilia,

 So, how can I test it? Do I need to especify some patameter to verify this
 type of problem?

 Thanks for the quick revision!


 Em 13-08-2015 16:03, Ilia Mirkin escreveu:

 Hi Macros,

 Looks like it's not parsed in exactly right. It will parse something like

 TESS_EVAL
 PROPERTY TES_PRIM_MODE 7
 PROPERTY TES_SPACING 2
 PROPERTY TES_VERTEX_ORDER_CW 0
 PROPERTY TES_POINT_MODE 0
 DCL IN[][0], GENERIC[0]
 DCL IN[][1], GENERIC[1]

 as

 TESS_EVAL
 PROPERTY TES_PRIM_MODE 7
 PROPERTY TES_SPACING 2
 PROPERTY TES_VERTEX_ORDER_CW 0
 PROPERTY TES_POINT_MODE 0
 DCL IN[][0][0], GENERIC[0]
 DCL IN[][0][1], GENERIC[1]

 Perhaps the same issue happens for geometry shaders, but that doesn't
 make it right :) You might have to look at the printing logic to get a
 better understanding of what's going wrong.

 Also you should send patches to nouveau separately from patches to the
 rest of the infra. Ideally this would have been 2 patches, e.g.

 tgsi: set implicit array size for tess stages
 nouveau: recognize tess stages in nouveau_compiler

 or something like that.

 On Wed, Aug 12, 2015 at 9:25 PM, Marcos Paulo de Souza
 marcos.souza@gmail.com wrote:

 From: Marcos Paulo de Souza marcos.souza@gmail.com

 Signed-off-by: Marcos Paulo de Souza marcos.souza.org
 Suggested-by: Ilia Mirkin imir...@alum.mit.edu
 ---
   src/gallium/auxiliary/tgsi/tgsi_text.c | 6 +-
   src/gallium/drivers/nouveau/nouveau_compiler.c | 4 
   2 files changed, 9 insertions(+), 1 deletion(-)

 diff --git a/src/gallium/auxiliary/tgsi/tgsi_text.c
 b/src/gallium/auxiliary/tgsi/tgsi_text.c
 index a6675c5..8647e4e 100644
 --- a/src/gallium/auxiliary/tgsi/tgsi_text.c
 +++ b/src/gallium/auxiliary/tgsi/tgsi_text.c
 @@ -259,7 +259,7 @@ struct translate_ctx
  struct tgsi_token *tokens_end;
  struct tgsi_header *header;
  unsigned processor : 4;
 -   int implied_array_size : 5;
 +   int implied_array_size : 6;
  unsigned num_immediates;
   };

 @@ -1623,6 +1623,10 @@ static boolean translate( struct translate_ctx
 *ctx )
  if (!parse_header( ctx ))
 return FALSE;

 +   if (ctx-processor == TGSI_PROCESSOR_TESS_CTRL ||
 +   ctx-processor == TGSI_PROCESSOR_TESS_EVAL)
 +   ctx-implied_array_size = 32 ;
 +
  while (*ctx-cur != '\0') {
 uint label_val = 0;
 if (!eat_white( ctx-cur )) {
 diff --git a/src/gallium/drivers/nouveau/nouveau_compiler.c
 b/src/gallium/drivers/nouveau/nouveau_compiler.c
 index 8660498..495450b 100644
 --- a/src/gallium/drivers/nouveau/nouveau_compiler.c
 +++ b/src/gallium/drivers/nouveau/nouveau_compiler.c
 @@ -190,6 +190,10 @@ main(int argc, char *argv[])
 type = PIPE_SHADER_GEOMETRY;
  else if (!strncmp(text, COMP, 4))
 type = PIPE_SHADER_COMPUTE;
 +   else if (!strncmp(text, TESS_CTRL, 9))
 +  type = PIPE_SHADER_TESS_CTRL;
 +   else if (!strncmp(text, TESS_EVAL, 9))
 +  type = PIPE_SHADER_TESS_EVAL;
  else {
 _debug_printf(Unrecognized TGSI header\n);
 return 1;
 --
 2.4.3

 ___
 mesa-dev mailing list
 mesa-dev@lists.freedesktop.org
 http://lists.freedesktop.org/mailman/listinfo/mesa-dev


___
mesa-dev mailing list
mesa-dev@lists.freedesktop.org
http://lists.freedesktop.org/mailman/listinfo/mesa-dev


[Mesa-dev] [PATCH] i965: Improve disassembly of data port read messages.

2015-08-13 Thread Kenneth Graunke
We now print out the name of the message instead of its numerical
value, and label the message control and surface numbers.

Signed-off-by: Kenneth Graunke kenn...@whitecape.org
---
 src/mesa/drivers/dri/i965/brw_disasm.c | 31 +++
 1 file changed, 27 insertions(+), 4 deletions(-)

diff --git a/src/mesa/drivers/dri/i965/brw_disasm.c 
b/src/mesa/drivers/dri/i965/brw_disasm.c
index 1075c5a..61be2b0 100644
--- a/src/mesa/drivers/dri/i965/brw_disasm.c
+++ b/src/mesa/drivers/dri/i965/brw_disasm.c
@@ -412,6 +412,22 @@ static const char *const gen7_gateway_subfuncid[8] = {
[BRW_MESSAGE_GATEWAY_SFID_MMIO_READ_WRITE] = mmio read/write,
 };
 
+static const char *const gen4_dp_read_port_msg_type[4] = {
+   [0b00] = OWord Block Read,
+   [0b01] = OWord Dual Block Read,
+   [0b10] = Media Block Read,
+   [0b11] = DWord Scattered Read,
+};
+
+static const char *const g45_dp_read_port_msg_type[8] = {
+   [0b000] = OWord Block Read,
+   [0b010] = OWord Dual Block Read,
+   [0b100] = Media Block Read,
+   [0b110] = DWord Scattered Read,
+   [0b001] = Render Target UNORM Read,
+   [0b011] = AVC Loop Filter Read,
+};
+
 static const char *const dp_write_port_msg_type[8] = {
[0b000] = OWord block write,
[0b001] = OWord dual block write,
@@ -1444,10 +1460,17 @@ brw_disassemble_inst(FILE *file, const struct 
brw_device_info *devinfo,
   brw_inst_dp_msg_type(devinfo, inst),
   devinfo-gen = 7 ? 0 : 
brw_inst_dp_write_commit(devinfo, inst));
 } else {
-   format(file,  (%ld, %ld, %ld),
-  brw_inst_binding_table_index(devinfo, inst),
-  brw_inst_dp_read_msg_control(devinfo, inst),
-  brw_inst_dp_read_msg_type(devinfo, inst));
+   bool is_965 = devinfo-gen == 4  !devinfo-is_g4x;
+   err |= control(file, DP read message type,
+  is_965 ? gen4_dp_read_port_msg_type :
+   g45_dp_read_port_msg_type,
+  brw_inst_dp_read_msg_type(devinfo, inst),
+  space);
+
+   format(file,  MsgCtrl = 0x%lx,
+  brw_inst_dp_read_msg_control(devinfo, inst));
+
+   format(file,  Surface = %ld, 
brw_inst_binding_table_index(devinfo, inst));
 }
 break;
 
-- 
2.4.6

___
mesa-dev mailing list
mesa-dev@lists.freedesktop.org
http://lists.freedesktop.org/mailman/listinfo/mesa-dev


[Mesa-dev] [PATCH 1/7] i965/gen9: Don't use intel_..._texture_alignment_unit() for linear 1D layout

2015-08-13 Thread Anuj Phogat
If gen9_use_linear_1d_layout() returns true, we discards the align_w
computed earlier and use fixed align_w = 64 in gen9_miptree_layout_1d().
So, avoid computing align_w when not required.

Signed-off-by: Anuj Phogat anuj.pho...@gmail.com
---
 src/mesa/drivers/dri/i965/brw_tex_layout.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/src/mesa/drivers/dri/i965/brw_tex_layout.c 
b/src/mesa/drivers/dri/i965/brw_tex_layout.c
index b8b0393..4e44b15 100644
--- a/src/mesa/drivers/dri/i965/brw_tex_layout.c
+++ b/src/mesa/drivers/dri/i965/brw_tex_layout.c
@@ -798,7 +798,7 @@ intel_miptree_set_alignment(struct brw_context *brw,
  mt-align_w = 128 / mt-cpp;
  mt-align_h = 32;
   }
-   } else {
+   } else if (!gen9_use_linear_1d_layout(brw, mt)) {
   mt-align_w =
  intel_horizontal_texture_alignment_unit(brw, mt, layout_flags);
   mt-align_h = intel_vertical_texture_alignment_unit(brw, mt);
-- 
2.4.3

___
mesa-dev mailing list
mesa-dev@lists.freedesktop.org
http://lists.freedesktop.org/mailman/listinfo/mesa-dev


Re: [Mesa-dev] [PATCH] i965: add ARB_texture_barrier support

2015-08-13 Thread Eric Anholt
Ilia Mirkin imir...@alum.mit.edu writes:

 Signed-off-by: Ilia Mirkin imir...@alum.mit.edu
 ---

 The blending-in-shader piglit test passed even without the flush,
 which doesn't inspire me with confidence, but those piglit_draw_rect
 things are pretty heavy so perhaps cause a flush on their own anyways.

I think you don't actually need the hook, because of the
brw_render_cache_set_check_flush(brw, tex_obj-mt-bo) in
intel_update_state().  You should be able to confirm that you're getting
those pipe controls between your draws using INTEL_DEBUG=batch


signature.asc
Description: PGP signature
___
mesa-dev mailing list
mesa-dev@lists.freedesktop.org
http://lists.freedesktop.org/mailman/listinfo/mesa-dev


[Mesa-dev] [PATCH 3/3] nv30: add depth bounds test support for hw that has it

2015-08-13 Thread Ilia Mirkin
Signed-off-by: Ilia Mirkin imir...@alum.mit.edu
---
 src/gallium/drivers/nouveau/nv30/nv30_screen.c | 4 +++-
 src/gallium/drivers/nouveau/nv30/nv30_state.c  | 8 
 src/gallium/drivers/nouveau/nv30/nv30_state.h  | 4 +++-
 3 files changed, 14 insertions(+), 2 deletions(-)

diff --git a/src/gallium/drivers/nouveau/nv30/nv30_screen.c 
b/src/gallium/drivers/nouveau/nv30/nv30_screen.c
index 0dd4fda..1a322e3 100644
--- a/src/gallium/drivers/nouveau/nv30/nv30_screen.c
+++ b/src/gallium/drivers/nouveau/nv30/nv30_screen.c
@@ -98,6 +98,9 @@ nv30_screen_get_param(struct pipe_screen *pscreen, enum 
pipe_cap param)
case PIPE_CAP_VERTEX_ELEMENT_SRC_OFFSET_4BYTE_ALIGNED_ONLY:
case PIPE_CAP_PREFER_BLIT_BASED_TEXTURE_TRANSFER:
   return 1;
+   /* nv35 capabilities */
+   case PIPE_CAP_DEPTH_BOUNDS_TEST:
+  return eng3d-oclass == NV35_3D_CLASS || eng3d-oclass = NV40_3D_CLASS;
/* nv4x capabilities */
case PIPE_CAP_BLEND_EQUATION_SEPARATE:
case PIPE_CAP_NPOT_TEXTURES:
@@ -164,7 +167,6 @@ nv30_screen_get_param(struct pipe_screen *pscreen, enum 
pipe_cap param)
case PIPE_CAP_RESOURCE_FROM_USER_MEMORY:
case PIPE_CAP_DEVICE_RESET_STATUS_QUERY:
case PIPE_CAP_MAX_SHADER_PATCH_VARYINGS:
-   case PIPE_CAP_DEPTH_BOUNDS_TEST:
   return 0;
 
case PIPE_CAP_VENDOR_ID:
diff --git a/src/gallium/drivers/nouveau/nv30/nv30_state.c 
b/src/gallium/drivers/nouveau/nv30/nv30_state.c
index 708ba34..fd604c2 100644
--- a/src/gallium/drivers/nouveau/nv30/nv30_state.c
+++ b/src/gallium/drivers/nouveau/nv30/nv30_state.c
@@ -211,6 +211,7 @@ static void *
 nv30_zsa_state_create(struct pipe_context *pipe,
   const struct pipe_depth_stencil_alpha_state *cso)
 {
+   struct nouveau_object *eng3d = nv30_context(pipe)-screen-eng3d;
struct nv30_zsa_stateobj *so;
 
so = CALLOC_STRUCT(nv30_zsa_stateobj);
@@ -223,6 +224,13 @@ nv30_zsa_state_create(struct pipe_context *pipe,
SB_DATA  (so, cso-depth.writemask);
SB_DATA  (so, cso-depth.enabled);
 
+   if (eng3d-oclass == NV35_3D_CLASS || eng3d-oclass = NV40_3D_CLASS) {
+  SB_MTHD35(so, DEPTH_BOUNDS_TEST_ENABLE, 3);
+  SB_DATA  (so, cso-depth.bounds_test);
+  SB_DATA  (so, fui(cso-depth.bounds_min));
+  SB_DATA  (so, fui(cso-depth.bounds_max));
+   }
+
if (cso-stencil[0].enabled) {
   SB_MTHD30(so, STENCIL_ENABLE(0), 3);
   SB_DATA  (so, 1);
diff --git a/src/gallium/drivers/nouveau/nv30/nv30_state.h 
b/src/gallium/drivers/nouveau/nv30/nv30_state.h
index 1f13d24..ed3b810 100644
--- a/src/gallium/drivers/nouveau/nv30/nv30_state.h
+++ b/src/gallium/drivers/nouveau/nv30/nv30_state.h
@@ -13,6 +13,8 @@
 #define SB_DATA(so, u)(so)-data[(so)-size++] = (u)
 #define SB_MTHD30(so, mthd, size)  \
SB_DATA((so), ((size)  18) | (7  13) | NV30_3D_##mthd)
+#define SB_MTHD35(so, mthd, size)  \
+   SB_DATA((so), ((size)  18) | (7  13) | NV35_3D_##mthd)
 #define SB_MTHD40(so, mthd, size)  \
SB_DATA((so), ((size)  18) | (7  13) | NV40_3D_##mthd)
 
@@ -30,7 +32,7 @@ struct nv30_rasterizer_stateobj {
 
 struct nv30_zsa_stateobj {
struct pipe_depth_stencil_alpha_state pipe;
-   unsigned data[32];
+   unsigned data[36];
unsigned size;
 };
 
-- 
2.4.6

___
mesa-dev mailing list
mesa-dev@lists.freedesktop.org
http://lists.freedesktop.org/mailman/listinfo/mesa-dev


[Mesa-dev] [PATCH 2/3] nv50: add depth bounds test support

2015-08-13 Thread Ilia Mirkin
Signed-off-by: Ilia Mirkin imir...@alum.mit.edu
---
 src/gallium/drivers/nouveau/nv50/nv50_screen.c   |  2 +-
 src/gallium/drivers/nouveau/nv50/nv50_state.c| 10 ++
 src/gallium/drivers/nouveau/nv50/nv50_stateobj.h |  2 +-
 3 files changed, 12 insertions(+), 2 deletions(-)

diff --git a/src/gallium/drivers/nouveau/nv50/nv50_screen.c 
b/src/gallium/drivers/nouveau/nv50/nv50_screen.c
index 46f733a..af71520 100644
--- a/src/gallium/drivers/nouveau/nv50/nv50_screen.c
+++ b/src/gallium/drivers/nouveau/nv50/nv50_screen.c
@@ -176,6 +176,7 @@ nv50_screen_get_param(struct pipe_screen *pscreen, enum 
pipe_cap param)
case PIPE_CAP_CLIP_HALFZ:
case PIPE_CAP_POLYGON_OFFSET_CLAMP:
case PIPE_CAP_QUERY_PIPELINE_STATISTICS:
+   case PIPE_CAP_DEPTH_BOUNDS_TEST:
   return 1;
case PIPE_CAP_SEAMLESS_CUBE_MAP:
   return 1; /* class_3d = NVA0_3D_CLASS; */
@@ -211,7 +212,6 @@ nv50_screen_get_param(struct pipe_screen *pscreen, enum 
pipe_cap param)
case PIPE_CAP_RESOURCE_FROM_USER_MEMORY:
case PIPE_CAP_DEVICE_RESET_STATUS_QUERY:
case PIPE_CAP_MAX_SHADER_PATCH_VARYINGS:
-   case PIPE_CAP_DEPTH_BOUNDS_TEST:
   return 0;
 
case PIPE_CAP_VENDOR_ID:
diff --git a/src/gallium/drivers/nouveau/nv50/nv50_state.c 
b/src/gallium/drivers/nouveau/nv50/nv50_state.c
index 186d126..9505a0b 100644
--- a/src/gallium/drivers/nouveau/nv50/nv50_state.c
+++ b/src/gallium/drivers/nouveau/nv50/nv50_state.c
@@ -373,6 +373,16 @@ nv50_zsa_state_create(struct pipe_context *pipe,
   SB_DATA(so, 0);
}
 
+   SB_BEGIN_3D(so, DEPTH_BOUNDS_EN, 1);
+   if (cso-depth.bounds_test) {
+  SB_DATA(so, 1);
+  SB_BEGIN_3D(so, DEPTH_BOUNDS(0), 2);
+  SB_DATA(so, fui(cso-depth.bounds_min));
+  SB_DATA(so, fui(cso-depth.bounds_max));
+   } else {
+  SB_DATA(so, 0);
+   }
+
if (cso-stencil[0].enabled) {
   SB_BEGIN_3D(so, STENCIL_ENABLE, 5);
   SB_DATA(so, 1);
diff --git a/src/gallium/drivers/nouveau/nv50/nv50_stateobj.h 
b/src/gallium/drivers/nouveau/nv50/nv50_stateobj.h
index 853df54..cf75d1e 100644
--- a/src/gallium/drivers/nouveau/nv50/nv50_stateobj.h
+++ b/src/gallium/drivers/nouveau/nv50/nv50_stateobj.h
@@ -31,7 +31,7 @@ struct nv50_rasterizer_stateobj {
 struct nv50_zsa_stateobj {
struct pipe_depth_stencil_alpha_state pipe;
int size;
-   uint32_t state[29];
+   uint32_t state[34];
 };
 
 struct nv50_constbuf {
-- 
2.4.6

___
mesa-dev mailing list
mesa-dev@lists.freedesktop.org
http://lists.freedesktop.org/mailman/listinfo/mesa-dev


[Mesa-dev] [PATCH 1/3] nvc0: add depth bounds test support

2015-08-13 Thread Ilia Mirkin
Signed-off-by: Ilia Mirkin imir...@alum.mit.edu
---

This and the following patch apply on top of the series that Marek just sent 
out.

 src/gallium/drivers/nouveau/nvc0/nvc0_screen.c   | 2 +-
 src/gallium/drivers/nouveau/nvc0/nvc0_state.c| 7 +++
 src/gallium/drivers/nouveau/nvc0/nvc0_stateobj.h | 2 +-
 3 files changed, 9 insertions(+), 2 deletions(-)

diff --git a/src/gallium/drivers/nouveau/nvc0/nvc0_screen.c 
b/src/gallium/drivers/nouveau/nvc0/nvc0_screen.c
index 5213d29..7ed42d1 100644
--- a/src/gallium/drivers/nouveau/nvc0/nvc0_screen.c
+++ b/src/gallium/drivers/nouveau/nvc0/nvc0_screen.c
@@ -175,6 +175,7 @@ nvc0_screen_get_param(struct pipe_screen *pscreen, enum 
pipe_cap param)
case PIPE_CAP_CLIP_HALFZ:
case PIPE_CAP_POLYGON_OFFSET_CLAMP:
case PIPE_CAP_MULTISAMPLE_Z_RESOLVE:
+   case PIPE_CAP_DEPTH_BOUNDS_TEST:
   return 1;
case PIPE_CAP_SEAMLESS_CUBE_MAP_PER_TEXTURE:
   return (class_3d = NVE4_3D_CLASS) ? 1 : 0;
@@ -197,7 +198,6 @@ nvc0_screen_get_param(struct pipe_screen *pscreen, enum 
pipe_cap param)
case PIPE_CAP_VERTEXID_NOBASE:
case PIPE_CAP_RESOURCE_FROM_USER_MEMORY:
case PIPE_CAP_DEVICE_RESET_STATUS_QUERY:
-   case PIPE_CAP_DEPTH_BOUNDS_TEST:
   return 0;
 
case PIPE_CAP_VENDOR_ID:
diff --git a/src/gallium/drivers/nouveau/nvc0/nvc0_state.c 
b/src/gallium/drivers/nouveau/nvc0/nvc0_state.c
index 693b14f..2a33857 100644
--- a/src/gallium/drivers/nouveau/nvc0/nvc0_state.c
+++ b/src/gallium/drivers/nouveau/nvc0/nvc0_state.c
@@ -351,6 +351,13 @@ nvc0_zsa_state_create(struct pipe_context *pipe,
   SB_DATA(so, nvgl_comparison_op(cso-depth.func));
}
 
+   SB_IMMED_3D(so, DEPTH_BOUNDS_EN, cso-depth.bounds_test);
+   if (cso-depth.bounds_test) {
+  SB_BEGIN_3D(so, DEPTH_BOUNDS(0), 2);
+  SB_DATA(so, fui(cso-depth.bounds_min));
+  SB_DATA(so, fui(cso-depth.bounds_max));
+   }
+
if (cso-stencil[0].enabled) {
   SB_BEGIN_3D(so, STENCIL_ENABLE, 5);
   SB_DATA(so, 1);
diff --git a/src/gallium/drivers/nouveau/nvc0/nvc0_stateobj.h 
b/src/gallium/drivers/nouveau/nvc0/nvc0_stateobj.h
index 9b69bf0..18fcc12 100644
--- a/src/gallium/drivers/nouveau/nvc0/nvc0_stateobj.h
+++ b/src/gallium/drivers/nouveau/nvc0/nvc0_stateobj.h
@@ -29,7 +29,7 @@ struct nvc0_rasterizer_stateobj {
 struct nvc0_zsa_stateobj {
struct pipe_depth_stencil_alpha_state pipe;
int size;
-   uint32_t state[26];
+   uint32_t state[30];
 };
 
 struct nvc0_constbuf {
-- 
2.4.6

___
mesa-dev mailing list
mesa-dev@lists.freedesktop.org
http://lists.freedesktop.org/mailman/listinfo/mesa-dev


Re: [Mesa-dev] [PATCH 2/2] r600, compute: setup RATs for write-only images

2015-08-13 Thread Marek Olšák
On Mon, Aug 10, 2015 at 8:32 PM, Zoltan Gilian zoltan.gil...@gmail.com wrote:
 ---
  src/gallium/drivers/r600/evergreen_compute.c | 101 
 ---
  src/gallium/drivers/r600/evergreen_state.c   |  44 +++-
  src/gallium/drivers/r600/r600_pipe.h |   4 +-
  src/gallium/drivers/radeon/r600_texture.c|   1 +
  4 files changed, 109 insertions(+), 41 deletions(-)

 diff --git a/src/gallium/drivers/r600/evergreen_compute.c 
 b/src/gallium/drivers/r600/evergreen_compute.c
 index 8b27a66..6f39507 100644
 --- a/src/gallium/drivers/r600/evergreen_compute.c
 +++ b/src/gallium/drivers/r600/evergreen_compute.c
 @@ -99,8 +99,39 @@ struct r600_resource* r600_compute_buffer_alloc_vram(
 return (struct r600_resource *)buffer;
  }

 +static void evergreen_set_cbuf(
 +   struct r600_context *ctx,
 +   unsigned id,
 +   struct pipe_surface *surf)
 +{
 +   struct pipe_framebuffer_state *state = ctx-framebuffer.state;
 +
 +   /* Add the RAT to the list of color buffers */
 +   state-cbufs[id] = surf;
 +
 +   /* Update the number of color buffers */
 +   state-nr_cbufs = MAX2(id + 1, state-nr_cbufs);
 +
 +   /* Update the cb_target_mask
 +* XXX: I think this is a potential spot for bugs once we start doing
 +* GL interop.  cb_target_mask may be modified in the 3D sections
 +* of this driver. */
 +   ctx-compute_cb_target_mask |= (0xf  (id  2));

CB_TARGET_MASK is ignored by RATs and should be set to 0 for all
compute resources.

 +}
 +
 +static void evergreen_unset_cbuf(
 +   struct r600_context *ctx,
 +   unsigned id)
 +{
 +   struct pipe_framebuffer_state *state = ctx-framebuffer.state;
 +
 +   state-cbufs[id] = NULL;
 +   ctx-compute_cb_target_mask = ~(0xf  (id  2));
 +   /* nr_cbufs = ceil(last_bit / 4) */
 +   state-nr_cbufs = (util_last_bit(ctx-compute_cb_target_mask) + 3)  
 2;
 +}

 -static void evergreen_set_rat(
 +static void evergreen_set_rat_buf(
 struct r600_context *ctx,
 unsigned id,
 struct r600_resource* bo,
 @@ -123,23 +154,11 @@ static void evergreen_set_rat(
 rat_templ.u.tex.first_layer = 0;
 rat_templ.u.tex.last_layer = 0;

 -   /* Add the RAT the list of color buffers */
 -   ctx-framebuffer.state.cbufs[id] = ctx-b.b.create_surface(
 -   (struct pipe_context *)ctx,
 -   (struct pipe_resource *)bo, rat_templ);
 -
 -   /* Update the number of color buffers */
 -   ctx-framebuffer.state.nr_cbufs =
 -   MAX2(id + 1, ctx-framebuffer.state.nr_cbufs);
 -
 -   /* Update the cb_target_mask
 -* XXX: I think this is a potential spot for bugs once we start doing
 -* GL interop.  cb_target_mask may be modified in the 3D sections
 -* of this driver. */
 -   ctx-compute_cb_target_mask |= (0xf  (id * 4));
 +   evergreen_set_cbuf(ctx, id, ctx-b.b.create_surface(
 +   (struct pipe_context *)ctx, (struct pipe_resource *)bo, 
 rat_templ));

 surf = (struct r600_surface*)ctx-framebuffer.state.cbufs[id];
 -   evergreen_init_color_surface_rat(rctx, surf);
 +   evergreen_init_color_surface_rat_buf(ctx, surf);
  }

  static void evergreen_cs_set_vertex_buffer(
 @@ -623,32 +642,34 @@ static void evergreen_set_compute_resources(struct 
 pipe_context * ctx_,
 struct pipe_surface ** surfaces)
  {
 struct r600_context *ctx = (struct r600_context *)ctx_;
 -   struct r600_surface **resources = (struct r600_surface **)surfaces;
 +   struct pipe_surface *surf = NULL;

 COMPUTE_DBG(ctx-screen, *** evergreen_set_compute_resources: start 
 = %u count = %u\n,
 start, count);

 +   if (!surfaces) {
 +   for (unsigned i = 0; i  count; ++i)
 +   evergreen_unset_cbuf(ctx, 1 + i);
 +   return;
 +   }
 +
 for (unsigned i = 0; i  count; i++) {
 -   /* The First two vertex buffers are reserved for parameters 
 and
 -* global buffers. */
 -   unsigned vtx_id = 2 + i;
 -   if (resources[i]) {
 -   struct r600_resource_global *buffer =
 -   (struct r600_resource_global*)
 -   resources[i]-base.texture;
 -   if (resources[i]-base.writable) {
 -   assert(i+1  12);
 -
 -   
 evergreen_set_rat(ctx-cs_shader_state.shader, i+1,
 -   (struct r600_resource 
 *)resources[i]-base.texture,
 -   buffer-chunk-start_in_dw*4,
 -   resources[i]-base.texture-width0);
 -   }
 -
 -   evergreen_cs_set_vertex_buffer(ctx, vtx_id,
 -   buffer-chunk-start_in_dw * 4,
 -   

Re: [Mesa-dev] [PATCH] r600, compute: setup compute sampler states and views

2015-08-13 Thread Marek Olšák
Reviewed-by: Marek Olšák marek.ol...@amd.com

I can't review the other patch completely, because it contains some
compute stuff I'm not familiar with.

Marek

On Wed, Aug 12, 2015 at 2:19 PM, Zoltan Gilian zoltan.gil...@gmail.com wrote:
 v2: Add compute mode flag to sampler state setup (Marek).
 Drop branches which avoid reference counting (Marek).
 Simplify unset branch condition (Marek).
 ---
  src/gallium/drivers/r600/evergreen_compute.c | 25 ---
  src/gallium/drivers/r600/evergreen_state.c   | 46 
 
  src/gallium/drivers/r600/evergreend.h|  5 +++
  src/gallium/drivers/r600/r600_pipe.h |  7 +
  src/gallium/drivers/r600/r600_state_common.c | 11 +--
  5 files changed, 54 insertions(+), 40 deletions(-)

 diff --git a/src/gallium/drivers/r600/evergreen_compute.c 
 b/src/gallium/drivers/r600/evergreen_compute.c
 index 6139fdd..b07ef0e 100644
 --- a/src/gallium/drivers/r600/evergreen_compute.c
 +++ b/src/gallium/drivers/r600/evergreen_compute.c
 @@ -503,6 +503,12 @@ static void compute_emit_cs(struct r600_context *ctx, 
 const uint *block_layout,
 /* Emit constant buffer state */
 r600_emit_atom(ctx, ctx-constbuf_state[PIPE_SHADER_COMPUTE].atom);

 +   /* Emit sampler state */
 +   r600_emit_atom(ctx, ctx-samplers[PIPE_SHADER_COMPUTE].states.atom);
 +
 +   /* Emit sampler view (texture resource) state */
 +   r600_emit_atom(ctx, ctx-samplers[PIPE_SHADER_COMPUTE].views.atom);
 +
 /* Emit compute shader state */
 r600_emit_atom(ctx, ctx-cs_shader_state.atom);

 @@ -673,25 +679,6 @@ static void evergreen_set_compute_resources(struct 
 pipe_context * ctx_,
 }
  }

 -void evergreen_set_cs_sampler_view(struct pipe_context *ctx_,
 -   unsigned start_slot, unsigned count,
 -   struct pipe_sampler_view **views)
 -{
 -   struct r600_pipe_sampler_view **resource =
 -   (struct r600_pipe_sampler_view **)views;
 -
 -   for (unsigned i = 0; i  count; i++){
 -   if (resource[i]) {
 -   assert(i+1  12);
 -   /* XXX: Implement */
 -   assert(!Compute samplers not implemented.);
 -   ///FETCH0 = VTX0 (param buffer),
 -   //FETCH1 = VTX1 (global buffer pool), FETCH2... = TEX
 -   }
 -   }
 -}
 -
 -
  static void evergreen_set_global_binding(
 struct pipe_context *ctx_, unsigned first, unsigned n,
 struct pipe_resource **resources,
 diff --git a/src/gallium/drivers/r600/evergreen_state.c 
 b/src/gallium/drivers/r600/evergreen_state.c
 index e374c03..319f7ef 100644
 --- a/src/gallium/drivers/r600/evergreen_state.c
 +++ b/src/gallium/drivers/r600/evergreen_state.c
 @@ -2029,7 +2029,7 @@ static void evergreen_emit_cs_constant_buffers(struct 
 r600_context *rctx, struct

  static void evergreen_emit_sampler_views(struct r600_context *rctx,
  struct r600_samplerview_state *state,
 -unsigned resource_id_base)
 +unsigned resource_id_base, unsigned 
 pkt_flags)
  {
 struct radeon_winsys_cs *cs = rctx-b.rings.gfx.cs;
 uint32_t dirty_mask = state-dirty_mask;
 @@ -2042,7 +2042,7 @@ static void evergreen_emit_sampler_views(struct 
 r600_context *rctx,
 rview = state-views[resource_index];
 assert(rview);

 -   radeon_emit(cs, PKT3(PKT3_SET_RESOURCE, 8, 0));
 +   radeon_emit(cs, PKT3(PKT3_SET_RESOURCE, 8, 0) | pkt_flags);
 radeon_emit(cs, (resource_id_base + resource_index) * 8);
 radeon_emit_array(cs, rview-tex_resource_words, 8);

 @@ -2051,11 +2051,11 @@ static void evergreen_emit_sampler_views(struct 
 r600_context *rctx,
   
 rview-tex_resource-b.b.nr_samples  1 ?
   
 RADEON_PRIO_SHADER_TEXTURE_MSAA :
   
 RADEON_PRIO_SHADER_TEXTURE_RO);
 -   radeon_emit(cs, PKT3(PKT3_NOP, 0, 0));
 +   radeon_emit(cs, PKT3(PKT3_NOP, 0, 0) | pkt_flags);
 radeon_emit(cs, reloc);

 if (!rview-skip_mip_address_reloc) {
 -   radeon_emit(cs, PKT3(PKT3_NOP, 0, 0));
 +   radeon_emit(cs, PKT3(PKT3_NOP, 0, 0) | pkt_flags);
 radeon_emit(cs, reloc);
 }
 }
 @@ -2064,23 +2064,33 @@ static void evergreen_emit_sampler_views(struct 
 r600_context *rctx,

  static void evergreen_emit_vs_sampler_views(struct r600_context *rctx, 
 struct r600_atom *atom)
  {
 -   evergreen_emit_sampler_views(rctx, 
 rctx-samplers[PIPE_SHADER_VERTEX].views, 176 + R600_MAX_CONST_BUFFERS);
 +   evergreen_emit_sampler_views(rctx, 
 

Re: [Mesa-dev] [PATCH] tgsi/nouveau: Add support for tesselation ctrl and tesselation eval

2015-08-13 Thread Ilia Mirkin
Hi Macros,

Looks like it's not parsed in exactly right. It will parse something like

TESS_EVAL
PROPERTY TES_PRIM_MODE 7
PROPERTY TES_SPACING 2
PROPERTY TES_VERTEX_ORDER_CW 0
PROPERTY TES_POINT_MODE 0
DCL IN[][0], GENERIC[0]
DCL IN[][1], GENERIC[1]

as

TESS_EVAL
PROPERTY TES_PRIM_MODE 7
PROPERTY TES_SPACING 2
PROPERTY TES_VERTEX_ORDER_CW 0
PROPERTY TES_POINT_MODE 0
DCL IN[][0][0], GENERIC[0]
DCL IN[][0][1], GENERIC[1]

Perhaps the same issue happens for geometry shaders, but that doesn't
make it right :) You might have to look at the printing logic to get a
better understanding of what's going wrong.

Also you should send patches to nouveau separately from patches to the
rest of the infra. Ideally this would have been 2 patches, e.g.

tgsi: set implicit array size for tess stages
nouveau: recognize tess stages in nouveau_compiler

or something like that.

On Wed, Aug 12, 2015 at 9:25 PM, Marcos Paulo de Souza
marcos.souza@gmail.com wrote:
 From: Marcos Paulo de Souza marcos.souza@gmail.com

 Signed-off-by: Marcos Paulo de Souza marcos.souza.org
 Suggested-by: Ilia Mirkin imir...@alum.mit.edu
 ---
  src/gallium/auxiliary/tgsi/tgsi_text.c | 6 +-
  src/gallium/drivers/nouveau/nouveau_compiler.c | 4 
  2 files changed, 9 insertions(+), 1 deletion(-)

 diff --git a/src/gallium/auxiliary/tgsi/tgsi_text.c 
 b/src/gallium/auxiliary/tgsi/tgsi_text.c
 index a6675c5..8647e4e 100644
 --- a/src/gallium/auxiliary/tgsi/tgsi_text.c
 +++ b/src/gallium/auxiliary/tgsi/tgsi_text.c
 @@ -259,7 +259,7 @@ struct translate_ctx
 struct tgsi_token *tokens_end;
 struct tgsi_header *header;
 unsigned processor : 4;
 -   int implied_array_size : 5;
 +   int implied_array_size : 6;
 unsigned num_immediates;
  };

 @@ -1623,6 +1623,10 @@ static boolean translate( struct translate_ctx *ctx )
 if (!parse_header( ctx ))
return FALSE;

 +   if (ctx-processor == TGSI_PROCESSOR_TESS_CTRL ||
 +   ctx-processor == TGSI_PROCESSOR_TESS_EVAL)
 +   ctx-implied_array_size = 32 ;
 +
 while (*ctx-cur != '\0') {
uint label_val = 0;
if (!eat_white( ctx-cur )) {
 diff --git a/src/gallium/drivers/nouveau/nouveau_compiler.c 
 b/src/gallium/drivers/nouveau/nouveau_compiler.c
 index 8660498..495450b 100644
 --- a/src/gallium/drivers/nouveau/nouveau_compiler.c
 +++ b/src/gallium/drivers/nouveau/nouveau_compiler.c
 @@ -190,6 +190,10 @@ main(int argc, char *argv[])
type = PIPE_SHADER_GEOMETRY;
 else if (!strncmp(text, COMP, 4))
type = PIPE_SHADER_COMPUTE;
 +   else if (!strncmp(text, TESS_CTRL, 9))
 +  type = PIPE_SHADER_TESS_CTRL;
 +   else if (!strncmp(text, TESS_EVAL, 9))
 +  type = PIPE_SHADER_TESS_EVAL;
 else {
_debug_printf(Unrecognized TGSI header\n);
return 1;
 --
 2.4.3

 ___
 mesa-dev mailing list
 mesa-dev@lists.freedesktop.org
 http://lists.freedesktop.org/mailman/listinfo/mesa-dev
___
mesa-dev mailing list
mesa-dev@lists.freedesktop.org
http://lists.freedesktop.org/mailman/listinfo/mesa-dev


Re: [Mesa-dev] [Mesa-stable] [PATCH] radeonsi: add new OLAND pci id

2015-08-13 Thread Emil Velikov
On 13/08/15 18:11, Alex Deucher wrote:
 On Thu, Aug 13, 2015 at 12:06 PM, Emil Velikov emil.l.veli...@gmail.com 
 wrote:
 On 13 August 2015 at 16:42, Alex Deucher alexdeuc...@gmail.com wrote:
 On Thu, Aug 13, 2015 at 11:11 AM, Emil Velikov emil.l.veli...@gmail.com 
 wrote:
 Hi Alex,

 On 10 August 2015 at 20:36, Alex Deucher alexdeuc...@gmail.com wrote:
 Signed-off-by: Alex Deucher alexander.deuc...@amd.com
 Cc: mesa-sta...@lists.freedesktop.org
 ---
  include/pci_ids/radeonsi_pci_ids.h | 1 +
  1 file changed, 1 insertion(+)

 diff --git a/include/pci_ids/radeonsi_pci_ids.h 
 b/include/pci_ids/radeonsi_pci_ids.h
 index c01ee20..52eada1 100644
 --- a/include/pci_ids/radeonsi_pci_ids.h
 +++ b/include/pci_ids/radeonsi_pci_ids.h
 @@ -63,6 +63,7 @@ CHIPSET(0x6608, OLAND_6608, OLAND)
  CHIPSET(0x6610, OLAND_6610, OLAND)
  CHIPSET(0x6611, OLAND_6611, OLAND)
  CHIPSET(0x6613, OLAND_6613, OLAND)
 +CHIPSET(0x6617, OLAND_6617, OLAND)
 Has there been any ideas/plans on getting this information
 consolidated in a single place ?

 It feels a bit dirty having the same information in four places -
 kernel, libdrm, ddx, mesa.

 There's not really a good solution that I know of due to the way X
 works.
 If I have to guess, obtaining OLAND via DRM_IOCTL_RADEON_INFO won't be
 impacted by (nor have any impact on) how X works. Shouldn't this just
 work or there is something subtly off with the idea ? Can you
 elaborate what part of X might be an obstacle ?
 
 IIRC, X decides what driver to load based on the pci ids they support
 rather than letting drivers claim their devices.  It's remnant of the
 UMS days.
 
I think we're talking about different things here.

* The (dare I say it) detection code used to determine the ddx/dri
module name happens before (and afaics is unrelated to) the driver
internals, which depend on the OLAND{,_foo} values.

Obviously there is a handfull of extra information about all the
supported vendor/device ids in the ddx that you're thinking about, that
I'm afraid one cannot get rid of, unless...

* The DDX uses a nouveau-like approach, accepting every device id. At
PreInit stage, one does a quick check with libdrm_radeon/amdgpu
(amdgpu_device_initialize?). The latter of which already has a
comprehensive enough list of device ids.

How do these sound ?

Cheers,
Emil
___
mesa-dev mailing list
mesa-dev@lists.freedesktop.org
http://lists.freedesktop.org/mailman/listinfo/mesa-dev


[Mesa-dev] [PATCH] i965: add ARB_texture_barrier support

2015-08-13 Thread Ilia Mirkin
Signed-off-by: Ilia Mirkin imir...@alum.mit.edu
---

The blending-in-shader piglit test passed even without the flush,
which doesn't inspire me with confidence, but those piglit_draw_rect
things are pretty heavy so perhaps cause a flush on their own anyways.

 docs/GL3.txt | 2 +-
 docs/relnotes/11.0.0.html| 1 +
 src/mesa/drivers/dri/i965/intel_extensions.c | 1 +
 src/mesa/drivers/dri/i965/intel_tex.c| 9 +
 4 files changed, 12 insertions(+), 1 deletion(-)

diff --git a/docs/GL3.txt b/docs/GL3.txt
index 54c0c5a..ed0e160 100644
--- a/docs/GL3.txt
+++ b/docs/GL3.txt
@@ -195,7 +195,7 @@ GL 4.5, GLSL 4.50:
   GL_ARB_direct_state_access   DONE (all drivers)
   GL_ARB_get_texture_sub_image DONE (all drivers)
   GL_ARB_shader_texture_image_samples  not started
-  GL_ARB_texture_barrier   DONE (nv50, nvc0, r600, 
radeonsi)
+  GL_ARB_texture_barrier   DONE (i965, nv50, nvc0, 
r600, radeonsi)
   GL_KHR_context_flush_control DONE (all - but needs 
GLX/EXT extension to be useful)
   GL_KHR_robust_buffer_access_behavior not started
   GL_KHR_robustness90% done (the ARB 
variant)
diff --git a/docs/relnotes/11.0.0.html b/docs/relnotes/11.0.0.html
index 2d80198..15b0477 100644
--- a/docs/relnotes/11.0.0.html
+++ b/docs/relnotes/11.0.0.html
@@ -56,6 +56,7 @@ Note: some of the new features are only available with 
certain drivers.
 liGL_ARB_shader_stencil_export on llvmpipe/li
 liGL_ARB_shader_subroutine on core profile all drivers/li
 liGL_ARB_tessellation_shader on nvc0, radeonsi/li
+liGL_ARB_texture_barrier / GL_NV_texture_barrier on i965/li
 liGL_ARB_vertex_attrib_64bit on llvmpipe, radeonsi/li
 liGL_ARB_viewport_array on radeonsi/li
 liGLX_ARB_create_context_robustness on r600, radeonsi/li
diff --git a/src/mesa/drivers/dri/i965/intel_extensions.c 
b/src/mesa/drivers/dri/i965/intel_extensions.c
index 24229af..ee9abe5 100644
--- a/src/mesa/drivers/dri/i965/intel_extensions.c
+++ b/src/mesa/drivers/dri/i965/intel_extensions.c
@@ -250,6 +250,7 @@ intelInitExtensions(struct gl_context *ctx)
ctx-Extensions.MESA_pack_invert = true;
ctx-Extensions.NV_conditional_render = true;
ctx-Extensions.NV_primitive_restart = true;
+   ctx-Extensions.NV_texture_barrier = true;
ctx-Extensions.NV_texture_env_combine4 = true;
ctx-Extensions.NV_texture_rectangle = true;
ctx-Extensions.TDFX_texture_compression_FXT1 = true;
diff --git a/src/mesa/drivers/dri/i965/intel_tex.c 
b/src/mesa/drivers/dri/i965/intel_tex.c
index e16b0de..cac33ac 100644
--- a/src/mesa/drivers/dri/i965/intel_tex.c
+++ b/src/mesa/drivers/dri/i965/intel_tex.c
@@ -357,6 +357,14 @@ intel_set_texture_storage_for_buffer_object(struct 
gl_context *ctx,
return true;
 }
 
+static void
+intel_texture_barrier(struct gl_context *ctx)
+{
+   struct brw_context *brw = brw_context(ctx);
+
+   brw_emit_mi_flush(brw);
+}
+
 void
 intelInitTextureFuncs(struct dd_function_table *functions)
 {
@@ -372,4 +380,5 @@ intelInitTextureFuncs(struct dd_function_table *functions)
functions-TextureView = intel_texture_view;
functions-SetTextureStorageForBufferObject =
   intel_set_texture_storage_for_buffer_object;
+   functions-TextureBarrier = intel_texture_barrier;
 }
-- 
2.4.6

___
mesa-dev mailing list
mesa-dev@lists.freedesktop.org
http://lists.freedesktop.org/mailman/listinfo/mesa-dev


[Mesa-dev] [PATCH 2/4] st/mesa: add EXT_depth_bounds_test

2015-08-13 Thread Marek Olšák
From: Marek Olšák marek.ol...@amd.com

---
 src/mesa/state_tracker/st_atom_depth.c | 15 +++
 src/mesa/state_tracker/st_extensions.c |  1 +
 2 files changed, 12 insertions(+), 4 deletions(-)

diff --git a/src/mesa/state_tracker/st_atom_depth.c 
b/src/mesa/state_tracker/st_atom_depth.c
index c4bca8d..d9cc970 100644
--- a/src/mesa/state_tracker/st_atom_depth.c
+++ b/src/mesa/state_tracker/st_atom_depth.c
@@ -105,10 +105,17 @@ update_depth_stencil_alpha(struct st_context *st)
memset(dsa, 0, sizeof(*dsa));
memset(sr, 0, sizeof(sr));
 
-   if (ctx-Depth.Test  ctx-DrawBuffer-Visual.depthBits  0) {
-  dsa-depth.enabled = 1;
-  dsa-depth.writemask = ctx-Depth.Mask;
-  dsa-depth.func = st_compare_func_to_pipe(ctx-Depth.Func);
+   if (ctx-DrawBuffer-Visual.depthBits  0) {
+  if (ctx-Depth.Test) {
+ dsa-depth.enabled = 1;
+ dsa-depth.writemask = ctx-Depth.Mask;
+ dsa-depth.func = st_compare_func_to_pipe(ctx-Depth.Func);
+  }
+  if (ctx-Depth.BoundsTest) {
+ dsa-depth.bounds_test = 1;
+ dsa-depth.bounds_min = ctx-Depth.BoundsMin;
+ dsa-depth.bounds_max = ctx-Depth.BoundsMax;
+  }
}
 
if (ctx-Stencil.Enabled  ctx-DrawBuffer-Visual.stencilBits  0) {
diff --git a/src/mesa/state_tracker/st_extensions.c 
b/src/mesa/state_tracker/st_extensions.c
index 7864cf8..17f572f 100644
--- a/src/mesa/state_tracker/st_extensions.c
+++ b/src/mesa/state_tracker/st_extensions.c
@@ -491,6 +491,7 @@ void st_init_extensions(struct pipe_screen *screen,
   { o(ARB_texture_view), PIPE_CAP_SAMPLER_VIEW_TARGET  
},
   { o(ARB_clip_control), PIPE_CAP_CLIP_HALFZ   
},
   { o(EXT_polygon_offset_clamp), PIPE_CAP_POLYGON_OFFSET_CLAMP 
},
+  { o(EXT_depth_bounds_test),PIPE_CAP_DEPTH_BOUNDS_TEST
},
};
 
/* Required: render target and sampler support */
-- 
2.1.4

___
mesa-dev mailing list
mesa-dev@lists.freedesktop.org
http://lists.freedesktop.org/mailman/listinfo/mesa-dev


Re: [Mesa-dev] [Mesa-stable] [PATCH] radeonsi: add new OLAND pci id

2015-08-13 Thread Emil Velikov
On 13/08/15 22:22, Emil Velikov wrote:
 On 13/08/15 18:11, Alex Deucher wrote:
 On Thu, Aug 13, 2015 at 12:06 PM, Emil Velikov emil.l.veli...@gmail.com 
 wrote:
 On 13 August 2015 at 16:42, Alex Deucher alexdeuc...@gmail.com wrote:
 On Thu, Aug 13, 2015 at 11:11 AM, Emil Velikov emil.l.veli...@gmail.com 
 wrote:
 Hi Alex,

 On 10 August 2015 at 20:36, Alex Deucher alexdeuc...@gmail.com wrote:
 Signed-off-by: Alex Deucher alexander.deuc...@amd.com
 Cc: mesa-sta...@lists.freedesktop.org
 ---
  include/pci_ids/radeonsi_pci_ids.h | 1 +
  1 file changed, 1 insertion(+)

 diff --git a/include/pci_ids/radeonsi_pci_ids.h 
 b/include/pci_ids/radeonsi_pci_ids.h
 index c01ee20..52eada1 100644
 --- a/include/pci_ids/radeonsi_pci_ids.h
 +++ b/include/pci_ids/radeonsi_pci_ids.h
 @@ -63,6 +63,7 @@ CHIPSET(0x6608, OLAND_6608, OLAND)
  CHIPSET(0x6610, OLAND_6610, OLAND)
  CHIPSET(0x6611, OLAND_6611, OLAND)
  CHIPSET(0x6613, OLAND_6613, OLAND)
 +CHIPSET(0x6617, OLAND_6617, OLAND)
 Has there been any ideas/plans on getting this information
 consolidated in a single place ?

 It feels a bit dirty having the same information in four places -
 kernel, libdrm, ddx, mesa.

 There's not really a good solution that I know of due to the way X
 works.
 If I have to guess, obtaining OLAND via DRM_IOCTL_RADEON_INFO won't be
 impacted by (nor have any impact on) how X works. Shouldn't this just
 work or there is something subtly off with the idea ? Can you
 elaborate what part of X might be an obstacle ?

 IIRC, X decides what driver to load based on the pci ids they support
 rather than letting drivers claim their devices.  It's remnant of the
 UMS days.

 I think we're talking about different things here.
 
 * The (dare I say it) detection code used to determine the ddx/dri
 module name happens before (and afaics is unrelated to) the driver
 internals, which depend on the OLAND{,_foo} values.
 
 Obviously there is a handfull of extra information about all the
 supported vendor/device ids in the ddx that you're thinking about, that
 I'm afraid one cannot get rid of, unless...
 
 * The DDX uses a nouveau-like approach, accepting every device id. At
 PreInit stage, one does a quick check with libdrm_radeon/amdgpu
 (amdgpu_device_initialize?). The latter of which already has a
 comprehensive enough list of device ids.
 
Actually scratch this part, libdrm_radeon does have a list of the
devices, but does not have a device_init type API. On the other hand
amdgpu has the API, but doesn't have the device ids.

The earlier (original) idea still stands though:
By the time OLAND* is queried/used in the ddx/mesa, the ddx/dri module
has already been picked up, irrespective of that extra info.

-Emil
___
mesa-dev mailing list
mesa-dev@lists.freedesktop.org
http://lists.freedesktop.org/mailman/listinfo/mesa-dev


Re: [Mesa-dev] [PATCH 1/4] gallium: add an interface for EXT_depth_bounds_test

2015-08-13 Thread Roland Scheidegger
I guess the question is if those depth bounds floats should be in the
dsa state or set separately. That would mostly depend on if you expect
frequent changes to the values or not, at least that's the pattern
usually followed. Either way though looks ok to me.

Reviewed-by: Roland Scheidegger srol...@vmware.com

Am 13.08.2015 um 22:32 schrieb Marek Olšák:
 From: Marek Olšák marek.ol...@amd.com
 
 ---
  src/gallium/docs/source/screen.rst   | 3 +++
  src/gallium/drivers/freedreno/freedreno_screen.c | 1 +
  src/gallium/drivers/i915/i915_screen.c   | 1 +
  src/gallium/drivers/ilo/ilo_screen.c | 1 +
  src/gallium/drivers/llvmpipe/lp_screen.c | 1 +
  src/gallium/drivers/nouveau/nv30/nv30_screen.c   | 1 +
  src/gallium/drivers/nouveau/nv50/nv50_screen.c   | 1 +
  src/gallium/drivers/nouveau/nvc0/nvc0_screen.c   | 1 +
  src/gallium/drivers/r300/r300_screen.c   | 1 +
  src/gallium/drivers/r600/r600_pipe.c | 1 +
  src/gallium/drivers/radeonsi/si_pipe.c   | 1 +
  src/gallium/drivers/softpipe/sp_screen.c | 1 +
  src/gallium/drivers/svga/svga_screen.c   | 1 +
  src/gallium/drivers/vc4/vc4_screen.c | 1 +
  src/gallium/include/pipe/p_defines.h | 1 +
  src/gallium/include/pipe/p_state.h   | 3 +++
  16 files changed, 20 insertions(+)
 
 diff --git a/src/gallium/docs/source/screen.rst 
 b/src/gallium/docs/source/screen.rst
 index c0b5eb3..2c0da01 100644
 --- a/src/gallium/docs/source/screen.rst
 +++ b/src/gallium/docs/source/screen.rst
 @@ -264,6 +264,9 @@ The integer capabilities:
  * ``PIPE_CAP_TEXTURE_HALF_FLOAT_LINEAR``: Whether the linear minification and
magnification filters are supported with half-precision floating-point
textures.
 +* ``PIPE_CAP_DEPTH_BOUNDS_TEST``: Whether bounds_test, bounds_min, and
 +  bounds_max states of pipe_depth_stencil_alpha_state behave according
 +  to the GL_EXT_depth_bounds_test specification.
  
  
  .. _pipe_capf:
 diff --git a/src/gallium/drivers/freedreno/freedreno_screen.c 
 b/src/gallium/drivers/freedreno/freedreno_screen.c
 index 295ce7e..b55f5b3 100644
 --- a/src/gallium/drivers/freedreno/freedreno_screen.c
 +++ b/src/gallium/drivers/freedreno/freedreno_screen.c
 @@ -232,6 +232,7 @@ fd_screen_get_param(struct pipe_screen *pscreen, enum 
 pipe_cap param)
   case PIPE_CAP_MAX_SHADER_PATCH_VARYINGS:
   case PIPE_CAP_TEXTURE_FLOAT_LINEAR:
   case PIPE_CAP_TEXTURE_HALF_FLOAT_LINEAR:
 + case PIPE_CAP_DEPTH_BOUNDS_TEST:
   return 0;
  
   case PIPE_CAP_MAX_VIEWPORTS:
 diff --git a/src/gallium/drivers/i915/i915_screen.c 
 b/src/gallium/drivers/i915/i915_screen.c
 index 7608ca5..19a94a8 100644
 --- a/src/gallium/drivers/i915/i915_screen.c
 +++ b/src/gallium/drivers/i915/i915_screen.c
 @@ -246,6 +246,7 @@ i915_get_param(struct pipe_screen *screen, enum pipe_cap 
 cap)
 case PIPE_CAP_MAX_SHADER_PATCH_VARYINGS:
 case PIPE_CAP_TEXTURE_FLOAT_LINEAR:
 case PIPE_CAP_TEXTURE_HALF_FLOAT_LINEAR:
 +   case PIPE_CAP_DEPTH_BOUNDS_TEST:
return 0;
  
 case PIPE_CAP_MAX_DUAL_SOURCE_RENDER_TARGETS:
 diff --git a/src/gallium/drivers/ilo/ilo_screen.c 
 b/src/gallium/drivers/ilo/ilo_screen.c
 index 9f150bb..ab4d137 100644
 --- a/src/gallium/drivers/ilo/ilo_screen.c
 +++ b/src/gallium/drivers/ilo/ilo_screen.c
 @@ -468,6 +468,7 @@ ilo_get_param(struct pipe_screen *screen, enum pipe_cap 
 param)
 case PIPE_CAP_RESOURCE_FROM_USER_MEMORY:
 case PIPE_CAP_DEVICE_RESET_STATUS_QUERY:
 case PIPE_CAP_MAX_SHADER_PATCH_VARYINGS:
 +   case PIPE_CAP_DEPTH_BOUNDS_TEST:
return 0;
  
 case PIPE_CAP_VENDOR_ID:
 diff --git a/src/gallium/drivers/llvmpipe/lp_screen.c 
 b/src/gallium/drivers/llvmpipe/lp_screen.c
 index 539bb44..14eeab0 100644
 --- a/src/gallium/drivers/llvmpipe/lp_screen.c
 +++ b/src/gallium/drivers/llvmpipe/lp_screen.c
 @@ -295,6 +295,7 @@ llvmpipe_get_param(struct pipe_screen *screen, enum 
 pipe_cap param)
 case PIPE_CAP_RESOURCE_FROM_USER_MEMORY:
 case PIPE_CAP_DEVICE_RESET_STATUS_QUERY:
 case PIPE_CAP_MAX_SHADER_PATCH_VARYINGS:
 +   case PIPE_CAP_DEPTH_BOUNDS_TEST:
return 0;
 }
 /* should only get here on unhandled cases */
 diff --git a/src/gallium/drivers/nouveau/nv30/nv30_screen.c 
 b/src/gallium/drivers/nouveau/nv30/nv30_screen.c
 index 73bcd5b..efa766d 100644
 --- a/src/gallium/drivers/nouveau/nv30/nv30_screen.c
 +++ b/src/gallium/drivers/nouveau/nv30/nv30_screen.c
 @@ -166,6 +166,7 @@ nv30_screen_get_param(struct pipe_screen *pscreen, enum 
 pipe_cap param)
 case PIPE_CAP_MAX_SHADER_PATCH_VARYINGS:
 case PIPE_CAP_TEXTURE_FLOAT_LINEAR:
 case PIPE_CAP_TEXTURE_HALF_FLOAT_LINEAR:
 +   case PIPE_CAP_DEPTH_BOUNDS_TEST:
return 0;
  
 case PIPE_CAP_VENDOR_ID:
 diff --git a/src/gallium/drivers/nouveau/nv50/nv50_screen.c 
 b/src/gallium/drivers/nouveau/nv50/nv50_screen.c
 index 1e19877..2479cbd 100644
 --- a/src/gallium/drivers/nouveau/nv50/nv50_screen.c
 

[Mesa-dev] [Bug 91631] Clang static analysis of libtess shows undefined values and use of memory after free

2015-08-13 Thread bugzilla-daemon
https://bugs.freedesktop.org/show_bug.cgi?id=91631

Jonathan Liu net...@gmail.com changed:

   What|Removed |Added

 CC||a...@freedesktop.org,
   ||bri...@vmware.com

-- 
You are receiving this mail because:
You are the assignee for the bug.
___
mesa-dev mailing list
mesa-dev@lists.freedesktop.org
http://lists.freedesktop.org/mailman/listinfo/mesa-dev


Re: [Mesa-dev] [PATCH 3/4] radeonsi: add support for EXT_depth_bounds_test

2015-08-13 Thread Michel Dänzer
On 14.08.2015 05:32, Marek Olšák wrote:
 From: Marek Olšák marek.ol...@amd.com

Reviewed-by: Michel Dänzer michel.daen...@amd.com


-- 
Earthling Michel Dänzer   |   http://www.amd.com
Libre software enthusiast | Mesa and X developer
___
mesa-dev mailing list
mesa-dev@lists.freedesktop.org
http://lists.freedesktop.org/mailman/listinfo/mesa-dev


Re: [Mesa-dev] [PATCH 08/70] i965: Remove early release of DRI2 miptree

2015-08-13 Thread Kenneth Graunke
On Thursday, August 13, 2015 02:57:20 PM Martin Peres wrote:
 On 07/08/15 23:13, Chris Wilson wrote:
  intel_update_winsys_renderbuffer_miptree() will release the existing
  miptree when wrapping a new DRI2 buffer, so we can remove the early
  release and so prevent a NULL mt dereference should importing the new
  DRI2 name fail for any reason. (Reusing the old DRI2 name will result
  in the rendering going astray, to a stale buffer, and not shown on the
  screen, but it allows us to issue a warning and not crash much later in
  innocent code.)
 
  Signed-off-by: Chris Wilson ch...@chris-wilson.co.uk
  ---
src/mesa/drivers/dri/i965/brw_context.c | 1 -
1 file changed, 1 deletion(-)
 
  diff --git a/src/mesa/drivers/dri/i965/brw_context.c 
  b/src/mesa/drivers/dri/i965/brw_context.c
  index e8d1396..72f3897 100644
  --- a/src/mesa/drivers/dri/i965/brw_context.c
  +++ b/src/mesa/drivers/dri/i965/brw_context.c
  @@ -1388,7 +1388,6 @@ intel_process_dri2_buffer(struct brw_context *brw,
  buffer-cpp, buffer-pitch);
   }

  -   intel_miptree_release(rb-mt);
   bo = drm_intel_bo_gem_create_from_name(brw-bufmgr, buffer_name,
  buffer-name);
   if (!bo) {
 
 Bugzilla: https://bugs.freedesktop.org/show_bug.cgi?id=86281
 Reviewed-by: Martin Peres martin.pe...@linux.intel.com
 
 If no-one has any objection, I will push the patch tomorrow to avoid the 
 crashes experienced by a lot of users, myself included!

This seems reasonable from a robustness point of view - try to limp
along a bit further and hope the import works next time, somehow.

That said, I do have one concern: we might get into trouble with
multisample buffers.

In the multisample case, irb-mt is the MSAA buffer, and
irb-singlesample_mt is the actual single-sampled DRI2 buffer.

Previously, this call always released irb-mt, deleting the MSAA buffer
every time.  Then, intel_update_winsys_renderbuffer_miptree would hit
the !irb-mt case, creating a fresh new irb-mt, and setting
irb-need_downsample = false.  That may not happen now, which is a
subtle change.  (It might be OK...)

If front buffer drawing, we call intel_renderbuffer_upsample(), which
asserts that irb-need_downsample == false.  So...if somehow we hit this
path with a dirty multisample buffer and front buffer rendering...then
I think we'd assert fail and die.  I'm not sure if that can happen; it
at least seems unlikely...

Do you think the new multisampled behavior will work OK?  If so, perhaps
we can at least leave a note about it in the commit message.

Thanks!
--Ken


signature.asc
Description: This is a digitally signed message part.
___
mesa-dev mailing list
mesa-dev@lists.freedesktop.org
http://lists.freedesktop.org/mailman/listinfo/mesa-dev


Re: [Mesa-dev] [PATCH 08/70] i965: Remove early release of DRI2 miptree

2015-08-13 Thread Kenneth Graunke
On Thursday, August 13, 2015 02:57:20 PM Martin Peres wrote:
 On 07/08/15 23:13, Chris Wilson wrote:
  intel_update_winsys_renderbuffer_miptree() will release the existing
  miptree when wrapping a new DRI2 buffer, so we can remove the early
  release and so prevent a NULL mt dereference should importing the new
  DRI2 name fail for any reason. (Reusing the old DRI2 name will result
  in the rendering going astray, to a stale buffer, and not shown on the
  screen, but it allows us to issue a warning and not crash much later in
  innocent code.)
 
  Signed-off-by: Chris Wilson ch...@chris-wilson.co.uk
  ---
src/mesa/drivers/dri/i965/brw_context.c | 1 -
1 file changed, 1 deletion(-)
 
  diff --git a/src/mesa/drivers/dri/i965/brw_context.c 
  b/src/mesa/drivers/dri/i965/brw_context.c
  index e8d1396..72f3897 100644
  --- a/src/mesa/drivers/dri/i965/brw_context.c
  +++ b/src/mesa/drivers/dri/i965/brw_context.c
  @@ -1388,7 +1388,6 @@ intel_process_dri2_buffer(struct brw_context *brw,
  buffer-cpp, buffer-pitch);
   }

  -   intel_miptree_release(rb-mt);
   bo = drm_intel_bo_gem_create_from_name(brw-bufmgr, buffer_name,
  buffer-name);
   if (!bo) {
 
 Bugzilla: https://bugs.freedesktop.org/show_bug.cgi?id=86281
 Reviewed-by: Martin Peres martin.pe...@linux.intel.com
 
 If no-one has any objection, I will push the patch tomorrow to avoid the 
 crashes experienced by a lot of users, myself included!

(resending with Chris's actual email...sorry!)

This seems reasonable from a robustness point of view - try to limp
along a bit further and hope the import works next time, somehow.

That said, I do have one concern: we might get into trouble with
multisample buffers.

In the multisample case, irb-mt is the MSAA buffer, and
irb-singlesample_mt is the actual single-sampled DRI2 buffer.

Previously, this call always released irb-mt, deleting the MSAA buffer
every time.  Then, intel_update_winsys_renderbuffer_miptree would hit
the !irb-mt case, creating a fresh new irb-mt, and setting
irb-need_downsample = false.  That may not happen now, which is a
subtle change.  (It might be OK...)

If front buffer drawing, we call intel_renderbuffer_upsample(), which
asserts that irb-need_downsample == false.  So...if somehow we hit this
path with a dirty multisample buffer and front buffer rendering...then
I think we'd assert fail and die.  I'm not sure if that can happen; it
at least seems unlikely...

Do you think the new multisampled behavior will work OK?  If so, perhaps
we can at least leave a note about it in the commit message.

Thanks!
--Ken


signature.asc
Description: This is a digitally signed message part.
___
mesa-dev mailing list
mesa-dev@lists.freedesktop.org
http://lists.freedesktop.org/mailman/listinfo/mesa-dev


[Mesa-dev] [Bug 91631] Clang static analysis of libtess shows undefined values and use of memory after free

2015-08-13 Thread bugzilla-daemon
https://bugs.freedesktop.org/show_bug.cgi?id=91631

Bug ID: 91631
   Summary: Clang static analysis of libtess shows undefined
values and use of memory after free
   Product: Mesa
   Version: git
  Hardware: All
OS: All
Status: NEW
  Severity: major
  Priority: medium
 Component: GLU
  Assignee: mesa-dev@lists.freedesktop.org
  Reporter: net...@gmail.com
QA Contact: mesa-dev@lists.freedesktop.org

Using static analyzer included in clang 3.6.2:
$ ./autogen.sh 
$ ./configure
$ scan-build make
  CC   src/libtess/dict.lo
  CC   src/libtess/geom.lo
  CC   src/libtess/memalloc.lo
  CC   src/libtess/mesh.lo
  CC   src/libtess/normal.lo
src/libtess/normal.c:112:6: warning: Assigned value is garbage or undefined
  v1 = minVert[i];
 ^ ~~
src/libtess/normal.c:113:6: warning: Assigned value is garbage or undefined
  v2 = maxVert[i];
 ^ ~~
2 warnings generated.
  CC   src/libtess/priorityq.lo
  CC   src/libtess/render.lo
  CC   src/libtess/sweep.lo
src/libtess/sweep.c:779:11: warning: Use of memory after it is freed
if( ! regUp-dirty ) {
  ^~~~
src/libtess/sweep.c:803:10: warning: Use of memory after it is freed
  eLo = regLo-eUp;
^~
src/libtess/sweep.c:808:10: warning: Use of memory after it is freed
  eUp = regUp-eUp;
^~
3 warnings generated.

-- 
You are receiving this mail because:
You are the QA Contact for the bug.
You are the assignee for the bug.
___
mesa-dev mailing list
mesa-dev@lists.freedesktop.org
http://lists.freedesktop.org/mailman/listinfo/mesa-dev


Re: [Mesa-dev] [PATCH] tgsi/nouveau: Add support for tesselation ctrl and tesselation eval

2015-08-13 Thread Ilia Mirkin
On Fri, Aug 14, 2015 at 12:25 AM, Marcos Souza
marcos.souza@gmail.com wrote:
 Hi Ilia,

 2015-08-14 1:02 GMT-03:00 Ilia Mirkin imir...@alum.mit.edu:

 On Thu, Aug 13, 2015 at 11:55 PM, Marcos Souza
 marcos.souza@gmail.com wrote:
  Hi Ilia,
 
  So i found the point here it addrs that double brackets, and the
  following
  patch solves it, but this is a right solution? If someone could guide me
  here, I could fix it :)
 
  diff --git a/src/gallium/auxiliary/tgsi/tgsi_dump.c
  b/src/gallium/auxiliary/tgsi/tgsi_dump.c
  index 8ceb5b4..046471e 100644
  --- a/src/gallium/auxiliary/tgsi/tgsi_dump.c
  +++ b/src/gallium/auxiliary/tgsi/tgsi_dump.c
  @@ -302,10 +302,14 @@ iter_declaration(
 TXT([]);
  }
 
  -   if (decl-Declaration.Dimension) {

 The issue is that the declaration is getting a dimension set by the
 parser, which in turn is causing it to print funny. It shouldn't be
 getting a dimension in the first place for those.


 The following patch fix the problem, is it the right place to put it?

I don't think so. Just glanced at the code, look at

parse_register_dcl

  /* for geometry shader we don't really care about
   * the first brackets it's always the size of the
   * input primitive. so we want to declare just
   * the index relevant to the semantics which is in
   * the second bracket */
  if (ctx-processor == TGSI_PROCESSOR_GEOMETRY  *file ==
TGSI_FILE_INPUT) {
 brackets[0] = brackets[1];
 *num_brackets = 1;
  }

Basically you need to extend this logic to similarly exclude

(a) tess ctrl inputs and outputs
(b) tess eval inputs

Technically you need to exclude patch/tessinner/tessouter from that,
but in practice they won't have an extra set of brackets either.


 diff --git a/src/gallium/auxiliary/tgsi/tgsi_text.c
 b/src/gallium/auxiliary/tgsi/tgsi_text.c
 index 8647e4e..f734d58 100644
 --- a/src/gallium/auxiliary/tgsi/tgsi_text.c
 +++ b/src/gallium/auxiliary/tgsi/tgsi_text.c
 @@ -1185,7 +1185,10 @@ static boolean parse_declaration( struct
 translate_ctx *ctx )
decl.Range.First = brackets[1].first;
decl.Range.Last = brackets[1].last;

 -  decl.Declaration.Dimension = 1;
 +  if (!(ctx-processor == TGSI_PROCESSOR_TESS_CTRL ||
 + ctx-processor == TGSI_PROCESSOR_TESS_EVAL))
 + decl.Declaration.Dimension = 1;
 +
decl.Dim.Index2D = brackets[0].first;
 }





  -  CHR('[');
  -  SID(decl-Dim.Index2D);
  -  CHR(']');
  +   /* FIXME: patched version could have tree dimensions?? */
  +   if (patch  (iter-processor.Processor == TGSI_PROCESSOR_TESS_CTRL
  ||
  +  iter-processor.Processor == TGSI_PROCESSOR_TESS_EVAL)) {
  +  if (decl-Declaration.Dimension) {
  + CHR('[');
  + SID(decl-Dim.Index2D);
  + CHR(']');
  +  }
  }
 
  After this patch, tess_eval output is the same before and after, but
  tess_ctrl is a little different:
  [marcos@x mesa]$ diff tess_ctrl tess_ctrl_new
  29c29
15: LRP OUT[ADDR[1].x][3], TEMP[1]., TEMP[3], TEMP[2]
  ---
   15: LRP OUT[0][3], TEMP[1]., TEMP[3], TEMP[2]
  40c40
26: MOV OUT[ADDR[1].x][2], TEMP[0]
  ---
   26: MOV OUT[0][2], TEMP[0]
 
  I'll try to investigate and send a new patch in the weekend.
 
  Thanks for all help Ilia and others!
 
  2015-08-13 18:43 GMT-03:00 Ilia Mirkin imir...@alum.mit.edu:
 
  [mesa-dev readded, please don't drop CC's]
 
  I found it by feeding the shader to nouveau_compiler with
  NV50_PROG_DEBUG=1 set, which dumps the input tgsi. Those two should
  match up.
 
  On Thu, Aug 13, 2015 at 5:39 PM, Marcos Paulo de souza
  marcos.souza@gmail.com wrote:
   Hi Ilia,
  
   So, how can I test it? Do I need to especify some patameter to verify
   this
   type of problem?
  
   Thanks for the quick revision!
  
  
   Em 13-08-2015 16:03, Ilia Mirkin escreveu:
  
   Hi Macros,
  
   Looks like it's not parsed in exactly right. It will parse something
   like
  
   TESS_EVAL
   PROPERTY TES_PRIM_MODE 7
   PROPERTY TES_SPACING 2
   PROPERTY TES_VERTEX_ORDER_CW 0
   PROPERTY TES_POINT_MODE 0
   DCL IN[][0], GENERIC[0]
   DCL IN[][1], GENERIC[1]
  
   as
  
   TESS_EVAL
   PROPERTY TES_PRIM_MODE 7
   PROPERTY TES_SPACING 2
   PROPERTY TES_VERTEX_ORDER_CW 0
   PROPERTY TES_POINT_MODE 0
   DCL IN[][0][0], GENERIC[0]
   DCL IN[][0][1], GENERIC[1]
  
   Perhaps the same issue happens for geometry shaders, but that
   doesn't
   make it right :) You might have to look at the printing logic to get
   a
   better understanding of what's going wrong.
  
   Also you should send patches to nouveau separately from patches to
   the
   rest of the infra. Ideally this would have been 2 patches, e.g.
  
   tgsi: set implicit array size for tess stages
   nouveau: recognize tess stages in nouveau_compiler
  
   or something like that.
  
   On Wed, Aug 12, 2015 at 9:25 PM, Marcos Paulo de Souza
   marcos.souza@gmail.com wrote:
  
   From: Marcos Paulo de Souza marcos.souza@gmail.com
  

Re: [Mesa-dev] [PATCH v2] gles/es3.1: Implement glMemoryBarrierByRegion

2015-08-13 Thread Tapani Pälli



On 08/07/2015 12:56 PM, Tapani Pälli wrote:

Super, I've verified that this makes
ES31-CTS.shader_image_load_store.basic-api-barrier-byRegion pass with
one of Curro's branches.

Reviewed-by: Tapani Pälli tapani.pa...@intel.com


Urgh should've tested this before but now I noticed that 'make check' 
does not pass with this.


This function is part of OpenGL 4.5 so we need to move it to GL4x.xml 
and expose it in gl_core_functions_possible in dispatch_sanity.cpp (with 
version 45). However, 'make check' still fails with these changes, I'm 
trying to figure out why. The failing test is GL30 where function ends 
up (no matter what GL version specified in entry).




On 08/04/2015 11:22 AM, Marta Lofstedt wrote:

From: Marta Lofstedt marta.lofst...@intel.com

Signed-off-by: Marta Lofstedt marta.lofst...@intel.com
---
  src/mapi/glapi/gen/gl_API.xml   |  4 
  src/mesa/main/shaderimage.c | 40
+
  src/mesa/main/shaderimage.h |  3 +++
  src/mesa/main/tests/dispatch_sanity.cpp |  3 +--
  4 files changed, 48 insertions(+), 2 deletions(-)

diff --git a/src/mapi/glapi/gen/gl_API.xml
b/src/mapi/glapi/gen/gl_API.xml
index 658efa4..3db4349 100644
--- a/src/mapi/glapi/gen/gl_API.xml
+++ b/src/mapi/glapi/gen/gl_API.xml
@@ -2966,6 +2966,10 @@
  param name=height type=GLsizei/
  glx rop=191/
  /function
+
+function name=MemoryBarrierByRegion es2=3.1
+param name=barriers type=GLbitfield/
+/function
  /category

  category name=1.1
diff --git a/src/mesa/main/shaderimage.c b/src/mesa/main/shaderimage.c
index a348cdb..7337f22 100644
--- a/src/mesa/main/shaderimage.c
+++ b/src/mesa/main/shaderimage.c
@@ -653,3 +653,43 @@ _mesa_MemoryBarrier(GLbitfield barriers)
 if (ctx-Driver.MemoryBarrier)
ctx-Driver.MemoryBarrier(ctx, barriers);
  }
+
+void GLAPIENTRY
+_mesa_MemoryBarrierByRegion(GLbitfield barriers)
+{
+   GET_CURRENT_CONTEXT(ctx);
+
+   GLbitfield all_allowed_bits = GL_ATOMIC_COUNTER_BARRIER_BIT |
+ GL_FRAMEBUFFER_BARRIER_BIT |
+ GL_SHADER_IMAGE_ACCESS_BARRIER_BIT |
+ GL_SHADER_STORAGE_BARRIER_BIT |
+ GL_TEXTURE_FETCH_BARRIER_BIT |
+ GL_UNIFORM_BARRIER_BIT;
+
+   if (ctx-Driver.MemoryBarrier) {
+  /* From section 7.11.2 of the OpenGL ES 3.1 specification:
+   *
+   *When barriers is ALL_BARRIER_BITS, shader memory
accesses will be
+   * synchronized relative to all these barrier bits, but not
to other
+   * barrier bits specific to MemoryBarrier.
+   *
+   * That is, if barriers is the special value
GL_ALL_BARRIER_BITS, then all
+   * barriers allowed by glMemoryBarrierByRegion should be
activated.
+   */
+  if (barriers == GL_ALL_BARRIER_BITS)
+ return ctx-Driver.MemoryBarrier(ctx, all_allowed_bits);
+
+  /* From section 7.11.2 of the OpenGL ES 3.1 specification:
+   *
+   *An INVALID_VALUE error is generated if barriers is not
the special
+   * value ALL_BARRIER_BITS, and has any bits set other than
those
+   * described above.
+   */
+  if ((barriers  ~all_allowed_bits) != 0) {
+ _mesa_error(ctx, GL_INVALID_VALUE,
+ glMemoryBarrierByRegion(unsupported barrier bit);
+  }
+
+  ctx-Driver.MemoryBarrier(ctx, barriers);
+   }
+}
diff --git a/src/mesa/main/shaderimage.h b/src/mesa/main/shaderimage.h
index 33d8a1e..d08ece8 100644
--- a/src/mesa/main/shaderimage.h
+++ b/src/mesa/main/shaderimage.h
@@ -68,6 +68,9 @@ _mesa_BindImageTextures(GLuint first, GLsizei count,
const GLuint *textures);
  void GLAPIENTRY
  _mesa_MemoryBarrier(GLbitfield barriers);

+void GLAPIENTRY
+_mesa_MemoryBarrierByRegion(GLbitfield barriers);
+
  #ifdef __cplusplus
  }
  #endif
diff --git a/src/mesa/main/tests/dispatch_sanity.cpp
b/src/mesa/main/tests/dispatch_sanity.cpp
index af89d2c..14c9eda 100644
--- a/src/mesa/main/tests/dispatch_sanity.cpp
+++ b/src/mesa/main/tests/dispatch_sanity.cpp
@@ -2461,8 +2461,7 @@ const struct function
gles31_functions_possible[] = {
 { glGetBooleani_v, 31, -1 },
 { glMemoryBarrier, 31, -1 },

-   // FINISHME: This function has not been implemented yet.
-   // { glMemoryBarrierByRegion, 31, -1 },
+   { glMemoryBarrierByRegion, 31, -1 },

 { glTexStorage2DMultisample, 31, -1 },
 { glGetMultisamplefv, 31, -1 },


___
mesa-dev mailing list
mesa-dev@lists.freedesktop.org
http://lists.freedesktop.org/mailman/listinfo/mesa-dev

___
mesa-dev mailing list
mesa-dev@lists.freedesktop.org
http://lists.freedesktop.org/mailman/listinfo/mesa-dev


Re: [Mesa-dev] [PATCH] tgsi/nouveau: Add support for tesselation ctrl and tesselation eval

2015-08-13 Thread Ilia Mirkin
On Fri, Aug 14, 2015 at 12:43 AM, Marcos Souza
marcos.souza@gmail.com wrote:
 HI Ilia

 2015-08-14 1:31 GMT-03:00 Ilia Mirkin imir...@alum.mit.edu:

 On Fri, Aug 14, 2015 at 12:25 AM, Marcos Souza
 marcos.souza@gmail.com wrote:
  Hi Ilia,
 
  2015-08-14 1:02 GMT-03:00 Ilia Mirkin imir...@alum.mit.edu:
 
  On Thu, Aug 13, 2015 at 11:55 PM, Marcos Souza
  marcos.souza@gmail.com wrote:
   Hi Ilia,
  
   So i found the point here it addrs that double brackets, and the
   following
   patch solves it, but this is a right solution? If someone could guide
   me
   here, I could fix it :)
  
   diff --git a/src/gallium/auxiliary/tgsi/tgsi_dump.c
   b/src/gallium/auxiliary/tgsi/tgsi_dump.c
   index 8ceb5b4..046471e 100644
   --- a/src/gallium/auxiliary/tgsi/tgsi_dump.c
   +++ b/src/gallium/auxiliary/tgsi/tgsi_dump.c
   @@ -302,10 +302,14 @@ iter_declaration(
  TXT([]);
   }
  
   -   if (decl-Declaration.Dimension) {
 
  The issue is that the declaration is getting a dimension set by the
  parser, which in turn is causing it to print funny. It shouldn't be
  getting a dimension in the first place for those.
 
 
  The following patch fix the problem, is it the right place to put it?

 I don't think so. Just glanced at the code, look at

 parse_register_dcl

   /* for geometry shader we don't really care about
* the first brackets it's always the size of the
* input primitive. so we want to declare just
* the index relevant to the semantics which is in
* the second bracket */
   if (ctx-processor == TGSI_PROCESSOR_GEOMETRY  *file ==
 TGSI_FILE_INPUT) {
  brackets[0] = brackets[1];
  *num_brackets = 1;
   }

 Basically you need to extend this logic to similarly exclude

 (a) tess ctrl inputs and outputs
 (b) tess eval inputs

 Technically you need to exclude patch/tessinner/tessouter from that,
 but in practice they won't have an extra set of brackets either.


 Sorry for flooding the list, but I'm relaly excited about it :)

 So, this is the change you asked. It also solved the problem:
 diff --git a/src/gallium/auxiliary/tgsi/tgsi_text.c
 b/src/gallium/auxiliary/tgsi/tgsi_text.c
 index 8647e4e..95c1daf 100644
 --- a/src/gallium/auxiliary/tgsi/tgsi_text.c
 +++ b/src/gallium/auxiliary/tgsi/tgsi_text.c
 @@ -684,7 +684,12 @@ parse_register_dcl(
 * input primitive. so we want to declare just
 * the index relevant to the semantics which is in
 * the second bracket */
 -  if (ctx-processor == TGSI_PROCESSOR_GEOMETRY  *file ==
 TGSI_FILE_INPUT) {
 +
 +  /* similarly from tessalation */

tessellation

 +  int exclude = (ctx-processor == TGSI_PROCESSOR_TESS_EVAL  *file ==
 TGSI_FILE_INPUT) ||
 +  (ctx-processor == TGSI_PROCESSOR_TESS_CTRL  (*file ==
 TGSI_FILE_INPUT ||
 + *file == TGSI_FILE_OUTPUT));

Why is this separate from the geometry thing?

 +  if ((ctx-processor == TGSI_PROCESSOR_GEOMETRY  *file ==
 TGSI_FILE_INPUT) || exclude) {
   brackets[0] = brackets[1];
   *num_brackets = 1;
} else {

 What do you think Ilia?

Generally sounds good.

  -ilia
___
mesa-dev mailing list
mesa-dev@lists.freedesktop.org
http://lists.freedesktop.org/mailman/listinfo/mesa-dev


Re: [Mesa-dev] [PATCH] tgsi/nouveau: Add support for tesselation ctrl and tesselation eval

2015-08-13 Thread Ilia Mirkin
On Thu, Aug 13, 2015 at 11:55 PM, Marcos Souza
marcos.souza@gmail.com wrote:
 Hi Ilia,

 So i found the point here it addrs that double brackets, and the following
 patch solves it, but this is a right solution? If someone could guide me
 here, I could fix it :)

 diff --git a/src/gallium/auxiliary/tgsi/tgsi_dump.c
 b/src/gallium/auxiliary/tgsi/tgsi_dump.c
 index 8ceb5b4..046471e 100644
 --- a/src/gallium/auxiliary/tgsi/tgsi_dump.c
 +++ b/src/gallium/auxiliary/tgsi/tgsi_dump.c
 @@ -302,10 +302,14 @@ iter_declaration(
TXT([]);
 }

 -   if (decl-Declaration.Dimension) {

The issue is that the declaration is getting a dimension set by the
parser, which in turn is causing it to print funny. It shouldn't be
getting a dimension in the first place for those.

 -  CHR('[');
 -  SID(decl-Dim.Index2D);
 -  CHR(']');
 +   /* FIXME: patched version could have tree dimensions?? */
 +   if (patch  (iter-processor.Processor == TGSI_PROCESSOR_TESS_CTRL ||
 +  iter-processor.Processor == TGSI_PROCESSOR_TESS_EVAL)) {
 +  if (decl-Declaration.Dimension) {
 + CHR('[');
 + SID(decl-Dim.Index2D);
 + CHR(']');
 +  }
 }

 After this patch, tess_eval output is the same before and after, but
 tess_ctrl is a little different:
 [marcos@x mesa]$ diff tess_ctrl tess_ctrl_new
 29c29
   15: LRP OUT[ADDR[1].x][3], TEMP[1]., TEMP[3], TEMP[2]
 ---
  15: LRP OUT[0][3], TEMP[1]., TEMP[3], TEMP[2]
 40c40
   26: MOV OUT[ADDR[1].x][2], TEMP[0]
 ---
  26: MOV OUT[0][2], TEMP[0]

 I'll try to investigate and send a new patch in the weekend.

 Thanks for all help Ilia and others!

 2015-08-13 18:43 GMT-03:00 Ilia Mirkin imir...@alum.mit.edu:

 [mesa-dev readded, please don't drop CC's]

 I found it by feeding the shader to nouveau_compiler with
 NV50_PROG_DEBUG=1 set, which dumps the input tgsi. Those two should
 match up.

 On Thu, Aug 13, 2015 at 5:39 PM, Marcos Paulo de souza
 marcos.souza@gmail.com wrote:
  Hi Ilia,
 
  So, how can I test it? Do I need to especify some patameter to verify
  this
  type of problem?
 
  Thanks for the quick revision!
 
 
  Em 13-08-2015 16:03, Ilia Mirkin escreveu:
 
  Hi Macros,
 
  Looks like it's not parsed in exactly right. It will parse something
  like
 
  TESS_EVAL
  PROPERTY TES_PRIM_MODE 7
  PROPERTY TES_SPACING 2
  PROPERTY TES_VERTEX_ORDER_CW 0
  PROPERTY TES_POINT_MODE 0
  DCL IN[][0], GENERIC[0]
  DCL IN[][1], GENERIC[1]
 
  as
 
  TESS_EVAL
  PROPERTY TES_PRIM_MODE 7
  PROPERTY TES_SPACING 2
  PROPERTY TES_VERTEX_ORDER_CW 0
  PROPERTY TES_POINT_MODE 0
  DCL IN[][0][0], GENERIC[0]
  DCL IN[][0][1], GENERIC[1]
 
  Perhaps the same issue happens for geometry shaders, but that doesn't
  make it right :) You might have to look at the printing logic to get a
  better understanding of what's going wrong.
 
  Also you should send patches to nouveau separately from patches to the
  rest of the infra. Ideally this would have been 2 patches, e.g.
 
  tgsi: set implicit array size for tess stages
  nouveau: recognize tess stages in nouveau_compiler
 
  or something like that.
 
  On Wed, Aug 12, 2015 at 9:25 PM, Marcos Paulo de Souza
  marcos.souza@gmail.com wrote:
 
  From: Marcos Paulo de Souza marcos.souza@gmail.com
 
  Signed-off-by: Marcos Paulo de Souza marcos.souza.org
  Suggested-by: Ilia Mirkin imir...@alum.mit.edu
  ---
src/gallium/auxiliary/tgsi/tgsi_text.c | 6 +-
src/gallium/drivers/nouveau/nouveau_compiler.c | 4 
2 files changed, 9 insertions(+), 1 deletion(-)
 
  diff --git a/src/gallium/auxiliary/tgsi/tgsi_text.c
  b/src/gallium/auxiliary/tgsi/tgsi_text.c
  index a6675c5..8647e4e 100644
  --- a/src/gallium/auxiliary/tgsi/tgsi_text.c
  +++ b/src/gallium/auxiliary/tgsi/tgsi_text.c
  @@ -259,7 +259,7 @@ struct translate_ctx
   struct tgsi_token *tokens_end;
   struct tgsi_header *header;
   unsigned processor : 4;
  -   int implied_array_size : 5;
  +   int implied_array_size : 6;
   unsigned num_immediates;
};
 
  @@ -1623,6 +1623,10 @@ static boolean translate( struct translate_ctx
  *ctx )
   if (!parse_header( ctx ))
  return FALSE;
 
  +   if (ctx-processor == TGSI_PROCESSOR_TESS_CTRL ||
  +   ctx-processor == TGSI_PROCESSOR_TESS_EVAL)
  +   ctx-implied_array_size = 32 ;
  +
   while (*ctx-cur != '\0') {
  uint label_val = 0;
  if (!eat_white( ctx-cur )) {
  diff --git a/src/gallium/drivers/nouveau/nouveau_compiler.c
  b/src/gallium/drivers/nouveau/nouveau_compiler.c
  index 8660498..495450b 100644
  --- a/src/gallium/drivers/nouveau/nouveau_compiler.c
  +++ b/src/gallium/drivers/nouveau/nouveau_compiler.c
  @@ -190,6 +190,10 @@ main(int argc, char *argv[])
  type = PIPE_SHADER_GEOMETRY;
   else if (!strncmp(text, COMP, 4))
  type = PIPE_SHADER_COMPUTE;
  +   else if (!strncmp(text, TESS_CTRL, 9))
  +  type = PIPE_SHADER_TESS_CTRL;
  +   else if (!strncmp(text, TESS_EVAL, 9))
  +  type = 

Re: [Mesa-dev] [PATCH] tgsi/nouveau: Add support for tesselation ctrl and tesselation eval

2015-08-13 Thread Ilia Mirkin
On Fri, Aug 14, 2015 at 12:52 AM, Marcos Paulo de souza
marcos.souza@gmail.com wrote:
 Now I'll take a look about the last problem of LRP and MOV.

That should ideally have solved itself too... if not, do you have the
full shader that demonstrates the problem?
___
mesa-dev mailing list
mesa-dev@lists.freedesktop.org
http://lists.freedesktop.org/mailman/listinfo/mesa-dev


Re: [Mesa-dev] [Mesa-stable] [PATCH] radeonsi: add new OLAND pci id

2015-08-13 Thread Emil Velikov
On 13 August 2015 at 16:42, Alex Deucher alexdeuc...@gmail.com wrote:
 On Thu, Aug 13, 2015 at 11:11 AM, Emil Velikov emil.l.veli...@gmail.com 
 wrote:
 Hi Alex,

 On 10 August 2015 at 20:36, Alex Deucher alexdeuc...@gmail.com wrote:
 Signed-off-by: Alex Deucher alexander.deuc...@amd.com
 Cc: mesa-sta...@lists.freedesktop.org
 ---
  include/pci_ids/radeonsi_pci_ids.h | 1 +
  1 file changed, 1 insertion(+)

 diff --git a/include/pci_ids/radeonsi_pci_ids.h 
 b/include/pci_ids/radeonsi_pci_ids.h
 index c01ee20..52eada1 100644
 --- a/include/pci_ids/radeonsi_pci_ids.h
 +++ b/include/pci_ids/radeonsi_pci_ids.h
 @@ -63,6 +63,7 @@ CHIPSET(0x6608, OLAND_6608, OLAND)
  CHIPSET(0x6610, OLAND_6610, OLAND)
  CHIPSET(0x6611, OLAND_6611, OLAND)
  CHIPSET(0x6613, OLAND_6613, OLAND)
 +CHIPSET(0x6617, OLAND_6617, OLAND)
 Has there been any ideas/plans on getting this information
 consolidated in a single place ?

 It feels a bit dirty having the same information in four places -
 kernel, libdrm, ddx, mesa.

 There's not really a good solution that I know of due to the way X
 works.
If I have to guess, obtaining OLAND via DRM_IOCTL_RADEON_INFO won't be
impacted by (nor have any impact on) how X works. Shouldn't this just
work or there is something subtly off with the idea ? Can you
elaborate what part of X might be an obstacle ?

 Using xf86-video-modesetting saves one at least. And for
 amdgpu, we merged the surface manager into mesa rather than having it
 on libdrm since we always use glamor so we didn't need access to it in
 the ddx to support EXA.

True. Even if one day you want/have to do EXA xf86-video-amdgpu one
can always re-factor it out into libdrm_amdgpu. So the surface manager
is a win-win atm :)

Thanks
Emil
___
mesa-dev mailing list
mesa-dev@lists.freedesktop.org
http://lists.freedesktop.org/mailman/listinfo/mesa-dev


Re: [Mesa-dev] [PATCH] i915: BINDING_TABLE_POINTER_* after CONSTANT_* for SKL BXT

2015-08-13 Thread Ben Widawsky
On Thu, Aug 13, 2015 at 10:38:43AM +0300, Joonas Lahtinen wrote:
 Hi,
 
 On ke, 2015-08-12 at 18:34 -0700, Ben Widawsky wrote:
  On Wed, Aug 12, 2015 at 03:09:44PM +0300, Joonas Lahtinen wrote:
   Add a comment about reinforcing command order so that
   3DSTATE_BINDING_TABLE_POINTER_* commands are after
   3DSTATE_CONSTANT_* commands for SKL  BXT, otherwise the
   GPU might hang.
   
   Changing the BLORP code is not relevant (where the order
   is wrong), as it is not used for GEN8 or up.
   
   Cc: Mika Kuoppala mika.kuopp...@linux.intel.com
   Cc: Arun Siluvery arun.siluv...@linux.intel.com
   Signed-off-by: Joonas Lahtinen joonas.lahti...@linux.intel.com
   ---
src/mesa/drivers/dri/i965/brw_state_upload.c | 6 +++---
1 file changed, 3 insertions(+), 3 deletions(-)
   
   diff --git a/src/mesa/drivers/dri/i965/brw_state_upload.c 
   b/src/mesa/drivers/dri/i965/brw_state_upload.c
   index 9de42ce..9078e11 100644
   --- a/src/mesa/drivers/dri/i965/brw_state_upload.c
   +++ b/src/mesa/drivers/dri/i965/brw_state_upload.c
   @@ -299,9 +299,9 @@ static const struct brw_tracked_state 
   *gen8_render_atoms[] =
   brw_wm_abo_surfaces,
   gen6_renderbuffer_surfaces,
   brw_texture_surfaces,
   -   brw_vs_binding_table,
   -   brw_gs_binding_table,
   -   brw_wm_binding_table,
   +   brw_vs_binding_table, /* Must come after vs_push_constants for 
   Skylake and Broxton. */
   +   brw_gs_binding_table, /* Must come after gs_push_constants for 
   Skylake and Broxton. */
   +   brw_wm_binding_table, /* Must come after wm_push_constants for 
   Skylake and Broxton. */

   brw_fs_samplers,
   brw_vs_samplers,
  
  Does anyone understand why this actually causes a hang on the IGT 
  test? I
  certainly don't. The docs are pretty clear that the constant command 
  is not
  committed until the BTP command, but I can't make any sense of how it 
  related to
  a GPU hang.
  
 
 Discussion about this continued in the driver list.
 
  In any event, I don't think the comments are super useful, but 
  they're not
  harmful either. I'd suggest one line instead:
  NOTE: push_constant_ff must precede binding table pointer upload
  
 
 The table previously seemed to contain per-line comments for other
 ordering restrictions, so I just went with style that looks consitent
 with the rest. Also it makes some sense, as it's only the respective
 3DSTATE_CONSTANT_* whose parsing is triggered by matching a
 3DSTATE_BINDING_TABLE_POINTER_* command. They could be interleaved too.
 
 I'll correct the s/i915/i965/ as noted by Matt. How about the comments?

Whatever you like. Ideally we'd probably try to capture such things in the atom
debugging, but I did look at that code, and it seems like it'd be a pain to add
for no real gain.

 
 Regards, Joonas
 
  Reviewed-by: Ben Widawsky b...@bwidawsk.net
___
mesa-dev mailing list
mesa-dev@lists.freedesktop.org
http://lists.freedesktop.org/mailman/listinfo/mesa-dev


Re: [Mesa-dev] [PATCH v4 (part2) 46/59] glsl: Allow use of memory qualifiers with ARB_shader_storage_buffer_object.

2015-08-13 Thread Iago Toral
Thanks Tapani, I'll look into this as soon as I get back from holidays. 
The implementation has changed slightly since I sent these patches too 
btw.


Iago

El 2015-08-13 10:05, Tapani Pälli escribió:

Hi;

I believe something more needs to be done here, it may be generic
changes to the memory qualifier parsing. I wrote a Piglit test that
fails with these changes (I tested against
itoral-ARB_shader_storage_buffer_object-v4.1 branch), here:

http://lists.freedesktop.org/archives/piglit/2015-August/016777.html


On 08/05/2015 11:30 AM, Iago Toral Quiroga wrote:

---
  src/glsl/glsl_lexer.ll | 10 +-
  1 file changed, 5 insertions(+), 5 deletions(-)

diff --git a/src/glsl/glsl_lexer.ll b/src/glsl/glsl_lexer.ll
index efa0bb6..b9d700a 100644
--- a/src/glsl/glsl_lexer.ll
+++ b/src/glsl/glsl_lexer.ll
@@ -405,11 +405,11 @@ image2DShadow   KEYWORD(130, 300, 0, 0, 
IMAGE2DSHADOW);

  image1DArrayShadow  KEYWORD(130, 300, 0, 0, IMAGE1DARRAYSHADOW);
  image2DArrayShadow  KEYWORD(130, 300, 0, 0, IMAGE2DARRAYSHADOW);

-coherent	KEYWORD_WITH_ALT(420, 300, 420, 0, 
yyextra-ARB_shader_image_load_store_enable, COHERENT);
-volatile	KEYWORD_WITH_ALT(110, 100, 420, 0, 
yyextra-ARB_shader_image_load_store_enable, VOLATILE);
-restrict	KEYWORD_WITH_ALT(420, 300, 420, 0, 
yyextra-ARB_shader_image_load_store_enable, RESTRICT);
-readonly	KEYWORD_WITH_ALT(420, 300, 420, 0, 
yyextra-ARB_shader_image_load_store_enable, READONLY);
-writeonly	KEYWORD_WITH_ALT(420, 300, 420, 0, 
yyextra-ARB_shader_image_load_store_enable, WRITEONLY);
+coherent   KEYWORD_WITH_ALT(420, 300, 420, 0, 
yyextra-ARB_shader_image_load_store_enable || 
yyextra-ARB_shader_storage_buffer_object_enable, COHERENT);
+volatile   KEYWORD_WITH_ALT(110, 100, 420, 0, 
yyextra-ARB_shader_image_load_store_enable || 
yyextra-ARB_shader_storage_buffer_object_enable, VOLATILE);
+restrict   KEYWORD_WITH_ALT(420, 300, 420, 0, 
yyextra-ARB_shader_image_load_store_enable || 
yyextra-ARB_shader_storage_buffer_object_enable, RESTRICT);
+readonly   KEYWORD_WITH_ALT(420, 300, 420, 0, 
yyextra-ARB_shader_image_load_store_enable || 
yyextra-ARB_shader_storage_buffer_object_enable, READONLY);
+writeonly  KEYWORD_WITH_ALT(420, 300, 420, 0, 
yyextra-ARB_shader_image_load_store_enable || 
yyextra-ARB_shader_storage_buffer_object_enable, WRITEONLY);


  atomic_uint KEYWORD_WITH_ALT(420, 300, 420, 310, 
yyextra-ARB_shader_atomic_counters_enable, ATOMIC_UINT);




___
mesa-dev mailing list
mesa-dev@lists.freedesktop.org
http://lists.freedesktop.org/mailman/listinfo/mesa-dev


Re: [Mesa-dev] [PATCH v3 4/5] i965: handle nir_intrinsic_image_size

2015-08-13 Thread Pohjolainen, Topi
On Thu, Aug 13, 2015 at 08:00:43PM +0300, Martin Peres wrote:
 v2, Review from Francisco Jerez:
 - avoid the camelCase for the booleans
 - init the booleans using the sampler type
 - force the initialization of all the components of the output register
 
 Signed-off-by: Martin Peres martin.pe...@linux.intel.com
 ---
  src/mesa/drivers/dri/i965/brw_fs_nir.cpp | 48 
 
  1 file changed, 48 insertions(+)
 
 diff --git a/src/mesa/drivers/dri/i965/brw_fs_nir.cpp 
 b/src/mesa/drivers/dri/i965/brw_fs_nir.cpp
 index ce4153d..cc0a5a6 100644
 --- a/src/mesa/drivers/dri/i965/brw_fs_nir.cpp
 +++ b/src/mesa/drivers/dri/i965/brw_fs_nir.cpp
 @@ -1406,6 +1406,54 @@ fs_visitor::nir_emit_intrinsic(const fs_builder bld, 
 nir_intrinsic_instr *instr
break;
 }
  
 +   case nir_intrinsic_image_size: {
 +  /* Get the referenced image variable and type. */
 +  const nir_variable *var = instr-variables[0]-var;
 +  const glsl_type *type = var-type-without_array();
 +  const brw_reg_type base_type = get_image_base_type(type);
 +
 +  /* Get the size of the image. */
 +  const fs_reg image = get_nir_image_deref(instr-variables[0]);
 +  const fs_reg size = offset(image, bld, BRW_IMAGE_PARAM_SIZE_OFFSET);
 +
 +  /*
 +   * For 1DArray image types, the array index is stored in the Z 
 component.

Just a few style nits from my part.

Usually (and in the rest of the file being modified) multi-line comments do
not have separate first line, instead:

 /* For 1DArray image types, the array index is stored in the Z
  * component.

 +   * Fix this by swizzling the Z component to the Y component.
 +   */
 +  const bool is_1d_array_image =
 +  (type-sampler_dimensionality == GLSL_SAMPLER_DIM_1D 
 +   type-sampler_array);

Indentation here looks a little odd and you can drop the extra (). I would
write this:

 const bool is_1d_array_image =
type-sampler_dimensionality == GLSL_SAMPLER_DIM_1D 
type-sampler_array;

Same comments just below.

 +
 +  /*
 +   * For CubeMapArray images, we should count the number of cubes instead
 +   * of the number of faces. Fix it by dividing the (Z component) by 6.
 +   */
 +  const bool is_cube_map_array_image =
 +  (type-sampler_dimensionality == GLSL_SAMPLER_DIM_CUBE 
 +   type-sampler_array);
 +
 +  /* Copy all the components. */
 +  const nir_intrinsic_info *info = 
 nir_intrinsic_infos[instr-intrinsic];
 +  for (int c = 0; c  info-dest_components; ++c) {
 + if (c  type-coordinate_components()) {
 + bld.MOV(offset(retype(dest, base_type), bld, c),
 + fs_reg(1));
 + } else if (c == 1  is_1d_array_image) {
 +bld.MOV(offset(retype(dest, base_type), bld, c),
 +offset(size, bld, 2));
 + } else if (c == 2  is_cube_map_array_image) {
 +bld.emit(SHADER_OPCODE_INT_QUOTIENT,
 + offset(retype(dest, base_type), bld, c),
 + offset(size, bld, c), fs_reg(6));
 + } else {
 +bld.MOV(offset(retype(dest, base_type), bld, c),
 +offset(size, bld, c));
 + }
 +   }
 +
 +  break;
 +   }
 +
 case nir_intrinsic_load_front_face:
bld.MOV(retype(dest, BRW_REGISTER_TYPE_D),
*emit_frontfacing_interpolation());
 -- 
 2.5.0
 
 ___
 mesa-dev mailing list
 mesa-dev@lists.freedesktop.org
 http://lists.freedesktop.org/mailman/listinfo/mesa-dev
___
mesa-dev mailing list
mesa-dev@lists.freedesktop.org
http://lists.freedesktop.org/mailman/listinfo/mesa-dev


Re: [Mesa-dev] [PATCH v2] gles/es3.1: Implement glMemoryBarrierByRegion

2015-08-13 Thread Tapani Pälli



On 08/14/2015 08:21 AM, Tapani Pälli wrote:



On 08/07/2015 12:56 PM, Tapani Pälli wrote:

Super, I've verified that this makes
ES31-CTS.shader_image_load_store.basic-api-barrier-byRegion pass with
one of Curro's branches.

Reviewed-by: Tapani Pälli tapani.pa...@intel.com


Urgh should've tested this before but now I noticed that 'make check'
does not pass with this.

This function is part of OpenGL 4.5 so we need to move it to GL4x.xml
and expose it in gl_core_functions_possible in dispatch_sanity.cpp (with
version 45). However, 'make check' still fails with these changes, I'm
trying to figure out why. The failing test is GL30 where function ends
up (no matter what GL version specified in entry).


I found that make check passes if I add 'desktop=false' to the xml entry 
making this function ES only. I guess we should go and do that to get 
forward.






On 08/04/2015 11:22 AM, Marta Lofstedt wrote:

From: Marta Lofstedt marta.lofst...@intel.com

Signed-off-by: Marta Lofstedt marta.lofst...@intel.com
---
  src/mapi/glapi/gen/gl_API.xml   |  4 
  src/mesa/main/shaderimage.c | 40
+
  src/mesa/main/shaderimage.h |  3 +++
  src/mesa/main/tests/dispatch_sanity.cpp |  3 +--
  4 files changed, 48 insertions(+), 2 deletions(-)

diff --git a/src/mapi/glapi/gen/gl_API.xml
b/src/mapi/glapi/gen/gl_API.xml
index 658efa4..3db4349 100644
--- a/src/mapi/glapi/gen/gl_API.xml
+++ b/src/mapi/glapi/gen/gl_API.xml
@@ -2966,6 +2966,10 @@
  param name=height type=GLsizei/
  glx rop=191/
  /function
+
+function name=MemoryBarrierByRegion es2=3.1
+param name=barriers type=GLbitfield/
+/function
  /category

  category name=1.1
diff --git a/src/mesa/main/shaderimage.c b/src/mesa/main/shaderimage.c
index a348cdb..7337f22 100644
--- a/src/mesa/main/shaderimage.c
+++ b/src/mesa/main/shaderimage.c
@@ -653,3 +653,43 @@ _mesa_MemoryBarrier(GLbitfield barriers)
 if (ctx-Driver.MemoryBarrier)
ctx-Driver.MemoryBarrier(ctx, barriers);
  }
+
+void GLAPIENTRY
+_mesa_MemoryBarrierByRegion(GLbitfield barriers)
+{
+   GET_CURRENT_CONTEXT(ctx);
+
+   GLbitfield all_allowed_bits = GL_ATOMIC_COUNTER_BARRIER_BIT |
+ GL_FRAMEBUFFER_BARRIER_BIT |
+ GL_SHADER_IMAGE_ACCESS_BARRIER_BIT |
+ GL_SHADER_STORAGE_BARRIER_BIT |
+ GL_TEXTURE_FETCH_BARRIER_BIT |
+ GL_UNIFORM_BARRIER_BIT;
+
+   if (ctx-Driver.MemoryBarrier) {
+  /* From section 7.11.2 of the OpenGL ES 3.1 specification:
+   *
+   *When barriers is ALL_BARRIER_BITS, shader memory
accesses will be
+   * synchronized relative to all these barrier bits, but not
to other
+   * barrier bits specific to MemoryBarrier.
+   *
+   * That is, if barriers is the special value
GL_ALL_BARRIER_BITS, then all
+   * barriers allowed by glMemoryBarrierByRegion should be
activated.
+   */
+  if (barriers == GL_ALL_BARRIER_BITS)
+ return ctx-Driver.MemoryBarrier(ctx, all_allowed_bits);
+
+  /* From section 7.11.2 of the OpenGL ES 3.1 specification:
+   *
+   *An INVALID_VALUE error is generated if barriers is not
the special
+   * value ALL_BARRIER_BITS, and has any bits set other than
those
+   * described above.
+   */
+  if ((barriers  ~all_allowed_bits) != 0) {
+ _mesa_error(ctx, GL_INVALID_VALUE,
+ glMemoryBarrierByRegion(unsupported barrier
bit);
+  }
+
+  ctx-Driver.MemoryBarrier(ctx, barriers);
+   }
+}
diff --git a/src/mesa/main/shaderimage.h b/src/mesa/main/shaderimage.h
index 33d8a1e..d08ece8 100644
--- a/src/mesa/main/shaderimage.h
+++ b/src/mesa/main/shaderimage.h
@@ -68,6 +68,9 @@ _mesa_BindImageTextures(GLuint first, GLsizei count,
const GLuint *textures);
  void GLAPIENTRY
  _mesa_MemoryBarrier(GLbitfield barriers);

+void GLAPIENTRY
+_mesa_MemoryBarrierByRegion(GLbitfield barriers);
+
  #ifdef __cplusplus
  }
  #endif
diff --git a/src/mesa/main/tests/dispatch_sanity.cpp
b/src/mesa/main/tests/dispatch_sanity.cpp
index af89d2c..14c9eda 100644
--- a/src/mesa/main/tests/dispatch_sanity.cpp
+++ b/src/mesa/main/tests/dispatch_sanity.cpp
@@ -2461,8 +2461,7 @@ const struct function
gles31_functions_possible[] = {
 { glGetBooleani_v, 31, -1 },
 { glMemoryBarrier, 31, -1 },

-   // FINISHME: This function has not been implemented yet.
-   // { glMemoryBarrierByRegion, 31, -1 },
+   { glMemoryBarrierByRegion, 31, -1 },

 { glTexStorage2DMultisample, 31, -1 },
 { glGetMultisamplefv, 31, -1 },


___
mesa-dev mailing list
mesa-dev@lists.freedesktop.org
http://lists.freedesktop.org/mailman/listinfo/mesa-dev

___
mesa-dev mailing list
mesa-dev@lists.freedesktop.org

Re: [Mesa-dev] [PATCH v2 2/3] mesa: validate size parameters for glTexStorage*Multisample

2015-08-13 Thread Tapani Pälli



On 08/13/2015 11:54 AM, Timothy Arceri wrote:

I've sent a couple of follow-up patches I notice when reviewing this.


On Thu, 2015-08-13 at 09:30 +0300, Tapani Pälli wrote:

v2: code cleanup

Signed-off-by: Tapani Pälli tapani.pa...@intel.com
---
  src/mesa/main/teximage.c | 24 
  1 file changed, 24 insertions(+)

diff --git a/src/mesa/main/teximage.c b/src/mesa/main/teximage.c
index d35dc12..add7438 100644
--- a/src/mesa/main/teximage.c
+++ b/src/mesa/main/teximage.c
@@ -5782,6 +5782,18 @@ _mesa_TexImage3DMultisample(GLenum target, GLsizei
samples,
 glTexImage3DMultisample);
  }

+static bool
+valid_texstorage_ms_parameters(GLsizei width, GLsizei height, GLsizei
depth,
+   GLsizei samples, unsigned dims)
+{
+   GET_CURRENT_CONTEXT(ctx);
+
+   if (_mesa_tex_storage_invalid_dim(width, height, depth) || samples  1)



Rather than do the samples  1 check here you should move it to
  _mesa_texture_image_multisample as the spec says An INVALID_VALUE error is
generated ifsamplesis zero. for glTexImage*Multisample too.

With that change you could change all the calls below to something like

if (_mesa_tex_storage_invalid_dim(width, height, depth)) {
   _mesa_error(ctx, GL_INVALID_VALUE, glTexStorage2DMultisample()
   return;
}


Would it be OK if we do possible unification for checking samples 
parameter after these patches? My goal here is to do check for 
glTexStorage*Multisample only. I don't feel comfortable changing checks 
for other functions at the same time, that should deserve it's own 
commit so it's easier to bisect later.



{
+  _mesa_error(ctx, GL_INVALID_VALUE, glTexStorage%uDMultisample(),
dims);
+  return false;
+   }
+   return true;
+}
  void GLAPIENTRY
  _mesa_TexStorage2DMultisample(GLenum target, GLsizei samples,
@@ -5795,6 +5807,9 @@ _mesa_TexStorage2DMultisample(GLenum target, GLsizei
samples,
 if (!texObj)
return;

+   if (!valid_texstorage_ms_parameters(width, height, 1, samples, 2))
+  return;
+
 _mesa_texture_image_multisample(ctx, 2, texObj, target, samples,
 internalformat, width, height, 1,
 fixedsamplelocations, GL_TRUE,
@@ -5814,6 +5829,9 @@ _mesa_TexStorage3DMultisample(GLenum target, GLsizei
samples,
 if (!texObj)
return;

+   if (!valid_texstorage_ms_parameters(width, height, depth, samples, 3))
+  return;
+
 _mesa_texture_image_multisample(ctx, 3, texObj, target, samples,
 internalformat, width, height, depth,
 fixedsamplelocations, GL_TRUE,
@@ -5834,6 +5852,9 @@ _mesa_TextureStorage2DMultisample(GLuint texture,
GLsizei samples,
 if (!texObj)
return;

+   if (!valid_texstorage_ms_parameters(width, height, 1, samples, 2))
+  return;
+
 _mesa_texture_image_multisample(ctx, 2, texObj, texObj-Target, samples,
 internalformat, width, height, 1,
 fixedsamplelocations, GL_TRUE,
@@ -5855,6 +5876,9 @@ _mesa_TextureStorage3DMultisample(GLuint texture,
GLsizei samples,
 if (!texObj)
return;

+   if (!valid_texstorage_ms_parameters(width, height, depth, samples, 3))
+  return;
+
 _mesa_texture_image_multisample(ctx, 3, texObj, texObj-Target, samples,
 internalformat, width, height, depth,
 fixedsamplelocations, GL_TRUE,

___
mesa-dev mailing list
mesa-dev@lists.freedesktop.org
http://lists.freedesktop.org/mailman/listinfo/mesa-dev


Re: [Mesa-dev] [PATCH v2] gles/es3.1: Implement glMemoryBarrierByRegion

2015-08-13 Thread Ilia Mirkin
On Mon, Aug 10, 2015 at 4:29 AM, Lofstedt, Marta
marta.lofst...@intel.com wrote:
 -Original Message-
 From: mesa-dev [mailto:mesa-dev-boun...@lists.freedesktop.org] On
 Behalf Of Ilia Mirkin
 Sent: Friday, August 7, 2015 9:56 PM
 To: Matt Turner
 Cc: mesa-dev@lists.freedesktop.org
 Subject: Re: [Mesa-dev] [PATCH v2] gles/es3.1: Implement
 glMemoryBarrierByRegion

 On Fri, Aug 7, 2015 at 2:18 PM, Matt Turner matts...@gmail.com wrote:
  On Tue, Aug 4, 2015 at 1:22 AM, Marta Lofstedt
  marta.lofst...@linux.intel.com wrote:
  From: Marta Lofstedt marta.lofst...@intel.com
 
  Signed-off-by: Marta Lofstedt marta.lofst...@intel.com
  ---
   src/mapi/glapi/gen/gl_API.xml   |  4 
   src/mesa/main/shaderimage.c | 40
 +
   src/mesa/main/shaderimage.h |  3 +++
   src/mesa/main/tests/dispatch_sanity.cpp |  3 +--
   4 files changed, 48 insertions(+), 2 deletions(-)
 
  diff --git a/src/mapi/glapi/gen/gl_API.xml
  b/src/mapi/glapi/gen/gl_API.xml index 658efa4..3db4349 100644
  --- a/src/mapi/glapi/gen/gl_API.xml
  +++ b/src/mapi/glapi/gen/gl_API.xml
  @@ -2966,6 +2966,10 @@
   param name=height type=GLsizei/
   glx rop=191/
   /function
  +
  +function name=MemoryBarrierByRegion es2=3.1
  +param name=barriers type=GLbitfield/
  +/function
   /category
 
   category name=1.1
  diff --git a/src/mesa/main/shaderimage.c
  b/src/mesa/main/shaderimage.c index a348cdb..7337f22 100644
  --- a/src/mesa/main/shaderimage.c
  +++ b/src/mesa/main/shaderimage.c
  @@ -653,3 +653,43 @@ _mesa_MemoryBarrier(GLbitfield barriers)
  if (ctx-Driver.MemoryBarrier)
 ctx-Driver.MemoryBarrier(ctx, barriers);  }
  +
  +void GLAPIENTRY
  +_mesa_MemoryBarrierByRegion(GLbitfield barriers) {
  +   GET_CURRENT_CONTEXT(ctx);
  +
  +   GLbitfield all_allowed_bits = GL_ATOMIC_COUNTER_BARRIER_BIT |
  + GL_FRAMEBUFFER_BARRIER_BIT |
  + GL_SHADER_IMAGE_ACCESS_BARRIER_BIT |
  + GL_SHADER_STORAGE_BARRIER_BIT |
  + GL_TEXTURE_FETCH_BARRIER_BIT |
  + GL_UNIFORM_BARRIER_BIT;
  +
  +   if (ctx-Driver.MemoryBarrier) {
  +  /* From section 7.11.2 of the OpenGL ES 3.1 specification:
  +   *
  +   *When barriers is ALL_BARRIER_BITS, shader memory accesses
 will be
  +   * synchronized relative to all these barrier bits, but not to 
  other
  +   * barrier bits specific to MemoryBarrier.
  +   *
  +   * That is, if barriers is the special value GL_ALL_BARRIER_BITS, 
  then
 all
  +   * barriers allowed by glMemoryBarrierByRegion should be
 activated.
  +   */
  +  if (barriers == GL_ALL_BARRIER_BITS)
  + return ctx-Driver.MemoryBarrier(ctx, all_allowed_bits);
  +
  +  /* From section 7.11.2 of the OpenGL ES 3.1 specification:
  +   *
  +   *An INVALID_VALUE error is generated if barriers is not the
 special
  +   * value ALL_BARRIER_BITS, and has any bits set other than 
  those
  +   * described above.
  +   */
  +  if ((barriers  ~all_allowed_bits) != 0) {
  + _mesa_error(ctx, GL_INVALID_VALUE,
  + glMemoryBarrierByRegion(unsupported barrier bit);
  +  }
  +
  +  ctx-Driver.MemoryBarrier(ctx, barriers);
  +   }
 
  Would probably be nice to put an unreachable(not implemented) as an
  else case for future implementors.
 
  Reviewed-by: Matt Turner matts...@gmail.com

 I wonder if this shouldn't just be

 if (!ctx-Driver.MemoryBarrier)
   INVALID_OPERATION

 But this is largely hypothetical... I'm not too worried about it.

 Hi Ilia,

 Since the patch isn't merged I assume you want me to change something, but I 
 am not sure what I should change.

 I see no consensus in the existing code on what to do at:
 If (!ctx-Driver.NNN)

 Ilia, are you suggesting that setting an INVALID_OPERATION should be the 
 new standard way of handling this?

Merely providing an alternative mechanism to write the same logic that
would not cause an extra indent level. and would produce an error when
called on a driver without MemoryBarrier implemented. But I don't feel
strongly about that. I assumed someone would actually be checking this
against various conformance tests and check it in [didn't even realize
that you didn't have push privileges, tbh].
___
mesa-dev mailing list
mesa-dev@lists.freedesktop.org
http://lists.freedesktop.org/mailman/listinfo/mesa-dev


Re: [Mesa-dev] [PATCH v3 2/5] glsl: add support for the imageSize builtin

2015-08-13 Thread Pohjolainen, Topi
On Thu, Aug 13, 2015 at 07:58:53PM +0300, Martin Peres wrote:
 The code is heavily inspired from Francisco Jerez's code supporting the
 image_load_store extension.
 
 Backends willing to support this builtin should handle
 __intrinsic_image_size.
 
 v2: Based on the review of Ilia Mirkin
 - Enable the extension for GLES 3.1
 - Fix indentation
 - Fix the return type (float to int, number of components for CubeImages)
 - Add a warning related to GLES 3.1
 
 v3: Based on the review of Francisco Jerez
 - Refactor the code to share both add_image_function and _image with the other
   image-related functions
 
 Signed-off-by: Martin Peres martin.pe...@linux.intel.com
 ---
  src/glsl/builtin_functions.cpp | 109 
 +++--
  1 file changed, 93 insertions(+), 16 deletions(-)
 
 diff --git a/src/glsl/builtin_functions.cpp b/src/glsl/builtin_functions.cpp
 index 2175c66..5d0a825 100644
 --- a/src/glsl/builtin_functions.cpp
 +++ b/src/glsl/builtin_functions.cpp
 @@ -399,6 +399,13 @@ shader_image_load_store(const _mesa_glsl_parse_state 
 *state)
  }
  
  static bool
 +shader_image_size(const _mesa_glsl_parse_state *state)
 +{
 +   return (state-is_version(430, 310) ||
 +   state-ARB_shader_image_size_enable);

You can drop the extra ().
___
mesa-dev mailing list
mesa-dev@lists.freedesktop.org
http://lists.freedesktop.org/mailman/listinfo/mesa-dev


[Mesa-dev] [PATCH 1/4] gallium: add an interface for EXT_depth_bounds_test

2015-08-13 Thread Marek Olšák
From: Marek Olšák marek.ol...@amd.com

---
 src/gallium/docs/source/screen.rst   | 3 +++
 src/gallium/drivers/freedreno/freedreno_screen.c | 1 +
 src/gallium/drivers/i915/i915_screen.c   | 1 +
 src/gallium/drivers/ilo/ilo_screen.c | 1 +
 src/gallium/drivers/llvmpipe/lp_screen.c | 1 +
 src/gallium/drivers/nouveau/nv30/nv30_screen.c   | 1 +
 src/gallium/drivers/nouveau/nv50/nv50_screen.c   | 1 +
 src/gallium/drivers/nouveau/nvc0/nvc0_screen.c   | 1 +
 src/gallium/drivers/r300/r300_screen.c   | 1 +
 src/gallium/drivers/r600/r600_pipe.c | 1 +
 src/gallium/drivers/radeonsi/si_pipe.c   | 1 +
 src/gallium/drivers/softpipe/sp_screen.c | 1 +
 src/gallium/drivers/svga/svga_screen.c   | 1 +
 src/gallium/drivers/vc4/vc4_screen.c | 1 +
 src/gallium/include/pipe/p_defines.h | 1 +
 src/gallium/include/pipe/p_state.h   | 3 +++
 16 files changed, 20 insertions(+)

diff --git a/src/gallium/docs/source/screen.rst 
b/src/gallium/docs/source/screen.rst
index c0b5eb3..2c0da01 100644
--- a/src/gallium/docs/source/screen.rst
+++ b/src/gallium/docs/source/screen.rst
@@ -264,6 +264,9 @@ The integer capabilities:
 * ``PIPE_CAP_TEXTURE_HALF_FLOAT_LINEAR``: Whether the linear minification and
   magnification filters are supported with half-precision floating-point
   textures.
+* ``PIPE_CAP_DEPTH_BOUNDS_TEST``: Whether bounds_test, bounds_min, and
+  bounds_max states of pipe_depth_stencil_alpha_state behave according
+  to the GL_EXT_depth_bounds_test specification.
 
 
 .. _pipe_capf:
diff --git a/src/gallium/drivers/freedreno/freedreno_screen.c 
b/src/gallium/drivers/freedreno/freedreno_screen.c
index 295ce7e..b55f5b3 100644
--- a/src/gallium/drivers/freedreno/freedreno_screen.c
+++ b/src/gallium/drivers/freedreno/freedreno_screen.c
@@ -232,6 +232,7 @@ fd_screen_get_param(struct pipe_screen *pscreen, enum 
pipe_cap param)
case PIPE_CAP_MAX_SHADER_PATCH_VARYINGS:
case PIPE_CAP_TEXTURE_FLOAT_LINEAR:
case PIPE_CAP_TEXTURE_HALF_FLOAT_LINEAR:
+   case PIPE_CAP_DEPTH_BOUNDS_TEST:
return 0;
 
case PIPE_CAP_MAX_VIEWPORTS:
diff --git a/src/gallium/drivers/i915/i915_screen.c 
b/src/gallium/drivers/i915/i915_screen.c
index 7608ca5..19a94a8 100644
--- a/src/gallium/drivers/i915/i915_screen.c
+++ b/src/gallium/drivers/i915/i915_screen.c
@@ -246,6 +246,7 @@ i915_get_param(struct pipe_screen *screen, enum pipe_cap 
cap)
case PIPE_CAP_MAX_SHADER_PATCH_VARYINGS:
case PIPE_CAP_TEXTURE_FLOAT_LINEAR:
case PIPE_CAP_TEXTURE_HALF_FLOAT_LINEAR:
+   case PIPE_CAP_DEPTH_BOUNDS_TEST:
   return 0;
 
case PIPE_CAP_MAX_DUAL_SOURCE_RENDER_TARGETS:
diff --git a/src/gallium/drivers/ilo/ilo_screen.c 
b/src/gallium/drivers/ilo/ilo_screen.c
index 9f150bb..ab4d137 100644
--- a/src/gallium/drivers/ilo/ilo_screen.c
+++ b/src/gallium/drivers/ilo/ilo_screen.c
@@ -468,6 +468,7 @@ ilo_get_param(struct pipe_screen *screen, enum pipe_cap 
param)
case PIPE_CAP_RESOURCE_FROM_USER_MEMORY:
case PIPE_CAP_DEVICE_RESET_STATUS_QUERY:
case PIPE_CAP_MAX_SHADER_PATCH_VARYINGS:
+   case PIPE_CAP_DEPTH_BOUNDS_TEST:
   return 0;
 
case PIPE_CAP_VENDOR_ID:
diff --git a/src/gallium/drivers/llvmpipe/lp_screen.c 
b/src/gallium/drivers/llvmpipe/lp_screen.c
index 539bb44..14eeab0 100644
--- a/src/gallium/drivers/llvmpipe/lp_screen.c
+++ b/src/gallium/drivers/llvmpipe/lp_screen.c
@@ -295,6 +295,7 @@ llvmpipe_get_param(struct pipe_screen *screen, enum 
pipe_cap param)
case PIPE_CAP_RESOURCE_FROM_USER_MEMORY:
case PIPE_CAP_DEVICE_RESET_STATUS_QUERY:
case PIPE_CAP_MAX_SHADER_PATCH_VARYINGS:
+   case PIPE_CAP_DEPTH_BOUNDS_TEST:
   return 0;
}
/* should only get here on unhandled cases */
diff --git a/src/gallium/drivers/nouveau/nv30/nv30_screen.c 
b/src/gallium/drivers/nouveau/nv30/nv30_screen.c
index 73bcd5b..efa766d 100644
--- a/src/gallium/drivers/nouveau/nv30/nv30_screen.c
+++ b/src/gallium/drivers/nouveau/nv30/nv30_screen.c
@@ -166,6 +166,7 @@ nv30_screen_get_param(struct pipe_screen *pscreen, enum 
pipe_cap param)
case PIPE_CAP_MAX_SHADER_PATCH_VARYINGS:
case PIPE_CAP_TEXTURE_FLOAT_LINEAR:
case PIPE_CAP_TEXTURE_HALF_FLOAT_LINEAR:
+   case PIPE_CAP_DEPTH_BOUNDS_TEST:
   return 0;
 
case PIPE_CAP_VENDOR_ID:
diff --git a/src/gallium/drivers/nouveau/nv50/nv50_screen.c 
b/src/gallium/drivers/nouveau/nv50/nv50_screen.c
index 1e19877..2479cbd 100644
--- a/src/gallium/drivers/nouveau/nv50/nv50_screen.c
+++ b/src/gallium/drivers/nouveau/nv50/nv50_screen.c
@@ -213,6 +213,7 @@ nv50_screen_get_param(struct pipe_screen *pscreen, enum 
pipe_cap param)
case PIPE_CAP_RESOURCE_FROM_USER_MEMORY:
case PIPE_CAP_DEVICE_RESET_STATUS_QUERY:
case PIPE_CAP_MAX_SHADER_PATCH_VARYINGS:
+   case PIPE_CAP_DEPTH_BOUNDS_TEST:
   return 0;
 
case PIPE_CAP_VENDOR_ID:
diff --git a/src/gallium/drivers/nouveau/nvc0/nvc0_screen.c 

[Mesa-dev] [PATCH 0/4] EXT_depth_bounds_test for Gallium / RadeonSI

2015-08-13 Thread Marek Olšák
Hi,

This is a simple feature that both Catalyst and NVIDIA support. Of all Radeons, 
only GCN can do it, so it's a pretty new feature for us.

I had hoped it would increase performance for Doom 3, which uses it, until I 
discovered that Doom 3 is CPU-bound.

Marek
___
mesa-dev mailing list
mesa-dev@lists.freedesktop.org
http://lists.freedesktop.org/mailman/listinfo/mesa-dev


[Mesa-dev] [PATCH 4/4] swrast: fix EXT_depth_bounds_test

2015-08-13 Thread Marek Olšák
From: Marek Olšák marek.ol...@amd.com

zMin and zMax can't use _DepthMaxF, because the test is done in Z32_UNORM.

Probably a useless patch given how popular swrast is nowadays, but it helped
create and validate the piglit test.
---
 src/mesa/swrast/s_depth.c | 14 --
 1 file changed, 12 insertions(+), 2 deletions(-)

diff --git a/src/mesa/swrast/s_depth.c b/src/mesa/swrast/s_depth.c
index 134f897..0a03541 100644
--- a/src/mesa/swrast/s_depth.c
+++ b/src/mesa/swrast/s_depth.c
@@ -419,8 +419,8 @@ _swrast_depth_bounds_test( struct gl_context *ctx, SWspan 
*span )
struct gl_framebuffer *fb = ctx-DrawBuffer;
struct gl_renderbuffer *rb = fb-Attachment[BUFFER_DEPTH].Renderbuffer;
GLubyte *zStart;
-   GLuint zMin = (GLuint) (ctx-Depth.BoundsMin * fb-_DepthMaxF + 0.5F);
-   GLuint zMax = (GLuint) (ctx-Depth.BoundsMax * fb-_DepthMaxF + 0.5F);
+   GLuint zMin = (double)ctx-Depth.BoundsMin * 0x;
+   GLuint zMax = (double)ctx-Depth.BoundsMax * 0x;
GLubyte *mask = span-array-mask;
const GLuint count = span-end;
GLuint i;
@@ -444,6 +444,16 @@ _swrast_depth_bounds_test( struct gl_context *ctx, SWspan 
*span )
   zBufferVals = (const GLuint *) zStart;
}
else {
+  /* Round the bounds to the precision of the zbuffer. */
+  if (rb-Format == MESA_FORMAT_Z_UNORM16) {
+ zMin = (zMin  0x) | (zMin  16);
+ zMax = (zMax  0x) | (zMax  16);
+  } else {
+ /* 24 bits */
+ zMin = (zMin  0xff00) | (zMin  24);
+ zMax = (zMax  0xff00) | (zMax  24);
+  }
+
   /* unpack Z values into a temporary array */
   if (span-arrayMask  SPAN_XY) {
  get_z32_values(ctx, rb, count, span-array-x, span-array-y,
-- 
2.1.4

___
mesa-dev mailing list
mesa-dev@lists.freedesktop.org
http://lists.freedesktop.org/mailman/listinfo/mesa-dev


[Mesa-dev] [PATCH 3/4] radeonsi: add support for EXT_depth_bounds_test

2015-08-13 Thread Marek Olšák
From: Marek Olšák marek.ol...@amd.com

---
 src/gallium/drivers/radeonsi/si_pipe.c  |  2 +-
 src/gallium/drivers/radeonsi/si_state.c | 10 ++
 2 files changed, 7 insertions(+), 5 deletions(-)

diff --git a/src/gallium/drivers/radeonsi/si_pipe.c 
b/src/gallium/drivers/radeonsi/si_pipe.c
index cd22862..9986bde 100644
--- a/src/gallium/drivers/radeonsi/si_pipe.c
+++ b/src/gallium/drivers/radeonsi/si_pipe.c
@@ -278,6 +278,7 @@ static int si_get_param(struct pipe_screen* pscreen, enum 
pipe_cap param)
case PIPE_CAP_CONDITIONAL_RENDER_INVERTED:
case PIPE_CAP_TEXTURE_FLOAT_LINEAR:
case PIPE_CAP_TEXTURE_HALF_FLOAT_LINEAR:
+   case PIPE_CAP_DEPTH_BOUNDS_TEST:
return 1;
 
case PIPE_CAP_RESOURCE_FROM_USER_MEMORY:
@@ -324,7 +325,6 @@ static int si_get_param(struct pipe_screen* pscreen, enum 
pipe_cap param)
case PIPE_CAP_TEXTURE_GATHER_OFFSETS:
case PIPE_CAP_SAMPLER_VIEW_TARGET:
case PIPE_CAP_VERTEXID_NOBASE:
-   case PIPE_CAP_DEPTH_BOUNDS_TEST:
return 0;
 
case PIPE_CAP_MAX_SHADER_PATCH_VARYINGS:
diff --git a/src/gallium/drivers/radeonsi/si_state.c 
b/src/gallium/drivers/radeonsi/si_state.c
index d768305..c923ea7 100644
--- a/src/gallium/drivers/radeonsi/si_state.c
+++ b/src/gallium/drivers/radeonsi/si_state.c
@@ -838,7 +838,8 @@ static void *si_create_dsa_state(struct pipe_context *ctx,
 
db_depth_control = S_028800_Z_ENABLE(state-depth.enabled) |
S_028800_Z_WRITE_ENABLE(state-depth.writemask) |
-   S_028800_ZFUNC(state-depth.func);
+   S_028800_ZFUNC(state-depth.func) |
+   S_028800_DEPTH_BOUNDS_ENABLE(state-depth.bounds_test);
 
/* stencil */
if (state-stencil[0].enabled) {
@@ -867,9 +868,12 @@ static void *si_create_dsa_state(struct pipe_context *ctx,
dsa-alpha_func = PIPE_FUNC_ALWAYS;
}
 
-   /* misc */
si_pm4_set_reg(pm4, R_028800_DB_DEPTH_CONTROL, db_depth_control);
si_pm4_set_reg(pm4, R_02842C_DB_STENCIL_CONTROL, db_stencil_control);
+   if (state-depth.bounds_test) {
+   si_pm4_set_reg(pm4, R_028020_DB_DEPTH_BOUNDS_MIN, 
fui(state-depth.bounds_min));
+   si_pm4_set_reg(pm4, R_028024_DB_DEPTH_BOUNDS_MAX, 
fui(state-depth.bounds_max));
+   }
 
return dsa;
 }
@@ -3285,8 +3289,6 @@ static void si_init_config(struct si_context *sctx)
si_pm4_set_reg(pm4, R_028BEC_PA_CL_GB_VERT_DISC_ADJ, fui(1.0));
si_pm4_set_reg(pm4, R_028BF0_PA_CL_GB_HORZ_CLIP_ADJ, fui(1.0));
si_pm4_set_reg(pm4, R_028BF4_PA_CL_GB_HORZ_DISC_ADJ, fui(1.0));
-   si_pm4_set_reg(pm4, R_028020_DB_DEPTH_BOUNDS_MIN, 0);
-   si_pm4_set_reg(pm4, R_028024_DB_DEPTH_BOUNDS_MAX, 0);
si_pm4_set_reg(pm4, R_028028_DB_STENCIL_CLEAR, 0);
si_pm4_set_reg(pm4, R_028AC0_DB_SRESULTS_COMPARE_STATE0, 0x0);
si_pm4_set_reg(pm4, R_028AC4_DB_SRESULTS_COMPARE_STATE1, 0x0);
-- 
2.1.4

___
mesa-dev mailing list
mesa-dev@lists.freedesktop.org
http://lists.freedesktop.org/mailman/listinfo/mesa-dev


  1   2   >