[Mesa-dev] [PATCH v2] dri3: For 1.2, use root window instead of pixmap drawable

2018-07-26 Thread Olivier Fourdan
get_supported_modifiers() and pixmap_from_buffers() requests both
expect a window as drawable, passing a pixmap will fail as the Xserver
will fail to match the given drawable to a window.

That leads to dri3_alloc_render_buffer() to return NULL and breaks
rendering when using GLX_DOUBLEBUFFER on pixmaps.

Query the root window of the pixmap on first init, and use the root
window instead of the pixmap drawable for get_supported_modifiers()
and pixmap_from_buffers().

Bugzilla: https://bugs.freedesktop.org/show_bug.cgi?id=107117
Fixes: 069fdd5 ("egl/x11: Support DRI3 v1.1")
Signed-off-by: Olivier Fourdan 
---
 v2: Use the root window instead of reverting to pixmap_from_buffer()
 as suggested by Eric.

 src/loader/loader_dri3_helper.c | 31 +--
 src/loader/loader_dri3_helper.h |  1 +
 2 files changed, 30 insertions(+), 2 deletions(-)

diff --git a/src/loader/loader_dri3_helper.c b/src/loader/loader_dri3_helper.c
index f0ff2f07bd..c7ad67cd04 100644
--- a/src/loader/loader_dri3_helper.c
+++ b/src/loader/loader_dri3_helper.c
@@ -1091,6 +1091,21 @@ has_supported_modifier(struct loader_dri3_drawable 
*draw, unsigned int format,
free(supported_modifiers);
return found;
 }
+
+static xcb_window_t
+get_root_window (struct loader_dri3_drawable *draw)
+{
+   xcb_get_geometry_cookie_t cookie;
+   xcb_get_geometry_reply_t *reply;
+   xcb_window_t window = draw->drawable;
+
+   cookie = xcb_get_geometry(draw->conn, draw->drawable);
+   if ((reply = xcb_get_geometry_reply(draw->conn, cookie, NULL)))
+  window = reply->root;
+   free(reply);
+
+   return window;
+}
 #endif
 
 /** loader_dri3_alloc_render_buffer
@@ -1149,7 +1164,7 @@ dri3_alloc_render_buffer(struct loader_dri3_drawable 
*draw, unsigned int format,
  uint32_t count = 0;
 
  mod_cookie = xcb_dri3_get_supported_modifiers(draw->conn,
-   draw->drawable,
+   draw->window,
depth, buffer->cpp * 8);
  mod_reply = xcb_dri3_get_supported_modifiers_reply(draw->conn,
 mod_cookie,
@@ -1281,7 +1296,7 @@ dri3_alloc_render_buffer(struct loader_dri3_drawable 
*draw, unsigned int format,
buffer->modifier != DRM_FORMAT_MOD_INVALID) {
   xcb_dri3_pixmap_from_buffers(draw->conn,
pixmap,
-   draw->drawable,
+   draw->window,
num_planes,
width, height,
buffer->strides[0], buffer->offsets[0],
@@ -1432,7 +1447,19 @@ dri3_update_drawable(__DRIdrawable *driDrawable,
  xcb_unregister_for_special_event(draw->conn, draw->special_event);
  draw->special_event = NULL;
   }
+
+#ifdef HAVE_DRI3_MODIFIERS
+  /* get_supported_modifiers() and pixmap_from_buffers() expect a window,
+   * not just a drawable, and will fail if we pass the pixmap drawable.
+   * So, in case of a pixmap, use the root window instead.
+   */
+  if (draw->is_pixmap)
+ draw->window = get_root_window(draw);
+  else
+#endif
+ draw->window = draw->drawable;
}
+
dri3_flush_present_events(draw);
mtx_unlock(&draw->mtx);
return true;
diff --git a/src/loader/loader_dri3_helper.h b/src/loader/loader_dri3_helper.h
index 7e3d82947b..51d000343d 100644
--- a/src/loader/loader_dri3_helper.h
+++ b/src/loader/loader_dri3_helper.h
@@ -114,6 +114,7 @@ struct loader_dri3_drawable {
xcb_connection_t *conn;
__DRIdrawable *dri_drawable;
xcb_drawable_t drawable;
+   xcb_window_t window;
int width;
int height;
int depth;
-- 
2.17.1

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


[Mesa-dev] [PATCH v3] dri3: For 1.2, use root window instead of pixmap drawable

2018-07-26 Thread Olivier Fourdan
get_supported_modifiers() and pixmap_from_buffers() requests both
expect a window as drawable, passing a pixmap will fail as the Xserver
will fail to match the given drawable to a window.

That leads to dri3_alloc_render_buffer() to return NULL and breaks
rendering when using GLX_DOUBLEBUFFER on pixmaps.

Query the root window of the pixmap on first init, and use the root
window instead of the pixmap drawable for get_supported_modifiers()
and pixmap_from_buffers().

Bugzilla: https://bugs.freedesktop.org/show_bug.cgi?id=107117
Fixes: 069fdd5 ("egl/x11: Support DRI3 v1.1")
Signed-off-by: Olivier Fourdan 
---
 v2: Use the root window instead of reverting to pixmap_from_buffer()
 as suggested by Eric.
 v3: Much simpler patch, no need to issue an xcb_get_geometry() twice,
 we already did it in dri3_update_drawable(), just save the root window
 from there... Sorry for the noise!

 src/loader/loader_dri3_helper.c | 12 +---
 src/loader/loader_dri3_helper.h |  1 +
 2 files changed, 10 insertions(+), 3 deletions(-)

diff --git a/src/loader/loader_dri3_helper.c b/src/loader/loader_dri3_helper.c
index f0ff2f07bd..b8eb87f5aa 100644
--- a/src/loader/loader_dri3_helper.c
+++ b/src/loader/loader_dri3_helper.c
@@ -1149,7 +1149,7 @@ dri3_alloc_render_buffer(struct loader_dri3_drawable 
*draw, unsigned int format,
  uint32_t count = 0;
 
  mod_cookie = xcb_dri3_get_supported_modifiers(draw->conn,
-   draw->drawable,
+   draw->window,
depth, buffer->cpp * 8);
  mod_reply = xcb_dri3_get_supported_modifiers_reply(draw->conn,
 mod_cookie,
@@ -1281,7 +1281,7 @@ dri3_alloc_render_buffer(struct loader_dri3_drawable 
*draw, unsigned int format,
buffer->modifier != DRM_FORMAT_MOD_INVALID) {
   xcb_dri3_pixmap_from_buffers(draw->conn,
pixmap,
-   draw->drawable,
+   draw->window,
num_planes,
width, height,
buffer->strides[0], buffer->offsets[0],
@@ -1357,6 +1357,7 @@ dri3_update_drawable(__DRIdrawable *driDrawable,
   xcb_generic_error_t   *error;
   xcb_present_query_capabilities_cookie_t   present_capabilities_cookie;
   xcb_present_query_capabilities_reply_t*present_capabilities_reply;
+  xcb_window_t   root_win;
 
   draw->first_init = false;
 
@@ -1394,11 +1395,11 @@ dri3_update_drawable(__DRIdrawable *driDrawable,
  mtx_unlock(&draw->mtx);
  return false;
   }
-
   draw->width = geom_reply->width;
   draw->height = geom_reply->height;
   draw->depth = geom_reply->depth;
   draw->vtable->set_drawable_size(draw, draw->width, draw->height);
+  root_win = geom_reply->root;
 
   free(geom_reply);
 
@@ -1432,6 +1433,11 @@ dri3_update_drawable(__DRIdrawable *driDrawable,
  xcb_unregister_for_special_event(draw->conn, draw->special_event);
  draw->special_event = NULL;
   }
+
+  if (draw->is_pixmap)
+ draw->window = root_win;
+  else
+ draw->window = draw->drawable;
}
dri3_flush_present_events(draw);
mtx_unlock(&draw->mtx);
diff --git a/src/loader/loader_dri3_helper.h b/src/loader/loader_dri3_helper.h
index 7e3d82947b..51d000343d 100644
--- a/src/loader/loader_dri3_helper.h
+++ b/src/loader/loader_dri3_helper.h
@@ -114,6 +114,7 @@ struct loader_dri3_drawable {
xcb_connection_t *conn;
__DRIdrawable *dri_drawable;
xcb_drawable_t drawable;
+   xcb_window_t window;
int width;
int height;
int depth;
-- 
2.17.1

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


Re: [Mesa-dev] [PATCH v3] dri3: For 1.2, use root window instead of pixmap drawable

2018-07-26 Thread Daniel Stone
On Thu, 26 Jul 2018 at 08:46, Olivier Fourdan  wrote:
> get_supported_modifiers() and pixmap_from_buffers() requests both
> expect a window as drawable, passing a pixmap will fail as the Xserver
> will fail to match the given drawable to a window.
>
> That leads to dri3_alloc_render_buffer() to return NULL and breaks
> rendering when using GLX_DOUBLEBUFFER on pixmaps.
>
> Query the root window of the pixmap on first init, and use the root
> window instead of the pixmap drawable for get_supported_modifiers()
> and pixmap_from_buffers().

Looks good to me, thanks Olivier!

Reviewed-by: Daniel Stone 

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


Re: [Mesa-dev] [PATCH mesa] anv: don't crash on vkDestroyDevice(NULL)

2018-07-26 Thread Eric Engestrom
On Wednesday, 2018-07-25 14:00:29 -0700, Dylan Baker wrote:
> Quoting Eric Engestrom (2018-07-25 11:45:56)
> > CovID: 1438132
> > Signed-off-by: Eric Engestrom 
> > ---
> >  src/intel/vulkan/anv_device.c | 4 +++-
> >  1 file changed, 3 insertions(+), 1 deletion(-)
> > 
> > diff --git a/src/intel/vulkan/anv_device.c b/src/intel/vulkan/anv_device.c
> > index 04fd6a829ed60081abc4..3664f80c24dc34955196 100644
> > --- a/src/intel/vulkan/anv_device.c
> > +++ b/src/intel/vulkan/anv_device.c
> > @@ -1832,11 +1832,13 @@ void anv_DestroyDevice(
> >  const VkAllocationCallbacks*pAllocator)
> >  {
> > ANV_FROM_HANDLE(anv_device, device, _device);
> > -   struct anv_physical_device *physical_device = 
> > &device->instance->physicalDevice;
> > +   struct anv_physical_device *physical_device;
> 
> Is there a particular reason to create the pointer her but assign it after the
> null check rather than just move the null check between the ANV_FROM_HANDLE 
> and
> the anv_pysical_device?

Just the habit of always putting variable declarations before any logic 
¯\_(ツ)_/¯
I thought that was considered best-practice; has that changed?

> 
> >  
> > if (!device)
> >return;
> >  
> > +   physical_device = &device->instance->physicalDevice;
> > +
> > anv_device_finish_blorp(device);
> >  
> > anv_pipeline_cache_finish(&device->default_pipeline_cache);
> > -- 
> > Cheers,
> >   Eric
> > 
> > ___
> > mesa-dev mailing list
> > mesa-dev@lists.freedesktop.org
> > https://lists.freedesktop.org/mailman/listinfo/mesa-dev


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


Re: [Mesa-dev] [PATCH mesa] anv: don't crash on vkDestroyDevice(NULL)

2018-07-26 Thread Jason Ekstrand
On Thu, Jul 26, 2018 at 1:50 AM Eric Engestrom 
wrote:

> On Wednesday, 2018-07-25 14:00:29 -0700, Dylan Baker wrote:
> > Quoting Eric Engestrom (2018-07-25 11:45:56)
> > > CovID: 1438132
> > > Signed-off-by: Eric Engestrom 
> > > ---
> > >  src/intel/vulkan/anv_device.c | 4 +++-
> > >  1 file changed, 3 insertions(+), 1 deletion(-)
> > >
> > > diff --git a/src/intel/vulkan/anv_device.c
> b/src/intel/vulkan/anv_device.c
> > > index 04fd6a829ed60081abc4..3664f80c24dc34955196 100644
> > > --- a/src/intel/vulkan/anv_device.c
> > > +++ b/src/intel/vulkan/anv_device.c
> > > @@ -1832,11 +1832,13 @@ void anv_DestroyDevice(
> > >  const VkAllocationCallbacks*pAllocator)
> > >  {
> > > ANV_FROM_HANDLE(anv_device, device, _device);
> > > -   struct anv_physical_device *physical_device =
> &device->instance->physicalDevice;
> > > +   struct anv_physical_device *physical_device;
> >
> > Is there a particular reason to create the pointer her but assign it
> after the
> > null check rather than just move the null check between the
> ANV_FROM_HANDLE and
> > the anv_pysical_device?
>
> Just the habit of always putting variable declarations before any logic
> ¯\_(ツ)_/¯
> I thought that was considered best-practice; has that changed?
>

Yup; welcome to C99. :-)
___
mesa-dev mailing list
mesa-dev@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/mesa-dev


Re: [Mesa-dev] [PATCH mesa] anv: don't crash on vkDestroyDevice(NULL)

2018-07-26 Thread Lionel Landwerlin

On 25/07/18 19:45, Eric Engestrom wrote:

CovID: 1438132
Signed-off-by: Eric Engestrom 


Reviewed-by: Lionel Landwerlin 


---
  src/intel/vulkan/anv_device.c | 4 +++-
  1 file changed, 3 insertions(+), 1 deletion(-)

diff --git a/src/intel/vulkan/anv_device.c b/src/intel/vulkan/anv_device.c
index 04fd6a829ed60081abc4..3664f80c24dc34955196 100644
--- a/src/intel/vulkan/anv_device.c
+++ b/src/intel/vulkan/anv_device.c
@@ -1832,11 +1832,13 @@ void anv_DestroyDevice(
  const VkAllocationCallbacks*pAllocator)
  {
 ANV_FROM_HANDLE(anv_device, device, _device);
-   struct anv_physical_device *physical_device = 
&device->instance->physicalDevice;
+   struct anv_physical_device *physical_device;
  
 if (!device)

return;
  
+   physical_device = &device->instance->physicalDevice;

+
 anv_device_finish_blorp(device);
  
 anv_pipeline_cache_finish(&device->default_pipeline_cache);



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


Re: [Mesa-dev] [PATCH mesa v2] vulkan/wsi: fix assignment in assert()

2018-07-26 Thread Lionel Landwerlin

On 25/07/18 20:03, Eric Engestrom wrote:

CovID: 1438113, 1438118, 1438119, 1438121
Fixes: dc1d10b396179766227df "anv,radv: Add support for 
VK_KHR_get_display_properties2"
Cc: Jason Ekstrand 
Signed-off-by: Eric Engestrom 


Reviewed-by: Lionel Landwerlin 


---
  src/vulkan/wsi/wsi_common_display.c | 4 ++--
  1 file changed, 2 insertions(+), 2 deletions(-)

diff --git a/src/vulkan/wsi/wsi_common_display.c 
b/src/vulkan/wsi/wsi_common_display.c
index ac932d4368a0293fe97e..e6cba188dfaf8d790415 100644
--- a/src/vulkan/wsi/wsi_common_display.c
+++ b/src/vulkan/wsi/wsi_common_display.c
@@ -619,7 +619,7 @@ wsi_display_fill_in_display_mode_properties(
 struct wsi_display_mode *display_mode,
 VkDisplayModeProperties2KHR *properties)
  {
-   assert(properties->sType = VK_STRUCTURE_TYPE_DISPLAY_MODE_PROPERTIES_2_KHR);
+   assert(properties->sType == 
VK_STRUCTURE_TYPE_DISPLAY_MODE_PROPERTIES_2_KHR);
 VkDisplayModePropertiesKHR *prop = &properties->displayModeProperties;
  
 prop->displayMode = wsi_display_mode_to_handle(display_mode);

@@ -763,7 +763,7 @@ wsi_get_display_plane_capabilities2(
 const VkDisplayPlaneInfo2KHR *pDisplayPlaneInfo,
 VkDisplayPlaneCapabilities2KHR *capabilities)
  {
-   assert(capabilities->sType =
+   assert(capabilities->sType ==
VK_STRUCTURE_TYPE_DISPLAY_PLANE_CAPABILITIES_2_KHR);
  
 return wsi_get_display_plane_capabilities(physical_device, wsi_device,



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


Re: [Mesa-dev] [PATCH mesa] vulkan/wsi: fix assignment in assert()

2018-07-26 Thread Lionel Landwerlin

On 25/07/18 19:54, Eric Engestrom wrote:

CovID: 1438121
Fixes: dc1d10b396179766227df "anv,radv: Add support for 
VK_KHR_get_display_properties2"
Cc: Jason Ekstrand 
Signed-off-by: Eric Engestrom 


Reviewed-by: Lionel Landwerlin 


---
  src/vulkan/wsi/wsi_common_display.c | 2 +-
  1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/src/vulkan/wsi/wsi_common_display.c 
b/src/vulkan/wsi/wsi_common_display.c
index ac932d4368a0293fe97e..7cabb7780db29c8a44d7 100644
--- a/src/vulkan/wsi/wsi_common_display.c
+++ b/src/vulkan/wsi/wsi_common_display.c
@@ -763,7 +763,7 @@ wsi_get_display_plane_capabilities2(
 const VkDisplayPlaneInfo2KHR *pDisplayPlaneInfo,
 VkDisplayPlaneCapabilities2KHR *capabilities)
  {
-   assert(capabilities->sType =
+   assert(capabilities->sType ==
VK_STRUCTURE_TYPE_DISPLAY_PLANE_CAPABILITIES_2_KHR);
  
 return wsi_get_display_plane_capabilities(physical_device, wsi_device,



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


Re: [Mesa-dev] [PATCH mesa] anv: drop unused local vars

2018-07-26 Thread Lionel Landwerlin

On 25/07/18 20:12, Eric Engestrom wrote:

Signed-off-by: Eric Engestrom 


Reviewed-by: Lionel Landwerlin 


---
  src/intel/vulkan/anv_descriptor_set.c | 6 --
  1 file changed, 6 deletions(-)

diff --git a/src/intel/vulkan/anv_descriptor_set.c 
b/src/intel/vulkan/anv_descriptor_set.c
index 8f7f1f3ba386de438887..66ed28292b01897fc1d1 100644
--- a/src/intel/vulkan/anv_descriptor_set.c
+++ b/src/intel/vulkan/anv_descriptor_set.c
@@ -902,15 +902,9 @@ anv_descriptor_set_write_template(struct 
anv_descriptor_set *set,
const struct anv_descriptor_update_template 
*template,
const void *data)
  {
-   const struct anv_descriptor_set_layout *layout = set->layout;
-
 for (uint32_t i = 0; i < template->entry_count; i++) {
const struct anv_descriptor_template_entry *entry =
   &template->entries[i];
-  const struct anv_descriptor_set_binding_layout *bind_layout =
- &layout->binding[entry->binding];
-  struct anv_descriptor *desc = 
&set->descriptors[bind_layout->descriptor_index];
-  desc += entry->array_element;
  
switch (entry->type) {

case VK_DESCRIPTOR_TYPE_SAMPLER:



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


Re: [Mesa-dev] [PATCH mesa 1/3] anv: remove unnecessary semicolons in python

2018-07-26 Thread Lionel Landwerlin

On 25/07/18 20:14, Eric Engestrom wrote:

Signed-off-by: Eric Engestrom 


Reviewed-by: Lionel Landwerlin 


---
  src/intel/vulkan/anv_extensions.py | 6 +++---
  1 file changed, 3 insertions(+), 3 deletions(-)

diff --git a/src/intel/vulkan/anv_extensions.py 
b/src/intel/vulkan/anv_extensions.py
index ea837744b4352845b0d5..cffc3e700cb0ccb7fa8f 100644
--- a/src/intel/vulkan/anv_extensions.py
+++ b/src/intel/vulkan/anv_extensions.py
@@ -31,11 +31,11 @@
  
  def _bool_to_c_expr(b):

  if b is True:
-return 'true';
+return 'true'
  elif b is False:
-return 'false';
+return 'false'
  else:
-return b;
+return b
  
  class Extension:

  def __init__(self, name, ext_version, enable):



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


Re: [Mesa-dev] [PATCH mesa] anv: don't crash on vkDestroyDevice(NULL)

2018-07-26 Thread Eric Engestrom
On Thursday, 2018-07-26 02:03:58 -0700, Jason Ekstrand wrote:
> On Thu, Jul 26, 2018 at 1:50 AM Eric Engestrom 
> wrote:
> 
> > On Wednesday, 2018-07-25 14:00:29 -0700, Dylan Baker wrote:
> > > Quoting Eric Engestrom (2018-07-25 11:45:56)
> > > > CovID: 1438132
> > > > Signed-off-by: Eric Engestrom 
> > > > ---
> > > >  src/intel/vulkan/anv_device.c | 4 +++-
> > > >  1 file changed, 3 insertions(+), 1 deletion(-)
> > > >
> > > > diff --git a/src/intel/vulkan/anv_device.c
> > b/src/intel/vulkan/anv_device.c
> > > > index 04fd6a829ed60081abc4..3664f80c24dc34955196 100644
> > > > --- a/src/intel/vulkan/anv_device.c
> > > > +++ b/src/intel/vulkan/anv_device.c
> > > > @@ -1832,11 +1832,13 @@ void anv_DestroyDevice(
> > > >  const VkAllocationCallbacks*pAllocator)
> > > >  {
> > > > ANV_FROM_HANDLE(anv_device, device, _device);
> > > > -   struct anv_physical_device *physical_device =
> > &device->instance->physicalDevice;
> > > > +   struct anv_physical_device *physical_device;
> > >
> > > Is there a particular reason to create the pointer her but assign it
> > after the
> > > null check rather than just move the null check between the
> > ANV_FROM_HANDLE and
> > > the anv_pysical_device?
> >
> > Just the habit of always putting variable declarations before any logic
> > ¯\_(ツ)_/¯
> > I thought that was considered best-practice; has that changed?
> >
> 
> Yup; welcome to C99. :-)

Haha, I know it's now allowed, but I thought best practice was to still
keep things grouped, except when there's a reason to have a declaration
in the middle of the logic.

Looking at the rest of the file, I see a bunch of examples of logic and
declarations interleaved, so I guess that rule doesn't apply in anv at
least; guess I'll change my style to match :)
___
mesa-dev mailing list
mesa-dev@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/mesa-dev


Re: [Mesa-dev] [PATCH] intel/compiler: fix lower conversions to account for predication

2018-07-26 Thread Chema Casanova
Please include:

Fixes: 5a12bdac09496e00 "i965/compiler: handle conversion to smaller
 type in the lowering pass for that"

Reviewed-by: Jose Maria Casanova Crespo 

El 17/07/18 a las 11:10, Iago Toral Quiroga escribió:
> The pass can create a temporary result for the instruction and then
> moves from it to the original destination, however, if the original
> instruction was predicated, the mov has to be predicated as well.
> ---
>  src/intel/compiler/brw_fs_lower_conversions.cpp | 5 -
>  1 file changed, 4 insertions(+), 1 deletion(-)
> 
> diff --git a/src/intel/compiler/brw_fs_lower_conversions.cpp 
> b/src/intel/compiler/brw_fs_lower_conversions.cpp
> index e27e2402746..145fb55f995 100644
> --- a/src/intel/compiler/brw_fs_lower_conversions.cpp
> +++ b/src/intel/compiler/brw_fs_lower_conversions.cpp
> @@ -98,7 +98,10 @@ fs_visitor::lower_conversions()
>   * size_written accordingly.
>   */
>  inst->size_written = inst->dst.component_size(inst->exec_size);
> -ibld.at(block, inst->next).MOV(dst, strided_temp)->saturate = 
> saturate;
> +
> +fs_inst *mov = ibld.at(block, inst->next).MOV(dst, strided_temp);
> +mov->saturate = saturate;
> +mov->predicate = inst->predicate;
>  
>  progress = true;
>   }
> 
___
mesa-dev mailing list
mesa-dev@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/mesa-dev


[Mesa-dev] [Bug 107385] full Screen Corruption when a program is fullscreen

2018-07-26 Thread bugzilla-daemon
https://bugs.freedesktop.org/show_bug.cgi?id=107385

Bug ID: 107385
   Summary: full Screen Corruption when a program is fullscreen
   Product: Mesa
   Version: unspecified
  Hardware: Other
OS: Linux (All)
Status: NEW
  Severity: normal
  Priority: medium
 Component: Other
  Assignee: mesa-dev@lists.freedesktop.org
  Reporter: monkeyinastripedsh...@gmail.com
QA Contact: mesa-dev@lists.freedesktop.org

Created attachment 140826
  --> https://bugs.freedesktop.org/attachment.cgi?id=140826&action=edit
glxinfo

This seemed to appear a few days ago after updating the obiaf ppa on Ubuntu 18.
I did not have this problem before.

Basically any time certain programs are fullscreen the screen becomes corrupted
and looks like a corrupted version of the login background however everything
is still intractable and (I'm using Gnome) pressing the super key allows me to
view the application and kill it. 
The view within (Whatever the application window thing is called) works and I
can see the loading animations, the start menu, and everything which is how I
have managed to get a few applications out of fullscreen and they work fine
when not in fullscreen.

Attempting to screenshot the problem doesn't seem to work. LightDM also has
this issue, the screen looks the exact same, with even the same colors. glxinfo
is also attached. Not too sure what other information I need to include?

OS: Ubuntu 18
Mesa Version: 18.2.0
Graphics Card: R9 390x (8GB)

-- 
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 107385] full Screen Corruption when a program is fullscreen

2018-07-26 Thread bugzilla-daemon
https://bugs.freedesktop.org/show_bug.cgi?id=107385

--- Comment #1 from monkeyinastripedsh...@gmail.com ---
Created attachment 140827
  --> https://bugs.freedesktop.org/attachment.cgi?id=140827&action=edit
Corruption

This is what it looks like on my monitors.

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


Re: [Mesa-dev] [PATCH v2] nir/gather_info: Set info.gs.uses_streams

2018-07-26 Thread Alejandro Piñeiro
Forgot to CC Jason


On 24/07/18 15:28, Alejandro Piñeiro wrote:
> From: Neil Roberts 
>
> Whenever a non-zero stream is written to it now sets uses_streams to
> true. This reflects the code in validate_geometry_shader_emissions for
> GLSL.
>
> v2: set uses_streams at gather_info instead that at spirv to nir
> (Jason Ekstrand)
> ---
>  src/compiler/nir/nir_gather_info.c | 5 +
>  1 file changed, 5 insertions(+)
>
> diff --git a/src/compiler/nir/nir_gather_info.c 
> b/src/compiler/nir/nir_gather_info.c
> index 2b431e343e9..d0b656ea741 100644
> --- a/src/compiler/nir/nir_gather_info.c
> +++ b/src/compiler/nir/nir_gather_info.c
> @@ -288,6 +288,11 @@ gather_intrinsic_info(nir_intrinsic_instr *instr, 
> nir_shader *shader,
> case nir_intrinsic_end_primitive_with_counter:
>assert(shader->info.stage == MESA_SHADER_GEOMETRY);
>shader->info.gs.uses_end_primitive = 1;
> +
> +   case nir_intrinsic_emit_vertex:
> +  if (nir_intrinsic_stream_id(instr) > 0)
> + shader->info.gs.uses_streams = true;
> +
>break;
>  
> default:

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


Re: [Mesa-dev] [PATCH mesa] docs: trivial html fix

2018-07-26 Thread Emil Velikov
On 26 July 2018 at 01:01, Jordan Justen  wrote:
> You might as well add something like ">" => ">" to the subject.
>
Yes, please.

Reviewed-by: Emil Velikov 

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


Re: [Mesa-dev] [RFC][PATCH 5/5] Android.mk: Fix checkbuild on Mac builders.

2018-07-26 Thread Emil Velikov
On 25 July 2018 at 20:33, Alistair Strachan  wrote:
> On Wed, Jul 25, 2018 at 5:48 AM Emil Velikov  wrote:
>>
>> On 25 July 2018 at 00:21, John Stultz  wrote:
>> > From: Alistair Strachan 
>> >
>> > This is a forward port of a patch in the AOSP/master tree:
>> > https://android.googlesource.com/platform/external/mesa3d/+/d7f894a7d39e66ca5a832c19edaf175400041aff%5E%21/
>> >
>> > The libmesa_dri_common target depends on xgettext unconditionally, but
>> > this is not a documented dependency of AOSP and is not installed on the
>> > Mac builders, so we must not build any part of mesa3d on these
>> > platforms.
>> >
>> > Cc: Rob Herring 
>> > Cc: Alistair Strachan 
>> > Cc: Marissa Wall 
>> > Cc: Sumit Semwal 
>> > Cc: Emil Velikov 
>> > Cc: Rob Clark 
>> > Signed-off-by: Alistair Strachan 
>> > Signed-off-by: John Stultz 
>> > ---
>> >  Android.mk | 5 -
>> >  1 file changed, 4 insertions(+), 1 deletion(-)
>> >
>> > diff --git a/Android.mk b/Android.mk
>> > index 494b4b9..128db4d 100644
>> > --- a/Android.mk
>> > +++ b/Android.mk
>> > @@ -30,6 +30,8 @@
>> >  # module will also be built.  DRI modules will be loaded by libGLES_mesa.
>> >
>> >  ifneq ($(BOARD_USE_CUSTOMIZED_MESA), true)
>> > +ifneq ($(BOARD_GPU_DRIVERS),)
>> > +
>>
>> Something looks fairly weird here. Commit message talks about Mac and
>> xgettext while this here checks for BOARD_GPU_DRIVERS.
>
> This change is actually papering over another bug in the makefiles: if
> BOARD_GPU_DRIVERS is the empty string, bits of mesa (I think the Intel
> drivers IIRC) will still be built due to some makefile logic that I
> didn't track down yet. This can be reproduced with "mmma
> external/mesa3d" for a device that does not specify
> BOARD_GPU_DRIVERS).
>
> As part of 'checkbuild', all reachable modules will be built for a
> given lunch target, this means all modules *must build* or the modules
> should not be emitted in the first place. If that bug was tracked down
> and fixed, we wouldn't need to mask the parsing of the mesa
> makefile/directory because BOARD_GPU_DRIVERS being the empty string
> would be enough to suppress these driver module definitions.
>
If BOARD_GPU_DRIVERS is not set, nothing should be build. Actually
your Intel hint gave me an idea:
We don't have a BOARD_GPU_DRIVERS based guard for the Intel (ANV) Vulkan driver.

Sadly, I won't have any time to look at this. John, others with an
Android setup handy - care to do the honours?
See how BOARD_GPU_DRIVERS controls what gets built and add similar
guards for ANV.

>> IIRC, libGLES_mesa must be explicitly pulled in the device
>> manifest/project in order to for Mesa be built. The exact same one
>> tends to set BOARD_GPU_DRIVERS.
>
> external/mesa3d is part of the upstream manifest. We are therefore
> holding this project to the highest standard: all modules must build
> on all targets, or be appropriately suppressed. All modules reachable
> with "mmm" must build for every target.
>
That's pretty high expectation, although not unreasonable.

>> Or looking it from another angle - if the Mac builder is missing
>> xgettext one could add it, becoming in sync with other builders.
>> Quick search shows that it's available in brew (brew install gettext)
>> and one can build it locally.
>
> AFAICT this won't happen. The dependencies for AOSP are documented on
> https://source.android.com/setup/build/initializing, and this list
> does not include xgettext. It's just that Linux distros tend to
> include xgettext in even the most minimal installation. On Mac, such a
> list (other than the one documented by that page) does not exist. To
> me, this seems like a porting issue that should be resolved
> appropriately for AOSP.
>
Ack. I assumed that xgettext was in the (Linux) list w/o checking.

> (IOW: ideally the dependencies on xgettext and python-maco should be
> removed so that these tools are not required to build Mesa for
> Android. The python-maco dependency has been worked around on the AOSP
> fork of mesa by directing the makefiles to a set of pregenerated files
> but this change, along with the hack discussed here, is not a
> good/sustainable solution.)
>
Personally, I don't mind removing those deps. although we'd need some
alternative way to getting the job done.
Something that the Mesa community is happy with.

Until then sharing some extra solutions/workarounds:
 - Check-in sources from the release tarballs which include all the
generated sources.
Hence above two deps. should not be needed.

 - Have a script which generates the files each time the repo is sync'd, ala
git reset --hard origin/foo; generate bits; git commit -am "checking
generated sources"


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


Re: [Mesa-dev] [RFC][PATCH 3/5] CleanSpec.mk: Remove HOST_OUT_release

2018-07-26 Thread Emil Velikov
On 25 July 2018 at 21:20, John Stultz  wrote:
> On Wed, Jul 25, 2018 at 1:06 PM, Dan Willemsen  wrote:
>> On Wed, Jul 25, 2018 at 12:35 PM John Stultz  wrote:
>>>
>>> On Wed, Jul 25, 2018 at 5:36 AM, Emil Velikov  
>>> wrote:
>>> > On 25 July 2018 at 00:21, John Stultz  wrote:
>>> >> From: Dan Willemsen 
>>> >>
>>> >> This is a forward port of a patch from the AOSP/master tree:
>>> >> https://android.googlesource.com/platform/external/mesa3d/+/bd633f11de0c6ac1ed333a28344c74fd9898df9e%5E%21/
>>> >>
>>> >> Which replaces HOST_OUT_release with HOST_OUT
>>> >>
>>> > What's wrong with HOST_OUT_release? If it is something that got
>>> > deprecated, we could:
>>> >  a) add a comment above it (deprecated since Android ...)
>>> >  b) add the HOST_OUT alongside the existing HOST_OUT_release
>>>
>>> Seems to be the case since:
>>> https://android.googlesource.com/platform/build/+/d6ed368fde0609742540b5da6d2e8a2a19b2c0eb%5E%21/
>>>
>>> Dan/Alistair: Any objections to option b?
>>
>> You can't add side-by-side, since new lines must be added at the end of the
>> file (the makefiles keep track of which lines were run by index, not their
>> contents). But when that variable isn't set, it would try to remove
>> "/*/EXECUTABLES/...
>> You could do something like:
>>
>> ifdef HOST_OUT_release
>> ...
>> else
>> ...
>> endif
>>
>> But it was already incorrect to use $(HOST_OUT_release) here, $(HOST_OUT) 
>> will
>> be set properly for whether the current build that's being cleaned during
>> incrementals is using host debug or release builds (it was incredibly 
>> uncommon
>> to use a debug host build, there was never a shortcut to use that, you had to
>> set an environment variable manually, and it was rarely if ever tested).
>
> Emil: Is this sufficient justification to drop HOST_OUT_release then?
>
Seems reasonable. With the explanation split into proper sentences and
included to the commit message, the patch is
Reviewed-by: Emil Velikov 

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


[Mesa-dev] [Bug 107224] Incorrect Rendering in Deus Ex: Mankind Divided in-game menu

2018-07-26 Thread bugzilla-daemon
https://bugs.freedesktop.org/show_bug.cgi?id=107224

--- Comment #5 from Alex Smith  ---
Could you go into "~/.local/share/feral-interactive/Deus Ex Mankind
Divided/preferences", find this line:

6

change 6 to 1, and see if that fixes the problem?

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


Re: [Mesa-dev] [PATCH] i965: Disable guardband clipping on SandyBridge for odd dimensions

2018-07-26 Thread Vadym Shovkoplias
ping

On Tue, Jul 3, 2018 at 5:09 PM, Vadim Shovkoplias <
vadim.shovkopl...@gmail.com> wrote:

> Hi mesa devs,
>
> Can anyone please review this ?
> This patch fixes following bugs:
>
> Bugzilla: https://bugs.freedesktop.org/show_bug.cgi?id=104388
> Bugzilla: https://bugs.freedesktop.org/show_bug.cgi?id=106158
> Bugzilla: https://bugs.freedesktop.org/show_bug.cgi?id=106667
>
>
> 2018-06-07 18:27 GMT+03:00 Vadim Shovkoplias 
> :
>
>> Hi Kenneth,
>>
>> Can you please look at this patch ?
>>
>> 2018-06-07 15:30 GMT+03:00 Den :
>>
>>> Hello. Found out that this patch also fixes 2 new issues:
>>>
>>> Bugzilla: https://bugs.freedesktop.org/show_bug.cgi?id=106158
>>>
>>> Bugzilla: https://bugs.freedesktop.org/show_bug.cgi?id=106667
>>>
>>> Tested-by: Denis 
>>>
>>>
>>>
>>> On 24.05.18 14:16, vadym.shovkoplias wrote:
>>>
 Bugzilla: https://bugs.freedesktop.org/show_bug.cgi?id=104388
 Signed-off-by: Andriy Khulap 
 ---
   src/mesa/drivers/dri/i965/genX_state_upload.c | 11 +++
   1 file changed, 11 insertions(+)

 diff --git a/src/mesa/drivers/dri/i965/genX_state_upload.c
 b/src/mesa/drivers/dri/i965/genX_state_upload.c
 index b485e2c..5aa8033 100644
 --- a/src/mesa/drivers/dri/i965/genX_state_upload.c
 +++ b/src/mesa/drivers/dri/i965/genX_state_upload.c
 @@ -2473,6 +2473,17 @@ brw_calculate_guardband_size(uint32_t fb_width,
 uint32_t fb_height,
   */
  const float gb_size = GEN_GEN >= 7 ? 16384.0f : 8192.0f;
   +   /* Workaround: prevent gpu hangs on SandyBridge
 +* by disabling guardband clipping for odd dimensions.
 +*/
 +   if (GEN_GEN == 6 && (fb_width & 1 || fb_height & 1)) {
 +  *xmin = -1.0f;
 +  *xmax =  1.0f;
 +  *ymin = -1.0f;
 +  *ymax =  1.0f;
 +  return;
 +   }
 +
  if (m00 != 0 && m11 != 0) {
 /* First, we compute the screen-space render area */
 const float ss_ra_xmin = MIN3(0, m30 + m00, m30 - m00);

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


-- 

Vadym Shovkoplias | Senior Software Engineer
GlobalLogic
P +380.57.766.7667  M +3.8050.931.7304  S vadym.shovkoplias
www.globallogic.com

http://www.globallogic.com/email_disclaimer.txt
___
mesa-dev mailing list
mesa-dev@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/mesa-dev


Re: [Mesa-dev] [RFC][PATCH 4/5] Android.mk: Add option to use vendor version of mesa

2018-07-26 Thread Emil Velikov
On 25 July 2018 at 20:52, John Stultz  wrote:
> On Wed, Jul 25, 2018 at 5:42 AM, Emil Velikov  
> wrote:
>> On 25 July 2018 at 00:21, John Stultz  wrote:
>>> From: Yong Yao 
>>>
>>> This is a forward port of a patch from the AOSP/master branch:
>>> https://android.googlesource.com/platform/external/mesa3d/+/b1e5fad1db4c1d51c7ae3a033b100a8429ae5415%5E%21/
>>>
>>> Which allows boards to provide their own custom copy of mesa.
>>>
>> Thanks for sorting these out John.
>>
>> My understanding was that when a custom project repo is used one
>> handles that in the device manifest. Roughly as:
>>  - foo.xml -> contains vast majority of the git repos with associated 
>> tags/etc
>>  - local.xml -> removes any repo/project from ^^, adds new one
>>
>> Is that no longer the case, or I simply misremember how Android does things?
>
> So, I'm not aware of the specific history behind this patch. And I
> can't speak for Google, there has been a general push via the Treble
> efforts to standardize the Android system image, and to push vendors
> to keep any device specific bits into their own device directory.  So
> there is a strong disincentive to modify projects in AOSP and in order
> to include things like devboards into AOSP, the push has been to limit
> any device specific changes to only the device directory git tree.
>
> So while one can technically still replace projects with local repos
> (and this is very useful for development!), I think they do not want
> folks doing this for shipping devices.
>
Hmm using the word "local" brought some assumptions that were never made.
AFAICT the remove/add project manifest combo can be used local
changes/testing as well as for "shipping devices".
Can it not?

> We are trying to make sure device support is pushed upstream to fdo,
> and then align AOSP's mesa to that, but one could imagine a board that
> doesn't have support upstream in mesa, and provides its own copy of
> mesa in the device directory. This patch allows the build to override
> the default mesa project with the vendor provided mesa.
>
Since the vendor will already need to add the project (git repo etc),
what is the blocker from removing the existing one beforehand?
Last I've tried - the repo tool gives you a nice and clear
warning/error message.

There is one case where this patch is a must. If repo forbids removing
"core" Android projects via the manifest.


Can anyone access the bug referenced in the gerrit commit?
Guess it could provide some clarity on the topic.

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


[Mesa-dev] [Bug 107385] full Screen Corruption when a program is fullscreen

2018-07-26 Thread bugzilla-daemon
https://bugs.freedesktop.org/show_bug.cgi?id=107385

--- Comment #2 from Michel Dänzer  ---
(In reply to monkeyinastripedshirt from comment #0)
> This seemed to appear a few days ago after updating the obiaf ppa on Ubuntu
> 18.

Can you look up in /var/log/apt/history.log which packages were updated, and
what the old and new package versions are?


Please also attach the corresponding Xorg log file and dmesg output.

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


Re: [Mesa-dev] [PATCH v2 1/2] egl/surfaceless: Define DRI_SWRastLoader extension when using swrast.

2018-07-26 Thread Emil Velikov
Hi David,

On 18 July 2018 at 01:12, David Riley  wrote:

Commit message here should explain why this is needed. Is the current
kms_swrast usage failing/crashing somewhere, etc.

> Signed-off-by: David Riley 
> ---
>  src/egl/drivers/dri2/platform_surfaceless.c | 28 +
>  1 file changed, 23 insertions(+), 5 deletions(-)
>
> diff --git a/src/egl/drivers/dri2/platform_surfaceless.c 
> b/src/egl/drivers/dri2/platform_surfaceless.c
> index a0348a5e95..f5fe7119c6 100644
> --- a/src/egl/drivers/dri2/platform_surfaceless.c
> +++ b/src/egl/drivers/dri2/platform_surfaceless.c
> @@ -260,6 +260,13 @@ static const __DRIimageLoaderExtension 
> image_loader_extension = {
> .flushFrontBuffer = surfaceless_flush_front_buffer,
>  };
>
> +static const __DRIswrastLoaderExtension swrast_loader_extension = {
> +   .base= { __DRI_SWRAST_LOADER, 1 },
> +   .getDrawableInfo = NULL,
> +   .putImage= NULL,
> +   .getImage= NULL,
> +};
> +
>  #define DRM_RENDER_DEV_NAME  "%s/renderD%d"
>
>  static const __DRIextension *image_loader_extensions[] = {
> @@ -269,6 +276,14 @@ static const __DRIextension *image_loader_extensions[] = 
> {
> NULL,
>  };
>
> +static const __DRIextension *swrast_loader_extensions[] = {
> +   &swrast_loader_extension.base,
> +   &image_loader_extension.base,
> +   &image_lookup_extension.base,
> +   &use_invalidate.base,
How did you compiler this list. Gut suggests that at least one of
those should not be here.
Doesn't this break the existing kms_swrast usage?


>
>dri2_dpy->fd = fd;
> -  if (dri2_load_driver_dri3(dpy))
> +  if (dri2_load_driver_dri3(dpy)) {
>   return true;
> +  }
Unnecessary change.

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


[Mesa-dev] [Bug 107224] Incorrect Rendering in Deus Ex: Mankind Divided in-game menu

2018-07-26 Thread bugzilla-daemon
https://bugs.freedesktop.org/show_bug.cgi?id=107224

--- Comment #6 from network...@rkmail.ru ---
(In reply to Alex Smith from comment #5)
> Could you go into "~/.local/share/feral-interactive/Deus Ex Mankind
> Divided/preferences", find this line:
> 
> 6
> 
> change 6 to 1, and see if that fixes the problem?

That definitely makes glitches go away for me.

-- 
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 v3] nvc0: serialize before updating some constant buffer bindings

2018-07-26 Thread Rhys Perry
To avoid serializing, this has the user constant buffer always be 65536
bytes and enabled unless it's required that something else is used for
constant buffer 0.

Fixes artifacts with at least XCOM: Enemy Within, 0 A.D. and Unigine
Valley, Heaven and Superposition.

v2: changed uniform_buffer_bound to be bool instead of a uint32_t
v3: remove magic constants
v3: remove pointless code in nvc0_validate_driverconst

Fixes: https://bugs.freedesktop.org/show_bug.cgi?id=100177
Signed-off-by: Rhys Perry 
---
 src/gallium/drivers/nouveau/nvc0/nvc0_compute.c| 13 +++---
 src/gallium/drivers/nouveau/nvc0/nvc0_screen.c | 48 ++---
 src/gallium/drivers/nouveau/nvc0/nvc0_screen.h | 17 +++-
 .../drivers/nouveau/nvc0/nvc0_state_validate.c | 50 --
 4 files changed, 81 insertions(+), 47 deletions(-)

diff --git a/src/gallium/drivers/nouveau/nvc0/nvc0_compute.c 
b/src/gallium/drivers/nouveau/nvc0/nvc0_compute.c
index 11635c9465..4963493877 100644
--- a/src/gallium/drivers/nouveau/nvc0/nvc0_compute.c
+++ b/src/gallium/drivers/nouveau/nvc0/nvc0_compute.c
@@ -181,7 +181,7 @@ nvc0_compute_invalidate_constbufs(struct nvc0_context *nvc0)
/* Invalidate all 3D constbufs because they are aliased with COMPUTE. */
for (s = 0; s < 5; s++) {
   nvc0->constbuf_dirty[s] |= nvc0->constbuf_valid[s];
-  nvc0->state.uniform_buffer_bound[s] = 0;
+  nvc0->state.uniform_buffer_bound[s] = false;
}
nvc0->dirty_3d |= NVC0_NEW_3D_CONSTBUF;
 }
@@ -203,19 +203,18 @@ nvc0_compute_validate_constbufs(struct nvc0_context *nvc0)
  assert(i == 0); /* we really only want OpenGL uniforms here */
  assert(nvc0->constbuf[s][0].u.data);
 
- if (nvc0->state.uniform_buffer_bound[s] < size) {
-nvc0->state.uniform_buffer_bound[s] = align(size, 0x100);
+ if (!nvc0->state.uniform_buffer_bound[s]) {
+nvc0->state.uniform_buffer_bound[s] = true;
 
 BEGIN_NVC0(push, NVC0_CP(CB_SIZE), 3);
-PUSH_DATA (push, nvc0->state.uniform_buffer_bound[s]);
+PUSH_DATA (push, NVC0_MAX_CONSTBUF_SIZE);
 PUSH_DATAh(push, bo->offset + base);
 PUSH_DATA (push, bo->offset + base);
 BEGIN_NVC0(push, NVC0_CP(CB_BIND), 1);
 PUSH_DATA (push, (0 << 8) | 1);
  }
  nvc0_cb_bo_push(&nvc0->base, bo, NV_VRAM_DOMAIN(&nvc0->screen->base),
- base, nvc0->state.uniform_buffer_bound[s],
- 0, (size + 3) / 4,
+ base, NVC0_MAX_CONSTBUF_SIZE, 0, (size + 3) / 4,
  nvc0->constbuf[s][0].u.data);
   } else {
  struct nv04_resource *res =
@@ -236,7 +235,7 @@ nvc0_compute_validate_constbufs(struct nvc0_context *nvc0)
 PUSH_DATA (push, (i << 8) | 0);
  }
  if (i == 0)
-nvc0->state.uniform_buffer_bound[s] = 0;
+nvc0->state.uniform_buffer_bound[s] = false;
   }
}
 
diff --git a/src/gallium/drivers/nouveau/nvc0/nvc0_screen.c 
b/src/gallium/drivers/nouveau/nvc0/nvc0_screen.c
index 37e10dcd07..bcd30b560b 100644
--- a/src/gallium/drivers/nouveau/nvc0/nvc0_screen.c
+++ b/src/gallium/drivers/nouveau/nvc0/nvc0_screen.c
@@ -382,7 +382,7 @@ nvc0_screen_get_shader_param(struct pipe_screen *pscreen,
case PIPE_SHADER_CAP_MAX_OUTPUTS:
   return 32;
case PIPE_SHADER_CAP_MAX_CONST_BUFFER_SIZE:
-  return 65536;
+  return NVC0_MAX_CONSTBUF_SIZE;
case PIPE_SHADER_CAP_MAX_CONST_BUFFERS:
   return NVC0_MAX_PIPE_CONSTBUFS;
case PIPE_SHADER_CAP_INDIRECT_OUTPUT_ADDR:
@@ -829,6 +829,40 @@ nvc0_screen_resize_text_area(struct nvc0_screen *screen, 
uint64_t size)
return 0;
 }
 
+void
+nvc0_screen_bind_cb_3d(struct nvc0_screen *screen, bool *can_serialize,
+   int stage, int index, int size, uint64_t addr)
+{
+   assert(stage != 5);
+
+   struct nouveau_pushbuf *push = screen->base.pushbuf;
+
+   if (screen->base.class_3d >= GM107_3D_CLASS) {
+  struct nvc0_cb_binding *binding = &screen->cb_bindings[stage][index];
+
+  // TODO: Better figure out the conditions in which this is needed
+  bool serialize = binding->addr == addr && binding->size != size;
+  if (can_serialize)
+ serialize = serialize && *can_serialize;
+  if (serialize) {
+ IMMED_NVC0(push, NVC0_3D(SERIALIZE), 0);
+ if (can_serialize)
+*can_serialize = false;
+  }
+
+  binding->addr = addr;
+  binding->size = size;
+   }
+
+   if (size >= 0) {
+  BEGIN_NVC0(push, NVC0_3D(CB_SIZE), 3);
+  PUSH_DATA (push, size);
+  PUSH_DATAh(push, addr);
+  PUSH_DATA (push, addr);
+   }
+   IMMED_NVC0(push, NVC0_3D(CB_BIND(stage)), (index << 4) | (size >= 0));
+}
+
 #define FAIL_SCREEN_INIT(str, err)\
do {   \
   NOUVEAU_ERR(str, err);  \
@@ -1272,14 +1306,14 @@ nvc0_screen_c

[Mesa-dev] [Bug 107369] "volatile" in OpenCL code not recognized by POLARIS10 and KABINI

2018-07-26 Thread bugzilla-daemon
https://bugs.freedesktop.org/show_bug.cgi?id=107369

--- Comment #4 from Aaron Watry  ---
My original theory (before I tested 6.0.1 myself) was that the spectre
mitigation changes that went into 6.0.1 broke something about compilation of CL
kernels, but that doesn't seem to have been the case (I did go through the
entire commit history of 6.0.0->6.0.1 to try to identify things that looked
suspicious).

I do run Ubuntu at home, so it would be feasible for me to at least install the
libclc version they've got and give it a spin. LLVM/Mesa might be a bit more
work, but if we run out of other options, I might give it a try. I'd have to
downgrade my whole stack, but it's possible they're compiling with different
flags/features which changes behavior somehow.

I think for now, it's worth giving the original reporter a bit of time to try
to dump the bitcode and get us a bit more info that might help us
reproduce/diagnose this since it seems there's something version/distro
specific possibly at play.  It might be useful to know the/an exact
build/tag/revision that is failing for CLBlast as well, just to eliminate that.
 I'm assuming that the latest git master is broken, but feel free to tell me
otherwise.

And to answer the implied question: libclc supports multiple LLVM versions, and
we've supported LLVM 6.0.x in libclc for a while now (and still build against
3.9 - 7.0.0svn).

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


Re: [Mesa-dev] [PATCH v2 2/2] egl/surfaceless: Allow DRMless fallback.

2018-07-26 Thread Emil Velikov
Hi David,

On 18 July 2018 at 01:12, David Riley  wrote:
> Allow platform_surfaceless to use swrast even if DRM is not available.
> To be used to allow a fuzzer for virgl to be run on a jailed VM without
> hardware GL or DRM support.
>
> Signed-off-by: David Riley 
> ---
>  src/egl/drivers/dri2/platform_surfaceless.c | 19 +++
>  1 file changed, 19 insertions(+)
>
> diff --git a/src/egl/drivers/dri2/platform_surfaceless.c 
> b/src/egl/drivers/dri2/platform_surfaceless.c
> index f5fe7119c6..f4618bfa11 100644
> --- a/src/egl/drivers/dri2/platform_surfaceless.c
> +++ b/src/egl/drivers/dri2/platform_surfaceless.c
> @@ -293,6 +293,7 @@ surfaceless_probe_device(_EGLDisplay *dpy, bool swrast)
> int fd;
> int i;
>
> +   /* Attempt to find DRM device. */
> for (i = 0; i < limit; ++i) {
>char *card_path;
>if (asprintf(&card_path, DRM_RENDER_DEV_NAME, DRM_DIR_NAME, base + i) 
> < 0)
> @@ -327,6 +328,24 @@ surfaceless_probe_device(_EGLDisplay *dpy, bool swrast)
>dri2_dpy->loader_extensions = NULL;
> }
>
> +   /* No DRM device, so attempt to fall back to software path w/o DRM. */
> +   if (swrast) {
> +  _eglLog(_EGL_DEBUG, "Falling back to surfaceless swrast without DRM.");
> +  dri2_dpy->fd = -1;
> +  dri2_dpy->driver_name = strdup("swrast");
> +  if (!dri2_dpy->driver_name) {
> + return false;
> +  }
> +
> +  if (dri2_load_driver_swrast(dpy)) {
> + dri2_dpy->loader_extensions = swrast_loader_extensions;
> + return true;
> +  }
> +
> +  free(dri2_dpy->driver_name);
> +  dri2_dpy->driver_name = NULL;
> +   }

Using swrast gives you a fairly different feature-set than kms_swrast.
Since you're doing virglrenderer fuzzing, you haven't really noticed it.

Regardless, this patch seems like a hack, alike the ones Tomeu did [1].
There are some ideas, in the comments, how to address this in a better fashion.

If you can give it a try, that'll be appreciated. I don't quite have
the time to pursue it atm.

HTH
Emil

[1]
https://gitlab.collabora.com/tomeu/mesa/commit/4f804ceecd658492234cbf0fa5fb1b156a8fb79c
https://gitlab.collabora.com/tomeu/mesa/commit/54adda6a4d7b5c783d54dfd37d38d1a5a0f3187f
___
mesa-dev mailing list
mesa-dev@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/mesa-dev


Re: [Mesa-dev] [PATCH 1/4] radv: move vk_format_table.c to generated sources

2018-07-26 Thread Emil Velikov
On 22 July 2018 at 09:14, Mauro Rossi  wrote:
> Android build system will try to compile vk_format_table.c
> as a shipped source, but at compile time it will be missing,
> we move it to generated source, where it belongs
>
> Signed-off-by: Mauro Rossi 
Please add

Fixes: f4e499ec791 ("radv: add initial non-conformant radv vulkan driver")

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


Re: [Mesa-dev] Mesa 18.2.0 release plan

2018-07-26 Thread Mario Kleiner
Hello Andreas,

the improved color depth 30 rendering support for nouveau is imho
ready for merging since about a month:

https://patchwork.freedesktop.org/project/mesa/patches/?submitter=14956&state=&q=&archive=&delegate=

The patch series submitted at 2018-06-13, and the single patch
"loader_dri3: Handle mismatched depth 30 formats for Prime
renderoffload." from 2018-06-04.

All patches have been successfully tested by myself on various
permuations of intel/amd/nvidia hardware and prime combo's of
intel+nvidia, amd+nvidia and nvidia+amd under wayland-weston and x11.
All review comments have been addressed.

Patch [4/5] egl/wayland: Allow client->server format conversion for
PRIME offload. (v2)
and
Patch [5/5] egl/wayland-drm: Only announce formats via wl_drm which
the driver supports.
and
Patch loader_dri3: Handle mismatched depth 30 formats for Prime renderoffload.

still need r-b's, although 4/5 got some review from Eric Engestroem,
but no r-b tag so far.

The remaining patches should be straightforward to review, and the
loader_dri3 patch is essentially the same as the already reviewed
[3/5], just applied to x11+prime instead of x11+eglCreateImage().
Cc'ing some people who are somewhat familiar with the patches already.

It would be good to get these merged for 18.2 before some changes in
Mesa break them again, given that they involve a lot of time intense
manual and tedious testing on lots of combos whenever i need to touch
them again. Also, more work to do on the x-server, weston, side, but
that needs a new baseline in Mesa before it makes sense for me to pile
on more work.

Thanks,
-mario




On Wed, Jul 18, 2018 at 12:55 AM, Andres Gomez  wrote:
> Hi all,
>
> Here is the tentative release plan for 18.2.0.
>
> Although the initial plan was to have the first release candidate by
> the end of this week, a slip of mind in my side on sending this plan is
> shifting the current schedule at mesa3d.org. We'll update the release
> schedule there soon.
>
>  Aug 01 2018 - Feature freeze/Release candidate 1
>  Aug 08 2018 - Release candidate 2
>  Aug 15 2018 - Release candidate 3
>  Aug 22 2018 - Release candidate 4/final release
>
> This gives us approximately two weeks until the branch point.
>
> Note: In the spririt of keeping things clearer and more transparent, we
> will be keeping track of any features planned for the release in
> Bugzilla [1].
>
> Do add a separate "Depends on" for each work you have planned.
> Alternatively you can reply to this email and I'll add them for you.
>
> [1] https://bugs.freedesktop.org/show_bug.cgi?id=106156
>
> --
> Br,
>
> Andres
> ___
> 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 3/4] android: radv: add Android.mk for vulkan.radv HAL module

2018-07-26 Thread Emil Velikov
On 22 July 2018 at 09:14, Mauro Rossi  wrote:
> radv implements the Android Vulkan HAL interface, this patch adds
> Android.mk building rules by porting of radv automake rules.
> vendor HAL module is installed as /vendor/lib/hw/vulkan.radv.so
>
> Signed-off-by: Mauro Rossi 
> ---
>  src/amd/vulkan/Android.mk | 166 ++

It would be great it this file is a bit closer to the ANV one,
although no clever ideas come to mind.

With the Fixes tag in Patch 1/4, the series is
Reviewed-by: Emil Velikov 

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


[Mesa-dev] [Bug 107385] full Screen Corruption when a program is fullscreen

2018-07-26 Thread bugzilla-daemon
https://bugs.freedesktop.org/show_bug.cgi?id=107385

--- Comment #3 from monkeyinastripedsh...@gmail.com ---
Created attachment 140838
  --> https://bugs.freedesktop.org/attachment.cgi?id=140838&action=edit
dmsg log

-- 
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 107385] full Screen Corruption when a program is fullscreen

2018-07-26 Thread bugzilla-daemon
https://bugs.freedesktop.org/show_bug.cgi?id=107385

--- Comment #4 from monkeyinastripedsh...@gmail.com ---
>Can you look up in /var/log/apt/history.log which packages were updated, and 
>what the old and new package versions are?

18.2~git1807210730.e1febb~oibaf~b possibly? I updated to that on sunday. I said
seemed because I don't know when the last time I played a game in fullscreen,
it very well could have been much earlier. It also might be worth noting that
things like YouTube videos might also have this issue, but not always as
yesterday I tried to fullscreen a video and it happened.

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


Re: [Mesa-dev] [PATCH] util/disk_cache: Fix disk_cache_get_function_timestamp with disabled cache.

2018-07-26 Thread Emil Velikov
Hi Bas,

Pardon for joining so late.

On 18 July 2018 at 13:01, Bas Nieuwenhuizen  wrote:
> radv always needs it, so just check the header instead. Also
> do not declare the function if the variable is not set, so we
> get a nice compile error instead of failing to open a device
> at runtime.
>
AFAICT the ENABLE_SHADER_CACHE define is set on all POSIX platforms.
Back in the early days we had --enable-shader-cache which was removed
with d1efa09d342bff3e5def2978a0bef748d74f9c82

Apart from the reasons listed, we do not want to control this at
configure time since it will produce varying driver behaviour. Hence
multiple unhappy users, as they hit the codepath w/o cache.

Skimming through - I would imagine you're building with meson, which
has the explicit shader cache toggle.
I'm assuming Dylan had it based on early autconf builds?

We can drop that one and effectively revert this and the follow-up Android fix.

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


[Mesa-dev] [Bug 107385] full Screen Corruption when a program is fullscreen

2018-07-26 Thread bugzilla-daemon
https://bugs.freedesktop.org/show_bug.cgi?id=107385

--- Comment #5 from Michel Dänzer  ---
(In reply to monkeyinastripedshirt from comment #4)
> 18.2~git1807210730.e1febb~oibaf~b possibly? I updated to that on sunday.

What was the previous version? /var/log/apt/history.log lists both on the
Upgrade: line.

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


Re: [Mesa-dev] [PATCH 3/4] android: radv: add Android.mk for vulkan.radv HAL module

2018-07-26 Thread Mauro Rossi
Hi Emil,

Il giorno gio 26 lug 2018 alle ore 16:48 Emil Velikov
 ha scritto:
>
> On 22 July 2018 at 09:14, Mauro Rossi  wrote:
> > radv implements the Android Vulkan HAL interface, this patch adds
> > Android.mk building rules by porting of radv automake rules.
> > vendor HAL module is installed as /vendor/lib/hw/vulkan.radv.so
> >
> > Signed-off-by: Mauro Rossi 
> > ---
> >  src/amd/vulkan/Android.mk | 166 ++
>
> It would be great it this file is a bit closer to the ANV one,
> although no clever ideas come to mind.

As a Quick Win, I think I could pull up this of one level as
src/amd/Android.vulkan.mk,
perform the necessary changes in paths, modify 4/4 accordingly,
test build and no regression and then and push to gitlab with those changes.

No problem to do that.

Please, let me know if I may send 3/4 and 4/4 for review
to you, to avoid resubmitting and re-reviewing the full series.

Is it ok for you?
Mauro

>
> With the Fixes tag in Patch 1/4, the series is
> Reviewed-by: Emil Velikov 
>
> Thanks
> Emil
___
mesa-dev mailing list
mesa-dev@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/mesa-dev


Re: [Mesa-dev] [PATCH] i965: Disable guardband clipping on SandyBridge for odd dimensions

2018-07-26 Thread Rafael Antognolli
Hi Vadym,

Ken and Ian explained a bit the situation on this one to me, and it
looks like neither of them are really against this patch. So unless
someone else raise any concern, I'll ack and push the patch later today.

Thanks for fixing this.

Rafael

On Thu, Jul 26, 2018 at 04:04:29PM +0300, Vadym Shovkoplias wrote:
> ping
> 
> On Tue, Jul 3, 2018 at 5:09 PM, Vadim Shovkoplias 
> 
> wrote:
> 
> Hi mesa devs,
> 
> Can anyone please review this ? 
> This patch fixes following bugs:
> 
> Bugzilla: https://bugs.freedesktop.org/show_bug.cgi?id=104388
> Bugzilla: https://bugs.freedesktop.org/show_bug.cgi?id=106158
> Bugzilla: https://bugs.freedesktop.org/show_bug.cgi?id=106667
> 
>
> 2018-06-07 18:27 GMT+03:00 Vadim Shovkoplias 
> :
> 
> Hi Kenneth,
> 
> Can you please look at this patch ?
> 
> 2018-06-07 15:30 GMT+03:00 Den :
> 
> Hello. Found out that this patch also fixes 2 new issues:
> 
> Bugzilla: https://bugs.freedesktop.org/show_bug.cgi?id=106158
> 
> Bugzilla: https://bugs.freedesktop.org/show_bug.cgi?id=106667
> 
> Tested-by: Denis 
> 
> 
> 
> On 24.05.18 14:16, vadym.shovkoplias wrote:
> 
> Bugzilla: https://bugs.freedesktop.org/show_bug.cgi?id=104388
> Signed-off-by: Andriy Khulap 
> ---
>   src/mesa/drivers/dri/i965/genX_state_upload.c | 11
> +++
>   1 file changed, 11 insertions(+)
> 
> diff --git a/src/mesa/drivers/dri/i965/genX_state_upload.c b/
> src/mesa/drivers/dri/i965/genX_state_upload.c
> index b485e2c..5aa8033 100644
> --- a/src/mesa/drivers/dri/i965/genX_state_upload.c
> +++ b/src/mesa/drivers/dri/i965/genX_state_upload.c
> @@ -2473,6 +2473,17 @@ brw_calculate_guardband_size(uint32_t
> fb_width, uint32_t fb_height,
>   */
>  const float gb_size = GEN_GEN >= 7 ? 16384.0f : 8192.0f;
>   +   /* Workaround: prevent gpu hangs on SandyBridge
> +* by disabling guardband clipping for odd dimensions.
> +*/
> +   if (GEN_GEN == 6 && (fb_width & 1 || fb_height & 1)) {
> +  *xmin = -1.0f;
> +  *xmax =  1.0f;
> +  *ymin = -1.0f;
> +  *ymax =  1.0f;
> +  return;
> +   }
> +
>  if (m00 != 0 && m11 != 0) {
> /* First, we compute the screen-space render area */
> const float ss_ra_xmin = MIN3(0, m30 + m00, 
> m30
> - m00);
> 
> 
> ___
> 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
> 
> 
> 
> 
> 
> --
> 
> Vadym Shovkoplias | Senior Software Engineer
> GlobalLogic
> P +380.57.766.7667  M +3.8050.931.7304  S vadym.shovkoplias
> www.globallogic.com
>  
> http://www.globallogic.com/email_disclaimer.txt
___
mesa-dev mailing list
mesa-dev@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/mesa-dev


[Mesa-dev] [Bug 107385] full Screen Corruption when a program is fullscreen

2018-07-26 Thread bugzilla-daemon
https://bugs.freedesktop.org/show_bug.cgi?id=107385

--- Comment #6 from Michel Dänzer  ---
Specifically, I'm interested in the versions of the xserver-xorg-video-radeon
package.

BTW, there's a new version 1:18.0.1+git1807251933.fed411~oibaf~x of that
package, can you try if that helps for this issue?

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


Re: [Mesa-dev] [PATCH] util/disk_cache: Fix disk_cache_get_function_timestamp with disabled cache.

2018-07-26 Thread Bas Nieuwenhuizen
On Thu, Jul 26, 2018 at 5:01 PM, Emil Velikov  wrote:
> Hi Bas,
>
> Pardon for joining so late.
>
> On 18 July 2018 at 13:01, Bas Nieuwenhuizen  wrote:
>> radv always needs it, so just check the header instead. Also
>> do not declare the function if the variable is not set, so we
>> get a nice compile error instead of failing to open a device
>> at runtime.
>>
> AFAICT the ENABLE_SHADER_CACHE define is set on all POSIX platforms.
> Back in the early days we had --enable-shader-cache which was removed
> with d1efa09d342bff3e5def2978a0bef748d74f9c82
>
> Apart from the reasons listed, we do not want to control this at
> configure time since it will produce varying driver behaviour. Hence
> multiple unhappy users, as they hit the codepath w/o cache.
>
> Skimming through - I would imagine you're building with meson, which
> has the explicit shader cache toggle.
> I'm assuming Dylan had it based on early autconf builds?
>
> We can drop that one and effectively revert this and the follow-up Android 
> fix.
>
> What do you think?

ChromeOS disables it for reasons I'm currently not sure about:

https://chromium.googlesource.com/chromiumos/overlays/chromiumos-overlay/+/master/media-libs/mesa/mesa-18.2_pre1.ebuild#197

And since the primary use case for vulkan at the moment seems to be
Android and I can conceive us not being able to use the cache there
for reasons, I'm not sure if disabling the cache is really that
unreasonable, though it is not ideal that they apparently override the
upstream configure.

Since most of that stuff seems to be driven by GL, this is pretty much
a "isolate radv from whatever people do on the GL side of things"
patch.

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


Re: [Mesa-dev] [PATCH] util/disk_cache: Fix disk_cache_get_function_timestamp with disabled cache.

2018-07-26 Thread Bas Nieuwenhuizen
On Thu, Jul 26, 2018 at 5:15 PM, Bas Nieuwenhuizen
 wrote:
> On Thu, Jul 26, 2018 at 5:01 PM, Emil Velikov  
> wrote:
>> Hi Bas,
>>
>> Pardon for joining so late.
>>
>> On 18 July 2018 at 13:01, Bas Nieuwenhuizen  wrote:
>>> radv always needs it, so just check the header instead. Also
>>> do not declare the function if the variable is not set, so we
>>> get a nice compile error instead of failing to open a device
>>> at runtime.
>>>
>> AFAICT the ENABLE_SHADER_CACHE define is set on all POSIX platforms.
>> Back in the early days we had --enable-shader-cache which was removed
>> with d1efa09d342bff3e5def2978a0bef748d74f9c82
>>
>> Apart from the reasons listed, we do not want to control this at
>> configure time since it will produce varying driver behaviour. Hence
>> multiple unhappy users, as they hit the codepath w/o cache.
>>
>> Skimming through - I would imagine you're building with meson, which
>> has the explicit shader cache toggle.
>> I'm assuming Dylan had it based on early autconf builds?
>>
>> We can drop that one and effectively revert this and the follow-up Android 
>> fix.
>>
>> What do you think?
>
> ChromeOS disables it for reasons I'm currently not sure about:
>
> https://chromium.googlesource.com/chromiumos/overlays/chromiumos-overlay/+/master/media-libs/mesa/mesa-18.2_pre1.ebuild#197
>
> And since the primary use case for vulkan at the moment seems to be
> Android and I can conceive us not being able to use the cache there
> for reasons, I'm not sure if disabling the cache is really that
> unreasonable, though it is not ideal that they apparently override the
> upstream configure.

To give a bit more context on why it was disabled:

"Starting with commit 96fe36f7 in mesa, the disk shader cache has been
enabled. This feature attempts to use multi-threading during GPU
initialization while Chromium enforces single threading during the
initialization process. The conflict causes the system to hang during
boot. This patchset includes the following line in the non- ebuild
file, which disables the feature and allows platforms to boot:

append-flags "-UENABLE_SHADER_CACHE"
"
(https://chromium-review.googlesource.com/c/chromiumos/overlays/chromiumos-overlay/+/1056288)

>
> Since most of that stuff seems to be driven by GL, this is pretty much
> a "isolate radv from whatever people do on the GL side of things"
> patch.
>
>> Emil
___
mesa-dev mailing list
mesa-dev@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/mesa-dev


Re: [Mesa-dev] [PATCH 3/4] android: radv: add Android.mk for vulkan.radv HAL module

2018-07-26 Thread Mauro Rossi
Hello there,
Il giorno gio 26 lug 2018 alle ore 17:09 Mauro Rossi
 ha scritto:
>
> Hi Emil,
>
> Il giorno gio 26 lug 2018 alle ore 16:48 Emil Velikov
>  ha scritto:
> >
> > On 22 July 2018 at 09:14, Mauro Rossi  wrote:
> > > radv implements the Android Vulkan HAL interface, this patch adds
> > > Android.mk building rules by porting of radv automake rules.
> > > vendor HAL module is installed as /vendor/lib/hw/vulkan.radv.so
> > >
> > > Signed-off-by: Mauro Rossi 
> > > ---
> > >  src/amd/vulkan/Android.mk | 166 ++
> >
> > It would be great it this file is a bit closer to the ANV one,
> > although no clever ideas come to mind.
>
> As a Quick Win, I think I could pull up this of one level as
> src/amd/Android.vulkan.mk,
> perform the necessary changes in paths, modify 4/4 accordingly,
> test build and no regression and then and push to gitlab with those changes.
>
> No problem to do that.
>
> Please, let me know if I may send 3/4 and 4/4 for review
> to you, to avoid resubmitting and re-reviewing the full series.
>
> Is it ok for you?
> Mauro

Well, I was too optimistic and considering only Android building rules,
it would require to modify also the automake rules and Makefile.sources
to accomodate the change in the relative path.

At least the automake and Android for radv are aligned in the AS-IS serie.

We can align radv to anv with another patch, but it is better to check
also with AMD developers that they agree to it.

Mauro

>
> >
> > With the Fixes tag in Patch 1/4, the series is
> > Reviewed-by: Emil Velikov 
> >
> > Thanks
> > Emil
___
mesa-dev mailing list
mesa-dev@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/mesa-dev


Re: [Mesa-dev] [PATCH] util/disk_cache: Fix disk_cache_get_function_timestamp with disabled cache.

2018-07-26 Thread Emil Velikov
On 26 July 2018 at 16:25, Bas Nieuwenhuizen  wrote:
> On Thu, Jul 26, 2018 at 5:15 PM, Bas Nieuwenhuizen
>  wrote:
>> On Thu, Jul 26, 2018 at 5:01 PM, Emil Velikov  
>> wrote:
>>> Hi Bas,
>>>
>>> Pardon for joining so late.
>>>
>>> On 18 July 2018 at 13:01, Bas Nieuwenhuizen  
>>> wrote:
 radv always needs it, so just check the header instead. Also
 do not declare the function if the variable is not set, so we
 get a nice compile error instead of failing to open a device
 at runtime.

>>> AFAICT the ENABLE_SHADER_CACHE define is set on all POSIX platforms.
>>> Back in the early days we had --enable-shader-cache which was removed
>>> with d1efa09d342bff3e5def2978a0bef748d74f9c82
>>>
>>> Apart from the reasons listed, we do not want to control this at
>>> configure time since it will produce varying driver behaviour. Hence
>>> multiple unhappy users, as they hit the codepath w/o cache.
>>>
>>> Skimming through - I would imagine you're building with meson, which
>>> has the explicit shader cache toggle.
>>> I'm assuming Dylan had it based on early autconf builds?
>>>
>>> We can drop that one and effectively revert this and the follow-up Android 
>>> fix.
>>>
>>> What do you think?
>>
>> ChromeOS disables it for reasons I'm currently not sure about:
>>
>> https://chromium.googlesource.com/chromiumos/overlays/chromiumos-overlay/+/master/media-libs/mesa/mesa-18.2_pre1.ebuild#197
>>
>> And since the primary use case for vulkan at the moment seems to be
>> Android and I can conceive us not being able to use the cache there
>> for reasons, I'm not sure if disabling the cache is really that
>> unreasonable, though it is not ideal that they apparently override the
>> upstream configure.
>
> To give a bit more context on why it was disabled:
>
> "Starting with commit 96fe36f7 in mesa, the disk shader cache has been
> enabled. This feature attempts to use multi-threading during GPU
> initialization while Chromium enforces single threading during the
> initialization process. The conflict causes the system to hang during
> boot. This patchset includes the following line in the non- ebuild
> file, which disables the feature and allows platforms to boot:
>
> append-flags "-UENABLE_SHADER_CACHE"
> "
> (https://chromium-review.googlesource.com/c/chromiumos/overlays/chromiumos-overlay/+/1056288)
>
Huge thanks for the context. Did you get that from the bug report -
seems to be missing from gerrit.

Regardless, the solution seems like a good first step, although
something better is needed in the long run.

Perhaps, forcing the system to fail on thread_create and adding error
handling for util_queue_init() in src/util/disk_cache.c?
Thus anything spawning threads will get the same consistent treatment
and all of these workarounds can go.

HTH
Emil


>>
>> Since most of that stuff seems to be driven by GL, this is pretty much
>> a "isolate radv from whatever people do on the GL side of things"
>> patch.
>>
>>> Emil
___
mesa-dev mailing list
mesa-dev@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/mesa-dev


Re: [Mesa-dev] [PATCH 3/4] android: radv: add Android.mk for vulkan.radv HAL module

2018-07-26 Thread Emil Velikov
On 26 July 2018 at 16:32, Mauro Rossi  wrote:
> Hello there,
> Il giorno gio 26 lug 2018 alle ore 17:09 Mauro Rossi
>  ha scritto:
>>
>> Hi Emil,
>>
>> Il giorno gio 26 lug 2018 alle ore 16:48 Emil Velikov
>>  ha scritto:
>> >
>> > On 22 July 2018 at 09:14, Mauro Rossi  wrote:
>> > > radv implements the Android Vulkan HAL interface, this patch adds
>> > > Android.mk building rules by porting of radv automake rules.
>> > > vendor HAL module is installed as /vendor/lib/hw/vulkan.radv.so
>> > >
>> > > Signed-off-by: Mauro Rossi 
>> > > ---
>> > >  src/amd/vulkan/Android.mk | 166 ++
>> >
>> > It would be great it this file is a bit closer to the ANV one,
>> > although no clever ideas come to mind.
>>
>> As a Quick Win, I think I could pull up this of one level as
>> src/amd/Android.vulkan.mk,
>> perform the necessary changes in paths, modify 4/4 accordingly,
>> test build and no regression and then and push to gitlab with those changes.
>>
>> No problem to do that.
>>
>> Please, let me know if I may send 3/4 and 4/4 for review
>> to you, to avoid resubmitting and re-reviewing the full series.
>>
>> Is it ok for you?
>> Mauro
>
> Well, I was too optimistic and considering only Android building rules,
> it would require to modify also the automake rules and Makefile.sources
> to accomodate the change in the relative path.
>
> At least the automake and Android for radv are aligned in the AS-IS serie.
>
> We can align radv to anv with another patch, but it is better to check
> also with AMD developers that they agree to it.
>
Agreed - series seems fine as-is. Any extra tweaks can be done at a later stage.

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


[Mesa-dev] [PATCH 03/12] nir/print: Remove a bogus assert

2018-07-26 Thread Jason Ekstrand
In 1beef89ad85c47fb6, we made a bunch of changes to NIR to allow for
more than four components.  This assert was added to trigger if we ever
saw a vec16 input variable.  However, it didn't take into account the
fact that we can get matrices as input/output variables and they break
this assumption without breaking the code that follows.

Fixes: 1beef89ad85c4 "nir: prepare for bumping up max components to 16"
---
 src/compiler/nir/nir_print.c | 1 -
 1 file changed, 1 deletion(-)

diff --git a/src/compiler/nir/nir_print.c b/src/compiler/nir/nir_print.c
index 93d1c02f23d..7cb16abd146 100644
--- a/src/compiler/nir/nir_print.c
+++ b/src/compiler/nir/nir_print.c
@@ -491,7 +491,6 @@ print_var_decl(nir_variable *var, print_state *state)
   switch (var->data.mode) {
   case nir_var_shader_in:
   case nir_var_shader_out:
- assert(num_components <= 4);
  if (num_components < 4 && num_components != 0) {
 const char *xyzw = "xyzw";
 for (int i = 0; i < num_components; i++)
-- 
2.17.1

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


[Mesa-dev] [PATCH 01/12] util/list: Make some helpers take const lists

2018-07-26 Thread Jason Ekstrand
They're all just querying things about the list and not mutating
anything.
---
 src/util/list.h | 8 
 1 file changed, 4 insertions(+), 4 deletions(-)

diff --git a/src/util/list.h b/src/util/list.h
index 6edb7501109..09d1b4cae64 100644
--- a/src/util/list.h
+++ b/src/util/list.h
@@ -72,7 +72,7 @@ static inline void list_addtail(struct list_head *item, 
struct list_head *list)
 list->prev = item;
 }
 
-static inline bool list_empty(struct list_head *list);
+static inline bool list_empty(const struct list_head *list);
 
 static inline void list_replace(struct list_head *from, struct list_head *to)
 {
@@ -101,7 +101,7 @@ static inline void list_delinit(struct list_head *item)
 item->prev = item;
 }
 
-static inline bool list_empty(struct list_head *list)
+static inline bool list_empty(const struct list_head *list)
 {
return list->next == list;
 }
@@ -114,7 +114,7 @@ static inline bool list_is_singular(const struct list_head 
*list)
return list->next != NULL && list->next != list && list->next->next == list;
 }
 
-static inline unsigned list_length(struct list_head *list)
+static inline unsigned list_length(const struct list_head *list)
 {
struct list_head *node;
unsigned length = 0;
@@ -145,7 +145,7 @@ static inline void list_splicetail(struct list_head *src, 
struct list_head *dst)
dst->prev = src->prev;
 }
 
-static inline void list_validate(struct list_head *list)
+static inline void list_validate(const struct list_head *list)
 {
struct list_head *node;
assert(list->next->prev == list && list->prev->next == list);
-- 
2.17.1

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


[Mesa-dev] [PATCH 02/12] nir: Take if uses into account in ssa_def_components_read

2018-07-26 Thread Jason Ekstrand
Fixes: d800b7daa5440 "nir: Add a helper for figuring out what..."
---
 src/compiler/nir/nir.c | 3 +++
 1 file changed, 3 insertions(+)

diff --git a/src/compiler/nir/nir.c b/src/compiler/nir/nir.c
index bc7f05b3e86..a849664134f 100644
--- a/src/compiler/nir/nir.c
+++ b/src/compiler/nir/nir.c
@@ -1446,6 +1446,9 @@ nir_ssa_def_components_read(const nir_ssa_def *def)
   }
}
 
+   if (!list_empty(&def->if_uses))
+  read_mask |= 1;
+
return read_mask;
 }
 
-- 
2.17.1

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


[Mesa-dev] [PATCH 00/12] nir: Add some optimizations on variables

2018-07-26 Thread Jason Ekstrand
This series adds some optimizations on variables to try and help shaders
with indirects where we can't just throw the variables away and use SSA.
The particular motivation of this series is the tessellation control
shaders in Batman: Arkham City as translated by DXVK.  When DXVK
translates a tessellation shader, it's common to see this pattern:

layout(location=0) in vec3 v0[3];
layout(location=0) in vec2 v1[3];
layout(location=0) out vec4 oVertex[3][32];

vec4 shader_in[3][32];

void hs_main () {
oVertex[gl_InvocationId][0].xyz = shader_in[gl_InvocationId][0].xyz;
oVertex[gl_InvocationId][1].xy = shader_in[gl_InvocationId][1].xy;
// Do some other stuff
}

void main () {
shader_in[0][0].xyz = v0[0];
shader_in[1][0].xyz = v0[1];
shader_in[2][0].xyz = v0[2];
shader_in[0][1].xyz = v1[0];
shader_in[1][1].xyz = v1[1];
shader_in[2][1].xyz = v1[2];

hs_main();
}

Having that shader_in temporary array is currently stops NIR's optimization
ability dead.  In anv, we end up generating a shader that first loads all
of the inputs into temporary storage and, because they are indirect, we
generate if-ladders for the reads of shader_in.  This isn't so bad in the
above example, but Batman: Arkham City has tessellation control shaders
with 8 inputs of 9 vertices each.  That many vec4's works out to 4.5 KiB of
data which is 9x the amount of storage we have per-thread in a SIMD8
shader so we end up spilling the whole lot.

This series attempts to solve this problem (and others like it) by adding
four optimizations:

 1. Structure splitting.  This isn't actually needed for this case since
there are no structures but it's needed in order for the other passes
to be more generally applicable.

 2. Array splitting.  This pass looks at something like the shader_in array
above and determines that the second array index is only used directly
and splits it into 32 arrays of vec4[3] and 30 of those arrays then get
deleted because we never use them.

 3. Vector narrowing.  This pass looks at vectors or arrays of vectors and
tries to determine if some of the channels are unused.  It then shrinks
the vector and reworks all the load/store operations to swizzle things
appropriately for the smaller type.  This way it can delete components
from the middle of a vector.  In the example above, it takes some of
the new vec4[3] arrays created by array splitting and shrinks them to
vec3[3] or vec2[3].

 4. Array copy detection.  This is a peephole optimization that looks for
a particular array copy pattern and turns it into a copy_deref
intrinsic which copies the entire array.  This is useful because
copy_prop_vars can see through copy_deref intrinsics and turn indirect
loads from the destination of the copy into an indirect load of the
source.

The end result of those four optimizations put together is that the above
example now looks something like this (after function inlining and other
optimizations):

layout(location=0) in vec3 v0[3];
layout(location=0) in vec2 v1[3];
layout(location=0) out vec4 oVertex[3][32];

vec4 shader_in[3][32];

void main () {
oVertex[gl_InvocationId][0].xyz = v0[gl_InvocationId].xyz;
oVertex[gl_InvocationId][1].xy = v1[gl_InvocationId].xy;
// Do some other stuff
}

and we can very nicely handle the indirect per-vertex loads in the back-end
without the need for if-ladders.  The end result is that the tessellation
shaders in Batman: Arkham City no longer spill at all and are actually
readable.

Another side-effect of this series is that it potentially allows us to
vastly simplify nir_lower_vars_to_ssa.  Most of the complexity in the
vars_to_ssa pass comes with trying to handle structures, arrays, potential
aliasing, etc.  If we run structure and array splitting prior to
vars_to_ssa, we could make it only consider non-array vector or scalar
variables and get exactly the same effect.  Gone would be the pile of data
structure that we build just to determine if a particular array dimension
is indirected.

This series can be found on my gitlab here:

https://gitlab.freedesktop.org/jekstrand/mesa/commits/wip/nir-var-opts

Cc: Timothy Arceri 

Jason Ekstrand (12):
  util/list: Make some helpers take const lists
  nir: Take if uses into account in ssa_def_components_read
  nir/print: Remove a bogus assert
  nir/instr_set: Fix nir_instrs_equal for derefs
  nir/types: Add array_or_matrix helpers
  nir: Add a structure splitting pass
  nir: Add an array splitting pass
  intel/nir: Use the new structure and array splitting passes
  nir: Add a array-of-vector variable narrowing pass
  intel/nir: Use narrow_vec_vars
  nir: Add an array copy optimization
  intel/nir: Enable nir_opt_find_array_copies

 src/compiler/Makefile.sources|2 +
 src/compiler/nir/meson.build |2 +
 src/co

[Mesa-dev] [PATCH 07/12] nir: Add an array splitting pass

2018-07-26 Thread Jason Ekstrand
This pass looks for array variables where at least one level of the
array is never indirected and splits it into multiple smaller variables.
---
 src/compiler/nir/nir.h|   1 +
 src/compiler/nir/nir_split_vars.c | 525 ++
 2 files changed, 526 insertions(+)

diff --git a/src/compiler/nir/nir.h b/src/compiler/nir/nir.h
index 4af7166f25b..c6ed5bb5358 100644
--- a/src/compiler/nir/nir.h
+++ b/src/compiler/nir/nir.h
@@ -2607,6 +2607,7 @@ void nir_dump_cfg(nir_shader *shader, FILE *fp);
 
 int nir_gs_count_vertices(const nir_shader *shader);
 
+bool nir_split_array_vars(nir_shader *shader, nir_variable_mode modes);
 bool nir_split_var_copies(nir_shader *shader);
 bool nir_split_per_member_structs(nir_shader *shader);
 bool nir_split_struct_vars(nir_shader *shader, nir_variable_mode modes);
diff --git a/src/compiler/nir/nir_split_vars.c 
b/src/compiler/nir/nir_split_vars.c
index 1f59ac2f5e7..394ed2be622 100644
--- a/src/compiler/nir/nir_split_vars.c
+++ b/src/compiler/nir/nir_split_vars.c
@@ -269,3 +269,528 @@ nir_split_struct_vars(nir_shader *shader, 
nir_variable_mode modes)
 
return progress;
 }
+
+static int
+num_arrays_in_type(const struct glsl_type *type)
+{
+   int num_arrays = 0;
+   while (true) {
+  if (glsl_type_is_array(type) || glsl_type_is_matrix(type)) {
+ num_arrays++;
+ type = glsl_get_array_element(type);
+  } else if (glsl_type_is_vector_or_scalar(type)) {
+ return num_arrays;
+  } else {
+ /* Unknown type */
+ return -1;
+  }
+   }
+}
+
+static bool
+init_var_list_array_indirects(struct exec_list *vars,
+  struct hash_table *var_indirect_map,
+  void *mem_ctx)
+{
+   bool has_aoa = false;
+
+   nir_foreach_variable(var, vars) {
+  int num_arrays = num_arrays_in_type(var->type);
+  if (num_arrays > 0) {
+ BITSET_WORD *indirects = rzalloc_array(mem_ctx, BITSET_WORD,
+BITSET_WORDS(num_arrays));
+ _mesa_hash_table_insert(var_indirect_map, var, indirects);
+ has_aoa = true;
+  }
+   }
+
+   return has_aoa;
+}
+
+static void
+mark_indirects_impl(nir_function_impl *impl,
+struct hash_table *var_indirect_map,
+nir_variable_mode modes,
+void *mem_ctx)
+{
+   nir_foreach_block(block, impl) {
+  nir_foreach_instr(instr, block) {
+ if (instr->type != nir_instr_type_deref)
+continue;
+
+ nir_deref_instr *deref = nir_instr_as_deref(instr);
+ if (!(deref->mode & modes))
+continue;
+
+ if (!glsl_type_is_vector_or_scalar(deref->type))
+continue;
+
+ nir_variable *base_var = nir_deref_instr_get_variable(deref);
+ struct hash_entry *entry =
+_mesa_hash_table_search(var_indirect_map, base_var);
+ if (!entry)
+continue;
+
+ BITSET_WORD *indirects = entry->data;
+
+ nir_deref_path path;
+ nir_deref_path_init(&path, deref, mem_ctx);
+
+ for (unsigned i = 1; path.path[i]; i++) {
+/* We already know this is an AoA variable */
+assert(path.path[i]->deref_type == nir_deref_type_array_wildcard ||
+   path.path[i]->deref_type == nir_deref_type_array);
+
+if (path.path[i]->deref_type == nir_deref_type_array &&
+nir_src_as_const_value(path.path[i]->arr.index) == NULL)
+   BITSET_SET(indirects, i - 1);
+ }
+  }
+   }
+}
+
+struct elem {
+   struct elem *parent;
+
+   const struct glsl_type *type;
+
+   nir_variable *var;
+   struct elem *ind_child;
+   struct elem *children;
+};
+
+static void
+create_split_array_vars(struct elem *elem, struct elem *parent,
+BITSET_WORD *indirects, unsigned depth,
+const struct glsl_type *type,
+const char *name,
+struct split_var_state *state)
+{
+   *elem = (struct elem) {
+  .parent = parent,
+  .type = type,
+   };
+
+   if (glsl_type_is_vector_or_scalar(type)) {
+  const struct glsl_type *var_type = type;
+  for (struct elem *e = elem->parent; e; e = e->parent) {
+ if (e->ind_child)
+var_type = glsl_array_type(var_type, glsl_get_length(e->type));
+  }
+
+  /* We add parens to the variable name so it looks like "(foo[2][*])" so
+   * that further derefs will look like "(foo[2][*])[ssa_6]"
+   */
+  name = ralloc_asprintf(state->mem_ctx, "(%s)", name);
+
+  nir_variable_mode mode = state->base_var->data.mode;
+  if (mode == nir_var_local) {
+ elem->var = nir_local_variable_create(state->impl, var_type, name);
+  } else {
+ elem->var = nir_variable_create(state->shader, mode, var_type, name);
+  }
+   } else if (BITSET_TEST(indirects, depth)) {
+  elem->ind_child = ralloc(

[Mesa-dev] [PATCH 10/12] intel/nir: Use narrow_vec_vars

2018-07-26 Thread Jason Ekstrand
---
 src/intel/compiler/brw_nir.c | 1 +
 1 file changed, 1 insertion(+)

diff --git a/src/intel/compiler/brw_nir.c b/src/intel/compiler/brw_nir.c
index 96ad77c3906..506051d6419 100644
--- a/src/intel/compiler/brw_nir.c
+++ b/src/intel/compiler/brw_nir.c
@@ -542,6 +542,7 @@ brw_nir_optimize(nir_shader *nir, const struct brw_compiler 
*compiler,
do {
   progress = false;
   OPT(nir_split_array_vars, nir_var_local);
+  OPT(nir_narrow_vec_vars, nir_var_local);
   OPT(nir_lower_vars_to_ssa);
   OPT(nir_opt_copy_prop_vars);
 
-- 
2.17.1

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


[Mesa-dev] [PATCH 08/12] intel/nir: Use the new structure and array splitting passes

2018-07-26 Thread Jason Ekstrand
---
 src/intel/compiler/brw_nir.c | 2 ++
 1 file changed, 2 insertions(+)

diff --git a/src/intel/compiler/brw_nir.c b/src/intel/compiler/brw_nir.c
index 5990427b731..96ad77c3906 100644
--- a/src/intel/compiler/brw_nir.c
+++ b/src/intel/compiler/brw_nir.c
@@ -541,6 +541,7 @@ brw_nir_optimize(nir_shader *nir, const struct brw_compiler 
*compiler,
bool progress;
do {
   progress = false;
+  OPT(nir_split_array_vars, nir_var_local);
   OPT(nir_lower_vars_to_ssa);
   OPT(nir_opt_copy_prop_vars);
 
@@ -648,6 +649,7 @@ brw_preprocess_nir(const struct brw_compiler *compiler, 
nir_shader *nir)
OPT(nir_lower_global_vars_to_local);
 
OPT(nir_split_var_copies);
+   OPT(nir_split_struct_vars, nir_var_local);
 
/* Run opt_algebraic before int64 lowering so we can hopefully get rid
 * of some int64 instructions.
-- 
2.17.1

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


[Mesa-dev] [PATCH 06/12] nir: Add a structure splitting pass

2018-07-26 Thread Jason Ekstrand
---
 src/compiler/Makefile.sources |   1 +
 src/compiler/nir/meson.build  |   1 +
 src/compiler/nir/nir.h|   1 +
 src/compiler/nir/nir_split_vars.c | 271 ++
 4 files changed, 274 insertions(+)
 create mode 100644 src/compiler/nir/nir_split_vars.c

diff --git a/src/compiler/Makefile.sources b/src/compiler/Makefile.sources
index cc147218c4e..144ba94a8c6 100644
--- a/src/compiler/Makefile.sources
+++ b/src/compiler/Makefile.sources
@@ -300,6 +300,7 @@ NIR_FILES = \
nir/nir_serialize.h \
nir/nir_split_per_member_structs.c \
nir/nir_split_var_copies.c \
+   nir/nir_split_vars.c \
nir/nir_sweep.c \
nir/nir_to_lcssa.c \
nir/nir_validate.c \
diff --git a/src/compiler/nir/meson.build b/src/compiler/nir/meson.build
index a1bb19356ce..3fd5535ba52 100644
--- a/src/compiler/nir/meson.build
+++ b/src/compiler/nir/meson.build
@@ -184,6 +184,7 @@ files_libnir = files(
   'nir_serialize.h',
   'nir_split_per_member_structs.c',
   'nir_split_var_copies.c',
+  'nir_split_vars.c',
   'nir_sweep.c',
   'nir_to_lcssa.c',
   'nir_validate.c',
diff --git a/src/compiler/nir/nir.h b/src/compiler/nir/nir.h
index 3bfe7d7f7bf..4af7166f25b 100644
--- a/src/compiler/nir/nir.h
+++ b/src/compiler/nir/nir.h
@@ -2609,6 +2609,7 @@ int nir_gs_count_vertices(const nir_shader *shader);
 
 bool nir_split_var_copies(nir_shader *shader);
 bool nir_split_per_member_structs(nir_shader *shader);
+bool nir_split_struct_vars(nir_shader *shader, nir_variable_mode modes);
 
 bool nir_lower_returns_impl(nir_function_impl *impl);
 bool nir_lower_returns(nir_shader *shader);
diff --git a/src/compiler/nir/nir_split_vars.c 
b/src/compiler/nir/nir_split_vars.c
new file mode 100644
index 000..1f59ac2f5e7
--- /dev/null
+++ b/src/compiler/nir/nir_split_vars.c
@@ -0,0 +1,271 @@
+/*
+ * Copyright © 2018 Intel Corporation
+ *
+ * Permission is hereby granted, free of charge, to any person obtaining a
+ * copy of this software and associated documentation files (the "Software"),
+ * to deal 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.
+ */
+
+#include "nir.h"
+#include "nir_builder.h"
+#include "nir_deref.h"
+
+struct split_var_state {
+   void *mem_ctx;
+
+   nir_shader *shader;
+   nir_function_impl *impl;
+
+   nir_variable *base_var;
+};
+
+struct field {
+   struct field *parent;
+
+   const struct glsl_type *type;
+
+   unsigned num_fields;
+   struct field *fields;
+
+   nir_variable *var;
+};
+
+static const struct glsl_type *
+wrap_type_in_array(const struct glsl_type *type,
+   const struct glsl_type *array_type)
+{
+   if (!glsl_type_is_array(array_type))
+  return type;
+
+   const struct glsl_type *elem_type =
+  wrap_type_in_array(type, glsl_get_array_element(array_type));
+   return glsl_array_type(elem_type, glsl_get_length(array_type));
+}
+
+static void
+init_field_for_type(struct field *field, struct field *parent,
+const struct glsl_type *type,
+const char *name,
+struct split_var_state *state)
+{
+   *field = (struct field) {
+  .parent = parent,
+  .type = type,
+   };
+
+   const struct glsl_type *struct_type = glsl_without_array(type);
+   if (glsl_type_is_struct(struct_type)) {
+  field->num_fields = glsl_get_length(struct_type),
+  field->fields = ralloc_array(state->mem_ctx, struct field,
+   field->num_fields);
+  for (unsigned i = 0; i < field->num_fields; i++) {
+ char *field_name = NULL;
+ if (name) {
+ralloc_asprintf(state->mem_ctx, "%s_%s", name,
+glsl_get_struct_elem_name(struct_type, i));
+ }
+ init_field_for_type(&field->fields[i], field,
+ glsl_get_struct_field(struct_type, i),
+ field_name, state);
+  }
+   } else {
+  const struct glsl_type *var_type = type;
+  for (struct field *f = field->parent; f; f = f->parent)
+ var_type = wrap_type_in_array(v

[Mesa-dev] [PATCH 04/12] nir/instr_set: Fix nir_instrs_equal for derefs

2018-07-26 Thread Jason Ekstrand
We weren't returning at the end of the nir_isntr_type_deref case in
nir_instrs_equal and it was falling through to the default of false.
While we're at it, make the default unreachable because all statements
in the switch now have their own returns.  Had we done that before, we
would have caught this bug a long time ago.

Fixes: 19a4662a540a8c94 "nir: Add a deref instruction type"
---
 src/compiler/nir/nir_instr_set.c | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

diff --git a/src/compiler/nir/nir_instr_set.c b/src/compiler/nir/nir_instr_set.c
index 42aa61808ac..19771fcd9dd 100644
--- a/src/compiler/nir/nir_instr_set.c
+++ b/src/compiler/nir/nir_instr_set.c
@@ -357,7 +357,7 @@ nir_instrs_equal(const nir_instr *instr1, const nir_instr 
*instr2)
   default:
  unreachable("Invalid instruction deref type");
   }
-  break;
+  return true;
}
case nir_instr_type_tex: {
   nir_tex_instr *tex1 = nir_instr_as_tex(instr1);
@@ -460,7 +460,7 @@ nir_instrs_equal(const nir_instr *instr1, const nir_instr 
*instr2)
   unreachable("Invalid instruction type");
}
 
-   return false;
+   unreachable("All cases in the above switch should return");
 }
 
 static bool
-- 
2.17.1

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


[Mesa-dev] [PATCH 11/12] nir: Add an array copy optimization

2018-07-26 Thread Jason Ekstrand
This peephole optimization looks for a series of load/store_deref or
copy_deref instructions that copy an array from one variable to another
and turns it into a copy_deref that copies the entire array.  The
pattern it looks for is extremely specific but it's good enough to pick
up on the input array copies in DXVK and should also be able to pick up
the sequence generated by spirv_to_nir for a OpLoad of a large composite
followed by OpStore.  It can always be improved later if needed.
---
 src/compiler/Makefile.sources|   1 +
 src/compiler/nir/meson.build |   1 +
 src/compiler/nir/nir.h   |   2 +
 src/compiler/nir/nir_opt_find_array_copies.c | 383 +++
 4 files changed, 387 insertions(+)
 create mode 100644 src/compiler/nir/nir_opt_find_array_copies.c

diff --git a/src/compiler/Makefile.sources b/src/compiler/Makefile.sources
index 144ba94a8c6..e20c16f8f76 100644
--- a/src/compiler/Makefile.sources
+++ b/src/compiler/Makefile.sources
@@ -274,6 +274,7 @@ NIR_FILES = \
nir/nir_opt_cse.c \
nir/nir_opt_dce.c \
nir/nir_opt_dead_cf.c \
+   nir/nir_opt_find_array_copies.c \
nir/nir_opt_gcm.c \
nir/nir_opt_global_to_local.c \
nir/nir_opt_if.c \
diff --git a/src/compiler/nir/meson.build b/src/compiler/nir/meson.build
index 3fd5535ba52..8cd817616ba 100644
--- a/src/compiler/nir/meson.build
+++ b/src/compiler/nir/meson.build
@@ -158,6 +158,7 @@ files_libnir = files(
   'nir_opt_cse.c',
   'nir_opt_dce.c',
   'nir_opt_dead_cf.c',
+  'nir_opt_find_array_copies.c',
   'nir_opt_gcm.c',
   'nir_opt_global_to_local.c',
   'nir_opt_if.c',
diff --git a/src/compiler/nir/nir.h b/src/compiler/nir/nir.h
index ca437743ff8..241ee96b075 100644
--- a/src/compiler/nir/nir.h
+++ b/src/compiler/nir/nir.h
@@ -2918,6 +2918,8 @@ bool nir_opt_dce(nir_shader *shader);
 
 bool nir_opt_dead_cf(nir_shader *shader);
 
+bool nir_opt_find_array_copies(nir_shader *shader);
+
 bool nir_opt_gcm(nir_shader *shader, bool value_number);
 
 bool nir_opt_if(nir_shader *shader);
diff --git a/src/compiler/nir/nir_opt_find_array_copies.c 
b/src/compiler/nir/nir_opt_find_array_copies.c
new file mode 100644
index 000..eee06fbd1a9
--- /dev/null
+++ b/src/compiler/nir/nir_opt_find_array_copies.c
@@ -0,0 +1,383 @@
+/*
+ * Copyright © 2018 Intel Corporation
+ *
+ * Permission is hereby granted, free of charge, to any person obtaining a
+ * copy of this software and associated documentation files (the "Software"),
+ * to deal 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.
+ */
+
+#include "nir.h"
+#include "nir_builder.h"
+#include "nir_deref.h"
+
+static bool
+index_ssa_def_cb(nir_ssa_def *def, void *state)
+{
+   unsigned *index = (unsigned *) state;
+   def->index = (*index)++;
+
+   return true;
+}
+
+static nir_deref_instr *
+get_deref_for_load_src(nir_src src, unsigned first_valid_load)
+{
+   if (!src.is_ssa)
+  return NULL;
+
+   if (src.ssa->parent_instr->type != nir_instr_type_intrinsic)
+  return NULL;
+
+   nir_intrinsic_instr *load = nir_instr_as_intrinsic(src.ssa->parent_instr);
+   if (load->intrinsic != nir_intrinsic_load_deref)
+  return NULL;
+
+   if (load->dest.ssa.index < first_valid_load)
+  return NULL;
+
+   return nir_src_as_deref(load->src[0]);
+}
+
+struct match_state {
+   /* Index into the array of the last copy or -1 for no ongoing copy. */
+   unsigned next_array_idx;
+
+   /* Length of the array we're copying */
+   unsigned array_len;
+
+   /* Index into the deref path to the array we think is being copied */
+   int src_deref_array_idx;
+   int dst_deref_array_idx;
+
+   /* Deref paths of the first load/store pair or copy */
+   nir_deref_path first_src_path;
+   nir_deref_path first_dst_path;
+};
+
+static void
+match_state_init(struct match_state *state)
+{
+   state->next_array_idx = 0;
+   state->array_len = 0;
+   state->src_deref_array_idx = -1;
+   state->dst_deref_array_idx = -1;
+}
+
+static void
+match_state_finish(struct match_state *state)
+{
+   if (state->next_array_idx > 0) {
+  

[Mesa-dev] [PATCH 09/12] nir: Add a array-of-vector variable narrowing pass

2018-07-26 Thread Jason Ekstrand
This pass looks for variables with vector or array-of-vector types and
narrows the type to only the components used.
---
 src/compiler/nir/nir.h|   1 +
 src/compiler/nir/nir_split_vars.c | 530 +-
 2 files changed, 523 insertions(+), 8 deletions(-)

diff --git a/src/compiler/nir/nir.h b/src/compiler/nir/nir.h
index c6ed5bb5358..ca437743ff8 100644
--- a/src/compiler/nir/nir.h
+++ b/src/compiler/nir/nir.h
@@ -2611,6 +2611,7 @@ bool nir_split_array_vars(nir_shader *shader, 
nir_variable_mode modes);
 bool nir_split_var_copies(nir_shader *shader);
 bool nir_split_per_member_structs(nir_shader *shader);
 bool nir_split_struct_vars(nir_shader *shader, nir_variable_mode modes);
+bool nir_narrow_vec_vars(nir_shader *shader, nir_variable_mode modes);
 
 bool nir_lower_returns_impl(nir_function_impl *impl);
 bool nir_lower_returns(nir_shader *shader);
diff --git a/src/compiler/nir/nir_split_vars.c 
b/src/compiler/nir/nir_split_vars.c
index 394ed2be622..8a981dd341d 100644
--- a/src/compiler/nir/nir_split_vars.c
+++ b/src/compiler/nir/nir_split_vars.c
@@ -25,6 +25,9 @@
 #include "nir_builder.h"
 #include "nir_deref.h"
 
+/* Needed for _mesa_bitcount() */
+#include "main/macros.h"
+
 struct split_var_state {
void *mem_ctx;
 
@@ -46,15 +49,28 @@ struct field {
 };
 
 static const struct glsl_type *
-wrap_type_in_array(const struct glsl_type *type,
-   const struct glsl_type *array_type)
+wrap_type_in_matrix_or_array(const struct glsl_type *type,
+ const struct glsl_type *array_type)
 {
-   if (!glsl_type_is_array(array_type))
+   if (glsl_type_is_array(array_type)) {
+  const struct glsl_type *elem_type =
+ wrap_type_in_matrix_or_array(type, 
glsl_get_array_element(array_type));
+  return glsl_array_type(elem_type, glsl_get_length(array_type));
+   } else if (glsl_type_is_matrix(array_type)) {
+  if (glsl_type_is_scalar(type)) {
+ /* This can happen if we reduce the number of rows in a matrix to 1.
+  * Just use an array type in this case.
+  */
+ return glsl_array_type(type, glsl_get_matrix_columns(array_type));
+  } else {
+ assert(glsl_type_is_vector(type));
+ return glsl_matrix_type(glsl_get_base_type(type),
+ glsl_get_components(type),
+ glsl_get_matrix_columns(array_type));
+  }
+   } else {
   return type;
-
-   const struct glsl_type *elem_type =
-  wrap_type_in_array(type, glsl_get_array_element(array_type));
-   return glsl_array_type(elem_type, glsl_get_length(array_type));
+   }
 }
 
 static void
@@ -86,7 +102,7 @@ init_field_for_type(struct field *field, struct field 
*parent,
} else {
   const struct glsl_type *var_type = type;
   for (struct field *f = field->parent; f; f = f->parent)
- var_type = wrap_type_in_array(var_type, f->type);
+ var_type = wrap_type_in_matrix_or_array(var_type, f->type);
 
   nir_variable_mode mode = state->base_var->data.mode;
   if (mode == nir_var_local) {
@@ -689,6 +705,8 @@ split_array_derefs_impl(nir_function_impl *impl,
/* This level is split, just advance to the next element */
assert(p->deref_type == nir_deref_type_array);
unsigned idx = nir_src_as_const_value(p->arr.index)->u32[0];
+   if (idx >= glsl_get_length(tail_elem->type))
+  idx = 0; /* Overflow; we can give them anything */
tail_elem = &tail_elem->children[idx];
 } else {
/* This level isn't split, build a deref */
@@ -794,3 +812,499 @@ nir_split_array_vars(nir_shader *shader, 
nir_variable_mode modes)
 
return progress;
 }
+
+struct vec_var_usage {
+   nir_component_mask_t comps_read;
+   nir_component_mask_t comps_written;
+
+   nir_component_mask_t comps_kept;
+
+   struct set *vars_copied;
+};
+
+static struct vec_var_usage *
+get_vec_var_usage(nir_variable *var,
+  struct hash_table *var_usage_map,
+  bool add_usage_entry, void *mem_ctx)
+{
+   struct hash_entry *entry = _mesa_hash_table_search(var_usage_map, var);
+   if (entry)
+  return entry->data;
+
+   if (!add_usage_entry)
+  return NULL;
+
+   struct vec_var_usage *usage = rzalloc(mem_ctx, struct vec_var_usage);
+   _mesa_hash_table_insert(var_usage_map, var, usage);
+
+   return usage;
+}
+
+static void
+mark_deref_used(nir_deref_instr *deref,
+nir_component_mask_t comps_read,
+nir_component_mask_t comps_written,
+nir_deref_instr *copy_deref,
+struct hash_table *var_usage_map,
+nir_variable_mode modes,
+void *mem_ctx)
+{
+   if (!(deref->mode & modes))
+  return;
+
+   nir_variable *var = nir_deref_instr_get_variable(deref);
+
+   const struct glsl_type *vec_type = glsl_without_array_or_matrix(var->type);
+   if (!glsl_typ

[Mesa-dev] [PATCH 05/12] nir/types: Add array_or_matrix helpers

2018-07-26 Thread Jason Ekstrand
---
 src/compiler/nir_types.cpp | 15 +++
 src/compiler/nir_types.h   |  2 ++
 2 files changed, 17 insertions(+)

diff --git a/src/compiler/nir_types.cpp b/src/compiler/nir_types.cpp
index 3a3864414f3..c6f30368c95 100644
--- a/src/compiler/nir_types.cpp
+++ b/src/compiler/nir_types.cpp
@@ -50,6 +50,15 @@ glsl_without_array(const glsl_type *type)
return type->without_array();
 }
 
+const glsl_type *
+glsl_without_array_or_matrix(const glsl_type *type)
+{
+   type = type->without_array();
+   if (type->is_matrix())
+  type = type->column_type();
+   return type;
+}
+
 const glsl_type *
 glsl_get_array_instance(const glsl_type *type,
 unsigned array_size)
@@ -224,6 +233,12 @@ glsl_type_is_array_of_arrays(const struct glsl_type *type)
return type->is_array_of_arrays();
 }
 
+bool
+glsl_type_is_array_or_matrix(const struct glsl_type *type)
+{
+   return type->is_array() || type->is_matrix();
+}
+
 bool
 glsl_type_is_struct(const struct glsl_type *type)
 {
diff --git a/src/compiler/nir_types.h b/src/compiler/nir_types.h
index 817b7a9b345..d29edd1d6c5 100644
--- a/src/compiler/nir_types.h
+++ b/src/compiler/nir_types.h
@@ -48,6 +48,7 @@ const struct glsl_type *glsl_get_struct_field(const struct 
glsl_type *type,
 
 const struct glsl_type *glsl_get_array_element(const struct glsl_type *type);
 const struct glsl_type *glsl_without_array(const struct glsl_type *type);
+const struct glsl_type *glsl_without_array_or_matrix(const struct glsl_type 
*type);
 const struct glsl_type *glsl_get_array_instance(const struct glsl_type *type,
 unsigned array_size);
 
@@ -131,6 +132,7 @@ bool glsl_type_is_vector_or_scalar(const struct glsl_type 
*type);
 bool glsl_type_is_matrix(const struct glsl_type *type);
 bool glsl_type_is_array(const struct glsl_type *type);
 bool glsl_type_is_array_of_arrays(const struct glsl_type *type);
+bool glsl_type_is_array_or_matrix(const struct glsl_type *type);
 bool glsl_type_is_struct(const struct glsl_type *type);
 bool glsl_type_is_sampler(const struct glsl_type *type);
 bool glsl_type_is_image(const struct glsl_type *type);
-- 
2.17.1

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


[Mesa-dev] [PATCH 12/12] intel/nir: Enable nir_opt_find_array_copies

2018-07-26 Thread Jason Ekstrand
We have to be a bit careful with this one because we want it to run in
the optimization loop but only in the first brw_nir_optimize call.
Later calls assume that we've lowered away copy_deref instructions and
we don't want to introduce any more.
---
 src/intel/compiler/brw_nir.c | 16 +---
 src/intel/compiler/brw_nir.h |  3 ++-
 2 files changed, 11 insertions(+), 8 deletions(-)

diff --git a/src/intel/compiler/brw_nir.c b/src/intel/compiler/brw_nir.c
index 506051d6419..ce701f854af 100644
--- a/src/intel/compiler/brw_nir.c
+++ b/src/intel/compiler/brw_nir.c
@@ -533,7 +533,7 @@ brw_nir_no_indirect_mask(const struct brw_compiler 
*compiler,
 
 nir_shader *
 brw_nir_optimize(nir_shader *nir, const struct brw_compiler *compiler,
- bool is_scalar)
+ bool is_scalar, bool allow_copies)
 {
nir_variable_mode indirect_mask =
   brw_nir_no_indirect_mask(compiler, nir->info.stage);
@@ -544,6 +544,8 @@ brw_nir_optimize(nir_shader *nir, const struct brw_compiler 
*compiler,
   OPT(nir_split_array_vars, nir_var_local);
   OPT(nir_narrow_vec_vars, nir_var_local);
   OPT(nir_lower_vars_to_ssa);
+  if (allow_copies)
+ OPT(nir_opt_find_array_copies);
   OPT(nir_opt_copy_prop_vars);
 
   if (is_scalar) {
@@ -664,7 +666,7 @@ brw_preprocess_nir(const struct brw_compiler *compiler, 
nir_shader *nir)
 nir_lower_isign64 |
 nir_lower_divmod64);
 
-   nir = brw_nir_optimize(nir, compiler, is_scalar);
+   nir = brw_nir_optimize(nir, compiler, is_scalar, true);
 
/* This needs to be run after the first optimization pass but before we
 * lower indirect derefs away
@@ -701,7 +703,7 @@ brw_preprocess_nir(const struct brw_compiler *compiler, 
nir_shader *nir)
nir_lower_indirect_derefs(nir, indirect_mask);
 
/* Get rid of split copies */
-   nir = brw_nir_optimize(nir, compiler, is_scalar);
+   nir = brw_nir_optimize(nir, compiler, is_scalar, false);
 
OPT(nir_remove_dead_variables, nir_var_local);
 
@@ -730,11 +732,11 @@ brw_nir_link_shaders(const struct brw_compiler *compiler,
 
   const bool p_is_scalar =
  compiler->scalar_stage[(*producer)->info.stage];
-  *producer = brw_nir_optimize(*producer, compiler, p_is_scalar);
+  *producer = brw_nir_optimize(*producer, compiler, p_is_scalar, false);
 
   const bool c_is_scalar =
  compiler->scalar_stage[(*producer)->info.stage];
-  *consumer = brw_nir_optimize(*consumer, compiler, c_is_scalar);
+  *consumer = brw_nir_optimize(*consumer, compiler, c_is_scalar, false);
}
 }
 
@@ -761,7 +763,7 @@ brw_postprocess_nir(nir_shader *nir, const struct 
brw_compiler *compiler,
   OPT(nir_opt_algebraic_before_ffma);
} while (progress);
 
-   nir = brw_nir_optimize(nir, compiler, is_scalar);
+   nir = brw_nir_optimize(nir, compiler, is_scalar, false);
 
if (devinfo->gen >= 6) {
   /* Try and fuse multiply-adds */
@@ -857,7 +859,7 @@ brw_nir_apply_sampler_key(nir_shader *nir,
 
if (nir_lower_tex(nir, &tex_options)) {
   nir_validate_shader(nir);
-  nir = brw_nir_optimize(nir, compiler, is_scalar);
+  nir = brw_nir_optimize(nir, compiler, is_scalar, false);
}
 
return nir;
diff --git a/src/intel/compiler/brw_nir.h b/src/intel/compiler/brw_nir.h
index 7d82edafe46..0193457c577 100644
--- a/src/intel/compiler/brw_nir.h
+++ b/src/intel/compiler/brw_nir.h
@@ -155,7 +155,8 @@ bool brw_nir_opt_peephole_ffma(nir_shader *shader);
 
 nir_shader *brw_nir_optimize(nir_shader *nir,
  const struct brw_compiler *compiler,
- bool is_scalar);
+ bool is_scalar,
+ bool allow_copies);
 
 #define BRW_NIR_FRAG_OUTPUT_INDEX_SHIFT 0
 #define BRW_NIR_FRAG_OUTPUT_INDEX_MASK INTEL_MASK(0, 0)
-- 
2.17.1

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


Re: [Mesa-dev] [PATCH v2] nir/gather_info: Set info.gs.uses_streams

2018-07-26 Thread Jason Ekstrand
Reviewed-by: Jason Ekstrand 

On Tue, Jul 24, 2018 at 6:28 AM Alejandro Piñeiro 
wrote:

> From: Neil Roberts 
>
> Whenever a non-zero stream is written to it now sets uses_streams to
> true. This reflects the code in validate_geometry_shader_emissions for
> GLSL.
>
> v2: set uses_streams at gather_info instead that at spirv to nir
> (Jason Ekstrand)
> ---
>  src/compiler/nir/nir_gather_info.c | 5 +
>  1 file changed, 5 insertions(+)
>
> diff --git a/src/compiler/nir/nir_gather_info.c
> b/src/compiler/nir/nir_gather_info.c
> index 2b431e343e9..d0b656ea741 100644
> --- a/src/compiler/nir/nir_gather_info.c
> +++ b/src/compiler/nir/nir_gather_info.c
> @@ -288,6 +288,11 @@ gather_intrinsic_info(nir_intrinsic_instr *instr,
> nir_shader *shader,
> case nir_intrinsic_end_primitive_with_counter:
>assert(shader->info.stage == MESA_SHADER_GEOMETRY);
>shader->info.gs.uses_end_primitive = 1;
> +
> +   case nir_intrinsic_emit_vertex:
> +  if (nir_intrinsic_stream_id(instr) > 0)
> + shader->info.gs.uses_streams = true;
> +
>break;
>
> default:
> --
> 2.14.1
>
>
___
mesa-dev mailing list
mesa-dev@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/mesa-dev


Re: [Mesa-dev] [PATCH mesa] anv: don't crash on vkDestroyDevice(NULL)

2018-07-26 Thread Jason Ekstrand
On Thu, Jul 26, 2018 at 2:26 AM Eric Engestrom 
wrote:

> On Thursday, 2018-07-26 02:03:58 -0700, Jason Ekstrand wrote:
> > On Thu, Jul 26, 2018 at 1:50 AM Eric Engestrom  >
> > wrote:
> >
> > > On Wednesday, 2018-07-25 14:00:29 -0700, Dylan Baker wrote:
> > > > Quoting Eric Engestrom (2018-07-25 11:45:56)
> > > > > CovID: 1438132
> > > > > Signed-off-by: Eric Engestrom 
> > > > > ---
> > > > >  src/intel/vulkan/anv_device.c | 4 +++-
> > > > >  1 file changed, 3 insertions(+), 1 deletion(-)
> > > > >
> > > > > diff --git a/src/intel/vulkan/anv_device.c
> > > b/src/intel/vulkan/anv_device.c
> > > > > index 04fd6a829ed60081abc4..3664f80c24dc34955196 100644
> > > > > --- a/src/intel/vulkan/anv_device.c
> > > > > +++ b/src/intel/vulkan/anv_device.c
> > > > > @@ -1832,11 +1832,13 @@ void anv_DestroyDevice(
> > > > >  const VkAllocationCallbacks*pAllocator)
> > > > >  {
> > > > > ANV_FROM_HANDLE(anv_device, device, _device);
> > > > > -   struct anv_physical_device *physical_device =
> > > &device->instance->physicalDevice;
> > > > > +   struct anv_physical_device *physical_device;
> > > >
> > > > Is there a particular reason to create the pointer her but assign it
> > > after the
> > > > null check rather than just move the null check between the
> > > ANV_FROM_HANDLE and
> > > > the anv_pysical_device?
> > >
> > > Just the habit of always putting variable declarations before any logic
> > > ¯\_(ツ)_/¯
> > > I thought that was considered best-practice; has that changed?
> > >
> >
> > Yup; welcome to C99. :-)
>
> Haha, I know it's now allowed, but I thought best practice was to still
> keep things grouped, except when there's a reason to have a declaration
> in the middle of the logic.
>
> Looking at the rest of the file, I see a bunch of examples of logic and
> declarations interleaved, so I guess that rule doesn't apply in anv at
> least; guess I'll change my style to match :)
>

Yeah, I (and I think quite a few other people) prefer variables to be as
short-lived as possible.  Mixing declarations to achieve that is something
we do at least in all the Intel and NIR code.  Separation was required for
a while in core code because of VMWare's use of MSVC but now that they've
moved on to a MSVC version that has a competent C compiler, I think mixing
is allowed there too.
___
mesa-dev mailing list
mesa-dev@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/mesa-dev


[Mesa-dev] [Bug 107388] GTK Apps severely glitching after updating from 18.1.3 to 18.1.4

2018-07-26 Thread bugzilla-daemon
https://bugs.freedesktop.org/show_bug.cgi?id=107388

Bug ID: 107388
   Summary: GTK Apps severely glitching after updating from 18.1.3
to 18.1.4
   Product: Mesa
   Version: 18.0
  Hardware: x86-64 (AMD64)
OS: Linux (All)
Status: NEW
  Severity: major
  Priority: medium
 Component: Other
  Assignee: mesa-dev@lists.freedesktop.org
  Reporter: n.rijk...@gmail.com
QA Contact: mesa-dev@lists.freedesktop.org

On Manjaro linux I upgraded mesa and after restarting saw severe glitching:

https://i.imgur.com/4lTkBtv.png

Qt apps did not appear to have this problem, Chrome was fine too. I downgraded
mesa after which everything settled down.

Hardware info:

H/W path Device  Class  Description
===
 system Galago Pro (Not Applicable)
/0   busGalago Pro
/0/0 memory 64KiB BIOS
/0/13memory 16GiB System Memory
/0/13/0  memory 8GiB SODIMM DDR4 Synchronous
2133 MHz (0.5 ns)
/0/13/1  memory 8GiB SODIMM DDR4 Synchronous
2133 MHz (0.5 ns)
/0/17memory 128KiB L1 cache
/0/18memory 512KiB L2 cache
/0/19memory 3MiB L3 cache
/0/1aprocessor  Intel(R) Core(TM) i5-7200U CPU
@ 2.50GHz
/0/100   bridge Xeon E3-1200 v6/7th Gen Core
Processor Host Bridge/DRAM Registers
/0/100/2 displayHD Graphics 620
/0/100/8 genericXeon E3-1200 v5/v6 / E3-1500 v5
/ 6th/7th Gen Core Processor Gaus
/0/100/14busSunrise Point-LP USB 3.0 xHCI
Controller
/0/100/14/0  usb1busxHCI Host Controller
/0/100/14/0/1busUSB2.0 Hub
/0/100/14/0/1/1  multimedia C922 Pro Stream Webcam
/0/100/14/0/1/3  busHub
/0/100/14/0/1/3/1busUSB2.0 Hub
/0/100/14/0/1/3/1/2  input  USB Receiver
/0/100/14/0/1/3/1/3  multimedia USB Audio Device
/0/100/14/0/1/4  input  USB-HID Gaming Keyboard
/0/100/14/0/4multimedia BisonCam,NB Pro
/0/100/14/0/5communication  Bluetooth wireless interface
/0/100/14/1  usb2busxHCI Host Controller
/0/100/14/1/1busUSB3.0 Hub
/0/100/14.2  genericSunrise Point-LP Thermal
subsystem
/0/100/17storageSunrise Point-LP SATA
Controller [AHCI mode]
/0/100/1cbridge Sunrise Point-LP PCI Express
Root Port #1
/0/100/1c.4  bridge Sunrise Point-LP PCI Express
Root Port #5
/0/100/1c.4/0genericRTL8411B PCI Express Card
Reader
/0/100/1c.4/0.1  enp58s0f1   networkRTL8111/8168/8411 PCI Express
Gigabit Ethernet Controller
/0/100/1c.5  bridge Sunrise Point-LP PCI Express
Root Port #6
/0/100/1c.5/0wlp59s0 networkWireless 8265 / 8275
/0/100/1fbridge Intel(R) 100 Series Chipset
Family LPC Controller/eSPI Controller
/0/100/1f.2  memory Memory controller
/0/100/1f.3  multimedia Sunrise Point-LP HD Audio
/0/100/1f.4  busSunrise Point-LP SMBus
/0/1 scsi2   storage
/0/1/0.0.0   /dev/sdadisk   250GB WDC WDS250G1B0B-
/0/1/0.0.0/1 /dev/sda1   volume 229GiB EXT4 volume
/0/1/0.0.0/2 /dev/sda2   volume 299MiB Windows FAT volume
/0/1/0.0.0/3 /dev/sda3   volume 3672MiB Linux swap volume
/1   vnet1   networkEthernet interface
/2   virbr1-nic  networkEthernet interface
/3   virbr0-nic  networkEthernet interface
/4   virbr0  networkEthernet interface
/5   vnet0   networkEthernet interface
/6   virbr1  networkEthernet interface

-- 
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 01/12] util/list: Make some helpers take const lists

2018-07-26 Thread Thomas Helland
This is:
Reviewed-by: Thomas Helland

26. jul. 2018 18.04 skrev "Jason Ekstrand" :

They're all just querying things about the list and not mutating
anything.
---
 src/util/list.h | 8 
 1 file changed, 4 insertions(+), 4 deletions(-)

diff --git a/src/util/list.h b/src/util/list.h
index 6edb7501109..09d1b4cae64 100644
--- a/src/util/list.h
+++ b/src/util/list.h
@@ -72,7 +72,7 @@ static inline void list_addtail(struct list_head *item,
struct list_head *list)
 list->prev = item;
 }

-static inline bool list_empty(struct list_head *list);
+static inline bool list_empty(const struct list_head *list);

 static inline void list_replace(struct list_head *from, struct list_head
*to)
 {
@@ -101,7 +101,7 @@ static inline void list_delinit(struct list_head *item)
 item->prev = item;
 }

-static inline bool list_empty(struct list_head *list)
+static inline bool list_empty(const struct list_head *list)
 {
return list->next == list;
 }
@@ -114,7 +114,7 @@ static inline bool list_is_singular(const struct
list_head *list)
return list->next != NULL && list->next != list && list->next->next ==
list;
 }

-static inline unsigned list_length(struct list_head *list)
+static inline unsigned list_length(const struct list_head *list)
 {
struct list_head *node;
unsigned length = 0;
@@ -145,7 +145,7 @@ static inline void list_splicetail(struct list_head
*src, struct list_head *dst)
dst->prev = src->prev;
 }

-static inline void list_validate(struct list_head *list)
+static inline void list_validate(const struct list_head *list)
 {
struct list_head *node;
assert(list->next->prev == list && list->prev->next == list);
-- 
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] [Bug 107388] GTK Apps severely glitching after updating from 18.1.3 to 18.1.4

2018-07-26 Thread bugzilla-daemon
https://bugs.freedesktop.org/show_bug.cgi?id=107388

Michel Dänzer  changed:

   What|Removed |Added

   Assignee|mesa-dev@lists.freedesktop. |intel-3d-bugs@lists.freedes
   |org |ktop.org
  Component|Other   |Drivers/DRI/i965
 QA Contact|mesa-dev@lists.freedesktop. |intel-3d-bugs@lists.freedes
   |org |ktop.org

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


Re: [Mesa-dev] [PATCH] util/disk_cache: Fix disk_cache_get_function_timestamp with disabled cache.

2018-07-26 Thread Bas Nieuwenhuizen
On Thu, Jul 26, 2018 at 5:55 PM, Emil Velikov  wrote:
> On 26 July 2018 at 16:25, Bas Nieuwenhuizen  wrote:
>> On Thu, Jul 26, 2018 at 5:15 PM, Bas Nieuwenhuizen
>>  wrote:
>>> On Thu, Jul 26, 2018 at 5:01 PM, Emil Velikov  
>>> wrote:
 Hi Bas,

 Pardon for joining so late.

 On 18 July 2018 at 13:01, Bas Nieuwenhuizen  
 wrote:
> radv always needs it, so just check the header instead. Also
> do not declare the function if the variable is not set, so we
> get a nice compile error instead of failing to open a device
> at runtime.
>
 AFAICT the ENABLE_SHADER_CACHE define is set on all POSIX platforms.
 Back in the early days we had --enable-shader-cache which was removed
 with d1efa09d342bff3e5def2978a0bef748d74f9c82

 Apart from the reasons listed, we do not want to control this at
 configure time since it will produce varying driver behaviour. Hence
 multiple unhappy users, as they hit the codepath w/o cache.

 Skimming through - I would imagine you're building with meson, which
 has the explicit shader cache toggle.
 I'm assuming Dylan had it based on early autconf builds?

 We can drop that one and effectively revert this and the follow-up Android 
 fix.

 What do you think?
>>>
>>> ChromeOS disables it for reasons I'm currently not sure about:
>>>
>>> https://chromium.googlesource.com/chromiumos/overlays/chromiumos-overlay/+/master/media-libs/mesa/mesa-18.2_pre1.ebuild#197
>>>
>>> And since the primary use case for vulkan at the moment seems to be
>>> Android and I can conceive us not being able to use the cache there
>>> for reasons, I'm not sure if disabling the cache is really that
>>> unreasonable, though it is not ideal that they apparently override the
>>> upstream configure.
>>
>> To give a bit more context on why it was disabled:
>>
>> "Starting with commit 96fe36f7 in mesa, the disk shader cache has been
>> enabled. This feature attempts to use multi-threading during GPU
>> initialization while Chromium enforces single threading during the
>> initialization process. The conflict causes the system to hang during
>> boot. This patchset includes the following line in the non- ebuild
>> file, which disables the feature and allows platforms to boot:
>>
>> append-flags "-UENABLE_SHADER_CACHE"
>> "
>> (https://chromium-review.googlesource.com/c/chromiumos/overlays/chromiumos-overlay/+/1056288)
>>
> Huge thanks for the context. Did you get that from the bug report -
> seems to be missing from gerrit.

Nope, gerrit, just need to click on the "SHOW ALL 51 MESSAGES" button.
>
> Regardless, the solution seems like a good first step, although
> something better is needed in the long run.
>
> Perhaps, forcing the system to fail on thread_create and adding error
> handling for util_queue_init() in src/util/disk_cache.c?
> Thus anything spawning threads will get the same consistent treatment
> and all of these workarounds can go.

It is my understanding that it does not fail thread creation, but if
at sandboxing time it detects multiple threads it kills the process.
Which unfortunately turns this into a game of "you are not allowed to
create any threads but we are not telling you", which is somewhat
annoying to fix without configuration.

Not familiar enough yet with the how and why of sandboxing this way or
why we open a GL context before that though.


>
> HTH
> Emil
>
>
>>>
>>> Since most of that stuff seems to be driven by GL, this is pretty much
>>> a "isolate radv from whatever people do on the GL side of things"
>>> patch.
>>>
 Emil
___
mesa-dev mailing list
mesa-dev@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/mesa-dev


[Mesa-dev] [Bug 106156] [TRACKER] Mesa 18.2 feature tracker

2018-07-26 Thread bugzilla-daemon
https://bugs.freedesktop.org/show_bug.cgi?id=106156

Andrés Gómez García  changed:

   What|Removed |Added

 CC||mario.klei...@tuebingen.mpg
   ||.de

--- Comment #1 from Andrés Gómez García  ---
According to Mario Kleiner, it would be good to get these merged for 18.2:

https://patchwork.freedesktop.org/series/44671/
https://patchwork.freedesktop.org/patch/229397/

-- 
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 107369] "volatile" in OpenCL code not recognized by POLARIS10 and KABINI

2018-07-26 Thread bugzilla-daemon
https://bugs.freedesktop.org/show_bug.cgi?id=107369

--- Comment #5 from Aaron Watry  ---
I reverted llvm to the 6.0.0 version packaged in the padoka ppa (from my 7.0svn
build) and libclc to the package manager's version and managed to reproduce the
failure.

Failing versions:
  libclc: 0.2.0+git20180312-1
  llvm..: 1:6.0-41~exp5~ubuntu1
  mesa..: 18.2-dev (b21b38c46cd)

Since mesa hadn't changed and LLVM didn't seem to be the issue, I upgraded
libclc to the current upstream revision (still built using llvm 6.0.0), and it
started working.

Figuring that debian's version included the git checkout date, I checked out
the latest code as of both Mar 8 and Mar 12, but both of those worked as well.

So, I checked out the debian sources and re-built their .debs on my system,
those failed.

They've patched configure.py in libclc to add in some debian-specific build
flags. When I copied those changes to upstream libclc as of 20180312 it started
failing in the same way. Those same changes also break the current upstream
libclc source.

The specific lines that debian have patched libclc's configure.py with that
break things seem to be:

# add in debian build flags
proc_cflags = Popen(("dpkg-buildflags","--get","CFLAGS"), stdout=PIPE)
clang_bc_flags = " " + proc_cflags.communicate()[0].strip("\n")

Where the output of 'dpkg-buildflags --get CFLAGS' for me is:
-g -O2 -fdebug-prefix-map=/home/awatry/src/libclc=. -fstack-protector-strong
-Wformat -Werror=format-security

Something in there is breaking the bitcode compilation for libclc in debian.

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


Re: [Mesa-dev] [PATCH 02/12] nir: Take if uses into account in ssa_def_components_read

2018-07-26 Thread Caio Marcelo de Oliveira Filho
This patch as-is is

Reviewed-by: Caio Marcelo de Oliveira Filho 

but consider the question below.

On Thu, Jul 26, 2018 at 08:59:58AM -0700, Jason Ekstrand wrote:
> Fixes: d800b7daa5440 "nir: Add a helper for figuring out what..."
> ---
>  src/compiler/nir/nir.c | 3 +++
>  1 file changed, 3 insertions(+)
> 
> diff --git a/src/compiler/nir/nir.c b/src/compiler/nir/nir.c
> index bc7f05b3e86..a849664134f 100644
> --- a/src/compiler/nir/nir.c
> +++ b/src/compiler/nir/nir.c
> @@ -1446,6 +1446,9 @@ nir_ssa_def_components_read(const nir_ssa_def *def)
>}
> }
>  
> +   if (!list_empty(&def->if_uses))
> +  read_mask |= 1;
> +

If I understood correctly: if the 'def' has 'if_uses', then it will
have only a single component. So maybe move this to be an early
return?



Thanks,
Caio

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


Re: [Mesa-dev] [PATCH 04/12] nir/instr_set: Fix nir_instrs_equal for derefs

2018-07-26 Thread Caio Marcelo de Oliveira Filho
This patch is

Reviewed-by: Caio Marcelo de Oliveira Filho 



On Thu, Jul 26, 2018 at 09:00:00AM -0700, Jason Ekstrand wrote:
> We weren't returning at the end of the nir_isntr_type_deref case in
> nir_instrs_equal and it was falling through to the default of false.
> While we're at it, make the default unreachable because all statements
> in the switch now have their own returns.  Had we done that before, we
> would have caught this bug a long time ago.
> 
> Fixes: 19a4662a540a8c94 "nir: Add a deref instruction type"
> ---
>  src/compiler/nir/nir_instr_set.c | 4 ++--
>  1 file changed, 2 insertions(+), 2 deletions(-)
> 
> diff --git a/src/compiler/nir/nir_instr_set.c 
> b/src/compiler/nir/nir_instr_set.c
> index 42aa61808ac..19771fcd9dd 100644
> --- a/src/compiler/nir/nir_instr_set.c
> +++ b/src/compiler/nir/nir_instr_set.c
> @@ -357,7 +357,7 @@ nir_instrs_equal(const nir_instr *instr1, const nir_instr 
> *instr2)
>default:
>   unreachable("Invalid instruction deref type");
>}
> -  break;
> +  return true;
> }
> case nir_instr_type_tex: {
>nir_tex_instr *tex1 = nir_instr_as_tex(instr1);
> @@ -460,7 +460,7 @@ nir_instrs_equal(const nir_instr *instr1, const nir_instr 
> *instr2)
>unreachable("Invalid instruction type");
> }
>  
> -   return false;
> +   unreachable("All cases in the above switch should return");
>  }
>  
>  static bool
> -- 
> 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 04/12] nir/instr_set: Fix nir_instrs_equal for derefs

2018-07-26 Thread Thomas Helland
This is:
Reviewed-by: Thomas Helland

2018-07-26 18:00 GMT+02:00 Jason Ekstrand :
> We weren't returning at the end of the nir_isntr_type_deref case in
> nir_instrs_equal and it was falling through to the default of false.
> While we're at it, make the default unreachable because all statements
> in the switch now have their own returns.  Had we done that before, we
> would have caught this bug a long time ago.
>
> Fixes: 19a4662a540a8c94 "nir: Add a deref instruction type"
> ---
>  src/compiler/nir/nir_instr_set.c | 4 ++--
>  1 file changed, 2 insertions(+), 2 deletions(-)
>
> diff --git a/src/compiler/nir/nir_instr_set.c 
> b/src/compiler/nir/nir_instr_set.c
> index 42aa61808ac..19771fcd9dd 100644
> --- a/src/compiler/nir/nir_instr_set.c
> +++ b/src/compiler/nir/nir_instr_set.c
> @@ -357,7 +357,7 @@ nir_instrs_equal(const nir_instr *instr1, const nir_instr 
> *instr2)
>default:
>   unreachable("Invalid instruction deref type");
>}
> -  break;
> +  return true;
> }
> case nir_instr_type_tex: {
>nir_tex_instr *tex1 = nir_instr_as_tex(instr1);
> @@ -460,7 +460,7 @@ nir_instrs_equal(const nir_instr *instr1, const nir_instr 
> *instr2)
>unreachable("Invalid instruction type");
> }
>
> -   return false;
> +   unreachable("All cases in the above switch should return");
>  }
>
>  static bool
> --
> 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 03/12] nir/print: Remove a bogus assert

2018-07-26 Thread Thomas Helland
This is already fixed in master it seems

2018-07-26 17:59 GMT+02:00 Jason Ekstrand :
> In 1beef89ad85c47fb6, we made a bunch of changes to NIR to allow for
> more than four components.  This assert was added to trigger if we ever
> saw a vec16 input variable.  However, it didn't take into account the
> fact that we can get matrices as input/output variables and they break
> this assumption without breaking the code that follows.
>
> Fixes: 1beef89ad85c4 "nir: prepare for bumping up max components to 16"
> ---
>  src/compiler/nir/nir_print.c | 1 -
>  1 file changed, 1 deletion(-)
>
> diff --git a/src/compiler/nir/nir_print.c b/src/compiler/nir/nir_print.c
> index 93d1c02f23d..7cb16abd146 100644
> --- a/src/compiler/nir/nir_print.c
> +++ b/src/compiler/nir/nir_print.c
> @@ -491,7 +491,6 @@ print_var_decl(nir_variable *var, print_state *state)
>switch (var->data.mode) {
>case nir_var_shader_in:
>case nir_var_shader_out:
> - assert(num_components <= 4);
>   if (num_components < 4 && num_components != 0) {
>  const char *xyzw = "xyzw";
>  for (int i = 0; i < num_components; i++)
> --
> 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 05/12] nir/types: Add array_or_matrix helpers

2018-07-26 Thread Thomas Helland
This patch is:

Reviewed-by: Thomas Helland

2018-07-26 18:00 GMT+02:00 Jason Ekstrand :
> ---
>  src/compiler/nir_types.cpp | 15 +++
>  src/compiler/nir_types.h   |  2 ++
>  2 files changed, 17 insertions(+)
>
> diff --git a/src/compiler/nir_types.cpp b/src/compiler/nir_types.cpp
> index 3a3864414f3..c6f30368c95 100644
> --- a/src/compiler/nir_types.cpp
> +++ b/src/compiler/nir_types.cpp
> @@ -50,6 +50,15 @@ glsl_without_array(const glsl_type *type)
> return type->without_array();
>  }
>
> +const glsl_type *
> +glsl_without_array_or_matrix(const glsl_type *type)
> +{
> +   type = type->without_array();
> +   if (type->is_matrix())
> +  type = type->column_type();
> +   return type;
> +}
> +
>  const glsl_type *
>  glsl_get_array_instance(const glsl_type *type,
>  unsigned array_size)
> @@ -224,6 +233,12 @@ glsl_type_is_array_of_arrays(const struct glsl_type 
> *type)
> return type->is_array_of_arrays();
>  }
>
> +bool
> +glsl_type_is_array_or_matrix(const struct glsl_type *type)
> +{
> +   return type->is_array() || type->is_matrix();
> +}
> +
>  bool
>  glsl_type_is_struct(const struct glsl_type *type)
>  {
> diff --git a/src/compiler/nir_types.h b/src/compiler/nir_types.h
> index 817b7a9b345..d29edd1d6c5 100644
> --- a/src/compiler/nir_types.h
> +++ b/src/compiler/nir_types.h
> @@ -48,6 +48,7 @@ const struct glsl_type *glsl_get_struct_field(const struct 
> glsl_type *type,
>
>  const struct glsl_type *glsl_get_array_element(const struct glsl_type *type);
>  const struct glsl_type *glsl_without_array(const struct glsl_type *type);
> +const struct glsl_type *glsl_without_array_or_matrix(const struct glsl_type 
> *type);
>  const struct glsl_type *glsl_get_array_instance(const struct glsl_type *type,
>  unsigned array_size);
>
> @@ -131,6 +132,7 @@ bool glsl_type_is_vector_or_scalar(const struct glsl_type 
> *type);
>  bool glsl_type_is_matrix(const struct glsl_type *type);
>  bool glsl_type_is_array(const struct glsl_type *type);
>  bool glsl_type_is_array_of_arrays(const struct glsl_type *type);
> +bool glsl_type_is_array_or_matrix(const struct glsl_type *type);
>  bool glsl_type_is_struct(const struct glsl_type *type);
>  bool glsl_type_is_sampler(const struct glsl_type *type);
>  bool glsl_type_is_image(const struct glsl_type *type);
> --
> 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] [Bug 107369] "volatile" in OpenCL code not recognized by POLARIS10 and KABINI

2018-07-26 Thread bugzilla-daemon
https://bugs.freedesktop.org/show_bug.cgi?id=107369

--- Comment #6 from Aaron Watry  ---
Passing "-fstack-protector-strong" into clang_bc_flags is what's breaking
libclc for debian.

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


Re: [Mesa-dev] [RFC][PATCH 4/5] Android.mk: Add option to use vendor version of mesa

2018-07-26 Thread Rob Herring
On Wed, Jul 25, 2018 at 1:52 PM John Stultz  wrote:
>
> On Wed, Jul 25, 2018 at 5:42 AM, Emil Velikov  
> wrote:
> > On 25 July 2018 at 00:21, John Stultz  wrote:
> >> From: Yong Yao 
> >>
> >> This is a forward port of a patch from the AOSP/master branch:
> >> https://android.googlesource.com/platform/external/mesa3d/+/b1e5fad1db4c1d51c7ae3a033b100a8429ae5415%5E%21/
> >>
> >> Which allows boards to provide their own custom copy of mesa.
> >>
> > Thanks for sorting these out John.
> >
> > My understanding was that when a custom project repo is used one
> > handles that in the device manifest. Roughly as:
> >  - foo.xml -> contains vast majority of the git repos with associated 
> > tags/etc
> >  - local.xml -> removes any repo/project from ^^, adds new one
> >
> > Is that no longer the case, or I simply misremember how Android does things?
>
> So, I'm not aware of the specific history behind this patch.

I think it is quite simple. Intel needed mesa and put it into their
device repo(s) rather than updating external/mesa3d/. I would point to
the repo, but it seems android-ia is gone...

> And I
> can't speak for Google, there has been a general push via the Treble
> efforts to standardize the Android system image, and to push vendors
> to keep any device specific bits into their own device directory.  So
> there is a strong disincentive to modify projects in AOSP and in order
> to include things like devboards into AOSP, the push has been to limit
> any device specific changes to only the device directory git tree.

I can't imagine that mesa would ever be part of the system image so
why would there be any common repository. Maybe a s/w rendering build,
but that may still be in the vendor partition and SwiftShader seems to
be preferred anyways. There seems to be little incentive to not have a
fork per device.

> So while one can technically still replace projects with local repos
> (and this is very useful for development!), I think they do not want
> folks doing this for shipping devices.
>
> We are trying to make sure device support is pushed upstream to fdo,

A fork in every device is not encouraging that. I think anyone working
on h/w support in mesa is targeting upstream anyways regardless of
what happens in AOSP.

> and then align AOSP's mesa to that, but one could imagine a board that
> doesn't have support upstream in mesa, and provides its own copy of
> mesa in the device directory. This patch allows the build to override
> the default mesa project with the vendor provided mesa.
>
> One concrete example here, which unfortunately I've not had time to
> work on, might be if we try to integrate the revived lima work to
> support HiKey's mali utgard gpu. That would require a local mesa tree
> along with the developmental kernel driver.

I'm pretty sure lima will be merged to mesa master well before either
it works with Android or anyone cares about supporting it in AOSP.

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


[Mesa-dev] [Bug 107369] "volatile" in OpenCL code not recognized by POLARIS10 and KABINI

2018-07-26 Thread bugzilla-daemon
https://bugs.freedesktop.org/show_bug.cgi?id=107369

--- Comment #7 from Gian-Carlo Pascutto  ---
Nice debugging.

Is this LLVM miscompiling the library, or LLVM trying to do stack protection on
AMD GCN code?

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


Re: [Mesa-dev] [RFC][PATCH 4/5] Android.mk: Add option to use vendor version of mesa

2018-07-26 Thread John Stultz
On Thu, Jul 26, 2018 at 6:46 AM, Emil Velikov  wrote:
> On 25 July 2018 at 20:52, John Stultz  wrote:
>> On Wed, Jul 25, 2018 at 5:42 AM, Emil Velikov  
>> wrote:
>>> On 25 July 2018 at 00:21, John Stultz  wrote:
 From: Yong Yao 

 This is a forward port of a patch from the AOSP/master branch:
 https://android.googlesource.com/platform/external/mesa3d/+/b1e5fad1db4c1d51c7ae3a033b100a8429ae5415%5E%21/

 Which allows boards to provide their own custom copy of mesa.

>>> Thanks for sorting these out John.
>>>
>>> My understanding was that when a custom project repo is used one
>>> handles that in the device manifest. Roughly as:
>>>  - foo.xml -> contains vast majority of the git repos with associated 
>>> tags/etc
>>>  - local.xml -> removes any repo/project from ^^, adds new one
>>>
>>> Is that no longer the case, or I simply misremember how Android does things?
>>
>> So, I'm not aware of the specific history behind this patch. And I
>> can't speak for Google, there has been a general push via the Treble
>> efforts to standardize the Android system image, and to push vendors
>> to keep any device specific bits into their own device directory.  So
>> there is a strong disincentive to modify projects in AOSP and in order
>> to include things like devboards into AOSP, the push has been to limit
>> any device specific changes to only the device directory git tree.
>>
>> So while one can technically still replace projects with local repos
>> (and this is very useful for development!), I think they do not want
>> folks doing this for shipping devices.
>>
> Hmm using the word "local" brought some assumptions that were never made.
> AFAICT the remove/add project manifest combo can be used local
> changes/testing as well as for "shipping devices".
> Can it not?
>
>> We are trying to make sure device support is pushed upstream to fdo,
>> and then align AOSP's mesa to that, but one could imagine a board that
>> doesn't have support upstream in mesa, and provides its own copy of
>> mesa in the device directory. This patch allows the build to override
>> the default mesa project with the vendor provided mesa.
>>
> Since the vendor will already need to add the project (git repo etc),
> what is the blocker from removing the existing one beforehand?
> Last I've tried - the repo tool gives you a nice and clear
> warning/error message.
>
> There is one case where this patch is a must. If repo forbids removing
> "core" Android projects via the manifest.

I'm not saying the repo tool at all forbids removing/replacing entries
in the manifest. Its just a tool.

I'm saying that if someone is replacing git trees that are part of the
system image in a shipping device, my understanding is they are likely
going to have more problems with treble compliance. There are probably
technical loopholes folks can get through and still do it, but I think
generally its becoming frowned upon.

Its possible, but I doubt they would chose to enforce this policy via
the repo tool.

Regardless, I'm not sure why such a trivial change to the Android.mk
that the Android developers found useful is cause for much objection,
but this one seems more trouble then its worth, so I'll drop it.

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


Re: [Mesa-dev] [PATCH 02/12] nir: Take if uses into account in ssa_def_components_read

2018-07-26 Thread Jason Ekstrand
On Thu, Jul 26, 2018 at 9:38 AM Caio Marcelo de Oliveira Filho <
caio.olive...@intel.com> wrote:

> This patch as-is is
>
> Reviewed-by: Caio Marcelo de Oliveira Filho 
>
> but consider the question below.
>
> On Thu, Jul 26, 2018 at 08:59:58AM -0700, Jason Ekstrand wrote:
> > Fixes: d800b7daa5440 "nir: Add a helper for figuring out what..."
> > ---
> >  src/compiler/nir/nir.c | 3 +++
> >  1 file changed, 3 insertions(+)
> >
> > diff --git a/src/compiler/nir/nir.c b/src/compiler/nir/nir.c
> > index bc7f05b3e86..a849664134f 100644
> > --- a/src/compiler/nir/nir.c
> > +++ b/src/compiler/nir/nir.c
> > @@ -1446,6 +1446,9 @@ nir_ssa_def_components_read(const nir_ssa_def *def)
> >}
> > }
> >
> > +   if (!list_empty(&def->if_uses))
> > +  read_mask |= 1;
> > +
>
> If I understood correctly: if the 'def' has 'if_uses', then it will
> have only a single component. So maybe move this to be an early
> return?
>

I did think about that.  We could.  The loop above will usually return
pretty quickly as well though.  I don't know if it matters.
___
mesa-dev mailing list
mesa-dev@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/mesa-dev


Re: [Mesa-dev] [PATCH v3] dri3: For 1.2, use root window instead of pixmap drawable

2018-07-26 Thread Eric Anholt
Olivier Fourdan  writes:

> get_supported_modifiers() and pixmap_from_buffers() requests both
> expect a window as drawable, passing a pixmap will fail as the Xserver
> will fail to match the given drawable to a window.
>
> That leads to dri3_alloc_render_buffer() to return NULL and breaks
> rendering when using GLX_DOUBLEBUFFER on pixmaps.
>
> Query the root window of the pixmap on first init, and use the root
> window instead of the pixmap drawable for get_supported_modifiers()
> and pixmap_from_buffers().
>
> Bugzilla: https://bugs.freedesktop.org/show_bug.cgi?id=107117
> Fixes: 069fdd5 ("egl/x11: Support DRI3 v1.1")
> Signed-off-by: Olivier Fourdan 

Looks great!

Reviewed-by: Eric Anholt 


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


Re: [Mesa-dev] [PATCH 06/12] nir: Add a structure splitting pass

2018-07-26 Thread Caio Marcelo de Oliveira Filho
On Thu, Jul 26, 2018 at 09:00:02AM -0700, Jason Ekstrand wrote:
> ---
>  src/compiler/Makefile.sources |   1 +
>  src/compiler/nir/meson.build  |   1 +
>  src/compiler/nir/nir.h|   1 +
>  src/compiler/nir/nir_split_vars.c | 271 ++
>  4 files changed, 274 insertions(+)
>  create mode 100644 src/compiler/nir/nir_split_vars.c

(...)

> +   const struct glsl_type *struct_type = glsl_without_array(type);
> +   if (glsl_type_is_struct(struct_type)) {
> +  field->num_fields = glsl_get_length(struct_type),
> +  field->fields = ralloc_array(state->mem_ctx, struct field,
> +   field->num_fields);
> +  for (unsigned i = 0; i < field->num_fields; i++) {
> + char *field_name = NULL;
> + if (name) {
> +ralloc_asprintf(state->mem_ctx, "%s_%s", name,
> +glsl_get_struct_elem_name(struct_type, i));
> + }

Maybe if no name for the parent is available, use something in this
place ("unnamed", or whatever). That way the rest of the hierarchy
doesn't lose the meaning completely.





> +static void
> +split_struct_derefs_impl(nir_function_impl *impl,
> + struct hash_table *var_field_map,
> + nir_variable_mode modes,
> + void *mem_ctx)
> +{
> +   nir_builder b;
> +   nir_builder_init(&b, impl);
> +
> +   nir_foreach_block(block, impl) {
> +  nir_foreach_instr_safe(instr, block) {
> + if (instr->type != nir_instr_type_deref)
> +continue;
> +
> + nir_deref_instr *deref = nir_instr_as_deref(instr);
> + if (!(deref->mode & modes))
> +continue;
> +
> + /* Clean up any dead derefs we find lying around.  They may refer to
> +  * variables we're planning to split.
> +  */
> + if (nir_deref_instr_remove_if_unused(deref))
> +continue;
> +
> + if (!glsl_type_is_vector_or_scalar(deref->type))
> +continue;
> +
> + nir_variable *base_var = nir_deref_instr_get_variable(deref);
> + struct hash_entry *entry =
> +_mesa_hash_table_search(var_field_map, base_var);
> + if (!entry)
> +continue;
> +
> + struct field *root_field = entry->data;
> +
> + nir_deref_path path;
> + nir_deref_path_init(&path, deref, mem_ctx);
> +
> + struct field *tail_field = root_field;
> + for (unsigned i = 0; path.path[i]; i++) {
> +if (path.path[i]->deref_type != nir_deref_type_struct)
> +   continue;
> +
> +assert(i > 0);
> +assert(glsl_type_is_struct(path.path[i - 1]->type));
> +assert(path.path[i - 1]->type ==
> +   glsl_without_array(tail_field->type));
> +
> +tail_field = &tail_field->fields[path.path[i]->strct.index];
> + }

Would make sense to assert here that tail_field is "leaf" in the
fields tree, i.e. tail_field->num_fields == 0?




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


Re: [Mesa-dev] [PATCH v2] clover: Reduce wait_count in abort path.

2018-07-26 Thread Francisco Jerez
Jan Vesely  writes:

> Trigger waiter condition variable.
> Passes 'events' CTS on carrizo and turks.
> v2: reduce to 0
>
> Signed-off-by: Jan Vesely 

Reviewed-by: Francisco Jerez 

> ---
>  src/gallium/state_trackers/clover/core/event.cpp | 4 +++-
>  1 file changed, 3 insertions(+), 1 deletion(-)
>
> diff --git a/src/gallium/state_trackers/clover/core/event.cpp 
> b/src/gallium/state_trackers/clover/core/event.cpp
> index b7eb33dbfc..3d313ce896 100644
> --- a/src/gallium/state_trackers/clover/core/event.cpp
> +++ b/src/gallium/state_trackers/clover/core/event.cpp
> @@ -41,7 +41,7 @@ event::trigger_self() {
> std::lock_guard lock(mutex);
> std::vector> evs;
>  
> -   if (!--_wait_count)
> +   if (_wait_count && !--_wait_count)
>std::swap(_chain, evs);
>  
> cv.notify_all();
> @@ -65,8 +65,10 @@ event::abort_self(cl_int status) {
> std::vector> evs;
>  
> _status = status;
> +   _wait_count = 0;
> std::swap(_chain, evs);
>  
> +   cv.notify_all();
> return evs;
>  }
>  
> -- 
> 2.17.1


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


Re: [Mesa-dev] [PATCH] clover: Don't extend illegal integer types.

2018-07-26 Thread Francisco Jerez
Jan Vesely  writes:

> It's OK to pass them in memory, which is what kernel invocation needs.
> Fixes AMDGCN regressions since llvm r337535 ("Reapply "AMDGPU: Fix handling 
> of alignment padding in DAG argument lowering"):
>   scalar-arithmetic-char
>   scalar-arithmetic-uchar
>   scalar-arithemtic-short
>   scalar-arithmetic-ushort
>   scalar-comparison-char
>   scalar-comparison-uchar
>   scalar-comparison-short
>   scalar-comparison-ushort
>
> Signed-off-by: Jan Vesely 

Reviewed-by: Francisco Jerez 

> ---
>  src/gallium/state_trackers/clover/llvm/codegen/common.cpp |  3 +--
>  src/gallium/state_trackers/clover/llvm/compat.hpp | 12 
>  2 files changed, 13 insertions(+), 2 deletions(-)
>
> diff --git a/src/gallium/state_trackers/clover/llvm/codegen/common.cpp 
> b/src/gallium/state_trackers/clover/llvm/codegen/common.cpp
> index ddf2083f37..ca5f78940d 100644
> --- a/src/gallium/state_trackers/clover/llvm/codegen/common.cpp
> +++ b/src/gallium/state_trackers/clover/llvm/codegen/common.cpp
> @@ -85,8 +85,7 @@ namespace {
>   const unsigned arg_store_size = dl.getTypeStoreSize(arg_type);
>   const unsigned arg_api_size = dl.getTypeAllocSize(arg_type);
>  
> - const auto target_type = !arg_type->isIntegerTy() ? arg_type :
> -dl.getSmallestLegalIntType(mod.getContext(), arg_store_size * 8);
> + const auto target_type = compat::get_abi_type(arg_type, mod);
>   const unsigned target_size = dl.getTypeStoreSize(target_type);
>   const unsigned target_align = dl.getABITypeAlignment(target_type);
>  
> diff --git a/src/gallium/state_trackers/clover/llvm/compat.hpp 
> b/src/gallium/state_trackers/clover/llvm/compat.hpp
> index 60270d1529..975012cbda 100644
> --- a/src/gallium/state_trackers/clover/llvm/compat.hpp
> +++ b/src/gallium/state_trackers/clover/llvm/compat.hpp
> @@ -153,6 +153,18 @@ namespace clover {
>   return tm.addPassesToEmitFile(pm, os, nullptr, ft);
>  #else
>   return tm.addPassesToEmitFile(pm, os, ft);
> +#endif
> + }
> +
> + template
> + T get_abi_type(const T &arg_type, const M &mod) {
> +#if HAVE_LLVM >= 0x0700
> +  return arg_type;
> +#else
> +  ::llvm::DataLayout dl(&mod);
> +  const unsigned arg_store_size = dl.getTypeStoreSize(arg_type);
> +  return !arg_type->isIntegerTy() ? arg_type :
> +dl.getSmallestLegalIntType(mod.getContext(), arg_store_size * 8);
>  #endif
>   }
>}
> -- 
> 2.16.4


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


Re: [Mesa-dev] [PATCH 1/2] intel/fs: New method for register_byte_use_pattern for fs_inst

2018-07-26 Thread Francisco Jerez
Chema Casanova  writes:

> El 20/07/18 a las 22:10, Francisco Jerez escribió:
>> Chema Casanova  writes:
>> 
>>> El 20/07/18 a las 00:34, Francisco Jerez escribió:
 Chema Casanova  writes:

> El 14/07/18 a las 00:14, Francisco Jerez escribió:
>> Jose Maria Casanova Crespo  writes:
>>
>>> For a register source/destination of an instruction the function returns
>>> the read/write byte pattern of a 32-byte registers as a unsigned int.
>>>
>>> The returned pattern takes into account the exec_size of the 
>>> instruction,
>>> the type bitsize, the stride and if the register is source or 
>>> destination.
>>>
>>> The objective of the functions if to help to know the read/written bytes
>>> of the instructions to improve the liveness analysis for partial 
>>> read/writes.
>>>
>>> We manage special cases for SHADER_OPCODE_BYTE_SCATTERED_WRITE_LOGICAL
>>> and SHADER_OPCODE_BYTE_SCATTERED_WRITE because depending of the bitsize
>>> parameter they have a different read pattern.
>>> ---
>>>  src/intel/compiler/brw_fs.cpp  | 183 +
>>>  src/intel/compiler/brw_ir_fs.h |   1 +
>>>  2 files changed, 184 insertions(+)
>>>
>>> diff --git a/src/intel/compiler/brw_fs.cpp 
>>> b/src/intel/compiler/brw_fs.cpp
>>> index 2b8363ca362..f3045c4ff6c 100644
>>> --- a/src/intel/compiler/brw_fs.cpp
>>> +++ b/src/intel/compiler/brw_fs.cpp
>>> @@ -687,6 +687,189 @@ fs_inst::is_partial_write() const
>>> this->dst.offset % REG_SIZE != 0);
>>>  }
>>>  
>>> +/**
>>> + * Returns a 32-bit uint whose bits represent if the associated 
>>> register byte
>>> + * has been read/written by the instruction. The returned pattern 
>>> takes into
>>> + * account the exec_size of the instruction, the type bitsize and the 
>>> register
>>> + * stride and the register is source or destination for the 
>>> instruction.
>>> + *
>>> + * The objective of this function is to identify which parts of the 
>>> register
>>> + * are read or written for operations that don't read/write a full 
>>> register.
>>> + * So we can identify in live range variable analysis if a partial 
>>> write has
>>> + * completelly defined the part of the register used by a partial 
>>> read. So we
>>> + * avoid extending the liveness range because all data read was already
>>> + * defined although the wasn't completely written.
>>> + */
>>> +unsigned
>>> +fs_inst::register_byte_use_pattern(const fs_reg &r, boolean is_dst) 
>>> const
>>> +{
>>> +   if (is_dst) {
>
>> Please split into two functions (like fs_inst::src_read and
>> ::src_written) since that would make the call-sites of this method more
>> self-documenting than a boolean parameter.  You should be able to share
>> code by refactoring the common logic into a separate function (see below
>> for some suggestions on how that could be achieved).
>
> Sure, it would improve readability and simplifies the logic, I've chosen
> dst_write_pattern and src_read_pattern.
>
>>
>>> +  /* We don't know what is written so we return the worts case */
>>
>> "worst"
>
> Fixed.
>
>>> +  if (this->predicate && this->opcode != BRW_OPCODE_SEL)
>>> + return 0;
>>> +  /* We assume that send destinations are completely written */
>>> +  if (this->is_send_from_grf())
>>> + return ~0u;
>>
>> Some send-like instructions won't be caught by this condition, you
>> should check for this->mlen != 0 in addition.
>
> Would it be enough to check for (this->mlen > 0) and forget about
> is_send_from_grf? I am using this approach in v2 I am sending.
>

 I don't think the mlen > 0 condition would catch all cases either...
 E.g. FS_OPCODE_UNIFORM_PULL_CONSTANT_LOAD IIRC.  You probably need both
 conditions.  Sucks...
>>>
>>> That is true, so now we have the:
>>>  (this->is_send_from_grf() || this->mlen != 0)
>>>
>>> +   } else {
>>> +  /* byte_scattered_write_logical pattern of src[1] is 32-bit 
>>> aligned
>>> +   * so the read pattern depends on the bitsize stored at src[4]
>>> +   */
>>> +  if (this->opcode == SHADER_OPCODE_BYTE_SCATTERED_WRITE_LOGICAL &&
>>> +  this->src[1].nr == r.nr) {
>
>> I feel uncomfortable about attempting to guess the source the caller is
>> referring to by comparing the registers for equality.  E.g.  you could
>> potentially end up with two sources that compare equal but have
>> different semantics (e.g. as a result of CSE) which might cause it to
>> get the wrong answer.  It would probably be better to pass a source
>> index and a byte offset as argument instead of an fs_reg.
>
> I've didn't thought about CSE, I'm no

[Mesa-dev] [PATCH 1/3 v2] util: Android.mk: Convert implicit rules to static pattern rules

2018-07-26 Thread John Stultz
From: Dan Willemsen 

This is a partial cherry-pick from AOSP's mesa3d tree:
 
https://android.googlesource.com/platform/external/mesa3d/+/a88dcf769eb00a4ffc7183a0396d881a28b5a29b%5E%21/

"We're deprecating make implicit rules, preferring static pattern
rules, or just regular rules."

Without this patch, the freedesktop/master branch won't build in
the AOSP environment, and this patch corrects that, as tested
on the Dragonboard 820c.

The i965 portion of the patch this is based on collided badly,
and I'm not sure how to best forward port it. However, so far
we don't see build issues without that portion.

Cc: Rob Herring 
Cc: Alistair Strachan 
Cc: Marissa Wall 
Cc: Sumit Semwal 
Cc: Emil Velikov 
Cc: Rob Clark 
Reviewed-by: Emil Velikov 
Signed-off-by: John Stultz 
---
 src/util/Android.mk | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/src/util/Android.mk b/src/util/Android.mk
index 9b61442..e463b63 100644
--- a/src/util/Android.mk
+++ b/src/util/Android.mk
@@ -71,7 +71,7 @@ $(POT): $(LOCAL_PATH)/xmlpool/t_options.h
@mkdir -p $(dir $@)
xgettext -L C --from-code utf-8 -o $@ $<
 
-$(intermediates)/xmlpool/%.po: $(LOCAL_PATH)/xmlpool/%.po $(POT)
+$(MESA_DRI_OPTIONS_LANGS:%=$(intermediates)/xmlpool/%.po): 
$(intermediates)/xmlpool/%.po: $(LOCAL_PATH)/xmlpool/%.po $(POT)
lang=$(basename $(notdir $@)); \
mkdir -p $(dir $@); \
if [ -f $< ]; then \
-- 
2.7.4

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


[Mesa-dev] [PATCH 3/3 v2] CleanSpec.mk: Remove HOST_OUT_release

2018-07-26 Thread John Stultz
From: Dan Willemsen 

This is a forward port of a patch from the AOSP/master tree:
https://android.googlesource.com/platform/external/mesa3d/+/bd633f11de0c6ac1ed333a28344c74fd9898df9e%5E%21/

Which replaces HOST_OUT_release with HOST_OUT

As per Dan's explanation, the current code was incorrect to use
$(HOST_OUT_release) as $(HOST_OUT) will be set properly for
whether the current build that's being cleaned during
incrementals is using host debug or release builds.

Additionally Dan noted it was incredibly uncommon to use a debug
host build, as there was never a shortcut and one had to set an
environment variable manually. Thus it was rarely if ever tested.

Cc: Rob Herring 
Cc: Alistair Strachan 
Cc: Marissa Wall 
Cc: Sumit Semwal 
Cc: Emil Velikov 
Cc: Rob Clark 
Reviewed-by: Emil Velikov 
Signed-off-by: John Stultz 
---
v2: Add more justification to the commit message
---
 CleanSpec.mk | 6 +++---
 1 file changed, 3 insertions(+), 3 deletions(-)

diff --git a/CleanSpec.mk b/CleanSpec.mk
index d08b0de..e5030ce 100644
--- a/CleanSpec.mk
+++ b/CleanSpec.mk
@@ -10,7 +10,7 @@ $(call add-clean-step, rm -rf 
$(PRODUCT_OUT)/*/STATIC_LIBRARIES/libmesa_*_interm
 $(call add-clean-step, rm -rf 
$(PRODUCT_OUT)/*/SHARED_LIBRARIES/i9?5_dri_intermediates)
 $(call add-clean-step, rm -rf 
$(PRODUCT_OUT)/*/SHARED_LIBRARIES/libglapi_intermediates)
 $(call add-clean-step, rm -rf 
$(PRODUCT_OUT)/*/SHARED_LIBRARIES/libGLES_mesa_intermediates)
-$(call add-clean-step, rm -rf 
$(HOST_OUT_release)/*/EXECUTABLES/mesa_*_intermediates)
-$(call add-clean-step, rm -rf 
$(HOST_OUT_release)/*/EXECUTABLES/glsl_compiler_intermediates)
-$(call add-clean-step, rm -rf 
$(HOST_OUT_release)/*/STATIC_LIBRARIES/libmesa_*_intermediates)
+$(call add-clean-step, rm -rf $(HOST_OUT)/*/EXECUTABLES/mesa_*_intermediates)
+$(call add-clean-step, rm -rf 
$(HOST_OUT)/*/EXECUTABLES/glsl_compiler_intermediates)
+$(call add-clean-step, rm -rf 
$(HOST_OUT)/*/STATIC_LIBRARIES/libmesa_*_intermediates)
 $(call add-clean-step, rm -rf 
$(PRODUCT_OUT)/*/SHARED_LIBRARIES/*_dri_intermediates)
-- 
2.7.4

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


[Mesa-dev] [PATCH 2/3 v2] Android.common.mk: define HAVE_TIMESPEC_GET

2018-07-26 Thread John Stultz
From: Sumit Semwal 

This is a forward port of a patch from the AOSP/master tree:
https://android.googlesource.com/platform/external/mesa3d/+/bd30b663f55f8af73a0be4446349c5a2d4c641b0%5E%21/

Since https://android-review.googlesource.com/c/718518 added
timespec_get() to bionic, mesa3d doesn't build due to redefinition
of timespec_get().

Avoid redefinition by defining HAVE_TIMESPEC_GET flag.

Test: build and boot tested db820c to UI.

Cc: Rob Herring 
Cc: Alistair Strachan 
Cc: Marissa Wall 
Cc: Sumit Semwal 
Cc: Emil Velikov 
Cc: Rob Clark 
Reviewed-by: Emil Velikov 
Signed-off-by: Sumit Semwal 
Signed-off-by: John Stultz 
---
v2: Conditionalize it for PLATFORM_VERSION Q and higher
---
 Android.common.mk | 6 ++
 1 file changed, 6 insertions(+)

diff --git a/Android.common.mk b/Android.common.mk
index 397dc03..3585470 100644
--- a/Android.common.mk
+++ b/Android.common.mk
@@ -89,6 +89,12 @@ LOCAL_CPPFLAGS += \
 LOCAL_CONLYFLAGS += \
-std=c99
 
+# c11 timespec_get is part of bionic as well
+# https://android-review.googlesource.com/c/718518
+ifneq ($(shell [ "$(MESA_ANDROID_MAJOR_VERSION)" \< "Q" ]; echo $$?),0)
+LOCAL_CFLAGS += -DHAVE_TIMESPEC_GET
+endif
+
 ifeq ($(strip $(MESA_ENABLE_ASM)),true)
 ifeq ($(TARGET_ARCH),x86)
 LOCAL_CFLAGS += \
-- 
2.7.4

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


Re: [Mesa-dev] [PATCH 0/7] ASTC texture compression for all Gallium drivers

2018-07-26 Thread Marek Olšák
FYI, I'd like to include this in Mesa 18.2, which means I'll push this
on Monday July 30 if there is no review.

Marek

On Mon, Jul 23, 2018 at 7:52 PM, Marek Olšák  wrote:
> Hi,
>
> This series enables ASTC texture compression for all Gallium drivers
> that don't support it in hardware. The works the same as the ETC2
> fallback, i.e. it decompresses ASTC inside glCompressedTexImage to
> a supported uncompressed format.
>
> RadeonSI now finally supports the following:
> - GL_KHR_texture_compression_astc_ldr
> - GL_ANDROID_extension_pack_es31a
> - OpenGL ES 3.2 !!!
>
> All ASTC dEQP tests pass.
>
> Please review.
>
> Thanks,
> Marek
___
mesa-dev mailing list
mesa-dev@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/mesa-dev


Re: [Mesa-dev] [PATCH 06/12] nir: Add a structure splitting pass

2018-07-26 Thread Thomas Helland
2018-07-26 18:00 GMT+02:00 Jason Ekstrand :
> ---
>  src/compiler/Makefile.sources |   1 +
>  src/compiler/nir/meson.build  |   1 +
>  src/compiler/nir/nir.h|   1 +
>  src/compiler/nir/nir_split_vars.c | 271 ++
>  4 files changed, 274 insertions(+)
>  create mode 100644 src/compiler/nir/nir_split_vars.c
>
> diff --git a/src/compiler/Makefile.sources b/src/compiler/Makefile.sources
> index cc147218c4e..144ba94a8c6 100644
> --- a/src/compiler/Makefile.sources
> +++ b/src/compiler/Makefile.sources
> @@ -300,6 +300,7 @@ NIR_FILES = \
> nir/nir_serialize.h \
> nir/nir_split_per_member_structs.c \
> nir/nir_split_var_copies.c \
> +   nir/nir_split_vars.c \
> nir/nir_sweep.c \
> nir/nir_to_lcssa.c \
> nir/nir_validate.c \
> diff --git a/src/compiler/nir/meson.build b/src/compiler/nir/meson.build
> index a1bb19356ce..3fd5535ba52 100644
> --- a/src/compiler/nir/meson.build
> +++ b/src/compiler/nir/meson.build
> @@ -184,6 +184,7 @@ files_libnir = files(
>'nir_serialize.h',
>'nir_split_per_member_structs.c',
>'nir_split_var_copies.c',
> +  'nir_split_vars.c',
>'nir_sweep.c',
>'nir_to_lcssa.c',
>'nir_validate.c',
> diff --git a/src/compiler/nir/nir.h b/src/compiler/nir/nir.h
> index 3bfe7d7f7bf..4af7166f25b 100644
> --- a/src/compiler/nir/nir.h
> +++ b/src/compiler/nir/nir.h
> @@ -2609,6 +2609,7 @@ int nir_gs_count_vertices(const nir_shader *shader);
>
>  bool nir_split_var_copies(nir_shader *shader);
>  bool nir_split_per_member_structs(nir_shader *shader);
> +bool nir_split_struct_vars(nir_shader *shader, nir_variable_mode modes);
>
>  bool nir_lower_returns_impl(nir_function_impl *impl);
>  bool nir_lower_returns(nir_shader *shader);
> diff --git a/src/compiler/nir/nir_split_vars.c 
> b/src/compiler/nir/nir_split_vars.c
> new file mode 100644
> index 000..1f59ac2f5e7
> --- /dev/null
> +++ b/src/compiler/nir/nir_split_vars.c
> @@ -0,0 +1,271 @@
> +/*
> + * Copyright © 2018 Intel Corporation
> + *
> + * Permission is hereby granted, free of charge, to any person obtaining a
> + * copy of this software and associated documentation files (the "Software"),
> + * to deal 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.
> + */
> +
> +#include "nir.h"
> +#include "nir_builder.h"
> +#include "nir_deref.h"
> +
> +struct split_var_state {
> +   void *mem_ctx;
> +
> +   nir_shader *shader;
> +   nir_function_impl *impl;
> +
> +   nir_variable *base_var;
> +};
> +
> +struct field {
> +   struct field *parent;
> +
> +   const struct glsl_type *type;
> +
> +   unsigned num_fields;
> +   struct field *fields;
> +
> +   nir_variable *var;
> +};
> +
> +static const struct glsl_type *
> +wrap_type_in_array(const struct glsl_type *type,
> +   const struct glsl_type *array_type)
> +{
> +   if (!glsl_type_is_array(array_type))
> +  return type;
> +
> +   const struct glsl_type *elem_type =
> +  wrap_type_in_array(type, glsl_get_array_element(array_type));
> +   return glsl_array_type(elem_type, glsl_get_length(array_type));
> +}
> +
> +static void
> +init_field_for_type(struct field *field, struct field *parent,
> +const struct glsl_type *type,
> +const char *name,
> +struct split_var_state *state)
> +{
> +   *field = (struct field) {
> +  .parent = parent,
> +  .type = type,
> +   };
> +
> +   const struct glsl_type *struct_type = glsl_without_array(type);
> +   if (glsl_type_is_struct(struct_type)) {
> +  field->num_fields = glsl_get_length(struct_type),

Should be semicolon at the end here?

> +  field->fields = ralloc_array(state->mem_ctx, struct field,
> +   field->num_fields);
> +  for (unsigned i = 0; i < field->num_fields; i++) {
> + char *field_name = NULL;
> + if (name) {
> +ralloc_asprintf(state->mem_ctx, "%s_%s", name,
> +glsl_get_struct_elem_name(struct_type, i));
> + }

Re: [Mesa-dev] [PATCH v2 1/2] egl/surfaceless: Define DRI_SWRastLoader extension when using swrast.

2018-07-26 Thread David Riley
On Thu, Jul 26, 2018 at 7:22 AM Emil Velikov 
wrote:

> Hi David,
>
> On 18 July 2018 at 01:12, David Riley  wrote:
>
> Commit message here should explain why this is needed. Is the current
> kms_swrast usage failing/crashing somewhere, etc.
>

The change wasn't needed for kms_swrast, just for swrast which added an
dependency on having the loader extension defined with the change
https://github.com/mesa3d/mesa/commit/63c427fa71a07649d5c033a5c6184ef701348590#diff-aa8c7f5cc2f62d6a098b04df0603c87b

I added one to avoid potential issues if other dependencies on a swrast
loader extension are required in the future and to keep the DRM and DRMless
paths be similar.  As far as I can tell it's not strictly needed at this
time and I'm okay dropping it.


>
> > Signed-off-by: David Riley 
> > ---
> >  src/egl/drivers/dri2/platform_surfaceless.c | 28 +
> >  1 file changed, 23 insertions(+), 5 deletions(-)
> >
> > diff --git a/src/egl/drivers/dri2/platform_surfaceless.c
> b/src/egl/drivers/dri2/platform_surfaceless.c
> > index a0348a5e95..f5fe7119c6 100644
> > --- a/src/egl/drivers/dri2/platform_surfaceless.c
> > +++ b/src/egl/drivers/dri2/platform_surfaceless.c
> > @@ -260,6 +260,13 @@ static const __DRIimageLoaderExtension
> image_loader_extension = {
> > .flushFrontBuffer = surfaceless_flush_front_buffer,
> >  };
> >
> > +static const __DRIswrastLoaderExtension swrast_loader_extension = {
> > +   .base= { __DRI_SWRAST_LOADER, 1 },
> > +   .getDrawableInfo = NULL,
> > +   .putImage= NULL,
> > +   .getImage= NULL,
> > +};
> > +
> >  #define DRM_RENDER_DEV_NAME  "%s/renderD%d"
> >
> >  static const __DRIextension *image_loader_extensions[] = {
> > @@ -269,6 +276,14 @@ static const __DRIextension
> *image_loader_extensions[] = {
> > NULL,
> >  };
> >
> > +static const __DRIextension *swrast_loader_extensions[] = {
> > +   &swrast_loader_extension.base,
> > +   &image_loader_extension.base,
> > +   &image_lookup_extension.base,
> > +   &use_invalidate.base,
> How did you compiler this list. Gut suggests that at least one of
> those should not be here.
> Doesn't this break the existing kms_swrast usage?
>
> This was the existing list of extensions used prior to this change with a
newly added one for the swrast loader.  I ran a basic set of DEQP tests
(dEQP-GLES3.functional.draw.draw_elements.*, dEQP-GLES3.info.*)


>
> >
> >dri2_dpy->fd = fd;
> > -  if (dri2_load_driver_dri3(dpy))
> > +  if (dri2_load_driver_dri3(dpy)) {
> >   return true;
> > +  }
> Unnecessary change.
>

I've fixed this for v3.


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


Re: [Mesa-dev] [PATCH 2/3 v2] Android.common.mk: define HAVE_TIMESPEC_GET

2018-07-26 Thread Rob Herring
Resending from correct email...

On Thu, Jul 26, 2018 at 12:28 PM John Stultz  wrote:
>
> From: Sumit Semwal 
>
> This is a forward port of a patch from the AOSP/master tree:
> https://android.googlesource.com/platform/external/mesa3d/+/bd30b663f55f8af73a0be4446349c5a2d4c641b0%5E%21/
>
> Since https://android-review.googlesource.com/c/718518 added
> timespec_get() to bionic, mesa3d doesn't build due to redefinition
> of timespec_get().
>
> Avoid redefinition by defining HAVE_TIMESPEC_GET flag.
>
> Test: build and boot tested db820c to UI.
>
> Cc: Rob Herring 
> Cc: Alistair Strachan 
> Cc: Marissa Wall 
> Cc: Sumit Semwal 
> Cc: Emil Velikov 
> Cc: Rob Clark 
> Reviewed-by: Emil Velikov 
> Signed-off-by: Sumit Semwal 
> Signed-off-by: John Stultz 
> ---
> v2: Conditionalize it for PLATFORM_VERSION Q and higher
> ---
>  Android.common.mk | 6 ++
>  1 file changed, 6 insertions(+)
>
> diff --git a/Android.common.mk b/Android.common.mk
> index 397dc03..3585470 100644
> --- a/Android.common.mk
> +++ b/Android.common.mk
> @@ -89,6 +89,12 @@ LOCAL_CPPFLAGS += \
>  LOCAL_CONLYFLAGS += \
> -std=c99
>
> +# c11 timespec_get is part of bionic as well
> +# https://android-review.googlesource.com/c/718518
> +ifneq ($(shell [ "$(MESA_ANDROID_MAJOR_VERSION)" \< "Q" ]; echo $$?),0)

While master is a letter most of the time, it's a number in release
branches. I guess this happens to work with numbers too?, but can we
follow the same style as other places.

$(ifneq $(filter $(MESA_ANDROID_MAJOR_VERSION), 5 6 7 8),)
...

Not sure if I have the list of versions quite right there, but you get the idea.

Note, we still list version 4 in some spots, but I'm pretty sure it is
broken with mesa master. Probably about time for another pass of
dropping older versions.

> +LOCAL_CFLAGS += -DHAVE_TIMESPEC_GET
> +endif
> +
>  ifeq ($(strip $(MESA_ENABLE_ASM)),true)
>  ifeq ($(TARGET_ARCH),x86)
>  LOCAL_CFLAGS += \
> --
> 2.7.4
>
___
mesa-dev mailing list
mesa-dev@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/mesa-dev


Re: [Mesa-dev] [PATCH 2/3 v2] Android.common.mk: define HAVE_TIMESPEC_GET

2018-07-26 Thread John Stultz
On Thu, Jul 26, 2018 at 12:09 PM, Rob Herring  wrote:
> Resending from correct email...
>
> On Thu, Jul 26, 2018 at 12:28 PM John Stultz  wrote:
>>
>> From: Sumit Semwal 
>>
>> This is a forward port of a patch from the AOSP/master tree:
>> https://android.googlesource.com/platform/external/mesa3d/+/bd30b663f55f8af73a0be4446349c5a2d4c641b0%5E%21/
>>
>> Since https://android-review.googlesource.com/c/718518 added
>> timespec_get() to bionic, mesa3d doesn't build due to redefinition
>> of timespec_get().
>>
>> Avoid redefinition by defining HAVE_TIMESPEC_GET flag.
>>
>> Test: build and boot tested db820c to UI.
>>
>> Cc: Rob Herring 
>> Cc: Alistair Strachan 
>> Cc: Marissa Wall 
>> Cc: Sumit Semwal 
>> Cc: Emil Velikov 
>> Cc: Rob Clark 
>> Reviewed-by: Emil Velikov 
>> Signed-off-by: Sumit Semwal 
>> Signed-off-by: John Stultz 
>> ---
>> v2: Conditionalize it for PLATFORM_VERSION Q and higher
>> ---
>>  Android.common.mk | 6 ++
>>  1 file changed, 6 insertions(+)
>>
>> diff --git a/Android.common.mk b/Android.common.mk
>> index 397dc03..3585470 100644
>> --- a/Android.common.mk
>> +++ b/Android.common.mk
>> @@ -89,6 +89,12 @@ LOCAL_CPPFLAGS += \
>>  LOCAL_CONLYFLAGS += \
>> -std=c99
>>
>> +# c11 timespec_get is part of bionic as well
>> +# https://android-review.googlesource.com/c/718518
>> +ifneq ($(shell [ "$(MESA_ANDROID_MAJOR_VERSION)" \< "Q" ]; echo $$?),0)
>
> While master is a letter most of the time, it's a number in release
> branches. I guess this happens to work with numbers too?, but can we
> follow the same style as other places.
>
> $(ifneq $(filter $(MESA_ANDROID_MAJOR_VERSION), 5 6 7 8),)
> ...
>
> Not sure if I have the list of versions quite right there, but you get the 
> idea.

Sure. I'll give that a whirl.

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


Re: [Mesa-dev] [PATCH v3 1/3] glsl: teach copy_propagation_elements to deal with whole variables

2018-07-26 Thread Thomas Helland
2018-07-25 3:03 GMT+02:00 Caio Marcelo de Oliveira Filho
:
> Keep information in acp_entry whether the entry is full or not, and
> use the ACP in more nodes when visiting the instructions:
>
> - add_copy: write whole variables to the ACP state (regardless the
>   type).
>
> - visit(ir_dereference_variable *): perform the propagation here if we have a
>   full candidate. Element-wise here doesn't apply because the mask
>   isn't available at this point.
>
> - visit_leave(ir_assignment *): process beyond scalar and vector, as
>   the full variables might have other types.
>
> Also import an improvement from opt_copy_propagation.cpp: if ir_call
> is an intrinsic, we know the variables affected, so keep going.
>
> v2: (all from Eric Anholt)
> Describe how acp_entry attributes are used.
> Don't do book-keeping to avoid adding repeated element to
> the dsts in write_elements().
>
> Reviewed-by: Eric Anholt 
> ---
>  .../glsl/opt_copy_propagation_elements.cpp| 147 ++
>  1 file changed, 118 insertions(+), 29 deletions(-)
>
> diff --git a/src/compiler/glsl/opt_copy_propagation_elements.cpp 
> b/src/compiler/glsl/opt_copy_propagation_elements.cpp
> index 4c6ca790394..cae6d3c0707 100644
> --- a/src/compiler/glsl/opt_copy_propagation_elements.cpp
> +++ b/src/compiler/glsl/opt_copy_propagation_elements.cpp
> @@ -27,18 +27,9 @@
>   * Replaces usage of recently-copied components of variables with the
>   * previous copy of the variable.
>   *
> - * This pass can be compared with opt_copy_propagation, which operands
> - * on arbitrary whole-variable copies.  However, in order to handle
> - * the copy propagation of swizzled variables or writemasked writes,
> - * we want to track things on a channel-wise basis.  I found that
> - * trying to mix the swizzled/writemasked support here with the
> - * whole-variable stuff in opt_copy_propagation.cpp just made a mess,
> - * so this is separate despite the ACP handling being somewhat
> - * similar.
> - *
>   * This should reduce the number of MOV instructions in the generated
> - * programs unless copy propagation is also done on the LIR, and may
> - * help anyway by triggering other optimizations that live in the HIR.
> + * programs and help triggering other optimizations that live in GLSL
> + * level.
>   */
>
>  #include "ir.h"
> @@ -58,9 +49,22 @@ class acp_entry
>  public:
> DECLARE_LINEAR_ZALLOC_CXX_OPERATORS(acp_entry)
>
> +   /* If set, rhs_full indicates that this ACP entry represents a
> +* whole-variable copy.  The rhs_element[] array will still be filled,
> +* to allow the swizzling from its components in case the variable
> +* was a vector (and to simplify some of the erase() and write_vector()
> +* logic).
> +*/
> +
> +   ir_variable *rhs_full;
> ir_variable *rhs_element[4];
> unsigned rhs_channel[4];
>
> +   /* Set of variables that use the variable associated with this acp_entry 
> as
> +* RHS.  This has the "reverse references" of rhs_full/rhs_element.  It is
> +* used to speed up invalidating those references when the acp_entry
> +* changes.
> +*/
> set *dsts;
>  };
>
> @@ -91,6 +95,7 @@ public:
> void erase(ir_variable *var, unsigned write_mask)
> {
>acp_entry *entry = pull_acp(var);
> +  entry->rhs_full = NULL;
>
>for (int i = 0; i < 4; i++) {
>   if (!entry->rhs_element[i])
> @@ -114,6 +119,8 @@ public:
>  if (dst_entry->rhs_element[i] == var)
> dst_entry->rhs_element[i] = NULL;
>   }
> + if (dst_entry->rhs_full == var)
> +dst_entry->rhs_full = NULL;
>   _mesa_set_remove(entry->dsts, set_entry);
>}
> }
> @@ -128,9 +135,10 @@ public:
>return NULL;
> }
>
> -   void write(ir_variable *lhs, ir_variable *rhs, unsigned write_mask, int 
> swizzle[4])
> +   void write_elements(ir_variable *lhs, ir_variable *rhs, unsigned 
> write_mask, int swizzle[4])
> {
>acp_entry *lhs_entry = pull_acp(lhs);
> +  lhs_entry->rhs_full = NULL;
>
>for (int i = 0; i < 4; i++) {
>   if ((write_mask & (1 << i)) == 0)
> @@ -146,6 +154,33 @@ public:
>_mesa_set_add(rhs_entry->dsts, lhs);
> }
>
> +   void write_full(ir_variable *lhs, ir_variable *rhs)
> +   {
> +  acp_entry *lhs_entry = pull_acp(lhs);
> +  if (lhs_entry->rhs_full == rhs)
> + return;
> +
> +  if (lhs_entry->rhs_full) {
> + remove_from_dsts(lhs_entry->rhs_full, lhs);
> +  } else if (lhs->type->is_vector()) {
> + for (int i = 0; i < 4; i++) {
> +if (lhs_entry->rhs_element[i])
> +   remove_from_dsts(lhs_entry->rhs_element[i], lhs);
> + }
> +  }
> +
> +  lhs_entry->rhs_full = rhs;
> +  acp_entry *rhs_entry = pull_acp(rhs);
> +  _mesa_set_add(rhs_entry->dsts, lhs);
> +
> +  if (lhs->type->is_vector()) {
> + for (int i = 0; i < 4; i++) {
> +lhs_entry->rhs_element[i] = rhs;
> 

[Mesa-dev] [Bug 107385] full Screen Corruption when a program is fullscreen

2018-07-26 Thread bugzilla-daemon
https://bugs.freedesktop.org/show_bug.cgi?id=107385

--- Comment #7 from monkeyinastripedsh...@gmail.com ---
>xserver-xorg-video-radeon:amd64 (1:18.0.1-1, 
>1:18.0.1+git1807201017.64bd00~oibaf~b)

The update is downloading right now and I'll let you know as soon as I've
tested it.

-- 
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 v3 2/3] glsl: use only copy_propagation_elements

2018-07-26 Thread Thomas Helland
This is:
Reviewed-by: Thomas Helland

2018-07-25 3:03 GMT+02:00 Caio Marcelo de Oliveira Filho
:
> Now that the elements version handles both cases, remove the
> non-elements version.
>
> Reviewed-by: Eric Anholt 
> ---
>  src/compiler/Makefile.sources  |   1 -
>  src/compiler/glsl/glsl_parser_extras.cpp   |   1 -
>  src/compiler/glsl/ir_optimization.h|   1 -
>  src/compiler/glsl/meson.build  |   1 -
>  src/compiler/glsl/opt_copy_propagation.cpp | 369 -
>  src/compiler/glsl/test_optpass.cpp |   2 -
>  6 files changed, 375 deletions(-)
>  delete mode 100644 src/compiler/glsl/opt_copy_propagation.cpp
>
> diff --git a/src/compiler/Makefile.sources b/src/compiler/Makefile.sources
> index cc147218c4e..908508adffb 100644
> --- a/src/compiler/Makefile.sources
> +++ b/src/compiler/Makefile.sources
> @@ -129,7 +129,6 @@ LIBGLSL_FILES = \
> glsl/opt_constant_folding.cpp \
> glsl/opt_constant_propagation.cpp \
> glsl/opt_constant_variable.cpp \
> -   glsl/opt_copy_propagation.cpp \
> glsl/opt_copy_propagation_elements.cpp \
> glsl/opt_dead_builtin_variables.cpp \
> glsl/opt_dead_builtin_varyings.cpp \
> diff --git a/src/compiler/glsl/glsl_parser_extras.cpp 
> b/src/compiler/glsl/glsl_parser_extras.cpp
> index 04eba980e0e..6d92f24ea22 100644
> --- a/src/compiler/glsl/glsl_parser_extras.cpp
> +++ b/src/compiler/glsl/glsl_parser_extras.cpp
> @@ -2214,7 +2214,6 @@ do_common_optimization(exec_list *ir, bool linked,
> OPT(do_if_simplification, ir);
> OPT(opt_flatten_nested_if_blocks, ir);
> OPT(opt_conditional_discard, ir);
> -   OPT(do_copy_propagation, ir);
> OPT(do_copy_propagation_elements, ir);
>
> if (options->OptimizeForAOS && !linked)
> diff --git a/src/compiler/glsl/ir_optimization.h 
> b/src/compiler/glsl/ir_optimization.h
> index b0e84608c58..ef68b93c09e 100644
> --- a/src/compiler/glsl/ir_optimization.h
> +++ b/src/compiler/glsl/ir_optimization.h
> @@ -103,7 +103,6 @@ bool opt_conditional_discard(exec_list *instructions);
>  bool do_constant_folding(exec_list *instructions);
>  bool do_constant_variable(exec_list *instructions);
>  bool do_constant_variable_unlinked(exec_list *instructions);
> -bool do_copy_propagation(exec_list *instructions);
>  bool do_copy_propagation_elements(exec_list *instructions);
>  bool do_constant_propagation(exec_list *instructions);
>  void do_dead_builtin_varyings(struct gl_context *ctx,
> diff --git a/src/compiler/glsl/meson.build b/src/compiler/glsl/meson.build
> index 96536b80168..09662b20775 100644
> --- a/src/compiler/glsl/meson.build
> +++ b/src/compiler/glsl/meson.build
> @@ -170,7 +170,6 @@ files_libglsl = files(
>'opt_constant_folding.cpp',
>'opt_constant_propagation.cpp',
>'opt_constant_variable.cpp',
> -  'opt_copy_propagation.cpp',
>'opt_copy_propagation_elements.cpp',
>'opt_dead_builtin_variables.cpp',
>'opt_dead_builtin_varyings.cpp',
> diff --git a/src/compiler/glsl/opt_copy_propagation.cpp 
> b/src/compiler/glsl/opt_copy_propagation.cpp
> deleted file mode 100644
> index 206dffe4f1c..000
> --- a/src/compiler/glsl/opt_copy_propagation.cpp
> +++ /dev/null
> @@ -1,369 +0,0 @@
> -/*
> - * Copyright © 2010 Intel Corporation
> - *
> - * Permission is hereby granted, free of charge, to any person obtaining a
> - * copy of this software and associated documentation files (the "Software"),
> - * to deal 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.
> - */
> -
> -/**
> - * \file opt_copy_propagation.cpp
> - *
> - * Moves usage of recently-copied variables to the previous copy of
> - * the variable.
> - *
> - * This should reduce the number of MOV instructions in the generated
> - * programs unless copy propagation is also done on the LIR, and may
> - * help anyway by triggering other optimizations that live in the HIR.
> - */
> -
> -#include "ir.h"
> -#include "ir_visitor.h"
> -#include "ir_basic_block.h"
> -#include "ir_optimization.h"
> -#include "compiler/glsl_types.h"
> -#include "util

Re: [Mesa-dev] [PATCH 07/12] nir: Add an array splitting pass

2018-07-26 Thread Jason Ekstrand
FYI, after further consideration, I've started reworking this pass to also 
be able to shorten arrays even if it can't split them. Probably best to 
wait on review for v2.


On July 26, 2018 09:00:57 Jason Ekstrand  wrote:


This pass looks for array variables where at least one level of the
array is never indirected and splits it into multiple smaller variables.
---
src/compiler/nir/nir.h|   1 +
src/compiler/nir/nir_split_vars.c | 525 ++
2 files changed, 526 insertions(+)

diff --git a/src/compiler/nir/nir.h b/src/compiler/nir/nir.h
index 4af7166f25b..c6ed5bb5358 100644
--- a/src/compiler/nir/nir.h
+++ b/src/compiler/nir/nir.h
@@ -2607,6 +2607,7 @@ void nir_dump_cfg(nir_shader *shader, FILE *fp);

int nir_gs_count_vertices(const nir_shader *shader);

+bool nir_split_array_vars(nir_shader *shader, nir_variable_mode modes);
bool nir_split_var_copies(nir_shader *shader);
bool nir_split_per_member_structs(nir_shader *shader);
bool nir_split_struct_vars(nir_shader *shader, nir_variable_mode modes);
diff --git a/src/compiler/nir/nir_split_vars.c 
b/src/compiler/nir/nir_split_vars.c

index 1f59ac2f5e7..394ed2be622 100644
--- a/src/compiler/nir/nir_split_vars.c
+++ b/src/compiler/nir/nir_split_vars.c
@@ -269,3 +269,528 @@ nir_split_struct_vars(nir_shader *shader, 
nir_variable_mode modes)


   return progress;
}
+
+static int
+num_arrays_in_type(const struct glsl_type *type)
+{
+   int num_arrays = 0;
+   while (true) {
+  if (glsl_type_is_array(type) || glsl_type_is_matrix(type)) {
+ num_arrays++;
+ type = glsl_get_array_element(type);
+  } else if (glsl_type_is_vector_or_scalar(type)) {
+ return num_arrays;
+  } else {
+ /* Unknown type */
+ return -1;
+  }
+   }
+}
+
+static bool
+init_var_list_array_indirects(struct exec_list *vars,
+  struct hash_table *var_indirect_map,
+  void *mem_ctx)
+{
+   bool has_aoa = false;
+
+   nir_foreach_variable(var, vars) {
+  int num_arrays = num_arrays_in_type(var->type);
+  if (num_arrays > 0) {
+ BITSET_WORD *indirects = rzalloc_array(mem_ctx, BITSET_WORD,
+BITSET_WORDS(num_arrays));
+ _mesa_hash_table_insert(var_indirect_map, var, indirects);
+ has_aoa = true;
+  }
+   }
+
+   return has_aoa;
+}
+
+static void
+mark_indirects_impl(nir_function_impl *impl,
+struct hash_table *var_indirect_map,
+nir_variable_mode modes,
+void *mem_ctx)
+{
+   nir_foreach_block(block, impl) {
+  nir_foreach_instr(instr, block) {
+ if (instr->type != nir_instr_type_deref)
+continue;
+
+ nir_deref_instr *deref = nir_instr_as_deref(instr);
+ if (!(deref->mode & modes))
+continue;
+
+ if (!glsl_type_is_vector_or_scalar(deref->type))
+continue;
+
+ nir_variable *base_var = nir_deref_instr_get_variable(deref);
+ struct hash_entry *entry =
+_mesa_hash_table_search(var_indirect_map, base_var);
+ if (!entry)
+continue;
+
+ BITSET_WORD *indirects = entry->data;
+
+ nir_deref_path path;
+ nir_deref_path_init(&path, deref, mem_ctx);
+
+ for (unsigned i = 1; path.path[i]; i++) {
+/* We already know this is an AoA variable */
+assert(path.path[i]->deref_type == 
nir_deref_type_array_wildcard ||

+   path.path[i]->deref_type == nir_deref_type_array);
+
+if (path.path[i]->deref_type == nir_deref_type_array &&
+nir_src_as_const_value(path.path[i]->arr.index) == NULL)
+   BITSET_SET(indirects, i - 1);
+ }
+  }
+   }
+}
+
+struct elem {
+   struct elem *parent;
+
+   const struct glsl_type *type;
+
+   nir_variable *var;
+   struct elem *ind_child;
+   struct elem *children;
+};
+
+static void
+create_split_array_vars(struct elem *elem, struct elem *parent,
+BITSET_WORD *indirects, unsigned depth,
+const struct glsl_type *type,
+const char *name,
+struct split_var_state *state)
+{
+   *elem = (struct elem) {
+  .parent = parent,
+  .type = type,
+   };
+
+   if (glsl_type_is_vector_or_scalar(type)) {
+  const struct glsl_type *var_type = type;
+  for (struct elem *e = elem->parent; e; e = e->parent) {
+ if (e->ind_child)
+var_type = glsl_array_type(var_type, glsl_get_length(e->type));
+  }
+
+  /* We add parens to the variable name so it looks like "(foo[2][*])" so
+   * that further derefs will look like "(foo[2][*])[ssa_6]"
+   */
+  name = ralloc_asprintf(state->mem_ctx, "(%s)", name);
+
+  nir_variable_mode mode = state->base_var->data.mode;
+  if (mode == nir_var_local) {
+ elem->var = nir_local_variable_creat

Re: [Mesa-dev] [PATCH v3 3/3] glsl: propagate full variables eagerly

2018-07-26 Thread Thomas Helland
Since we're always going top-down through the
program there should be no need to "walk backwards",
so this approach should be enough to get the whole chain
of assignments in one pass. Neat.

Reviewed-by: Thomas Helland

2018-07-25 3:03 GMT+02:00 Caio Marcelo de Oliveira Filho
:
> When creating a new acp_entry after an assignment "c = b", check if b
> itself has an acp_entry with a full variable associated and use
> that. This reduces the number of passes the algorithm needs to
> propagate a value in a chain of assignments.
>
> I've tried to make a similar change to the write_partial, but it
> caused noise in the final output (hurting instruction count). The
> reason is for partials, a propagation might imply a swizzle
> operation.
>
> We could later investigate if it is worth to restrict the cases we are
> eager to avoid getting things worse because of swizzling.
> ---
>  .../glsl/opt_copy_propagation_elements.cpp| 23 ++-
>  1 file changed, 22 insertions(+), 1 deletion(-)
>
> diff --git a/src/compiler/glsl/opt_copy_propagation_elements.cpp 
> b/src/compiler/glsl/opt_copy_propagation_elements.cpp
> index cae6d3c0707..c44f7c56f11 100644
> --- a/src/compiler/glsl/opt_copy_propagation_elements.cpp
> +++ b/src/compiler/glsl/opt_copy_propagation_elements.cpp
> @@ -169,8 +169,29 @@ public:
>   }
>}
>
> +  /* If the rhs has an acp_entry pointing to another full variable, use
> +   * that. This allows propagation to happen all in one pass, instead of
> +   * having the value walking slowly. E.g.
> +   *
> +   * b = a
> +   * c = b
> +   * d = c
> +   * use(d)
> +   *
> +   * will need one pass to propagate to
> +   *
> +   * b = a
> +   * c = a// Because of b acp_entry.
> +   * d = a// Because of c acp_entry that uses 'a' directly.
> +   * use(a)   // Because of d acp_entry that uses 'a' directly.
> +   */
> +  acp_entry *rhs_entry = read(rhs);
> +  if (rhs_entry && rhs_entry->rhs_full != NULL) {
> + rhs = rhs_entry->rhs_full;
> +  }
> +  rhs_entry = pull_acp(rhs);
> +
>lhs_entry->rhs_full = rhs;
> -  acp_entry *rhs_entry = pull_acp(rhs);
>_mesa_set_add(rhs_entry->dsts, lhs);
>
>if (lhs->type->is_vector()) {
> --
> 2.18.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] clover: Don't extend illegal integer types.

2018-07-26 Thread Jan Vesely
On Thu, 2018-07-26 at 10:51 -0700, Francisco Jerez wrote:
> Jan Vesely  writes:
> 
> > It's OK to pass them in memory, which is what kernel invocation needs.
> > Fixes AMDGCN regressions since llvm r337535 ("Reapply "AMDGPU: Fix handling 
> > of alignment padding in DAG argument lowering"):
> > scalar-arithmetic-char
> > scalar-arithmetic-uchar
> > scalar-arithemtic-short
> > scalar-arithmetic-ushort
> > scalar-comparison-char
> > scalar-comparison-uchar
> > scalar-comparison-short
> > scalar-comparison-ushort
> > 
> > Signed-off-by: Jan Vesely 
> 
> Reviewed-by: Francisco Jerez 

thank you. I added cc: stable and pushed both patches.

Jan

> 
> > ---
> >  src/gallium/state_trackers/clover/llvm/codegen/common.cpp |  3 +--
> >  src/gallium/state_trackers/clover/llvm/compat.hpp | 12 
> >  2 files changed, 13 insertions(+), 2 deletions(-)
> > 
> > diff --git a/src/gallium/state_trackers/clover/llvm/codegen/common.cpp 
> > b/src/gallium/state_trackers/clover/llvm/codegen/common.cpp
> > index ddf2083f37..ca5f78940d 100644
> > --- a/src/gallium/state_trackers/clover/llvm/codegen/common.cpp
> > +++ b/src/gallium/state_trackers/clover/llvm/codegen/common.cpp
> > @@ -85,8 +85,7 @@ namespace {
> >   const unsigned arg_store_size = dl.getTypeStoreSize(arg_type);
> >   const unsigned arg_api_size = dl.getTypeAllocSize(arg_type);
> >  
> > - const auto target_type = !arg_type->isIntegerTy() ? arg_type :
> > -dl.getSmallestLegalIntType(mod.getContext(), arg_store_size * 
> > 8);
> > + const auto target_type = compat::get_abi_type(arg_type, mod);
> >   const unsigned target_size = dl.getTypeStoreSize(target_type);
> >   const unsigned target_align = dl.getABITypeAlignment(target_type);
> >  
> > diff --git a/src/gallium/state_trackers/clover/llvm/compat.hpp 
> > b/src/gallium/state_trackers/clover/llvm/compat.hpp
> > index 60270d1529..975012cbda 100644
> > --- a/src/gallium/state_trackers/clover/llvm/compat.hpp
> > +++ b/src/gallium/state_trackers/clover/llvm/compat.hpp
> > @@ -153,6 +153,18 @@ namespace clover {
> > return tm.addPassesToEmitFile(pm, os, nullptr, ft);
> >  #else
> > return tm.addPassesToEmitFile(pm, os, ft);
> > +#endif
> > +   }
> > +
> > +   template
> > +   T get_abi_type(const T &arg_type, const M &mod) {
> > +#if HAVE_LLVM >= 0x0700
> > +  return arg_type;
> > +#else
> > +  ::llvm::DataLayout dl(&mod);
> > +  const unsigned arg_store_size = dl.getTypeStoreSize(arg_type);
> > +  return !arg_type->isIntegerTy() ? arg_type :
> > +dl.getSmallestLegalIntType(mod.getContext(), arg_store_size * 
> > 8);
> >  #endif
> > }
> >}
> > -- 
> > 2.16.4
> 
> ___
> mesa-dev mailing list
> mesa-dev@lists.freedesktop.org
> https://lists.freedesktop.org/mailman/listinfo/mesa-dev

-- 
Jan Vesely 

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


[Mesa-dev] [Bug 107385] full Screen Corruption when a program is fullscreen

2018-07-26 Thread bugzilla-daemon
https://bugs.freedesktop.org/show_bug.cgi?id=107385

--- Comment #8 from monkeyinastripedsh...@gmail.com ---
Created attachment 140844
  --> https://bugs.freedesktop.org/attachment.cgi?id=140844&action=edit
Xorg log

Unfortunately no, `1:18.0.1+git1807251933.fed411~oibaf~b` does not solve the
problem. Demesg shows the exact same error, I'm also including the most recent
Xorg log, hopefully that might shed some light on this.

-- 
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] gallium/auxiliary: Fix Autotools on Android (v2)

2018-07-26 Thread Chad Versace
On Wed 25 Jul 2018, Tomasz Figa wrote:
> Hi Chad,
> 
> On Wed, Jul 25, 2018 at 10:11 AM Chad Versace  
> wrote:
> >
> > Problem 1: u_debug_stack_android.cpp transitively included
> > "pipe/p_compiler.h", but src/gallium/include was missing from the C++
> > include path.
> >
> > Problem 2: Add -std=c++11 to AM_CXXFLAGS. Android's libbacktrace headers
> > require C++11, but the Android toolchain (at least in the Chrome OS SDK)
> > does not enable C++11 by default.
> >
> > v2: Add -std=c++11.
> >
> > Cc: Gurchetan Singh 
> > Cc: Eric Engestrom 
> > ---
> >  src/gallium/auxiliary/Makefile.am | 6 +-
> >  1 file changed, 5 insertions(+), 1 deletion(-)

[snip]

> >  if HAVE_PLATFORM_ANDROID
> > +# Android's libbacktrace headers required C++11, but the Android toolchain 
> > (at
> > +# least in the Chrome OS SDK) does not enable C++11 by default.
> > +AM_CXXFLAGS += $(CXX11_CXXFLAGS)
> > +
> 
> This is something that would normally be handled by the .pc file for
> given library. Package build system shouldn't be polluted with such
> system-specific low level dependencies.

Normally, I would agree. "If libbacktrace needs a CXXFLAG, then put in
the pc file". That's reasonable for most flags, because most flags are
*additive*. But the -std flag is not. If backtrace.pc added '-std=c++11'
to CXXFLAGS, but a different package required c++14, how should Mesa
resolve that conflict?

As precedent, I searched all pc files on my Debian machine. The only pc
files that add -std to CFLAGS or CXXFLAGS are the icu-*.pc files. And
those files should serve as anti-precedent in most cases; they are badly
written compared to all other pc files I've seen.
___
mesa-dev mailing list
mesa-dev@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/mesa-dev


[Mesa-dev] [Bug 107391] feature request: enforceable vsync and anisotropic filtering via environment variables

2018-07-26 Thread bugzilla-daemon
https://bugs.freedesktop.org/show_bug.cgi?id=107391

Bug ID: 107391
   Summary: feature request: enforceable vsync and anisotropic
filtering via environment variables
   Product: Mesa
   Version: unspecified
  Hardware: x86-64 (AMD64)
OS: Linux (All)
Status: NEW
  Severity: enhancement
  Priority: medium
 Component: Drivers/Vulkan/radeon
  Assignee: mesa-dev@lists.freedesktop.org
  Reporter: tempel.jul...@gmail.com
QA Contact: mesa-dev@lists.freedesktop.org

With RadeonSI, it's possible to force vsync on/off with vblank_mode and level
of anisotropic filtering with R600_TEX_ANISO.
It would be nice to have equivalent features for RADV.

Explanation why it would make sense to have these:
Some games/applications don't offer options for these features and the user may
not like the choice the application forces on him.
For example, a casual game runs with hundreds or thousands of frames per
second, which wastes lots of energy. Or a game doesn't offer to turn vsync off
and the user doesn't want the additional input lag that comes with this.
Enforceable vsync on/off would be very helpful in such cases.

Regarding anisotropic filtering:
Some games tend to ignore to apply AF to every texture when it's not enforced
via the driver. Sometimes even ground textures look blurry due to this, which
is a real shame. There are lots of examples for this when running DX11 games
with DXVK on RADV, e.g. Dying Light or Hitman (they run faster with DXVK than
the official OGL Linux ports).

-- 
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] intel_stub: Claim to support I915_PARAM_HAS_CONTEXT_ISOLATION.

2018-07-26 Thread Kenneth Graunke
Modern kernels support I915_PARAM_HAS_CONTEXT_ISOLATION, which allows
us to whack certain context registers with impunity.  One of those is
INSTPM/CS_DEBUG_MODE2, which controls whether Constant Buffer 0 is
relative to dynamic state base address, or a general GPU address.
If it's relative (the default), we can only push 3 ranges of UBOs.
If it's absolute, we can push 4.  So this affects our shader output.

Follow the behavior of modern kernels and allow us to push all 4 ranges.
---
 intel_stub.c | 1 +
 1 file changed, 1 insertion(+)

diff --git a/intel_stub.c b/intel_stub.c
index a3316b1..8b8db64 100644
--- a/intel_stub.c
+++ b/intel_stub.c
@@ -262,6 +262,7 @@ ioctl(int fd, unsigned long request, ...)
 case I915_PARAM_HAS_RELAXED_DELTA:
 case I915_PARAM_HAS_WAIT_TIMEOUT:
 case I915_PARAM_HAS_EXEC_NO_RELOC:
+case I915_PARAM_HAS_CONTEXT_ISOLATION:
 *getparam->value = 1;
 break;
 case I915_PARAM_CHIPSET_ID:
-- 
2.18.0

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


[Mesa-dev] [Bug 107351] Android 8.1: radv segfault with 3Dmark vulkan benchmarks

2018-07-26 Thread bugzilla-daemon
https://bugs.freedesktop.org/show_bug.cgi?id=107351

--- Comment #11 from Mauro Rossi  ---
Hi Bas, 
thanks for your instructions

I've tracked the line crashing in the radv_image.c file in master branch

utente@utente-MS-7576:~/oreo-x86_hwc1$ addr2line -Cfe
out/target/product/x86_64/symbols/system/vendor/lib/hw/vulkan.radv.so 
000f3407
vk_format_get_nr_components
external/mesa/src/amd/vulkan/vk_format.h:535
000f45e6
radv_CreateImage
external/mesa/src/amd/vulkan/radv_image.c:1261
^C

I don't trust too much addr2lib when the most recent code line is an header,
so I added ALOGD lines with LOG_TAG RADV 
in order to have the incremental inspection of 
radv_image_from_gralloc() arguments to expose the
argument affected by null pointer, here is what I did:


>From f2db3b5a70aaf66e9bf60c42da99560e6e5b6c13 Mon Sep 17 00:00:00 2001
From: Mauro Rossi 
Date: Thu, 26 Jul 2018 23:48:54 +0200
Subject: [PATCH] DO NOT MERGE: add incremental dump of
 radv_image_from_gralloc() arguments

Looking at the line crashing we will identity the argument with null pointer
---
 src/amd/vulkan/radv_image.c | 9 -
 1 file changed, 8 insertions(+), 1 deletion(-)

diff --git a/src/amd/vulkan/radv_image.c b/src/amd/vulkan/radv_image.c
index 826f898d28..b1141c71e2 100644
--- a/src/amd/vulkan/radv_image.c
+++ b/src/amd/vulkan/radv_image.c
@@ -25,6 +25,9 @@
  * IN THE SOFTWARE.
  */

+#define LOG_TAG "RADV"
+
+#include 
 #include "radv_debug.h"
 #include "radv_private.h"
 #include "vk_format.h"
@@ -1248,7 +1251,11 @@ radv_CreateImage(VkDevice device,
 #ifdef ANDROID
const VkNativeBufferANDROID *gralloc_info =
vk_find_struct_const(pCreateInfo->pNext,
NATIVE_BUFFER_ANDROID);
-
+   ALOGD("radv_image_from_gralloc() device=0x%x", device);
+   ALOGD("radv_image_from_gralloc() *pCreateInfo=0x%x", *pCreateInfo);
+   ALOGD("radv_image_from_gralloc() gralloc_info=0x%x", gralloc_info);
+   ALOGD("radv_image_from_gralloc() *pAllocator=0x%x", *pAllocator);
+   ALOGD("radv_image_from_gralloc() *pImage=0x%x", *pImage);
if (gralloc_info)
return radv_image_from_gralloc(device, pCreateInfo,
gralloc_info,
  pAllocator, pImage);
-- 
2.17.1


The output in the logcat is:

... D RADV: radv_image_from_gralloc() device=
... D RADV: radv_image_from_gralloc() *pCreateInfo=0xe
... D RADV: radv_image_from_gralloc() gralloc_info=0xc502a0e8
... F libc: Fatal signal 11 (SIGSEGV), code 1, fault addr 0x10 in tid 5548
(Thread-9), pid 5501 (cation:workload)

The crash happened with pAllocator, so this argument is the null pointer.
Mauro

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


Re: [Mesa-dev] [PATCH v2 2/2] egl/surfaceless: Allow DRMless fallback.

2018-07-26 Thread David Riley
On Thu, Jul 26, 2018 at 7:30 AM Emil Velikov 
wrote:

> Hi David,
>
> Hi Emil,

Thanks for the comments.


> On 18 July 2018 at 01:12, David Riley  wrote:
> > Allow platform_surfaceless to use swrast even if DRM is not available.
> > To be used to allow a fuzzer for virgl to be run on a jailed VM without
> > hardware GL or DRM support.
> >
> > Signed-off-by: David Riley 
> > ---
> >  src/egl/drivers/dri2/platform_surfaceless.c | 19 +++
> >  1 file changed, 19 insertions(+)
> >
> > diff --git a/src/egl/drivers/dri2/platform_surfaceless.c
> b/src/egl/drivers/dri2/platform_surfaceless.c
> > index f5fe7119c6..f4618bfa11 100644
> > --- a/src/egl/drivers/dri2/platform_surfaceless.c
> > +++ b/src/egl/drivers/dri2/platform_surfaceless.c
> > @@ -293,6 +293,7 @@ surfaceless_probe_device(_EGLDisplay *dpy, bool
> swrast)
> > int fd;
> > int i;
> >
> > +   /* Attempt to find DRM device. */
> > for (i = 0; i < limit; ++i) {
> >char *card_path;
> >if (asprintf(&card_path, DRM_RENDER_DEV_NAME, DRM_DIR_NAME, base
> + i) < 0)
> > @@ -327,6 +328,24 @@ surfaceless_probe_device(_EGLDisplay *dpy, bool
> swrast)
> >dri2_dpy->loader_extensions = NULL;
> > }
> >
> > +   /* No DRM device, so attempt to fall back to software path w/o DRM.
> */
> > +   if (swrast) {
> > +  _eglLog(_EGL_DEBUG, "Falling back to surfaceless swrast without
> DRM.");
> > +  dri2_dpy->fd = -1;
> > +  dri2_dpy->driver_name = strdup("swrast");
> > +  if (!dri2_dpy->driver_name) {
> > + return false;
> > +  }
> > +
> > +  if (dri2_load_driver_swrast(dpy)) {
> > + dri2_dpy->loader_extensions = swrast_loader_extensions;
> > + return true;
> > +  }
> > +
> > +  free(dri2_dpy->driver_name);
> > +  dri2_dpy->driver_name = NULL;
> > +   }
>
> Using swrast gives you a fairly different feature-set than kms_swrast.
> Since you're doing virglrenderer fuzzing, you haven't really noticed it.
>
> Yes, the main goal is to be able to get coverage of the virgl APIs and
thus the required GL APIs.


> Regardless, this patch seems like a hack, alike the ones Tomeu did [1].
> There are some ideas, in the comments, how to address this in a better
> fashion.
>
> If you can give it a try, that'll be appreciated. I don't quite have
> the time to pursue it atm.
>

I understand and agree with your comments about kms_swrast requiring KMS
and not wanting to change those semantics.

I'm not quite sure I follow all the rest of your suggestions (new to this
entire code base).  You're suggesting that surfaceless move away from
kms_swrast entirely?  Or just for the fallback path like I've got in these
changes?

With regards to your other suggestion I also don't follow. Are you're
suggesting that createNewScreen3 for swrast should dispatch between
dri2_init_screen/drisw_init_screen/dri_kms_init_screen based on some enum
instead of a driver that has been loaded and it's vtable?

I'm hoping to make some more targeted changes than major refactoring of
code that I'm quite unfamiliar with.

Thanks,
David

>
> HTH
> Emil
>
> [1]
>
> https://gitlab.collabora.com/tomeu/mesa/commit/4f804ceecd658492234cbf0fa5fb1b156a8fb79c
>
> https://gitlab.collabora.com/tomeu/mesa/commit/54adda6a4d7b5c783d54dfd37d38d1a5a0f3187f
>
___
mesa-dev mailing list
mesa-dev@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/mesa-dev


[Mesa-dev] [PATCH 2/3 v3] Android.common.mk: define HAVE_TIMESPEC_GET

2018-07-26 Thread John Stultz
From: Sumit Semwal 

This is a forward port of a patch from the AOSP/master tree:
https://android.googlesource.com/platform/external/mesa3d/+/bd30b663f55f8af73a0be4446349c5a2d4c641b0%5E%21/

Since https://android-review.googlesource.com/c/718518 added
timespec_get() to bionic, mesa3d doesn't build due to redefinition
of timespec_get().

Avoid redefinition by defining HAVE_TIMESPEC_GET flag.

Test: build and boot tested db820c to UI.

Cc: Rob Herring 
Cc: Alistair Strachan 
Cc: Marissa Wall 
Cc: Sumit Semwal 
Cc: Emil Velikov 
Cc: Rob Clark 
Reviewed-by: Emil Velikov 
Signed-off-by: Sumit Semwal 
Signed-off-by: John Stultz 
---
v2: Conditionalize it for PLATFORM_VERSION Q and higher
v3: Rework conditionalization to numbered releases prior
to P (9.0)
---
 Android.common.mk | 7 +++
 1 file changed, 7 insertions(+)

diff --git a/Android.common.mk b/Android.common.mk
index 397dc03..619b216 100644
--- a/Android.common.mk
+++ b/Android.common.mk
@@ -89,6 +89,13 @@ LOCAL_CPPFLAGS += \
 LOCAL_CONLYFLAGS += \
-std=c99
 
+# c11 timespec_get is part of bionic as well
+# https://android-review.googlesource.com/c/718518
+# This means releases from P and earlier won't need this
+ifeq ($(filter 5 6 7 8 9, $(MESA_ANDROID_MAJOR_VERSION)),)
+LOCAL_CFLAGS += -DHAVE_TIMESPEC_GET
+endif
+
 ifeq ($(strip $(MESA_ENABLE_ASM)),true)
 ifeq ($(TARGET_ARCH),x86)
 LOCAL_CFLAGS += \
-- 
2.7.4

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


Re: [Mesa-dev] [PATCH 1/2] intel/fs: New method for register_byte_use_pattern for fs_inst

2018-07-26 Thread Chema Casanova
El 26/07/18 a las 20:02, Francisco Jerez escribió:
> Chema Casanova  writes:
> 
>> El 20/07/18 a las 22:10, Francisco Jerez escribió:
>>> Chema Casanova  writes:
>>>
 El 20/07/18 a las 00:34, Francisco Jerez escribió:
> Chema Casanova  writes:
>
>> El 14/07/18 a las 00:14, Francisco Jerez escribió:
>>> Jose Maria Casanova Crespo  writes:
>>>
 For a register source/destination of an instruction the function 
 returns
 the read/write byte pattern of a 32-byte registers as a unsigned int.

 The returned pattern takes into account the exec_size of the 
 instruction,
 the type bitsize, the stride and if the register is source or 
 destination.

 The objective of the functions if to help to know the read/written 
 bytes
 of the instructions to improve the liveness analysis for partial 
 read/writes.

 We manage special cases for SHADER_OPCODE_BYTE_SCATTERED_WRITE_LOGICAL
 and SHADER_OPCODE_BYTE_SCATTERED_WRITE because depending of the bitsize
 parameter they have a different read pattern.
 ---
  src/intel/compiler/brw_fs.cpp  | 183 +
  src/intel/compiler/brw_ir_fs.h |   1 +
  2 files changed, 184 insertions(+)

 diff --git a/src/intel/compiler/brw_fs.cpp 
 b/src/intel/compiler/brw_fs.cpp
 index 2b8363ca362..f3045c4ff6c 100644
 --- a/src/intel/compiler/brw_fs.cpp
 +++ b/src/intel/compiler/brw_fs.cpp
 @@ -687,6 +687,189 @@ fs_inst::is_partial_write() const
 this->dst.offset % REG_SIZE != 0);
  }
  
 +/**
 + * Returns a 32-bit uint whose bits represent if the associated 
 register byte
 + * has been read/written by the instruction. The returned pattern 
 takes into
 + * account the exec_size of the instruction, the type bitsize and the 
 register
 + * stride and the register is source or destination for the 
 instruction.
 + *
 + * The objective of this function is to identify which parts of the 
 register
 + * are read or written for operations that don't read/write a full 
 register.
 + * So we can identify in live range variable analysis if a partial 
 write has
 + * completelly defined the part of the register used by a partial 
 read. So we
 + * avoid extending the liveness range because all data read was 
 already
 + * defined although the wasn't completely written.
 + */
 +unsigned
 +fs_inst::register_byte_use_pattern(const fs_reg &r, boolean is_dst) 
 const
 +{
 +   if (is_dst) {
>>
>>> Please split into two functions (like fs_inst::src_read and
>>> ::src_written) since that would make the call-sites of this method more
>>> self-documenting than a boolean parameter.  You should be able to share
>>> code by refactoring the common logic into a separate function (see below
>>> for some suggestions on how that could be achieved).
>>
>> Sure, it would improve readability and simplifies the logic, I've chosen
>> dst_write_pattern and src_read_pattern.
>>
>>>
 +  /* We don't know what is written so we return the worts case */
>>>
>>> "worst"
>>
>> Fixed.
>>
 +  if (this->predicate && this->opcode != BRW_OPCODE_SEL)
 + return 0;
 +  /* We assume that send destinations are completely written */
 +  if (this->is_send_from_grf())
 + return ~0u;
>>>
>>> Some send-like instructions won't be caught by this condition, you
>>> should check for this->mlen != 0 in addition.
>>
>> Would it be enough to check for (this->mlen > 0) and forget about
>> is_send_from_grf? I am using this approach in v2 I am sending.
>>
>
> I don't think the mlen > 0 condition would catch all cases either...
> E.g. FS_OPCODE_UNIFORM_PULL_CONSTANT_LOAD IIRC.  You probably need both
> conditions.  Sucks...

 That is true, so now we have the:
  (this->is_send_from_grf() || this->mlen != 0)

 +   } else {
 +  /* byte_scattered_write_logical pattern of src[1] is 32-bit 
 aligned
 +   * so the read pattern depends on the bitsize stored at src[4]
 +   */
 +  if (this->opcode == SHADER_OPCODE_BYTE_SCATTERED_WRITE_LOGICAL 
 &&
 +  this->src[1].nr == r.nr) {
>>
>>> I feel uncomfortable about attempting to guess the source the caller is
>>> referring to by comparing the registers for equality.  E.g.  you could
>>> potentially end up with two sources that compare equal but have
>>> different semantics (e.g. as a result of CSE) which 

  1   2   >