[Mesa-dev] [Bug 106893] Potential mem leak with radv

2018-06-12 Thread bugzilla-daemon
https://bugs.freedesktop.org/show_bug.cgi?id=106893

--- Comment #1 from Alex Smith  ---
The game will be compiling pipelines in the background even while left idle at
the main menu. This is likely what's causing the memory usage to increase.

I just tested here with a Vega 64 on Mesa commit e266b32059 and LLVM release_60
branch r333579. At the main menu, once all background pipeline creation has
completed, the game's memory usage is 2.6GB, which is not far off what I'd
expect (perhaps a bit higher than last time I looked, IIRC on 18.0 stable).

If you're seeing significantly higher than that, perhaps something has
regressed on LLVM trunk?

-- 
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 106893] Potential mem leak with radv

2018-06-12 Thread bugzilla-daemon
https://bugs.freedesktop.org/show_bug.cgi?id=106893

--- Comment #2 from John  ---
Hello Alex,

on one test I started the game with around 1.5Gb used, and quit it when I had
around 11Gb used just being in the main menu, quite more than expected, and it
was still increasing (well maybe it would have stopped eventually).

I've dropped all settings to minimum, window instead of fullscreen, etc... but
it does not seem to help.


I've had the issue since the game was released on Linux, so if it is a
regression in LLVM, it is not super recent. I can always try with some release
drivers instead of dev ones if you think that could be a start.

Thank you!

-- 
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 1/2] vkpipeline-db: add sType to pipeline info

2018-06-12 Thread Grazvydas Ignotas
On Tue, Jun 12, 2018 at 8:07 AM, Timothy Arceri  wrote:
> From: Timothy Arceri 

localhost.localdomain?

>
> This avoids hitting asserts in anv.
> ---
>  run.c | 2 ++
>  1 file changed, 2 insertions(+)
>
> diff --git a/run.c b/run.c
> index eafbd7d..a962887 100644
> --- a/run.c
> +++ b/run.c
> @@ -264,6 +264,7 @@ create_graphics_pipeline(VkDevice device, struct 
> pipeline_info *info,
>  return result;
>
>  /* Graphics pipeline. */
> +pipelineInfo.sType = VK_STRUCTURE_TYPE_GRAPHICS_PIPELINE_CREATE_INFO;
>  pipelineInfo.stageCount = info->stageCount;
>  pipelineInfo.pStages = info->pShaderStagesInfo;
>  pipelineInfo.pVertexInputState = &info->vertexInputState;
> @@ -292,6 +293,7 @@ create_compute_pipeline(VkDevice device, struct 
> pipeline_info *info,
>  VkComputePipelineCreateInfo pipelineInfo = {};
>
>  /* Compute pipeline. */
> +pipelineInfo.sType = VK_STRUCTURE_TYPE_COMPUTE_PIPELINE_CREATE_INFO;
>  pipelineInfo.stage = *info->pShaderStagesInfo;
>  pipelineInfo.layout = layout;
>
> --
> 2.17.1
>
> ___
> 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 1/2] vkpipeline-db: add sType to pipeline info

2018-06-12 Thread Timothy Arceri
On 12/06/18 18:46, Grazvydas Ignotas wrote> On Tue, Jun 12, 2018 at 8:07 
AM, Timothy Arceri  wrote:

From: Timothy Arceri 


localhost.localdomain?



Yeah I wrote these patches from an Intel machine I don't use very often, 
I've already fixed these locally :)

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


[Mesa-dev] [Bug 106893] Potential mem leak with radv

2018-06-12 Thread bugzilla-daemon
https://bugs.freedesktop.org/show_bug.cgi?id=106893

--- Comment #3 from John  ---
I've just tried with Mesa 18.1 and LLVM 6.0, the behavior was the same.

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


[Mesa-dev] [Bug 106877] The game Rise of the Tomb Raider lead to GPU hang when I try in same place jump into the hole.

2018-06-12 Thread bugzilla-daemon
https://bugs.freedesktop.org/show_bug.cgi?id=106877

--- Comment #4 from Alex Smith  ---
Created attachment 140129
  --> https://bugs.freedesktop.org/attachment.cgi?id=140129&action=edit
Save game

-- 
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 106877] The game Rise of the Tomb Raider lead to GPU hang when I try in same place jump into the hole.

2018-06-12 Thread bugzilla-daemon
https://bugs.freedesktop.org/show_bug.cgi?id=106877

--- Comment #5 from Alex Smith  ---
I can reproduce this hang on Vega 64 with Mesa commit e266b32059 and LLVM
release_60 branch r333579.

I've attached a save file just before where it hangs. Drop it into
"~/.local/share/feral-interactive/Rise of the Tomb Raider/SaveData/Steam Saves
()/", and load the last autosave from the load game menu (should be in
"Soviet Installation").

-- 
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] nv50/ir: handle SHLADD in IndirectPropagation

2018-06-12 Thread Karol Herbst
On Mon, Jun 11, 2018 at 2:39 PM, Rhys Perry  wrote:
> An alternative solution to the problem fixed in
> 0bd83d0 ("nv50/ir: move LateAlgebraicOpt to the very end"). Should be
> useful in the future and seems to make dolphin ubershaders a bit smaller.
>
> total instructions in shared programs : 226722 -> 226464 (-0.11%)
> total gprs used in shared programs: 19378 -> 19378 (0.00%)
> total shared used in shared programs  : 0 -> 0 (0.00%)
> total local used in shared programs   : 0 -> 0 (0.00%)
>
> local sharedgpr   inst  bytes
> helped   0   0   0  51  51
>   hurt   0   0   0   0   0
>
> Signed-off-by: Rhys Perry 
> ---
>  src/gallium/drivers/nouveau/codegen/nv50_ir_peephole.cpp | 14 +-
>  1 file changed, 13 insertions(+), 1 deletion(-)
>
> diff --git a/src/gallium/drivers/nouveau/codegen/nv50_ir_peephole.cpp 
> b/src/gallium/drivers/nouveau/codegen/nv50_ir_peephole.cpp
> index 39177bd044..4d0589214d 100644
> --- a/src/gallium/drivers/nouveau/codegen/nv50_ir_peephole.cpp
> +++ b/src/gallium/drivers/nouveau/codegen/nv50_ir_peephole.cpp
> @@ -283,6 +283,8 @@ class IndirectPropagation : public Pass
>  {
>  private:
> virtual bool visit(BasicBlock *);
> +
> +   BuildUtil bld;
>  };
>
>  bool
> @@ -294,6 +296,8 @@ IndirectPropagation::visit(BasicBlock *bb)
> for (Instruction *i = bb->getEntry(); i; i = next) {
>next = i->next;
>
> +  bld.setPosition(i, false);
> +
>for (int s = 0; i->srcExists(s); ++s) {
>   Instruction *insn;
>   ImmediateValue imm;
> @@ -325,6 +329,14 @@ IndirectPropagation::visit(BasicBlock *bb)
>  i->setIndirect(s, 0, NULL);
>  i->setSrc(s, cloneShallow(func, i->getSrc(s)));
>  i->src(s).get()->reg.data.offset += imm.reg.data.u32;
> + } else if (insn->op == OP_SHLADD) {
> +if (!insn->src(2).getImmediate(imm) ||
> +!targ->insnCanLoadOffset(i, s, imm.reg.data.s32))
> +   continue;
> +i->setIndirect(s, 0, bld.mkOp2v(
> +   OP_SHL, TYPE_U32, bld.getSSA(), insn->getSrc(0), 
> insn->getSrc(1)));
> +i->setSrc(s, cloneShallow(func, i->getSrc(s)));
> +i->src(s).get()->reg.data.offset += imm.reg.data.u32;
>   }
>}
> }
> @@ -3797,11 +3809,11 @@ Program::optimizeSSA(int level)
> RUN_PASS(2, AlgebraicOpt, run);
> RUN_PASS(2, ModifierFolding, run); // before load propagation -> less 
> checks
> RUN_PASS(1, ConstantFolding, foldAll);
> +   RUN_PASS(2, LateAlgebraicOpt, run);
> RUN_PASS(1, Split64BitOpPreRA, run);
> RUN_PASS(1, LoadPropagation, run);
> RUN_PASS(1, IndirectPropagation, run);
> RUN_PASS(2, MemoryOpt, run);
> -   RUN_PASS(2, LateAlgebraicOpt, run);
> RUN_PASS(2, LocalCSE, run);
> RUN_PASS(0, DeadCodeElim, buryAll);

well no, it is late for a good reason actually. those opts have the
potential to increase instruction count in other shaders. This should
be tested on more shaders than just the default shader-db ones.

>
> --
> 2.14.4
>
> ___
> 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 26/48] meson: fix pipe-loader compilation for windows

2018-06-12 Thread Eric Engestrom
On Monday, 2018-06-11 15:55:53 -0700, Dylan Baker wrote:
> ---
>  src/gallium/auxiliary/pipe-loader/meson.build | 9 +++--
>  1 file changed, 7 insertions(+), 2 deletions(-)
> 
> diff --git a/src/gallium/auxiliary/pipe-loader/meson.build 
> b/src/gallium/auxiliary/pipe-loader/meson.build
> index 32e8188c68b..207e4b0fac4 100644
> --- a/src/gallium/auxiliary/pipe-loader/meson.build
> +++ b/src/gallium/auxiliary/pipe-loader/meson.build
> @@ -27,13 +27,18 @@ files_pipe_loader = files(
>  )
>  
>  libpipe_loader_defines = []
> +libpipe_loader_links = []
>  
>  if dep_libdrm.found()
>files_pipe_loader += files('pipe_loader_drm.c')
> +  libpipe_loader_links += libloader
>  endif
>  if with_gallium_drisw_kms
>libpipe_loader_defines += '-DHAVE_PIPE_LOADER_KMS'
>  endif
> +if not (with_gallium_st_nine or with_gallium_opencl)
> +  libpipe_loader_defines += '-DROP_PIPE_LOADER_MISC=1'

missing `D` here, and the `=1` is not necessary:
  '-DDROP_PIPE_LOADER_MISC'

> +endif
>  
>  libpipe_loader_static = static_library(
>'pipe_loader_static',
> @@ -46,7 +51,7 @@ libpipe_loader_static = static_library(
>  c_vis_args, '-DHAVE_PIPE_LOADER_DRI', '-DGALLIUM_STATIC_TARGETS=1',
>  libpipe_loader_defines,
>],
> -  link_with : [libloader, libxmlconfig],
> +  link_with : [libpipe_loader_links, libxmlconfig],
>dependencies : [dep_libdrm],
>build_by_default : false,
>  )
> @@ -64,7 +69,7 @@ libpipe_loader_dynamic = static_library(
>join_paths(get_option('prefix'), get_option('libdir'), 'gallium-pipe')
>  )
>],
> -  link_with : [libloader, libxmlconfig],
> +  link_with : [libpipe_loader_links, libxmlconfig],
>dependencies : [dep_libdrm],
>build_by_default : false,
>  )
> -- 
> 2.17.1
> 
> ___
> 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 29/48] meson: don't look for nm binary on windows

2018-06-12 Thread Eric Engestrom
On Monday, 2018-06-11 15:55:56 -0700, Dylan Baker wrote:
> ---
>  meson.build | 5 -
>  src/mapi/es1api/meson.build | 2 +-
>  src/mapi/es2api/meson.build | 2 +-
>  3 files changed, 6 insertions(+), 3 deletions(-)
> 
> diff --git a/meson.build b/meson.build
> index f3e9676f8bf..abe45e933ba 100644
> --- a/meson.build
> +++ b/meson.build
> @@ -1468,8 +1468,11 @@ endif
>  
>  pkg = import('pkgconfig')
>  
> +prog_nm = find_program('nm', required : false)
>  env_test = environment()
> -env_test.set('NM', find_program('nm').path())
> +if prog_nm.found()
> +  env_test.set('NM', prog_nm.path())
> +endif
>  
>  subdir('include')
>  subdir('bin')
> diff --git a/src/mapi/es1api/meson.build b/src/mapi/es1api/meson.build
> index dcf0aa57492..448cf1c73d2 100644
> --- a/src/mapi/es1api/meson.build
> +++ b/src/mapi/es1api/meson.build
> @@ -59,7 +59,7 @@ pkg.generate(
>libraries_private : gl_priv_libs,
>  )
>  
> -if with_tests
> +if with_tests and prog_nm.found()

All the *-symbols-check (egl & gbm right now) use `nm` as well, and need
this check added there too.

(reminds me that I need to ping people on my *-symbols-check series)

>test(
>  'es1-ABI-check',
>  find_program('ABI-check'),
> diff --git a/src/mapi/es2api/meson.build b/src/mapi/es2api/meson.build
> index abd633fbb6b..cb6a70a2e90 100644
> --- a/src/mapi/es2api/meson.build
> +++ b/src/mapi/es2api/meson.build
> @@ -59,7 +59,7 @@ pkg.generate(
>libraries_private : gl_priv_libs,
>  )
>  
> -if with_tests
> +if with_tests and prog_nm.found()
>test(
>  'es2-ABI-check',
>  find_program('ABI-check'),
> -- 
> 2.17.1
> 
> ___
> 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] drivers/dri/i965: add missing #include

2018-06-12 Thread Ross Burton
brw_bufmgr.h uses time_t without include time.h, so the build fails under musl.
---
 src/mesa/drivers/dri/i965/brw_bufmgr.h | 2 ++
 1 file changed, 2 insertions(+)

diff --git a/src/mesa/drivers/dri/i965/brw_bufmgr.h 
b/src/mesa/drivers/dri/i965/brw_bufmgr.h
index 68f5e0c2c8..5c2702652b 100644
--- a/src/mesa/drivers/dri/i965/brw_bufmgr.h
+++ b/src/mesa/drivers/dri/i965/brw_bufmgr.h
@@ -37,6 +37,8 @@
 #include 
 #include 
 #include 
+#include 
+
 #include "util/u_atomic.h"
 #include "util/list.h"
 
-- 
2.11.0

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


Re: [Mesa-dev] [RFC 3/6] anv/android: add GetAndroidHardwareBufferPropertiesANDROID WIP

2018-06-12 Thread Tapani Pälli



On 05/29/2018 10:08 AM, Tapani Pälli wrote:

TODO - need to figure out implementation-defined external format identifier
  - YUV support

Signed-off-by: Tapani Pälli 
---
  src/intel/vulkan/anv_android.c | 91 ++
  1 file changed, 91 insertions(+)

diff --git a/src/intel/vulkan/anv_android.c b/src/intel/vulkan/anv_android.c
index 7e07dbaaa4..6c0c8cc793 100644
--- a/src/intel/vulkan/anv_android.c
+++ b/src/intel/vulkan/anv_android.c
@@ -29,6 +29,8 @@
  #include 
  
  #include "anv_private.h"

+#include "vk_format_info.h"
+#include "vk_util.h"
  
  static int anv_hal_open(const struct hw_module_t* mod, const char* id, struct hw_device_t** dev);

  static int anv_hal_close(struct hw_device_t *dev);
@@ -96,6 +98,95 @@ anv_hal_close(struct hw_device_t *dev)
 return -1;
  }
  
+static VkResult

+get_ahw_buffer_format_properties(
+   VkDevice device_h,
+   const struct AHardwareBuffer *buffer,
+   VkAndroidHardwareBufferFormatPropertiesANDROID *pProperties)
+{
+   ANV_FROM_HANDLE(anv_device, device, device_h);
+
+   /* Get a description of buffer contents . */
+   AHardwareBuffer_Desc desc;
+   AHardwareBuffer_describe(buffer, &desc);
+
+   /* Verify description. */
+   uint64_t gpu_usage =
+  AHARDWAREBUFFER_USAGE_GPU_SAMPLED_IMAGE |
+  AHARDWAREBUFFER_USAGE_GPU_COLOR_OUTPUT |
+  AHARDWAREBUFFER_USAGE_GPU_DATA_BUFFER;
+
+   /* "Buffer must be a valid Android hardware buffer object with at least
+* one of the AHARDWAREBUFFER_USAGE_GPU_* usage flags."
+*/
+   if (!(desc.usage & (gpu_usage)))
+  return VK_ERROR_INVALID_EXTERNAL_HANDLE_KHR;
+
+   /* Fill properties fields based on description. */
+   VkAndroidHardwareBufferFormatPropertiesANDROID *p = pProperties;
+
+   p->pNext = NULL;
+   p->format = vk_format_from_android(desc.format);
+   p->externalFormat = 1; /* XXX */
+
+   const struct anv_format *anv_format = anv_get_format(p->format);
+   struct anv_physical_device *physical_device =
+  &device->instance->physicalDevice;
+   const struct gen_device_info *devinfo = &physical_device->info;
+
+   p->formatFeatures =
+  anv_get_image_format_features(devinfo, p->format,
+anv_format, VK_IMAGE_TILING_OPTIMAL);
+
+   p->samplerYcbcrConversionComponents.r = VK_COMPONENT_SWIZZLE_IDENTITY;
+   p->samplerYcbcrConversionComponents.g = VK_COMPONENT_SWIZZLE_IDENTITY;
+   p->samplerYcbcrConversionComponents.b = VK_COMPONENT_SWIZZLE_IDENTITY;
+   p->samplerYcbcrConversionComponents.a = VK_COMPONENT_SWIZZLE_IDENTITY;
+
+   p->suggestedYcbcrModel = VK_SAMPLER_YCBCR_MODEL_CONVERSION_RGB_IDENTITY;
+   p->suggestedYcbcrRange = VK_SAMPLER_YCBCR_RANGE_ITU_FULL;
+   p->suggestedXChromaOffset = VK_CHROMA_LOCATION_COSITED_EVEN;
+   p->suggestedYChromaOffset = VK_CHROMA_LOCATION_COSITED_EVEN;
+
+   return VK_SUCCESS;
+}
+
+VkResult
+anv_GetAndroidHardwareBufferPropertiesANDROID(
+   VkDevice device_h,
+   const struct AHardwareBuffer *buffer,
+   VkAndroidHardwareBufferPropertiesANDROID *pProperties)
+{
+   ANV_FROM_HANDLE(anv_device, dev, device_h);
+   struct anv_physical_device *pdevice = &dev->instance->physicalDevice;
+
+   const VkExternalFormatANDROID *format_prop =
+  vk_find_struct_const(pProperties->pNext,
+   ANDROID_HARDWARE_BUFFER_FORMAT_PROPERTIES_ANDROID);


oops this was wrong structure and should rather be:

VkAndroidHardwareBufferFormatPropertiesANDROID *format_prop =
vk_find_struct((pProperties->pNext, 
ANDROID_HARDWARE_BUFFER_FORMAT_PROPERTIES_ANDROID);


I've corrected this, rebased the patches and done some testing locally.


+
+   /* Fill format properties of an Android hardware buffer. */
+   if (format_prop)
+  get_ahw_buffer_format_properties(device_h, buffer, format_prop);
+
+   /* Get a description of buffer contents . */
+   AHardwareBuffer_Desc desc;
+   AHardwareBuffer_describe(buffer, &desc);
+
+   const native_handle_t *handle =
+  AHardwareBuffer_getNativeHandle(buffer);
+   int dma_buf = (handle && handle->numFds) ? handle->data[0] : -1;
+   if (dma_buf < 0)
+  return VK_ERROR_INVALID_EXTERNAL_HANDLE_KHR;
+
+   /* All memory types. */
+   uint32_t memory_types = (1ull << pdevice->memory.type_count) - 1;
+
+   pProperties->allocationSize = lseek(dma_buf, 0, SEEK_END);
+   pProperties->memoryTypeBits = memory_types;
+
+   return VK_SUCCESS;
+}
+
  VkResult
  anv_image_from_gralloc(VkDevice device_h,
 const VkImageCreateInfo *base_info,


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


Re: [Mesa-dev] [PATCH 35/48] util/tests: Use define instead of VLA

2018-06-12 Thread Eric Engestrom
On Monday, 2018-06-11 15:56:02 -0700, Dylan Baker wrote:
> To allow the this test to be built with MSVC, which doesn't support
> VLAs.
> ---
>  src/util/tests/hash_table/clear.c | 13 +++--
>  src/util/tests/hash_table/delete_management.c | 13 +++--
>  src/util/tests/hash_table/insert_many.c   | 11 ++-
>  src/util/tests/hash_table/meson.build |  1 +
>  src/util/tests/hash_table/random_entry.c  |  7 ---
>  src/util/tests/string_buffer/meson.build  |  1 +
>  6 files changed, 26 insertions(+), 20 deletions(-)
> 
> diff --git a/src/util/tests/hash_table/clear.c 
> b/src/util/tests/hash_table/clear.c
> index 526700bfb0f..19494844608 100644
> --- a/src/util/tests/hash_table/clear.c
> +++ b/src/util/tests/hash_table/clear.c
> @@ -23,6 +23,8 @@
>  
>  #include "hash_table.h"
>  
> +#define SIZE 1000
> +
>  static void *make_key(uint32_t i)
>  {
>return (void *)(uintptr_t)(1 + i);
> @@ -54,13 +56,12 @@ int main()
>  {
> struct hash_table *ht;
> struct hash_entry *entry;
> -   const uint32_t size = 1000;
> -   bool flags[size];
> +   bool flags[SIZE];

alternative solution:
  bool flags[1000];
  const uint32_t size = ARRAY_SIZE(flags);

bonus: no need to s/size/SIZE/g all over the place :)

> uint32_t i;
>  
> ht = _mesa_hash_table_create(NULL, key_hash, key_equal);
>  
> -   for (i = 0; i < size; ++i) {
> +   for (i = 0; i < SIZE; ++i) {
>flags[i] = false;
>_mesa_hash_table_insert(ht, make_key(i), &flags[i]);
> }
> @@ -70,19 +71,19 @@ int main()
>  
> /* Check that delete_function was called and that repopulating the table
>  * works. */
> -   for (i = 0; i < size; ++i) {
> +   for (i = 0; i < SIZE; ++i) {
>assert(flags[i]);
>flags[i] = false;
>_mesa_hash_table_insert(ht, make_key(i), &flags[i]);
> }
>  
> /* Check that exactly the right set of entries is in the table. */
> -   for (i = 0; i < size; ++i) {
> +   for (i = 0; i < SIZE; ++i) {
>assert(_mesa_hash_table_search(ht, make_key(i)));
> }
>  
> hash_table_foreach(ht, entry) {
> -  assert(key_id(entry->key) < size);
> +  assert(key_id(entry->key) < SIZE);
> }
>  
> _mesa_hash_table_destroy(ht, NULL);
> diff --git a/src/util/tests/hash_table/delete_management.c 
> b/src/util/tests/hash_table/delete_management.c
> index 127d81b3ca9..e3be9fb3d99 100644
> --- a/src/util/tests/hash_table/delete_management.c
> +++ b/src/util/tests/hash_table/delete_management.c
> @@ -30,6 +30,8 @@
>  #include 
>  #include "hash_table.h"
>  
> +#define SIZE 1
> +
>  static uint32_t
>  key_value(const void *key)
>  {
> @@ -47,8 +49,7 @@ main(int argc, char **argv)
>  {
> struct hash_table *ht;
> struct hash_entry *entry;
> -   unsigned size = 1;
> -   uint32_t keys[size];
> +   uint32_t keys[SIZE];
> uint32_t i;
>  
> (void) argc;
> @@ -56,7 +57,7 @@ main(int argc, char **argv)
>  
> ht = _mesa_hash_table_create(NULL, key_value, uint32_t_key_equals);
>  
> -   for (i = 0; i < size; i++) {
> +   for (i = 0; i < SIZE; i++) {
>keys[i] = i;
>  
>_mesa_hash_table_insert(ht, keys + i, NULL);
> @@ -69,7 +70,7 @@ main(int argc, char **argv)
> }
>  
> /* Make sure that all our entries were present at the end. */
> -   for (i = size - 100; i < size; i++) {
> +   for (i = SIZE - 100; i < SIZE; i++) {
>entry = _mesa_hash_table_search(ht, keys + i);
>assert(entry);
>assert(key_value(entry->key) == i);
> @@ -79,8 +80,8 @@ main(int argc, char **argv)
> for (entry = _mesa_hash_table_next_entry(ht, NULL);
>  entry != NULL;
>  entry = _mesa_hash_table_next_entry(ht, entry)) {
> -  assert(key_value(entry->key) >= size - 100 &&
> - key_value(entry->key) < size);
> +  assert(key_value(entry->key) >= SIZE - 100 &&
> + key_value(entry->key) < SIZE);
> }
> assert(ht->entries == 100);
>  
> diff --git a/src/util/tests/hash_table/insert_many.c 
> b/src/util/tests/hash_table/insert_many.c
> index b07e40842bf..6bd35d5c0c7 100644
> --- a/src/util/tests/hash_table/insert_many.c
> +++ b/src/util/tests/hash_table/insert_many.c
> @@ -30,6 +30,8 @@
>  #include 
>  #include "hash_table.h"
>  
> +#define SIZE 1
> +
>  static uint32_t
>  key_value(const void *key)
>  {
> @@ -47,8 +49,7 @@ main(int argc, char **argv)
>  {
> struct hash_table *ht;
> struct hash_entry *entry;
> -   unsigned size = 1;
> -   uint32_t keys[size];
> +   uint32_t keys[SIZE];
> uint32_t i;
>  
> (void) argc;
> @@ -56,18 +57,18 @@ main(int argc, char **argv)
>  
> ht = _mesa_hash_table_create(NULL, key_value, uint32_t_key_equals);
>  
> -   for (i = 0; i < size; i++) {
> +   for (i = 0; i < SIZE; i++) {
>keys[i] = i;
>  
>_mesa_hash_table_insert(ht, keys + i, NULL);
> }
>  
> -   for (i = 0; i < size; i++) {
> +   for (i = 0; i < SIZE; i++) {
>entry = _mesa_hash_table_search(ht, keys + i

Re: [Mesa-dev] [PATCH 00/16] Move the Mesa Website to Sphinx

2018-06-12 Thread Erik Faye-Lund
I've updated my attempt here, to now have the original colors, and
centered the M-corners on the text a bit more properly:

https://codepen.io/kusma/pen/vrXppL

On Tue, Jun 12, 2018 at 2:51 AM Rob Clark  wrote:
>
> On Mon, Jun 11, 2018 at 6:24 PM, Laura Ekstrand  wrote:
> > I really like the rotate on hover effect for the gears.  I would rather that
> > we use 2D WebGL for it if we could, though, since Mesa enables WebGL on
> > certain platforms.
> >
>
> webgl can be a bit heavy for startup time although it might be kinda
> nice if clicking the logo enough times launched an interactive webgl
> version of the logo where you could rotate the logo..

While a 3D WebGL logo would indeed be cool, I'm thinking that it's
probably a relatively "heavy" solution for the use-case.

I'm not particularly interested in trying out that direction, but if
someone else is, I'd love to see it worked on, and maybe measure what
kind of impact it would have on load-times etc?
___
mesa-dev mailing list
mesa-dev@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/mesa-dev


Re: [Mesa-dev] [PATCH] drivers/dri/i965: add missing #include

2018-06-12 Thread Eric Engestrom
On Tuesday, 2018-06-12 11:59:01 +0100, Ross Burton wrote:
> brw_bufmgr.h uses time_t without include time.h, so the build fails under 
> musl.

Indeed, in struct brw_bo.
Reviewed-by: Eric Engestrom 

... and pushed, thank :)

> ---
>  src/mesa/drivers/dri/i965/brw_bufmgr.h | 2 ++
>  1 file changed, 2 insertions(+)
> 
> diff --git a/src/mesa/drivers/dri/i965/brw_bufmgr.h 
> b/src/mesa/drivers/dri/i965/brw_bufmgr.h
> index 68f5e0c2c8..5c2702652b 100644
> --- a/src/mesa/drivers/dri/i965/brw_bufmgr.h
> +++ b/src/mesa/drivers/dri/i965/brw_bufmgr.h
> @@ -37,6 +37,8 @@
>  #include 
>  #include 
>  #include 
> +#include 
> +
>  #include "util/u_atomic.h"
>  #include "util/list.h"
>  
> -- 
> 2.11.0
> 
> ___
> mesa-dev mailing list
> mesa-dev@lists.freedesktop.org
> https://lists.freedesktop.org/mailman/listinfo/mesa-dev
___
mesa-dev mailing list
mesa-dev@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/mesa-dev


[Mesa-dev] [PATCH mesa] meson: add GL/glext.h warning fix for MacOS

2018-06-12 Thread Eric Engestrom
Copied from configure.ac:1950

Signed-off-by: Eric Engestrom 
---
Is it still needed? We've been building on MacOS for a while,
yet nobody noticed anything (Dylan?)
If not, we should probably avoid unnecessary differences with Khronos'
headers and nuke BUILDING_MESA.
---
 meson.build | 1 +
 1 file changed, 1 insertion(+)

diff --git a/meson.build b/meson.build
index c5acc8a3587ea20e131e..04b3bdfd77f36670ff7f 100644
--- a/meson.build
+++ b/meson.build
@@ -209,6 +209,7 @@ endif
 
 if host_machine.system() == 'darwin'
   with_dri_platform = 'apple'
+  pre_args += '-DBUILDING_MESA'
 elif ['windows', 'cygwin'].contains(host_machine.system())
   with_dri_platform = 'windows'
 elif system_has_kms_drm
-- 
Cheers,
  Eric

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


Re: [Mesa-dev] [PATCH 14/48] meson: don't build shader cache on windows

2018-06-12 Thread Eric Engestrom
On Monday, 2018-06-11 15:55:41 -0700, Dylan Baker wrote:
> ---
>  meson.build | 2 +-
>  1 file changed, 1 insertion(+), 1 deletion(-)
> 
> diff --git a/meson.build b/meson.build
> index 4247d195bc1..ed63276b63e 100644
> --- a/meson.build
> +++ b/meson.build
> @@ -699,7 +699,7 @@ if get_option('buildtype') == 'debug'
>pre_args += '-DDEBUG'
>  endif
>  
> -if get_option('shader-cache')
> +if get_option('shader-cache') and host_machine.system() != 'windows'

This means that shader-cache=true on windows will be silently ignored,
not very intuitive.
How about auto/true/false, with auto = `host_machine.system() != 'windows'`?
That way, patch 36/48 (meson: Don't build glsl cache_test for windows)
can be guarded by `with_shader_cache` instead, which means it will be
automatically tested on windows if/when turned on.

>pre_args += '-DENABLE_SHADER_CACHE'
>  elif with_amd_vk
>error('Radv requires shader cache support')
> -- 
> 2.17.1
> 
> ___
> 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 38/48] nir/meson: fix c vs cpp args for nir test

2018-06-12 Thread Eric Engestrom
On Monday, 2018-06-11 15:56:05 -0700, Dylan Baker wrote:

Reviewed-by: Eric Engestrom 

> ---
>  src/compiler/nir/meson.build | 2 +-
>  1 file changed, 1 insertion(+), 1 deletion(-)
> 
> diff --git a/src/compiler/nir/meson.build b/src/compiler/nir/meson.build
> index 598c68aff9f..b6677ae7793 100644
> --- a/src/compiler/nir/meson.build
> +++ b/src/compiler/nir/meson.build
> @@ -231,7 +231,7 @@ if with_tests
>  executable(
>'nir_control_flow_test',
>files('tests/control_flow_tests.cpp'),
> -  c_args : [c_vis_args, c_msvc_compat_args, no_override_init_args],
> +  cpp_args : [cpp_vis_args, cpp_msvc_compat_args],
>include_directories : [inc_common],
>dependencies : [dep_thread, idep_gtest, idep_nir],
>link_with : libmesa_util,
> -- 
> 2.17.1
> 
> ___
> 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 44/48] meson: add windows specific linker flags

2018-06-12 Thread Eric Engestrom
On Monday, 2018-06-11 15:56:11 -0700, Dylan Baker wrote:
> ---
>  meson.build | 21 +
>  1 file changed, 21 insertions(+)
> 
> diff --git a/meson.build b/meson.build
> index a244694fd4a..e1b3afbe688 100644
> --- a/meson.build
> +++ b/meson.build
> @@ -847,6 +847,27 @@ else
>endforeach
>  endif
>  
> +# set linker arguments
> +if host_machine.system() == 'windows'
> +  if cc.get_id() == 'msvc'
> +add_project_link_arguments(
> +  '/fixed:no',
> +  '/incremental:no',
> +  '/dynamicbase',
> +  '/nxcompat',
> +  language : ['c', 'cpp'],
> +)
> +  else
> +add_project_link_arguments(
> +  '-Wl,--nxcompat',
> +  '-Wl,--dynamicbase',
> +  '-static-libgcc',
> +  '-static-libstdc++',
> +  language : ['c', 'cpp'],

probably harmless, but it feels like libgcc and libstdc++ should be
only added to c, respectively cpp, not both.

> +)
> +  endif
> +endif
> +
>  if host_machine.cpu_family().startswith('x86') and cc.get_id() != 'msvc'
>pre_args += '-DUSE_SSE41'
>with_sse41 = true
> -- 
> 2.17.1
> 
> ___
> 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 46/48] appveyor: Add support for meson as well as scons

2018-06-12 Thread Eric Engestrom
On Monday, 2018-06-11 15:56:13 -0700, Dylan Baker wrote:
> This currently builds softpipe only
> ---
>  appveyor.yml | 28 +++-
>  1 file changed, 19 insertions(+), 9 deletions(-)
> 
> diff --git a/appveyor.yml b/appveyor.yml
> index bd33e2e9554..06063feba93 100644
> --- a/appveyor.yml
> +++ b/appveyor.yml
> @@ -42,6 +42,9 @@ os: Visual Studio 2015
>  environment:
>WINFLEXBISON_ARCHIVE: win_flex_bison-2.5.9.zip
>LLVM_ARCHIVE: llvm-3.3.1-msvc2015-mtd.7z
> +  matrix:
> +- BUILD_SYSTEM: meson
> +- BUILD_SYSTEM: scons
>  
>  install:
>  # Check pip
> @@ -49,13 +52,16 @@ install:
>  - python -m pip --version
>  # Install Mako
>  - python -m pip install Mako==1.0.6
> -# Install pywin32 extensions, needed by SCons
> -- python -m pip install pypiwin32
> -# Install python wheels, necessary to install SCons via pip
> -- python -m pip install wheel
> -# Install SCons
> -- python -m pip install scons==2.5.1
> -- scons --version
> +- if "%BUILD_SYSTEM%"=="scons" python -m pip install pypiwin32 wheel
> +- if "%BUILD_SYSTEM%"=="scons" python -m pip install scons==2.5.1
> +- if "%BUILD_SYSTEM%"=="scons" scons --version
> +- if "%BUILD_SYSTEM%"=="meson" C:\Python36\python.exe -m pip install meson
> +- if "%BUILD_SYSTEM%"=="meson" set Path=C:\Python36\Scripts;%Path%
> +- if "%BUILD_SYSTEM%"=="meson" set Path=C:\Python27;%Path%
> +- if "%BUILD_SYSTEM%"=="meson" meson.py --version
> +- if "%BUILD_SYSTEM%"=="meson" cinst -y ninja pkgconfiglite
> +- if "%BUILD_SYSTEM%"=="meson" ninja --version
> +- if "%BUILD_SYSTEM%"=="meson" call "C:\Program Files (x86)\Microsoft Visual 
> Studio 14.0\VC\vcvarsall.bat" x86_amd64

I think this is gonna be more readable if you use `()`:

  if %BS%==scons (
foo
bar
baz
...
  )

>  # Install flex/bison
>  - if not exist "%WINFLEXBISON_ARCHIVE%" appveyor DownloadFile 
> "https://downloads.sourceforge.net/project/winflexbison/old_versions/%WINFLEXBISON_ARCHIVE%";
>  - 7z x -y -owinflexbison\ "%WINFLEXBISON_ARCHIVE%" > nul
> @@ -69,10 +75,14 @@ install:
>  - set LLVM=%CD%\llvm
>  
>  build_script:
> -- scons -j%NUMBER_OF_PROCESSORS% MSVC_VERSION=14.0 llvm=1
> +- if "%BUILD_SYSTEM%"=="scons" scons -j%NUMBER_OF_PROCESSORS% 
> MSVC_VERSION=14.0 llvm=1
> +- if "%BUILD_SYSTEM%"=="meson" meson builddir -Dbuild-tests=true
> +- if "%BUILD_SYSTEM%"=="meson" ninja -C builddir
>  
>  after_build:
> -- scons -j%NUMBER_OF_PROCESSORS% MSVC_VERSION=14.0 llvm=1 check
> +- if "%BUILD_SYSTEM%"=="scons" scons -j%NUMBER_OF_PROCESSORS% 
> MSVC_VERSION=14.0 llvm=1 check
> +# Doesn't work yet, a large number of tests fail
> +#- if "%BUILD_SYSTEM%"=="meson" ninja -C builddir test
>  
>  
>  # It's possible to setup notification here, as described in
> -- 
> 2.17.1
> 
> ___
> 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 47/48] appveyor: use chocolatey (cinst) to isntall winflexbixon

2018-06-12 Thread Eric Engestrom
(couple typos in the subject)

On Monday, 2018-06-11 15:56:14 -0700, Dylan Baker wrote:
> ---
>  appveyor.yml | 6 +-
>  1 file changed, 1 insertion(+), 5 deletions(-)
> 
> diff --git a/appveyor.yml b/appveyor.yml
> index 06063feba93..f544314e730 100644
> --- a/appveyor.yml
> +++ b/appveyor.yml
> @@ -34,13 +34,11 @@ branches:
>  clone_depth: 100
>  
>  cache:
> -- win_flex_bison-2.5.9.zip
>  - llvm-3.3.1-msvc2015-mtd.7z
>  
>  os: Visual Studio 2015
>  
>  environment:
> -  WINFLEXBISON_ARCHIVE: win_flex_bison-2.5.9.zip
>LLVM_ARCHIVE: llvm-3.3.1-msvc2015-mtd.7z
>matrix:
>  - BUILD_SYSTEM: meson
> @@ -63,9 +61,7 @@ install:
>  - if "%BUILD_SYSTEM%"=="meson" ninja --version
>  - if "%BUILD_SYSTEM%"=="meson" call "C:\Program Files (x86)\Microsoft Visual 
> Studio 14.0\VC\vcvarsall.bat" x86_amd64
>  # Install flex/bison
> -- if not exist "%WINFLEXBISON_ARCHIVE%" appveyor DownloadFile 
> "https://downloads.sourceforge.net/project/winflexbison/old_versions/%WINFLEXBISON_ARCHIVE%";
> -- 7z x -y -owinflexbison\ "%WINFLEXBISON_ARCHIVE%" > nul
> -- set Path=%CD%\winflexbison;%Path%
> +- cinst -y winflexbison
>  - win_flex --version
>  - win_bison --version
>  # Download and extract LLVM
> -- 
> 2.17.1
> 
> ___
> 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 23/48] meson: Add support for wrapping llvm

2018-06-12 Thread Eric Engestrom
On Monday, 2018-06-11 15:55:50 -0700, Dylan Baker wrote:
> For building on Windows (when not using cygwin), the assumption is that
> LLVM will have to be handled via a binary wrap. In this case the user
> wanting to use LLVM is this way will need to create a directory in
> subprojects (any name is fine), and pass that name via the -Dllvm-wrap
> option (for example, assuming subprojects/llvm, -Dllvm-wrap=llvm), which
> must have a meson.build file and the installed LLVM to link with (this
> can be either static or dynamic). There is documentation for what this
> needs to look like and how to define it.
> ---
>  docs/meson.html   |  66 +
>  meson.build   | 128 ++
>  meson_options.txt |   6 +
>  .../drivers/swr/rasterizer/jitter/meson.build |  13 +-
>  4 files changed, 154 insertions(+), 59 deletions(-)
> 
> diff --git a/docs/meson.html b/docs/meson.html
> index 29907a60a9c..6697dbb34ef 100644
> --- a/docs/meson.html
> +++ b/docs/meson.html
> @@ -132,6 +132,72 @@ dependency interface. It will search $PATH 
> (or %PATH%
>  llvm-config, so using an LLVM from a non-standard path is as easy as
>  PATH=/path/with/llvm-config:$PATH meson build.
>  
> +
> +On windows (and in other cases), using llvm-config is either 
> undesirable
> +or impossible. Meson's solution for this is a
> +http://mesonbuild.com/Wrap-dependency-system-manual.html";>wrap, 
> in
> +this case a "binary wrap". Follow the steps below:
> +
> +Install the binaries and headers into a directory under the 
> $mesa_src/subprojects
> +Add a meson build.build file to that directory (more on that 
> later)
> +add -Dllvm-wrap=$directory to your meson configuration (where 
> $directory is the the directory under subprojects

nit: put  around cli args, vars, paths, and functions :)
(here and below)

> +
> +
> +The wrap file must define the following:
> +
> +ext_llvm: a declare_dependency() object with include_directories, 
> dependencies, and version set)
> +
> +
> +It may also define:
> +
> +irbuilder_h: a file() object pointing to llvm/IR/IRBuilder.h (for 
> SWR)
> +
> +
> +such a meson.build file might look like:
> +
> +project('llvm', ['cpp'])
> +
> +cpp = meson.get_compiler('cpp')
> +
> +_deps = []
> +_search = join_paths(meson.current_source_dir(), 'lib')
> +foreach d : ['libLLVMCodeGen', 'libLLVMScalarOpts', 'libLLVMAnalysis',
> + 'libLLVMTransformUtils', 'libLLVMCore', 'libLLVMX86CodeGen',
> + 'libLLVMSelectionDAG', 'libLLVMipo', 'libLLVMAsmPrinter',
> + 'libLLVMInstCombine', 'libLLVMInstrumentation', 'libLLVMMC',
> + 'libLLVMGlobalISel', 'libLLVMObjectYAML', 'libLLVMDebugInfoPDB',
> + 'libLLVMVectorize', 'libLLVMPasses', 'libLLVMSupport',
> + 'libLLVMLTO', 'libLLVMObject', 'libLLVMDebugInfoCodeView',
> + 'libLLVMDebugInfoDWARF', 'libLLVMOrcJIT', 'libLLVMProfileData',
> + 'libLLVMObjCARCOpts', 'libLLVMBitReader', 'libLLVMCoroutines',
> + 'libLLVMBitWriter', 'libLLVMRuntimeDyld', 'libLLVMMIRParser',
> + 'libLLVMX86Desc', 'libLLVMAsmParser', 'libLLVMTableGen',
> + 'libLLVMFuzzMutate', 'libLLVMLinker', 'libLLVMMCParser',
> + 'libLLVMExecutionEngine', 'libLLVMCoverage', 
> 'libLLVMInterpreter',
> + 'libLLVMTarget', 'libLLVMX86AsmParser', 'libLLVMSymbolize',
> + 'libLLVMDebugInfoMSF', 'libLLVMMCJIT', 'libLLVMXRay',
> + 'libLLVMX86AsmPrinter', 'libLLVMX86Disassembler',
> + 'libLLVMMCDisassembler', 'libLLVMOption', 'libLLVMIRReader',
> + 'libLLVMLibDriver', 'libLLVMDlltoolDriver', 'libLLVMDemangle',
> + 'libLLVMBinaryFormat', 'libLLVMLineEditor',
> + 'libLLVMWindowsManifest', 'libLLVMX86Info', 'libLLVMX86Utils']
> +  _deps += cpp.find_library(d, dirs : _search)
> +endforeach
> +
> +ext_llvm = declare_dependency(
> +  include_directories : include_directories('include'),
> +  dependencies : _deps,
> +  version : '6.0.0',
> +)
> +
> +irbuilder_h = files('include/llvm/IR/IRBuilder.h')
> +
> +
> +It is very important that version is defined and is accurate, if it is 
> not,
> +workarounds for the wrong version of LLVM might be used resulting in build
> +failures.
> +
> +
>  
>  
>  
> diff --git a/meson.build b/meson.build
> index 0b0203bc03d..67577241953 100644
> --- a/meson.build
> +++ b/meson.build
> @@ -1145,20 +1145,6 @@ if dep_libdrm.found()
>endif
>  endif
>  
> -llvm_modules = ['bitwriter', 'engine', 'mcdisassembler', 'mcjit']
> -if with_amd_vk or with_gallium_radeonsi or with_gallium_r600
> -  llvm_modules += ['amdgpu', 'bitreader', 'ipo']
> -  if with_gallium_r600
> -llvm_modules += 'asmparser'
> -  endif
> -endif
> -if with_gallium_opencl
> -  llvm_modules += [
> -'all-targets', 'linker', 'coverage', 'instrumentation', 'ipo', 
> 'irreader',
> -'lto', 'option', 'objcarcopts', 'profi

Re: [Mesa-dev] [PATCH 10/48] meson: Add a platform for windows

2018-06-12 Thread Eric Engestrom
On Monday, 2018-06-11 15:55:37 -0700, Dylan Baker wrote:
> This mirrors the haiku build which uses a platform.
> ---
>  meson.build   | 16 ++--
>  meson_options.txt |  1 +
>  2 files changed, 15 insertions(+), 2 deletions(-)
> 
> diff --git a/meson.build b/meson.build
> index 634a7a21758..9c8b9ca9ba5 100644
> --- a/meson.build
> +++ b/meson.build
> @@ -222,14 +222,24 @@ else
>with_dri_platform = 'none'
>  endif
>  
> +with_platform_android = false
> +with_platform_haiku = false
> +with_platform_windows = false
> +with_platform_wayland = false
> +with_platform_x11 = false
> +with_platform_drm = false
> +with_platform_surfaceless = false
> +egl_native_platform = ''

guessing that's a rebase fail :P

>  _platforms = get_option('platforms')
>  if _platforms.contains('auto')
>if system_has_kms_drm
>  _platforms = ['x11', 'wayland', 'drm', 'surfaceless']
> -  elif ['darwin', 'windows', 'cygwin'].contains(host_machine.system())
> +  elif ['darwin', 'cygwin'].contains(host_machine.system())
>  _platforms = ['x11', 'surfaceless']
>elif ['haiku'].contains(host_machine.system())
>  _platforms = ['haiku']
> +  elif host_machine.system() == 'windows'
> +_platforms = ['windows']

I'm not convinced by this though; if you add `-D platforms=windows` on
non-Windows, what do you get?
If you remove `windows` from `platforms` on Windows, what do you get?

It seems to me like all the places where `with_platform_windows` is used
in your series, it should be `host_machine.system() == 'windows'` instead.

This is the only patch I'm (soft) NAK'ing in your series; the rest of it
is:
Acked-by: Eric Engestrom 

>else
>  error('Unknown OS. Please pass -Dplatforms to set platforms. Patches 
> gladly accepted to fix this.')
>endif
> @@ -241,6 +251,7 @@ with_platform_wayland = _platforms.contains('wayland')
>  with_platform_drm = _platforms.contains('drm')
>  with_platform_haiku = _platforms.contains('haiku')
>  with_platform_surfaceless = _platforms.contains('surfaceless')
> +with_platform_windows = _platforms.contains('windows')
>  
>  with_platforms = false
>  if _platforms.length() != 0 and _platforms != ['']
> @@ -365,7 +376,8 @@ 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 and not with_platform_haiku
> +  if (with_glx == 'disabled' and not with_egl and not with_platform_haiku and
> +  not with_platform_windows)
>  error('building dri or gallium drivers require at least one window 
> system')
>endif
>  endif
> diff --git a/meson_options.txt b/meson_options.txt
> index 28e92509198..ad06916fc40 100644
> --- a/meson_options.txt
> +++ b/meson_options.txt
> @@ -24,6 +24,7 @@ option(
>value : ['auto'],
>choices : [
>  '', 'auto', 'x11', 'wayland', 'drm', 'surfaceless', 'haiku', 'android',
> +'windows',
>],
>description : 'comma separated list of window systems to support. If this 
> is set to auto all platforms applicable to the OS will be enabled.'
>  )
> -- 
> 2.17.1
> 
> ___
> 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 00/16] Move the Mesa Website to Sphinx

2018-06-12 Thread Ilia Mirkin
On Tue, Jun 12, 2018 at 7:04 AM, Erik Faye-Lund  wrote:
> I've updated my attempt here, to now have the original colors, and
> centered the M-corners on the text a bit more properly:
>
> https://codepen.io/kusma/pen/vrXppL
>
> On Tue, Jun 12, 2018 at 2:51 AM Rob Clark  wrote:
>>
>> On Mon, Jun 11, 2018 at 6:24 PM, Laura Ekstrand  wrote:
>> > I really like the rotate on hover effect for the gears.  I would rather 
>> > that
>> > we use 2D WebGL for it if we could, though, since Mesa enables WebGL on
>> > certain platforms.
>> >
>>
>> webgl can be a bit heavy for startup time although it might be kinda
>> nice if clicking the logo enough times launched an interactive webgl
>> version of the logo where you could rotate the logo..
>
> While a 3D WebGL logo would indeed be cool, I'm thinking that it's
> probably a relatively "heavy" solution for the use-case.
>
> I'm not particularly interested in trying out that direction, but if
> someone else is, I'd love to see it worked on, and maybe measure what
> kind of impact it would have on load-times etc?

I tend to agree - svg seems like the natural fit for web, while WebGL
is cool-but-too-heavy for a logo. Cool to have a demo page with it,
but I don't know if it should be in the logo on every page, esp given
WebGL's propensity to crash things.

Erik - https://stackoverflow.com/questions/35124550/animating-an-svg-on-hover
- might want to do it the CSS way to avoid the onmouseover/etc stuff,
which IME is somewhat imperfect.
___
mesa-dev mailing list
mesa-dev@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/mesa-dev


Re: [Mesa-dev] [PATCH v2 6/6] meson: remove a bunch of out of date TODO's

2018-06-12 Thread Eric Engestrom
On Monday, 2018-06-11 10:19:01 -0700, Dylan Baker wrote:
> Some of these are done already, some of them are things we're not going
> to do, like have a toggle for GLX_TLS.

I'm not 100% sure which is which, and I might not be the only one;
could you split these two into two patches? Thanks :)

The rest of the series is:
Reviewed-by: Eric Engestrom 

> 
> v2: - Don't remove USE_MGL_NAMESPACE or with_glx_direct
> 
> Signed-off-by: Dylan Baker 
> ---
>  meson.build | 8 
>  src/egl/meson.build | 2 --
>  src/gbm/meson.build | 2 --
>  3 files changed, 12 deletions(-)
> 
> diff --git a/meson.build b/meson.build
> index bee526a4f22..aefb9f3c85e 100644
> --- a/meson.build
> +++ b/meson.build
> @@ -1217,8 +1217,6 @@ if get_option('selinux')
>pre_args += '-DMESA_SELINUX'
>  endif
>  
> -# TODO: llvm-prefix and llvm-shared-libs
> -
>  if with_libunwind != 'false'
>dep_unwind = dependency('libunwind', required : with_libunwind == 'true')
>if dep_unwind.found()
> @@ -1228,8 +1226,6 @@ else
>dep_unwind = null_dep
>  endif
>  
> -# TODO: gallium-hud
> -
>  if with_osmesa != 'none'
>if with_osmesa == 'classic' and not with_dri_swrast
>  error('OSMesa classic requires dri (classic) swrast.')
> @@ -1354,10 +1350,6 @@ else
>dep_lmsensors = null_dep
>  endif
>  
> -# TODO: various libdirs
> -
> -# TODO: gallium driver dirs
> -
>  foreach a : pre_args
>add_project_arguments(a, language : ['c', 'cpp'])
>  endforeach
> diff --git a/src/egl/meson.build b/src/egl/meson.build
> index 8d888d35aff..5f30bbba89a 100644
> --- a/src/egl/meson.build
> +++ b/src/egl/meson.build
> @@ -140,8 +140,6 @@ if with_platform_haiku
>deps_for_egl += cpp.find_library('be')
>  endif
>  
> -# TODO: glvnd
> -
>  if cc.has_function('mincore')
>c_args_for_egl += '-DHAVE_MINCORE'
>  endif
> diff --git a/src/gbm/meson.build b/src/gbm/meson.build
> index 7a60868783c..2e9d380c0b4 100644
> --- a/src/gbm/meson.build
> +++ b/src/gbm/meson.build
> @@ -45,8 +45,6 @@ if with_platform_wayland
>incs_gbm += inc_wayland_drm
>  endif
>  
> -# TODO: wayland support (requires egl)
> -
>  libgbm = shared_library(
>'gbm',
>files_gbm,
> -- 
> 2.17.1
> 
> ___
> 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 00/16] Move the Mesa Website to Sphinx

2018-06-12 Thread Erik Faye-Lund
On Tue, Jun 12, 2018 at 1:59 PM Ilia Mirkin  wrote:
>
> On Tue, Jun 12, 2018 at 7:04 AM, Erik Faye-Lund  wrote:
> > I've updated my attempt here, to now have the original colors, and
> > centered the M-corners on the text a bit more properly:
> >
> > https://codepen.io/kusma/pen/vrXppL
> >
> Erik - https://stackoverflow.com/questions/35124550/animating-an-svg-on-hover
> - might want to do it the CSS way to avoid the onmouseover/etc stuff,
> which IME is somewhat imperfect.

Sure, I can give that a go.

On a side-note, I've also created a new favicon from the gears SVG,
and it looks quite a bit cleaner than the current one IMO:

https://gitlab.freedesktop.org/kusma/mesa/tree/new-favicon

We should probably just do that imagemagick-line on CI instead of
checking in the ICO-file, though.
___
mesa-dev mailing list
mesa-dev@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/mesa-dev


Re: [Mesa-dev] [PATCH 00/16] Move the Mesa Website to Sphinx

2018-06-12 Thread Rob Clark
On Tue, Jun 12, 2018 at 7:04 AM, Erik Faye-Lund  wrote:
> I've updated my attempt here, to now have the original colors, and
> centered the M-corners on the text a bit more properly:
>
> https://codepen.io/kusma/pen/vrXppL

very nice :-)

BR,
-R

>
> On Tue, Jun 12, 2018 at 2:51 AM Rob Clark  wrote:
>>
>> On Mon, Jun 11, 2018 at 6:24 PM, Laura Ekstrand  wrote:
>> > I really like the rotate on hover effect for the gears.  I would rather 
>> > that
>> > we use 2D WebGL for it if we could, though, since Mesa enables WebGL on
>> > certain platforms.
>> >
>>
>> webgl can be a bit heavy for startup time although it might be kinda
>> nice if clicking the logo enough times launched an interactive webgl
>> version of the logo where you could rotate the logo..
>
> While a 3D WebGL logo would indeed be cool, I'm thinking that it's
> probably a relatively "heavy" solution for the use-case.
>
> I'm not particularly interested in trying out that direction, but if
> someone else is, I'd love to see it worked on, and maybe measure what
> kind of impact it would have on load-times etc?
___
mesa-dev mailing list
mesa-dev@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/mesa-dev


Re: [Mesa-dev] [PATCH 00/16] Move the Mesa Website to Sphinx

2018-06-12 Thread Erik Faye-Lund
On Tue, Jun 12, 2018 at 2:12 PM Erik Faye-Lund  wrote:
>
> On Tue, Jun 12, 2018 at 1:59 PM Ilia Mirkin  wrote:
> >
> > On Tue, Jun 12, 2018 at 7:04 AM, Erik Faye-Lund  wrote:
> > > I've updated my attempt here, to now have the original colors, and
> > > centered the M-corners on the text a bit more properly:
> > >
> > > https://codepen.io/kusma/pen/vrXppL
> > >
> > Erik - 
> > https://stackoverflow.com/questions/35124550/animating-an-svg-on-hover
> > - might want to do it the CSS way to avoid the onmouseover/etc stuff,
> > which IME is somewhat imperfect.
>
> Sure, I can give that a go.

Yeah, that was easy:

https://codepen.io/kusma/pen/vrXppL

Much nicer than the JS solution :)
___
mesa-dev mailing list
mesa-dev@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/mesa-dev


Re: [Mesa-dev] [PATCH 2/2] vkpipeline-db: add support for anv

2018-06-12 Thread Samuel Pitoiset

Acked-by: Samuel Pitoiset 

On 06/12/2018 07:05 AM, Timothy Arceri wrote:

From: Timothy Arceri 

---
  anv-report.py | 191 ++
  run.c |  75 +---
  2 files changed, 239 insertions(+), 27 deletions(-)
  create mode 100755 anv-report.py

diff --git a/anv-report.py b/anv-report.py
new file mode 100755
index 000..b306220
--- /dev/null
+++ b/anv-report.py
@@ -0,0 +1,191 @@
+#!/usr/bin/env python3
+
+import re
+import argparse
+
+
+def get_results(filename):
+file = open(filename, "r")
+lines = file.read().split('\n')
+
+results = {}
+
+re_match = re.compile(r"(\S+) - (\S+ \S+) shader: (\S*) inst, (\S*) loops, 
(\S*) cycles, (\S*):(\S*) spills:fills")
+for line in lines:
+match = re.search(re_match, line)
+if match is None:
+continue
+
+groups = match.groups()
+inst_count = int(groups[2])
+loop_count = int(groups[3])
+cycle_count = int(groups[4])
+spill_count = int(groups[5])
+fill_count = int(groups[6])
+if inst_count != 0:
+results[(groups[0], groups[1])] = {
+"instructions": inst_count,
+"spills": spill_count,
+"fills": fill_count,
+"cycles": cycle_count,
+"loops": loop_count
+}
+
+return results
+
+
+def format_percent(frac):
+"""Converts a factional value (typically 0.0 to 1.0) to a string as a 
percentage"""
+if abs(frac) > 0.0 and abs(frac) < 0.0001:
+return "<.01%"
+else:
+return "{:.2f}%".format(frac * 100)
+
+
+def get_delta(b, a):
+if b != 0 and a != 0:
+frac = float(a) / float(b) - 1.0
+return ' ({})'.format(format_percent(frac))
+else:
+return ''
+
+
+def change(b, a):
+return str(b) + " -> " + str(a) + get_delta(b, a)
+
+
+def get_result_string(p, b, a):
+p = p + ": "
+while len(p) < 50:
+p = p + ' '
+return p + change(b, a)
+
+def split_list(string):
+return string.split(",")
+
+def main():
+parser = argparse.ArgumentParser()
+parser.add_argument("--measurements", "-m", type=split_list,
+default=["instructions", "cycles", "loops", "spills", 
"fills"],
+help="comma-separated list of measurements to report")
+parser.add_argument("--summary-only", "-s", action="store_true", 
default=False,
+help="do not show the per-shader helped / hurt data")
+parser.add_argument("--changes-only", "-c", action="store_true", 
default=False,
+help="only show measurements that have changes")
+parser.add_argument("before", type=get_results, help="the output of the 
original code")
+parser.add_argument("after", type=get_results, help="the output of the new 
code")
+args = parser.parse_args()
+
+total_before = {}
+total_after = {}
+affected_before = {}
+affected_after = {}
+num_hurt = {}
+num_helped = {}
+
+for m in args.measurements:
+total_before[m] = 0
+total_after[m] = 0
+affected_before[m] = 0
+affected_after[m] = 0
+
+helped = []
+hurt = []
+for p in args.before:
+before_count = args.before[p][m]
+
+if args.after.get(p) is None:
+continue
+
+# If the number of loops changed, then we may have unrolled some
+# loops, in which case other measurements will be misleading.
+if m != "loops" and args.before[p]["loops"] != 
args.after[p]["loops"]:
+continue
+
+after_count = args.after[p][m]
+
+total_before[m] += before_count
+total_after[m] += after_count
+
+if before_count != after_count:
+affected_before[m] += before_count
+affected_after[m] += after_count
+
+if after_count > before_count:
+hurt.append(p)
+else:
+helped.append(p)
+
+if not args.summary_only:
+helped.sort(
+key=lambda k: args.after[k][m] if args.before[k][m] == 0 else 
float(args.before[k][m] - args.after[k][m]) / args.before[k][m])
+for p in helped:
+namestr = p[0] + " " + p[1]
+print(m + " helped:   " + get_result_string(
+namestr, args.before[p][m], args.after[p][m]))
+if helped:
+print("")
+
+hurt.sort(
+key=lambda k: args.after[k][m] if args.before[k][m] == 0 else 
float(args.after[k][m] - args.before[k][m]) / args.before[k][m])
+for p in hurt:
+namestr = p[0] + " " + p[1]
+print(m + " HURT:   " + get_result_string(
+namestr, args.before[p][m], args.after[p][m]))
+if hurt:
+print("")
+
+n

Re: [Mesa-dev] [PATCH 1/2] vkpipeline-db: add sType to pipeline info

2018-06-12 Thread Samuel Pitoiset

Reviewed-by: Samuel Pitoiset 

On 06/12/2018 07:05 AM, Timothy Arceri wrote:

From: Timothy Arceri 

This avoids hitting asserts in anv.
---
  run.c | 2 ++
  1 file changed, 2 insertions(+)

diff --git a/run.c b/run.c
index eafbd7d..a962887 100644
--- a/run.c
+++ b/run.c
@@ -264,6 +264,7 @@ create_graphics_pipeline(VkDevice device, struct 
pipeline_info *info,
  return result;
  
  /* Graphics pipeline. */

+pipelineInfo.sType = VK_STRUCTURE_TYPE_GRAPHICS_PIPELINE_CREATE_INFO;
  pipelineInfo.stageCount = info->stageCount;
  pipelineInfo.pStages = info->pShaderStagesInfo;
  pipelineInfo.pVertexInputState = &info->vertexInputState;
@@ -292,6 +293,7 @@ create_compute_pipeline(VkDevice device, struct 
pipeline_info *info,
  VkComputePipelineCreateInfo pipelineInfo = {};
  
  /* Compute pipeline. */

+pipelineInfo.sType = VK_STRUCTURE_TYPE_COMPUTE_PIPELINE_CREATE_INFO;
  pipelineInfo.stage = *info->pShaderStagesInfo;
  pipelineInfo.layout = layout;
  


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


Re: [Mesa-dev] [PATCH] vkpipeline_db: add support for multi-threading

2018-06-12 Thread Samuel Pitoiset

Very nice. :-)

Reviewed-by: Samuel Pitoiset 

On 06/09/2018 03:23 AM, Timothy Arceri wrote:

---
  CMakeLists.txt |   1 +
  run.c  | 169 +++--
  2 files changed, 121 insertions(+), 49 deletions(-)

diff --git a/CMakeLists.txt b/CMakeLists.txt
index 3e1546c..c1d86c8 100644
--- a/CMakeLists.txt
+++ b/CMakeLists.txt
@@ -4,6 +4,7 @@ project(vkpipeline-db)
  
  find_package(Vulkan REQUIRED)
  
+SET(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} -fopenmp")

  set(CMAKE_CXX_FLAGS_DEBUG "${CMAKE_CXX_FLAGS_DEBUG} -Wall")
  set(CMAKE_C_FLAGS_DEBUG "${CMAKE_CXX_FLAGS_DEBUG} -Wall")
  if(CMAKE_COMPILER_IS_GNUCXX)
diff --git a/run.c b/run.c
index 1d641a0..eafbd7d 100644
--- a/run.c
+++ b/run.c
@@ -31,16 +31,47 @@
  #include 
  #include 
  #include 
+#include 
+#include 
  #include 
  #include 
  #include 
  #include 
  #include 
+#include 
  
  #include "serialize.h"
  
  #define unlikely(x) __builtin_expect(!!(x), 0)
  
+int max_threads;

+const char **current_pipeline_names;
+static pthread_mutex_t printf_mutex;
+
+#define sigputs(str) write(STDERR_FILENO, str, strlen(str))
+
+#pragma GCC diagnostic push
+#pragma GCC diagnostic ignored "-Wunused-result"
+static void
+abort_handler(int signo)
+{
+if (current_pipeline_names) {
+sigputs("\n => CRASHED <= while processing these pipelines:\n\n");
+for (int i = 0; i < max_threads; i++) {
+if (current_pipeline_names[i]) {
+sigputs("");
+sigputs(current_pipeline_names[i]);
+sigputs("\n");
+}
+}
+} else {
+   sigputs("\n => CRASHED <= during final teardown.\n");
+}
+sigputs("\n");
+_exit(-1);
+}
+#pragma GCC diagnostic pop
+
  /* Pipeline tests. */
  static unsigned pipeline_test_size = 1 << 15; /* next-pow-2(num pipelines in 
db) */
  static unsigned pipeline_test_length;
@@ -94,7 +125,7 @@ struct shader_stats
  };
  
  #define PARSE_STAT(key, value) \

-line = strtok(NULL, "\n"); \
+line = strtok_r(NULL, "\n", &saveptr); \
  if (sscanf(line, key, value) != 1) \
  return -1;
  
@@ -102,12 +133,13 @@ static int

  parse_shader_stats(char *buf, struct shader_stats *stats)
  {
  char *line;
+char *saveptr;
  
-line = strtok(buf, "\n");

+line = strtok_r(buf, "\n", &saveptr);
  while(line) {
  if (!strcmp(line, "*** SHADER STATS ***"))
  break;
-line = strtok(NULL, "\n");
+line = strtok_r(NULL, "\n", &saveptr);
  }
  
  if (unlikely(!line))

@@ -200,6 +232,7 @@ static void
  print_shader_stats(const char *pipeline_name, VkShaderStageFlagBits stage,
 const struct shader_stats *stats)
  {
+pthread_mutex_lock(&printf_mutex);
  printf("%s (%s) - ", pipeline_name, get_shader_stage_name(stage));
  printf("Shader Stats: ");
  printf("SGPRS: %d ", stats->num_sgprs);
@@ -212,6 +245,7 @@ print_shader_stats(const char *pipeline_name, 
VkShaderStageFlagBits stage,
  printf("Spilled VGPRs: %d ", stats->num_spilled_vgprs);
  printf("PrivMem VGPRs: %d ", stats->priv_mem_vgprs);
  printf("\n");
+pthread_mutex_unlock(&printf_mutex);
  }
  
  static VkResult

@@ -401,7 +435,8 @@ static void
  print_usage(const char *prog_name)
  {
  fprintf(stderr,
-"Usage: %s \n",
+"Usage: %s [-j ] "
+"\n",
  prog_name);
  }
  
@@ -410,16 +445,31 @@ int main(int argc, char **argv)

  const char *extensionNames[] = { "VK_AMD_shader_info" };
  VkQueueFamilyProperties queue_family;
  VkPhysicalDevice *physical_devices;
-struct timespec start, end;
  uint32_t device_count;
  uint32_t queue_count = 1;
  VkInstance instance;
-VkDevice device;
  VkResult result;
  int ret = 0;
+int opt;
+
+pthread_mutex_init(&printf_mutex, NULL);
+
+max_threads = omp_get_max_threads();
+
+while ((opt = getopt(argc, argv, "j:")) != -1) {
+switch(opt) {
+case 'j':
+max_threads = atoi(optarg);
+break;
+default:
+fprintf(stderr, "Unknown option: %x\n", opt);
+print_usage(argv[0]);
+return -1;
+}
+}
  
-if (argc < 2) {

-fprintf(stderr, "No directories specified!\n");
+if (unlikely(optind >= argc)) {
+fprintf(stderr, "No directories specified\n");
  print_usage(argv[0]);
  return -1;
  }
@@ -464,6 +514,7 @@ int main(int argc, char **argv)
  assert(queue_family.queueFlags & VK_QUEUE_GRAPHICS_BIT);
  
  /* Create logical device. */

+VkDevice device;
  VkDeviceQueueCreateInfo queueCreateInfo = {};
  queueCreateInfo.sType = VK_STRUCTURE_TYPE_DEVICE_QUEUE_CREATE_INFO;
  queueCreateInfo.queueFamilyIndex = 0;
@@ -494,54 +545,74 @@ int main(int argc, char **argv)
   */
  /* Gather all pipeline tests. */
  pipeline_test = malloc(pipeline_test_size * sizeof(struct pipeline_test

Re: [Mesa-dev] [PATCH] virgl: add ARB_tessellation_shader support.

2018-06-12 Thread Elie Tournier
On Fri, Jun 08, 2018 at 03:15:36PM +1000, Dave Airlie wrote:
> From: Dave Airlie 
> 
> This should add all the pieces to enable tess shaders on virgl.

Hi

I think that we also need to add the following code:

--- a/src/gallium/drivers/virgl/virgl_winsys.h
+++ b/src/gallium/drivers/virgl/virgl_winsys.h
@@ -127,7 +127,7 @@ static inline void virgl_ws_fill_new_caps_defaults(struct 
virgl_drm_caps *caps)   
   
caps->caps.v2.max_geom_total_output_components = 1024;
caps->caps.v2.max_vertex_outputs = 32;
caps->caps.v2.max_vertex_attribs = 16;
-   caps->caps.v2.max_shader_patch_varyings = 0;
+   caps->caps.v2.max_shader_patch_varyings = 30;
caps->caps.v2.min_texel_offset = -8;
caps->caps.v2.max_texel_offset = 7;
caps->caps.v2.min_texture_gather_offset = -8;

Elie

> 
> This + fp64 enabled should give GL4.1
> ---
>  docs/features.txt  |  2 +-
>  src/gallium/drivers/virgl/virgl_context.c  | 82 
> --
>  src/gallium/drivers/virgl/virgl_encode.c   | 21 +++-
>  src/gallium/drivers/virgl/virgl_encode.h   |  4 ++
>  src/gallium/drivers/virgl/virgl_protocol.h |  5 ++
>  src/gallium/drivers/virgl/virgl_screen.c   | 10 +++-
>  6 files changed, 116 insertions(+), 8 deletions(-)
> 
> diff --git a/docs/features.txt b/docs/features.txt
> index 6e5cbc8b11e..bc3fdbc8890 100644
> --- a/docs/features.txt
> +++ b/docs/features.txt
> @@ -130,7 +130,7 @@ GL 4.0, GLSL 4.00 --- all DONE: i965/gen7+, nvc0, r600, 
> radeonsi
>GL_ARB_gpu_shader_fp64DONE (i965/gen7+, 
> llvmpipe, softpipe)
>GL_ARB_sample_shading DONE (i965/gen6+, 
> nv50, virgl)
>GL_ARB_shader_subroutine  DONE (freedreno, 
> i965/gen6+, nv50, llvmpipe, softpipe, swr, virgl)
> -  GL_ARB_tessellation_shaderDONE (i965/gen7+)
> +  GL_ARB_tessellation_shaderDONE (i965/gen7+, 
> virgl)
>GL_ARB_texture_buffer_object_rgb32DONE (freedreno, 
> i965/gen6+, llvmpipe, softpipe, swr, virgl)
>GL_ARB_texture_cube_map_array DONE (i965/gen6+, 
> nv50, llvmpipe, softpipe, virgl)
>GL_ARB_texture_gather DONE (freedreno, 
> i965/gen6+, nv50, llvmpipe, softpipe, swr, virgl)
> diff --git a/src/gallium/drivers/virgl/virgl_context.c 
> b/src/gallium/drivers/virgl/virgl_context.c
> index 8d701bb8f40..cee58faa12e 100644
> --- a/src/gallium/drivers/virgl/virgl_context.c
> +++ b/src/gallium/drivers/virgl/virgl_context.c
> @@ -469,9 +469,13 @@ static void *virgl_shader_encoder(struct pipe_context 
> *ctx,
> struct tgsi_token *new_tokens;
> int ret;
>  
> -   new_tokens = virgl_tgsi_transform(vctx, shader->tokens);
> -   if (!new_tokens)
> -  return NULL;
> +   if (type != PIPE_SHADER_TESS_CTRL &&
> +   type != PIPE_SHADER_TESS_EVAL) {
> + new_tokens = virgl_tgsi_transform(vctx, shader->tokens);
> + if (!new_tokens)
> +   return NULL;
> +   } else
> + new_tokens = shader->tokens;
>  
> handle = virgl_object_assign_handle();
> /* encode VS state */
> @@ -482,7 +486,8 @@ static void *virgl_shader_encoder(struct pipe_context 
> *ctx,
>return NULL;
> }
>  
> -   FREE(new_tokens);
> +   if (new_tokens != shader->tokens)
> + FREE(new_tokens);
> return (void *)(unsigned long)handle;
>  
>  }
> @@ -492,6 +497,18 @@ static void *virgl_create_vs_state(struct pipe_context 
> *ctx,
> return virgl_shader_encoder(ctx, shader, PIPE_SHADER_VERTEX);
>  }
>  
> +static void *virgl_create_tcs_state(struct pipe_context *ctx,
> +   const struct pipe_shader_state *shader)
> +{
> +   return virgl_shader_encoder(ctx, shader, PIPE_SHADER_TESS_CTRL);
> +}
> +
> +static void *virgl_create_tes_state(struct pipe_context *ctx,
> +   const struct pipe_shader_state *shader)
> +{
> +   return virgl_shader_encoder(ctx, shader, PIPE_SHADER_TESS_EVAL);
> +}
> +
>  static void *virgl_create_gs_state(struct pipe_context *ctx,
> const struct pipe_shader_state *shader)
>  {
> @@ -534,6 +551,26 @@ virgl_delete_vs_state(struct pipe_context *ctx,
> virgl_encode_delete_object(vctx, handle, VIRGL_OBJECT_SHADER);
>  }
>  
> +static void
> +virgl_delete_tcs_state(struct pipe_context *ctx,
> +   void *tcs)
> +{
> +   uint32_t handle = (unsigned long)tcs;
> +   struct virgl_context *vctx = virgl_context(ctx);
> +
> +   virgl_encode_delete_object(vctx, handle, VIRGL_OBJECT_SHADER);
> +}
> +
> +static void
> +virgl_delete_tes_state(struct pipe_context *ctx,
> +  void *tes)
> +{
> +   uint32_t handle = (unsigned long)tes;
> +   struct virgl_context *vctx = virgl_context(ctx);
> +
> +   virgl_encode_delete_object(vctx, handle, VIRGL_OBJECT_SHADER);
> +}
> +
>  static voi

[Mesa-dev] [PATCH v2 0/2] nv50/ir: SHLADD related improvements

2018-06-12 Thread Rhys Perry
This series implements an alternative solution to the problem fixed in
0bd83d0 ("nv50/ir: move LateAlgebraicOpt to the very end"). Overall, it
slightly helps various shaders while slightly hurting a few others.

Effects of both patches:

total instructions in shared programs : 5265148 -> 5256901 (-0.16%)
total gprs used in shared programs: 624346 -> 624328 (-0.00%)
total shared used in shared programs  : 360704 -> 360704 (0.00%)
total local used in shared programs   : 20952 -> 20952 (0.00%)

local sharedgpr   inst  bytes 
helped   0   0  7120162016
  hurt   0   0  52  19  19

Rhys Perry (2):
  nv50/ir: handle SHLADD in IndirectPropagation
  nv50/ir: move LateAlgebraicOpt back to right after ConstantFolding

 src/gallium/drivers/nouveau/codegen/nv50_ir_peephole.cpp | 14 +-
 1 file changed, 13 insertions(+), 1 deletion(-)

-- 
2.14.4

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


[Mesa-dev] [PATCH v2 2/2] nv50/ir: move LateAlgebraicOpt back to right after ConstantFolding

2018-06-12 Thread Rhys Perry
Reverts 3072bbe ("nv50/ir: move LateAlgebraicOpt to the very end") since
SHLADD is now handled in IndirectPropagation.

total instructions in shared programs : 5264804 -> 5256901 (-0.15%)
total gprs used in shared programs: 624341 -> 624328 (-0.00%)
total shared used in shared programs  : 360704 -> 360704 (0.00%)
total local used in shared programs   : 20952 -> 20952 (0.00%)

local sharedgpr   inst  bytes
helped   0   0  6919931993
  hurt   0   0  52  32  32

Signed-off-by: Rhys Perry 
---
 src/gallium/drivers/nouveau/codegen/nv50_ir_peephole.cpp | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/src/gallium/drivers/nouveau/codegen/nv50_ir_peephole.cpp 
b/src/gallium/drivers/nouveau/codegen/nv50_ir_peephole.cpp
index 83fb15ca34..4d0589214d 100644
--- a/src/gallium/drivers/nouveau/codegen/nv50_ir_peephole.cpp
+++ b/src/gallium/drivers/nouveau/codegen/nv50_ir_peephole.cpp
@@ -3809,11 +3809,11 @@ Program::optimizeSSA(int level)
RUN_PASS(2, AlgebraicOpt, run);
RUN_PASS(2, ModifierFolding, run); // before load propagation -> less checks
RUN_PASS(1, ConstantFolding, foldAll);
+   RUN_PASS(2, LateAlgebraicOpt, run);
RUN_PASS(1, Split64BitOpPreRA, run);
RUN_PASS(1, LoadPropagation, run);
RUN_PASS(1, IndirectPropagation, run);
RUN_PASS(2, MemoryOpt, run);
-   RUN_PASS(2, LateAlgebraicOpt, run);
RUN_PASS(2, LocalCSE, run);
RUN_PASS(0, DeadCodeElim, buryAll);
 
-- 
2.14.4

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


[Mesa-dev] [PATCH v2 1/2] nv50/ir: handle SHLADD in IndirectPropagation

2018-06-12 Thread Rhys Perry
An alternative solution to the problem fixed in
0bd83d0 ("nv50/ir: move LateAlgebraicOpt to the very end").

total instructions in shared programs : 5265148 -> 5264804 (-0.01%)
total gprs used in shared programs: 624346 -> 624341 (-0.00%)
total shared used in shared programs  : 360704 -> 360704 (0.00%)
total local used in shared programs   : 20952 -> 20952 (0.00%)

local sharedgpr   inst  bytes
helped   0   0   2  31  31
  hurt   0   0   0   0   0

Signed-off-by: Rhys Perry 
---
 src/gallium/drivers/nouveau/codegen/nv50_ir_peephole.cpp | 12 
 1 file changed, 12 insertions(+)

diff --git a/src/gallium/drivers/nouveau/codegen/nv50_ir_peephole.cpp 
b/src/gallium/drivers/nouveau/codegen/nv50_ir_peephole.cpp
index 39177bd044..83fb15ca34 100644
--- a/src/gallium/drivers/nouveau/codegen/nv50_ir_peephole.cpp
+++ b/src/gallium/drivers/nouveau/codegen/nv50_ir_peephole.cpp
@@ -283,6 +283,8 @@ class IndirectPropagation : public Pass
 {
 private:
virtual bool visit(BasicBlock *);
+
+   BuildUtil bld;
 };
 
 bool
@@ -294,6 +296,8 @@ IndirectPropagation::visit(BasicBlock *bb)
for (Instruction *i = bb->getEntry(); i; i = next) {
   next = i->next;
 
+  bld.setPosition(i, false);
+
   for (int s = 0; i->srcExists(s); ++s) {
  Instruction *insn;
  ImmediateValue imm;
@@ -325,6 +329,14 @@ IndirectPropagation::visit(BasicBlock *bb)
 i->setIndirect(s, 0, NULL);
 i->setSrc(s, cloneShallow(func, i->getSrc(s)));
 i->src(s).get()->reg.data.offset += imm.reg.data.u32;
+ } else if (insn->op == OP_SHLADD) {
+if (!insn->src(2).getImmediate(imm) ||
+!targ->insnCanLoadOffset(i, s, imm.reg.data.s32))
+   continue;
+i->setIndirect(s, 0, bld.mkOp2v(
+   OP_SHL, TYPE_U32, bld.getSSA(), insn->getSrc(0), 
insn->getSrc(1)));
+i->setSrc(s, cloneShallow(func, i->getSrc(s)));
+i->src(s).get()->reg.data.offset += imm.reg.data.u32;
  }
   }
}
-- 
2.14.4

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


Re: [Mesa-dev] [PATCH v2 1/2] nv50/ir: handle SHLADD in IndirectPropagation

2018-06-12 Thread Karol Herbst
this can potentially lead to worse code, but shladd is usually only
used in regards to load, and the shader-db result also states there
are no regressions. I would really like to be able to do certain ops
conditionally, but that's kind of a bigger project. Anyway...

Reviewed-by: Karol Herbst 

On Tue, Jun 12, 2018 at 3:30 PM, Rhys Perry  wrote:
> An alternative solution to the problem fixed in
> 0bd83d0 ("nv50/ir: move LateAlgebraicOpt to the very end").
>
> total instructions in shared programs : 5265148 -> 5264804 (-0.01%)
> total gprs used in shared programs: 624346 -> 624341 (-0.00%)
> total shared used in shared programs  : 360704 -> 360704 (0.00%)
> total local used in shared programs   : 20952 -> 20952 (0.00%)
>
> local sharedgpr   inst  bytes
> helped   0   0   2  31  31
>   hurt   0   0   0   0   0
>
> Signed-off-by: Rhys Perry 
> ---
>  src/gallium/drivers/nouveau/codegen/nv50_ir_peephole.cpp | 12 
>  1 file changed, 12 insertions(+)
>
> diff --git a/src/gallium/drivers/nouveau/codegen/nv50_ir_peephole.cpp 
> b/src/gallium/drivers/nouveau/codegen/nv50_ir_peephole.cpp
> index 39177bd044..83fb15ca34 100644
> --- a/src/gallium/drivers/nouveau/codegen/nv50_ir_peephole.cpp
> +++ b/src/gallium/drivers/nouveau/codegen/nv50_ir_peephole.cpp
> @@ -283,6 +283,8 @@ class IndirectPropagation : public Pass
>  {
>  private:
> virtual bool visit(BasicBlock *);
> +
> +   BuildUtil bld;
>  };
>
>  bool
> @@ -294,6 +296,8 @@ IndirectPropagation::visit(BasicBlock *bb)
> for (Instruction *i = bb->getEntry(); i; i = next) {
>next = i->next;
>
> +  bld.setPosition(i, false);
> +
>for (int s = 0; i->srcExists(s); ++s) {
>   Instruction *insn;
>   ImmediateValue imm;
> @@ -325,6 +329,14 @@ IndirectPropagation::visit(BasicBlock *bb)
>  i->setIndirect(s, 0, NULL);
>  i->setSrc(s, cloneShallow(func, i->getSrc(s)));
>  i->src(s).get()->reg.data.offset += imm.reg.data.u32;
> + } else if (insn->op == OP_SHLADD) {
> +if (!insn->src(2).getImmediate(imm) ||
> +!targ->insnCanLoadOffset(i, s, imm.reg.data.s32))
> +   continue;
> +i->setIndirect(s, 0, bld.mkOp2v(
> +   OP_SHL, TYPE_U32, bld.getSSA(), insn->getSrc(0), 
> insn->getSrc(1)));
> +i->setSrc(s, cloneShallow(func, i->getSrc(s)));
> +i->src(s).get()->reg.data.offset += imm.reg.data.u32;
>   }
>}
> }
> --
> 2.14.4
>
> ___
> 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] winsys/svga/drm: Include sys/types.h

2018-06-12 Thread Ross Burton
From: Khem Raj 

vmw_screen.h uses dev_t which is defines in sys/types.h
this header is required to be included for getting dev_t
definition. This issue happens on musl C library, it is hidden
on glibc since sys/types.h is included through another
system headers

Upstream-Status: Submitted
Signed-off-by: Khem Raj 
---
 src/gallium/winsys/svga/drm/vmw_screen.h | 1 +
 1 file changed, 1 insertion(+)

diff --git a/src/gallium/winsys/svga/drm/vmw_screen.h 
b/src/gallium/winsys/svga/drm/vmw_screen.h
index f21cabb51f..4c972fdaa9 100644
--- a/src/gallium/winsys/svga/drm/vmw_screen.h
+++ b/src/gallium/winsys/svga/drm/vmw_screen.h
@@ -41,6 +41,7 @@
 #include "svga_winsys.h"
 #include "pipebuffer/pb_buffer_fenced.h"
 #include 
+#include 
 
 #define VMW_GMR_POOL_SIZE (16*1024*1024)
 #define VMW_QUERY_POOL_SIZE (8192)
-- 
2.17.1

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


Re: [Mesa-dev] [PATCH 0/1] Code formatting changes in swr driver

2018-06-12 Thread Cherniak, Bruce
Reviewed-by: Bruce Cherniak 
(and thanks for not emailing such a huge patch)

> On Jun 8, 2018, at 3:01 PM, Alok Hota  wrote:
> 
> Sorry for the large patch - the changes are all whitespace and code
> formatting for the swr driver and its rasterizer. 
> The patch file itself is available on Github as a Gist:
> https://gist.github.com/ahota/34210949630618f684babc4cfa240aa5
> 
> This is to prevent the full 3.1 MB of it being sent out to everyone's
> email.
> 
> Alok Hota (1):
>  swr/rast: Clang-Format most rasterizer source code
> 
> .../swr/rasterizer/archrast/archrast.cpp  |   415 +-
> .../swr/rasterizer/archrast/archrast.h|59 +-
> .../swr/rasterizer/archrast/eventmanager.h|57 +-
> .../codegen/templates/gen_ar_event.cpp|65 +-
> .../codegen/templates/gen_ar_event.hpp|70 +-
> .../codegen/templates/gen_ar_eventhandler.hpp |66 +-
> .../templates/gen_ar_eventhandlerfile.hpp |91 +-
> .../codegen/templates/gen_backend.cpp | 6 +-
> .../codegen/templates/gen_builder.hpp | 8 +-
> .../codegen/templates/gen_header_init.hpp | 9 +-
> .../codegen/templates/gen_knobs.cpp   |82 +-
> .../rasterizer/codegen/templates/gen_knobs.h  |74 +-
> .../rasterizer/codegen/templates/gen_llvm.hpp |69 +-
> .../codegen/templates/gen_rasterizer.cpp  | 8 +-
> .../drivers/swr/rasterizer/common/formats.cpp | 13725 +---
> .../drivers/swr/rasterizer/common/formats.h   |   403 +-
> .../drivers/swr/rasterizer/common/intrin.h|   100 +-
> .../drivers/swr/rasterizer/common/isa.hpp |94 +-
> .../drivers/swr/rasterizer/common/os.cpp  |   161 +-
> .../drivers/swr/rasterizer/common/os.h|   153 +-
> .../swr/rasterizer/common/rdtsc_buckets.cpp   |95 +-
> .../swr/rasterizer/common/rdtsc_buckets.h |87 +-
> .../rasterizer/common/rdtsc_buckets_shared.h  |88 +-
> .../swr/rasterizer/common/simd16intrin.h  |   308 +-
> .../swr/rasterizer/common/simdintrin.h|   446 +-
> .../drivers/swr/rasterizer/common/simdlib.hpp |   532 +-
> .../swr/rasterizer/common/simdlib_128_avx.inl |   409 +-
> .../rasterizer/common/simdlib_128_avx2.inl|64 +-
> .../rasterizer/common/simdlib_128_avx512.inl  |   322 +-
> .../common/simdlib_128_avx512_core.inl|   219 +-
> .../common/simdlib_128_avx512_knights.inl |43 +-
> .../swr/rasterizer/common/simdlib_256_avx.inl |   625 +-
> .../rasterizer/common/simdlib_256_avx2.inl|   215 +-
> .../rasterizer/common/simdlib_256_avx512.inl  |   318 +-
> .../common/simdlib_256_avx512_core.inl|   142 +-
> .../common/simdlib_256_avx512_knights.inl |43 +-
> .../rasterizer/common/simdlib_512_avx512.inl  |   511 +-
> .../common/simdlib_512_avx512_core.inl|   235 +-
> .../common/simdlib_512_avx512_knights.inl |   181 +-
> .../common/simdlib_512_avx512_masks.inl   |42 +-
> .../common/simdlib_512_avx512_masks_core.inl  |42 +-
> .../simdlib_512_avx512_masks_knights.inl  |42 +-
> .../swr/rasterizer/common/simdlib_512_emu.inl |   755 +-
> .../common/simdlib_512_emu_masks.inl  |43 +-
> .../rasterizer/common/simdlib_interface.hpp   |42 +-
> .../swr/rasterizer/common/simdlib_types.hpp   |   338 +-
> .../swr/rasterizer/common/swr_assert.cpp  |   192 +-
> .../swr/rasterizer/common/swr_assert.h|   197 +-
> .../drivers/swr/rasterizer/core/api.cpp   |  1083 +-
> src/gallium/drivers/swr/rasterizer/core/api.h |   649 +-
> .../drivers/swr/rasterizer/core/arena.h   |   190 +-
> .../drivers/swr/rasterizer/core/backend.cpp   |   281 +-
> .../drivers/swr/rasterizer/core/backend.h |   106 +-
> .../swr/rasterizer/core/backend_clear.cpp |   218 +-
> .../swr/rasterizer/core/backend_impl.h|  1030 +-
> .../swr/rasterizer/core/backend_sample.cpp|   276 +-
> .../rasterizer/core/backend_singlesample.cpp  |   295 +-
> .../drivers/swr/rasterizer/core/binner.cpp|  1069 +-
> .../drivers/swr/rasterizer/core/binner.h  |   294 +-
> .../drivers/swr/rasterizer/core/blend.h   |   174 +-
> .../drivers/swr/rasterizer/core/clip.cpp  |   272 +-
> .../drivers/swr/rasterizer/core/clip.h|   740 +-
> .../swr/rasterizer/core/conservativeRast.h|   161 +-
> .../drivers/swr/rasterizer/core/context.h |   386 +-
> .../swr/rasterizer/core/depthstencil.h|   238 +-
> .../drivers/swr/rasterizer/core/fifo.hpp  |   117 +-
> .../swr/rasterizer/core/format_conversion.h   |   175 +-
> .../swr/rasterizer/core/format_traits.h   |  5102 +++---
> .../swr/rasterizer/core/format_types.h|   870 +-
> .../swr/rasterizer/core/format_utils.h|   513 +-
> .../drivers/swr/rasterizer/core/frontend.cpp  |  1033 +-
> .../drivers/swr/rasterizer/core/frontend.h|   250 +-
> .../drivers/swr/rasterizer/core/knobs.h   |   125 +-
> .../drivers/swr/rasterizer/core/knobs_init.h  |64 +-
> .../drivers/swr/rasterizer/core/multisample.h |   464 +-
> src/gallium/driver

[Mesa-dev] [Bug 106897] Ubuntu 16.04. Mesa can't be built with specified configurations

2018-06-12 Thread bugzilla-daemon
https://bugs.freedesktop.org/show_bug.cgi?id=106897

Bug ID: 106897
   Summary: Ubuntu 16.04. Mesa can't be built with specified
configurations
   Product: Mesa
   Version: git
  Hardware: Other
OS: All
Status: NEW
  Severity: normal
  Priority: medium
 Component: EGL/Wayland
  Assignee: wayland-b...@lists.freedesktop.org
  Reporter: denys.kos...@globallogic.com
QA Contact: mesa-dev@lists.freedesktop.org

Hello.

I tried to build mesa with fix from this ticket
https://bugs.freedesktop.org/show_bug.cgi?id=106861, and it failed with this
error:


configure: error: Package requirements (wayland-egl-backend >= 3) were not met:

No package 'wayland-egl-backend' found

Consider adjusting the PKG_CONFIG_PATH environment variable if you
installed software in a non-standard prefix.

Alternatively, you may set the environment variables WAYLAND_EGL_CFLAGS
and WAYLAND_EGL_LIBS to avoid the need to call pkg-config.
See the pkg-config man page for more details.
Makefile:648: recipe for target 'config.status' failed
make: *** [config.status] Error 1

Checked on:
HEAD is now at 3c288da drivers/dri/i965: add missing #include

-- 
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 106861] fatal error: wayland-egl-backend.h: No such file or directory compilation terminated.

2018-06-12 Thread bugzilla-daemon
https://bugs.freedesktop.org/show_bug.cgi?id=106861

Denis  changed:

   What|Removed |Added

   See Also||https://bugs.freedesktop.or
   ||g/show_bug.cgi?id=106897

-- 
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 106897] Ubuntu 16.04. Mesa can't be built with specified configurations

2018-06-12 Thread bugzilla-daemon
https://bugs.freedesktop.org/show_bug.cgi?id=106897

--- Comment #1 from Denis  ---
./autogen.sh --with-egl-platforms=x11,wayland --with-gallium-drivers=""
--with-dri-drivers=i965 --enable-debug

that's how I configured 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] [PATCH v1] configure.ac: Missed package 'wayland-egl-backend'

2018-06-12 Thread Sergii Romantsov
Added support of wayland-egl-backend for old Ubuntus.
Building of mesa with parameter "--with-egl-platforms=x11,wayland"
fails:
"configure: error: Package requirements (wayland-egl-backend >= 3)
were not met: No package 'wayland-egl-backend' found"

Ubuntu's releases less than 18.10 don't have package
libwayland-egl-backend-dev.
To fix that issue used mesa-platfrom-header wayland-egl-backend.h.

Bugzilla: https://bugs.freedesktop.org/show_bug.cgi?id=106897
Signed-off-by: Sergii Romantsov 
---
 configure.ac  | 20 ++-
 src/egl/Makefile.am   |  5 ++
 src/egl/wayland/wayland-egl/wayland-egl-backend.h | 67 +++
 3 files changed, 91 insertions(+), 1 deletion(-)
 create mode 100644 src/egl/wayland/wayland-egl/wayland-egl-backend.h

diff --git a/configure.ac b/configure.ac
index 75ee1a7..32b3c53 100644
--- a/configure.ac
+++ b/configure.ac
@@ -91,6 +91,7 @@ LIBVA_REQUIRED=0.39.0
 VDPAU_REQUIRED=1.1
 WAYLAND_REQUIRED=1.11
 WAYLAND_EGL_BACKEND_REQUIRED=3
+UBUNTU_WAYLAND_EGL_BACKEND_REQUIRED=18.10
 WAYLAND_PROTOCOLS_REQUIRED=1.8
 XCB_REQUIRED=1.9.3
 XCBDRI2_REQUIRED=1.8
@@ -1810,7 +1811,24 @@ for plat in $platforms; do
 PKG_CHECK_MODULES([WAYLAND_SERVER], [wayland-server >= 
$WAYLAND_REQUIRED])
 PKG_CHECK_MODULES([WAYLAND_PROTOCOLS], [wayland-protocols >= 
$WAYLAND_PROTOCOLS_REQUIRED])
 if test "x$enable_egl" = xyes; then
-  PKG_CHECK_MODULES([WAYLAND_EGL], [wayland-egl-backend >= 
$WAYLAND_EGL_BACKEND_REQUIRED])
+  case "$host_os" in
+  linux*)
+  AC_SUBST([DISTRIBUTOR_ID],[$( lsb_release -is )])
+  AC_SUBST([RELEASE_VERSION],[$( lsb_release -rs )])
+  ;;
+  *)
+  AC_SUBST([DISTRIBUTOR_ID])
+  AC_SUBST([RELEASE_VERSION])
+  ;;
+  esac
+
+  if test "$DISTRIBUTOR_ID" = "Ubuntu" -a  $RELEASE_VERSION \< 
$UBUNTU_WAYLAND_EGL_BACKEND_REQUIRED ; then
+  DEFINES="$DEFINES -DHAVE_PLATFORM_WAYLAND_BACKEND"
+  AM_CONDITIONAL([HAVE_PLATFORM_WAYLAND_BACKEND], [test "xyes" = 
xyes])
+  else
+  PKG_CHECK_MODULES([WAYLAND_EGL], [wayland-egl-backend >= 
$WAYLAND_EGL_BACKEND_REQUIRED])
+  AM_CONDITIONAL([HAVE_PLATFORM_WAYLAND_BACKEND], [test "xyes" != 
xyes])
+  fi
 fi
 WAYLAND_PROTOCOLS_DATADIR=`$PKG_CONFIG --variable=pkgdatadir 
wayland-protocols`
 
diff --git a/src/egl/Makefile.am b/src/egl/Makefile.am
index be3547d..0ef0a42 100644
--- a/src/egl/Makefile.am
+++ b/src/egl/Makefile.am
@@ -121,6 +121,11 @@ AM_CFLAGS += \
-DDEFAULT_DRIVER_DIR=\"$(DRI_DRIVER_SEARCH_DIR)\" \
-D_EGL_BUILT_IN_DRIVER_DRI2
 
+if HAVE_PLATFORM_WAYLAND_BACKEND
+AM_CFLAGS += \
+   -I$(top_srcdir)/src/egl/wayland/wayland-egl
+endif
+
 nodist_libEGL_common_la_SOURCES = \
$(dri2_backend_GENERATED_FILES)
 
diff --git a/src/egl/wayland/wayland-egl/wayland-egl-backend.h 
b/src/egl/wayland/wayland-egl/wayland-egl-backend.h
new file mode 100644
index 000..869c86f
--- /dev/null
+++ b/src/egl/wayland/wayland-egl/wayland-egl-backend.h
@@ -0,0 +1,67 @@
+/*
+ * Copyright © 2011 Benjamin Franzke
+ *
+ * Permission is hereby granted, free of charge, to any person obtaining a
+ * copy of this software and associated documentation files (the "Software"),
+ * to deal in the Software without restriction, including without limitation
+ * the rights to use, copy, modify, merge, publish, distribute, sublicense,
+ * and/or sell copies of the Software, and to permit persons to whom the
+ * Software is furnished to do so, subject to the following conditions:
+ *
+ * The above copyright notice and this permission notice (including the next
+ * paragraph) shall be included in all copies or substantial portions of the
+ * Software.
+ *
+ * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
+ * EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
+ * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
+ * NONINFRINGEMENT.  IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT
+ * HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY,
+ * WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
+ * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER
+ * DEALINGS IN THE SOFTWARE.
+ *
+ * Authors:
+ *Benjamin Franzke 
+ */
+
+#ifndef _WAYLAND_EGL_PRIV_H
+#define _WAYLAND_EGL_PRIV_H
+
+#include 
+
+#ifdef  __cplusplus
+extern "C" {
+#endif
+
+/*
+ * NOTE: This version must be kept in sync with the Version field in the
+ * wayland-egl-backend.pc.in file.
+ */
+#define WL_EGL_WINDOW_VERSION 3
+
+struct wl_surface;
+
+struct wl_egl_window {
+   const intptr_t version;
+
+   int width;
+   int height;
+   int dx;
+   int dy;
+
+   int attached_width;
+   int attached_height;
+
+   void *driver_private;
+   void (*resize_callback)(struct wl_egl_window *, void *);
+   void (*

[Mesa-dev] [Bug 106897] Ubuntu 16.04. Mesa can't be built with specified configurations

2018-06-12 Thread bugzilla-daemon
https://bugs.freedesktop.org/show_bug.cgi?id=106897

Daniel Stone  changed:

   What|Removed |Added

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

--- Comment #2 from Daniel Stone  ---
You need to install a newer version of the core Wayland repository, which now
provides libwayland-egl.

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


Re: [Mesa-dev] [PATCH v1] configure.ac: Missed package 'wayland-egl-backend'

2018-06-12 Thread Eric Engestrom
On Tuesday, 2018-06-12 18:22:03 +0300, Sergii Romantsov wrote:
> Added support of wayland-egl-backend for old Ubuntus.
> Building of mesa with parameter "--with-egl-platforms=x11,wayland"
> fails:
> "configure: error: Package requirements (wayland-egl-backend >= 3)
> were not met: No package 'wayland-egl-backend' found"
> 
> Ubuntu's releases less than 18.10 don't have package
> libwayland-egl-backend-dev.
> To fix that issue used mesa-platfrom-header wayland-egl-backend.h.
> 
> Bugzilla: https://bugs.freedesktop.org/show_bug.cgi?id=106897
> Signed-off-by: Sergii Romantsov 

NAK

There are many issues here:
- you're going backwards: we just deleted this file
- we don't want distro-specific hacks in mesa
- your HAVE_PLATFORM_WAYLAND_BACKEND is backwards (you define it when
  you don't have it)
- you're only "fixing" autotools, not meson
- as mentioned by Daniel on the bug, the actual issue is that your
  system is not up to date; `apt upgrade` to fix your issue.

Btw, `--with-egl-platforms` is deprecated (see the warning it prints
when you use it).

> ---
>  configure.ac  | 20 ++-
>  src/egl/Makefile.am   |  5 ++
>  src/egl/wayland/wayland-egl/wayland-egl-backend.h | 67 
> +++
>  3 files changed, 91 insertions(+), 1 deletion(-)
>  create mode 100644 src/egl/wayland/wayland-egl/wayland-egl-backend.h
> 
> diff --git a/configure.ac b/configure.ac
> index 75ee1a7..32b3c53 100644
> --- a/configure.ac
> +++ b/configure.ac
> @@ -91,6 +91,7 @@ LIBVA_REQUIRED=0.39.0
>  VDPAU_REQUIRED=1.1
>  WAYLAND_REQUIRED=1.11
>  WAYLAND_EGL_BACKEND_REQUIRED=3
> +UBUNTU_WAYLAND_EGL_BACKEND_REQUIRED=18.10
>  WAYLAND_PROTOCOLS_REQUIRED=1.8
>  XCB_REQUIRED=1.9.3
>  XCBDRI2_REQUIRED=1.8
> @@ -1810,7 +1811,24 @@ for plat in $platforms; do
>  PKG_CHECK_MODULES([WAYLAND_SERVER], [wayland-server >= 
> $WAYLAND_REQUIRED])
>  PKG_CHECK_MODULES([WAYLAND_PROTOCOLS], [wayland-protocols >= 
> $WAYLAND_PROTOCOLS_REQUIRED])
>  if test "x$enable_egl" = xyes; then
> -  PKG_CHECK_MODULES([WAYLAND_EGL], [wayland-egl-backend >= 
> $WAYLAND_EGL_BACKEND_REQUIRED])
> +  case "$host_os" in
> +  linux*)
> +  AC_SUBST([DISTRIBUTOR_ID],[$( lsb_release -is )])
> +  AC_SUBST([RELEASE_VERSION],[$( lsb_release -rs )])
> +  ;;
> +  *)
> +  AC_SUBST([DISTRIBUTOR_ID])
> +  AC_SUBST([RELEASE_VERSION])
> +  ;;
> +  esac
> +
> +  if test "$DISTRIBUTOR_ID" = "Ubuntu" -a  $RELEASE_VERSION \< 
> $UBUNTU_WAYLAND_EGL_BACKEND_REQUIRED ; then
> +  DEFINES="$DEFINES -DHAVE_PLATFORM_WAYLAND_BACKEND"
> +  AM_CONDITIONAL([HAVE_PLATFORM_WAYLAND_BACKEND], [test "xyes" = 
> xyes])
> +  else
> +  PKG_CHECK_MODULES([WAYLAND_EGL], [wayland-egl-backend >= 
> $WAYLAND_EGL_BACKEND_REQUIRED])
> +  AM_CONDITIONAL([HAVE_PLATFORM_WAYLAND_BACKEND], [test "xyes" 
> != xyes])
> +  fi
>  fi
>  WAYLAND_PROTOCOLS_DATADIR=`$PKG_CONFIG --variable=pkgdatadir 
> wayland-protocols`
>  
> diff --git a/src/egl/Makefile.am b/src/egl/Makefile.am
> index be3547d..0ef0a42 100644
> --- a/src/egl/Makefile.am
> +++ b/src/egl/Makefile.am
> @@ -121,6 +121,11 @@ AM_CFLAGS += \
>   -DDEFAULT_DRIVER_DIR=\"$(DRI_DRIVER_SEARCH_DIR)\" \
>   -D_EGL_BUILT_IN_DRIVER_DRI2
>  
> +if HAVE_PLATFORM_WAYLAND_BACKEND
> +AM_CFLAGS += \
> + -I$(top_srcdir)/src/egl/wayland/wayland-egl
> +endif
> +
>  nodist_libEGL_common_la_SOURCES = \
>   $(dri2_backend_GENERATED_FILES)
>  
> diff --git a/src/egl/wayland/wayland-egl/wayland-egl-backend.h 
> b/src/egl/wayland/wayland-egl/wayland-egl-backend.h
> new file mode 100644
> index 000..869c86f
> --- /dev/null
> +++ b/src/egl/wayland/wayland-egl/wayland-egl-backend.h
> @@ -0,0 +1,67 @@
> +/*
> + * Copyright © 2011 Benjamin Franzke
> + *
> + * Permission is hereby granted, free of charge, to any person obtaining a
> + * copy of this software and associated documentation files (the "Software"),
> + * to deal in the Software without restriction, including without limitation
> + * the rights to use, copy, modify, merge, publish, distribute, sublicense,
> + * and/or sell copies of the Software, and to permit persons to whom the
> + * Software is furnished to do so, subject to the following conditions:
> + *
> + * The above copyright notice and this permission notice (including the next
> + * paragraph) shall be included in all copies or substantial portions of the
> + * Software.
> + *
> + * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
> + * EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
> + * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
> + * NONINFRINGEMENT.  IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT
> + * HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY,
> + * WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERW

Re: [Mesa-dev] [PATCH mesa] meson: add GL/glext.h warning fix for MacOS

2018-06-12 Thread Dylan Baker
Quoting Eric Engestrom (2018-06-12 04:25:10)
> Copied from configure.ac:1950
> 
> Signed-off-by: Eric Engestrom 
> ---
> Is it still needed? We've been building on MacOS for a while,
> yet nobody noticed anything (Dylan?)
> If not, we should probably avoid unnecessary differences with Khronos'
> headers and nuke BUILDING_MESA.
> ---
>  meson.build | 1 +
>  1 file changed, 1 insertion(+)
> 
> diff --git a/meson.build b/meson.build
> index c5acc8a3587ea20e131e..04b3bdfd77f36670ff7f 100644
> --- a/meson.build
> +++ b/meson.build
> @@ -209,6 +209,7 @@ endif
>  
>  if host_machine.system() == 'darwin'
>with_dri_platform = 'apple'
> +  pre_args += '-DBUILDING_MESA'
>  elif ['windows', 'cygwin'].contains(host_machine.system())
>with_dri_platform = 'windows'
>  elif system_has_kms_drm
> -- 
> Cheers,
>   Eric
> 

I didn't notice, but I also didn't do a whole lot of testing

I've added Jon who did most of the meson mac work and Jeremy who's the resident
mac expert.

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 v2 6/6] meson: remove a bunch of out of date TODO's

2018-06-12 Thread Dylan Baker
Quoting Eric Engestrom (2018-06-12 05:08:57)
> On Monday, 2018-06-11 10:19:01 -0700, Dylan Baker wrote:
> > Some of these are done already, some of them are things we're not going
> > to do, like have a toggle for GLX_TLS.
> 
> I'm not 100% sure which is which, and I might not be the only one;
> could you split these two into two patches? Thanks :)
> 
> The rest of the series is:
> Reviewed-by: Eric Engestrom 
> 
> > 
> > v2: - Don't remove USE_MGL_NAMESPACE or with_glx_direct
> > 
> > Signed-off-by: Dylan Baker 
> > ---
> >  meson.build | 8 
> >  src/egl/meson.build | 2 --
> >  src/gbm/meson.build | 2 --
> >  3 files changed, 12 deletions(-)
> > 
> > diff --git a/meson.build b/meson.build
> > index bee526a4f22..aefb9f3c85e 100644
> > --- a/meson.build
> > +++ b/meson.build
> > @@ -1217,8 +1217,6 @@ if get_option('selinux')
> >pre_args += '-DMESA_SELINUX'
> >  endif
> >  
> > -# TODO: llvm-prefix and llvm-shared-libs
> > -

This was the only one left that was "not going to do", and Emil asked me to
leave it for now and I forgot. I've dropped this hunk and reworked the commit
message to say "meson: remove various completed todos"

> >  if with_libunwind != 'false'
> >dep_unwind = dependency('libunwind', required : with_libunwind == 'true')
> >if dep_unwind.found()
> > @@ -1228,8 +1226,6 @@ else
> >dep_unwind = null_dep
> >  endif
> >  
> > -# TODO: gallium-hud
> > -
> >  if with_osmesa != 'none'
> >if with_osmesa == 'classic' and not with_dri_swrast
> >  error('OSMesa classic requires dri (classic) swrast.')
> > @@ -1354,10 +1350,6 @@ else
> >dep_lmsensors = null_dep
> >  endif
> >  
> > -# TODO: various libdirs
> > -
> > -# TODO: gallium driver dirs
> > -
> >  foreach a : pre_args
> >add_project_arguments(a, language : ['c', 'cpp'])
> >  endforeach
> > diff --git a/src/egl/meson.build b/src/egl/meson.build
> > index 8d888d35aff..5f30bbba89a 100644
> > --- a/src/egl/meson.build
> > +++ b/src/egl/meson.build
> > @@ -140,8 +140,6 @@ if with_platform_haiku
> >deps_for_egl += cpp.find_library('be')
> >  endif
> >  
> > -# TODO: glvnd
> > -
> >  if cc.has_function('mincore')
> >c_args_for_egl += '-DHAVE_MINCORE'
> >  endif
> > diff --git a/src/gbm/meson.build b/src/gbm/meson.build
> > index 7a60868783c..2e9d380c0b4 100644
> > --- a/src/gbm/meson.build
> > +++ b/src/gbm/meson.build
> > @@ -45,8 +45,6 @@ if with_platform_wayland
> >incs_gbm += inc_wayland_drm
> >  endif
> >  
> > -# TODO: wayland support (requires egl)
> > -
> >  libgbm = shared_library(
> >'gbm',
> >files_gbm,
> > -- 
> > 2.17.1
> > 
> > ___
> > mesa-dev mailing list
> > mesa-dev@lists.freedesktop.org
> > https://lists.freedesktop.org/mailman/listinfo/mesa-dev


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


Re: [Mesa-dev] [PATCH v1] configure.ac: Missed package 'wayland-egl-backend'

2018-06-12 Thread Aaron Watry
On Tue, Jun 12, 2018 at 10:31 AM, Eric Engestrom
 wrote:
> On Tuesday, 2018-06-12 18:22:03 +0300, Sergii Romantsov wrote:
>> Added support of wayland-egl-backend for old Ubuntus.
>> Building of mesa with parameter "--with-egl-platforms=x11,wayland"
>> fails:
>> "configure: error: Package requirements (wayland-egl-backend >= 3)
>> were not met: No package 'wayland-egl-backend' found"
>>
>> Ubuntu's releases less than 18.10 don't have package
>> libwayland-egl-backend-dev.
>> To fix that issue used mesa-platfrom-header wayland-egl-backend.h.
>>
>> Bugzilla: https://bugs.freedesktop.org/show_bug.cgi?id=106897
>> Signed-off-by: Sergii Romantsov 
>
> NAK
>
> There are many issues here:
> - you're going backwards: we just deleted this file
> - we don't want distro-specific hacks in mesa
> - your HAVE_PLATFORM_WAYLAND_BACKEND is backwards (you define it when
>   you don't have it)
> - you're only "fixing" autotools, not meson
> - as mentioned by Daniel on the bug, the actual issue is that your
>   system is not up to date; `apt upgrade` to fix your issue.

That's the thing here.  There is no released version of Ubuntu that
you can just `apt upgrade` to get the required libwayland version.

The way I was able to resolve this for my system was to download the
Ubuntu 18.10 version of the libwayland packages and apply them to my
18.04 instance (with fingers crossed that I wasn't breaking my system
in the process as I worked my way through the dependency issues that
it caused).

For the brave/desperate, the latest build as of this moment for Cosmic is here:
https://bugs.launchpad.net/ubuntu/+source/wayland/1.15.0-2/+build/14907841

I believe it'd work to install the libwayland-egl1 DEB first, so that
it replaces the old libwayland-egl-mesa package, and then upgrade the
rest afterwards. I tried installing them in a single command, and that
didn't go so well due to conflicts/dependency-issues with
libwayland-egl1 ...

--Aaron

>
> Btw, `--with-egl-platforms` is deprecated (see the warning it prints
> when you use it).
>
>> ---
>>  configure.ac  | 20 ++-
>>  src/egl/Makefile.am   |  5 ++
>>  src/egl/wayland/wayland-egl/wayland-egl-backend.h | 67 
>> +++
>>  3 files changed, 91 insertions(+), 1 deletion(-)
>>  create mode 100644 src/egl/wayland/wayland-egl/wayland-egl-backend.h
>>
>> diff --git a/configure.ac b/configure.ac
>> index 75ee1a7..32b3c53 100644
>> --- a/configure.ac
>> +++ b/configure.ac
>> @@ -91,6 +91,7 @@ LIBVA_REQUIRED=0.39.0
>>  VDPAU_REQUIRED=1.1
>>  WAYLAND_REQUIRED=1.11
>>  WAYLAND_EGL_BACKEND_REQUIRED=3
>> +UBUNTU_WAYLAND_EGL_BACKEND_REQUIRED=18.10
>>  WAYLAND_PROTOCOLS_REQUIRED=1.8
>>  XCB_REQUIRED=1.9.3
>>  XCBDRI2_REQUIRED=1.8
>> @@ -1810,7 +1811,24 @@ for plat in $platforms; do
>>  PKG_CHECK_MODULES([WAYLAND_SERVER], [wayland-server >= 
>> $WAYLAND_REQUIRED])
>>  PKG_CHECK_MODULES([WAYLAND_PROTOCOLS], [wayland-protocols >= 
>> $WAYLAND_PROTOCOLS_REQUIRED])
>>  if test "x$enable_egl" = xyes; then
>> -  PKG_CHECK_MODULES([WAYLAND_EGL], [wayland-egl-backend >= 
>> $WAYLAND_EGL_BACKEND_REQUIRED])
>> +  case "$host_os" in
>> +  linux*)
>> +  AC_SUBST([DISTRIBUTOR_ID],[$( lsb_release -is )])
>> +  AC_SUBST([RELEASE_VERSION],[$( lsb_release -rs )])
>> +  ;;
>> +  *)
>> +  AC_SUBST([DISTRIBUTOR_ID])
>> +  AC_SUBST([RELEASE_VERSION])
>> +  ;;
>> +  esac
>> +
>> +  if test "$DISTRIBUTOR_ID" = "Ubuntu" -a  $RELEASE_VERSION \< 
>> $UBUNTU_WAYLAND_EGL_BACKEND_REQUIRED ; then
>> +  DEFINES="$DEFINES -DHAVE_PLATFORM_WAYLAND_BACKEND"
>> +  AM_CONDITIONAL([HAVE_PLATFORM_WAYLAND_BACKEND], [test "xyes" 
>> = xyes])
>> +  else
>> +  PKG_CHECK_MODULES([WAYLAND_EGL], [wayland-egl-backend >= 
>> $WAYLAND_EGL_BACKEND_REQUIRED])
>> +  AM_CONDITIONAL([HAVE_PLATFORM_WAYLAND_BACKEND], [test "xyes" 
>> != xyes])
>> +  fi
>>  fi
>>  WAYLAND_PROTOCOLS_DATADIR=`$PKG_CONFIG --variable=pkgdatadir 
>> wayland-protocols`
>>
>> diff --git a/src/egl/Makefile.am b/src/egl/Makefile.am
>> index be3547d..0ef0a42 100644
>> --- a/src/egl/Makefile.am
>> +++ b/src/egl/Makefile.am
>> @@ -121,6 +121,11 @@ AM_CFLAGS += \
>>   -DDEFAULT_DRIVER_DIR=\"$(DRI_DRIVER_SEARCH_DIR)\" \
>>   -D_EGL_BUILT_IN_DRIVER_DRI2
>>
>> +if HAVE_PLATFORM_WAYLAND_BACKEND
>> +AM_CFLAGS += \
>> + -I$(top_srcdir)/src/egl/wayland/wayland-egl
>> +endif
>> +
>>  nodist_libEGL_common_la_SOURCES = \
>>   $(dri2_backend_GENERATED_FILES)
>>
>> diff --git a/src/egl/wayland/wayland-egl/wayland-egl-backend.h 
>> b/src/egl/wayland/wayland-egl/wayland-egl-backend.h
>> new file mode 100644
>> index 000..869c86f
>> --- /dev/null
>> +++ b/src/egl/wayland/wayland-egl/wayland-egl-backend.h
>> @@ -0,0 +1,67 @@
>> +/*
>> + * Copyright © 2011 Benjamin Franzke
>> + 

Re: [Mesa-dev] [PATCH v2 6/6] meson: remove a bunch of out of date TODO's

2018-06-12 Thread Eric Engestrom
On Tuesday, 2018-06-12 09:05:58 -0700, Dylan Baker wrote:
> Quoting Eric Engestrom (2018-06-12 05:08:57)
> > On Monday, 2018-06-11 10:19:01 -0700, Dylan Baker wrote:
> > > Some of these are done already, some of them are things we're not going
> > > to do, like have a toggle for GLX_TLS.
> > 
> > I'm not 100% sure which is which, and I might not be the only one;
> > could you split these two into two patches? Thanks :)
> > 
> > The rest of the series is:
> > Reviewed-by: Eric Engestrom 
> > 
> > > 
> > > v2: - Don't remove USE_MGL_NAMESPACE or with_glx_direct
> > > 
> > > Signed-off-by: Dylan Baker 
> > > ---
> > >  meson.build | 8 
> > >  src/egl/meson.build | 2 --
> > >  src/gbm/meson.build | 2 --
> > >  3 files changed, 12 deletions(-)
> > > 
> > > diff --git a/meson.build b/meson.build
> > > index bee526a4f22..aefb9f3c85e 100644
> > > --- a/meson.build
> > > +++ b/meson.build
> > > @@ -1217,8 +1217,6 @@ if get_option('selinux')
> > >pre_args += '-DMESA_SELINUX'
> > >  endif
> > >  
> > > -# TODO: llvm-prefix and llvm-shared-libs
> > > -
> 
> This was the only one left that was "not going to do", and Emil asked me to
> leave it for now and I forgot. I've dropped this hunk and reworked the commit
> message to say "meson: remove various completed todos"

R-b on this patch as well then :)

> 
> > >  if with_libunwind != 'false'
> > >dep_unwind = dependency('libunwind', required : with_libunwind == 
> > > 'true')
> > >if dep_unwind.found()
> > > @@ -1228,8 +1226,6 @@ else
> > >dep_unwind = null_dep
> > >  endif
> > >  
> > > -# TODO: gallium-hud
> > > -
> > >  if with_osmesa != 'none'
> > >if with_osmesa == 'classic' and not with_dri_swrast
> > >  error('OSMesa classic requires dri (classic) swrast.')
> > > @@ -1354,10 +1350,6 @@ else
> > >dep_lmsensors = null_dep
> > >  endif
> > >  
> > > -# TODO: various libdirs
> > > -
> > > -# TODO: gallium driver dirs
> > > -
> > >  foreach a : pre_args
> > >add_project_arguments(a, language : ['c', 'cpp'])
> > >  endforeach
> > > diff --git a/src/egl/meson.build b/src/egl/meson.build
> > > index 8d888d35aff..5f30bbba89a 100644
> > > --- a/src/egl/meson.build
> > > +++ b/src/egl/meson.build
> > > @@ -140,8 +140,6 @@ if with_platform_haiku
> > >deps_for_egl += cpp.find_library('be')
> > >  endif
> > >  
> > > -# TODO: glvnd
> > > -
> > >  if cc.has_function('mincore')
> > >c_args_for_egl += '-DHAVE_MINCORE'
> > >  endif
> > > diff --git a/src/gbm/meson.build b/src/gbm/meson.build
> > > index 7a60868783c..2e9d380c0b4 100644
> > > --- a/src/gbm/meson.build
> > > +++ b/src/gbm/meson.build
> > > @@ -45,8 +45,6 @@ if with_platform_wayland
> > >incs_gbm += inc_wayland_drm
> > >  endif
> > >  
> > > -# TODO: wayland support (requires egl)
> > > -
> > >  libgbm = shared_library(
> > >'gbm',
> > >files_gbm,
> > > -- 
> > > 2.17.1
> > > 
> > > ___
> > > 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 10/48] meson: Add a platform for windows

2018-06-12 Thread Dylan Baker
Quoting Eric Engestrom (2018-06-12 04:58:53)
> On Monday, 2018-06-11 15:55:37 -0700, Dylan Baker wrote:
> > This mirrors the haiku build which uses a platform.
> > ---
> >  meson.build   | 16 ++--
> >  meson_options.txt |  1 +
> >  2 files changed, 15 insertions(+), 2 deletions(-)
> > 
> > diff --git a/meson.build b/meson.build
> > index 634a7a21758..9c8b9ca9ba5 100644
> > --- a/meson.build
> > +++ b/meson.build
> > @@ -222,14 +222,24 @@ else
> >with_dri_platform = 'none'
> >  endif
> >  
> > +with_platform_android = false
> > +with_platform_haiku = false
> > +with_platform_windows = false
> > +with_platform_wayland = false
> > +with_platform_x11 = false
> > +with_platform_drm = false
> > +with_platform_surfaceless = false
> > +egl_native_platform = ''
> 
> guessing that's a rebase fail :P

Yeah, git didn't generate very good diffs for this...

> 
> >  _platforms = get_option('platforms')
> >  if _platforms.contains('auto')
> >if system_has_kms_drm
> >  _platforms = ['x11', 'wayland', 'drm', 'surfaceless']
> > -  elif ['darwin', 'windows', 'cygwin'].contains(host_machine.system())
> > +  elif ['darwin', 'cygwin'].contains(host_machine.system())
> >  _platforms = ['x11', 'surfaceless']
> >elif ['haiku'].contains(host_machine.system())
> >  _platforms = ['haiku']
> > +  elif host_machine.system() == 'windows'
> > +_platforms = ['windows']
> 
> I'm not convinced by this though; if you add `-D platforms=windows` on
> non-Windows, what do you get?
> If you remove `windows` from `platforms` on Windows, what do you get?

The intention was (and I may have failed at this), that platform_windows was for
building a driver that would integrate with Window's libGL, which IIRC is an ICD
similar to glvnd on *nix. There are other use cases for windows though, among
them you could build an software rasterizer (swrast, llvmpipe, swr) with osmesa,
and there are certainly people who do that.

Dylan

> 
> It seems to me like all the places where `with_platform_windows` is used
> in your series, it should be `host_machine.system() == 'windows'` instead.
> 
> This is the only patch I'm (soft) NAK'ing in your series; the rest of it
> is:
> Acked-by: Eric Engestrom 
> 


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 v1] configure.ac: Missed package 'wayland-egl-backend'

2018-06-12 Thread Eric Engestrom
On Tuesday, 2018-06-12 11:07:40 -0500, Aaron Watry wrote:
> On Tue, Jun 12, 2018 at 10:31 AM, Eric Engestrom
>  wrote:
> > On Tuesday, 2018-06-12 18:22:03 +0300, Sergii Romantsov wrote:
> >> Added support of wayland-egl-backend for old Ubuntus.
> >> Building of mesa with parameter "--with-egl-platforms=x11,wayland"
> >> fails:
> >> "configure: error: Package requirements (wayland-egl-backend >= 3)
> >> were not met: No package 'wayland-egl-backend' found"
> >>
> >> Ubuntu's releases less than 18.10 don't have package
> >> libwayland-egl-backend-dev.
> >> To fix that issue used mesa-platfrom-header wayland-egl-backend.h.
> >>
> >> Bugzilla: https://bugs.freedesktop.org/show_bug.cgi?id=106897
> >> Signed-off-by: Sergii Romantsov 
> >
> > NAK
> >
> > There are many issues here:
> > - you're going backwards: we just deleted this file
> > - we don't want distro-specific hacks in mesa
> > - your HAVE_PLATFORM_WAYLAND_BACKEND is backwards (you define it when
> >   you don't have it)
> > - you're only "fixing" autotools, not meson
> > - as mentioned by Daniel on the bug, the actual issue is that your
> >   system is not up to date; `apt upgrade` to fix your issue.
> 
> That's the thing here.  There is no released version of Ubuntu that
> you can just `apt upgrade` to get the required libwayland version.
> 
> The way I was able to resolve this for my system was to download the
> Ubuntu 18.10 version of the libwayland packages and apply them to my
> 18.04 instance (with fingers crossed that I wasn't breaking my system
> in the process as I worked my way through the dependency issues that
> it caused).

You can't expect to work on up-to-date software on a system that's only
shipping old software...

I'm sorry, but you're always going to encounter these issue, and if
you're not comfortable building your dependencies yourself, you should
move to a distro that ships up-to-date software; there's a fair few of
them, google for "rolling release distribution" for instance.

> 
> For the brave/desperate, the latest build as of this moment for Cosmic is 
> here:
> https://bugs.launchpad.net/ubuntu/+source/wayland/1.15.0-2/+build/14907841
> 
> I believe it'd work to install the libwayland-egl1 DEB first, so that
> it replaces the old libwayland-egl-mesa package, and then upgrade the
> rest afterwards. I tried installing them in a single command, and that
> didn't go so well due to conflicts/dependency-issues with
> libwayland-egl1 ...
> 
> --Aaron
> 
> >
> > Btw, `--with-egl-platforms` is deprecated (see the warning it prints
> > when you use it).
> >
> >> ---
> >>  configure.ac  | 20 ++-
> >>  src/egl/Makefile.am   |  5 ++
> >>  src/egl/wayland/wayland-egl/wayland-egl-backend.h | 67 
> >> +++
> >>  3 files changed, 91 insertions(+), 1 deletion(-)
> >>  create mode 100644 src/egl/wayland/wayland-egl/wayland-egl-backend.h
> >>
> >> diff --git a/configure.ac b/configure.ac
> >> index 75ee1a7..32b3c53 100644
> >> --- a/configure.ac
> >> +++ b/configure.ac
> >> @@ -91,6 +91,7 @@ LIBVA_REQUIRED=0.39.0
> >>  VDPAU_REQUIRED=1.1
> >>  WAYLAND_REQUIRED=1.11
> >>  WAYLAND_EGL_BACKEND_REQUIRED=3
> >> +UBUNTU_WAYLAND_EGL_BACKEND_REQUIRED=18.10
> >>  WAYLAND_PROTOCOLS_REQUIRED=1.8
> >>  XCB_REQUIRED=1.9.3
> >>  XCBDRI2_REQUIRED=1.8
> >> @@ -1810,7 +1811,24 @@ for plat in $platforms; do
> >>  PKG_CHECK_MODULES([WAYLAND_SERVER], [wayland-server >= 
> >> $WAYLAND_REQUIRED])
> >>  PKG_CHECK_MODULES([WAYLAND_PROTOCOLS], [wayland-protocols >= 
> >> $WAYLAND_PROTOCOLS_REQUIRED])
> >>  if test "x$enable_egl" = xyes; then
> >> -  PKG_CHECK_MODULES([WAYLAND_EGL], [wayland-egl-backend >= 
> >> $WAYLAND_EGL_BACKEND_REQUIRED])
> >> +  case "$host_os" in
> >> +  linux*)
> >> +  AC_SUBST([DISTRIBUTOR_ID],[$( lsb_release -is )])
> >> +  AC_SUBST([RELEASE_VERSION],[$( lsb_release -rs )])
> >> +  ;;
> >> +  *)
> >> +  AC_SUBST([DISTRIBUTOR_ID])
> >> +  AC_SUBST([RELEASE_VERSION])
> >> +  ;;
> >> +  esac
> >> +
> >> +  if test "$DISTRIBUTOR_ID" = "Ubuntu" -a  $RELEASE_VERSION \< 
> >> $UBUNTU_WAYLAND_EGL_BACKEND_REQUIRED ; then
> >> +  DEFINES="$DEFINES -DHAVE_PLATFORM_WAYLAND_BACKEND"
> >> +  AM_CONDITIONAL([HAVE_PLATFORM_WAYLAND_BACKEND], [test 
> >> "xyes" = xyes])
> >> +  else
> >> +  PKG_CHECK_MODULES([WAYLAND_EGL], [wayland-egl-backend >= 
> >> $WAYLAND_EGL_BACKEND_REQUIRED])
> >> +  AM_CONDITIONAL([HAVE_PLATFORM_WAYLAND_BACKEND], [test 
> >> "xyes" != xyes])
> >> +  fi
> >>  fi
> >>  WAYLAND_PROTOCOLS_DATADIR=`$PKG_CONFIG --variable=pkgdatadir 
> >> wayland-protocols`
> >>
> >> diff --git a/src/egl/Makefile.am b/src/egl/Makefile.am
> >> index be3547d..0ef0a42 100644
> >> --- a/src/egl/Makefile.am
> >> +++ b/src/egl/Makefile.am
> >> @@ -121,6 +12

Re: [Mesa-dev] [PATCH 14/48] meson: don't build shader cache on windows

2018-06-12 Thread Dylan Baker
Quoting Eric Engestrom (2018-06-12 04:30:47)
> On Monday, 2018-06-11 15:55:41 -0700, Dylan Baker wrote:
> > ---
> >  meson.build | 2 +-
> >  1 file changed, 1 insertion(+), 1 deletion(-)
> > 
> > diff --git a/meson.build b/meson.build
> > index 4247d195bc1..ed63276b63e 100644
> > --- a/meson.build
> > +++ b/meson.build
> > @@ -699,7 +699,7 @@ if get_option('buildtype') == 'debug'
> >pre_args += '-DDEBUG'
> >  endif
> >  
> > -if get_option('shader-cache')
> > +if get_option('shader-cache') and host_machine.system() != 'windows'
> 
> This means that shader-cache=true on windows will be silently ignored,
> not very intuitive.
> How about auto/true/false, with auto = `host_machine.system() != 'windows'`?
> That way, patch 36/48 (meson: Don't build glsl cache_test for windows)
> can be guarded by `with_shader_cache` instead, which means it will be
> automatically tested on windows if/when turned on.

Yup, that seems like a better idea. Fixed locally.

> 
> >pre_args += '-DENABLE_SHADER_CACHE'
> >  elif with_amd_vk
> >error('Radv requires shader cache support')
> > -- 
> > 2.17.1
> > 
> > ___
> > mesa-dev mailing list
> > mesa-dev@lists.freedesktop.org
> > https://lists.freedesktop.org/mailman/listinfo/mesa-dev


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


Re: [Mesa-dev] [PATCH 26/48] meson: fix pipe-loader compilation for windows

2018-06-12 Thread Dylan Baker
Quoting Eric Engestrom (2018-06-12 03:39:17)
> On Monday, 2018-06-11 15:55:53 -0700, Dylan Baker wrote:
> > ---
> >  src/gallium/auxiliary/pipe-loader/meson.build | 9 +++--
> >  1 file changed, 7 insertions(+), 2 deletions(-)
> > 
> > diff --git a/src/gallium/auxiliary/pipe-loader/meson.build 
> > b/src/gallium/auxiliary/pipe-loader/meson.build
> > index 32e8188c68b..207e4b0fac4 100644
> > --- a/src/gallium/auxiliary/pipe-loader/meson.build
> > +++ b/src/gallium/auxiliary/pipe-loader/meson.build
> > @@ -27,13 +27,18 @@ files_pipe_loader = files(
> >  )
> >  
> >  libpipe_loader_defines = []
> > +libpipe_loader_links = []
> >  
> >  if dep_libdrm.found()
> >files_pipe_loader += files('pipe_loader_drm.c')
> > +  libpipe_loader_links += libloader
> >  endif
> >  if with_gallium_drisw_kms
> >libpipe_loader_defines += '-DHAVE_PIPE_LOADER_KMS'
> >  endif
> > +if not (with_gallium_st_nine or with_gallium_opencl)
> > +  libpipe_loader_defines += '-DROP_PIPE_LOADER_MISC=1'
> 
> missing `D` here, and the `=1` is not necessary:
>   '-DDROP_PIPE_LOADER_MISC'
> 

Scons sets it to 1, but android.mk doesn't. But since it's not required and
we generally don't set it in meson I'll do that.

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 35/48] util/tests: Use define instead of VLA

2018-06-12 Thread Dylan Baker
Quoting Eric Engestrom (2018-06-12 04:01:57)
> On Monday, 2018-06-11 15:56:02 -0700, Dylan Baker wrote:
> > To allow the this test to be built with MSVC, which doesn't support
> > VLAs.
> > ---
> >  src/util/tests/hash_table/clear.c | 13 +++--
> >  src/util/tests/hash_table/delete_management.c | 13 +++--
> >  src/util/tests/hash_table/insert_many.c   | 11 ++-
> >  src/util/tests/hash_table/meson.build |  1 +
> >  src/util/tests/hash_table/random_entry.c  |  7 ---
> >  src/util/tests/string_buffer/meson.build  |  1 +
> >  6 files changed, 26 insertions(+), 20 deletions(-)
> > 
> > diff --git a/src/util/tests/hash_table/clear.c 
> > b/src/util/tests/hash_table/clear.c
> > index 526700bfb0f..19494844608 100644
> > --- a/src/util/tests/hash_table/clear.c
> > +++ b/src/util/tests/hash_table/clear.c
> > @@ -23,6 +23,8 @@
> >  
> >  #include "hash_table.h"
> >  
> > +#define SIZE 1000
> > +
> >  static void *make_key(uint32_t i)
> >  {
> >return (void *)(uintptr_t)(1 + i);
> > @@ -54,13 +56,12 @@ int main()
> >  {
> > struct hash_table *ht;
> > struct hash_entry *entry;
> > -   const uint32_t size = 1000;
> > -   bool flags[size];
> > +   bool flags[SIZE];
> 
> alternative solution:
>   bool flags[1000];
>   const uint32_t size = ARRAY_SIZE(flags);
> 
> bonus: no need to s/size/SIZE/g all over the place :)

I guess? It just doesn't seem like that big of a deal either way, since I used
sed to generate most of the patch anyway.

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 44/48] meson: add windows specific linker flags

2018-06-12 Thread Dylan Baker
Quoting Eric Engestrom (2018-06-12 04:38:04)
> On Monday, 2018-06-11 15:56:11 -0700, Dylan Baker wrote:
> > ---
> >  meson.build | 21 +
> >  1 file changed, 21 insertions(+)
> > 
> > diff --git a/meson.build b/meson.build
> > index a244694fd4a..e1b3afbe688 100644
> > --- a/meson.build
> > +++ b/meson.build
> > @@ -847,6 +847,27 @@ else
> >endforeach
> >  endif
> >  
> > +# set linker arguments
> > +if host_machine.system() == 'windows'
> > +  if cc.get_id() == 'msvc'
> > +add_project_link_arguments(
> > +  '/fixed:no',
> > +  '/incremental:no',
> > +  '/dynamicbase',
> > +  '/nxcompat',
> > +  language : ['c', 'cpp'],
> > +)
> > +  else
> > +add_project_link_arguments(
> > +  '-Wl,--nxcompat',
> > +  '-Wl,--dynamicbase',
> > +  '-static-libgcc',
> > +  '-static-libstdc++',
> > +  language : ['c', 'cpp'],
> 
> probably harmless, but it feels like libgcc and libstdc++ should be
> only added to c, respectively cpp, not both.

cpp needs -static-libgcc if the target has both C and C++ code, right?

I copied this from scons/gallium.py.

Brian or Jose, I don't know what the right think to do is here, do one of you
guys?

Dylan


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


[Mesa-dev] [PATCH] intel/fs: use uint type for per_slot_offset at GS

2018-06-12 Thread Jose Maria Casanova Crespo
This helps us to compact original instruction:

mul(8)  g3<1>D  g6<8,8,1>UD  0x0006UD { align1 1Q };

So now we emit:

mul(8)  g3<1>UD g6<8,8,1>UD  0x0006UD { align1 1Q compacted };
---
 src/intel/compiler/brw_fs_visitor.cpp | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/src/intel/compiler/brw_fs_visitor.cpp 
b/src/intel/compiler/brw_fs_visitor.cpp
index a24808eac69..7159d78a86d 100644
--- a/src/intel/compiler/brw_fs_visitor.cpp
+++ b/src/intel/compiler/brw_fs_visitor.cpp
@@ -597,7 +597,7 @@ fs_visitor::emit_urb_writes(const fs_reg &gs_vertex_count)
  per_slot_offsets = brw_imm_ud(output_vertex_size_owords *
gs_vertex_count.ud);
   } else {
- per_slot_offsets = vgrf(glsl_type::int_type);
+ per_slot_offsets = vgrf(glsl_type::uint_type);
  bld.MUL(per_slot_offsets, gs_vertex_count,
  brw_imm_ud(output_vertex_size_owords));
   }
-- 
2.17.1

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


[Mesa-dev] [PATCH] configure.ac/meson.build: Add options for library suffixes

2018-06-12 Thread bmgordon
From: Benjamin Gordon 

When building the Chrome OS Android container, we need to build copies
of mesa that don't conflict with the Android system-supplied libraries.
This adds options to create suffixed versions of EGL and GLES libraries:

libEGL.so -> libEGL${egl-lib-suffix}.so
libGLESv1_CM.so -> libGLESv1_CM${gles-lib-suffix}.so
libGLESv2.so -> libGLES${gles-lib-suffix}.so

This is similar to what happens when --enable-libglvnd is specified, but
without the side effects of linking against libglvnd.

Change-Id: I0a534d3921a24c031e2532ee7d5ba9813740b33b
Signed-off-by: Benjamin Gordon 
---
 configure.ac| 14 ++
 meson_options.txt   | 12 
 src/egl/Makefile.am |  8 
 src/egl/meson.build |  2 +-
 src/mapi/Makefile.am| 28 ++--
 src/mapi/es1api/meson.build |  2 +-
 src/mapi/es2api/meson.build |  2 +-
 7 files changed, 47 insertions(+), 21 deletions(-)

diff --git a/configure.ac b/configure.ac
index 35ade986d1..6070a2146b 100644
--- a/configure.ac
+++ b/configure.ac
@@ -1511,12 +1511,24 @@ AC_ARG_WITH([gl-lib-name],
 [specify GL library name @<:@default=GL@:>@])],
   [GL_LIB=$withval],
   [GL_LIB="$DEFAULT_GL_LIB_NAME"])
+AC_ARG_WITH([egl-lib-suffix],
+  [AS_HELP_STRING([--with-egl-lib-suffix@<:@=NAME@:>@],
+[specify EGL library suffix @<:@default=none@:>@])],
+  [EGL_LIB_SUFFIX=$withval],
+  [EGL_LIB_SUFFIX=""])
+AC_ARG_WITH([gles-lib-suffix],
+  [AS_HELP_STRING([--with-gles-lib-suffix@<:@=NAME@:>@],
+[specify GLES library suffix @<:@default=none@:>@])],
+  [GLES_LIB_SUFFIX=$withval],
+  [GLES_LIB_SUFFIX=""])
 AC_ARG_WITH([osmesa-lib-name],
   [AS_HELP_STRING([--with-osmesa-lib-name@<:@=NAME@:>@],
 [specify OSMesa library name @<:@default=OSMesa@:>@])],
   [OSMESA_LIB=$withval],
   [OSMESA_LIB=OSMesa])
 AS_IF([test "x$GL_LIB" = xyes], [GL_LIB="$DEFAULT_GL_LIB_NAME"])
+AS_IF([test "x$EGL_LIB_SUFFIX" = xyes], [EGL_LIB_SUFFIX=""])
+AS_IF([test "x$GLES_LIB_SUFFIX" = xyes], [GLES_LIB_SUFFIX=""])
 AS_IF([test "x$OSMESA_LIB" = xyes], [OSMESA_LIB=OSMesa])
 
 dnl
@@ -1534,6 +1546,8 @@ if test "x${enable_mangling}" = "xyes" ; then
   OSMESA_LIB="Mangled${OSMESA_LIB}"
 fi
 AC_SUBST([GL_LIB])
+AC_SUBST([EGL_LIB_SUFFIX])
+AC_SUBST([GLES_LIB_SUFFIX])
 AC_SUBST([OSMESA_LIB])
 
 # Check for libdrm
diff --git a/meson_options.txt b/meson_options.txt
index ce7d87f1eb..9d84c3b5bb 100644
--- a/meson_options.txt
+++ b/meson_options.txt
@@ -298,3 +298,15 @@ option(
   choices : ['freedreno', 'glsl', 'intel', 'nir', 'nouveau', 'all'],
   description : 'List of tools to build.',
 )
+option(
+  'egl-lib-suffix',
+  type : 'string',
+  value : '',
+  description : 'Suffix to append to EGL library name.  Default: none.'
+)
+option(
+  'gles-lib-suffix',
+  type : 'string',
+  value : '',
+  description : 'Suffix to append to GLES library names.  Default: none.'
+)
diff --git a/src/egl/Makefile.am b/src/egl/Makefile.am
index 086a4a1e63..c3aeeea007 100644
--- a/src/egl/Makefile.am
+++ b/src/egl/Makefile.am
@@ -184,12 +184,12 @@ libEGL_mesa_la_LDFLAGS = \
 
 else # USE_LIBGLVND
 
-lib_LTLIBRARIES = libEGL.la
-libEGL_la_SOURCES =
-libEGL_la_LIBADD = \
+lib_LTLIBRARIES = libEGL@EGL_LIB_SUFFIX@.la
+libEGL@EGL_LIB_SUFFIX@_la_SOURCES =
+libEGL@EGL_LIB_SUFFIX@_la_LIBADD = \
libEGL_common.la \
$(top_builddir)/src/mapi/shared-glapi/libglapi.la
-libEGL_la_LDFLAGS = \
+libEGL@EGL_LIB_SUFFIX@_la_LDFLAGS = \
-no-undefined \
-version-number 1:0 \
$(BSYMBOLIC) \
diff --git a/src/egl/meson.build b/src/egl/meson.build
index 6537e4bdee..b833fd1729 100644
--- a/src/egl/meson.build
+++ b/src/egl/meson.build
@@ -148,7 +148,7 @@ if cc.has_function('mincore')
 endif
 
 if not with_glvnd
-  egl_lib_name = 'EGL'
+  egl_lib_name = 'EGL' + get_option('egl-lib-suffix')
   egl_lib_version = '1.0.0'
 else
   egl_lib_name = 'EGL_mesa'
diff --git a/src/mapi/Makefile.am b/src/mapi/Makefile.am
index 3da1a193d2..a2b108adc9 100644
--- a/src/mapi/Makefile.am
+++ b/src/mapi/Makefile.am
@@ -178,24 +178,24 @@ GLES_include_HEADERS = \
$(top_srcdir)/include/GLES/glext.h \
$(top_srcdir)/include/GLES/glplatform.h
 
-lib_LTLIBRARIES += es1api/libGLESv1_CM.la
+lib_LTLIBRARIES += es1api/libGLESv1_CM@GLES_LIB_SUFFIX@.la
 
-es1api_libGLESv1_CM_la_SOURCES = entry.c es1api/glapi_mapi_tmp.h
-es1api_libGLESv1_CM_la_CFLAGS = \
+es1api_libGLESv1_CM@GLES_LIB_SUFFIX@_la_SOURCES = entry.c 
es1api/glapi_mapi_tmp.h
+es1api_libGLESv1_CM@GLES_LIB_SUFFIX@_la_CFLAGS = \
$(AM_CFLAGS) \
$(VISIBILITY_CFLAGS)
-es1api_libGLESv1_CM_la_CPPFLAGS = \
+es1api_libGLESv1_CM@GLES_LIB_SUFFIX@_la_CPPFLAGS = \
$(AM_CPPFLAGS) \
-DMAPI_MODE_BRIDGE \
-DMAPI_ABI_HEADER=\"es1api/glapi_mapi_tmp.h\"
-es1api_libGLESv1_CM_la_LIBADD = $(GLESv1_CM_LIB_DEPS)
-es1api_libGLESv1_CM_la_LDFLAGS = \
+es1api_libGLESv1_CM@GLES_LIB_SUFFIX@_la_LIBADD = $(GLESv1_CM_LIB_DEPS)
+es1api_libGLESv1_CM@GLES_LIB_SUFFIX@_la_LDFLAGS = \
   

Re: [Mesa-dev] [PATCH 2/2] nir: add lowering for gl_HelperInvocation

2018-06-12 Thread Rob Clark
On Mon, Jun 11, 2018 at 10:59 PM, Roland Scheidegger  wrote:
> Am 12.06.2018 um 01:17 schrieb Rob Clark:
>> On Mon, Jun 11, 2018 at 6:59 PM, Roland Scheidegger  
>> wrote:
>>> Am 12.06.2018 um 00:32 schrieb Jason Ekstrand:
 On Wed, Jun 6, 2018 at 7:43 AM, Rob Clark >>> > wrote:

 Signed-off-by: Rob Clark >>> >
 ---
 I can't say for sure that this will work on all drivers, but it is
 what the blob driver does, and it seems to make deqp happy.  I could
 move this to it's own pass inside ir3, but that seemed like overkill

  src/compiler/nir/nir.h  | 10 ++
  src/compiler/nir/nir_lower_system_values.c  | 17 +
  src/gallium/drivers/freedreno/ir3/ir3_nir.c |  1 +
  3 files changed, 28 insertions(+)

 diff --git a/src/compiler/nir/nir.h b/src/compiler/nir/nir.h
 index 073ab4e82ea..de3d55d83af 100644
 --- a/src/compiler/nir/nir.h
 +++ b/src/compiler/nir/nir.h
 @@ -1963,6 +1963,16 @@ typedef struct nir_shader_compiler_options {
  */
 bool lower_base_vertex;

 +   /**
 +* If enabled, gl_HelperInvocation will be lowered as:
 +*
 +*   !((1 << gl_SampleID) & gl_SampleMaskIN[0]))


 This only works for multi-sampling.  What about the single-sampled case?
>>> It doesn't make sense to me for msaa neither.
>>> gl_SampleID forces per-sample execution, which clearly isn't what you
>>> want.
>>
>> open to suggestions about how to try and force blob to do something
>> different.. I tried a few things and the blob popped out shader code
>> that worked the same way in all cases, but ofc I could have missed
>> something.
>>
>>> Plus, gl_SampleMaskIN is specified to only contain bits for the
>>> current shader invocation, so for msaa with forced per-sample execution
>>> that would only contain the single bit corresponding to gl_SampleID
>>> anyway (that is my interpretation at least - I know hw sample mask
>>> inputs will probably always contains all the bits from rasterization,
>>> regardless of gl_SampleID), so the "1 << gl_SampleID &" part will do
>>> nothing at all. So I think that part is more about lowering the hw
>>> rasterization sample mask to gl_SampleMaskIN rather than lowering to
>>> gl_HelperInvocation.
>>> But yes, !gl_SampleMaskIN should give gl_HelperInvocation - I think all
>>> hw can give you raster sample mask even without msaa but I'm not
>>> entirely sure if it's guaranteed to work in GL with single sampling
>>> (similar for sample id, which should just be stuck at 0). But using the
>>> gl names here looks very, very fishy to me here.
>>
>> I *guess* this is relying on behaviour that gl does not guarantee, but
>> also doesn't prohibit, but the hw happens work that way and it works
>> out..
>>
>> Maybe the answer is to simply better document the assumptions that
>> this lowering depends on?
> Well I think if you have a nir shader which uses sample id but is
> supposed to not be run per-sample that is quite confusing (I'd just
> assume that adrenos will use sample id 0 just like in single sampled
> case). Hopefully noone will deduce shader frequency from the nir shader...
> I'm definitely no NIR expert but there's quite a lot of hacky
> assumptions in there:
> - sample id in nir doesn't cause per-sample execution (and needs to be 0
> in case of msaa but no per-sample execution)
> - sampleMaskIn is available in single-sampled
> - sampleMaskIn doesn't actually have gl semantics but hw ones (so simply
> the mask from rasterization, not taking into account the sample id
> already if there's per-sample execution (for legitimate reasons),
> although as mentioned I think there's still some debate about this and
> not all drivers may actually agree what the semantics of it are in case
> of per-sample execution)
>
> As such I'm not sure it really makes sense to do that as a generic
> lowering pass? Albeit you're quite right that it might work for a lot of
> hw... But some comments would at the very least imho definitely be required.
>

so I reworded the comment about the enable flag a bit:

   /**
* If enabled, gl_HelperInvocation will be lowered as:
*
*   !((1 << sample_id) & sample_mask_in))
*
* This depends on some possibly hw implementation details, which may
* not be true for all hw.  In particular that the FS is only executed
* for covered samples or for helper invocations.  So, do not blindly
* enable this option.
*/
   bool lower_helper_invocation;

But I guess I probably do need to introduce a new intrinsic to access
sample_id without necessarily triggering per-sample mode.. hmm..

BR,
-R


> Roland
>
>
>
>>
>> BR,
>> -R
>>
>>>
>>> Roland
>>>
>>>
>>>
>>>

 --Jason



 +*
 +* TODO any hw w/ more than 32 samples?  For them (i

Re: [Mesa-dev] [PATCH 46/48] appveyor: Add support for meson as well as scons

2018-06-12 Thread Dylan Baker
Quoting Eric Engestrom (2018-06-12 04:46:19)
> On Monday, 2018-06-11 15:56:13 -0700, Dylan Baker wrote:
> > This currently builds softpipe only
> > ---
> >  appveyor.yml | 28 +++-
> >  1 file changed, 19 insertions(+), 9 deletions(-)
> > 
> > diff --git a/appveyor.yml b/appveyor.yml
> > index bd33e2e9554..06063feba93 100644
> > --- a/appveyor.yml
> > +++ b/appveyor.yml
> > @@ -42,6 +42,9 @@ os: Visual Studio 2015
> >  environment:
> >WINFLEXBISON_ARCHIVE: win_flex_bison-2.5.9.zip
> >LLVM_ARCHIVE: llvm-3.3.1-msvc2015-mtd.7z
> > +  matrix:
> > +- BUILD_SYSTEM: meson
> > +- BUILD_SYSTEM: scons
> >  
> >  install:
> >  # Check pip
> > @@ -49,13 +52,16 @@ install:
> >  - python -m pip --version
> >  # Install Mako
> >  - python -m pip install Mako==1.0.6
> > -# Install pywin32 extensions, needed by SCons
> > -- python -m pip install pypiwin32
> > -# Install python wheels, necessary to install SCons via pip
> > -- python -m pip install wheel
> > -# Install SCons
> > -- python -m pip install scons==2.5.1
> > -- scons --version
> > +- if "%BUILD_SYSTEM%"=="scons" python -m pip install pypiwin32 wheel
> > +- if "%BUILD_SYSTEM%"=="scons" python -m pip install scons==2.5.1
> > +- if "%BUILD_SYSTEM%"=="scons" scons --version
> > +- if "%BUILD_SYSTEM%"=="meson" C:\Python36\python.exe -m pip install meson
> > +- if "%BUILD_SYSTEM%"=="meson" set Path=C:\Python36\Scripts;%Path%
> > +- if "%BUILD_SYSTEM%"=="meson" set Path=C:\Python27;%Path%
> > +- if "%BUILD_SYSTEM%"=="meson" meson.py --version
> > +- if "%BUILD_SYSTEM%"=="meson" cinst -y ninja pkgconfiglite
> > +- if "%BUILD_SYSTEM%"=="meson" ninja --version
> > +- if "%BUILD_SYSTEM%"=="meson" call "C:\Program Files (x86)\Microsoft 
> > Visual Studio 14.0\VC\vcvarsall.bat" x86_amd64
> 
> I think this is gonna be more readable if you use `()`:
> 
>   if %BS%==scons (
> foo
> bar
> baz
> ...
>   )

I cannot get appveyor to accept anything like that. I know it's valid CMD, but
appveyor's yaml parser is a bit odd, and I can't figure out how to get it to
take multi-line cmd. When I went to stack overflow I found a bunch of questions
about it, but the only answer seems to be "use powershell" or reference an
external file. I'm very against the latter, and others have objected to
powershell in the past.

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 2/2] i965: implement MESA_framebuffer_flip_y

2018-06-12 Thread Chad Versace
On Thu 07 Jun 2018, Jason Ekstrand wrote:
> There are also a pile of places where we look at rb->Name == 0 to determine if
> it's a window-system framebuffer

For the public record, Fritz and I discussed this in person.

I recommend that the patches replace each checking on rb->Name == 0 to
instead check if the framebuffer is in flip mode. In other words,
replace checks on the rb with a check on the fb.
___
mesa-dev mailing list
mesa-dev@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/mesa-dev


[Mesa-dev] [Bug 106774] GLSL IR copy propagates loads of SSBOs

2018-06-12 Thread bugzilla-daemon
https://bugs.freedesktop.org/show_bug.cgi?id=106774

--- Comment #16 from Caio Marcelo de Oliveira Filho  
---
(In reply to Caio Marcelo de Oliveira Filho from comment #11)
> Even with the fixes to the GLSL copy propagation (and other passes) logic,
> the shader was still hanging. After a debugging session with Jason, he
> figured that the helper invocations were not making progress, getting into
> an infinite loop.

Per requested created https://bugs.freedesktop.org/show_bug.cgi?id=106902 for
this particular issue with helper invocations.

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


[Mesa-dev] [Bug 106903] radv: Fragment shader output goes to wrong attachments when render targets are sparse

2018-06-12 Thread bugzilla-daemon
https://bugs.freedesktop.org/show_bug.cgi?id=106903

Bug ID: 106903
   Summary: radv: Fragment shader output goes to wrong attachments
when render targets are sparse
   Product: Mesa
   Version: git
  Hardware: Other
OS: All
Status: NEW
  Severity: normal
  Priority: medium
 Component: Drivers/Vulkan/radeon
  Assignee: mesa-dev@lists.freedesktop.org
  Reporter: philip.rebo...@tu-dortmund.de
QA Contact: mesa-dev@lists.freedesktop.org

Created attachment 140140
  --> https://bugs.freedesktop.org/attachment.cgi?id=140140&action=edit
Patch for the 'deferred' demo

Hello,

when there's an unused color attachment in a subpass, it looks like fragment
shader outputs are not written to the correct attachments, i.e. if attachment
reference 1 is VK_ATTACHMENT_UNUSED, the fragment shader output at location 2
is written to the 3rd attachment and the output at location 3 is discarded
entirely. This causes rendering issues in Vampyr on DXVK.

The attached patch for Sasha Willems 'deferred' demo demonstrates the issue. It
works as expected on amdvlk. Mind that the affected fragment shader needs to be
recompiled manually.

Regards,
- Philip

-- 
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] [PATCH 01/13] i965: Set the r8stencil flag in miptree_finish_write

2018-06-12 Thread Nanley Chery
This seems to be the most appropriate place.
---
 src/mesa/drivers/dri/i965/brw_blorp.c | 6 +-
 src/mesa/drivers/dri/i965/brw_clear.c | 8 
 src/mesa/drivers/dri/i965/intel_mipmap_tree.c | 4 +++-
 src/mesa/drivers/dri/i965/intel_tex_image.c   | 3 ---
 4 files changed, 4 insertions(+), 17 deletions(-)

diff --git a/src/mesa/drivers/dri/i965/brw_blorp.c 
b/src/mesa/drivers/dri/i965/brw_blorp.c
index 8c6d77e1b7d..36409a04db9 100644
--- a/src/mesa/drivers/dri/i965/brw_blorp.c
+++ b/src/mesa/drivers/dri/i965/brw_blorp.c
@@ -121,7 +121,7 @@ brw_blorp_init(struct brw_context *brw)
 static void
 blorp_surf_for_miptree(struct brw_context *brw,
struct blorp_surf *surf,
-   struct intel_mipmap_tree *mt,
+   const struct intel_mipmap_tree *mt,
enum isl_aux_usage aux_usage,
bool is_render_target,
unsigned *level,
@@ -156,10 +156,6 @@ blorp_surf_for_miptree(struct brw_context *brw,
   .tile_y_sa = mt->level[*level].level_y,
};
 
-   if (mt->format == MESA_FORMAT_S_UINT8 && is_render_target &&
-   devinfo->gen <= 7)
-  mt->r8stencil_needs_update = true;
-
if (surf->aux_usage == ISL_AUX_USAGE_HIZ &&
!intel_miptree_level_has_hiz(mt, *level))
   surf->aux_usage = ISL_AUX_USAGE_NONE;
diff --git a/src/mesa/drivers/dri/i965/brw_clear.c 
b/src/mesa/drivers/dri/i965/brw_clear.c
index b097dfe346c..30e09861491 100644
--- a/src/mesa/drivers/dri/i965/brw_clear.c
+++ b/src/mesa/drivers/dri/i965/brw_clear.c
@@ -261,14 +261,6 @@ brw_clear(struct gl_context *ctx, GLbitfield mask)
   }
}
 
-   if (mask & BUFFER_BIT_STENCIL) {
-  struct intel_renderbuffer *stencil_irb =
- intel_get_renderbuffer(fb, BUFFER_STENCIL);
-  struct intel_mipmap_tree *mt = stencil_irb->mt;
-  if (mt && mt->stencil_mt)
- mt->stencil_mt->r8stencil_needs_update = true;
-   }
-
if (mask & BUFFER_BITS_COLOR) {
   brw_blorp_clear_color(brw, fb, mask, partial_clear,
 ctx->Color.sRGBEnabled);
diff --git a/src/mesa/drivers/dri/i965/intel_mipmap_tree.c 
b/src/mesa/drivers/dri/i965/intel_mipmap_tree.c
index 6b89bf6848a..765a830a6aa 100644
--- a/src/mesa/drivers/dri/i965/intel_mipmap_tree.c
+++ b/src/mesa/drivers/dri/i965/intel_mipmap_tree.c
@@ -2466,11 +2466,13 @@ intel_miptree_finish_write(struct brw_context *brw,
uint32_t start_layer, uint32_t num_layers,
enum isl_aux_usage aux_usage)
 {
+   const struct gen_device_info *devinfo = &brw->screen->devinfo;
num_layers = miptree_layer_range_length(mt, level, start_layer, num_layers);
 
switch (mt->aux_usage) {
case ISL_AUX_USAGE_NONE:
-  /* Nothing to do */
+  if (mt->format == MESA_FORMAT_S_UINT8 && devinfo->gen <= 7)
+ mt->r8stencil_needs_update = true;
   break;
 
case ISL_AUX_USAGE_MCS:
diff --git a/src/mesa/drivers/dri/i965/intel_tex_image.c 
b/src/mesa/drivers/dri/i965/intel_tex_image.c
index fae179214dd..3d948381f4a 100644
--- a/src/mesa/drivers/dri/i965/intel_tex_image.c
+++ b/src/mesa/drivers/dri/i965/intel_tex_image.c
@@ -325,9 +325,6 @@ intel_upload_tex(struct gl_context * ctx,
 
bool tex_busy = mt && brw_bo_busy(mt->bo);
 
-   if (mt && mt->format == MESA_FORMAT_S_UINT8)
-  mt->r8stencil_needs_update = true;
-
if (_mesa_is_bufferobj(packing->BufferObj) || tex_busy ||
mt->aux_usage == ISL_AUX_USAGE_CCS_E) {
   ok = intel_texsubimage_blorp(brw, dims, texImage,
-- 
2.17.0

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


[Mesa-dev] [PATCH 07/13] i965/miptree: Share tiling_flags in miptree_create

2018-06-12 Thread Nanley Chery
---
 src/mesa/drivers/dri/i965/intel_mipmap_tree.c | 15 +++
 1 file changed, 7 insertions(+), 8 deletions(-)

diff --git a/src/mesa/drivers/dri/i965/intel_mipmap_tree.c 
b/src/mesa/drivers/dri/i965/intel_mipmap_tree.c
index ca909c3fab7..03628e3fd9f 100644
--- a/src/mesa/drivers/dri/i965/intel_mipmap_tree.c
+++ b/src/mesa/drivers/dri/i965/intel_mipmap_tree.c
@@ -690,11 +690,16 @@ miptree_create(struct brw_context *brw,
enum intel_miptree_create_flags flags)
 {
const struct gen_device_info *devinfo = &brw->screen->devinfo;
+   isl_tiling_flags_t tiling_flags = ISL_TILING_ANY_MASK;
+
+   /* TODO: This used to be because there wasn't BLORP to handle Y-tiling. */
+   if (devinfo->gen < 6 && _mesa_is_format_color_format(format))
+  tiling_flags &= ~ISL_TILING_Y0_BIT;
 
if (format == MESA_FORMAT_S_UINT8)
   return make_surface(brw, target, format, first_level, last_level,
   width0, height0, depth0, num_samples,
-  ISL_TILING_W_BIT,
+  tiling_flags,
   ISL_SURF_USAGE_STENCIL_BIT |
   ISL_SURF_USAGE_TEXTURE_BIT,
   BO_ALLOC_BUSY,
@@ -712,7 +717,7 @@ miptree_create(struct brw_context *brw,
   struct intel_mipmap_tree *mt = make_surface(
  brw, target, devinfo->gen >= 6 ? depth_only_format : format,
  first_level, last_level,
- width0, height0, depth0, num_samples, ISL_TILING_Y0_BIT,
+ width0, height0, depth0, num_samples, tiling_flags,
  ISL_SURF_USAGE_DEPTH_BIT | ISL_SURF_USAGE_TEXTURE_BIT,
  BO_ALLOC_BUSY, 0, NULL);
 
@@ -739,12 +744,6 @@ miptree_create(struct brw_context *brw,
if (flags & MIPTREE_CREATE_BUSY)
   alloc_flags |= BO_ALLOC_BUSY;
 
-   isl_tiling_flags_t tiling_flags = ISL_TILING_ANY_MASK;
-
-   /* TODO: This used to be because there wasn't BLORP to handle Y-tiling. */
-   if (devinfo->gen < 6)
-  tiling_flags &= ~ISL_TILING_Y0_BIT;
-
struct intel_mipmap_tree *mt = make_surface(
  brw, target, format,
  first_level, last_level,
-- 
2.17.0

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


[Mesa-dev] [PATCH 04/13] i965/draw: Fix adding the stencil bo to the depth cache

2018-06-12 Thread Nanley Chery
Fix the case where only stencil writes are enabled on a depth stencil
texture. Found by inspection.

---

I'm looking into writing a test for this.

 src/mesa/drivers/dri/i965/brw_draw.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/src/mesa/drivers/dri/i965/brw_draw.c 
b/src/mesa/drivers/dri/i965/brw_draw.c
index 271456e0f7d..71461d7b0a7 100644
--- a/src/mesa/drivers/dri/i965/brw_draw.c
+++ b/src/mesa/drivers/dri/i965/brw_draw.c
@@ -623,10 +623,10 @@ brw_postdraw_set_buffers_need_resolve(struct brw_context 
*brw)
}
 
if (stencil_irb && brw->stencil_write_enabled) {
-  brw_depth_cache_add_bo(brw, stencil_irb->mt->bo);
   struct intel_mipmap_tree *stencil_mt =
  stencil_irb->mt->stencil_mt != NULL ?
  stencil_irb->mt->stencil_mt : stencil_irb->mt;
+  brw_depth_cache_add_bo(brw, stencil_mt->bo);
   intel_miptree_finish_write(brw, stencil_mt, stencil_irb->mt_level,
  stencil_irb->mt_layer,
  stencil_irb->layer_count, ISL_AUX_USAGE_NONE);
-- 
2.17.0

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


[Mesa-dev] [PATCH 00/13] Fix stencil texturing and BO caching bugs

2018-06-12 Thread Nanley Chery
This series fixes a couple stencil texturing bugs on HSW and
cache-tracking for certain stencil BOs on all platforms.

Nanley Chery (13):
  i965: Set the r8stencil flag in miptree_finish_write
  i965/miptree: Set the r8stencil flag in map_depthstencil
  i965/draw: Set the r8stencil flag after drawing
  i965/draw: Fix adding the stencil bo to the depth cache
  i965/miptree: Use make_surface in map_blit
  i965/miptree: Delete MIPTREE_CREATE_LINEAR
  i965/miptree: Share tiling_flags in miptree_create
  i965/miptree: Share the miptree format in miptree_create
  i965/miptree: Share alloc_flags in miptree_create
  i965/miptree: Add and use mt_surf_usage
  i965/miptree: Refactor miptree_create
  i965/miptree: Create the r8stencil_mt immediately
  i965/miptree: Inline make_separate_stencil

 src/mesa/drivers/dri/i965/brw_blorp.c |   6 +-
 src/mesa/drivers/dri/i965/brw_clear.c |   8 -
 src/mesa/drivers/dri/i965/brw_draw.c  |  14 +-
 src/mesa/drivers/dri/i965/intel_mipmap_tree.c | 211 --
 src/mesa/drivers/dri/i965/intel_mipmap_tree.h |   5 +-
 src/mesa/drivers/dri/i965/intel_tex_image.c   |   3 -
 6 files changed, 103 insertions(+), 144 deletions(-)

-- 
2.17.0

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


[Mesa-dev] [Bug 34401] glXGetScreenDriver doesn't report the same driver name as used in ~/.drirc

2018-06-12 Thread bugzilla-daemon
https://bugs.freedesktop.org/show_bug.cgi?id=34401
Bug 34401 depends on bug 42035, which changed state.

Bug 42035 Summary: no way to turn off vline wait at runtime
https://bugs.freedesktop.org/show_bug.cgi?id=42035

   What|Removed |Added

 Status|NEW |RESOLVED
 Resolution|--- |INVALID

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


[Mesa-dev] [PATCH 13/13] i965/miptree: Inline make_separate_stencil

2018-06-12 Thread Nanley Chery
Note that the separate stencil miptree now has the same alloc_flag as
the depth component.
---
 src/mesa/drivers/dri/i965/intel_mipmap_tree.c | 29 ---
 1 file changed, 6 insertions(+), 23 deletions(-)

diff --git a/src/mesa/drivers/dri/i965/intel_mipmap_tree.c 
b/src/mesa/drivers/dri/i965/intel_mipmap_tree.c
index 6311b2257db..d9251967876 100644
--- a/src/mesa/drivers/dri/i965/intel_mipmap_tree.c
+++ b/src/mesa/drivers/dri/i965/intel_mipmap_tree.c
@@ -664,28 +664,6 @@ fail:
return NULL;
 }
 
-static bool
-make_separate_stencil_surface(struct brw_context *brw,
-  struct intel_mipmap_tree *mt)
-{
-   mt->stencil_mt = make_surface(brw, mt->target, MESA_FORMAT_S_UINT8,
- 0, mt->surf.levels - 1,
- mt->surf.logical_level0_px.width,
- mt->surf.logical_level0_px.height,
- mt->surf.dim == ISL_SURF_DIM_3D ?
-mt->surf.logical_level0_px.depth :
-mt->surf.logical_level0_px.array_len,
- mt->surf.samples, ISL_TILING_W_BIT,
- ISL_SURF_USAGE_STENCIL_BIT |
- ISL_SURF_USAGE_TEXTURE_BIT,
- BO_ALLOC_BUSY, 0, NULL);
-
-   if (!mt->stencil_mt)
-  return false;
-
-   return true;
-}
-
 /* Return the usual surface usage flags for the given format. */
 static isl_surf_usage_flags_t
 mt_surf_usage(mesa_format format)
@@ -745,7 +723,12 @@ miptree_create(struct brw_context *brw,
   return NULL;
 
if (needs_separate_stencil(brw, mt, format)) {
-  if (!make_separate_stencil_surface(brw, mt)) {
+  mt->stencil_mt =
+ make_surface(brw, target, MESA_FORMAT_S_UINT8, first_level, 
last_level,
+  width0, height0, depth0, num_samples,
+  ISL_TILING_W_BIT, mt_surf_usage(MESA_FORMAT_S_UINT8),
+  alloc_flags, 0, NULL);
+  if (mt->stencil_mt == NULL) {
  intel_miptree_release(&mt);
  return NULL;
   }
-- 
2.17.0

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


[Mesa-dev] [PATCH 05/13] i965/miptree: Use make_surface in map_blit

2018-06-12 Thread Nanley Chery
Do this so that we don't have to special case linearly-tiled depth
buffers in miptree_create.
---
 src/mesa/drivers/dri/i965/intel_mipmap_tree.c | 12 ++--
 1 file changed, 6 insertions(+), 6 deletions(-)

diff --git a/src/mesa/drivers/dri/i965/intel_mipmap_tree.c 
b/src/mesa/drivers/dri/i965/intel_mipmap_tree.c
index c7efcad3420..2f7d648ec72 100644
--- a/src/mesa/drivers/dri/i965/intel_mipmap_tree.c
+++ b/src/mesa/drivers/dri/i965/intel_mipmap_tree.c
@@ -3123,12 +3123,12 @@ intel_miptree_map_blit(struct brw_context *brw,
   unsigned int level, unsigned int slice)
 {
const struct gen_device_info *devinfo = &brw->screen->devinfo;
-   map->linear_mt = intel_miptree_create(brw, GL_TEXTURE_2D, mt->format,
- /* first_level */ 0,
- /* last_level */ 0,
- map->w, map->h, 1,
- /* samples */ 1,
- MIPTREE_CREATE_LINEAR);
+   map->linear_mt = make_surface(brw, GL_TEXTURE_2D, mt->format,
+ 0, 0, map->w, map->h, 1, 1,
+ ISL_TILING_LINEAR_BIT,
+ ISL_SURF_USAGE_RENDER_TARGET_BIT |
+ ISL_SURF_USAGE_TEXTURE_BIT,
+ 0, 0, NULL);
 
if (!map->linear_mt) {
   fprintf(stderr, "Failed to allocate blit temporary\n");
-- 
2.17.0

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


[Mesa-dev] [PATCH 02/13] i965/miptree: Set the r8stencil flag in map_depthstencil

2018-06-12 Thread Nanley Chery
Found by initializing the r8stencil_needs_update to false in
make_separate_stencil_surface.

Prevents regressing the piglit test arb_stencil_texturing-draw, later on
in the series.

Cc: Jordan Justen 
---
 src/mesa/drivers/dri/i965/intel_mipmap_tree.c | 4 +++-
 1 file changed, 3 insertions(+), 1 deletion(-)

diff --git a/src/mesa/drivers/dri/i965/intel_mipmap_tree.c 
b/src/mesa/drivers/dri/i965/intel_mipmap_tree.c
index 765a830a6aa..c7efcad3420 100644
--- a/src/mesa/drivers/dri/i965/intel_mipmap_tree.c
+++ b/src/mesa/drivers/dri/i965/intel_mipmap_tree.c
@@ -3474,7 +3474,9 @@ intel_miptree_map_depthstencil(struct brw_context *brw,
if (!map->buffer)
   return;
 
-   intel_miptree_access_raw(brw, mt, level, slice,
+   intel_miptree_access_raw(brw, z_mt, level, slice,
+map->mode & GL_MAP_WRITE_BIT);
+   intel_miptree_access_raw(brw, s_mt, level, slice,
 map->mode & GL_MAP_WRITE_BIT);
 
/* One of either READ_BIT or WRITE_BIT or both is set.  READ_BIT implies no
-- 
2.17.0

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


[Mesa-dev] [PATCH 03/13] i965/draw: Set the r8stencil flag after drawing

2018-06-12 Thread Nanley Chery
Fixes the regresion introduced with commit
bdbb527a65fc729e7a9319ae67de60d03d06c3fd
"i965: Use ISL for emitting depth/stencil/hiz state on gen6+"

Found by inspection.

Prevents regressing the piglit test, fbo-depth-array stencil-draw, later
on in this series.

Cc: Jason Ekstrand 
---
 src/mesa/drivers/dri/i965/brw_draw.c | 12 +++-
 1 file changed, 11 insertions(+), 1 deletion(-)

diff --git a/src/mesa/drivers/dri/i965/brw_draw.c 
b/src/mesa/drivers/dri/i965/brw_draw.c
index 18aa12feaef..271456e0f7d 100644
--- a/src/mesa/drivers/dri/i965/brw_draw.c
+++ b/src/mesa/drivers/dri/i965/brw_draw.c
@@ -576,6 +576,9 @@ brw_predraw_resolve_framebuffer(struct brw_context *brw,
  * If the depth buffer was written to and if it has an accompanying HiZ
  * buffer, then mark that it needs a depth resolve.
  *
+ * If the stencil buffer was written to then mark that it may need to be
+ * copied to an R8 texture.
+ *
  * If the color buffer is a multisample window system buffer, then
  * mark that it needs a downsample.
  *
@@ -619,8 +622,15 @@ brw_postdraw_set_buffers_need_resolve(struct brw_context 
*brw)
  brw_depth_cache_add_bo(brw, depth_irb->mt->bo);
}
 
-   if (stencil_irb && brw->stencil_write_enabled)
+   if (stencil_irb && brw->stencil_write_enabled) {
   brw_depth_cache_add_bo(brw, stencil_irb->mt->bo);
+  struct intel_mipmap_tree *stencil_mt =
+ stencil_irb->mt->stencil_mt != NULL ?
+ stencil_irb->mt->stencil_mt : stencil_irb->mt;
+  intel_miptree_finish_write(brw, stencil_mt, stencil_irb->mt_level,
+ stencil_irb->mt_layer,
+ stencil_irb->layer_count, ISL_AUX_USAGE_NONE);
+   }
 
for (unsigned i = 0; i < fb->_NumColorDrawBuffers; i++) {
   struct intel_renderbuffer *irb =
-- 
2.17.0

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


[Mesa-dev] [PATCH 12/13] i965/miptree: Create the r8stencil_mt immediately

2018-06-12 Thread Nanley Chery
The current behavior masked two bugs where the flag was not set to true
 after modifying the stencil texture. One case was a regression
introduced with commit bdbb527a65fc729e7a9319ae67de60d03d06c3fd and
another was a bug in the depthstencil mapping code. These have since
been fixed.

To prevent such bugs from being masked in the future, create the
texturing miptree immediately.

Note that the r8stencil_mt is now created with
ISL_SURF_USAGE_RENDER_TARGET_BIT. This is appropriate because it is
used as blit destination during the update process.

Also note that we now properly handle the case in which make_surface
fails.
---
 src/mesa/drivers/dri/i965/intel_mipmap_tree.c | 47 ++-
 1 file changed, 25 insertions(+), 22 deletions(-)

diff --git a/src/mesa/drivers/dri/i965/intel_mipmap_tree.c 
b/src/mesa/drivers/dri/i965/intel_mipmap_tree.c
index b078c759243..6311b2257db 100644
--- a/src/mesa/drivers/dri/i965/intel_mipmap_tree.c
+++ b/src/mesa/drivers/dri/i965/intel_mipmap_tree.c
@@ -354,6 +354,17 @@ needs_separate_stencil(const struct brw_context *brw,
   intel_miptree_supports_hiz(brw, mt);
 }
 
+static bool
+needs_r8stencil(const struct brw_context *brw,
+mesa_format format)
+{
+   const struct gen_device_info *devinfo = &brw->screen->devinfo;
+   const GLenum base_fmt = _mesa_get_format_base_format(format);
+
+   return (base_fmt == GL_STENCIL_INDEX ||
+   base_fmt == GL_DEPTH_STENCIL) && devinfo->gen == 7;
+}
+
 /**
  * Choose the aux usage for this miptree.  This function must be called fairly
  * late in the miptree create process after we have a tiling.
@@ -672,8 +683,6 @@ make_separate_stencil_surface(struct brw_context *brw,
if (!mt->stencil_mt)
   return false;
 
-   mt->stencil_mt->r8stencil_needs_update = true;
-
return true;
 }
 
@@ -742,6 +751,18 @@ miptree_create(struct brw_context *brw,
   }
}
 
+   if (needs_r8stencil(brw, format)) {
+  mt->r8stencil_mt =
+ make_surface(brw, target, MESA_FORMAT_R_UINT8, first_level, 
last_level,
+  width0, height0, depth0, num_samples,
+  ISL_TILING_Y0_BIT, mt_surf_usage(MESA_FORMAT_R_UINT8),
+  BO_ALLOC_BUSY, 0, NULL);
+  if (mt->r8stencil_mt == NULL) {
+ intel_miptree_release(&mt);
+ return NULL;
+  }
+   }
+
if (_mesa_is_format_color_format(format) && mt_fmt != format)
   mt->etc_format = format;
 
@@ -2934,32 +2955,14 @@ intel_update_r8stencil(struct brw_context *brw,
 {
const struct gen_device_info *devinfo = &brw->screen->devinfo;
 
-   assert(devinfo->gen >= 7);
+   assert(devinfo->gen > 6); /* Handle MIPTREE_LAYOUT_GEN6_HIZ_STENCIL */
struct intel_mipmap_tree *src =
   mt->format == MESA_FORMAT_S_UINT8 ? mt : mt->stencil_mt;
if (!src || devinfo->gen >= 8 || !src->r8stencil_needs_update)
   return;
 
assert(src->surf.size > 0);
-
-   if (!mt->r8stencil_mt) {
-  assert(devinfo->gen > 6); /* Handle MIPTREE_LAYOUT_GEN6_HIZ_STENCIL */
-  mt->r8stencil_mt = make_surface(
-brw,
-src->target,
-MESA_FORMAT_R_UINT8,
-src->first_level, src->last_level,
-src->surf.logical_level0_px.width,
-src->surf.logical_level0_px.height,
-src->surf.dim == ISL_SURF_DIM_3D ?
-   src->surf.logical_level0_px.depth :
-   src->surf.logical_level0_px.array_len,
-src->surf.samples,
-ISL_TILING_Y0_BIT,
-ISL_SURF_USAGE_TEXTURE_BIT,
-BO_ALLOC_BUSY, 0, NULL);
-  assert(mt->r8stencil_mt);
-   }
+   assert(mt->r8stencil_mt);
 
struct intel_mipmap_tree *dst = mt->r8stencil_mt;
 
-- 
2.17.0

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


[Mesa-dev] [PATCH 08/13] i965/miptree: Share the miptree format in miptree_create

2018-06-12 Thread Nanley Chery
---
 src/mesa/drivers/dri/i965/intel_mipmap_tree.c | 30 +--
 1 file changed, 15 insertions(+), 15 deletions(-)

diff --git a/src/mesa/drivers/dri/i965/intel_mipmap_tree.c 
b/src/mesa/drivers/dri/i965/intel_mipmap_tree.c
index 03628e3fd9f..97de30076e0 100644
--- a/src/mesa/drivers/dri/i965/intel_mipmap_tree.c
+++ b/src/mesa/drivers/dri/i965/intel_mipmap_tree.c
@@ -696,8 +696,19 @@ miptree_create(struct brw_context *brw,
if (devinfo->gen < 6 && _mesa_is_format_color_format(format))
   tiling_flags &= ~ISL_TILING_Y0_BIT;
 
+   mesa_format mt_fmt;
+   if (_mesa_is_format_color_format(format)) {
+  mt_fmt = intel_lower_compressed_format(brw, format);
+   } else {
+  /* Fix up the Z miptree format for how we're splitting out separate
+   * stencil. Gen7 expects there to be no stencil bits in its depth buffer.
+   */
+  mt_fmt = (devinfo->gen < 6) ? format :
+   intel_depth_format_for_depthstencil_format(format);
+   }
+
if (format == MESA_FORMAT_S_UINT8)
-  return make_surface(brw, target, format, first_level, last_level,
+  return make_surface(brw, target, mt_fmt, first_level, last_level,
   width0, height0, depth0, num_samples,
   tiling_flags,
   ISL_SURF_USAGE_STENCIL_BIT |
@@ -709,13 +720,8 @@ miptree_create(struct brw_context *brw,
const GLenum base_format = _mesa_get_format_base_format(format);
if ((base_format == GL_DEPTH_COMPONENT ||
 base_format == GL_DEPTH_STENCIL)) {
-  /* Fix up the Z miptree format for how we're splitting out separate
-   * stencil.  Gen7 expects there to be no stencil bits in its depth 
buffer.
-   */
-  const mesa_format depth_only_format =
- intel_depth_format_for_depthstencil_format(format);
   struct intel_mipmap_tree *mt = make_surface(
- brw, target, devinfo->gen >= 6 ? depth_only_format : format,
+ brw, target, mt_fmt,
  first_level, last_level,
  width0, height0, depth0, num_samples, tiling_flags,
  ISL_SURF_USAGE_DEPTH_BIT | ISL_SURF_USAGE_TEXTURE_BIT,
@@ -733,19 +739,13 @@ miptree_create(struct brw_context *brw,
   return mt;
}
 
-   mesa_format tex_format = format;
-   mesa_format etc_format = MESA_FORMAT_NONE;
uint32_t alloc_flags = 0;
 
-   format = intel_lower_compressed_format(brw, format);
-
-   etc_format = (format != tex_format) ? tex_format : MESA_FORMAT_NONE;
-
if (flags & MIPTREE_CREATE_BUSY)
   alloc_flags |= BO_ALLOC_BUSY;
 
struct intel_mipmap_tree *mt = make_surface(
- brw, target, format,
+ brw, target, mt_fmt,
  first_level, last_level,
  width0, height0, depth0,
  num_samples, tiling_flags,
@@ -755,7 +755,7 @@ miptree_create(struct brw_context *brw,
if (!mt)
   return NULL;
 
-   mt->etc_format = etc_format;
+   mt->etc_format = (mt_fmt != format) ? format : MESA_FORMAT_NONE;
 
if (!(flags & MIPTREE_CREATE_NO_AUX))
   intel_miptree_choose_aux_usage(brw, mt);
-- 
2.17.0

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


[Mesa-dev] [PATCH 11/13] i965/miptree: Refactor miptree_create

2018-06-12 Thread Nanley Chery
Enable a future patch to create the r8stencil_mt in this function.
---
 src/mesa/drivers/dri/i965/intel_mipmap_tree.c | 48 +--
 1 file changed, 12 insertions(+), 36 deletions(-)

diff --git a/src/mesa/drivers/dri/i965/intel_mipmap_tree.c 
b/src/mesa/drivers/dri/i965/intel_mipmap_tree.c
index 5e00da86d32..b078c759243 100644
--- a/src/mesa/drivers/dri/i965/intel_mipmap_tree.c
+++ b/src/mesa/drivers/dri/i965/intel_mipmap_tree.c
@@ -726,48 +726,24 @@ miptree_create(struct brw_context *brw,
intel_depth_format_for_depthstencil_format(format);
}
 
-   if (format == MESA_FORMAT_S_UINT8)
-  return make_surface(brw, target, mt_fmt, first_level, last_level,
-  width0, height0, depth0, num_samples,
-  tiling_flags,
-  mt_surf_usage(mt_fmt),
-  alloc_flags,
-  0,
-  NULL);
+   struct intel_mipmap_tree *mt =
+  make_surface(brw, target, mt_fmt, first_level, last_level,
+   width0, height0, depth0, num_samples,
+   tiling_flags, mt_surf_usage(mt_fmt),
+   alloc_flags, 0, NULL);
 
-   const GLenum base_format = _mesa_get_format_base_format(format);
-   if ((base_format == GL_DEPTH_COMPONENT ||
-base_format == GL_DEPTH_STENCIL)) {
-  struct intel_mipmap_tree *mt = make_surface(
- brw, target, mt_fmt,
- first_level, last_level,
- width0, height0, depth0, num_samples, tiling_flags,
- mt_surf_usage(mt_fmt),
- alloc_flags, 0, NULL);
-
-  if (needs_separate_stencil(brw, mt, format) &&
-  !make_separate_stencil_surface(brw, mt)) {
+   if (mt == NULL)
+  return NULL;
+
+   if (needs_separate_stencil(brw, mt, format)) {
+  if (!make_separate_stencil_surface(brw, mt)) {
  intel_miptree_release(&mt);
  return NULL;
   }
-
-  if (!(flags & MIPTREE_CREATE_NO_AUX))
- intel_miptree_choose_aux_usage(brw, mt);
-
-  return mt;
}
 
-   struct intel_mipmap_tree *mt = make_surface(
- brw, target, mt_fmt,
- first_level, last_level,
- width0, height0, depth0,
- num_samples, tiling_flags,
- mt_surf_usage(mt_fmt),
- alloc_flags, 0, NULL);
-   if (!mt)
-  return NULL;
-
-   mt->etc_format = (mt_fmt != format) ? format : MESA_FORMAT_NONE;
+   if (_mesa_is_format_color_format(format) && mt_fmt != format)
+  mt->etc_format = format;
 
if (!(flags & MIPTREE_CREATE_NO_AUX))
   intel_miptree_choose_aux_usage(brw, mt);
-- 
2.17.0

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


[Mesa-dev] [PATCH 09/13] i965/miptree: Share alloc_flags in miptree_create

2018-06-12 Thread Nanley Chery
---
 src/mesa/drivers/dri/i965/intel_mipmap_tree.c | 11 ---
 1 file changed, 4 insertions(+), 7 deletions(-)

diff --git a/src/mesa/drivers/dri/i965/intel_mipmap_tree.c 
b/src/mesa/drivers/dri/i965/intel_mipmap_tree.c
index 97de30076e0..cfb83d15ecc 100644
--- a/src/mesa/drivers/dri/i965/intel_mipmap_tree.c
+++ b/src/mesa/drivers/dri/i965/intel_mipmap_tree.c
@@ -690,6 +690,8 @@ miptree_create(struct brw_context *brw,
enum intel_miptree_create_flags flags)
 {
const struct gen_device_info *devinfo = &brw->screen->devinfo;
+   const uint32_t alloc_flags = (flags & MIPTREE_CREATE_BUSY) ?
+BO_ALLOC_BUSY : 0;
isl_tiling_flags_t tiling_flags = ISL_TILING_ANY_MASK;
 
/* TODO: This used to be because there wasn't BLORP to handle Y-tiling. */
@@ -713,7 +715,7 @@ miptree_create(struct brw_context *brw,
   tiling_flags,
   ISL_SURF_USAGE_STENCIL_BIT |
   ISL_SURF_USAGE_TEXTURE_BIT,
-  BO_ALLOC_BUSY,
+  alloc_flags,
   0,
   NULL);
 
@@ -725,7 +727,7 @@ miptree_create(struct brw_context *brw,
  first_level, last_level,
  width0, height0, depth0, num_samples, tiling_flags,
  ISL_SURF_USAGE_DEPTH_BIT | ISL_SURF_USAGE_TEXTURE_BIT,
- BO_ALLOC_BUSY, 0, NULL);
+ alloc_flags, 0, NULL);
 
   if (needs_separate_stencil(brw, mt, format) &&
   !make_separate_stencil_surface(brw, mt)) {
@@ -739,11 +741,6 @@ miptree_create(struct brw_context *brw,
   return mt;
}
 
-   uint32_t alloc_flags = 0;
-
-   if (flags & MIPTREE_CREATE_BUSY)
-  alloc_flags |= BO_ALLOC_BUSY;
-
struct intel_mipmap_tree *mt = make_surface(
  brw, target, mt_fmt,
  first_level, last_level,
-- 
2.17.0

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


[Mesa-dev] [PATCH 06/13] i965/miptree: Delete MIPTREE_CREATE_LINEAR

2018-06-12 Thread Nanley Chery
This enum constant was introduced to enable blit maps with intel_miptree_create
da2880bea05bfc87109477ab026a7f5401fc8f0c. Now that such maps use the more
direct make_surface function which allows you to specify the tiling directly,
the constant is no longer being used.
---
 src/mesa/drivers/dri/i965/intel_mipmap_tree.c | 11 ++-
 src/mesa/drivers/dri/i965/intel_mipmap_tree.h |  5 +
 2 files changed, 3 insertions(+), 13 deletions(-)

diff --git a/src/mesa/drivers/dri/i965/intel_mipmap_tree.c 
b/src/mesa/drivers/dri/i965/intel_mipmap_tree.c
index 2f7d648ec72..ca909c3fab7 100644
--- a/src/mesa/drivers/dri/i965/intel_mipmap_tree.c
+++ b/src/mesa/drivers/dri/i965/intel_mipmap_tree.c
@@ -703,8 +703,7 @@ miptree_create(struct brw_context *brw,
 
const GLenum base_format = _mesa_get_format_base_format(format);
if ((base_format == GL_DEPTH_COMPONENT ||
-base_format == GL_DEPTH_STENCIL) &&
-   !(flags & MIPTREE_CREATE_LINEAR)) {
+base_format == GL_DEPTH_STENCIL)) {
   /* Fix up the Z miptree format for how we're splitting out separate
* stencil.  Gen7 expects there to be no stencil bits in its depth 
buffer.
*/
@@ -740,8 +739,7 @@ miptree_create(struct brw_context *brw,
if (flags & MIPTREE_CREATE_BUSY)
   alloc_flags |= BO_ALLOC_BUSY;
 
-   isl_tiling_flags_t tiling_flags = (flags & MIPTREE_CREATE_LINEAR) ?
-  ISL_TILING_LINEAR_BIT : ISL_TILING_ANY_MASK;
+   isl_tiling_flags_t tiling_flags = ISL_TILING_ANY_MASK;
 
/* TODO: This used to be because there wasn't BLORP to handle Y-tiling. */
if (devinfo->gen < 6)
@@ -865,11 +863,6 @@ intel_miptree_create_for_bo(struct brw_context *brw,
 */
assert(pitch >= 0);
 
-   /* The BO already has a tiling format and we shouldn't confuse the lower
-* layers by making it try to find a tiling format again.
-*/
-   assert((flags & MIPTREE_CREATE_LINEAR) == 0);
-
mt = make_surface(brw, target, format,
  0, 0, width, height, depth, 1,
  1lu << tiling,
diff --git a/src/mesa/drivers/dri/i965/intel_mipmap_tree.h 
b/src/mesa/drivers/dri/i965/intel_mipmap_tree.h
index ef8f51840cc..7c2341ab431 100644
--- a/src/mesa/drivers/dri/i965/intel_mipmap_tree.h
+++ b/src/mesa/drivers/dri/i965/intel_mipmap_tree.h
@@ -370,16 +370,13 @@ enum intel_miptree_create_flags {
 */
MIPTREE_CREATE_BUSY = 1 << 0,
 
-   /** Create a linear (not tiled) miptree */
-   MIPTREE_CREATE_LINEAR   = 1 << 1,
-
/** Create the miptree with auxiliary compression disabled
 *
 * This does not prevent the caller of intel_miptree_create from coming
 * along later and turning auxiliary compression back on but it does mean
 * that the miptree will be created with mt->aux_usage == NONE.
 */
-   MIPTREE_CREATE_NO_AUX   = 1 << 2,
+   MIPTREE_CREATE_NO_AUX   = 1 << 1,
 };
 
 struct intel_mipmap_tree *intel_miptree_create(struct brw_context *brw,
-- 
2.17.0

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


[Mesa-dev] [PATCH 10/13] i965/miptree: Add and use mt_surf_usage

2018-06-12 Thread Nanley Chery
---
 src/mesa/drivers/dri/i965/intel_mipmap_tree.c | 40 ---
 1 file changed, 26 insertions(+), 14 deletions(-)

diff --git a/src/mesa/drivers/dri/i965/intel_mipmap_tree.c 
b/src/mesa/drivers/dri/i965/intel_mipmap_tree.c
index cfb83d15ecc..5e00da86d32 100644
--- a/src/mesa/drivers/dri/i965/intel_mipmap_tree.c
+++ b/src/mesa/drivers/dri/i965/intel_mipmap_tree.c
@@ -677,6 +677,23 @@ make_separate_stencil_surface(struct brw_context *brw,
return true;
 }
 
+/* Return the usual surface usage flags for the given format. */
+static isl_surf_usage_flags_t
+mt_surf_usage(mesa_format format)
+{
+   switch(_mesa_get_format_base_format(format)) {
+   case GL_DEPTH_COMPONENT:
+  return ISL_SURF_USAGE_DEPTH_BIT | ISL_SURF_USAGE_TEXTURE_BIT;
+   case GL_DEPTH_STENCIL:
+  return ISL_SURF_USAGE_DEPTH_BIT | ISL_SURF_USAGE_STENCIL_BIT |
+ ISL_SURF_USAGE_TEXTURE_BIT;
+   case GL_STENCIL_INDEX:
+  return ISL_SURF_USAGE_STENCIL_BIT | ISL_SURF_USAGE_TEXTURE_BIT;
+   default:
+  return ISL_SURF_USAGE_RENDER_TARGET_BIT | ISL_SURF_USAGE_TEXTURE_BIT;
+   }
+}
+
 static struct intel_mipmap_tree *
 miptree_create(struct brw_context *brw,
GLenum target,
@@ -713,8 +730,7 @@ miptree_create(struct brw_context *brw,
   return make_surface(brw, target, mt_fmt, first_level, last_level,
   width0, height0, depth0, num_samples,
   tiling_flags,
-  ISL_SURF_USAGE_STENCIL_BIT |
-  ISL_SURF_USAGE_TEXTURE_BIT,
+  mt_surf_usage(mt_fmt),
   alloc_flags,
   0,
   NULL);
@@ -726,7 +742,7 @@ miptree_create(struct brw_context *brw,
  brw, target, mt_fmt,
  first_level, last_level,
  width0, height0, depth0, num_samples, tiling_flags,
- ISL_SURF_USAGE_DEPTH_BIT | ISL_SURF_USAGE_TEXTURE_BIT,
+ mt_surf_usage(mt_fmt),
  alloc_flags, 0, NULL);
 
   if (needs_separate_stencil(brw, mt, format) &&
@@ -746,8 +762,7 @@ miptree_create(struct brw_context *brw,
  first_level, last_level,
  width0, height0, depth0,
  num_samples, tiling_flags,
- ISL_SURF_USAGE_RENDER_TARGET_BIT |
- ISL_SURF_USAGE_TEXTURE_BIT,
+ mt_surf_usage(mt_fmt),
  alloc_flags, 0, NULL);
if (!mt)
   return NULL;
@@ -816,12 +831,11 @@ intel_miptree_create_for_bo(struct brw_context *brw,
 
if ((base_format == GL_DEPTH_COMPONENT ||
 base_format == GL_DEPTH_STENCIL)) {
-  const mesa_format depth_only_format =
- intel_depth_format_for_depthstencil_format(format);
-  mt = make_surface(brw, target,
-devinfo->gen >= 6 ? depth_only_format : format,
+  mesa_format mt_fmt = (devinfo->gen < 6) ? format :
+   intel_depth_format_for_depthstencil_format(format);
+  mt = make_surface(brw, target, mt_fmt,
 0, 0, width, height, depth, 1, ISL_TILING_Y0_BIT,
-ISL_SURF_USAGE_DEPTH_BIT | ISL_SURF_USAGE_TEXTURE_BIT,
+mt_surf_usage(mt_fmt),
 0, pitch, bo);
   if (!mt)
  return NULL;
@@ -836,8 +850,7 @@ intel_miptree_create_for_bo(struct brw_context *brw,
   mt = make_surface(brw, target, MESA_FORMAT_S_UINT8,
 0, 0, width, height, depth, 1,
 ISL_TILING_W_BIT,
-ISL_SURF_USAGE_STENCIL_BIT |
-ISL_SURF_USAGE_TEXTURE_BIT,
+mt_surf_usage(MESA_FORMAT_S_UINT8),
 0, pitch, bo);
   if (!mt)
  return NULL;
@@ -862,8 +875,7 @@ intel_miptree_create_for_bo(struct brw_context *brw,
mt = make_surface(brw, target, format,
  0, 0, width, height, depth, 1,
  1lu << tiling,
- ISL_SURF_USAGE_RENDER_TARGET_BIT |
- ISL_SURF_USAGE_TEXTURE_BIT,
+ mt_surf_usage(format),
  0, pitch, bo);
if (!mt)
   return NULL;
-- 
2.17.0

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


Re: [Mesa-dev] [PATCH 1/2] mesa : MESA_framebuffer_flip_y extension

2018-06-12 Thread Chad Versace
On Thu 07 Jun 2018, Fritz Koenig wrote:
> Adds an extension to glFramebufferParameteri
> that will specify if the framebuffer is vertically
> flipped. Historically system framebuffers are
> vertically flipped and user framebuffers are not.
> Checking to see the state was done by looking at
> the name field.  This adds an explicit field.
> ---
>  docs/specs/MESA_framebuffer_flip_y.spec | 59 +
>  include/GLES2/gl2ext.h  |  5 +++
>  src/mapi/glapi/registry/gl.xml  |  6 +++
>  src/mesa/main/extensions_table.h|  1 +
>  src/mesa/main/fbobject.c|  8 
>  src/mesa/main/framebuffer.c |  1 +
>  src/mesa/main/glheader.h|  3 ++
>  src/mesa/main/mtypes.h  |  4 ++
>  8 files changed, 87 insertions(+)
>  create mode 100644 docs/specs/MESA_framebuffer_flip_y.spec
> 
> diff --git a/docs/specs/MESA_framebuffer_flip_y.spec 
> b/docs/specs/MESA_framebuffer_flip_y.spec
> new file mode 100644
> index 00..b9867e0683
> --- /dev/null
> +++ b/docs/specs/MESA_framebuffer_flip_y.spec
> @@ -0,0 +1,59 @@
> +Name
> +
> +MESA_framebuffer_flip_y
> +
> +Name Strings
> +
> +GL_MESA_framebuffer_flip_y
> +
> +Contact
> +
> +Fritz Koenig 
> +
> +Status
> +
> +Proposal
> +
> +Version
> +
> +Version 1, June 7, 2018
> +
> +Number
> +
> +TBD
> +
> +Dependencies
> +
> +OpenGLES 3.1 is required.

In specs, s/OpenGLES/OpenGL ES/.

> +
> +Overview
> +
> +This extension adds the ability to specify that the internal framebuffer
> +object is vertically flipped.

Questions:

  a. Is it legal to set and/or query GL_FRAMEBUFFER_FLIP_Y_MESA on the
 default framebuffer (that is, the winsys framebuffer)?
  b. If (a) is legal, then the default framebuffer's initial value of
 GL_FRAMEBUFFER_FLIP_Y_MESA is ambiguous. Does the spec define it
 to be GL_TRUE or GL_FALSE? (I assume the answer is GL_TRUE based on
 the patch's code).

The patch seems to allow toggling the state of winsys framebuffers,
but I was unsure if that decision was intentional.

> +New Tokens
> +
> +Accepted by the  argument of FramebufferParameteri:
> +
> +GL_FRAMEBUFFER_FLIP_Y_EXT   0x8BBB

... and GetFramebufferParameteriv.

> +
> +Revision History
> +
> +Version 1, June, 2018
> +Initial draft (Fritz Koenig)
> diff --git a/include/GLES2/gl2ext.h b/include/GLES2/gl2ext.h
> index a7d19a1fc8..7fb5e9ca5f 100644
> --- a/include/GLES2/gl2ext.h
> +++ b/include/GLES2/gl2ext.h
> @@ -2334,6 +2334,11 @@ GL_APICALL void GL_APIENTRY glGetPerfQueryInfoINTEL 
> (GLuint queryId, GLuint quer
>  #endif
>  #endif /* GL_INTEL_performance_query */
>  
> +#ifndef GL_MESA_framebuffer_flip_y
> +#define GL_MESA_framebuffer_flip_y 1
> +#define GL_FRAMEBUFFER_FLIP_Y_EXT 0x8BBB
> +#endif /* GL_MESA_framebuffer_flip_y */
> +
>  #ifndef GL_MESA_program_binary_formats
>  #define GL_MESA_program_binary_formats 1
>  #define GL_PROGRAM_BINARY_FORMAT_MESA 0x875F
> diff --git a/src/mapi/glapi/registry/gl.xml b/src/mapi/glapi/registry/gl.xml
> index 833478aa51..3a3d4f3d81 100644
> --- a/src/mapi/glapi/registry/gl.xml
> +++ b/src/mapi/glapi/registry/gl.xml
> @@ -6568,6 +6568,7 @@ typedef unsigned int GLhandleARB;
>  
>  
>  
> +
>  
>  
>   comment="Reassigned from AMD to QCOM">
> @@ -44356,6 +44357,11 @@ typedef unsigned int GLhandleARB;
>  
>  
>  
> +
> +
> +
> +
> +
>  
>  
>  
> diff --git a/src/mesa/main/extensions_table.h 
> b/src/mesa/main/extensions_table.h
> index 79ef228b69..03a5c7b345 100644
> --- a/src/mesa/main/extensions_table.h
> +++ b/src/mesa/main/extensions_table.h
> @@ -322,6 +322,7 @@ EXT(KHR_texture_compression_astc_hdr, 
> KHR_texture_compression_astc_hdr
>  EXT(KHR_texture_compression_astc_ldr, 
> KHR_texture_compression_astc_ldr   , GLL, GLC,  x , ES2, 2012)
>  EXT(KHR_texture_compression_astc_sliced_3d  , 
> KHR_texture_compression_astc_sliced_3d , GLL, GLC,  x , ES2, 2015)
>  
> +EXT(MESA_framebuffer_flip_y , MESA_framebuffer_flip_y
> ,   x,   x,  x , ES2, 2018)

Since the extension requires GLES 3.1, this row should have s/ES2/31/.

>  EXT(MESA_pack_invert, MESA_pack_invert   
> , GLL, GLC,  x ,  x , 2002)
>  EXT(MESA_shader_integer_functions   , MESA_shader_integer_functions  
> , GLL, GLC,  x ,  30, 2016)
>  EXT(MESA_texture_signed_rgba, EXT_texture_snorm  
> , GLL, GLC,  x ,  x , 2009)
> diff --git a/src/mesa/main/fbobject.c b/src/mesa/main/fbobject.c
> index a63e8b8de5..efa000ede7 100644
> --- a/src/mesa/main/fbobject.c
> +++ b/src/mesa/main/fbobject.c
> @@ -1448,6 +1448,14 @@ framebuffer_parameteri(struct gl_context *ctx, struct 
> gl_framebuffer *fb,
>

[Mesa-dev] [PATCH] intel/aubinator: Use int to store getopt_long flags.

2018-06-12 Thread Rafael Antognolli
getopt_long flag parameter is an int pointer, so if we use bool to store
those values, when getopt_long writes to one of them, it might end up
overwriting the next one.
---
 src/intel/tools/aubinator.c | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

diff --git a/src/intel/tools/aubinator.c b/src/intel/tools/aubinator.c
index 930cc92f132..9c14a9d4c97 100644
--- a/src/intel/tools/aubinator.c
+++ b/src/intel/tools/aubinator.c
@@ -71,8 +71,8 @@ memfd_create(const char *name, unsigned int flags)
 
 /* options */
 
-static bool option_full_decode = true;
-static bool option_print_offsets = true;
+static int option_full_decode = true;
+static int option_print_offsets = true;
 static int max_vbo_lines = -1;
 static enum { COLOR_AUTO, COLOR_ALWAYS, COLOR_NEVER } option_color;
 
-- 
2.14.3

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


Re: [Mesa-dev] [PATCH v4 000/129] nir: Move to using instructions for derefs

2018-06-12 Thread Kenneth Graunke
On Thursday, May 31, 2018 10:01:43 PM PDT Jason Ekstrand wrote:
> Ideally, I'd like the series to get some amount of real review before it
> lands.  Honestly, it's been baking long enough and tested by enough people
> on enough drivers that we can probably throw a bunch of Acked-by and
> Tested-bys on it and call it a day but I'd rather not.  I plan to review
> all of the patches I didn't write but that will have to wait until
> tomorrow.
> 
> At the very least, I'd like some sort of an ACK from a variety of the
> people that use NIR on the core concept and the sort of general shape of
> things at the end of the series.  A lot of work has gone into this but it's
> also a big change and the more positive feedback it gets, the more
> comfortable I'll be pulling the trigger.

Patches 1-28 are
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


Re: [Mesa-dev] [PATCH 2/2] nir: add lowering for gl_HelperInvocation

2018-06-12 Thread Jason Ekstrand
On Tue, Jun 12, 2018 at 10:49 AM, Rob Clark  wrote:

> On Mon, Jun 11, 2018 at 10:59 PM, Roland Scheidegger 
> wrote:
> > Am 12.06.2018 um 01:17 schrieb Rob Clark:
> >> On Mon, Jun 11, 2018 at 6:59 PM, Roland Scheidegger 
> wrote:
> >>> Am 12.06.2018 um 00:32 schrieb Jason Ekstrand:
>  On Wed, Jun 6, 2018 at 7:43 AM, Rob Clark   > wrote:
> 
>  Signed-off-by: Rob Clark   >
>  ---
>  I can't say for sure that this will work on all drivers, but it is
>  what the blob driver does, and it seems to make deqp happy.  I
> could
>  move this to it's own pass inside ir3, but that seemed like
> overkill
> 
>   src/compiler/nir/nir.h  | 10 ++
>   src/compiler/nir/nir_lower_system_values.c  | 17
> +
>   src/gallium/drivers/freedreno/ir3/ir3_nir.c |  1 +
>   3 files changed, 28 insertions(+)
> 
>  diff --git a/src/compiler/nir/nir.h b/src/compiler/nir/nir.h
>  index 073ab4e82ea..de3d55d83af 100644
>  --- a/src/compiler/nir/nir.h
>  +++ b/src/compiler/nir/nir.h
>  @@ -1963,6 +1963,16 @@ typedef struct nir_shader_compiler_options
> {
>   */
>  bool lower_base_vertex;
> 
>  +   /**
>  +* If enabled, gl_HelperInvocation will be lowered as:
>  +*
>  +*   !((1 << gl_SampleID) & gl_SampleMaskIN[0]))
> 
> 
>  This only works for multi-sampling.  What about the single-sampled
> case?
> >>> It doesn't make sense to me for msaa neither.
> >>> gl_SampleID forces per-sample execution, which clearly isn't what you
> >>> want.
> >>
> >> open to suggestions about how to try and force blob to do something
> >> different.. I tried a few things and the blob popped out shader code
> >> that worked the same way in all cases, but ofc I could have missed
> >> something.
> >>
> >>> Plus, gl_SampleMaskIN is specified to only contain bits for the
> >>> current shader invocation, so for msaa with forced per-sample execution
> >>> that would only contain the single bit corresponding to gl_SampleID
> >>> anyway (that is my interpretation at least - I know hw sample mask
> >>> inputs will probably always contains all the bits from rasterization,
> >>> regardless of gl_SampleID), so the "1 << gl_SampleID &" part will do
> >>> nothing at all. So I think that part is more about lowering the hw
> >>> rasterization sample mask to gl_SampleMaskIN rather than lowering to
> >>> gl_HelperInvocation.
> >>> But yes, !gl_SampleMaskIN should give gl_HelperInvocation - I think all
> >>> hw can give you raster sample mask even without msaa but I'm not
> >>> entirely sure if it's guaranteed to work in GL with single sampling
> >>> (similar for sample id, which should just be stuck at 0). But using the
> >>> gl names here looks very, very fishy to me here.
> >>
> >> I *guess* this is relying on behaviour that gl does not guarantee, but
> >> also doesn't prohibit, but the hw happens work that way and it works
> >> out..
> >>
> >> Maybe the answer is to simply better document the assumptions that
> >> this lowering depends on?
> > Well I think if you have a nir shader which uses sample id but is
> > supposed to not be run per-sample that is quite confusing (I'd just
> > assume that adrenos will use sample id 0 just like in single sampled
> > case). Hopefully noone will deduce shader frequency from the nir
> shader...
> > I'm definitely no NIR expert but there's quite a lot of hacky
> > assumptions in there:
> > - sample id in nir doesn't cause per-sample execution (and needs to be 0
> > in case of msaa but no per-sample execution)
> > - sampleMaskIn is available in single-sampled
> > - sampleMaskIn doesn't actually have gl semantics but hw ones (so simply
> > the mask from rasterization, not taking into account the sample id
> > already if there's per-sample execution (for legitimate reasons),
> > although as mentioned I think there's still some debate about this and
> > not all drivers may actually agree what the semantics of it are in case
> > of per-sample execution)
> >
> > As such I'm not sure it really makes sense to do that as a generic
> > lowering pass? Albeit you're quite right that it might work for a lot of
> > hw... But some comments would at the very least imho definitely be
> required.
> >
>
> so I reworded the comment about the enable flag a bit:
>
>/**
> * If enabled, gl_HelperInvocation will be lowered as:
> *
> *   !((1 << sample_id) & sample_mask_in))
> *
> * This depends on some possibly hw implementation details, which may
> * not be true for all hw.  In particular that the FS is only executed
> * for covered samples or for helper invocations.  So, do not blindly
> * enable this option.
> */
>bool lower_helper_invocation;
>
> But I guess I probably do need to introduce a new intrinsic 

Re: [Mesa-dev] [PATCH] intel/aubinator: Use int to store getopt_long flags.

2018-06-12 Thread Rafael Antognolli
On Tue, Jun 12, 2018 at 12:23:17PM -0700, Rafael Antognolli wrote:
> getopt_long flag parameter is an int pointer, so if we use bool to store
> those values, when getopt_long writes to one of them, it might end up
> overwriting the next one.

I forgot to mention in the commit message that without this, sometimes
when I use --no-offsets I also get the equivalent of --headers (no
instructions are decoded, just their name).

> ---
>  src/intel/tools/aubinator.c | 4 ++--
>  1 file changed, 2 insertions(+), 2 deletions(-)
> 
> diff --git a/src/intel/tools/aubinator.c b/src/intel/tools/aubinator.c
> index 930cc92f132..9c14a9d4c97 100644
> --- a/src/intel/tools/aubinator.c
> +++ b/src/intel/tools/aubinator.c
> @@ -71,8 +71,8 @@ memfd_create(const char *name, unsigned int flags)
>  
>  /* options */
>  
> -static bool option_full_decode = true;
> -static bool option_print_offsets = true;
> +static int option_full_decode = true;
> +static int option_print_offsets = true;
>  static int max_vbo_lines = -1;
>  static enum { COLOR_AUTO, COLOR_ALWAYS, COLOR_NEVER } option_color;
>  
> -- 
> 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] Gitlab access to Mesa

2018-06-12 Thread Hota, Alok
Hello,

I created my account on gitlab.fd.o and requested access to the Mesa group. I 
just wanted to follow it up with an email to the list as well.

I will be working specifically on the swr Gallium driver.

-Alok



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


Re: [Mesa-dev] [PATCH] virgl: add ARB_tessellation_shader support.

2018-06-12 Thread Dave Airlie
On 12 June 2018 at 23:25, Elie Tournier  wrote:
> On Fri, Jun 08, 2018 at 03:15:36PM +1000, Dave Airlie wrote:
>> From: Dave Airlie 
>>
>> This should add all the pieces to enable tess shaders on virgl.
>
> Hi
>
> I think that we also need to add the following code:
>
> --- a/src/gallium/drivers/virgl/virgl_winsys.h
> +++ b/src/gallium/drivers/virgl/virgl_winsys.h
> @@ -127,7 +127,7 @@ static inline void virgl_ws_fill_new_caps_defaults(struct 
> virgl_drm_caps *caps)
> caps->caps.v2.max_geom_total_output_components = 1024;
> caps->caps.v2.max_vertex_outputs = 32;
> caps->caps.v2.max_vertex_attribs = 16;
> -   caps->caps.v2.max_shader_patch_varyings = 0;
> +   caps->caps.v2.max_shader_patch_varyings = 30;
> caps->caps.v2.min_texel_offset = -8;
> caps->caps.v2.max_texel_offset = 7;
> caps->caps.v2.min_texture_gather_offset = -8;

Okay I see the problem, if you don't have a qemu/kernel that passes v2
you can see
tess enabled but this var is 0 and messes up the tests. I've been
testing with v2 caps.

I'll incorporate this fix.

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


Re: [Mesa-dev] [PATCH v4 029/129] nir: Support deref instructions in lower_wpos_ytransform

2018-06-12 Thread Kenneth Graunke
On Thursday, May 31, 2018 10:02:12 PM PDT Jason Ekstrand wrote:
> Reviewed-by: Caio Marcelo de Oliveira Filho 
> ---
>  src/compiler/nir/nir_lower_wpos_ytransform.c | 53 
> ++--
>  1 file changed, 42 insertions(+), 11 deletions(-)
> 
> diff --git a/src/compiler/nir/nir_lower_wpos_ytransform.c 
> b/src/compiler/nir/nir_lower_wpos_ytransform.c
> index 9cb5c71..6212702 100644
> --- a/src/compiler/nir/nir_lower_wpos_ytransform.c
> +++ b/src/compiler/nir/nir_lower_wpos_ytransform.c
> @@ -77,11 +77,10 @@ nir_cmp(nir_builder *b, nir_ssa_def *src0, nir_ssa_def 
> *src1, nir_ssa_def *src2)
>  /* see emit_wpos_adjustment() in st_mesa_to_tgsi.c */
>  static void
>  emit_wpos_adjustment(lower_wpos_ytransform_state *state,
> - nir_intrinsic_instr *intr,
> + nir_intrinsic_instr *intr, nir_variable *fragcoord,
>   bool invert, float adjX, float adjY[2])
>  {
> nir_builder *b = &state->b;
> -   nir_variable *fragcoord = intr->variables[0]->var;
> nir_ssa_def *wpostrans, *wpos_temp, *wpos_temp_y, *wpos_input;
>  
> assert(intr->dest.is_ssa);
> @@ -144,10 +143,10 @@ emit_wpos_adjustment(lower_wpos_ytransform_state *state,
>  }
>  
>  static void
> -lower_fragcoord(lower_wpos_ytransform_state *state, nir_intrinsic_instr 
> *intr)
> +lower_fragcoord(lower_wpos_ytransform_state *state,
> +nir_intrinsic_instr *intr, nir_variable *fragcoord)
>  {
> const nir_lower_wpos_ytransform_options *options = state->options;
> -   nir_variable *fragcoord = intr->variables[0]->var;
> float adjX = 0.0f;
> float adjY[2] = { 0.0f, 0.0f };
> bool invert = false;
> @@ -229,7 +228,7 @@ lower_fragcoord(lower_wpos_ytransform_state *state, 
> nir_intrinsic_instr *intr)
>}
> }
>  
> -   emit_wpos_adjustment(state, intr, invert, adjX, adjY);
> +   emit_wpos_adjustment(state, intr, fragcoord, invert, adjX, adjY);
>  }
>  
>  /* turns 'fddy(p)' into 'fddy(fmul(p, transform.x))' */
> @@ -253,7 +252,25 @@ lower_fddy(lower_wpos_ytransform_state *state, 
> nir_alu_instr *fddy)
>fddy->src[0].swizzle[i] = MIN2(i, pt->num_components - 1);
>  }
>  
> -/* Multiply interp_var_at_offset's offset by transform.x to flip it. */
> +/* Multiply interp_deref_at_offset's offset by transform.x to flip it. */
> +static void
> +lower_interp_deref_at_offset(lower_wpos_ytransform_state *state,
> +   nir_intrinsic_instr *interp)
> +{
> +   nir_builder *b = &state->b;
> +   nir_ssa_def *offset;
> +   nir_ssa_def *flip_y;
> +
> +   b->cursor = nir_before_instr(&interp->instr);
> +
> +   offset = nir_ssa_for_src(b, interp->src[1], 2);
> +   flip_y = nir_fmul(b, nir_channel(b, offset, 1),
> +nir_channel(b, get_transform(state), 0));
> +   nir_instr_rewrite_src(&interp->instr, &interp->src[1],
> + nir_src_for_ssa(nir_vec2(b, nir_channel(b, offset, 
> 0),
> + flip_y)));
> +}
> +
>  static void
>  lower_interp_var_at_offset(lower_wpos_ytransform_state *state,
> nir_intrinsic_instr *interp)
> @@ -298,7 +315,21 @@ lower_wpos_ytransform_block(lower_wpos_ytransform_state 
> *state, nir_block *block
> nir_foreach_instr_safe(instr, block) {
>if (instr->type == nir_instr_type_intrinsic) {
>   nir_intrinsic_instr *intr = nir_instr_as_intrinsic(instr);
> - if (intr->intrinsic == nir_intrinsic_load_var) {
> + if (intr->intrinsic == nir_intrinsic_load_deref) {
> +nir_deref_instr *deref = nir_src_as_deref(intr->src[0]);
> +nir_variable *var = nir_deref_instr_get_variable(deref);
> +
> +if ((var->data.mode == nir_var_shader_in &&
> + var->data.location == VARYING_SLOT_POS) ||
> +(var->data.mode == nir_var_system_value &&
> + var->data.location == SYSTEM_VALUE_FRAG_COORD)) {
> +   /* gl_FragCoord should not have array/struct derefs: */
> +   lower_fragcoord(state, intr, var);
> +} else if (var->data.mode == nir_var_system_value &&
> +   var->data.location == SYSTEM_VALUE_SAMPLE_POS) {
> +   lower_load_sample_pos(state, intr);
> +}

Lots of duplication here :(  But I suppose the other case is going away
at the end of the series, so no real point in tidying...

> + } else if (intr->intrinsic == nir_intrinsic_load_var) {
>  nir_deref_var *dvar = intr->variables[0];
>  nir_variable *var = dvar->var;
>  
> @@ -308,16 +339,18 @@ lower_wpos_ytransform_block(lower_wpos_ytransform_state 
> *state, nir_block *block
>   var->data.location == SYSTEM_VALUE_FRAG_COORD)) {
> /* gl_FragCoord should not have array/struct derefs: */
> assert(dvar->deref.child == NULL);
> -   lower_fragcoord(state, intr);
> +   lower_fragco

Re: [Mesa-dev] [PATCH] intel/compiler: Properly consider UBO loads that cross 32B boundaries.

2018-06-12 Thread Rafael Antognolli
On Mon, Jun 11, 2018 at 02:01:49PM -0700, Kenneth Graunke wrote:
> The UBO push analysis pass incorrectly assumed that all values would fit
> within a 32B chunk, and only recorded a bit for the 32B chunk containing
> the starting offset.
> 
> For example, if a UBO contained the following, tightly packed:
> 
>vec4 a;  // [0, 16)
>float b; // [16, 20)
>vec4 c;  // [20, 36)
> 
> then, c would start at offset 20 / 32 = 0 and end at 36 / 32 = 1,
> which means that we ought to record two 32B chunks in the bitfield.
> 
> Similarly, dvec4s would suffer from the same problem.
> ---
>  src/intel/compiler/brw_nir_analyze_ubo_ranges.c | 8 +++-
>  1 file changed, 7 insertions(+), 1 deletion(-)
> 
> diff --git a/src/intel/compiler/brw_nir_analyze_ubo_ranges.c 
> b/src/intel/compiler/brw_nir_analyze_ubo_ranges.c
> index d58fe3dd2e3..6d6ccf73ade 100644
> --- a/src/intel/compiler/brw_nir_analyze_ubo_ranges.c
> +++ b/src/intel/compiler/brw_nir_analyze_ubo_ranges.c
> @@ -141,10 +141,16 @@ analyze_ubos_block(struct ubo_analysis_state *state, 
> nir_block *block)
>   if (offset >= 64)
>  continue;
>  
> + /* The value might span multiple 32-byte chunks. */
> + const int bytes = nir_intrinsic_dest_components(intrin) *
> +   (nir_dest_bit_size(intrin->dest) / 8);
> + const int end = DIV_ROUND_UP(offset_const->u32[0] + bytes, 32);
> + const int regs = end - offset + 1;
> +

But if I understood it correctly, offset is the first 32B chunk within
the UBO block (it's actually an ubo "chunk offset"). And you calculate
bytes by taking the number of components times the size of each
component of the nir_intrinsic_load_ubo instruction (which apparently
supports multiple components). So yeah, this makes sense to me.

Take this review with a grain of salt (assuming what I wrote above is
correct), but this looks simple enough. So it is

Reviewed-by: Rafael Antognolli 

>   /* TODO: should we count uses in loops as higher benefit? */
>  
>   struct ubo_block_info *info = get_block_info(state, block);
> - info->offsets |= 1ull << offset;
> + info->offsets |= ((1ull << regs) - 1) << offset;
>   info->uses[offset]++;
>}
> }
> -- 
> 2.17.0
> 
> ___
> 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] intel/compiler: Properly consider UBO loads that cross 32B boundaries.

2018-06-12 Thread Rafael Antognolli
On Tue, Jun 12, 2018 at 01:38:03PM -0700, Rafael Antognolli wrote:
> On Mon, Jun 11, 2018 at 02:01:49PM -0700, Kenneth Graunke wrote:
> > The UBO push analysis pass incorrectly assumed that all values would fit
> > within a 32B chunk, and only recorded a bit for the 32B chunk containing
> > the starting offset.
> > 
> > For example, if a UBO contained the following, tightly packed:
> > 
> >vec4 a;  // [0, 16)
> >float b; // [16, 20)
> >vec4 c;  // [20, 36)
> > 
> > then, c would start at offset 20 / 32 = 0 and end at 36 / 32 = 1,
> > which means that we ought to record two 32B chunks in the bitfield.
> > 
> > Similarly, dvec4s would suffer from the same problem.
> > ---
> >  src/intel/compiler/brw_nir_analyze_ubo_ranges.c | 8 +++-
> >  1 file changed, 7 insertions(+), 1 deletion(-)
> > 
> > diff --git a/src/intel/compiler/brw_nir_analyze_ubo_ranges.c 
> > b/src/intel/compiler/brw_nir_analyze_ubo_ranges.c
> > index d58fe3dd2e3..6d6ccf73ade 100644
> > --- a/src/intel/compiler/brw_nir_analyze_ubo_ranges.c
> > +++ b/src/intel/compiler/brw_nir_analyze_ubo_ranges.c
> > @@ -141,10 +141,16 @@ analyze_ubos_block(struct ubo_analysis_state *state, 
> > nir_block *block)
> >   if (offset >= 64)
> >  continue;
> >  
> > + /* The value might span multiple 32-byte chunks. */
> > + const int bytes = nir_intrinsic_dest_components(intrin) *
> > +   (nir_dest_bit_size(intrin->dest) / 8);
> > + const int end = DIV_ROUND_UP(offset_const->u32[0] + bytes, 32);
> > + const int regs = end - offset + 1;
> > +
> 
> But if I understood it correctly, offset is the first 32B chunk within

s/But //

> the UBO block (it's actually an ubo "chunk offset"). And you calculate
> bytes by taking the number of components times the size of each
> component of the nir_intrinsic_load_ubo instruction (which apparently
> supports multiple components). So yeah, this makes sense to me.
> 
> Take this review with a grain of salt (assuming what I wrote above is
> correct), but this looks simple enough. So it is
> 
> Reviewed-by: Rafael Antognolli 
> 
> >   /* TODO: should we count uses in loops as higher benefit? */
> >  
> >   struct ubo_block_info *info = get_block_info(state, block);
> > - info->offsets |= 1ull << offset;
> > + info->offsets |= ((1ull << regs) - 1) << offset;
> >   info->uses[offset]++;
> >}
> > }
> > -- 
> > 2.17.0
> > 
> > ___
> > 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 1/2] i965: Rework push constants packets creation.

2018-06-12 Thread Rafael Antognolli
There's a lot of logic on the function that builds the push constants
packets. It reads both the push constants and the UBOs, and tries to
account for some hardware workarounds.

This patch splits the logic to gather the buffers into a function, and
the code to emit the packet to another one, where the hw workaround is
actually implemented. It tries to simplify reading the workaround, and
makes it easier for future platforms to avoid the workaround when it's
not needed anymore.
---
 src/mesa/drivers/dri/i965/genX_state_upload.c | 187 --
 1 file changed, 117 insertions(+), 70 deletions(-)

diff --git a/src/mesa/drivers/dri/i965/genX_state_upload.c 
b/src/mesa/drivers/dri/i965/genX_state_upload.c
index 88fde9d12fd..7976538b865 100644
--- a/src/mesa/drivers/dri/i965/genX_state_upload.c
+++ b/src/mesa/drivers/dri/i965/genX_state_upload.c
@@ -3154,14 +3154,125 @@ UNUSED static const uint32_t push_constant_opcodes[] = 
{
[MESA_SHADER_COMPUTE] = 0,
 };
 
-static void
-genX(upload_push_constant_packets)(struct brw_context *brw)
+struct push_bos {
+   int n;
+   struct {
+  struct brw_address addr;
+  uint32_t length;
+   } buffers[4];
+};
+
+UNUSED static void
+setup_constant_buffers(struct brw_context *brw,
+   struct brw_stage_state *stage_state,
+   gl_shader_stage stage,
+   struct push_bos *push_bos)
 {
-   const struct gen_device_info *devinfo = &brw->screen->devinfo;
struct gl_context *ctx = &brw->ctx;
+   struct gl_program *prog = ctx->_Shader->CurrentProgram[stage];
+
+   if (!stage_state->prog_data)
+  return;
+
+   assert(push_bos && push_bos->n == 0);
+
+   int n = 0;
+   if (stage_state->push_const_size > 0) {
+  push_bos->buffers[n].length = stage_state->push_const_size;
+  push_bos->buffers[n].addr =
+ ro_bo(stage_state->push_const_bo,
+   stage_state->push_const_offset);
+  n++;
+   }
+
+   if (GEN_GEN >= 8 || GEN_IS_HASWELL) {
+  for (int i = 0; i <= 3; i++) {
+ assert(n <= 3);
+
+ const struct brw_ubo_range *range =
+&stage_state->prog_data->ubo_ranges[i];
+
+ if (range->length == 0)
+continue;
+
+ const struct gl_uniform_block *block =
+prog->sh.UniformBlocks[range->block];
+ const struct gl_buffer_binding *binding =
+&ctx->UniformBufferBindings[block->Binding];
+
+ if (binding->BufferObject == ctx->Shared->NullBufferObj) {
+static unsigned msg_id = 0;
+_mesa_gl_debug(ctx, &msg_id, MESA_DEBUG_SOURCE_API,
+   MESA_DEBUG_TYPE_UNDEFINED,
+   MESA_DEBUG_SEVERITY_HIGH,
+   "UBO %d unbound, %s shader uniform data "
+   "will be undefined.",
+   range->block,
+   _mesa_shader_stage_to_string(stage));
+continue;
+ }
 
+ assert(binding->Offset % 32 == 0);
+
+ struct brw_bo *bo = intel_bufferobj_buffer(
+brw, intel_buffer_object(binding->BufferObject),
+binding->Offset, range->length * 32, false);
+
+ /* printf(">>> UBO %p goes to buffer: %d\n", bo, n); */
+ push_bos->buffers[n].length = range->length;
+ push_bos->buffers[n].addr =
+ro_bo(bo, range->start * 32 + binding->Offset);
+ n++;
+  }
+   }
+
+   push_bos->n = n;
+}
+
+UNUSED static void
+emit_push_constant_packet(struct brw_context *brw,
+  struct brw_stage_state *stage_state,
+  gl_shader_stage stage,
+  const struct push_bos *push_bos)
+{
UNUSED uint32_t mocs = GEN_GEN < 8 ? GEN7_MOCS_L3 : 0;
 
+   brw_batch_emit(brw, GENX(3DSTATE_CONSTANT_VS), pkt) {
+  pkt._3DCommandSubOpcode = push_constant_opcodes[stage];
+  if (stage_state->prog_data) {
+#if GEN_GEN >= 8 || GEN_IS_HASWELL
+ /* The Skylake PRM contains the following restriction:
+  *
+  *"The driver must ensure The following case does not occur
+  * without a flush to the 3D engine: 3DSTATE_CONSTANT_* with
+  * buffer 3 read length equal to zero committed followed by a
+  * 3DSTATE_CONSTANT_* with buffer 0 read length not equal to
+  * zero committed."
+  *
+  * To avoid this, we program the buffers in the highest slots.
+  * This way, slot 0 is only used if slot 3 is also used.
+  */
+ int n = push_bos->n;
+ for (int i = 3, j = n - 1; j >= 0; i--, j--) {
+/* printf(">>> assigning address: %p from buffer %d to packet 
%d\n", */
+/*push_bos->buffers[i].addr.bo, i, j); */
+pkt.ConstantBody.ReadLength[i] = push_bos->buffers[j].length;
+pkt.ConstantBody.Buffer[i] = push_bos->buffers[j].addr;
+ }
+#else
+   

[Mesa-dev] [PATCH 2/2] anv: Rework push constant packets.

2018-06-12 Thread Rafael Antognolli
Copying from the i965 change:

There's a lot of logic on the function that builds the push constants
packets. It reads both the push constants and the UBOs, and tries to
account for some hardware workarounds.

This patch splits the logic to gather the buffers into a function, and
the code to emit the packet to another one, where the hw workaround is
actually implemented. It tries to simplify reading the workaround, and
makes it easier for future platforms to avoid the workaround when it's
not needed anymore.
---
 src/intel/vulkan/genX_cmd_buffer.c | 242 ++---
 1 file changed, 144 insertions(+), 98 deletions(-)

diff --git a/src/intel/vulkan/genX_cmd_buffer.c 
b/src/intel/vulkan/genX_cmd_buffer.c
index 97b321ccaeb..67be91e7de8 100644
--- a/src/intel/vulkan/genX_cmd_buffer.c
+++ b/src/intel/vulkan/genX_cmd_buffer.c
@@ -2322,13 +2322,151 @@ cmd_buffer_emit_descriptor_pointers(struct 
anv_cmd_buffer *cmd_buffer,
}
 }
 
-static void
-cmd_buffer_flush_push_constants(struct anv_cmd_buffer *cmd_buffer,
-VkShaderStageFlags dirty_stages)
+struct push_bos {
+   int n;
+   struct {
+  struct anv_address addr;
+  uint32_t length;
+   } buffers[4];
+};
+
+UNUSED static void
+setup_constant_buffers(struct anv_cmd_buffer *cmd_buffer,
+   gl_shader_stage stage,
+   struct push_bos *push_bos)
 {
const struct anv_cmd_graphics_state *gfx_state = &cmd_buffer->state.gfx;
const struct anv_pipeline *pipeline = gfx_state->base.pipeline;
 
+   if (!anv_pipeline_has_stage(pipeline, stage))
+  return;
+
+   assert(push_bos && push_bos->n == 0);
+
+   const struct brw_stage_prog_data *prog_data =
+  pipeline->shaders[stage]->prog_data;
+   const struct anv_pipeline_bind_map *bind_map =
+  &pipeline->shaders[stage]->bind_map;
+
+   int n = 0;
+
+   struct anv_state state =
+  anv_cmd_buffer_push_constants(cmd_buffer, stage);
+
+   if (state.alloc_size > 0) {
+  push_bos->buffers[n].addr.offset = state.offset;
+  push_bos->buffers[n].addr.bo = GEN_GEN >= 8 || GEN_IS_HASWELL ?
+ &cmd_buffer->device->dynamic_state_pool.block_pool.bo : NULL;
+  push_bos->buffers[n].length = DIV_ROUND_UP(state.alloc_size, 32);
+  n++;
+   }
+
+   if (GEN_GEN >= 8 || GEN_IS_HASWELL) {
+  for (int i = 0; i <= 3; i++) {
+ assert(n <= 3);
+
+ const struct brw_ubo_range *range = &prog_data->ubo_ranges[i];
+ if (range->length == 0)
+continue;
+
+ const unsigned surface =
+prog_data->binding_table.ubo_start + range->block;
+ assert(surface <= bind_map->surface_count);
+ const struct anv_pipeline_binding *binding =
+&bind_map->surface_to_descriptor[surface];
+
+ const struct anv_descriptor *desc =
+anv_descriptor_for_binding(&gfx_state->base, binding);
+
+ struct anv_address read_addr;
+ uint32_t read_len;
+
+ if (desc->type == VK_DESCRIPTOR_TYPE_UNIFORM_BUFFER) {
+read_len = MIN2(range->length,
+   DIV_ROUND_UP(desc->buffer_view->range, 32) - range->start);
+read_addr = anv_address_add(desc->buffer_view->address,
+range->start * 32);
+ } else {
+assert(desc->type == VK_DESCRIPTOR_TYPE_UNIFORM_BUFFER_DYNAMIC);
+
+uint32_t dynamic_offset =
+   dynamic_offset_for_binding(&gfx_state->base, binding);
+uint32_t buf_offset =
+   MIN2(desc->offset + dynamic_offset, desc->buffer->size);
+uint32_t buf_range =
+   MIN2(desc->range, desc->buffer->size - buf_offset);
+
+read_len = MIN2(range->length,
+DIV_ROUND_UP(buf_range, 32) - range->start);
+read_addr = anv_address_add(desc->buffer->address,
+buf_offset + range->start * 32);
+ }
+
+ if (read_len > 0) {
+push_bos->buffers[n].addr = read_addr;
+push_bos->buffers[n].length = read_len;
+n++;
+ }
+  }
+   }
+
+   push_bos->n = n;
+}
+
+UNUSED static void
+emit_push_constant_packet(struct anv_cmd_buffer *cmd_buffer,
+  gl_shader_stage stage,
+  const struct push_bos *push_bos)
+{
+   const struct anv_cmd_graphics_state *gfx_state = &cmd_buffer->state.gfx;
+   const struct anv_pipeline *pipeline = gfx_state->base.pipeline;
+   static const uint32_t push_constant_opcodes[] = {
+  [MESA_SHADER_VERTEX]  = 21,
+  [MESA_SHADER_TESS_CTRL]   = 25, /* HS */
+  [MESA_SHADER_TESS_EVAL]   = 26, /* DS */
+  [MESA_SHADER_GEOMETRY]= 22,
+  [MESA_SHADER_FRAGMENT]= 23,
+  [MESA_SHADER_COMPUTE] = 0,
+   };
+
+   anv_batch_emit(&cmd_buffer->batch, GENX(3DSTA

Re: [Mesa-dev] [PATCH v4 045/129] nir: Add a concept of per-member structs and a lowering pass

2018-06-12 Thread Kenneth Graunke
On Thursday, May 31, 2018 10:02:28 PM PDT Jason Ekstrand wrote:
> This adds a concept of "members" to a variable with an interface type.
> It allows you to specify the full variable data for each member of the
> interface instead of once for the variable.  We also add a lowering pass
> to lower those variables to a sequence of variables and rewrite all the
> derefs accordingly.
> ---
>  src/compiler/Makefile.sources   |   1 +
>  src/compiler/nir/meson.build|   1 +
>  src/compiler/nir/nir.h  |  12 +
>  src/compiler/nir/nir_clone.c|   8 +
>  src/compiler/nir/nir_serialize.c|  12 +
>  src/compiler/nir/nir_split_per_member_structs.c | 290 
> 
>  src/compiler/nir/nir_validate.c |   7 +
>  7 files changed, 331 insertions(+)
>  create mode 100644 src/compiler/nir/nir_split_per_member_structs.c

Jason and I discussed this on #dri-devel some today...a few things:

- I was concerned that this won't handle fully general structure/array
  nesting, with different decorations on various subfields.  It seems
  impossible to handle that without wholly rewriting how we represent
  structures in the IR.

- We used to do structure splitting right away, but we can't do that
  properly in SPIR-V because "pointers" may not terminate in a variable,
  and we need to be able to handle things part-way through a deref
  chain.

- We think that SPIR-V probably disallows cases that can't be handled
  by this code.  Hopefully. :/  Either way, those cases were probably
  already broken.

I don't like this at all but I don't want to tackle a struct rewrite
today, and this is probably the best we're going to get for now. :/

[snip]
> +static void
> +split_variable(struct nir_variable *var, nir_shader *shader,
> +   struct hash_table *var_to_member_map, void *dead_ctx)
> +{
> +   assert(var->state_slots == NULL);
> +
> +   /* Constant initializers are currently not handled */
> +   assert(var->constant_initializer == NULL);

Jason, could you please change this comment to:

   /* This pass should be run after lowering constant initializers. */

(I was concerned that the original code this replaced handled
initializers, and this code doesn't...but it's timing...we lower
them before this pass.  In the old code, we were splitting before
lowering, so we had to bother handling them.)

With that, patches 1-49 are
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


Re: [Mesa-dev] [PATCH v4 075/129] nir: convert lower_samplers_as_deref to deref instructions

2018-06-12 Thread Kenneth Graunke
On Thursday, May 31, 2018 10:04:05 PM PDT Jason Ekstrand wrote:
> From: Rob Clark 
> 
> This also removes the legacy version of lower_samplers.

It does not, that's what patch 76 (the next one) does.


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


Re: [Mesa-dev] [PATCH] intel/aubinator: Use int to store getopt_long flags.

2018-06-12 Thread Ian Romanick
Reviewed-by: Ian Romanick 

On 06/12/2018 12:23 PM, Rafael Antognolli wrote:
> getopt_long flag parameter is an int pointer, so if we use bool to store
> those values, when getopt_long writes to one of them, it might end up
> overwriting the next one.
> ---
>  src/intel/tools/aubinator.c | 4 ++--
>  1 file changed, 2 insertions(+), 2 deletions(-)
> 
> diff --git a/src/intel/tools/aubinator.c b/src/intel/tools/aubinator.c
> index 930cc92f132..9c14a9d4c97 100644
> --- a/src/intel/tools/aubinator.c
> +++ b/src/intel/tools/aubinator.c
> @@ -71,8 +71,8 @@ memfd_create(const char *name, unsigned int flags)
>  
>  /* options */
>  
> -static bool option_full_decode = true;
> -static bool option_print_offsets = true;
> +static int option_full_decode = true;
> +static int option_print_offsets = true;
>  static int max_vbo_lines = -1;
>  static enum { COLOR_AUTO, COLOR_ALWAYS, COLOR_NEVER } option_color;
>  
> 

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


[Mesa-dev] [PATCH 2/2] glsl: Don't copy propagate elements from SSBO or shared variables either

2018-06-12 Thread Ian Romanick
From: Ian Romanick 

Since SSBOs can be written, copy propagating a read can cause the
value to magically change.  SSBO reads are also very expensive, so
doing it twice will be slower.

The same shader was helped by this patch and the previous.

Haswell, Broadwell, and Skylake had similar results. (Skylake shown)
total instructions in shared programs: 14399119 -> 14399113 (<.01%)
instructions in affected programs: 683 -> 677 (-0.88%)
helped: 1
HURT: 0

total cycles in shared programs: 532973113 -> 532971865 (<.01%)
cycles in affected programs: 524666 -> 523418 (-0.24%)
helped: 1
HURT: 0

Signed-off-by: Ian Romanick 
Cc: mesa-sta...@lists.freedesktop.org
Bugzilla: https://bugs.freedesktop.org/show_bug.cgi?id=106774
---
 src/compiler/glsl/opt_copy_propagation_elements.cpp | 8 
 1 file changed, 8 insertions(+)

diff --git a/src/compiler/glsl/opt_copy_propagation_elements.cpp 
b/src/compiler/glsl/opt_copy_propagation_elements.cpp
index 8bae424a1d0..8975e727522 100644
--- a/src/compiler/glsl/opt_copy_propagation_elements.cpp
+++ b/src/compiler/glsl/opt_copy_propagation_elements.cpp
@@ -544,6 +544,10 @@ 
ir_copy_propagation_elements_visitor::add_copy(ir_assignment *ir)
if (!lhs || !(lhs->type->is_scalar() || lhs->type->is_vector()))
   return;
 
+   if (lhs->var->data.mode == ir_var_shader_storage ||
+   lhs->var->data.mode == ir_var_shader_shared)
+  return;
+
ir_dereference_variable *rhs = ir->rhs->as_dereference_variable();
if (!rhs) {
   ir_swizzle *swiz = ir->rhs->as_swizzle();
@@ -560,6 +564,10 @@ 
ir_copy_propagation_elements_visitor::add_copy(ir_assignment *ir)
   orig_swizzle[3] = swiz->mask.w;
}
 
+   if (rhs->var->data.mode == ir_var_shader_storage ||
+   rhs->var->data.mode == ir_var_shader_shared)
+  return;
+
/* Move the swizzle channels out to the positions they match in the
 * destination.  We don't want to have to rewrite the swizzle[]
 * array every time we clear a bit of the write_mask.
-- 
2.14.4

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


[Mesa-dev] [PATCH 1/2] glsl: Don't copy propagate from SSBO or shared variables either

2018-06-12 Thread Ian Romanick
From: Ian Romanick 

Since SSBOs can be written, copy propagating a read can cause the
value to magically change.  SSBO reads are also very expensive, so
doing it twice will be slower.

Haswell, Broadwell, and Skylake had similar results. (Skylake shown)
total instructions in shared programs: 14399120 -> 14399119 (<.01%)
instructions in affected programs: 684 -> 683 (-0.15%)
helped: 1
HURT: 0

total cycles in shared programs: 532978931 -> 532973113 (<.01%)
cycles in affected programs: 530484 -> 524666 (-1.10%)
helped: 1
HURT: 0

Signed-off-by: Ian Romanick 
Cc: mesa-sta...@lists.freedesktop.org
Bugzilla: https://bugs.freedesktop.org/show_bug.cgi?id=106774
---
 src/compiler/glsl/opt_copy_propagation.cpp | 2 ++
 1 file changed, 2 insertions(+)

diff --git a/src/compiler/glsl/opt_copy_propagation.cpp 
b/src/compiler/glsl/opt_copy_propagation.cpp
index 6220aa86da9..206dffe4f1c 100644
--- a/src/compiler/glsl/opt_copy_propagation.cpp
+++ b/src/compiler/glsl/opt_copy_propagation.cpp
@@ -347,6 +347,8 @@ ir_copy_propagation_visitor::add_copy(ir_assignment *ir)
if (lhs_var != NULL && rhs_var != NULL && lhs_var != rhs_var) {
   if (lhs_var->data.mode != ir_var_shader_storage &&
   lhs_var->data.mode != ir_var_shader_shared &&
+  rhs_var->data.mode != ir_var_shader_storage &&
+  rhs_var->data.mode != ir_var_shader_shared &&
   lhs_var->data.precise == rhs_var->data.precise) {
  _mesa_hash_table_insert(acp, lhs_var, rhs_var);
   }
-- 
2.14.4

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


[Mesa-dev] [Bug 106774] GLSL IR copy propagates loads of SSBOs

2018-06-12 Thread bugzilla-daemon
https://bugs.freedesktop.org/show_bug.cgi?id=106774

--- Comment #17 from Ian Romanick  ---
I have sent fixes to the mesa-dev list:

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

And an updated version of the test case (that avoids the helper pixels problem)
to the piglit list:

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

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


[Mesa-dev] [PATCH 2/3] meson: Test for __atomic_add_fetch in atomic checks

2018-06-12 Thread Matt Turner
From: Andrew Galante 

Some platforms have 64-bit __atomic_load_n but not 64-bit
__atomic_add_fetch, so test for both of them.

Bug: https://bugs.gentoo.org/655616
Reviewed-by: Matt Turner 
---
 meson.build | 7 +--
 1 file changed, 5 insertions(+), 2 deletions(-)

diff --git a/meson.build b/meson.build
index 62200476216..517636e5e09 100644
--- a/meson.build
+++ b/meson.build
@@ -841,7 +841,9 @@ if cc.compiles('''#include 
 struct {
   uint64_t *v;
 } x;
-return (int)__atomic_load_n(x.v, __ATOMIC_ACQUIRE);
+return (int)__atomic_load_n(x.v, __ATOMIC_ACQUIRE) &
+   (int)__atomic_add_fetch(x.v, (uint64_t)1, 
__ATOMIC_ACQ_REL);
+
   }''',
name : 'GCC atomic builtins')
   pre_args += '-DUSE_GCC_ATOMIC_BUILTINS'
@@ -857,7 +859,8 @@ if cc.compiles('''#include 
struct {
  uint64_t *v;
} x;
-   return (int)__atomic_load_n(x.v, __ATOMIC_ACQUIRE);
+   return (int)__atomic_load_n(x.v, __ATOMIC_ACQUIRE) &
+  (int)__atomic_add_fetch(x.v, (uint64_t)1, 
__ATOMIC_ACQ_REL);
  }''',
   name : 'GCC atomic builtins required -latomic')
 dep_atomic = cc.find_library('atomic')
-- 
2.16.1

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


[Mesa-dev] [PATCH 1/3] meson: Fix -latomic check

2018-06-12 Thread Matt Turner
Commit 54ba73ef102f (configure.ac/meson.build: Fix -latomic test) fixed
some checks for -latomic, and then commit 54bbe600ec26 (configure.ac:
rework -latomic check) further extended the fixes in configure.ac but
not in Meson. This commit extends those fixes to the Meson tests.

Fixes: 54bbe600ec26 (configure.ac: rework -latomic check)
---
 meson.build | 8 +++-
 1 file changed, 7 insertions(+), 1 deletion(-)

diff --git a/meson.build b/meson.build
index 7dba52369b0..62200476216 100644
--- a/meson.build
+++ b/meson.build
@@ -836,7 +836,13 @@ endif
 # Check for GCC style atomics
 dep_atomic = null_dep
 
-if cc.compiles('int main() { int n; return __atomic_load_n(&n, 
__ATOMIC_ACQUIRE); }',
+if cc.compiles('''#include 
+  int main() {
+struct {
+  uint64_t *v;
+} x;
+return (int)__atomic_load_n(x.v, __ATOMIC_ACQUIRE);
+  }''',
name : 'GCC atomic builtins')
   pre_args += '-DUSE_GCC_ATOMIC_BUILTINS'
 
-- 
2.16.1

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


[Mesa-dev] [PATCH 3/3] configure.ac: Test for __atomic_add_fetch in atomic checks

2018-06-12 Thread Matt Turner
From: Andrew Galante 

Some platforms have 64-bit __atomic_load_n but not 64-bit
__atomic_add_fetch, so test for both of them.

Bug: https://bugs.gentoo.org/655616
Reviewed-by: Matt Turner 
---
 configure.ac | 6 --
 1 file changed, 4 insertions(+), 2 deletions(-)

diff --git a/configure.ac b/configure.ac
index 704b67fd834..98fd4375b01 100644
--- a/configure.ac
+++ b/configure.ac
@@ -442,7 +442,8 @@ int main() {
 struct {
 uint64_t *v;
 } x;
-return (int)__atomic_load_n(x.v, __ATOMIC_ACQUIRE);
+return (int)__atomic_load_n(x.v, __ATOMIC_ACQUIRE) &
+   (int)__atomic_add_fetch(x.v, (uint64_t)1, __ATOMIC_ACQ_REL);
 }]])], GCC_ATOMIC_BUILTINS_SUPPORTED=yes, GCC_ATOMIC_BUILTINS_SUPPORTED=no)
 
 dnl If that didn't work, we try linking with -latomic, which is needed on some
@@ -456,7 +457,8 @@ if test "x$GCC_ATOMIC_BUILTINS_SUPPORTED" != xyes; then
 struct {
 uint64_t *v;
 } x;
-return (int)__atomic_load_n(x.v, __ATOMIC_ACQUIRE);
+return (int)__atomic_load_n(x.v, __ATOMIC_ACQUIRE) &
+   (int)__atomic_add_fetch(x.v, (uint64_t)1, __ATOMIC_ACQ_REL);
}]])], GCC_ATOMIC_BUILTINS_SUPPORTED=yes LIBATOMIC_LIBS="-latomic",
   GCC_ATOMIC_BUILTINS_SUPPORTED=no)
LDFLAGS=$save_LDFLAGS
-- 
2.16.1

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


Re: [Mesa-dev] [PATCH v4 075/129] nir: convert lower_samplers_as_deref to deref instructions

2018-06-12 Thread Rob Clark
On Tue, Jun 12, 2018 at 6:34 PM, Kenneth Graunke  wrote:
> On Thursday, May 31, 2018 10:04:05 PM PDT Jason Ekstrand wrote:
>> From: Rob Clark 
>>
>> This also removes the legacy version of lower_samplers.
>
> It does not, that's what patch 76 (the next one) does.
>

(for lack of good way of viewing full patchset atm, I'll take your
word for that, but that said) maybe just add the words "need for" into
that sentence, rather than squashing this and the following patch
together, to reduce the noise in the patch history..

BR,
-R

> ___
> 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] virgl: add ARB_tessellation_shader support. (v2)

2018-06-12 Thread Dave Airlie
From: Dave Airlie 

This should add all the pieces to enable tess shaders on virgl.

v2: fixup transform to handle tess and strip out precise.
set default for max patch varyings to work around issue when
tess gets enabled from v1 caps but v2 caps aren't in place. (Elie)
---
 src/gallium/auxiliary/tgsi/tgsi_transform.c |  4 --
 src/gallium/drivers/virgl/virgl_context.c   | 69 +
 src/gallium/drivers/virgl/virgl_encode.c| 21 -
 src/gallium/drivers/virgl/virgl_encode.h|  4 ++
 src/gallium/drivers/virgl/virgl_protocol.h  |  5 +++
 src/gallium/drivers/virgl/virgl_screen.c| 10 -
 src/gallium/drivers/virgl/virgl_winsys.h|  2 +-
 7 files changed, 107 insertions(+), 8 deletions(-)

diff --git a/src/gallium/auxiliary/tgsi/tgsi_transform.c 
b/src/gallium/auxiliary/tgsi/tgsi_transform.c
index cd076c9e79e..4b2b10f50ad 100644
--- a/src/gallium/auxiliary/tgsi/tgsi_transform.c
+++ b/src/gallium/auxiliary/tgsi/tgsi_transform.c
@@ -140,10 +140,6 @@ tgsi_transform_shader(const struct tgsi_token *tokens_in,
   return -1;
}
procType = parse.FullHeader.Processor.Processor;
-   assert(procType == PIPE_SHADER_FRAGMENT ||
-  procType == PIPE_SHADER_VERTEX ||
-  procType == PIPE_SHADER_GEOMETRY);
-
 
/**
 **  Setup output shader
diff --git a/src/gallium/drivers/virgl/virgl_context.c 
b/src/gallium/drivers/virgl/virgl_context.c
index 8d701bb8f40..e6f8dc85256 100644
--- a/src/gallium/drivers/virgl/virgl_context.c
+++ b/src/gallium/drivers/virgl/virgl_context.c
@@ -492,6 +492,18 @@ static void *virgl_create_vs_state(struct pipe_context 
*ctx,
return virgl_shader_encoder(ctx, shader, PIPE_SHADER_VERTEX);
 }
 
+static void *virgl_create_tcs_state(struct pipe_context *ctx,
+   const struct pipe_shader_state *shader)
+{
+   return virgl_shader_encoder(ctx, shader, PIPE_SHADER_TESS_CTRL);
+}
+
+static void *virgl_create_tes_state(struct pipe_context *ctx,
+   const struct pipe_shader_state *shader)
+{
+   return virgl_shader_encoder(ctx, shader, PIPE_SHADER_TESS_EVAL);
+}
+
 static void *virgl_create_gs_state(struct pipe_context *ctx,
const struct pipe_shader_state *shader)
 {
@@ -534,6 +546,26 @@ virgl_delete_vs_state(struct pipe_context *ctx,
virgl_encode_delete_object(vctx, handle, VIRGL_OBJECT_SHADER);
 }
 
+static void
+virgl_delete_tcs_state(struct pipe_context *ctx,
+   void *tcs)
+{
+   uint32_t handle = (unsigned long)tcs;
+   struct virgl_context *vctx = virgl_context(ctx);
+
+   virgl_encode_delete_object(vctx, handle, VIRGL_OBJECT_SHADER);
+}
+
+static void
+virgl_delete_tes_state(struct pipe_context *ctx,
+  void *tes)
+{
+   uint32_t handle = (unsigned long)tes;
+   struct virgl_context *vctx = virgl_context(ctx);
+
+   virgl_encode_delete_object(vctx, handle, VIRGL_OBJECT_SHADER);
+}
+
 static void virgl_bind_vs_state(struct pipe_context *ctx,
 void *vss)
 {
@@ -543,6 +575,24 @@ static void virgl_bind_vs_state(struct pipe_context *ctx,
virgl_encode_bind_shader(vctx, handle, PIPE_SHADER_VERTEX);
 }
 
+static void virgl_bind_tcs_state(struct pipe_context *ctx,
+   void *vss)
+{
+   uint32_t handle = (unsigned long)vss;
+   struct virgl_context *vctx = virgl_context(ctx);
+
+   virgl_encode_bind_shader(vctx, handle, PIPE_SHADER_TESS_CTRL);
+}
+
+static void virgl_bind_tes_state(struct pipe_context *ctx,
+   void *vss)
+{
+   uint32_t handle = (unsigned long)vss;
+   struct virgl_context *vctx = virgl_context(ctx);
+
+   virgl_encode_bind_shader(vctx, handle, PIPE_SHADER_TESS_EVAL);
+}
+
 static void virgl_bind_gs_state(struct pipe_context *ctx,
void *vss)
 {
@@ -801,6 +851,18 @@ static void virgl_set_clip_state(struct pipe_context *ctx,
virgl_encoder_set_clip_state(vctx, clip);
 }
 
+static void virgl_set_tess_state(struct pipe_context *ctx,
+ const float default_outer_level[4],
+ const float default_inner_level[2])
+{
+   struct virgl_context *vctx = virgl_context(ctx);
+   struct virgl_screen *rs = virgl_screen(ctx->screen);
+
+   if (!rs->caps.caps.v1.bset.has_tessellation_shaders)
+  return;
+   virgl_encode_set_tess_state(vctx, default_outer_level, default_inner_level);
+}
+
 static void virgl_resource_copy_region(struct pipe_context *ctx,
   struct pipe_resource *dst,
   unsigned dst_level,
@@ -893,15 +955,22 @@ struct pipe_context *virgl_context_create(struct 
pipe_screen *pscreen,
vctx->base.set_vertex_buffers = virgl_set_vertex_buffers;
vctx->base.set_constant_buffer = virgl_set_constant_buffer;
 
+   vctx->base.set_tess_state = virgl_set_tess_state;
vctx->base.create_vs_state = virgl_create_vs_state;

Re: [Mesa-dev] [PATCH 2/2] nir: add lowering for gl_HelperInvocation

2018-06-12 Thread Rob Clark
On Tue, Jun 12, 2018 at 3:36 PM, Jason Ekstrand  wrote:
> On Tue, Jun 12, 2018 at 10:49 AM, Rob Clark  wrote:
>>
>> On Mon, Jun 11, 2018 at 10:59 PM, Roland Scheidegger 
>> wrote:
>> > Am 12.06.2018 um 01:17 schrieb Rob Clark:
>> >> On Mon, Jun 11, 2018 at 6:59 PM, Roland Scheidegger
>> >>  wrote:
>> >>> Am 12.06.2018 um 00:32 schrieb Jason Ekstrand:
>>  On Wed, Jun 6, 2018 at 7:43 AM, Rob Clark >  > wrote:
>> 
>>  Signed-off-by: Rob Clark >  >
>>  ---
>>  I can't say for sure that this will work on all drivers, but it
>>  is
>>  what the blob driver does, and it seems to make deqp happy.  I
>>  could
>>  move this to it's own pass inside ir3, but that seemed like
>>  overkill
>> 
>>   src/compiler/nir/nir.h  | 10 ++
>>   src/compiler/nir/nir_lower_system_values.c  | 17
>>  +
>>   src/gallium/drivers/freedreno/ir3/ir3_nir.c |  1 +
>>   3 files changed, 28 insertions(+)
>> 
>>  diff --git a/src/compiler/nir/nir.h b/src/compiler/nir/nir.h
>>  index 073ab4e82ea..de3d55d83af 100644
>>  --- a/src/compiler/nir/nir.h
>>  +++ b/src/compiler/nir/nir.h
>>  @@ -1963,6 +1963,16 @@ typedef struct nir_shader_compiler_options
>>  {
>>   */
>>  bool lower_base_vertex;
>> 
>>  +   /**
>>  +* If enabled, gl_HelperInvocation will be lowered as:
>>  +*
>>  +*   !((1 << gl_SampleID) & gl_SampleMaskIN[0]))
>> 
>> 
>>  This only works for multi-sampling.  What about the single-sampled
>>  case?
>> >>> It doesn't make sense to me for msaa neither.
>> >>> gl_SampleID forces per-sample execution, which clearly isn't what you
>> >>> want.
>> >>
>> >> open to suggestions about how to try and force blob to do something
>> >> different.. I tried a few things and the blob popped out shader code
>> >> that worked the same way in all cases, but ofc I could have missed
>> >> something.
>> >>
>> >>> Plus, gl_SampleMaskIN is specified to only contain bits for the
>> >>> current shader invocation, so for msaa with forced per-sample
>> >>> execution
>> >>> that would only contain the single bit corresponding to gl_SampleID
>> >>> anyway (that is my interpretation at least - I know hw sample mask
>> >>> inputs will probably always contains all the bits from rasterization,
>> >>> regardless of gl_SampleID), so the "1 << gl_SampleID &" part will do
>> >>> nothing at all. So I think that part is more about lowering the hw
>> >>> rasterization sample mask to gl_SampleMaskIN rather than lowering to
>> >>> gl_HelperInvocation.
>> >>> But yes, !gl_SampleMaskIN should give gl_HelperInvocation - I think
>> >>> all
>> >>> hw can give you raster sample mask even without msaa but I'm not
>> >>> entirely sure if it's guaranteed to work in GL with single sampling
>> >>> (similar for sample id, which should just be stuck at 0). But using
>> >>> the
>> >>> gl names here looks very, very fishy to me here.
>> >>
>> >> I *guess* this is relying on behaviour that gl does not guarantee, but
>> >> also doesn't prohibit, but the hw happens work that way and it works
>> >> out..
>> >>
>> >> Maybe the answer is to simply better document the assumptions that
>> >> this lowering depends on?
>> > Well I think if you have a nir shader which uses sample id but is
>> > supposed to not be run per-sample that is quite confusing (I'd just
>> > assume that adrenos will use sample id 0 just like in single sampled
>> > case). Hopefully noone will deduce shader frequency from the nir
>> > shader...
>> > I'm definitely no NIR expert but there's quite a lot of hacky
>> > assumptions in there:
>> > - sample id in nir doesn't cause per-sample execution (and needs to be 0
>> > in case of msaa but no per-sample execution)
>> > - sampleMaskIn is available in single-sampled
>> > - sampleMaskIn doesn't actually have gl semantics but hw ones (so simply
>> > the mask from rasterization, not taking into account the sample id
>> > already if there's per-sample execution (for legitimate reasons),
>> > although as mentioned I think there's still some debate about this and
>> > not all drivers may actually agree what the semantics of it are in case
>> > of per-sample execution)
>> >
>> > As such I'm not sure it really makes sense to do that as a generic
>> > lowering pass? Albeit you're quite right that it might work for a lot of
>> > hw... But some comments would at the very least imho definitely be
>> > required.
>> >
>>
>> so I reworded the comment about the enable flag a bit:
>>
>>/**
>> * If enabled, gl_HelperInvocation will be lowered as:
>> *
>> *   !((1 << sample_id) & sample_mask_in))
>> *
>> * This depends on some possibly hw implementation details, which may
>> * not be true for all hw.  In particular that the FS is o

  1   2   >