[Mesa-dev] [PATCH] renderonly: fix dumb BO allocation for non 32bpp formats

2018-01-30 Thread Lucas Stach
Take into account the resource format, instead of applying a hardcoded
32bpp. This not only over-allocates 16bpp formats, but also results in
a wrong stride being filled into the handle.

Signed-off-by: Lucas Stach 
---
 src/gallium/auxiliary/renderonly/renderonly.c | 3 ++-
 1 file changed, 2 insertions(+), 1 deletion(-)

diff --git a/src/gallium/auxiliary/renderonly/renderonly.c 
b/src/gallium/auxiliary/renderonly/renderonly.c
index da91f12b2ea1..8112b1563723 100644
--- a/src/gallium/auxiliary/renderonly/renderonly.c
+++ b/src/gallium/auxiliary/renderonly/renderonly.c
@@ -33,6 +33,7 @@
 
 #include "state_tracker/drm_driver.h"
 #include "pipe/p_screen.h"
+#include "util/u_format.h"
 #include "util/u_inlines.h"
 #include "util/u_memory.h"
 
@@ -73,7 +74,7 @@ renderonly_create_kms_dumb_buffer_for_resource(struct 
pipe_resource *rsc,
struct drm_mode_create_dumb create_dumb = {
   .width = rsc->width0,
   .height = rsc->height0,
-  .bpp = 32,
+  .bpp = util_format_get_blocksize(rsc->format) * 8,
};
struct drm_mode_destroy_dumb destroy_dumb = { };
 
-- 
2.15.1

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


Re: [Mesa-dev] [PATCH] r600/sb: insert the else clause when we might depart from a loop

2018-01-30 Thread Roland Scheidegger
Makes sense to me, albeit I don't really quite understand sb...
Reviewed-by: Roland Scheidegger 

Am 30.01.2018 um 07:40 schrieb Dave Airlie:
> From: Dave Airlie 
> 
> If there is a break inside the else clause and this means we
> are breaking from a loop, the loop finalise will want to insert
> the LOOP_BREAK/CONTINUE instruction, however if we don't emit
> the else there is no where for these to end up, so they will end
> up in the wrong place.
> 
> Signed-off-by: Dave Airlie 
> ---
>  src/gallium/drivers/r600/sb/sb_bc_finalize.cpp | 17 +
>  1 file changed, 17 insertions(+)
> 
> diff --git a/src/gallium/drivers/r600/sb/sb_bc_finalize.cpp 
> b/src/gallium/drivers/r600/sb/sb_bc_finalize.cpp
> index 099b295..d3fab80 100644
> --- a/src/gallium/drivers/r600/sb/sb_bc_finalize.cpp
> +++ b/src/gallium/drivers/r600/sb/sb_bc_finalize.cpp
> @@ -208,8 +208,25 @@ void bc_finalizer::finalize_if(region_node* r) {
>   r->push_front(if_jump);
>   r->push_back(if_pop);
>  
> + /* the depart/repeat 1 is actually part of the "else" code.
> +  * if it's a depart for an outer loop region it will want to
> +  * insert a LOOP_BREAK or LOOP_CONTINUE in here, so we need
> +  * to emit the else clause.
> +  */
>   bool has_else = n_if->next;
>  
> + if (repdep1->is_depart()) {
> + depart_node *dep1 = static_cast(repdep1);
> + if (dep1->target != r && dep1->target->is_loop())
> + has_else = true;
> + }
> +
> + if (repdep1->is_repeat()) {
> + repeat_node *rep1 = static_cast(repdep1);
> + if (rep1->target != r && rep1->target->is_loop())
> + has_else = true;
> + }
> +
>   if (has_else) {
>   cf_node *nelse = sh.create_cf(CF_OP_ELSE);
>   n_if->insert_after(nelse);
> 

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


Re: [Mesa-dev] [PATCH 8/8] mesa: use gl_vert_attrib enum type in more places

2018-01-30 Thread Brian Paul

On 01/30/2018 01:38 AM, Gert Wollny wrote:

Am Montag, den 29.01.2018, 13:42 -0700 schrieb Brian Paul:

Slightly better readbility.
---
  src/mesa/main/arrayobj.c |  2 +-
  src/mesa/main/varray.c   | 12 ++--
  src/mesa/main/varray.h   |  4 ++--
  3 files changed, 9 insertions(+), 9 deletions(-)

diff --git a/src/mesa/main/arrayobj.c b/src/mesa/main/arrayobj.c
index ea9b316..1951638 100644
--- a/src/mesa/main/arrayobj.c
+++ b/src/mesa/main/arrayobj.c
@@ -231,7 +231,7 @@ _mesa_reference_vao_(struct gl_context *ctx,
  static void
  init_array(struct gl_context *ctx,
 struct gl_vertex_array_object *vao,
-   GLuint index, GLint size, GLint type)
+   gl_vert_attrib index, GLint size, GLint type)
  {
 struct gl_array_attributes *array = >VertexAttrib[index];
 struct gl_vertex_buffer_binding *binding = 

BufferBinding[index];


This conflicts with d5f42f96e16f4b12, you added an asset there.


Yeah, I rebased/reordered my patches several times (same story with 
patch 4/8).  This change is still applicable.  Can I assume your R-b for 
the rest of the patch?




With that patches 1-3 and 5-7 are
   Reviewed-by: Gert Wollny 


Thanks.

-Brian






diff --git a/src/mesa/main/varray.c b/src/mesa/main/varray.c
index 6c022b4..b2783e2 100644
--- a/src/mesa/main/varray.c
+++ b/src/mesa/main/varray.c
@@ -132,7 +132,7 @@ type_to_bit(const struct gl_context *ctx, GLenum
type)
  static void
  vertex_attrib_binding(struct gl_context *ctx,
struct gl_vertex_array_object *vao,
-  GLuint attribIndex,
+  gl_vert_attrib attribIndex,
GLuint bindingIndex)
  {
 struct gl_array_attributes *array = 

VertexAttrib[attribIndex];

@@ -294,7 +294,7 @@ get_array_format(const struct gl_context *ctx,
GLint sizeMax, GLint *size)
  void
  _mesa_update_array_format(struct gl_context *ctx,
struct gl_vertex_array_object *vao,
-  GLuint attrib, GLint size, GLenum type,
+  gl_vert_attrib attrib, GLint size, GLenum
type,
GLenum format, GLboolean normalized,
GLboolean integer, GLboolean doubles,
GLuint relativeOffset)
@@ -1063,7 +1063,7 @@ _mesa_VertexAttribLPointer(GLuint index, GLint
size, GLenum type,
  void
  _mesa_enable_vertex_array_attrib(struct gl_context *ctx,
   struct gl_vertex_array_object *vao,
- unsigned attrib)
+ gl_vert_attrib attrib)
  {
 assert(attrib >= VERT_ATTRIB_GENERIC0);
 assert(attrib < ARRAY_SIZE(vao->VertexAttrib));
@@ -1965,7 +1965,7 @@ _mesa_VertexAttribDivisor_no_error(GLuint
index, GLuint divisor)
  {
 GET_CURRENT_CONTEXT(ctx);
  
-   const GLuint genericIndex = VERT_ATTRIB_GENERIC(index);

+   const gl_vert_attrib genericIndex = VERT_ATTRIB_GENERIC(index);
 struct gl_vertex_array_object * const vao = ctx->Array.VAO;
  
 assert(genericIndex < ARRAY_SIZE(vao->VertexAttrib));

@@ -1996,7 +1996,7 @@ _mesa_VertexAttribDivisor(GLuint index, GLuint
divisor)
  {
 GET_CURRENT_CONTEXT(ctx);
  
-   const GLuint genericIndex = VERT_ATTRIB_GENERIC(index);

+   const gl_vert_attrib genericIndex = VERT_ATTRIB_GENERIC(index);
 struct gl_vertex_array_object * const vao = ctx->Array.VAO;
  
 if (!ctx->Extensions.ARB_instanced_arrays) {

@@ -2856,7 +2856,7 @@ _mesa_print_arrays(struct gl_context *ctx)
  
 fprintf(stderr, "Array Object %u\n", vao->Name);
  
-   unsigned i;

+   gl_vert_attrib i;
 for (i = 0; i < VERT_ATTRIB_MAX; ++i) {
const struct gl_array_attributes *array = 

VertexAttrib[i];

if (!array->Enabled)
diff --git a/src/mesa/main/varray.h b/src/mesa/main/varray.h
index 79ecd9a..fe7eb81 100644
--- a/src/mesa/main/varray.h
+++ b/src/mesa/main/varray.h
@@ -96,7 +96,7 @@ _mesa_set_drawing_arrays(struct gl_context *ctx,
  extern void
  _mesa_update_array_format(struct gl_context *ctx,
struct gl_vertex_array_object *vao,
-  GLuint attrib, GLint size, GLenum type,
+  gl_vert_attrib attrib, GLint size, GLenum
type,
GLenum format, GLboolean normalized,
GLboolean integer, GLboolean doubles,
GLuint relativeOffset);
@@ -104,7 +104,7 @@ _mesa_update_array_format(struct gl_context *ctx,
  extern void
  _mesa_enable_vertex_array_attrib(struct gl_context *ctx,
   struct gl_vertex_array_object *vao,
- unsigned attrib);
+ gl_vert_attrib attrib);
  
  extern void

  _mesa_bind_vertex_buffer(struct gl_context *ctx,


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

Re: [Mesa-dev] [PATCH] renderonly: fix dumb BO allocation for non 32bpp formats

2018-01-30 Thread Philipp Zabel
On Tue, 2018-01-30 at 15:22 +0100, Lucas Stach wrote:
> Take into account the resource format, instead of applying a hardcoded
> 32bpp. This not only over-allocates 16bpp formats, but also results in
> a wrong stride being filled into the handle.
> 
> Signed-off-by: Lucas Stach 

Reviewed-by: Philipp Zabel 

regards
Philipp
___
mesa-dev mailing list
mesa-dev@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/mesa-dev


[Mesa-dev] [Bug 104777] Attaching multiple shader objects for the same stage to a GLSL program triggers a linker error

2018-01-30 Thread bugzilla-daemon
https://bugs.freedesktop.org/show_bug.cgi?id=104777

--- Comment #2 from Juan A. Suarez  ---
I've sent a patch for review that I think should fix this issue.

https://patchwork.freedesktop.org/series/37349/

-- 
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
https://lists.freedesktop.org/mailman/listinfo/mesa-dev


Re: [Mesa-dev] [PATCH 3/3] radeonsi: remove DBG_PRECOMPILE

2018-01-30 Thread Marek Olšák
ping

On Sat, Jan 27, 2018 at 7:01 PM, Marek Olšák  wrote:
> From: Marek Olšák 
>
> it's useless and shader-db stats only report the main shader part.
> ---
>  src/gallium/drivers/radeon/r600_pipe_common.h   |  1 -
>  src/gallium/drivers/radeonsi/si_pipe.c  |  1 -
>  src/gallium/drivers/radeonsi/si_state_shaders.c | 49 
> -
>  3 files changed, 51 deletions(-)
>
> diff --git a/src/gallium/drivers/radeon/r600_pipe_common.h 
> b/src/gallium/drivers/radeon/r600_pipe_common.h
> index a8e632c..d82e123 100644
> --- a/src/gallium/drivers/radeon/r600_pipe_common.h
> +++ b/src/gallium/drivers/radeon/r600_pipe_common.h
> @@ -69,21 +69,20 @@ enum {
> DBG_NO_ASM,
> DBG_PREOPT_IR,
>
> /* Shader compiler options the shader cache should be aware of: */
> DBG_FS_CORRECT_DERIVS_AFTER_KILL,
> DBG_UNSAFE_MATH,
> DBG_SI_SCHED,
>
> /* Shader compiler options (with no effect on the shader cache): */
> DBG_CHECK_IR,
> -   DBG_PRECOMPILE,
> DBG_NIR,
> DBG_MONOLITHIC_SHADERS,
> DBG_NO_OPT_VARIANT,
>
> /* Information logging options: */
> DBG_INFO,
> DBG_TEX,
> DBG_COMPUTE,
> DBG_VM,
>
> diff --git a/src/gallium/drivers/radeonsi/si_pipe.c 
> b/src/gallium/drivers/radeonsi/si_pipe.c
> index 676d199..79c31a4 100644
> --- a/src/gallium/drivers/radeonsi/si_pipe.c
> +++ b/src/gallium/drivers/radeonsi/si_pipe.c
> @@ -48,21 +48,20 @@ static const struct debug_named_value debug_options[] = {
> { "notgsi", DBG(NO_TGSI), "Don't print the TGSI"},
> { "noasm", DBG(NO_ASM), "Don't print disassembled shaders"},
> { "preoptir", DBG(PREOPT_IR), "Print the LLVM IR before initial 
> optimizations" },
>
> /* Shader compiler options the shader cache should be aware of: */
> { "unsafemath", DBG(UNSAFE_MATH), "Enable unsafe math shader 
> optimizations" },
> { "sisched", DBG(SI_SCHED), "Enable LLVM SI Machine Instruction 
> Scheduler." },
>
> /* Shader compiler options (with no effect on the shader cache): */
> { "checkir", DBG(CHECK_IR), "Enable additional sanity checks on 
> shader IR" },
> -   { "precompile", DBG(PRECOMPILE), "Compile one shader variant at 
> shader creation." },
> { "nir", DBG(NIR), "Enable experimental NIR shaders" },
> { "mono", DBG(MONOLITHIC_SHADERS), "Use old-style monolithic shaders 
> compiled on demand" },
> { "nooptvariant", DBG(NO_OPT_VARIANT), "Disable compiling optimized 
> shader variants." },
>
> /* Information logging options: */
> { "info", DBG(INFO), "Print driver information" },
> { "tex", DBG(TEX), "Print texture info" },
> { "compute", DBG(COMPUTE), "Print compute info" },
> { "vm", DBG(VM), "Print virtual addresses when creating resources" },
>
> diff --git a/src/gallium/drivers/radeonsi/si_state_shaders.c 
> b/src/gallium/drivers/radeonsi/si_state_shaders.c
> index 959aead..2c1d990 100644
> --- a/src/gallium/drivers/radeonsi/si_state_shaders.c
> +++ b/src/gallium/drivers/radeonsi/si_state_shaders.c
> @@ -1778,21 +1778,20 @@ static void si_parse_next_shader_property(const 
> struct tgsi_shader_info *info,
>   * Compile the main shader part or the monolithic shader as part of
>   * si_shader_selector initialization. Since it can be done asynchronously,
>   * there is no way to report compile failures to applications.
>   */
>  static void si_init_shader_selector_async(void *job, int thread_index)
>  {
> struct si_shader_selector *sel = (struct si_shader_selector *)job;
> struct si_screen *sscreen = sel->screen;
> LLVMTargetMachineRef tm;
> struct pipe_debug_callback *debug = >compiler_ctx_state.debug;
> -   unsigned i;
>
> assert(!debug->debug_message || debug->async);
> assert(thread_index >= 0);
> assert(thread_index < ARRAY_SIZE(sscreen->tm));
> tm = sscreen->tm[thread_index];
>
> /* Compile the main shader part for use with a prolog and/or epilog.
>  * If this fails, the driver will try to compile a monolithic shader
>  * on demand.
>  */
> @@ -1882,68 +1881,20 @@ static void si_init_shader_selector_async(void *job, 
> int thread_index)
> case TGSI_SEMANTIC_POSITION: /* ignore these 
> */
> case TGSI_SEMANTIC_PSIZE:
> case TGSI_SEMANTIC_CLIPVERTEX:
> case TGSI_SEMANTIC_EDGEFLAG:
> break;
> }
> }
> }
> }
>
> -   /* Pre-compilation. */
> -   if (sscreen->debug_flags & DBG(PRECOMPILE) &&
> -   /* GFX9 needs LS or ES for compilation, which we don't have here. 
> */
> -   (sscreen->info.chip_class <= VI ||
> -

[Mesa-dev] [PATCH 1/4] mesa: don't flag _NEW_COLOR for KHR adv.blend if prog constant doesn't change

2018-01-30 Thread Marek Olšák
From: Marek Olšák 

This only affects drivers that set DriverFlags.NewBlend.
---
 src/mesa/main/blend.c |  6 --
 src/mesa/main/blend.h | 41 +++
 src/mesa/main/enable.c| 14 +
 src/mesa/program/prog_statevars.c |  3 ++-
 4 files changed, 49 insertions(+), 15 deletions(-)

diff --git a/src/mesa/main/blend.c b/src/mesa/main/blend.c
index 6b379f2..ec8e27e 100644
--- a/src/mesa/main/blend.c
+++ b/src/mesa/main/blend.c
@@ -528,21 +528,22 @@ _mesa_BlendEquation( GLenum mode )
 
if (!changed)
   return;
 
 
if (!legal_simple_blend_equation(ctx, mode) && !advanced_mode) {
   _mesa_error(ctx, GL_INVALID_ENUM, "glBlendEquation");
   return;
}
 
-   _mesa_flush_vertices_for_blend_state(ctx);
+   _mesa_flush_vertices_for_blend_adv(ctx, ctx->Color.BlendEnabled,
+  advanced_mode);
 
for (buf = 0; buf < numBuffers; buf++) {
   ctx->Color.Blend[buf].EquationRGB = mode;
   ctx->Color.Blend[buf].EquationA = mode;
}
ctx->Color._BlendEquationPerBuffer = GL_FALSE;
ctx->Color._AdvancedBlendMode = advanced_mode;
 
if (ctx->Driver.BlendEquationSeparate)
   ctx->Driver.BlendEquationSeparate(ctx, mode, mode);
@@ -553,21 +554,22 @@ _mesa_BlendEquation( GLenum mode )
  * Set blend equation for one color buffer/target.
  */
 static void
 blend_equationi(struct gl_context *ctx, GLuint buf, GLenum mode,
 enum gl_advanced_blend_mode advanced_mode)
 {
if (ctx->Color.Blend[buf].EquationRGB == mode &&
ctx->Color.Blend[buf].EquationA == mode)
   return;  /* no change */
 
-   _mesa_flush_vertices_for_blend_state(ctx);
+   _mesa_flush_vertices_for_blend_adv(ctx, ctx->Color.BlendEnabled,
+  advanced_mode);
ctx->Color.Blend[buf].EquationRGB = mode;
ctx->Color.Blend[buf].EquationA = mode;
ctx->Color._BlendEquationPerBuffer = GL_TRUE;
 
if (buf == 0)
   ctx->Color._AdvancedBlendMode = advanced_mode;
 }
 
 
 void GLAPIENTRY
diff --git a/src/mesa/main/blend.h b/src/mesa/main/blend.h
index 2454e0c..cba5a98 100644
--- a/src/mesa/main/blend.h
+++ b/src/mesa/main/blend.h
@@ -147,28 +147,53 @@ extern void
 _mesa_update_clamp_vertex_color(struct gl_context *ctx,
 const struct gl_framebuffer *drawFb);
 
 extern mesa_format
 _mesa_get_render_format(const struct gl_context *ctx, mesa_format format);
 
 extern void  
 _mesa_init_color( struct gl_context * ctx );
 
 
+static inline unsigned
+_mesa_get_advanded_blend_sh_constant(GLbitfield blend_enabled,
+ enum gl_advanced_blend_mode mode)
+{
+   return blend_enabled ? mode : 0;
+}
+
+static inline bool
+_mesa_advanded_blend_sh_constant_changed(struct gl_context *ctx,
+ GLbitfield new_blend_enabled,
+ enum gl_advanced_blend_mode new_mode)
+{
+   return _mesa_get_advanded_blend_sh_constant(new_blend_enabled, new_mode) !=
+  _mesa_get_advanded_blend_sh_constant(ctx->Color.BlendEnabled,
+   ctx->Color._AdvancedBlendMode);
+}
+
 static inline void
 _mesa_flush_vertices_for_blend_state(struct gl_context *ctx)
 {
-   /* The advanced blend mode needs _NEW_COLOR to update the state constant,
-* so we have to set it. This is inefficient.
-* This should only be done for states that affect the state constant.
-* It shouldn't be done for other blend states.
-*/
-   if (_mesa_has_KHR_blend_equation_advanced(ctx) ||
-   !ctx->DriverFlags.NewBlend) {
+   if (!ctx->DriverFlags.NewBlend) {
   FLUSH_VERTICES(ctx, _NEW_COLOR);
} else {
   FLUSH_VERTICES(ctx, 0);
+  ctx->NewDriverState |= ctx->DriverFlags.NewBlend;
+   }
+}
+
+static inline void
+_mesa_flush_vertices_for_blend_adv(struct gl_context *ctx,
+   GLbitfield new_blend_enabled,
+   enum gl_advanced_blend_mode new_mode)
+{
+   /* The advanced blend mode needs _NEW_COLOR to update the state constant. */
+   if (_mesa_has_KHR_blend_equation_advanced(ctx) &&
+   _mesa_advanded_blend_sh_constant_changed(ctx, new_blend_enabled,
+new_mode)) {
+  FLUSH_VERTICES(ctx, _NEW_COLOR);
}
-   ctx->NewDriverState |= ctx->DriverFlags.NewBlend;
+   _mesa_flush_vertices_for_blend_state(ctx);
 }
 
 #endif
diff --git a/src/mesa/main/enable.c b/src/mesa/main/enable.c
index c859a7a..b09aca3 100644
--- a/src/mesa/main/enable.c
+++ b/src/mesa/main/enable.c
@@ -317,21 +317,22 @@ _mesa_set_enable(struct gl_context *ctx, GLenum cap, 
GLboolean state)
  if (ctx->Eval.AutoNormal == state)
 return;
  FLUSH_VERTICES(ctx, _NEW_EVAL);
  ctx->Eval.AutoNormal = state;
  break;
   case GL_BLEND:
  {
 

[Mesa-dev] [PATCH 2/4] radeonsi: make texture_discard_cmask/eliminate functions non-static

2018-01-30 Thread Marek Olšák
From: Marek Olšák 

---
 src/gallium/drivers/radeon/r600_pipe_common.h |  4 
 src/gallium/drivers/radeon/r600_texture.c | 20 +---
 2 files changed, 13 insertions(+), 11 deletions(-)

diff --git a/src/gallium/drivers/radeon/r600_pipe_common.h 
b/src/gallium/drivers/radeon/r600_pipe_common.h
index d82e123..e2cd6c60 100644
--- a/src/gallium/drivers/radeon/r600_pipe_common.h
+++ b/src/gallium/drivers/radeon/r600_pipe_common.h
@@ -591,20 +591,24 @@ bool si_prepare_for_dma_blit(struct r600_common_context 
*rctx,
 struct r600_texture *rsrc,
 unsigned src_level,
 const struct pipe_box *src_box);
 void si_texture_get_fmask_info(struct si_screen *sscreen,
   struct r600_texture *rtex,
   unsigned nr_samples,
   struct r600_fmask_info *out);
 void si_texture_get_cmask_info(struct si_screen *sscreen,
   struct r600_texture *rtex,
   struct r600_cmask_info *out);
+void si_eliminate_fast_color_clear(struct r600_common_context *rctx,
+  struct r600_texture *rtex);
+void si_texture_discard_cmask(struct si_screen *sscreen,
+ struct r600_texture *rtex);
 bool si_init_flushed_depth_texture(struct pipe_context *ctx,
   struct pipe_resource *texture,
   struct r600_texture **staging);
 void si_print_texture_info(struct si_screen *sscreen,
   struct r600_texture *rtex, struct u_log_context 
*log);
 struct pipe_resource *si_texture_create(struct pipe_screen *screen,
const struct pipe_resource *templ);
 bool vi_dcc_formats_compatible(enum pipe_format format1,
   enum pipe_format format2);
 bool vi_dcc_formats_are_incompatible(struct pipe_resource *tex,
diff --git a/src/gallium/drivers/radeon/r600_texture.c 
b/src/gallium/drivers/radeon/r600_texture.c
index 36eff40..a0e9129 100644
--- a/src/gallium/drivers/radeon/r600_texture.c
+++ b/src/gallium/drivers/radeon/r600_texture.c
@@ -29,22 +29,20 @@
 #include "util/u_memory.h"
 #include "util/u_pack_color.h"
 #include "util/u_resource.h"
 #include "util/u_surface.h"
 #include "util/os_time.h"
 #include 
 #include 
 #include "state_tracker/drm_driver.h"
 #include "amd/common/sid.h"
 
-static void r600_texture_discard_cmask(struct si_screen *sscreen,
-  struct r600_texture *rtex);
 static enum radeon_surf_mode
 r600_choose_tiling(struct si_screen *sscreen,
   const struct pipe_resource *templ);
 
 
 bool si_prepare_for_dma_blit(struct r600_common_context *rctx,
 struct r600_texture *rdst,
 unsigned dst_level, unsigned dstx,
 unsigned dsty, unsigned dstz,
 struct r600_texture *rsrc,
@@ -83,21 +81,21 @@ bool si_prepare_for_dma_blit(struct r600_common_context 
*rctx,
 *SDMA. Otherwise, use the 3D path.
 */
if (rdst->cmask.size && rdst->dirty_level_mask & (1 << dst_level)) {
/* The CMASK clear is only enabled for the first level. */
assert(dst_level == 0);
if (!util_texrange_covers_whole_level(>resource.b.b, 
dst_level,
  dstx, dsty, dstz, 
src_box->width,
  src_box->height, 
src_box->depth))
return false;
 
-   r600_texture_discard_cmask(rctx->screen, rdst);
+   si_texture_discard_cmask(rctx->screen, rdst);
}
 
/* All requirements are met. Prepare textures for SDMA. */
if (rsrc->cmask.size && rsrc->dirty_level_mask & (1 << src_level))
rctx->b.flush_resource(>b, >resource.b.b);
 
assert(!(rsrc->dirty_level_mask & (1 << src_level)));
assert(!(rdst->dirty_level_mask & (1 << dst_level)));
 
return true;
@@ -375,38 +373,38 @@ static void r600_surface_import_metadata(struct si_screen 
*sscreen,
*array_mode = RADEON_SURF_MODE_2D;
else if (metadata->u.legacy.microtile == RADEON_LAYOUT_TILED)
*array_mode = RADEON_SURF_MODE_1D;
else
*array_mode = RADEON_SURF_MODE_LINEAR_ALIGNED;
 
*is_scanout = metadata->u.legacy.scanout;
}
 }
 
-static void r600_eliminate_fast_color_clear(struct r600_common_context *rctx,
-   struct r600_texture *rtex)
+void si_eliminate_fast_color_clear(struct r600_common_context *rctx,
+  struct r600_texture *rtex)
 {
struct si_screen *sscreen = 

[Mesa-dev] [PATCH 3/4] radeonsi: don't flush when si_eliminate_fast_color_clear is no-op

2018-01-30 Thread Marek Olšák
From: Marek Olšák 

---
 src/gallium/drivers/radeon/r600_texture.c | 6 +-
 1 file changed, 5 insertions(+), 1 deletion(-)

diff --git a/src/gallium/drivers/radeon/r600_texture.c 
b/src/gallium/drivers/radeon/r600_texture.c
index a0e9129..125e7ef 100644
--- a/src/gallium/drivers/radeon/r600_texture.c
+++ b/src/gallium/drivers/radeon/r600_texture.c
@@ -382,22 +382,26 @@ static void r600_surface_import_metadata(struct si_screen 
*sscreen,
 
 void si_eliminate_fast_color_clear(struct r600_common_context *rctx,
   struct r600_texture *rtex)
 {
struct si_screen *sscreen = rctx->screen;
struct pipe_context *ctx = >b;
 
if (ctx == sscreen->aux_context)
mtx_lock(>aux_context_lock);
 
+   unsigned n = rctx->num_decompress_calls;
ctx->flush_resource(ctx, >resource.b.b);
-   ctx->flush(ctx, NULL, 0);
+
+   /* Flush only if any fast clear elimination took place. */
+   if (n != rctx->num_decompress_calls)
+   ctx->flush(ctx, NULL, 0);
 
if (ctx == sscreen->aux_context)
mtx_unlock(>aux_context_lock);
 }
 
 void si_texture_discard_cmask(struct si_screen *sscreen,
  struct r600_texture *rtex)
 {
if (!rtex->cmask.size)
return;
-- 
2.7.4

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


[Mesa-dev] [PATCH 4/4] radeonsi: implement GL_KHR_blend_equation_advanced without MSAA

2018-01-30 Thread Marek Olšák
From: Marek Olšák 

I'm not fully convinced that the hw can do it with MSAA.
Maybe without CMASK, FMASK, and with sample shading, i.e. the slowest
possible way.
---
 docs/features.txt |  2 +-
 docs/relnotes/18.1.0.html |  2 +-
 src/gallium/drivers/radeonsi/si_descriptors.c | 61 +++
 src/gallium/drivers/radeonsi/si_get.c |  2 +-
 src/gallium/drivers/radeonsi/si_shader_tgsi_mem.c | 45 +
 src/gallium/drivers/radeonsi/si_state.c   |  1 +
 src/gallium/drivers/radeonsi/si_state.h   |  5 ++
 src/gallium/drivers/radeonsi/si_state_shaders.c   |  1 +
 8 files changed, 116 insertions(+), 3 deletions(-)

diff --git a/docs/features.txt b/docs/features.txt
index 2e110d9..6226629 100644
--- a/docs/features.txt
+++ b/docs/features.txt
@@ -262,21 +262,21 @@ GLES3.1, GLSL ES 3.1 -- all DONE: i965/hsw+, nvc0, r600, 
radeonsi
 
   Additional functionality not covered above:
   glMemoryBarrierByRegion   DONE
   glGetTexLevelParameter[fi]v - needs updates   DONE
   glGetBooleani_v - restrict to GLES enums
   gl_HelperInvocation support   DONE (i965, r600)
 
 GLES3.2, GLSL ES 3.2 -- all DONE: i965/gen9+
 
   GL_EXT_color_buffer_float DONE (all drivers)
-  GL_KHR_blend_equation_advancedDONE (i965, nvc0)
+  GL_KHR_blend_equation_advancedDONE (i965, nvc0, 
radeonsi)
   GL_KHR_debug  DONE (all drivers)
   GL_KHR_robustness DONE (i965, nvc0, 
radeonsi)
   GL_KHR_texture_compression_astc_ldr   DONE (freedreno, 
i965/gen9+)
   GL_OES_copy_image DONE (all drivers)
   GL_OES_draw_buffers_indexed   DONE (all drivers that 
support GL_ARB_draw_buffers_blend)
   GL_OES_draw_elements_base_vertex  DONE (all drivers)
   GL_OES_geometry_shaderDONE (i965/hsw+, nvc0, 
radeonsi)
   GL_OES_gpu_shader5DONE (all drivers that 
support GL_ARB_gpu_shader5)
   GL_OES_primitive_bounding_box DONE (i965/gen7+, 
nvc0, radeonsi)
   GL_OES_sample_shading DONE (i965, nvc0, 
r600, radeonsi)
diff --git a/docs/relnotes/18.1.0.html b/docs/relnotes/18.1.0.html
index ddacbb4..e15ee87 100644
--- a/docs/relnotes/18.1.0.html
+++ b/docs/relnotes/18.1.0.html
@@ -37,21 +37,21 @@ TBD.
 
 
 
 New features
 
 
 Note: some of the new features are only available with certain drivers.
 
 
 
-TBD
+GL_KHR_blend_equation_advanced on radeonsi
 
 
 Bug fixes
 
 
 TBD
 
 
 Changes
 
diff --git a/src/gallium/drivers/radeonsi/si_descriptors.c 
b/src/gallium/drivers/radeonsi/si_descriptors.c
index 17115e1..98086a7 100644
--- a/src/gallium/drivers/radeonsi/si_descriptors.c
+++ b/src/gallium/drivers/radeonsi/si_descriptors.c
@@ -854,20 +854,81 @@ si_images_update_needs_color_decompress_mask(struct 
si_images *images)
 
if (color_needs_decompression(rtex)) {
images->needs_color_decompress_mask |= 1 << i;
} else {
images->needs_color_decompress_mask &= ~(1 << 
i);
}
}
}
 }
 
+void si_update_ps_colorbuf0_slot(struct si_context *sctx)
+{
+   struct si_buffer_resources *buffers = >rw_buffers;
+   struct si_descriptors *descs = >descriptors[SI_DESCS_RW_BUFFERS];
+   unsigned slot = SI_PS_IMAGE_COLORBUF0;
+   struct pipe_surface *surf = NULL;
+
+   /* si_texture_disable_dcc can get us here again. */
+   if (sctx->blitter->running)
+   return;
+
+   /* See whether FBFETCH is used and color buffer 0 is set. */
+   if (sctx->ps_shader.cso &&
+   sctx->ps_shader.cso->info.opcode_count[TGSI_OPCODE_FBFETCH] &&
+   sctx->framebuffer.state.nr_cbufs &&
+   sctx->framebuffer.state.cbufs[0])
+   surf = sctx->framebuffer.state.cbufs[0];
+
+   if (!buffers->buffers[slot] && !surf)
+   return;
+
+   struct r600_texture *tex = surf ? (struct r600_texture*)surf->texture : 
NULL;
+   if (tex) {
+   struct pipe_image_view view;
+
+   /* There is no automatic decompression for this resource slot. 
*/
+   assert(!tex->is_depth);
+
+   if (tex->resource.b.b.nr_samples <= 1) {
+   /* Disable DCC and CMASK. */
+   si_texture_disable_dcc(>b, tex);
+   si_eliminate_fast_color_clear(>b, tex);
+   si_texture_discard_cmask(sctx->screen, tex);
+   }
+
+   view.resource = surf->texture;
+   view.format = surf->format;
+   

Re: [Mesa-dev] [PATCH 7/8] mesa: rename some 'client' array functions

2018-01-30 Thread Mark Janes
This series that was just pushed to master generates ~200 assertions on
all platforms, eg:

piglit.spec.ext_framebuffer_multisample.formats 2

ext_framebuffer_multisample-formats: ../src/mesa/main/varray.c:1068:
_mesa_enable_vertex_array_attrib: Assertion `attrib >=
VERT_ATTRIB_GENERIC0' failed.

Should we revert the series?  This needs to be corrected immediately.

Brian Paul  writes:

> A long time ago gl_vertex_array was gl_client_array.  Update some function
> names to be consistent.
> ---
>  src/mesa/main/arrayobj.c | 6 +++---
>  src/mesa/main/arrayobj.h | 4 ++--
>  src/mesa/main/attrib.c   | 2 +-
>  src/mesa/main/state.c| 2 +-
>  src/mesa/main/varray.c   | 4 ++--
>  src/mesa/main/varray.h   | 4 ++--
>  6 files changed, 11 insertions(+), 11 deletions(-)
>
> diff --git a/src/mesa/main/arrayobj.c b/src/mesa/main/arrayobj.c
> index b862f0f..ea9b316 100644
> --- a/src/mesa/main/arrayobj.c
> +++ b/src/mesa/main/arrayobj.c
> @@ -311,8 +311,8 @@ _mesa_initialize_vao(struct gl_context *ctx,
>   * or a gl_vertex_buffer_binding has changed.
>   */
>  void
> -_mesa_update_vao_client_arrays(struct gl_context *ctx,
> -   struct gl_vertex_array_object *vao)
> +_mesa_update_vao_derived_arrays(struct gl_context *ctx,
> +struct gl_vertex_array_object *vao)
>  {
> GLbitfield arrays = vao->NewArrays;
>  
> @@ -324,7 +324,7 @@ _mesa_update_vao_client_arrays(struct gl_context *ctx,
>const struct gl_vertex_buffer_binding *buffer_binding =
>   >BufferBinding[attrib_array->BufferBindingIndex];
>  
> -  _mesa_update_client_array(ctx, client_array, attrib_array,
> +  _mesa_update_vertex_array(ctx, client_array, attrib_array,
>  buffer_binding);
> }
>  }
> diff --git a/src/mesa/main/arrayobj.h b/src/mesa/main/arrayobj.h
> index 1b9900c..ff26157 100644
> --- a/src/mesa/main/arrayobj.h
> +++ b/src/mesa/main/arrayobj.h
> @@ -78,8 +78,8 @@ _mesa_initialize_vao(struct gl_context *ctx,
>  
>  
>  extern void
> -_mesa_update_vao_client_arrays(struct gl_context *ctx,
> -   struct gl_vertex_array_object *vao);
> +_mesa_update_vao_derived_arrays(struct gl_context *ctx,
> +struct gl_vertex_array_object *vao);
>  
>  /* Returns true if all varying arrays reside in vbos */
>  extern bool
> diff --git a/src/mesa/main/attrib.c b/src/mesa/main/attrib.c
> index 3c12fd6..0b4b63f 100644
> --- a/src/mesa/main/attrib.c
> +++ b/src/mesa/main/attrib.c
> @@ -1503,7 +1503,7 @@ copy_array_object(struct gl_context *ctx,
> /* skip RefCount */
>  
> for (i = 0; i < ARRAY_SIZE(src->VertexAttrib); i++) {
> -  _mesa_copy_client_array(ctx, >_VertexAttrib[i], 
> >_VertexAttrib[i]);
> +  _mesa_copy_vertex_array(ctx, >_VertexAttrib[i], 
> >_VertexAttrib[i]);
>_mesa_copy_vertex_attrib_array(ctx, >VertexAttrib[i], 
> >VertexAttrib[i]);
>_mesa_copy_vertex_buffer_binding(ctx, >BufferBinding[i], 
> >BufferBinding[i]);
> }
> diff --git a/src/mesa/main/state.c b/src/mesa/main/state.c
> index dd61cc7..df694d0 100644
> --- a/src/mesa/main/state.c
> +++ b/src/mesa/main/state.c
> @@ -357,7 +357,7 @@ _mesa_update_state_locked( struct gl_context *ctx )
> }
>  
> if (new_state & _NEW_ARRAY)
> -  _mesa_update_vao_client_arrays(ctx, ctx->Array.VAO);
> +  _mesa_update_vao_derived_arrays(ctx, ctx->Array.VAO);
>  
>   out:
> new_prog_state |= update_program_constants(ctx);
> diff --git a/src/mesa/main/varray.c b/src/mesa/main/varray.c
> index 2801a6f..6c022b4 100644
> --- a/src/mesa/main/varray.c
> +++ b/src/mesa/main/varray.c
> @@ -2794,10 +2794,10 @@ _mesa_VertexArrayBindingDivisor(GLuint vaobj, GLuint 
> bindingIndex,
>  
>  
>  /**
> - * Copy one client vertex array to another.
> + * Copy one vertex array to another.
>   */
>  void
> -_mesa_copy_client_array(struct gl_context *ctx,
> +_mesa_copy_vertex_array(struct gl_context *ctx,
>  struct gl_vertex_array *dst,
>  struct gl_vertex_array *src)
>  {
> diff --git a/src/mesa/main/varray.h b/src/mesa/main/varray.h
> index 19506bf..79ecd9a 100644
> --- a/src/mesa/main/varray.h
> +++ b/src/mesa/main/varray.h
> @@ -53,7 +53,7 @@ _mesa_vertex_attrib_address(const struct 
> gl_array_attributes *array,
>   * gl_array_attributes and a gl_vertex_buffer_binding.
>   */
>  static inline void
> -_mesa_update_client_array(struct gl_context *ctx,
> +_mesa_update_vertex_array(struct gl_context *ctx,
>struct gl_vertex_array *dst,
>const struct gl_array_attributes *attribs,
>const struct gl_vertex_buffer_binding *binding)
> @@ -475,7 +475,7 @@ _mesa_VertexArrayBindingDivisor(GLuint vaobj, GLuint 
> bindingIndex,
>  GLuint divisor);
>  
>  extern void
> -_mesa_copy_client_array(struct gl_context *ctx,
> 

[Mesa-dev] [Bug 104863] 186 assertions in piglit

2018-01-30 Thread bugzilla-daemon
https://bugs.freedesktop.org/show_bug.cgi?id=104863

Bug ID: 104863
   Summary: 186 assertions in piglit
   Product: Mesa
   Version: git
  Hardware: Other
OS: All
Status: NEW
  Keywords: regression
  Severity: normal
  Priority: medium
 Component: Mesa core
  Assignee: bri...@vmware.com
  Reporter: mark.a.ja...@intel.com
QA Contact: mesa-dev@lists.freedesktop.org
CC: mathias.froehl...@web.de

186 tests assert on each i965 platform, eg:

piglit.spec.ext_framebuffer_multisample.formats 2

/tmp/build_root/m64/lib/piglit/bin/ext_framebuffer_multisample-formats 2 -auto
-fbo
Using test set: Core formats
Testing GL_RGB

Standard Error

ext_framebuffer_multisample-formats: ../src/mesa/main/varray.c:1068:
_mesa_enable_vertex_array_attrib: Assertion `attrib >= VERT_ATTRIB_GENERIC0'
failed.


Triggered between Mesa bc5c54cadfe23905e33b43ecf29dab42026c58a5 and
f892e332a8ea02a99da5b7c4d721bc838b12f33b

bisection underway.

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


[Mesa-dev] [Bug 104863] 186 assertions in piglit

2018-01-30 Thread bugzilla-daemon
https://bugs.freedesktop.org/show_bug.cgi?id=104863

--- Comment #2 from Brian Paul  ---
Patch posted to mesa-dev.  Please review and I'll push it.

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


Re: [Mesa-dev] [PATCH mesa 1/2] meson: centralise the libdrm versions information

2018-01-30 Thread Dylan Baker
Quoting Eric Engestrom (2018-01-30 09:55:53)
> 
> 
> On January 30, 2018 5:34:07 PM UTC, Dylan Baker  wrote:
> > Quoting Eric Engestrom (2018-01-29 10:15:50)
> > > The big comment is taken from the equivalent block in configure.ac
> > > 
> > > Signed-off-by: Eric Engestrom 
> > > ---
> > >  meson.build | 30
> > +
> > >  src/gallium/targets/d3dadapter9/meson.build |  2 +-
> > >  src/mesa/drivers/dri/meson.build|  2 +-
> > >  3 files changed, 24 insertions(+), 10 deletions(-)
> > > 
> > > diff --git a/meson.build b/meson.build
> > > index 0a00798c2a5093ec803b..6d7a8e976ff6ad002d9a 100644
> > > --- a/meson.build
> > > +++ b/meson.build
> > > @@ -41,6 +41,20 @@ pre_args = [
> > >   
> > '-DPACKAGE_BUGREPORT="https://bugs.freedesktop.org/enter_bug.cgi?product=Mesa;',
> > >  ]
> > >  
> > > +# The idea is that libdrm is distributed as one cohesive package,
> > even
> > > +# though it is composed of multiple libraries. However some drivers
> > > +# may have different version requirements than others. This list
> > > +# codifies which drivers need which version of libdrm. Any libdrm
> > > +# version dependencies in non-driver-specific code should be
> > reflected
> > > +# in the first entry.
> > > +libdrm_version   = '2.4.75'
> > > +libdrm_amdgpu_version= '2.4.89'
> > > +libdrm_etnaviv_version   = '2.4.82'
> > > +libdrm_freedreno_version = '2.4.82'
> > > +libdrm_intel_version = '2.4.75'
> > > +libdrm_nouveau_version   = '2.4.66'
> > > +libdrm_radeon_version= '2.4.71'
> > 
> > Is there any reason we can't just make these (for example):
> > libdrm_radeon_version= '>= 2.4.71'
> > 
> > Since that avoids all of the format calls?
> 
> Sure. I was trying to only have the actual numbers here, but in hindsight
> all these format() calls are a bit ugly.
> I'll send a v2 tomorrow.
> 

I understand, I just didn't see a case where we don't want the '>=' as well.
Thanks for doing this, it's been on my long list of todo's for a while now :)


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


Re: [Mesa-dev] [PATCH libdrm] meson: fix libdrm_nouveau pkgconfig include directories

2018-01-30 Thread Dylan Baker
ping

Quoting Dylan Baker (2018-01-25 16:14:45)
> Signed-off-by: Dylan Baker 
> ---
> 
> I have tested building every mesa driver against this (with and without udev!)
> so I'm pretty sure that this is the last pkgbuild problem.
> 
> I'm sure I'll be sad in a day or two...
> 
>  nouveau/meson.build | 2 +-
>  1 file changed, 1 insertion(+), 1 deletion(-)
> 
> diff --git a/nouveau/meson.build b/nouveau/meson.build
> index bfecf84b..f031cd63 100644
> --- a/nouveau/meson.build
> +++ b/nouveau/meson.build
> @@ -45,7 +45,7 @@ install_headers(
>  pkg.generate(
>name : 'libdrm_nouveau',
>libraries : libdrm_nouveau,
> -  subdirs : ['.', 'nouveau'],
> +  subdirs : ['.', 'libdrm', 'libdrm/nouveau'],
>version : meson.project_version(),
>requires_private : 'libdrm',
>description : 'Userspace interface to nouveau kernel DRM services',
> -- 
> 2.16.0
> 


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


Re: [Mesa-dev] [PATCH 7/8] mesa: rename some 'client' array functions

2018-01-30 Thread Brian Paul

On 01/30/2018 09:59 AM, Mark Janes wrote:

This series that was just pushed to master generates ~200 assertions on
all platforms, eg:

piglit.spec.ext_framebuffer_multisample.formats 2

ext_framebuffer_multisample-formats: ../src/mesa/main/varray.c:1068:
_mesa_enable_vertex_array_attrib: Assertion `attrib >=
VERT_ATTRIB_GENERIC0' failed.

Should we revert the series?  This needs to be corrected immediately.


I'll post a patch to remove the assertion.  It appears to be hit via the 
meta code, which is not used by gallium.


-Brian




Brian Paul  writes:


A long time ago gl_vertex_array was gl_client_array.  Update some function
names to be consistent.
---
  src/mesa/main/arrayobj.c | 6 +++---
  src/mesa/main/arrayobj.h | 4 ++--
  src/mesa/main/attrib.c   | 2 +-
  src/mesa/main/state.c| 2 +-
  src/mesa/main/varray.c   | 4 ++--
  src/mesa/main/varray.h   | 4 ++--
  6 files changed, 11 insertions(+), 11 deletions(-)

diff --git a/src/mesa/main/arrayobj.c b/src/mesa/main/arrayobj.c
index b862f0f..ea9b316 100644
--- a/src/mesa/main/arrayobj.c
+++ b/src/mesa/main/arrayobj.c
@@ -311,8 +311,8 @@ _mesa_initialize_vao(struct gl_context *ctx,
   * or a gl_vertex_buffer_binding has changed.
   */
  void
-_mesa_update_vao_client_arrays(struct gl_context *ctx,
-   struct gl_vertex_array_object *vao)
+_mesa_update_vao_derived_arrays(struct gl_context *ctx,
+struct gl_vertex_array_object *vao)
  {
 GLbitfield arrays = vao->NewArrays;
  
@@ -324,7 +324,7 @@ _mesa_update_vao_client_arrays(struct gl_context *ctx,

const struct gl_vertex_buffer_binding *buffer_binding =
   >BufferBinding[attrib_array->BufferBindingIndex];
  
-  _mesa_update_client_array(ctx, client_array, attrib_array,

+  _mesa_update_vertex_array(ctx, client_array, attrib_array,
  buffer_binding);
 }
  }
diff --git a/src/mesa/main/arrayobj.h b/src/mesa/main/arrayobj.h
index 1b9900c..ff26157 100644
--- a/src/mesa/main/arrayobj.h
+++ b/src/mesa/main/arrayobj.h
@@ -78,8 +78,8 @@ _mesa_initialize_vao(struct gl_context *ctx,
  
  
  extern void

-_mesa_update_vao_client_arrays(struct gl_context *ctx,
-   struct gl_vertex_array_object *vao);
+_mesa_update_vao_derived_arrays(struct gl_context *ctx,
+struct gl_vertex_array_object *vao);
  
  /* Returns true if all varying arrays reside in vbos */

  extern bool
diff --git a/src/mesa/main/attrib.c b/src/mesa/main/attrib.c
index 3c12fd6..0b4b63f 100644
--- a/src/mesa/main/attrib.c
+++ b/src/mesa/main/attrib.c
@@ -1503,7 +1503,7 @@ copy_array_object(struct gl_context *ctx,
 /* skip RefCount */
  
 for (i = 0; i < ARRAY_SIZE(src->VertexAttrib); i++) {

-  _mesa_copy_client_array(ctx, >_VertexAttrib[i], 
>_VertexAttrib[i]);
+  _mesa_copy_vertex_array(ctx, >_VertexAttrib[i], 
>_VertexAttrib[i]);
_mesa_copy_vertex_attrib_array(ctx, >VertexAttrib[i], 
>VertexAttrib[i]);
_mesa_copy_vertex_buffer_binding(ctx, >BufferBinding[i], 
>BufferBinding[i]);
 }
diff --git a/src/mesa/main/state.c b/src/mesa/main/state.c
index dd61cc7..df694d0 100644
--- a/src/mesa/main/state.c
+++ b/src/mesa/main/state.c
@@ -357,7 +357,7 @@ _mesa_update_state_locked( struct gl_context *ctx )
 }
  
 if (new_state & _NEW_ARRAY)

-  _mesa_update_vao_client_arrays(ctx, ctx->Array.VAO);
+  _mesa_update_vao_derived_arrays(ctx, ctx->Array.VAO);
  
   out:

 new_prog_state |= update_program_constants(ctx);
diff --git a/src/mesa/main/varray.c b/src/mesa/main/varray.c
index 2801a6f..6c022b4 100644
--- a/src/mesa/main/varray.c
+++ b/src/mesa/main/varray.c
@@ -2794,10 +2794,10 @@ _mesa_VertexArrayBindingDivisor(GLuint vaobj, GLuint 
bindingIndex,
  
  
  /**

- * Copy one client vertex array to another.
+ * Copy one vertex array to another.
   */
  void
-_mesa_copy_client_array(struct gl_context *ctx,
+_mesa_copy_vertex_array(struct gl_context *ctx,
  struct gl_vertex_array *dst,
  struct gl_vertex_array *src)
  {
diff --git a/src/mesa/main/varray.h b/src/mesa/main/varray.h
index 19506bf..79ecd9a 100644
--- a/src/mesa/main/varray.h
+++ b/src/mesa/main/varray.h
@@ -53,7 +53,7 @@ _mesa_vertex_attrib_address(const struct gl_array_attributes 
*array,
   * gl_array_attributes and a gl_vertex_buffer_binding.
   */
  static inline void
-_mesa_update_client_array(struct gl_context *ctx,
+_mesa_update_vertex_array(struct gl_context *ctx,
struct gl_vertex_array *dst,
const struct gl_array_attributes *attribs,
const struct gl_vertex_buffer_binding *binding)
@@ -475,7 +475,7 @@ _mesa_VertexArrayBindingDivisor(GLuint vaobj, GLuint 
bindingIndex,
  GLuint divisor);
  
  extern void

-_mesa_copy_client_array(struct gl_context *ctx,

Re: [Mesa-dev] [PATCH 7/8] mesa: Reduce ffvertex_prog state_key to 36 bytes.

2018-01-30 Thread Mathias Fröhlich
Hi Brian,

On Monday, 29 January 2018 17:05:57 CET Brian Paul wrote:
> The series looks good tome.
> 
> Reviewed-by: Brian Paul 

Thanks for the review!

> Can you push this or do you need me to do it?
And Thanks for pushing.
I used to have a git account and I assume it is still working.
So the next time, we can give that a try again.

best
Mathias



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


Re: [Mesa-dev] [PATCH] mesa: remove invalid assertion in _mesa_enable_vertex_array_attrib()

2018-01-30 Thread Brian Paul

On 01/30/2018 10:35 AM, Roland Scheidegger wrote:

Should the meta module not do this?


The meta module is OK.  It's using this function to enable vertex 
position, for example.




In any case,
Reviewed-by: Roland Scheidegger 


Thanks!

-Brian



Am 30.01.2018 um 18:14 schrieb Brian Paul:

The meta module passes some 0-based attrib values.  Should fix Piglit
regressions reported by Mark Janes.

Bugzilla: 
https://urldefense.proofpoint.com/v2/url?u=https-3A__bugs.freedesktop.org_show-5Fbug.cgi-3Fid-3D104863=DwIGaQ=uilaK90D4TOVoH58JNXRgQ=_QIjpv-UJ77xEQY8fIYoQtr5qv8wKrPJc7v7_-CYAb0=xOz2kY7Vkhso-In1VT-iEa8fb2AR83C9FQ3IW8KLXzU=YQYaKowlcOY50rg1E_q3wnoxzHPbNhIAO8UJd_t2EpM=
---
  src/mesa/main/varray.c | 1 -
  1 file changed, 1 deletion(-)

diff --git a/src/mesa/main/varray.c b/src/mesa/main/varray.c
index b2783e2..bc0afa6 100644
--- a/src/mesa/main/varray.c
+++ b/src/mesa/main/varray.c
@@ -1065,7 +1065,6 @@ _mesa_enable_vertex_array_attrib(struct gl_context *ctx,
   struct gl_vertex_array_object *vao,
   gl_vert_attrib attrib)
  {
-   assert(attrib >= VERT_ATTRIB_GENERIC0);
 assert(attrib < ARRAY_SIZE(vao->VertexAttrib));
  
 if (!vao->VertexAttrib[attrib].Enabled) {






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


Re: [Mesa-dev] [PATCH mesa 1/2] meson: centralise the libdrm versions information

2018-01-30 Thread Eric Engestrom


On January 30, 2018 5:34:07 PM UTC, Dylan Baker  wrote:
> Quoting Eric Engestrom (2018-01-29 10:15:50)
> > The big comment is taken from the equivalent block in configure.ac
> > 
> > Signed-off-by: Eric Engestrom 
> > ---
> >  meson.build | 30
> +
> >  src/gallium/targets/d3dadapter9/meson.build |  2 +-
> >  src/mesa/drivers/dri/meson.build|  2 +-
> >  3 files changed, 24 insertions(+), 10 deletions(-)
> > 
> > diff --git a/meson.build b/meson.build
> > index 0a00798c2a5093ec803b..6d7a8e976ff6ad002d9a 100644
> > --- a/meson.build
> > +++ b/meson.build
> > @@ -41,6 +41,20 @@ pre_args = [
> >   
> '-DPACKAGE_BUGREPORT="https://bugs.freedesktop.org/enter_bug.cgi?product=Mesa;',
> >  ]
> >  
> > +# The idea is that libdrm is distributed as one cohesive package,
> even
> > +# though it is composed of multiple libraries. However some drivers
> > +# may have different version requirements than others. This list
> > +# codifies which drivers need which version of libdrm. Any libdrm
> > +# version dependencies in non-driver-specific code should be
> reflected
> > +# in the first entry.
> > +libdrm_version   = '2.4.75'
> > +libdrm_amdgpu_version= '2.4.89'
> > +libdrm_etnaviv_version   = '2.4.82'
> > +libdrm_freedreno_version = '2.4.82'
> > +libdrm_intel_version = '2.4.75'
> > +libdrm_nouveau_version   = '2.4.66'
> > +libdrm_radeon_version= '2.4.71'
> 
> Is there any reason we can't just make these (for example):
> libdrm_radeon_version= '>= 2.4.71'
> 
> Since that avoids all of the format calls?

Sure. I was trying to only have the actual numbers here, but in hindsight
all these format() calls are a bit ugly.
I'll send a v2 tomorrow.

> 
> [snip]
> 
> Dylan
___
mesa-dev mailing list
mesa-dev@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/mesa-dev


Re: [Mesa-dev] [PATCH 8/8] mesa: use gl_vert_attrib enum type in more places

2018-01-30 Thread Gert Wollny
Am Dienstag, den 30.01.2018, 08:26 -0700 schrieb Brian Paul:
> On 01/30/2018 01:38 AM, Gert Wollny wrote:
> > Am Montag, den 29.01.2018, 13:42 -0700 schrieb Brian Paul:
> > > Slightly better readbility.
> > > ---
> > >   src/mesa/main/arrayobj.c |  2 +-
> > >   src/mesa/main/varray.c   | 12 ++--
> > >   src/mesa/main/varray.h   |  4 ++--
> > >   3 files changed, 9 insertions(+), 9 deletions(-)
> > > 
> > > diff --git a/src/mesa/main/arrayobj.c b/src/mesa/main/arrayobj.c
> > > index ea9b316..1951638 100644
> > > --- a/src/mesa/main/arrayobj.c
> > > +++ b/src/mesa/main/arrayobj.c
> > > @@ -231,7 +231,7 @@ _mesa_reference_vao_(struct gl_context *ctx,
> > >   static void
> > >   init_array(struct gl_context *ctx,
> > >  struct gl_vertex_array_object *vao,
> > > -   GLuint index, GLint size, GLint type)
> > > +   gl_vert_attrib index, GLint size, GLint type)
> > >   {
> > >  struct gl_array_attributes *array = 
> > > >VertexAttrib[index];
> > >  struct gl_vertex_buffer_binding *binding = 
> > > > BufferBinding[index];
> > 
> > This conflicts with d5f42f96e16f4b12, you added an asset there.
> 
> Yeah, I rebased/reordered my patches several times (same story with 
> patch 4/8).  This change is still applicable.  Can I assume your R-b
> for the rest of the patch?
Yes, I took a second look now. 


> 
> > 
> > With that patches 1-3 and 5-7 are
> >Reviewed-by: Gert Wollny 
> 
> Thanks.
> 
> -Brian
> 
> 
> > 
> > 
> > > diff --git a/src/mesa/main/varray.c b/src/mesa/main/varray.c
> > > index 6c022b4..b2783e2 100644
> > > --- a/src/mesa/main/varray.c
> > > +++ b/src/mesa/main/varray.c
> > > @@ -132,7 +132,7 @@ type_to_bit(const struct gl_context *ctx,
> > > GLenum
> > > type)
> > >   static void
> > >   vertex_attrib_binding(struct gl_context *ctx,
> > > struct gl_vertex_array_object *vao,
> > > -  GLuint attribIndex,
> > > +  gl_vert_attrib attribIndex,
> > > GLuint bindingIndex)
> > >   {
> > >  struct gl_array_attributes *array = 
> > > > VertexAttrib[attribIndex];
> > > 
> > > @@ -294,7 +294,7 @@ get_array_format(const struct gl_context
> > > *ctx,
> > > GLint sizeMax, GLint *size)
> > >   void
> > >   _mesa_update_array_format(struct gl_context *ctx,
> > > struct gl_vertex_array_object *vao,
> > > -  GLuint attrib, GLint size, GLenum
> > > type,
> > > +  gl_vert_attrib attrib, GLint size,
> > > GLenum
> > > type,
> > > GLenum format, GLboolean normalized,
> > > GLboolean integer, GLboolean doubles,
> > > GLuint relativeOffset)
> > > @@ -1063,7 +1063,7 @@ _mesa_VertexAttribLPointer(GLuint index,
> > > GLint
> > > size, GLenum type,
> > >   void
> > >   _mesa_enable_vertex_array_attrib(struct gl_context *ctx,
> > >struct gl_vertex_array_object
> > > *vao,
> > > - unsigned attrib)
> > > + gl_vert_attrib attrib)
> > >   {
> > >  assert(attrib >= VERT_ATTRIB_GENERIC0);
> > >  assert(attrib < ARRAY_SIZE(vao->VertexAttrib));
> > > @@ -1965,7 +1965,7 @@ _mesa_VertexAttribDivisor_no_error(GLuint
> > > index, GLuint divisor)
> > >   {
> > >  GET_CURRENT_CONTEXT(ctx);
> > >   
> > > -   const GLuint genericIndex = VERT_ATTRIB_GENERIC(index);
> > > +   const gl_vert_attrib genericIndex =
> > > VERT_ATTRIB_GENERIC(index);
> > >  struct gl_vertex_array_object * const vao = ctx->Array.VAO;
> > >   
> > >  assert(genericIndex < ARRAY_SIZE(vao->VertexAttrib));
> > > @@ -1996,7 +1996,7 @@ _mesa_VertexAttribDivisor(GLuint index,
> > > GLuint
> > > divisor)
> > >   {
> > >  GET_CURRENT_CONTEXT(ctx);
> > >   
> > > -   const GLuint genericIndex = VERT_ATTRIB_GENERIC(index);
> > > +   const gl_vert_attrib genericIndex =
> > > VERT_ATTRIB_GENERIC(index);
> > >  struct gl_vertex_array_object * const vao = ctx->Array.VAO;
> > >   
> > >  if (!ctx->Extensions.ARB_instanced_arrays) {
> > > @@ -2856,7 +2856,7 @@ _mesa_print_arrays(struct gl_context *ctx)
> > >   
> > >  fprintf(stderr, "Array Object %u\n", vao->Name);
> > >   
> > > -   unsigned i;
> > > +   gl_vert_attrib i;
> > >  for (i = 0; i < VERT_ATTRIB_MAX; ++i) {
> > > const struct gl_array_attributes *array = 
> > > > VertexAttrib[i];
> > > 
> > > if (!array->Enabled)
> > > diff --git a/src/mesa/main/varray.h b/src/mesa/main/varray.h
> > > index 79ecd9a..fe7eb81 100644
> > > --- a/src/mesa/main/varray.h
> > > +++ b/src/mesa/main/varray.h
> > > @@ -96,7 +96,7 @@ _mesa_set_drawing_arrays(struct gl_context
> > > *ctx,
> > >   extern void
> > >   _mesa_update_array_format(struct gl_context *ctx,
> > > struct gl_vertex_array_object *vao,
> > > -  GLuint attrib, 

[Mesa-dev] [Bug 104863] 186 assertions in piglit

2018-01-30 Thread bugzilla-daemon
https://bugs.freedesktop.org/show_bug.cgi?id=104863

Brian Paul  changed:

   What|Removed |Added

 Resolution|--- |FIXED
 Status|NEW |RESOLVED

--- Comment #3 from Brian Paul  ---
Roland reviewed the patch.
Pushed as 1a9aa69ae85d7eb1baae1f2ee6af84d6fbd22de7

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


Re: [Mesa-dev] [PATCH 3/3] radeonsi: remove DBG_PRECOMPILE

2018-01-30 Thread Nicolai Hähnle

Series is:

Reviewed-by: Nicolai Hähnle 


On 27.01.2018 19:01, Marek Olšák wrote:

From: Marek Olšák 

it's useless and shader-db stats only report the main shader part.
---
  src/gallium/drivers/radeon/r600_pipe_common.h   |  1 -
  src/gallium/drivers/radeonsi/si_pipe.c  |  1 -
  src/gallium/drivers/radeonsi/si_state_shaders.c | 49 -
  3 files changed, 51 deletions(-)

diff --git a/src/gallium/drivers/radeon/r600_pipe_common.h 
b/src/gallium/drivers/radeon/r600_pipe_common.h
index a8e632c..d82e123 100644
--- a/src/gallium/drivers/radeon/r600_pipe_common.h
+++ b/src/gallium/drivers/radeon/r600_pipe_common.h
@@ -69,21 +69,20 @@ enum {
DBG_NO_ASM,
DBG_PREOPT_IR,
  
  	/* Shader compiler options the shader cache should be aware of: */

DBG_FS_CORRECT_DERIVS_AFTER_KILL,
DBG_UNSAFE_MATH,
DBG_SI_SCHED,
  
  	/* Shader compiler options (with no effect on the shader cache): */

DBG_CHECK_IR,
-   DBG_PRECOMPILE,
DBG_NIR,
DBG_MONOLITHIC_SHADERS,
DBG_NO_OPT_VARIANT,
  
  	/* Information logging options: */

DBG_INFO,
DBG_TEX,
DBG_COMPUTE,
DBG_VM,
  
diff --git a/src/gallium/drivers/radeonsi/si_pipe.c b/src/gallium/drivers/radeonsi/si_pipe.c

index 676d199..79c31a4 100644
--- a/src/gallium/drivers/radeonsi/si_pipe.c
+++ b/src/gallium/drivers/radeonsi/si_pipe.c
@@ -48,21 +48,20 @@ static const struct debug_named_value debug_options[] = {
{ "notgsi", DBG(NO_TGSI), "Don't print the TGSI"},
{ "noasm", DBG(NO_ASM), "Don't print disassembled shaders"},
{ "preoptir", DBG(PREOPT_IR), "Print the LLVM IR before initial 
optimizations" },
  
  	/* Shader compiler options the shader cache should be aware of: */

{ "unsafemath", DBG(UNSAFE_MATH), "Enable unsafe math shader 
optimizations" },
{ "sisched", DBG(SI_SCHED), "Enable LLVM SI Machine Instruction 
Scheduler." },
  
  	/* Shader compiler options (with no effect on the shader cache): */

{ "checkir", DBG(CHECK_IR), "Enable additional sanity checks on shader 
IR" },
-   { "precompile", DBG(PRECOMPILE), "Compile one shader variant at shader 
creation." },
{ "nir", DBG(NIR), "Enable experimental NIR shaders" },
{ "mono", DBG(MONOLITHIC_SHADERS), "Use old-style monolithic shaders 
compiled on demand" },
{ "nooptvariant", DBG(NO_OPT_VARIANT), "Disable compiling optimized shader 
variants." },
  
  	/* Information logging options: */

{ "info", DBG(INFO), "Print driver information" },
{ "tex", DBG(TEX), "Print texture info" },
{ "compute", DBG(COMPUTE), "Print compute info" },
{ "vm", DBG(VM), "Print virtual addresses when creating resources" },
  
diff --git a/src/gallium/drivers/radeonsi/si_state_shaders.c b/src/gallium/drivers/radeonsi/si_state_shaders.c

index 959aead..2c1d990 100644
--- a/src/gallium/drivers/radeonsi/si_state_shaders.c
+++ b/src/gallium/drivers/radeonsi/si_state_shaders.c
@@ -1778,21 +1778,20 @@ static void si_parse_next_shader_property(const struct 
tgsi_shader_info *info,
   * Compile the main shader part or the monolithic shader as part of
   * si_shader_selector initialization. Since it can be done asynchronously,
   * there is no way to report compile failures to applications.
   */
  static void si_init_shader_selector_async(void *job, int thread_index)
  {
struct si_shader_selector *sel = (struct si_shader_selector *)job;
struct si_screen *sscreen = sel->screen;
LLVMTargetMachineRef tm;
struct pipe_debug_callback *debug = >compiler_ctx_state.debug;
-   unsigned i;
  
  	assert(!debug->debug_message || debug->async);

assert(thread_index >= 0);
assert(thread_index < ARRAY_SIZE(sscreen->tm));
tm = sscreen->tm[thread_index];
  
  	/* Compile the main shader part for use with a prolog and/or epilog.

 * If this fails, the driver will try to compile a monolithic shader
 * on demand.
 */
@@ -1882,68 +1881,20 @@ static void si_init_shader_selector_async(void *job, 
int thread_index)
case TGSI_SEMANTIC_POSITION: /* ignore these */
case TGSI_SEMANTIC_PSIZE:
case TGSI_SEMANTIC_CLIPVERTEX:
case TGSI_SEMANTIC_EDGEFLAG:
break;
}
}
}
}
  
-	/* Pre-compilation. */

-   if (sscreen->debug_flags & DBG(PRECOMPILE) &&
-   /* GFX9 needs LS or ES for compilation, which we don't have here. */
-   (sscreen->info.chip_class <= VI ||
-(sel->type != PIPE_SHADER_TESS_CTRL &&
- sel->type != PIPE_SHADER_GEOMETRY))) {
-   struct si_shader_ctx_state state = {sel};
-   struct si_shader_key key;
-
-   

Re: [Mesa-dev] [PATCH 10/11] vbo: optimize loops in bind_vertex_list(), vbo_exec_bind_arrays()

2018-01-30 Thread Mathias Fröhlich
Hi Brian,

On Monday, 29 January 2018 19:24:15 CET Brian Paul wrote:
> On 01/27/2018 08:01 AM, Mathias Fröhlich wrote:
> > Hi Brian,
> > 
> > The change should not change the current behavior.
> > Nevertheless the current behavior as well as past your change the code has 
a
> > corner case that will not work correctly.
> 
> Can you elaborate?

If VBO_ATTRIB_POS is in the current code switched off in favour 
VBO_ATTRIB_GENERIC0 then the offsets may get shifted as in the wong sequence 
as the array look only does buffer_offset += node_attrsz[src] *...;
So if the size array position at number 0 is skipped at incrementing the 
buffer_offset variable already the next VBO_NORMAL_ARRAY offset is wrong by 
the unapplied position offset. The generic values are again with the correct 
offset as the positon offset increment was applied then.

> > I do have a hand full of unpublished changes here that will fix that 
potential
> > problem and achieve something similar to what you are doing now with 
different
> > means. So, if you don't mind not applying that one I that saves me from
> > intrusively rebasing my series here.
> 
> Sounds good.
I hope to send a first part for review later today.

best

Mathias


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


Re: [Mesa-dev] [PATCH 04/51] glsl: Print 16-bit constants

2018-01-30 Thread Pohjolainen, Topi
On Mon, Nov 27, 2017 at 08:41:42PM +0200, Pohjolainen, Topi wrote:
> On Mon, Nov 27, 2017 at 11:40:49AM -0800, Matt Turner wrote:
> > On 11/24, Topi Pohjolainen wrote:
> > > ---
> > > src/compiler/glsl/ir_print_visitor.cpp | 1 +
> > > 1 file changed, 1 insertion(+)
> > > 
> > > diff --git a/src/compiler/glsl/ir_print_visitor.cpp 
> > > b/src/compiler/glsl/ir_print_visitor.cpp
> > > index ea14cdeb6c..ab9a35d73f 100644
> > > --- a/src/compiler/glsl/ir_print_visitor.cpp
> > > +++ b/src/compiler/glsl/ir_print_visitor.cpp
> > > @@ -482,6 +482,7 @@ void ir_print_visitor::visit(ir_constant *ir)
> > >case GLSL_TYPE_UINT:  fprintf(f, "%u", ir->value.u[i]); break;
> > >case GLSL_TYPE_INT:   fprintf(f, "%d", ir->value.i[i]); break;
> > >case GLSL_TYPE_FLOAT:
> > > +  case GLSL_TYPE_FLOAT16:
> > 
> > Are fp16 values stored as 32-bit floats in ir->value.f[]? That seems
> > surprising.
> 
> Right. This needs more thought I guess. In the GLSL lowering pass I'm only
> changing types at the moment and the conversion of constants from 32-bits
> to 16-bits later in GLSL -> NIR. See patch:
> 
> glsl: Add support for 16-bit float constants in nir-conversion

Okay, coming back to this. At the moment there is no separate storage for
16-bit float in "union ir_constant_data". I thought about adding it but then
couldn't see the added value as we might as well store 16-bit constants with
32-bit precision. They are originally 32-bit anyway - it is the lowering pass
that might change the type to 16-bit.

What do you think?
___
mesa-dev mailing list
mesa-dev@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/mesa-dev


[Mesa-dev] [Bug 104863] 186 assertions in piglit

2018-01-30 Thread bugzilla-daemon
https://bugs.freedesktop.org/show_bug.cgi?id=104863

--- Comment #1 from Mark Janes  ---
4ab7e03e1fc7ac6c7cd3a5a1c160726f2a262e66 is the first bad commit
commit 4ab7e03e1fc7ac6c7cd3a5a1c160726f2a262e66
Author: Brian Paul 
Date:   Fri Jan 26 11:03:57 2018 -0700
mesa: add an assertion in _mesa_enable_vertex_array_attrib()

Some of the enable/disable vertex array functions take a zero-based
generic index, while others take a VERT_ATTRIB_GENERIC0-based value.
Add an assertion to clarify that in one place.

Reviewed-by: Gert Wollny 

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


Re: [Mesa-dev] [PATCH] mesa: remove invalid assertion in _mesa_enable_vertex_array_attrib()

2018-01-30 Thread Roland Scheidegger
Should the meta module not do this?
In any case,
Reviewed-by: Roland Scheidegger 

Am 30.01.2018 um 18:14 schrieb Brian Paul:
> The meta module passes some 0-based attrib values.  Should fix Piglit
> regressions reported by Mark Janes.
> 
> Bugzilla: 
> https://urldefense.proofpoint.com/v2/url?u=https-3A__bugs.freedesktop.org_show-5Fbug.cgi-3Fid-3D104863=DwIGaQ=uilaK90D4TOVoH58JNXRgQ=_QIjpv-UJ77xEQY8fIYoQtr5qv8wKrPJc7v7_-CYAb0=xOz2kY7Vkhso-In1VT-iEa8fb2AR83C9FQ3IW8KLXzU=YQYaKowlcOY50rg1E_q3wnoxzHPbNhIAO8UJd_t2EpM=
> ---
>  src/mesa/main/varray.c | 1 -
>  1 file changed, 1 deletion(-)
> 
> diff --git a/src/mesa/main/varray.c b/src/mesa/main/varray.c
> index b2783e2..bc0afa6 100644
> --- a/src/mesa/main/varray.c
> +++ b/src/mesa/main/varray.c
> @@ -1065,7 +1065,6 @@ _mesa_enable_vertex_array_attrib(struct gl_context *ctx,
>   struct gl_vertex_array_object *vao,
>   gl_vert_attrib attrib)
>  {
> -   assert(attrib >= VERT_ATTRIB_GENERIC0);
> assert(attrib < ARRAY_SIZE(vao->VertexAttrib));
>  
> if (!vao->VertexAttrib[attrib].Enabled) {
> 

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


Re: [Mesa-dev] [PATCH 7/8] mesa: rename some 'client' array functions

2018-01-30 Thread Gert Wollny
Am Dienstag, den 30.01.2018, 10:14 -0700 schrieb Brian Paul:
> On 01/30/2018 09:59 AM, Mark Janes wrote:
> > This series that was just pushed to master generates ~200
> > assertions on
> > all platforms, eg:
> > 
> > piglit.spec.ext_framebuffer_multisample.formats 2
> > 
> > ext_framebuffer_multisample-formats:
> > ../src/mesa/main/varray.c:1068:
> > _mesa_enable_vertex_array_attrib: Assertion `attrib >=
> > VERT_ATTRIB_GENERIC0' failed.
> > 
> > Should we revert the series?  This needs to be corrected
> > immediately.
> 
> I'll post a patch to remove the assertion.  It appears to be hit via
> the meta code, which is not used by gallium.

How can I trigger this? - because on r600 with the piglit/quick tests I
didn't see the problem. 

Best, 
 Gert  

> 
> -Brian
> 
> 
> > 
> > Brian Paul  writes:
> > 
> > > A long time ago gl_vertex_array was gl_client_array.  Update some
> > > function
> > > names to be consistent.
> > > ---
> > >   src/mesa/main/arrayobj.c | 6 +++---
> > >   src/mesa/main/arrayobj.h | 4 ++--
> > >   src/mesa/main/attrib.c   | 2 +-
> > >   src/mesa/main/state.c| 2 +-
> > >   src/mesa/main/varray.c   | 4 ++--
> > >   src/mesa/main/varray.h   | 4 ++--
> > >   6 files changed, 11 insertions(+), 11 deletions(-)
> > > 
> > > diff --git a/src/mesa/main/arrayobj.c b/src/mesa/main/arrayobj.c
> > > index b862f0f..ea9b316 100644
> > > --- a/src/mesa/main/arrayobj.c
> > > +++ b/src/mesa/main/arrayobj.c
> > > @@ -311,8 +311,8 @@ _mesa_initialize_vao(struct gl_context *ctx,
> > >* or a gl_vertex_buffer_binding has changed.
> > >*/
> > >   void
> > > -_mesa_update_vao_client_arrays(struct gl_context *ctx,
> > > -   struct gl_vertex_array_object
> > > *vao)
> > > +_mesa_update_vao_derived_arrays(struct gl_context *ctx,
> > > +struct gl_vertex_array_object
> > > *vao)
> > >   {
> > >  GLbitfield arrays = vao->NewArrays;
> > >   
> > > @@ -324,7 +324,7 @@ _mesa_update_vao_client_arrays(struct
> > > gl_context *ctx,
> > > const struct gl_vertex_buffer_binding *buffer_binding =
> > >>BufferBinding[attrib_array->BufferBindingIndex];
> > >   
> > > -  _mesa_update_client_array(ctx, client_array, attrib_array,
> > > +  _mesa_update_vertex_array(ctx, client_array, attrib_array,
> > >   buffer_binding);
> > >  }
> > >   }
> > > diff --git a/src/mesa/main/arrayobj.h b/src/mesa/main/arrayobj.h
> > > index 1b9900c..ff26157 100644
> > > --- a/src/mesa/main/arrayobj.h
> > > +++ b/src/mesa/main/arrayobj.h
> > > @@ -78,8 +78,8 @@ _mesa_initialize_vao(struct gl_context *ctx,
> > >   
> > >   
> > >   extern void
> > > -_mesa_update_vao_client_arrays(struct gl_context *ctx,
> > > -   struct gl_vertex_array_object
> > > *vao);
> > > +_mesa_update_vao_derived_arrays(struct gl_context *ctx,
> > > +struct gl_vertex_array_object
> > > *vao);
> > >   
> > >   /* Returns true if all varying arrays reside in vbos */
> > >   extern bool
> > > diff --git a/src/mesa/main/attrib.c b/src/mesa/main/attrib.c
> > > index 3c12fd6..0b4b63f 100644
> > > --- a/src/mesa/main/attrib.c
> > > +++ b/src/mesa/main/attrib.c
> > > @@ -1503,7 +1503,7 @@ copy_array_object(struct gl_context *ctx,
> > >  /* skip RefCount */
> > >   
> > >  for (i = 0; i < ARRAY_SIZE(src->VertexAttrib); i++) {
> > > -  _mesa_copy_client_array(ctx, >_VertexAttrib[i],
> > > >_VertexAttrib[i]);
> > > +  _mesa_copy_vertex_array(ctx, >_VertexAttrib[i],
> > > >_VertexAttrib[i]);
> > > _mesa_copy_vertex_attrib_array(ctx, 
> > > >VertexAttrib[i], >VertexAttrib[i]);
> > > _mesa_copy_vertex_buffer_binding(ctx, 
> > > >BufferBinding[i], >BufferBinding[i]);
> > >  }
> > > diff --git a/src/mesa/main/state.c b/src/mesa/main/state.c
> > > index dd61cc7..df694d0 100644
> > > --- a/src/mesa/main/state.c
> > > +++ b/src/mesa/main/state.c
> > > @@ -357,7 +357,7 @@ _mesa_update_state_locked( struct gl_context
> > > *ctx )
> > >  }
> > >   
> > >  if (new_state & _NEW_ARRAY)
> > > -  _mesa_update_vao_client_arrays(ctx, ctx->Array.VAO);
> > > +  _mesa_update_vao_derived_arrays(ctx, ctx->Array.VAO);
> > >   
> > >out:
> > >  new_prog_state |= update_program_constants(ctx);
> > > diff --git a/src/mesa/main/varray.c b/src/mesa/main/varray.c
> > > index 2801a6f..6c022b4 100644
> > > --- a/src/mesa/main/varray.c
> > > +++ b/src/mesa/main/varray.c
> > > @@ -2794,10 +2794,10 @@ _mesa_VertexArrayBindingDivisor(GLuint
> > > vaobj, GLuint bindingIndex,
> > >   
> > >   
> > >   /**
> > > - * Copy one client vertex array to another.
> > > + * Copy one vertex array to another.
> > >*/
> > >   void
> > > -_mesa_copy_client_array(struct gl_context *ctx,
> > > +_mesa_copy_vertex_array(struct gl_context *ctx,
> > >   struct gl_vertex_array *dst,
> > >   struct gl_vertex_array *src)

[Mesa-dev] [PATCH] mesa: remove invalid assertion in _mesa_enable_vertex_array_attrib()

2018-01-30 Thread Brian Paul
The meta module passes some 0-based attrib values.  Should fix Piglit
regressions reported by Mark Janes.

Bugzilla: https://bugs.freedesktop.org/show_bug.cgi?id=104863
---
 src/mesa/main/varray.c | 1 -
 1 file changed, 1 deletion(-)

diff --git a/src/mesa/main/varray.c b/src/mesa/main/varray.c
index b2783e2..bc0afa6 100644
--- a/src/mesa/main/varray.c
+++ b/src/mesa/main/varray.c
@@ -1065,7 +1065,6 @@ _mesa_enable_vertex_array_attrib(struct gl_context *ctx,
  struct gl_vertex_array_object *vao,
  gl_vert_attrib attrib)
 {
-   assert(attrib >= VERT_ATTRIB_GENERIC0);
assert(attrib < ARRAY_SIZE(vao->VertexAttrib));
 
if (!vao->VertexAttrib[attrib].Enabled) {
-- 
2.7.4

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


Re: [Mesa-dev] [PATCH v2] meson: generate translations for driconf

2018-01-30 Thread Dylan Baker
Quoting Marc Dietrich (2018-01-27 06:36:51)
> Hi Dylan,
> 
> Am Donnerstag, 25. Januar 2018, 20:32:23 CET schrieb Dylan Baker:
> > Currently meson implements the same logic as SCons for translations,
> > namely it doesn't do them. This patch changes meson to use logic more
> > like autotools, and generate translations. To do this we have to go
> > behind meson's back a bit, and wrap the whole thing up in a single
> > python script.
> > 
> > Meson has a module for gettext translations, but it assumes that one
> > will have a pot file, and then .mo translations will be generated and
> > checked into the source repo (or generated by hand using custom ninja
> > targets before building), mesa assumes that the targets will be
> > regenerated on each invocation of make or ninja. I think this can be
> > fixed upstream, but in the mean time this adds support for using
> > translations.
> 
> I have some patch sitting in my local tree which also addresses this problem. 
> It is a bit shorter and doesn't require an external script. I initially tried 
> to solve this by adding some custom targets mostly in order to learn some 
> meson. Unfortunately, I didn't came far. I also tried the i18n module, but as 
> you said, there are still some features missing.
> 
> Nevertheless, here is my solution using run_commands instead of external 
> script. The advantage maybe better maintainability:
> 
> diff --git a/src/util/xmlpool/meson.build b/src/util/xmlpool/meson.build
> index 97693fac8c..91f2b025f6 100644
> --- a/src/util/xmlpool/meson.build
> +++ b/src/util/xmlpool/meson.build
> @@ -18,11 +18,36 @@
>  # OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN 
> THE
>  # SOFTWARE.
>  
> +langs = ['ca', 'es', 'de', 'nl', 'sv', 'fr']
> +deps = []
> +pot = 'xmlpool.pot'
> +out = meson.current_build_dir()
> +in = meson.current_source_dir()
> +
> +xmlpool_pot = custom_target(
> +  pot,
> +  build_by_default : true,
> +  input : 't_options.h',
> +  output : pot,
> +  command : ['xgettext', '-LC', '--from-code=utf-8', '-o', '@OUTPUT@', 
> '@INPUT@'],
> +)
> +
> +foreach l : langs
> +  po = l+'.po'
> +  mo = '@0@/LC_MESSAGES/options.mo'.format(l)
> +  message('Merge new strings @0@ into @1@'.format(po, pot))
> +  run_command('msgmerge', '-o', join_paths(out, po), join_paths(in, po), pot)
> +  message('Updating (@0@) @1@ from @2@.'.format(l, mo, po))
> +  run_command('mkdir', '-p', join_paths(out, l, 'LC_MESSAGES'))
> +  run_command('msgfmt', '-o', join_paths(out, mo), po)
> +  deps += po
> +endforeach
> +

Hi Marc,

I'm not a huge fan of this, it adds three unix specific dependencies, and every
time ninja is run we'll call mkdir and msgfrmt multiple times. I really like the
idea of fixing the i18n module to return custom targets instead of run targets,
but that's going take some work and wont come until a newer version of meson.
Maybe the thing to do is to just rely on distros manually updating the mo files.

Dylan


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


Re: [Mesa-dev] [PATCH mesa 1/2] meson: centralise the libdrm versions information

2018-01-30 Thread Dylan Baker
Quoting Eric Engestrom (2018-01-29 10:15:50)
> The big comment is taken from the equivalent block in configure.ac
> 
> Signed-off-by: Eric Engestrom 
> ---
>  meson.build | 30 
> +
>  src/gallium/targets/d3dadapter9/meson.build |  2 +-
>  src/mesa/drivers/dri/meson.build|  2 +-
>  3 files changed, 24 insertions(+), 10 deletions(-)
> 
> diff --git a/meson.build b/meson.build
> index 0a00798c2a5093ec803b..6d7a8e976ff6ad002d9a 100644
> --- a/meson.build
> +++ b/meson.build
> @@ -41,6 +41,20 @@ pre_args = [
>
> '-DPACKAGE_BUGREPORT="https://bugs.freedesktop.org/enter_bug.cgi?product=Mesa;',
>  ]
>  
> +# The idea is that libdrm is distributed as one cohesive package, even
> +# though it is composed of multiple libraries. However some drivers
> +# may have different version requirements than others. This list
> +# codifies which drivers need which version of libdrm. Any libdrm
> +# version dependencies in non-driver-specific code should be reflected
> +# in the first entry.
> +libdrm_version   = '2.4.75'
> +libdrm_amdgpu_version= '2.4.89'
> +libdrm_etnaviv_version   = '2.4.82'
> +libdrm_freedreno_version = '2.4.82'
> +libdrm_intel_version = '2.4.75'
> +libdrm_nouveau_version   = '2.4.66'
> +libdrm_radeon_version= '2.4.71'

Is there any reason we can't just make these (for example):
libdrm_radeon_version= '>= 2.4.71'

Since that avoids all of the format calls?

[snip]

Dylan


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


Re: [Mesa-dev] [PATCH 3/6] meson: build src/glx/apple

2018-01-30 Thread Dylan Baker
Quoting Jon Turney (2018-01-28 06:24:10)
> ---
>  src/glx/apple/meson.build | 62 
> +++
>  src/glx/meson.build   |  4 +++
>  2 files changed, 66 insertions(+)
>  create mode 100644 src/glx/apple/meson.build
> 
> diff --git a/src/glx/apple/meson.build b/src/glx/apple/meson.build
> new file mode 100644
> index 000..f69803713e0
> --- /dev/null
> +++ b/src/glx/apple/meson.build
> @@ -0,0 +1,62 @@
> +# Copyright © 2017 Jon Turney
> +
> +# Permission is hereby granted, free of charge, to any person obtaining a 
> copy
> +# of this software and associated documentation files (the "Software"), to 
> deal
> +# in the Software without restriction, including without limitation the 
> rights
> +# to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
> +# copies of the Software, and to permit persons to whom the Software is
> +# furnished to do so, subject to the following conditions:
> +
> +# The above copyright notice and this permission notice shall be included in
> +# all copies or substantial portions of the Software.
> +
> +# THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
> +# IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
> +# FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
> +# AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
> +# LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING 
> FROM,
> +# OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN 
> THE
> +# SOFTWARE.
> +
> +# library for native GL on macos
> +files_libappleglx = files(
> +  'apple_cgl.c',
> +  'apple_cgl.h',
> +  'appledri.c',
> +  'appledri.h',
> +  'appledristr.h',
> +  'apple_glapi.c',
> +  'apple_glx.c',
> +  'apple_glx_context.c',
> +  'apple_glx_context.h',
> +  'apple_glx_drawable.c',
> +  'apple_glx_drawable.h',
> +  'apple_glx.h',
> +  'apple_glx_log.c',
> +  'apple_glx_log.h',
> +  'apple_glx_pbuffer.c',
> +  'apple_glx_pixmap.c',
> +  'apple_glx_surface.c',
> +  'apple_visual.c',
> +  'apple_visual.h',
> +  'apple_xgl_api.h',
> +  'apple_xgl_api_read.c',
> +  'apple_xgl_api_stereo.c',
> +  'apple_xgl_api_viewport.c',
> +  'glx_empty.c',
> +)
> +
> +dep_xplugin = []
> +if with_dri_platform == 'apple'
> +  dep_xplugin = meson.get_compiler('c').find_library('Xplugin')
> +endif
> +# -framework ApplicationServices -framework CoreFoundation

Is this not available as a framework? (I don't know, I'm not a mac expert by any
stretch).

> +
> +libappleglx = static_library(
> +  'glxapple',
> +  [files_libappleglx, glapitable_h],
> +  include_directories: [inc_mesa, inc_glx, inc_src, inc_include, inc_glapi],
> +  dependencies: [dep_xext, dep_xplugin],
> +  c_args: [c_vis_args],
> +  build_by_default: false,
> +)
> diff --git a/src/glx/meson.build b/src/glx/meson.build
> index 04cd647ee49..ecedfd60f0e 100644
> --- a/src/glx/meson.build
> +++ b/src/glx/meson.build
> @@ -18,6 +18,9 @@
>  # OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN 
> THE
>  # SOFTWARE.
>  
> +inc_glx = include_directories('.')
> +
> +subdir('apple')
>  subdir('windows')
>  
>  files_libglx = files(
> @@ -98,6 +101,7 @@ endif
>  
>  if with_dri_platform == 'apple'
>files_libglx += files('applegl_glx.c')
> +  extra_libs_libglx += libappleglx
>  elif with_dri_platform == 'windows'
>files_libglx += files('driwindows_glx.c')
>extra_libs_libglx += [
> -- 
> 2.15.1
> 
> ___
> mesa-dev mailing list
> mesa-dev@lists.freedesktop.org
> https://lists.freedesktop.org/mailman/listinfo/mesa-dev


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


Re: [Mesa-dev] [PATCH 4/6] meson: osx doesn't have librt, so don't require it

2018-01-30 Thread Dylan Baker
Quoting Jon Turney (2018-01-28 06:24:11)
> ---
>  meson.build | 2 +-
>  1 file changed, 1 insertion(+), 1 deletion(-)
> 
> diff --git a/meson.build b/meson.build
> index 7e194a9f10d..8fdbaa8b8d8 100644
> --- a/meson.build
> +++ b/meson.build
> @@ -935,7 +935,7 @@ elif with_dri_i965 and get_option('shader-cache')
>  endif
>  
>  # Determine whether or not the rt library is needed for time functions
> -if cc.has_function('clock_gettime')
> +if cc.has_function('clock_gettime') or (host_machine.system() == 'darwin')

We don't use parens around conditionals except to group them logically, can we
drop the extra parens here?

>dep_clock = []
>  else
>dep_clock = cc.find_library('rt')
> -- 
> 2.15.1
> 
> ___
> mesa-dev mailing list
> mesa-dev@lists.freedesktop.org
> https://lists.freedesktop.org/mailman/listinfo/mesa-dev


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


Re: [Mesa-dev] [PATCH 0/6] meson: build src/glx/apple

2018-01-30 Thread Dylan Baker
Quoting Jon Turney (2018-01-28 06:24:07)
> This also requires my "fix osx" series to actually build
> 
> Dylan Baker (2):
>   meson: find python2 on macOS
>   meson: set apple glx defines
> 
> Jon Turney (4):
>   meson: build src/glx/apple
>   meson: osx doesn't have librt, so don't require it
>   meson: osx ld doesn't support --build-id
>   travis: add macOS meson build
> 
>  .travis.yml  |  5 
>  meson.build  | 16 +--
>  src/glx/apple/meson.build| 62 
> 
>  src/glx/meson.build  |  4 +++
>  src/mesa/drivers/dri/meson.build |  2 +-
>  5 files changed, 86 insertions(+), 3 deletions(-)
>  create mode 100644 src/glx/apple/meson.build
> 
> -- 
> 2.15.1
> 
> ___
> mesa-dev mailing list
> mesa-dev@lists.freedesktop.org
> https://lists.freedesktop.org/mailman/listinfo/mesa-dev

Thanks for working on this, you beat me to getting this done. I have a couple of
little nits, but with that fixed, for the series:

Reviewed-by: Dylan Baker 


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


Re: [Mesa-dev] [PATCH mesa 1/2] meson: centralise the libdrm versions information

2018-01-30 Thread Emil Velikov
On 29 January 2018 at 18:57, Dylan Baker  wrote:
> Quoting Eric Engestrom (2018-01-29 10:15:50)
>> The big comment is taken from the equivalent block in configure.ac
>>
>> Signed-off-by: Eric Engestrom 
>> ---
>>  meson.build | 30 
>> +
>>  src/gallium/targets/d3dadapter9/meson.build |  2 +-
>>  src/mesa/drivers/dri/meson.build|  2 +-
>>  3 files changed, 24 insertions(+), 10 deletions(-)
>>
>> diff --git a/meson.build b/meson.build
>> index 0a00798c2a5093ec803b..6d7a8e976ff6ad002d9a 100644
>> --- a/meson.build
>> +++ b/meson.build
>> @@ -41,6 +41,20 @@ pre_args = [
>>
>> '-DPACKAGE_BUGREPORT="https://bugs.freedesktop.org/enter_bug.cgi?product=Mesa;',
>>  ]
>>
>> +# The idea is that libdrm is distributed as one cohesive package, even
>> +# though it is composed of multiple libraries. However some drivers
>> +# may have different version requirements than others. This list
>> +# codifies which drivers need which version of libdrm. Any libdrm
>> +# version dependencies in non-driver-specific code should be reflected
>> +# in the first entry.
>> +libdrm_version   = '2.4.75'
>> +libdrm_amdgpu_version= '2.4.89'
>> +libdrm_etnaviv_version   = '2.4.82'
>> +libdrm_freedreno_version = '2.4.82'
>> +libdrm_intel_version = '2.4.75'
>> +libdrm_nouveau_version   = '2.4.66'
>> +libdrm_radeon_version= '2.4.71'
>
> Is there any reason we can't just make these (for example):
> libdrm_radeon_version= '>= 2.4.71'
>
> Since that avoids all of the format calls?
>
Is there particular reason why meson doesn't allow plain
concatenation, and one must go through the format dance?
Off the top of my head, I think that most higher level programming
languages (including python) have it, making for clearer and more
obvious code.

That aside:
A huge +1 from me on the idea, although the libdrm_foo checks should
become libdrm && libdrm_foo.
See commit 2b4eaabff01a3a8ea0c4742ac481492092c1ab4f.

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


Re: [Mesa-dev] [PATCH 4/6] meson: osx doesn't have librt, so don't require it

2018-01-30 Thread Emil Velikov
Hi Jon,

On 28 January 2018 at 14:24, Jon Turney  wrote:
> ---
>  meson.build | 2 +-
>  1 file changed, 1 insertion(+), 1 deletion(-)
>
> diff --git a/meson.build b/meson.build
> index 7e194a9f10d..8fdbaa8b8d8 100644
> --- a/meson.build
> +++ b/meson.build
> @@ -935,7 +935,7 @@ elif with_dri_i965 and get_option('shader-cache')
>  endif
>
>  # Determine whether or not the rt library is needed for time functions
> -if cc.has_function('clock_gettime')
> +if cc.has_function('clock_gettime') or (host_machine.system() == 'darwin')

Absolutely no objections against the patch - just a small question.
If the meson/autotools check fails, does this mean that the resulting
binaries are having unresolved reference wrt said symbol?

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


Re: [Mesa-dev] [PATCH] ac/llvm: bump the number of results to 8.

2018-01-30 Thread Marek Olšák
Reviewed-by: Marek Olšák 

Marek

On Tue, Jan 30, 2018 at 4:59 AM, Dave Airlie  wrote:
> From: Dave Airlie 
>
> This function can get access for a 64-bit dvec4, which means we
> have to load 8 components.
>
> This fixes:
> R600_DEBUG=nir ./bin/shader_runner 
> generated_tests/spec/arb_gpu_shader_fp64/execution/built-in-functions/fs-abs-dvec4.shader_test
>  -auto
> ---
>  src/amd/common/ac_llvm_build.c | 2 +-
>  1 file changed, 1 insertion(+), 1 deletion(-)
>
> diff --git a/src/amd/common/ac_llvm_build.c b/src/amd/common/ac_llvm_build.c
> index 5e08508..6afe7f9 100644
> --- a/src/amd/common/ac_llvm_build.c
> +++ b/src/amd/common/ac_llvm_build.c
> @@ -983,7 +983,7 @@ ac_build_buffer_load(struct ac_llvm_context *ctx,
> if (allow_smem && !glc && !slc) {
> assert(vindex == NULL);
>
> -   LLVMValueRef result[4];
> +   LLVMValueRef result[8];
>
> for (int i = 0; i < num_channels; i++) {
> if (i) {
> --
> 2.9.5
>
> ___
> mesa-dev mailing list
> mesa-dev@lists.freedesktop.org
> https://lists.freedesktop.org/mailman/listinfo/mesa-dev
___
mesa-dev mailing list
mesa-dev@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/mesa-dev


Re: [Mesa-dev] [PATCH v2 09/12] st/glsl_to_nir: copy nir compiler options to context

2018-01-30 Thread Marek Olšák
On Tue, Jan 30, 2018 at 4:55 AM, Timothy Arceri  wrote:
> Various nir passes may expect this to be here as does the nir
> serialisation pass.
> ---
>  src/mesa/state_tracker/st_extensions.c| 17 +
>  src/mesa/state_tracker/st_glsl_to_nir.cpp | 10 ++
>  2 files changed, 19 insertions(+), 8 deletions(-)
>
> diff --git a/src/mesa/state_tracker/st_extensions.c 
> b/src/mesa/state_tracker/st_extensions.c
> index d00ee83c05..ea77aa6ed1 100644
> --- a/src/mesa/state_tracker/st_extensions.c
> +++ b/src/mesa/state_tracker/st_extensions.c
> @@ -26,6 +26,8 @@
>   *
>   **/
>
> +#include "compiler/nir/nir.h"
> +
>  #include "main/imports.h"
>  #include "main/context.h"
>  #include "main/macros.h"
> @@ -156,31 +158,46 @@ void st_init_limits(struct pipe_screen *screen,
> for (sh = 0; sh < PIPE_SHADER_TYPES; ++sh) {
>struct gl_shader_compiler_options *options;
>struct gl_program_constants *pc;
> +  const nir_shader_compiler_options *nir_options =
> + (const nir_shader_compiler_options *)
> +screen->get_compiler_options(screen, PIPE_SHADER_IR_NIR, sh);

This will crash with drivers that don't set the get_compiler_options callback.

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


Re: [Mesa-dev] [PATCH v2 12/12] st/glsl_to_nir: disable io lowering and array splitting of fs inputs

2018-01-30 Thread Marek Olšák
If you fix the possible NULL function call in patch 9, the series is:

Reviewed-by: Marek Olšák 

Marek

On Tue, Jan 30, 2018 at 4:55 AM, Timothy Arceri  wrote:
> We need this to be able to support the interpolateAt builtins in a
> sane way. It also leads to the generation of more optimal code.
>
> The lowering and splitting is made conditional on lower_all_io_to_temps
> because vc4 and freedreno both expect these passes to be enabled and
> niether support glsl 400 so don't need to deal with the interpolateAt
> builtins.
>
> We leave the other stages for now as to avoid regressions. Ideally we
> could remove the stage checks and just set the nir options correctly
> for each stage. However all gallium drivers currently just use return
> the same nir compiler options for all stages, and it's probably more
> trouble than its worth to change this.
> ---
>  src/mesa/state_tracker/st_glsl_to_nir.cpp | 22 ++
>  1 file changed, 18 insertions(+), 4 deletions(-)
>
> diff --git a/src/mesa/state_tracker/st_glsl_to_nir.cpp 
> b/src/mesa/state_tracker/st_glsl_to_nir.cpp
> index a3d447c5a4..65931bfa33 100644
> --- a/src/mesa/state_tracker/st_glsl_to_nir.cpp
> +++ b/src/mesa/state_tracker/st_glsl_to_nir.cpp
> @@ -451,6 +451,8 @@ st_nir_get_mesa_program(struct gl_context *ctx,
>  struct gl_linked_shader *shader)
>  {
> struct st_context *st = st_context(ctx);
> +   const nir_shader_compiler_options *options =
> +  
> ctx->Const.ShaderCompilerOptions[shader->Program->info.stage].NirOptions;
> struct gl_program *prog;
>
> validate_ir_tree(shader->ir);
> @@ -480,12 +482,18 @@ st_nir_get_mesa_program(struct gl_context *ctx,
> set_st_program(prog, shader_program, nir);
> prog->nir = nir;
>
> -   if (nir->info.stage != MESA_SHADER_TESS_CTRL &&
> -   nir->info.stage != MESA_SHADER_TESS_EVAL) {
> +   if (options->lower_all_io_to_temps ||
> +   nir->info.stage == MESA_SHADER_VERTEX ||
> +   nir->info.stage == MESA_SHADER_GEOMETRY) {
>NIR_PASS_V(nir, nir_lower_io_to_temporaries,
>   nir_shader_get_entrypoint(nir),
>   true, true);
> +   } else if (nir->info.stage == MESA_SHADER_FRAGMENT) {
> +  NIR_PASS_V(nir, nir_lower_io_to_temporaries,
> + nir_shader_get_entrypoint(nir),
> + true, false);
> }
> +
> NIR_PASS_V(nir, nir_lower_global_vars_to_local);
> NIR_PASS_V(nir, nir_split_var_copies);
> NIR_PASS_V(nir, nir_lower_var_copies);
> @@ -655,12 +663,18 @@ st_finalize_nir(struct st_context *st, struct 
> gl_program *prog,
>  struct gl_shader_program *shader_program, nir_shader *nir)
>  {
> struct pipe_screen *screen = st->pipe->screen;
> +   const nir_shader_compiler_options *options =
> +  st->ctx->Const.ShaderCompilerOptions[prog->info.stage].NirOptions;
>
> NIR_PASS_V(nir, nir_split_var_copies);
> NIR_PASS_V(nir, nir_lower_var_copies);
> -   if (nir->info.stage != MESA_SHADER_TESS_CTRL &&
> -   nir->info.stage != MESA_SHADER_TESS_EVAL)
> +   if (options->lower_all_io_to_temps ||
> +   nir->info.stage == MESA_SHADER_VERTEX ||
> +   nir->info.stage == MESA_SHADER_GEOMETRY) {
>NIR_PASS_V(nir, nir_lower_io_arrays_to_elements_no_indirects, false);
> +   } else if (nir->info.stage == MESA_SHADER_FRAGMENT) {
> +  NIR_PASS_V(nir, nir_lower_io_arrays_to_elements_no_indirects, true);
> +   }
>
> if (nir->info.stage == MESA_SHADER_VERTEX) {
>/* Needs special handling so drvloc matches the vbo state: */
> --
> 2.14.3
>
> ___
> mesa-dev mailing list
> mesa-dev@lists.freedesktop.org
> https://lists.freedesktop.org/mailman/listinfo/mesa-dev
___
mesa-dev mailing list
mesa-dev@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/mesa-dev


Re: [Mesa-dev] [PATCH v1 0/7] Implement commont gralloc_handle_t in libdrm

2018-01-30 Thread Robert Foss



On 01/30/2018 04:16 AM, Tomasz Figa wrote:

Hi Rob,

On Tue, Jan 30, 2018 at 1:17 AM, Robert Foss  wrote:

Hey Tomasz,

I'm tempted to split this work into two parts.
1) Move gbm gralloc struct


Alright, if we look at this only as an attempt to converge gbm_ and
drm_gralloc, it's out of my scope and no concern anymore.


Glad I asked, let's get that part over with, and continue with the accessors.




2) Accessor functions

I would like to get 1) out the door to support John Stultzs current HiKey
960 efforts. As for 2), it would seem that we have some more discussing to
do. But I'll keep pushing that forward.

Separately, I'd like to know if the below sketch of a func ptr solution is
what you had in mind. From what I've gathered this is exactly what you've
requested, but I would like to confirm it too.


I assume you mean the ones below?


Yes.





I'll send out a v2, that covers 1) later today.


Rob.


On 01/29/2018 01:03 PM, Robert Foss wrote:

[snip]





  uint32_t (*get_fd)(buffer_handle_t handle, uint32_t plane);
  uint64_t (*get_modifier)(buffer_handle_t handle, uint32_t plane);
  uint32_t (*get_offsets)(buffer_handle_t handle, uint32_t plane);
  uint32_t (*get_stride)(buffer_handle_t handle, uint32_t plane);
  ...
} gralloc_funcs_t;


These ones? >
Yeah, if we could retrieve such function pointer struct using perform
or any equivalent (like the implementation-specific methods in
gralloc1, but not sure if that's going to be used in practice
anywhere), it could work for us.


So this is where you and Rob Herring lose me, I don't think I understand quite 
how the gralloc1 call would be used, and how it would tie into this handle 
struct. I think I could do with some guidance on this.




I think we could also add .get_fourcc(handle) and
.get_num_planes(handle) callbacks, so that we could do away with the
whole sophisticated format guessing based on Android HAL format and
lock_ycbcr results.


I intentionally kept the list brief, but a more complete list would provide 
support for each element of the cros minigbm struct.




Perhaps an integer version field would also be useful, in case we end
up adding some more callbacks.


That's a good point.


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


[Mesa-dev] [Bug 104820] White screen in SDDM after upgrade to latest padoka

2018-01-30 Thread bugzilla-daemon
https://bugs.freedesktop.org/show_bug.cgi?id=104820

--- Comment #7 from Eero Tamminen  ---
If Padoka repos update also X server, there was X server bug 103000 that
affected titlebar colors (and was recently fixed).

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


Re: [Mesa-dev] [PATCH v2 17/24] anv: Use blorp_ccs_ambiguate instead of fast-clears

2018-01-30 Thread Jason Ekstrand
On Tue, Jan 30, 2018 at 2:54 PM, Nanley Chery  wrote:

> On Fri, Jan 19, 2018 at 03:47:34PM -0800, Jason Ekstrand wrote:
> > Even though the blorp pass looks a bit on the sketchy side, the end
> > result in the Vulkan driver is very nice.  Instead of having this weird
> > case where you do a fast clear and then maybe have to resolve, we just
> > do the ambiguate and are done with it.  The ambiguate does exactly what
> > we want of setting all the CCS values to 0 which puts it inot the
>^
>in
> > pass-through state.
> >
> > This should also improve performance a bit in certain cases.  For
> > instance, if we did a transition from UNDEFINED to GENERAL for a surface
> > that doesn't have CCS enabled all the time, we would end up doing a
> > fast-clear and then a full resolve which ends up touching every byte in
> > the main surface as well as the CCS.  With the ambiguate pass, that
> > transition only touches the CCS.
> > ---
> >  src/intel/vulkan/anv_blorp.c   |  5 
> >  src/intel/vulkan/genX_cmd_buffer.c | 54 +-
> 
> >  2 files changed, 17 insertions(+), 42 deletions(-)
> >
> > diff --git a/src/intel/vulkan/anv_blorp.c b/src/intel/vulkan/anv_blorp.c
> > index 05efc6d..3698543 100644
> > --- a/src/intel/vulkan/anv_blorp.c
> > +++ b/src/intel/vulkan/anv_blorp.c
> > @@ -1792,6 +1792,11 @@ anv_image_ccs_op(struct anv_cmd_buffer
> *cmd_buffer,
> >  surf.surf->format, isl_to_blorp_fast_clear_op(
> ccs_op));
> >break;
> > case ISL_AUX_OP_AMBIGUATE:
> > +  for (uint32_t a = 0; a < layer_count; a++) {
> > + const uint32_t layer = base_layer + a;
> > + blorp_ccs_ambiguate(, , level, layer);
> > +  }
> > +  break;
> > default:
> >unreachable("Unsupported CCS operation");
> > }
> > diff --git a/src/intel/vulkan/genX_cmd_buffer.c
> b/src/intel/vulkan/genX_cmd_buffer.c
> > index 77fdadf..9e2eba3 100644
> > --- a/src/intel/vulkan/genX_cmd_buffer.c
> > +++ b/src/intel/vulkan/genX_cmd_buffer.c
> > @@ -486,15 +486,6 @@ init_fast_clear_state_entry(struct anv_cmd_buffer
> *cmd_buffer,
> > uint32_t plane = anv_image_aspect_to_plane(image->aspects, aspect);
> > enum isl_aux_usage aux_usage = image->planes[plane].aux_usage;
> >
> > -   /* The resolve flag should updated to signify that
> fast-clear/compression
> > -* data needs to be removed when leaving the undefined layout. Such
> data
> > -* may need to be removed if it would cause accesses to the color
> buffer
> > -* to return incorrect data. The fast clear data in CCS_D buffers
> should
> > -* be removed because CCS_D isn't enabled all the time.
> > -*/
> > -   genX(set_image_needs_resolve)(cmd_buffer, image, aspect, level,
> > - aux_usage == ISL_AUX_USAGE_NONE);
> > -
> > /* The fast clear value dword(s) will be copied into a surface state
> object.
> >  * Ensure that the restrictions of the fields in the dword(s) are
> followed.
> >  *
> > @@ -677,10 +668,9 @@ transition_color_buffer(struct anv_cmd_buffer
> *cmd_buffer,
> >for (unsigned level = base_level; level < last_level_num; level++)
> >   init_fast_clear_state_entry(cmd_buffer, image, aspect, level);
> >
> > -  /* Initialize the aux buffers to enable correct rendering. This
> operation
> > -   * requires up to two steps: one to rid the aux buffer of data
> that may
> > -   * cause GPU hangs, and another to ensure that writes done
> without aux
> > -   * will be visible to reads done with aux.
> > +  /* Initialize the aux buffers to enable correct rendering.  In
> order to
> > +   * ensure that things such as storage images work correctly, aux
> buffers
> > +   * are initialized to the pass-through state.
>
> Only CCS is initialized to the pass-through state while MCS is
> fast-cleared. We may also want to update the comment below since we're
> no longer fast-clearing CCS.
>

Right.  I've replaced this entire comment with:

  /* Initialize the aux buffers to enable correct rendering.  In order
to
   * ensure that things such as storage images work correctly, aux
buffers
   * need to be initialized to valid data.
   *
   * Having an aux buffer with invalid data is a problem for two
reasons:
   *
   *  1) Having an invalid value in the buffer can confuse the hardware.
   * For instance, with CCS_E on SKL, a two-bit CCS value of 2 is
   * invalid and leads to the hardware doing strange things.  It
   * doesn't hang as far as we can tell but rendering corruption can
   * occur.
   *
   *  2) If this transition is into the GENERAL layout and we then use
the
   * image as a storage image, then we must have the aux buffer in
the
   * pass-through state so that, if 

Re: [Mesa-dev] [PATCH] glsl/linker: check same name is not used in block and outside

2018-01-30 Thread Matteo Bruni
2018-01-30 16:11 GMT+01:00 Juan A. Suarez Romero :
> According with OpenGL GLSL 3.20 spec, section 4.3.9:
>
>   "It is a link-time error if any particular shader interface
>contains:
>  - two different blocks, each having no instance name, and each
>having a member of the same name, or
>  - a variable outside a block, and a block with no instance name,
>where the variable has the same name as a member in the block."
>
> This fixes a previous commit 9b894c8 ("glsl/linker: link-error using the
> same name in unnamed block and outside") that covered this case, but
> did not take in account that precision qualifiers are ignored when
> comparing blocks with no instance name.

Thanks! This also fixes Wine, although the reason is slightly
different: Wine might end up linking a program with a vertex shader
containing "#extension GL_ARB_cull_distance : enable" together with a
vertex shader without it. I guess this makes the gl_PerVertex builtin
defined in the two shader objects differ and that triggered the old
check but not the new one from this patch.

I don't know if you want to change the commit message to account for
that (maybe make it more general?) but in any case, and FWIW:

Tested-by: Matteo Bruni 

I also have a nitpick which you can entirely ignore, below.

> + if (var->get_interface_type() != existing->get_interface_type()) {
> +if (!var->get_interface_type() || 
> !existing->get_interface_type()) {
> +   linker_error(prog, "declarations for %s `%s` are inside block 
> "
> +"`%s` and outside a block",
> +mode_string(var), var->name,
> +var->get_interface_type()
> +   ? var->get_interface_type()->name
> +   : existing->get_interface_type()->name);
> +   return;
> +} else if (strcmp(var->get_interface_type()->name,
> +  existing->get_interface_type()->name) != 0) {
> +   linker_error(prog, "declarations for %s `%s` are inside 
> blocks "
> +"`%s` and `%s`",
> +mode_string(var), var->name,
> +existing->get_interface_type()->name,
> +var->get_interface_type()->name);

What about declaring a couple of variables for the interface types and
using them through? Like:

const glsl_type var_itype = var->get_interface_type();
const glsl_type existing_itype = existing->get_interface_type();

(maybe with different names, I don't know what's Mesa's preferred style)
___
mesa-dev mailing list
mesa-dev@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/mesa-dev


Re: [Mesa-dev] [PATCH v2 22/24] intel/blorp: Use isl_aux_op instead of blorp_fast_clear_op

2018-01-30 Thread Nanley Chery
On Fri, Jan 19, 2018 at 03:47:39PM -0800, Jason Ekstrand wrote:
> ---
>  src/intel/blorp/blorp.h   |  9 +--
>  src/intel/blorp/blorp_clear.c | 10 
>  src/intel/blorp/blorp_genX_exec.h | 16 ++--
>  src/intel/blorp/blorp_priv.h  |  2 +-
>  src/intel/vulkan/anv_blorp.c  | 14 +--
>  src/mesa/drivers/dri/i965/brw_blorp.c |  2 +-
>  src/mesa/drivers/dri/i965/brw_blorp.h |  2 +-
>  src/mesa/drivers/dri/i965/intel_mipmap_tree.c | 36 
> +--
>  8 files changed, 36 insertions(+), 55 deletions(-)
> 

This patch is
Reviewed-by: Nanley Chery 

> diff --git a/src/intel/blorp/blorp.h b/src/intel/blorp/blorp.h
> index 478a9af..f1be12b 100644
> --- a/src/intel/blorp/blorp.h
> +++ b/src/intel/blorp/blorp.h
> @@ -189,19 +189,12 @@ blorp_clear_attachments(struct blorp_batch *batch,
>  bool clear_depth, float depth_value,
>  uint8_t stencil_mask, uint8_t stencil_value);
>  
> -enum blorp_fast_clear_op {
> -   BLORP_FAST_CLEAR_OP_NONE = 0,
> -   BLORP_FAST_CLEAR_OP_CLEAR,
> -   BLORP_FAST_CLEAR_OP_RESOLVE_PARTIAL,
> -   BLORP_FAST_CLEAR_OP_RESOLVE_FULL,
> -};
> -
>  void
>  blorp_ccs_resolve(struct blorp_batch *batch,
>struct blorp_surf *surf, uint32_t level,
>uint32_t start_layer, uint32_t num_layers,
>enum isl_format format,
> -  enum blorp_fast_clear_op resolve_op);
> +  enum isl_aux_op resolve_op);
>  
>  void
>  blorp_ccs_ambiguate(struct blorp_batch *batch,
> diff --git a/src/intel/blorp/blorp_clear.c b/src/intel/blorp/blorp_clear.c
> index fa2abd9..8b7c5a8 100644
> --- a/src/intel/blorp/blorp_clear.c
> +++ b/src/intel/blorp/blorp_clear.c
> @@ -322,7 +322,7 @@ blorp_fast_clear(struct blorp_batch *batch,
> params.y1 = y1;
>  
> memset(_inputs.clear_color, 0xff, 4*sizeof(float));
> -   params.fast_clear_op = BLORP_FAST_CLEAR_OP_CLEAR;
> +   params.fast_clear_op = ISL_AUX_OP_FAST_CLEAR;
>  
> get_fast_clear_rect(batch->blorp->isl_dev, surf->aux_surf,
> , , , );
> @@ -720,7 +720,7 @@ blorp_ccs_resolve(struct blorp_batch *batch,
>struct blorp_surf *surf, uint32_t level,
>uint32_t start_layer, uint32_t num_layers,
>enum isl_format format,
> -  enum blorp_fast_clear_op resolve_op)
> +  enum isl_aux_op resolve_op)
>  {
> struct blorp_params params;
>  
> @@ -759,11 +759,11 @@ blorp_ccs_resolve(struct blorp_batch *batch,
> params.y1 = ALIGN(params.y1, y_scaledown) / y_scaledown;
>  
> if (batch->blorp->isl_dev->info->gen >= 9) {
> -  assert(resolve_op == BLORP_FAST_CLEAR_OP_RESOLVE_FULL ||
> - resolve_op == BLORP_FAST_CLEAR_OP_RESOLVE_PARTIAL);
> +  assert(resolve_op == ISL_AUX_OP_FULL_RESOLVE ||
> + resolve_op == ISL_AUX_OP_PARTIAL_RESOLVE);
> } else {
>/* Broadwell and earlier do not have a partial resolve */
> -  assert(resolve_op == BLORP_FAST_CLEAR_OP_RESOLVE_FULL);
> +  assert(resolve_op == ISL_AUX_OP_FULL_RESOLVE);
> }
> params.fast_clear_op = resolve_op;
> params.num_layers = num_layers;
> diff --git a/src/intel/blorp/blorp_genX_exec.h 
> b/src/intel/blorp/blorp_genX_exec.h
> index 1968460..8d007b8 100644
> --- a/src/intel/blorp/blorp_genX_exec.h
> +++ b/src/intel/blorp/blorp_genX_exec.h
> @@ -750,21 +750,21 @@ blorp_emit_ps_config(struct blorp_batch *batch,
>   ps.MaximumNumberofThreadsPerPSD = 64 - 2;
>  
>switch (params->fast_clear_op) {
> -  case BLORP_FAST_CLEAR_OP_NONE:
> +  case ISL_AUX_OP_NONE:
>   break;
>  #if GEN_GEN >= 9
> -  case BLORP_FAST_CLEAR_OP_RESOLVE_PARTIAL:
> +  case ISL_AUX_OP_PARTIAL_RESOLVE:
>   ps.RenderTargetResolveType = RESOLVE_PARTIAL;
>   break;
> -  case BLORP_FAST_CLEAR_OP_RESOLVE_FULL:
> +  case ISL_AUX_OP_FULL_RESOLVE:
>   ps.RenderTargetResolveType = RESOLVE_FULL;
>   break;
>  #else
> -  case BLORP_FAST_CLEAR_OP_RESOLVE_FULL:
> +  case ISL_AUX_OP_FULL_RESOLVE:
>   ps.RenderTargetResolveEnable = true;
>   break;
>  #endif
> -  case BLORP_FAST_CLEAR_OP_CLEAR:
> +  case ISL_AUX_OP_FAST_CLEAR:
>   ps.RenderTargetFastClearEnable = true;
>   break;
>default:
> @@ -852,12 +852,12 @@ blorp_emit_ps_config(struct blorp_batch *batch,
>   ps.SamplerCount = 1; /* Up to 4 samplers */
>  
>switch (params->fast_clear_op) {
> -  case BLORP_FAST_CLEAR_OP_NONE:
> +  case ISL_AUX_OP_NONE:
>   break;
> -  case BLORP_FAST_CLEAR_OP_RESOLVE_FULL:
> +  case ISL_AUX_OP_FULL_RESOLVE:
>   ps.RenderTargetResolveEnable = true;
>   break;
> -  case BLORP_FAST_CLEAR_OP_CLEAR:
> +  case ISL_AUX_OP_FAST_CLEAR:
> 

Re: [Mesa-dev] [PATCH v2 23/24] intel/blorp: Use isl_aux_op instead of blorp_hiz_op

2018-01-30 Thread Nanley Chery
On Fri, Jan 19, 2018 at 03:47:40PM -0800, Jason Ekstrand wrote:
> ---
>  src/intel/blorp/blorp.c   |  2 +-
>  src/intel/blorp/blorp.h   | 19 +
>  src/intel/blorp/blorp_clear.c |  2 +-
>  src/intel/blorp/blorp_genX_exec.h | 39 
> ++-
>  src/intel/blorp/blorp_priv.h  |  2 +-
>  src/intel/vulkan/anv_blorp.c  | 15 +--
>  src/mesa/drivers/dri/i965/brw_blorp.c | 16 +--
>  src/mesa/drivers/dri/i965/brw_blorp.h |  2 +-
>  src/mesa/drivers/dri/i965/brw_clear.c |  4 +--
>  src/mesa/drivers/dri/i965/intel_mipmap_tree.c | 14 +-
>  10 files changed, 44 insertions(+), 71 deletions(-)
> 
> diff --git a/src/intel/blorp/blorp.c b/src/intel/blorp/blorp.c
> index e8a2c61..f067515 100644
> --- a/src/intel/blorp/blorp.c
> +++ b/src/intel/blorp/blorp.c
> @@ -293,7 +293,7 @@ blorp_ensure_sf_program(struct blorp_context *blorp,
>  void
>  blorp_hiz_op(struct blorp_batch *batch, struct blorp_surf *surf,
>   uint32_t level, uint32_t start_layer, uint32_t num_layers,
> - enum blorp_hiz_op op)
> + enum isl_aux_op op)
>  {
> struct blorp_params params;
> blorp_params_init();
> diff --git a/src/intel/blorp/blorp.h b/src/intel/blorp/blorp.h
> index f1be12b..ce3762c 100644
> --- a/src/intel/blorp/blorp.h
> +++ b/src/intel/blorp/blorp.h
> @@ -207,27 +207,10 @@ blorp_mcs_partial_resolve(struct blorp_batch *batch,
>enum isl_format format,
>uint32_t start_layer, uint32_t num_layers);
>  
> -/**
> - * For an overview of the HiZ operations, see the following sections of the
> - * Sandy Bridge PRM, Volume 1, Part2:
> - *   - 7.5.3.1 Depth Buffer Clear
> - *   - 7.5.3.2 Depth Buffer Resolve
> - *   - 7.5.3.3 Hierarchical Depth Buffer Resolve
> - *
> - * Of these, two get entered in the resolve map as needing to be done to the
> - * buffer: depth resolve and hiz resolve.
> - */
> -enum blorp_hiz_op {
> -   BLORP_HIZ_OP_NONE,
> -   BLORP_HIZ_OP_DEPTH_CLEAR,
> -   BLORP_HIZ_OP_DEPTH_RESOLVE,
> -   BLORP_HIZ_OP_HIZ_RESOLVE,
> -};
> -
>  void
>  blorp_hiz_op(struct blorp_batch *batch, struct blorp_surf *surf,
>   uint32_t level, uint32_t start_layer, uint32_t num_layers,
> - enum blorp_hiz_op op);
> + enum isl_aux_op op);
>  
>  #ifdef __cplusplus
>  } /* end extern "C" */
> diff --git a/src/intel/blorp/blorp_clear.c b/src/intel/blorp/blorp_clear.c
> index 8b7c5a8..e9f5463 100644
> --- a/src/intel/blorp/blorp_clear.c
> +++ b/src/intel/blorp/blorp_clear.c
> @@ -630,7 +630,7 @@ blorp_gen8_hiz_clear_attachments(struct blorp_batch 
> *batch,
> struct blorp_params params;
> blorp_params_init();
> params.num_layers = 1;
> -   params.hiz_op = BLORP_HIZ_OP_DEPTH_CLEAR;
> +   params.hiz_op = ISL_AUX_OP_FAST_CLEAR;
> params.x0 = x0;
> params.y0 = y0;
> params.x1 = x1;
> diff --git a/src/intel/blorp/blorp_genX_exec.h 
> b/src/intel/blorp/blorp_genX_exec.h
> index 8d007b8..5e1312a 100644
> --- a/src/intel/blorp/blorp_genX_exec.h
> +++ b/src/intel/blorp/blorp_genX_exec.h
> @@ -787,16 +787,16 @@ blorp_emit_ps_config(struct blorp_batch *batch,
>  
> blorp_emit(batch, GENX(3DSTATE_WM), wm) {
>switch (params->hiz_op) {
> -  case BLORP_HIZ_OP_DEPTH_CLEAR:
> +  case ISL_AUX_OP_FAST_CLEAR:
>   wm.DepthBufferClear = true;
>   break;
> -  case BLORP_HIZ_OP_DEPTH_RESOLVE:
> +  case ISL_AUX_OP_FULL_RESOLVE:
>   wm.DepthBufferResolveEnable = true;
>   break;
> -  case BLORP_HIZ_OP_HIZ_RESOLVE:
> +  case ISL_AUX_OP_AMBIGUATE:
>   wm.HierarchicalDepthBufferResolveEnable = true;
>   break;
> -  case BLORP_HIZ_OP_NONE:
> +  case ISL_AUX_OP_NONE:
>   break;
>default:
>   unreachable("not reached");
> @@ -872,16 +872,16 @@ blorp_emit_ps_config(struct blorp_batch *batch,
>   batch->blorp->isl_dev->info->max_wm_threads - 1;
>  
>switch (params->hiz_op) {
> -  case BLORP_HIZ_OP_DEPTH_CLEAR:
> +  case ISL_AUX_OP_FAST_CLEAR:
>   wm.DepthBufferClear = true;
>   break;
> -  case BLORP_HIZ_OP_DEPTH_RESOLVE:
> +  case ISL_AUX_OP_FULL_RESOLVE:
>   wm.DepthBufferResolveEnable = true;
>   break;
> -  case BLORP_HIZ_OP_HIZ_RESOLVE:
> +  case ISL_AUX_OP_AMBIGUATE:
>   wm.HierarchicalDepthBufferResolveEnable = true;
>   break;
> -  case BLORP_HIZ_OP_NONE:
> +  case ISL_AUX_OP_NONE:
>   break;
>default:
>   unreachable("not reached");
> @@ -1014,7 +1014,7 @@ blorp_emit_depth_stencil_state(struct blorp_batch 
> *batch,
>ds.DepthBufferWriteEnable = true;
>  
>switch (params->hiz_op) {
> -  case BLORP_HIZ_OP_NONE:
> +  case ISL_AUX_OP_NONE:
>   ds.DepthTestEnable = true;
>   

Re: [Mesa-dev] [PATCH v2 17/24] anv: Use blorp_ccs_ambiguate instead of fast-clears

2018-01-30 Thread Nanley Chery
On Tue, Jan 30, 2018 at 04:25:59PM -0800, Jason Ekstrand wrote:
> On Tue, Jan 30, 2018 at 2:54 PM, Nanley Chery  wrote:
> 
> > On Fri, Jan 19, 2018 at 03:47:34PM -0800, Jason Ekstrand wrote:
> > > Even though the blorp pass looks a bit on the sketchy side, the end
> > > result in the Vulkan driver is very nice.  Instead of having this weird
> > > case where you do a fast clear and then maybe have to resolve, we just
> > > do the ambiguate and are done with it.  The ambiguate does exactly what
> > > we want of setting all the CCS values to 0 which puts it inot the
> >^
> >in

Typo.

> > > pass-through state.
> > >
> > > This should also improve performance a bit in certain cases.  For
> > > instance, if we did a transition from UNDEFINED to GENERAL for a surface
> > > that doesn't have CCS enabled all the time, we would end up doing a
> > > fast-clear and then a full resolve which ends up touching every byte in
> > > the main surface as well as the CCS.  With the ambiguate pass, that
> > > transition only touches the CCS.
> > > ---
> > >  src/intel/vulkan/anv_blorp.c   |  5 
> > >  src/intel/vulkan/genX_cmd_buffer.c | 54 +-
> > 
> > >  2 files changed, 17 insertions(+), 42 deletions(-)
> > >
> > > diff --git a/src/intel/vulkan/anv_blorp.c b/src/intel/vulkan/anv_blorp.c
> > > index 05efc6d..3698543 100644
> > > --- a/src/intel/vulkan/anv_blorp.c
> > > +++ b/src/intel/vulkan/anv_blorp.c
> > > @@ -1792,6 +1792,11 @@ anv_image_ccs_op(struct anv_cmd_buffer
> > *cmd_buffer,
> > >  surf.surf->format, isl_to_blorp_fast_clear_op(
> > ccs_op));
> > >break;
> > > case ISL_AUX_OP_AMBIGUATE:
> > > +  for (uint32_t a = 0; a < layer_count; a++) {
> > > + const uint32_t layer = base_layer + a;
> > > + blorp_ccs_ambiguate(, , level, layer);
> > > +  }
> > > +  break;
> > > default:
> > >unreachable("Unsupported CCS operation");
> > > }
> > > diff --git a/src/intel/vulkan/genX_cmd_buffer.c
> > b/src/intel/vulkan/genX_cmd_buffer.c
> > > index 77fdadf..9e2eba3 100644
> > > --- a/src/intel/vulkan/genX_cmd_buffer.c
> > > +++ b/src/intel/vulkan/genX_cmd_buffer.c
> > > @@ -486,15 +486,6 @@ init_fast_clear_state_entry(struct anv_cmd_buffer
> > *cmd_buffer,
> > > uint32_t plane = anv_image_aspect_to_plane(image->aspects, aspect);
> > > enum isl_aux_usage aux_usage = image->planes[plane].aux_usage;
> > >
> > > -   /* The resolve flag should updated to signify that
> > fast-clear/compression
> > > -* data needs to be removed when leaving the undefined layout. Such
> > data
> > > -* may need to be removed if it would cause accesses to the color
> > buffer
> > > -* to return incorrect data. The fast clear data in CCS_D buffers
> > should
> > > -* be removed because CCS_D isn't enabled all the time.
> > > -*/
> > > -   genX(set_image_needs_resolve)(cmd_buffer, image, aspect, level,
> > > - aux_usage == ISL_AUX_USAGE_NONE);
> > > -
> > > /* The fast clear value dword(s) will be copied into a surface state
> > object.
> > >  * Ensure that the restrictions of the fields in the dword(s) are
> > followed.
> > >  *
> > > @@ -677,10 +668,9 @@ transition_color_buffer(struct anv_cmd_buffer
> > *cmd_buffer,
> > >for (unsigned level = base_level; level < last_level_num; level++)
> > >   init_fast_clear_state_entry(cmd_buffer, image, aspect, level);
> > >
> > > -  /* Initialize the aux buffers to enable correct rendering. This
> > operation
> > > -   * requires up to two steps: one to rid the aux buffer of data
> > that may
> > > -   * cause GPU hangs, and another to ensure that writes done
> > without aux
> > > -   * will be visible to reads done with aux.
> > > +  /* Initialize the aux buffers to enable correct rendering.  In
> > order to
> > > +   * ensure that things such as storage images work correctly, aux
> > buffers
> > > +   * are initialized to the pass-through state.
> >
> > Only CCS is initialized to the pass-through state while MCS is
> > fast-cleared. We may also want to update the comment below since we're
> > no longer fast-clearing CCS.
> >
> 
> Right.  I've replaced this entire comment with:
> 
>   /* Initialize the aux buffers to enable correct rendering.  In order
> to
>* ensure that things such as storage images work correctly, aux
> buffers
>* need to be initialized to valid data.
>*
>* Having an aux buffer with invalid data is a problem for two
> reasons:
>*
>*  1) Having an invalid value in the buffer can confuse the hardware.
>* For instance, with CCS_E on SKL, a two-bit CCS value of 2 is
>* invalid and leads to the hardware doing strange things.  It
>* doesn't 

Re: [Mesa-dev] [PATCH v2 17/24] anv: Use blorp_ccs_ambiguate instead of fast-clears

2018-01-30 Thread Jason Ekstrand
On Tue, Jan 30, 2018 at 5:03 PM, Nanley Chery  wrote:

> On Tue, Jan 30, 2018 at 04:25:59PM -0800, Jason Ekstrand wrote:
> > On Tue, Jan 30, 2018 at 2:54 PM, Nanley Chery 
> wrote:
> >
> > > On Fri, Jan 19, 2018 at 03:47:34PM -0800, Jason Ekstrand wrote:
> > > > Even though the blorp pass looks a bit on the sketchy side, the end
> > > > result in the Vulkan driver is very nice.  Instead of having this
> weird
> > > > case where you do a fast clear and then maybe have to resolve, we
> just
> > > > do the ambiguate and are done with it.  The ambiguate does exactly
> what
> > > > we want of setting all the CCS values to 0 which puts it inot the
> > >^
> > >in
>
> Typo.
>

Yup.  Meant into


> > > > pass-through state.
> > > >
> > > > This should also improve performance a bit in certain cases.  For
> > > > instance, if we did a transition from UNDEFINED to GENERAL for a
> surface
> > > > that doesn't have CCS enabled all the time, we would end up doing a
> > > > fast-clear and then a full resolve which ends up touching every byte
> in
> > > > the main surface as well as the CCS.  With the ambiguate pass, that
> > > > transition only touches the CCS.
> > > > ---
> > > >  src/intel/vulkan/anv_blorp.c   |  5 
> > > >  src/intel/vulkan/genX_cmd_buffer.c | 54
> +-
> > > 
> > > >  2 files changed, 17 insertions(+), 42 deletions(-)
> > > >
> > > > diff --git a/src/intel/vulkan/anv_blorp.c
> b/src/intel/vulkan/anv_blorp.c
> > > > index 05efc6d..3698543 100644
> > > > --- a/src/intel/vulkan/anv_blorp.c
> > > > +++ b/src/intel/vulkan/anv_blorp.c
> > > > @@ -1792,6 +1792,11 @@ anv_image_ccs_op(struct anv_cmd_buffer
> > > *cmd_buffer,
> > > >  surf.surf->format,
> isl_to_blorp_fast_clear_op(
> > > ccs_op));
> > > >break;
> > > > case ISL_AUX_OP_AMBIGUATE:
> > > > +  for (uint32_t a = 0; a < layer_count; a++) {
> > > > + const uint32_t layer = base_layer + a;
> > > > + blorp_ccs_ambiguate(, , level, layer);
> > > > +  }
> > > > +  break;
> > > > default:
> > > >unreachable("Unsupported CCS operation");
> > > > }
> > > > diff --git a/src/intel/vulkan/genX_cmd_buffer.c
> > > b/src/intel/vulkan/genX_cmd_buffer.c
> > > > index 77fdadf..9e2eba3 100644
> > > > --- a/src/intel/vulkan/genX_cmd_buffer.c
> > > > +++ b/src/intel/vulkan/genX_cmd_buffer.c
> > > > @@ -486,15 +486,6 @@ init_fast_clear_state_entry(struct
> anv_cmd_buffer
> > > *cmd_buffer,
> > > > uint32_t plane = anv_image_aspect_to_plane(image->aspects,
> aspect);
> > > > enum isl_aux_usage aux_usage = image->planes[plane].aux_usage;
> > > >
> > > > -   /* The resolve flag should updated to signify that
> > > fast-clear/compression
> > > > -* data needs to be removed when leaving the undefined layout.
> Such
> > > data
> > > > -* may need to be removed if it would cause accesses to the color
> > > buffer
> > > > -* to return incorrect data. The fast clear data in CCS_D buffers
> > > should
> > > > -* be removed because CCS_D isn't enabled all the time.
> > > > -*/
> > > > -   genX(set_image_needs_resolve)(cmd_buffer, image, aspect, level,
> > > > - aux_usage == ISL_AUX_USAGE_NONE);
> > > > -
> > > > /* The fast clear value dword(s) will be copied into a surface
> state
> > > object.
> > > >  * Ensure that the restrictions of the fields in the dword(s) are
> > > followed.
> > > >  *
> > > > @@ -677,10 +668,9 @@ transition_color_buffer(struct anv_cmd_buffer
> > > *cmd_buffer,
> > > >for (unsigned level = base_level; level < last_level_num;
> level++)
> > > >   init_fast_clear_state_entry(cmd_buffer, image, aspect,
> level);
> > > >
> > > > -  /* Initialize the aux buffers to enable correct rendering.
> This
> > > operation
> > > > -   * requires up to two steps: one to rid the aux buffer of data
> > > that may
> > > > -   * cause GPU hangs, and another to ensure that writes done
> > > without aux
> > > > -   * will be visible to reads done with aux.
> > > > +  /* Initialize the aux buffers to enable correct rendering.  In
> > > order to
> > > > +   * ensure that things such as storage images work correctly,
> aux
> > > buffers
> > > > +   * are initialized to the pass-through state.
> > >
> > > Only CCS is initialized to the pass-through state while MCS is
> > > fast-cleared. We may also want to update the comment below since we're
> > > no longer fast-clearing CCS.
> > >
> >
> > Right.  I've replaced this entire comment with:
> >
> >   /* Initialize the aux buffers to enable correct rendering.  In
> order
> > to
> >* ensure that things such as storage images work correctly, aux
> > buffers
> >* need to be initialized to valid data.
> >*
> >

[Mesa-dev] [PATCH] intel/blorp: Use the hardware op for CCS ambiguate on gen10+

2018-01-30 Thread Jason Ekstrand
Completely untested.
---
 src/intel/blorp/blorp_clear.c | 12 +++-
 src/intel/blorp/blorp_genX_exec.h |  6 ++
 2 files changed, 17 insertions(+), 1 deletion(-)

diff --git a/src/intel/blorp/blorp_clear.c b/src/intel/blorp/blorp_clear.c
index dd29d9e..32ec31b 100644
--- a/src/intel/blorp/blorp_clear.c
+++ b/src/intel/blorp/blorp_clear.c
@@ -758,7 +758,11 @@ blorp_ccs_resolve(struct blorp_batch *batch,
params.x1 = ALIGN(params.x1, x_scaledown) / x_scaledown;
params.y1 = ALIGN(params.y1, y_scaledown) / y_scaledown;
 
-   if (batch->blorp->isl_dev->info->gen >= 9) {
+   if (batch->blorp->isl_dev->info->gen >= 10) {
+  assert(resolve_op == ISL_AUX_OP_FULL_RESOLVE ||
+ resolve_op == ISL_AUX_OP_PARTIAL_RESOLVE ||
+ resolve_op == ISL_AUX_OP_AMBIGUATE);
+   } else if (batch->blorp->isl_dev->info->gen >= 9) {
   assert(resolve_op == ISL_AUX_OP_FULL_RESOLVE ||
  resolve_op == ISL_AUX_OP_PARTIAL_RESOLVE);
} else {
@@ -893,6 +897,12 @@ blorp_ccs_ambiguate(struct blorp_batch *batch,
 struct blorp_surf *surf,
 uint32_t level, uint32_t layer)
 {
+   if (ISL_DEV_GEN(batch->blorp->isl_dev) >= 10) {
+  /* On gen10 and above, we have a hardware resolve op for this */
+  return blorp_ccs_resolve(batch, surf, level, layer, 1,
+   surf->surf->format, ISL_AUX_OP_AMBIGUATE);
+   }
+
struct blorp_params params;
blorp_params_init();
 
diff --git a/src/intel/blorp/blorp_genX_exec.h 
b/src/intel/blorp/blorp_genX_exec.h
index 5e1312a..85abf6b 100644
--- a/src/intel/blorp/blorp_genX_exec.h
+++ b/src/intel/blorp/blorp_genX_exec.h
@@ -752,6 +752,12 @@ blorp_emit_ps_config(struct blorp_batch *batch,
   switch (params->fast_clear_op) {
   case ISL_AUX_OP_NONE:
  break;
+#if GEN_GEN >= 10
+  case ISL_AUX_OP_AMBIGUATE:
+ ps.RenderTargetFastClearEnable = true;
+ ps.RenderTargetResolveType = FAST_CLEAR_0;
+ break;
+#endif
 #if GEN_GEN >= 9
   case ISL_AUX_OP_PARTIAL_RESOLVE:
  ps.RenderTargetResolveType = RESOLVE_PARTIAL;
-- 
2.5.0.400.gff86faf

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


[Mesa-dev] [PATCH] st/glsl_to_nir: add more nir opts to st_nir_opts()

2018-01-30 Thread Timothy Arceri
All of the current gallium nir driver use these optimisations but
they do so in their backends. Having these called in the backend
only can cause a number of problems:

- Shader compile times are greater because the opts need to do
  significant passes over all shader variants.
- The shader cache is partially defeated due to the significant
  optimisation passes over variants.
- We might miss out on nir linking optimisation opportunities.

Adding these passes to st_nir_opts() alleviates these problems.
---
 src/mesa/state_tracker/st_glsl_to_nir.cpp | 36 +--
 1 file changed, 20 insertions(+), 16 deletions(-)

diff --git a/src/mesa/state_tracker/st_glsl_to_nir.cpp 
b/src/mesa/state_tracker/st_glsl_to_nir.cpp
index 65931bfa33..b9ac9fafc2 100644
--- a/src/mesa/state_tracker/st_glsl_to_nir.cpp
+++ b/src/mesa/state_tracker/st_glsl_to_nir.cpp
@@ -270,6 +270,10 @@ st_nir_opts(nir_shader *nir)
do {
   progress = false;
 
+  NIR_PASS_V(nir, nir_lower_vars_to_ssa);
+  NIR_PASS_V(nir, nir_lower_alu_to_scalar);
+  NIR_PASS_V(nir, nir_lower_phis_to_scalar);
+
   NIR_PASS_V(nir, nir_lower_64bit_pack);
   NIR_PASS(progress, nir, nir_copy_prop);
   NIR_PASS(progress, nir, nir_opt_remove_phis);
@@ -317,6 +321,22 @@ st_glsl_to_nir(struct st_context *st, struct gl_program 
*prog,
   (nir_variable_mode) (nir_var_shader_in | nir_var_shader_out);
nir_remove_dead_variables(nir, mask);
 
+   if (options->lower_all_io_to_temps ||
+   nir->info.stage == MESA_SHADER_VERTEX ||
+   nir->info.stage == MESA_SHADER_GEOMETRY) {
+  NIR_PASS_V(nir, nir_lower_io_to_temporaries,
+ nir_shader_get_entrypoint(nir),
+ true, true);
+   } else if (nir->info.stage == MESA_SHADER_FRAGMENT) {
+  NIR_PASS_V(nir, nir_lower_io_to_temporaries,
+ nir_shader_get_entrypoint(nir),
+ true, false);
+   }
+
+   NIR_PASS_V(nir, nir_lower_global_vars_to_local);
+   NIR_PASS_V(nir, nir_split_var_copies);
+   NIR_PASS_V(nir, nir_lower_var_copies);
+
st_nir_opts(nir);
 
return nir;
@@ -481,22 +501,6 @@ st_nir_get_mesa_program(struct gl_context *ctx,
 
set_st_program(prog, shader_program, nir);
prog->nir = nir;
-
-   if (options->lower_all_io_to_temps ||
-   nir->info.stage == MESA_SHADER_VERTEX ||
-   nir->info.stage == MESA_SHADER_GEOMETRY) {
-  NIR_PASS_V(nir, nir_lower_io_to_temporaries,
- nir_shader_get_entrypoint(nir),
- true, true);
-   } else if (nir->info.stage == MESA_SHADER_FRAGMENT) {
-  NIR_PASS_V(nir, nir_lower_io_to_temporaries,
- nir_shader_get_entrypoint(nir),
- true, false);
-   }
-
-   NIR_PASS_V(nir, nir_lower_global_vars_to_local);
-   NIR_PASS_V(nir, nir_split_var_copies);
-   NIR_PASS_V(nir, nir_lower_var_copies);
 }
 
 static void
-- 
2.14.3

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


Re: [Mesa-dev] [PATCH] st/glsl_to_nir: add more nir opts to st_nir_opts()

2018-01-30 Thread Timothy Arceri
I forgot to add that adding the opts also required some of the lowering 
passes to be called slightly earlier.


On 31/01/18 12:58, Timothy Arceri wrote:

All of the current gallium nir driver use these optimisations but
they do so in their backends. Having these called in the backend
only can cause a number of problems:

- Shader compile times are greater because the opts need to do
   significant passes over all shader variants.
- The shader cache is partially defeated due to the significant
   optimisation passes over variants.
- We might miss out on nir linking optimisation opportunities.

Adding these passes to st_nir_opts() alleviates these problems.
---
  src/mesa/state_tracker/st_glsl_to_nir.cpp | 36 +--
  1 file changed, 20 insertions(+), 16 deletions(-)

diff --git a/src/mesa/state_tracker/st_glsl_to_nir.cpp 
b/src/mesa/state_tracker/st_glsl_to_nir.cpp
index 65931bfa33..b9ac9fafc2 100644
--- a/src/mesa/state_tracker/st_glsl_to_nir.cpp
+++ b/src/mesa/state_tracker/st_glsl_to_nir.cpp
@@ -270,6 +270,10 @@ st_nir_opts(nir_shader *nir)
 do {
progress = false;
  
+  NIR_PASS_V(nir, nir_lower_vars_to_ssa);

+  NIR_PASS_V(nir, nir_lower_alu_to_scalar);
+  NIR_PASS_V(nir, nir_lower_phis_to_scalar);
+
NIR_PASS_V(nir, nir_lower_64bit_pack);
NIR_PASS(progress, nir, nir_copy_prop);
NIR_PASS(progress, nir, nir_opt_remove_phis);
@@ -317,6 +321,22 @@ st_glsl_to_nir(struct st_context *st, struct gl_program 
*prog,
(nir_variable_mode) (nir_var_shader_in | nir_var_shader_out);
 nir_remove_dead_variables(nir, mask);
  
+   if (options->lower_all_io_to_temps ||

+   nir->info.stage == MESA_SHADER_VERTEX ||
+   nir->info.stage == MESA_SHADER_GEOMETRY) {
+  NIR_PASS_V(nir, nir_lower_io_to_temporaries,
+ nir_shader_get_entrypoint(nir),
+ true, true);
+   } else if (nir->info.stage == MESA_SHADER_FRAGMENT) {
+  NIR_PASS_V(nir, nir_lower_io_to_temporaries,
+ nir_shader_get_entrypoint(nir),
+ true, false);
+   }
+
+   NIR_PASS_V(nir, nir_lower_global_vars_to_local);
+   NIR_PASS_V(nir, nir_split_var_copies);
+   NIR_PASS_V(nir, nir_lower_var_copies);
+
 st_nir_opts(nir);
  
 return nir;

@@ -481,22 +501,6 @@ st_nir_get_mesa_program(struct gl_context *ctx,
  
 set_st_program(prog, shader_program, nir);

 prog->nir = nir;
-
-   if (options->lower_all_io_to_temps ||
-   nir->info.stage == MESA_SHADER_VERTEX ||
-   nir->info.stage == MESA_SHADER_GEOMETRY) {
-  NIR_PASS_V(nir, nir_lower_io_to_temporaries,
- nir_shader_get_entrypoint(nir),
- true, true);
-   } else if (nir->info.stage == MESA_SHADER_FRAGMENT) {
-  NIR_PASS_V(nir, nir_lower_io_to_temporaries,
- nir_shader_get_entrypoint(nir),
- true, false);
-   }
-
-   NIR_PASS_V(nir, nir_lower_global_vars_to_local);
-   NIR_PASS_V(nir, nir_split_var_copies);
-   NIR_PASS_V(nir, nir_lower_var_copies);
  }
  
  static void



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


Re: [Mesa-dev] [PATCH] virgl: also remove dimension on indirect.

2018-01-30 Thread Gurchetan Singh
Any plans to merge this?  This fixes Chrome not starting with Virgl.

Reviewed-by: Gurchetan Singh 
Tested-by: Gurchetan Singh 

On Mon, Nov 13, 2017 at 12:53 PM, Dave Airlie  wrote:
> From: Dave Airlie 
>
> This fixes some dEQP tests that generated bad shaders.
>
> Fixes: b6f6ead19 (virgl: drop const dimensions on first block.)
> Signed-off-by: Dave Airlie 
> ---
>  src/gallium/drivers/virgl/virgl_tgsi.c | 1 -
>  1 file changed, 1 deletion(-)
>
> diff --git a/src/gallium/drivers/virgl/virgl_tgsi.c 
> b/src/gallium/drivers/virgl/virgl_tgsi.c
> index aa483ad..ca05913 100644
> --- a/src/gallium/drivers/virgl/virgl_tgsi.c
> +++ b/src/gallium/drivers/virgl/virgl_tgsi.c
> @@ -76,7 +76,6 @@ virgl_tgsi_transform_instruction(struct 
> tgsi_transform_context *ctx,
> for (unsigned i = 0; i < inst->Instruction.NumSrcRegs; i++) {
>if (inst->Src[i].Register.File == TGSI_FILE_CONSTANT &&
>inst->Src[i].Register.Dimension &&
> -  !inst->Src[i].Register.Indirect &&
>inst->Src[i].Dimension.Index == 0)
>   inst->Src[i].Register.Dimension = 0;
> }
> --
> 2.9.5
>
> ___
> mesa-dev mailing list
> mesa-dev@lists.freedesktop.org
> https://lists.freedesktop.org/mailman/listinfo/mesa-dev
___
mesa-dev mailing list
mesa-dev@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/mesa-dev


Re: [Mesa-dev] [PATCH] virgl: also remove dimension on indirect.

2018-01-30 Thread Dave Airlie
On 31 January 2018 at 12:04, Gurchetan Singh
 wrote:
> Any plans to merge this?  This fixes Chrome not starting with Virgl.

Oops pushed now.

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


Re: [Mesa-dev] [PATCH] mesa: fix glGet MAX_VERTEX_ATTRIB queries

2018-01-30 Thread Roland Scheidegger
FWIW the same commit also broke conform (completely - it will
refuse to run even a single test due to failing mustpass).

Default State test failed.
State Report. (Current) <-> (Default)
GL_POLYGON_MODE (State Information)
GL_FILL -1 (Bad enumeration) <-> GL_FILL GL_FILL
Cannot continue until default state test passes.

I think that's because glGet(GL_POLYGON_MODE) will return 2 values (for
front and back), hence compaction doesn't work. Unless there'd be some
enum16_2 type or something similar and handling it appropriately, or
some special casing elsewhere.

Roland

Am 30.01.2018 um 22:46 schrieb Marek Olšák:
> From: Marek Olšák 
> 
> Broken by f96a69f916aed40519e755d0460a83940a587
> ---
>  src/mesa/main/get_hash_params.py | 6 +++---
>  1 file changed, 3 insertions(+), 3 deletions(-)
> 
> diff --git a/src/mesa/main/get_hash_params.py 
> b/src/mesa/main/get_hash_params.py
> index 7cd195c..55d29e9 100644
> --- a/src/mesa/main/get_hash_params.py
> +++ b/src/mesa/main/get_hash_params.py
> @@ -514,25 +514,25 @@ descriptor=[
>  # GL_ARB_framebuffer_no_attachments / geometry shader
>[ "MAX_FRAMEBUFFER_LAYERS", "CONTEXT_INT(Const.MaxFramebufferLayers), 
> extra_ARB_framebuffer_no_attachments_and_geometry_shader" ],
>  
>  # GL_ARB_explicit_uniform_location / GLES 3.1
>[ "MAX_UNIFORM_LOCATIONS", 
> "CONTEXT_INT(Const.MaxUserAssignableUniformLocations), 
> extra_ARB_explicit_uniform_location" ],
>  
>  # GL_ARB_separate_shader_objects / GLES 3.1
>[ "PROGRAM_PIPELINE_BINDING", "LOC_CUSTOM, TYPE_INT, 
> GL_PROGRAM_PIPELINE_BINDING, NO_EXTRA" ],
>  
>  # GL_ARB_vertex_attrib_binding / GLES 3.1
> -  [ "MAX_VERTEX_ATTRIB_RELATIVE_OFFSET", 
> "CONTEXT_ENUM16(Const.MaxVertexAttribRelativeOffset), NO_EXTRA" ],
> -  [ "MAX_VERTEX_ATTRIB_BINDINGS", 
> "CONTEXT_ENUM16(Const.MaxVertexAttribBindings), NO_EXTRA" ],
> +  [ "MAX_VERTEX_ATTRIB_RELATIVE_OFFSET", 
> "CONTEXT_INT(Const.MaxVertexAttribRelativeOffset), NO_EXTRA" ],
> +  [ "MAX_VERTEX_ATTRIB_BINDINGS", 
> "CONTEXT_INT(Const.MaxVertexAttribBindings), NO_EXTRA" ],
>  
>  # GL 4.4 / GLES 3.1
> -  [ "MAX_VERTEX_ATTRIB_STRIDE", 
> "CONTEXT_ENUM16(Const.MaxVertexAttribStride), NO_EXTRA" ],
> +  [ "MAX_VERTEX_ATTRIB_STRIDE", "CONTEXT_UINT(Const.MaxVertexAttribStride), 
> NO_EXTRA" ],
>  
># GL_ARB_shader_storage_buffer_object / GLES 3.1
>[ "MAX_VERTEX_SHADER_STORAGE_BLOCKS", 
> "CONTEXT_INT(Const.Program[MESA_SHADER_VERTEX].MaxShaderStorageBlocks), 
> extra_ARB_shader_storage_buffer_object_es31" ],
>[ "MAX_FRAGMENT_SHADER_STORAGE_BLOCKS", 
> "CONTEXT_INT(Const.Program[MESA_SHADER_FRAGMENT].MaxShaderStorageBlocks), 
> extra_ARB_shader_storage_buffer_object_es31" ],
>[ "MAX_COMPUTE_SHADER_STORAGE_BLOCKS", 
> "CONTEXT_INT(Const.Program[MESA_SHADER_COMPUTE].MaxShaderStorageBlocks), 
> extra_ARB_shader_storage_buffer_object_es31" ],
>[ "MAX_COMBINED_SHADER_STORAGE_BLOCKS", 
> "CONTEXT_INT(Const.MaxCombinedShaderStorageBlocks), 
> extra_ARB_shader_storage_buffer_object_es31" ],
>[ "MAX_SHADER_STORAGE_BLOCK_SIZE", 
> "CONTEXT_INT(Const.MaxShaderStorageBlockSize), 
> extra_ARB_shader_storage_buffer_object_es31" ],
>[ "MAX_SHADER_STORAGE_BUFFER_BINDINGS", 
> "CONTEXT_INT(Const.MaxShaderStorageBufferBindings), 
> extra_ARB_shader_storage_buffer_object_es31" ],
>[ "SHADER_STORAGE_BUFFER_OFFSET_ALIGNMENT", 
> "CONTEXT_INT(Const.ShaderStorageBufferOffsetAlignment), 
> extra_ARB_shader_storage_buffer_object_es31" ],
>[ "SHADER_STORAGE_BUFFER_BINDING", "LOC_CUSTOM, TYPE_INT, 0, 
> extra_ARB_shader_storage_buffer_object_es31" ],
> 

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


Re: [Mesa-dev] [PATCH] radv/winsys: replace bo list searchs with a hash table.

2018-01-30 Thread Dieter Nützel

Ping!

Am 11.01.2018 04:53, schrieb Dave Airlie:

From: Dave Airlie 

This should make the merging of cmd buffers less CPU intensive,
note I said *should* :)
---
 src/amd/vulkan/winsys/amdgpu/radv_amdgpu_cs.c | 47 
---

 1 file changed, 20 insertions(+), 27 deletions(-)

diff --git a/src/amd/vulkan/winsys/amdgpu/radv_amdgpu_cs.c
b/src/amd/vulkan/winsys/amdgpu/radv_amdgpu_cs.c
index 0ee56f91447..9a39d237ae8 100644
--- a/src/amd/vulkan/winsys/amdgpu/radv_amdgpu_cs.c
+++ b/src/amd/vulkan/winsys/amdgpu/radv_amdgpu_cs.c
@@ -33,6 +33,7 @@
 #include "radv_amdgpu_bo.h"
 #include "sid.h"

+#include "util/hash_table.h"

 enum {
VIRTUAL_BUFFER_HASH_TABLE_SIZE = 1024
@@ -584,6 +585,9 @@ static int radv_amdgpu_create_bo_list(struct
radv_amdgpu_winsys *ws,
priorities[0] = 8;
}

+		struct hash_table *ht = _mesa_hash_table_create(NULL, 
_mesa_hash_pointer,

+   
_mesa_key_pointer_equal);
+
for (unsigned i = 0; i < count + !!extra_cs; ++i) {
struct radv_amdgpu_cs *cs;

@@ -595,50 +599,39 @@ static int radv_amdgpu_create_bo_list(struct
radv_amdgpu_winsys *ws,
if (!cs->num_buffers)
continue;

-   if (unique_bo_count == 0) {
-memcpy(handles, cs->handles, cs->num_buffers * 
sizeof(amdgpu_bo_handle));
-memcpy(priorities, cs->priorities, cs->num_buffers * 
sizeof(uint8_t));

-   unique_bo_count = cs->num_buffers;
-   continue;
-   }
-   int unique_bo_so_far = unique_bo_count;
for (unsigned j = 0; j < cs->num_buffers; ++j) {
-   bool found = false;
-   for (unsigned k = 0; k < unique_bo_so_far; ++k) 
{
-   if (handles[k] == cs->handles[j]) {
-   found = true;
-   priorities[k] = 
MAX2(priorities[k],
-
cs->priorities[j]);
-   break;
-   }
-   }
-   if (!found) {
+   struct hash_entry *entry = 
_mesa_hash_table_search(ht, (void
*)cs->handles[j]);
+   if (!entry) {
+   _mesa_hash_table_insert(ht, (void 
*)cs->handles[j], (void
*)(uintptr_t)unique_bo_count);
handles[unique_bo_count] = 
cs->handles[j];
priorities[unique_bo_count] = 
cs->priorities[j];
++unique_bo_count;
+   } else {
+   int bo_idx = (uint32_t)(unsigned 
long)entry->data;
+   priorities[bo_idx] = 
MAX2(priorities[bo_idx],
+ 
cs->priorities[j]);
}
}
for (unsigned j = 0; j < cs->num_virtual_buffers; ++j) {
struct radv_amdgpu_winsys_bo *virtual_bo =
radv_amdgpu_winsys_bo(cs->virtual_buffers[j]);
for(unsigned k = 0; k < virtual_bo->bo_count; 
++k) {
struct radv_amdgpu_winsys_bo *bo = 
virtual_bo->bos[k];
-   bool found = false;
-   for (unsigned m = 0; m < 
unique_bo_count; ++m) {
-   if (handles[m] == bo->bo) {
-   found = true;
-   priorities[m] = 
MAX2(priorities[m],
-   
cs->virtual_buffer_priorities[j]);
-   break;
-   }
-   }
-   if (!found) {
+
+	struct hash_entry *entry = _mesa_hash_table_search(ht, (void 
*)bo->bo);

+   if (!entry) {
+   _mesa_hash_table_insert(ht, (void 
*)bo->bo, (void
*)(uintptr_t)unique_bo_count);
handles[unique_bo_count] = 
bo->bo;
priorities[unique_bo_count] = 
cs->virtual_buffer_priorities[j];
++unique_bo_count;
+   } 

Re: [Mesa-dev] [PATCH] mesa: fix glGet MAX_VERTEX_ATTRIB queries

2018-01-30 Thread Eric Anholt
Marek Olšák  writes:

> From: Marek Olšák 
>
> Broken by f96a69f916aed40519e755d0460a83940a587

Reviewed-by: Eric Anholt 


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


Re: [Mesa-dev] [PATCH] mesa: fix glGet MAX_VERTEX_ATTRIB queries

2018-01-30 Thread Brian Paul

On 01/30/2018 07:25 PM, Roland Scheidegger wrote:

FWIW the same commit also broke conform (completely - it will
refuse to run even a single test due to failing mustpass).

Default State test failed.
 State Report. (Current) <-> (Default)
 GL_POLYGON_MODE (State Information)
 GL_FILL -1 (Bad enumeration) <-> GL_FILL GL_FILL
Cannot continue until default state test passes.

I think that's because glGet(GL_POLYGON_MODE) will return 2 values (for
front and back), hence compaction doesn't work. Unless there'd be some
enum16_2 type or something similar and handling it appropriately, or
some special casing elsewhere.


Let's just revert those bits for now.  I'll post a patch...

-Brian



Roland

Am 30.01.2018 um 22:46 schrieb Marek Olšák:

From: Marek Olšák 

Broken by f96a69f916aed40519e755d0460a83940a587
---
  src/mesa/main/get_hash_params.py | 6 +++---
  1 file changed, 3 insertions(+), 3 deletions(-)

diff --git a/src/mesa/main/get_hash_params.py b/src/mesa/main/get_hash_params.py
index 7cd195c..55d29e9 100644
--- a/src/mesa/main/get_hash_params.py
+++ b/src/mesa/main/get_hash_params.py
@@ -514,25 +514,25 @@ descriptor=[
  # GL_ARB_framebuffer_no_attachments / geometry shader
[ "MAX_FRAMEBUFFER_LAYERS", "CONTEXT_INT(Const.MaxFramebufferLayers), 
extra_ARB_framebuffer_no_attachments_and_geometry_shader" ],
  
  # GL_ARB_explicit_uniform_location / GLES 3.1

[ "MAX_UNIFORM_LOCATIONS", 
"CONTEXT_INT(Const.MaxUserAssignableUniformLocations), 
extra_ARB_explicit_uniform_location" ],
  
  # GL_ARB_separate_shader_objects / GLES 3.1

[ "PROGRAM_PIPELINE_BINDING", "LOC_CUSTOM, TYPE_INT, 
GL_PROGRAM_PIPELINE_BINDING, NO_EXTRA" ],
  
  # GL_ARB_vertex_attrib_binding / GLES 3.1

-  [ "MAX_VERTEX_ATTRIB_RELATIVE_OFFSET", 
"CONTEXT_ENUM16(Const.MaxVertexAttribRelativeOffset), NO_EXTRA" ],
-  [ "MAX_VERTEX_ATTRIB_BINDINGS", "CONTEXT_ENUM16(Const.MaxVertexAttribBindings), 
NO_EXTRA" ],
+  [ "MAX_VERTEX_ATTRIB_RELATIVE_OFFSET", 
"CONTEXT_INT(Const.MaxVertexAttribRelativeOffset), NO_EXTRA" ],
+  [ "MAX_VERTEX_ATTRIB_BINDINGS", "CONTEXT_INT(Const.MaxVertexAttribBindings), 
NO_EXTRA" ],
  
  # GL 4.4 / GLES 3.1

-  [ "MAX_VERTEX_ATTRIB_STRIDE", "CONTEXT_ENUM16(Const.MaxVertexAttribStride), 
NO_EXTRA" ],
+  [ "MAX_VERTEX_ATTRIB_STRIDE", "CONTEXT_UINT(Const.MaxVertexAttribStride), 
NO_EXTRA" ],
  
# GL_ARB_shader_storage_buffer_object / GLES 3.1

[ "MAX_VERTEX_SHADER_STORAGE_BLOCKS", 
"CONTEXT_INT(Const.Program[MESA_SHADER_VERTEX].MaxShaderStorageBlocks), 
extra_ARB_shader_storage_buffer_object_es31" ],
[ "MAX_FRAGMENT_SHADER_STORAGE_BLOCKS", 
"CONTEXT_INT(Const.Program[MESA_SHADER_FRAGMENT].MaxShaderStorageBlocks), 
extra_ARB_shader_storage_buffer_object_es31" ],
[ "MAX_COMPUTE_SHADER_STORAGE_BLOCKS", 
"CONTEXT_INT(Const.Program[MESA_SHADER_COMPUTE].MaxShaderStorageBlocks), 
extra_ARB_shader_storage_buffer_object_es31" ],
[ "MAX_COMBINED_SHADER_STORAGE_BLOCKS", 
"CONTEXT_INT(Const.MaxCombinedShaderStorageBlocks), 
extra_ARB_shader_storage_buffer_object_es31" ],
[ "MAX_SHADER_STORAGE_BLOCK_SIZE", 
"CONTEXT_INT(Const.MaxShaderStorageBlockSize), 
extra_ARB_shader_storage_buffer_object_es31" ],
[ "MAX_SHADER_STORAGE_BUFFER_BINDINGS", 
"CONTEXT_INT(Const.MaxShaderStorageBufferBindings), 
extra_ARB_shader_storage_buffer_object_es31" ],
[ "SHADER_STORAGE_BUFFER_OFFSET_ALIGNMENT", 
"CONTEXT_INT(Const.ShaderStorageBufferOffsetAlignment), 
extra_ARB_shader_storage_buffer_object_es31" ],
[ "SHADER_STORAGE_BUFFER_BINDING", "LOC_CUSTOM, TYPE_INT, 0, 
extra_ARB_shader_storage_buffer_object_es31" ],



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



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


[Mesa-dev] [PATCH] mesa: fix broken glGet*(GL_POLYGON_MODE) query

2018-01-30 Thread Brian Paul
This reverts part of the patch which introduced the GLenum16 change.
Fixes a conform regression found by Roland.

Fixes: f96a69f916aed405 ("mesa: replace GLenum with GLenum16 in
common structures (v4)")
---
 src/mesa/main/get_hash_params.py | 2 +-
 src/mesa/main/mtypes.h   | 4 ++--
 2 files changed, 3 insertions(+), 3 deletions(-)

diff --git a/src/mesa/main/get_hash_params.py b/src/mesa/main/get_hash_params.py
index 7cd195c..b61b16b 100644
--- a/src/mesa/main/get_hash_params.py
+++ b/src/mesa/main/get_hash_params.py
@@ -743,7 +743,7 @@ descriptor=[
   [ "PIXEL_MAP_R_TO_R_SIZE", "CONTEXT_INT(PixelMaps.RtoR.Size), NO_EXTRA" ],
   [ "PIXEL_MAP_S_TO_S_SIZE", "CONTEXT_INT(PixelMaps.StoS.Size), NO_EXTRA" ],
   [ "POINT_SIZE_GRANULARITY", "CONTEXT_FLOAT(Const.PointSizeGranularity), 
NO_EXTRA" ],
-  [ "POLYGON_MODE", "CONTEXT_ENUM16(Polygon.FrontMode), NO_EXTRA" ],
+  [ "POLYGON_MODE", "CONTEXT_ENUM2(Polygon.FrontMode), NO_EXTRA" ],
   [ "POLYGON_OFFSET_BIAS_EXT", "CONTEXT_FLOAT(Polygon.OffsetUnits), NO_EXTRA" 
],
   [ "POLYGON_OFFSET_POINT", "CONTEXT_BOOL(Polygon.OffsetPoint), NO_EXTRA" ],
   [ "POLYGON_OFFSET_LINE", "CONTEXT_BOOL(Polygon.OffsetLine), NO_EXTRA" ],
diff --git a/src/mesa/main/mtypes.h b/src/mesa/main/mtypes.h
index 35fafa5..f6fa6f4 100644
--- a/src/mesa/main/mtypes.h
+++ b/src/mesa/main/mtypes.h
@@ -843,8 +843,8 @@ struct gl_point_attrib
 struct gl_polygon_attrib
 {
GLenum16 FrontFace; /**< Either GL_CW or GL_CCW */
-   GLenum16 FrontMode; /**< Either GL_POINT, GL_LINE or GL_FILL */
-   GLenum16 BackMode;  /**< Either GL_POINT, GL_LINE or GL_FILL */
+   GLenum FrontMode;   /**< Either GL_POINT, GL_LINE or GL_FILL */
+   GLenum BackMode;/**< Either GL_POINT, GL_LINE or GL_FILL */
GLboolean CullFlag; /**< Culling on/off flag */
GLboolean SmoothFlag;   /**< True if GL_POLYGON_SMOOTH is enabled */
GLboolean StippleFlag;  /**< True if GL_POLYGON_STIPPLE is enabled */
-- 
2.7.4

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


Re: [Mesa-dev] [PATCH] radv/winsys: replace bo list searchs with a hash table.

2018-01-30 Thread Dave Airlie
On 31 January 2018 at 12:27, Dieter Nützel  wrote:
> Ping!

I'm not sure this was much of a win, and if it makes things worse in some cases,
then it needs a lot more investigation, so probably consider it dead for now.

Dave.

>
> Am 11.01.2018 04:53, schrieb Dave Airlie:
>>
>> From: Dave Airlie 
>>
>> This should make the merging of cmd buffers less CPU intensive,
>> note I said *should* :)
>> ---
>>  src/amd/vulkan/winsys/amdgpu/radv_amdgpu_cs.c | 47
>> ---
>>  1 file changed, 20 insertions(+), 27 deletions(-)
>>
>> diff --git a/src/amd/vulkan/winsys/amdgpu/radv_amdgpu_cs.c
>> b/src/amd/vulkan/winsys/amdgpu/radv_amdgpu_cs.c
>> index 0ee56f91447..9a39d237ae8 100644
>> --- a/src/amd/vulkan/winsys/amdgpu/radv_amdgpu_cs.c
>> +++ b/src/amd/vulkan/winsys/amdgpu/radv_amdgpu_cs.c
>> @@ -33,6 +33,7 @@
>>  #include "radv_amdgpu_bo.h"
>>  #include "sid.h"
>>
>> +#include "util/hash_table.h"
>>
>>  enum {
>> VIRTUAL_BUFFER_HASH_TABLE_SIZE = 1024
>> @@ -584,6 +585,9 @@ static int radv_amdgpu_create_bo_list(struct
>> radv_amdgpu_winsys *ws,
>> priorities[0] = 8;
>> }
>>
>> +   struct hash_table *ht = _mesa_hash_table_create(NULL,
>> _mesa_hash_pointer,
>> +
>> _mesa_key_pointer_equal);
>> +
>> for (unsigned i = 0; i < count + !!extra_cs; ++i) {
>> struct radv_amdgpu_cs *cs;
>>
>> @@ -595,50 +599,39 @@ static int radv_amdgpu_create_bo_list(struct
>> radv_amdgpu_winsys *ws,
>> if (!cs->num_buffers)
>> continue;
>>
>> -   if (unique_bo_count == 0) {
>> -   memcpy(handles, cs->handles,
>> cs->num_buffers * sizeof(amdgpu_bo_handle));
>> -   memcpy(priorities, cs->priorities,
>> cs->num_buffers * sizeof(uint8_t));
>> -   unique_bo_count = cs->num_buffers;
>> -   continue;
>> -   }
>> -   int unique_bo_so_far = unique_bo_count;
>> for (unsigned j = 0; j < cs->num_buffers; ++j) {
>> -   bool found = false;
>> -   for (unsigned k = 0; k < unique_bo_so_far;
>> ++k) {
>> -   if (handles[k] == cs->handles[j])
>> {
>> -   found = true;
>> -   priorities[k] =
>> MAX2(priorities[k],
>> -
>> cs->priorities[j]);
>> -   break;
>> -   }
>> -   }
>> -   if (!found) {
>> +   struct hash_entry *entry =
>> _mesa_hash_table_search(ht, (void
>> *)cs->handles[j]);
>> +   if (!entry) {
>> +   _mesa_hash_table_insert(ht, (void
>> *)cs->handles[j], (void
>> *)(uintptr_t)unique_bo_count);
>> handles[unique_bo_count] =
>> cs->handles[j];
>> priorities[unique_bo_count] =
>> cs->priorities[j];
>> ++unique_bo_count;
>> +   } else {
>> +   int bo_idx = (uint32_t)(unsigned
>> long)entry->data;
>> +   priorities[bo_idx] =
>> MAX2(priorities[bo_idx],
>> +
>> cs->priorities[j]);
>> }
>> }
>> for (unsigned j = 0; j < cs->num_virtual_buffers;
>> ++j) {
>> struct radv_amdgpu_winsys_bo *virtual_bo =
>> radv_amdgpu_winsys_bo(cs->virtual_buffers[j]);
>> for(unsigned k = 0; k <
>> virtual_bo->bo_count; ++k) {
>> struct radv_amdgpu_winsys_bo *bo =
>> virtual_bo->bos[k];
>> -   bool found = false;
>> -   for (unsigned m = 0; m <
>> unique_bo_count; ++m) {
>> -   if (handles[m] == bo->bo)
>> {
>> -   found = true;
>> -   priorities[m] =
>> MAX2(priorities[m],
>> -
>> cs->virtual_buffer_priorities[j]);
>> -   break;
>> -   }
>> -   }
>> -   if (!found) {
>> +
>> +   struct hash_entry *entry =
>> _mesa_hash_table_search(ht, (void *)bo->bo);
>> +   if (!entry) {
>> +
>> _mesa_hash_table_insert(ht, (void 

[Mesa-dev] [PATCH] docs/features: mark EXT_semaphore(_fd) as DONE

2018-01-30 Thread Andres Rodriguez
Support for these extensions is available in radeonsi.

Signed-off-by: Andres Rodriguez 
---
 docs/features.txt | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

diff --git a/docs/features.txt b/docs/features.txt
index 2e110d9994..1672460a2f 100644
--- a/docs/features.txt
+++ b/docs/features.txt
@@ -316,8 +316,8 @@ Khronos, ARB, and OES extensions that are not part of any 
OpenGL or OpenGL ES ve
   GL_EXT_memory_object  DONE (radeonsi)
   GL_EXT_memory_object_fd   DONE (radeonsi)
   GL_EXT_memory_object_win32not started
-  GL_EXT_semaphore  not started
-  GL_EXT_semaphore_fd   not started
+  GL_EXT_semaphore  DONE (radeonsi)
+  GL_EXT_semaphore_fd   DONE (radeonsi)
   GL_EXT_semaphore_win32not started
   GL_KHR_blend_equation_advanced_coherent   DONE (i965/gen9+)
   GL_KHR_texture_compression_astc_hdr   DONE (i965/bxt)
-- 
2.14.1

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


Re: [Mesa-dev] [PATCH] radv/winsys: replace bo list searchs with a hash table.

2018-01-30 Thread Dieter Nützel

Am 12.01.2018 01:31, schrieb Dieter Nützel:

Tested-by: Dieter Nützel 

This offer an additional 1-1,5% (~20 fps) boost with 'smoketest'.

6290 presents in 5.00045 seconds (FPS: 1257.89)
6291 presents in 5.00041 seconds (FPS: 1258.1)
6293 presents in 5.00065 seconds (FPS: 1258.44)
6289 presents in 5.0006 seconds (FPS: 1257.65)

But _only_ with 'ondemand' governor!!!

cpupower frequency-set -g ondemand => GOOD
cpupower frequency-set -g performance => BAD
cpupower frequency-set -g schedutil => BAD

performance: 100-110 fps _lower_
schedutil: 110-140 fps _lower_


Hello Dave,

if you refer to this part,

I'm not sure this was much of a win, and if it makes things worse in 
some
cases, then it needs a lot more investigation, so probably consider it 
dead

for now.

Dave.


it was _only_ additional finding on my side.
Boost is there, I'm running daily with it.

'New' finding for me was, that 'performance' and 'schedutil' is slower 
as 'ondemand' for Vulkan (only radv tested) opposed to OpenGL, where 
'performance' is the clear winner (in most games much more min and avg 
plus max fps).


With 'cpupower frequency-set -g performance' I get _more_ noise (bus?) 
from my system during 'smoketest'. (Apart from this patch.) And it is 
somewhat slower.


Your call.

Greetings,
Dieter



Am 11.01.2018 04:53, schrieb Dave Airlie:

From: Dave Airlie 

This should make the merging of cmd buffers less CPU intensive,
note I said *should* :)
---
 src/amd/vulkan/winsys/amdgpu/radv_amdgpu_cs.c | 47 
---

 1 file changed, 20 insertions(+), 27 deletions(-)

diff --git a/src/amd/vulkan/winsys/amdgpu/radv_amdgpu_cs.c
b/src/amd/vulkan/winsys/amdgpu/radv_amdgpu_cs.c
index 0ee56f91447..9a39d237ae8 100644
--- a/src/amd/vulkan/winsys/amdgpu/radv_amdgpu_cs.c
+++ b/src/amd/vulkan/winsys/amdgpu/radv_amdgpu_cs.c
@@ -33,6 +33,7 @@
 #include "radv_amdgpu_bo.h"
 #include "sid.h"

+#include "util/hash_table.h"

 enum {
VIRTUAL_BUFFER_HASH_TABLE_SIZE = 1024
@@ -584,6 +585,9 @@ static int radv_amdgpu_create_bo_list(struct
radv_amdgpu_winsys *ws,
priorities[0] = 8;
}

+		struct hash_table *ht = _mesa_hash_table_create(NULL, 
_mesa_hash_pointer,

+   
_mesa_key_pointer_equal);
+
for (unsigned i = 0; i < count + !!extra_cs; ++i) {
struct radv_amdgpu_cs *cs;

@@ -595,50 +599,39 @@ static int radv_amdgpu_create_bo_list(struct
radv_amdgpu_winsys *ws,
if (!cs->num_buffers)
continue;

-   if (unique_bo_count == 0) {
-memcpy(handles, cs->handles, cs->num_buffers * 
sizeof(amdgpu_bo_handle));
-memcpy(priorities, cs->priorities, cs->num_buffers * 
sizeof(uint8_t));

-   unique_bo_count = cs->num_buffers;
-   continue;
-   }
-   int unique_bo_so_far = unique_bo_count;
for (unsigned j = 0; j < cs->num_buffers; ++j) {
-   bool found = false;
-   for (unsigned k = 0; k < unique_bo_so_far; ++k) 
{
-   if (handles[k] == cs->handles[j]) {
-   found = true;
-   priorities[k] = 
MAX2(priorities[k],
-
cs->priorities[j]);
-   break;
-   }
-   }
-   if (!found) {
+   struct hash_entry *entry = 
_mesa_hash_table_search(ht, (void
*)cs->handles[j]);
+   if (!entry) {
+   _mesa_hash_table_insert(ht, (void 
*)cs->handles[j], (void
*)(uintptr_t)unique_bo_count);
handles[unique_bo_count] = 
cs->handles[j];
priorities[unique_bo_count] = 
cs->priorities[j];
++unique_bo_count;
+   } else {
+   int bo_idx = (uint32_t)(unsigned 
long)entry->data;
+   priorities[bo_idx] = 
MAX2(priorities[bo_idx],
+ 
cs->priorities[j]);
}
}
for (unsigned j = 0; j < cs->num_virtual_buffers; ++j) {
struct radv_amdgpu_winsys_bo *virtual_bo =
radv_amdgpu_winsys_bo(cs->virtual_buffers[j]);
for(unsigned k = 0; k < virtual_bo->bo_count; 
++k) {
struct 

Re: [Mesa-dev] [PATCH] mesa: fix broken glGet*(GL_POLYGON_MODE) query

2018-01-30 Thread Roland Scheidegger
I wasn't sure if someone wanted to fix it by using special getter for
it, but it might not be worth the trouble... Thanks!

Reviewed-by: Roland Scheidegger 

Am 31.01.2018 um 03:35 schrieb Brian Paul:
> This reverts part of the patch which introduced the GLenum16 change.
> Fixes a conform regression found by Roland.
> 
> Fixes: f96a69f916aed405 ("mesa: replace GLenum with GLenum16 in
> common structures (v4)")
> ---
>  src/mesa/main/get_hash_params.py | 2 +-
>  src/mesa/main/mtypes.h   | 4 ++--
>  2 files changed, 3 insertions(+), 3 deletions(-)
> 
> diff --git a/src/mesa/main/get_hash_params.py 
> b/src/mesa/main/get_hash_params.py
> index 7cd195c..b61b16b 100644
> --- a/src/mesa/main/get_hash_params.py
> +++ b/src/mesa/main/get_hash_params.py
> @@ -743,7 +743,7 @@ descriptor=[
>[ "PIXEL_MAP_R_TO_R_SIZE", "CONTEXT_INT(PixelMaps.RtoR.Size), NO_EXTRA" ],
>[ "PIXEL_MAP_S_TO_S_SIZE", "CONTEXT_INT(PixelMaps.StoS.Size), NO_EXTRA" ],
>[ "POINT_SIZE_GRANULARITY", "CONTEXT_FLOAT(Const.PointSizeGranularity), 
> NO_EXTRA" ],
> -  [ "POLYGON_MODE", "CONTEXT_ENUM16(Polygon.FrontMode), NO_EXTRA" ],
> +  [ "POLYGON_MODE", "CONTEXT_ENUM2(Polygon.FrontMode), NO_EXTRA" ],
>[ "POLYGON_OFFSET_BIAS_EXT", "CONTEXT_FLOAT(Polygon.OffsetUnits), 
> NO_EXTRA" ],
>[ "POLYGON_OFFSET_POINT", "CONTEXT_BOOL(Polygon.OffsetPoint), NO_EXTRA" ],
>[ "POLYGON_OFFSET_LINE", "CONTEXT_BOOL(Polygon.OffsetLine), NO_EXTRA" ],
> diff --git a/src/mesa/main/mtypes.h b/src/mesa/main/mtypes.h
> index 35fafa5..f6fa6f4 100644
> --- a/src/mesa/main/mtypes.h
> +++ b/src/mesa/main/mtypes.h
> @@ -843,8 +843,8 @@ struct gl_point_attrib
>  struct gl_polygon_attrib
>  {
> GLenum16 FrontFace;   /**< Either GL_CW or GL_CCW */
> -   GLenum16 FrontMode;   /**< Either GL_POINT, GL_LINE or 
> GL_FILL */
> -   GLenum16 BackMode;/**< Either GL_POINT, GL_LINE or 
> GL_FILL */
> +   GLenum FrontMode; /**< Either GL_POINT, GL_LINE or GL_FILL */
> +   GLenum BackMode;  /**< Either GL_POINT, GL_LINE or GL_FILL */
> GLboolean CullFlag;   /**< Culling on/off flag */
> GLboolean SmoothFlag; /**< True if GL_POLYGON_SMOOTH is enabled */
> GLboolean StippleFlag;/**< True if GL_POLYGON_STIPPLE is enabled */
> 

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


Re: [Mesa-dev] [PATCH 1/4] mesa: don't flag _NEW_COLOR for KHR adv.blend if prog constant doesn't change

2018-01-30 Thread Ian Romanick
On 01/30/2018 07:48 AM, Marek Olšák wrote:
> From: Marek Olšák 
> 
> This only affects drivers that set DriverFlags.NewBlend.
> ---
>  src/mesa/main/blend.c |  6 --
>  src/mesa/main/blend.h | 41 
> +++
>  src/mesa/main/enable.c| 14 +
>  src/mesa/program/prog_statevars.c |  3 ++-
>  4 files changed, 49 insertions(+), 15 deletions(-)
> 
> diff --git a/src/mesa/main/blend.c b/src/mesa/main/blend.c
> index 6b379f2..ec8e27e 100644
> --- a/src/mesa/main/blend.c
> +++ b/src/mesa/main/blend.c
> @@ -528,21 +528,22 @@ _mesa_BlendEquation( GLenum mode )
>  
> if (!changed)
>return;
>  
>  
> if (!legal_simple_blend_equation(ctx, mode) && !advanced_mode) {
>_mesa_error(ctx, GL_INVALID_ENUM, "glBlendEquation");
>return;
> }
>  
> -   _mesa_flush_vertices_for_blend_state(ctx);
> +   _mesa_flush_vertices_for_blend_adv(ctx, ctx->Color.BlendEnabled,
> +  advanced_mode);
>  
> for (buf = 0; buf < numBuffers; buf++) {
>ctx->Color.Blend[buf].EquationRGB = mode;
>ctx->Color.Blend[buf].EquationA = mode;
> }
> ctx->Color._BlendEquationPerBuffer = GL_FALSE;
> ctx->Color._AdvancedBlendMode = advanced_mode;
>  
> if (ctx->Driver.BlendEquationSeparate)
>ctx->Driver.BlendEquationSeparate(ctx, mode, mode);
> @@ -553,21 +554,22 @@ _mesa_BlendEquation( GLenum mode )
>   * Set blend equation for one color buffer/target.
>   */
>  static void
>  blend_equationi(struct gl_context *ctx, GLuint buf, GLenum mode,
>  enum gl_advanced_blend_mode advanced_mode)
>  {
> if (ctx->Color.Blend[buf].EquationRGB == mode &&
> ctx->Color.Blend[buf].EquationA == mode)
>return;  /* no change */
>  
> -   _mesa_flush_vertices_for_blend_state(ctx);
> +   _mesa_flush_vertices_for_blend_adv(ctx, ctx->Color.BlendEnabled,
> +  advanced_mode);
> ctx->Color.Blend[buf].EquationRGB = mode;
> ctx->Color.Blend[buf].EquationA = mode;
> ctx->Color._BlendEquationPerBuffer = GL_TRUE;
>  
> if (buf == 0)
>ctx->Color._AdvancedBlendMode = advanced_mode;
>  }
>  
>  
>  void GLAPIENTRY
> diff --git a/src/mesa/main/blend.h b/src/mesa/main/blend.h
> index 2454e0c..cba5a98 100644
> --- a/src/mesa/main/blend.h
> +++ b/src/mesa/main/blend.h
> @@ -147,28 +147,53 @@ extern void
>  _mesa_update_clamp_vertex_color(struct gl_context *ctx,
>  const struct gl_framebuffer *drawFb);
>  
>  extern mesa_format
>  _mesa_get_render_format(const struct gl_context *ctx, mesa_format format);
>  
>  extern void  
>  _mesa_init_color( struct gl_context * ctx );
>  
>  
> +static inline unsigned
> +_mesa_get_advanded_blend_sh_constant(GLbitfield blend_enabled,
> + enum gl_advanced_blend_mode mode)
> +{
> +   return blend_enabled ? mode : 0;

Should this be BLEND_NONE with a return type enum gl_advanced_blend_mode?

> +}
> +
> +static inline bool
> +_mesa_advanded_blend_sh_constant_changed(struct gl_context *ctx,
> + GLbitfield new_blend_enabled,
> + enum gl_advanced_blend_mode 
> new_mode)
> +{
> +   return _mesa_get_advanded_blend_sh_constant(new_blend_enabled, new_mode) 
> !=
> +  _mesa_get_advanded_blend_sh_constant(ctx->Color.BlendEnabled,
> +   
> ctx->Color._AdvancedBlendMode);
> +}
> +
>  static inline void
>  _mesa_flush_vertices_for_blend_state(struct gl_context *ctx)
>  {
> -   /* The advanced blend mode needs _NEW_COLOR to update the state constant,
> -* so we have to set it. This is inefficient.
> -* This should only be done for states that affect the state constant.
> -* It shouldn't be done for other blend states.
> -*/
> -   if (_mesa_has_KHR_blend_equation_advanced(ctx) ||
> -   !ctx->DriverFlags.NewBlend) {
> +   if (!ctx->DriverFlags.NewBlend) {
>FLUSH_VERTICES(ctx, _NEW_COLOR);
> } else {
>FLUSH_VERTICES(ctx, 0);
> +  ctx->NewDriverState |= ctx->DriverFlags.NewBlend;
> +   }
> +}
> +
> +static inline void
> +_mesa_flush_vertices_for_blend_adv(struct gl_context *ctx,
> +   GLbitfield new_blend_enabled,
> +   enum gl_advanced_blend_mode new_mode)
> +{
> +   /* The advanced blend mode needs _NEW_COLOR to update the state constant. 
> */
> +   if (_mesa_has_KHR_blend_equation_advanced(ctx) &&
> +   _mesa_advanded_blend_sh_constant_changed(ctx, new_blend_enabled,
> +new_mode)) {
> +  FLUSH_VERTICES(ctx, _NEW_COLOR);
> }
> -   ctx->NewDriverState |= ctx->DriverFlags.NewBlend;
> +   _mesa_flush_vertices_for_blend_state(ctx);

This is going to cause FLUSH_VERTICES twice.  This is supposed to be an
optimization, 

[Mesa-dev] [PATCH 1/2] svga: s/unsigned/VGPU10_OPCODE_TYPE/

2018-01-30 Thread Brian Paul
---
 src/gallium/drivers/svga/svga_tgsi_vgpu10.c | 21 +++--
 1 file changed, 11 insertions(+), 10 deletions(-)

diff --git a/src/gallium/drivers/svga/svga_tgsi_vgpu10.c 
b/src/gallium/drivers/svga/svga_tgsi_vgpu10.c
index 2f16935..da520be 100644
--- a/src/gallium/drivers/svga/svga_tgsi_vgpu10.c
+++ b/src/gallium/drivers/svga/svga_tgsi_vgpu10.c
@@ -1198,7 +1198,7 @@ emit_face_register(struct svga_shader_emitter_v10 *emit)
  */
 static void
 emit_opcode(struct svga_shader_emitter_v10 *emit,
-unsigned vgpu10_opcode, boolean saturate)
+VGPU10_OPCODE_TYPE vgpu10_opcode, boolean saturate)
 {
VGPU10OpcodeToken0 token0;
 
@@ -2053,7 +2053,7 @@ emit_decl_instruction(struct svga_shader_emitter_v10 
*emit,
  */
 static void
 emit_input_declaration(struct svga_shader_emitter_v10 *emit,
-   unsigned opcodeType, unsigned operandType,
+   VGPU10_OPCODE_TYPE opcodeType, unsigned operandType,
unsigned dim, unsigned index, unsigned size,
unsigned name, unsigned numComp,
unsigned selMode, unsigned usageMask,
@@ -2411,7 +2411,7 @@ emit_input_declarations(struct svga_shader_emitter_v10 
*emit)
  enum tgsi_semantic semantic_name = emit->info.input_semantic_name[i];
  unsigned usage_mask = emit->info.input_usage_mask[i];
  unsigned index = emit->linkage.input_map[i];
- unsigned opcodeType, operandType;
+ VGPU10_OPCODE_TYPE opcodeType, operandType;
  unsigned numComp, selMode;
  unsigned name;
  unsigned dim;
@@ -3106,7 +3106,7 @@ emit_resource_declarations(struct svga_shader_emitter_v10 
*emit)
 
 static void
 emit_instruction_op1(struct svga_shader_emitter_v10 *emit,
- unsigned opcode,
+ VGPU10_OPCODE_TYPE opcode,
  const struct tgsi_full_dst_register *dst,
  const struct tgsi_full_src_register *src,
  boolean saturate)
@@ -3120,7 +3120,7 @@ emit_instruction_op1(struct svga_shader_emitter_v10 *emit,
 
 static void
 emit_instruction_op2(struct svga_shader_emitter_v10 *emit,
- unsigned opcode,
+ VGPU10_OPCODE_TYPE opcode,
  const struct tgsi_full_dst_register *dst,
  const struct tgsi_full_src_register *src1,
  const struct tgsi_full_src_register *src2,
@@ -3136,7 +3136,7 @@ emit_instruction_op2(struct svga_shader_emitter_v10 *emit,
 
 static void
 emit_instruction_op3(struct svga_shader_emitter_v10 *emit,
- unsigned opcode,
+ VGPU10_OPCODE_TYPE opcode,
  const struct tgsi_full_dst_register *dst,
  const struct tgsi_full_src_register *src1,
  const struct tgsi_full_src_register *src2,
@@ -3484,7 +3484,7 @@ emit_arl_uarl(struct svga_shader_emitter_v10 *emit,
 {
unsigned index = inst->Dst[0].Register.Index;
struct tgsi_full_dst_register dst;
-   unsigned opcode;
+   VGPU10_OPCODE_TYPE opcode;
 
assert(index < MAX_VGPU10_ADDR_REGS);
dst = make_dst_temp_reg(emit->address_reg_index[index]);
@@ -5061,7 +5061,7 @@ emit_tex(struct svga_shader_emitter_v10 *emit,
 {
const uint unit = inst->Src[1].Register.Index;
const enum tgsi_texture_type target = inst->Texture.Texture;
-   unsigned opcode;
+   VGPU10_OPCODE_TYPE opcode;
struct tgsi_full_src_register coord;
int offsets[3];
struct tex_swizzle_info swz_info;
@@ -5111,7 +5111,7 @@ emit_txp(struct svga_shader_emitter_v10 *emit,
 {
const uint unit = inst->Src[1].Register.Index;
const enum tgsi_texture_type target = inst->Texture.Texture;
-   unsigned opcode;
+   VGPU10_OPCODE_TYPE opcode;
int offsets[3];
unsigned tmp = get_temp_index(emit);
struct tgsi_full_src_register tmp_src = make_src_temp_reg(tmp);
@@ -5263,7 +5263,8 @@ emit_txl_txb(struct svga_shader_emitter_v10 *emit,
  const struct tgsi_full_instruction *inst)
 {
const enum tgsi_texture_type target = inst->Texture.Texture;
-   unsigned opcode, unit;
+   VGPU10_OPCODE_TYPE opcode;
+   unsigned unit;
int offsets[3];
struct tgsi_full_src_register coord, lod_bias;
struct tex_swizzle_info swz_info;
-- 
2.7.4

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


[Mesa-dev] [PATCH 2/2] svga: use opcode local var to simplify some code

2018-01-30 Thread Brian Paul
---
 src/gallium/drivers/svga/svga_tgsi_vgpu10.c | 6 ++
 1 file changed, 2 insertions(+), 4 deletions(-)

diff --git a/src/gallium/drivers/svga/svga_tgsi_vgpu10.c 
b/src/gallium/drivers/svga/svga_tgsi_vgpu10.c
index da520be..73aa78b 100644
--- a/src/gallium/drivers/svga/svga_tgsi_vgpu10.c
+++ b/src/gallium/drivers/svga/svga_tgsi_vgpu10.c
@@ -5360,8 +5360,7 @@ emit_simple(struct svga_shader_emitter_v10 *emit,
unsigned i;
 
begin_emit_instruction(emit);
-   emit_opcode(emit, translate_opcode(inst->Instruction.Opcode),
-   inst->Instruction.Saturate);
+   emit_opcode(emit, translate_opcode(opcode), inst->Instruction.Saturate);
for (i = 0; i < op->num_dst; i++) {
   emit_dst_register(emit, >Dst[i]);
}
@@ -5412,8 +5411,7 @@ emit_simple_1dst(struct svga_shader_emitter_v10 *emit,
unsigned i;
 
begin_emit_instruction(emit);
-   emit_opcode(emit, translate_opcode(inst->Instruction.Opcode),
-   inst->Instruction.Saturate);
+   emit_opcode(emit, translate_opcode(opcode), inst->Instruction.Saturate);
 
for (i = 0; i < dst_count; i++) {
   if (i == dst_index) {
-- 
2.7.4

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


[Mesa-dev] [PATCH 1/2] st/mesa: s/int/GLenum/ in st_glsl_to_tgsi.cpp

2018-01-30 Thread Brian Paul
---
 src/mesa/state_tracker/st_glsl_to_tgsi.cpp | 11 ++-
 1 file changed, 6 insertions(+), 5 deletions(-)

diff --git a/src/mesa/state_tracker/st_glsl_to_tgsi.cpp 
b/src/mesa/state_tracker/st_glsl_to_tgsi.cpp
index 84ed614..a1e37cf 100644
--- a/src/mesa/state_tracker/st_glsl_to_tgsi.cpp
+++ b/src/mesa/state_tracker/st_glsl_to_tgsi.cpp
@@ -98,7 +98,7 @@ public:
 
 class immediate_storage : public exec_node {
 public:
-   immediate_storage(gl_constant_value *values, int size32, int type)
+   immediate_storage(gl_constant_value *values, int size32, GLenum type)
{
   memcpy(this->values, values, size32 * sizeof(gl_constant_value));
   this->size32 = size32;
@@ -108,7 +108,7 @@ public:
/* doubles are stored across 2 gl_constant_values */
gl_constant_value values[4];
int size32; /**< Number of 32-bit components (1-4) */
-   int type; /**< GL_DOUBLE, GL_FLOAT, GL_INT, GL_BOOL, or GL_UNSIGNED_INT */
+   GLenum type; /**< GL_DOUBLE, GL_FLOAT, GL_INT, GL_BOOL, or GL_UNSIGNED_INT 
*/
 };
 
 static const st_src_reg undef_src = st_src_reg(PROGRAM_UNDEFINED, 0, 
GLSL_TYPE_ERROR);
@@ -207,7 +207,7 @@ public:
variable_storage *find_variable_storage(ir_variable *var);
 
int add_constant(gl_register_file file, gl_constant_value values[8],
-int size, int datatype, uint16_t *swizzle_out);
+int size, GLenum datatype, uint16_t *swizzle_out);
 
st_src_reg get_temp(const glsl_type *type);
void reladdr_to_temp(ir_instruction *ir, st_src_reg *reg, int *num_reladdr);
@@ -826,7 +826,8 @@ glsl_to_tgsi_visitor::emit_arl(ir_instruction *ir,
 
 int
 glsl_to_tgsi_visitor::add_constant(gl_register_file file,
-   gl_constant_value values[8], int size, int 
datatype,
+   gl_constant_value values[8], int size,
+   GLenum datatype,
uint16_t *swizzle_out)
 {
if (file == PROGRAM_CONSTANT) {
@@ -5485,7 +5486,7 @@ _mesa_sysval_to_semantic(unsigned sysval)
 static struct ureg_src
 emit_immediate(struct st_translate *t,
gl_constant_value values[4],
-   int type, int size)
+   GLenum type, int size)
 {
struct ureg_program *ureg = t->ureg;
 
-- 
2.7.4

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


[Mesa-dev] [PATCH 2/2] st/mesa: whitespace, formatting fixes in st_glsl_to_tgsi.cpp

2018-01-30 Thread Brian Paul
---
 src/mesa/state_tracker/st_glsl_to_tgsi.cpp | 273 ++---
 1 file changed, 169 insertions(+), 104 deletions(-)

diff --git a/src/mesa/state_tracker/st_glsl_to_tgsi.cpp 
b/src/mesa/state_tracker/st_glsl_to_tgsi.cpp
index a1e37cf..c92b1d9 100644
--- a/src/mesa/state_tracker/st_glsl_to_tgsi.cpp
+++ b/src/mesa/state_tracker/st_glsl_to_tgsi.cpp
@@ -348,12 +348,16 @@ public:
void *mem_ctx;
 };
 
-static st_dst_reg address_reg = st_dst_reg(PROGRAM_ADDRESS, WRITEMASK_X, 
GLSL_TYPE_FLOAT, 0);
-static st_dst_reg address_reg2 = st_dst_reg(PROGRAM_ADDRESS, WRITEMASK_X, 
GLSL_TYPE_FLOAT, 1);
-static st_dst_reg sampler_reladdr = st_dst_reg(PROGRAM_ADDRESS, WRITEMASK_X, 
GLSL_TYPE_FLOAT, 2);
+static st_dst_reg address_reg = st_dst_reg(PROGRAM_ADDRESS, WRITEMASK_X,
+   GLSL_TYPE_FLOAT, 0);
+static st_dst_reg address_reg2 = st_dst_reg(PROGRAM_ADDRESS, WRITEMASK_X,
+GLSL_TYPE_FLOAT, 1);
+static st_dst_reg sampler_reladdr = st_dst_reg(PROGRAM_ADDRESS, WRITEMASK_X,
+   GLSL_TYPE_FLOAT, 2);
 
 static void
-fail_link(struct gl_shader_program *prog, const char *fmt, ...) PRINTFLIKE(2, 
3);
+fail_link(struct gl_shader_program *prog, const char *fmt, ...)
+   PRINTFLIKE(2, 3);
 
 static void
 fail_link(struct gl_shader_program *prog, const char *fmt, ...)
@@ -445,7 +449,7 @@ glsl_to_tgsi_visitor::emit_asm(ir_instruction *ir, unsigned 
op,
 
/* Update indirect addressing status used by TGSI */
if (dst.reladdr || dst.reladdr2) {
-  switch(dst.file) {
+  switch (dst.file) {
   case PROGRAM_STATE_VAR:
   case PROGRAM_CONSTANT:
   case PROGRAM_UNIFORM:
@@ -460,8 +464,8 @@ glsl_to_tgsi_visitor::emit_asm(ir_instruction *ir, unsigned 
op,
}
else {
   for (i = 0; i < 4; i++) {
- if(inst->src[i].reladdr) {
-switch(inst->src[i].file) {
+ if (inst->src[i].reladdr) {
+switch (inst->src[i].file) {
 case PROGRAM_STATE_VAR:
 case PROGRAM_CONSTANT:
 case PROGRAM_UNIFORM:
@@ -497,8 +501,11 @@ glsl_to_tgsi_visitor::emit_asm(ir_instruction *ir, 
unsigned op,
 */
for (j = 0; j < 2; j++) {
   dst_is_64bit[j] = glsl_base_type_is_64bit(inst->dst[j].type);
-  if (!dst_is_64bit[j] && inst->dst[j].file == PROGRAM_OUTPUT && 
inst->dst[j].type == GLSL_TYPE_ARRAY) {
- enum glsl_base_type type = find_array_type(this->outputs, 
this->num_outputs, inst->dst[j].array_id);
+  if (!dst_is_64bit[j] && inst->dst[j].file == PROGRAM_OUTPUT &&
+  inst->dst[j].type == GLSL_TYPE_ARRAY) {
+ enum glsl_base_type type = find_array_type(this->outputs,
+this->num_outputs,
+inst->dst[j].array_id);
  if (glsl_base_type_is_64bit(type))
 dst_is_64bit[j] = true;
   }
@@ -510,7 +517,8 @@ glsl_to_tgsi_visitor::emit_asm(ir_instruction *ir, unsigned 
op,
   int initial_src_swz[4], initial_src_idx[4];
   int initial_dst_idx[2], initial_dst_writemask[2];
   /* select the writemask for dst0 or dst1 */
-  unsigned writemask = inst->dst[1].file == PROGRAM_UNDEFINED ? 
inst->dst[0].writemask : inst->dst[1].writemask;
+  unsigned writemask = inst->dst[1].file == PROGRAM_UNDEFINED
+ ? inst->dst[0].writemask : inst->dst[1].writemask;
 
   /* copy out the writemask, index and swizzles for all src/dsts. */
   for (j = 0; j < 2; j++) {
@@ -532,9 +540,10 @@ glsl_to_tgsi_visitor::emit_asm(ir_instruction *ir, 
unsigned op,
 
  int i = u_bit_scan();
 
- /* before emitting the instruction, see if we have to adjust load / 
store
-  * address */
- if (i > 1 && (inst->op == TGSI_OPCODE_LOAD || inst->op == 
TGSI_OPCODE_STORE) &&
+ /* before emitting the instruction, see if we have to adjust
+  * load / store address */
+ if (i > 1 && (inst->op == TGSI_OPCODE_LOAD ||
+   inst->op == TGSI_OPCODE_STORE) &&
  addr.file == PROGRAM_UNDEFINED) {
 /* We have to advance the buffer address by 16 */
 addr = get_temp(glsl_type::uint_type);
@@ -561,14 +570,16 @@ glsl_to_tgsi_visitor::emit_asm(ir_instruction *ir, 
unsigned op,
dinst->dst[j].writemask = (i & 1) ? WRITEMASK_ZW : WRITEMASK_XY;
dinst->dst[j].index = initial_dst_idx[j];
if (i > 1) {
-  if (dinst->op == TGSI_OPCODE_LOAD || dinst->op == 
TGSI_OPCODE_STORE)
+  if (dinst->op == TGSI_OPCODE_LOAD ||
+  dinst->op == TGSI_OPCODE_STORE)
  dinst->src[0] = addr;
   if (dinst->op != TGSI_OPCODE_STORE)
  dinst->dst[j].index++;
}
 } else {
-   /* if we aren't writing to a double, just get the bit 

Re: [Mesa-dev] [PATCH] mesa: fix broken glGet*(GL_POLYGON_MODE) query

2018-01-30 Thread Brian Paul

On 01/30/2018 08:25 PM, Roland Scheidegger wrote:

I wasn't sure if someone wanted to fix it by using special getter for
it, but it might not be worth the trouble... Thanks!


If someone wants to do it that way, that's fine by me.  This is just 
simpler for the time being.


-Brian



Reviewed-by: Roland Scheidegger 

Am 31.01.2018 um 03:35 schrieb Brian Paul:

This reverts part of the patch which introduced the GLenum16 change.
Fixes a conform regression found by Roland.

Fixes: f96a69f916aed405 ("mesa: replace GLenum with GLenum16 in
common structures (v4)")
---
  src/mesa/main/get_hash_params.py | 2 +-
  src/mesa/main/mtypes.h   | 4 ++--
  2 files changed, 3 insertions(+), 3 deletions(-)

diff --git a/src/mesa/main/get_hash_params.py b/src/mesa/main/get_hash_params.py
index 7cd195c..b61b16b 100644
--- a/src/mesa/main/get_hash_params.py
+++ b/src/mesa/main/get_hash_params.py
@@ -743,7 +743,7 @@ descriptor=[
[ "PIXEL_MAP_R_TO_R_SIZE", "CONTEXT_INT(PixelMaps.RtoR.Size), NO_EXTRA" ],
[ "PIXEL_MAP_S_TO_S_SIZE", "CONTEXT_INT(PixelMaps.StoS.Size), NO_EXTRA" ],
[ "POINT_SIZE_GRANULARITY", "CONTEXT_FLOAT(Const.PointSizeGranularity), 
NO_EXTRA" ],
-  [ "POLYGON_MODE", "CONTEXT_ENUM16(Polygon.FrontMode), NO_EXTRA" ],
+  [ "POLYGON_MODE", "CONTEXT_ENUM2(Polygon.FrontMode), NO_EXTRA" ],
[ "POLYGON_OFFSET_BIAS_EXT", "CONTEXT_FLOAT(Polygon.OffsetUnits), NO_EXTRA" 
],
[ "POLYGON_OFFSET_POINT", "CONTEXT_BOOL(Polygon.OffsetPoint), NO_EXTRA" ],
[ "POLYGON_OFFSET_LINE", "CONTEXT_BOOL(Polygon.OffsetLine), NO_EXTRA" ],
diff --git a/src/mesa/main/mtypes.h b/src/mesa/main/mtypes.h
index 35fafa5..f6fa6f4 100644
--- a/src/mesa/main/mtypes.h
+++ b/src/mesa/main/mtypes.h
@@ -843,8 +843,8 @@ struct gl_point_attrib
  struct gl_polygon_attrib
  {
 GLenum16 FrontFace;/**< Either GL_CW or GL_CCW */
-   GLenum16 FrontMode; /**< Either GL_POINT, GL_LINE or GL_FILL */
-   GLenum16 BackMode;  /**< Either GL_POINT, GL_LINE or GL_FILL */
+   GLenum FrontMode;   /**< Either GL_POINT, GL_LINE or GL_FILL */
+   GLenum BackMode;/**< Either GL_POINT, GL_LINE or GL_FILL */
 GLboolean CullFlag;/**< Culling on/off flag */
 GLboolean SmoothFlag;  /**< True if GL_POLYGON_SMOOTH is enabled */
 GLboolean StippleFlag; /**< True if GL_POLYGON_STIPPLE is enabled */





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


Re: [Mesa-dev] [PATCH] radv: remove predication on cache flushes

2018-01-30 Thread Dave Airlie
On 30 January 2018 at 02:26, Matthew Nicholls
 wrote:
> This can lead to a situation where cache flushes could get conditionally
> disabled while still clearing the flush_bits, and thus flushes due to
> application pipeline barriers may never get executed.

Thanks I've pushed this now.

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


[Mesa-dev] [PATCH] gallium/st/clover: remove unused PIPE_SHADER_IR_LLVM

2018-01-30 Thread Timothy Arceri
This has been unused since 100796c15c3a.
---

 Please note this is not even compile tested as I don't have clover
 7.0.0 repo to go with my current llvm 7.0.0 setup. Any testing is
 appreciated.

 src/gallium/docs/source/screen.rst |  4 ++--
 src/gallium/include/pipe/p_defines.h   |  1 -
 src/gallium/include/pipe/p_state.h |  5 +++--
 src/gallium/state_trackers/clover/llvm/codegen.hpp |  7 ---
 src/gallium/state_trackers/clover/llvm/codegen/bitcode.cpp | 14 --
 src/gallium/state_trackers/clover/llvm/invocation.cpp  |  3 ---
 src/mesa/state_tracker/st_program.c|  1 -
 7 files changed, 5 insertions(+), 30 deletions(-)

diff --git a/src/gallium/docs/source/screen.rst 
b/src/gallium/docs/source/screen.rst
index c33facb79b..cb3418fce3 100644
--- a/src/gallium/docs/source/screen.rst
+++ b/src/gallium/docs/source/screen.rst
@@ -531,8 +531,8 @@ pipe_screen::get_compute_param.
 
 * ``PIPE_COMPUTE_CAP_IR_TARGET``: A description of the target of the form
   ``processor-arch-manufacturer-os`` that will be passed on to the compiler.
-  This CAP is only relevant for drivers that specify PIPE_SHADER_IR_LLVM
-  or PIPE_SHADER_IR_NATIVE for their preferred IR.
+  This CAP is only relevant for drivers that specify PIPE_SHADER_IR_NATIVE for
+  their preferred IR.
   Value type: null-terminated string. Shader IR type dependent.
 * ``PIPE_COMPUTE_CAP_GRID_DIMENSION``: Number of supported dimensions
   for grid and block coordinates.  Value type: ``uint64_t``. Shader IR type 
dependent.
diff --git a/src/gallium/include/pipe/p_defines.h 
b/src/gallium/include/pipe/p_defines.h
index 19941350b8..778e5f4e53 100644
--- a/src/gallium/include/pipe/p_defines.h
+++ b/src/gallium/include/pipe/p_defines.h
@@ -894,7 +894,6 @@ enum pipe_shader_cap
 enum pipe_shader_ir
 {
PIPE_SHADER_IR_TGSI = 0,
-   PIPE_SHADER_IR_LLVM,
PIPE_SHADER_IR_NATIVE,
PIPE_SHADER_IR_NIR,
 };
diff --git a/src/gallium/include/pipe/p_state.h 
b/src/gallium/include/pipe/p_state.h
index 10d21db28c..2b56d60b5e 100644
--- a/src/gallium/include/pipe/p_state.h
+++ b/src/gallium/include/pipe/p_state.h
@@ -782,8 +782,9 @@ struct pipe_blit_info
 struct pipe_grid_info
 {
/**
-* For drivers that use PIPE_SHADER_IR_LLVM as their prefered IR, this value
-* will be the index of the kernel in the opencl.kernels metadata list.
+* For drivers that use PIPE_SHADER_IR_NATIVE as their prefered IR, this
+* value will be the index of the kernel in the opencl.kernels metadata
+* list.
 */
uint32_t pc;
 
diff --git a/src/gallium/state_trackers/clover/llvm/codegen.hpp 
b/src/gallium/state_trackers/clover/llvm/codegen.hpp
index 25f6e01beb..391a20298c 100644
--- a/src/gallium/state_trackers/clover/llvm/codegen.hpp
+++ b/src/gallium/state_trackers/clover/llvm/codegen.hpp
@@ -38,13 +38,6 @@
 
 namespace clover {
namespace llvm {
-  module
-  build_module_bitcode(const ::llvm::Module ,
-   const clang::CompilerInstance );
-
-  std::string
-  print_module_bitcode(const ::llvm::Module );
-
   module
   build_module_library(const ::llvm::Module ,
enum module::section::type section_type);
diff --git a/src/gallium/state_trackers/clover/llvm/codegen/bitcode.cpp 
b/src/gallium/state_trackers/clover/llvm/codegen/bitcode.cpp
index 6737f7af0a..b7c5c0b00f 100644
--- a/src/gallium/state_trackers/clover/llvm/codegen/bitcode.cpp
+++ b/src/gallium/state_trackers/clover/llvm/codegen/bitcode.cpp
@@ -71,20 +71,6 @@ namespace {
}
 }
 
-module
-clover::llvm::build_module_bitcode(const ::llvm::Module ,
-   const clang::CompilerInstance ) {
-   return build_module_common(mod, emit_code(mod), get_symbol_offsets(mod), c);
-}
-
-std::string
-clover::llvm::print_module_bitcode(const ::llvm::Module ) {
-   std::string s;
-   ::llvm::raw_string_ostream os { s };
-   mod.print(os, NULL);
-   return os.str();
-}
-
 module
 clover::llvm::build_module_library(const ::llvm::Module ,
enum module::section::type section_type) {
diff --git a/src/gallium/state_trackers/clover/llvm/invocation.cpp 
b/src/gallium/state_trackers/clover/llvm/invocation.cpp
index a373df4eac..e4ca5fa444 100644
--- a/src/gallium/state_trackers/clover/llvm/invocation.cpp
+++ b/src/gallium/state_trackers/clover/llvm/invocation.cpp
@@ -291,9 +291,6 @@ clover::llvm::link_program(const std::vector 
,
if (create_library) {
   return build_module_library(*mod, module::section::text_library);
 
-   } else if (ir == PIPE_SHADER_IR_LLVM) {
-  return build_module_bitcode(*mod, *c);
-
} else if (ir == PIPE_SHADER_IR_NATIVE) {
   if (has_flag(debug::native))
  debug::log(id +  ".asm", print_module_native(*mod, target));
diff --git a/src/mesa/state_tracker/st_program.c 
b/src/mesa/state_tracker/st_program.c
index b3926eaa02..d9b7155a91 

Re: [Mesa-dev] [PATCH 2/2] svga: use opcode local var to simplify some code

2018-01-30 Thread Charmaine Lee

For this series, Reviewed-by: Charmaine Lee 


From: Brian Paul 
Sent: Tuesday, January 30, 2018 7:36:27 PM
To: mesa-dev@lists.freedesktop.org
Cc: Charmaine Lee; Neha Bhende
Subject: [PATCH 2/2] svga: use opcode local var to simplify some code

---
 src/gallium/drivers/svga/svga_tgsi_vgpu10.c | 6 ++
 1 file changed, 2 insertions(+), 4 deletions(-)

diff --git a/src/gallium/drivers/svga/svga_tgsi_vgpu10.c 
b/src/gallium/drivers/svga/svga_tgsi_vgpu10.c
index da520be..73aa78b 100644
--- a/src/gallium/drivers/svga/svga_tgsi_vgpu10.c
+++ b/src/gallium/drivers/svga/svga_tgsi_vgpu10.c
@@ -5360,8 +5360,7 @@ emit_simple(struct svga_shader_emitter_v10 *emit,
unsigned i;

begin_emit_instruction(emit);
-   emit_opcode(emit, translate_opcode(inst->Instruction.Opcode),
-   inst->Instruction.Saturate);
+   emit_opcode(emit, translate_opcode(opcode), inst->Instruction.Saturate);
for (i = 0; i < op->num_dst; i++) {
   emit_dst_register(emit, >Dst[i]);
}
@@ -5412,8 +5411,7 @@ emit_simple_1dst(struct svga_shader_emitter_v10 *emit,
unsigned i;

begin_emit_instruction(emit);
-   emit_opcode(emit, translate_opcode(inst->Instruction.Opcode),
-   inst->Instruction.Saturate);
+   emit_opcode(emit, translate_opcode(opcode), inst->Instruction.Saturate);

for (i = 0; i < dst_count; i++) {
   if (i == dst_index) {
--
2.7.4

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


Re: [Mesa-dev] [PATCH] gallium/st/clover: remove unused PIPE_SHADER_IR_LLVM

2018-01-30 Thread Timothy Arceri

On 31/01/18 15:05, Timothy Arceri wrote:

This has been unused since 100796c15c3a.
---

  Please note this is not even compile tested as I don't have clover >   7.0.0 
repo to go with my current llvm 7.0.0 setup. Any testing is
  appreciated.


That was meant to say clang repo.

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


Re: [Mesa-dev] [PATCH 2/2] st/mesa: whitespace, formatting fixes in st_glsl_to_tgsi.cpp

2018-01-30 Thread Charmaine Lee
For the series, Reviewed-by: Charmaine Lee 


From: Brian Paul 
Sent: Tuesday, January 30, 2018 7:36:43 PM
To: mesa-dev@lists.freedesktop.org
Cc: Charmaine Lee; Neha Bhende
Subject: [PATCH 2/2] st/mesa: whitespace, formatting fixes in 
st_glsl_to_tgsi.cpp

---
 src/mesa/state_tracker/st_glsl_to_tgsi.cpp | 273 ++---
 1 file changed, 169 insertions(+), 104 deletions(-)

diff --git a/src/mesa/state_tracker/st_glsl_to_tgsi.cpp 
b/src/mesa/state_tracker/st_glsl_to_tgsi.cpp
index a1e37cf..c92b1d9 100644
--- a/src/mesa/state_tracker/st_glsl_to_tgsi.cpp
+++ b/src/mesa/state_tracker/st_glsl_to_tgsi.cpp
@@ -348,12 +348,16 @@ public:
void *mem_ctx;
 };

-static st_dst_reg address_reg = st_dst_reg(PROGRAM_ADDRESS, WRITEMASK_X, 
GLSL_TYPE_FLOAT, 0);
-static st_dst_reg address_reg2 = st_dst_reg(PROGRAM_ADDRESS, WRITEMASK_X, 
GLSL_TYPE_FLOAT, 1);
-static st_dst_reg sampler_reladdr = st_dst_reg(PROGRAM_ADDRESS, WRITEMASK_X, 
GLSL_TYPE_FLOAT, 2);
+static st_dst_reg address_reg = st_dst_reg(PROGRAM_ADDRESS, WRITEMASK_X,
+   GLSL_TYPE_FLOAT, 0);
+static st_dst_reg address_reg2 = st_dst_reg(PROGRAM_ADDRESS, WRITEMASK_X,
+GLSL_TYPE_FLOAT, 1);
+static st_dst_reg sampler_reladdr = st_dst_reg(PROGRAM_ADDRESS, WRITEMASK_X,
+   GLSL_TYPE_FLOAT, 2);

 static void
-fail_link(struct gl_shader_program *prog, const char *fmt, ...) PRINTFLIKE(2, 
3);
+fail_link(struct gl_shader_program *prog, const char *fmt, ...)
+   PRINTFLIKE(2, 3);

 static void
 fail_link(struct gl_shader_program *prog, const char *fmt, ...)
@@ -445,7 +449,7 @@ glsl_to_tgsi_visitor::emit_asm(ir_instruction *ir, unsigned 
op,

/* Update indirect addressing status used by TGSI */
if (dst.reladdr || dst.reladdr2) {
-  switch(dst.file) {
+  switch (dst.file) {
   case PROGRAM_STATE_VAR:
   case PROGRAM_CONSTANT:
   case PROGRAM_UNIFORM:
@@ -460,8 +464,8 @@ glsl_to_tgsi_visitor::emit_asm(ir_instruction *ir, unsigned 
op,
}
else {
   for (i = 0; i < 4; i++) {
- if(inst->src[i].reladdr) {
-switch(inst->src[i].file) {
+ if (inst->src[i].reladdr) {
+switch (inst->src[i].file) {
 case PROGRAM_STATE_VAR:
 case PROGRAM_CONSTANT:
 case PROGRAM_UNIFORM:
@@ -497,8 +501,11 @@ glsl_to_tgsi_visitor::emit_asm(ir_instruction *ir, 
unsigned op,
 */
for (j = 0; j < 2; j++) {
   dst_is_64bit[j] = glsl_base_type_is_64bit(inst->dst[j].type);
-  if (!dst_is_64bit[j] && inst->dst[j].file == PROGRAM_OUTPUT && 
inst->dst[j].type == GLSL_TYPE_ARRAY) {
- enum glsl_base_type type = find_array_type(this->outputs, 
this->num_outputs, inst->dst[j].array_id);
+  if (!dst_is_64bit[j] && inst->dst[j].file == PROGRAM_OUTPUT &&
+  inst->dst[j].type == GLSL_TYPE_ARRAY) {
+ enum glsl_base_type type = find_array_type(this->outputs,
+this->num_outputs,
+inst->dst[j].array_id);
  if (glsl_base_type_is_64bit(type))
 dst_is_64bit[j] = true;
   }
@@ -510,7 +517,8 @@ glsl_to_tgsi_visitor::emit_asm(ir_instruction *ir, unsigned 
op,
   int initial_src_swz[4], initial_src_idx[4];
   int initial_dst_idx[2], initial_dst_writemask[2];
   /* select the writemask for dst0 or dst1 */
-  unsigned writemask = inst->dst[1].file == PROGRAM_UNDEFINED ? 
inst->dst[0].writemask : inst->dst[1].writemask;
+  unsigned writemask = inst->dst[1].file == PROGRAM_UNDEFINED
+ ? inst->dst[0].writemask : inst->dst[1].writemask;

   /* copy out the writemask, index and swizzles for all src/dsts. */
   for (j = 0; j < 2; j++) {
@@ -532,9 +540,10 @@ glsl_to_tgsi_visitor::emit_asm(ir_instruction *ir, 
unsigned op,

  int i = u_bit_scan();

- /* before emitting the instruction, see if we have to adjust load / 
store
-  * address */
- if (i > 1 && (inst->op == TGSI_OPCODE_LOAD || inst->op == 
TGSI_OPCODE_STORE) &&
+ /* before emitting the instruction, see if we have to adjust
+  * load / store address */
+ if (i > 1 && (inst->op == TGSI_OPCODE_LOAD ||
+   inst->op == TGSI_OPCODE_STORE) &&
  addr.file == PROGRAM_UNDEFINED) {
 /* We have to advance the buffer address by 16 */
 addr = get_temp(glsl_type::uint_type);
@@ -561,14 +570,16 @@ glsl_to_tgsi_visitor::emit_asm(ir_instruction *ir, 
unsigned op,
dinst->dst[j].writemask = (i & 1) ? WRITEMASK_ZW : WRITEMASK_XY;
dinst->dst[j].index = initial_dst_idx[j];
if (i > 1) {
-  if (dinst->op == TGSI_OPCODE_LOAD || dinst->op == 
TGSI_OPCODE_STORE)
+  if (dinst->op 

[Mesa-dev] [PATCH] glsl/linker: check same name is not used in block and outside

2018-01-30 Thread Juan A. Suarez Romero
According with OpenGL GLSL 3.20 spec, section 4.3.9:

  "It is a link-time error if any particular shader interface
   contains:
 - two different blocks, each having no instance name, and each
   having a member of the same name, or
 - a variable outside a block, and a block with no instance name,
   where the variable has the same name as a member in the block."

This fixes a previous commit 9b894c8 ("glsl/linker: link-error using the
same name in unnamed block and outside") that covered this case, but
did not take in account that precision qualifiers are ignored when
comparing blocks with no instance name.

With this commit, the original tests
KHR-GL*.shaders.uniform_block.common.name_matching keep fixed, and also
dEQP-GLES31.functional.shaders.linkage.uniform.block.differing_precision
regression is fixed, which was broken by previous commit.

Fixes: 9b894c8 ("glsl/linker: link-error using the same name in unnamed block 
and outside")
Bugzilla: https://bugs.freedesktop.org/show_bug.cgi?id=104668
Bugzilla: https://bugs.freedesktop.org/show_bug.cgi?id=104777
CC: Mark Janes 
CC: "18.0" 
Signed-off-by: Juan A. Suarez Romero 
---
 src/compiler/glsl/linker.cpp | 54 +---
 1 file changed, 31 insertions(+), 23 deletions(-)

diff --git a/src/compiler/glsl/linker.cpp b/src/compiler/glsl/linker.cpp
index ce101935b01..65b22fdba8a 100644
--- a/src/compiler/glsl/linker.cpp
+++ b/src/compiler/glsl/linker.cpp
@@ -,29 +,6 @@ cross_validate_globals(struct gl_shader_program *prog,
 return;
  }
 
- /* In OpenGL GLSL 4.20 spec, section 4.3.9, page 57:
-  *
-  *   "It is a link-time error if any particular shader interface
-  *contains:
-  *
-  *- two different blocks, each having no instance name, and each
-  *  having a member of the same name, or
-  *
-  *- a variable outside a block, and a block with no instance name,
-  *  where the variable has the same name as a member in the 
block."
-  */
- if (var->data.mode == existing->data.mode &&
- var->get_interface_type() != existing->get_interface_type()) {
-linker_error(prog, "declarations for %s `%s` are in "
- "%s and %s\n",
- mode_string(var), var->name,
- existing->get_interface_type() ?
-   existing->get_interface_type()->name : "outside a 
block",
- var->get_interface_type() ?
-   var->get_interface_type()->name : "outside a 
block");
-
-return;
- }
  /* Only in GLSL ES 3.10, the precision qualifier should not match
   * between block members defined in matched block names within a
   * shader interface.
@@ -1155,6 +1132,37 @@ cross_validate_globals(struct gl_shader_program *prog,
   mode_string(var), var->name);
 }
  }
+
+ /* In OpenGL GLSL 3.20 spec, section 4.3.9:
+  *
+  *   "It is a link-time error if any particular shader interface
+  *contains:
+  *
+  *- two different blocks, each having no instance name, and each
+  *  having a member of the same name, or
+  *
+  *- a variable outside a block, and a block with no instance name,
+  *  where the variable has the same name as a member in the 
block."
+  */
+ if (var->get_interface_type() != existing->get_interface_type()) {
+if (!var->get_interface_type() || !existing->get_interface_type()) 
{
+   linker_error(prog, "declarations for %s `%s` are inside block "
+"`%s` and outside a block",
+mode_string(var), var->name,
+var->get_interface_type()
+   ? var->get_interface_type()->name
+   : existing->get_interface_type()->name);
+   return;
+} else if (strcmp(var->get_interface_type()->name,
+  existing->get_interface_type()->name) != 0) {
+   linker_error(prog, "declarations for %s `%s` are inside blocks "
+"`%s` and `%s`",
+mode_string(var), var->name,
+existing->get_interface_type()->name,
+var->get_interface_type()->name);
+   return;
+}
+ }
   } else
  variables->add_variable(var);
}
-- 
2.14.3

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


Re: [Mesa-dev] [PATCH 00/20] Add support for GL_EXT_semaphore v3

2018-01-30 Thread Andres Rodriguez



On 2018-01-29 02:02 PM, Marek Olšák wrote:

On Tue, Jan 23, 2018 at 10:16 PM, Andres Rodriguez  wrote:

Also, the associated piglit patches:
https://lists.freedesktop.org/archives/piglit/2017-December/023600.html


You can just push the piglit patches if you get no review there.


Thanks for the review. Applied your feedback and pushed.

Andres


Marek


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


Re: [Mesa-dev] [PATCH] ac: Use old kill intrinsics for LLVM 6.

2018-01-30 Thread Bas Nieuwenhuizen
On Tue, Jan 30, 2018 at 12:32 AM, Samuel Pitoiset
 wrote:
>
>
> On 01/30/2018 12:03 AM, Bas Nieuwenhuizen wrote:
>>
>> llvm.amdgcn.kill is currently broken for SGPRs. The old intrinsic
>> had that issue too, but did not fold the preceding comparison into
>> the machine instruction in LLVM. As the preceding comparison is
>> often a float comparison, this results in a VGPR, essentially hiding
>> the issue.
>>
>> I have a fix outstanding for LLVM to make the new intrinsic work,
>> but as getting stuff reviewed, committed and cherry-picked in LLVM
>> takes quite a while, I'd like to be safe and disable the new
>> intrinsic with LLVM 6.
>>
>> We can always revert when the fix is in LLVM.
>
>
> Yes, I do agree.
>
> Reviewed-by: Samuel Pitoiset 

The LLVM fix got in and was cherry-picked suprisingly quick, so I will
drop this patch.
>
>
>>
>> Fixes: ad2b3b2a9c "ac: replace llvm.AMDGPU.kilp by llvm.amdgcn.kill with
>> LLVM 6"
>> ---
>>
>> The LLVM fix is available at https://reviews.llvm.org/D42302
>>
>>   src/amd/common/ac_llvm_build.c | 2 +-
>>   1 file changed, 1 insertion(+), 1 deletion(-)
>>
>> diff --git a/src/amd/common/ac_llvm_build.c
>> b/src/amd/common/ac_llvm_build.c
>> index 5e08508fed..a34eda1037 100644
>> --- a/src/amd/common/ac_llvm_build.c
>> +++ b/src/amd/common/ac_llvm_build.c
>> @@ -1479,7 +1479,7 @@ LLVMValueRef ac_build_wqm_vote(struct
>> ac_llvm_context *ctx, LLVMValueRef i1)
>> void ac_build_kill_if_false(struct ac_llvm_context *ctx, LLVMValueRef
>> i1)
>>   {
>> -   if (HAVE_LLVM >= 0x0600) {
>> +   if (HAVE_LLVM >= 0x0700) {
>> ac_build_intrinsic(ctx, "llvm.amdgcn.kill", ctx->voidt,
>>, 1, 0);
>> return;
>>
>
___
mesa-dev mailing list
mesa-dev@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/mesa-dev


Re: [Mesa-dev] [PATCH 11/11] vbo: overhaul display list vertex array setup/binding code

2018-01-30 Thread Mathias Fröhlich
Hi Brian,

> Ah right.  At one point I thought about dlist sharing, but I forgot to 
> address that in the end.
> 
> I think one way to address that would be to put a mutex in the 
> vbo_save_vertex_list so it can only be accessed by one context at a 
> time.  Plus, check if the calling context matches to compile-time 
> context - if they don't match, update the 'current values'.

Hmm, that might work, but putting a mutex there is not so great IMO.

> I'll think about it more though.
Wait a minute ...
.. or two.

> > Beside that I am also not sure if the array update logic in 
bind_vertex_list
> > works correctly when VBO_ATTRIB* arrays ending in an aliasing VERT_ATTRIB*
> > slot are both enabled. You probably need to currectly mask out the 
VBO_ATTRIB
> > arrays before you distribute them across the inputs[] array. But the the 
logic
> > just to store subsequent node->arrays entries to save memory fails when
> > skipping the masked out arrays.
> 
> Can you provide a concrete example of what you mean?
I did not look too close as the dlist threading issue is already a show 
stopper for me.

But if you ask I have to look close:
Well what I initially thought should actually not be an issue. The loop 
walking the successive arrays actually walks all vbo enabled bits before some 
of them get disabled.

Put the context sharing issue asside for this question, but let me ask, were 
does the code set back the current array pointers in the inputs array?
Example:
Enabled has arrays are VBO_ATTRIB_POS, VBO_ATTRIB_GENERIC1 and  
VBO_ATTRIB_MAT_FRONT_DIFFUSE.
Then issue a fixed function draw call on this dlist. That one shall evaluate 
VBO_ATTRIB_{POS,MAT_FRONT_DIFFUSE}.
Then issue a shader that should set the inputs VBO_ATTRIB_{POS,GENERIC1}.
But since .._GENERIC1 and _MAT_FRONT_DIFFUSE  do not end in the same 
VERT_ATTRIB location the corresponding current array pointers should be 
restored then, right?

Anyhow, wait a minute - did I already mention?

> Thanks for reviewing!
You are welcome!

best

Mathias



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


Re: [Mesa-dev] [PATCH 4/6] meson: osx doesn't have librt, so don't require it

2018-01-30 Thread Dylan Baker
Quoting Emil Velikov (2018-01-30 10:56:42)
> Hi Jon,
> 
> On 28 January 2018 at 14:24, Jon Turney  wrote:
> > ---
> >  meson.build | 2 +-
> >  1 file changed, 1 insertion(+), 1 deletion(-)
> >
> > diff --git a/meson.build b/meson.build
> > index 7e194a9f10d..8fdbaa8b8d8 100644
> > --- a/meson.build
> > +++ b/meson.build
> > @@ -935,7 +935,7 @@ elif with_dri_i965 and get_option('shader-cache')
> >  endif
> >
> >  # Determine whether or not the rt library is needed for time functions
> > -if cc.has_function('clock_gettime')
> > +if cc.has_function('clock_gettime') or (host_machine.system() == 'darwin')
> 
> Absolutely no objections against the patch - just a small question.
> If the meson/autotools check fails, does this mean that the resulting
> binaries are having unresolved reference wrt said symbol?
> 
> Thanks
> Emil

Not for meson, it builds -Wl,--no-undefined (or it's MSVC equivalent) by
default, so it shouldn't be possible to get unresolved symbols in a binary or
shared library.

I'm pretty sure that the autotools build sets --no-undefined too, right?

Dylan


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


Re: [Mesa-dev] [GSOC] DriConf Replacement

2018-01-30 Thread Jean Hertel
Hi Axel,
  

>Hi all,
>
>Don't hesitate to recycle parts of my old try at DriConf Replacement:
>
>https://github.com/axeldavy/driCenter
>
>It had automatic detection of prime system and of the device_id.
>It detected also on which card apps run, and running apps.

Thanks for pointing this out.
Right now I'm enumerating the devices using libDrm, but it's good to know that 
there are more ways to achieve the same results.

Regards,
Jean

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


[Mesa-dev] [Bug 104837] 'radeonsi: Failed to create context' with 32 bit applications

2018-01-30 Thread bugzilla-daemon
https://bugs.freedesktop.org/show_bug.cgi?id=104837

Michel Dänzer  changed:

   What|Removed |Added

 Status|NEW |RESOLVED
 Resolution|--- |FIXED

--- Comment #8 from Michel Dänzer  ---
Resolving per comment 7, thanks for the followup, glad it's working now.

-- 
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
https://lists.freedesktop.org/mailman/listinfo/mesa-dev


Re: [Mesa-dev] [PATCH mesa 1/2] meson: centralise the libdrm versions information

2018-01-30 Thread Dylan Baker
Quoting Emil Velikov (2018-01-30 10:43:06)
> On 29 January 2018 at 18:57, Dylan Baker  wrote:
> > Quoting Eric Engestrom (2018-01-29 10:15:50)
> >> The big comment is taken from the equivalent block in configure.ac
> >>
> >> Signed-off-by: Eric Engestrom 
> >> ---
> >>  meson.build | 30 
> >> +
> >>  src/gallium/targets/d3dadapter9/meson.build |  2 +-
> >>  src/mesa/drivers/dri/meson.build|  2 +-
> >>  3 files changed, 24 insertions(+), 10 deletions(-)
> >>
> >> diff --git a/meson.build b/meson.build
> >> index 0a00798c2a5093ec803b..6d7a8e976ff6ad002d9a 100644
> >> --- a/meson.build
> >> +++ b/meson.build
> >> @@ -41,6 +41,20 @@ pre_args = [
> >>
> >> '-DPACKAGE_BUGREPORT="https://bugs.freedesktop.org/enter_bug.cgi?product=Mesa;',
> >>  ]
> >>
> >> +# The idea is that libdrm is distributed as one cohesive package, even
> >> +# though it is composed of multiple libraries. However some drivers
> >> +# may have different version requirements than others. This list
> >> +# codifies which drivers need which version of libdrm. Any libdrm
> >> +# version dependencies in non-driver-specific code should be reflected
> >> +# in the first entry.
> >> +libdrm_version   = '2.4.75'
> >> +libdrm_amdgpu_version= '2.4.89'
> >> +libdrm_etnaviv_version   = '2.4.82'
> >> +libdrm_freedreno_version = '2.4.82'
> >> +libdrm_intel_version = '2.4.75'
> >> +libdrm_nouveau_version   = '2.4.66'
> >> +libdrm_radeon_version= '2.4.71'
> >
> > Is there any reason we can't just make these (for example):
> > libdrm_radeon_version= '>= 2.4.71'
> >
> > Since that avoids all of the format calls?
> >
> Is there particular reason why meson doesn't allow plain
> concatenation, and one must go through the format dance?
> Off the top of my head, I think that most higher level programming
> languages (including python) have it, making for clearer and more
> obvious code.
> 
> That aside:
> A huge +1 from me on the idea, although the libdrm_foo checks should
> become libdrm && libdrm_foo.
> See commit 2b4eaabff01a3a8ea0c4742ac481492092c1ab4f.
> 
> Thanks
> Emil

I'm confused by that commit. pkg-config is supposed to handle this, libdrm_intel
(for example) has `Requires : libdrm` in it, so when you generate libs you get
`-ldrm_intel -ldrm`. Why do we need to check libdrm as well? If it's just that
we need to make sure that the version matches we should fix the pkg-config files
in libdrm to set `Requires : libdrm >= version`. Or am I missing something?

Dylan


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


[Mesa-dev] [PATCH] mesa: fix glGet MAX_VERTEX_ATTRIB queries

2018-01-30 Thread Marek Olšák
From: Marek Olšák 

Broken by f96a69f916aed40519e755d0460a83940a587
---
 src/mesa/main/get_hash_params.py | 6 +++---
 1 file changed, 3 insertions(+), 3 deletions(-)

diff --git a/src/mesa/main/get_hash_params.py b/src/mesa/main/get_hash_params.py
index 7cd195c..55d29e9 100644
--- a/src/mesa/main/get_hash_params.py
+++ b/src/mesa/main/get_hash_params.py
@@ -514,25 +514,25 @@ descriptor=[
 # GL_ARB_framebuffer_no_attachments / geometry shader
   [ "MAX_FRAMEBUFFER_LAYERS", "CONTEXT_INT(Const.MaxFramebufferLayers), 
extra_ARB_framebuffer_no_attachments_and_geometry_shader" ],
 
 # GL_ARB_explicit_uniform_location / GLES 3.1
   [ "MAX_UNIFORM_LOCATIONS", 
"CONTEXT_INT(Const.MaxUserAssignableUniformLocations), 
extra_ARB_explicit_uniform_location" ],
 
 # GL_ARB_separate_shader_objects / GLES 3.1
   [ "PROGRAM_PIPELINE_BINDING", "LOC_CUSTOM, TYPE_INT, 
GL_PROGRAM_PIPELINE_BINDING, NO_EXTRA" ],
 
 # GL_ARB_vertex_attrib_binding / GLES 3.1
-  [ "MAX_VERTEX_ATTRIB_RELATIVE_OFFSET", 
"CONTEXT_ENUM16(Const.MaxVertexAttribRelativeOffset), NO_EXTRA" ],
-  [ "MAX_VERTEX_ATTRIB_BINDINGS", 
"CONTEXT_ENUM16(Const.MaxVertexAttribBindings), NO_EXTRA" ],
+  [ "MAX_VERTEX_ATTRIB_RELATIVE_OFFSET", 
"CONTEXT_INT(Const.MaxVertexAttribRelativeOffset), NO_EXTRA" ],
+  [ "MAX_VERTEX_ATTRIB_BINDINGS", "CONTEXT_INT(Const.MaxVertexAttribBindings), 
NO_EXTRA" ],
 
 # GL 4.4 / GLES 3.1
-  [ "MAX_VERTEX_ATTRIB_STRIDE", "CONTEXT_ENUM16(Const.MaxVertexAttribStride), 
NO_EXTRA" ],
+  [ "MAX_VERTEX_ATTRIB_STRIDE", "CONTEXT_UINT(Const.MaxVertexAttribStride), 
NO_EXTRA" ],
 
   # GL_ARB_shader_storage_buffer_object / GLES 3.1
   [ "MAX_VERTEX_SHADER_STORAGE_BLOCKS", 
"CONTEXT_INT(Const.Program[MESA_SHADER_VERTEX].MaxShaderStorageBlocks), 
extra_ARB_shader_storage_buffer_object_es31" ],
   [ "MAX_FRAGMENT_SHADER_STORAGE_BLOCKS", 
"CONTEXT_INT(Const.Program[MESA_SHADER_FRAGMENT].MaxShaderStorageBlocks), 
extra_ARB_shader_storage_buffer_object_es31" ],
   [ "MAX_COMPUTE_SHADER_STORAGE_BLOCKS", 
"CONTEXT_INT(Const.Program[MESA_SHADER_COMPUTE].MaxShaderStorageBlocks), 
extra_ARB_shader_storage_buffer_object_es31" ],
   [ "MAX_COMBINED_SHADER_STORAGE_BLOCKS", 
"CONTEXT_INT(Const.MaxCombinedShaderStorageBlocks), 
extra_ARB_shader_storage_buffer_object_es31" ],
   [ "MAX_SHADER_STORAGE_BLOCK_SIZE", 
"CONTEXT_INT(Const.MaxShaderStorageBlockSize), 
extra_ARB_shader_storage_buffer_object_es31" ],
   [ "MAX_SHADER_STORAGE_BUFFER_BINDINGS", 
"CONTEXT_INT(Const.MaxShaderStorageBufferBindings), 
extra_ARB_shader_storage_buffer_object_es31" ],
   [ "SHADER_STORAGE_BUFFER_OFFSET_ALIGNMENT", 
"CONTEXT_INT(Const.ShaderStorageBufferOffsetAlignment), 
extra_ARB_shader_storage_buffer_object_es31" ],
   [ "SHADER_STORAGE_BUFFER_BINDING", "LOC_CUSTOM, TYPE_INT, 0, 
extra_ARB_shader_storage_buffer_object_es31" ],
-- 
2.7.4

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


[Mesa-dev] [PATCH 4/5] ac/nir: use ac_build_buffer_load_format for image buffer loads

2018-01-30 Thread Marek Olšák
From: Marek Olšák 

Please test RADV.
---
 src/amd/common/ac_nir_to_llvm.c | 21 +
 1 file changed, 13 insertions(+), 8 deletions(-)

diff --git a/src/amd/common/ac_nir_to_llvm.c b/src/amd/common/ac_nir_to_llvm.c
index 0ab16c4..428764b 100644
--- a/src/amd/common/ac_nir_to_llvm.c
+++ b/src/amd/common/ac_nir_to_llvm.c
@@ -3596,28 +3596,33 @@ static LLVMValueRef visit_image_load(struct 
ac_nir_context *ctx,
const nir_variable *var = instr->variables[0]->var;
const struct glsl_type *type = var->type;
 
if(instr->variables[0]->deref.child)
type = instr->variables[0]->deref.child->type;
 
type = glsl_without_array(type);
 
const enum glsl_sampler_dim dim = glsl_get_sampler_dim(type);
if (dim == GLSL_SAMPLER_DIM_BUF) {
-   params[0] = get_sampler_desc(ctx, instr->variables[0], 
AC_DESC_BUFFER, NULL, true, false);
-   params[1] = LLVMBuildExtractElement(ctx->ac.builder, 
get_src(ctx, instr->src[0]),
-   ctx->ac.i32_0, ""); /* 
vindex */
-   params[2] = ctx->ac.i32_0; /* voffset */
-   params[3] = ctx->ac.i1false;  /* glc */
-   params[4] = ctx->ac.i1false;  /* slc */
-   res = ac_build_intrinsic(>ac, 
"llvm.amdgcn.buffer.load.format.v4f32", ctx->ac.v4f32,
-params, 5, 0);
+   unsigned mask = nir_ssa_def_components_read(>dest.ssa);
+   unsigned num_channels = util_last_bit(mask);
+   LLVMValueRef rsrc, vindex;
+
+   rsrc = get_sampler_desc(ctx, instr->variables[0], 
AC_DESC_BUFFER, NULL, true, false);
+   vindex = LLVMBuildExtractElement(ctx->ac.builder, get_src(ctx, 
instr->src[0]),
+ctx->ac.i32_0, "");
+
+   /* TODO: set "glc" and "can_speculate" when OpenGL needs it. */
+   res = ac_build_buffer_load_format(>ac, rsrc, vindex,
+ ctx->ac.i32_0, num_channels,
+ false, false);
+   res = ac_build_expand_to_vec4(>ac, res, num_channels);
 
res = trim_vector(>ac, res, 
instr->dest.ssa.num_components);
res = ac_to_integer(>ac, res);
} else {
bool is_da = glsl_sampler_type_is_array(type) ||
 dim == GLSL_SAMPLER_DIM_CUBE ||
 dim == GLSL_SAMPLER_DIM_3D ||
 dim == GLSL_SAMPLER_DIM_SUBPASS ||
 dim == GLSL_SAMPLER_DIM_SUBPASS_MS;
LLVMValueRef da = is_da ? ctx->ac.i1true : ctx->ac.i1false;
-- 
2.7.4

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


[Mesa-dev] [PATCH 3/5] ac: add glc parameter to ac_build_buffer_load_format

2018-01-30 Thread Marek Olšák
From: Marek Olšák 

---
 src/amd/common/ac_llvm_build.c| 3 ++-
 src/amd/common/ac_llvm_build.h| 1 +
 src/amd/common/ac_nir_to_llvm.c   | 4 ++--
 src/gallium/drivers/radeonsi/si_shader.c  | 2 +-
 src/gallium/drivers/radeonsi/si_shader_tgsi_mem.c | 2 +-
 5 files changed, 7 insertions(+), 5 deletions(-)

diff --git a/src/amd/common/ac_llvm_build.c b/src/amd/common/ac_llvm_build.c
index a5cb72d..762351f 100644
--- a/src/amd/common/ac_llvm_build.c
+++ b/src/amd/common/ac_llvm_build.c
@@ -1042,24 +1042,25 @@ ac_build_buffer_load(struct ac_llvm_context *ctx,
return ac_build_buffer_load_common(ctx, rsrc, vindex, offset,
   num_channels, glc, slc,
   can_speculate, false);
 }
 
 LLVMValueRef ac_build_buffer_load_format(struct ac_llvm_context *ctx,
 LLVMValueRef rsrc,
 LLVMValueRef vindex,
 LLVMValueRef voffset,
 unsigned num_channels,
+bool glc,
 bool can_speculate)
 {
return ac_build_buffer_load_common(ctx, rsrc, vindex, voffset,
-  num_channels, false, false,
+  num_channels, glc, false,
   can_speculate, true);
 }
 
 /**
  * Set range metadata on an instruction.  This can only be used on load and
  * call instructions.  If you know an instruction can only produce the values
  * 0, 1, 2, you would do set_range_metadata(value, 0, 3);
  * \p lo is the minimum value inclusive.
  * \p hi is the maximum value exclusive.
  */
diff --git a/src/amd/common/ac_llvm_build.h b/src/amd/common/ac_llvm_build.h
index 3ae9678..f95ad6a 100644
--- a/src/amd/common/ac_llvm_build.h
+++ b/src/amd/common/ac_llvm_build.h
@@ -212,20 +212,21 @@ ac_build_buffer_load(struct ac_llvm_context *ctx,
 unsigned glc,
 unsigned slc,
 bool can_speculate,
 bool allow_smem);
 
 LLVMValueRef ac_build_buffer_load_format(struct ac_llvm_context *ctx,
 LLVMValueRef rsrc,
 LLVMValueRef vindex,
 LLVMValueRef voffset,
 unsigned num_channels,
+bool glc,
 bool can_speculate);
 
 LLVMValueRef
 ac_get_thread_id(struct ac_llvm_context *ctx);
 
 #define AC_TID_MASK_TOP_LEFT 0xfffc
 #define AC_TID_MASK_TOP  0xfffd
 #define AC_TID_MASK_LEFT 0xfffe
 
 LLVMValueRef
diff --git a/src/amd/common/ac_nir_to_llvm.c b/src/amd/common/ac_nir_to_llvm.c
index b3336ff..0ab16c4 100644
--- a/src/amd/common/ac_nir_to_llvm.c
+++ b/src/amd/common/ac_nir_to_llvm.c
@@ -2283,21 +2283,21 @@ static LLVMValueRef build_tex_intrinsic(struct 
ac_nir_context *ctx,
struct ac_image_args *args)
 {
if (instr->sampler_dim == GLSL_SAMPLER_DIM_BUF) {
unsigned mask = nir_ssa_def_components_read(>dest.ssa);
 
return ac_build_buffer_load_format(>ac,
   args->resource,
   args->addr,
   ctx->ac.i32_0,
   util_last_bit(mask),
-  true);
+  false, true);
}
 
args->opcode = ac_image_sample;
args->compare = instr->is_shadow;
 
switch (instr->op) {
case nir_texop_txf:
case nir_texop_txf_ms:
case nir_texop_samples_identical:
args->opcode = lod_is_zero ||
@@ -5341,21 +5341,21 @@ handle_vs_input_decl(struct nir_to_llvm_context *ctx,
} else
buffer_index = LLVMBuildAdd(ctx->builder, 
ctx->abi.vertex_id,
ctx->abi.base_vertex, "");
t_offset = LLVMConstInt(ctx->ac.i32, index + i, false);
 
t_list = ac_build_load_to_sgpr(>ac, t_list_ptr, t_offset);
 
input = ac_build_buffer_load_format(>ac, t_list,
buffer_index,
ctx->ac.i32_0,
-   4, true);
+   4, false, true);
 
for (unsigned chan = 0; chan < 4; chan++) {
LLVMValueRef llvm_chan = 

[Mesa-dev] [PATCH 5/5] radeonsi: use ac_build_buffer_load_format for image buffer loads

2018-01-30 Thread Marek Olšák
From: Marek Olšák 

---
 src/gallium/drivers/radeonsi/si_shader_tgsi_mem.c | 14 ++
 1 file changed, 10 insertions(+), 4 deletions(-)

diff --git a/src/gallium/drivers/radeonsi/si_shader_tgsi_mem.c 
b/src/gallium/drivers/radeonsi/si_shader_tgsi_mem.c
index c958da6..b5fad34 100644
--- a/src/gallium/drivers/radeonsi/si_shader_tgsi_mem.c
+++ b/src/gallium/drivers/radeonsi/si_shader_tgsi_mem.c
@@ -559,25 +559,31 @@ static void load_emit(
info->shader_buffers_atomic,
info->images_store |
info->images_atomic);
 
if (inst->Src[0].Register.File == TGSI_FILE_BUFFER) {
load_emit_buffer(ctx, emit_data, can_speculate, false);
return;
}
 
if (inst->Memory.Texture == TGSI_TEXTURE_BUFFER) {
+   unsigned num_channels = 
util_last_bit(inst->Dst[0].Register.WriteMask);
+   LLVMValueRef result =
+   ac_build_buffer_load_format(>ac,
+   emit_data->args[0],
+   emit_data->args[1],
+   emit_data->args[2],
+   num_channels,
+   
LLVMConstIntGetZExtValue(emit_data->args[3]),
+   can_speculate);
emit_data->output[emit_data->chan] =
-   lp_build_intrinsic(
-   builder, 
"llvm.amdgcn.buffer.load.format.v4f32", emit_data->dst_type,
-   emit_data->args, emit_data->arg_count,
-   ac_get_load_intr_attribs(can_speculate));
+   ac_build_expand_to_vec4(>ac, result, num_channels);
} else {
ac_get_image_intr_name("llvm.amdgcn.image.load",
   emit_data->dst_type, /* 
vdata */
   LLVMTypeOf(emit_data->args[0]), /* 
coords */
   LLVMTypeOf(emit_data->args[1]), /* rsrc 
*/
   intrinsic_name, sizeof(intrinsic_name));
 
emit_data->output[emit_data->chan] =
lp_build_intrinsic(
builder, intrinsic_name, emit_data->dst_type,
-- 
2.7.4

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


[Mesa-dev] [PATCH 1/5] radeonsi: remove unused si_shader_context members

2018-01-30 Thread Marek Olšák
From: Marek Olšák 

---
 src/gallium/drivers/radeonsi/si_shader_internal.h   | 4 
 src/gallium/drivers/radeonsi/si_shader_tgsi_setup.c | 7 ---
 2 files changed, 11 deletions(-)

diff --git a/src/gallium/drivers/radeonsi/si_shader_internal.h 
b/src/gallium/drivers/radeonsi/si_shader_internal.h
index 3084d88..1fc42df 100644
--- a/src/gallium/drivers/radeonsi/si_shader_internal.h
+++ b/src/gallium/drivers/radeonsi/si_shader_internal.h
@@ -184,24 +184,20 @@ struct si_shader_context {
int param_gs_vtx23_offset; /* in dwords (GFX9) */
int param_gs_vtx45_offset; /* in dwords (GFX9) */
/* CS */
int param_grid_size;
int param_block_size;
int param_block_id[3];
int param_thread_id;
 
LLVMTargetMachineRef tm;
 
-   unsigned range_md_kind;
-   unsigned fpmath_md_kind;
-   LLVMValueRef fpmath_md_2p5_ulp;
-
/* Preloaded descriptors. */
LLVMValueRef esgs_ring;
LLVMValueRef gsvs_ring[4];
 
LLVMValueRef invoc0_tess_factors[6]; /* outer[4], inner[2] */
LLVMValueRef gs_next_vertex[4];
LLVMValueRef postponed_kill;
LLVMValueRef return_value;
 
LLVMTypeRef voidt;
diff --git a/src/gallium/drivers/radeonsi/si_shader_tgsi_setup.c 
b/src/gallium/drivers/radeonsi/si_shader_tgsi_setup.c
index fc141ca..f70e2bd 100644
--- a/src/gallium/drivers/radeonsi/si_shader_tgsi_setup.c
+++ b/src/gallium/drivers/radeonsi/si_shader_tgsi_setup.c
@@ -1187,27 +1187,20 @@ void si_llvm_context_init(struct si_shader_context *ctx,
type.width *= 2;
lp_build_context_init(>bld_base.dbl_bld, >gallivm, type);
lp_build_context_init(>bld_base.uint64_bld, >gallivm, 
lp_uint_type(type));
lp_build_context_init(>bld_base.int64_bld, >gallivm, 
lp_int_type(type));
 
bld_base->soa = 1;
bld_base->emit_swizzle = emit_swizzle;
bld_base->emit_declaration = emit_declaration;
bld_base->emit_immediate = emit_immediate;
 
-   /* metadata allowing 2.5 ULP */
-   ctx->fpmath_md_kind = LLVMGetMDKindIDInContext(ctx->ac.context,
-  "fpmath", 6);
-   LLVMValueRef arg = LLVMConstReal(ctx->ac.f32, 2.5);
-   ctx->fpmath_md_2p5_ulp = LLVMMDNodeInContext(ctx->ac.context,
-, 1);
-
bld_base->op_actions[TGSI_OPCODE_BGNLOOP].emit = bgnloop_emit;
bld_base->op_actions[TGSI_OPCODE_BRK].emit = brk_emit;
bld_base->op_actions[TGSI_OPCODE_CONT].emit = cont_emit;
bld_base->op_actions[TGSI_OPCODE_IF].emit = if_emit;
bld_base->op_actions[TGSI_OPCODE_UIF].emit = uif_emit;
bld_base->op_actions[TGSI_OPCODE_ELSE].emit = else_emit;
bld_base->op_actions[TGSI_OPCODE_ENDIF].emit = endif_emit;
bld_base->op_actions[TGSI_OPCODE_ENDLOOP].emit = endloop_emit;
 
si_shader_context_init_alu(>bld_base);
-- 
2.7.4

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


[Mesa-dev] [PATCH 4/4] radv: repack some structures post pipeline rework.

2018-01-30 Thread Dave Airlie
From: Dave Airlie 

Bas's pipeline rework made me relook at the struct packing:

radv_cmd_state: 984->968
radv_cmd_buffer: 2910->2896
radv_image: 1008->1000
radv_pipeline: 1640->1632

Signed-off-by: Dave Airlie 
---
 src/amd/vulkan/radv_private.h | 25 ++---
 1 file changed, 14 insertions(+), 11 deletions(-)

diff --git a/src/amd/vulkan/radv_private.h b/src/amd/vulkan/radv_private.h
index e856f5f9b07..46a2e02612e 100644
--- a/src/amd/vulkan/radv_private.h
+++ b/src/amd/vulkan/radv_private.h
@@ -886,12 +886,14 @@ struct radv_attachment_state {
 
 struct radv_cmd_state {
/* Vertex descriptors */
+   enum radv_cmd_flush_bits  flush_bits;
bool  vb_prefetch_dirty;
+   bool  push_descriptors_dirty;
+   bool predicating;
+
uint64_t  vb_va;
unsigned  vb_size;
 
-   bool  push_descriptors_dirty;
-   bool predicating;
uint32_t  dirty;
 
struct radv_pipeline *pipeline;
@@ -915,7 +917,6 @@ struct radv_cmd_state {
 
int32_t  last_primitive_reset_en;
uint32_t last_primitive_reset_index;
-   enum radv_cmd_flush_bits flush_bits;
unsigned active_occlusion_queries;
floatoffset_scale;
uint32_t  descriptors_dirty;
@@ -962,14 +963,16 @@ struct radv_cmd_buffer {
VkCommandBufferUsageFlagsusage_flags;
VkCommandBufferLevel level;
enum radv_cmd_buffer_status status;
+   uint32_t queue_family_index;
+   VkShaderStageFlags push_constant_stages;
+   VkResult record_result;
+
struct radeon_winsys_cs *cs;
struct radv_cmd_state state;
struct radv_vertex_binding   vertex_bindings[MAX_VBS];
-   uint32_t queue_family_index;
 
uint8_t push_constants[MAX_PUSH_CONSTANTS_SIZE];
uint32_t dynamic_buffers[4 * MAX_DYNAMIC_BUFFERS];
-   VkShaderStageFlags push_constant_stages;
struct radv_push_descriptor_set push_descriptors;
struct radv_descriptor_set meta_push_descriptors;
struct radv_descriptor_set *descriptors[MAX_SETS];
@@ -983,12 +986,11 @@ struct radv_cmd_buffer {
bool tess_rings_needed;
bool sample_positions_needed;
 
-   VkResult record_result;
 
int ring_offsets_idx; /* just used for verification */
uint32_t gfx9_fence_offset;
-   struct radeon_winsys_bo *gfx9_fence_bo;
uint32_t gfx9_fence_idx;
+   struct radeon_winsys_bo *gfx9_fence_bo;
 };
 
 struct radv_image;
@@ -1171,11 +1173,11 @@ struct radv_pipeline {
 
struct radv_pipeline_layout * layout;
 
+   VkShaderStageFlags   active_stages;
bool needs_data_cache;
bool 
need_indirect_descriptor_sets;
struct radv_shader_variant * 
shaders[MESA_SHADER_STAGES];
struct radv_shader_variant *gs_copy_shader;
-   VkShaderStageFlags   active_stages;
 
struct radeon_winsys_cs  cs;
 
@@ -1189,13 +1191,13 @@ struct radv_pipeline {
struct radv_multisample_state ms;
uint32_t spi_baryc_cntl;
bool prim_restart_enable;
+   bool can_use_guardband;
+   uint8_t vtx_emit_num;
unsigned esgs_ring_size;
unsigned gsvs_ring_size;
uint32_t vtx_base_sgpr;
struct radv_ia_multi_vgt_param_helpers 
ia_multi_vgt_param;
-   uint8_t vtx_emit_num;
struct radv_prim_vertex_count prim_vertex_count;
-   bool can_use_guardband;
uint32_t needed_dynamic_state;
} graphics;
};
@@ -1301,13 +1303,14 @@ struct radv_image {
unsigned queue_family_mask;
bool exclusive;
bool shareable;
+   bool tc_compatible_htile;
 
/* Set when bound */
struct radeon_winsys_bo *bo;
VkDeviceSize offset;
uint64_t dcc_offset;
uint64_t htile_offset;
-   bool tc_compatible_htile;
+
struct radeon_surf surface;
 
struct radv_fmask_info fmask;
-- 
2.14.3

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

[Mesa-dev] [PATCH 3/4] radv: reduce vk_format_descriptions memory usage.

2018-01-30 Thread Dave Airlie
From: Dave Airlie 

This repacks to reduce the usage from 72->64 bytes, but also
makes the descriptions static const so they don't just stay in
the same unit.

Signed-off-by: Dave Airlie 
---
 src/amd/vulkan/vk_format.h| 3 ++-
 src/amd/vulkan/vk_format_table.py | 4 ++--
 2 files changed, 4 insertions(+), 3 deletions(-)

diff --git a/src/amd/vulkan/vk_format.h b/src/amd/vulkan/vk_format.h
index 43265ed3d97..7e2c1e8ae3f 100644
--- a/src/amd/vulkan/vk_format.h
+++ b/src/amd/vulkan/vk_format.h
@@ -117,11 +117,12 @@ struct vk_format_channel_description {
 struct vk_format_description
 {
VkFormat format;
+   enum vk_format_layout layout;
+
const char *name;
const char *short_name;
 
struct vk_format_block block;
-   enum vk_format_layout layout;
 
unsigned nr_channels:3;
unsigned is_array:1;
diff --git a/src/amd/vulkan/vk_format_table.py 
b/src/amd/vulkan/vk_format_table.py
index 36352b108d0..df08ab17970 100644
--- a/src/amd/vulkan/vk_format_table.py
+++ b/src/amd/vulkan/vk_format_table.py
@@ -125,13 +125,13 @@ def write_format_table(formats):
 print "   },"
 
 for format in formats:
-print 'const struct vk_format_description'
+print 'static const struct vk_format_description'
 print 'vk_format_%s_description = {' % (format.short_name(),)
 print "   %s," % (format.name,)
+print "   %s," % (layout_map(format.layout),)
 print "   \"%s\"," % (format.name,)
 print "   \"%s\"," % (format.short_name(),)
 print "   {%u, %u, %u},\t/* block */" % (format.block_width, 
format.block_height, format.block_size())
-print "   %s," % (layout_map(format.layout),)
 print "   %u,\t/* nr_channels */" % (format.nr_channels(),)
 print "   %s,\t/* is_array */" % (bool_map(format.is_array()),)
 print "   %s,\t/* is_bitmask */" % (bool_map(format.is_bitmask()),)
-- 
2.14.3

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


[Mesa-dev] [PATCH 2/4] ac/shader: repack ac_shader_info

2018-01-30 Thread Dave Airlie
From: Dave Airlie 

This reduces the size from 28->24 bytes.

Signed-off-by: Dave Airlie 
---
 src/amd/common/ac_shader_info.h | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/src/amd/common/ac_shader_info.h b/src/amd/common/ac_shader_info.h
index 59b749576aa..7283433bfce 100644
--- a/src/amd/common/ac_shader_info.h
+++ b/src/amd/common/ac_shader_info.h
@@ -28,8 +28,8 @@ struct nir_shader;
 struct ac_nir_compiler_options;
 
 struct ac_shader_info {
-   bool loads_push_constants;
uint32_t desc_set_used_mask;
+   bool loads_push_constants;
bool needs_multiview_view_index;
bool uses_invocation_id;
bool uses_prim_id;
-- 
2.14.3

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


[Mesa-dev] [PATCH 1/4] shader_info: repack to avoid holes.

2018-01-30 Thread Dave Airlie
From: Dave Airlie 

This makes this got from 136->128 bytes.

Signed-off-by: Dave Airlie 
---
 src/compiler/shader_info.h | 18 +-
 1 file changed, 9 insertions(+), 9 deletions(-)

diff --git a/src/compiler/shader_info.h b/src/compiler/shader_info.h
index f6dedb8d624..2edf8220bdd 100644
--- a/src/compiler/shader_info.h
+++ b/src/compiler/shader_info.h
@@ -84,9 +84,6 @@ typedef struct shader_info {
/* Whether or not this shader ever uses textureGather() */
bool uses_texture_gather;
 
-   /** Bitfield of which textures are used by texelFetch() */
-   uint32_t textures_used_by_txf;
-
/**
 * True if this shader uses the fddx/fddy opcodes.
 *
@@ -94,18 +91,21 @@ typedef struct shader_info {
 */
bool uses_fddx_fddy;
 
+  /* Whether or not separate shader objects were used */
+   bool separate_shader;
+
+   /** Was this shader linked with any transform feedback varyings? */
+   bool has_transform_feedback_varyings;
+
+   /** Bitfield of which textures are used by texelFetch() */
+   uint32_t textures_used_by_txf;
+
/* The size of the gl_ClipDistance[] array, if declared. */
unsigned clip_distance_array_size;
 
/* The size of the gl_CullDistance[] array, if declared. */
unsigned cull_distance_array_size;
 
-   /* Whether or not separate shader objects were used */
-   bool separate_shader;
-
-   /** Was this shader linked with any transform feedback varyings? */
-   bool has_transform_feedback_varyings;
-
union {
   struct {
  /* Which inputs are doubles */
-- 
2.14.3

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


Re: [Mesa-dev] [PATCH v2 14/24] intel/blorp: Add a CCS ambiguation pass

2018-01-30 Thread Nanley Chery
On Fri, Jan 19, 2018 at 05:25:41PM -0800, Jason Ekstrand wrote:
> On Fri, Jan 19, 2018 at 3:47 PM, Jason Ekstrand 
> wrote:
> 
> > This pass performs an "ambiguate" operation on a CCS-compressed surface
> > by manually writing zeros into the CCS.  On gen8+, ISL gives us a fairly
> > detailed notion of how the CCS is laid out so this is fairly simple to
> > do.  On gen7, the CCS tiling is quite crazy but that isn't an issue
> > because we can only do CCS on single-slice images so we can just blast
> > over the entire CCS buffer if we want to.
> > ---
> >  src/intel/blorp/blorp.h   |   5 ++
> >  src/intel/blorp/blorp_clear.c | 149 ++
> > 
> >  2 files changed, 154 insertions(+)
> >
> > diff --git a/src/intel/blorp/blorp.h b/src/intel/blorp/blorp.h
> > index a1dd571..478a9af 100644
> > --- a/src/intel/blorp/blorp.h
> > +++ b/src/intel/blorp/blorp.h
> > @@ -204,6 +204,11 @@ blorp_ccs_resolve(struct blorp_batch *batch,
> >enum blorp_fast_clear_op resolve_op);
> >
> >  void
> > +blorp_ccs_ambiguate(struct blorp_batch *batch,
> > +struct blorp_surf *surf,
> > +uint32_t level, uint32_t layer);
> > +
> > +void
> >  blorp_mcs_partial_resolve(struct blorp_batch *batch,
> >struct blorp_surf *surf,
> >enum isl_format format,
> > diff --git a/src/intel/blorp/blorp_clear.c b/src/intel/blorp/blorp_clear.c
> > index 8e7bc9f..fa2abd9 100644
> > --- a/src/intel/blorp/blorp_clear.c
> > +++ b/src/intel/blorp/blorp_clear.c
> > @@ -881,3 +881,152 @@ blorp_mcs_partial_resolve(struct blorp_batch *batch,
> >
> > batch->blorp->exec(batch, );
> >  }
> > +
> > +/** Clear a CCS to the "uncompressed" state
> > + *
> > + * This pass is the CCS equivalent of a "HiZ resolve".  It sets the CCS
> > values
> > + * for a given layer/level of a surface to 0x0 which is the "uncompressed"
> > + * state which tells the sampler to go look at the main surface.
> > + */
> > +void
> > +blorp_ccs_ambiguate(struct blorp_batch *batch,
> > +struct blorp_surf *surf,
> > +uint32_t level, uint32_t layer)
> > +{
> > +   struct blorp_params params;
> > +   blorp_params_init();
> > +
> > +   assert(ISL_DEV_GEN(batch->blorp->isl_dev) >= 7);
> > +
> > +   const struct isl_format_layout *aux_fmtl =
> > +  isl_format_get_layout(surf->aux_surf->format);
> > +   assert(aux_fmtl->txc == ISL_TXC_CCS);
> > +
> > +   params.dst = (struct brw_blorp_surface_info) {
> > +  .enabled = true,
> > +  .addr = surf->aux_addr,
> > +  .view = {
> > + .usage = ISL_SURF_USAGE_RENDER_TARGET_BIT,
> > + .format = ISL_FORMAT_R32G32B32A32_UINT,
> > + .base_level = 0,
> > + .base_array_layer = 0,
> > + .levels = 1,
> > + .array_len = 1,
> > + .swizzle = ISL_SWIZZLE_IDENTITY,
> > +  },
> > +   };
> > +
> > +   uint32_t z = 0;
> > +   if (surf->surf->dim == ISL_SURF_DIM_3D) {
> > +  z = layer;
> > +  layer = 0;
> > +   }
> > +
> > +   uint32_t offset_B, x_offset_el, y_offset_el;
> > +   isl_surf_get_image_offset_el(surf->aux_surf, level, layer, z,
> > +_offset_el, _offset_el);
> > +   isl_tiling_get_intratile_offset_el(surf->aux_surf->tiling,
> > aux_fmtl->bpb,
> > +  surf->aux_surf->row_pitch,
> > +  x_offset_el, y_offset_el,
> > +  _B, _offset_el,
> > _offset_el);
> > +   params.dst.addr.offset += offset_B;
> > +
> > +   const uint32_t width_px = minify(surf->surf->logical_level0_px.width,
> > level);
> > +   const uint32_t height_px = minify(surf->surf->logical_level0_px.height,
> > level);
> > +   const uint32_t width_el = DIV_ROUND_UP(width_px, aux_fmtl->bw);
> > +   const uint32_t height_el = DIV_ROUND_UP(height_px, aux_fmtl->bh);
> > +
> > +   struct isl_tile_info ccs_tile_info;
> > +   isl_surf_get_tile_info(surf->aux_surf, _tile_info);
> > +
> > +   /* We're going to map it as a regular RGBA32_UINT surface.  We need to
> > +* downscale a good deal.  We start by computing the area on the CCS to
> > +* clear in units of Y-tiled cache lines.
> > +*/
> > +   uint32_t x_offset_y_cl, y_offset_y_cl, width_y_cl, height_y_cl;
> > +   if (ISL_DEV_GEN(batch->blorp->isl_dev) >= 8) {
> > +  /* From the Sky Lake PRM Vol. 12 in the section on planes:
> > +   *
> > +   *"The Color Control Surface (CCS) contains the compression
> > status
> > +   *of the cache-line pairs. The compression state of the
> > cache-line
> > +   *pair is specified by 2 bits in the CCS.  Each CCS cache-line
> > +   *represents an area on the main surface of 16x16 sets of 128
> > byte
> > +   *Y-tiled cache-line-pairs. CCS is always Y tiled."
> > +   *
> > +   * Each 2-bit surface element in the CCS corresponds to 

Re: [Mesa-dev] [PATCH v2 14/24] intel/blorp: Add a CCS ambiguation pass

2018-01-30 Thread Jason Ekstrand
On Tue, Jan 30, 2018 at 2:24 PM, Nanley Chery  wrote:

> On Fri, Jan 19, 2018 at 05:25:41PM -0800, Jason Ekstrand wrote:
> > On Fri, Jan 19, 2018 at 3:47 PM, Jason Ekstrand 
> > wrote:
> >
> > > This pass performs an "ambiguate" operation on a CCS-compressed surface
> > > by manually writing zeros into the CCS.  On gen8+, ISL gives us a
> fairly
> > > detailed notion of how the CCS is laid out so this is fairly simple to
> > > do.  On gen7, the CCS tiling is quite crazy but that isn't an issue
> > > because we can only do CCS on single-slice images so we can just blast
> > > over the entire CCS buffer if we want to.
> > > ---
> > >  src/intel/blorp/blorp.h   |   5 ++
> > >  src/intel/blorp/blorp_clear.c | 149 ++
> > > 
> > >  2 files changed, 154 insertions(+)
> > >
> > > diff --git a/src/intel/blorp/blorp.h b/src/intel/blorp/blorp.h
> > > index a1dd571..478a9af 100644
> > > --- a/src/intel/blorp/blorp.h
> > > +++ b/src/intel/blorp/blorp.h
> > > @@ -204,6 +204,11 @@ blorp_ccs_resolve(struct blorp_batch *batch,
> > >enum blorp_fast_clear_op resolve_op);
> > >
> > >  void
> > > +blorp_ccs_ambiguate(struct blorp_batch *batch,
> > > +struct blorp_surf *surf,
> > > +uint32_t level, uint32_t layer);
> > > +
> > > +void
> > >  blorp_mcs_partial_resolve(struct blorp_batch *batch,
> > >struct blorp_surf *surf,
> > >enum isl_format format,
> > > diff --git a/src/intel/blorp/blorp_clear.c
> b/src/intel/blorp/blorp_clear.c
> > > index 8e7bc9f..fa2abd9 100644
> > > --- a/src/intel/blorp/blorp_clear.c
> > > +++ b/src/intel/blorp/blorp_clear.c
> > > @@ -881,3 +881,152 @@ blorp_mcs_partial_resolve(struct blorp_batch
> *batch,
> > >
> > > batch->blorp->exec(batch, );
> > >  }
> > > +
> > > +/** Clear a CCS to the "uncompressed" state
> > > + *
> > > + * This pass is the CCS equivalent of a "HiZ resolve".  It sets the
> CCS
> > > values
> > > + * for a given layer/level of a surface to 0x0 which is the
> "uncompressed"
> > > + * state which tells the sampler to go look at the main surface.
> > > + */
> > > +void
> > > +blorp_ccs_ambiguate(struct blorp_batch *batch,
> > > +struct blorp_surf *surf,
> > > +uint32_t level, uint32_t layer)
> > > +{
> > > +   struct blorp_params params;
> > > +   blorp_params_init();
> > > +
> > > +   assert(ISL_DEV_GEN(batch->blorp->isl_dev) >= 7);
> > > +
> > > +   const struct isl_format_layout *aux_fmtl =
> > > +  isl_format_get_layout(surf->aux_surf->format);
> > > +   assert(aux_fmtl->txc == ISL_TXC_CCS);
> > > +
> > > +   params.dst = (struct brw_blorp_surface_info) {
> > > +  .enabled = true,
> > > +  .addr = surf->aux_addr,
> > > +  .view = {
> > > + .usage = ISL_SURF_USAGE_RENDER_TARGET_BIT,
> > > + .format = ISL_FORMAT_R32G32B32A32_UINT,
> > > + .base_level = 0,
> > > + .base_array_layer = 0,
> > > + .levels = 1,
> > > + .array_len = 1,
> > > + .swizzle = ISL_SWIZZLE_IDENTITY,
> > > +  },
> > > +   };
> > > +
> > > +   uint32_t z = 0;
> > > +   if (surf->surf->dim == ISL_SURF_DIM_3D) {
> > > +  z = layer;
> > > +  layer = 0;
> > > +   }
> > > +
> > > +   uint32_t offset_B, x_offset_el, y_offset_el;
> > > +   isl_surf_get_image_offset_el(surf->aux_surf, level, layer, z,
> > > +_offset_el, _offset_el);
> > > +   isl_tiling_get_intratile_offset_el(surf->aux_surf->tiling,
> > > aux_fmtl->bpb,
> > > +  surf->aux_surf->row_pitch,
> > > +  x_offset_el, y_offset_el,
> > > +  _B, _offset_el,
> > > _offset_el);
> > > +   params.dst.addr.offset += offset_B;
> > > +
> > > +   const uint32_t width_px = minify(surf->surf->logical_
> level0_px.width,
> > > level);
> > > +   const uint32_t height_px = minify(surf->surf->logical_
> level0_px.height,
> > > level);
> > > +   const uint32_t width_el = DIV_ROUND_UP(width_px, aux_fmtl->bw);
> > > +   const uint32_t height_el = DIV_ROUND_UP(height_px, aux_fmtl->bh);
> > > +
> > > +   struct isl_tile_info ccs_tile_info;
> > > +   isl_surf_get_tile_info(surf->aux_surf, _tile_info);
> > > +
> > > +   /* We're going to map it as a regular RGBA32_UINT surface.  We
> need to
> > > +* downscale a good deal.  We start by computing the area on the
> CCS to
> > > +* clear in units of Y-tiled cache lines.
> > > +*/
> > > +   uint32_t x_offset_y_cl, y_offset_y_cl, width_y_cl, height_y_cl;
> > > +   if (ISL_DEV_GEN(batch->blorp->isl_dev) >= 8) {
> > > +  /* From the Sky Lake PRM Vol. 12 in the section on planes:
> > > +   *
> > > +   *"The Color Control Surface (CCS) contains the compression
> > > status
> > > +   *of the cache-line pairs. The compression state of the
> 

Re: [Mesa-dev] [PATCH v2 17/24] anv: Use blorp_ccs_ambiguate instead of fast-clears

2018-01-30 Thread Nanley Chery
On Fri, Jan 19, 2018 at 03:47:34PM -0800, Jason Ekstrand wrote:
> Even though the blorp pass looks a bit on the sketchy side, the end
> result in the Vulkan driver is very nice.  Instead of having this weird
> case where you do a fast clear and then maybe have to resolve, we just
> do the ambiguate and are done with it.  The ambiguate does exactly what
> we want of setting all the CCS values to 0 which puts it inot the
   ^
   in
> pass-through state.
> 
> This should also improve performance a bit in certain cases.  For
> instance, if we did a transition from UNDEFINED to GENERAL for a surface
> that doesn't have CCS enabled all the time, we would end up doing a
> fast-clear and then a full resolve which ends up touching every byte in
> the main surface as well as the CCS.  With the ambiguate pass, that
> transition only touches the CCS.
> ---
>  src/intel/vulkan/anv_blorp.c   |  5 
>  src/intel/vulkan/genX_cmd_buffer.c | 54 
> +-
>  2 files changed, 17 insertions(+), 42 deletions(-)
> 
> diff --git a/src/intel/vulkan/anv_blorp.c b/src/intel/vulkan/anv_blorp.c
> index 05efc6d..3698543 100644
> --- a/src/intel/vulkan/anv_blorp.c
> +++ b/src/intel/vulkan/anv_blorp.c
> @@ -1792,6 +1792,11 @@ anv_image_ccs_op(struct anv_cmd_buffer *cmd_buffer,
>  surf.surf->format, 
> isl_to_blorp_fast_clear_op(ccs_op));
>break;
> case ISL_AUX_OP_AMBIGUATE:
> +  for (uint32_t a = 0; a < layer_count; a++) {
> + const uint32_t layer = base_layer + a;
> + blorp_ccs_ambiguate(, , level, layer);
> +  }
> +  break;
> default:
>unreachable("Unsupported CCS operation");
> }
> diff --git a/src/intel/vulkan/genX_cmd_buffer.c 
> b/src/intel/vulkan/genX_cmd_buffer.c
> index 77fdadf..9e2eba3 100644
> --- a/src/intel/vulkan/genX_cmd_buffer.c
> +++ b/src/intel/vulkan/genX_cmd_buffer.c
> @@ -486,15 +486,6 @@ init_fast_clear_state_entry(struct anv_cmd_buffer 
> *cmd_buffer,
> uint32_t plane = anv_image_aspect_to_plane(image->aspects, aspect);
> enum isl_aux_usage aux_usage = image->planes[plane].aux_usage;
>  
> -   /* The resolve flag should updated to signify that fast-clear/compression
> -* data needs to be removed when leaving the undefined layout. Such data
> -* may need to be removed if it would cause accesses to the color buffer
> -* to return incorrect data. The fast clear data in CCS_D buffers should
> -* be removed because CCS_D isn't enabled all the time.
> -*/
> -   genX(set_image_needs_resolve)(cmd_buffer, image, aspect, level,
> - aux_usage == ISL_AUX_USAGE_NONE);
> -
> /* The fast clear value dword(s) will be copied into a surface state 
> object.
>  * Ensure that the restrictions of the fields in the dword(s) are 
> followed.
>  *
> @@ -677,10 +668,9 @@ transition_color_buffer(struct anv_cmd_buffer 
> *cmd_buffer,
>for (unsigned level = base_level; level < last_level_num; level++)
>   init_fast_clear_state_entry(cmd_buffer, image, aspect, level);
>  
> -  /* Initialize the aux buffers to enable correct rendering. This 
> operation
> -   * requires up to two steps: one to rid the aux buffer of data that may
> -   * cause GPU hangs, and another to ensure that writes done without aux
> -   * will be visible to reads done with aux.
> +  /* Initialize the aux buffers to enable correct rendering.  In order to
> +   * ensure that things such as storage images work correctly, aux 
> buffers
> +   * are initialized to the pass-through state.

Only CCS is initialized to the pass-through state while MCS is
fast-cleared. We may also want to update the comment below since we're
no longer fast-clearing CCS.

> *
> * Having an aux buffer with invalid data is possible for CCS buffers
> * SKL+ and for MCS buffers with certain sample counts (2x and 8x). One
> @@ -692,16 +682,18 @@ transition_color_buffer(struct anv_cmd_buffer 
> *cmd_buffer,
> * We don't have any data to show that this is a problem, but we want 
> to
> * avoid causing difficult-to-debug problems.
> */
> -  if (GEN_GEN >= 9 && image->samples == 1) {
> +  if (image->samples == 1) {
>   for (uint32_t l = 0; l < level_count; l++) {
>  const uint32_t level = base_level + l;
>  const uint32_t level_layer_count =
> MIN2(layer_count, anv_image_aux_layers(image, aspect, level));
>  anv_image_ccs_op(cmd_buffer, image, aspect, level,
>   base_layer, level_layer_count,
> - ISL_AUX_OP_FAST_CLEAR, false);
> + ISL_AUX_OP_AMBIGUATE, false);
> +genX(set_image_needs_resolve)(cmd_buffer, image,
> +  

[Mesa-dev] [PATCH 2/5] radeonsi: load the right number of components for VS inputs and TBOs

2018-01-30 Thread Marek Olšák
From: Marek Olšák 

The supported counts are 1, 2, 4. (3=4)

The following snippet loads float, vec2, vec3, and vec4:

Before:
buffer_load_format_x v9, v4, s[0:3], 0 idxen  ; E0002000 8904
buffer_load_format_xyzw v[0:3], v5, s[8:11], 0 idxen  ; E00C2000 80020005
s_waitcnt vmcnt(0); BF8C0F70
buffer_load_format_xyzw v[2:5], v6, s[12:15], 0 idxen ; E00C2000 80030206
s_waitcnt vmcnt(0); BF8C0F70
buffer_load_format_xyzw v[5:8], v7, s[4:7], 0 idxen   ; E00C2000 80010507

After:
buffer_load_format_x v10, v4, s[0:3], 0 idxen ; E0002000 8A04
buffer_load_format_xy v[8:9], v5, s[8:11], 0 idxen; E0042000 80020805
buffer_load_format_xyzw v[0:3], v6, s[12:15], 0 idxen ; E00C2000 80030006
s_waitcnt vmcnt(0); BF8C0F70
buffer_load_format_xyzw v[3:6], v7, s[4:7], 0 idxen   ; E00C2000 80010307
---
 src/amd/common/ac_llvm_build.c| 35 +++
 src/amd/common/ac_llvm_build.h|  3 ++
 src/gallium/drivers/radeonsi/si_shader.c  | 13 +++--
 src/gallium/drivers/radeonsi/si_shader_tgsi_mem.c |  8 --
 4 files changed, 54 insertions(+), 5 deletions(-)

diff --git a/src/amd/common/ac_llvm_build.c b/src/amd/common/ac_llvm_build.c
index 6afe7f9..a5cb72d 100644
--- a/src/amd/common/ac_llvm_build.c
+++ b/src/amd/common/ac_llvm_build.c
@@ -454,20 +454,55 @@ ac_build_gather_values_extended(struct ac_llvm_context 
*ctx,
 }
 
 LLVMValueRef
 ac_build_gather_values(struct ac_llvm_context *ctx,
   LLVMValueRef *values,
   unsigned value_count)
 {
return ac_build_gather_values_extended(ctx, values, value_count, 1, 
false, false);
 }
 
+/* Expand a scalar or vector to <4 x type> by filling the remaining channels
+ * with undef. Extract at most num_channels components from the input.
+ */
+LLVMValueRef ac_build_expand_to_vec4(struct ac_llvm_context *ctx,
+LLVMValueRef value,
+unsigned num_channels)
+{
+   LLVMTypeRef elemtype;
+   LLVMValueRef chan[4];
+
+   if (LLVMGetTypeKind(LLVMTypeOf(value)) == LLVMVectorTypeKind) {
+   unsigned vec_size = LLVMGetVectorSize(LLVMTypeOf(value));
+   num_channels = MIN2(num_channels, vec_size);
+
+   if (num_channels >= 4)
+   return value;
+
+   for (unsigned i = 0; i < num_channels; i++)
+   chan[i] = ac_llvm_extract_elem(ctx, value, i);
+
+   elemtype = LLVMGetElementType(LLVMTypeOf(value));
+   } else {
+   if (num_channels) {
+   assert(num_channels == 1);
+   chan[0] = value;
+   }
+   elemtype = LLVMTypeOf(value);
+   }
+
+   while (num_channels < 4)
+   chan[num_channels++] = LLVMGetUndef(elemtype);
+
+   return ac_build_gather_values(ctx, chan, 4);
+}
+
 LLVMValueRef
 ac_build_fdiv(struct ac_llvm_context *ctx,
  LLVMValueRef num,
  LLVMValueRef den)
 {
LLVMValueRef ret = LLVMBuildFDiv(ctx->builder, num, den, "");
 
/* Use v_rcp_f32 instead of precise division. */
if (!LLVMIsConstant(ret))
LLVMSetMetadata(ret, ctx->fpmath_md_kind, 
ctx->fpmath_md_2p5_ulp);
diff --git a/src/amd/common/ac_llvm_build.h b/src/amd/common/ac_llvm_build.h
index 78437d6..3ae9678 100644
--- a/src/amd/common/ac_llvm_build.h
+++ b/src/amd/common/ac_llvm_build.h
@@ -134,20 +134,23 @@ LLVMValueRef
 ac_build_gather_values_extended(struct ac_llvm_context *ctx,
LLVMValueRef *values,
unsigned value_count,
unsigned value_stride,
bool load,
bool always_vector);
 LLVMValueRef
 ac_build_gather_values(struct ac_llvm_context *ctx,
   LLVMValueRef *values,
   unsigned value_count);
+LLVMValueRef ac_build_expand_to_vec4(struct ac_llvm_context *ctx,
+LLVMValueRef value,
+unsigned num_channels);
 
 LLVMValueRef
 ac_build_fdiv(struct ac_llvm_context *ctx,
  LLVMValueRef num,
  LLVMValueRef den);
 
 void
 ac_prepare_cube_coords(struct ac_llvm_context *ctx,
   bool is_deriv, bool is_array, bool is_lod,
   LLVMValueRef *coords_arg,
diff --git a/src/gallium/drivers/radeonsi/si_shader.c 
b/src/gallium/drivers/radeonsi/si_shader.c
index de1f725..bc621af 100644
--- a/src/gallium/drivers/radeonsi/si_shader.c
+++ b/src/gallium/drivers/radeonsi/si_shader.c
@@ -473,22 +473,22 @@ static LLVMValueRef unpack_sint16(struct 
si_shader_context *ctx,
 

Re: [Mesa-dev] [PATCH] mesa: fix glGet MAX_VERTEX_ATTRIB queries

2018-01-30 Thread Brian Paul

Reviewed-by: Brian Paul 


On 01/30/2018 02:46 PM, Marek Olšák wrote:

From: Marek Olšák 

Broken by f96a69f916aed40519e755d0460a83940a587
---
  src/mesa/main/get_hash_params.py | 6 +++---
  1 file changed, 3 insertions(+), 3 deletions(-)

diff --git a/src/mesa/main/get_hash_params.py b/src/mesa/main/get_hash_params.py
index 7cd195c..55d29e9 100644
--- a/src/mesa/main/get_hash_params.py
+++ b/src/mesa/main/get_hash_params.py
@@ -514,25 +514,25 @@ descriptor=[
  # GL_ARB_framebuffer_no_attachments / geometry shader
[ "MAX_FRAMEBUFFER_LAYERS", "CONTEXT_INT(Const.MaxFramebufferLayers), 
extra_ARB_framebuffer_no_attachments_and_geometry_shader" ],
  
  # GL_ARB_explicit_uniform_location / GLES 3.1

[ "MAX_UNIFORM_LOCATIONS", 
"CONTEXT_INT(Const.MaxUserAssignableUniformLocations), 
extra_ARB_explicit_uniform_location" ],
  
  # GL_ARB_separate_shader_objects / GLES 3.1

[ "PROGRAM_PIPELINE_BINDING", "LOC_CUSTOM, TYPE_INT, 
GL_PROGRAM_PIPELINE_BINDING, NO_EXTRA" ],
  
  # GL_ARB_vertex_attrib_binding / GLES 3.1

-  [ "MAX_VERTEX_ATTRIB_RELATIVE_OFFSET", 
"CONTEXT_ENUM16(Const.MaxVertexAttribRelativeOffset), NO_EXTRA" ],
-  [ "MAX_VERTEX_ATTRIB_BINDINGS", "CONTEXT_ENUM16(Const.MaxVertexAttribBindings), 
NO_EXTRA" ],
+  [ "MAX_VERTEX_ATTRIB_RELATIVE_OFFSET", 
"CONTEXT_INT(Const.MaxVertexAttribRelativeOffset), NO_EXTRA" ],
+  [ "MAX_VERTEX_ATTRIB_BINDINGS", "CONTEXT_INT(Const.MaxVertexAttribBindings), 
NO_EXTRA" ],
  
  # GL 4.4 / GLES 3.1

-  [ "MAX_VERTEX_ATTRIB_STRIDE", "CONTEXT_ENUM16(Const.MaxVertexAttribStride), 
NO_EXTRA" ],
+  [ "MAX_VERTEX_ATTRIB_STRIDE", "CONTEXT_UINT(Const.MaxVertexAttribStride), 
NO_EXTRA" ],
  
# GL_ARB_shader_storage_buffer_object / GLES 3.1

[ "MAX_VERTEX_SHADER_STORAGE_BLOCKS", 
"CONTEXT_INT(Const.Program[MESA_SHADER_VERTEX].MaxShaderStorageBlocks), 
extra_ARB_shader_storage_buffer_object_es31" ],
[ "MAX_FRAGMENT_SHADER_STORAGE_BLOCKS", 
"CONTEXT_INT(Const.Program[MESA_SHADER_FRAGMENT].MaxShaderStorageBlocks), 
extra_ARB_shader_storage_buffer_object_es31" ],
[ "MAX_COMPUTE_SHADER_STORAGE_BLOCKS", 
"CONTEXT_INT(Const.Program[MESA_SHADER_COMPUTE].MaxShaderStorageBlocks), 
extra_ARB_shader_storage_buffer_object_es31" ],
[ "MAX_COMBINED_SHADER_STORAGE_BLOCKS", 
"CONTEXT_INT(Const.MaxCombinedShaderStorageBlocks), 
extra_ARB_shader_storage_buffer_object_es31" ],
[ "MAX_SHADER_STORAGE_BLOCK_SIZE", 
"CONTEXT_INT(Const.MaxShaderStorageBlockSize), 
extra_ARB_shader_storage_buffer_object_es31" ],
[ "MAX_SHADER_STORAGE_BUFFER_BINDINGS", 
"CONTEXT_INT(Const.MaxShaderStorageBufferBindings), 
extra_ARB_shader_storage_buffer_object_es31" ],
[ "SHADER_STORAGE_BUFFER_OFFSET_ALIGNMENT", 
"CONTEXT_INT(Const.ShaderStorageBufferOffsetAlignment), 
extra_ARB_shader_storage_buffer_object_es31" ],
[ "SHADER_STORAGE_BUFFER_BINDING", "LOC_CUSTOM, TYPE_INT, 0, 
extra_ARB_shader_storage_buffer_object_es31" ],



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


[Mesa-dev] misc pahole repacking

2018-01-30 Thread Dave Airlie
This month's Dave hasn't got enough sleep to do real work, lets
repack some structs.

The format descriptions one is quite good though it reduces the
radv binary data segment.

Dave.

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


[Mesa-dev] [PATCH] r600/cayman: initial attempt at gl_HelperInvocation

2018-01-30 Thread Dave Airlie
From: Dave Airlie 

This is a cayman only patch, it doesn't appear that
evergreen supports the ALU on VPM. I'll try and figure it out later.

All I can say for this patch is it passes the piglit test and
the CTS tests.

This also disable sb for helper invocations until it doesn't
mess up the MBCNTs.

TODO : non-cayman
---
 src/gallium/drivers/r600/r600_isa.c|   1 +
 src/gallium/drivers/r600/r600_isa.h|   5 +-
 src/gallium/drivers/r600/r600_shader.c | 185 +
 src/gallium/drivers/r600/r600_shader.h |   1 +
 src/gallium/drivers/r600/r600_sq.h |   2 +
 src/gallium/drivers/r600/sb/sb_bc_dump.cpp |  15 +++
 6 files changed, 207 insertions(+), 2 deletions(-)

diff --git a/src/gallium/drivers/r600/r600_isa.c 
b/src/gallium/drivers/r600/r600_isa.c
index 2633cdcdb9..611b370bf5 100644
--- a/src/gallium/drivers/r600/r600_isa.c
+++ b/src/gallium/drivers/r600/r600_isa.c
@@ -506,6 +506,7 @@ static const struct cf_op_info cf_op_table[] = {
{"ALU_EXT",   {   -1,   -1, 0x0C, 0x0C },  
CF_CLAUSE | CF_ALU | CF_ALU_EXT  },
{"ALU_CONTINUE",  { 0x0D, 0x0D, 0x0D,   -1 },  
CF_CLAUSE | CF_ALU  },
{"ALU_BREAK", { 0x0E, 0x0E, 0x0E,   -1 },  
CF_CLAUSE | CF_ALU  },
+   {"ALU_VALID_PIXEL_MODE",  {   -1,   -1,   -1, 0x0E },  
CF_CLAUSE | CF_ALU  },
{"ALU_ELSE_AFTER",{ 0x0F, 0x0F, 0x0F, 0x0F },  
CF_CLAUSE | CF_ALU  },
{"CF_NATIVE", { 0x00, 0x00, 0x00, 0x00 },  
0  }
 };
diff --git a/src/gallium/drivers/r600/r600_isa.h 
b/src/gallium/drivers/r600/r600_isa.h
index f6e26976c5..fcaf1f766b 100644
--- a/src/gallium/drivers/r600/r600_isa.h
+++ b/src/gallium/drivers/r600/r600_isa.h
@@ -646,10 +646,11 @@ struct cf_op_info
 #define CF_OP_ALU_EXT  84
 #define CF_OP_ALU_CONTINUE 85
 #define CF_OP_ALU_BREAK86
-#define CF_OP_ALU_ELSE_AFTER   87
+#define CF_OP_ALU_VALID_PIXEL_MODE 87
+#define CF_OP_ALU_ELSE_AFTER   88
 
 /* CF_NATIVE means that r600_bytecode_cf contains pre-encoded native data */
-#define CF_NATIVE  88
+#define CF_NATIVE  89
 
 enum r600_chip_class {
ISA_CC_R600,
diff --git a/src/gallium/drivers/r600/r600_shader.c 
b/src/gallium/drivers/r600/r600_shader.c
index 3344bcb76a..d0ae508a8b 100644
--- a/src/gallium/drivers/r600/r600_shader.c
+++ b/src/gallium/drivers/r600/r600_shader.c
@@ -197,6 +197,7 @@ int r600_pipe_shader_create(struct pipe_context *ctx,
 
use_sb &= !shader->shader.uses_atomics;
use_sb &= !shader->shader.uses_images;
+   use_sb &= !shader->shader.uses_helper_invocation;
 
/* Check if the bytecode has already been built. */
if (!shader->shader.bc.bytecode) {
@@ -346,9 +347,11 @@ struct r600_shader_ctx {
boolean clip_vertex_write;
unsignedcv_output;
unsignededgeflag_output;
+   int helper_invoc_reg;
int cs_block_size_reg;
int cs_grid_size_reg;
bool cs_block_size_loaded, cs_grid_size_loaded;
+   bool helper_invoc_loaded;
int fragcoord_input;
int next_ring_offset;
int gs_out_ring_offset;
@@ -1295,6 +1298,176 @@ static int load_sample_position(struct r600_shader_ctx 
*ctx, struct r600_shader_
return t1;
 }
 
+static int load_helper_invocation(struct r600_shader_ctx *ctx)
+{
+   int r;
+
+   if (ctx->helper_invoc_loaded)
+   return ctx->helper_invoc_reg;
+
+   if (ctx->bc->chip_class != CAYMAN)
+   return -1;
+
+   /* force add a cf and set vpm on it */
+   struct r600_bytecode_alu alu;
+
+   memset(, 0, sizeof(struct r600_bytecode_alu));
+   alu.op = ALU_OP1_MOV;
+   alu.dst.sel = ctx->helper_invoc_reg;
+   alu.dst.chan = 2;
+   alu.src[0].sel = EG_V_SQ_ALU_SRC_MASK_HI;
+   alu.dst.write = 1;
+   r = r600_bytecode_add_alu_type(ctx->bc, , 
CF_OP_ALU_VALID_PIXEL_MODE);
+   if (r)
+   return r;
+
+   memset(, 0, sizeof(struct r600_bytecode_alu));
+   alu.op = ALU_OP1_MOV;
+   alu.dst.sel = ctx->helper_invoc_reg;
+   alu.dst.chan = 3;
+   alu.src[0].sel = EG_V_SQ_ALU_SRC_MASK_LO;
+   alu.dst.write = 1;
+   alu.last = 1;
+   r = r600_bytecode_add_alu_type(ctx->bc, , 
CF_OP_ALU_VALID_PIXEL_MODE);
+   if (r)
+   return r;
+
+   memset(, 0, sizeof(struct r600_bytecode_alu));
+   alu.op = ALU_OP1_MBCNT_32LO_ACCUM_PREV_INT;
+   alu.dst.sel = ctx->temp_reg;
+   alu.dst.chan = 0;
+   

[Mesa-dev] [PATCH 3/7] glsl/tests: move utility functions in cache_test

2018-01-30 Thread Tapani Pälli
Patch moves functions higher so that we can utilize them from
test_disk_cache_create which is modified by next patch.

Signed-off-by: Tapani Pälli 
---
 src/compiler/glsl/tests/cache_test.c | 70 ++--
 1 file changed, 35 insertions(+), 35 deletions(-)

diff --git a/src/compiler/glsl/tests/cache_test.c 
b/src/compiler/glsl/tests/cache_test.c
index 75319f1160..dd11fd5944 100644
--- a/src/compiler/glsl/tests/cache_test.c
+++ b/src/compiler/glsl/tests/cache_test.c
@@ -147,6 +147,41 @@ check_directories_created(const char *cache_dir)
expect_true(sub_dirs_created, "create sub dirs");
 }
 
+static bool
+does_cache_contain(struct disk_cache *cache, const cache_key key)
+{
+   void *result;
+
+   result = disk_cache_get(cache, key, NULL);
+
+   if (result) {
+  free(result);
+  return true;
+   }
+
+   return false;
+}
+
+static void
+wait_until_file_written(struct disk_cache *cache, const cache_key key)
+{
+   struct timespec req;
+   struct timespec rem;
+
+   /* Set 100ms delay */
+   req.tv_sec = 0;
+   req.tv_nsec = 1;
+
+   unsigned retries = 0;
+   while (retries++ < 20) {
+  if (does_cache_contain(cache, key)) {
+ break;
+  }
+
+  nanosleep(, );
+   }
+}
+
 #define CACHE_TEST_TMP "./cache-test-tmp"
 
 static void
@@ -209,41 +244,6 @@ test_disk_cache_create(void)
disk_cache_destroy(cache);
 }
 
-static bool
-does_cache_contain(struct disk_cache *cache, const cache_key key)
-{
-   void *result;
-
-   result = disk_cache_get(cache, key, NULL);
-
-   if (result) {
-  free(result);
-  return true;
-   }
-
-   return false;
-}
-
-static void
-wait_until_file_written(struct disk_cache *cache, const cache_key key)
-{
-   struct timespec req;
-   struct timespec rem;
-
-   /* Set 100ms delay */
-   req.tv_sec = 0;
-   req.tv_nsec = 1;
-
-   unsigned retries = 0;
-   while (retries++ < 20) {
-  if (does_cache_contain(cache, key)) {
- break;
-  }
-
-  nanosleep(, );
-   }
-}
-
 static void
 test_put_and_get(void)
 {
-- 
2.13.6

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


[Mesa-dev] [PATCH v3 6/7] disk cache: add callback functionality

2018-01-30 Thread Tapani Pälli
v2: add disk_cache_has_key, disk_cache_put_key support
using blob cache (Nicolai, Jordan)

v3: rename set_cb as put_cb to match existing naming (Timothy)

Signed-off-by: Tapani Pälli 
---
 src/util/disk_cache.c | 49 +
 src/util/disk_cache.h | 19 +++
 2 files changed, 68 insertions(+)

diff --git a/src/util/disk_cache.c b/src/util/disk_cache.c
index 9fa264440b..5af0346c7a 100644
--- a/src/util/disk_cache.c
+++ b/src/util/disk_cache.c
@@ -101,6 +101,9 @@ struct disk_cache {
/* Driver cache keys. */
uint8_t *driver_keys_blob;
size_t driver_keys_blob_size;
+
+   disk_cache_put_cb blob_put_cb;
+   disk_cache_get_cb blob_get_cb;
 };
 
 struct disk_cache_put_job {
@@ -1012,6 +1015,11 @@ disk_cache_put(struct disk_cache *cache, const cache_key 
key,
const void *data, size_t size,
struct cache_item_metadata *cache_item_metadata)
 {
+   if (cache->blob_put_cb) {
+  cache->blob_put_cb(key, CACHE_KEY_SIZE, data, size);
+  return;
+   }
+
struct disk_cache_put_job *dc_job =
   create_put_job(cache, key, data, size, cache_item_metadata);
 
@@ -1079,6 +1087,29 @@ disk_cache_get(struct disk_cache *cache, const cache_key 
key, size_t *size)
if (size)
   *size = 0;
 
+   if (cache->blob_get_cb) {
+/* This is what Android EGL defines as the maxValueSize in egl_cache_t
+ * class implementation.
+ */
+#define MAX_BLOB_SIZE 64 * 1024
+  void *blob = malloc(MAX_BLOB_SIZE);
+  if (!blob)
+ return NULL;
+
+  signed long bytes =
+ cache->blob_get_cb(key, CACHE_KEY_SIZE, blob, MAX_BLOB_SIZE);
+
+  if (!bytes) {
+ free(blob);
+ return NULL;
+  }
+
+  if (size)
+ *size = bytes;
+  return blob;
+#undef MAX_BLOB_SIZE
+   }
+
filename = get_cache_file(cache, key);
if (filename == NULL)
   goto fail;
@@ -1194,6 +1225,11 @@ disk_cache_put_key(struct disk_cache *cache, const 
cache_key key)
int i = CPU_TO_LE32(*key_chunk) & CACHE_INDEX_KEY_MASK;
unsigned char *entry;
 
+   if (cache->blob_put_cb) {
+  cache->blob_put_cb(key, CACHE_KEY_SIZE, key_chunk, sizeof(uint32_t));
+  return;
+   }
+
if (!cache->path)
   return;
 
@@ -1216,6 +1252,11 @@ disk_cache_has_key(struct disk_cache *cache, const 
cache_key key)
int i = CPU_TO_LE32(*key_chunk) & CACHE_INDEX_KEY_MASK;
unsigned char *entry;
 
+   if (cache->blob_get_cb) {
+  uint32_t blob;
+  return cache->blob_get_cb(key, CACHE_KEY_SIZE, , sizeof(uint32_t));
+   }
+
/* Initialize path if not initialized yet. */
if (cache->path_init_failed ||
(!cache->path && !disk_cache_path_init(cache)))
@@ -1239,4 +1280,12 @@ disk_cache_compute_key(struct disk_cache *cache, const 
void *data, size_t size,
_mesa_sha1_final(, key);
 }
 
+void
+disk_cache_set_callbacks(struct disk_cache *cache, disk_cache_put_cb put,
+ disk_cache_get_cb get)
+{
+   cache->blob_put_cb = put;
+   cache->blob_get_cb = get;
+}
+
 #endif /* ENABLE_SHADER_CACHE */
diff --git a/src/util/disk_cache.h b/src/util/disk_cache.h
index 488b297ead..f84840fb5c 100644
--- a/src/util/disk_cache.h
+++ b/src/util/disk_cache.h
@@ -50,6 +50,14 @@ typedef uint8_t cache_key[CACHE_KEY_SIZE];
 #define CACHE_ITEM_TYPE_UNKNOWN  0x0
 #define CACHE_ITEM_TYPE_GLSL 0x1
 
+typedef void
+(*disk_cache_put_cb) (const void *key, signed long keySize,
+  const void *value, signed long valueSize);
+
+typedef signed long
+(*disk_cache_get_cb) (const void *key, signed long keySize,
+  void *value, signed long valueSize);
+
 struct cache_item_metadata {
/**
 * The cache item type. This could be used to identify a GLSL cache item,
@@ -207,6 +215,10 @@ void
 disk_cache_compute_key(struct disk_cache *cache, const void *data, size_t size,
cache_key key);
 
+void
+disk_cache_set_callbacks(struct disk_cache *cache, disk_cache_put_cb put,
+ disk_cache_get_cb get);
+
 #else
 
 static inline struct disk_cache *
@@ -260,6 +272,13 @@ disk_cache_compute_key(struct disk_cache *cache, const 
void *data, size_t size,
return;
 }
 
+static inline void
+disk_cache_set_callbacks(struct disk_cache *cache, disk_cache_put_cb put,
+ disk_cache_get_cb get)
+{
+   return;
+}
+
 #endif /* ENABLE_SHADER_CACHE */
 
 #ifdef __cplusplus
-- 
2.13.6

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


[Mesa-dev] [PATCH v2 5/7] disk cache: initialize cache path and index only when used

2018-01-30 Thread Tapani Pälli
This patch makes disk_cache initialize path and index lazily so
that we can utilize disk_cache without a path using callback
functionality introduced by next patch.

v2: unmap mmap and destroy queue only if index_mmap exists

Signed-off-by: Tapani Pälli 
---
 src/util/disk_cache.c | 127 +++---
 1 file changed, 78 insertions(+), 49 deletions(-)

diff --git a/src/util/disk_cache.c b/src/util/disk_cache.c
index 2884d3c9c1..9fa264440b 100644
--- a/src/util/disk_cache.c
+++ b/src/util/disk_cache.c
@@ -77,6 +77,7 @@
 struct disk_cache {
/* The path to the cache directory. */
char *path;
+   bool path_init_failed;
 
/* Thread queue for compressing and writing cache entries to disk */
struct util_queue cache_queue;
@@ -178,37 +179,20 @@ concatenate_and_mkdir(void *ctx, const char *path, const 
char *name)
   return NULL;
 }
 
-#define DRV_KEY_CPY(_dst, _src, _src_size) \
-do {   \
-   memcpy(_dst, _src, _src_size);  \
-   _dst += _src_size;  \
-} while (0);
-
-struct disk_cache *
-disk_cache_create(const char *gpu_name, const char *timestamp,
-  uint64_t driver_flags)
+static bool
+disk_cache_path_init(struct disk_cache *cache)
 {
-   void *local;
-   struct disk_cache *cache = NULL;
-   char *path, *max_size_str;
-   uint64_t max_size;
+   void *local = NULL;
+   char *path;
int fd = -1;
struct stat sb;
size_t size;
 
-   /* If running as a users other than the real user disable cache */
-   if (geteuid() != getuid())
-  return NULL;
-
/* A ralloc context for transient data during this invocation. */
local = ralloc_context(NULL);
if (local == NULL)
   goto fail;
 
-   /* At user request, disable shader cache entirely. */
-   if (env_var_as_boolean("MESA_GLSL_CACHE_DISABLE", false))
-  goto fail;
-
/* Determine path for cache based on the first defined name as follows:
 *
 *   $MESA_GLSL_CACHE_DIR
@@ -273,10 +257,6 @@ disk_cache_create(const char *gpu_name, const char 
*timestamp,
  goto fail;
}
 
-   cache = ralloc(NULL, struct disk_cache);
-   if (cache == NULL)
-  goto fail;
-
cache->path = ralloc_strdup(cache, path);
if (cache->path == NULL)
   goto fail;
@@ -325,6 +305,58 @@ disk_cache_create(const char *gpu_name, const char 
*timestamp,
cache->size = (uint64_t *) cache->index_mmap;
cache->stored_keys = cache->index_mmap + sizeof(uint64_t);
 
+   /* 1 thread was chosen because we don't really care about getting things
+* to disk quickly just that it's not blocking other tasks.
+*
+* The queue will resize automatically when it's full, so adding new jobs
+* doesn't stall.
+*/
+   util_queue_init(>cache_queue, "disk_cache", 32, 1,
+   UTIL_QUEUE_INIT_RESIZE_IF_FULL |
+   UTIL_QUEUE_INIT_USE_MINIMUM_PRIORITY);
+
+   ralloc_free(local);
+
+   return true;
+
+ fail:
+   if (fd != -1)
+  close(fd);
+
+   if (local)
+  ralloc_free(local);
+
+   cache->path_init_failed = true;
+
+   return false;
+}
+
+#define DRV_KEY_CPY(_dst, _src, _src_size) \
+do {   \
+   memcpy(_dst, _src, _src_size);  \
+   _dst += _src_size;  \
+} while (0);
+
+struct disk_cache *
+disk_cache_create(const char *gpu_name, const char *timestamp,
+  uint64_t driver_flags)
+{
+   struct disk_cache *cache = NULL;
+   char *max_size_str;
+   uint64_t max_size;
+
+   /* If running as a users other than the real user disable cache */
+   if (geteuid() != getuid())
+  return NULL;
+
+   /* At user request, disable shader cache entirely. */
+   if (env_var_as_boolean("MESA_GLSL_CACHE_DISABLE", false))
+  return NULL;
+
+   cache = rzalloc(NULL, struct disk_cache);
+   if (cache == NULL)
+  return NULL;
+
max_size = 0;
 
max_size_str = getenv("MESA_GLSL_CACHE_MAX_SIZE");
@@ -360,16 +392,6 @@ disk_cache_create(const char *gpu_name, const char 
*timestamp,
 
cache->max_size = max_size;
 
-   /* 1 thread was chosen because we don't really care about getting things
-* to disk quickly just that it's not blocking other tasks.
-*
-* The queue will resize automatically when it's full, so adding new jobs
-* doesn't stall.
-*/
-   util_queue_init(>cache_queue, "disk_cache", 32, 1,
-   UTIL_QUEUE_INIT_RESIZE_IF_FULL |
-   UTIL_QUEUE_INIT_USE_MINIMUM_PRIORITY);
-
uint8_t cache_version = CACHE_VERSION;
size_t cv_size = sizeof(cache_version);
cache->driver_keys_blob_size = cv_size;
@@ -392,8 +414,10 @@ disk_cache_create(const char *gpu_name, const char 
*timestamp,
 
cache->driver_keys_blob =
   ralloc_size(cache, cache->driver_keys_blob_size);
-   if (!cache->driver_keys_blob)
-  goto fail;
+   if (!cache->driver_keys_blob) {
+  ralloc_free(cache);
+  return NULL;
+   }
 

[Mesa-dev] [PATCH 4/7] glsl/tests: changes to test_disk_cache_create test

2018-01-30 Thread Tapani Pälli
Next patch will allow disk_cache instance to be created without
path set for it, remove some test cases that assume disk_cache
creation to fail with invalid path.

To test if different paths work, insert put/get cycle before
directory check so that path gets properly created.

Signed-off-by: Tapani Pälli 
---
 src/compiler/glsl/tests/cache_test.c | 51 ++--
 1 file changed, 20 insertions(+), 31 deletions(-)

diff --git a/src/compiler/glsl/tests/cache_test.c 
b/src/compiler/glsl/tests/cache_test.c
index dd11fd5944..4a2f43a4c3 100644
--- a/src/compiler/glsl/tests/cache_test.c
+++ b/src/compiler/glsl/tests/cache_test.c
@@ -182,21 +182,25 @@ wait_until_file_written(struct disk_cache *cache, const 
cache_key key)
}
 }
 
+static void *
+verify_cache_existence(struct disk_cache *cache)
+{
+   uint8_t dummy_key[20];
+   char *data = "some test data";
+
+   disk_cache_put(cache, dummy_key, data, sizeof(data), NULL);
+   wait_until_file_written(cache, dummy_key);
+   return disk_cache_get(cache, dummy_key, NULL);
+}
+
 #define CACHE_TEST_TMP "./cache-test-tmp"
 
 static void
 test_disk_cache_create(void)
 {
struct disk_cache *cache;
-   int err;
-
-   /* Before doing anything else, ensure that with
-* MESA_GLSL_CACHE_DISABLE set to true, that disk_cache_create returns NULL.
-*/
-   setenv("MESA_GLSL_CACHE_DISABLE", "true", 1);
-   cache = disk_cache_create("test", "make_check", 0);
-   expect_null(cache, "disk_cache_create with MESA_GLSL_CACHE_DISABLE set");
 
+   /* Make sure disk cache is enabled. */
unsetenv("MESA_GLSL_CACHE_DISABLE");
 
/* For the first real disk_cache_create() clear these environment
@@ -206,41 +210,26 @@ test_disk_cache_create(void)
unsetenv("XDG_CACHE_HOME");
 
cache = disk_cache_create("test", "make_check", 0);
-   expect_non_null(cache, "disk_cache_create with no environment variables");
-
+   expect_non_null(verify_cache_existence(cache),
+   "cache works with no environment variables");
disk_cache_destroy(cache);
 
-   /* Test with XDG_CACHE_HOME set */
-   setenv("XDG_CACHE_HOME", CACHE_TEST_TMP "/xdg-cache-home", 1);
-   cache = disk_cache_create("test", "make_check", 0);
-   expect_null(cache, "disk_cache_create with XDG_CACHE_HOME set with"
-   "a non-existing parent directory");
-
mkdir(CACHE_TEST_TMP, 0755);
-   cache = disk_cache_create("test", "make_check", 0);
-   expect_non_null(cache, "disk_cache_create with XDG_CACHE_HOME set");
 
+   setenv("XDG_CACHE_HOME", CACHE_TEST_TMP "/xdg-cache-home", 1);
+   cache = disk_cache_create("test", "make_check", 0);
+   expect_non_null(verify_cache_existence(cache),
+   "cache works with XDG_CACHE_HOME set");
check_directories_created(CACHE_TEST_TMP "/xdg-cache-home/"
  CACHE_DIR_NAME);
-
disk_cache_destroy(cache);
 
-   /* Test with MESA_GLSL_CACHE_DIR set */
-   err = rmrf_local(CACHE_TEST_TMP);
-   expect_equal(err, 0, "Removing " CACHE_TEST_TMP);
-
setenv("MESA_GLSL_CACHE_DIR", CACHE_TEST_TMP "/mesa-glsl-cache-dir", 1);
cache = disk_cache_create("test", "make_check", 0);
-   expect_null(cache, "disk_cache_create with MESA_GLSL_CACHE_DIR set with"
-   "a non-existing parent directory");
-
-   mkdir(CACHE_TEST_TMP, 0755);
-   cache = disk_cache_create("test", "make_check", 0);
-   expect_non_null(cache, "disk_cache_create with MESA_GLSL_CACHE_DIR set");
-
+   expect_non_null(verify_cache_existence(cache),
+   "cache works with MESA_GLSL_CACHE_DIR set");
check_directories_created(CACHE_TEST_TMP "/mesa-glsl-cache-dir/"
  CACHE_DIR_NAME);
-
disk_cache_destroy(cache);
 }
 
-- 
2.13.6

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


[Mesa-dev] [PATCH v2 1/7] dri: add interface for EGL_ANDROID_blob_cache extension

2018-01-30 Thread Tapani Pälli
v2: move from __DRIcontext to __DRIscreen (Emil Velikov)

Signed-off-by: Tapani Pälli 
---
 include/GL/internal/dri_interface.h | 26 +-
 1 file changed, 25 insertions(+), 1 deletion(-)

diff --git a/include/GL/internal/dri_interface.h 
b/include/GL/internal/dri_interface.h
index 34a5c9fb01..a0c11f184c 100644
--- a/include/GL/internal/dri_interface.h
+++ b/include/GL/internal/dri_interface.h
@@ -82,7 +82,7 @@ typedef struct __DRI2flushExtensionRec
__DRI2flushExtension;
 typedef struct __DRI2throttleExtensionRec  __DRI2throttleExtension;
 typedef struct __DRI2fenceExtensionRec  __DRI2fenceExtension;
 typedef struct __DRI2interopExtensionRec   __DRI2interopExtension;
-
+typedef struct __DRI2blobExtensionRec   __DRI2blobExtension;
 
 typedef struct __DRIimageLoaderExtensionRec __DRIimageLoaderExtension;
 typedef struct __DRIimageDriverExtensionRec __DRIimageDriverExtension;
@@ -336,6 +336,30 @@ struct __DRI2throttleExtensionRec {
enum __DRI2throttleReason reason);
 };
 
+/**
+ * Extension for EGL_ANDROID_blob_cache
+ */
+
+#define __DRI2_BLOB "DRI2_Blob"
+#define __DRI2_BLOB_VERSION 1
+
+typedef void
+(*__DRIblobCacheSet) (const void *key, signed long keySize,
+  const void *value, signed long valueSize);
+
+typedef signed long
+(*__DRIblobCacheGet) (const void *key, signed long keySize,
+  void *value, signed long valueSize);
+
+struct __DRI2blobExtensionRec {
+   __DRIextension base;
+
+   /**
+* Set cache functions for setting and getting cache entries.
+*/
+   void (*set_cache_funcs) (__DRIscreen *screen,
+__DRIblobCacheSet set, __DRIblobCacheGet get);
+};
 
 /**
  * Extension for fences / synchronization objects.
-- 
2.13.6

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


  1   2   >