[Mesa-dev] [PATCH v2] anv/blorp: multisample resolve all attachment layers

2018-02-15 Thread Iago Toral Quiroga
We were only resolving the first.

v2:
  - Do not require that the number of layers on dst and src are an
exact match, it is okay if the dst has more layers so long as
it has at least the same that we are going to resolve.
  - Do not always resolve array_len layers, we should resolve
only from base_array_layer to array_len.

Fixes new CTS tests for multisampled layered rendering:
dEQP-VK.renderpass.multisample_resolve.layers_*
---
 src/intel/vulkan/anv_blorp.c | 30 +++---
 1 file changed, 19 insertions(+), 11 deletions(-)

diff --git a/src/intel/vulkan/anv_blorp.c b/src/intel/vulkan/anv_blorp.c
index d38b343671..9afac89b2d 100644
--- a/src/intel/vulkan/anv_blorp.c
+++ b/src/intel/vulkan/anv_blorp.c
@@ -1543,25 +1543,33 @@ anv_cmd_buffer_resolve_subpass(struct anv_cmd_buffer 
*cmd_buffer)
  get_blorp_surf_for_anv_image(cmd_buffer->device, dst_iview->image,
   VK_IMAGE_ASPECT_COLOR_BIT,
   dst_aux_usage, &dst_surf);
+
+ uint32_t base_src_layer = src_iview->planes[0].isl.base_array_layer;
+ uint32_t base_dst_layer = dst_iview->planes[0].isl.base_array_layer;
+ uint32_t num_layers = src_iview->planes[0].isl.array_len - 
base_src_layer;
+ assert(num_layers <= dst_iview->planes[0].isl.array_len - 
base_dst_layer);
+
  anv_cmd_buffer_mark_image_written(cmd_buffer, dst_iview->image,
VK_IMAGE_ASPECT_COLOR_BIT,
dst_surf.aux_usage,
dst_iview->planes[0].isl.base_level,
-   
dst_iview->planes[0].isl.base_array_layer, 1);
+   base_dst_layer, num_layers);
 
  assert(!src_iview->image->format->can_ycbcr);
  assert(!dst_iview->image->format->can_ycbcr);
 
- resolve_surface(&batch,
- &src_surf,
- src_iview->planes[0].isl.base_level,
- src_iview->planes[0].isl.base_array_layer,
- &dst_surf,
- dst_iview->planes[0].isl.base_level,
- dst_iview->planes[0].isl.base_array_layer,
- render_area.offset.x, render_area.offset.y,
- render_area.offset.x, render_area.offset.y,
- render_area.extent.width, render_area.extent.height);
+ for (uint32_t i = 0; i < num_layers; i++) {
+resolve_surface(&batch,
+&src_surf,
+src_iview->planes[0].isl.base_level,
+base_src_layer + i,
+&dst_surf,
+dst_iview->planes[0].isl.base_level,
+base_dst_layer + i,
+render_area.offset.x, render_area.offset.y,
+render_area.offset.x, render_area.offset.y,
+render_area.extent.width, 
render_area.extent.height);
+ }
   }
 
   blorp_batch_finish(&batch);
-- 
2.14.1

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


Re: [Mesa-dev] [PATCH v2] anv/blorp: multisample resolve all attachment layers

2018-02-15 Thread Iago Toral
On Thu, 2018-02-15 at 09:24 +0100, Iago Toral Quiroga wrote:
> We were only resolving the first.
> 
> v2:
>   - Do not require that the number of layers on dst and src are an
> exact match, it is okay if the dst has more layers so long as
> it has at least the same that we are going to resolve.
>   - Do not always resolve array_len layers, we should resolve
> only from base_array_layer to array_len.

Ignore this v2, it doesn't account for the fact that array_len
represent the number of layers starting at the base layer. I'll send a
v3 shortly.

> Fixes new CTS tests for multisampled layered rendering:
> dEQP-VK.renderpass.multisample_resolve.layers_*
> ---
>  src/intel/vulkan/anv_blorp.c | 30 +++---
>  1 file changed, 19 insertions(+), 11 deletions(-)
> 
> diff --git a/src/intel/vulkan/anv_blorp.c
> b/src/intel/vulkan/anv_blorp.c
> index d38b343671..9afac89b2d 100644
> --- a/src/intel/vulkan/anv_blorp.c
> +++ b/src/intel/vulkan/anv_blorp.c
> @@ -1543,25 +1543,33 @@ anv_cmd_buffer_resolve_subpass(struct
> anv_cmd_buffer *cmd_buffer)
>   get_blorp_surf_for_anv_image(cmd_buffer->device, dst_iview-
> >image,
>VK_IMAGE_ASPECT_COLOR_BIT,
>dst_aux_usage, &dst_surf);
> +
> + uint32_t base_src_layer = src_iview-
> >planes[0].isl.base_array_layer;
> + uint32_t base_dst_layer = dst_iview-
> >planes[0].isl.base_array_layer;
> + uint32_t num_layers = src_iview->planes[0].isl.array_len -
> base_src_layer;
> + assert(num_layers <= dst_iview->planes[0].isl.array_len -
> base_dst_layer);
> +
>   anv_cmd_buffer_mark_image_written(cmd_buffer, dst_iview-
> >image,
> VK_IMAGE_ASPECT_COLOR_BIT
> ,
> dst_surf.aux_usage,
> dst_iview-
> >planes[0].isl.base_level,
> -   dst_iview-
> >planes[0].isl.base_array_layer, 1);
> +   base_dst_layer,
> num_layers);
>  
>   assert(!src_iview->image->format->can_ycbcr);
>   assert(!dst_iview->image->format->can_ycbcr);
>  
> - resolve_surface(&batch,
> - &src_surf,
> - src_iview->planes[0].isl.base_level,
> - src_iview->planes[0].isl.base_array_layer,
> - &dst_surf,
> - dst_iview->planes[0].isl.base_level,
> - dst_iview->planes[0].isl.base_array_layer,
> - render_area.offset.x, render_area.offset.y,
> - render_area.offset.x, render_area.offset.y,
> - render_area.extent.width,
> render_area.extent.height);
> + for (uint32_t i = 0; i < num_layers; i++) {
> +resolve_surface(&batch,
> +&src_surf,
> +src_iview->planes[0].isl.base_level,
> +base_src_layer + i,
> +&dst_surf,
> +dst_iview->planes[0].isl.base_level,
> +base_dst_layer + i,
> +render_area.offset.x,
> render_area.offset.y,
> +render_area.offset.x,
> render_area.offset.y,
> +render_area.extent.width,
> render_area.extent.height);
> + }
>}
>  
>blorp_batch_finish(&batch);
___
mesa-dev mailing list
mesa-dev@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/mesa-dev


[Mesa-dev] [PATCH v3] anv/blorp: multisample resolve all attachment layers

2018-02-15 Thread Iago Toral Quiroga
We were only resolving the first.

v2:
  - Do not require that the number of layers on dst and src are an
exact match, it is okay if the dst has more layers so long as
it has at least the same that we are going to resolve.
  - Do not always resolve array_len layers, we should resolve
only from base_array_layer to array_len.

v3:
  - v2 was assuming that array_len represented the total number of
layers in the image, but it represents the number of layers
starting at the base array ayer.

Fixes new CTS tests for multisampled layered rendering:
dEQP-VK.renderpass.multisample_resolve.layers_*
---
 src/intel/vulkan/anv_blorp.c | 30 +++---
 1 file changed, 19 insertions(+), 11 deletions(-)

diff --git a/src/intel/vulkan/anv_blorp.c b/src/intel/vulkan/anv_blorp.c
index d38b343671..df566773a4 100644
--- a/src/intel/vulkan/anv_blorp.c
+++ b/src/intel/vulkan/anv_blorp.c
@@ -1543,25 +1543,33 @@ anv_cmd_buffer_resolve_subpass(struct anv_cmd_buffer 
*cmd_buffer)
  get_blorp_surf_for_anv_image(cmd_buffer->device, dst_iview->image,
   VK_IMAGE_ASPECT_COLOR_BIT,
   dst_aux_usage, &dst_surf);
+
+ uint32_t base_src_layer = src_iview->planes[0].isl.base_array_layer;
+ uint32_t base_dst_layer = dst_iview->planes[0].isl.base_array_layer;
+ uint32_t num_layers = src_iview->planes[0].isl.array_len;
+ assert(num_layers <= dst_iview->planes[0].isl.array_len);
+
  anv_cmd_buffer_mark_image_written(cmd_buffer, dst_iview->image,
VK_IMAGE_ASPECT_COLOR_BIT,
dst_surf.aux_usage,
dst_iview->planes[0].isl.base_level,
-   
dst_iview->planes[0].isl.base_array_layer, 1);
+   base_dst_layer, num_layers);
 
  assert(!src_iview->image->format->can_ycbcr);
  assert(!dst_iview->image->format->can_ycbcr);
 
- resolve_surface(&batch,
- &src_surf,
- src_iview->planes[0].isl.base_level,
- src_iview->planes[0].isl.base_array_layer,
- &dst_surf,
- dst_iview->planes[0].isl.base_level,
- dst_iview->planes[0].isl.base_array_layer,
- render_area.offset.x, render_area.offset.y,
- render_area.offset.x, render_area.offset.y,
- render_area.extent.width, render_area.extent.height);
+ for (uint32_t i = 0; i < num_layers; i++) {
+resolve_surface(&batch,
+&src_surf,
+src_iview->planes[0].isl.base_level,
+base_src_layer + i,
+&dst_surf,
+dst_iview->planes[0].isl.base_level,
+base_dst_layer + i,
+render_area.offset.x, render_area.offset.y,
+render_area.offset.x, render_area.offset.y,
+render_area.extent.width, 
render_area.extent.height);
+ }
   }
 
   blorp_batch_finish(&batch);
-- 
2.14.1

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


Re: [Mesa-dev] [PATCH 5/5] ac: use correct LLVM opcodes for ordered comparisons

2018-02-15 Thread Bas Nieuwenhuizen
On Thu, Feb 15, 2018 at 8:54 AM, Connor Abbott  wrote:
> On Wed, Feb 14, 2018 at 11:53 PM, Timothy Arceri  
> wrote:
>>
>>
>> On 15/02/18 04:39, Marek Olšák wrote:
>>>
>>> Reviewed-by: Marek Olšák 
>>>
>>> Marek
>>>
>>> On Wed, Feb 14, 2018 at 7:29 AM, Timothy Arceri 
>>> wrote:

 Fixes glsl-1.30/execution/isinf-and-isnan* piglit tests for
 radeonsi and should fix SPIRV errors when LLVM optimises away
 the workarounds in vtn_handle_alu() for handling ordered
 comparisons.

 Bugzilla: https://bugs.freedesktop.org/show_bug.cgi?id=104905
 ---
   src/amd/common/ac_nir_to_llvm.c | 8 
   1 file changed, 4 insertions(+), 4 deletions(-)

 diff --git a/src/amd/common/ac_nir_to_llvm.c
 b/src/amd/common/ac_nir_to_llvm.c
 index a0c5680205..e81f86bb08 100644
 --- a/src/amd/common/ac_nir_to_llvm.c
 +++ b/src/amd/common/ac_nir_to_llvm.c
 @@ -1792,16 +1792,16 @@ static void visit_alu(struct ac_nir_context *ctx,
 const nir_alu_instr *instr)
  result = emit_int_cmp(&ctx->ac, LLVMIntUGE, src[0],
 src[1]);
  break;
  case nir_op_feq:
 -   result = emit_float_cmp(&ctx->ac, LLVMRealUEQ, src[0],
 src[1]);
 +   result = emit_float_cmp(&ctx->ac, LLVMRealOEQ, src[0],
 src[1]);
  break;
  case nir_op_fne:
 -   result = emit_float_cmp(&ctx->ac, LLVMRealUNE, src[0],
 src[1]);
 +   result = emit_float_cmp(&ctx->ac, LLVMRealONE, src[0],
 src[1]);
>>
>>
>> It seems we need to leave this one as is to avoid regressions. This is also
>> what radeonsi does.
>
> So, the thing you have to understand is that in LLVM unordered
> comparisons are precisely the inverse of the ordered comparisons. That
> is, (a <=(ordered) b) == !(a >(unordered b), (a ==(ordered) b) == !(a
> !=(unordered) b), and  so on. C defines that all comparsions are
> ordered except !=, so that (a == b) == !(a != b) always holds true.
> Most hardware follows this convention -- offhand, x86 SSE is the only
> ISA I know of with separate ordered and unordered comparisons, and
> LLVM appears to have copied the distinction from them, but no one else
> has both. I'm not even sure if it's in the IEEE spec. GLSL follows the
> C convention, so glsl_to_nir just uses nir_op_fne to mean unordered
> not-equal. spirv_to_nir generates some extra instructions, which then
> get stripped away later... sigh.
>
> I think the right way to untangle this mess is to define that the NIR
> opcodes should always match the C convention. The separate ordered and
> unordered opcodes are unnecesary, since one is just the logical
> negation of the other, and LLVM was a little overzealous -- I'm sure
> they would get rid of the distinction if they had the chance -- and
> then they were blindly copied to SPIR-V. spirv_to_nir should just
> negate the result if necessary rather than emitting the extra code to
> handle NaN, and ac should use ordered except for not-equals.

GCN hardware actually has both ordered and unordered instructions,
though I think
it could be fair to only introduce them during instruction selection
(or conversion to LLVM)
and keep a canonical ordered comparison + not in nir.

I think the most important part would be to firmly define which one
the nir instructions are
and then make nir_opt_algebraic not break that.

>
>>
>>
  break;
  case nir_op_flt:
 -   result = emit_float_cmp(&ctx->ac, LLVMRealULT, src[0],
 src[1]);
 +   result = emit_float_cmp(&ctx->ac, LLVMRealOLT, src[0],
 src[1]);
  break;
  case nir_op_fge:
 -   result = emit_float_cmp(&ctx->ac, LLVMRealUGE, src[0],
 src[1]);
 +   result = emit_float_cmp(&ctx->ac, LLVMRealOGE, src[0],
 src[1]);
  break;
  case nir_op_ufeq:
  result = emit_float_cmp(&ctx->ac, LLVMRealUEQ, src[0],
 src[1]);
 --
 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
> ___
> 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] glsl: Fix memory leak with known glsl_type instances

2018-02-15 Thread Tapani Pälli
From: Simon Hausmann 

When looking up known glsl_type instances in the various hash tables, we
end up leaking the key instances used for the lookup, as the glsl_type
constructor allocates memory on the global mem_ctx. This patch changes
glsl_type to manage its own memory, which fixes the leak and also allows
getting rid of the global mem_ctx and its mutex.

v2: remove lambda usage (Tapani)

Bugzilla: https://bugs.freedesktop.org/show_bug.cgi?id=104884
Signed-off-by: Simon Hausmann 
Signed-off-by: Tapani Pälli 
---
 src/compiler/glsl_types.cpp | 83 -
 src/compiler/glsl_types.h   | 44 +++-
 2 files changed, 41 insertions(+), 86 deletions(-)

diff --git a/src/compiler/glsl_types.cpp b/src/compiler/glsl_types.cpp
index 3cc5eb0495..81ff97b1f7 100644
--- a/src/compiler/glsl_types.cpp
+++ b/src/compiler/glsl_types.cpp
@@ -28,23 +28,12 @@
 #include "util/hash_table.h"
 
 
-mtx_t glsl_type::mem_mutex = _MTX_INITIALIZER_NP;
 mtx_t glsl_type::hash_mutex = _MTX_INITIALIZER_NP;
 hash_table *glsl_type::array_types = NULL;
 hash_table *glsl_type::record_types = NULL;
 hash_table *glsl_type::interface_types = NULL;
 hash_table *glsl_type::function_types = NULL;
 hash_table *glsl_type::subroutine_types = NULL;
-void *glsl_type::mem_ctx = NULL;
-
-void
-glsl_type::init_ralloc_type_ctx(void)
-{
-   if (glsl_type::mem_ctx == NULL) {
-  glsl_type::mem_ctx = ralloc_context(NULL);
-  assert(glsl_type::mem_ctx != NULL);
-   }
-}
 
 glsl_type::glsl_type(GLenum gl_type,
  glsl_base_type base_type, unsigned vector_elements,
@@ -63,14 +52,12 @@ glsl_type::glsl_type(GLenum gl_type,
STATIC_ASSERT((unsigned(GLSL_TYPE_INT)   & 3) == unsigned(GLSL_TYPE_INT));
STATIC_ASSERT((unsigned(GLSL_TYPE_FLOAT) & 3) == unsigned(GLSL_TYPE_FLOAT));
 
-   mtx_lock(&glsl_type::mem_mutex);
+   this->mem_ctx = ralloc_context(NULL);
+   assert(this->mem_ctx != NULL);
 
-   init_ralloc_type_ctx();
assert(name != NULL);
this->name = ralloc_strdup(this->mem_ctx, name);
 
-   mtx_unlock(&glsl_type::mem_mutex);
-
/* Neither dimension is zero or both dimensions are zero.
 */
assert((vector_elements == 0) == (matrix_columns == 0));
@@ -86,14 +73,12 @@ glsl_type::glsl_type(GLenum gl_type, glsl_base_type 
base_type,
sampler_array(array), interface_packing(0),
interface_row_major(0), length(0)
 {
-   mtx_lock(&glsl_type::mem_mutex);
+   this->mem_ctx = ralloc_context(NULL);
+   assert(this->mem_ctx != NULL);
 
-   init_ralloc_type_ctx();
assert(name != NULL);
this->name = ralloc_strdup(this->mem_ctx, name);
 
-   mtx_unlock(&glsl_type::mem_mutex);
-
memset(& fields, 0, sizeof(fields));
 
matrix_columns = vector_elements = 1;
@@ -110,9 +95,9 @@ glsl_type::glsl_type(const glsl_struct_field *fields, 
unsigned num_fields,
 {
unsigned int i;
 
-   mtx_lock(&glsl_type::mem_mutex);
+   this->mem_ctx = ralloc_context(NULL);
+   assert(this->mem_ctx != NULL);
 
-   init_ralloc_type_ctx();
assert(name != NULL);
this->name = ralloc_strdup(this->mem_ctx, name);
this->fields.structure = ralloc_array(this->mem_ctx,
@@ -123,8 +108,6 @@ glsl_type::glsl_type(const glsl_struct_field *fields, 
unsigned num_fields,
   this->fields.structure[i].name = ralloc_strdup(this->fields.structure,
  fields[i].name);
}
-
-   mtx_unlock(&glsl_type::mem_mutex);
 }
 
 glsl_type::glsl_type(const glsl_struct_field *fields, unsigned num_fields,
@@ -140,9 +123,9 @@ glsl_type::glsl_type(const glsl_struct_field *fields, 
unsigned num_fields,
 {
unsigned int i;
 
-   mtx_lock(&glsl_type::mem_mutex);
+   this->mem_ctx = ralloc_context(NULL);
+   assert(this->mem_ctx != NULL);
 
-   init_ralloc_type_ctx();
assert(name != NULL);
this->name = ralloc_strdup(this->mem_ctx, name);
this->fields.structure = rzalloc_array(this->mem_ctx,
@@ -152,8 +135,6 @@ glsl_type::glsl_type(const glsl_struct_field *fields, 
unsigned num_fields,
   this->fields.structure[i].name = ralloc_strdup(this->fields.structure,
  fields[i].name);
}
-
-   mtx_unlock(&glsl_type::mem_mutex);
 }
 
 glsl_type::glsl_type(const glsl_type *return_type,
@@ -167,9 +148,8 @@ glsl_type::glsl_type(const glsl_type *return_type,
 {
unsigned int i;
 
-   mtx_lock(&glsl_type::mem_mutex);
-
-   init_ralloc_type_ctx();
+   this->mem_ctx = ralloc_context(NULL);
+   assert(this->mem_ctx != NULL);
 
this->fields.parameters = rzalloc_array(this->mem_ctx,
glsl_function_param, num_params + 
1);
@@ -185,8 +165,6 @@ glsl_type::glsl_type(const glsl_type *return_type,
   this->fields.parameters[i + 1].in = params[i].in;
   this->fields.parameters[i + 1].out = params[i].out;
}
-
-   mtx_unlock(&glsl_type::mem_mutex);
 }
 
 glsl_type::glsl_type(const char *subroutine_name) :
@@ -197,12 +175,16 @@ glsl_type::glsl_type(

[Mesa-dev] [Bug 105103] Wayland master causes Mesa to fail to compile

2018-02-15 Thread bugzilla-daemon
https://bugs.freedesktop.org/show_bug.cgi?id=105103

Daniel Stone  changed:

   What|Removed |Added

  Component|wayland |EGL/Wayland
 QA Contact||mesa-dev@lists.freedesktop.
   ||org
Version|unspecified |git
Product|Wayland |Mesa

-- 
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 105103] Wayland master causes Mesa to fail to compile

2018-02-15 Thread bugzilla-daemon
https://bugs.freedesktop.org/show_bug.cgi?id=105103

--- Comment #1 from Daniel Stone  ---
Ugh. This should fix it:
https://patchwork.freedesktop.org/patch/204873/

-- 
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] [PATCH] egl/wayland: Always use in-tree wayland-egl-backend.h

2018-02-15 Thread Daniel Stone
A recent patchset to Wayland[0] migrated Mesa's libwayland-egl backend
into Wayland itself, so implementations could provide backends. Mesa
still uses its own, and the two have already diverged[1].

The include from egl_dri2.h could pick up either the installed Wayland
wayland-egl-backend.h (with a 'driver_private' member), or the Mesa
internal wayland-egl-backend.h (with a 'private' member), failing the
build in the first instance.

Add an explicit directory prefix to the include, so we always get our
in-tree version.

[0]: https://patchwork.freedesktop.org/series/31663/
[1]: https://cgit.freedesktop.org/wayland/wayland/commit/?id=9fa60983b579

Signed-off-by: Daniel Stone 
Cc: Emil Velikov 
Cc: mesa-sta...@lists.freedesktop.org
Fixes: https://bugs.freedesktop.org/show_bug.cgi?id=105103
---
 src/egl/drivers/dri2/egl_dri2.h | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/src/egl/drivers/dri2/egl_dri2.h b/src/egl/drivers/dri2/egl_dri2.h
index 4e711ff3851..bd637f73c9d 100644
--- a/src/egl/drivers/dri2/egl_dri2.h
+++ b/src/egl/drivers/dri2/egl_dri2.h
@@ -44,7 +44,7 @@
 
 #ifdef HAVE_WAYLAND_PLATFORM
 #include 
-#include "wayland-egl-backend.h"
+#include "wayland/wayland-egl/wayland-egl-backend.h"
 /* forward declarations of protocol elements */
 struct zwp_linux_dmabuf_v1;
 #endif
-- 
2.14.3

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


Re: [Mesa-dev] [PATCH mesa] dri: use a supported API in driCreateNewContext

2018-02-15 Thread Eric Engestrom
On Wednesday, 2018-02-14 09:06:41 -0500, Ilia Mirkin wrote:
> On Feb 14, 2018 7:38 AM, "Eric Engestrom"  wrote:
> 
> From: Brendan King 
> 
> Don't assume the screen supports OpenGL when creating a new context,
> use an API that the screen supports.
> 
> Signed-off-by: Brendan King 
> Reviewed-by: Eric Engestrom 
> [Eric: rebased on current git HEAD]
> Signed-off-by: Eric Engestrom 
> ---
>  src/mesa/drivers/dri/common/dri_util.c | 14 +-
>  1 file changed, 13 insertions(+), 1 deletion(-)
> 
> diff --git a/src/mesa/drivers/dri/common/dri_util.c
> b/src/mesa/drivers/dri/common/dri_util.c
> index e6a7d2391a78c45d45a1..3f32b34132e75228e0e0 100644
> --- a/src/mesa/drivers/dri/common/dri_util.c
> +++ b/src/mesa/drivers/dri/common/dri_util.c
> @@ -49,6 +49,7 @@
>  #include "main/debug_output.h"
>  #include "main/errors.h"
>  #include "main/macros.h"
> +#include "util/bitscan.h"
> 
>  const char __dri2ConfigOptions[] =
> DRI_CONF_BEGIN
> @@ -325,7 +326,11 @@ driCreateContextAttribs(__DRIscreen *screen, int api,
> mesa_api = API_OPENGLES;
> break;
>  case __DRI_API_GLES2:
> +   ctx_config.major_version = 2;
> +   mesa_api = API_OPENGLES2;
> +   break;
>  case __DRI_API_GLES3:
> +   ctx_config.major_version = 3;
> 
> 
> Are you sure about this change? Doesn't seem related, and I'm about 20%
> sure there was some reason for the current thing.

I take the point that these are two separate bugs, and I'll split the
change and re-send, but I don't see the "reason for the current thing".
I'm betting on the 80% :P

Without this `major_version` being set, validate_context_version()
further down could accept a gles3 context when only gles2 is supported,
because `major_version` would be 1 for both and never `>2` or `>3`.

This is normally be hidden by the fact an attribute list with
__DRI_CTX_ATTRIB_MAJOR_VERSION would be passed, but
driCreateNewContextForAPI() doesn't pass an attribute list, which was in
turn hidden by driCreateNewContext() always requesting OPENGL, for which
1.0 is valid, if you support OpenGL (which a lot of dri drivers do, but
we don't anymore).

> 
> mesa_api = API_OPENGLES2;
> break;
>  case __DRI_API_OPENGL_CORE:
> @@ -514,7 +519,14 @@ static __DRIcontext *
>  driCreateNewContext(__DRIscreen *screen, const __DRIconfig *config,
>  __DRIcontext *shared, void *data)
>  {
> -return driCreateNewContextForAPI(screen, __DRI_API_OPENGL,
> +int apifs;
> +
> +apifs = ffs(screen->api_mask);
> +
> +if (!apifs)
> +return NULL;
> +
> +return driCreateNewContextForAPI(screen, apifs - 1,
>   config, shared, data);
>  }
> 
> --
> Cheers,
>   Eric
> 
___
mesa-dev mailing list
mesa-dev@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/mesa-dev


Re: [Mesa-dev] [PATCH 07/15] util/bitset: Add C++ wrapper for static-size bitsets.

2018-02-15 Thread Eric Engestrom
On Wednesday, 2018-02-14 13:18:29 -0800, Francisco Jerez wrote:
> ---
>  src/util/bitset.h | 114 
> ++
>  1 file changed, 114 insertions(+)
> 
> diff --git a/src/util/bitset.h b/src/util/bitset.h
> index 2404ce7f630..7bb5f3c83cf 100644
> --- a/src/util/bitset.h
> +++ b/src/util/bitset.h
> @@ -132,4 +132,118 @@ __bitset_next_set(unsigned i, BITSET_WORD *tmp,
> for (__tmp = *(__set), __i = 0; \
>  (__i = __bitset_next_set(__i, &__tmp, __set, __size)) < __size;)
>  
> +#ifdef __cplusplus
> +
> +/**
> + * Simple C++ wrapper of a bitset type of static size, with value semantics
> + * and basic bitwise arithmetic operators.  The operators defined below are
> + * expected to have the same semantics as the same operator applied to other
> + * fundamental integer types.  T is the name of the struct to instantiate
> + * it as, and N is the number of bits in the bitset.
> + */

Any reason not to use std::bitset for this?
http://en.cppreference.com/w/cpp/utility/bitset

> +#define DECLARE_BITSET_T(T, N) struct T {   \
> +  /* XXX - Replace this with an implicitly-defined  \
> +   * constructor when support for C++11 defaulted   \
> +   * constructors can be assumed (available on GCC 4.4 and  \
> +   * later) in order to make the object trivially   \
> +   * constructible like a fundamental integer type for  \
> +   * convenience.   \
> +   */   \
> +  T()   \
> +  { \
> +  } \
> +\
> +  T(BITSET_WORD x)  \
> +  { \
> + for (unsigned i = 0; i < BITSET_WORDS(N); i++, x = 0)  \
> +words[i] = x;   \
> +  } \
> +\
> +  EXPLICIT_CONVERSION   \
> +  operator bool() const \
> +  { \
> + for (unsigned i = 0; i < BITSET_WORDS(N); i++) \
> +if (words[i])   \
> +   return true; \
> + return false;  \
> +  } \
> +\
> +  friend bool   \
> +  operator==(const T &b, const T &c)\
> +  { \
> + return BITSET_EQUAL(b.words, c.words); \
> +  } \
> +\
> +  friend bool   \
> +  operator!=(const T &b, const T &c)\
> +  { \
> + return !(b == c);  \
> +  } \
> +\
> +  friend T  \
> +  operator~(const T &b) \
> +  { \
> + T c;   \
> + for (unsigned i = 0; i < BITSET_WORDS(N); i++) \
> +c.words[i] = ~b.words[i];   \
> + return c;  \
> +  } \
> +\
> +  T &   \
> +  operator|=(const T &b)\
> +  { \
> + for (unsigned i = 0; i < BITSET_WORDS(N); i++) \
> +words[i] |= b.words[i]; \
> + return *this;  \
> +  } \
> +\
> +  friend T  \
> +  operator|(const T &b

[Mesa-dev] [PATCH mesa] glsl: fix sizeof(pointer) bug

2018-02-15 Thread Eric Engestrom
Doesn't really change anything to the test though ¯\_(ツ)_/¯

CID: 1429511
Fixes: e8495646afb06a9dd7786 "glsl/tests: changes to test_disk_cache_create 
test"
Signed-off-by: Eric Engestrom 
---
 src/compiler/glsl/tests/cache_test.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/src/compiler/glsl/tests/cache_test.c 
b/src/compiler/glsl/tests/cache_test.c
index 3edd88b06a158d8c4b46..9d7bde2834c827a10757 100644
--- a/src/compiler/glsl/tests/cache_test.c
+++ b/src/compiler/glsl/tests/cache_test.c
@@ -186,7 +186,7 @@ static void *
 cache_exists(struct disk_cache *cache)
 {
uint8_t dummy_key[20];
-   char *data = "some test data";
+   char data[] = "some test data";
 
if (!cache)
   return NULL;
-- 
Cheers,
  Eric

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


Re: [Mesa-dev] [PATCH] radv: compact varyings after removing unused ones

2018-02-15 Thread Samuel Pitoiset



On 02/14/2018 11:24 PM, Timothy Arceri wrote:

On 15/02/18 01:10, Samuel Pitoiset wrote:

It makes no sense to compact before, and the description of
nir_compact_varyings() confirms that.


Reviewed-by: Timothy Arceri 

Your right this seems to be in the wrong place. There was a lot of 
restructuring around the time this landed so it seems to have been moved 
to the wrong location at some point. The original commit message (below) 
records a performance improvement it might be good to check if this 
improves things further.


     SaschaWillems Vulkan demo tessellation:

     ~4000fps -> ~4600fps


Mmmh, with this patch 5800->5200 fps on vega, I will have a look.







Polaris10:
Totals from affected shaders:
SGPRS: 106000 -> 105600 (-0.38 %)
VGPRS: 70704 -> 70640 (-0.09 %)
Spilled SGPRs: 892 -> 878 (-1.57 %)
Code Size: 2826240 -> 2812476 (-0.49 %) bytes
Max Waves: 15909 -> 15899 (-0.06 %)

Vega10:
Totals from affected shaders:
SGPRS: 103520 -> 103664 (0.14 %)
VGPRS: 70776 -> 70808 (0.05 %)
Spilled SGPRs: 740 -> 722 (-2.43 %)
Code Size: 2786076 -> 2772004 (-0.51 %) bytes
Max Waves: 18026 -> 18010 (-0.09 %)

Signed-off-by: Samuel Pitoiset 
---
  src/amd/vulkan/radv_pipeline.c | 9 +++--
  1 file changed, 3 insertions(+), 6 deletions(-)

diff --git a/src/amd/vulkan/radv_pipeline.c 
b/src/amd/vulkan/radv_pipeline.c

index 8f872e7c14..06e1ec5ae3 100644
--- a/src/amd/vulkan/radv_pipeline.c
+++ b/src/amd/vulkan/radv_pipeline.c
@@ -1525,6 +1525,9 @@ radv_link_shaders(struct radv_pipeline 
*pipeline, nir_shader **shaders)

 ordered_shaders[i - 1]);
  if (progress) {
+    nir_compact_varyings(ordered_shaders[i],
+ ordered_shaders[i - 1], true);
+
  nir_lower_global_vars_to_local(ordered_shaders[i]);
  radv_optimize_nir(ordered_shaders[i]);
  nir_lower_global_vars_to_local(ordered_shaders[i - 1]);
@@ -1715,7 +1718,6 @@ void radv_create_shaders(struct radv_pipeline 
*pipeline,

  last = i;
  }
-    int prev = -1;
  for (unsigned i = 0; i < MESA_SHADER_STAGES; ++i) {
  const VkPipelineShaderStageCreateInfo *stage = pStages[i];
@@ -1746,11 +1748,6 @@ void radv_create_shaders(struct radv_pipeline 
*pipeline,

  nir_lower_io_to_scalar_early(nir[i], mask);
  radv_optimize_nir(nir[i]);
  }
-
-    if (prev != -1) {
-    nir_compact_varyings(nir[prev], nir[i], true);
-    }
-    prev = i;
  }
  if (nir[MESA_SHADER_TESS_CTRL]) {


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


[Mesa-dev] [PATCH mesa] egl/wayland: check for invalid format index

2018-02-15 Thread Eric Engestrom
CID: 1429516
Fixes: d32b23f3830099a328b91 "egl/wayland: Add bpp to visual map"
Cc: Daniel Stone 
Signed-off-by: Eric Engestrom 
---
Daniel, `w` seemed like the "least bad" thing to return in this case;
would you prefer `0`?
---
 src/egl/drivers/dri2/platform_wayland.c | 5 +
 1 file changed, 5 insertions(+)

diff --git a/src/egl/drivers/dri2/platform_wayland.c 
b/src/egl/drivers/dri2/platform_wayland.c
index 20e47a5f6c15129d4fd8..73b29c96e5b83ff184d9 100644
--- a/src/egl/drivers/dri2/platform_wayland.c
+++ b/src/egl/drivers/dri2/platform_wayland.c
@@ -1294,6 +1294,11 @@ dri2_wl_swrast_get_stride_for_format(int format, int w)
 {
int visual_idx = dri2_wl_visual_idx_from_shm_format(format);
 
+   if (visual_idx == -1) {
+  assert(!"unknown format");
+  return w;
+   }
+
return w * (dri2_wl_visuals[visual_idx].bpp / 8);
 }
 
-- 
Cheers,
  Eric

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


Re: [Mesa-dev] [PATCH] nir: add is_used_once for fmul(fexp2(a), fexp2(b)) to fexp2(fadd(a, b))

2018-02-15 Thread Samuel Pitoiset



On 02/15/2018 02:49 AM, Ian Romanick wrote:

On 02/14/2018 05:36 PM, Ian Romanick wrote:

Do you have shader-db results?  Did you try having only one is_used_once?


I think you sent out a hastebin link with results before, but it's not
loading now.


Ah yeah, the hastebin link is outdated. Timothy launched shader-db on 
Intel for me, I will ask him again.


Shader stats were good overall.




On 02/05/2018 07:07 AM, Samuel Pitoiset wrote:

Otherwise the code size increases because the original fexp2()
instructions can't be deleted.

Signed-off-by: Samuel Pitoiset 
---
  src/compiler/nir/nir_opt_algebraic.py | 2 +-
  1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/src/compiler/nir/nir_opt_algebraic.py 
b/src/compiler/nir/nir_opt_algebraic.py
index b30d1df199..d40d59b5cd 100644
--- a/src/compiler/nir/nir_opt_algebraic.py
+++ b/src/compiler/nir/nir_opt_algebraic.py
@@ -336,7 +336,7 @@ optimizations = [
 (('~flog2', ('frcp', a)), ('fneg', ('flog2', a))),
 (('~flog2', ('frsq', a)), ('fmul', -0.5, ('flog2', a))),
 (('~flog2', ('fpow', a, b)), ('fmul', b, ('flog2', a))),
-   (('~fmul', ('fexp2', a), ('fexp2', b)), ('fexp2', ('fadd', a, b))),
+   (('~fmul', ('fexp2(is_used_once)', a), ('fexp2(is_used_once)', b)), 
('fexp2', ('fadd', a, b))),
 # Division and reciprocal
 (('~fdiv', 1.0, a), ('frcp', a)),
 (('fdiv', a, b), ('fmul', a, ('frcp', b)), 'options->lower_fdiv'),



___
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 mesa] egl/wayland: check for invalid format index

2018-02-15 Thread Daniel Stone
Hi Eric,

On 15 February 2018 at 11:17, Eric Engestrom  wrote:
> Daniel, `w` seemed like the "least bad" thing to return in this case;
> would you prefer `0`?

I guess Coverity doesn't know it can never be invalid. We look up a
visual in the table using dri2_surf->format, whcih is only ever set
from the table itself when creating a surface. assert(visual_idx ==
-1) should be enough to please Coverity there I think.

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


[Mesa-dev] [Bug 104662] OpenGL 4.5 needs to be active by default instead of using 3.0 by default

2018-02-15 Thread bugzilla-daemon
https://bugs.freedesktop.org/show_bug.cgi?id=104662

--- Comment #4 from mirh  ---
https://lists.freedesktop.org/archives/mesa-dev/2018-February/185646.html

Compatibility context is very, very shyly advancing.. 
Maybe this bug should be renamed to just that?

-- 
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 0/6] OpenGL 3.1 + ARB_compatibility and related stuff (v2)

2018-02-15 Thread Marek Olšák
On Thu, Feb 15, 2018 at 3:40 AM, Dieter Nützel  wrote:
> For the series:
>
> Tested-by: Dieter Nützel 
>
> on RX580 with SPECviewperf from the phoronix test suite. ;-)
>
> Viewset Composite   Mulitsample Performance
> 3dsmax-0411.97  no result
> catia-02 9.19   no result
> ensight-03   not Successful
> maya-02  41.69  no result
> proe-04  6.82   no result
> sw-0115.09  no result
> tcvis-01 5.13   no result
> ugnx-01  13.66  no result
>
> Are these numbers 'right'?
> Any other (special) tests wanted?

I don't think there are apps that specifically use GL 3.1 + ARB_compatibility.

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


[Mesa-dev] [Bug 105103] Wayland master causes Mesa to fail to compile

2018-02-15 Thread bugzilla-daemon
https://bugs.freedesktop.org/show_bug.cgi?id=105103

--- Comment #2 from n3rdopolis  ---
That works!

-- 
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 105105] Suffixless KHR_robustness functions aren't exposed in ES 3.2

2018-02-15 Thread bugzilla-daemon
https://bugs.freedesktop.org/show_bug.cgi?id=105105

--- Comment #1 from Tapani Pälli  ---
It looks like these 2 tests fail for different reasons:

- 'readnpix' hits generic_nop (glapi issue)

- 'getnuniform', problem seems to be that according to Mesa these uniforms are
inactive and therefore no uniformstorage is available. I can see that linker
reserves explicit locations correctly (inputf : 11, inputi : 12, inputu : 13)
but opt_dead_code removes the variables:

--- 8< ---
Removed declaration of inputf@0x34f1f80
Removed declaration of inputu@0x34f26b0
Removed declaration of inputi@0x34f2540
--- 8< ---

If I modify opt_dead_code to not remove those variables the test passes. I
hacked it like this:

--- 8< ---
+if (entry->var->data.explicit_location)
+   continue;
--- 8< ---

It seems compiler/linker should realize that they are written to shared values
so we should not optimize those away.

-- 
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


[Mesa-dev] [ANNOUNCE] mesa 17.3.4

2018-02-15 Thread Emil Velikov
Mesa 17.3.4 is now available.

In this release we have:

Dozens of fixes in the i965, ANV and RADV drivers. Additionally
the r600, virgl, etnaviv and renderonly drivers have also seen some love.

The experimental Vulkan extension VK_KHX_multiview was disabled.

On the video decoding drivers side:
r600/radeonsi correctly handle new UVD/VCN firmware. The VA and OMX
state-trackers have some MPEG2 glitches resolved, while locking is correctly
handled in the error paths.

To top it up, the libGL module should build fine on non-dri and Darwin systems.


Andres Gomez (1):
  i965: perform 2 uploads with dual slot *64*PASSTHRU formats on gen<8

Bas Nieuwenhuizen (10):
  radv: Fix ordering issue in meta memory allocation failure path.
  radv: Fix memory allocation failure path in compute resolve init.
  radv: Fix freeing meta state if the device pipeline cache fails
to allocate.
  radv: Fix fragment resolve init memory allocation failure paths.
  radv: Fix bufimage failure deallocation.
  radv: Init variant entry with memset.
  radv: Don't allow 3d or 1d depth/stencil textures.
  ac/nir: Use instance_rate_inputs per attribute, not per variable.
  ac/nir: Use correct 32-bit component writemask for 64-bit SSBO stores.
  ac/nir: Fix vector extraction if source vector has >4 elements.

Boyuan Zhang (2):
  radeon/vcn: add and manage render picture list
  radeon/uvd: add and manage render picture list

Chuck Atkins (1):
  configure.ac: add missing llvm dependencies to .pc files

Dave Airlie (10):
  r600/sb: fix a bug emitting ar load from a constant.
  ac/nir: account for view index in the user sgpr allocation.
  radv: add fs_key meta format support to resolve passes.
  radv: don't use hw resolve for integer image formats
  radv: don't use hw resolves for r16g16 norm formats.
  radv: move spi_baryc_cntl to pipeline
  r600/sb: insert the else clause when we might depart from a loop
  radv: don't enable tc compat for d32s8 + 4/8 samples (v1.1)
  radv/gfx9: fix block compression texture views. (v2)
  virgl: also remove dimension on indirect.

Eleni Maria Stea (1):
  mesa: Fix function pointers initialization in status tracker

Emil Velikov (19):
  cherry-ignore: i965: Accept CONTEXT_ATTRIB_PRIORITY for brwCreateContext
  cherry-ignore: swr: refactor swr_create_screen to allow for
proper cleanup on error
  cherry-ignore: anv: add explicit 18.0 only nominations
  cherry-ignore: radv: fix sample_mask_in loading. (v3.1)
  cherry-ignore: meson: multiple fixes
  cherry-ignore: swr/rast: support llvm 3.9 type declarations
  Revert "cherry-ignore: intel/fs: Use the original destination
region for int MUL lowering"
  cherry-ignore: ac/nir: set amdgpu.uniform and invariant.load for UBOs
  cherry-ignore: add gen10 fixes
  cherry-ignore: add r600/amdgpu 18.0 nominations
  cherry-ignore: add i965 shader cache fixes
  cherry-ignore: nir: mark unused space in packed_tex_data
  radv: Stop advertising VK_KHX_multiview
  cherry-ignore: radv: Don't expose VK_KHX_multiview on android.
  configure.ac: correct driglx-direct help text
  cherry-ignore: add meson fix
  cherry-ignore: add a few more meson fixes
  Update version to 17.3.4
  docs: add release notes for 17.3.4

Eric Engestrom (1):
  radeon: remove left over dead code

Gert Wollny (1):
  r600/shader: Initialize max_driver_temp_used correctly for the first time

Grazvydas Ignotas (2):
  st/va: release held locks in error paths
  st/vdpau: release held lock in error path

Igor Gnatenko (1):
  link mesautil with pthreads

Indrajit Das (4):
  st/omx_bellagio: Update default intra matrix per MPEG2 spec
  radeon/uvd: update quantiser matrices only when requested
  radeon/vcn: update quantiser matrices only when requested
  st/va: clear pointers for mpeg2 quantiser matrices

Jason Ekstrand (19):
  i965: Call brw_cache_flush_for_render in predraw_resolve_framebuffer
  i965: Add more precise cache tracking helpers
  i965/blorp: Add more destination flushing
  i965: Track the depth and render caches separately
  i965: Track format and aux usage in the render cache
  Re-enable regular fast-clears (CCS_D) on gen9+
  i965/miptree: Refactor CCS_E and CCS_D cases in render_aux_usage
  i965/miptree: Add an explicit tiling parameter to create_for_bo
  i965/miptree: Use the tiling from the modifier instead of the BO
  i965/bufmgr: Add a create_from_prime_tiled function
  i965: Set tiling on BOs imported with modifiers
  i965/miptree: Take an aux_usage in prepare/finish_render
  i965/miptree: Add an aux_disabled parameter to render_aux_usage
  i965/surface_state: Drop brw_aux_surface_disabled
  intel/fs: Use the original destination region for int MUL lowering
  anv/pipeline: Don't look at blend state unless we have an attachment
 

Re: [Mesa-dev] [PATCH] radeonsi/nir: set TGSI_PROPERTY_FS_EARLY_DEPTH_STENCIL correctly

2018-02-15 Thread Marek Olšák
Reviewed-by: Marek Olšák 

Marek

On Thu, Feb 15, 2018 at 5:14 AM, Timothy Arceri  wrote:
> We set this for post_depth_coverage in addition to early_fragment_tests.
> ---
>
>  This doesn't fix any piglit tests but it's what the glsl->tgsi state
>  tracker does.
>
>  src/gallium/drivers/radeonsi/si_shader_nir.c | 3 ++-
>  1 file changed, 2 insertions(+), 1 deletion(-)
>
> diff --git a/src/gallium/drivers/radeonsi/si_shader_nir.c 
> b/src/gallium/drivers/radeonsi/si_shader_nir.c
> index 501e8bab03..8094f1f584 100644
> --- a/src/gallium/drivers/radeonsi/si_shader_nir.c
> +++ b/src/gallium/drivers/radeonsi/si_shader_nir.c
> @@ -292,7 +292,8 @@ void si_nir_scan_shader(const struct nir_shader *nir,
> }
>
> if (nir->info.stage == MESA_SHADER_FRAGMENT) {
> -   info->properties[TGSI_PROPERTY_FS_EARLY_DEPTH_STENCIL] = 
> nir->info.fs.early_fragment_tests;
> +   info->properties[TGSI_PROPERTY_FS_EARLY_DEPTH_STENCIL] =
> +   nir->info.fs.early_fragment_tests | 
> nir->info.fs.post_depth_coverage;
> info->properties[TGSI_PROPERTY_FS_POST_DEPTH_COVERAGE] = 
> nir->info.fs.post_depth_coverage;
>
> if (nir->info.fs.depth_layout != FRAG_DEPTH_LAYOUT_NONE) {
> --
> 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


[Mesa-dev] [Bug 105105] Suffixless KHR_robustness functions aren't exposed in ES 3.2

2018-02-15 Thread bugzilla-daemon
https://bugs.freedesktop.org/show_bug.cgi?id=105105

--- Comment #2 from Tapani Pälli  ---
(In reply to Tapani Pälli from comment #1)
> It seems compiler/linker should realize that they are written to shared
> values so we should not optimize those away.

and alternative theory: since we never write these out to any buffer maybe it
is just ok to optimize these away and test should be changed instead :)

-- 
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 mesa] dri: use a supported API in driCreateNewContext

2018-02-15 Thread Emil Velikov
On 15 February 2018 at 09:51, Eric Engestrom  wrote:
> On Wednesday, 2018-02-14 09:06:41 -0500, Ilia Mirkin wrote:
>> On Feb 14, 2018 7:38 AM, "Eric Engestrom"  wrote:
>>
>> From: Brendan King 
>>
>> Don't assume the screen supports OpenGL when creating a new context,
>> use an API that the screen supports.
>>
>> Signed-off-by: Brendan King 
>> Reviewed-by: Eric Engestrom 
>> [Eric: rebased on current git HEAD]
>> Signed-off-by: Eric Engestrom 
>> ---
>>  src/mesa/drivers/dri/common/dri_util.c | 14 +-
>>  1 file changed, 13 insertions(+), 1 deletion(-)
>>
>> diff --git a/src/mesa/drivers/dri/common/dri_util.c
>> b/src/mesa/drivers/dri/common/dri_util.c
>> index e6a7d2391a78c45d45a1..3f32b34132e75228e0e0 100644
>> --- a/src/mesa/drivers/dri/common/dri_util.c
>> +++ b/src/mesa/drivers/dri/common/dri_util.c
>> @@ -49,6 +49,7 @@
>>  #include "main/debug_output.h"
>>  #include "main/errors.h"
>>  #include "main/macros.h"
>> +#include "util/bitscan.h"
>>
>>  const char __dri2ConfigOptions[] =
>> DRI_CONF_BEGIN
>> @@ -325,7 +326,11 @@ driCreateContextAttribs(__DRIscreen *screen, int api,
>> mesa_api = API_OPENGLES;
>> break;
>>  case __DRI_API_GLES2:
>> +   ctx_config.major_version = 2;
>> +   mesa_api = API_OPENGLES2;
>> +   break;
>>  case __DRI_API_GLES3:
>> +   ctx_config.major_version = 3;
>>
>>
>> Are you sure about this change? Doesn't seem related, and I'm about 20%
>> sure there was some reason for the current thing.
>
> I take the point that these are two separate bugs, and I'll split the
> change and re-send, but I don't see the "reason for the current thing".
> I'm betting on the 80% :P
>
> Without this `major_version` being set, validate_context_version()
> further down could accept a gles3 context when only gles2 is supported,
> because `major_version` would be 1 for both and never `>2` or `>3`.
>
> This is normally be hidden by the fact an attribute list with
> __DRI_CTX_ATTRIB_MAJOR_VERSION would be passed, but
> driCreateNewContextForAPI() doesn't pass an attribute list, which was in
> turn hidden by driCreateNewContext() always requesting OPENGL, for which
> 1.0 is valid, if you support OpenGL (which a lot of dri drivers do, but
> we don't anymore).
>
Not quite sure about the version thingy, bth. IIRC the spec says that
you can get higher version, as long as it's compatible.
Thus using 2 for GLES2 doesn't sound right. I think this is simply
masking an existing bug coming from the second hunk below.

If we do need something like this, it should be handled right next to
were we handle the desktop GL case.

>>
>> mesa_api = API_OPENGLES2;
>> break;
>>  case __DRI_API_OPENGL_CORE:
>> @@ -514,7 +519,14 @@ static __DRIcontext *
>>  driCreateNewContext(__DRIscreen *screen, const __DRIconfig *config,
>>  __DRIcontext *shared, void *data)
>>  {
>> -return driCreateNewContextForAPI(screen, __DRI_API_OPENGL,
>> +int apifs;
>> +
>> +apifs = ffs(screen->api_mask);
>> +
>> +if (!apifs)
>> +return NULL;
>> +
>> +return driCreateNewContextForAPI(screen, apifs - 1,
>>   config, shared, data);

This doesn't seem right:
 - the __DRI_API_GL* to API_OPENGL* mapping is not linear
 - this ends up picking an fairly "arbitrary" API

Instead, I would address the callers to feed the correct API.
From a quick look you're getting hit by either the gbm or the loader one?

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


Re: [Mesa-dev] [Mesa-stable] [PATCH] egl/wayland: Always use in-tree wayland-egl-backend.h

2018-02-15 Thread Emil Velikov
On 15 February 2018 at 09:23, Daniel Stone  wrote:
> A recent patchset to Wayland[0] migrated Mesa's libwayland-egl backend
> into Wayland itself, so implementations could provide backends. Mesa
> still uses its own, and the two have already diverged[1].
>
> The include from egl_dri2.h could pick up either the installed Wayland
> wayland-egl-backend.h (with a 'driver_private' member), or the Mesa
> internal wayland-egl-backend.h (with a 'private' member), failing the
> build in the first instance.
>
> Add an explicit directory prefix to the include, so we always get our
> in-tree version.
>
> [0]: https://patchwork.freedesktop.org/series/31663/
> [1]: https://cgit.freedesktop.org/wayland/wayland/commit/?id=9fa60983b579
>
Hmm in hind-sight, one could have fixed the "C++ issue" in a backward
compatible manner.
Let me try that instead - otherwise we need to port this patch to
every mesa in existence :-\

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


Re: [Mesa-dev] [PATCH mesa] egl/wayland: check for invalid format index

2018-02-15 Thread Eric Engestrom
On Thursday, 2018-02-15 11:25:33 +, Daniel Stone wrote:
> Hi Eric,
> 
> On 15 February 2018 at 11:17, Eric Engestrom  
> wrote:
> > Daniel, `w` seemed like the "least bad" thing to return in this case;
> > would you prefer `0`?
> 
> I guess Coverity doesn't know it can never be invalid. We look up a
> visual in the table using dri2_surf->format, whcih is only ever set
> from the table itself when creating a surface. assert(visual_idx ==
> -1) should be enough to please Coverity there I think.

(I assume you meant `!=`)

Sounds like assume() might be better than assert() though, if it's
actually impossible (barring internal bug), so that the compiler can
drop the `== -1` paths.
Sending a v2 in a minute :)

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


Re: [Mesa-dev] [PATCH mesa] dri: use a supported API in driCreateNewContext

2018-02-15 Thread Ilia Mirkin
On Thu, Feb 15, 2018 at 8:10 AM, Emil Velikov  wrote:
> On 15 February 2018 at 09:51, Eric Engestrom  
> wrote:
>> On Wednesday, 2018-02-14 09:06:41 -0500, Ilia Mirkin wrote:
>>> On Feb 14, 2018 7:38 AM, "Eric Engestrom"  wrote:
>>>
>>> From: Brendan King 
>>>
>>> Don't assume the screen supports OpenGL when creating a new context,
>>> use an API that the screen supports.
>>>
>>> Signed-off-by: Brendan King 
>>> Reviewed-by: Eric Engestrom 
>>> [Eric: rebased on current git HEAD]
>>> Signed-off-by: Eric Engestrom 
>>> ---
>>>  src/mesa/drivers/dri/common/dri_util.c | 14 +-
>>>  1 file changed, 13 insertions(+), 1 deletion(-)
>>>
>>> diff --git a/src/mesa/drivers/dri/common/dri_util.c
>>> b/src/mesa/drivers/dri/common/dri_util.c
>>> index e6a7d2391a78c45d45a1..3f32b34132e75228e0e0 100644
>>> --- a/src/mesa/drivers/dri/common/dri_util.c
>>> +++ b/src/mesa/drivers/dri/common/dri_util.c
>>> @@ -49,6 +49,7 @@
>>>  #include "main/debug_output.h"
>>>  #include "main/errors.h"
>>>  #include "main/macros.h"
>>> +#include "util/bitscan.h"
>>>
>>>  const char __dri2ConfigOptions[] =
>>> DRI_CONF_BEGIN
>>> @@ -325,7 +326,11 @@ driCreateContextAttribs(__DRIscreen *screen, int api,
>>> mesa_api = API_OPENGLES;
>>> break;
>>>  case __DRI_API_GLES2:
>>> +   ctx_config.major_version = 2;
>>> +   mesa_api = API_OPENGLES2;
>>> +   break;
>>>  case __DRI_API_GLES3:
>>> +   ctx_config.major_version = 3;
>>>
>>>
>>> Are you sure about this change? Doesn't seem related, and I'm about 20%
>>> sure there was some reason for the current thing.
>>
>> I take the point that these are two separate bugs, and I'll split the
>> change and re-send, but I don't see the "reason for the current thing".
>> I'm betting on the 80% :P
>>
>> Without this `major_version` being set, validate_context_version()
>> further down could accept a gles3 context when only gles2 is supported,
>> because `major_version` would be 1 for both and never `>2` or `>3`.
>>
>> This is normally be hidden by the fact an attribute list with
>> __DRI_CTX_ATTRIB_MAJOR_VERSION would be passed, but
>> driCreateNewContextForAPI() doesn't pass an attribute list, which was in
>> turn hidden by driCreateNewContext() always requesting OPENGL, for which
>> 1.0 is valid, if you support OpenGL (which a lot of dri drivers do, but
>> we don't anymore).
>>
> Not quite sure about the version thingy, bth. IIRC the spec says that
> you can get higher version, as long as it's compatible.
> Thus using 2 for GLES2 doesn't sound right. I think this is simply
> masking an existing bug coming from the second hunk below.
>
> If we do need something like this, it should be handled right next to
> were we handle the desktop GL case.

As I recall, this code is a lot more subtle than it looks, and I'm
fairly sure correct as-is. Please ensure that you understand how it's
getting called before trying to change it. (e.g. I don't think
__DRI_API_GLES3 is used today, and it's a compat holdover, which we
decided should go to the same handling as GLES2.) All this stuff needs
to get checked *very* carefully.
___
mesa-dev mailing list
mesa-dev@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/mesa-dev


Re: [Mesa-dev] [PATCH mesa] glsl: fix sizeof(pointer) bug

2018-02-15 Thread Brian Paul

On 02/15/2018 04:01 AM, Eric Engestrom wrote:

Doesn't really change anything to the test though ¯\_(ツ)_/¯

CID: 1429511
Fixes: e8495646afb06a9dd7786 "glsl/tests: changes to test_disk_cache_create 
test"
Signed-off-by: Eric Engestrom 
---
  src/compiler/glsl/tests/cache_test.c | 2 +-
  1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/src/compiler/glsl/tests/cache_test.c 
b/src/compiler/glsl/tests/cache_test.c
index 3edd88b06a158d8c4b46..9d7bde2834c827a10757 100644
--- a/src/compiler/glsl/tests/cache_test.c
+++ b/src/compiler/glsl/tests/cache_test.c
@@ -186,7 +186,7 @@ static void *
  cache_exists(struct disk_cache *cache)
  {
 uint8_t dummy_key[20];
-   char *data = "some test data";
+   char data[] = "some test data";
  
 if (!cache)

return NULL;



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


[Mesa-dev] [PATCH mesa v2] egl/wayland: check for invalid format index

2018-02-15 Thread Eric Engestrom
v2: just tell the compiler to assume the format will always be found, as
it comes from the table itself to begin with.

CID: 1429516
Fixes: d32b23f3830099a328b91 "egl/wayland: Add bpp to visual map"
Cc: Daniel Stone 
Signed-off-by: Eric Engestrom 
---
 src/egl/drivers/dri2/platform_wayland.c | 2 ++
 1 file changed, 2 insertions(+)

diff --git a/src/egl/drivers/dri2/platform_wayland.c 
b/src/egl/drivers/dri2/platform_wayland.c
index 20e47a5f6c15129d4fd8..cbe4a8edbc4b0486fffa 100644
--- a/src/egl/drivers/dri2/platform_wayland.c
+++ b/src/egl/drivers/dri2/platform_wayland.c
@@ -1294,6 +1294,8 @@ dri2_wl_swrast_get_stride_for_format(int format, int w)
 {
int visual_idx = dri2_wl_visual_idx_from_shm_format(format);
 
+   assume(visual_idx != -1);
+
return w * (dri2_wl_visuals[visual_idx].bpp / 8);
 }
 
-- 
Cheers,
  Eric

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


[Mesa-dev] [PATCH] i965: Fix aux-surface size check

2018-02-15 Thread Daniel Stone
The previous commit reworked the checks intel_from_planar() to check the
right individual cases for regular/planar/aux buffers, and do size
checks in all cases.

Unfortunately, the aux size check was broken, and required the aux
surface to be allocated with the correct aux stride, but full image
height (!).

As the ISL aux surface is not recorded in the DRIimage, we cannot easily
access it to check. Instead, store the aux size from when we do have the
ISL surface to hand, and check against that later when we go to access
the aux surface.

Signed-off-by: Daniel Stone 
Fixes: c2c4e5bae3ba ("i965: Fix bugs in intel_from_planar")
Cc: Jason Ekstrand 
---
 src/mesa/drivers/dri/i965/intel_image.h  |  3 +++
 src/mesa/drivers/dri/i965/intel_screen.c | 10 +++---
 2 files changed, 10 insertions(+), 3 deletions(-)

diff --git a/src/mesa/drivers/dri/i965/intel_image.h 
b/src/mesa/drivers/dri/i965/intel_image.h
index 78d689a11a3..a8193c6def9 100644
--- a/src/mesa/drivers/dri/i965/intel_image.h
+++ b/src/mesa/drivers/dri/i965/intel_image.h
@@ -98,6 +98,9 @@ struct __DRIimageRec {
/** Pitch of the auxiliary compression surface. */
uint32_t aux_pitch;
 
+   /** Total size in bytes of the auxiliary compression surface. */
+   uint32_t aux_size;
+
/**
 * Provided by EGL_EXT_image_dma_buf_import.
 * \{
diff --git a/src/mesa/drivers/dri/i965/intel_screen.c 
b/src/mesa/drivers/dri/i965/intel_screen.c
index 1c0fffa2e96..a21b08e51b1 100644
--- a/src/mesa/drivers/dri/i965/intel_screen.c
+++ b/src/mesa/drivers/dri/i965/intel_screen.c
@@ -750,6 +750,7 @@ intel_create_image_common(__DRIscreen *dri_screen,
if (aux_surf.size) {
   image->aux_offset = surf.size;
   image->aux_pitch = aux_surf.row_pitch;
+  image->aux_size = aux_surf.size;
}
 
return image;
@@ -1312,7 +1313,7 @@ intel_query_dma_buf_modifiers(__DRIscreen *_screen, int 
fourcc, int max,
 static __DRIimage *
 intel_from_planar(__DRIimage *parent, int plane, void *loaderPrivate)
 {
-int width, height, offset, stride, dri_format;
+int width, height, offset, stride, size, dri_format;
 __DRIimage *image;
 
 if (parent == NULL)
@@ -1331,24 +1332,27 @@ intel_from_planar(__DRIimage *parent, int plane, void 
*loaderPrivate)
int index = f->planes[plane].buffer_index;
offset = parent->offsets[index];
stride = parent->strides[index];
+   size = height * stride;
 } else if (plane == 0) {
/* The only plane of a non-planar image: copy the parent definition
 * directly. */
dri_format = parent->dri_format;
offset = parent->offset;
stride = parent->pitch;
+   size = height * stride;
 } else if (plane == 1 && parent->modifier != DRM_FORMAT_MOD_INVALID &&
isl_drm_modifier_has_aux(parent->modifier)) {
/* Auxiliary plane */
dri_format = parent->dri_format;
offset = parent->aux_offset;
stride = parent->aux_pitch;
+   size = parent->aux_size;
 } else {
return NULL;
 }
 
-if (offset + height * stride > parent->bo->size) {
-   _mesa_warning(NULL, "intel_create_sub_image: subimage out of bounds");
+if (offset + size > parent->bo->size) {
+   _mesa_warning(NULL, "intel_from_planar: subimage out of bounds");
return NULL;
 }
 
-- 
2.14.3

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


Re: [Mesa-dev] [PATCH mesa] glsl: fix sizeof(pointer) bug

2018-02-15 Thread Tapani Pälli

Reviewed-by: Tapani Pälli 

On 15.02.2018 13:01, Eric Engestrom wrote:

Doesn't really change anything to the test though ¯\_(ツ)_/¯

CID: 1429511
Fixes: e8495646afb06a9dd7786 "glsl/tests: changes to test_disk_cache_create 
test"
Signed-off-by: Eric Engestrom 
---
  src/compiler/glsl/tests/cache_test.c | 2 +-
  1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/src/compiler/glsl/tests/cache_test.c 
b/src/compiler/glsl/tests/cache_test.c
index 3edd88b06a158d8c4b46..9d7bde2834c827a10757 100644
--- a/src/compiler/glsl/tests/cache_test.c
+++ b/src/compiler/glsl/tests/cache_test.c
@@ -186,7 +186,7 @@ static void *
  cache_exists(struct disk_cache *cache)
  {
 uint8_t dummy_key[20];
-   char *data = "some test data";
+   char data[] = "some test data";
  
 if (!cache)

return NULL;


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


Re: [Mesa-dev] [PATCH mesa v2] egl/wayland: check for invalid format index

2018-02-15 Thread Daniel Stone
Hi Eric,

On 15 February 2018 at 15:11, Eric Engestrom  wrote:
> v2: just tell the compiler to assume the format will always be found, as
> it comes from the table itself to begin with.

Thanks, assume() is a new one on me!

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


[Mesa-dev] [PATCH 05/11] anv/image: Add support for modifiers for WSI

2018-02-15 Thread Daniel Stone
From: Jason Ekstrand 

This adds support for the modifiers portion of the WSI "extension".

Reviewed-by: Daniel Stone 
Signed-off-by: Daniel Stone 
---
 src/intel/vulkan/anv_formats.c | 38 ++
 src/intel/vulkan/anv_image.c   | 40 
 src/intel/vulkan/anv_private.h |  6 ++
 src/intel/vulkan/anv_wsi.c | 24 
 4 files changed, 104 insertions(+), 4 deletions(-)

diff --git a/src/intel/vulkan/anv_formats.c b/src/intel/vulkan/anv_formats.c
index 4075ae8e620..9c52ad5acbd 100644
--- a/src/intel/vulkan/anv_formats.c
+++ b/src/intel/vulkan/anv_formats.c
@@ -22,6 +22,7 @@
  */
 
 #include "anv_private.h"
+#include "drm_fourcc.h"
 #include "vk_enum_to_str.h"
 #include "vk_format_info.h"
 #include "vk_util.h"
@@ -651,6 +652,38 @@ get_buffer_format_features(const struct gen_device_info 
*devinfo,
return flags;
 }
 
+static void
+get_wsi_format_modifier_properties_list(const struct anv_physical_device 
*physical_device,
+VkFormat vk_format,
+struct 
wsi_format_modifier_properties_list *list)
+{
+   const struct anv_format *anv_format = anv_get_format(vk_format);
+
+   VK_OUTARRAY_MAKE(out, list->modifier_properties, &list->modifier_count);
+
+   /* This is a simplified list where all the modifiers are available */
+   assert(vk_format == VK_FORMAT_B8G8R8_SRGB ||
+  vk_format == VK_FORMAT_B8G8R8_UNORM ||
+  vk_format == VK_FORMAT_B8G8R8A8_SRGB ||
+  vk_format == VK_FORMAT_B8G8R8A8_UNORM);
+
+   uint64_t modifiers[] = {
+  DRM_FORMAT_MOD_LINEAR,
+  I915_FORMAT_MOD_X_TILED,
+  I915_FORMAT_MOD_Y_TILED,
+   };
+
+   for (uint32_t i = 0; i < ARRAY_SIZE(modifiers); i++) {
+  vk_outarray_append(&out, mod_props) {
+ mod_props->modifier = modifiers[i];
+ if (isl_drm_modifier_has_aux(modifiers[i]))
+mod_props->modifier_plane_count = 2;
+ else
+mod_props->modifier_plane_count = anv_format->n_planes;
+  }
+   }
+}
+
 void anv_GetPhysicalDeviceFormatProperties(
 VkPhysicalDevicephysicalDevice,
 VkFormatvk_format,
@@ -677,11 +710,16 @@ void anv_GetPhysicalDeviceFormatProperties2KHR(
 VkFormatformat,
 VkFormatProperties2KHR* pFormatProperties)
 {
+   ANV_FROM_HANDLE(anv_physical_device, physical_device, physicalDevice);
anv_GetPhysicalDeviceFormatProperties(physicalDevice, format,
  &pFormatProperties->formatProperties);
 
vk_foreach_struct(ext, pFormatProperties->pNext) {
   switch (ext->sType) {
+  case VK_STRUCTURE_TYPE_WSI_FORMAT_MODIFIER_PROPERTIES_LIST_MESA:
+ get_wsi_format_modifier_properties_list(physical_device, format,
+ (void *)ext);
+ break;
   default:
  anv_debug_ignored_stype(ext->sType);
  break;
diff --git a/src/intel/vulkan/anv_image.c b/src/intel/vulkan/anv_image.c
index c3d1810cee8..a2bae7b3827 100644
--- a/src/intel/vulkan/anv_image.c
+++ b/src/intel/vulkan/anv_image.c
@@ -508,6 +508,38 @@ make_surface(const struct anv_device *dev,
return VK_SUCCESS;
 }
 
+static uint32_t
+score_drm_format_mod(uint64_t modifier)
+{
+   switch (modifier) {
+   case DRM_FORMAT_MOD_LINEAR: return 1;
+   case I915_FORMAT_MOD_X_TILED: return 2;
+   case I915_FORMAT_MOD_Y_TILED: return 3;
+   default: unreachable("bad DRM format modifier");
+   }
+}
+
+static const struct isl_drm_modifier_info *
+choose_drm_format_mod(const struct anv_physical_device *device,
+  uint32_t modifier_count, const uint64_t *modifiers)
+{
+   uint64_t best_mod = UINT64_MAX;
+   uint32_t best_score = 0;
+
+   for (uint32_t i = 0; i < modifier_count; ++i) {
+  uint32_t score = score_drm_format_mod(modifiers[i]);
+  if (score > best_score) {
+ best_mod = modifiers[i];
+ best_score = score;
+  }
+   }
+
+   if (best_score > 0)
+  return isl_drm_modifier_get_info(best_mod);
+   else
+  return NULL;
+}
+
 VkResult
 anv_image_create(VkDevice _device,
  const struct anv_image_create_info *create_info,
@@ -524,6 +556,12 @@ anv_image_create(VkDevice _device,
 
const struct wsi_image_create_info *wsi_info =
   vk_find_struct_const(pCreateInfo->pNext, WSI_IMAGE_CREATE_INFO_MESA);
+   if (wsi_info && wsi_info->modifier_count > 0) {
+  isl_mod_info = choose_drm_format_mod(&device->instance->physicalDevice,
+   wsi_info->modifier_count,
+   wsi_info->modifiers);
+  assert(isl_mod_info);
+   }
 
anv_assert(pCreateInfo->mipLevels > 0);
anv_assert(pCreateInfo->arrayLayers > 0);
@@ -549,6 +587,8 @@ anv_image_create(VkDevice _device,
image->tiling = pCre

[Mesa-dev] [PATCH 04/11] anv/image: Separate modifiers from legacy scanout

2018-02-15 Thread Daniel Stone
From: Jason Ekstrand 

For a bit there, we had a bug in i965 where it ignored the tiling of the
modifier and used the one from the BO instead.  At one point, we though
this was best fixed by setting a tiling from Vulkan.  However, we've
decided that i965 was just doing the wrong thing and have fixed it as of
50485723523d2948a44570ba110f02f726f86a54.

The old assumptions also affected the solution we used for legacy
scanout in Vulkan.  Instead of treating it specially, we just treated it
like a modifier like we do in GL.  This commit goes back to making it
it's own thing so that it's clear in the driver when we're using
modifiers and when we're using legacy paths.

v2 (Jason Ekstrand):
 - Rename legacy_scanout to needs_set_tiling

Reviewed-by: Daniel Stone 
Signed-off-by: Daniel Stone 
---
 src/intel/vulkan/anv_device.c  | 22 ++
 src/intel/vulkan/anv_image.c   | 27 ---
 src/intel/vulkan/anv_private.h | 10 +++---
 3 files changed, 21 insertions(+), 38 deletions(-)

diff --git a/src/intel/vulkan/anv_device.c b/src/intel/vulkan/anv_device.c
index 2c2cd0b2d42..38909e5a4ae 100644
--- a/src/intel/vulkan/anv_device.c
+++ b/src/intel/vulkan/anv_device.c
@@ -1832,21 +1832,10 @@ VkResult anv_AllocateMemory(
   if (dedicated_info && dedicated_info->image != VK_NULL_HANDLE) {
  ANV_FROM_HANDLE(anv_image, image, dedicated_info->image);
 
- /* For images using modifiers, we require a dedicated allocation
-  * and we set the BO tiling to match the tiling of the underlying
-  * modifier.  This is a bit unfortunate as this is completely
-  * pointless for Vulkan.  However, GL needs to be able to map things
-  * so it needs the tiling to be set.  The only way to do this in a
-  * non-racy way is to set the tiling in the creator of the BO so that
-  * makes it our job.
-  *
-  * One of these days, once the GL driver learns to not map things
-  * through the GTT in random places, we can drop this and start
-  * allowing multiple modified images in the same BO.
+ /* Some legacy (non-modifiers) consumers need the tiling to be set on
+  * the BO.  In this case, we have a dedicated allocation.
   */
- if (image->drm_format_mod != DRM_FORMAT_MOD_INVALID) {
-assert(isl_drm_modifier_get_info(image->drm_format_mod)->tiling ==
-   image->planes[0].surface.isl.tiling);
+ if (image->needs_set_tiling) {
 const uint32_t i915_tiling =
isl_tiling_to_i915_tiling(image->planes[0].surface.isl.tiling);
 int ret = anv_gem_set_tiling(device, mem->bo->gem_handle,
@@ -2214,8 +2203,9 @@ void anv_GetImageMemoryRequirements2KHR(
   switch (ext->sType) {
   case VK_STRUCTURE_TYPE_MEMORY_DEDICATED_REQUIREMENTS_KHR: {
  VkMemoryDedicatedRequirementsKHR *requirements = (void *)ext;
- if (image->drm_format_mod != DRM_FORMAT_MOD_INVALID) {
-/* Require a dedicated allocation for images with modifiers.
+ if (image->needs_set_tiling) {
+/* If we need to set the tiling for external consumers, we need a
+ * dedicated allocation.
  *
  * See also anv_AllocateMemory.
  */
diff --git a/src/intel/vulkan/anv_image.c b/src/intel/vulkan/anv_image.c
index a297cc47320..c3d1810cee8 100644
--- a/src/intel/vulkan/anv_image.c
+++ b/src/intel/vulkan/anv_image.c
@@ -93,7 +93,8 @@ choose_isl_surf_usage(VkImageCreateFlags vk_create_flags,
 
 static isl_tiling_flags_t
 choose_isl_tiling_flags(const struct anv_image_create_info *anv_info,
-const struct isl_drm_modifier_info *isl_mod_info)
+const struct isl_drm_modifier_info *isl_mod_info,
+bool legacy_scanout)
 {
const VkImageCreateInfo *base_info = anv_info->vk_info;
isl_tiling_flags_t flags = 0;
@@ -112,6 +113,9 @@ choose_isl_tiling_flags(const struct anv_image_create_info 
*anv_info,
if (anv_info->isl_tiling_flags)
   flags &= anv_info->isl_tiling_flags;
 
+   if (legacy_scanout)
+  flags &= ISL_TILING_LINEAR_BIT | ISL_TILING_X_BIT;
+
if (isl_mod_info)
   flags &= 1 << isl_mod_info->tiling;
 
@@ -504,19 +508,6 @@ make_surface(const struct anv_device *dev,
return VK_SUCCESS;
 }
 
-static const struct isl_drm_modifier_info *
-get_legacy_scanout_drm_format_mod(VkImageTiling tiling)
-{
-   switch (tiling) {
-   case VK_IMAGE_TILING_OPTIMAL:
-  return isl_drm_modifier_get_info(I915_FORMAT_MOD_X_TILED);
-   case VK_IMAGE_TILING_LINEAR:
-  return isl_drm_modifier_get_info(DRM_FORMAT_MOD_LINEAR);
-   default:
-  unreachable("bad VkImageTiling");
-   }
-}
-
 VkResult
 anv_image_create(VkDevice _device,
  const struct anv_image_create_info *create_info,
@@ -533,8 +524,6 @@ anv_image_create(VkDevice _device,
 
const struct wsi_image_create_info *wsi_inf

[Mesa-dev] [PATCH v10 00/11] Modifiers for X11 EGL/Vulkan, WL/VK

2018-02-15 Thread Daniel Stone
Hi,
I don't actually know which revision we're up to by now, so I decided to
rebase at v10.

This is a slight evolution of Jason's 16-patch series posted on Feb 9th.
It adds:
  - support for multi-plane buffers and modifiers to the Vulkan WSI
  - support for zwp_linux_dmabuf_v1 to the Vulkan Wayland WSI,
enabling multi-plane buffers and modifiers on Wayland
  - support for DRI3 v1.1 to the Vulkan X11 WSI, enabling multi-plane
buffers and modifiers on X11
  - support for DRI3 v1.1 to EGL/GLX X11, ditto

The first three patches have been acked (or explicitly not-not-acked) by
Dave for RADV, and Jason and I have been back and forth over the first
five long enough that they should in theory be perfect by now.

Patch 6 is new. When we discussed having a src/wsi/ for common winsys
code (like we have src/loader/loader_dri3_helper.c at the moment, not
really related to the loader but just for shared utility) that was
deemed to not be a good idea, so I moved dmabuf to wayland-drm, even
though it's not that.

Patch 7 has been carried for a while, is a pretty straightforward port
of the EGL code we've been shipping, and should be easy to land, but it
depends on how we end up bikeshedding the build system.

Patches 8-11 implement multi-buffer/modifier support for X11 in two
stages. Firstly, support for the DRI3 v1.1 and Present v1.2 protocols
has been added. DRI3 v1.1 is the X11 protocol equivalent of
EGL_EXT_image_dma_buf_import_modifiers: it allows us to query the set of
supported format modifiers from the server, and send/receive multi-plane
buffers with modifiers as well. Present v1.2 adds a 'suboptimal copy'
mode: a hint that the presentation was not a flip, but if the client
reallocated then flipping would be possible.

These patches have all been tested with today's submission to xorg-devel@
by Louis-Francis Ratté-Boullianne, in various combinations of new/old.
In order to build the Mesa client side, you will need to have the
xcb-proto patches from that submission, rebuild libxcb against that
xcb-proto (making sure your PKG_CONFIG_PATH includes
$xcb_proto_prefix/share/pkgconfig!), and then rebuild Mesa against the
new libxcb.

The X11 patches all include #ifdefs for the new DRI3 and Present
protocol, to make it easier to test it when it's not running. These will
be removed when the protocol is merged upstream, which is hopefully
soon.

Cheers,
Daniel

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


[Mesa-dev] [PATCH 11/11] egl/x11: Re-allocate buffers if format is suboptimal

2018-02-15 Thread Daniel Stone
From: Louis-Francis Ratté-Boulianne 

If PresentCompleteNotify event says the pixmap was presented
with mode PresentCompleteModeSuboptimalCopy, it means the pixmap
could possibly have been flipped instead if allocated with a
different format/modifier.

Signed-off-by: Louis-Francis Ratté-Boulianne 
Reviewed-by: Daniel Stone 
Signed-off-by: Daniel Stone 
---
 src/egl/drivers/dri2/egl_dri2.c  |  2 ++
 src/egl/drivers/dri2/egl_dri2.h  |  2 ++
 src/egl/drivers/dri2/platform_x11_dri3.c |  3 +++
 src/loader/loader_dri3_helper.c  | 37 
 src/loader/loader_dri3_helper.h  |  2 ++
 src/loader/meson.build   |  2 +-
 6 files changed, 43 insertions(+), 5 deletions(-)

diff --git a/src/egl/drivers/dri2/egl_dri2.c b/src/egl/drivers/dri2/egl_dri2.c
index 9a7e43bafb6..921d1a52931 100644
--- a/src/egl/drivers/dri2/egl_dri2.c
+++ b/src/egl/drivers/dri2/egl_dri2.c
@@ -885,6 +885,8 @@ dri2_setup_extensions(_EGLDisplay *disp)
dri2_dpy->multibuffers_available =
   (dri2_dpy->dri3_major_version > 1 || (dri2_dpy->dri3_major_version == 1 
&&
 dri2_dpy->dri3_minor_version >= 
1)) &&
+  (dri2_dpy->present_major_version > 1 || (dri2_dpy->present_major_version 
== 1 &&
+   dri2_dpy->present_minor_version 
>= 1)) &&
   (dri2_dpy->image && dri2_dpy->image->base.version >= 15);
 #endif
 
diff --git a/src/egl/drivers/dri2/egl_dri2.h b/src/egl/drivers/dri2/egl_dri2.h
index 00c4768d421..bd637f73c9d 100644
--- a/src/egl/drivers/dri2/egl_dri2.h
+++ b/src/egl/drivers/dri2/egl_dri2.h
@@ -202,6 +202,8 @@ struct dri2_egl_display
bool multibuffers_available;
int  dri3_major_version;
int  dri3_minor_version;
+   int  present_major_version;
+   int  present_minor_version;
struct loader_dri3_extensions loader_dri3_ext;
 #endif
 #endif
diff --git a/src/egl/drivers/dri2/platform_x11_dri3.c 
b/src/egl/drivers/dri2/platform_x11_dri3.c
index 15c349eb828..ae2588d04c4 100644
--- a/src/egl/drivers/dri2/platform_x11_dri3.c
+++ b/src/egl/drivers/dri2/platform_x11_dri3.c
@@ -557,6 +557,9 @@ dri3_x11_connect(struct dri2_egl_display *dri2_dpy)
   free(error);
   return EGL_FALSE;
}
+
+   dri2_dpy->present_major_version = present_query->major_version;
+   dri2_dpy->present_minor_version = present_query->minor_version;
free(present_query);
 
dri2_dpy->fd = loader_dri3_open(dri2_dpy->conn, dri2_dpy->screen->root, 0);
diff --git a/src/loader/loader_dri3_helper.c b/src/loader/loader_dri3_helper.c
index 038216c2637..855ec5ce343 100644
--- a/src/loader/loader_dri3_helper.c
+++ b/src/loader/loader_dri3_helper.c
@@ -34,6 +34,8 @@
 #include 
 
 #include "loader_dri3_helper.h"
+#include "util/macros.h"
+#include "drm_fourcc.h"
 
 /* From xmlpool/options.h, user exposed so should be stable */
 #define DRI_CONF_VBLANK_NEVER 0
@@ -373,11 +375,25 @@ dri3_handle_present_event(struct loader_dri3_drawable 
*draw,
 draw->recv_sbc -= 0x1;
  switch (ce->mode) {
  case XCB_PRESENT_COMPLETE_MODE_FLIP:
-draw->flipping = true;
+if (!draw->flipping) {
+   draw->flipping = true;
+   for (int b = 0; b < ARRAY_SIZE(draw->buffers); b++) {
+  if (draw->buffers[b])
+ draw->buffers[b]->realloc_suboptimal = true;
+   }
+}
 break;
  case XCB_PRESENT_COMPLETE_MODE_COPY:
 draw->flipping = false;
 break;
+#if XCB_PRESENT_MAJOR_VERSION > 1 || (XCB_PRESENT_MAJOR_VERSION == 1 && 
XCB_PRESENT_MINOR_VERSION >= 1)
+ case XCB_PRESENT_COMPLETE_MODE_SUBOPTIMAL_COPY:
+draw->flipping = false;
+for (int b = 0; b < ARRAY_SIZE(draw->buffers); b++) {
+   if (draw->buffers[b])
+  draw->buffers[b]->suboptimal = true;
+}
+#endif
  }
 
  if (draw->vtable->show_fps)
@@ -885,6 +901,11 @@ loader_dri3_swap_buffers_msc(struct loader_dri3_drawable 
*draw,
   if (!loader_dri3_have_image_blit(draw) && draw->cur_blit_source != -1)
  options |= XCB_PRESENT_OPTION_COPY;
 
+#if XCB_PRESENT_MAJOR_VERSION > 1 || (XCB_PRESENT_MAJOR_VERSION == 1 && 
XCB_PRESENT_MINOR_VERSION >= 1)
+  if (draw->multiplanes_available)
+ options  |= XCB_PRESENT_OPTION_SUBOPTIMAL;
+#endif
+
   back->busy = 1;
   back->last_swap = draw->send_sbc;
   xcb_present_pixmap(draw->conn,
@@ -1287,6 +1308,8 @@ dri3_alloc_render_buffer(struct loader_dri3_drawable 
*draw, unsigned int format,
buffer->shm_fence = shm_fence;
buffer->width = width;
buffer->height = height;
+   buffer->suboptimal = false;
+   buffer->realloc_suboptimal = true;
 
/* Mark the buffer as idle
 */
@@ -1629,11 +1652,12 @@ dri3_get_buffer(__DRIdrawable *driD

[Mesa-dev] [PATCH 10/11] egl/x11: Support DRI3 v1.1

2018-02-15 Thread Daniel Stone
From: Louis-Francis Ratté-Boulianne 

Add support for DRI3 v1.1, which allows pixmaps to be backed by
multi-planar buffers, or those with format modifiers. This is both
for allocating render buffers, as well as EGLImage imports from a
native pixmap (EGL_NATIVE_PIXMAP_KHR).

Signed-off-by: Louis-Francis Ratté-Boulianne 
Reviewed-by: Eric Engestrom 
Reviewed-by: Emil Velikov 
Reviewed-by: Daniel Stone 
Signed-off-by: Daniel Stone 
---
 src/egl/drivers/dri2/egl_dri2.c  |   7 +
 src/egl/drivers/dri2/egl_dri2.h  |   3 +
 src/egl/drivers/dri2/platform_x11_dri3.c | 105 +--
 src/glx/dri3_glx.c   |  10 +-
 src/loader/loader_dri3_helper.c  | 306 +++
 src/loader/loader_dri3_helper.h  |  17 +-
 6 files changed, 393 insertions(+), 55 deletions(-)

diff --git a/src/egl/drivers/dri2/egl_dri2.c b/src/egl/drivers/dri2/egl_dri2.c
index 17b646e7ede..9a7e43bafb6 100644
--- a/src/egl/drivers/dri2/egl_dri2.c
+++ b/src/egl/drivers/dri2/egl_dri2.c
@@ -881,6 +881,13 @@ dri2_setup_extensions(_EGLDisplay *disp)
if (!dri2_bind_extensions(dri2_dpy, mandatory_core_extensions, extensions, 
false))
   return EGL_FALSE;
 
+#ifdef HAVE_DRI3
+   dri2_dpy->multibuffers_available =
+  (dri2_dpy->dri3_major_version > 1 || (dri2_dpy->dri3_major_version == 1 
&&
+dri2_dpy->dri3_minor_version >= 
1)) &&
+  (dri2_dpy->image && dri2_dpy->image->base.version >= 15);
+#endif
+
dri2_bind_extensions(dri2_dpy, optional_core_extensions, extensions, true);
return EGL_TRUE;
 }
diff --git a/src/egl/drivers/dri2/egl_dri2.h b/src/egl/drivers/dri2/egl_dri2.h
index d36d02c3c49..00c4768d421 100644
--- a/src/egl/drivers/dri2/egl_dri2.h
+++ b/src/egl/drivers/dri2/egl_dri2.h
@@ -199,6 +199,9 @@ struct dri2_egl_display
xcb_screen_t *screen;
bool swap_available;
 #ifdef HAVE_DRI3
+   bool multibuffers_available;
+   int  dri3_major_version;
+   int  dri3_minor_version;
struct loader_dri3_extensions loader_dri3_ext;
 #endif
 #endif
diff --git a/src/egl/drivers/dri2/platform_x11_dri3.c 
b/src/egl/drivers/dri2/platform_x11_dri3.c
index 6ead4d0a222..15c349eb828 100644
--- a/src/egl/drivers/dri2/platform_x11_dri3.c
+++ b/src/egl/drivers/dri2/platform_x11_dri3.c
@@ -39,6 +39,23 @@
 #include "loader.h"
 #include "loader_dri3_helper.h"
 
+static uint32_t
+dri3_format_for_depth(uint32_t depth)
+{
+   switch (depth) {
+   case 16:
+  return __DRI_IMAGE_FORMAT_RGB565;
+   case 24:
+  return __DRI_IMAGE_FORMAT_XRGB;
+   case 30:
+  return __DRI_IMAGE_FORMAT_XRGB2101010;
+   case 32:
+  return __DRI_IMAGE_FORMAT_ARGB;
+   default:
+  return __DRI_IMAGE_FORMAT_NONE;
+   }
+}
+
 static struct dri3_egl_surface *
 loader_drawable_to_egl_surface(struct loader_dri3_drawable *draw) {
size_t offset = offsetof(struct dri3_egl_surface, loader_drawable);
@@ -156,7 +173,9 @@ dri3_create_surface(_EGLDriver *drv, _EGLDisplay *disp, 
EGLint type,
 
if (loader_dri3_drawable_init(dri2_dpy->conn, drawable,
  dri2_dpy->dri_screen,
- dri2_dpy->is_different_gpu, dri_config,
+ dri2_dpy->is_different_gpu,
+ dri2_dpy->multibuffers_available,
+ dri_config,
  &dri2_dpy->loader_dri3_ext,
  &egl_dri3_vtable,
  &dri3_surf->loader_drawable)) {
@@ -262,20 +281,8 @@ dri3_create_image_khr_pixmap(_EGLDisplay *disp, 
_EGLContext *ctx,
   return NULL;
}
 
-   switch (bp_reply->depth) {
-   case 16:
-  format = __DRI_IMAGE_FORMAT_RGB565;
-  break;
-   case 24:
-  format = __DRI_IMAGE_FORMAT_XRGB;
-  break;
-   case 30:
-  format = __DRI_IMAGE_FORMAT_XRGB2101010;
-  break;
-   case 32:
-  format = __DRI_IMAGE_FORMAT_ARGB;
-  break;
-   default:
+   format = dri3_format_for_depth(bp_reply->depth);
+   if (format == __DRI_IMAGE_FORMAT_NONE) {
   _eglError(EGL_BAD_PARAMETER,
 "dri3_create_image_khr: unsupported pixmap depth");
   free(bp_reply);
@@ -303,13 +310,78 @@ dri3_create_image_khr_pixmap(_EGLDisplay *disp, 
_EGLContext *ctx,
return &dri2_img->base;
 }
 
+#if XCB_DRI3_MAJOR_VERSION > 1 || (XCB_DRI3_MAJOR_VERSION == 1 && 
XCB_DRI3_MINOR_VERSION >= 1)
+static _EGLImage *
+dri3_create_image_khr_pixmap_from_buffers(_EGLDisplay *disp, _EGLContext *ctx,
+  EGLClientBuffer buffer,
+  const EGLint *attr_list)
+{
+   struct dri2_egl_display *dri2_dpy = dri2_egl_display(disp);
+   struct dri2_egl_image *dri2_img;
+   xcb_dri3_buffers_from_pixmap_cookie_t bp_cookie;
+   xcb_dri3_buffers_from_pixmap_reply_t  *bp_reply;
+   xcb_dra

[Mesa-dev] [PATCH 08/11] vulkan/wsi: Add support for DRI3 v1.1

2018-02-15 Thread Daniel Stone
Adds support for multiple planes and buffer modifiers.

v4: Rename "has_dri3_v1_1" to "has_dri3_modifiers"
Signed-off-by: Daniel Stone 
---
 src/vulkan/wsi/wsi_common_x11.c | 183 
 1 file changed, 166 insertions(+), 17 deletions(-)

diff --git a/src/vulkan/wsi/wsi_common_x11.c b/src/vulkan/wsi/wsi_common_x11.c
index 2cc7a67c63f..c569aa17187 100644
--- a/src/vulkan/wsi/wsi_common_x11.c
+++ b/src/vulkan/wsi/wsi_common_x11.c
@@ -36,6 +36,7 @@
 #include 
 #include 
 #include 
+#include 
 #include "util/hash_table.h"
 
 #include "vk_util.h"
@@ -50,6 +51,7 @@
 
 struct wsi_x11_connection {
bool has_dri3;
+   bool has_dri3_modifiers;
bool has_present;
bool is_proprietary_x11;
 };
@@ -164,6 +166,19 @@ wsi_x11_connection_create(const VkAllocationCallbacks 
*alloc,
}
 
wsi_conn->has_dri3 = dri3_reply->present != 0;
+#if XCB_DRI3_MAJOR_VERSION > 1 || XCB_DRI3_MINOR_VERSION >= 1
+   if (wsi_conn->has_dri3) {
+  xcb_dri3_query_version_cookie_t ver_cookie;
+  xcb_dri3_query_version_reply_t *ver_reply;
+
+  ver_cookie = xcb_dri3_query_version(conn, 1, 1);
+  ver_reply = xcb_dri3_query_version_reply(conn, ver_cookie, NULL);
+  wsi_conn->has_dri3_modifiers =
+ (ver_reply->major_version > 1 || ver_reply->minor_version >= 1);
+  free(ver_reply);
+   }
+#endif
+
wsi_conn->has_present = pres_reply->present != 0;
wsi_conn->is_proprietary_x11 = false;
if (amd_reply && amd_reply->present)
@@ -620,6 +635,8 @@ struct x11_image {
 struct x11_swapchain {
struct wsi_swapchainbase;
 
+   bool has_dri3_modifiers;
+
xcb_connection_t *   conn;
xcb_window_t window;
xcb_gc_t gc;
@@ -920,7 +937,9 @@ static VkResult
 x11_image_init(VkDevice device_h, struct x11_swapchain *chain,
const VkSwapchainCreateInfoKHR *pCreateInfo,
const VkAllocationCallbacks* pAllocator,
-   struct x11_image *image)
+   const uint64_t *const *modifiers,
+   const uint32_t *num_modifiers,
+   int num_tranches, struct x11_image *image)
 {
xcb_void_cookie_t cookie;
VkResult result;
@@ -930,28 +949,58 @@ x11_image_init(VkDevice device_h, struct x11_swapchain 
*chain,
   result = wsi_create_prime_image(&chain->base, pCreateInfo, &image->base);
} else {
   result = wsi_create_native_image(&chain->base, pCreateInfo,
-   0, NULL, NULL, &image->base);
+   num_tranches, num_modifiers, modifiers,
+   &image->base);
}
if (result != VK_SUCCESS)
   return result;
 
image->pixmap = xcb_generate_id(chain->conn);
 
-   /* Without passing modifiers, we can't have multi-plane RGB images. */
-   assert(image->base.num_planes == 1);
-
-   cookie =
-  xcb_dri3_pixmap_from_buffer_checked(chain->conn,
-  image->pixmap,
-  chain->window,
-  image->base.sizes[0],
-  pCreateInfo->imageExtent.width,
-  pCreateInfo->imageExtent.height,
-  image->base.row_pitches[0],
-  chain->depth, bpp,
-  image->base.fds[0]);
+#if XCB_DRI3_MAJOR_VERSION > 1 || XCB_DRI3_MINOR_VERSION >= 1
+   if (chain->has_dri3_modifiers &&
+   image->base.drm_modifier != DRM_FORMAT_MOD_INVALID) {
+  cookie =
+ xcb_dri3_pixmap_from_buffers_checked(chain->conn,
+  image->pixmap,
+  chain->window,
+  image->base.num_planes,
+  pCreateInfo->imageExtent.width,
+  pCreateInfo->imageExtent.height,
+  image->base.row_pitches[0],
+  image->base.offsets[0],
+  image->base.row_pitches[1],
+  image->base.offsets[1],
+  image->base.row_pitches[2],
+  image->base.offsets[2],
+  image->base.row_pitches[3],
+  image->base.offsets[3],
+  chain->depth, bpp,
+  image->base.drm_modifier,
+  image->base.fds);
+   } else
+#endif
+   

[Mesa-dev] [PATCH 06/11] meson: Move Wayland dmabuf to wayland-drm

2018-02-15 Thread Daniel Stone
As the comment notes: linux-dmabuf has nothing to do with wayland-drm,
but we need a single place to build these files we can use from both EGL
and Vulkan, which is guaranteed to be included before both EGL and
Vulkan WSI.

Signed-off-by: Daniel Stone 
Cc: Emil Velikov 
---
 src/egl/meson.build | 14 --
 src/egl/wayland/wayland-drm/meson.build | 22 ++
 2 files changed, 22 insertions(+), 14 deletions(-)

diff --git a/src/egl/meson.build b/src/egl/meson.build
index 6cd04567b0d..cd51ad308f6 100644
--- a/src/egl/meson.build
+++ b/src/egl/meson.build
@@ -58,20 +58,6 @@ files_egl = files(
   'drivers/dri2/egl_dri2_fallbacks.h',
 )
 
-linux_dmabuf_unstable_v1_protocol_c = custom_target(
-  'linux-dmabuf-unstable-v1-protocol.c',
-  input : wayland_dmabuf_xml,
-  output : 'linux-dmabuf-unstable-v1-protocol.c',
-  command : [prog_wl_scanner, 'code', '@INPUT@', '@OUTPUT@'],
-)
-
-linux_dmabuf_unstable_v1_client_protocol_h = custom_target(
-  'linux-dmabuf-unstable-v1-client-protocol.h',
-  input : wayland_dmabuf_xml,
-  output : 'linux-dmabuf-unstable-v1-client-protocol.h',
-  command : [prog_wl_scanner, 'client-header', '@INPUT@', '@OUTPUT@'],
-)
-
 g_egldispatchstubs_c = custom_target(
   'g_egldispatchstubs.c',
   input : [
diff --git a/src/egl/wayland/wayland-drm/meson.build 
b/src/egl/wayland/wayland-drm/meson.build
index fa334880530..c627deaa1c3 100644
--- a/src/egl/wayland/wayland-drm/meson.build
+++ b/src/egl/wayland/wayland-drm/meson.build
@@ -48,3 +48,25 @@ libwayland_drm = static_library(
   dependencies : [dep_wayland_server],
   build_by_default : false,
 )
+
+# linux-dmabuf isn't part of wayland-drm, but this happens to be the only
+# place which is a) guaranteed to be built when building either or both
+# of EGL and Vulkan WSI, and b) guaranteed to be included before both,
+# so the targets are actually defined by the time the files come to be
+# used.
+#
+# Moving these to a src/wsi/ was suggested but shot down, so put these
+# here for now as the maybe-least-bad solution.
+linux_dmabuf_unstable_v1_protocol_c = custom_target(
+  'linux-dmabuf-unstable-v1-protocol.c',
+  input : wayland_dmabuf_xml,
+  output : 'linux-dmabuf-unstable-v1-protocol.c',
+  command : [prog_wl_scanner, 'code', '@INPUT@', '@OUTPUT@'],
+)
+
+linux_dmabuf_unstable_v1_client_protocol_h = custom_target(
+  'linux-dmabuf-unstable-v1-client-protocol.h',
+  input : wayland_dmabuf_xml,
+  output : 'linux-dmabuf-unstable-v1-client-protocol.h',
+  command : [prog_wl_scanner, 'client-header', '@INPUT@', '@OUTPUT@'],
+)
-- 
2.14.3

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


[Mesa-dev] [PATCH 03/11] vulkan/wsi: Add modifiers support to wsi_create_native_image

2018-02-15 Thread Daniel Stone
From: Jason Ekstrand 

This involves extending our fake extension a bit to allow for additional
querying and passing of modifier information.  The added bits are
intended to look a lot like the draft of VK_EXT_image_drm_format_modifier.
Once the extension gets finalized, we'll simply transition all of the
structs used in wsi_common to the real extension structs.

Reviewed-by: Daniel Stone 
Signed-off-by: Daniel Stone 
---
 src/vulkan/wsi/wsi_common.c | 164 
 src/vulkan/wsi/wsi_common.h |  23 +
 src/vulkan/wsi/wsi_common_private.h |   3 +
 src/vulkan/wsi/wsi_common_wayland.c |   3 +-
 src/vulkan/wsi/wsi_common_x11.c |   3 +-
 5 files changed, 177 insertions(+), 19 deletions(-)

diff --git a/src/vulkan/wsi/wsi_common.c b/src/vulkan/wsi/wsi_common.c
index c235128e562..edba13a13de 100644
--- a/src/vulkan/wsi/wsi_common.c
+++ b/src/vulkan/wsi/wsi_common.c
@@ -26,6 +26,8 @@
 #include "util/macros.h"
 #include "vk_util.h"
 
+#include 
+
 VkResult
 wsi_device_init(struct wsi_device *wsi,
 VkPhysicalDevice pdevice,
@@ -36,6 +38,8 @@ wsi_device_init(struct wsi_device *wsi,
 
memset(wsi, 0, sizeof(*wsi));
 
+   wsi->pdevice = pdevice;
+
 #define WSI_GET_CB(func) \
PFN_vk##func func = (PFN_vk##func)proc_addr(pdevice, "vk" #func)
WSI_GET_CB(GetPhysicalDeviceMemoryProperties);
@@ -69,6 +73,7 @@ wsi_device_init(struct wsi_device *wsi,
WSI_GET_CB(GetImageSubresourceLayout);
WSI_GET_CB(GetMemoryFdKHR);
WSI_GET_CB(GetPhysicalDeviceFormatProperties);
+   WSI_GET_CB(GetPhysicalDeviceFormatProperties2KHR);
WSI_GET_CB(ResetFences);
WSI_GET_CB(QueueSubmit);
WSI_GET_CB(WaitForFences);
@@ -196,6 +201,9 @@ align_u32(uint32_t v, uint32_t a)
 VkResult
 wsi_create_native_image(const struct wsi_swapchain *chain,
 const VkSwapchainCreateInfoKHR *pCreateInfo,
+uint32_t num_modifier_lists,
+const uint32_t *num_modifiers,
+const uint64_t *const *modifiers,
 struct wsi_image *image)
 {
const struct wsi_device *wsi = chain->wsi;
@@ -205,11 +213,91 @@ wsi_create_native_image(const struct wsi_swapchain *chain,
for (int i = 0; i < ARRAY_SIZE(image->fds); i++)
   image->fds[i] = -1;
 
-   const struct wsi_image_create_info image_wsi_info = {
+   struct wsi_image_create_info image_wsi_info = {
   .sType = VK_STRUCTURE_TYPE_WSI_IMAGE_CREATE_INFO_MESA,
   .pNext = NULL,
-  .scanout = true,
};
+
+   uint32_t image_modifier_count = 0, modifier_prop_count = 0;
+   struct wsi_format_modifier_properties *modifier_props = NULL;
+   uint64_t *image_modifiers = NULL;
+   if (num_modifier_lists == 0) {
+  /* If we don't have modifiers, fall back to the legacy "scanout" flag */
+  image_wsi_info.scanout = true;
+   } else {
+  /* The winsys can't request modifiers if we don't support them. */
+  assert(wsi->supports_modifiers);
+  struct wsi_format_modifier_properties_list modifier_props_list = {
+ .sType = VK_STRUCTURE_TYPE_WSI_FORMAT_MODIFIER_PROPERTIES_LIST_MESA,
+ .pNext = NULL,
+  };
+  VkFormatProperties2KHR format_props = {
+ .sType = VK_STRUCTURE_TYPE_FORMAT_PROPERTIES_2_KHR,
+ .pNext = &modifier_props_list,
+  };
+  wsi->GetPhysicalDeviceFormatProperties2KHR(wsi->pdevice,
+ pCreateInfo->imageFormat,
+ &format_props);
+  assert(modifier_props_list.modifier_count > 0);
+  modifier_props = vk_alloc(&chain->alloc,
+sizeof(*modifier_props) *
+modifier_props_list.modifier_count,
+8,
+VK_SYSTEM_ALLOCATION_SCOPE_COMMAND);
+  if (!modifier_props) {
+ result = VK_ERROR_OUT_OF_HOST_MEMORY;
+ goto fail;
+  }
+
+  modifier_props_list.modifier_properties = modifier_props;
+  wsi->GetPhysicalDeviceFormatProperties2KHR(wsi->pdevice,
+ pCreateInfo->imageFormat,
+ &format_props);
+  modifier_prop_count = modifier_props_list.modifier_count;
+
+  uint32_t max_modifier_count = 0;
+  for (uint32_t l = 0; l < num_modifier_lists; l++)
+ max_modifier_count = MAX2(max_modifier_count, num_modifiers[l]);
+
+  image_modifiers = vk_alloc(&chain->alloc,
+ sizeof(*image_modifiers) *
+ max_modifier_count,
+ 8,
+ VK_SYSTEM_ALLOCATION_SCOPE_COMMAND);
+  if (!image_modifiers) {
+ result = VK_ERROR_OUT_OF_HOST_MEMORY;
+ goto fail;
+  }
+
+  image_modifier_count = 0;
+  for (uint32_t l = 0; l < num_modifier_lists; l++) {
+ 

[Mesa-dev] [PATCH 02/11] vulkan/wsi: Add drm_modifier member to wsi_image

2018-02-15 Thread Daniel Stone
Not yet used anywhere.

Signed-off-by: Daniel Stone 
Reviewed-by: Jason Ekstrand 
---
 src/vulkan/Makefile.am  | 1 +
 src/vulkan/wsi/meson.build  | 2 +-
 src/vulkan/wsi/wsi_common.c | 3 +++
 src/vulkan/wsi/wsi_common_private.h | 1 +
 4 files changed, 6 insertions(+), 1 deletion(-)

diff --git a/src/vulkan/Makefile.am b/src/vulkan/Makefile.am
index 037436c1cd7..4fdaedf38c1 100644
--- a/src/vulkan/Makefile.am
+++ b/src/vulkan/Makefile.am
@@ -36,6 +36,7 @@ libvulkan_util_la_SOURCES = $(VULKAN_UTIL_SOURCES)
 AM_CPPFLAGS = \
$(DEFINES) \
-I$(top_srcdir)/include \
+   -I$(top_srcdir)/include/drm-uapi \
-I$(top_srcdir)/src \
-I$(top_srcdir)/src/vulkan/util \
-I$(top_srcdir)/src/gallium/auxiliary \
diff --git a/src/vulkan/wsi/meson.build b/src/vulkan/wsi/meson.build
index bd0fd3cc53e..66ccc8316ec 100644
--- a/src/vulkan/wsi/meson.build
+++ b/src/vulkan/wsi/meson.build
@@ -60,7 +60,7 @@ endif
 libvulkan_wsi = static_library(
   'vulkan_wsi',
   files_vulkan_wsi,
-  include_directories : [inc_common, inc_vulkan_util],
+  include_directories : [inc_common, inc_vulkan_util, inc_drm_uapi],
   dependencies : [vulkan_wsi_deps, dep_libdrm],
   c_args : [c_vis_args, vulkan_wsi_args],
   build_by_default : false,
diff --git a/src/vulkan/wsi/wsi_common.c b/src/vulkan/wsi/wsi_common.c
index f257eb08755..c235128e562 100644
--- a/src/vulkan/wsi/wsi_common.c
+++ b/src/vulkan/wsi/wsi_common.c
@@ -22,6 +22,7 @@
  */
 
 #include "wsi_common_private.h"
+#include "drm_fourcc.h"
 #include "util/macros.h"
 #include "vk_util.h"
 
@@ -291,6 +292,7 @@ wsi_create_native_image(const struct wsi_swapchain *chain,
if (result != VK_SUCCESS)
   goto fail;
 
+   image->drm_modifier = DRM_FORMAT_MOD_INVALID;
image->num_planes = 1;
image->sizes[0] = reqs.size;
image->row_pitches[0] = image_layout.rowPitch;
@@ -494,6 +496,7 @@ wsi_create_prime_image(const struct wsi_swapchain *chain,
if (result != VK_SUCCESS)
   goto fail;
 
+   image->drm_modifier = DRM_FORMAT_MOD_LINEAR;
image->num_planes = 1;
image->sizes[0] = linear_size;
image->row_pitches[0] = linear_stride;
diff --git a/src/vulkan/wsi/wsi_common_private.h 
b/src/vulkan/wsi/wsi_common_private.h
index c5002ec8eca..781e84635f9 100644
--- a/src/vulkan/wsi/wsi_common_private.h
+++ b/src/vulkan/wsi/wsi_common_private.h
@@ -35,6 +35,7 @@ struct wsi_image {
   VkCommandBuffer *blit_cmd_buffers;
} prime;
 
+   uint64_t drm_modifier;
int num_planes;
uint32_t sizes[4];
uint32_t offsets[4];
-- 
2.14.3

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


[Mesa-dev] [PATCH 01/11] vulkan/wsi: Add multiple planes to wsi_image

2018-02-15 Thread Daniel Stone
Not currently used.

Signed-off-by: Daniel Stone 
Reviewed-by: Jason Ekstrand 
---
 src/vulkan/wsi/wsi_common.c | 20 
 src/vulkan/wsi/wsi_common_private.h |  9 +
 src/vulkan/wsi/wsi_common_wayland.c | 11 +++
 src/vulkan/wsi/wsi_common_x11.c | 11 +++
 4 files changed, 31 insertions(+), 20 deletions(-)

diff --git a/src/vulkan/wsi/wsi_common.c b/src/vulkan/wsi/wsi_common.c
index 90ed07b7857..f257eb08755 100644
--- a/src/vulkan/wsi/wsi_common.c
+++ b/src/vulkan/wsi/wsi_common.c
@@ -201,6 +201,8 @@ wsi_create_native_image(const struct wsi_swapchain *chain,
VkResult result;
 
memset(image, 0, sizeof(*image));
+   for (int i = 0; i < ARRAY_SIZE(image->fds); i++)
+  image->fds[i] = -1;
 
const struct wsi_image_create_info image_wsi_info = {
   .sType = VK_STRUCTURE_TYPE_WSI_IMAGE_CREATE_INFO_MESA,
@@ -289,10 +291,11 @@ wsi_create_native_image(const struct wsi_swapchain *chain,
if (result != VK_SUCCESS)
   goto fail;
 
-   image->size = reqs.size;
-   image->row_pitch = image_layout.rowPitch;
-   image->offset = 0;
-   image->fd = fd;
+   image->num_planes = 1;
+   image->sizes[0] = reqs.size;
+   image->row_pitches[0] = image_layout.rowPitch;
+   image->offsets[0] = 0;
+   image->fds[0] = fd;
 
return VK_SUCCESS;
 
@@ -491,10 +494,11 @@ wsi_create_prime_image(const struct wsi_swapchain *chain,
if (result != VK_SUCCESS)
   goto fail;
 
-   image->size = linear_size;
-   image->row_pitch = linear_stride;
-   image->offset = 0;
-   image->fd = fd;
+   image->num_planes = 1;
+   image->sizes[0] = linear_size;
+   image->row_pitches[0] = linear_stride;
+   image->offsets[0] = 0;
+   image->fds[0] = fd;
 
return VK_SUCCESS;
 
diff --git a/src/vulkan/wsi/wsi_common_private.h 
b/src/vulkan/wsi/wsi_common_private.h
index 503b2a015dc..c5002ec8eca 100644
--- a/src/vulkan/wsi/wsi_common_private.h
+++ b/src/vulkan/wsi/wsi_common_private.h
@@ -35,10 +35,11 @@ struct wsi_image {
   VkCommandBuffer *blit_cmd_buffers;
} prime;
 
-   uint32_t size;
-   uint32_t offset;
-   uint32_t row_pitch;
-   int fd;
+   int num_planes;
+   uint32_t sizes[4];
+   uint32_t offsets[4];
+   uint32_t row_pitches[4];
+   int fds[4];
 };
 
 struct wsi_swapchain {
diff --git a/src/vulkan/wsi/wsi_common_wayland.c 
b/src/vulkan/wsi/wsi_common_wayland.c
index be7635bbf84..8290170c9ec 100644
--- a/src/vulkan/wsi/wsi_common_wayland.c
+++ b/src/vulkan/wsi/wsi_common_wayland.c
@@ -712,15 +712,18 @@ wsi_wl_image_init(struct wsi_wl_swapchain *chain,
if (result != VK_SUCCESS)
   return result;
 
+   /* Without passing modifiers, we can't have multi-plane RGB images. */
+   assert(image->base.num_planes == 1);
+
image->buffer = wl_drm_create_prime_buffer(chain->drm_wrapper,
-  image->base.fd, /* name */
+  image->base.fds[0], /* name */
   chain->extent.width,
   chain->extent.height,
   chain->drm_format,
-  image->base.offset,
-  image->base.row_pitch,
+  image->base.offsets[0],
+  image->base.row_pitches[0],
   0, 0, 0, 0 /* unused */);
-   close(image->base.fd);
+   close(image->base.fds[0]);
 
if (!image->buffer)
   goto fail_image;
diff --git a/src/vulkan/wsi/wsi_common_x11.c b/src/vulkan/wsi/wsi_common_x11.c
index c29e0a2d30d..b42b8234064 100644
--- a/src/vulkan/wsi/wsi_common_x11.c
+++ b/src/vulkan/wsi/wsi_common_x11.c
@@ -936,18 +936,21 @@ x11_image_init(VkDevice device_h, struct x11_swapchain 
*chain,
 
image->pixmap = xcb_generate_id(chain->conn);
 
+   /* Without passing modifiers, we can't have multi-plane RGB images. */
+   assert(image->base.num_planes == 1);
+
cookie =
   xcb_dri3_pixmap_from_buffer_checked(chain->conn,
   image->pixmap,
   chain->window,
-  image->base.size,
+  image->base.sizes[0],
   pCreateInfo->imageExtent.width,
   pCreateInfo->imageExtent.height,
-  image->base.row_pitch,
+  image->base.row_pitches[0],
   chain->depth, bpp,
-  image->base.fd);
+  image->base.fds[0]);
xcb_discard_reply(chain->conn, cookie.sequence);
-   image->base.fd = -1; /* XCB has now taken ownership of the FD */
+   image->base.fds[0] = -1; /* XCB

[Mesa-dev] [PATCH 07/11] vulkan/wsi/wayland: Add support for zwp_dmabuf

2018-02-15 Thread Daniel Stone
zwp_linux_dmabuf_v1 lets us use multi-planar images and buffer
modifiers.

Signed-off-by: Daniel Stone 
---
 src/vulkan/Makefile.am  |  10 +++
 src/vulkan/Makefile.sources |   4 +-
 src/vulkan/wsi/meson.build  |   2 +
 src/vulkan/wsi/wsi_common_wayland.c | 138 
 4 files changed, 139 insertions(+), 15 deletions(-)

diff --git a/src/vulkan/Makefile.am b/src/vulkan/Makefile.am
index 4fdaedf38c1..c7813ce05e3 100644
--- a/src/vulkan/Makefile.am
+++ b/src/vulkan/Makefile.am
@@ -71,6 +71,16 @@ wsi/wayland-drm-client-protocol.h : $(WL_DRM_XML)
$(MKDIR_GEN)
$(AM_V_GEN)$(WAYLAND_SCANNER) client-header < $< > $@
 
+WL_DMABUF_XML = 
$(WAYLAND_PROTOCOLS_DATADIR)/unstable/linux-dmabuf/linux-dmabuf-unstable-v1.xml
+
+wsi/linux-dmabuf-unstable-v1-protocol.c : $(WL_DMABUF_XML)
+   $(MKDIR_GEN)
+   $(AM_V_GEN)$(WAYLAND_SCANNER) code < $< > $@
+
+wsi/linux-dmabuf-unstable-v1-client-protocol.h : $(WL_DMABUF_XML)
+   $(MKDIR_GEN)
+   $(AM_V_GEN)$(WAYLAND_SCANNER) client-header < $< > $@
+
 if HAVE_PLATFORM_WAYLAND
 AM_CPPFLAGS += \
-I$(top_builddir)/src/vulkan/wsi \
diff --git a/src/vulkan/Makefile.sources b/src/vulkan/Makefile.sources
index a0a24ce7de8..101a94349c6 100644
--- a/src/vulkan/Makefile.sources
+++ b/src/vulkan/Makefile.sources
@@ -11,7 +11,9 @@ VULKAN_WSI_WAYLAND_FILES := \
 
 VULKAN_WSI_WAYLAND_GENERATED_FILES := \
wsi/wayland-drm-protocol.c \
-   wsi/wayland-drm-client-protocol.h
+   wsi/wayland-drm-client-protocol.h \
+   wsi/linux-dmabuf-unstable-v1-protocol.c \
+   wsi/linux-dmabuf-unstable-v1-client-protocol.h
 
 VULKAN_WSI_X11_FILES := \
wsi/wsi_common_x11.c \
diff --git a/src/vulkan/wsi/meson.build b/src/vulkan/wsi/meson.build
index 66ccc8316ec..223c8ca357e 100644
--- a/src/vulkan/wsi/meson.build
+++ b/src/vulkan/wsi/meson.build
@@ -54,6 +54,8 @@ if with_platform_wayland
   files_vulkan_wsi += [
 wayland_drm_client_protocol_h,
 wayland_drm_protocol_c,
+linux_dmabuf_unstable_v1_client_protocol_h,
+linux_dmabuf_unstable_v1_protocol_c,
   ]
 endif
 
diff --git a/src/vulkan/wsi/wsi_common_wayland.c 
b/src/vulkan/wsi/wsi_common_wayland.c
index 1162b92c35f..26acde194d6 100644
--- a/src/vulkan/wsi/wsi_common_wayland.c
+++ b/src/vulkan/wsi/wsi_common_wayland.c
@@ -31,10 +31,13 @@
 #include 
 #include 
 
+#include 
+
 #include "vk_util.h"
 #include "wsi_common_private.h"
 #include "wsi_common_wayland.h"
 #include "wayland-drm-client-protocol.h"
+#include "linux-dmabuf-unstable-v1-client-protocol.h"
 
 #include 
 #include 
@@ -53,11 +56,17 @@ struct wsi_wl_display {
struct wl_display *  wl_display_wrapper;
struct wl_event_queue *  queue;
struct wl_drm *  drm;
+   struct zwp_linux_dmabuf_v1 * dmabuf;
 
struct wsi_wayland *wsi_wl;
/* Vector of VkFormats supported */
struct u_vectorformats;
 
+   struct {
+  struct u_vector   argb;
+  struct u_vector   xrgb;
+   } modifiers;
+
uint32_t capabilities;
 
/* Only used for displays created by wsi_wl_display_create */
@@ -223,6 +232,53 @@ static const struct wl_drm_listener drm_listener = {
drm_handle_capabilities,
 };
 
+static void
+dmabuf_handle_format(void *data, struct zwp_linux_dmabuf_v1 *dmabuf,
+ uint32_t format)
+{
+   /* Formats are implicitly advertised by the modifier event, so we ignore
+* them here. */
+}
+
+static void
+dmabuf_handle_modifier(void *data, struct zwp_linux_dmabuf_v1 *dmabuf,
+   uint32_t format, uint32_t modifier_hi,
+   uint32_t modifier_lo)
+{
+   struct wsi_wl_display *display = data;
+   uint64_t *mod = NULL;
+
+   /* If we're not fetching formats, don't fetch modifiers either. */
+   if (display->formats.element_size == 0)
+  return;
+
+   if (modifier_hi == (DRM_FORMAT_MOD_INVALID >> 32) &&
+   modifier_lo == (DRM_FORMAT_MOD_INVALID & 0x))
+  return;
+
+   switch (format) {
+   case WL_DRM_FORMAT_ARGB:
+  mod = u_vector_add(&display->modifiers.argb);
+  break;
+   case WL_DRM_FORMAT_XRGB:
+  mod = u_vector_add(&display->modifiers.xrgb);
+  break;
+   default:
+  break;
+   }
+
+   if (!mod)
+  return;
+
+   *mod = (uint64_t) modifier_hi << 32;
+   *mod |= (uint64_t) (modifier_lo & 0x);
+}
+
+static const struct zwp_linux_dmabuf_v1_listener dmabuf_listener = {
+   dmabuf_handle_format,
+   dmabuf_handle_modifier,
+};
+
 static void
 registry_handle_global(void *data, struct wl_registry *registry,
uint32_t name, const char *interface, uint32_t version)
@@ -237,6 +293,11 @@ registry_handle_global(void *data, struct wl_registry 
*registry,
 
   if (display->drm)
  wl_drm_add_listene

[Mesa-dev] [PATCH 09/11] vulkan/wsi: Return VK_SUBOPTIMAL_KHR for X11

2018-02-15 Thread Daniel Stone
From: Louis-Francis Ratté-Boulianne 

When it is detected that a window could have been flipped
but has been copied because of suboptimal format/modifier.
The Vulkan client should then re-create the swapchain.

Signed-off-by: Louis-Francis Ratté-Boulianne 
Reviewed-by: Daniel Stone 
Signed-off-by: Daniel Stone 
---
 src/vulkan/wsi/wsi_common_x11.c | 64 +
 1 file changed, 58 insertions(+), 6 deletions(-)

diff --git a/src/vulkan/wsi/wsi_common_x11.c b/src/vulkan/wsi/wsi_common_x11.c
index c569aa17187..a9929af338c 100644
--- a/src/vulkan/wsi/wsi_common_x11.c
+++ b/src/vulkan/wsi/wsi_common_x11.c
@@ -130,6 +130,8 @@ wsi_x11_connection_create(const VkAllocationCallbacks 
*alloc,
 {
xcb_query_extension_cookie_t dri3_cookie, pres_cookie, amd_cookie, 
nv_cookie;
xcb_query_extension_reply_t *dri3_reply, *pres_reply, *amd_reply, *nv_reply;
+   bool has_dri3_v1_1 = false;
+   bool has_present_v1_1 = false;
 
struct wsi_x11_connection *wsi_conn =
   vk_alloc(alloc, sizeof(*wsi_conn), 8,
@@ -138,7 +140,7 @@ wsi_x11_connection_create(const VkAllocationCallbacks 
*alloc,
   return NULL;
 
dri3_cookie = xcb_query_extension(conn, 4, "DRI3");
-   pres_cookie = xcb_query_extension(conn, 7, "PRESENT");
+   pres_cookie = xcb_query_extension(conn, 7, "Present");
 
/* We try to be nice to users and emit a warning if they try to use a
 * Vulkan application on a system without DRI3 enabled.  However, this ends
@@ -173,13 +175,27 @@ wsi_x11_connection_create(const VkAllocationCallbacks 
*alloc,
 
   ver_cookie = xcb_dri3_query_version(conn, 1, 1);
   ver_reply = xcb_dri3_query_version_reply(conn, ver_cookie, NULL);
-  wsi_conn->has_dri3_modifiers =
+  has_dri3_v1_1 =
  (ver_reply->major_version > 1 || ver_reply->minor_version >= 1);
   free(ver_reply);
}
 #endif
 
wsi_conn->has_present = pres_reply->present != 0;
+#if XCB_PRESENT_MAJOR_VERSION > 1 || XCB_PRESENT_MINOR_VERSION >= 1
+   if (wsi_conn->has_present) {
+  xcb_present_query_version_cookie_t ver_cookie;
+  xcb_present_query_version_reply_t *ver_reply;
+
+  ver_cookie = xcb_present_query_version(conn, 1, 1);
+  ver_reply = xcb_present_query_version_reply(conn, ver_cookie, NULL);
+  has_present_v1_1 =
+(ver_reply->major_version > 1 || ver_reply->minor_version >= 1);
+  free(ver_reply);
+   }
+#endif
+
+   wsi_conn->has_dri3_modifiers = has_dri3_v1_1 && has_present_v1_1;
wsi_conn->is_proprietary_x11 = false;
if (amd_reply && amd_reply->present)
   wsi_conn->is_proprietary_x11 = true;
@@ -651,6 +667,8 @@ struct x11_swapchain {
 
bool threaded;
VkResult status;
+   bool suboptimal;
+   bool realloc_suboptimal;
struct wsi_queue present_queue;
struct wsi_queue acquire_queue;
pthread_tqueue_manager;
@@ -699,6 +717,10 @@ x11_handle_dri3_present_event(struct x11_swapchain *chain,
   xcb_present_complete_notify_event_t *complete = (void *) event;
   if (complete->kind == XCB_PRESENT_COMPLETE_KIND_PIXMAP)
  chain->last_present_msc = complete->msc;
+#if XCB_PRESENT_MAJOR_VERSION > 1 || XCB_PRESENT_MINOR_VERSION >= 1
+  if (complete->mode == XCB_PRESENT_COMPLETE_MODE_SUBOPTIMAL_COPY)
+ chain->suboptimal = true;
+#endif
   break;
}
 
@@ -828,6 +850,11 @@ x11_present_to_x11(struct x11_swapchain *chain, uint32_t 
image_index,
if (chain->base.present_mode == VK_PRESENT_MODE_IMMEDIATE_KHR)
   options |= XCB_PRESENT_OPTION_ASYNC;
 
+#if XCB_PRESENT_MAJOR_VERSION > 1 || XCB_PRESENT_MINOR_VERSION >= 1
+   if (chain->has_dri3_modifiers)
+  options |= XCB_PRESENT_OPTION_SUBOPTIMAL;
+#endif
+
xshmfence_reset(image->shm_fence);
 
++chain->send_sbc;
@@ -862,11 +889,19 @@ x11_acquire_next_image(struct wsi_swapchain *anv_chain,
uint32_t *image_index)
 {
struct x11_swapchain *chain = (struct x11_swapchain *)anv_chain;
+   VkResult result;
 
if (chain->threaded) {
-  return x11_acquire_next_image_from_queue(chain, image_index, timeout);
+  result = x11_acquire_next_image_from_queue(chain, image_index, timeout);
} else {
-  return x11_acquire_next_image_poll_x11(chain, image_index, timeout);
+  result = x11_acquire_next_image_poll_x11(chain, image_index, timeout);
+   }
+
+   if (result != VK_SUCCESS) {
+  return result;
+   } else {
+  return (chain->realloc_suboptimal && chain->suboptimal) ? 
VK_SUBOPTIMAL_KHR
+  : VK_SUCCESS;
}
 }
 
@@ -876,12 +911,20 @@ x11_queue_present(struct wsi_swapchain *anv_chain,
   const VkPresentRegionKHR *damage)
 {
struct x11_swapchain *chain = (struct x11_swapcha

Re: [Mesa-dev] [PATCH] svga: call tgsi_scan_shader() for dummy shaders

2018-02-15 Thread Charmaine Lee

Looks good.

Reviewed-by: Charmaine Lee 


From: Brian Paul 
Sent: Wednesday, February 14, 2018 6:57:21 PM
To: mesa-dev@lists.freedesktop.org
Cc: Charmaine Lee; Neha Bhende
Subject: [PATCH] svga: call tgsi_scan_shader() for dummy shaders

If we fail to compile the normal VS or FS we fall back to a simple/
dummy shader.  We need to rescan the the shader to update the shader
info.  Otherwise, this can lead to further translations failures
because the shader info doesn't match the actual shader.

Found by adding some extra debug assertions in the state-update code
while debugging something else.

v2: also update shader generic_inputs/outputs, etc. per Charmaine
---
 src/gallium/drivers/svga/svga_state_fs.c | 4 
 src/gallium/drivers/svga/svga_state_vs.c | 3 +++
 2 files changed, 7 insertions(+)

diff --git a/src/gallium/drivers/svga/svga_state_fs.c 
b/src/gallium/drivers/svga/svga_state_fs.c
index 5e56899..eeb1ba6 100644
--- a/src/gallium/drivers/svga/svga_state_fs.c
+++ b/src/gallium/drivers/svga/svga_state_fs.c
@@ -115,6 +115,10 @@ get_compiled_dummy_shader(struct svga_context *svga,
FREE((void *) fs->base.tokens);
fs->base.tokens = dummy;

+   tgsi_scan_shader(fs->base.tokens, &fs->base.info);
+   fs->generic_inputs = svga_get_generic_inputs_mask(&fs->base.info);
+   svga_remap_generics(fs->generic_inputs, fs->generic_remap_table);
+
variant = translate_fragment_program(svga, fs, key);
return variant;
 }
diff --git a/src/gallium/drivers/svga/svga_state_vs.c 
b/src/gallium/drivers/svga/svga_state_vs.c
index a0ab868..3dfc9f4 100644
--- a/src/gallium/drivers/svga/svga_state_vs.c
+++ b/src/gallium/drivers/svga/svga_state_vs.c
@@ -105,6 +105,9 @@ get_compiled_dummy_vertex_shader(struct svga_context *svga,
FREE((void *) vs->base.tokens);
vs->base.tokens = dummy;

+   tgsi_scan_shader(vs->base.tokens, &vs->base.info);
+   vs->generic_outputs = svga_get_generic_outputs_mask(&vs->base.info);
+
variant = translate_vertex_program(svga, vs, key);
return variant;
 }
--
2.7.4

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


Re: [Mesa-dev] [PATCH 11/11] egl/x11: Re-allocate buffers if format is suboptimal

2018-02-15 Thread Michel Dänzer
On 2018-02-15 04:57 PM, Daniel Stone wrote:
> From: Louis-Francis Ratté-Boulianne 
> 
> If PresentCompleteNotify event says the pixmap was presented
> with mode PresentCompleteModeSuboptimalCopy, it means the pixmap
> could possibly have been flipped instead if allocated with a
> different format/modifier.
> 
> Signed-off-by: Louis-Francis Ratté-Boulianne 
> Reviewed-by: Daniel Stone 
> Signed-off-by: Daniel Stone 

[...]

> @@ -885,6 +901,11 @@ loader_dri3_swap_buffers_msc(struct loader_dri3_drawable 
> *draw,
>if (!loader_dri3_have_image_blit(draw) && draw->cur_blit_source != -1)
>   options |= XCB_PRESENT_OPTION_COPY;
>  
> +#if XCB_PRESENT_MAJOR_VERSION > 1 || (XCB_PRESENT_MAJOR_VERSION == 1 && 
> XCB_PRESENT_MINOR_VERSION >= 1)
> +  if (draw->multiplanes_available)
> + options  |= XCB_PRESENT_OPTION_SUBOPTIMAL;
> +#endif

This should check directly that the Present extension supports
PresentOptionSuboptimal, rather than checking the DRI3 extension
capabilities (what draw->multiplanes_available reflects).


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


Re: [Mesa-dev] [PATCH 11/11] egl/x11: Re-allocate buffers if format is suboptimal

2018-02-15 Thread Daniel Stone
Hi Michel,

On 15 February 2018 at 16:14, Michel Dänzer  wrote:
> On 2018-02-15 04:57 PM, Daniel Stone wrote:
>> @@ -885,6 +901,11 @@ loader_dri3_swap_buffers_msc(struct 
>> loader_dri3_drawable *draw,
>>if (!loader_dri3_have_image_blit(draw) && draw->cur_blit_source != -1)
>>   options |= XCB_PRESENT_OPTION_COPY;
>>
>> +#if XCB_PRESENT_MAJOR_VERSION > 1 || (XCB_PRESENT_MAJOR_VERSION == 1 && 
>> XCB_PRESENT_MINOR_VERSION >= 1)
>> +  if (draw->multiplanes_available)
>> + options  |= XCB_PRESENT_OPTION_SUBOPTIMAL;
>> +#endif
>
> This should check directly that the Present extension supports
> PresentOptionSuboptimal, rather than checking the DRI3 extension
> capabilities (what draw->multiplanes_available reflects).

True, but it does:
dri2_dpy->multibuffers_available =
   (dri2_dpy->dri3_major_version > 1 ||
(dri2_dpy->dri3_major_version == 1 &&

dri2_dpy->dri3_minor_version >= 1)) &&
+  (dri2_dpy->present_major_version > 1 ||
(dri2_dpy->present_major_version == 1 &&
+
dri2_dpy->present_minor_version >= 1)) &&
   (dri2_dpy->image && dri2_dpy->image->base.version >= 15);

If you'd prefer a present_suboptimal_available rather than lumping the
two together, that would be pretty easy to do.

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


Re: [Mesa-dev] [PATCH 11/11] egl/x11: Re-allocate buffers if format is suboptimal

2018-02-15 Thread Michel Dänzer
On 2018-02-15 05:17 PM, Daniel Stone wrote:
> Hi Michel,
> 
> On 15 February 2018 at 16:14, Michel Dänzer  wrote:
>> On 2018-02-15 04:57 PM, Daniel Stone wrote:
>>> @@ -885,6 +901,11 @@ loader_dri3_swap_buffers_msc(struct 
>>> loader_dri3_drawable *draw,
>>>if (!loader_dri3_have_image_blit(draw) && draw->cur_blit_source != 
>>> -1)
>>>   options |= XCB_PRESENT_OPTION_COPY;
>>>
>>> +#if XCB_PRESENT_MAJOR_VERSION > 1 || (XCB_PRESENT_MAJOR_VERSION == 1 && 
>>> XCB_PRESENT_MINOR_VERSION >= 1)
>>> +  if (draw->multiplanes_available)
>>> + options  |= XCB_PRESENT_OPTION_SUBOPTIMAL;
>>> +#endif
>>
>> This should check directly that the Present extension supports
>> PresentOptionSuboptimal, rather than checking the DRI3 extension
>> capabilities (what draw->multiplanes_available reflects).
> 
> True, but it does:
> dri2_dpy->multibuffers_available =
>(dri2_dpy->dri3_major_version > 1 ||
> (dri2_dpy->dri3_major_version == 1 &&
> 
> dri2_dpy->dri3_minor_version >= 1)) &&
> +  (dri2_dpy->present_major_version > 1 ||
> (dri2_dpy->present_major_version == 1 &&
> +
> dri2_dpy->present_minor_version >= 1)) &&
>(dri2_dpy->image && dri2_dpy->image->base.version >= 15);

Oh, I missed that.


> If you'd prefer a present_suboptimal_available rather than lumping the
> two together, that would be pretty easy to do.

I don't care.


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


[Mesa-dev] [PATCH] svga: replace gotos with else clauses

2018-02-15 Thread Brian Paul
Simple clean-up.
---
 src/gallium/drivers/svga/svga_state_fs.c | 19 +--
 src/gallium/drivers/svga/svga_state_gs.c |  9 -
 src/gallium/drivers/svga/svga_state_vs.c | 15 +++
 3 files changed, 20 insertions(+), 23 deletions(-)

diff --git a/src/gallium/drivers/svga/svga_state_fs.c 
b/src/gallium/drivers/svga/svga_state_fs.c
index eeb1ba6..5190542 100644
--- a/src/gallium/drivers/svga/svga_state_fs.c
+++ b/src/gallium/drivers/svga/svga_state_fs.c
@@ -383,18 +383,17 @@ svga_reemit_fs_bindings(struct svga_context *svga)
   ret =  svga->swc->resource_rebind(svga->swc, NULL,
 svga->state.hw_draw.fs->gb_shader,
 SVGA_RELOC_READ);
-  goto out;
+   }
+   else {
+  if (svga_have_vgpu10(svga))
+ ret = SVGA3D_vgpu10_SetShader(svga->swc, SVGA3D_SHADERTYPE_PS,
+   svga->state.hw_draw.fs->gb_shader,
+   svga->state.hw_draw.fs->id);
+  else
+ ret = SVGA3D_SetGBShader(svga->swc, SVGA3D_SHADERTYPE_PS,
+  svga->state.hw_draw.fs->gb_shader);
}
 
-   if (svga_have_vgpu10(svga))
-  ret = SVGA3D_vgpu10_SetShader(svga->swc, SVGA3D_SHADERTYPE_PS,
-svga->state.hw_draw.fs->gb_shader,
-svga->state.hw_draw.fs->id);
-   else
-  ret = SVGA3D_SetGBShader(svga->swc, SVGA3D_SHADERTYPE_PS,
-   svga->state.hw_draw.fs->gb_shader);
-
- out:
if (ret != PIPE_OK)
   return ret;
 
diff --git a/src/gallium/drivers/svga/svga_state_gs.c 
b/src/gallium/drivers/svga/svga_state_gs.c
index 19f0887..38d85f0 100644
--- a/src/gallium/drivers/svga/svga_state_gs.c
+++ b/src/gallium/drivers/svga/svga_state_gs.c
@@ -153,13 +153,12 @@ svga_reemit_gs_bindings(struct svga_context *svga)
if (!svga_need_to_rebind_resources(svga)) {
   ret =  svga->swc->resource_rebind(svga->swc, NULL, gbshader,
 SVGA_RELOC_READ);
-  goto out;
+   }
+   else {
+  ret = SVGA3D_vgpu10_SetShader(svga->swc, SVGA3D_SHADERTYPE_GS,
+gbshader, shaderId);
}
 
-   ret = SVGA3D_vgpu10_SetShader(svga->swc, SVGA3D_SHADERTYPE_GS,
- gbshader, shaderId);
-
- out:
if (ret != PIPE_OK)
   return ret;
 
diff --git a/src/gallium/drivers/svga/svga_state_vs.c 
b/src/gallium/drivers/svga/svga_state_vs.c
index 3dfc9f4..ad93f60 100644
--- a/src/gallium/drivers/svga/svga_state_vs.c
+++ b/src/gallium/drivers/svga/svga_state_vs.c
@@ -227,16 +227,15 @@ svga_reemit_vs_bindings(struct svga_context *svga)
if (!svga_need_to_rebind_resources(svga)) {
   ret =  svga->swc->resource_rebind(svga->swc, NULL, gbshader,
 SVGA_RELOC_READ);
-  goto out;
+   }
+   else {
+  if (svga_have_vgpu10(svga))
+ ret = SVGA3D_vgpu10_SetShader(svga->swc, SVGA3D_SHADERTYPE_VS,
+   gbshader, shaderId);
+  else
+ ret = SVGA3D_SetGBShader(svga->swc, SVGA3D_SHADERTYPE_VS, gbshader);
}
 
-   if (svga_have_vgpu10(svga))
-  ret = SVGA3D_vgpu10_SetShader(svga->swc, SVGA3D_SHADERTYPE_VS,
-gbshader, shaderId);
-   else
-  ret = SVGA3D_SetGBShader(svga->swc, SVGA3D_SHADERTYPE_VS, gbshader);
-
- out:
if (ret != PIPE_OK)
   return ret;
 
-- 
2.7.4

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


Re: [Mesa-dev] [PATCH] svga: replace gotos with else clauses

2018-02-15 Thread Charmaine Lee
Looks good.

Reviewed-by: Charmaine Lee 


From: Brian Paul 
Sent: Thursday, February 15, 2018 8:31:12 AM
To: mesa-dev@lists.freedesktop.org
Cc: Charmaine Lee; Neha Bhende
Subject: [PATCH] svga: replace gotos with else clauses

Simple clean-up.
---
 src/gallium/drivers/svga/svga_state_fs.c | 19 +--
 src/gallium/drivers/svga/svga_state_gs.c |  9 -
 src/gallium/drivers/svga/svga_state_vs.c | 15 +++
 3 files changed, 20 insertions(+), 23 deletions(-)

diff --git a/src/gallium/drivers/svga/svga_state_fs.c 
b/src/gallium/drivers/svga/svga_state_fs.c
index eeb1ba6..5190542 100644
--- a/src/gallium/drivers/svga/svga_state_fs.c
+++ b/src/gallium/drivers/svga/svga_state_fs.c
@@ -383,18 +383,17 @@ svga_reemit_fs_bindings(struct svga_context *svga)
   ret =  svga->swc->resource_rebind(svga->swc, NULL,
 svga->state.hw_draw.fs->gb_shader,
 SVGA_RELOC_READ);
-  goto out;
+   }
+   else {
+  if (svga_have_vgpu10(svga))
+ ret = SVGA3D_vgpu10_SetShader(svga->swc, SVGA3D_SHADERTYPE_PS,
+   svga->state.hw_draw.fs->gb_shader,
+   svga->state.hw_draw.fs->id);
+  else
+ ret = SVGA3D_SetGBShader(svga->swc, SVGA3D_SHADERTYPE_PS,
+  svga->state.hw_draw.fs->gb_shader);
}

-   if (svga_have_vgpu10(svga))
-  ret = SVGA3D_vgpu10_SetShader(svga->swc, SVGA3D_SHADERTYPE_PS,
-svga->state.hw_draw.fs->gb_shader,
-svga->state.hw_draw.fs->id);
-   else
-  ret = SVGA3D_SetGBShader(svga->swc, SVGA3D_SHADERTYPE_PS,
-   svga->state.hw_draw.fs->gb_shader);
-
- out:
if (ret != PIPE_OK)
   return ret;

diff --git a/src/gallium/drivers/svga/svga_state_gs.c 
b/src/gallium/drivers/svga/svga_state_gs.c
index 19f0887..38d85f0 100644
--- a/src/gallium/drivers/svga/svga_state_gs.c
+++ b/src/gallium/drivers/svga/svga_state_gs.c
@@ -153,13 +153,12 @@ svga_reemit_gs_bindings(struct svga_context *svga)
if (!svga_need_to_rebind_resources(svga)) {
   ret =  svga->swc->resource_rebind(svga->swc, NULL, gbshader,
 SVGA_RELOC_READ);
-  goto out;
+   }
+   else {
+  ret = SVGA3D_vgpu10_SetShader(svga->swc, SVGA3D_SHADERTYPE_GS,
+gbshader, shaderId);
}

-   ret = SVGA3D_vgpu10_SetShader(svga->swc, SVGA3D_SHADERTYPE_GS,
- gbshader, shaderId);
-
- out:
if (ret != PIPE_OK)
   return ret;

diff --git a/src/gallium/drivers/svga/svga_state_vs.c 
b/src/gallium/drivers/svga/svga_state_vs.c
index 3dfc9f4..ad93f60 100644
--- a/src/gallium/drivers/svga/svga_state_vs.c
+++ b/src/gallium/drivers/svga/svga_state_vs.c
@@ -227,16 +227,15 @@ svga_reemit_vs_bindings(struct svga_context *svga)
if (!svga_need_to_rebind_resources(svga)) {
   ret =  svga->swc->resource_rebind(svga->swc, NULL, gbshader,
 SVGA_RELOC_READ);
-  goto out;
+   }
+   else {
+  if (svga_have_vgpu10(svga))
+ ret = SVGA3D_vgpu10_SetShader(svga->swc, SVGA3D_SHADERTYPE_VS,
+   gbshader, shaderId);
+  else
+ ret = SVGA3D_SetGBShader(svga->swc, SVGA3D_SHADERTYPE_VS, gbshader);
}

-   if (svga_have_vgpu10(svga))
-  ret = SVGA3D_vgpu10_SetShader(svga->swc, SVGA3D_SHADERTYPE_VS,
-gbshader, shaderId);
-   else
-  ret = SVGA3D_SetGBShader(svga->swc, SVGA3D_SHADERTYPE_VS, gbshader);
-
- out:
if (ret != PIPE_OK)
   return ret;

--
2.7.4

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


Re: [Mesa-dev] [PATCH] loader_dri3/glx/egl: Reinstate the loader_dri3_vtable get_dri_screen callback

2018-02-15 Thread Brian Paul

I'm not too familiar with this code, but your changes look OK to me.

Reviewed-by: Brian Paul 

On 02/09/2018 01:37 AM, Thomas Hellstrom wrote:

Removing this callback caused rendering corruption in some multi-screen cases,
so it is reinstated but without the drawable argument which was never used
by implementations and was confusing since the drawable could have been
created with another screen.

Cc: "17.3" mesa-sta...@lists.freedesktop.org
Fixes: 5198e48a0d (loader_dri3/glx/egl: Remove the loader_dri3_vtable 
get_dri_screen callback)
Bugzilla: https://bugs.freedesktop.org/show_bug.cgi?id=105013
Reported-by: Daniel van Vugt 
Signed-off-by: Thomas Hellstrom 
---
  src/egl/drivers/dri2/platform_x11_dri3.c | 12 
  src/glx/dri3_glx.c   | 11 +++
  src/loader/loader_dri3_helper.c  | 12 +++-
  src/loader/loader_dri3_helper.h  |  1 +
  4 files changed, 35 insertions(+), 1 deletion(-)

diff --git a/src/egl/drivers/dri2/platform_x11_dri3.c 
b/src/egl/drivers/dri2/platform_x11_dri3.c
index 6e40eaa596..060b5f83a3 100644
--- a/src/egl/drivers/dri2/platform_x11_dri3.c
+++ b/src/egl/drivers/dri2/platform_x11_dri3.c
@@ -75,6 +75,17 @@ egl_dri3_get_dri_context(struct loader_dri3_drawable *draw)
 return dri2_ctx->dri_context;
  }
  
+static __DRIscreen *

+egl_dri3_get_dri_screen(void)
+{
+   _EGLContext *ctx = _eglGetCurrentContext();
+   struct dri2_egl_context *dri2_ctx;
+   if (!ctx)
+  return NULL;
+   dri2_ctx = dri2_egl_context(ctx);
+   return dri2_egl_display(dri2_ctx->base.Resource.Display)->dri_screen;
+}
+
  static void
  egl_dri3_flush_drawable(struct loader_dri3_drawable *draw, unsigned flags)
  {
@@ -88,6 +99,7 @@ static const struct loader_dri3_vtable egl_dri3_vtable = {
 .set_drawable_size = egl_dri3_set_drawable_size,
 .in_current_context = egl_dri3_in_current_context,
 .get_dri_context = egl_dri3_get_dri_context,
+   .get_dri_screen = egl_dri3_get_dri_screen,
 .flush_drawable = egl_dri3_flush_drawable,
 .show_fps = NULL,
  };
diff --git a/src/glx/dri3_glx.c b/src/glx/dri3_glx.c
index f280a8cef7..016f91b196 100644
--- a/src/glx/dri3_glx.c
+++ b/src/glx/dri3_glx.c
@@ -116,6 +116,16 @@ glx_dri3_get_dri_context(struct loader_dri3_drawable *draw)
 return (gc != &dummyContext) ? dri3Ctx->driContext : NULL;
  }
  
+static __DRIscreen *

+glx_dri3_get_dri_screen(void)
+{
+   struct glx_context *gc = __glXGetCurrentContext();
+   struct dri3_context *pcp = (struct dri3_context *) gc;
+   struct dri3_screen *psc = (struct dri3_screen *) pcp->base.psc;
+
+   return (gc != &dummyContext && psc) ? psc->driScreen : NULL;
+}
+
  static void
  glx_dri3_flush_drawable(struct loader_dri3_drawable *draw, unsigned flags)
  {
@@ -150,6 +160,7 @@ static const struct loader_dri3_vtable glx_dri3_vtable = {
 .set_drawable_size = glx_dri3_set_drawable_size,
 .in_current_context = glx_dri3_in_current_context,
 .get_dri_context = glx_dri3_get_dri_context,
+   .get_dri_screen = glx_dri3_get_dri_screen,
 .flush_drawable = glx_dri3_flush_drawable,
 .show_fps = glx_dri3_show_fps,
  };
diff --git a/src/loader/loader_dri3_helper.c b/src/loader/loader_dri3_helper.c
index fbda3d635c..2e3b6c619e 100644
--- a/src/loader/loader_dri3_helper.c
+++ b/src/loader/loader_dri3_helper.c
@@ -1311,6 +1311,7 @@ dri3_get_pixmap_buffer(__DRIdrawable *driDrawable, 
unsigned int format,
 xcb_sync_fence_t sync_fence;
 struct xshmfence *shm_fence;
 int  fence_fd;
+   __DRIscreen  *cur_screen;
  
 if (buffer)

return buffer;
@@ -1341,8 +1342,17 @@ dri3_get_pixmap_buffer(__DRIdrawable *driDrawable, 
unsigned int format,
 if (!bp_reply)
goto no_image;
  
+   /* Get the currently-bound screen or revert to using the drawable's screen if

+* no contexts are currently bound. The latter case is at least necessary 
for
+* obs-studio, when using Window Capture (Xcomposite) as a Source.
+*/
+   cur_screen = draw->vtable->get_dri_screen();
+   if (!cur_screen) {
+   cur_screen = draw->dri_screen;
+   }
+
 buffer->image = loader_dri3_create_image(draw->conn, bp_reply, format,
-draw->dri_screen, draw->ext->image,
+cur_screen, draw->ext->image,
  buffer);
 if (!buffer->image)
goto no_image;
diff --git a/src/loader/loader_dri3_helper.h b/src/loader/loader_dri3_helper.h
index 4ce98b8c59..839cba30df 100644
--- a/src/loader/loader_dri3_helper.h
+++ b/src/loader/loader_dri3_helper.h
@@ -99,6 +99,7 @@ struct loader_dri3_vtable {
 void (*set_drawable_size)(struct loader_dri3_drawable *, int, int);
 bool (*in_current_context)(struct loader_dri3_drawable *);
 __DRIcontext *(*get_dri_context)(struct loader_dri3_drawable *);
+   __DRIscreen *(*get_dri_screen)(void);
 

Re: [Mesa-dev] [PATCH v4 02/12] meson: add libswdri and libswkmsdri to link_with unconditionally

2018-02-15 Thread Emil Velikov
On 12 February 2018 at 19:27, Dylan Baker  wrote:
> Fixes: 6b4c7047d571 ("meson: build gallium nine state_tracker")
> Signed-off-by: Dylan Baker 
> ---
>  src/gallium/targets/d3dadapter9/meson.build | 13 +++--
>  1 file changed, 3 insertions(+), 10 deletions(-)
>
> diff --git a/src/gallium/targets/d3dadapter9/meson.build 
> b/src/gallium/targets/d3dadapter9/meson.build
> index 5476e80..f1b68fd 100644
> --- a/src/gallium/targets/d3dadapter9/meson.build
> +++ b/src/gallium/targets/d3dadapter9/meson.build
> @@ -1,4 +1,5 @@
>  # Copyright © 2017 Dylan Baker
> +# Copyright © 2018 Intel Corporation
>
>  # Permission is hereby granted, free of charge, to any person obtaining a 
> copy
>  # of this software and associated documentation files (the "Software"), to 
> deal
> @@ -31,20 +32,12 @@ gallium_nine_c_args = [
>  ]
>  gallium_nine_ld_args = []
>  gallium_nine_link_depends = []
> -gallium_nine_link_with = []
>
>  if with_ld_version_script
>gallium_nine_ld_args += ['-Wl,--version-script', 
> join_paths(meson.current_source_dir(), 'd3dadapter9.sym')]
>gallium_nine_link_depends += files('d3dadapter9.sym')
>  endif
>
> -if with_dri
> -  gallium_nine_link_with += libswdri
> -endif
> -if with_gallium_drisw_kms
> -  gallium_nine_link_with += libswkmsdri
> -endif
> -
>  libgallium_nine = shared_library(
>'d3dadapter9',
>[files('description.c', 'getproc.c', 'drm.c'), xmlpool_options_h],
> @@ -60,8 +53,8 @@ libgallium_nine = shared_library(
>link_depends : gallium_nine_link_depends,
>link_with : [
>  libgalliumvl_stub, libgallium, libnine_st, libmesa_util, libddebug,
> -librbug, libtrace, libpipe_loader_static, libws_null, libwsw,
> -gallium_nine_link_with,
> +librbug, libtrace, libpipe_loader_static, libws_null, libwsw, libswdi,
> +libswkmsdri,
I hope you build tested the series with and w/o gallium swrast - that
should cover most of the cases.

With the s/swdi/swdri/ typo fixed the series is
Reviewed-by: Emil Velikov 

For the future - one could even fold the link_with libraries into a
list and reuse across targets.
There's two instances vl stubbed and full blown ones.

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


Re: [Mesa-dev] [PATCH 01/16] intel/genxml/icl: Add gen11.xml

2018-02-15 Thread Emil Velikov
Hi Anuj,

On 13 February 2018 at 22:41, Anuj Phogat  wrote:
> Signed-off-by: Anuj Phogat 
> ---
> This patch adds a big xml file. So I couldn't send the patch
> to the list. Clamping down the patch so that reviewers can
> actually see what i'm doing in [PATCH 01/16 ]. The whole
> patch can be found in my 'review' branch on github.
>
>  src/intel/Makefile.sources   |3 +-
>  src/intel/genxml/gen11.xml   | 3787 
> ++
>  src/intel/genxml/meson.build |1 +

Can you please add an Android blurb in src/intel/Android.genxml.mk
Just copy the 4 lines of gen10_pack.h + sed s/gen10/gen11/

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


Re: [Mesa-dev] [PATCH 1/7] vulkan: Add KHR_display extension to anv and radv using DRM

2018-02-15 Thread Keith Packard
Jason Ekstrand  writes:

> It seems a little odd to me to default to opening the master node and then
> fall back to the render node if it doesn't work.  I suppose that's probably
> ok so long as we ensure that vkGetPhysicalDeviceDisplayPropertiesKHR
> returns no displays if we're on the render node.
>
> We could always go back to the DRM fd extension idea but I'm not coming up
> with something nice and clean in the 60 seconds I've thought about it.

As I said in the last comments about this section, Dave Airlie and I
added this code only recently so that we could test this extension
without also needing the kernel and X leasing changes.

I think we should decide how to enable this functionality "for real",
and I have two easy options:

 1) Use my KEITHP_kms_display extension (presumably renamed MESA), which
exposes a way to pass the DRM fd from the application into the
driver. This makes it possible for the application to get the FD
through any mechanism at all (including RandR or the new Wayland
extension) and leave that out of the Vulkan code entirely.

 2) Add a new extension which passes a new data structure that directs
the driver to open either the Render or Primary nodes.

When this is done, we can switch from the current code which tries to
open the Primary node whenever the KHR_display extension is requested.

> Would it make anything easier if we just storred the DRM struct here?  "No"
> is a perfectly valid answer.

Nope -- once we add the acquire_xlib extension, we get modes through
either X or DRM, depending on whether we're pre-lease or post-lease.

> Any particular reason why the list of modes is global and not in the
> connector?  It seems like it would be a tiny bit more efficient and
> convenient to put the list in the connector.

I think you're right. I have some vague memory of a lifetime issue with
connectors, but can't think of what it might be, even after reviewing
the relevant parts of the Vulkan spec. I've gone ahead and changed it;
seems to work fine.

>> +   LIST_FOR_EACH_ENTRY(display_mode, &wsi->display_modes, list)
>> +  if (display_mode->connector == connector)
>> + display_mode->valid = false;
>>
>
> Please use braces for loops containing more than one line.

Well, that was easy to fix -- the condition is now gone :-)

> Since we're allocating these in a physical device query, we need to use the
> INSTANCE scope.  the OBJECT scope is intended for vkCreate functions to
> allocated data that will live no longer than the associated vkDestroy
> function.

Thanks! The whole Vulkan memory model remains a mystery to me.

I've changed allocation of wsi_display_mode and wsi_display_connector to
use SCOPE_INSTANCE. VkIceSurfaceDisplay, wsi_display_fence and
wsi_display_swapchain remain using SCOPE_OBJECT.

I've also changed *all* instances of vk_alloc to use
vk_zalloc. These are all small data structures allocated only during
application startup, so I think the benefit of known memory contents is
worth the cost of memset.

> Hooray for obviously false fixed constants!
>
> I know the answer to this will be "EDIDs lie, never trust them!" but can we
> get the real value somehow?  As someone who has a 13" laptop with a
> 3200x1800 display, I know that number isn't always right. :-)

Yes, we could dig the real value out of the EDID, but we'd have to parse
the entire EDID to manage that. I don't want to stick an EDID parser
directly in Mesa, so I'm kinda waiting for someone to create a separate
EDID parsing library that the X server, Mesa and others can share. Until
then, I'd prefer to just lie here.

> double-;;

Thx. I remember seeing this while reviewing patches and forgot all about
it...

> From the Vulkan spec:
>
> Note:
> For devices which have no natural value to return here, implementations
> *should* return the maximum resolution supported.
>
> We should walk the list and pick the biggest one.

I did this intentionally -- most monitors have a preferred resolution,
which is their native pixel size. And, we want to tell applications to
use that size, even if the monitor offers a larger (presumabl scaled)
resolution in their mode list.

> See question about MM_PER_PIXEL above

Yeah, see response about not boiling the EDID ocean above ;-)

> I know i915 can do better at least in some cases.  Is there a practical way
> to expose this?  If not, I'm fine with just exposing IDENTITY.

I'm not seeing this exposed through the common DRM mode interfaces
yet. We should probably consider adding this to the kernel and then
adding it here.

> This error is not allowed for this function.  We should just write 0 to
> property_count and return VK_SUCCESS.  Maybe add some asserts for debug
> builds if you really think this shouldn't ever happen.

I bet it will happen if you VT switch away and then try this function.

I've added this at the end of the function:

bail:
   *property_count = 0;
   return VK_SUCCESS;

> This could be made a 

Re: [Mesa-dev] [PATCH 02/16] intel/genxml/icl: Generate packing headers

2018-02-15 Thread Emil Velikov
On 13 February 2018 at 19:15, Anuj Phogat  wrote:
> Signed-off-by: Anuj Phogat 
> ---
>  src/intel/Android.genxml.mk   | 5 +
>  src/intel/Makefile.sources| 3 ++-
>  src/intel/genxml/genX_pack.h  | 2 ++
>  src/intel/genxml/gen_macros.h | 3 +++
>  4 files changed, 12 insertions(+), 1 deletion(-)
>
> diff --git a/src/intel/Android.genxml.mk b/src/intel/Android.genxml.mk
> index e4d8dd8b94..8b867920c3 100644
> --- a/src/intel/Android.genxml.mk
> +++ b/src/intel/Android.genxml.mk
> @@ -101,6 +101,11 @@ $(intermediates)/genxml/gen10_pack.h: PRIVATE_XML := 
> $(LOCAL_PATH)/genxml/gen10.
>  $(intermediates)/genxml/gen10_pack.h: $(LOCAL_PATH)/genxml/gen10.xml 
> $(LOCAL_PATH)/genxml/gen_pack_header.py
> $(call header-gen)
>
> +$(intermediates)/genxml/gen11_pack.h: PRIVATE_SCRIPT := $(MESA_PYTHON2) 
> $(LOCAL_PATH)/genxml/gen_pack_header.py
> +$(intermediates)/genxml/gen11_pack.h: PRIVATE_XML := 
> $(LOCAL_PATH)/genxml/gen11.xml
> +$(intermediates)/genxml/gen11_pack.h: $(LOCAL_PATH)/genxml/gen11.xml 
> $(LOCAL_PATH)/genxml/gen_pack_header.py
> +   $(call header-gen)
> +
... and here it is.

I second Kenneth - please keep the build bits in one patch.
Be that squashing 1+2 or keeping git add gen10.xml in patch 01 and the
build in 02.

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


Re: [Mesa-dev] [PATCH 05/16] intel/isl/icl: Build and use gen11 surface state emit functions

2018-02-15 Thread Emil Velikov
On 13 February 2018 at 19:15, Anuj Phogat  wrote:
> Signed-off-by: Anuj Phogat 
> ---
>  src/intel/Android.isl.mk   | 20 
>  src/intel/Makefile.isl.am  |  4 
>  src/intel/Makefile.sources |  4 
>  src/intel/isl/isl.c|  3 +++
>  src/intel/isl/isl_priv.h   |  3 +++
>  src/intel/isl/meson.build  |  2 +-
>  6 files changed, 35 insertions(+), 1 deletion(-)
>
Patch looks spot on. Patches 01, 02 and 05 are
Reviewed-by: Emil Velikov 

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


Re: [Mesa-dev] [PATCH 06/11] meson: Move Wayland dmabuf to wayland-drm

2018-02-15 Thread Emil Velikov
On 15 February 2018 at 15:57, Daniel Stone  wrote:
> As the comment notes: linux-dmabuf has nothing to do with wayland-drm,
> but we need a single place to build these files we can use from both EGL
> and Vulkan, which is guaranteed to be included before both EGL and
> Vulkan WSI.
>
> Signed-off-by: Daniel Stone 
> Cc: Emil Velikov 
Thanks Dan,

Reviewed-by: Emil Velikov 

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


Re: [Mesa-dev] [PATCH 01/29] blorp: Handle the RGB workaround more like other workarounds

2018-02-15 Thread Pohjolainen, Topi
On Fri, Jan 26, 2018 at 05:59:30PM -0800, Jason Ekstrand wrote:
> The previous version was sort-of strapped on in that it just adjusted
> the blit rectangle and trusted in the fact that we would use texelFetch
> and round to the nearest integer to ensure that the component positions
> matched.  This new version, while slightly more complicated, is more
> accurate because all three components end up with exactly the same
> dst_pos and so they will get interpolated and sampled at the same
> texture coordinate.  This makes the workaround suitable for using with
> scaled blits.

This can be also seen as being more simple. It is (as you said yourself) now
like the other workarounds.

Reviewed-by: Topi Pohjolainen 

> ---
>  src/intel/blorp/blorp_blit.c | 60 
> ++--
>  1 file changed, 30 insertions(+), 30 deletions(-)
> 
> diff --git a/src/intel/blorp/blorp_blit.c b/src/intel/blorp/blorp_blit.c
> index 0757db0..7d717da 100644
> --- a/src/intel/blorp/blorp_blit.c
> +++ b/src/intel/blorp/blorp_blit.c
> @@ -1155,6 +1155,20 @@ brw_blorp_build_nir_shader(struct blorp_context 
> *blorp, void *mem_ctx,
>key->dst_layout);
> }
>  
> +   nir_ssa_def *comp = NULL;
> +   if (key->dst_rgb) {
> +  /* The destination image is bound as a red texture three times as wide
> +   * as the actual image.  Our shader is effectively running one color
> +   * component at a time.  We need to save off the component and adjust
> +   * the destination position.
> +   */
> +  assert(dst_pos->num_components == 2);
> +  nir_ssa_def *dst_x = nir_channel(&b, dst_pos, 0);
> +  comp = nir_umod(&b, dst_x, nir_imm_int(&b, 3));
> +  dst_pos = nir_vec2(&b, nir_idiv(&b, dst_x, nir_imm_int(&b, 3)),
> + nir_channel(&b, dst_pos, 1));
> +   }
> +
> /* Now (X, Y, S) = decode_msaa(dst_samples, detile(dst_tiling, offset)).
>  *
>  * That is: X, Y and S now contain the true coordinates and sample index 
> of
> @@ -1285,8 +1299,6 @@ brw_blorp_build_nir_shader(struct blorp_context *blorp, 
> void *mem_ctx,
> * from the source color and write that to destination red.
> */
>assert(dst_pos->num_components == 2);
> -  nir_ssa_def *comp =
> - nir_umod(&b, nir_channel(&b, dst_pos, 0), nir_imm_int(&b, 3));
>  
>nir_ssa_def *color_component =
>   nir_bcsel(&b, nir_ieq(&b, comp, nir_imm_int(&b, 0)),
> @@ -1549,16 +1561,13 @@ struct blt_coords {
>  
>  static void
>  surf_fake_rgb_with_red(const struct isl_device *isl_dev,
> -   struct brw_blorp_surface_info *info,
> -   uint32_t *x, uint32_t *width)
> +   struct brw_blorp_surface_info *info)
>  {
> blorp_surf_convert_to_single_slice(isl_dev, info);
>  
> info->surf.logical_level0_px.width *= 3;
> info->surf.phys_level0_sa.width *= 3;
> info->tile_x_sa *= 3;
> -   *x *= 3;
> -   *width *= 3;
>  
> enum isl_format red_format;
> switch (info->view.format) {
> @@ -1588,28 +1597,6 @@ surf_fake_rgb_with_red(const struct isl_device 
> *isl_dev,
> info->surf.format = info->view.format = red_format;
>  }
>  
> -static void
> -fake_dest_rgb_with_red(const struct isl_device *dev,
> -   struct blorp_params *params,
> -   struct brw_blorp_blit_prog_key *wm_prog_key,
> -   struct blt_coords *coords)
> -{
> -   /* Handle RGB destinations for blorp_copy */
> -   const struct isl_format_layout *dst_fmtl =
> -  isl_format_get_layout(params->dst.surf.format);
> -
> -   if (dst_fmtl->bpb % 3 == 0) {
> -  uint32_t dst_x = coords->x.dst0;
> -  uint32_t dst_width = coords->x.dst1 - dst_x;
> -  surf_fake_rgb_with_red(dev, ¶ms->dst,
> - &dst_x, &dst_width);
> -  coords->x.dst0 = dst_x;
> -  coords->x.dst1 = dst_x + dst_width;
> -  wm_prog_key->dst_rgb = true;
> -  wm_prog_key->need_dst_offset = true;
> -   }
> -}
> -
>  enum blit_shrink_status {
> BLIT_NO_SHRINK = 0,
> BLIT_WIDTH_SHRINK = 1,
> @@ -1628,8 +1615,6 @@ try_blorp_blit(struct blorp_batch *batch,
>  {
> const struct gen_device_info *devinfo = batch->blorp->isl_dev->info;
>  
> -   fake_dest_rgb_with_red(batch->blorp->isl_dev, params, wm_prog_key, 
> coords);
> -
> if (isl_format_has_sint_channel(params->src.view.format)) {
>wm_prog_key->texture_data_type = nir_type_int;
> } else if (isl_format_has_uint_channel(params->src.view.format)) {
> @@ -1835,6 +1820,21 @@ try_blorp_blit(struct blorp_batch *batch,
> params->src.view.base_level);
> }
>  
> +   if (isl_format_get_layout(params->dst.view.format)->bpb % 3 == 0) {
> +  /* We can't render to  RGB formats natively because they aren't a
> +   * power-of-two size.  Instead, we fake them by using a red format
> +   * with the same channel type and size and emit

Re: [Mesa-dev] [PATCH 0/6] OpenGL 3.1 + ARB_compatibility and related stuff (v2)

2018-02-15 Thread Marek Olšák
FYI, these GLSL 1.40 tests pass:
https://cgit.freedesktop.org/~mareko/piglit/commit/?h=deqp&id=eeccd7b98e74e7dfefd02611563b0edbf2358327
glslparsertest dependency:
https://cgit.freedesktop.org/~mareko/piglit/commit/?h=deqp&id=e3f6d5fc68b61c23c7327083bed6c90333119d75

I plan to send out those piglit patches after I know that the GLSL
1.50 tests are also correct.

Marek


On Thu, Feb 15, 2018 at 1:11 AM, Marek Olšák  wrote:
> Hi,
>
> This is the second version of GL 3.1 compatibility support patches.
> There is also ARB_enhanced_layouts for the compatibility context and
> other related changes.
>
> Please review.
>
> Thanks,
> Marek
___
mesa-dev mailing list
mesa-dev@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/mesa-dev


Re: [Mesa-dev] [PATCH 07/15] util/bitset: Add C++ wrapper for static-size bitsets.

2018-02-15 Thread Francisco Jerez
Eric Engestrom  writes:

> On Wednesday, 2018-02-14 13:18:29 -0800, Francisco Jerez wrote:
>> ---
>>  src/util/bitset.h | 114 
>> ++
>>  1 file changed, 114 insertions(+)
>> 
>> diff --git a/src/util/bitset.h b/src/util/bitset.h
>> index 2404ce7f630..7bb5f3c83cf 100644
>> --- a/src/util/bitset.h
>> +++ b/src/util/bitset.h
>> @@ -132,4 +132,118 @@ __bitset_next_set(unsigned i, BITSET_WORD *tmp,
>> for (__tmp = *(__set), __i = 0; \
>>  (__i = __bitset_next_set(__i, &__tmp, __set, __size)) < __size;)
>>  
>> +#ifdef __cplusplus
>> +
>> +/**
>> + * Simple C++ wrapper of a bitset type of static size, with value semantics
>> + * and basic bitwise arithmetic operators.  The operators defined below are
>> + * expected to have the same semantics as the same operator applied to other
>> + * fundamental integer types.  T is the name of the struct to instantiate
>> + * it as, and N is the number of bits in the bitset.
>> + */
>
> Any reason not to use std::bitset for this?
> http://en.cppreference.com/w/cpp/utility/bitset
>

It would be nice, but I don't think std::bitset is guaranteed to be a
standard layout type which the next patch relies on.

>> +#define DECLARE_BITSET_T(T, N) struct T {   \
>> +  /* XXX - Replace this with an implicitly-defined  \
>> +   * constructor when support for C++11 defaulted   \
>> +   * constructors can be assumed (available on GCC 4.4 and  \
>> +   * later) in order to make the object trivially   \
>> +   * constructible like a fundamental integer type for  \
>> +   * convenience.   \
>> +   */   \
>> +  T()   \
>> +  { \
>> +  } \
>> +\
>> +  T(BITSET_WORD x)  \
>> +  { \
>> + for (unsigned i = 0; i < BITSET_WORDS(N); i++, x = 0)  \
>> +words[i] = x;   \
>> +  } \
>> +\
>> +  EXPLICIT_CONVERSION   \
>> +  operator bool() const \
>> +  { \
>> + for (unsigned i = 0; i < BITSET_WORDS(N); i++) \
>> +if (words[i])   \
>> +   return true; \
>> + return false;  \
>> +  } \
>> +\
>> +  friend bool   \
>> +  operator==(const T &b, const T &c)\
>> +  { \
>> + return BITSET_EQUAL(b.words, c.words); \
>> +  } \
>> +\
>> +  friend bool   \
>> +  operator!=(const T &b, const T &c)\
>> +  { \
>> + return !(b == c);  \
>> +  } \
>> +\
>> +  friend T  \
>> +  operator~(const T &b) \
>> +  { \
>> + T c;   \
>> + for (unsigned i = 0; i < BITSET_WORDS(N); i++) \
>> +c.words[i] = ~b.words[i];   \
>> + return c;  \
>> +  } \
>> +\
>> +  T &   \
>> +  operator|=(const T &b)\
>> +  { \
>> + for (unsigned i = 0; i < BITSET_WORDS(N); i++) \
>> +words[i] |= b.words[i]; \
>> + return *this;  \
>>

Re: [Mesa-dev] [PATCH v4 02/12] meson: add libswdri and libswkmsdri to link_with unconditionally

2018-02-15 Thread Dylan Baker
Quoting Emil Velikov (2018-02-15 09:37:01)
> On 12 February 2018 at 19:27, Dylan Baker  wrote:
> > Fixes: 6b4c7047d571 ("meson: build gallium nine state_tracker")
> > Signed-off-by: Dylan Baker 
> > ---
> >  src/gallium/targets/d3dadapter9/meson.build | 13 +++--
> >  1 file changed, 3 insertions(+), 10 deletions(-)
> >
> > diff --git a/src/gallium/targets/d3dadapter9/meson.build 
> > b/src/gallium/targets/d3dadapter9/meson.build
> > index 5476e80..f1b68fd 100644
> > --- a/src/gallium/targets/d3dadapter9/meson.build
> > +++ b/src/gallium/targets/d3dadapter9/meson.build
> > @@ -1,4 +1,5 @@
> >  # Copyright © 2017 Dylan Baker
> > +# Copyright © 2018 Intel Corporation
> >
> >  # Permission is hereby granted, free of charge, to any person obtaining a 
> > copy
> >  # of this software and associated documentation files (the "Software"), to 
> > deal
> > @@ -31,20 +32,12 @@ gallium_nine_c_args = [
> >  ]
> >  gallium_nine_ld_args = []
> >  gallium_nine_link_depends = []
> > -gallium_nine_link_with = []
> >
> >  if with_ld_version_script
> >gallium_nine_ld_args += ['-Wl,--version-script', 
> > join_paths(meson.current_source_dir(), 'd3dadapter9.sym')]
> >gallium_nine_link_depends += files('d3dadapter9.sym')
> >  endif
> >
> > -if with_dri
> > -  gallium_nine_link_with += libswdri
> > -endif
> > -if with_gallium_drisw_kms
> > -  gallium_nine_link_with += libswkmsdri
> > -endif
> > -
> >  libgallium_nine = shared_library(
> >'d3dadapter9',
> >[files('description.c', 'getproc.c', 'drm.c'), xmlpool_options_h],
> > @@ -60,8 +53,8 @@ libgallium_nine = shared_library(
> >link_depends : gallium_nine_link_depends,
> >link_with : [
> >  libgalliumvl_stub, libgallium, libnine_st, libmesa_util, libddebug,
> > -librbug, libtrace, libpipe_loader_static, libws_null, libwsw,
> > -gallium_nine_link_with,
> > +librbug, libtrace, libpipe_loader_static, libws_null, libwsw, libswdi,
> > +libswkmsdri,
> I hope you build tested the series with and w/o gallium swrast - that
> should cover most of the cases.
> 
> With the s/swdi/swdri/ typo fixed the series is
> Reviewed-by: Emil Velikov 
> 
> For the future - one could even fold the link_with libraries into a
> list and reuse across targets.
> There's two instances vl stubbed and full blown ones.
> 
> -Emil

Thanks!

I did test this (before pushing) with
-Dgallium-drivers=swrast -Ddri-drivers= -Dvulkan-drivers= -Dglx=gallium-xlib
and an error in the real swdri case.

I looked into putting the libs into lists of some kind, I still think that would
be worth looking into.

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 02/16] intel/genxml/icl: Generate packing headers

2018-02-15 Thread Anuj Phogat
On Thu, Feb 15, 2018 at 9:49 AM, Emil Velikov  wrote:
> On 13 February 2018 at 19:15, Anuj Phogat  wrote:
>> Signed-off-by: Anuj Phogat 
>> ---
>>  src/intel/Android.genxml.mk   | 5 +
>>  src/intel/Makefile.sources| 3 ++-
>>  src/intel/genxml/genX_pack.h  | 2 ++
>>  src/intel/genxml/gen_macros.h | 3 +++
>>  4 files changed, 12 insertions(+), 1 deletion(-)
>>
>> diff --git a/src/intel/Android.genxml.mk b/src/intel/Android.genxml.mk
>> index e4d8dd8b94..8b867920c3 100644
>> --- a/src/intel/Android.genxml.mk
>> +++ b/src/intel/Android.genxml.mk
>> @@ -101,6 +101,11 @@ $(intermediates)/genxml/gen10_pack.h: PRIVATE_XML := 
>> $(LOCAL_PATH)/genxml/gen10.
>>  $(intermediates)/genxml/gen10_pack.h: $(LOCAL_PATH)/genxml/gen10.xml 
>> $(LOCAL_PATH)/genxml/gen_pack_header.py
>> $(call header-gen)
>>
>> +$(intermediates)/genxml/gen11_pack.h: PRIVATE_SCRIPT := $(MESA_PYTHON2) 
>> $(LOCAL_PATH)/genxml/gen_pack_header.py
>> +$(intermediates)/genxml/gen11_pack.h: PRIVATE_XML := 
>> $(LOCAL_PATH)/genxml/gen11.xml
>> +$(intermediates)/genxml/gen11_pack.h: $(LOCAL_PATH)/genxml/gen11.xml 
>> $(LOCAL_PATH)/genxml/gen_pack_header.py
>> +   $(call header-gen)
>> +
> ... and here it is.
>
> I second Kenneth - please keep the build bits in one patch.
> Be that squashing 1+2 or keeping git add gen10.xml in patch 01 and the
> build in 02.
>
> Thanks
> Emil
I'll move the build changes in patch 2. Thanks.
___
mesa-dev mailing list
mesa-dev@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/mesa-dev


[Mesa-dev] [PATCH 14/16] intel/common/icl: Add has_sample_with_hiz flag in gen_device_info

2018-02-15 Thread Anuj Phogat
Sampling from hiz is enabled in i965 for GEN9+ but this feature has
been removed from gen11. So, this new flag will be useful to turn
the feature on/off for different gen h/w. It will be used later
in a patch adding device info for gen11.

Suggested-by: Kenneth Graunke 
Signed-off-by: Anuj Phogat 
Cc: Kenneth Graunke 
---
 src/intel/common/gen_device_info.c| 7 +++
 src/intel/common/gen_device_info.h| 2 +-
 src/mesa/drivers/dri/i965/intel_mipmap_tree.c | 5 +
 3 files changed, 9 insertions(+), 5 deletions(-)

diff --git a/src/intel/common/gen_device_info.c 
b/src/intel/common/gen_device_info.c
index c0eb7c3c35..a08a13a32a 100644
--- a/src/intel/common/gen_device_info.c
+++ b/src/intel/common/gen_device_info.c
@@ -311,12 +311,16 @@ static const struct gen_device_info 
gen_device_info_hsw_gt3 = {
},
 };
 
+/* It's unclear how well supported sampling from the hiz buffer is on GEN8,
+ * so keep things conservative for now and set has_sample_with_hiz = false.
+ */
 #define GEN8_FEATURES   \
.gen = 8,\
.has_hiz_and_separate_stencil = true,\
.has_resource_streamer = true,   \
.must_use_separate_stencil = true,   \
.has_llc = true, \
+   .has_sample_with_hiz = false,\
.has_pln = true, \
.supports_simd16_3src = true,\
.has_surface_tile_offset = true, \
@@ -451,6 +455,7 @@ static const struct gen_device_info gen_device_info_chv = {
GEN9_HW_INFO,   \
.gt = 1,\
.has_llc = false,   \
+   .has_sample_with_hiz = true,\
.num_slices = 1,\
.num_thread_per_eu = 6, \
.max_vs_threads = 112,  \
@@ -502,6 +507,7 @@ static const struct gen_device_info gen_device_info_chv = {
 #define GEN9_FEATURES   \
GEN8_FEATURES,   \
GEN9_HW_INFO,\
+   .has_sample_with_hiz = true, \
.num_thread_per_eu = 7
 
 static const struct gen_device_info gen_device_info_skl_gt1 = {
@@ -695,6 +701,7 @@ static const struct gen_device_info gen_device_info_cfl_gt3 
= {
 #define GEN10_FEATURES(_gt, _slices, _subslices, _l3) \
GEN8_FEATURES,   \
GEN10_HW_INFO,   \
+   .has_sample_with_hiz = true, \
.gt = _gt,   \
.num_slices = _slices,   \
.num_subslices = _subslices, \
diff --git a/src/intel/common/gen_device_info.h 
b/src/intel/common/gen_device_info.h
index 30ddd905be..fd9c17531d 100644
--- a/src/intel/common/gen_device_info.h
+++ b/src/intel/common/gen_device_info.h
@@ -55,7 +55,7 @@ struct gen_device_info
 
bool has_hiz_and_separate_stencil;
bool must_use_separate_stencil;
-
+   bool has_sample_with_hiz;
bool has_llc;
 
bool has_pln;
diff --git a/src/mesa/drivers/dri/i965/intel_mipmap_tree.c 
b/src/mesa/drivers/dri/i965/intel_mipmap_tree.c
index da5e3b0989..6d35c9d392 100644
--- a/src/mesa/drivers/dri/i965/intel_mipmap_tree.c
+++ b/src/mesa/drivers/dri/i965/intel_mipmap_tree.c
@@ -1911,10 +1911,7 @@ intel_miptree_sample_with_hiz(struct brw_context *brw,
 {
const struct gen_device_info *devinfo = &brw->screen->devinfo;
 
-   /* It's unclear how well supported sampling from the hiz buffer is on GEN8,
-* so keep things conservative for now and never enable it unless we're 
SKL+.
-*/
-   if (devinfo->gen < 9) {
+   if (!devinfo->has_sample_with_hiz) {
   return false;
}
 
-- 
2.13.6

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


[Mesa-dev] [PATCH V2 16/16] i965/icl: Add render target flush after uploading binding table

2018-02-15 Thread Anuj Phogat
From PIPE_CONTROL command description in gfxspecs:

"Whenever a Binding Table Index (BTI) used by a Render Taget Message
 points to a different RENDER_SURFACE_STATE, SW must issue a Render
 Target Cache Flush by enabling this bit. When render target flush
 is set due to new association of BTI, PS Scoreboard Stall bit must
 be set in this packet."

V2: Move the PIPE_CONTROL to update_renderbuffer_surfaces() in
brw_wm_surface_state.c (Ken).

Fixes a fulsim error and a GPU hang described in below JIRA.
JIRA: MD5-322
Signed-off-by: Anuj Phogat 
---
 src/mesa/drivers/dri/i965/brw_wm_surface_state.c | 14 ++
 1 file changed, 14 insertions(+)

diff --git a/src/mesa/drivers/dri/i965/brw_wm_surface_state.c 
b/src/mesa/drivers/dri/i965/brw_wm_surface_state.c
index 44c87df17d..84c5a81227 100644
--- a/src/mesa/drivers/dri/i965/brw_wm_surface_state.c
+++ b/src/mesa/drivers/dri/i965/brw_wm_surface_state.c
@@ -971,6 +971,20 @@ update_renderbuffer_surfaces(struct brw_context *brw)
   emit_null_surface_state(brw, fb, &surf_offsets[rt_start]);
}
 
+   /* From PIPE_CONTROL command description in gfxspecs:
+
+  "Whenever a Binding Table Index (BTI) used by a Render Taget Message
+   points to a different RENDER_SURFACE_STATE, SW must issue a Render
+   Target Cache Flush by enabling this bit. When render target flush
+   is set due to new association of BTI, PS Scoreboard Stall bit must
+   be set in this packet."
+   */
+   if (devinfo->gen >= 11) {
+  brw_emit_pipe_control_flush(brw,
+  PIPE_CONTROL_RENDER_TARGET_FLUSH |
+  PIPE_CONTROL_STALL_AT_SCOREBOARD);
+   }
+
brw->ctx.NewDriverState |= BRW_NEW_SURFACES;
 }
 
-- 
2.13.6

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


Re: [Mesa-dev] [PATCH 07/11] vulkan/wsi/wayland: Add support for zwp_dmabuf

2018-02-15 Thread Jason Ekstrand
On Thu, Feb 15, 2018 at 7:57 AM, Daniel Stone  wrote:

> zwp_linux_dmabuf_v1 lets us use multi-planar images and buffer
> modifiers.
>
> Signed-off-by: Daniel Stone 
> ---
>  src/vulkan/Makefile.am  |  10 +++
>  src/vulkan/Makefile.sources |   4 +-
>  src/vulkan/wsi/meson.build  |   2 +
>  src/vulkan/wsi/wsi_common_wayland.c | 138 ++
> ++
>  4 files changed, 139 insertions(+), 15 deletions(-)
>
> diff --git a/src/vulkan/Makefile.am b/src/vulkan/Makefile.am
> index 4fdaedf38c1..c7813ce05e3 100644
> --- a/src/vulkan/Makefile.am
> +++ b/src/vulkan/Makefile.am
> @@ -71,6 +71,16 @@ wsi/wayland-drm-client-protocol.h : $(WL_DRM_XML)
> $(MKDIR_GEN)
> $(AM_V_GEN)$(WAYLAND_SCANNER) client-header < $< > $@
>
> +WL_DMABUF_XML = $(WAYLAND_PROTOCOLS_DATADIR)/unstable/linux-dmabuf/linux-
> dmabuf-unstable-v1.xml
> +
> +wsi/linux-dmabuf-unstable-v1-protocol.c : $(WL_DMABUF_XML)
> +   $(MKDIR_GEN)
> +   $(AM_V_GEN)$(WAYLAND_SCANNER) code < $< > $@
> +
> +wsi/linux-dmabuf-unstable-v1-client-protocol.h : $(WL_DMABUF_XML)
> +   $(MKDIR_GEN)
> +   $(AM_V_GEN)$(WAYLAND_SCANNER) client-header < $< > $@
> +
>  if HAVE_PLATFORM_WAYLAND
>  AM_CPPFLAGS += \
> -I$(top_builddir)/src/vulkan/wsi \
> diff --git a/src/vulkan/Makefile.sources b/src/vulkan/Makefile.sources
> index a0a24ce7de8..101a94349c6 100644
> --- a/src/vulkan/Makefile.sources
> +++ b/src/vulkan/Makefile.sources
> @@ -11,7 +11,9 @@ VULKAN_WSI_WAYLAND_FILES := \
>
>  VULKAN_WSI_WAYLAND_GENERATED_FILES := \
> wsi/wayland-drm-protocol.c \
> -   wsi/wayland-drm-client-protocol.h
> +   wsi/wayland-drm-client-protocol.h \
> +   wsi/linux-dmabuf-unstable-v1-protocol.c \
> +   wsi/linux-dmabuf-unstable-v1-client-protocol.h
>
>  VULKAN_WSI_X11_FILES := \
> wsi/wsi_common_x11.c \
> diff --git a/src/vulkan/wsi/meson.build b/src/vulkan/wsi/meson.build
> index 66ccc8316ec..223c8ca357e 100644
> --- a/src/vulkan/wsi/meson.build
> +++ b/src/vulkan/wsi/meson.build
> @@ -54,6 +54,8 @@ if with_platform_wayland
>files_vulkan_wsi += [
>  wayland_drm_client_protocol_h,
>  wayland_drm_protocol_c,
> +linux_dmabuf_unstable_v1_client_protocol_h,
> +linux_dmabuf_unstable_v1_protocol_c,
>]
>  endif
>
> diff --git a/src/vulkan/wsi/wsi_common_wayland.c
> b/src/vulkan/wsi/wsi_common_wayland.c
> index 1162b92c35f..26acde194d6 100644
> --- a/src/vulkan/wsi/wsi_common_wayland.c
> +++ b/src/vulkan/wsi/wsi_common_wayland.c
> @@ -31,10 +31,13 @@
>  #include 
>  #include 
>
> +#include 
> +
>  #include "vk_util.h"
>  #include "wsi_common_private.h"
>  #include "wsi_common_wayland.h"
>  #include "wayland-drm-client-protocol.h"
> +#include "linux-dmabuf-unstable-v1-client-protocol.h"
>
>  #include 
>  #include 
> @@ -53,11 +56,17 @@ struct wsi_wl_display {
> struct wl_display *  wl_display_wrapper;
> struct wl_event_queue *  queue;
> struct wl_drm *  drm;
> +   struct zwp_linux_dmabuf_v1 * dmabuf;
>
> struct wsi_wayland *wsi_wl;
> /* Vector of VkFormats supported */
> struct u_vectorformats;
>
> +   struct {
> +  struct u_vector   argb;
> +  struct u_vector   xrgb;
> +   } modifiers;
> +
> uint32_t capabilities;
>
> /* Only used for displays created by wsi_wl_display_create */
> @@ -223,6 +232,53 @@ static const struct wl_drm_listener drm_listener = {
> drm_handle_capabilities,
>  };
>
> +static void
> +dmabuf_handle_format(void *data, struct zwp_linux_dmabuf_v1 *dmabuf,
> + uint32_t format)
> +{
> +   /* Formats are implicitly advertised by the modifier event, so we
> ignore
> +* them here. */
> +}
> +
> +static void
> +dmabuf_handle_modifier(void *data, struct zwp_linux_dmabuf_v1 *dmabuf,
> +   uint32_t format, uint32_t modifier_hi,
> +   uint32_t modifier_lo)
> +{
> +   struct wsi_wl_display *display = data;
> +   uint64_t *mod = NULL;
> +
> +   /* If we're not fetching formats, don't fetch modifiers either. */
> +   if (display->formats.element_size == 0)
> +  return;
> +
> +   if (modifier_hi == (DRM_FORMAT_MOD_INVALID >> 32) &&
> +   modifier_lo == (DRM_FORMAT_MOD_INVALID & 0x))
> +  return;
> +
> +   switch (format) {
> +   case WL_DRM_FORMAT_ARGB:
> +  mod = u_vector_add(&display->modifiers.argb);
> +  break;
> +   case WL_DRM_FORMAT_XRGB:
> +  mod = u_vector_add(&display->modifiers.xrgb);
> +  break;
> +   default:
> +  break;
> +   }
> +
> +   if (!mod)
> +  return;
> +
> +   *mod = (uint64_t) modifier_hi << 32;
> +   *mod |= (uint64_t) (modifier_lo & 0x);
> +}
> +
> +static const struct zwp_linux_dmabuf_v1_listener dmabuf_listener = {
> +   dmabuf_handle_format,
> +   

Re: [Mesa-dev] [PATCH 06/11] meson: Move Wayland dmabuf to wayland-drm

2018-02-15 Thread Dylan Baker
Quoting Daniel Stone (2018-02-15 07:57:36)
> As the comment notes: linux-dmabuf has nothing to do with wayland-drm,
> but we need a single place to build these files we can use from both EGL
> and Vulkan, which is guaranteed to be included before both EGL and
> Vulkan WSI.
> 
> Signed-off-by: Daniel Stone 
> Cc: Emil Velikov 
> ---
>  src/egl/meson.build | 14 --
>  src/egl/wayland/wayland-drm/meson.build | 22 ++
>  2 files changed, 22 insertions(+), 14 deletions(-)
> 
> diff --git a/src/egl/meson.build b/src/egl/meson.build
> index 6cd04567b0d..cd51ad308f6 100644
> --- a/src/egl/meson.build
> +++ b/src/egl/meson.build
> @@ -58,20 +58,6 @@ files_egl = files(
>'drivers/dri2/egl_dri2_fallbacks.h',
>  )
>  
> -linux_dmabuf_unstable_v1_protocol_c = custom_target(
> -  'linux-dmabuf-unstable-v1-protocol.c',
> -  input : wayland_dmabuf_xml,
> -  output : 'linux-dmabuf-unstable-v1-protocol.c',
> -  command : [prog_wl_scanner, 'code', '@INPUT@', '@OUTPUT@'],
> -)
> -
> -linux_dmabuf_unstable_v1_client_protocol_h = custom_target(
> -  'linux-dmabuf-unstable-v1-client-protocol.h',
> -  input : wayland_dmabuf_xml,
> -  output : 'linux-dmabuf-unstable-v1-client-protocol.h',
> -  command : [prog_wl_scanner, 'client-header', '@INPUT@', '@OUTPUT@'],
> -)
> -
>  g_egldispatchstubs_c = custom_target(
>'g_egldispatchstubs.c',
>input : [
> diff --git a/src/egl/wayland/wayland-drm/meson.build 
> b/src/egl/wayland/wayland-drm/meson.build
> index fa334880530..c627deaa1c3 100644
> --- a/src/egl/wayland/wayland-drm/meson.build
> +++ b/src/egl/wayland/wayland-drm/meson.build
> @@ -48,3 +48,25 @@ libwayland_drm = static_library(
>dependencies : [dep_wayland_server],
>build_by_default : false,
>  )
> +
> +# linux-dmabuf isn't part of wayland-drm, but this happens to be the only
> +# place which is a) guaranteed to be built when building either or both
> +# of EGL and Vulkan WSI, and b) guaranteed to be included before both,
> +# so the targets are actually defined by the time the files come to be
> +# used.
> +#
> +# Moving these to a src/wsi/ was suggested but shot down, so put these
> +# here for now as the maybe-least-bad solution.
> +linux_dmabuf_unstable_v1_protocol_c = custom_target(
> +  'linux-dmabuf-unstable-v1-protocol.c',
> +  input : wayland_dmabuf_xml,
> +  output : 'linux-dmabuf-unstable-v1-protocol.c',
> +  command : [prog_wl_scanner, 'code', '@INPUT@', '@OUTPUT@'],
> +)
> +
> +linux_dmabuf_unstable_v1_client_protocol_h = custom_target(
> +  'linux-dmabuf-unstable-v1-client-protocol.h',
> +  input : wayland_dmabuf_xml,
> +  output : 'linux-dmabuf-unstable-v1-client-protocol.h',
> +  command : [prog_wl_scanner, 'client-header', '@INPUT@', '@OUTPUT@'],
> +)
> -- 
> 2.14.3
> 
> ___
> mesa-dev mailing list
> mesa-dev@lists.freedesktop.org
> https://lists.freedesktop.org/mailman/listinfo/mesa-dev

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 03/11] vulkan/wsi: Add modifiers support to wsi_create_native_image

2018-02-15 Thread Jason Ekstrand
On Thu, Feb 15, 2018 at 7:57 AM, Daniel Stone  wrote:

> From: Jason Ekstrand 
>
> This involves extending our fake extension a bit to allow for additional
> querying and passing of modifier information.  The added bits are
> intended to look a lot like the draft of VK_EXT_image_drm_format_modifier.
> Once the extension gets finalized, we'll simply transition all of the
> structs used in wsi_common to the real extension structs.
>
> Reviewed-by: Daniel Stone 
> Signed-off-by: Daniel Stone 
> ---
>  src/vulkan/wsi/wsi_common.c | 164 ++
> ++
>  src/vulkan/wsi/wsi_common.h |  23 +
>  src/vulkan/wsi/wsi_common_private.h |   3 +
>  src/vulkan/wsi/wsi_common_wayland.c |   3 +-
>  src/vulkan/wsi/wsi_common_x11.c |   3 +-
>  5 files changed, 177 insertions(+), 19 deletions(-)
>
> diff --git a/src/vulkan/wsi/wsi_common.c b/src/vulkan/wsi/wsi_common.c
> index c235128e562..edba13a13de 100644
> --- a/src/vulkan/wsi/wsi_common.c
> +++ b/src/vulkan/wsi/wsi_common.c
> @@ -26,6 +26,8 @@
>  #include "util/macros.h"
>  #include "vk_util.h"
>
> +#include 
> +
>  VkResult
>  wsi_device_init(struct wsi_device *wsi,
>  VkPhysicalDevice pdevice,
> @@ -36,6 +38,8 @@ wsi_device_init(struct wsi_device *wsi,
>
> memset(wsi, 0, sizeof(*wsi));
>
> +   wsi->pdevice = pdevice;
> +
>  #define WSI_GET_CB(func) \
> PFN_vk##func func = (PFN_vk##func)proc_addr(pdevice, "vk" #func)
> WSI_GET_CB(GetPhysicalDeviceMemoryProperties);
> @@ -69,6 +73,7 @@ wsi_device_init(struct wsi_device *wsi,
> WSI_GET_CB(GetImageSubresourceLayout);
> WSI_GET_CB(GetMemoryFdKHR);
> WSI_GET_CB(GetPhysicalDeviceFormatProperties);
> +   WSI_GET_CB(GetPhysicalDeviceFormatProperties2KHR);
> WSI_GET_CB(ResetFences);
> WSI_GET_CB(QueueSubmit);
> WSI_GET_CB(WaitForFences);
> @@ -196,6 +201,9 @@ align_u32(uint32_t v, uint32_t a)
>  VkResult
>  wsi_create_native_image(const struct wsi_swapchain *chain,
>  const VkSwapchainCreateInfoKHR *pCreateInfo,
> +uint32_t num_modifier_lists,
> +const uint32_t *num_modifiers,
> +const uint64_t *const *modifiers,
>  struct wsi_image *image)
>  {
> const struct wsi_device *wsi = chain->wsi;
> @@ -205,11 +213,91 @@ wsi_create_native_image(const struct wsi_swapchain
> *chain,
> for (int i = 0; i < ARRAY_SIZE(image->fds); i++)
>image->fds[i] = -1;
>
> -   const struct wsi_image_create_info image_wsi_info = {
> +   struct wsi_image_create_info image_wsi_info = {
>.sType = VK_STRUCTURE_TYPE_WSI_IMAGE_CREATE_INFO_MESA,
>.pNext = NULL,
> -  .scanout = true,
> };
> +
> +   uint32_t image_modifier_count = 0, modifier_prop_count = 0;
> +   struct wsi_format_modifier_properties *modifier_props = NULL;
> +   uint64_t *image_modifiers = NULL;
> +   if (num_modifier_lists == 0) {
> +  /* If we don't have modifiers, fall back to the legacy "scanout"
> flag */
> +  image_wsi_info.scanout = true;
> +   } else {
> +  /* The winsys can't request modifiers if we don't support them. */
> +  assert(wsi->supports_modifiers);
> +  struct wsi_format_modifier_properties_list modifier_props_list = {
> + .sType = VK_STRUCTURE_TYPE_WSI_FORMAT_M
> ODIFIER_PROPERTIES_LIST_MESA,
> + .pNext = NULL,
> +  };
> +  VkFormatProperties2KHR format_props = {
> + .sType = VK_STRUCTURE_TYPE_FORMAT_PROPERTIES_2_KHR,
> + .pNext = &modifier_props_list,
> +  };
> +  wsi->GetPhysicalDeviceFormatProperties2KHR(wsi->pdevice,
> + pCreateInfo->imageFormat,
> + &format_props);
> +  assert(modifier_props_list.modifier_count > 0);
> +  modifier_props = vk_alloc(&chain->alloc,
> +sizeof(*modifier_props) *
> +modifier_props_list.modifier_count,
> +8,
> +VK_SYSTEM_ALLOCATION_SCOPE_COMMAND);
> +  if (!modifier_props) {
> + result = VK_ERROR_OUT_OF_HOST_MEMORY;
> + goto fail;
> +  }
> +
> +  modifier_props_list.modifier_properties = modifier_props;
> +  wsi->GetPhysicalDeviceFormatProperties2KHR(wsi->pdevice,
> + pCreateInfo->imageFormat,
> + &format_props);
> +  modifier_prop_count = modifier_props_list.modifier_count;
> +
> +  uint32_t max_modifier_count = 0;
> +  for (uint32_t l = 0; l < num_modifier_lists; l++)
> + max_modifier_count = MAX2(max_modifier_count, num_modifiers[l]);
> +
> +  image_modifiers = vk_alloc(&chain->alloc,
> + sizeof(*image_modifiers) *
> + max_modifier_count,
> + 8,
> 

[Mesa-dev] [PATCH 03/13] vbo: Remove get_vp_mode() and enum vp_mode.

2018-02-15 Thread Mathias . Froehlich
From: Mathias Fröhlich 

Is now unused.

Signed-off-by: Mathias Fröhlich 
---
 src/mesa/vbo/vbo_private.h | 27 ---
 1 file changed, 27 deletions(-)

diff --git a/src/mesa/vbo/vbo_private.h b/src/mesa/vbo/vbo_private.h
index e44a521b11..49922892e5 100644
--- a/src/mesa/vbo/vbo_private.h
+++ b/src/mesa/vbo/vbo_private.h
@@ -68,33 +68,6 @@ vbo_context(struct gl_context *ctx)
 }
 
 
-/**
- * Current vertex processing mode: fixed function vs. shader.
- * In reality, fixed function is probably implemented by a shader but that's
- * not what we care about here.
- */
-enum vp_mode {
-   VP_FF,/**< legacy / fixed function */
-   VP_SHADER, /**< ARB vertex program or GLSL vertex shader */
-   VP_MODE_MAX /**< for sizing arrays */
-};
-
-
-/**
- * Get current vertex processing mode (fixed function vs. shader).
- */
-static inline enum vp_mode
-get_vp_mode( struct gl_context *ctx )
-{
-   if (!ctx->VertexProgram._Current)
-  return VP_FF;
-   else if (ctx->VertexProgram._Current == ctx->VertexProgram._TnlProgram)
-  return VP_FF;
-   else
-  return VP_SHADER;
-}
-
-
 /**
  * Array to apply the fixed function material aliasing map to
  * an attribute value used in vbo processing inputs to an attribute
-- 
2.14.3

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


[Mesa-dev] [PATCH 01/13] mesa: Provide an alternative to get_vp_mode()

2018-02-15 Thread Mathias . Froehlich
From: Mathias Fröhlich 

To get equivalent information than get_vp_mode(), track the
vertex processing mode in a per context variable at
gl_vertex_program_state::_VPMode.
This aims to replace get_vp_mode() as seen in the vbo module.
But instead of the get_vp_mode() implementation which only
gives correct answers past calling _mesa_update_state() this
context variable is immediately tracked when the vertex
processing state is modified. The correctness of this value
is asserted on state validation.

With this in place we should be able to untangle the
dependency with varying_vp_inputs and state invalidation.

Signed-off-by: Mathias Fröhlich 
---
 src/mesa/drivers/common/meta.c |  2 ++
 src/mesa/main/arbprogram.c |  5 +
 src/mesa/main/context.c|  3 +++
 src/mesa/main/enable.c |  2 ++
 src/mesa/main/mtypes.h | 24 
 src/mesa/main/pipelineobj.c|  3 +++
 src/mesa/main/shaderapi.c  |  5 +
 src/mesa/main/state.c  | 23 +++
 src/mesa/main/state.h  |  7 +++
 src/mesa/program/program.c |  1 +
 10 files changed, 75 insertions(+)

diff --git a/src/mesa/drivers/common/meta.c b/src/mesa/drivers/common/meta.c
index cd898e26f6..0cb2ef450e 100644
--- a/src/mesa/drivers/common/meta.c
+++ b/src/mesa/drivers/common/meta.c
@@ -1012,6 +1012,8 @@ _mesa_meta_end(struct gl_context *ctx)
 
  _mesa_reference_pipeline_object(ctx, &save->Pipeline, NULL);
   }
+
+  _mesa_update_vertex_processing_mode(ctx);
}
 
if (state & MESA_META_STENCIL_TEST) {
diff --git a/src/mesa/main/arbprogram.c b/src/mesa/main/arbprogram.c
index 625dc667f8..b169bce0c5 100644
--- a/src/mesa/main/arbprogram.c
+++ b/src/mesa/main/arbprogram.c
@@ -37,6 +37,7 @@
 #include "main/mtypes.h"
 #include "main/arbprogram.h"
 #include "main/shaderapi.h"
+#include "main/state.h"
 #include "program/arbprogparse.h"
 #include "program/program.h"
 #include "program/prog_print.h"
@@ -133,6 +134,8 @@ _mesa_BindProgramARB(GLenum target, GLuint id)
   _mesa_reference_program(ctx, &ctx->FragmentProgram.Current, newProg);
}
 
+   _mesa_update_vertex_processing_mode(ctx);
+
/* Never null pointers */
assert(ctx->VertexProgram.Current);
assert(ctx->FragmentProgram.Current);
@@ -369,6 +372,8 @@ _mesa_ProgramStringARB(GLenum target, GLenum format, 
GLsizei len,
   }
}
 
+   _mesa_update_vertex_processing_mode(ctx);
+
if (ctx->_Shader->Flags & GLSL_DUMP) {
   const char *shader_type =
  target == GL_FRAGMENT_PROGRAM_ARB ? "fragment" : "vertex";
diff --git a/src/mesa/main/context.c b/src/mesa/main/context.c
index 79d3e39e92..0aa2e3639f 100644
--- a/src/mesa/main/context.c
+++ b/src/mesa/main/context.c
@@ -123,6 +123,7 @@
 #include "shared.h"
 #include "shaderobj.h"
 #include "shaderimage.h"
+#include "state.h"
 #include "util/debug.h"
 #include "util/disk_cache.h"
 #include "util/strtod.h"
@@ -1579,6 +1580,8 @@ handle_first_current(struct gl_context *ctx)
 
check_context_limits(ctx);
 
+   _mesa_update_vertex_processing_mode(ctx);
+
/* According to GL_MESA_configless_context the default value of
 * glDrawBuffers depends on the config of the first surface it is bound to.
 * For GLES it is always GL_BACK which has a magic interpretation.
diff --git a/src/mesa/main/enable.c b/src/mesa/main/enable.c
index f23673a6cd..868b73ac68 100644
--- a/src/mesa/main/enable.c
+++ b/src/mesa/main/enable.c
@@ -39,6 +39,7 @@
 #include "light.h"
 #include "mtypes.h"
 #include "enums.h"
+#include "state.h"
 #include "texstate.h"
 #include "varray.h"
 
@@ -919,6 +920,7 @@ _mesa_set_enable(struct gl_context *ctx, GLenum cap, 
GLboolean state)
 return;
  FLUSH_VERTICES(ctx, _NEW_PROGRAM);
  ctx->VertexProgram.Enabled = state;
+ _mesa_update_vertex_processing_mode(ctx);
  break;
   case GL_VERTEX_PROGRAM_POINT_SIZE_ARB:
  /* This was added with ARB_vertex_program, but it is also used with
diff --git a/src/mesa/main/mtypes.h b/src/mesa/main/mtypes.h
index 7da3240da7..41df04d38d 100644
--- a/src/mesa/main/mtypes.h
+++ b/src/mesa/main/mtypes.h
@@ -2136,6 +2136,19 @@ typedef enum
 } gl_register_file;
 
 
+/**
+ * Current vertex processing mode: fixed function vs. shader.
+ * In reality, fixed function is probably implemented by a shader but that's
+ * not what we care about here.
+ */
+typedef enum
+{
+   VP_MODE_FF, /**< legacy / fixed function */
+   VP_MODE_SHADER, /**< ARB vertex program or GLSL vertex shader */
+   VP_MODE_MAX /**< for sizing arrays */
+} gl_vertex_processing_mode;
+
+
 /**
  * Base class for any kind of program object
  */
@@ -2362,6 +2375,17 @@ struct gl_vertex_program_state
struct gl_program_cache *Cache;
 
GLboolean _Overriden;
+
+   /**
+* If we have a vertex program, a TNL program or no program at all.
+* Note that this value should be kept up to date all the time,
+* nevertheless its correctness is asserted in _mesa_upd

[Mesa-dev] [PATCH 10/13] vbo: Implement tool functions for vbo specific VAO setup.

2018-02-15 Thread Mathias . Froehlich
From: Mathias Fröhlich 

Correct VBO_MATERIAL_SHIFT value.
The functions will be used next in this series.

Signed-off-by: Mathias Fröhlich 
---
 src/mesa/vbo/vbo_attrib.h  |  4 ++--
 src/mesa/vbo/vbo_private.h | 53 ++
 2 files changed, 55 insertions(+), 2 deletions(-)

diff --git a/src/mesa/vbo/vbo_attrib.h b/src/mesa/vbo/vbo_attrib.h
index fb178e17d6..0592d845ba 100644
--- a/src/mesa/vbo/vbo_attrib.h
+++ b/src/mesa/vbo/vbo_attrib.h
@@ -113,8 +113,8 @@ enum vbo_attrib {
  VBO_ATTRIB_LAST_MATERIAL - VBO_ATTRIB_FIRST_MATERIAL + 1)
 
 /** Shift to move legacy material attribs into generic slots */
-#define VBO_MATERIAL_SHIFT (VBO_ATTRIB_FIRST_MATERIAL - VBO_ATTRIB_GENERIC0)
-
+#define VBO_MATERIAL_SHIFT \
+   (VBO_ATTRIB_LAST_MATERIAL - VBO_ATTRIB_FIRST_MATERIAL + 1)
 
 
 
diff --git a/src/mesa/vbo/vbo_private.h b/src/mesa/vbo/vbo_private.h
index 545daa3b87..503a533244 100644
--- a/src/mesa/vbo/vbo_private.h
+++ b/src/mesa/vbo/vbo_private.h
@@ -36,6 +36,7 @@
 #include "vbo/vbo_exec.h"
 #include "vbo/vbo_save.h"
 #include "main/mtypes.h"
+#include "main/varray.h"
 
 
 struct _glapi_table;
@@ -172,4 +173,56 @@ void
 vbo_merge_prims(struct _mesa_prim *p0, const struct _mesa_prim *p1);
 
 
+/**
+ * Get the filter mask for vbo draws depending on the vertex_processing_mode.
+ */
+static inline GLbitfield
+_vbo_get_vao_filter(gl_vertex_processing_mode vertex_processing_mode)
+{
+   if (vertex_processing_mode == VP_MODE_FF) {
+  /* The materials mapped into the generic arrays */
+  return VERT_BIT_FF_ALL | VERT_BIT_MAT_ALL;
+   } else {
+  return VERT_BIT_ALL;
+   }
+}
+
+
+/**
+ * Translate the bitmask of VBO_ATTRIB_BITs to VERT_ATTRIB_BITS.
+ * Note that position/generic0 attribute aliasing is done
+ * generically in the VAO.
+ */
+static inline GLbitfield
+_vbo_get_vao_enabled_from_vbo(gl_vertex_processing_mode vertex_processing_mode,
+  GLbitfield64 enabled)
+{
+   if (vertex_processing_mode == VP_MODE_FF) {
+  /* The materials mapped into the generic arrays */
+  return (((GLbitfield)enabled) & VERT_BIT_FF_ALL)
+ | (((GLbitfield)(enabled >> VBO_MATERIAL_SHIFT)) & VERT_BIT_MAT_ALL);
+   } else {
+  return ((GLbitfield)enabled) & VERT_BIT_ALL;
+   }
+}
+
+
+/**
+ * Set the vertex attrib for vbo draw use.
+ */
+static inline void
+_vbo_set_attrib_format(struct gl_context *ctx,
+   struct gl_vertex_array_object *vao,
+   gl_vert_attrib attr, GLintptr buffer_offset,
+   GLubyte size, GLenum16 type, GLuint offset)
+{
+   const GLboolean integer = vbo_attrtype_to_integer_flag(type);
+   const GLboolean doubles = vbo_attrtype_to_double_flag(type);
+   _mesa_update_array_format(ctx, vao, attr, size, type, GL_RGBA,
+ GL_FALSE, integer, doubles, offset);
+   /* Ptr for userspace arrays */
+   vao->VertexAttrib[attr].Ptr = ADD_POINTERS(buffer_offset, offset);
+}
+
+
 #endif /* VBO_PRIVATE_H */
-- 
2.14.3

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


[Mesa-dev] [PATCH 02/13] vbo: Use _VPMode instead of get_vp_mode().

2018-02-15 Thread Mathias . Froehlich
From: Mathias Fröhlich 

At those places where we used get_vp_mode() use
gl_vertex_program_state::_VPMode instead.

Signed-off-by: Mathias Fröhlich 
---
 src/mesa/vbo/vbo_exec.c   |  4 ++--
 src/mesa/vbo/vbo_exec_array.c | 11 ++-
 src/mesa/vbo/vbo_exec_draw.c  |  5 +++--
 src/mesa/vbo/vbo_save_draw.c  |  5 +++--
 4 files changed, 14 insertions(+), 11 deletions(-)

diff --git a/src/mesa/vbo/vbo_exec.c b/src/mesa/vbo/vbo_exec.c
index fc06979dcb..372d0237aa 100644
--- a/src/mesa/vbo/vbo_exec.c
+++ b/src/mesa/vbo/vbo_exec.c
@@ -34,7 +34,7 @@
 
 const GLubyte
 _vbo_attribute_alias_map[VP_MODE_MAX][VERT_ATTRIB_MAX] = {
-   /* VP_FF: */
+   /* VP_MODE_FF: */
{
   VBO_ATTRIB_POS, /* VERT_ATTRIB_POS */
   VBO_ATTRIB_NORMAL,  /* VERT_ATTRIB_NORMAL */
@@ -70,7 +70,7 @@ _vbo_attribute_alias_map[VP_MODE_MAX][VERT_ATTRIB_MAX] = {
   VBO_ATTRIB_MAT_BACK_INDEXES /* VERT_ATTRIB_GENERIC15 */
},
 
-   /* VP_SHADER: */
+   /* VP_MODE_SHADER: */
{
   VBO_ATTRIB_POS, /* VERT_ATTRIB_POS */
   VBO_ATTRIB_NORMAL,  /* VERT_ATTRIB_NORMAL */
diff --git a/src/mesa/vbo/vbo_exec_array.c b/src/mesa/vbo/vbo_exec_array.c
index 25abe09559..0c3c9017b1 100644
--- a/src/mesa/vbo/vbo_exec_array.c
+++ b/src/mesa/vbo/vbo_exec_array.c
@@ -338,10 +338,11 @@ recalculate_input_bindings(struct gl_context *ctx)
/* May shuffle the position and generic0 bits around */
GLbitfield vp_inputs = _mesa_get_vao_vp_inputs(vao);
 
-   const enum vp_mode program_mode = get_vp_mode(ctx);
-   const GLubyte *const map = _vbo_attribute_alias_map[program_mode];
-   switch (program_mode) {
-   case VP_FF:
+   const gl_vertex_processing_mode processing_mode
+  = ctx->VertexProgram._VPMode;
+   const GLubyte * const map = _vbo_attribute_alias_map[processing_mode];
+   switch (processing_mode) {
+   case VP_MODE_FF:
   /* When no vertex program is active (or the vertex program is generated
* from fixed-function state).  We put the material values into the
* generic slots.  Since the vao has no material arrays, mute these
@@ -352,7 +353,7 @@ recalculate_input_bindings(struct gl_context *ctx)
 
   break;
 
-   case VP_SHADER:
+   case VP_MODE_SHADER:
   /* There are no shaders in OpenGL ES 1.x, so this code path should be
* impossible to reach.  The meta code is careful to not use shaders in
* ES1.
diff --git a/src/mesa/vbo/vbo_exec_draw.c b/src/mesa/vbo/vbo_exec_draw.c
index b0cc394642..4421496072 100644
--- a/src/mesa/vbo/vbo_exec_draw.c
+++ b/src/mesa/vbo/vbo_exec_draw.c
@@ -178,8 +178,9 @@ vbo_exec_bind_arrays(struct gl_context *ctx)
GLuint attr;
GLbitfield varying_inputs = 0x0;
 
-   const enum vp_mode program_mode = get_vp_mode(exec->ctx);
-   const GLubyte * const map = _vbo_attribute_alias_map[program_mode];
+   const gl_vertex_processing_mode processing_mode
+  = ctx->VertexProgram._VPMode;
+   const GLubyte * const map = _vbo_attribute_alias_map[processing_mode];
 
/* Grab VERT_ATTRIB_{POS,GENERIC0} from VBO_ATTRIB_POS */
const gl_attribute_map_mode mode = ATTRIBUTE_MAP_MODE_POSITION;
diff --git a/src/mesa/vbo/vbo_save_draw.c b/src/mesa/vbo/vbo_save_draw.c
index 96a9bab029..8c58fecf40 100644
--- a/src/mesa/vbo/vbo_save_draw.c
+++ b/src/mesa/vbo/vbo_save_draw.c
@@ -142,8 +142,9 @@ bind_vertex_list(struct gl_context *ctx,
GLuint attr;
GLbitfield varying_inputs = 0x0;
 
-   const enum vp_mode program_mode = get_vp_mode(ctx);
-   const GLubyte * const map = _vbo_attribute_alias_map[program_mode];
+   const gl_vertex_processing_mode processing_mode
+  = ctx->VertexProgram._VPMode;
+   const GLubyte * const map = _vbo_attribute_alias_map[processing_mode];
 
/* Grab VERT_ATTRIB_{POS,GENERIC0} from VBO_ATTRIB_POS */
const gl_attribute_map_mode mode = ATTRIBUTE_MAP_MODE_POSITION;
-- 
2.14.3

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


[Mesa-dev] [PATCH 11/13] vbo: Make use of _DrawVAO from immediate mode draw

2018-02-15 Thread Mathias . Froehlich
From: Mathias Fröhlich 

Finally use an internal VAO to execute immediate
mode draws. Avoid duplicate state validation
for immediate mode draws. Remove client arrays
previously used exclusively for immediate
mode draws.

Signed-off-by: Mathias Fröhlich 
---
 src/mesa/vbo/vbo_context.c   |   8 +++
 src/mesa/vbo/vbo_exec.h  |   8 ---
 src/mesa/vbo/vbo_exec_api.c  |  47 +
 src/mesa/vbo/vbo_exec_draw.c | 117 ---
 src/mesa/vbo/vbo_private.h   |   2 +
 5 files changed, 78 insertions(+), 104 deletions(-)

diff --git a/src/mesa/vbo/vbo_context.c b/src/mesa/vbo/vbo_context.c
index 1a9935d5e8..bcd87b4c40 100644
--- a/src/mesa/vbo/vbo_context.c
+++ b/src/mesa/vbo/vbo_context.c
@@ -30,6 +30,8 @@
 #include "math/m_eval.h"
 #include "main/vtxfmt.h"
 #include "main/api_arrayelt.h"
+#include "main/arrayobj.h"
+#include "main/varray.h"
 #include "vbo.h"
 #include "vbo_private.h"
 
@@ -252,6 +254,11 @@ _vbo_CreateContext(struct gl_context *ctx)
if (ctx->API == API_OPENGL_COMPAT)
   vbo_save_init(ctx);
 
+   vbo->VAO = _mesa_new_vao(ctx, ~((GLuint)0));
+   /* The exec VAO assumes to have all arributes bound to binding 0 */
+   for (unsigned i = 0; i < VERT_ATTRIB_MAX; ++i)
+  _mesa_vertex_attrib_binding(ctx, vbo->VAO, i, 0, false);
+
_math_init_eval();
 
return GL_TRUE;
@@ -278,6 +285,7 @@ _vbo_DestroyContext(struct gl_context *ctx)
   vbo_exec_destroy(ctx);
   if (ctx->API == API_OPENGL_COMPAT)
  vbo_save_destroy(ctx);
+  _mesa_reference_vao(ctx, &vbo->VAO, NULL);
   free(vbo);
   ctx->vbo_context = NULL;
}
diff --git a/src/mesa/vbo/vbo_exec.h b/src/mesa/vbo/vbo_exec.h
index b00045c7c8..07ab5cc837 100644
--- a/src/mesa/vbo/vbo_exec.h
+++ b/src/mesa/vbo/vbo_exec.h
@@ -101,14 +101,6 @@ struct vbo_exec_context
 
   /** pointers into the current 'vertex' array, declared above */
   fi_type *attrptr[VBO_ATTRIB_MAX];
-
-  struct gl_vertex_array arrays[VERT_ATTRIB_MAX];
-
-  /* According to program mode, the values above plus current
-   * values are squashed down to the 32 attributes passed to the
-   * vertex program below:
-   */
-  const struct gl_vertex_array *inputs[VERT_ATTRIB_MAX];
} vtx;
 
struct {
diff --git a/src/mesa/vbo/vbo_exec_api.c b/src/mesa/vbo/vbo_exec_api.c
index 64e792bfa2..317fc43d1c 100644
--- a/src/mesa/vbo/vbo_exec_api.c
+++ b/src/mesa/vbo/vbo_exec_api.c
@@ -758,7 +758,8 @@ static void GLAPIENTRY
 vbo_exec_Begin(GLenum mode)
 {
GET_CURRENT_CONTEXT(ctx);
-   struct vbo_exec_context *exec = &vbo_context(ctx)->exec;
+   struct vbo_context *vbo = vbo_context(ctx);
+   struct vbo_exec_context *exec = &vbo->exec;
int i;
 
if (_mesa_inside_begin_end(ctx)) {
@@ -770,8 +771,6 @@ vbo_exec_Begin(GLenum mode)
   return;
}
 
-   _mesa_set_drawing_arrays(ctx, exec->vtx.inputs);
-
if (ctx->NewState) {
   _mesa_update_state(ctx);
 
@@ -1162,7 +1161,6 @@ void
 vbo_exec_vtx_init(struct vbo_exec_context *exec)
 {
struct gl_context *ctx = exec->ctx;
-   struct vbo_context *vbo = vbo_context(ctx);
GLuint i;
 
/* Allocate a buffer object.  Will just reuse this object
@@ -1189,38 +1187,6 @@ vbo_exec_vtx_init(struct vbo_exec_context *exec)
   assert(i < ARRAY_SIZE(exec->vtx.active_sz));
   exec->vtx.active_sz[i] = 0;
}
-   for (i = 0 ; i < VERT_ATTRIB_MAX; i++) {
-  assert(i < ARRAY_SIZE(exec->vtx.inputs));
-  assert(i < ARRAY_SIZE(exec->vtx.arrays));
-  exec->vtx.inputs[i] = &exec->vtx.arrays[i];
-   }
-
-   {
-  struct gl_vertex_array *arrays = exec->vtx.arrays;
-  unsigned i;
-
-  memcpy(arrays, &vbo->currval[VBO_ATTRIB_POS],
- VERT_ATTRIB_FF_MAX * sizeof(arrays[0]));
-  for (i = 0; i < VERT_ATTRIB_FF_MAX; ++i) {
- struct gl_vertex_array *array;
- array = &arrays[VERT_ATTRIB_FF(i)];
- array->BufferObj = NULL;
- _mesa_reference_buffer_object(ctx, &array->BufferObj,
-   
vbo->currval[VBO_ATTRIB_POS+i].BufferObj);
-  }
-
-  memcpy(arrays + VERT_ATTRIB_GENERIC(0),
- &vbo->currval[VBO_ATTRIB_GENERIC0],
- VERT_ATTRIB_GENERIC_MAX * sizeof(arrays[0]));
-
-  for (i = 0; i < VERT_ATTRIB_GENERIC_MAX; ++i) {
- struct gl_vertex_array *array;
- array = &arrays[VERT_ATTRIB_GENERIC(i)];
- array->BufferObj = NULL;
- _mesa_reference_buffer_object(ctx, &array->BufferObj,
-   vbo->currval[VBO_ATTRIB_GENERIC0+i].BufferObj);
-  }
-   }
 
exec->vtx.vertex_size = 0;
 
@@ -1233,7 +1199,6 @@ vbo_exec_vtx_destroy(struct vbo_exec_context *exec)
 {
/* using a real VBO for vertex data */
struct gl_context *ctx = exec->ctx;
-   unsigned i;
 
/* True VBOs should already be unmapped
 */
@@ -1247,14 +1212,6 @@ vbo_exec_vtx_destroy(struct vbo_exec_context *exec)
   }
}
 
-   /* Drop any outstanding reference to the vertex buffer
-   

[Mesa-dev] [PATCH 09/13] mesa: Add flush_vertices to _mesa_bind_vertex_buffer.

2018-02-15 Thread Mathias . Froehlich
From: Mathias Fröhlich 

We will need the flush_vertices argument later in this series.

Signed-off-by: Mathias Fröhlich 
---
 src/mesa/drivers/common/meta.c | 16 +---
 src/mesa/main/bufferobj.c  |  2 +-
 src/mesa/main/varray.c | 15 ---
 src/mesa/main/varray.h |  2 +-
 4 files changed, 19 insertions(+), 16 deletions(-)

diff --git a/src/mesa/drivers/common/meta.c b/src/mesa/drivers/common/meta.c
index 3d9833dabb..830d82ad49 100644
--- a/src/mesa/drivers/common/meta.c
+++ b/src/mesa/drivers/common/meta.c
@@ -348,7 +348,7 @@ _mesa_meta_setup_vertex_objects(struct gl_context *ctx,
GL_FALSE, GL_FALSE,
offsetof(struct vertex, x));
  _mesa_bind_vertex_buffer(ctx, array_obj, VERT_ATTRIB_GENERIC(0),
-  *buf_obj, 0, sizeof(struct vertex));
+  *buf_obj, 0, sizeof(struct vertex), true);
  _mesa_enable_vertex_array_attrib(ctx, array_obj,
   VERT_ATTRIB_GENERIC(0), true);
  if (texcoord_size > 0) {
@@ -357,7 +357,7 @@ _mesa_meta_setup_vertex_objects(struct gl_context *ctx,
   GL_FALSE, GL_FALSE, GL_FALSE,
   offsetof(struct vertex, tex));
 _mesa_bind_vertex_buffer(ctx, array_obj, VERT_ATTRIB_GENERIC(1),
- *buf_obj, 0, sizeof(struct vertex));
+ *buf_obj, 0, sizeof(struct vertex), true);
 _mesa_enable_vertex_array_attrib(ctx, array_obj,
  VERT_ATTRIB_GENERIC(1), true);
  }
@@ -367,7 +367,7 @@ _mesa_meta_setup_vertex_objects(struct gl_context *ctx,
GL_FALSE, GL_FALSE,
offsetof(struct vertex, x));
  _mesa_bind_vertex_buffer(ctx, array_obj, VERT_ATTRIB_POS,
-  *buf_obj, 0, sizeof(struct vertex));
+  *buf_obj, 0, sizeof(struct vertex), true);
  _mesa_enable_vertex_array_attrib(ctx, array_obj,
   VERT_ATTRIB_POS, true);
 
@@ -377,7 +377,7 @@ _mesa_meta_setup_vertex_objects(struct gl_context *ctx,
   GL_FALSE, GL_FALSE,
   offsetof(struct vertex, tex));
 _mesa_bind_vertex_buffer(ctx, array_obj, VERT_ATTRIB_TEX(0),
- *buf_obj, 0, sizeof(struct vertex));
+ *buf_obj, 0, sizeof(struct vertex), true);
 _mesa_enable_vertex_array_attrib(ctx, array_obj,
  VERT_ATTRIB_TEX(0), true);
  }
@@ -388,7 +388,7 @@ _mesa_meta_setup_vertex_objects(struct gl_context *ctx,
   GL_FALSE, GL_FALSE,
   offsetof(struct vertex, r));
 _mesa_bind_vertex_buffer(ctx, array_obj, VERT_ATTRIB_COLOR0,
- *buf_obj, 0, sizeof(struct vertex));
+ *buf_obj, 0, sizeof(struct vertex), true);
 _mesa_enable_vertex_array_attrib(ctx, array_obj,
  VERT_ATTRIB_COLOR0, true);
  }
@@ -3347,7 +3347,8 @@ _mesa_meta_DrawTex(struct gl_context *ctx, GLfloat x, 
GLfloat y, GLfloat z,
 GL_FALSE, GL_FALSE,
 offsetof(struct vertex, x));
   _mesa_bind_vertex_buffer(ctx, array_obj, VERT_ATTRIB_POS,
-   drawtex->buf_obj, 0, sizeof(struct vertex));
+   drawtex->buf_obj, 0,
+   sizeof(struct vertex), true);
   _mesa_enable_vertex_array_attrib(ctx, array_obj, VERT_ATTRIB_POS, true);
 
 
@@ -3358,7 +3359,8 @@ _mesa_meta_DrawTex(struct gl_context *ctx, GLfloat x, 
GLfloat y, GLfloat z,
GL_FALSE, GL_FALSE,
offsetof(struct vertex, st[i]));
  _mesa_bind_vertex_buffer(ctx, array_obj, VERT_ATTRIB_TEX(i),
-  drawtex->buf_obj, 0, sizeof(struct vertex));
+  drawtex->buf_obj, 0,
+  sizeof(struct vertex), true);
  _mesa_enable_vertex_array_attrib(ctx, array_obj,
   VERT_ATTRIB_TEX(i), true);
   }
diff --git a/src/mesa/main/bufferobj.c b/src/mesa/main/bufferobj.c
index 67f9cd0a90..068c7dd434 100644
--- a/src/mesa/main/bufferobj.c
+++ b/src/mesa/main/bufferobj.c
@@ -1167,7 +1167,7 @@ unbind(struct gl_context *ctx,
if (vao->BufferBinding[index].BufferObj == obj) {
   _mesa_bind_vertex_buffer(ctx, vao, index, ctx->Shared->NullBufferObj,
   

[Mesa-dev] [PATCH 13/13] vbo: Make use of _DrawVAO from the dlist code.

2018-02-15 Thread Mathias . Froehlich
From: Mathias Fröhlich 

Finally use an internal VAO to execute display
list draws. Avoid duplicate state validation
for display list draws. Remove client arrays
previously used exclusively for display lists.

Signed-off-by: Mathias Fröhlich 
---
 src/mesa/vbo/vbo_save.c  |  37 ++--
 src/mesa/vbo/vbo_save.h  |   4 +-
 src/mesa/vbo/vbo_save_api.c  | 132 +--
 src/mesa/vbo/vbo_save_draw.c |  64 -
 4 files changed, 144 insertions(+), 93 deletions(-)

diff --git a/src/mesa/vbo/vbo_save.c b/src/mesa/vbo/vbo_save.c
index 19c40ec530..f106cf279a 100644
--- a/src/mesa/vbo/vbo_save.c
+++ b/src/mesa/vbo/vbo_save.c
@@ -27,6 +27,7 @@
 
 
 #include "main/mtypes.h"
+#include "main/arrayobj.h"
 #include "main/bufferobj.h"
 
 #include "vbo_private.h"
@@ -44,32 +45,8 @@ void vbo_save_init( struct gl_context *ctx )
 
vbo_save_api_init( save );
 
-   {
-  struct gl_vertex_array *arrays = save->arrays;
-  unsigned i;
-
-  memcpy(arrays, &vbo->currval[VBO_ATTRIB_POS],
- VERT_ATTRIB_FF_MAX * sizeof(arrays[0]));
-  for (i = 0; i < VERT_ATTRIB_FF_MAX; ++i) {
- struct gl_vertex_array *array;
- array = &arrays[VERT_ATTRIB_FF(i)];
- array->BufferObj = NULL;
- _mesa_reference_buffer_object(ctx, &arrays->BufferObj,
-   
vbo->currval[VBO_ATTRIB_POS+i].BufferObj);
-  }
-
-  memcpy(arrays + VERT_ATTRIB_GENERIC(0),
- &vbo->currval[VBO_ATTRIB_GENERIC0],
- VERT_ATTRIB_GENERIC_MAX * sizeof(arrays[0]));
-
-  for (i = 0; i < VERT_ATTRIB_GENERIC_MAX; ++i) {
- struct gl_vertex_array *array;
- array = &arrays[VERT_ATTRIB_GENERIC(i)];
- array->BufferObj = NULL;
- _mesa_reference_buffer_object(ctx, &array->BufferObj,
-   vbo->currval[VBO_ATTRIB_GENERIC0+i].BufferObj);
-  }
-   }
+   for (gl_vertex_processing_mode vpm = VP_MODE_FF; vpm < VP_MODE_MAX; ++vpm)
+  save->VAO[vpm] = NULL;
 
ctx->Driver.CurrentSavePrimitive = PRIM_OUTSIDE_BEGIN_END;
 }
@@ -79,7 +56,9 @@ void vbo_save_destroy( struct gl_context *ctx )
 {
struct vbo_context *vbo = vbo_context(ctx);
struct vbo_save_context *save = &vbo->save;
-   GLuint i;
+
+   for (gl_vertex_processing_mode vpm = VP_MODE_FF; vpm < VP_MODE_MAX; ++vpm)
+  _mesa_reference_vao(ctx, &save->VAO[vpm], NULL);
 
if (save->prim_store) {
   if ( --save->prim_store->refcount == 0 ) {
@@ -93,10 +72,6 @@ void vbo_save_destroy( struct gl_context *ctx )
  save->vertex_store = NULL;
   }
}
-
-   for (i = 0; i < VBO_ATTRIB_MAX; i++) {
-  _mesa_reference_buffer_object(ctx, &save->arrays[i].BufferObj, NULL);
-   }
 }
 
 
diff --git a/src/mesa/vbo/vbo_save.h b/src/mesa/vbo/vbo_save.h
index cb0bff2341..edbce3673d 100644
--- a/src/mesa/vbo/vbo_save.h
+++ b/src/mesa/vbo/vbo_save.h
@@ -66,6 +66,7 @@ struct vbo_save_vertex_list {
GLenum16 attrtype[VBO_ATTRIB_MAX];
GLuint offsets[VBO_ATTRIB_MAX];
GLuint vertex_size;  /**< size in GLfloats */
+   struct gl_vertex_array_object *VAO[VP_MODE_MAX];
 
/* Copy of the final vertex from node->vertex_store->bufferobj.
 * Keep this in regular (non-VBO) memory to avoid repeated
@@ -140,14 +141,13 @@ struct vbo_save_context {
struct gl_context *ctx;
GLvertexformat vtxfmt;
GLvertexformat vtxfmt_noop;  /**< Used if out_of_memory is true */
-   struct gl_vertex_array arrays[VBO_ATTRIB_MAX];
-   const struct gl_vertex_array *inputs[VBO_ATTRIB_MAX];
 
GLbitfield64 enabled; /**< mask of enabled vbo arrays. */
GLubyte attrsz[VBO_ATTRIB_MAX];  /**< 1, 2, 3 or 4 */
GLenum16 attrtype[VBO_ATTRIB_MAX];  /**< GL_FLOAT, GL_INT, etc */
GLubyte active_sz[VBO_ATTRIB_MAX];  /**< 1, 2, 3 or 4 */
GLuint vertex_size;  /**< size in GLfloats */
+   struct gl_vertex_array_object *VAO[VP_MODE_MAX];
 
GLboolean out_of_memory;  /**< True if last VBO allocation failed */
 
diff --git a/src/mesa/vbo/vbo_save_api.c b/src/mesa/vbo/vbo_save_api.c
index fb51bdb84e..1edf7b9dfa 100644
--- a/src/mesa/vbo/vbo_save_api.c
+++ b/src/mesa/vbo/vbo_save_api.c
@@ -68,6 +68,7 @@ USE OR OTHER DEALINGS IN THE SOFTWARE.
 
 
 #include "main/glheader.h"
+#include "main/arrayobj.h"
 #include "main/bufferobj.h"
 #include "main/context.h"
 #include "main/dlist.h"
@@ -79,6 +80,7 @@ USE OR OTHER DEALINGS IN THE SOFTWARE.
 #include "main/vtxfmt.h"
 #include "main/dispatch.h"
 #include "main/state.h"
+#include "main/varray.h"
 #include "util/bitscan.h"
 
 #include "vbo_noop.h"
@@ -411,6 +413,112 @@ convert_line_loop_to_strip(struct vbo_save_context *save,
 }
 
 
+/* Compare the present vao if it has the same setup. */
+static bool
+compare_vao(gl_vertex_processing_mode mode,
+const struct gl_vertex_array_object *vao,
+const struct gl_buffer_object *bo, GLintptr buffer_offset,
+GLuint stride, GLbitfield64 vao_enabled,
+const GLubyte size[V

[Mesa-dev] [PATCH 12/13] mesa: Use atomics for shared VAO reference counts.

2018-02-15 Thread Mathias . Froehlich
From: Mathias Fröhlich 

VAOs will be used in the next change as immutable object
across multiple contexts. Only reference counting may write
concurrently on the VAO. So, make the reference count
thread safe for those and only those VAO objects.

Signed-off-by: Mathias Fröhlich 
---
 src/mesa/main/arrayobj.c | 35 ++-
 src/mesa/main/arrayobj.h |  9 +
 src/mesa/main/mtypes.h   |  7 +++
 3 files changed, 46 insertions(+), 5 deletions(-)

diff --git a/src/mesa/main/arrayobj.c b/src/mesa/main/arrayobj.c
index cf9c5d7ecc..063856d984 100644
--- a/src/mesa/main/arrayobj.c
+++ b/src/mesa/main/arrayobj.c
@@ -53,6 +53,7 @@
 #include "varray.h"
 #include "main/dispatch.h"
 #include "util/bitscan.h"
+#include "util/u_atomic.h"
 
 
 const GLubyte
@@ -331,10 +332,16 @@ _mesa_reference_vao_(struct gl_context *ctx,
   /* Unreference the old array object */
   struct gl_vertex_array_object *oldObj = *ptr;
 
-  assert(oldObj->RefCount > 0);
-  oldObj->RefCount--;
+  bool deleteFlag;
+  if (oldObj->SharedAndImmutable) {
+ deleteFlag = p_atomic_dec_zero(&oldObj->RefCount);
+  } else {
+ assert(oldObj->RefCount > 0);
+ oldObj->RefCount--;
+ deleteFlag = (oldObj->RefCount == 0);
+  }
 
-  if (oldObj->RefCount == 0)
+  if (deleteFlag)
  _mesa_delete_vao(ctx, oldObj);
 
   *ptr = NULL;
@@ -343,9 +350,13 @@ _mesa_reference_vao_(struct gl_context *ctx,
 
if (vao) {
   /* reference new array object */
-  assert(vao->RefCount > 0);
+  if (vao->SharedAndImmutable) {
+ p_atomic_inc(&vao->RefCount);
+  } else {
+ assert(vao->RefCount > 0);
+ vao->RefCount++;
+  }
 
-  vao->RefCount++;
   *ptr = vao;
}
 }
@@ -407,6 +418,7 @@ _mesa_initialize_vao(struct gl_context *ctx,
vao->Name = name;
 
vao->RefCount = 1;
+   vao->SharedAndImmutable = GL_FALSE;
 
/* Init the individual arrays */
for (i = 0; i < ARRAY_SIZE(vao->VertexAttrib); i++) {
@@ -452,6 +464,9 @@ _mesa_update_vao_derived_arrays(struct gl_context *ctx,
 {
GLbitfield arrays = vao->NewArrays;
 
+   /* Make sure we do not run into problems with shared objects */
+   assert(!vao->SharedAndImmutable || vao->NewArrays == 0);
+
while (arrays) {
   const int attrib = u_bit_scan(&arrays);
   struct gl_vertex_array *array = &vao->_VertexArray[attrib];
@@ -465,6 +480,16 @@ _mesa_update_vao_derived_arrays(struct gl_context *ctx,
 }
 
 
+void
+_mesa_set_vao_immutable(struct gl_context *ctx,
+struct gl_vertex_array_object *vao)
+{
+   _mesa_update_vao_derived_arrays(ctx, vao);
+   vao->NewArrays = 0;
+   vao->SharedAndImmutable = GL_TRUE;
+}
+
+
 bool
 _mesa_all_varyings_in_vbos(const struct gl_vertex_array_object *vao)
 {
diff --git a/src/mesa/main/arrayobj.h b/src/mesa/main/arrayobj.h
index 5de74505bb..8da5c9ffe0 100644
--- a/src/mesa/main/arrayobj.h
+++ b/src/mesa/main/arrayobj.h
@@ -81,6 +81,15 @@ extern void
 _mesa_update_vao_derived_arrays(struct gl_context *ctx,
 struct gl_vertex_array_object *vao);
 
+
+/**
+ * Mark the vao as shared and immutable, do remaining updates.
+ */
+extern void
+_mesa_set_vao_immutable(struct gl_context *ctx,
+struct gl_vertex_array_object *vao);
+
+
 /* Returns true if all varying arrays reside in vbos */
 extern bool
 _mesa_all_varyings_in_vbos(const struct gl_vertex_array_object *vao);
diff --git a/src/mesa/main/mtypes.h b/src/mesa/main/mtypes.h
index b6fdb69283..93ad5a9057 100644
--- a/src/mesa/main/mtypes.h
+++ b/src/mesa/main/mtypes.h
@@ -1607,6 +1607,13 @@ struct gl_vertex_array_object
 */
GLboolean EverBound;
 
+   /**
+* Marked to true if the object is shared between contexts and immutable.
+* Then reference counting is done using atomics and thread safe.
+* Is used for dlist VAOs.
+*/
+   GLboolean SharedAndImmutable;
+
/**
 * Derived vertex attribute arrays
 *
-- 
2.14.3

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


[Mesa-dev] [PATCH 00/13] Switch over to use VAOs for drawing.

2018-02-15 Thread Mathias . Froehlich
From: Mathias Fröhlich 

Hi,

The following series moves over to draw via a VAO in all draw
paths. At the current stage this introduces an additional
indirection for the immediate mode and display list draws.
But in the mid term using a VAO should enable drivers to make
use of the binding information already present in the VAO
that gets lost when transforming VAO to a gl_vertex_array list.
In the mid term todays fast vbo_exec_array draw path should
move closer to the backend drivers. But the old style dlist
draw path does as well benefit from the preserved single
vbo binding information still visible in the VAO.
The changeset just cleans up the most obvious parts that are
directly involved with the changes done. For example the
duplicate _mesa_update_state call is no longer needed with the
series and cleaned up. But the series enables much more cleanup.
The series is tested without piglit regressions with my
available hardware that is i965, classic swrast and radeonsi.

Please review
Thanks!

Mathias


Mathias Fröhlich (13):
  mesa: Provide an alternative to get_vp_mode()
  vbo: Use _VPMode instead of get_vp_mode().
  vbo: Remove get_vp_mode() and enum vp_mode.
  mesa: Introduce a yet unused _DrawVAO.
  vbo: Implement method to track the inputs array.
  vbo: Use _DrawVAO for array type draw commands.
  mesa: Add flush_vertices to
_mesa_{enable,disable}_vertex_array_attrib.
  mesa: Make _mesa_vertex_attrib_binding public.
  mesa: Add flush_vertices to _mesa_bind_vertex_buffer.
  vbo: Implement tool functions for vbo specific VAO setup.
  vbo: Make use of _DrawVAO from immediate mode draw
  mesa: Use atomics for shared VAO reference counts.
  vbo: Make use of _DrawVAO from the dlist code.

 src/mesa/drivers/common/meta.c |  36 +
 src/mesa/main/arbprogram.c |   5 ++
 src/mesa/main/arrayobj.c   |  39 --
 src/mesa/main/arrayobj.h   |   9 +++
 src/mesa/main/attrib.c |   2 +
 src/mesa/main/bufferobj.c  |   2 +-
 src/mesa/main/context.c|   5 ++
 src/mesa/main/enable.c |   6 +-
 src/mesa/main/mtypes.h |  38 ++
 src/mesa/main/pipelineobj.c|   3 +
 src/mesa/main/shaderapi.c  |   5 ++
 src/mesa/main/state.c  |  44 +++
 src/mesa/main/state.h  |  15 
 src/mesa/main/varray.c |  85 -
 src/mesa/main/varray.h |  13 +++-
 src/mesa/program/program.c |   1 +
 src/mesa/vbo/vbo.h |  28 +++
 src/mesa/vbo/vbo_attrib.h  |   4 +-
 src/mesa/vbo/vbo_context.c |  17 -
 src/mesa/vbo/vbo_exec.c|  80 +++-
 src/mesa/vbo/vbo_exec.h|  14 
 src/mesa/vbo/vbo_exec_api.c|  47 +---
 src/mesa/vbo/vbo_exec_array.c  | 162 -
 src/mesa/vbo/vbo_exec_draw.c   | 116 -
 src/mesa/vbo/vbo_private.h |  84 ++---
 src/mesa/vbo/vbo_save.c|  37 ++
 src/mesa/vbo/vbo_save.h|   4 +-
 src/mesa/vbo/vbo_save_api.c| 132 +++--
 src/mesa/vbo/vbo_save_draw.c   |  63 +++-
 29 files changed, 735 insertions(+), 361 deletions(-)

-- 
2.14.3

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


[Mesa-dev] [PATCH 07/13] mesa: Add flush_vertices to _mesa_{enable, disable}_vertex_array_attrib.

2018-02-15 Thread Mathias . Froehlich
From: Mathias Fröhlich 

We will need the flush_vertices argument later in this series.

Signed-off-by: Mathias Fröhlich 
---
 src/mesa/drivers/common/meta.c | 18 +++---
 src/mesa/main/enable.c |  4 ++--
 src/mesa/main/varray.c | 30 +++---
 src/mesa/main/varray.h |  4 ++--
 4 files changed, 34 insertions(+), 22 deletions(-)

diff --git a/src/mesa/drivers/common/meta.c b/src/mesa/drivers/common/meta.c
index 0cb2ef450e..3d9833dabb 100644
--- a/src/mesa/drivers/common/meta.c
+++ b/src/mesa/drivers/common/meta.c
@@ -350,7 +350,7 @@ _mesa_meta_setup_vertex_objects(struct gl_context *ctx,
  _mesa_bind_vertex_buffer(ctx, array_obj, VERT_ATTRIB_GENERIC(0),
   *buf_obj, 0, sizeof(struct vertex));
  _mesa_enable_vertex_array_attrib(ctx, array_obj,
-  VERT_ATTRIB_GENERIC(0));
+  VERT_ATTRIB_GENERIC(0), true);
  if (texcoord_size > 0) {
 _mesa_update_array_format(ctx, array_obj, VERT_ATTRIB_GENERIC(1),
   texcoord_size, GL_FLOAT, GL_RGBA,
@@ -359,7 +359,7 @@ _mesa_meta_setup_vertex_objects(struct gl_context *ctx,
 _mesa_bind_vertex_buffer(ctx, array_obj, VERT_ATTRIB_GENERIC(1),
  *buf_obj, 0, sizeof(struct vertex));
 _mesa_enable_vertex_array_attrib(ctx, array_obj,
- VERT_ATTRIB_GENERIC(1));
+ VERT_ATTRIB_GENERIC(1), true);
  }
   } else {
  _mesa_update_array_format(ctx, array_obj, VERT_ATTRIB_POS,
@@ -368,7 +368,8 @@ _mesa_meta_setup_vertex_objects(struct gl_context *ctx,
offsetof(struct vertex, x));
  _mesa_bind_vertex_buffer(ctx, array_obj, VERT_ATTRIB_POS,
   *buf_obj, 0, sizeof(struct vertex));
- _mesa_enable_vertex_array_attrib(ctx, array_obj, VERT_ATTRIB_POS);
+ _mesa_enable_vertex_array_attrib(ctx, array_obj,
+  VERT_ATTRIB_POS, true);
 
  if (texcoord_size > 0) {
 _mesa_update_array_format(ctx, array_obj, VERT_ATTRIB_TEX(0),
@@ -377,7 +378,8 @@ _mesa_meta_setup_vertex_objects(struct gl_context *ctx,
   offsetof(struct vertex, tex));
 _mesa_bind_vertex_buffer(ctx, array_obj, VERT_ATTRIB_TEX(0),
  *buf_obj, 0, sizeof(struct vertex));
-_mesa_enable_vertex_array_attrib(ctx, array_obj, 
VERT_ATTRIB_TEX(0));
+_mesa_enable_vertex_array_attrib(ctx, array_obj,
+ VERT_ATTRIB_TEX(0), true);
  }
 
  if (color_size > 0) {
@@ -387,7 +389,8 @@ _mesa_meta_setup_vertex_objects(struct gl_context *ctx,
   offsetof(struct vertex, r));
 _mesa_bind_vertex_buffer(ctx, array_obj, VERT_ATTRIB_COLOR0,
  *buf_obj, 0, sizeof(struct vertex));
-_mesa_enable_vertex_array_attrib(ctx, array_obj, 
VERT_ATTRIB_COLOR0);
+_mesa_enable_vertex_array_attrib(ctx, array_obj,
+ VERT_ATTRIB_COLOR0, true);
  }
   }
} else {
@@ -3345,7 +3348,7 @@ _mesa_meta_DrawTex(struct gl_context *ctx, GLfloat x, 
GLfloat y, GLfloat z,
 offsetof(struct vertex, x));
   _mesa_bind_vertex_buffer(ctx, array_obj, VERT_ATTRIB_POS,
drawtex->buf_obj, 0, sizeof(struct vertex));
-  _mesa_enable_vertex_array_attrib(ctx, array_obj, VERT_ATTRIB_POS);
+  _mesa_enable_vertex_array_attrib(ctx, array_obj, VERT_ATTRIB_POS, true);
 
 
   for (i = 0; i < ctx->Const.MaxTextureUnits; i++) {
@@ -3356,7 +3359,8 @@ _mesa_meta_DrawTex(struct gl_context *ctx, GLfloat x, 
GLfloat y, GLfloat z,
offsetof(struct vertex, st[i]));
  _mesa_bind_vertex_buffer(ctx, array_obj, VERT_ATTRIB_TEX(i),
   drawtex->buf_obj, 0, sizeof(struct vertex));
- _mesa_enable_vertex_array_attrib(ctx, array_obj, VERT_ATTRIB_TEX(i));
+ _mesa_enable_vertex_array_attrib(ctx, array_obj,
+  VERT_ATTRIB_TEX(i), true);
   }
}
else {
diff --git a/src/mesa/main/enable.c b/src/mesa/main/enable.c
index 868b73ac68..7625a4c957 100644
--- a/src/mesa/main/enable.c
+++ b/src/mesa/main/enable.c
@@ -68,9 +68,9 @@ static void
 vao_state(struct gl_context *ctx, gl_vert_attrib attr, GLboolean state)
 {
if (state)
-  _mesa_enable_vertex_array_attrib(ctx, ctx->Array.VAO, attr);
+  _mesa_enable_vertex_array_attrib(ctx, ctx->Array.VAO, attr, true);
else
-  _mesa_disable_vertex_array_attrib(ctx, ctx->Array.VAO, attr);
+  

[Mesa-dev] [PATCH 06/13] vbo: Use _DrawVAO for array type draw commands.

2018-02-15 Thread Mathias . Froehlich
From: Mathias Fröhlich 

Switch over to use the _DrawVAO for all the array type draws.
The _DrawVAO needs to be set before we enter _mesa_update_state,
so move setting the draw method in front of the first call
to _mesa_update_state which is in turn called from the *validate*Draw*
calls. Using the gl_vertex_array_object::_Enabled bitmask,
gl_vertex_program_state::_VPMode and gl_vertex_array_object::_AttributeMapMode
we can already set varying_vp_inputs before we call _mesa_update_state
the first time. Thus remove duplicate state validation.

Signed-off-by: Mathias Fröhlich 
---
 src/mesa/vbo/vbo_context.c|   8 ++-
 src/mesa/vbo/vbo_exec.h   |   6 --
 src/mesa/vbo/vbo_exec_array.c | 159 +-
 3 files changed, 100 insertions(+), 73 deletions(-)

diff --git a/src/mesa/vbo/vbo_context.c b/src/mesa/vbo/vbo_context.c
index cc9cbffc51..1a9935d5e8 100644
--- a/src/mesa/vbo/vbo_context.c
+++ b/src/mesa/vbo/vbo_context.c
@@ -206,11 +206,15 @@ vbo_exec_invalidate_state(struct gl_context *ctx)
struct vbo_exec_context *exec = &vbo->exec;
 
if (ctx->NewState & (_NEW_PROGRAM | _NEW_ARRAY)) {
-  if (!exec->validating)
- exec->array.recalculate_inputs = GL_TRUE;
+  exec->array.recalculate_inputs = GL_TRUE;
 
   _ae_invalidate_state(ctx);
}
+   /* If _mesa_update_state is called in a non draw code path,
+* changes in the VAO need to be captured.
+*/
+   if (ctx->Array.VAO->NewArrays)
+  exec->array.recalculate_inputs = GL_TRUE;
 
if (ctx->NewState & _NEW_EVAL)
   exec->eval.recalculate_maps = GL_TRUE;
diff --git a/src/mesa/vbo/vbo_exec.h b/src/mesa/vbo/vbo_exec.h
index 7e00d45de0..b00045c7c8 100644
--- a/src/mesa/vbo/vbo_exec.h
+++ b/src/mesa/vbo/vbo_exec.h
@@ -76,7 +76,6 @@ struct vbo_exec_context
struct gl_context *ctx;
GLvertexformat vtxfmt;
GLvertexformat vtxfmt_noop;
-   GLboolean validating; /**< if we're in the middle of state validation */
 
struct {
   struct gl_buffer_object *bufferobj;
@@ -119,11 +118,6 @@ struct vbo_exec_context
} eval;
 
struct {
-  /* Arrays and current values manipulated according to program
-   * mode, etc.  These are the attributes as seen by vertex
-   * programs:
-   */
-  const struct gl_vertex_array *inputs[VERT_ATTRIB_MAX];
   GLboolean recalculate_inputs;
} array;
 
diff --git a/src/mesa/vbo/vbo_exec_array.c b/src/mesa/vbo/vbo_exec_array.c
index 0c3c9017b1..5741696943 100644
--- a/src/mesa/vbo/vbo_exec_array.c
+++ b/src/mesa/vbo/vbo_exec_array.c
@@ -319,29 +319,14 @@ print_draw_arrays(struct gl_context *ctx,
 
 
 /**
- * Set the vbo->exec->inputs[] pointers to point to the enabled
- * vertex arrays.  This depends on the current vertex program/shader
- * being executed because of whether or not generic vertex arrays
- * alias the conventional vertex arrays.
- * For arrays that aren't enabled, we set the input[attrib] pointer
- * to point at a zero-stride current value "array".
+ * Return a filter mask for the net enabled vao arrays.
+ * This is to maks out arrays that would otherwise superseed required current
+ * values for the fixed function shaders for example.
  */
-static void
-recalculate_input_bindings(struct gl_context *ctx)
+static GLbitfield
+enabled_filter(const struct gl_context *ctx)
 {
-   struct vbo_context *vbo = vbo_context(ctx);
-   struct vbo_exec_context *exec = &vbo->exec;
-   const struct gl_vertex_array_object *vao = ctx->Array.VAO;
-   const struct gl_vertex_array *vertexAttrib = vao->_VertexArray;
-   const struct gl_vertex_array **inputs = &exec->array.inputs[0];
-
-   /* May shuffle the position and generic0 bits around */
-   GLbitfield vp_inputs = _mesa_get_vao_vp_inputs(vao);
-
-   const gl_vertex_processing_mode processing_mode
-  = ctx->VertexProgram._VPMode;
-   const GLubyte * const map = _vbo_attribute_alias_map[processing_mode];
-   switch (processing_mode) {
+   switch (ctx->VertexProgram._VPMode) {
case VP_MODE_FF:
   /* When no vertex program is active (or the vertex program is generated
* from fixed-function state).  We put the material values into the
@@ -349,9 +334,7 @@ recalculate_input_bindings(struct gl_context *ctx)
* slots from the enabled arrays so that the current material values
* are pulled instead of the vao arrays.
*/
-  vp_inputs &= VERT_BIT_FF_ALL;
-
-  break;
+  return VERT_BIT_FF_ALL;
 
case VP_MODE_SHADER:
   /* There are no shaders in OpenGL ES 1.x, so this code path should be
@@ -360,40 +343,20 @@ recalculate_input_bindings(struct gl_context *ctx)
*/
   assert(ctx->API != API_OPENGLES);
 
-  /* In the compatibility profile of desktop OpenGL, the generic[0]
-   * attribute array aliases and overrides the legacy position array.
-   * Otherwise, legacy attributes available in the legacy slots,
-   * generic attributes in the generic slots and materials are not
-   * available as per-v

[Mesa-dev] [PATCH 05/13] vbo: Implement method to track the inputs array.

2018-02-15 Thread Mathias . Froehlich
From: Mathias Fröhlich 

Provided the _DrawVAO and the derived state that is
maintained if we have the _DrawVAO set, implement a
method to incrementally update the array of
gl_vertex_array input pointers.

Signed-off-by: Mathias Fröhlich 
---
 src/mesa/vbo/vbo.h | 28 +
 src/mesa/vbo/vbo_context.c |  1 +
 src/mesa/vbo/vbo_exec.c| 76 ++
 src/mesa/vbo/vbo_private.h |  2 ++
 4 files changed, 107 insertions(+)

diff --git a/src/mesa/vbo/vbo.h b/src/mesa/vbo/vbo.h
index d594ba8f6a..bb8ab7a745 100644
--- a/src/mesa/vbo/vbo.h
+++ b/src/mesa/vbo/vbo.h
@@ -254,6 +254,34 @@ vbo_sw_primitive_restart(struct gl_context *ctx,
  const struct _mesa_index_buffer *ib,
  struct gl_buffer_object *indirect);
 
+
+/**
+ * Utility that tracks and updates the current array entries.
+ */
+struct vbo_inputs
+{
+   const struct gl_vertex_array *inputs[VERT_ATTRIB_MAX];
+   GLbitfield current;
+   gl_vertex_processing_mode vertex_processing_mode;
+};
+
+
+/**
+ * Initialize inputs.
+ */
+void
+_vbo_array_init(struct vbo_inputs *inputs);
+
+
+/**
+ * Update the gl_vertex_array array inside the vbo_inputs structure
+ * provided the current _VPMode, the provided vao and
+ * the vao's enabled arrays filtered by the filter bitmask.
+ */
+void
+_vbo_update_inputs(struct gl_context *ctx, struct vbo_inputs *inputs);
+
+
 void GLAPIENTRY
 _es_Color4f(GLfloat r, GLfloat g, GLfloat b, GLfloat a);
 
diff --git a/src/mesa/vbo/vbo_context.c b/src/mesa/vbo/vbo_context.c
index 5bc6bf0acd..cc9cbffc51 100644
--- a/src/mesa/vbo/vbo_context.c
+++ b/src/mesa/vbo/vbo_context.c
@@ -234,6 +234,7 @@ _vbo_CreateContext(struct gl_context *ctx)
init_legacy_currval(ctx);
init_generic_currval(ctx);
init_mat_currval(ctx);
+   _vbo_array_init(&vbo->array);
vbo_set_indirect_draw_func(ctx, vbo_draw_indirect_prims);
 
/* make sure all VBO_ATTRIB_ values can fit in an unsigned byte */
diff --git a/src/mesa/vbo/vbo_exec.c b/src/mesa/vbo/vbo_exec.c
index 372d0237aa..c5f01e3e4d 100644
--- a/src/mesa/vbo/vbo_exec.c
+++ b/src/mesa/vbo/vbo_exec.c
@@ -27,6 +27,7 @@
 
 
 #include "main/glheader.h"
+#include "main/arrayobj.h"
 #include "main/mtypes.h"
 #include "main/api_arrayelt.h"
 #include "main/vtxfmt.h"
@@ -240,3 +241,78 @@ vbo_merge_prims(struct _mesa_prim *p0, const struct 
_mesa_prim *p1)
p0->count += p1->count;
p0->end = p1->end;
 }
+
+
+void
+_vbo_array_init(struct vbo_inputs *inputs)
+{
+   inputs->current = 0;
+   inputs->vertex_processing_mode = VP_MODE_FF;
+}
+
+
+/**
+ * Update those gl_vertex_array array inside the vbo_inputs structure
+ * from the enable bits pointing into the provided vao.
+ */
+static inline void
+update_vao_inputs(struct gl_context *ctx,
+  struct vbo_inputs *inputs, GLbitfield enable)
+{
+   const struct gl_vertex_array_object *vao = ctx->Array._DrawVAO;
+
+   /* Make sure we process only arrays enabled in the VAO */
+   assert((enable & ~_mesa_get_vao_vp_inputs(vao)) == 0);
+
+   /* Fill in the client arrays from the VAO */
+   const GLubyte *const map = _mesa_vao_attribute_map[vao->_AttributeMapMode];
+   const struct gl_vertex_array *array = vao->_VertexArray;
+   const struct gl_vertex_array **iarray = &inputs->inputs[0];
+   while (enable) {
+  const int attr = u_bit_scan(&enable);
+  iarray[attr] = &array[map[attr]];
+   }
+}
+
+
+/**
+ * Update those gl_vertex_array array inside the vbo_inputs structure
+ * from the current bits pointing into the current values.
+ */
+static inline void
+update_current_inputs(struct gl_context *ctx,
+  struct vbo_inputs *inputs, GLbitfield current)
+{
+   gl_vertex_processing_mode mode = ctx->VertexProgram._VPMode;
+
+   /* All previously non current array pointers need update. */
+   GLbitfield mask = current & ~inputs->current;
+   /* On mode change, the slots aliasing with materials need update too */
+   if (mode != inputs->vertex_processing_mode)
+  mask |= current & VERT_BIT_MAT_ALL;
+
+   struct vbo_context *vbo = vbo_context(ctx);
+   const struct gl_vertex_array *const currval = &vbo->currval[0];
+   const struct gl_vertex_array **iarray = &inputs->inputs[0];
+   const GLubyte *const map = _vbo_attribute_alias_map[mode];
+   while (mask) {
+  const int attr = u_bit_scan(&mask);
+  iarray[attr] = &currval[map[attr]];
+   }
+
+   inputs->current = current;
+   inputs->vertex_processing_mode = mode;
+}
+
+
+void
+_vbo_update_inputs(struct gl_context *ctx, struct vbo_inputs *inputs)
+{
+   const GLbitfield enable = ctx->Array._DrawVAOEnabled;
+
+   /* Update array input pointers */
+   update_vao_inputs(ctx, inputs, enable);
+
+   /* The rest must be current inputs. */
+   update_current_inputs(ctx, inputs, ~enable & VERT_BIT_ALL);
+}
diff --git a/src/mesa/vbo/vbo_private.h b/src/mesa/vbo/vbo_private.h
index 49922892e5..545daa3b87 100644
--- a/src/mesa/vbo/vbo_private.h
+++ b/src/mesa/vbo/vbo_pri

[Mesa-dev] [PATCH 04/13] mesa: Introduce a yet unused _DrawVAO.

2018-02-15 Thread Mathias . Froehlich
From: Mathias Fröhlich 

During the patch series this VAO gets populated with
either the currently bound VAO or an internal VAO that
will be used for immediate mode and dlist rendering.

Signed-off-by: Mathias Fröhlich 
---
 src/mesa/main/arrayobj.c |  4 
 src/mesa/main/attrib.c   |  2 ++
 src/mesa/main/context.c  |  2 ++
 src/mesa/main/mtypes.h   |  7 +++
 src/mesa/main/state.c| 21 +
 src/mesa/main/state.h|  8 
 src/mesa/main/varray.c   |  2 ++
 7 files changed, 46 insertions(+)

diff --git a/src/mesa/main/arrayobj.c b/src/mesa/main/arrayobj.c
index a6fa33c82c..cf9c5d7ecc 100644
--- a/src/mesa/main/arrayobj.c
+++ b/src/mesa/main/arrayobj.c
@@ -49,6 +49,7 @@
 #include "arrayobj.h"
 #include "macros.h"
 #include "mtypes.h"
+#include "state.h"
 #include "varray.h"
 #include "main/dispatch.h"
 #include "util/bitscan.h"
@@ -578,6 +579,7 @@ bind_vertex_array(struct gl_context *ctx, GLuint id, bool 
no_error)
 * deleted.
 */
_mesa_set_drawing_arrays(ctx, NULL);
+   _mesa_set_draw_vao(ctx, ctx->Array._EmptyVAO, 0);
 
ctx->NewState |= _NEW_ARRAY;
_mesa_reference_vao(ctx, &ctx->Array.VAO, newObj);
@@ -629,6 +631,8 @@ delete_vertex_arrays(struct gl_context *ctx, GLsizei n, 
const GLuint *ids)
 
  if (ctx->Array.LastLookedUpVAO == obj)
 _mesa_reference_vao(ctx, &ctx->Array.LastLookedUpVAO, NULL);
+ if (ctx->Array._DrawVAO == obj)
+_mesa_set_draw_vao(ctx, ctx->Array._EmptyVAO, 0);
 
  /* Unreference the array object. 
   * If refcount hits zero, the object will be deleted.
diff --git a/src/mesa/main/attrib.c b/src/mesa/main/attrib.c
index 398ff653b7..dd6b98ce04 100644
--- a/src/mesa/main/attrib.c
+++ b/src/mesa/main/attrib.c
@@ -57,6 +57,7 @@
 #include "viewport.h"
 #include "mtypes.h"
 #include "main/dispatch.h"
+#include "state.h"
 #include "hash.h"
 #include 
 
@@ -1548,6 +1549,7 @@ copy_array_attrib(struct gl_context *ctx,
 
/* Invalidate array state. It will be updated during the next draw. */
_mesa_set_drawing_arrays(ctx, NULL);
+   _mesa_set_draw_vao(ctx, ctx->Array._EmptyVAO, 0);
 }
 
 /**
diff --git a/src/mesa/main/context.c b/src/mesa/main/context.c
index 0aa2e3639f..e13343b5e6 100644
--- a/src/mesa/main/context.c
+++ b/src/mesa/main/context.c
@@ -1335,6 +1335,8 @@ _mesa_free_context_data( struct gl_context *ctx )
 
_mesa_reference_vao(ctx, &ctx->Array.VAO, NULL);
_mesa_reference_vao(ctx, &ctx->Array.DefaultVAO, NULL);
+   _mesa_reference_vao(ctx, &ctx->Array._EmptyVAO, NULL);
+   _mesa_reference_vao(ctx, &ctx->Array._DrawVAO, NULL);
 
_mesa_free_attrib_data(ctx);
_mesa_free_buffer_objects(ctx);
diff --git a/src/mesa/main/mtypes.h b/src/mesa/main/mtypes.h
index 41df04d38d..b6fdb69283 100644
--- a/src/mesa/main/mtypes.h
+++ b/src/mesa/main/mtypes.h
@@ -1691,6 +1691,13 @@ struct gl_array_attrib
/* GL_ARB_vertex_buffer_object */
struct gl_buffer_object *ArrayBufferObj;
 
+   /** Vertex array object used when no specific DrawVAO is bound */
+   struct gl_vertex_array_object *_EmptyVAO;
+   /** Vertex array object used for the current draw */
+   struct gl_vertex_array_object *_DrawVAO;
+   /** The possibly reduced set of enabled vertex attributes from the above */
+   GLbitfield _DrawVAOEnabled;
+
/**
 * Vertex arrays as consumed by a driver.
 * The array pointer is set up only by the VBO module.
diff --git a/src/mesa/main/state.c b/src/mesa/main/state.c
index 2fd4fb9d32..42bf483682 100644
--- a/src/mesa/main/state.c
+++ b/src/mesa/main/state.c
@@ -479,3 +479,24 @@ _mesa_update_vertex_processing_mode(struct gl_context *ctx)
else
   ctx->VertexProgram._VPMode = VP_MODE_FF;
 }
+
+
+void
+_mesa_set_draw_vao(struct gl_context *ctx, struct gl_vertex_array_object *vao,
+   GLbitfield filter)
+{
+   struct gl_vertex_array_object **ptr = &ctx->Array._DrawVAO;
+   if (*ptr != vao) {
+  _mesa_reference_vao_(ctx, ptr, vao);
+  ctx->NewDriverState |= ctx->DriverFlags.NewArray;
+   } else if (vao->NewArrays) {
+  ctx->NewDriverState |= ctx->DriverFlags.NewArray;
+   }
+
+   /* May shuffle the position and generic0 bits around, filter out unwanted */
+   const GLbitfield enabled = filter & _mesa_get_vao_vp_inputs(vao);
+   if (ctx->Array._DrawVAOEnabled != enabled)
+  ctx->NewDriverState |= ctx->DriverFlags.NewArray;
+   ctx->Array._DrawVAOEnabled = enabled;
+   _mesa_set_varying_vp_inputs(ctx, enabled);
+}
diff --git a/src/mesa/main/state.h b/src/mesa/main/state.h
index 049166578c..589c6650ad 100644
--- a/src/mesa/main/state.h
+++ b/src/mesa/main/state.h
@@ -53,6 +53,14 @@ extern void
 _mesa_update_vertex_processing_mode(struct gl_context *ctx);
 
 
+/**
+ * Set the _DrawVAO and the net enabled arrays.
+ */
+void
+_mesa_set_draw_vao(struct gl_context *ctx, struct gl_vertex_array_object *vao,
+   GLbitfield filter);
+
+
 static inline bool
 _mesa_ati_fragment_shader_enabled(const struct gl_context *ctx)
 {
dif

[Mesa-dev] [PATCH 08/13] mesa: Make _mesa_vertex_attrib_binding public.

2018-02-15 Thread Mathias . Froehlich
From: Mathias Fröhlich 

Change vertex_attrib_binding() to _mesa_vertex_attrib_binding(),
add a flush_vertices argument, and make it publically
available.
The function will be needed later in the series.

Signed-off-by: Mathias Fröhlich 
---
 src/mesa/main/varray.c | 38 --
 src/mesa/main/varray.h |  7 +++
 2 files changed, 27 insertions(+), 18 deletions(-)

diff --git a/src/mesa/main/varray.c b/src/mesa/main/varray.c
index 90b874aa49..f7d32fdbef 100644
--- a/src/mesa/main/varray.c
+++ b/src/mesa/main/varray.c
@@ -155,11 +155,11 @@ update_attribute_map_mode(const struct gl_context *ctx,
  * Sets the BufferBindingIndex field for the vertex attribute given by
  * attribIndex.
  */
-static void
-vertex_attrib_binding(struct gl_context *ctx,
-  struct gl_vertex_array_object *vao,
-  gl_vert_attrib attribIndex,
-  GLuint bindingIndex)
+void
+_mesa_vertex_attrib_binding(struct gl_context *ctx,
+struct gl_vertex_array_object *vao,
+gl_vert_attrib attribIndex,
+GLuint bindingIndex, bool flush_vertices)
 {
struct gl_array_attributes *array = &vao->VertexAttrib[attribIndex];
 
@@ -171,7 +171,9 @@ vertex_attrib_binding(struct gl_context *ctx,
   else
  vao->VertexAttribBufferMask &= ~array_bit;
 
-  FLUSH_VERTICES(ctx, _NEW_ARRAY);
+  if (flush_vertices) {
+ FLUSH_VERTICES(ctx, _NEW_ARRAY);
+  }
 
   vao->BufferBinding[array->BufferBindingIndex]._BoundArrays &= ~array_bit;
   vao->BufferBinding[bindingIndex]._BoundArrays |= array_bit;
@@ -592,7 +594,7 @@ update_array(struct gl_context *ctx,
  normalized, integer, doubles, 0);
 
/* Reset the vertex attrib binding */
-   vertex_attrib_binding(ctx, vao, attrib, attrib);
+   _mesa_vertex_attrib_binding(ctx, vao, attrib, attrib, true);
 
/* The Stride and Ptr fields are not set by update_array_format() */
struct gl_array_attributes *array = &vao->VertexAttrib[attrib];
@@ -2030,7 +2032,7 @@ _mesa_VertexAttribDivisor_no_error(GLuint index, GLuint 
divisor)
 *   VertexAttribBinding(index, index);
 *   VertexBindingDivisor(index, divisor);"
 */
-   vertex_attrib_binding(ctx, vao, genericIndex, genericIndex);
+   _mesa_vertex_attrib_binding(ctx, vao, genericIndex, genericIndex, true);
vertex_binding_divisor(ctx, vao, genericIndex, divisor);
 }
 
@@ -2072,7 +2074,7 @@ _mesa_VertexAttribDivisor(GLuint index, GLuint divisor)
 *   VertexAttribBinding(index, index);
 *   VertexBindingDivisor(index, divisor);"
 */
-   vertex_attrib_binding(ctx, vao, genericIndex, genericIndex);
+   _mesa_vertex_attrib_binding(ctx, vao, genericIndex, genericIndex, true);
vertex_binding_divisor(ctx, vao, genericIndex, divisor);
 }
 
@@ -2674,9 +2676,9 @@ vertex_array_attrib_binding(struct gl_context *ctx,
 
assert(VERT_ATTRIB_GENERIC(attribIndex) < ARRAY_SIZE(vao->VertexAttrib));
 
-   vertex_attrib_binding(ctx, vao,
- VERT_ATTRIB_GENERIC(attribIndex),
- VERT_ATTRIB_GENERIC(bindingIndex));
+   _mesa_vertex_attrib_binding(ctx, vao,
+   VERT_ATTRIB_GENERIC(attribIndex),
+   VERT_ATTRIB_GENERIC(bindingIndex), true);
 }
 
 
@@ -2684,9 +2686,9 @@ void GLAPIENTRY
 _mesa_VertexAttribBinding_no_error(GLuint attribIndex, GLuint bindingIndex)
 {
GET_CURRENT_CONTEXT(ctx);
-   vertex_attrib_binding(ctx, ctx->Array.VAO,
- VERT_ATTRIB_GENERIC(attribIndex),
- VERT_ATTRIB_GENERIC(bindingIndex));
+   _mesa_vertex_attrib_binding(ctx, ctx->Array.VAO,
+   VERT_ATTRIB_GENERIC(attribIndex),
+   VERT_ATTRIB_GENERIC(bindingIndex), true);
 }
 
 
@@ -2720,9 +2722,9 @@ _mesa_VertexArrayAttribBinding_no_error(GLuint vaobj, 
GLuint attribIndex,
GET_CURRENT_CONTEXT(ctx);
 
struct gl_vertex_array_object *vao = _mesa_lookup_vao(ctx, vaobj);
-   vertex_attrib_binding(ctx, vao,
- VERT_ATTRIB_GENERIC(attribIndex),
- VERT_ATTRIB_GENERIC(bindingIndex));
+   _mesa_vertex_attrib_binding(ctx, vao,
+   VERT_ATTRIB_GENERIC(attribIndex),
+   VERT_ATTRIB_GENERIC(bindingIndex), true);
 }
 
 
diff --git a/src/mesa/main/varray.h b/src/mesa/main/varray.h
index 93ffb37a0d..6585355771 100644
--- a/src/mesa/main/varray.h
+++ b/src/mesa/main/varray.h
@@ -120,6 +120,13 @@ _mesa_disable_vertex_array_attrib(struct gl_context *ctx,
   gl_vert_attrib attrib, bool flush_vertices);
 
 
+extern void
+_mesa_vertex_attrib_binding(struct gl_context *ctx,
+struct gl_vertex_array_object *vao,
+gl_vert_attrib attribIndex,
+  

[Mesa-dev] [PATCH 1/1] clover: Fix build after llvm r325155 and r325160

2018-02-15 Thread Jan Vesely
r325155 ("Pass a reference to a module to the bitcode writer.")
and
r325160 ("Pass module reference to CloneModule")

change function interface from pointer to reference.

Signed-off-by: Jan Vesely 
---
 .../state_trackers/clover/llvm/codegen/bitcode.cpp |  2 +-
 .../state_trackers/clover/llvm/codegen/native.cpp  |  2 +-
 src/gallium/state_trackers/clover/llvm/compat.hpp  | 28 ++
 3 files changed, 30 insertions(+), 2 deletions(-)

diff --git a/src/gallium/state_trackers/clover/llvm/codegen/bitcode.cpp 
b/src/gallium/state_trackers/clover/llvm/codegen/bitcode.cpp
index 679ecd8758..40bb426218 100644
--- a/src/gallium/state_trackers/clover/llvm/codegen/bitcode.cpp
+++ b/src/gallium/state_trackers/clover/llvm/codegen/bitcode.cpp
@@ -66,7 +66,7 @@ namespace {
emit_code(const ::llvm::Module &mod) {
   ::llvm::SmallVector data;
   ::llvm::raw_svector_ostream os { data };
-  WriteBitcodeToFile(&mod, os);
+  compat::write_bitcode_to_file(mod, os);
   return { os.str().begin(), os.str().end() };
}
 }
diff --git a/src/gallium/state_trackers/clover/llvm/codegen/native.cpp 
b/src/gallium/state_trackers/clover/llvm/codegen/native.cpp
index 12c83a92b6..409f8ac32f 100644
--- a/src/gallium/state_trackers/clover/llvm/codegen/native.cpp
+++ b/src/gallium/state_trackers/clover/llvm/codegen/native.cpp
@@ -156,7 +156,7 @@ clover::llvm::print_module_native(const ::llvm::Module &mod,
   const target &target) {
std::string log;
try {
-  std::unique_ptr< ::llvm::Module> cmod { CloneModule(&mod) };
+  std::unique_ptr< ::llvm::Module> cmod { compat::clone_module(mod) };
   return as_string(emit_code(*cmod, target,
  TargetMachine::CGFT_AssemblyFile, log));
} catch (...) {
diff --git a/src/gallium/state_trackers/clover/llvm/compat.hpp 
b/src/gallium/state_trackers/clover/llvm/compat.hpp
index 6fc75fb250..db9e8020cf 100644
--- a/src/gallium/state_trackers/clover/llvm/compat.hpp
+++ b/src/gallium/state_trackers/clover/llvm/compat.hpp
@@ -36,9 +36,17 @@
 
 #include "util/algorithm.hpp"
 
+#if HAVE_LLVM < 0x0400
+#include 
+#else
+#include 
+#include 
+#endif
+
 #include 
 #include 
 #include 
+#include 
 #include 
 #if HAVE_LLVM >= 0x0400
 #include 
@@ -217,6 +225,26 @@ namespace clover {
ctx.setDiagnosticHandler(diagnostic_handler, data);
 #endif
 }
+
+   inline std::unique_ptr< ::llvm::Module>
+   clone_module(const ::llvm::Module &mod)
+   {
+#if HAVE_LLVM >= 0x0700
+   return ::llvm::CloneModule(mod);
+#else
+   return ::llvm::CloneModule(&mod);
+#endif
+   }
+
+template void
+   write_bitcode_to_file(const ::llvm::Module &mod, T &os)
+   {
+#if HAVE_LLVM >= 0x0700
+   ::llvm::WriteBitcodeToFile(mod, os);
+#else
+   ::llvm::WriteBitcodeToFile(&mod, os);
+#endif
+   }
   }
}
 }
-- 
2.14.3

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


Re: [Mesa-dev] [PATCH 07/21] vulkan: Add EXT_acquire_xlib_display

2018-02-15 Thread Keith Packard
Eric Engestrom  writes:

> Can be simplified a bit:
>
>   _xlib_lease = get_option('xlib-lease')
>   if _xlib_lease == 'auto'
> with_xlib_lease = with_platform_x11 and with_platform_display
>   else
> with_xlib_lease = _xlib_lease == 'true'
>   endif
>
> (We also usually try to avoid changing the type of a var, and meson might
> start being more strict with types in future releases)

I wondered about that in the places I copied my code from. Good to know
there's a better practice. I've switched to using this form.

>> +if with_xlib_lease
>> +  vulkan_wsi_deps += dep_xcb_xrandr
>> +  vulkan_wsi_args += [
>> +'-DVK_USE_PLATFORM_XLIB_XRANDR_EXT',
>> +  ]
>
> vulkan_wsi_args += '-DVK_USE_PLATFORM_XLIB_XRANDR_EXT'

I switched all of the inappropriate usage to this form for six separate
patches (three each for core/anv/radv by two extensions (DISPLAY and 
XLIB_XRANDR).

> with that, the meson part of this is
> Reviewed-by: Eric Engestrom 

Awesome!

Thanks for reviewing the build system bits; I'm just starting to use
meson and every new change is a learning opportunity at this point.

-- 
-keith


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


[Mesa-dev] [PATCH] radv: Always lower indirect derefs after nir_lower_global_vars_to_local.

2018-02-15 Thread Bas Nieuwenhuizen
Otherwise new local variables can cause hangs on vega.

CC: 
Bugzilla: https://bugs.freedesktop.org/show_bug.cgi?id=105098
---
 src/amd/vulkan/radv_pipeline.c | 11 +--
 src/amd/vulkan/radv_shader.c   | 74 +++---
 src/amd/vulkan/radv_shader.h   |  4 +++
 3 files changed, 53 insertions(+), 36 deletions(-)

diff --git a/src/amd/vulkan/radv_pipeline.c b/src/amd/vulkan/radv_pipeline.c
index 8f872e7c14..0d1958fc93 100644
--- a/src/amd/vulkan/radv_pipeline.c
+++ b/src/amd/vulkan/radv_pipeline.c
@@ -1525,9 +1525,16 @@ radv_link_shaders(struct radv_pipeline *pipeline, 
nir_shader **shaders)
   ordered_shaders[i - 
1]);
 
if (progress) {
-   nir_lower_global_vars_to_local(ordered_shaders[i]);
+   if (nir_lower_global_vars_to_local(ordered_shaders[i])) 
{
+   radv_lower_indirect_derefs(ordered_shaders[i],
+  
pipeline->device->physical_device);
+   }
radv_optimize_nir(ordered_shaders[i]);
-   nir_lower_global_vars_to_local(ordered_shaders[i - 1]);
+
+   if (nir_lower_global_vars_to_local(ordered_shaders[i - 
1])) {
+   radv_lower_indirect_derefs(ordered_shaders[i - 
1],
+  
pipeline->device->physical_device);
+   }
radv_optimize_nir(ordered_shaders[i - 1]);
}
}
diff --git a/src/amd/vulkan/radv_shader.c b/src/amd/vulkan/radv_shader.c
index 42f83bb335..d9b8e209a9 100644
--- a/src/amd/vulkan/radv_shader.c
+++ b/src/amd/vulkan/radv_shader.c
@@ -114,6 +114,45 @@ void radv_DestroyShaderModule(
vk_free2(&device->alloc, pAllocator, module);
 }
 
+bool
+radv_lower_indirect_derefs(struct nir_shader *nir,
+   struct radv_physical_device *device)
+{
+   /* While it would be nice not to have this flag, we are constrained
+* by the reality that LLVM 5.0 doesn't have working VGPR indexing
+* on GFX9.
+*/
+   bool llvm_has_working_vgpr_indexing =
+   device->rad_info.chip_class <= VI;
+
+   /* TODO: Indirect indexing of GS inputs is unimplemented.
+*
+* TCS and TES load inputs directly from LDS or offchip memory, so
+* indirect indexing is trivial.
+*/
+   nir_variable_mode indirect_mask = 0;
+   if (nir->info.stage == MESA_SHADER_GEOMETRY ||
+   (nir->info.stage != MESA_SHADER_TESS_CTRL &&
+nir->info.stage != MESA_SHADER_TESS_EVAL &&
+!llvm_has_working_vgpr_indexing)) {
+   indirect_mask |= nir_var_shader_in;
+   }
+   if (!llvm_has_working_vgpr_indexing &&
+   nir->info.stage != MESA_SHADER_TESS_CTRL)
+   indirect_mask |= nir_var_shader_out;
+
+   /* TODO: We shouldn't need to do this, however LLVM isn't currently
+* smart enough to handle indirects without causing excess spilling
+* causing the gpu to hang.
+*
+* See the following thread for more details of the problem:
+* https://lists.freedesktop.org/archives/mesa-dev/2017-July/162106.html
+*/
+   indirect_mask |= nir_var_local;
+
+   return nir_lower_indirect_derefs(nir, indirect_mask);
+}
+
 void
 radv_optimize_nir(struct nir_shader *shader)
 {
@@ -254,40 +293,6 @@ radv_shader_compile_to_nir(struct radv_device *device,
 
nir_shader_gather_info(nir, entry_point->impl);
 
-   /* While it would be nice not to have this flag, we are constrained
-* by the reality that LLVM 5.0 doesn't have working VGPR indexing
-* on GFX9.
-*/
-   bool llvm_has_working_vgpr_indexing =
-   device->physical_device->rad_info.chip_class <= VI;
-
-   /* TODO: Indirect indexing of GS inputs is unimplemented.
-*
-* TCS and TES load inputs directly from LDS or offchip memory, so
-* indirect indexing is trivial.
-*/
-   nir_variable_mode indirect_mask = 0;
-   if (nir->info.stage == MESA_SHADER_GEOMETRY ||
-   (nir->info.stage != MESA_SHADER_TESS_CTRL &&
-nir->info.stage != MESA_SHADER_TESS_EVAL &&
-!llvm_has_working_vgpr_indexing)) {
-   indirect_mask |= nir_var_shader_in;
-   }
-   if (!llvm_has_working_vgpr_indexing &&
-   nir->info.stage != MESA_SHADER_TESS_CTRL)
-   indirect_mask |= nir_var_shader_out;
-
-   /* TODO: We shouldn't need to do this, however LLVM isn't currently
-* smart enough to handle indirects without causing excess spilling
-* causing the gpu to hang.
-*
-* See the following thread for more details of the problem:
-* https://lists.freedesktop.org/archives/mesa-dev/2

[Mesa-dev] [Bug 105098] [RADV] GPU freeze with simple Vulkan App

2018-02-15 Thread bugzilla-daemon
https://bugs.freedesktop.org/show_bug.cgi?id=105098

Bas Nieuwenhuizen  changed:

   What|Removed |Added

 Status|NEW |NEEDINFO

--- Comment #5 from Bas Nieuwenhuizen  ---
The non-constant indexing was indeed the issue. Normally we use some
instructions for those but Vega switched to different instruction and a bug in
LLVM causes a hang with them. 

We had a workaround for that but it turned out it did not trigger for this
shader due to declaring the array in global scope.

https://patchwork.freedesktop.org/patch/205018/

should fix the issue. Does this also fix your app?

-- 
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] i965: Fix aux-surface size check

2018-02-15 Thread Jason Ekstrand
On Thu, Feb 15, 2018 at 7:42 AM, Daniel Stone  wrote:

> The previous commit reworked the checks intel_from_planar() to check the
> right individual cases for regular/planar/aux buffers, and do size
> checks in all cases.
>
> Unfortunately, the aux size check was broken, and required the aux
> surface to be allocated with the correct aux stride, but full image
> height (!).
>
> As the ISL aux surface is not recorded in the DRIimage, we cannot easily
> access it to check. Instead, store the aux size from when we do have the
> ISL surface to hand, and check against that later when we go to access
> the aux surface.
>
> Signed-off-by: Daniel Stone 
> Fixes: c2c4e5bae3ba ("i965: Fix bugs in intel_from_planar")
> Cc: Jason Ekstrand 
> ---
>  src/mesa/drivers/dri/i965/intel_image.h  |  3 +++
>  src/mesa/drivers/dri/i965/intel_screen.c | 10 +++---
>  2 files changed, 10 insertions(+), 3 deletions(-)
>
> diff --git a/src/mesa/drivers/dri/i965/intel_image.h
> b/src/mesa/drivers/dri/i965/intel_image.h
> index 78d689a11a3..a8193c6def9 100644
> --- a/src/mesa/drivers/dri/i965/intel_image.h
> +++ b/src/mesa/drivers/dri/i965/intel_image.h
> @@ -98,6 +98,9 @@ struct __DRIimageRec {
> /** Pitch of the auxiliary compression surface. */
> uint32_t aux_pitch;
>
> +   /** Total size in bytes of the auxiliary compression surface. */
> +   uint32_t aux_size;
> +
> /**
>  * Provided by EGL_EXT_image_dma_buf_import.
>  * \{
> diff --git a/src/mesa/drivers/dri/i965/intel_screen.c
> b/src/mesa/drivers/dri/i965/intel_screen.c
> index 1c0fffa2e96..a21b08e51b1 100644
> --- a/src/mesa/drivers/dri/i965/intel_screen.c
> +++ b/src/mesa/drivers/dri/i965/intel_screen.c
> @@ -750,6 +750,7 @@ intel_create_image_common(__DRIscreen *dri_screen,
> if (aux_surf.size) {
>image->aux_offset = surf.size;
>image->aux_pitch = aux_surf.row_pitch;
> +  image->aux_size = aux_surf.size;
>

We also need to do this in create_image_from_fds_common


> }
>
> return image;
> @@ -1312,7 +1313,7 @@ intel_query_dma_buf_modifiers(__DRIscreen *_screen,
> int fourcc, int max,
>  static __DRIimage *
>  intel_from_planar(__DRIimage *parent, int plane, void *loaderPrivate)
>  {
> -int width, height, offset, stride, dri_format;
> +int width, height, offset, stride, size, dri_format;
>  __DRIimage *image;
>
>  if (parent == NULL)
> @@ -1331,24 +1332,27 @@ intel_from_planar(__DRIimage *parent, int plane,
> void *loaderPrivate)
> int index = f->planes[plane].buffer_index;
> offset = parent->offsets[index];
> stride = parent->strides[index];
> +   size = height * stride;
>  } else if (plane == 0) {
> /* The only plane of a non-planar image: copy the parent definition
>  * directly. */
> dri_format = parent->dri_format;
> offset = parent->offset;
> stride = parent->pitch;
> +   size = height * stride;
>  } else if (plane == 1 && parent->modifier != DRM_FORMAT_MOD_INVALID &&
> isl_drm_modifier_has_aux(parent->modifier)) {
> /* Auxiliary plane */
> dri_format = parent->dri_format;
> offset = parent->aux_offset;
> stride = parent->aux_pitch;
> +   size = parent->aux_size;
>  } else {
> return NULL;
>  }
>
> -if (offset + height * stride > parent->bo->size) {
> -   _mesa_warning(NULL, "intel_create_sub_image: subimage out of
> bounds");
> +if (offset + size > parent->bo->size) {
> +   _mesa_warning(NULL, "intel_from_planar: subimage out of bounds");
> return NULL;
>  }
>
> --
> 2.14.3
>
>
___
mesa-dev mailing list
mesa-dev@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/mesa-dev


[Mesa-dev] [PATCH] meson: Add Haiku platform support

2018-02-15 Thread Alexander von Gluck IV
---
 include/meson.build|  8 +
 meson.build| 18 +++---
 src/egl/meson.build| 33 +
 src/gallium/meson.build|  9 +
 src/gallium/state_trackers/hgl/meson.build | 41 +
 src/gallium/targets/haiku-softpipe/meson.build | 50 ++
 src/gallium/winsys/sw/hgl/meson.build  | 29 +++
 src/hgl/GLDispatcher.h |  2 +-
 src/hgl/meson.build| 38 
 src/mapi/es1api/meson.build|  2 +-
 src/mapi/es2api/meson.build|  2 +-
 src/meson.build|  7 +++-
 12 files changed, 224 insertions(+), 15 deletions(-)
 create mode 100644 src/gallium/state_trackers/hgl/meson.build
 create mode 100644 src/gallium/targets/haiku-softpipe/meson.build
 create mode 100644 src/gallium/winsys/sw/hgl/meson.build
 create mode 100644 src/hgl/meson.build

diff --git a/include/meson.build b/include/meson.build
index 1cbc68182c..28ffb33215 100644
--- a/include/meson.build
+++ b/include/meson.build
@@ -22,6 +22,7 @@ inc_drm_uapi = include_directories('drm-uapi')
 inc_vulkan = include_directories('vulkan')
 inc_d3d9 = include_directories('D3D9')
 inc_gl_internal = include_directories('GL/internal')
+inc_haikugl = include_directories('HaikuGL')
 
 if with_gles1
   install_headers(
@@ -80,6 +81,13 @@ if with_gallium_st_nine
   )
 endif
 
+if with_platform_haiku
+  install_headers(
+'HaikuGL/GLRenderer.h', 'HaikuGL/GLView.h', 'HaikuGL/OpenGLKit.h',
+subdir : 'opengl',
+  )
+endif
+
 # Only install the headers if we are building a stand alone implementation and
 # not an ICD enabled implementation
 if with_gallium_opencl and not with_opencl_icd
diff --git a/meson.build b/meson.build
index 3925ec483e..d476f70bbe 100644
--- a/meson.build
+++ b/meson.build
@@ -103,7 +103,7 @@ if _drivers == 'auto'
 else
   error('Unknown architecture. Please pass -Ddri-drivers to set driver 
options. Patches gladly accepted to fix this.')
 endif
-  elif ['darwin', 'windows', 'cygwin'].contains(host_machine.system())
+  elif ['darwin', 'windows', 'cygwin', 'haiku'].contains(host_machine.system())
 # only swrast would make sense here, but gallium swrast is a much better 
default
 _drivers = ''
   else
@@ -148,7 +148,7 @@ if _drivers == 'auto'
 else
   error('Unknown architecture. Please pass -Dgallium-drivers to set driver 
options. Patches gladly accepted to fix this.')
 endif
-  elif ['darwin', 'windows', 'cygwin'].contains(host_machine.system())
+  elif ['darwin', 'windows', 'cygwin', 'haiku'].contains(host_machine.system())
 _drivers = 'swrast'
   else
 error('Unknown OS. Please pass -Dgallium-drivers to set driver options. 
Patches gladly accepted to fix this.')
@@ -185,7 +185,7 @@ if _vulkan_drivers == 'auto'
 else
   error('Unknown architecture. Please pass -Dvulkan-drivers to set driver 
options. Patches gladly accepted to fix this.')
 endif
-  elif ['darwin', 'windows', 'cygwin'].contains(host_machine.system())
+  elif ['darwin', 'windows', 'cygwin', 'haiku'].contains(host_machine.system())
 # No vulkan driver supports windows or macOS currently
 _vulkan_drivers = ''
   else
@@ -246,6 +246,8 @@ if _platforms == 'auto'
 _platforms = 'x11,wayland,drm,surfaceless'
   elif ['darwin', 'windows', 'cygwin'].contains(host_machine.system())
 _platforms = 'x11,surfaceless'
+  elif ['haiku'].contains(host_machine.system())
+_platforms = 'haiku'
   else
 error('Unknown OS. Please pass -Dplatforms to set platforms. Patches 
gladly accepted to fix this.')
   endif
@@ -256,6 +258,7 @@ if _platforms != ''
   with_platform_x11 = _split.contains('x11')
   with_platform_wayland = _split.contains('wayland')
   with_platform_drm = _split.contains('drm')
+  with_platform_haiku = _split.contains('haiku')
   with_platform_surfaceless = _split.contains('surfaceless')
   egl_native_platform = _split[0]
 endif
@@ -264,6 +267,8 @@ with_glx = get_option('glx')
 if with_glx == 'auto'
   if with_dri
 with_glx = 'dri'
+  elif with_platform_haiku
+with_glx = 'disabled'
   elif with_gallium
 # Even when building just gallium drivers the user probably wants dri
 with_glx = 'dri'
@@ -379,7 +384,7 @@ if with_any_vk and (with_platform_x11 and not with_dri3)
   error('Vulkan drivers require dri3 for X11 support')
 endif
 if with_dri or with_gallium
-  if with_glx == 'disabled' and not with_egl
+  if with_glx == 'disabled' and not with_egl and not with_platform_haiku
 error('building dri or gallium drivers require at least one window system')
   endif
 endif
@@ -640,6 +645,9 @@ if with_platform_android
   ]
   pre_args += '-DHAVE_ANDROID_PLATFORM'
 endif
+if with_platform_haiku
+  pre_args += '-DHAVE_HAIKU_PLATFORM'
+endif
 
 prog_python2 = find_program('python2')
 has_ma

[Mesa-dev] [PATCH] meson: Add Haiku platform support v2

2018-02-15 Thread Alexander von Gluck IV
---
 include/meson.build|  8 +
 meson.build| 18 +++---
 src/egl/meson.build| 35 +-
 src/gallium/meson.build|  9 +
 src/gallium/state_trackers/hgl/meson.build | 41 +
 src/gallium/targets/haiku-softpipe/meson.build | 50 ++
 src/gallium/winsys/sw/hgl/meson.build  | 29 +++
 src/hgl/GLDispatcher.h |  2 +-
 src/hgl/meson.build| 38 
 src/mapi/es1api/meson.build|  2 +-
 src/mapi/es2api/meson.build|  2 +-
 src/meson.build|  7 +++-
 12 files changed, 224 insertions(+), 17 deletions(-)
 create mode 100644 src/gallium/state_trackers/hgl/meson.build
 create mode 100644 src/gallium/targets/haiku-softpipe/meson.build
 create mode 100644 src/gallium/winsys/sw/hgl/meson.build
 create mode 100644 src/hgl/meson.build

diff --git a/include/meson.build b/include/meson.build
index 1cbc68182c..28ffb33215 100644
--- a/include/meson.build
+++ b/include/meson.build
@@ -22,6 +22,7 @@ inc_drm_uapi = include_directories('drm-uapi')
 inc_vulkan = include_directories('vulkan')
 inc_d3d9 = include_directories('D3D9')
 inc_gl_internal = include_directories('GL/internal')
+inc_haikugl = include_directories('HaikuGL')
 
 if with_gles1
   install_headers(
@@ -80,6 +81,13 @@ if with_gallium_st_nine
   )
 endif
 
+if with_platform_haiku
+  install_headers(
+'HaikuGL/GLRenderer.h', 'HaikuGL/GLView.h', 'HaikuGL/OpenGLKit.h',
+subdir : 'opengl',
+  )
+endif
+
 # Only install the headers if we are building a stand alone implementation and
 # not an ICD enabled implementation
 if with_gallium_opencl and not with_opencl_icd
diff --git a/meson.build b/meson.build
index 3925ec483e..d476f70bbe 100644
--- a/meson.build
+++ b/meson.build
@@ -103,7 +103,7 @@ if _drivers == 'auto'
 else
   error('Unknown architecture. Please pass -Ddri-drivers to set driver 
options. Patches gladly accepted to fix this.')
 endif
-  elif ['darwin', 'windows', 'cygwin'].contains(host_machine.system())
+  elif ['darwin', 'windows', 'cygwin', 'haiku'].contains(host_machine.system())
 # only swrast would make sense here, but gallium swrast is a much better 
default
 _drivers = ''
   else
@@ -148,7 +148,7 @@ if _drivers == 'auto'
 else
   error('Unknown architecture. Please pass -Dgallium-drivers to set driver 
options. Patches gladly accepted to fix this.')
 endif
-  elif ['darwin', 'windows', 'cygwin'].contains(host_machine.system())
+  elif ['darwin', 'windows', 'cygwin', 'haiku'].contains(host_machine.system())
 _drivers = 'swrast'
   else
 error('Unknown OS. Please pass -Dgallium-drivers to set driver options. 
Patches gladly accepted to fix this.')
@@ -185,7 +185,7 @@ if _vulkan_drivers == 'auto'
 else
   error('Unknown architecture. Please pass -Dvulkan-drivers to set driver 
options. Patches gladly accepted to fix this.')
 endif
-  elif ['darwin', 'windows', 'cygwin'].contains(host_machine.system())
+  elif ['darwin', 'windows', 'cygwin', 'haiku'].contains(host_machine.system())
 # No vulkan driver supports windows or macOS currently
 _vulkan_drivers = ''
   else
@@ -246,6 +246,8 @@ if _platforms == 'auto'
 _platforms = 'x11,wayland,drm,surfaceless'
   elif ['darwin', 'windows', 'cygwin'].contains(host_machine.system())
 _platforms = 'x11,surfaceless'
+  elif ['haiku'].contains(host_machine.system())
+_platforms = 'haiku'
   else
 error('Unknown OS. Please pass -Dplatforms to set platforms. Patches 
gladly accepted to fix this.')
   endif
@@ -256,6 +258,7 @@ if _platforms != ''
   with_platform_x11 = _split.contains('x11')
   with_platform_wayland = _split.contains('wayland')
   with_platform_drm = _split.contains('drm')
+  with_platform_haiku = _split.contains('haiku')
   with_platform_surfaceless = _split.contains('surfaceless')
   egl_native_platform = _split[0]
 endif
@@ -264,6 +267,8 @@ with_glx = get_option('glx')
 if with_glx == 'auto'
   if with_dri
 with_glx = 'dri'
+  elif with_platform_haiku
+with_glx = 'disabled'
   elif with_gallium
 # Even when building just gallium drivers the user probably wants dri
 with_glx = 'dri'
@@ -379,7 +384,7 @@ if with_any_vk and (with_platform_x11 and not with_dri3)
   error('Vulkan drivers require dri3 for X11 support')
 endif
 if with_dri or with_gallium
-  if with_glx == 'disabled' and not with_egl
+  if with_glx == 'disabled' and not with_egl and not with_platform_haiku
 error('building dri or gallium drivers require at least one window system')
   endif
 endif
@@ -640,6 +645,9 @@ if with_platform_android
   ]
   pre_args += '-DHAVE_ANDROID_PLATFORM'
 endif
+if with_platform_haiku
+  pre_args += '-DHAVE_HAIKU_PLATFORM'
+endif
 
 prog_python2 = find_program('python2')
 has_m

Re: [Mesa-dev] [PATCH 14/16] intel/common/icl: Add has_sample_with_hiz flag in gen_device_info

2018-02-15 Thread Kenneth Graunke
On Thursday, February 15, 2018 11:09:09 AM PST Anuj Phogat wrote:
> Sampling from hiz is enabled in i965 for GEN9+ but this feature has
> been removed from gen11. So, this new flag will be useful to turn
> the feature on/off for different gen h/w. It will be used later
> in a patch adding device info for gen11.
> 
> Suggested-by: Kenneth Graunke 
> Signed-off-by: Anuj Phogat 
> Cc: Kenneth Graunke 
> ---
>  src/intel/common/gen_device_info.c| 7 +++
>  src/intel/common/gen_device_info.h| 2 +-
>  src/mesa/drivers/dri/i965/intel_mipmap_tree.c | 5 +
>  3 files changed, 9 insertions(+), 5 deletions(-)

Reviewed-by: Kenneth Graunke 


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


[Mesa-dev] [Bug 105098] [RADV] GPU freeze with simple Vulkan App

2018-02-15 Thread bugzilla-daemon
https://bugs.freedesktop.org/show_bug.cgi?id=105098

--- Comment #6 from Lukas Kahnert  ---
My App is more or less the same than the triangle demo(I try to learn Vulkan,
but this issue was definitely not normal for invalid API usage ;)).

With this patch it does't hang now and works as expected. Thanks :)

-- 
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] meson: Add Haiku platform support v2

2018-02-15 Thread Alexander von Gluck IV
February 15, 2018 3:22 PM, "Alexander von Gluck IV"  
wrote:
> ---
> include/meson.build | 8 +
> meson.build | 18 +++---
> src/egl/meson.build | 35 +-
> src/gallium/meson.build | 9 +
> src/gallium/state_trackers/hgl/meson.build | 41 +
> src/gallium/targets/haiku-softpipe/meson.build | 50 ++
> src/gallium/winsys/sw/hgl/meson.build | 29 +++
> src/hgl/GLDispatcher.h | 2 +-
> src/hgl/meson.build | 38 
> src/mapi/es1api/meson.build | 2 +-
> src/mapi/es2api/meson.build | 2 +-
> src/meson.build | 7 +++-
> 12 files changed, 224 insertions(+), 17 deletions(-)
> create mode 100644 src/gallium/state_trackers/hgl/meson.build
> create mode 100644 src/gallium/targets/haiku-softpipe/meson.build
> create mode 100644 src/gallium/winsys/sw/hgl/meson.build
> create mode 100644 src/hgl/meson.build

Sorry for the v2.. I did a test build on Linux and noticed I broke egl.

A diff of what changed in v2:


$ git diff
diff --git a/src/egl/meson.build b/src/egl/meson.build
index 1fd2b241bb..8880d4631b 100644
--- a/src/egl/meson.build
+++ b/src/egl/meson.build
@@ -148,7 +148,7 @@ if with_platform_haiku
 else
   incs_for_egl += [inc_loader, inc_gbm]
   c_args_for_egl += [
-'-DDEFAULT_DRIVER_DIR="@0@"'.format(dri_driver_dir),
+'-DDEFAULT_DRIVER_DIR="@0@"'.format(dri_search_path),
 '-D_EGL_BUILT_IN_DRIVER_DRI2',
   ]
   link_for_egl += [libloader, libxmlconfig]
@@ -181,8 +181,6 @@ libegl = shared_library(
   c_args : [
 c_vis_args,
 c_args_for_egl,
-'-DDEFAULT_DRIVER_DIR="@0@"'.format(dri_search_path),
-'-D_EGL_BUILT_IN_DRIVER_DRI2',
 
'-D_EGL_NATIVE_PLATFORM=_EGL_PLATFORM_@0@'.format(egl_native_platform.to_upper()),
   ],
   include_directories : incs_for_egl,





There are a lot of changes here...

If it isn't perfect I ask to get it in to make adjustments to avoid the need
of rebasing over and over.

As for Haiku support, meson successfully generates all the needed binaries... 
there
are a few minor issues around TLS i need to sort still however.

Thanks!

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


Re: [Mesa-dev] [PATCH 09/11] vulkan/wsi: Return VK_SUBOPTIMAL_KHR for X11

2018-02-15 Thread Jason Ekstrand
On Thu, Feb 15, 2018 at 7:57 AM, Daniel Stone  wrote:

> From: Louis-Francis Ratté-Boulianne 
>
> When it is detected that a window could have been flipped
> but has been copied because of suboptimal format/modifier.
> The Vulkan client should then re-create the swapchain.
>
> Signed-off-by: Louis-Francis Ratté-Boulianne 
> Reviewed-by: Daniel Stone 
> Signed-off-by: Daniel Stone 
> ---
>  src/vulkan/wsi/wsi_common_x11.c | 64 ++
> +++
>  1 file changed, 58 insertions(+), 6 deletions(-)
>
> diff --git a/src/vulkan/wsi/wsi_common_x11.c b/src/vulkan/wsi/wsi_common_
> x11.c
> index c569aa17187..a9929af338c 100644
> --- a/src/vulkan/wsi/wsi_common_x11.c
> +++ b/src/vulkan/wsi/wsi_common_x11.c
> @@ -130,6 +130,8 @@ wsi_x11_connection_create(const VkAllocationCallbacks
> *alloc,
>  {
> xcb_query_extension_cookie_t dri3_cookie, pres_cookie, amd_cookie,
> nv_cookie;
> xcb_query_extension_reply_t *dri3_reply, *pres_reply, *amd_reply,
> *nv_reply;
> +   bool has_dri3_v1_1 = false;
> +   bool has_present_v1_1 = false;
>
> struct wsi_x11_connection *wsi_conn =
>vk_alloc(alloc, sizeof(*wsi_conn), 8,
> @@ -138,7 +140,7 @@ wsi_x11_connection_create(const VkAllocationCallbacks
> *alloc,
>return NULL;
>
> dri3_cookie = xcb_query_extension(conn, 4, "DRI3");
> -   pres_cookie = xcb_query_extension(conn, 7, "PRESENT");
> +   pres_cookie = xcb_query_extension(conn, 7, "Present");
>

This seems a bit odd.  Did we just not use it before?  Looking through
things, it appears we didn't.


> /* We try to be nice to users and emit a warning if they try to use a
>  * Vulkan application on a system without DRI3 enabled.  However, this
> ends
> @@ -173,13 +175,27 @@ wsi_x11_connection_create(const
> VkAllocationCallbacks *alloc,
>
>ver_cookie = xcb_dri3_query_version(conn, 1, 1);
>ver_reply = xcb_dri3_query_version_reply(conn, ver_cookie, NULL);
> -  wsi_conn->has_dri3_modifiers =
> +  has_dri3_v1_1 =
>   (ver_reply->major_version > 1 || ver_reply->minor_version >= 1);
>free(ver_reply);
> }
>  #endif
>
> wsi_conn->has_present = pres_reply->present != 0;
> +#if XCB_PRESENT_MAJOR_VERSION > 1 || XCB_PRESENT_MINOR_VERSION >= 1
> +   if (wsi_conn->has_present) {
> +  xcb_present_query_version_cookie_t ver_cookie;
> +  xcb_present_query_version_reply_t *ver_reply;
> +
> +  ver_cookie = xcb_present_query_version(conn, 1, 1);
> +  ver_reply = xcb_present_query_version_reply(conn, ver_cookie,
> NULL);
> +  has_present_v1_1 =
> +(ver_reply->major_version > 1 || ver_reply->minor_version >= 1);
> +  free(ver_reply);
> +   }
> +#endif
> +
> +   wsi_conn->has_dri3_modifiers = has_dri3_v1_1 && has_present_v1_1;
> wsi_conn->is_proprietary_x11 = false;
> if (amd_reply && amd_reply->present)
>wsi_conn->is_proprietary_x11 = true;
> @@ -651,6 +667,8 @@ struct x11_swapchain {
>
> bool threaded;
> VkResult status;
> +   bool suboptimal;
> +   bool realloc_suboptimal;
> struct wsi_queue present_queue;
> struct wsi_queue acquire_queue;
> pthread_tqueue_manager;
> @@ -699,6 +717,10 @@ x11_handle_dri3_present_event(struct x11_swapchain
> *chain,
>xcb_present_complete_notify_event_t *complete = (void *) event;
>if (complete->kind == XCB_PRESENT_COMPLETE_KIND_PIXMAP)
>   chain->last_present_msc = complete->msc;
> +#if XCB_PRESENT_MAJOR_VERSION > 1 || XCB_PRESENT_MINOR_VERSION >= 1
> +  if (complete->mode == XCB_PRESENT_COMPLETE_MODE_SUBOPTIMAL_COPY)
> + chain->suboptimal = true;
>

I think I like the approach taken in GLX better.  Here, we'll properly
reallocate when we go from not flipping to flipping but, what happens if we
stop flipping?  In that case, we can do better if we reallocate again.

Also, I find "chain->suboptimal" and "chain->realloc_suboptimal" to be very
confusing.  chain->suboptimal has an obvious meaning but the other
doesn't.  At the very least we need better documentation as to what they
mean.


> +#endif
>break;
> }
>
> @@ -828,6 +850,11 @@ x11_present_to_x11(struct x11_swapchain *chain,
> uint32_t image_index,
> if (chain->base.present_mode == VK_PRESENT_MODE_IMMEDIATE_KHR)
>options |= XCB_PRESENT_OPTION_ASYNC;
>
> +#if XCB_PRESENT_MAJOR_VERSION > 1 || XCB_PRESENT_MINOR_VERSION >= 1
> +   if (chain->has_dri3_modifiers)
> +  options |= XCB_PRESENT_OPTION_SUBOPTIMAL;
> +#endif
> +
> xshmfence_reset(image->shm_fence);
>
> ++chain->send_sbc;
> @@ -862,11 +889,19 @@ x11_acquire_next_image(struct wsi_swapchain
> *anv_chain,
> uint32_t *image_index)
>  {
> struct x11_swapchain *chain = (struct x11_swapchain *)anv_chain;

Re: [Mesa-dev] [PATCH] nir: add is_used_once for fmul(fexp2(a), fexp2(b)) to fexp2(fadd(a, b))

2018-02-15 Thread Timothy Arceri

Here are the IVB shader-db results:

instructions helped:   shaders/closed/steam/dex/63.shader_test FS SIMD8: 
1303 -> 1300 (-0.23%)
instructions helped:   shaders/closed/steam/gang-beasts/111.shader_test 
FS SIMD8: 1303 -> 1300 (-0.23%)
instructions helped: 
shaders/closed/steam/rocketsrocketsrockets/81.shader_test FS SIMD8: 1303 
-> 1300 (-0.23%)
instructions helped: 
shaders/closed/steam/kerbal-space-program/687.shader_test FS SIMD8: 1303 
-> 1300 (-0.23%)
instructions helped: 
shaders/closed/steam/chivalry-medieval-warfare/834.shader_test FS 
SIMD16: 391 -> 389 (-0.51%)
instructions helped: 
shaders/closed/steam/saints-row-the-third/834.shader_test FS SIMD16: 391 
-> 389 (-0.51%)
instructions helped: 
shaders/closed/steam/chivalry-medieval-warfare/834.shader_test FS SIMD8: 
338 -> 336 (-0.59%)
instructions helped: 
shaders/closed/steam/saints-row-the-third/834.shader_test FS SIMD8: 338 
-> 336 (-0.59%)
instructions helped: 
shaders/closed/steam/dota-2-reborn/1243.shader_test FS SIMD16: 148 -> 
141 (-4.73%)
instructions helped:   shaders/closed/steam-big-picture/1.shader_test FS 
SIMD16: 145 -> 138 (-4.83%)
instructions helped: 
shaders/closed/steam/dota-2-reborn/1243.shader_test FS SIMD8: 100 -> 93 
(-7.00%)
instructions helped:   shaders/closed/steam-big-picture/1.shader_test FS 
SIMD8: 97 -> 90 (-7.22%)


instructions HURT: 
shaders/closed/UnrealEngine4/VehicleGame/234.shader_test FS SIMD8: 146 
-> 147 (0.68%)
instructions HURT: 
shaders/closed/UnrealEngine4/Lightroominteriorday/175.shader_test FS 
SIMD8: 139 -> 140 (0.72%)
instructions HURT: 
shaders/closed/UnrealEngine4/VehicleGame/234.shader_test FS SIMD16: 178 
-> 180 (1.12%)
instructions HURT: 
shaders/closed/UnrealEngine4/Lightroominteriorday/175.shader_test FS 
SIMD16: 171 -> 173 (1.17%)


cycles helped: 
shaders/closed/steam/chivalry-medieval-warfare/834.shader_test FS SIMD8: 
2790 -> 2784 (-0.22%)
cycles helped: 
shaders/closed/steam/saints-row-the-third/834.shader_test FS SIMD8: 2790 
-> 2784 (-0.22%)
cycles helped: 
shaders/closed/steam/chivalry-medieval-warfare/834.shader_test FS 
SIMD16: 3399 -> 3383 (-0.47%)
cycles helped: 
shaders/closed/steam/saints-row-the-third/834.shader_test FS SIMD16: 
3399 -> 3383 (-0.47%)
cycles helped: 
shaders/closed/UnrealEngine4/VehicleGame/234.shader_test FS SIMD8: 7944 
-> 7904 (-0.50%)
cycles helped: 
shaders/closed/UnrealEngine4/Lightroominteriorday/175.shader_test FS 
SIMD8: 7726 -> 7686 (-0.52%)
cycles helped: 
shaders/closed/UnrealEngine4/VehicleGame/234.shader_test FS SIMD16: 
10557 -> 10471 (-0.81%)
cycles helped: 
shaders/closed/UnrealEngine4/Lightroominteriorday/175.shader_test FS 
SIMD16: 10335 -> 10249 (-0.83%)
cycles helped:   shaders/closed/steam/dota-2-reborn/1243.shader_test FS 
SIMD16: 974 -> 883 (-9.34%)
cycles helped:   shaders/closed/steam/dota-2-reborn/1243.shader_test FS 
SIMD8: 951 -> 841 (-11.57%)
cycles helped:   shaders/closed/steam-big-picture/1.shader_test FS 
SIMD16: 1155 -> 958 (-17.06%)
cycles helped:   shaders/closed/steam-big-picture/1.shader_test FS 
SIMD8: 1056 -> 845 (-19.98%)


cycles HURT:   shaders/closed/steam/dex/63.shader_test FS SIMD8: 13165 
-> 13240 (0.57%)
cycles HURT:   shaders/closed/steam/gang-beasts/111.shader_test FS 
SIMD8: 13165 -> 13240 (0.57%)
cycles HURT:   shaders/closed/steam/rocketsrocketsrockets/81.shader_test 
FS SIMD8: 13165 -> 13240 (0.57%)
cycles HURT:   shaders/closed/steam/kerbal-space-program/687.shader_test 
FS SIMD8: 13165 -> 13240 (0.57%)
cycles HURT:   shaders/closed/steam/dungeon-defenders/8409.shader_test 
FS SIMD8: 573 -> 579 (1.05%)
cycles HURT:   shaders/closed/steam/dungeon-defenders/8409.shader_test 
FS SIMD16: 635 -> 645 (1.57%)


total instructions in shared programs: 10114499 -> 10114457 (-0.00%)
instructions in affected programs: 7794 -> 7752 (-0.54%)
helped: 12
HURT: 4

total cycles in shared programs: 230925909 -> 230925320 (-0.00%)
cycles in affected programs: 106944 -> 106355 (-0.55%)
helped: 12
HURT: 6

total loops in shared programs: 2436 -> 2436 (0.00%)
loops in affected programs: 0 -> 0
helped: 0
HURT: 0

total spills in shared programs: 5435 -> 5435 (0.00%)
spills in affected programs: 0 -> 0
helped: 0
HURT: 0

total fills in shared programs: 6069 -> 6069 (0.00%)
fills in affected programs: 0 -> 0
helped: 0
HURT: 0

LOST:   0
GAINED: 0

On 15/02/18 12:36, Ian Romanick wrote:

Do you have shader-db results?  Did you try having only one is_used_once?

On 02/05/2018 07:07 AM, Samuel Pitoiset wrote:

Otherwise the code size increases because the original fexp2()
instructions can't be deleted.

Signed-off-by: Samuel Pitoiset 
---
  src/compiler/nir/nir_opt_algebraic.py | 2 +-
  1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/src/compiler/nir/nir_opt_algebraic.py 
b/src/compiler/nir/nir_opt_algebraic.py
index b30d1df199..d40d59b5cd 100644
--- a/src/compiler/nir/nir_opt_algebraic.py
+++ b/src/compiler/nir/nir_opt_algebraic.py
@@ -336,7 +336,7 @@ optimizations = [
 (('~flog2', ('frcp', a)), ('fneg', ('flog2'

Re: [Mesa-dev] [PATCH] radv: Always lower indirect derefs after nir_lower_global_vars_to_local.

2018-02-15 Thread Timothy Arceri

Reviewed-by: Timothy Arceri 

On 16/02/18 07:40, Bas Nieuwenhuizen wrote:

Otherwise new local variables can cause hangs on vega.

CC: 
Bugzilla: https://bugs.freedesktop.org/show_bug.cgi?id=105098
---
  src/amd/vulkan/radv_pipeline.c | 11 +--
  src/amd/vulkan/radv_shader.c   | 74 +++---
  src/amd/vulkan/radv_shader.h   |  4 +++
  3 files changed, 53 insertions(+), 36 deletions(-)

diff --git a/src/amd/vulkan/radv_pipeline.c b/src/amd/vulkan/radv_pipeline.c
index 8f872e7c14..0d1958fc93 100644
--- a/src/amd/vulkan/radv_pipeline.c
+++ b/src/amd/vulkan/radv_pipeline.c
@@ -1525,9 +1525,16 @@ radv_link_shaders(struct radv_pipeline *pipeline, 
nir_shader **shaders)
   ordered_shaders[i - 
1]);
  
  		if (progress) {

-   nir_lower_global_vars_to_local(ordered_shaders[i]);
+   if (nir_lower_global_vars_to_local(ordered_shaders[i])) 
{
+   radv_lower_indirect_derefs(ordered_shaders[i],
+  
pipeline->device->physical_device);
+   }
radv_optimize_nir(ordered_shaders[i]);
-   nir_lower_global_vars_to_local(ordered_shaders[i - 1]);
+
+   if (nir_lower_global_vars_to_local(ordered_shaders[i - 
1])) {
+   radv_lower_indirect_derefs(ordered_shaders[i - 
1],
+  
pipeline->device->physical_device);
+   }
radv_optimize_nir(ordered_shaders[i - 1]);
}
}
diff --git a/src/amd/vulkan/radv_shader.c b/src/amd/vulkan/radv_shader.c
index 42f83bb335..d9b8e209a9 100644
--- a/src/amd/vulkan/radv_shader.c
+++ b/src/amd/vulkan/radv_shader.c
@@ -114,6 +114,45 @@ void radv_DestroyShaderModule(
vk_free2(&device->alloc, pAllocator, module);
  }
  
+bool

+radv_lower_indirect_derefs(struct nir_shader *nir,
+   struct radv_physical_device *device)
+{
+   /* While it would be nice not to have this flag, we are constrained
+* by the reality that LLVM 5.0 doesn't have working VGPR indexing
+* on GFX9.
+*/
+   bool llvm_has_working_vgpr_indexing =
+   device->rad_info.chip_class <= VI;
+
+   /* TODO: Indirect indexing of GS inputs is unimplemented.
+*
+* TCS and TES load inputs directly from LDS or offchip memory, so
+* indirect indexing is trivial.
+*/
+   nir_variable_mode indirect_mask = 0;
+   if (nir->info.stage == MESA_SHADER_GEOMETRY ||
+   (nir->info.stage != MESA_SHADER_TESS_CTRL &&
+nir->info.stage != MESA_SHADER_TESS_EVAL &&
+!llvm_has_working_vgpr_indexing)) {
+   indirect_mask |= nir_var_shader_in;
+   }
+   if (!llvm_has_working_vgpr_indexing &&
+   nir->info.stage != MESA_SHADER_TESS_CTRL)
+   indirect_mask |= nir_var_shader_out;
+
+   /* TODO: We shouldn't need to do this, however LLVM isn't currently
+* smart enough to handle indirects without causing excess spilling
+* causing the gpu to hang.
+*
+* See the following thread for more details of the problem:
+* https://lists.freedesktop.org/archives/mesa-dev/2017-July/162106.html
+*/
+   indirect_mask |= nir_var_local;
+
+   return nir_lower_indirect_derefs(nir, indirect_mask);
+}
+
  void
  radv_optimize_nir(struct nir_shader *shader)
  {
@@ -254,40 +293,6 @@ radv_shader_compile_to_nir(struct radv_device *device,
  
  	nir_shader_gather_info(nir, entry_point->impl);
  
-	/* While it would be nice not to have this flag, we are constrained

-* by the reality that LLVM 5.0 doesn't have working VGPR indexing
-* on GFX9.
-*/
-   bool llvm_has_working_vgpr_indexing =
-   device->physical_device->rad_info.chip_class <= VI;
-
-   /* TODO: Indirect indexing of GS inputs is unimplemented.
-*
-* TCS and TES load inputs directly from LDS or offchip memory, so
-* indirect indexing is trivial.
-*/
-   nir_variable_mode indirect_mask = 0;
-   if (nir->info.stage == MESA_SHADER_GEOMETRY ||
-   (nir->info.stage != MESA_SHADER_TESS_CTRL &&
-nir->info.stage != MESA_SHADER_TESS_EVAL &&
-!llvm_has_working_vgpr_indexing)) {
-   indirect_mask |= nir_var_shader_in;
-   }
-   if (!llvm_has_working_vgpr_indexing &&
-   nir->info.stage != MESA_SHADER_TESS_CTRL)
-   indirect_mask |= nir_var_shader_out;
-
-   /* TODO: We shouldn't need to do this, however LLVM isn't currently
-* smart enough to handle indirects without causing excess spilling
-* causing the gpu to hang.
-*
-* See the following thread for more details of the p

[Mesa-dev] [Bug 105119] Desktop-wide input freeze when vulkan (radv)

2018-02-15 Thread bugzilla-daemon
https://bugs.freedesktop.org/show_bug.cgi?id=105119

Bug ID: 105119
   Summary: Desktop-wide input freeze when vulkan (radv)
   Product: Mesa
   Version: 17.3
  Hardware: x86-64 (AMD64)
OS: Linux (All)
Status: NEW
  Severity: normal
  Priority: medium
 Component: Drivers/Vulkan/radeon
  Assignee: mesa-dev@lists.freedesktop.org
  Reporter: ja...@okonski.org
QA Contact: mesa-dev@lists.freedesktop.org

Created attachment 137384
  --> https://bugs.freedesktop.org/attachment.cgi?id=137384&action=edit
trace #1 with long vkDeviceWaitIdle

I'm experimenting with vulkan, and, after my application exits cleanly,
keyboard input is ignored until I switch to another window using my mouse (that
I can still use).

This is not the main problem though, I found a sequence of commands that
triggers a desktop-wide freeze. I can still move my mouse, but windows don't
redraw as far as I can tell. I also cannot focus other windows with
mouse/keyboard, I cannot use ctrl+alt+f[1-9] to jump back to tty. Because I
have a physical tachometer on the GPU, I also noticed that it is being utilized
100%, at least that's what the LEDs say.

I tried doing a vulkan trace and replay, but the replay does not trigger it.
I'm attaching two vktrace files, first one is my original case, where I render
two frames and exit cleanly (or at least try to). Of note is the never-ending
vkDeviceWaitIdle call (it actually does end as soon as I press the power button
on my PC, more on this in a second). The second trace I attached is one where I
only render one frame and then exit the application (cleanly). Interestingly,
in this case there is no failure

So after the desktop is frozen, I can only press the power button, which
immediately exits xorg server, I again see my tty (I launch startx directly
from tty, no GUI login manager). The control is never yielded back to my tty
though, I can see a snippet of xorg logs but the process has not exited (and
the GPU leds show 100% utilisation still).

Mesa, radv 17.3.3, xorg 1.19.6, linux 4.15.3 with RX Vega 64 GPU.

Let me know if there are additional debugging steps I can take, I can also
provide source code for reproduction steps.

-- 
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


[Mesa-dev] [Bug 105119] Desktop-wide input freeze when vulkan (radv)

2018-02-15 Thread bugzilla-daemon
https://bugs.freedesktop.org/show_bug.cgi?id=105119

--- Comment #1 from Jakub Okoński  ---
Created attachment 137385
  --> https://bugs.freedesktop.org/attachment.cgi?id=137385&action=edit
single frame render that exits cleanly

-- 
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


[Mesa-dev] [Bug 105119] Desktop-wide input freeze when vulkan (radv)

2018-02-15 Thread bugzilla-daemon
https://bugs.freedesktop.org/show_bug.cgi?id=105119

Jakub Okoński  changed:

   What|Removed |Added

 CC||ja...@okonski.org

-- 
You are receiving this mail because:
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 1/1] clover: Fix build after llvm r325155 and r325160

2018-02-15 Thread Francisco Jerez
Jan Vesely  writes:

> r325155 ("Pass a reference to a module to the bitcode writer.")
> and
> r325160 ("Pass module reference to CloneModule")
>
> change function interface from pointer to reference.
>
> Signed-off-by: Jan Vesely 
> ---
>  .../state_trackers/clover/llvm/codegen/bitcode.cpp |  2 +-
>  .../state_trackers/clover/llvm/codegen/native.cpp  |  2 +-
>  src/gallium/state_trackers/clover/llvm/compat.hpp  | 28 
> ++
>  3 files changed, 30 insertions(+), 2 deletions(-)
>
> diff --git a/src/gallium/state_trackers/clover/llvm/codegen/bitcode.cpp 
> b/src/gallium/state_trackers/clover/llvm/codegen/bitcode.cpp
> index 679ecd8758..40bb426218 100644
> --- a/src/gallium/state_trackers/clover/llvm/codegen/bitcode.cpp
> +++ b/src/gallium/state_trackers/clover/llvm/codegen/bitcode.cpp
> @@ -66,7 +66,7 @@ namespace {
> emit_code(const ::llvm::Module &mod) {
>::llvm::SmallVector data;
>::llvm::raw_svector_ostream os { data };
> -  WriteBitcodeToFile(&mod, os);
> +  compat::write_bitcode_to_file(mod, os);
>return { os.str().begin(), os.str().end() };
> }
>  }
> diff --git a/src/gallium/state_trackers/clover/llvm/codegen/native.cpp 
> b/src/gallium/state_trackers/clover/llvm/codegen/native.cpp
> index 12c83a92b6..409f8ac32f 100644
> --- a/src/gallium/state_trackers/clover/llvm/codegen/native.cpp
> +++ b/src/gallium/state_trackers/clover/llvm/codegen/native.cpp
> @@ -156,7 +156,7 @@ clover::llvm::print_module_native(const ::llvm::Module 
> &mod,
>const target &target) {
> std::string log;
> try {
> -  std::unique_ptr< ::llvm::Module> cmod { CloneModule(&mod) };
> +  std::unique_ptr< ::llvm::Module> cmod { compat::clone_module(mod) };
>return as_string(emit_code(*cmod, target,
>   TargetMachine::CGFT_AssemblyFile, log));
> } catch (...) {
> diff --git a/src/gallium/state_trackers/clover/llvm/compat.hpp 
> b/src/gallium/state_trackers/clover/llvm/compat.hpp
> index 6fc75fb250..db9e8020cf 100644
> --- a/src/gallium/state_trackers/clover/llvm/compat.hpp
> +++ b/src/gallium/state_trackers/clover/llvm/compat.hpp
> @@ -36,9 +36,17 @@
>  
>  #include "util/algorithm.hpp"
>  
> +#if HAVE_LLVM < 0x0400
> +#include 
> +#else
> +#include 
> +#include 
> +#endif
> +
>  #include 
>  #include 
>  #include 
> +#include 
>  #include 
>  #if HAVE_LLVM >= 0x0400
>  #include 
> @@ -217,6 +225,26 @@ namespace clover {
> ctx.setDiagnosticHandler(diagnostic_handler, data);
>  #endif
>  }
> +
> + inline std::unique_ptr< ::llvm::Module>
> + clone_module(const ::llvm::Module &mod)
> + {
> +#if HAVE_LLVM >= 0x0700
> + return ::llvm::CloneModule(mod);
> +#else
> + return ::llvm::CloneModule(&mod);
> +#endif
> + }
> +
> +template void

Weird indentation.  Other than that:

Reviewed-by: Francisco Jerez 

> + write_bitcode_to_file(const ::llvm::Module &mod, T &os)
> + {
> +#if HAVE_LLVM >= 0x0700
> + ::llvm::WriteBitcodeToFile(mod, os);
> +#else
> + ::llvm::WriteBitcodeToFile(&mod, os);
> +#endif
> + }
>}
> }
>  }
> -- 
> 2.14.3


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


[Mesa-dev] [Bug 104662] OpenGL 4.5 needs to be active by default instead of using 3.0 by default

2018-02-15 Thread bugzilla-daemon
https://bugs.freedesktop.org/show_bug.cgi?id=104662

Timothy Arceri  changed:

   What|Removed |Added

 Status|NEW |RESOLVED
 Resolution|--- |NOTABUG

--- Comment #5 from Timothy Arceri  ---
(In reply to mirh from comment #4)
> https://lists.freedesktop.org/archives/mesa-dev/2018-February/185646.html
> 
> Compatibility context is very, very shyly advancing.. 
> Maybe this bug should be renamed to just that?

Compatibility is a missing feature of the various drivers not a bug, there is
no need to track it in bugzilla. I'm resolving this as not a bug.

-- 
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 V2 16/16] i965/icl: Add render target flush after uploading binding table

2018-02-15 Thread Anuj Phogat
+Ken

On Thu, Feb 15, 2018 at 11:11 AM, Anuj Phogat  wrote:
> From PIPE_CONTROL command description in gfxspecs:
>
> "Whenever a Binding Table Index (BTI) used by a Render Taget Message
>  points to a different RENDER_SURFACE_STATE, SW must issue a Render
>  Target Cache Flush by enabling this bit. When render target flush
>  is set due to new association of BTI, PS Scoreboard Stall bit must
>  be set in this packet."
>
> V2: Move the PIPE_CONTROL to update_renderbuffer_surfaces() in
> brw_wm_surface_state.c (Ken).
>
> Fixes a fulsim error and a GPU hang described in below JIRA.
> JIRA: MD5-322
> Signed-off-by: Anuj Phogat 
> ---
>  src/mesa/drivers/dri/i965/brw_wm_surface_state.c | 14 ++
>  1 file changed, 14 insertions(+)
>
> diff --git a/src/mesa/drivers/dri/i965/brw_wm_surface_state.c 
> b/src/mesa/drivers/dri/i965/brw_wm_surface_state.c
> index 44c87df17d..84c5a81227 100644
> --- a/src/mesa/drivers/dri/i965/brw_wm_surface_state.c
> +++ b/src/mesa/drivers/dri/i965/brw_wm_surface_state.c
> @@ -971,6 +971,20 @@ update_renderbuffer_surfaces(struct brw_context *brw)
>emit_null_surface_state(brw, fb, &surf_offsets[rt_start]);
> }
>
> +   /* From PIPE_CONTROL command description in gfxspecs:
> +
> +  "Whenever a Binding Table Index (BTI) used by a Render Taget Message
> +   points to a different RENDER_SURFACE_STATE, SW must issue a Render
> +   Target Cache Flush by enabling this bit. When render target flush
> +   is set due to new association of BTI, PS Scoreboard Stall bit must
> +   be set in this packet."
> +   */
> +   if (devinfo->gen >= 11) {
> +  brw_emit_pipe_control_flush(brw,
> +  PIPE_CONTROL_RENDER_TARGET_FLUSH |
> +  PIPE_CONTROL_STALL_AT_SCOREBOARD);
> +   }
> +
> brw->ctx.NewDriverState |= BRW_NEW_SURFACES;
>  }
>
> --
> 2.13.6
>
___
mesa-dev mailing list
mesa-dev@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/mesa-dev


Re: [Mesa-dev] [PATCH 10/11] egl/x11: Support DRI3 v1.1

2018-02-15 Thread Jason Ekstrand
On Thu, Feb 15, 2018 at 7:57 AM, Daniel Stone  wrote:

> From: Louis-Francis Ratté-Boulianne 
>
> Add support for DRI3 v1.1, which allows pixmaps to be backed by
> multi-planar buffers, or those with format modifiers. This is both
> for allocating render buffers, as well as EGLImage imports from a
> native pixmap (EGL_NATIVE_PIXMAP_KHR).
>
> Signed-off-by: Louis-Francis Ratté-Boulianne 
> Reviewed-by: Eric Engestrom 
> Reviewed-by: Emil Velikov 
> Reviewed-by: Daniel Stone 
> Signed-off-by: Daniel Stone 
> ---
>  src/egl/drivers/dri2/egl_dri2.c  |   7 +
>  src/egl/drivers/dri2/egl_dri2.h  |   3 +
>  src/egl/drivers/dri2/platform_x11_dri3.c | 105 +--
>  src/glx/dri3_glx.c   |  10 +-
>  src/loader/loader_dri3_helper.c  | 306
> +++
>  src/loader/loader_dri3_helper.h  |  17 +-
>  6 files changed, 393 insertions(+), 55 deletions(-)
>
> diff --git a/src/egl/drivers/dri2/egl_dri2.c b/src/egl/drivers/dri2/egl_
> dri2.c
> index 17b646e7ede..9a7e43bafb6 100644
> --- a/src/egl/drivers/dri2/egl_dri2.c
> +++ b/src/egl/drivers/dri2/egl_dri2.c
> @@ -881,6 +881,13 @@ dri2_setup_extensions(_EGLDisplay *disp)
> if (!dri2_bind_extensions(dri2_dpy, mandatory_core_extensions,
> extensions, false))
>return EGL_FALSE;
>
> +#ifdef HAVE_DRI3
> +   dri2_dpy->multibuffers_available =
> +  (dri2_dpy->dri3_major_version > 1 || (dri2_dpy->dri3_major_version
> == 1 &&
> +dri2_dpy->dri3_minor_version
> >= 1)) &&
> +  (dri2_dpy->image && dri2_dpy->image->base.version >= 15);
> +#endif
> +
> dri2_bind_extensions(dri2_dpy, optional_core_extensions, extensions,
> true);
> return EGL_TRUE;
>  }
> diff --git a/src/egl/drivers/dri2/egl_dri2.h b/src/egl/drivers/dri2/egl_
> dri2.h
> index d36d02c3c49..00c4768d421 100644
> --- a/src/egl/drivers/dri2/egl_dri2.h
> +++ b/src/egl/drivers/dri2/egl_dri2.h
> @@ -199,6 +199,9 @@ struct dri2_egl_display
> xcb_screen_t *screen;
> bool swap_available;
>  #ifdef HAVE_DRI3
> +   bool multibuffers_available;
> +   int  dri3_major_version;
> +   int  dri3_minor_version;
> struct loader_dri3_extensions loader_dri3_ext;
>  #endif
>  #endif
> diff --git a/src/egl/drivers/dri2/platform_x11_dri3.c
> b/src/egl/drivers/dri2/platform_x11_dri3.c
> index 6ead4d0a222..15c349eb828 100644
> --- a/src/egl/drivers/dri2/platform_x11_dri3.c
> +++ b/src/egl/drivers/dri2/platform_x11_dri3.c
> @@ -39,6 +39,23 @@
>  #include "loader.h"
>  #include "loader_dri3_helper.h"
>
> +static uint32_t
> +dri3_format_for_depth(uint32_t depth)
> +{
> +   switch (depth) {
> +   case 16:
> +  return __DRI_IMAGE_FORMAT_RGB565;
> +   case 24:
> +  return __DRI_IMAGE_FORMAT_XRGB;
> +   case 30:
> +  return __DRI_IMAGE_FORMAT_XRGB2101010;
> +   case 32:
> +  return __DRI_IMAGE_FORMAT_ARGB;
> +   default:
> +  return __DRI_IMAGE_FORMAT_NONE;
> +   }
> +}
> +
>  static struct dri3_egl_surface *
>  loader_drawable_to_egl_surface(struct loader_dri3_drawable *draw) {
> size_t offset = offsetof(struct dri3_egl_surface, loader_drawable);
> @@ -156,7 +173,9 @@ dri3_create_surface(_EGLDriver *drv, _EGLDisplay
> *disp, EGLint type,
>
> if (loader_dri3_drawable_init(dri2_dpy->conn, drawable,
>   dri2_dpy->dri_screen,
> - dri2_dpy->is_different_gpu, dri_config,
> + dri2_dpy->is_different_gpu,
> + dri2_dpy->multibuffers_available,
> + dri_config,
>   &dri2_dpy->loader_dri3_ext,
>   &egl_dri3_vtable,
>   &dri3_surf->loader_drawable)) {
> @@ -262,20 +281,8 @@ dri3_create_image_khr_pixmap(_EGLDisplay *disp,
> _EGLContext *ctx,
>return NULL;
> }
>
> -   switch (bp_reply->depth) {
> -   case 16:
> -  format = __DRI_IMAGE_FORMAT_RGB565;
> -  break;
> -   case 24:
> -  format = __DRI_IMAGE_FORMAT_XRGB;
> -  break;
> -   case 30:
> -  format = __DRI_IMAGE_FORMAT_XRGB2101010;
> -  break;
> -   case 32:
> -  format = __DRI_IMAGE_FORMAT_ARGB;
> -  break;
> -   default:
> +   format = dri3_format_for_depth(bp_reply->depth);
> +   if (format == __DRI_IMAGE_FORMAT_NONE) {
>_eglError(EGL_BAD_PARAMETER,
>  "dri3_create_image_khr: unsupported pixmap depth");
>free(bp_reply);
> @@ -303,13 +310,78 @@ dri3_create_image_khr_pixmap(_EGLDisplay *disp,
> _EGLContext *ctx,
> return &dri2_img->base;
>  }
>
> +#if XCB_DRI3_MAJOR_VERSION > 1 || (XCB_DRI3_MAJOR_VERSION == 1 &&
> XCB_DRI3_MINOR_VERSION >= 1)
> +static _EGLImage *
> +dri3_create_image_khr_pixmap_from_buffers(_EGLDisplay *disp, _EGLContext
> *ctx,
> +  EGLCl

  1   2   >