[Mesa-dev] [Bug 99959] egl-entrypoint-check fails

2017-02-24 Thread bugzilla-daemon
https://bugs.freedesktop.org/show_bug.cgi?id=99959

--- Comment #1 from Vinson Lee  ---
*** Bug 99960 has been marked as a duplicate of this bug. ***

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


[Mesa-dev] [Bug 99960] egl-entrypoint-check fails

2017-02-24 Thread bugzilla-daemon
https://bugs.freedesktop.org/show_bug.cgi?id=99960

Vinson Lee  changed:

   What|Removed |Added

 Resolution|--- |DUPLICATE
 Status|NEW |RESOLVED

--- Comment #1 from Vinson Lee  ---


*** This bug has been marked as a duplicate of bug 99959 ***

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


[Mesa-dev] [Bug 99960] egl-entrypoint-check fails

2017-02-24 Thread bugzilla-daemon
https://bugs.freedesktop.org/show_bug.cgi?id=99960

Bug ID: 99960
   Summary: egl-entrypoint-check fails
   Product: Mesa
   Version: git
  Hardware: x86-64 (AMD64)
OS: Linux (All)
Status: NEW
  Keywords: bisected, regression
  Severity: normal
  Priority: medium
 Component: Mesa core
  Assignee: mesa-dev@lists.freedesktop.org
  Reporter: v...@freedesktop.org
QA Contact: mesa-dev@lists.freedesktop.org
CC: emil.l.veli...@gmail.com, fdo-b...@engestrom.ch

mesa: 6b4bb24acfeec4d224acdffb73a5f5d810291a02 (master 17.1.0-devel)

FAIL: egl-entrypoint-check
==

./egl-entrypoint-check: 4: ./egl-entrypoint-check: Syntax error: redirection
unexpected
FAIL egl-entrypoint-check (exit status: 2)


commit d25dea0c688cc05f08b4ae32545e9a3bd5b33be0
Author: Eric Engestrom 
Date:   Tue Feb 21 23:56:51 2017 +

egl: make sure entrypoints list is always sorted

Starting with the next commit, badly sorting this list will break the
eglGetProcAddress().

Signed-off-by: Eric Engestrom 
Reviewed-by: Emil Velikov 

-- 
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 99959] egl-entrypoint-check fails

2017-02-24 Thread bugzilla-daemon
https://bugs.freedesktop.org/show_bug.cgi?id=99959

Bug ID: 99959
   Summary: egl-entrypoint-check fails
   Product: Mesa
   Version: git
  Hardware: x86-64 (AMD64)
OS: Linux (All)
Status: NEW
  Keywords: bisected, regression
  Severity: normal
  Priority: medium
 Component: Mesa core
  Assignee: mesa-dev@lists.freedesktop.org
  Reporter: v...@freedesktop.org
QA Contact: mesa-dev@lists.freedesktop.org
CC: emil.l.veli...@gmail.com, fdo-b...@engestrom.ch

mesa: 6b4bb24acfeec4d224acdffb73a5f5d810291a02 (master 17.1.0-devel)

FAIL: egl-entrypoint-check
==

./egl-entrypoint-check: 4: ./egl-entrypoint-check: Syntax error: redirection
unexpected
FAIL egl-entrypoint-check (exit status: 2)


commit d25dea0c688cc05f08b4ae32545e9a3bd5b33be0
Author: Eric Engestrom 
Date:   Tue Feb 21 23:56:51 2017 +

egl: make sure entrypoints list is always sorted

Starting with the next commit, badly sorting this list will break the
eglGetProcAddress().

Signed-off-by: Eric Engestrom 
Reviewed-by: Emil Velikov 

-- 
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] glx/tests: Fix bash-specific code in dispatch-index-check

2017-02-24 Thread Vinson Lee
On Fri, Feb 24, 2017 at 8:03 PM, Aaron Watry  wrote:
> Using <<< for variable redirection is bash-specific behavior.
> Ubuntu redirects sh -> dash, so this was erroring out.
>
> Also, the initial error that led me to this was that srcdir is null when 
> running make check
> so I just copied something similar to what the optimization-test script does.
> ---
>  src/glx/tests/dispatch-index-check | 21 ++---
>  1 file changed, 14 insertions(+), 7 deletions(-)
>
> diff --git a/src/glx/tests/dispatch-index-check 
> b/src/glx/tests/dispatch-index-check
> index 78464b8..ee1b9ee 100755
> --- a/src/glx/tests/dispatch-index-check
> +++ b/src/glx/tests/dispatch-index-check
> @@ -1,24 +1,31 @@
>  #!/bin/sh
>
> +if [ -z "$srcdir" ]; then
> +   scriptdir=`dirname "$0"`
> +else
> +   scriptdir=$srcdir
> +fi
> +
> +
>  # extract enum definition
>  dispatch_list=$(sed '/__GLXdispatchIndex/,/__GLXdispatchIndex/!d' \
> -  "$srcdir"/../g_glxglvnddispatchindices.h)
> +  "$scriptdir"/../g_glxglvnddispatchindices.h)
>
>  # extract values inside of enum
> -dispatch_list=$(sed '1d;$d' <<< "$dispatch_list")
> +dispatch_list=$(printf "$dispatch_list" | sed '1d;$d')
>
>  # remove indentation
> -dispatch_list=$(sed 's/^\s\+//' <<< "$dispatch_list")
> +dispatch_list=$(printf "$dispatch_list" | sed 's/^\s\+//')
>
>  # extract function names
> -dispatch_list=$(sed 's/DI_//;s/,//' <<< "$dispatch_list")
> +dispatch_list=$(printf "$dispatch_list" | sed 's/DI_//;s/,//')
>
>  # same for commented functions, we want to keep them sorted too
> -dispatch_list=$(sed 's#// ##;s/ implemented by [a-z]\+//' <<< 
> "$dispatch_list")
> +dispatch_list=$(printf "$dispatch_list" | sed 's#// ##;s/ implemented by 
> [a-z]\+//')
>
>  # remove LAST_INDEX, as it will not be in alphabetical order
> -dispatch_list=$(sed '/LAST_INDEX/d' <<< "$dispatch_list")
> +dispatch_list=$(printf "$dispatch_list" | sed '/LAST_INDEX/d')
>
> -sorted=$(LC_ALL=C sort <<< "$dispatch_list")
> +sorted=$(LC_ALL=C printf "$dispatch_list" | sort)
>
>  test "$dispatch_list" = "$sorted"
> --
> 2.9.3
>
> ___
> mesa-dev mailing list
> mesa-dev@lists.freedesktop.org
> https://lists.freedesktop.org/mailman/listinfo/mesa-dev


Fixes: 3cc33e764011 ("glx: add GLXdispatchIndex sort check")

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


[Mesa-dev] [Bug 99918] disk_cache.h:57:20: error: no member named 'st_mtim' in 'struct stat'

2017-02-24 Thread bugzilla-daemon
https://bugs.freedesktop.org/show_bug.cgi?id=99918

Vinson Lee  changed:

   What|Removed |Added

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

--- Comment #3 from Vinson Lee  ---
commit 30a4b25efe005c922f048beaf62852714d2462a1
Author: Vinson Lee 
Date:   Thu Feb 23 13:48:34 2017 -0800

util/disk_cache: Use backward compatible st_mtime.

Fix Mac OS X build error.

  CC   libmesautil_la-disk_cache.lo
In file included from disk_cache.c:46:
./disk_cache.h:57:20: error: no member named 'st_mtim' in 'struct stat'
   *timestamp = st.st_mtim.tv_sec;
~~ ^

Bugzilla: https://bugs.freedesktop.org/show_bug.cgi?id=99918
Fixes: 207e3a6e4b ("util/radv: move *_get_function_timestamp() to utils")
Signed-off-by: Vinson Lee 
Reviewed-by: Timothy Arceri 
Reviewed-by: Nicolai Hähnle 

-- 
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] st/nine: Remove code for no USER_INDEX_BUFFERS as these are always on

2017-02-24 Thread Vinson Lee
On Fri, Feb 24, 2017 at 9:23 PM, Mike Lothian  wrote:
> This fixes 4a883966c1f74f43afc145d2c3d27af7b8c5e01a where the pipe cap
> was removed
>
> Now USER_INDEX_BUFFERS are always enabled remove code that checks for
> them and works around them not being available
>
> Signed-off-by: Mike Lothian 
> Cc: Marek Olšák 
> Cc: Axel Davy 
> ---
>  src/gallium/state_trackers/nine/device9.c | 17 -
>  1 file changed, 17 deletions(-)
>
> diff --git a/src/gallium/state_trackers/nine/device9.c 
> b/src/gallium/state_trackers/nine/device9.c
> index b9b7a637d7..2217cc9d0c 100644
> --- a/src/gallium/state_trackers/nine/device9.c
> +++ b/src/gallium/state_trackers/nine/device9.c
> @@ -473,7 +473,6 @@ NineDevice9_ctor( struct NineDevice9 *This,
>  /* Allocate upload helper for drivers that suck (from st pov ;). */
>
>  This->driver_caps.user_vbufs = GET_PCAP(USER_VERTEX_BUFFERS) && 
> !This->csmt_active;
> -This->driver_caps.user_ibufs = GET_PCAP(USER_INDEX_BUFFERS) && 
> !This->csmt_active;
>  This->driver_caps.user_cbufs = GET_PCAP(USER_CONSTANT_BUFFERS);
>  This->driver_caps.user_sw_vbufs = 
> This->screen_sw->get_param(This->screen_sw, PIPE_CAP_USER_VERTEX_BUFFERS);
>  This->driver_caps.user_sw_cbufs = 
> This->screen_sw->get_param(This->screen_sw, PIPE_CAP_USER_CONSTANT_BUFFERS);
> @@ -488,11 +487,6 @@ NineDevice9_ctor( struct NineDevice9 *This,
>  PIPE_BIND_VERTEX_BUFFER, 
> PIPE_USAGE_STREAM);
>  This->vertex_sw_uploader = u_upload_create(This->pipe_sw, 65536,
>  PIPE_BIND_VERTEX_BUFFER, 
> PIPE_USAGE_STREAM);
> -if (!This->driver_caps.user_ibufs)
> -This->index_uploader = u_upload_create(This->csmt_active ?
> -This->pipe_secondary : 
> This->context.pipe,
> -   128 * 1024,
> -   PIPE_BIND_INDEX_BUFFER, 
> PIPE_USAGE_STREAM);
>  if (!This->driver_caps.user_cbufs) {
>  This->constbuf_alignment = 
> GET_PCAP(CONSTANT_BUFFER_OFFSET_ALIGNMENT);
>  This->constbuf_uploader = u_upload_create(This->context.pipe, 
> This->vs_const_size,
> @@ -2928,17 +2922,6 @@ NineDevice9_DrawIndexedPrimitiveUP( struct NineDevice9 
> *This,
>  vbuf.buffer_offset -= base;
>  vbuf.user_buffer = NULL;
>  }
> -if (!This->driver_caps.user_ibufs) {
> -u_upload_data(This->index_uploader,
> -  0,
> -  (prim_count_to_vertex_count(PrimitiveType, 
> PrimitiveCount)) * ibuf.index_size,
> -  4,
> -  ibuf.user_buffer,
> -  &ibuf.offset,
> -  &ibuf.buffer);
> -u_upload_unmap(This->index_uploader);
> -ibuf.user_buffer = NULL;
> -}
>
>  NineBeforeDraw(This);
>  nine_context_draw_indexed_primitive_from_vtxbuf_idxbuf(This, 
> PrimitiveType,
> --
> 2.11.1
>
> ___
> mesa-dev mailing list
> mesa-dev@lists.freedesktop.org
> https://lists.freedesktop.org/mailman/listinfo/mesa-dev

Bugzilla: https://bugs.freedesktop.org/show_bug.cgi?id=99953
Fixes: 4a883966c1f7 ("gallium: remove PIPE_CAP_USER_INDEX_BUFFERS")

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


[Mesa-dev] [PATCH] st/nine: Remove code for no USER_INDEX_BUFFERS as these are always on

2017-02-24 Thread Mike Lothian
This fixes 4a883966c1f74f43afc145d2c3d27af7b8c5e01a where the pipe cap
was removed

Now USER_INDEX_BUFFERS are always enabled remove code that checks for
them and works around them not being available

Signed-off-by: Mike Lothian 
Cc: Marek Olšák 
Cc: Axel Davy 
---
 src/gallium/state_trackers/nine/device9.c | 17 -
 1 file changed, 17 deletions(-)

diff --git a/src/gallium/state_trackers/nine/device9.c 
b/src/gallium/state_trackers/nine/device9.c
index b9b7a637d7..2217cc9d0c 100644
--- a/src/gallium/state_trackers/nine/device9.c
+++ b/src/gallium/state_trackers/nine/device9.c
@@ -473,7 +473,6 @@ NineDevice9_ctor( struct NineDevice9 *This,
 /* Allocate upload helper for drivers that suck (from st pov ;). */
 
 This->driver_caps.user_vbufs = GET_PCAP(USER_VERTEX_BUFFERS) && 
!This->csmt_active;
-This->driver_caps.user_ibufs = GET_PCAP(USER_INDEX_BUFFERS) && 
!This->csmt_active;
 This->driver_caps.user_cbufs = GET_PCAP(USER_CONSTANT_BUFFERS);
 This->driver_caps.user_sw_vbufs = 
This->screen_sw->get_param(This->screen_sw, PIPE_CAP_USER_VERTEX_BUFFERS);
 This->driver_caps.user_sw_cbufs = 
This->screen_sw->get_param(This->screen_sw, PIPE_CAP_USER_CONSTANT_BUFFERS);
@@ -488,11 +487,6 @@ NineDevice9_ctor( struct NineDevice9 *This,
 PIPE_BIND_VERTEX_BUFFER, 
PIPE_USAGE_STREAM);
 This->vertex_sw_uploader = u_upload_create(This->pipe_sw, 65536,
 PIPE_BIND_VERTEX_BUFFER, 
PIPE_USAGE_STREAM);
-if (!This->driver_caps.user_ibufs)
-This->index_uploader = u_upload_create(This->csmt_active ?
-This->pipe_secondary : 
This->context.pipe,
-   128 * 1024,
-   PIPE_BIND_INDEX_BUFFER, 
PIPE_USAGE_STREAM);
 if (!This->driver_caps.user_cbufs) {
 This->constbuf_alignment = GET_PCAP(CONSTANT_BUFFER_OFFSET_ALIGNMENT);
 This->constbuf_uploader = u_upload_create(This->context.pipe, 
This->vs_const_size,
@@ -2928,17 +2922,6 @@ NineDevice9_DrawIndexedPrimitiveUP( struct NineDevice9 
*This,
 vbuf.buffer_offset -= base;
 vbuf.user_buffer = NULL;
 }
-if (!This->driver_caps.user_ibufs) {
-u_upload_data(This->index_uploader,
-  0,
-  (prim_count_to_vertex_count(PrimitiveType, 
PrimitiveCount)) * ibuf.index_size,
-  4,
-  ibuf.user_buffer,
-  &ibuf.offset,
-  &ibuf.buffer);
-u_upload_unmap(This->index_uploader);
-ibuf.user_buffer = NULL;
-}
 
 NineBeforeDraw(This);
 nine_context_draw_indexed_primitive_from_vtxbuf_idxbuf(This, PrimitiveType,
-- 
2.11.1

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


Re: [Mesa-dev] Mesa git: compilation error in NINE after your latest commit - 'PIPE_CAP_USER_INDEX_BUFFERS' undeclared

2017-02-24 Thread Mike Lothian
I've got a patch for this, just testing it now

On Sat, 25 Feb 2017 at 00:10 Dieter Nützel  wrote:

> Making all in state_trackers/nine
> make[4]: Entering directory '/opt/mesa/src/gallium/state_trackers/nine'
>CC   device9.lo
> device9.c: In function 'NineDevice9_ctor':
> device9.c:122:49: error: 'PIPE_CAP_USER_INDEX_BUFFERS' undeclared (first
> use in this function)
>   #define GET_PCAP(n) pScreen->get_param(pScreen, PIPE_CAP_##n)
>   ^
> device9.c:476:36: note: in expansion of macro 'GET_PCAP'
>   This->driver_caps.user_ibufs = GET_PCAP(USER_INDEX_BUFFERS) &&
> !This->csmt_active;
>  ^
> device9.c:122:49: note: each undeclared identifier is reported only once
> for each function it appears in
>   #define GET_PCAP(n) pScreen->get_param(pScreen, PIPE_CAP_##n)
>   ^
> device9.c:476:36: note: in expansion of macro 'GET_PCAP'
>   This->driver_caps.user_ibufs = GET_PCAP(USER_INDEX_BUFFERS) &&
> !This->csmt_active;
>  ^
> Makefile:745: recipe for target 'device9.lo' failed
> make[4]: *** [device9.lo] Error 1
> ___
> mesa-dev mailing list
> mesa-dev@lists.freedesktop.org
> https://lists.freedesktop.org/mailman/listinfo/mesa-dev
>
___
mesa-dev mailing list
mesa-dev@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/mesa-dev


Re: [Mesa-dev] [PATCH 1/2] radeonsi: add support for an on-disk shader cache

2017-02-24 Thread Timothy Arceri



On 24/02/17 21:02, Marek Olšák wrote:

On Fri, Feb 24, 2017 at 3:18 AM, Timothy Arceri  wrote:



On 24/02/17 08:49, Timothy Arceri wrote:




On 24/02/17 05:12, Marek Olšák wrote:


On Thu, Feb 23, 2017 at 3:09 AM, Timothy Arceri
 wrote:


From: kdj0c 

V2 (Timothy Arceri):
- when loading from disk cache also binary insert into memory cache.
- check that the binary loaded from disk is the correct size. If not
  delete the cache item and skip loading from cache.
---
 src/gallium/drivers/radeonsi/si_state_shaders.c | 69
++---
 1 file changed, 62 insertions(+), 7 deletions(-)

diff --git a/src/gallium/drivers/radeonsi/si_state_shaders.c
b/src/gallium/drivers/radeonsi/si_state_shaders.c
index f615aa8..71556f9 100644
--- a/src/gallium/drivers/radeonsi/si_state_shaders.c
+++ b/src/gallium/drivers/radeonsi/si_state_shaders.c
@@ -36,6 +36,9 @@
 #include "util/u_memory.h"
 #include "util/u_prim.h"

+#include "util/disk_cache.h"
+#include "util/mesa-sha1.h"
+
 /* SHADER_CACHE */

 /**
@@ -182,10 +185,12 @@ static bool si_load_shader_binary(struct
si_shader *shader, void *binary)
  */
 static bool si_shader_cache_insert_shader(struct si_screen *sscreen,
  void *tgsi_binary,
- struct si_shader *shader)
+ struct si_shader *shader,
+ bool insert_into_disk_cache)
 {
void *hw_binary;
struct hash_entry *entry;
+   uint8_t key[CACHE_KEY_SIZE];

entry = _mesa_hash_table_search(sscreen->shader_cache,
tgsi_binary);
if (entry)
@@ -201,6 +206,12 @@ static bool si_shader_cache_insert_shader(struct
si_screen *sscreen,
return false;
}

+   if (sscreen->b.disk_shader_cache && insert_into_disk_cache) {
+   _mesa_sha1_compute(tgsi_binary, *((uint32_t
*)tgsi_binary), key);



What happens if we randomly get a sha1 collision?



You should stop playing your game which will be rendering incorrectly
and by a lotto ticket.


Shouldn't we store the whole key as well?



Sure I can add that, its cheap to check here anyway. Although the other
cache stages rely on a collision being improbable.




For some reason I thought the key was simpler than it is. It seems excessive
to store and compare the tgsi again. I don't think git even worries about
the possibility of a collision and we will be dealing with much smaller
amounts of cache items then commits in a git repository.

Thoughts?


I'll let others comment on this. If nobody comments, checking only the
key can stay.


Seems SVN didn't used to worry about collisions either.

https://arstechnica.com/security/2017/02/watershed-sha1-collision-just-broke-the-webkit-repository-others-may-follow/



Marek


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


[Mesa-dev] [PATCH] glx/tests: Fix bash-specific code in dispatch-index-check

2017-02-24 Thread Aaron Watry
Using <<< for variable redirection is bash-specific behavior.
Ubuntu redirects sh -> dash, so this was erroring out.

Also, the initial error that led me to this was that srcdir is null when 
running make check
so I just copied something similar to what the optimization-test script does.
---
 src/glx/tests/dispatch-index-check | 21 ++---
 1 file changed, 14 insertions(+), 7 deletions(-)

diff --git a/src/glx/tests/dispatch-index-check 
b/src/glx/tests/dispatch-index-check
index 78464b8..ee1b9ee 100755
--- a/src/glx/tests/dispatch-index-check
+++ b/src/glx/tests/dispatch-index-check
@@ -1,24 +1,31 @@
 #!/bin/sh
 
+if [ -z "$srcdir" ]; then
+   scriptdir=`dirname "$0"`
+else
+   scriptdir=$srcdir
+fi
+
+
 # extract enum definition
 dispatch_list=$(sed '/__GLXdispatchIndex/,/__GLXdispatchIndex/!d' \
-  "$srcdir"/../g_glxglvnddispatchindices.h)
+  "$scriptdir"/../g_glxglvnddispatchindices.h)
 
 # extract values inside of enum
-dispatch_list=$(sed '1d;$d' <<< "$dispatch_list")
+dispatch_list=$(printf "$dispatch_list" | sed '1d;$d')
 
 # remove indentation
-dispatch_list=$(sed 's/^\s\+//' <<< "$dispatch_list")
+dispatch_list=$(printf "$dispatch_list" | sed 's/^\s\+//')
 
 # extract function names
-dispatch_list=$(sed 's/DI_//;s/,//' <<< "$dispatch_list")
+dispatch_list=$(printf "$dispatch_list" | sed 's/DI_//;s/,//')
 
 # same for commented functions, we want to keep them sorted too
-dispatch_list=$(sed 's#// ##;s/ implemented by [a-z]\+//' <<< "$dispatch_list")
+dispatch_list=$(printf "$dispatch_list" | sed 's#// ##;s/ implemented by 
[a-z]\+//')
 
 # remove LAST_INDEX, as it will not be in alphabetical order
-dispatch_list=$(sed '/LAST_INDEX/d' <<< "$dispatch_list")
+dispatch_list=$(printf "$dispatch_list" | sed '/LAST_INDEX/d')
 
-sorted=$(LC_ALL=C sort <<< "$dispatch_list")
+sorted=$(LC_ALL=C printf "$dispatch_list" | sort)
 
 test "$dispatch_list" = "$sorted"
-- 
2.9.3

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


[Mesa-dev] [Bug 99319] godot engine poor performance

2017-02-24 Thread bugzilla-daemon
https://bugs.freedesktop.org/show_bug.cgi?id=99319

--- Comment #6 from i9i7s...@gmail.com ---
Posting to say I have this problem on my RX 460. Mesa 17, I get good
performance in other games but I get <10fps in the Godot platformer demo. Is
there anything I can do to help test or debug this?

-- 
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] [AppVeyor] mesa master #3563 completed

2017-02-24 Thread AppVeyor


Build mesa 3563 completed



Commit fcf466383a by Brian Paul on 2/25/2017 2:02 AM:

svga: fix MSVC build error after PIPE_CAP_USER_INDEX_BUFFERS removal\n\nNeed to specify the zero for the struct initializer.  My earlier test\nof the patch series was with MinGW, not MSVC.\n\nTrivial.


Configure your notification preferences

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


Re: [Mesa-dev] [PATCH] anv/image: Remove extra dependency on HiZ-specific variable

2017-02-24 Thread Jason Ekstrand
seems reasonable

Reviewed-by: Jason Ekstrand 

On Wed, Feb 22, 2017 at 4:33 PM, Nanley Chery  wrote:

> Depth buffers aren't allowed to be used as storage images.
>
> Fixes: 055ff2ec521 ("anv: Replace anv_image_has_hiz() with
> ISL_AUX_USAGE_HIZ")
> Signed-off-by: Nanley Chery 
> ---
>  src/intel/vulkan/anv_image.c | 4 ++--
>  1 file changed, 2 insertions(+), 2 deletions(-)
>
> diff --git a/src/intel/vulkan/anv_image.c b/src/intel/vulkan/anv_image.c
> index e2f7ca340f..27bd0f212c 100644
> --- a/src/intel/vulkan/anv_image.c
> +++ b/src/intel/vulkan/anv_image.c
> @@ -595,7 +595,7 @@ anv_CreateImageView(VkDevice _device,
>.surf = &surface->isl,
>.view = &view,
>.aux_surf = &image->aux_surface.isl,
> -  .aux_usage = surf_usage,
> +  .aux_usage = image->aux_usage,
>.mocs = device->default_mocs);
>
>if (isl_has_matching_typed_storage_image_format(&device->info,
> @@ -612,7 +612,7 @@ anv_CreateImageView(VkDevice _device,
>   .surf = &surface->isl,
>   .view = &view,
>   .aux_surf = &image->aux_surface.isl,
> - .aux_usage = surf_usage,
> + .aux_usage = image->aux_usage,
>   .mocs = device->default_mocs);
>} else {
>   anv_fill_buffer_surface_state(device,
> iview->storage_surface_state,
> --
> 2.11.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 3/5] anv: automake: add TODO to the tarball

2017-02-24 Thread Jason Ekstrand
Why?

On Thu, Feb 23, 2017 at 8:48 AM, Emil Velikov 
wrote:

> From: Emil Velikov 
>
> Signed-off-by: Emil Velikov 
> ---
>  src/intel/vulkan/Makefile.am | 3 ++-
>  1 file changed, 2 insertions(+), 1 deletion(-)
>
> diff --git a/src/intel/vulkan/Makefile.am b/src/intel/vulkan/Makefile.am
> index 449188fe1e..a7e2d8e2b4 100644
> --- a/src/intel/vulkan/Makefile.am
> +++ b/src/intel/vulkan/Makefile.am
> @@ -159,7 +159,8 @@ EXTRA_DIST = \
> $(top_srcdir)/include/vulkan/vk_icd.h \
> anv_entrypoints_gen.py \
> dev_icd.json.in \
> -   intel_icd.json.in
> +   intel_icd.json.in \
> +   TODO
>
>  libvulkan_intel_la_LIBADD = $(VULKAN_LIB_DEPS)
>
> --
> 2.11.0
>
> ___
> mesa-dev mailing list
> mesa-dev@lists.freedesktop.org
> https://lists.freedesktop.org/mailman/listinfo/mesa-dev
>
___
mesa-dev mailing list
mesa-dev@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/mesa-dev


[Mesa-dev] [Bug 99956] build_id.c:36:20: error: unknown type name 'Elf_Nhdr'

2017-02-24 Thread bugzilla-daemon
https://bugs.freedesktop.org/show_bug.cgi?id=99956

--- Comment #1 from Jonathan Gray  ---
Looking at the FreeBSD headers it appears they define Elf_Note not Elf_Nhdr.

https://svnweb.freebsd.org/base/head/sys/sys/elf_common.h?revision=HEAD&view=co

The OpenBSD headers define both at the moment to be compatible though the
Elf_Note members on OpenBSD do not have the n_ prefix only the Elf_Nhdr structs
do where as the FreeBSD Elf_Note has the n_ prefix.

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


[Mesa-dev] [Bug 99956] build_id.c:36:20: error: unknown type name 'Elf_Nhdr'

2017-02-24 Thread bugzilla-daemon
https://bugs.freedesktop.org/show_bug.cgi?id=99956

Bug ID: 99956
   Summary: build_id.c:36:20: error: unknown type name 'Elf_Nhdr'
   Product: Mesa
   Version: git
  Hardware: x86-64 (AMD64)
OS: FreeBSD
Status: NEW
  Keywords: regression
  Severity: normal
  Priority: medium
 Component: Mesa core
  Assignee: mesa-dev@lists.freedesktop.org
  Reporter: v...@freedesktop.org
QA Contact: mesa-dev@lists.freedesktop.org
CC: emil.l.veli...@gmail.com, j...@openbsd.org,
matts...@gmail.com

mesa: 292c24ddac5acc35676424f05291c101fcd47b3e (master 17.1.0-devel)

FreeBSD build error.

  CC   libmesautil_la-build_id.lo
build_id.c:36:20: error: unknown type name 'Elf_Nhdr'
 #define ElfW(type) Elf_##type
^
build_id.c:42:4: note: in expansion of macro 'ElfW'
ElfW(Nhdr) nhdr;
^
build_id.c: In function 'build_id_find_nhdr_callback':
build_id.c:71:24: error: request for member 'n_type' in something not a
structure or union
  if (note->nhdr.n_type == NT_GNU_BUILD_ID &&
^
build_id.c:72:23: error: request for member 'n_descsz' in something not a
structure or union
 note->nhdr.n_descsz != 0 &&
   ^
build_id.c:73:23: error: request for member 'n_namesz' in something not a
structure or union
 note->nhdr.n_namesz == 4 &&
   ^
build_id.c:36:20: error: 'Elf_Nhdr' undeclared (first use in this function)
 #define ElfW(type) Elf_##type
^
build_id.c:79:33: note: in expansion of macro 'ElfW'
  size_t offset = sizeof(ElfW(Nhdr)) +
 ^
build_id.c:36:20: note: each undeclared identifier is reported only once for
each function it appears in
 #define ElfW(type) Elf_##type
^
build_id.c:79:33: note: in expansion of macro 'ElfW'
  size_t offset = sizeof(ElfW(Nhdr)) +
 ^
build_id.c:80:42: error: request for member 'n_namesz' in something not a
structure or union
  ALIGN(note->nhdr.n_namesz, 4) +
  ^
build_id.c:39:35: note: in definition of macro 'ALIGN'
 #define ALIGN(val, align)  (((val) + (align) - 1) & ~((align) - 1))
   ^
build_id.c:81:42: error: request for member 'n_descsz' in something not a
structure or union
  ALIGN(note->nhdr.n_descsz, 4);
  ^
build_id.c:39:35: note: in definition of macro 'ALIGN'
 #define ALIGN(val, align)  (((val) + (align) - 1) & ~((align) - 1))
   ^
build_id.c: In function 'build_id_length':
build_id.c:107:21: error: request for member 'n_descsz' in something not a
structure or union
return note->nhdr.n_descsz;
 ^
build_id.c:108:1: warning: control reaches end of non-void function
[-Wreturn-type]
 }
 ^

-- 
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] doc: GL_ARB_buffer_storage is supported on llvmpipe/swr

2017-02-24 Thread Edward O'Callaghan
Acked-by: Edward O'Callaghan 

On 02/25/2017 07:45 AM, Gregory Hainaut wrote:
> At least, the extension is exported (gallium capability
> PIPE_CAP_BUFFER_MAP_PERSISTENT_COHERENT is 1)
> 
> Signed-off-by: Gregory Hainaut 
> ---
>  docs/features.txt | 2 +-
>  1 file changed, 1 insertion(+), 1 deletion(-)
> 
> diff --git a/docs/features.txt b/docs/features.txt
> index d9528e9..9d3a460 100644
> --- a/docs/features.txt
> +++ b/docs/features.txt
> @@ -191,7 +191,7 @@ GL 4.3, GLSL 4.30 -- all DONE: i965/gen8+, nvc0, radeonsi
>  GL 4.4, GLSL 4.40 -- all DONE: i965/gen8+, nvc0, radeonsi
>  
>GL_MAX_VERTEX_ATTRIB_STRIDE   DONE (all drivers)
> -  GL_ARB_buffer_storage DONE (i965, nv50, 
> r600)
> +  GL_ARB_buffer_storage DONE (i965, nv50, 
> r600, llvmpipe, swr)
>GL_ARB_clear_texture  DONE (i965, nv50, 
> r600, llvmpipe, softpipe)
>GL_ARB_enhanced_layouts   DONE (i965, nv50, 
> llvmpipe, softpipe)
>- compile-time constant expressions   DONE
> 



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


[Mesa-dev] [PATCH 1/2] util/build-id: Return a pointer rather than copying the data

2017-02-24 Thread Jason Ekstrand
We're about to use the build-id as the starting point for another SHA1
hash in the Intel Vulkan driver, and returning a pointer is far more
convenient.
---
 src/intel/vulkan/anv_device.c | 2 +-
 src/util/build_id.c   | 7 +++
 src/util/build_id.h   | 5 ++---
 3 files changed, 6 insertions(+), 8 deletions(-)

diff --git a/src/intel/vulkan/anv_device.c b/src/intel/vulkan/anv_device.c
index 6f570d8..38def35 100644
--- a/src/intel/vulkan/anv_device.c
+++ b/src/intel/vulkan/anv_device.c
@@ -63,7 +63,7 @@ anv_device_get_cache_uuid(void *uuid)
if (len < VK_UUID_SIZE)
   return false;
 
-   build_id_read(note, uuid, VK_UUID_SIZE);
+   memcpy(uuid, build_id_data(note), VK_UUID_SIZE);
return true;
 }
 
diff --git a/src/util/build_id.c b/src/util/build_id.c
index cc0f852..c53e71d 100644
--- a/src/util/build_id.c
+++ b/src/util/build_id.c
@@ -107,11 +107,10 @@ build_id_length(const struct build_id_note *note)
return note->nhdr.n_descsz;
 }
 
-void
-build_id_read(const struct build_id_note *note,
-  unsigned char *build_id, size_t n)
+const uint8_t *
+build_id_data(const struct build_id_note *note)
 {
-   memcpy(build_id, note->build_id, n);
+   return note->build_id;
 }
 
 #endif
diff --git a/src/util/build_id.h b/src/util/build_id.h
index 39bf9b0..551ac69 100644
--- a/src/util/build_id.h
+++ b/src/util/build_id.h
@@ -31,8 +31,7 @@ build_id_find_nhdr(const char *filename);
 unsigned
 build_id_length(const struct build_id_note *note);
 
-void
-build_id_read(const struct build_id_note *note,
-  unsigned char *build_id, size_t n);
+const uint8_t *
+build_id_data(const struct build_id_note *note);
 
 #endif
-- 
2.5.0.400.gff86faf

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


[Mesa-dev] [PATCH 2/2] anv: Add the pci_id into the shader cache UUID

2017-02-24 Thread Jason Ekstrand
This prevents a user from using a cache created on one hardware
generation on a different one.  Of course, with Intel hardware, this
requires moving their drive from one machine to another but it's still
possible and we should prevent it.
---
 src/intel/vulkan/anv_device.c | 20 +++-
 1 file changed, 15 insertions(+), 5 deletions(-)

diff --git a/src/intel/vulkan/anv_device.c b/src/intel/vulkan/anv_device.c
index 38def35..5168331 100644
--- a/src/intel/vulkan/anv_device.c
+++ b/src/intel/vulkan/anv_device.c
@@ -32,6 +32,7 @@
 #include "util/strtod.h"
 #include "util/debug.h"
 #include "util/build_id.h"
+#include "util/mesa-sha1.h"
 #include "util/vk_util.h"
 
 #include "genxml/gen7_pack.h"
@@ -53,17 +54,26 @@ compiler_perf_log(void *data, const char *fmt, ...)
 }
 
 static bool
-anv_device_get_cache_uuid(void *uuid)
+anv_device_get_cache_uuid(void *uuid, uint16_t pci_id)
 {
const struct build_id_note *note = build_id_find_nhdr("libvulkan_intel.so");
if (!note)
   return false;
 
-   unsigned len = build_id_length(note);
-   if (len < VK_UUID_SIZE)
+   unsigned build_id_len = build_id_length(note);
+   if (build_id_len < VK_UUID_SIZE)
   return false;
 
-   memcpy(uuid, build_id_data(note), VK_UUID_SIZE);
+   uint8_t sha1[20];
+   struct mesa_sha1 *sha1_ctx = _mesa_sha1_init();
+   if (sha1_ctx == NULL)
+  return false;
+
+   _mesa_sha1_update(sha1_ctx, build_id_data(note), build_id_len);
+   _mesa_sha1_update(sha1_ctx, &pci_id, sizeof(pci_id));
+   _mesa_sha1_final(sha1_ctx, sha1);
+
+   memcpy(uuid, sha1, VK_UUID_SIZE);
return true;
 }
 
@@ -148,7 +158,7 @@ anv_physical_device_init(struct anv_physical_device *device,
   goto fail;
}
 
-   if (!anv_device_get_cache_uuid(device->uuid)) {
+   if (!anv_device_get_cache_uuid(device->uuid, device->chipset_id)) {
   result = vk_errorf(VK_ERROR_INITIALIZATION_FAILED,
  "cannot generate UUID");
   goto fail;
-- 
2.5.0.400.gff86faf

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


[Mesa-dev] [Bug 99919] Wrong and unstable image rendering from GLSL fragment shaders

2017-02-24 Thread bugzilla-daemon
https://bugs.freedesktop.org/show_bug.cgi?id=99919

Grazvydas Ignotas  changed:

   What|Removed |Added

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

--- Comment #5 from Grazvydas Ignotas  ---
radeonsi renders original.png, so reassigning.
I can confirm softpipe renders a checkerboard though.

-- 
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] Mesa git: compilation error in NINE after your latest commit - 'PIPE_CAP_USER_INDEX_BUFFERS' undeclared

2017-02-24 Thread Dieter Nützel

Making all in state_trackers/nine
make[4]: Entering directory '/opt/mesa/src/gallium/state_trackers/nine'
  CC   device9.lo
device9.c: In function 'NineDevice9_ctor':
device9.c:122:49: error: 'PIPE_CAP_USER_INDEX_BUFFERS' undeclared (first 
use in this function)

 #define GET_PCAP(n) pScreen->get_param(pScreen, PIPE_CAP_##n)
 ^
device9.c:476:36: note: in expansion of macro 'GET_PCAP'
 This->driver_caps.user_ibufs = GET_PCAP(USER_INDEX_BUFFERS) && 
!This->csmt_active;

^
device9.c:122:49: note: each undeclared identifier is reported only once 
for each function it appears in

 #define GET_PCAP(n) pScreen->get_param(pScreen, PIPE_CAP_##n)
 ^
device9.c:476:36: note: in expansion of macro 'GET_PCAP'
 This->driver_caps.user_ibufs = GET_PCAP(USER_INDEX_BUFFERS) && 
!This->csmt_active;

^
Makefile:745: recipe for target 'device9.lo' failed
make[4]: *** [device9.lo] Error 1
___
mesa-dev mailing list
mesa-dev@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/mesa-dev


Re: [Mesa-dev] [PATCH v3 6/8] nir: Add a simple int64 lowering pass

2017-02-24 Thread Jason Ekstrand
On Fri, Feb 24, 2017 at 3:58 PM, Matt Turner  wrote:

> On Fri, Feb 24, 2017 at 3:48 PM, Jason Ekstrand 
> wrote:
> > The algorithms used by this pass, especially for division, are heavily
> > based on the work Ian Romanick did for the similar int64 lowering pass
> > in the GLSL compiler.
> >
> > v2: Properly handle vectors
> >
> > v3: Get rid of log2_denom stuff.  Since we're using bcsel, we do all the
> > calculations anyway and this is just extra instructions.
> > ---
> >  src/compiler/Makefile.sources  |   1 +
> >  src/compiler/nir/nir.h |  11 ++
> >  src/compiler/nir/nir_lower_int64.c | 261 ++
> +++
> >  3 files changed, 273 insertions(+)
> >  create mode 100644 src/compiler/nir/nir_lower_int64.c
> >
> > diff --git a/src/compiler/Makefile.sources b/src/compiler/Makefile.
> sources
> > index 643a018..2455d4e 100644
> > --- a/src/compiler/Makefile.sources
> > +++ b/src/compiler/Makefile.sources
> > @@ -221,6 +221,7 @@ NIR_FILES = \
> > nir/nir_lower_locals_to_regs.c \
> > nir/nir_lower_idiv.c \
> > nir/nir_lower_indirect_derefs.c \
> > +   nir/nir_lower_int64.c \
> > nir/nir_lower_io.c \
> > nir/nir_lower_io_to_temporaries.c \
> > nir/nir_lower_io_to_scalar.c \
> > diff --git a/src/compiler/nir/nir.h b/src/compiler/nir/nir.h
> > index 5243a9e..1a23e19 100644
> > --- a/src/compiler/nir/nir.h
> > +++ b/src/compiler/nir/nir.h
> > @@ -2540,6 +2540,17 @@ void nir_lower_to_source_mods(nir_shader
> *shader);
> >  bool nir_lower_gs_intrinsics(nir_shader *shader);
> >
> >  typedef enum {
> > +   nir_lower_imul64 = (1 << 0),
> > +   nir_lower_isign64 = (1 << 1),
> > +   nir_lower_udiv64 = (1 << 2),
> > +   nir_lower_idiv64 = (1 << 3),
> > +   nir_lower_umod64 = (1 << 4),
> > +   nir_lower_imod64 = (1 << 5),
> > +} nir_lower_int64_options;
> > +
> > +bool nir_lower_int64(nir_shader *shader, nir_lower_int64_options
> options);
> > +
> > +typedef enum {
> > nir_lower_drcp = (1 << 0),
> > nir_lower_dsqrt = (1 << 1),
> > nir_lower_drsq = (1 << 2),
> > diff --git a/src/compiler/nir/nir_lower_int64.c
> b/src/compiler/nir/nir_lower_int64.c
> > new file mode 100644
> > index 000..c40305e
> > --- /dev/null
> > +++ b/src/compiler/nir/nir_lower_int64.c
> > @@ -0,0 +1,261 @@
> > +/*
> > + * Copyright © 2016 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"
> > +
> > +static nir_ssa_def *
> > +lower_umul64(nir_builder *b, nir_ssa_def *x, nir_ssa_def *y)
> > +{
> > +   nir_ssa_def *x_lo = nir_unpack_64_2x32_split_x(b, x);
> > +   nir_ssa_def *x_hi = nir_unpack_64_2x32_split_y(b, x);
> > +   nir_ssa_def *y_lo = nir_unpack_64_2x32_split_x(b, y);
> > +   nir_ssa_def *y_hi = nir_unpack_64_2x32_split_y(b, y);
> > +
> > +   nir_ssa_def *res_lo = nir_imul(b, x_lo, y_lo);
> > +   nir_ssa_def *res_hi = nir_iadd(b, nir_umul_high(b, x_lo, y_lo),
> > + nir_iadd(b, nir_imul(b, x_lo, y_hi),
> > + nir_imul(b, x_hi, y_lo)));
> > +
> > +   return nir_pack_64_2x32_split(b, res_lo, res_hi);
> > +}
> > +
> > +static nir_ssa_def *
> > +lower_isign64(nir_builder *b, nir_ssa_def *x)
> > +{
> > +   nir_ssa_def *x_lo = nir_unpack_64_2x32_split_x(b, x);
> > +   nir_ssa_def *x_hi = nir_unpack_64_2x32_split_y(b, x);
> > +
> > +   nir_ssa_def *is_non_zero = nir_i2b(b, nir_ior(b, x_lo, x_hi));
> > +   nir_ssa_def *res_hi = nir_ishr(b, x_hi, nir_imm_int(b, 31));
> > +   nir_ssa_def *res_lo = nir_ior(b, res_hi, nir_b2i(b, is_non_zero));
> > +
> > +   return nir_pack_64_2x32_split(b, res_lo, res_hi);
> > +}
> > +
> > +static void
> > +lower_udiv64_mod64(nir_builder *b, nir_ssa_def *n, nir_ssa_def *d,
> > +   nir_ssa_def **q, nir

[Mesa-dev] [Bug 99953] device9.c:122:49: error: ‘PIPE_CAP_USER_INDEX_BUFFERS’ undeclared (first use in this function)

2017-02-24 Thread bugzilla-daemon
https://bugs.freedesktop.org/show_bug.cgi?id=99953

Bug ID: 99953
   Summary: device9.c:122:49: error: ‘PIPE_CAP_USER_INDEX_BUFFERS’
undeclared (first use in this function)
   Product: Mesa
   Version: git
  Hardware: x86-64 (AMD64)
OS: All
Status: NEW
  Keywords: bisected, regression
  Severity: normal
  Priority: medium
 Component: Mesa core
  Assignee: mesa-dev@lists.freedesktop.org
  Reporter: v...@freedesktop.org
QA Contact: mesa-dev@lists.freedesktop.org
CC: bri...@vmware.com, mar...@gmail.com,
nhaeh...@gmail.com

mesa: c7878b0167bb7e652973c208e172b93c00956a1c (master 17.1.0-devel)

  CC   device9.lo
device9.c: In function ‘NineDevice9_ctor’:
device9.c:122:49: error: ‘PIPE_CAP_USER_INDEX_BUFFERS’ undeclared (first use in
this function)
 #define GET_PCAP(n) pScreen->get_param(pScreen, PIPE_CAP_##n)
 ^
device9.c:476:36: note: in expansion of macro ‘GET_PCAP’
 This->driver_caps.user_ibufs = GET_PCAP(USER_INDEX_BUFFERS) &&
!This->csmt_active;
^~~~
device9.c:122:49: note: each undeclared identifier is reported only once for
each function it appears in
 #define GET_PCAP(n) pScreen->get_param(pScreen, PIPE_CAP_##n)
 ^
device9.c:476:36: note: in expansion of macro ‘GET_PCAP’
 This->driver_caps.user_ibufs = GET_PCAP(USER_INDEX_BUFFERS) &&
!This->csmt_active;
^~~~

commit 4a883966c1f74f43afc145d2c3d27af7b8c5e01a
Author: Marek Olšák 
Date:   Fri Feb 17 02:28:20 2017 +0100

gallium: remove PIPE_CAP_USER_INDEX_BUFFERS

all drivers support it

Reviewed-by: Nicolai Hähnle 
Reviewed-by: Brian Paul 
Tested-by: Brian Paul   (VMware driver only)

-- 
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 v3 6/8] nir: Add a simple int64 lowering pass

2017-02-24 Thread Matt Turner
On Fri, Feb 24, 2017 at 3:48 PM, Jason Ekstrand  wrote:
> The algorithms used by this pass, especially for division, are heavily
> based on the work Ian Romanick did for the similar int64 lowering pass
> in the GLSL compiler.
>
> v2: Properly handle vectors
>
> v3: Get rid of log2_denom stuff.  Since we're using bcsel, we do all the
> calculations anyway and this is just extra instructions.
> ---
>  src/compiler/Makefile.sources  |   1 +
>  src/compiler/nir/nir.h |  11 ++
>  src/compiler/nir/nir_lower_int64.c | 261 
> +
>  3 files changed, 273 insertions(+)
>  create mode 100644 src/compiler/nir/nir_lower_int64.c
>
> diff --git a/src/compiler/Makefile.sources b/src/compiler/Makefile.sources
> index 643a018..2455d4e 100644
> --- a/src/compiler/Makefile.sources
> +++ b/src/compiler/Makefile.sources
> @@ -221,6 +221,7 @@ NIR_FILES = \
> nir/nir_lower_locals_to_regs.c \
> nir/nir_lower_idiv.c \
> nir/nir_lower_indirect_derefs.c \
> +   nir/nir_lower_int64.c \
> nir/nir_lower_io.c \
> nir/nir_lower_io_to_temporaries.c \
> nir/nir_lower_io_to_scalar.c \
> diff --git a/src/compiler/nir/nir.h b/src/compiler/nir/nir.h
> index 5243a9e..1a23e19 100644
> --- a/src/compiler/nir/nir.h
> +++ b/src/compiler/nir/nir.h
> @@ -2540,6 +2540,17 @@ void nir_lower_to_source_mods(nir_shader *shader);
>  bool nir_lower_gs_intrinsics(nir_shader *shader);
>
>  typedef enum {
> +   nir_lower_imul64 = (1 << 0),
> +   nir_lower_isign64 = (1 << 1),
> +   nir_lower_udiv64 = (1 << 2),
> +   nir_lower_idiv64 = (1 << 3),
> +   nir_lower_umod64 = (1 << 4),
> +   nir_lower_imod64 = (1 << 5),
> +} nir_lower_int64_options;
> +
> +bool nir_lower_int64(nir_shader *shader, nir_lower_int64_options options);
> +
> +typedef enum {
> nir_lower_drcp = (1 << 0),
> nir_lower_dsqrt = (1 << 1),
> nir_lower_drsq = (1 << 2),
> diff --git a/src/compiler/nir/nir_lower_int64.c 
> b/src/compiler/nir/nir_lower_int64.c
> new file mode 100644
> index 000..c40305e
> --- /dev/null
> +++ b/src/compiler/nir/nir_lower_int64.c
> @@ -0,0 +1,261 @@
> +/*
> + * Copyright © 2016 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"
> +
> +static nir_ssa_def *
> +lower_umul64(nir_builder *b, nir_ssa_def *x, nir_ssa_def *y)
> +{
> +   nir_ssa_def *x_lo = nir_unpack_64_2x32_split_x(b, x);
> +   nir_ssa_def *x_hi = nir_unpack_64_2x32_split_y(b, x);
> +   nir_ssa_def *y_lo = nir_unpack_64_2x32_split_x(b, y);
> +   nir_ssa_def *y_hi = nir_unpack_64_2x32_split_y(b, y);
> +
> +   nir_ssa_def *res_lo = nir_imul(b, x_lo, y_lo);
> +   nir_ssa_def *res_hi = nir_iadd(b, nir_umul_high(b, x_lo, y_lo),
> + nir_iadd(b, nir_imul(b, x_lo, y_hi),
> + nir_imul(b, x_hi, y_lo)));
> +
> +   return nir_pack_64_2x32_split(b, res_lo, res_hi);
> +}
> +
> +static nir_ssa_def *
> +lower_isign64(nir_builder *b, nir_ssa_def *x)
> +{
> +   nir_ssa_def *x_lo = nir_unpack_64_2x32_split_x(b, x);
> +   nir_ssa_def *x_hi = nir_unpack_64_2x32_split_y(b, x);
> +
> +   nir_ssa_def *is_non_zero = nir_i2b(b, nir_ior(b, x_lo, x_hi));
> +   nir_ssa_def *res_hi = nir_ishr(b, x_hi, nir_imm_int(b, 31));
> +   nir_ssa_def *res_lo = nir_ior(b, res_hi, nir_b2i(b, is_non_zero));
> +
> +   return nir_pack_64_2x32_split(b, res_lo, res_hi);
> +}
> +
> +static void
> +lower_udiv64_mod64(nir_builder *b, nir_ssa_def *n, nir_ssa_def *d,
> +   nir_ssa_def **q, nir_ssa_def **r)
> +{
> +   /* TODO: We should specially handle the case where the denominator is a
> +* constant.  In that case, we should be able to reduce it to a multiply 
> by
> +* a constant, some shifts, and an add.
> +*/
> +   nir_ssa_def *n_lo = nir_unpack_64_2x32_split_x(b, n);
> +   nir_ssa

[Mesa-dev] [PATCH v3 6/8] nir: Add a simple int64 lowering pass

2017-02-24 Thread Jason Ekstrand
The algorithms used by this pass, especially for division, are heavily
based on the work Ian Romanick did for the similar int64 lowering pass
in the GLSL compiler.

v2: Properly handle vectors

v3: Get rid of log2_denom stuff.  Since we're using bcsel, we do all the
calculations anyway and this is just extra instructions.
---
 src/compiler/Makefile.sources  |   1 +
 src/compiler/nir/nir.h |  11 ++
 src/compiler/nir/nir_lower_int64.c | 261 +
 3 files changed, 273 insertions(+)
 create mode 100644 src/compiler/nir/nir_lower_int64.c

diff --git a/src/compiler/Makefile.sources b/src/compiler/Makefile.sources
index 643a018..2455d4e 100644
--- a/src/compiler/Makefile.sources
+++ b/src/compiler/Makefile.sources
@@ -221,6 +221,7 @@ NIR_FILES = \
nir/nir_lower_locals_to_regs.c \
nir/nir_lower_idiv.c \
nir/nir_lower_indirect_derefs.c \
+   nir/nir_lower_int64.c \
nir/nir_lower_io.c \
nir/nir_lower_io_to_temporaries.c \
nir/nir_lower_io_to_scalar.c \
diff --git a/src/compiler/nir/nir.h b/src/compiler/nir/nir.h
index 5243a9e..1a23e19 100644
--- a/src/compiler/nir/nir.h
+++ b/src/compiler/nir/nir.h
@@ -2540,6 +2540,17 @@ void nir_lower_to_source_mods(nir_shader *shader);
 bool nir_lower_gs_intrinsics(nir_shader *shader);
 
 typedef enum {
+   nir_lower_imul64 = (1 << 0),
+   nir_lower_isign64 = (1 << 1),
+   nir_lower_udiv64 = (1 << 2),
+   nir_lower_idiv64 = (1 << 3),
+   nir_lower_umod64 = (1 << 4),
+   nir_lower_imod64 = (1 << 5),
+} nir_lower_int64_options;
+
+bool nir_lower_int64(nir_shader *shader, nir_lower_int64_options options);
+
+typedef enum {
nir_lower_drcp = (1 << 0),
nir_lower_dsqrt = (1 << 1),
nir_lower_drsq = (1 << 2),
diff --git a/src/compiler/nir/nir_lower_int64.c 
b/src/compiler/nir/nir_lower_int64.c
new file mode 100644
index 000..c40305e
--- /dev/null
+++ b/src/compiler/nir/nir_lower_int64.c
@@ -0,0 +1,261 @@
+/*
+ * Copyright © 2016 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"
+
+static nir_ssa_def *
+lower_umul64(nir_builder *b, nir_ssa_def *x, nir_ssa_def *y)
+{
+   nir_ssa_def *x_lo = nir_unpack_64_2x32_split_x(b, x);
+   nir_ssa_def *x_hi = nir_unpack_64_2x32_split_y(b, x);
+   nir_ssa_def *y_lo = nir_unpack_64_2x32_split_x(b, y);
+   nir_ssa_def *y_hi = nir_unpack_64_2x32_split_y(b, y);
+
+   nir_ssa_def *res_lo = nir_imul(b, x_lo, y_lo);
+   nir_ssa_def *res_hi = nir_iadd(b, nir_umul_high(b, x_lo, y_lo),
+ nir_iadd(b, nir_imul(b, x_lo, y_hi),
+ nir_imul(b, x_hi, y_lo)));
+
+   return nir_pack_64_2x32_split(b, res_lo, res_hi);
+}
+
+static nir_ssa_def *
+lower_isign64(nir_builder *b, nir_ssa_def *x)
+{
+   nir_ssa_def *x_lo = nir_unpack_64_2x32_split_x(b, x);
+   nir_ssa_def *x_hi = nir_unpack_64_2x32_split_y(b, x);
+
+   nir_ssa_def *is_non_zero = nir_i2b(b, nir_ior(b, x_lo, x_hi));
+   nir_ssa_def *res_hi = nir_ishr(b, x_hi, nir_imm_int(b, 31));
+   nir_ssa_def *res_lo = nir_ior(b, res_hi, nir_b2i(b, is_non_zero));
+
+   return nir_pack_64_2x32_split(b, res_lo, res_hi);
+}
+
+static void
+lower_udiv64_mod64(nir_builder *b, nir_ssa_def *n, nir_ssa_def *d,
+   nir_ssa_def **q, nir_ssa_def **r)
+{
+   /* TODO: We should specially handle the case where the denominator is a
+* constant.  In that case, we should be able to reduce it to a multiply by
+* a constant, some shifts, and an add.
+*/
+   nir_ssa_def *n_lo = nir_unpack_64_2x32_split_x(b, n);
+   nir_ssa_def *n_hi = nir_unpack_64_2x32_split_y(b, n);
+   nir_ssa_def *d_lo = nir_unpack_64_2x32_split_x(b, d);
+   nir_ssa_def *d_hi = nir_unpack_64_2x32_split_y(b, d);
+
+   nir_const_value v = { .u32 = { 0, 0, 0, 0 } };
+   nir_ssa_def *q_lo = nir_build_imm(b, n->num_components, 32, v);
+   nir_ssa_def *q

[Mesa-dev] [PATCH] glsl/int64: Fix a typo in imod64

2017-02-24 Thread Jason Ekstrand
The zy swizzle gives us one component of quotient and one component of
remainder.  What we wanted was zw for the remainder.

Cc: Ian Romanick 
---
 src/compiler/glsl/builtin_int64.h | 22 --
 src/compiler/glsl/int64.glsl  |  2 +-
 2 files changed, 9 insertions(+), 15 deletions(-)

diff --git a/src/compiler/glsl/builtin_int64.h 
b/src/compiler/glsl/builtin_int64.h
index c3577af..6812d4b 100644
--- a/src/compiler/glsl/builtin_int64.h
+++ b/src/compiler/glsl/builtin_int64.h
@@ -279,8 +279,7 @@ udiv64(void *mem_ctx, builtin_available_predicate avail)
sig_parameters.push_tail(r0035);
ir_variable *const r0036 = new(mem_ctx) ir_variable(glsl_type::uvec2_type, 
"d", ir_var_function_in);
sig_parameters.push_tail(r0036);
-   ir_variable *const r0037 = new(mem_ctx) ir_variable(glsl_type::uvec2_type, 
"n", ir_var_auto);
-   body.emit(r0037);
+   ir_variable *const r0037 = body.make_temp(glsl_type::uvec2_type, "n");
body.emit(assign(r0037, r0035, 0x03));
 
ir_variable *const r0038 = new(mem_ctx) ir_variable(glsl_type::int_type, 
"i", ir_var_auto);
@@ -495,15 +494,13 @@ idiv64(void *mem_ctx, builtin_available_predicate avail)
ir_expression *const r0062 = less(swizzle_y(r005F), body.constant(int(0)));
body.emit(assign(r0060, nequal(r0061, r0062), 0x01));
 
-   ir_variable *const r0063 = new(mem_ctx) ir_variable(glsl_type::uvec2_type, 
"n", ir_var_auto);
-   body.emit(r0063);
+   ir_variable *const r0063 = body.make_temp(glsl_type::uvec2_type, "n");
ir_expression *const r0064 = expr(ir_unop_pack_int_2x32, r005E);
ir_expression *const r0065 = expr(ir_unop_abs, r0064);
ir_expression *const r0066 = expr(ir_unop_i642u64, r0065);
body.emit(assign(r0063, expr(ir_unop_unpack_uint_2x32, r0066), 0x03));
 
-   ir_variable *const r0067 = new(mem_ctx) ir_variable(glsl_type::uvec2_type, 
"d", ir_var_auto);
-   body.emit(r0067);
+   ir_variable *const r0067 = body.make_temp(glsl_type::uvec2_type, "d");
ir_expression *const r0068 = expr(ir_unop_pack_int_2x32, r005F);
ir_expression *const r0069 = expr(ir_unop_abs, r0068);
ir_expression *const r006A = expr(ir_unop_i642u64, r0069);
@@ -740,8 +737,7 @@ umod64(void *mem_ctx, builtin_available_predicate avail)
sig_parameters.push_tail(r0096);
ir_variable *const r0097 = new(mem_ctx) ir_variable(glsl_type::uvec2_type, 
"d", ir_var_function_in);
sig_parameters.push_tail(r0097);
-   ir_variable *const r0098 = new(mem_ctx) ir_variable(glsl_type::uvec2_type, 
"n", ir_var_auto);
-   body.emit(r0098);
+   ir_variable *const r0098 = body.make_temp(glsl_type::uvec2_type, "n");
body.emit(assign(r0098, r0096, 0x03));
 
ir_variable *const r0099 = new(mem_ctx) ir_variable(glsl_type::int_type, 
"i", ir_var_auto);
@@ -962,15 +958,13 @@ imod64(void *mem_ctx, builtin_available_predicate avail)
ir_expression *const r00C5 = less(swizzle_y(r00C2), body.constant(int(0)));
body.emit(assign(r00C3, nequal(r00C4, r00C5), 0x01));
 
-   ir_variable *const r00C6 = new(mem_ctx) ir_variable(glsl_type::uvec2_type, 
"n", ir_var_auto);
-   body.emit(r00C6);
+   ir_variable *const r00C6 = body.make_temp(glsl_type::uvec2_type, "n");
ir_expression *const r00C7 = expr(ir_unop_pack_int_2x32, r00C1);
ir_expression *const r00C8 = expr(ir_unop_abs, r00C7);
ir_expression *const r00C9 = expr(ir_unop_i642u64, r00C8);
body.emit(assign(r00C6, expr(ir_unop_unpack_uint_2x32, r00C9), 0x03));
 
-   ir_variable *const r00CA = new(mem_ctx) ir_variable(glsl_type::uvec2_type, 
"d", ir_var_auto);
-   body.emit(r00CA);
+   ir_variable *const r00CA = body.make_temp(glsl_type::uvec2_type, "d");
ir_expression *const r00CB = expr(ir_unop_pack_int_2x32, r00C2);
ir_expression *const r00CC = expr(ir_unop_abs, r00CB);
ir_expression *const r00CD = expr(ir_unop_i642u64, r00CC);
@@ -1176,7 +1170,7 @@ imod64(void *mem_ctx, builtin_available_predicate avail)
   /* THEN INSTRUCTIONS */
   body.instructions = &f00F6->then_instructions;
 
-  ir_swizzle *const r00F7 = swizzle(r00F4, MAKE_SWIZZLE4(SWIZZLE_Z, 
SWIZZLE_Y, SWIZZLE_X, SWIZZLE_X), 2);
+  ir_swizzle *const r00F7 = swizzle(r00F4, MAKE_SWIZZLE4(SWIZZLE_Z, 
SWIZZLE_W, SWIZZLE_X, SWIZZLE_X), 2);
   ir_expression *const r00F8 = expr(ir_unop_pack_uint_2x32, r00F7);
   ir_expression *const r00F9 = expr(ir_unop_u642i64, r00F8);
   ir_expression *const r00FA = neg(r00F9);
@@ -1186,7 +1180,7 @@ imod64(void *mem_ctx, builtin_available_predicate avail)
   /* ELSE INSTRUCTIONS */
   body.instructions = &f00F6->else_instructions;
 
-  ir_swizzle *const r00FB = swizzle(r00F4, MAKE_SWIZZLE4(SWIZZLE_Z, 
SWIZZLE_Y, SWIZZLE_X, SWIZZLE_X), 2);
+  ir_swizzle *const r00FB = swizzle(r00F4, MAKE_SWIZZLE4(SWIZZLE_Z, 
SWIZZLE_W, SWIZZLE_X, SWIZZLE_X), 2);
   body.emit(assign(r00F5, expr(ir_unop_u2i, r00FB), 0x03));
 
 
diff --git a/src/compiler/glsl/int64.glsl b/src/compiler/glsl/int64.glsl
index b1036e3..1ac8d12 100644
--- a/src/compiler/glsl/int64.g

Re: [Mesa-dev] [PATCH] radv/ac: enable loop unrolling.

2017-02-24 Thread Matt Arsenault

> On Feb 24, 2017, at 14:39, Marek Olšák  wrote:
> 
> On Fri, Feb 24, 2017 at 7:20 PM, Matt Arsenault  wrote:
>> 
>> On Feb 24, 2017, at 01:45, Marek Olšák  wrote:
>> 
>> The main requirement is that if there is indirect indexing inside a
>> loop, we always want to unroll the whole loop to get rid of the
>> indexing, which can decrease scratch usage.
>> 
>> Marek
>> 
>> We boost the unroll thresholds when there is private memory indexed by the
>> induction variable. See AMDGPUTTIImpl::getUnrollingPreferences
> 
> When Samuel Pitoiset was experimenting with the same code as this
> patch but for radeonsi, getUnrollingPreferences wasn't even getting
> called when unrolling. I guess he eventually gave up or didn't see any
> positive effect from it.
> 
> Marek

Then there’s a bug somewhere. It should be getting called
___
mesa-dev mailing list
mesa-dev@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/mesa-dev


[Mesa-dev] [AppVeyor] mesa master #3559 failed

2017-02-24 Thread AppVeyor



Build mesa 3559 failed


Commit c7878b0167 by Marek Olšák on 2/23/2017 12:34 AM:

ac: silence a warning\n\ntrivial


Configure your notification preferences

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


Re: [Mesa-dev] [PATCH] radv/ac: enable loop unrolling.

2017-02-24 Thread Marek Olšák
On Fri, Feb 24, 2017 at 7:20 PM, Matt Arsenault  wrote:
>
> On Feb 24, 2017, at 01:45, Marek Olšák  wrote:
>
> The main requirement is that if there is indirect indexing inside a
> loop, we always want to unroll the whole loop to get rid of the
> indexing, which can decrease scratch usage.
>
> Marek
>
> We boost the unroll thresholds when there is private memory indexed by the
> induction variable. See AMDGPUTTIImpl::getUnrollingPreferences

When Samuel Pitoiset was experimenting with the same code as this
patch but for radeonsi, getUnrollingPreferences wasn't even getting
called when unrolling. I guess he eventually gave up or didn't see any
positive effect from it.

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


Re: [Mesa-dev] [PATCH 2/2] glsl: use is_sampler() anywhere it's possible

2017-02-24 Thread Timothy Arceri

Series is:

Reviewed-by: Timothy Arceri 

On 25/02/17 00:40, Samuel Pitoiset wrote:

Signed-off-by: Samuel Pitoiset 
---
 src/compiler/glsl/ast_to_hir.cpp| 22 +++---
 src/compiler/glsl/ir.cpp|  4 ++--
 src/compiler/glsl/link_uniform_initializers.cpp |  3 +--
 src/compiler/glsl_types.cpp |  2 +-
 src/mesa/main/uniform_query.cpp |  2 +-
 5 files changed, 16 insertions(+), 17 deletions(-)

diff --git a/src/compiler/glsl/ast_to_hir.cpp b/src/compiler/glsl/ast_to_hir.cpp
index c0629feb58..f033d7df97 100644
--- a/src/compiler/glsl/ast_to_hir.cpp
+++ b/src/compiler/glsl/ast_to_hir.cpp
@@ -2407,13 +2407,13 @@ get_type_name_for_precision_qualifier(const glsl_type 
*type)
case GLSL_TYPE_SAMPLER: {
   const unsigned type_idx =
  type->sampler_array + 2 * type->sampler_shadow;
-  const unsigned offset = type->base_type == GLSL_TYPE_SAMPLER ? 0 : 4;
+  const unsigned offset = type->is_sampler() ? 0 : 4;
   assert(type_idx < 4);
   switch (type->sampled_type) {
   case GLSL_TYPE_FLOAT:
  switch (type->sampler_dimensionality) {
  case GLSL_SAMPLER_DIM_1D: {
-assert(type->base_type == GLSL_TYPE_SAMPLER);
+assert(type->is_sampler());
 static const char *const names[4] = {
   "sampler1D", "sampler1DArray",
   "sampler1DShadow", "sampler1DArrayShadow"
@@ -2444,14 +2444,14 @@ get_type_name_for_precision_qualifier(const glsl_type 
*type)
 return names[offset + type_idx];
  }
  case GLSL_SAMPLER_DIM_MS: {
-assert(type->base_type == GLSL_TYPE_SAMPLER);
+assert(type->is_sampler());
 static const char *const names[4] = {
   "sampler2DMS", "sampler2DMSArray", NULL, NULL
 };
 return names[type_idx];
  }
  case GLSL_SAMPLER_DIM_RECT: {
-assert(type->base_type == GLSL_TYPE_SAMPLER);
+assert(type->is_sampler());
 static const char *const names[4] = {
   "samplerRect", NULL, "samplerRectShadow", NULL
 };
@@ -2465,7 +2465,7 @@ get_type_name_for_precision_qualifier(const glsl_type 
*type)
 return names[offset + type_idx];
  }
  case GLSL_SAMPLER_DIM_EXTERNAL: {
-assert(type->base_type == GLSL_TYPE_SAMPLER);
+assert(type->is_sampler());
 static const char *const names[4] = {
   "samplerExternalOES", NULL, NULL, NULL
 };
@@ -2478,7 +2478,7 @@ get_type_name_for_precision_qualifier(const glsl_type 
*type)
   case GLSL_TYPE_INT:
  switch (type->sampler_dimensionality) {
  case GLSL_SAMPLER_DIM_1D: {
-assert(type->base_type == GLSL_TYPE_SAMPLER);
+assert(type->is_sampler());
 static const char *const names[4] = {
   "isampler1D", "isampler1DArray", NULL, NULL
 };
@@ -2506,14 +2506,14 @@ get_type_name_for_precision_qualifier(const glsl_type 
*type)
 return names[offset + type_idx];
  }
  case GLSL_SAMPLER_DIM_MS: {
-assert(type->base_type == GLSL_TYPE_SAMPLER);
+assert(type->is_sampler());
 static const char *const names[4] = {
   "isampler2DMS", "isampler2DMSArray", NULL, NULL
 };
 return names[type_idx];
  }
  case GLSL_SAMPLER_DIM_RECT: {
-assert(type->base_type == GLSL_TYPE_SAMPLER);
+assert(type->is_sampler());
 static const char *const names[4] = {
   "isamplerRect", NULL, "isamplerRectShadow", NULL
 };
@@ -2533,7 +2533,7 @@ get_type_name_for_precision_qualifier(const glsl_type 
*type)
   case GLSL_TYPE_UINT:
  switch (type->sampler_dimensionality) {
  case GLSL_SAMPLER_DIM_1D: {
-assert(type->base_type == GLSL_TYPE_SAMPLER);
+assert(type->is_sampler());
 static const char *const names[4] = {
   "usampler1D", "usampler1DArray", NULL, NULL
 };
@@ -2561,14 +2561,14 @@ get_type_name_for_precision_qualifier(const glsl_type 
*type)
 return names[offset + type_idx];
  }
  case GLSL_SAMPLER_DIM_MS: {
-assert(type->base_type == GLSL_TYPE_SAMPLER);
+assert(type->is_sampler());
 static const char *const names[4] = {
   "usampler2DMS", "usampler2DMSArray", NULL, NULL
 };
 return names[type_idx];
  }
  case GLSL_SAMPLER_DIM_RECT: {
-assert(type->base_type == GLSL_TYPE_SAMPLER);
+assert(type->is_sampler());
 static const char *const names[4] = {
   "usamplerRect", NULL, "usamplerRectShadow", NULL
 };
diff --git a/src/compiler/glsl/ir.cpp b/src/compiler/glsl/ir.cpp
index 28511b5b81..f80bd811

Re: [Mesa-dev] [PATCH v2] nir: delete magic number

2017-02-24 Thread Jason Ekstrand
On Fri, Feb 24, 2017 at 8:33 AM, tournier.elie 
wrote:

> Ping.
>
>
> On 13 February 2017 at 10:17, tournier.elie 
> wrote:
>
>> Whoops I answer 2 times.
>>
>> Would the comment bellow be appropriate?
>>
>> This limit is chosen fairly arbitrarily.
>> GLSL IR max iteration is 32 instructions. (Multiply counting nodes and
>> magic number 5).
>> But there is no 1:1 mapping between GLSL IR and NIR so 25 was picked
>> because
>> it seemed to give about the same results. Around 5 instructions per node.
>> But some loops that would unroll with GLSL IR fail to unroll if we set
>> this to 25 so we set it to 26.
>>
>
Sorry its taken so long.  That comment looks good to me.

Reviewed-by: Jason Ekstrand 

I'll push it as soon as I've verified that it builds.

--Jason


> Elie
>>
>>
>> On 13 February 2017 at 01:00, tournier.elie 
>> wrote:
>>
>>>
>>> On 9 February 2017 at 02:48, Timothy Arceri 
>>> wrote:
>>>
>>> > On Wed, 8 Feb 2017 15:54:46 -0800
>>> > Jason Ekstrand  wrote:
>>> >
>>> > > On Wed, Feb 8, 2017 at 2:20 PM, Elie Tournier
>>> > >  wrote:
>>> > >
>>> > > > Signed-off-by: Elie Tournier 
>>> > > > ---
>>> > > >  src/compiler/nir/nir_opt_loop_unroll.c | 10 +-
>>> > > >  1 file changed, 9 insertions(+), 1 deletion(-)
>>> > > >
>>> > > > diff --git a/src/compiler/nir/nir_opt_loop_unroll.c
>>> > > > b/src/compiler/nir/nir_opt_loop_unroll.c
>>> > > > index 37cbced43d..035a030239 100644
>>> > > > --- a/src/compiler/nir/nir_opt_loop_unroll.c
>>> > > > +++ b/src/compiler/nir/nir_opt_loop_unroll.c
>>> > > > @@ -26,6 +26,14 @@
>>> > > >  #include "nir_control_flow.h"
>>> > > >  #include "nir_loop_analyze.h"
>>> > > >
>>> > > > +
>>> > > > +/* This limit is chosen fairly arbitrarily.  The GLSL IR limit is
>>> > > > 25.
>>> > > > + * However, due to slight differences in the way the two IRs count
>>> > > > + * instructions, some loops that would unroll with GLSL IR fail to
>>> > > > unroll
>>> > > > + * if we set this to 25 so we set it to 26.
>>> > > >
>>> > >
>>> > > Ok, I lied in my comment.  It's not 25, it's 32.  Tim, can you
>>> > > explain the discrepancy?
>>> > > --Jason
>>> >
>>> > Max iteration is 32 this is number of instructions, in GLSL IR it was
>>> > counting nodes and the magic number was 5. There is no 1:1 mapping 25
>>> > was picked because it seemed to give about the same results. Around 5
>>> > instructions per node.
>>> >
>>> >
>>> So to resume. Is this comment correct for you?
>>>
>>> This limit is chosen fairly arbitrarily.
>>> GLSL IR max iteration is 32 instructions. (Counting nodes by magic
>>> number 5).
>>> But there is no 1:1 mapping between GLSL IR and NIR so 25 was picked
>>> because
>>> it seemed to give about the same results. Around 5 instructions per node.
>>> But some loops that would unroll with GLSL IR fail to unroll if we set
>>> this to 25 so we set it to 26.
>>>
>>> >
>>> > >
>>> > > > + */
>>> > > > +#define LOOP_UNROLL_LIMIT 26
>>> > > > +
>>> > > >  /* Prepare this loop for unrolling by first converting to lcssa
>>> > > > and then
>>> > > >   * converting the phis from the loops first block and the block
>>> > > > that follows
>>> > > >   * the loop into regs.  Partially converting out of SSA allows us
>>> > > > to unroll
>>> > > > @@ -460,7 +468,7 @@ is_loop_small_enough_to_unroll(nir_shader
>>> > > > *shader, nir_loop_info *li)
>>> > > >return true;
>>> > > >
>>> > > > bool loop_not_too_large =
>>> > > > -  li->num_instructions * li->trip_count <= max_iter * 26;
>>> > > > +  li->num_instructions * li->trip_count <= max_iter *
>>> > > > LOOP_UNROLL_LIMIT;
>>> > > >
>>> > > > return loop_not_too_large;
>>> > > >  }
>>> > > > --
>>> > > > 2.11.0
>>> > > >
>>> > > >
>>> >
>>> >
>>>
>>>
>>> On 9 February 2017 at 02:48, Timothy Arceri 
>>> wrote:
>>>
 On Wed, 8 Feb 2017 15:54:46 -0800
 Jason Ekstrand  wrote:

 > On Wed, Feb 8, 2017 at 2:20 PM, Elie Tournier
 >  wrote:
 >
 > > Signed-off-by: Elie Tournier 
 > > ---
 > >  src/compiler/nir/nir_opt_loop_unroll.c | 10 +-
 > >  1 file changed, 9 insertions(+), 1 deletion(-)
 > >
 > > diff --git a/src/compiler/nir/nir_opt_loop_unroll.c
 > > b/src/compiler/nir/nir_opt_loop_unroll.c
 > > index 37cbced43d..035a030239 100644
 > > --- a/src/compiler/nir/nir_opt_loop_unroll.c
 > > +++ b/src/compiler/nir/nir_opt_loop_unroll.c
 > > @@ -26,6 +26,14 @@
 > >  #include "nir_control_flow.h"
 > >  #include "nir_loop_analyze.h"
 > >
 > > +
 > > +/* This limit is chosen fairly arbitrarily.  The GLSL IR limit is
 > > 25.
 > > + * However, due to slight differences in the way the two IRs count
 > > + * instructions, some loops that would unroll with GLSL IR fail to
 > > unroll
 > > + * if we set this to 25 so we set it to 26.
 > >
 >
 > Ok, I lied in my comment.  It's not 25, it's 32.  Tim, can you
 > explain the discrepancy?
 > --Jason


>>> Max iteration is 32 this is number of in

Re: [Mesa-dev] [PATCH 1/8] nir/builder: Add support for easily building control-flow

2017-02-24 Thread Jason Ekstrand
On Fri, Feb 24, 2017 at 6:05 AM, Samuel Iglesias Gonsálvez <
sigles...@igalia.com> wrote:

>
>
> On 24/02/17 02:14, Jason Ekstrand wrote:
> > Each of the pop functions (and push_else) take a control flow parameter
> as
> > their second argument.  If NULL, it assumes that the builder is in a
> block
> > that's a direct child of the control-flow node you want to pop off the
> > virtual stack.  This is what 90% of consumers will want.  The SPIR-V
> pass,
> > however, is a bit more "creative" about how it walks the CFG and it needs
> > to be able to pop multiple levels at a time, hence the argument.
> > ---
> >  src/compiler/nir/nir_builder.h | 95 ++
> 
> >  1 file changed, 95 insertions(+)
> >
> > diff --git a/src/compiler/nir/nir_builder.h b/src/compiler/nir/nir_
> builder.h
> > index 194d327..2eaa025 100644
> > --- a/src/compiler/nir/nir_builder.h
> > +++ b/src/compiler/nir/nir_builder.h
> > @@ -81,6 +81,101 @@ nir_builder_cf_insert(nir_builder *build,
> nir_cf_node *cf)
> > nir_cf_node_insert(build->cursor, cf);
> >  }
> >
> > +static inline bool
> > +nir_builder_is_inside_cf(nir_builder *build, nir_cf_node *cf_node)
> > +{
> > +   nir_block *block = nir_cursor_current_block(build->cursor);
> > +   for (nir_cf_node *n = &block->cf_node; n; n = n->parent) {
> > +  if (n == cf_node)
> > + return true;
> > +   }
> > +   return false;
> > +}
> > +
> > +static inline nir_if *
> > +nir_push_if(nir_builder *build, nir_ssa_def *condition)
> > +{
> > +   nir_if *nif = nir_if_create(build->shader);
> > +   nif->condition = nir_src_for_ssa(condition);
> > +   nir_builder_cf_insert(build, &nif->cf_node);
> > +   build->cursor = nir_before_cf_list(&nif->then_list);
>
> Is this fine? In the places you replace code with this function, there
> was nir_after_cf_list(&nif->then_list), and same for the others.
>

it should be.  The if statement is empty so then_list has exactly one block
with zero instructions in it.  Inserting before or after the list should be
equivalent.  That said, I'm happy to change it to after if that makes more
sense to someone.
___
mesa-dev mailing list
mesa-dev@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/mesa-dev


Re: [Mesa-dev] [PATCH 0/8] anv: Add int64 support for gen8+

2017-02-24 Thread Jason Ekstrand
On Thu, Feb 23, 2017 at 11:08 PM, Michael Schellenberger Costa <
mschellenbergerco...@googlemail.com> wrote:

> Hi Jason,
>
> how much of a noob task would the expansion to other operations be?
>

It shouldn't be too bad.  Last night, I cracked out a bunch more lowering
helpers.  I haven't tested them yet but they should be roughly what we need:

https://cgit.freedesktop.org/~jekstrand/mesa/log/?h=wip/nir-int64

I think all that's left after that is shifts, bcsel, and conversions (int
<-> float etc.).  It should be fairly easy to write.  Debugging will
require learning a bit about the compiler stack but this is as good a
learning opportunity as any.

--Jason


> --Michael
>
> -Ursprüngliche Nachricht-
> Von: mesa-dev [mailto:mesa-dev-boun...@lists.freedesktop.org] Im Auftrag
> von Jason Ekstrand
> Gesendet: Freitag, 24. Februar 2017 02:15
> An: mesa-dev@lists.freedesktop.org
> Cc: Jason Ekstrand 
> Betreff: [Mesa-dev] [PATCH 0/8] anv: Add int64 support for gen8+
>
> This little series adds int64 support to Vulkan on Broadwell and newer
> hardware.  In theory, we could also support it on gen7 but that requires
> more lowering code to be written.
>
> Most of this series is the nir_builder control-flow stuff that I sent out
> earlier with a small addition to make it easy to add phi instructions after
> an if statement.  Next comes an int64 lowering pass in NIR that mirrors the
> GLSL IR pass written by Ian.
>
> The second-to-last patch makes i965 use the new NIR pass rather than the
> GLSL IR one.  There are two reasons for this.  First, is that GL gets
> better int64 test coverage than Vulkan does at the moment.  Second, this
> means that we get at least one run of the NIR optimization loop (including
> nir_opt_algebraic) before we do 64-bit integer lowering and we may be able
> to get rid of some instructions instead of having to lower them.
>
> Finally, it turns it in in the Vulkan driver for gen8+.  Once the lowering
> pass gets expanded to handle the rest of the integer operations (maybe a
> good noob task?), we can turn it on for gen7.
>
> Jason Ekstrand (8):
>   nir/builder: Add support for easily building control-flow
>   glsl/nir: Use nir_builder's new control-flow helpers
>   nir/lower_gs_intrinsics: Use nir_builder control-flow helpers
>   nir/lower_indirect: Use nir_builder control-flow helpers
>   spirv: Use nir_builder for control flow
>   nir: Add a simple int64 lowering pass
>   i965: Do int64 lowering in NIR
>   anv: Advertise shaderInt64 on Broadwell and above
>
>  src/compiler/Makefile.sources|   1 +
>  src/compiler/glsl/glsl_to_nir.cpp|  38 ++--
>  src/compiler/nir/nir.h   |  11 ++
>  src/compiler/nir/nir_builder.h   |  95 +
>  src/compiler/nir/nir_lower_gs_intrinsics.c   |   9 +-
>  src/compiler/nir/nir_lower_indirect_derefs.c |  35 +---
>  src/compiler/nir/nir_lower_int64.c   | 275
> +++
>  src/compiler/spirv/vtn_cfg.c |  45 ++---
>  src/intel/vulkan/anv_device.c|   2 +-
>  src/mesa/drivers/dri/i965/brw_link.cpp   |   5 -
>  src/mesa/drivers/dri/i965/brw_nir.c  |   7 +
>  11 files changed, 423 insertions(+), 100 deletions(-)  create mode 100644
> src/compiler/nir/nir_lower_int64.c
>
> --
> 2.5.0.400.gff86faf
>
> ___
> mesa-dev mailing list
> mesa-dev@lists.freedesktop.org
> https://lists.freedesktop.org/mailman/listinfo/mesa-dev
>
>
___
mesa-dev mailing list
mesa-dev@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/mesa-dev


[Mesa-dev] [PATCH] doc: GL_ARB_buffer_storage is supported on llvmpipe/swr

2017-02-24 Thread Gregory Hainaut
At least, the extension is exported (gallium capability
PIPE_CAP_BUFFER_MAP_PERSISTENT_COHERENT is 1)

Signed-off-by: Gregory Hainaut 
---
 docs/features.txt | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/docs/features.txt b/docs/features.txt
index d9528e9..9d3a460 100644
--- a/docs/features.txt
+++ b/docs/features.txt
@@ -191,7 +191,7 @@ GL 4.3, GLSL 4.30 -- all DONE: i965/gen8+, nvc0, radeonsi
 GL 4.4, GLSL 4.40 -- all DONE: i965/gen8+, nvc0, radeonsi
 
   GL_MAX_VERTEX_ATTRIB_STRIDE   DONE (all drivers)
-  GL_ARB_buffer_storage DONE (i965, nv50, r600)
+  GL_ARB_buffer_storage DONE (i965, nv50, 
r600, llvmpipe, swr)
   GL_ARB_clear_texture  DONE (i965, nv50, 
r600, llvmpipe, softpipe)
   GL_ARB_enhanced_layouts   DONE (i965, nv50, 
llvmpipe, softpipe)
   - compile-time constant expressions   DONE
-- 
2.1.4

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


[Mesa-dev] [Bug 99919] Wrong and unstable image rendering from GLSL fragment shaders

2017-02-24 Thread bugzilla-daemon
https://bugs.freedesktop.org/show_bug.cgi?id=99919

--- Comment #4 from Ilia Mirkin  ---
As an aside, for gallium-based drivers this seems to generate a checkerboard.
(Tested with at least llvmpipe and softpipe.) Both the original and the
variant.

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


[Mesa-dev] [Bug 99919] Wrong and unstable image rendering from GLSL fragment shaders

2017-02-24 Thread bugzilla-daemon
https://bugs.freedesktop.org/show_bug.cgi?id=99919

Lars Hamre  changed:

   What|Removed |Added

 CC||cheme...@gmail.com

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


[Mesa-dev] [Bug 99919] Wrong and unstable image rendering from GLSL fragment shaders

2017-02-24 Thread bugzilla-daemon
https://bugs.freedesktop.org/show_bug.cgi?id=99919

Jan Ziak <0xe2.0x9a.0...@gmail.com> changed:

   What|Removed |Added

 CC||0xe2.0x9a.0...@gmail.com

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


[Mesa-dev] [Bug 99919] Wrong and unstable image rendering from GLSL fragment shaders

2017-02-24 Thread bugzilla-daemon
https://bugs.freedesktop.org/show_bug.cgi?id=99919

Matt Turner  changed:

   What|Removed |Added

 CC||matts...@gmail.com

--- Comment #3 from Matt Turner  ---
Thanks for the report!

I can reproduce on Haswell, in addition to your report on Sandybridge. I expect
this means it will apply to all generations supported by the i965 driver.


The first thing that pops out at me is in the NIR for the variant, we have:

vec1 32 ssa_0 = undefined
vec1 32 ssa_1 = undefined
vec1 32 ssa_2 = undefined
[snip]
loop {
block block_6:
/* preds: block_5 block_15 */
vec1 32 ssa_118 = phi block_5: ssa_0, block_15: ssa_130
vec1 32 ssa_119 = phi block_5: ssa_1, block_15: ssa_131
vec1 32 ssa_120 = phi block_5: ssa_2, block_15: ssa_132

whereas there are no undefined SSA values in the original. Since the undefined
values are flowing into the loop from the entrance, I believe this indeed
indicates a bug in our control flow analysis in NIR.

-- 
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 99919] Wrong and unstable image rendering from GLSL fragment shaders

2017-02-24 Thread bugzilla-daemon
https://bugs.freedesktop.org/show_bug.cgi?id=99919

--- Comment #2 from Ilia Mirkin  ---
Created attachment 129905
  --> https://bugs.freedesktop.org/attachment.cgi?id=129905&action=edit
apitrace of variant shader

For convenience, attaching a trace of the variant.

Very surprising that this breaks... the diff between shaders is

--- large-v100-webgl-9803840f5a05935c_inv_variant_77/original.frag 
2017-02-23 05:18:29.0 -0500
+++ large-v100-webgl-9803840f5a05935c_inv_variant_77/variant.frag  
2017-02-23 05:18:58.0 -0500
@@ -67,12 +70,18 @@
 }
 else
 {
+for(int i = 0; i < 1; i++) {
 if((s2.x < s1.x || s1.x <= 0.0) && s2.x > 0.0)
 {
 hd.c = ca.y;
+if(injectionSwitch.x > injectionSwitch.y)
+{
+break;
+}
 hd.d = s2.x;
 hd.n = s2.yzw;
 }
+}
 }
 return hd;
 }

(and injectionSwitch is set to 0,1 so that should never be true)

Tested on a SKL GT2, so it's not just some weird SNB 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 0/4] glsl/tests: completely broken or strange design ?

2017-02-24 Thread Dylan Baker
Quoting Emil Velikov (2017-02-23 08:43:06)
> Hi all,
> 
> As some of you may know we have a bunch of interesting tests in glsl.
> 
> A bit earlier I've spotted that they are competely broken, as they would
> happily return "success" even when 0 tests were generated.
> 
> As an example I will take optimisation-test, which this series sort of
> fixes. Here is the design flow:
>  - optimisation-test (SH1) assumes that we're in the right location and 
> opens a python script (PY1).
>  - if found (only in corner cases) - the PY1 is executed and generates 
> a bunch of bash scripts (SH2) which are stored in the srcdir (fails on
> make distcheck).
>  - PY1 also hardcodes the location of the glsl_test binary, based on 
> some magically derived value (hint srcdir not used and wrong to use)
>  - the return status of PY1 is unchecked.
>  - thus as PY1 fails (and we often do) no tests are generated and SH1 
> reports "SUCCESS"
>  - alternatively, SH1 executes SH2 to produce the to-be-tested files
>  - then it (SH1) proceeds to execute PY2
>  - latter of which decodes and saves the [to a temporary location] the
> template and the file under test and calls "diff" on the resulting
> files.
> 
> With the following patches I've addressed all usecases, but the fact that
> srcdir is RO, thus 3/4 will cause "make distcheck" to fail (and rightfully 
> so).
> 
> I believe all of us can see how fragile/suboptimal/you name it the
> design is and it need a complete rework.
> 
> Conteplating about giving a shot myself, but I suspect all of it will end up
> in the bin, now that we have Dylan back ;-)
> 
> So the questions are:
>  - Do we care about those tests ?
>  - Dylan any interest in giving it a stab ?

Not particularly, but I'd be happy to review whatever you come up with ;)

> 
> Thanks
> Emil
> 
> Cc: Dylan Baker 
> Cc: Kenneth Graunke 
> Cc: Matt Turner 
> 
> Emil Velikov (4):
>   glsl/tests/optimisation-test: make sure that $PYTHON2 is set/available
>   glsl/tests/optimisation-test: ensure that compare_ir is available
>   glsl/tests/optimization-test: error out if we fail to generate any
> tests
>   glsl/tests/optimization-test: correctly manage srcdir/pwd and co
> 
>  src/compiler/glsl/tests/optimization-test | 50 
> +++
>  1 file changed, 44 insertions(+), 6 deletions(-)
> 
> -- 
> 2.11.0
> 


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


[Mesa-dev] [PATCH v2 1/1] clover: Dump linked binary to a different file

2017-02-24 Thread Jan Vesely
this allows to pass the generated files directly to llc or bugpoint

v2: add atomic counter ID

Signed-off-by: Jan Vesely 
---
 src/gallium/state_trackers/clover/llvm/invocation.cpp | 8 ++--
 1 file changed, 6 insertions(+), 2 deletions(-)

diff --git a/src/gallium/state_trackers/clover/llvm/invocation.cpp 
b/src/gallium/state_trackers/clover/llvm/invocation.cpp
index f63ff3d..bb9d95d 100644
--- a/src/gallium/state_trackers/clover/llvm/invocation.cpp
+++ b/src/gallium/state_trackers/clover/llvm/invocation.cpp
@@ -281,8 +281,12 @@ clover::llvm::link_program(const std::vector 
&modules,
 
optimize(*mod, c->getCodeGenOpts().OptimizationLevel, !create_library);
 
+   static ::std::atomic_uint seq(0);
+   ::std::string id = "." + mod->getModuleIdentifier() + "-" +
+  ::std::to_string(seq++);
+
if (has_flag(debug::llvm))
-  debug::log(".ll", print_module_bitcode(*mod));
+  debug::log(id + ".ll", print_module_bitcode(*mod));
 
if (create_library) {
   return build_module_library(*mod, module::section::text_library);
@@ -292,7 +296,7 @@ clover::llvm::link_program(const std::vector 
&modules,
 
} else if (ir == PIPE_SHADER_IR_NATIVE) {
   if (has_flag(debug::native))
- debug::log(".asm", print_module_native(*mod, target));
+ debug::log(id +  ".asm", print_module_native(*mod, target));
 
   return build_module_native(*mod, target, *c, r_log);
 
-- 
2.9.3

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


[Mesa-dev] [PATCH v3 10/15] anv: anv-entrypoints_gen.py: rename hash to cal_hash.

2017-02-24 Thread Dylan Baker
hash is reserved name in python, it's the interface to access an
object's hash protocol.

Signed-off-by: Dylan Baker 
---
 src/intel/vulkan/anv_entrypoints_gen.py | 7 ---
 1 file changed, 4 insertions(+), 3 deletions(-)

diff --git a/src/intel/vulkan/anv_entrypoints_gen.py 
b/src/intel/vulkan/anv_entrypoints_gen.py
index 156a14f..8460bb5 100644
--- a/src/intel/vulkan/anv_entrypoints_gen.py
+++ b/src/intel/vulkan/anv_entrypoints_gen.py
@@ -254,7 +254,8 @@ PRIME_FACTOR = 5024183
 PRIME_STEP = 19
 
 
-def hash(name):
+def cal_hash(name):
+"""Calculate the same hash value that Mesa will calculate in C."""
 h = 0
 for c in name:
 h = (h * PRIME_FACTOR + ord(c)) & U32_MASK
@@ -298,7 +299,7 @@ def get_entrypoints(doc, entrypoints_to_defines):
 guard = entrypoints_to_defines[fullname]
 else:
 guard = None
-entrypoints.append((type, shortname, params, index, hash(fullname), 
guard))
+entrypoints.append((type, shortname, params, index, 
cal_hash(fullname), guard))
 index += 1
 
 return entrypoints
@@ -369,7 +370,7 @@ def main():
 'const VkAllocationCallbacks* pAllocator,' +
 'VkDeviceMemory* pMem,' +
 'VkImage* pImage', len(entrypoints),
-hash('vkCreateDmaBufImageINTEL'), None))
+cal_hash('vkCreateDmaBufImageINTEL'), None))
 
 # For outputting entrypoints.h we generate a anv_EntryPoint() prototype
 # per entry point.
-- 
git-series 0.9.1
___
mesa-dev mailing list
mesa-dev@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/mesa-dev


[Mesa-dev] [PATCH v3 12/15] anv: use dict.get in anv_entrypoints_gen.py

2017-02-24 Thread Dylan Baker
Instead of using an if and a check, use dict.get, which does the same
thing, but more succinctly.

Signed-off-by: Dylan Baker 
---
 src/intel/vulkan/anv_entrypoints_gen.py | 5 +
 1 file changed, 1 insertion(+), 4 deletions(-)

diff --git a/src/intel/vulkan/anv_entrypoints_gen.py 
b/src/intel/vulkan/anv_entrypoints_gen.py
index 7a5d0a7..9bec52a 100644
--- a/src/intel/vulkan/anv_entrypoints_gen.py
+++ b/src/intel/vulkan/anv_entrypoints_gen.py
@@ -293,10 +293,7 @@ def get_entrypoints(doc, entrypoints_to_defines):
 shortname = fullname[2:]
 params = (''.join(p.itertext()) for p in command.findall('./param'))
 params = ', '.join(params)
-if fullname in entrypoints_to_defines:
-guard = entrypoints_to_defines[fullname]
-else:
-guard = None
+guard = entrypoints_to_defines.get(fullname)
 entrypoints.append((type, shortname, params, index, 
cal_hash(fullname), guard))
 index += 1
 
-- 
git-series 0.9.1
___
mesa-dev mailing list
mesa-dev@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/mesa-dev


[Mesa-dev] [PATCH v3 14/15] anv: use cElementTree in anv_entrypoints_gen.py

2017-02-24 Thread Dylan Baker
It's written in C rather than pure python and is strictly faster, the
only reason not to use it that it's classes cannot be subclassed.

Signed-off-by: Dylan Baker 
---
 src/intel/vulkan/anv_entrypoints_gen.py | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/src/intel/vulkan/anv_entrypoints_gen.py 
b/src/intel/vulkan/anv_entrypoints_gen.py
index 8736eaf..72d8c17 100644
--- a/src/intel/vulkan/anv_entrypoints_gen.py
+++ b/src/intel/vulkan/anv_entrypoints_gen.py
@@ -26,7 +26,7 @@ import argparse
 import functools
 import os
 import textwrap
-import xml.etree.ElementTree as et
+import xml.etree.cElementTree as et
 
 from mako.template import Template
 
-- 
git-series 0.9.1
___
mesa-dev mailing list
mesa-dev@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/mesa-dev


[Mesa-dev] [PATCH v3 13/15] anv: don't use Element.get in anv_entrypoints_gen.py

2017-02-24 Thread Dylan Baker
This has the potential to mask errors, since Element.get works like
dict.get, returning None if the element isn't found. I think the reason
that Element.get was used is that vulkan has one extension that isn't
really an extension, and thus is missing the 'protect' field.

This patch changes the behavior slightly by replacing get with explicit
lookup in the Element.attrib dictionary, and using xpath to only iterate
over extensions with a "protect" attribute.

Signed-off-by: Dylan Baker 
---
 src/intel/vulkan/anv_entrypoints_gen.py | 13 +++--
 1 file changed, 7 insertions(+), 6 deletions(-)

diff --git a/src/intel/vulkan/anv_entrypoints_gen.py 
b/src/intel/vulkan/anv_entrypoints_gen.py
index 9bec52a..8736eaf 100644
--- a/src/intel/vulkan/anv_entrypoints_gen.py
+++ b/src/intel/vulkan/anv_entrypoints_gen.py
@@ -303,13 +303,14 @@ def get_entrypoints(doc, entrypoints_to_defines):
 def get_entrypoints_defines(doc):
 """Maps entry points to extension defines."""
 entrypoints_to_defines = {}
-extensions = doc.findall('./extensions/extension')
-for extension in extensions:
-define = extension.get('protect')
-entrypoints = extension.findall('./require/command')
-for entrypoint in entrypoints:
-fullname = entrypoint.get('name')
+
+for extension in doc.findall('./extensions/extension[@protect]'):
+define = extension.attrib['protect']
+
+for entrypoint in extension.findall('./require/command'):
+fullname = entrypoint.attrib['name']
 entrypoints_to_defines[fullname] = define
+
 return entrypoints_to_defines
 
 
-- 
git-series 0.9.1
___
mesa-dev mailing list
mesa-dev@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/mesa-dev


[Mesa-dev] [PATCH v3 05/15] anv: split main into two functions in anv_entrypoints_gen.py

2017-02-24 Thread Dylan Baker
This is groundwork for the next patches, it will allows porting the
header and the code to mako separately, and will also allow both to be
run simultaneously.

Signed-off-by: Dylan Baker 
---
 src/intel/vulkan/anv_entrypoints_gen.py | 108 -
 1 file changed, 56 insertions(+), 52 deletions(-)

diff --git a/src/intel/vulkan/anv_entrypoints_gen.py 
b/src/intel/vulkan/anv_entrypoints_gen.py
index ea15065..772f3e6 100644
--- a/src/intel/vulkan/anv_entrypoints_gen.py
+++ b/src/intel/vulkan/anv_entrypoints_gen.py
@@ -130,64 +130,40 @@ def get_entrypoints_defines(doc):
 return entrypoints_to_defines
 
 
-def main():
-parser = argparse.ArgumentParser()
-parser.add_argument('target', choices=['header', 'code'],
-help='Which file to generate.')
-parser.add_argument('--xml', help='Vulkan API XML file.')
-args = parser.parse_args()
-
-doc = et.parse(args.xml)
-entrypoints = get_entrypoints(doc, get_entrypoints_defines(doc))
-
-# Manually add CreateDmaBufImageINTEL for which we don't have an extension
-# defined.
-entrypoints.append(('VkResult', 'CreateDmaBufImageINTEL',
-'VkDevice device, ' +
-'const VkDmaBufImageCreateInfo* pCreateInfo, ' +
-'const VkAllocationCallbacks* pAllocator,' +
-'VkDeviceMemory* pMem,' +
-'VkImage* pImage', len(entrypoints),
-hash('vkCreateDmaBufImageINTEL'), None))
+def gen_header(entrypoints):
+print "/* This file generated from vk_gen.py, don't edit directly. */\n"
 
-# For outputting entrypoints.h we generate a anv_EntryPoint() prototype
-# per entry point.
-
-if args.target == 'header':
-print "/* This file generated from vk_gen.py, don't edit directly. 
*/\n"
+print "struct anv_dispatch_table {"
+print "   union {"
+print "  void *entrypoints[%d];" % len(entrypoints)
+print "  struct {"
 
-print "struct anv_dispatch_table {"
-print "   union {"
-print "  void *entrypoints[%d];" % len(entrypoints)
-print "  struct {"
-
-for type, name, args, num, h, guard in entrypoints:
-if guard is not None:
-print "#ifdef {0}".format(guard)
-print " PFN_vk{0} {0};".format(name)
-print "#else"
-print " void *{0};".format(name)
-print "#endif"
-else:
-print " PFN_vk{0} {0};".format(name)
-print "  };\n"
-print "   };\n"
-print "};\n"
-
-print "void anv_set_dispatch_devinfo(const struct gen_device_info 
*info);\n"
+for type, name, args, num, h, guard in entrypoints:
+if guard is not None:
+print "#ifdef {0}".format(guard)
+print " PFN_vk{0} {0};".format(name)
+print "#else"
+print " void *{0};".format(name)
+print "#endif"
+else:
+print " PFN_vk{0} {0};".format(name)
+print "  };\n"
+print "   };\n"
+print "};\n"
 
-for type, name, args, num, h, guard in entrypoints:
-print_guard_start(guard)
-print "%s anv_%s(%s);" % (type, name, args)
-print "%s gen7_%s(%s);" % (type, name, args)
-print "%s gen75_%s(%s);" % (type, name, args)
-print "%s gen8_%s(%s);" % (type, name, args)
-print "%s gen9_%s(%s);" % (type, name, args)
-print_guard_end(guard)
-exit()
+print "void anv_set_dispatch_devinfo(const struct gen_device_info 
*info);\n"
 
+for type, name, args, num, h, guard in entrypoints:
+print_guard_start(guard)
+print "%s anv_%s(%s);" % (type, name, args)
+print "%s gen7_%s(%s);" % (type, name, args)
+print "%s gen75_%s(%s);" % (type, name, args)
+print "%s gen8_%s(%s);" % (type, name, args)
+print "%s gen9_%s(%s);" % (type, name, args)
+print_guard_end(guard)
 
 
+def gen_code(entrypoints):
 print textwrap.dedent("""\
 /*
  * Copyright ?? 2015 Intel Corporation
@@ -372,5 +348,33 @@ def main():
 """) % (PRIME_FACTOR, PRIME_STEP, HASH_MASK)
 
 
+def main():
+parser = argparse.ArgumentParser()
+parser.add_argument('target', choices=['header', 'code'],
+help='Which file to generate.')
+parser.add_argument('--xml', help='Vulkan API XML file.')
+args = parser.parse_args()
+
+doc = et.parse(args.xml)
+entrypoints = get_entrypoints(doc, get_entrypoints_defines(doc))
+
+# Manually add CreateDmaBufImageINTEL for which we don't have an extension
+# defined.
+entrypoints.append(('VkResult', 'CreateDmaBufImageINTEL',
+'VkDevice device, ' +
+'const VkDmaBufImageCreateInfo* pCreateInfo, ' +
+   

[Mesa-dev] [PATCH v3 06/15] anv: Update "do not edit" comments with proper filename

2017-02-24 Thread Dylan Baker
This does two things, first it updates both the .h and the .c file to
have the same do not edit string. Second, it uses __file__ to ensure
that even if the file is moved or renamed that the name will be correct.

One thing to note is the use of '{{' and '}}' in the C template. This is
to instruct python to print a literal '{' and '}' respectively, rather
than treating the contents as a formatter specifier.

v3: - add this patch

Signed-off-by: Dylan Baker 
---
 src/intel/vulkan/anv_entrypoints_gen.py | 12 +++-
 1 file changed, 7 insertions(+), 5 deletions(-)

diff --git a/src/intel/vulkan/anv_entrypoints_gen.py 
b/src/intel/vulkan/anv_entrypoints_gen.py
index 772f3e6..05a685d 100644
--- a/src/intel/vulkan/anv_entrypoints_gen.py
+++ b/src/intel/vulkan/anv_entrypoints_gen.py
@@ -23,6 +23,7 @@
 #
 
 import argparse
+import os
 import textwrap
 import xml.etree.ElementTree as et
 
@@ -131,7 +132,8 @@ def get_entrypoints_defines(doc):
 
 
 def gen_header(entrypoints):
-print "/* This file generated from vk_gen.py, don't edit directly. */\n"
+print "/* This file generated from {}, don't edit directly. */\n".format(
+os.path.basename(__file__))
 
 print "struct anv_dispatch_table {"
 print "   union {"
@@ -188,21 +190,21 @@ def gen_code(entrypoints):
  * IN THE SOFTWARE.
  */
 
-/* DO NOT EDIT! This is a generated file. */
+/* This file generated from {}, don't edit directly. */
 
 #include "anv_private.h"
 
-struct anv_entrypoint {
+struct anv_entrypoint {{
uint32_t name;
uint32_t hash;
-};
+}};
 
 /* We use a big string constant to avoid lots of reloctions from the entry
  * point table to lots of little strings. The entries in the entry point 
table
  * store the index into this big string.
  */
 
-static const char strings[] =""")
+static const char strings[] =""".format(os.path.basename(__file__)))
 
 offsets = []
 i = 0
-- 
git-series 0.9.1
___
mesa-dev mailing list
mesa-dev@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/mesa-dev


[Mesa-dev] [PATCH v3 07/15] anv: convert header generation in anv_entrypoints_gen.py to mako

2017-02-24 Thread Dylan Baker
This produces an identical file except for whitespace.

Signed-off-by: Dylan Baker 
---
 src/intel/vulkan/anv_entrypoints_gen.py | 77 ++
 1 file changed, 42 insertions(+), 35 deletions(-)

diff --git a/src/intel/vulkan/anv_entrypoints_gen.py 
b/src/intel/vulkan/anv_entrypoints_gen.py
index 05a685d..cad94c8 100644
--- a/src/intel/vulkan/anv_entrypoints_gen.py
+++ b/src/intel/vulkan/anv_entrypoints_gen.py
@@ -27,6 +27,8 @@ import os
 import textwrap
 import xml.etree.ElementTree as et
 
+from mako.template import Template
+
 MAX_API_VERSION = 1.0
 
 SUPPORTED_EXTENSIONS = [
@@ -46,6 +48,44 @@ SUPPORTED_EXTENSIONS = [
 # function and a power-of-two size table. The prime numbers are determined
 # experimentally.
 
+TEMPLATE_H = Template(textwrap.dedent("""\
+/* This file generated from ${filename}, don't edit directly. */
+
+struct anv_dispatch_table {
+   union {
+  void *entrypoints[${len(entrypoints)}];
+  struct {
+  % for _, name, _, _, _, guard in entrypoints:
+% if guard is not None:
+#ifdef ${guard}
+  PFN_vk${name} ${name};
+#else
+  void *${name};
+# endif
+% else:
+  PFN_vk${name} ${name};
+% endif
+  % endfor
+  };
+   };
+};
+
+void anv_set_dispatch_devinfo(const struct gen_device_info *info);
+% for type_, name, args, num, h, guard in entrypoints:
+  % if guard is not None:
+#ifdef ${guard}
+  % endif
+  ${type_} anv_${name}(${args});
+  ${type_} gen7_${name}(${args});
+  ${type_} gen75_${name}(${args});
+  ${type_} gen8_${name}(${args});
+  ${type_} gen9_${name}(${args});
+  % if guard is not None:
+#endif // ${guard}
+  % endif
+% endfor
+"""))
+
 NONE = 0x
 HASH_SIZE = 256
 U32_MASK = 2**32 - 1
@@ -131,40 +171,6 @@ def get_entrypoints_defines(doc):
 return entrypoints_to_defines
 
 
-def gen_header(entrypoints):
-print "/* This file generated from {}, don't edit directly. */\n".format(
-os.path.basename(__file__))
-
-print "struct anv_dispatch_table {"
-print "   union {"
-print "  void *entrypoints[%d];" % len(entrypoints)
-print "  struct {"
-
-for type, name, args, num, h, guard in entrypoints:
-if guard is not None:
-print "#ifdef {0}".format(guard)
-print " PFN_vk{0} {0};".format(name)
-print "#else"
-print " void *{0};".format(name)
-print "#endif"
-else:
-print " PFN_vk{0} {0};".format(name)
-print "  };\n"
-print "   };\n"
-print "};\n"
-
-print "void anv_set_dispatch_devinfo(const struct gen_device_info 
*info);\n"
-
-for type, name, args, num, h, guard in entrypoints:
-print_guard_start(guard)
-print "%s anv_%s(%s);" % (type, name, args)
-print "%s gen7_%s(%s);" % (type, name, args)
-print "%s gen75_%s(%s);" % (type, name, args)
-print "%s gen8_%s(%s);" % (type, name, args)
-print "%s gen9_%s(%s);" % (type, name, args)
-print_guard_end(guard)
-
-
 def gen_code(entrypoints):
 print textwrap.dedent("""\
 /*
@@ -373,7 +379,8 @@ def main():
 # For outputting entrypoints.h we generate a anv_EntryPoint() prototype
 # per entry point.
 if args.target == 'header':
-gen_header(entrypoints)
+print TEMPLATE_H.render(entrypoints=entrypoints,
+filename=os.path.basename(__file__))
 else:
 gen_code(entrypoints)
 
-- 
git-series 0.9.1
___
mesa-dev mailing list
mesa-dev@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/mesa-dev


[Mesa-dev] [PATCH v3 08/15] anv: convert C generation to template in anv_entrypoints_gen.py

2017-02-24 Thread Dylan Baker
This produces a file that is identical except for whitespace, there is a
table that has 8 columns in the original and is easy to do with prints,
but is ugly using mako, so it doesn't have columns; the data is not
inherently tabular.

Signed-off-by: Dylan Baker 
---
 src/intel/vulkan/anv_entrypoints_gen.py | 340 -
 1 file changed, 167 insertions(+), 173 deletions(-)

diff --git a/src/intel/vulkan/anv_entrypoints_gen.py 
b/src/intel/vulkan/anv_entrypoints_gen.py
index cad94c8..e4bf002 100644
--- a/src/intel/vulkan/anv_entrypoints_gen.py
+++ b/src/intel/vulkan/anv_entrypoints_gen.py
@@ -86,93 +86,7 @@ TEMPLATE_H = Template(textwrap.dedent("""\
 % endfor
 """))
 
-NONE = 0x
-HASH_SIZE = 256
-U32_MASK = 2**32 - 1
-HASH_MASK = HASH_SIZE - 1
-
-PRIME_FACTOR = 5024183
-PRIME_STEP = 19
-
-opt_header = False
-opt_code = False
-
-
-def hash(name):
-h = 0
-for c in name:
-h = (h * PRIME_FACTOR + ord(c)) & U32_MASK
-
-return h
-
-
-def print_guard_start(guard):
-if guard is not None:
-print "#ifdef {0}".format(guard)
-
-
-def print_guard_end(guard):
-if guard is not None:
-print "#endif // {0}".format(guard)
-
-
-def get_entrypoints(doc, entrypoints_to_defines):
-"""Extract the entry points from the registry."""
-entrypoints = []
-
-enabled_commands = set()
-for feature in doc.findall('./feature'):
-assert feature.attrib['api'] == 'vulkan'
-if float(feature.attrib['number']) > MAX_API_VERSION:
-continue
-
-for command in feature.findall('./require/command'):
-enabled_commands.add(command.attrib['name'])
-
-for extension in doc.findall('.extensions/extension'):
-if extension.attrib['name'] not in SUPPORTED_EXTENSIONS:
-continue
-
-assert extension.attrib['supported'] == 'vulkan'
-for command in extension.findall('./require/command'):
-enabled_commands.add(command.attrib['name'])
-
-index = 0
-for command in doc.findall('./commands/command'):
-type = command.find('./proto/type').text
-fullname = command.find('./proto/name').text
-
-if fullname not in enabled_commands:
-continue
-
-shortname = fullname[2:]
-params = (''.join(p.itertext()) for p in command.findall('./param'))
-params = ', '.join(params)
-if fullname in entrypoints_to_defines:
-guard = entrypoints_to_defines[fullname]
-else:
-guard = None
-entrypoints.append((type, shortname, params, index, hash(fullname), 
guard))
-index += 1
-
-return entrypoints
-
-
-def get_entrypoints_defines(doc):
-"""Maps entry points to extension defines."""
-entrypoints_to_defines = {}
-extensions = doc.findall('./extensions/extension')
-for extension in extensions:
-define = extension.get('protect')
-entrypoints = extension.findall('./require/command')
-for entrypoint in entrypoints:
-fullname = entrypoint.get('name')
-entrypoints_to_defines[fullname] = define
-return entrypoints_to_defines
-
-
-def gen_code(entrypoints):
-print textwrap.dedent("""\
+TEMPLATE_C = Template(textwrap.dedent(u"""\
 /*
  * Copyright ?? 2015 Intel Corporation
  *
@@ -196,58 +110,61 @@ def gen_code(entrypoints):
  * IN THE SOFTWARE.
  */
 
-/* This file generated from {}, don't edit directly. */
+/* This file generated from ${filename}, don't edit directly. */
 
 #include "anv_private.h"
 
-struct anv_entrypoint {{
+struct anv_entrypoint {
uint32_t name;
uint32_t hash;
-}};
+};
 
 /* We use a big string constant to avoid lots of reloctions from the entry
  * point table to lots of little strings. The entries in the entry point 
table
  * store the index into this big string.
  */
 
-static const char strings[] =""".format(os.path.basename(__file__)))
-
-offsets = []
-i = 0
-for type, name, args, num, h, guard in entrypoints:
-print "   \"vk%s\\0\"" % name
-offsets.append(i)
-i += 2 + len(name) + 1
-print "   ;"
-
-# Now generate the table of all entry points
-
-print "\nstatic const struct anv_entrypoint entrypoints[] = {"
-for type, name, args, num, h, guard in entrypoints:
-print "   { %5d, 0x%08x }," % (offsets[num], h)
-print "};\n"
+static const char strings[] =
+% for _, name, _, _, _, _ in entrypoints:
+"vk${name}\\0"
+% endfor
+;
 
-print textwrap.dedent("""
+static const struct anv_entrypoint entrypoints[] = {
+% for _, _, _, num, h, _ in entrypoints:
+{ ${offsets[num]}, ${'{:0=#8x}'.format(h)} },
+% endfor
+};
 
 /* Weak aliases for all potential implementations. These will resolve to
  * NULL if they're not defined, which lets the resolve_entrypoint() 
function
  * either pick the correct entry po

[Mesa-dev] [PATCH v3 11/15] anv: anv_entrypoints_gen.py: use reduce function.

2017-02-24 Thread Dylan Baker
Reduce is it's own reward.

Signed-off-by: Dylan Baker 
---
 src/intel/vulkan/anv_entrypoints_gen.py | 8 +++-
 1 file changed, 3 insertions(+), 5 deletions(-)

diff --git a/src/intel/vulkan/anv_entrypoints_gen.py 
b/src/intel/vulkan/anv_entrypoints_gen.py
index 8460bb5..7a5d0a7 100644
--- a/src/intel/vulkan/anv_entrypoints_gen.py
+++ b/src/intel/vulkan/anv_entrypoints_gen.py
@@ -23,6 +23,7 @@
 #
 
 import argparse
+import functools
 import os
 import textwrap
 import xml.etree.ElementTree as et
@@ -256,11 +257,8 @@ PRIME_STEP = 19
 
 def cal_hash(name):
 """Calculate the same hash value that Mesa will calculate in C."""
-h = 0
-for c in name:
-h = (h * PRIME_FACTOR + ord(c)) & U32_MASK
-
-return h
+return functools.reduce(
+lambda h, c: (h * PRIME_FACTOR + ord(c)) & U32_MASK, name, 0)
 
 
 def get_entrypoints(doc, entrypoints_to_defines):
-- 
git-series 0.9.1
___
mesa-dev mailing list
mesa-dev@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/mesa-dev


[Mesa-dev] [PATCH v3 09/15] anv: anv_entrypoints_gen.py: directly write files instead of piping

2017-02-24 Thread Dylan Baker
This changes the output to be written as a file rather than being piped.
This had one critical advantage, it encapsulates the encoding. This
prevents bugs where a symbol (generally unicode like ?? [copyright]) is
printed and the system being built on doesn't have a unicode locale.

v2: - Update Android.mk
v3: - Don't generate both files at once
- Fix Android.mk
- drop --outdir, since the filename is passed in as an argument

Signed-off-by: Dylan Baker 
---
 src/intel/vulkan/Android.mk |  5 ++--
 src/intel/vulkan/Makefile.am| 10 
 src/intel/vulkan/anv_entrypoints_gen.py | 31 ++
 3 files changed, 26 insertions(+), 20 deletions(-)

diff --git a/src/intel/vulkan/Android.mk b/src/intel/vulkan/Android.mk
index 9dabf1c..13b4846 100644
--- a/src/intel/vulkan/Android.mk
+++ b/src/intel/vulkan/Android.mk
@@ -61,7 +61,8 @@ $(intermediates)/dummy.c:
$(hide) touch $@
 
 $(intermediates)/anv_entrypoints.h:
-   $(VK_ENTRYPOINTS_SCRIPT) header --xml 
$(MESA_TOP)/src/vulkan/registry/vk.xml > $@
+   $(VK_ENTRYPOINTS_SCRIPT) header $@ --xml 
$(MESA_TOP)/src/vulkan/registry/vk.xml
+
 
 LOCAL_EXPORT_C_INCLUDE_DIRS := \
 $(intermediates)
@@ -177,7 +178,7 @@ LOCAL_WHOLE_STATIC_LIBRARIES := libmesa_anv_entrypoints 
libmesa_genxml
 LOCAL_GENERATED_SOURCES += $(intermediates)/anv_entrypoints.c
 
 $(intermediates)/anv_entrypoints.c:
-   $(VK_ENTRYPOINTS_SCRIPT) code --xml 
$(MESA_TOP)/src/vulkan/registry/vk.xml > $@
+   $(VK_ENTRYPOINTS_SCRIPT) code $@ --xml 
$(MESA_TOP)/src/vulkan/registry/vk.xml
 
 LOCAL_SHARED_LIBRARIES := libdrm_intel
 
diff --git a/src/intel/vulkan/Makefile.am b/src/intel/vulkan/Makefile.am
index 565559c..f3ae4a0 100644
--- a/src/intel/vulkan/Makefile.am
+++ b/src/intel/vulkan/Makefile.am
@@ -145,11 +145,13 @@ libvulkan_intel_la_SOURCES = $(VULKAN_GEM_FILES)
 
 vulkan_api_xml = $(top_srcdir)/src/vulkan/registry/vk.xml
 
-anv_entrypoints.h : anv_entrypoints_gen.py $(vulkan_api_xml)
-   $(AM_V_GEN)$(PYTHON2) $(srcdir)/anv_entrypoints_gen.py header --xml 
$(vulkan_api_xml) > $@
+anv_entrypoints.h: anv_entrypoints_gen.py $(vulkan_api_xml)
+   $(AM_V_GEN)$(PYTHON2) $(srcdir)/anv_entrypoints_gen.py \
+   --xml $(vulkan_api_xml) header $@
 
-anv_entrypoints.c : anv_entrypoints_gen.py $(vulkan_api_xml)
-   $(AM_V_GEN)$(PYTHON2) $(srcdir)/anv_entrypoints_gen.py code --xml 
$(vulkan_api_xml) > $@
+anv_entrypoints.c: anv_entrypoints_gen.py $(vulkan_api_xml)
+   $(AM_V_GEN)$(PYTHON2) $(srcdir)/anv_entrypoints_gen.py \
+   --xml $(vulkan_api_xml) code $@
 
 BUILT_SOURCES = $(VULKAN_GENERATED_FILES)
 CLEANFILES = $(BUILT_SOURCES) dev_icd.json intel_icd.@host_cpu@.json
diff --git a/src/intel/vulkan/anv_entrypoints_gen.py 
b/src/intel/vulkan/anv_entrypoints_gen.py
index e4bf002..156a14f 100644
--- a/src/intel/vulkan/anv_entrypoints_gen.py
+++ b/src/intel/vulkan/anv_entrypoints_gen.py
@@ -84,7 +84,7 @@ TEMPLATE_H = Template(textwrap.dedent("""\
 #endif // ${guard}
   % endif
 % endfor
-"""))
+"""), output_encoding='utf-8')
 
 TEMPLATE_C = Template(textwrap.dedent(u"""\
 /*
@@ -338,22 +338,23 @@ def gen_code(entrypoints):
 collisions[level] += 1
 mapping[h & HASH_MASK] = num
 
-print TEMPLATE_C.render(entrypoints=entrypoints,
-offsets=offsets,
-collisions=collisions,
-mapping=mapping,
-hash_mask=HASH_MASK,
-prime_step=PRIME_STEP,
-prime_factor=PRIME_FACTOR,
-none=NONE,
-hash_size=HASH_SIZE,
-filename=os.path.basename(__file__))
+return TEMPLATE_C.render(entrypoints=entrypoints,
+ offsets=offsets,
+ collisions=collisions,
+ mapping=mapping,
+ hash_mask=HASH_MASK,
+ prime_step=PRIME_STEP,
+ prime_factor=PRIME_FACTOR,
+ none=NONE,
+ hash_size=HASH_SIZE,
+ filename=os.path.basename(__file__))
 
 
 def main():
 parser = argparse.ArgumentParser()
 parser.add_argument('target', choices=['header', 'code'],
 help='Which file to generate.')
+parser.add_argument('file', help='Where to write the file.')
 parser.add_argument('--xml', help='Vulkan API XML file.')
 args = parser.parse_args()
 
@@ -373,10 +374,12 @@ def main():
 # For outputting entrypoints.h we generate a anv_EntryPoint() prototype
 # per entry point.
 if args.target == 'header':
-print TEMPLATE_H.render(entrypoints=entrypoints,
-filename=os.path.basename(__file__))
+with open(args.file, 'wb') as

[Mesa-dev] [PATCH v3 00/15] cleanup anv_entrpoints_gen.py

2017-02-24 Thread Dylan Baker
There are a number of small style cleanups and simplifications in this series,
but the main changes are:
 - use a mako template to generate the header and code rather than prints
 - be python 3.x ready (the goal isn't to write python 3 code, but to write code
   that is easy to port or hybridize)
 - generate the header and the code in one go

I've put emphasis on the readability of the template rather than the readability
of the output code, it's relatively easy to pipe the code through 'indent' to
make it more readable.

Notable changes in Version 2:
- Pass XML file via an argument
- add flag to control output directory
- Attempt to update android makefiles

Notable changes in Version 3:
- Fix "do not edit" message to have proper file name
- More Android.mk changes
- Don't write both files at the same time
- Provide the file name to be written to as an argument

Dylan Baker (15):
  anv: anv_entrypoints_gen.py: use a main function
  anv: Use python style in anv_entrypoints_gen.py
  anv: make constants capitals in anv_entrypoints_gen.py
  anv: don't pass xmlfile via stdin anv_entrypoints_gen.py
  anv: split main into two functions in anv_entrypoints_gen.py
  anv: Update "do not edit" comments with proper filename
  anv: convert header generation in anv_entrypoints_gen.py to mako
  anv: convert C generation to template in anv_entrypoints_gen.py
  anv: anv_entrypoints_gen.py: directly write files instead of piping
  anv: anv-entrypoints_gen.py: rename hash to cal_hash.
  anv: anv_entrypoints_gen.py: use reduce function.
  anv: use dict.get in anv_entrypoints_gen.py
  anv: don't use Element.get in anv_entrypoints_gen.py
  anv: use cElementTree in anv_entrypoints_gen.py
  anv: Remove dead prototype from entrypoints

 src/intel/vulkan/Android.mk |   5 +-
 src/intel/vulkan/Makefile.am|  12 +-
 src/intel/vulkan/anv_entrypoints_gen.py | 600 -
 3 files changed, 318 insertions(+), 299 deletions(-)

base-commit: a9c488f2858f8a383dd50e557ec8a832bcb35f47
-- 
git-series 0.9.1
___
mesa-dev mailing list
mesa-dev@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/mesa-dev


[Mesa-dev] [PATCH v3 15/15] anv: Remove dead prototype from entrypoints

2017-02-24 Thread Dylan Baker
Spotted by Emil.

v2: - Add this patch

Signed-off-by: Dylan Baker 
---
 src/intel/vulkan/anv_entrypoints_gen.py | 1 -
 1 file changed, 1 deletion(-)

diff --git a/src/intel/vulkan/anv_entrypoints_gen.py 
b/src/intel/vulkan/anv_entrypoints_gen.py
index 72d8c17..ecdff13 100644
--- a/src/intel/vulkan/anv_entrypoints_gen.py
+++ b/src/intel/vulkan/anv_entrypoints_gen.py
@@ -71,7 +71,6 @@ TEMPLATE_H = Template(textwrap.dedent("""\
};
 };
 
-void anv_set_dispatch_devinfo(const struct gen_device_info *info);
 % for type_, name, args, num, h, guard in entrypoints:
   % if guard is not None:
 #ifdef ${guard}
-- 
git-series 0.9.1
___
mesa-dev mailing list
mesa-dev@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/mesa-dev


[Mesa-dev] [PATCH v3 01/15] anv: anv_entrypoints_gen.py: use a main function

2017-02-24 Thread Dylan Baker
This is just good practice.

Signed-off-by: Dylan Baker 
---
 src/intel/vulkan/anv_entrypoints_gen.py | 458 -
 1 file changed, 233 insertions(+), 225 deletions(-)

diff --git a/src/intel/vulkan/anv_entrypoints_gen.py 
b/src/intel/vulkan/anv_entrypoints_gen.py
index 93511ec..3f7a1ce 100644
--- a/src/intel/vulkan/anv_entrypoints_gen.py
+++ b/src/intel/vulkan/anv_entrypoints_gen.py
@@ -1,6 +1,6 @@
 # coding=utf-8
 #
-# Copyright ?? 2015 Intel Corporation
+# Copyright ?? 2015, 2017 Intel Corporation
 #
 # Permission is hereby granted, free of charge, to any person obtaining a
 # copy of this software and associated documentation files (the "Software"),
@@ -23,6 +23,7 @@
 #
 
 import sys
+import textwrap
 import xml.etree.ElementTree as ET
 
 max_api_version = 1.0
@@ -130,235 +131,242 @@ def get_entrypoints_defines(doc):
 entrypoints_to_defines[fullname] = define
 return entrypoints_to_defines
 
-doc = ET.parse(sys.stdin)
-entrypoints = get_entrypoints(doc, get_entrypoints_defines(doc))
-
-# Manually add CreateDmaBufImageINTEL for which we don't have an extension
-# defined.
-entrypoints.append(('VkResult', 'CreateDmaBufImageINTEL',
-'VkDevice device, ' +
-'const VkDmaBufImageCreateInfo* pCreateInfo, ' +
-'const VkAllocationCallbacks* pAllocator,' +
-'VkDeviceMemory* pMem,' +
-'VkImage* pImage', len(entrypoints),
-hash('vkCreateDmaBufImageINTEL'), None))
-
-# For outputting entrypoints.h we generate a anv_EntryPoint() prototype
-# per entry point.
-
-if opt_header:
-print "/* This file generated from vk_gen.py, don't edit directly. */\n"
-
-print "struct anv_dispatch_table {"
-print "   union {"
-print "  void *entrypoints[%d];" % len(entrypoints)
-print "  struct {"
 
+def main():
+doc = ET.parse(sys.stdin)
+entrypoints = get_entrypoints(doc, get_entrypoints_defines(doc))
+
+# Manually add CreateDmaBufImageINTEL for which we don't have an extension
+# defined.
+entrypoints.append(('VkResult', 'CreateDmaBufImageINTEL',
+'VkDevice device, ' +
+'const VkDmaBufImageCreateInfo* pCreateInfo, ' +
+'const VkAllocationCallbacks* pAllocator,' +
+'VkDeviceMemory* pMem,' +
+'VkImage* pImage', len(entrypoints),
+hash('vkCreateDmaBufImageINTEL'), None))
+
+# For outputting entrypoints.h we generate a anv_EntryPoint() prototype
+# per entry point.
+
+if opt_header:
+print "/* This file generated from vk_gen.py, don't edit directly. 
*/\n"
+
+print "struct anv_dispatch_table {"
+print "   union {"
+print "  void *entrypoints[%d];" % len(entrypoints)
+print "  struct {"
+
+for type, name, args, num, h, guard in entrypoints:
+if guard is not None:
+print "#ifdef {0}".format(guard)
+print " PFN_vk{0} {0};".format(name)
+print "#else"
+print " void *{0};".format(name)
+print "#endif"
+else:
+print " PFN_vk{0} {0};".format(name)
+print "  };\n"
+print "   };\n"
+print "};\n"
+
+print "void anv_set_dispatch_devinfo(const struct gen_device_info 
*info);\n"
+
+for type, name, args, num, h, guard in entrypoints:
+print_guard_start(guard)
+print "%s anv_%s(%s);" % (type, name, args)
+print "%s gen7_%s(%s);" % (type, name, args)
+print "%s gen75_%s(%s);" % (type, name, args)
+print "%s gen8_%s(%s);" % (type, name, args)
+print "%s gen9_%s(%s);" % (type, name, args)
+print_guard_end(guard)
+exit()
+
+
+
+print textwrap.dedent("""\
+/*
+ * Copyright ?? 2015 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 LIA

[Mesa-dev] [PATCH v3 03/15] anv: make constants capitals in anv_entrypoints_gen.py

2017-02-24 Thread Dylan Baker
Again, it's standard python style.

Signed-off-by: Dylan Baker 
---
 src/intel/vulkan/anv_entrypoints_gen.py | 38 +-
 1 file changed, 19 insertions(+), 19 deletions(-)

diff --git a/src/intel/vulkan/anv_entrypoints_gen.py 
b/src/intel/vulkan/anv_entrypoints_gen.py
index b4cead9..d3f028e 100644
--- a/src/intel/vulkan/anv_entrypoints_gen.py
+++ b/src/intel/vulkan/anv_entrypoints_gen.py
@@ -26,9 +26,9 @@ import sys
 import textwrap
 import xml.etree.ElementTree as et
 
-max_api_version = 1.0
+MAX_API_VERSION = 1.0
 
-supported_extensions = [
+SUPPORTED_EXTENSIONS = [
 'VK_KHR_get_physical_device_properties2',
 'VK_KHR_maintenance1',
 'VK_KHR_sampler_mirror_clamp_to_edge',
@@ -45,13 +45,13 @@ supported_extensions = [
 # function and a power-of-two size table. The prime numbers are determined
 # experimentally.
 
-none = 0x
-hash_size = 256
-u32_mask = 2**32 - 1
-hash_mask = hash_size - 1
+NONE = 0x
+HASH_SIZE = 256
+U32_MASK = 2**32 - 1
+HASH_MASK = HASH_SIZE - 1
 
-prime_factor = 5024183
-prime_step = 19
+PRIME_FACTOR = 5024183
+PRIME_STEP = 19
 
 opt_header = False
 opt_code = False
@@ -67,7 +67,7 @@ elif sys.argv[1] == "code":
 def hash(name):
 h = 0
 for c in name:
-h = (h * prime_factor + ord(c)) & u32_mask
+h = (h * PRIME_FACTOR + ord(c)) & U32_MASK
 
 return h
 
@@ -89,14 +89,14 @@ def get_entrypoints(doc, entrypoints_to_defines):
 enabled_commands = set()
 for feature in doc.findall('./feature'):
 assert feature.attrib['api'] == 'vulkan'
-if float(feature.attrib['number']) > max_api_version:
+if float(feature.attrib['number']) > MAX_API_VERSION:
 continue
 
 for command in feature.findall('./require/command'):
 enabled_commands.add(command.attrib['name'])
 
 for extension in doc.findall('.extensions/extension'):
-if extension.attrib['name'] not in supported_extensions:
+if extension.attrib['name'] not in SUPPORTED_EXTENSIONS:
 continue
 
 assert extension.attrib['supported'] == 'vulkan'
@@ -300,21 +300,21 @@ def main():
 # uint16_t table of entry point indices. We use 0x to indicate an entry
 # in the hash table is empty.
 
-map = [none] * hash_size
+map = [NONE] * HASH_SIZE
 collisions = [0] * 10
 for type, name, args, num, h, guard in entrypoints:
 level = 0
-while map[h & hash_mask] != none:
-h = h + prime_step
+while map[h & HASH_MASK] != NONE:
+h = h + PRIME_STEP
 level = level + 1
 if level > 9:
 collisions[9] += 1
 else:
 collisions[level] += 1
-map[h & hash_mask] = num
+map[h & HASH_MASK] = num
 
 print "/* Hash table stats:"
-print " * size %d entries" % hash_size
+print " * size %d entries" % HASH_SIZE
 print " * collisions  entries"
 for i in xrange(10):
 if i == 9:
@@ -325,10 +325,10 @@ def main():
 print " * %2d%s %4d" % (i, plus, collisions[i])
 print " */\n"
 
-print "#define none 0x%04x\n" % none
+print "#define none 0x%04x\n" % NONE
 
 print "static const uint16_t map[] = {"
-for i in xrange(0, hash_size, 8):
+for i in xrange(0, HASH_SIZE, 8):
 print "   ",
 for j in xrange(i, i + 8):
 if map[j] & 0x == 0x:
@@ -370,7 +370,7 @@ def main():
 
return anv_resolve_entrypoint(devinfo, i);
 }
-""") % (prime_factor, prime_step, hash_mask)
+""") % (PRIME_FACTOR, PRIME_STEP, HASH_MASK)
 
 
 if __name__ == '__main__':
-- 
git-series 0.9.1
___
mesa-dev mailing list
mesa-dev@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/mesa-dev


[Mesa-dev] [PATCH v3 04/15] anv: don't pass xmlfile via stdin anv_entrypoints_gen.py

2017-02-24 Thread Dylan Baker
It's slow, and has the potential for encoding issues.

v2: - pass xml file location via argument
- update Android.mk

Signed-off-by: Dylan Baker 
---
 src/intel/vulkan/Android.mk |  4 ++--
 src/intel/vulkan/Makefile.am|  6 ++
 src/intel/vulkan/anv_entrypoints_gen.py | 19 +--
 3 files changed, 13 insertions(+), 16 deletions(-)

diff --git a/src/intel/vulkan/Android.mk b/src/intel/vulkan/Android.mk
index 1e53970..9dabf1c 100644
--- a/src/intel/vulkan/Android.mk
+++ b/src/intel/vulkan/Android.mk
@@ -61,7 +61,7 @@ $(intermediates)/dummy.c:
$(hide) touch $@
 
 $(intermediates)/anv_entrypoints.h:
-   $(hide) cat $(MESA_TOP)/src/vulkan/registry/vk.xml | 
$(VK_ENTRYPOINTS_SCRIPT) header > $@
+   $(VK_ENTRYPOINTS_SCRIPT) header --xml 
$(MESA_TOP)/src/vulkan/registry/vk.xml > $@
 
 LOCAL_EXPORT_C_INCLUDE_DIRS := \
 $(intermediates)
@@ -177,7 +177,7 @@ LOCAL_WHOLE_STATIC_LIBRARIES := libmesa_anv_entrypoints 
libmesa_genxml
 LOCAL_GENERATED_SOURCES += $(intermediates)/anv_entrypoints.c
 
 $(intermediates)/anv_entrypoints.c:
-   $(hide) cat $(MESA_TOP)/src/vulkan/registry/vk.xml | 
$(VK_ENTRYPOINTS_SCRIPT) code > $@
+   $(VK_ENTRYPOINTS_SCRIPT) code --xml 
$(MESA_TOP)/src/vulkan/registry/vk.xml > $@
 
 LOCAL_SHARED_LIBRARIES := libdrm_intel
 
diff --git a/src/intel/vulkan/Makefile.am b/src/intel/vulkan/Makefile.am
index 449188f..565559c 100644
--- a/src/intel/vulkan/Makefile.am
+++ b/src/intel/vulkan/Makefile.am
@@ -146,12 +146,10 @@ libvulkan_intel_la_SOURCES = $(VULKAN_GEM_FILES)
 vulkan_api_xml = $(top_srcdir)/src/vulkan/registry/vk.xml
 
 anv_entrypoints.h : anv_entrypoints_gen.py $(vulkan_api_xml)
-   $(AM_V_GEN) cat $(vulkan_api_xml) |\
-   $(PYTHON2) $(srcdir)/anv_entrypoints_gen.py header > $@
+   $(AM_V_GEN)$(PYTHON2) $(srcdir)/anv_entrypoints_gen.py header --xml 
$(vulkan_api_xml) > $@
 
 anv_entrypoints.c : anv_entrypoints_gen.py $(vulkan_api_xml)
-   $(AM_V_GEN) cat $(vulkan_api_xml) |\
-   $(PYTHON2) $(srcdir)/anv_entrypoints_gen.py code > $@
+   $(AM_V_GEN)$(PYTHON2) $(srcdir)/anv_entrypoints_gen.py code --xml 
$(vulkan_api_xml) > $@
 
 BUILT_SOURCES = $(VULKAN_GENERATED_FILES)
 CLEANFILES = $(BUILT_SOURCES) dev_icd.json intel_icd.@host_cpu@.json
diff --git a/src/intel/vulkan/anv_entrypoints_gen.py 
b/src/intel/vulkan/anv_entrypoints_gen.py
index d3f028e..ea15065 100644
--- a/src/intel/vulkan/anv_entrypoints_gen.py
+++ b/src/intel/vulkan/anv_entrypoints_gen.py
@@ -22,7 +22,7 @@
 # IN THE SOFTWARE.
 #
 
-import sys
+import argparse
 import textwrap
 import xml.etree.ElementTree as et
 
@@ -56,13 +56,6 @@ PRIME_STEP = 19
 opt_header = False
 opt_code = False
 
-if sys.argv[1] == "header":
-opt_header = True
-sys.argv.pop()
-elif sys.argv[1] == "code":
-opt_code = True
-sys.argv.pop()
-
 
 def hash(name):
 h = 0
@@ -138,7 +131,13 @@ def get_entrypoints_defines(doc):
 
 
 def main():
-doc = et.parse(sys.stdin)
+parser = argparse.ArgumentParser()
+parser.add_argument('target', choices=['header', 'code'],
+help='Which file to generate.')
+parser.add_argument('--xml', help='Vulkan API XML file.')
+args = parser.parse_args()
+
+doc = et.parse(args.xml)
 entrypoints = get_entrypoints(doc, get_entrypoints_defines(doc))
 
 # Manually add CreateDmaBufImageINTEL for which we don't have an extension
@@ -154,7 +153,7 @@ def main():
 # For outputting entrypoints.h we generate a anv_EntryPoint() prototype
 # per entry point.
 
-if opt_header:
+if args.target == 'header':
 print "/* This file generated from vk_gen.py, don't edit directly. 
*/\n"
 
 print "struct anv_dispatch_table {"
-- 
git-series 0.9.1
___
mesa-dev mailing list
mesa-dev@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/mesa-dev


[Mesa-dev] [PATCH v3 02/15] anv: Use python style in anv_entrypoints_gen.py

2017-02-24 Thread Dylan Baker
These are all fairly small cleanups/tweaks that don't really deserve
their own patch.

- Prefer comprehensions to map() and filter(), since they're faster
- replace unused variables with _
- Use 4 spaces of indent
- drop semicolons from the end of lines
- Don't use parens around if conditions
- don't put spaces around brackets
- don't import modules as caps (ET -> et)
- Use docstrings instead of comments

v2: - Replace comprehensions with multiplication

Signed-off-by: Dylan Baker 
---
 src/intel/vulkan/anv_entrypoints_gen.py | 63 ++
 1 file changed, 34 insertions(+), 29 deletions(-)

diff --git a/src/intel/vulkan/anv_entrypoints_gen.py 
b/src/intel/vulkan/anv_entrypoints_gen.py
index 3f7a1ce..b4cead9 100644
--- a/src/intel/vulkan/anv_entrypoints_gen.py
+++ b/src/intel/vulkan/anv_entrypoints_gen.py
@@ -24,20 +24,20 @@
 
 import sys
 import textwrap
-import xml.etree.ElementTree as ET
+import xml.etree.ElementTree as et
 
 max_api_version = 1.0
 
 supported_extensions = [
-   'VK_KHR_get_physical_device_properties2',
-   'VK_KHR_maintenance1',
-   'VK_KHR_sampler_mirror_clamp_to_edge',
-   'VK_KHR_shader_draw_parameters',
-   'VK_KHR_surface',
-   'VK_KHR_swapchain',
-   'VK_KHR_wayland_surface',
-   'VK_KHR_xcb_surface',
-   'VK_KHR_xlib_surface',
+'VK_KHR_get_physical_device_properties2',
+'VK_KHR_maintenance1',
+'VK_KHR_sampler_mirror_clamp_to_edge',
+'VK_KHR_shader_draw_parameters',
+'VK_KHR_surface',
+'VK_KHR_swapchain',
+'VK_KHR_wayland_surface',
+'VK_KHR_xcb_surface',
+'VK_KHR_xlib_surface',
 ]
 
 # We generate a static hash table for entry point lookup
@@ -53,33 +53,37 @@ hash_mask = hash_size - 1
 prime_factor = 5024183
 prime_step = 19
 
+opt_header = False
+opt_code = False
+
+if sys.argv[1] == "header":
+opt_header = True
+sys.argv.pop()
+elif sys.argv[1] == "code":
+opt_code = True
+sys.argv.pop()
+
+
 def hash(name):
-h = 0;
+h = 0
 for c in name:
 h = (h * prime_factor + ord(c)) & u32_mask
 
 return h
 
+
 def print_guard_start(guard):
 if guard is not None:
 print "#ifdef {0}".format(guard)
 
+
 def print_guard_end(guard):
 if guard is not None:
 print "#endif // {0}".format(guard)
 
-opt_header = False
-opt_code = False
 
-if (sys.argv[1] == "header"):
-opt_header = True
-sys.argv.pop()
-elif (sys.argv[1] == "code"):
-opt_code = True
-sys.argv.pop()
-
-# Extract the entry points from the registry
 def get_entrypoints(doc, entrypoints_to_defines):
+"""Extract the entry points from the registry."""
 entrypoints = []
 
 enabled_commands = set()
@@ -108,7 +112,7 @@ def get_entrypoints(doc, entrypoints_to_defines):
 continue
 
 shortname = fullname[2:]
-params = map(lambda p: "".join(p.itertext()), 
command.findall('./param'))
+params = (''.join(p.itertext()) for p in command.findall('./param'))
 params = ', '.join(params)
 if fullname in entrypoints_to_defines:
 guard = entrypoints_to_defines[fullname]
@@ -119,8 +123,9 @@ def get_entrypoints(doc, entrypoints_to_defines):
 
 return entrypoints
 
-# Maps entry points to extension defines
+
 def get_entrypoints_defines(doc):
+"""Maps entry points to extension defines."""
 entrypoints_to_defines = {}
 extensions = doc.findall('./extensions/extension')
 for extension in extensions:
@@ -133,7 +138,7 @@ def get_entrypoints_defines(doc):
 
 
 def main():
-doc = ET.parse(sys.stdin)
+doc = et.parse(sys.stdin)
 entrypoints = get_entrypoints(doc, get_entrypoints_defines(doc))
 
 # Manually add CreateDmaBufImageINTEL for which we don't have an extension
@@ -225,7 +230,7 @@ def main():
 static const char strings[] =""")
 
 offsets = []
-i = 0;
+i = 0
 for type, name, args, num, h, guard in entrypoints:
 print "   \"vk%s\\0\"" % name
 offsets.append(i)
@@ -247,7 +252,7 @@ def main():
  */
 """)
 
-for layer in [ "anv", "gen7", "gen75", "gen8", "gen9" ]:
+for layer in ["anv", "gen7", "gen75", "gen8", "gen9"]:
 for type, name, args, num, h, guard in entrypoints:
 print_guard_start(guard)
 print "%s %s_%s(%s) __attribute__ ((weak));" % (type, layer, name, 
args)
@@ -295,8 +300,8 @@ def main():
 # uint16_t table of entry point indices. We use 0x to indicate an entry
 # in the hash table is empty.
 
-map = [none for f in xrange(hash_size)]
-collisions = [0 for f in xrange(10)]
+map = [none] * hash_size
+collisions = [0] * 10
 for type, name, args, num, h, guard in entrypoints:
 level = 0
 while map[h & hash_mask] != none:
@@ -312,7 +317,7 @@ def main():
 print " * size %d entries" % hash_size
 print " * collisions  entries"
 for i in xrange(10):
-if (i == 9):
+if i == 9:
 plus = "+"
 else:
 plus = " "
-- 
git-series 0.9.1
__

Re: [Mesa-dev] [PATCH] radv/ac: enable loop unrolling.

2017-02-24 Thread Matt Arsenault

> On Feb 24, 2017, at 01:45, Marek Olšák  wrote:
> 
> The main requirement is that if there is indirect indexing inside a
> loop, we always want to unroll the whole loop to get rid of the
> indexing, which can decrease scratch usage.
> 
> Marek
We boost the unroll thresholds when there is private memory indexed by the 
induction variable. See AMDGPUTTIImpl::getUnrollingPreferences___
mesa-dev mailing list
mesa-dev@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/mesa-dev


Re: [Mesa-dev] X test suite regression due to gallivm change

2017-02-24 Thread Rob Clark
On Fri, Feb 24, 2017 at 12:32 PM, Jose Fonseca  wrote:
> On 23/02/17 21:54, Adam Jackson wrote:
>>
>> On Thu, 2017-02-23 at 21:59 +0100, Roland Scheidegger wrote:
>>
>>> So, what does the failing test do?
>>
>>
>> Not much, curiously. There are five that fail and they're all fairly
>> trivial, although the xts harness makes that hard to see.
>>
>> XClearArea/6 and XClearWindow/4 set the window background pixmap to
>> None and calls XClearArea. This should not change any pixels;
>> apparently it does.
>>
>> XClearArea/7 and XClearWindow/5 create a parent window, then a child,
>> sets the parent bg to None, the child to ParentRelative, and clears the
>> child. Again, this should not change anything, but does.
>>
>> XCopyArea/1 creates two windows, tiles the background of the first one
>> (equivalent to ClearWindow), copies from one window to the other, and
>> verifies that the second one has the right content.
>>
>> The first four there are a little strange because, in principle, the
>> thing they're testing is that no rendering happens. Presumably what's
>> being measured is that some _other_ rendering prior to the action under
>> test is being done incorrectly. The CopyArea test is probably closest
>> to the root cause. I'll drill down a bit on exactly what that turns
>> into in terms of GL draws.
>>
>> - ajax
>>
>
> I'm not sure if apitrace w/ glamor is practical / feasible, but being able
> to repro the issue outside X would be great.
>

I'm sure Adam knows this already, but for the record (and so I can
find it again 3yrs from now when I need to):

 MESA_EXTENSION_OVERRIDE="-GL_ARB_buffer_storage" apitrace trace
/usr/bin/Xephyr -glamor :1 -screen 1024x768

works like a charm.. I've used it to debug bugs that glamor triggers before

BR,
-R


>
> Another tack on this issue would be to revert parts of
> 320d1191c61a0a82444605c12e5c4b2ee0b241eb separately and see which
> trigger/fix the problem.
>
> In particular:
> - src/gallium/drivers/llvmpipe/lp_bld_interp.c for interpolation
> - src/gallium/auxiliary/draw/draw_llvm.c for viewport / clipping
> - src/gallium/auxiliary/gallivm/lp_bld_tgsi_action.c for TGSI translation
>
> I tried to use fmad everywhere I could, but it's possible a couple or so is
> simply a bad idea.
>
>
> Jose
>
> ___
> 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] X test suite regression due to gallivm change

2017-02-24 Thread Jose Fonseca

On 23/02/17 21:54, Adam Jackson wrote:

On Thu, 2017-02-23 at 21:59 +0100, Roland Scheidegger wrote:


So, what does the failing test do?


Not much, curiously. There are five that fail and they're all fairly
trivial, although the xts harness makes that hard to see.

XClearArea/6 and XClearWindow/4 set the window background pixmap to
None and calls XClearArea. This should not change any pixels;
apparently it does.

XClearArea/7 and XClearWindow/5 create a parent window, then a child,
sets the parent bg to None, the child to ParentRelative, and clears the
child. Again, this should not change anything, but does.

XCopyArea/1 creates two windows, tiles the background of the first one
(equivalent to ClearWindow), copies from one window to the other, and
verifies that the second one has the right content.

The first four there are a little strange because, in principle, the
thing they're testing is that no rendering happens. Presumably what's
being measured is that some _other_ rendering prior to the action under
test is being done incorrectly. The CopyArea test is probably closest
to the root cause. I'll drill down a bit on exactly what that turns
into in terms of GL draws.

- ajax



I'm not sure if apitrace w/ glamor is practical / feasible, but being 
able to repro the issue outside X would be great.



Another tack on this issue would be to revert parts of 
320d1191c61a0a82444605c12e5c4b2ee0b241eb separately and see which 
trigger/fix the problem.


In particular:
- src/gallium/drivers/llvmpipe/lp_bld_interp.c for interpolation
- src/gallium/auxiliary/draw/draw_llvm.c for viewport / clipping
- src/gallium/auxiliary/gallivm/lp_bld_tgsi_action.c for TGSI translation

I tried to use fmad everywhere I could, but it's possible a couple or so 
is simply a bad idea.



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


Re: [Mesa-dev] [PATCH 1/5] util/sha1: add non-typedef name for the SHA1_CTX struct

2017-02-24 Thread Emil Velikov
Humble ping anyone ?

-Emil

On 24 January 2017 at 21:21, Emil Velikov  wrote:
> From: Emil Velikov 
>
> Using typedef(s) is not always the answer and makes it harder for people
> to do clever (or one might call nasty) things with the code.
>
> Add a struct name which we will use with follow-up commit.
>
> Signed-off-by: Emil Velikov 
> ---
>  src/util/sha1/README | 3 +++
>  src/util/sha1/sha1.h | 2 +-
>  2 files changed, 4 insertions(+), 1 deletion(-)
>
> diff --git a/src/util/sha1/README b/src/util/sha1/README
> index f13baf9d1a..f30acf984e 100644
> --- a/src/util/sha1/README
> +++ b/src/util/sha1/README
> @@ -57,3 +57,6 @@ Upstream status: TBD (N/A ?)
>   - Manually expand __BEGIN_DECLS/__END_DECLS and make sure that they include
>  the struct declaration.
>  Upstream status: TBD
> +
> + - Add non-typedef struct name.
> +Upstream status: TBD
> diff --git a/src/util/sha1/sha1.h b/src/util/sha1/sha1.h
> index 243481a98e..029a0ae87f 100644
> --- a/src/util/sha1/sha1.h
> +++ b/src/util/sha1/sha1.h
> @@ -20,7 +20,7 @@
>  extern "C" {
>  #endif
>
> -typedef struct {
> +typedef struct _SHA1_CTX {
>  uint32_t state[5];
>  uint64_t count;
>  uint8_t buffer[SHA1_BLOCK_LENGTH];
> --
> 2.11.0
>
___
mesa-dev mailing list
mesa-dev@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/mesa-dev


Re: [Mesa-dev] [PATCH] util/disk_cache: Use backward compatible st_mtime.

2017-02-24 Thread Nicolai Hähnle

On 23.02.2017 23:29, Vinson Lee wrote:

Fix Mac OS X build error.

  CC   libmesautil_la-disk_cache.lo
In file included from disk_cache.c:46:
./disk_cache.h:57:20: error: no member named 'st_mtim' in 'struct stat'
   *timestamp = st.st_mtim.tv_sec;
~~ ^

Bugzilla: https://bugs.freedesktop.org/show_bug.cgi?id=99918
Fixes: 207e3a6e4b ("util/radv: move *_get_function_timestamp() to utils")
Signed-off-by: Vinson Lee 


Reviewed-by: Nicolai Hähnle 


---
 src/util/disk_cache.h | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/src/util/disk_cache.h b/src/util/disk_cache.h
index 7f4da809cc..b7c0df25dd 100644
--- a/src/util/disk_cache.h
+++ b/src/util/disk_cache.h
@@ -54,7 +54,7 @@ disk_cache_get_function_timestamp(void *ptr, uint32_t* 
timestamp)
if (stat(info.dli_fname, &st)) {
   return false;
}
-   *timestamp = st.st_mtim.tv_sec;
+   *timestamp = st.st_mtime;
return true;
 #else
return false;



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


Re: [Mesa-dev] [PATCH mesa v2] glx: add GLXdispatchIndex sort check

2017-02-24 Thread Eric Engestrom
On Friday, 2017-02-24 16:46:36 +, Emil Velikov wrote:
> On 24 February 2017 at 14:58, Eric Engestrom  
> wrote:
> > On Thursday, 2017-02-23 16:07:36 +, Emil Velikov wrote:
> >> You're a star Eric, thank you !
> >>
> >> On 22 February 2017 at 11:24, Eric Engestrom  
> >> wrote:
> >> > Signed-off-by: Eric Engestrom 
> >> > ---
> >> > v2: make sure the list is in the order C's strcmp uses (Ilia)
> >> > Ilia: I used LC_ALL instead of LANG, as it takes precedence
> >> >   (ie. LANG=C in this script would be overridden by
> >> >   LC_ALL=en_US in the environment).
> >> Personally I'm safe even without the LC_ALL bit, but it seems like a good 
> >> idea.
> >>
> >> Perhaps we want that for the EGL test as well ?
> >
> > Of course, I just didn't want to send a bunch of versions of each until
> > something was accepted by everyone.
> >
> >> In both cases we really want to set srcdir, such that 
> >> ./dispatch-index-check and
> >> ../some/crazy/path/to/dispatch-index-check also work.
> >>
> >> Perhaps reuse the autogen.sh magic ?
> >
> > Sure, I could, but I'm not sure I see the point? Are these tests ever
> > run not through `make check` ?
> > And if someone does do that, surely they can be expected to know they
> > need to set $srcdir correctly?
> >
> The other tests we have use srcdir, if available, and fallback appropriately.
> Modulo other other bugs of course ;-)

I have to admit I didn't even look at the other tests, but you're right,
if the other tests do it then it should be done everywhere :)

I'll update the two tests I just introduced to match this.

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


Re: [Mesa-dev] [PATCH 4/4] glsl/tests/optimization-test: correctly manage srcdir/pwd and co

2017-02-24 Thread Emil Velikov
On 24 February 2017 at 16:13, Eric Engestrom  wrote:
> On Thursday, 2017-02-23 16:43:10 +, Emil Velikov wrote:
>> From: Emil Velikov 
>>
>> At the moment things are completely bonkers (as can be seen from last
>> commit). Regardless if we run the test as part of "make check" or
>> standalone the most of the paths are wrong.
>>
>> Untangle things by issuing "cd `dirname "$0`" and working from there.
>> Otherwise it's nearly impossible to consider all the permutations one
>> can use while running outside of "make check"
>>
>> Clearly document the variables and the intended behaviour.
>>
>> Signed-off-by: Emil Velikov 
>> ---
>> We really want to cut down all the crazy design here. Dylan ?
>>
>> sh script which executes a python one, with the latter creating a bunch
>> of sh ones and hardcoding binary location. Then call the generated sh
>> scripts, to create the tested OP files. Now compare the expected vs the
>> tested via another python script which decodes [in to a temporary file]
>> and calls "diff" to compare them.
>> ---
>>  src/compiler/glsl/tests/optimization-test | 22 +-
>>  1 file changed, 17 insertions(+), 5 deletions(-)
>>
>> diff --git a/src/compiler/glsl/tests/optimization-test 
>> b/src/compiler/glsl/tests/optimization-test
>> index d84b83cfaa..e851e13bfb 100755
>> --- a/src/compiler/glsl/tests/optimization-test
>> +++ b/src/compiler/glsl/tests/optimization-test
>> @@ -1,10 +1,18 @@
>>  #!/usr/bin/env bash
>>
>> -if [ ! -z "$srcdir" ]; then
>> -   compare_ir=`pwd`/tests/compare_ir
>> -else
>> -   compare_ir=./compare_ir
>> +# The srcdir variable must point to the location where the Makefile.am or
>> +# Makefile.glsl.am in particular is. Even if we execute this test manually.
>> +
>> +if [ -z "$srcdir" ]; then
>> +   srcdir=./../../
>> +
>> +# In the manual invokation case, we must CD otherwise we cannot manage 
>> all
>> +# the permutations of our scripts which calls a script to create a 
>> script
>> +# then execute the script design.
>> +cd `dirname "$0"`
>> +
>>  fi
>> +compare_ir=$srcdir/glsl/tests/compare_ir
>
> Like I said in the other email, I think if someone wants to run the
> checks manually, they can be expected to set $srcdir correctly.
> Bailing out when it's unset would be good enough IMHO.
>
Based on git log, the lack of srcdir is explicitly required/wanted so
I opted to keep it.

>>
>>  if [ -z "$PYTHON2" ]; then
>>  PYTHON2=python2
>> @@ -20,10 +28,13 @@ total=0
>>  pass=0
>>  has_tests=0
>>
>> +# Store our location before we start diving into subdirectories.
>> +ORIGDIR=`pwd`
>
> How about pushd/popd instead?
>
They're missing (yes I know) from sh. Rather keep it compliant,
considering how trivial the WA is

>>  echo "==   Generating tests  =="
>> -for dir in tests/*/; do
>> +for dir in $srcdir/glsl/tests/*/; do
>>  if [ -e "${dir}create_test_cases.py" ]; then
>>  cd $dir;
>> +echo found
>
> Guessing this line can go? :)
>
Oops, yes it should.

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


Re: [Mesa-dev] [PATCH 1/4] glsl/tests/optimisation-test: make sure that $PYTHON2 is set/available

2017-02-24 Thread Emil Velikov
On 24 February 2017 at 15:34, Eric Engestrom  wrote:
> On Thursday, 2017-02-23 16:43:07 +, Emil Velikov wrote:
>> From: Emil Velikov 
>>
>> Otherwise we'll fail when invoking the script outside of "make check"
>>
>> Signed-off-by: Emil Velikov 
>> ---
>>  src/compiler/glsl/tests/optimization-test | 10 ++
>>  1 file changed, 10 insertions(+)
>>
>> diff --git a/src/compiler/glsl/tests/optimization-test 
>> b/src/compiler/glsl/tests/optimization-test
>> index 26a51be698..7ccbb4467d 100755
>> --- a/src/compiler/glsl/tests/optimization-test
>> +++ b/src/compiler/glsl/tests/optimization-test
>> @@ -6,6 +6,16 @@ else
>> compare_ir=./compare_ir
>>  fi
>>
>> +if [ -z "$PYTHON2" ]; then
>> +PYTHON2=python2
>> +fi
>> +
>> +which $PYTHON2 >/dev/null
>> +if [ "x$?" != x0 ]; then
>
> You want a numerical comparison here (`[ $? -ne 0 ]`), not a string
> comparison, and you could also simplify it as:
> if ! which $PYTHON2 >/dev/null; then
Similar hunk in src/Makefile.am did fail on zsh, so I opted for the split here.
Need to track down exact reason behind it, but the series became quite
large even w/o it ;-)

Barring strong preference on the last suggestion I'll stick with -ne 0.

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


Re: [Mesa-dev] [PATCH 3/4] glsl/tests/optimization-test: error out if we fail to generate any tests

2017-02-24 Thread Emil Velikov
On 24 February 2017 at 15:58, Eric Engestrom  wrote:
> On Thursday, 2017-02-23 16:43:09 +, Emil Velikov wrote:
>> From: Emil Velikov 
>>
>> Signed-off-by: Emil Velikov 
>> ---
>>  src/compiler/glsl/tests/optimization-test | 13 -
>>  1 file changed, 12 insertions(+), 1 deletion(-)
>>
>> diff --git a/src/compiler/glsl/tests/optimization-test 
>> b/src/compiler/glsl/tests/optimization-test
>> index ec0f09b125..d84b83cfaa 100755
>> --- a/src/compiler/glsl/tests/optimization-test
>> +++ b/src/compiler/glsl/tests/optimization-test
>> @@ -18,15 +18,26 @@ fi
>>
>>  total=0
>>  pass=0
>> +has_tests=0
>>
>>  echo "==   Generating tests  =="
>>  for dir in tests/*/; do
>>  if [ -e "${dir}create_test_cases.py" ]; then
>> -cd $dir; $PYTHON2 create_test_cases.py; cd ..
>> +cd $dir;
>> +$PYTHON2 create_test_cases.py
>> +if [ "x$?" = x0 ]; then
>
> if $PYTHON2 create_test_cases.py; then
> ...
Similar to the if which ... > ; then case, I'm not sure if these will
fly on zsh/other shell(s).

Might if I opt for -ne 0 for now ?
Emil
___
mesa-dev mailing list
mesa-dev@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/mesa-dev


Re: [Mesa-dev] [PATCH 2/4] glsl/tests/optimisation-test: ensure that compare_ir is available

2017-02-24 Thread Emil Velikov
On 24 February 2017 at 15:42, Eric Engestrom  wrote:
> On Thursday, 2017-02-23 16:43:08 +, Emil Velikov wrote:
>> From: Emil Velikov 
>>
>> Bail out early if the script is not where we expect it to be.
>>
>> Signed-off-by: Emil Velikov 
>> ---
>>  src/compiler/glsl/tests/optimization-test | 5 +
>>  1 file changed, 5 insertions(+)
>>
>> diff --git a/src/compiler/glsl/tests/optimization-test 
>> b/src/compiler/glsl/tests/optimization-test
>> index 7ccbb4467d..ec0f09b125 100755
>> --- a/src/compiler/glsl/tests/optimization-test
>> +++ b/src/compiler/glsl/tests/optimization-test
>> @@ -27,6 +27,11 @@ for dir in tests/*/; do
>>  echo "$dir"
>>  done
>>
>> +if [ ! -e "$compare_ir" ]; then
>
> `-f` to make sure it's a file (not a dir)?
> Maybe even `-x` to make sure it can be executed (or just `-r` since it's
> actually read by $PYTHON2, not directly executed, so it doesn't *need*
> the executable bit).
>
No -x thank you. Barring any objections/other suggestions I'll use -r.

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


Re: [Mesa-dev] [PATCH mesa v2] glx: add GLXdispatchIndex sort check

2017-02-24 Thread Emil Velikov
On 24 February 2017 at 14:58, Eric Engestrom  wrote:
> On Thursday, 2017-02-23 16:07:36 +, Emil Velikov wrote:
>> You're a star Eric, thank you !
>>
>> On 22 February 2017 at 11:24, Eric Engestrom  
>> wrote:
>> > Signed-off-by: Eric Engestrom 
>> > ---
>> > v2: make sure the list is in the order C's strcmp uses (Ilia)
>> > Ilia: I used LC_ALL instead of LANG, as it takes precedence
>> >   (ie. LANG=C in this script would be overridden by
>> >   LC_ALL=en_US in the environment).
>> Personally I'm safe even without the LC_ALL bit, but it seems like a good 
>> idea.
>>
>> Perhaps we want that for the EGL test as well ?
>
> Of course, I just didn't want to send a bunch of versions of each until
> something was accepted by everyone.
>
>> In both cases we really want to set srcdir, such that ./dispatch-index-check 
>> and
>> ../some/crazy/path/to/dispatch-index-check also work.
>>
>> Perhaps reuse the autogen.sh magic ?
>
> Sure, I could, but I'm not sure I see the point? Are these tests ever
> run not through `make check` ?
> And if someone does do that, surely they can be expected to know they
> need to set $srcdir correctly?
>
The other tests we have use srcdir, if available, and fallback appropriately.
Modulo other other bugs of course ;-)

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


[Mesa-dev] [PATCH] mesa: Fix performance query id check

2017-02-24 Thread Robert Bragg
In queryid_valid() index is unsigned so checking if it is less
than zero is useless. On queryid_to_index() is comment
saying 0 is reserved to be invalid thus rule it out.

This is a v2 of a fix for an issue identified by Juha-Pekka (thanks)
and the commit message is gratuitously stolen.

Cc: Juha-Pekka Heikkila 
Signed-off-by: Robert Bragg 
---
 src/mesa/main/performance_query.c | 8 ++--
 1 file changed, 6 insertions(+), 2 deletions(-)

diff --git a/src/mesa/main/performance_query.c 
b/src/mesa/main/performance_query.c
index aa103516a5..56f6a7da8b 100644
--- a/src/mesa/main/performance_query.c
+++ b/src/mesa/main/performance_query.c
@@ -90,8 +90,12 @@ index_to_queryid(unsigned index)
 static inline bool
 queryid_valid(const struct gl_context *ctx, unsigned numQueries, GLuint 
queryid)
 {
-   GLuint index = queryid_to_index(queryid);
-   return index >= 0 && index < numQueries;
+   /* The GL_INTEL_performance_query spec says:
+*
+*  "Performance counter ids values start with 1. Performance counter id 0
+*  is reserved as an invalid counter."
+*/
+   return queryid != 0 && queryid_to_index(queryid) < numQueries;
 }
 
 static inline GLuint
-- 
2.11.1

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


Re: [Mesa-dev] [PATCH v2 6/14] anv: convert header generation in anv_entrypoints_gen.py to mako

2017-02-24 Thread Dylan Baker
Quoting Emil Velikov (2017-02-24 05:57:24)
> On 24 February 2017 at 10:28, Eric Engestrom  
> wrote:
> > On Thursday, 2017-02-23 10:46:19 -0800, Dylan Baker wrote:
> >> This produces an identical file except for whitespace.
> >>
> >> Signed-off-by: Dylan Baker 
> >> ---
> >>  src/intel/vulkan/anv_entrypoints_gen.py | 75 ++
> >>  1 file changed, 41 insertions(+), 34 deletions(-)
> >>
> >> diff --git a/src/intel/vulkan/anv_entrypoints_gen.py 
> >> b/src/intel/vulkan/anv_entrypoints_gen.py
> >> index 772f3e6..7493fb6 100644
> >> --- a/src/intel/vulkan/anv_entrypoints_gen.py
> >> +++ b/src/intel/vulkan/anv_entrypoints_gen.py
> >> @@ -26,6 +26,8 @@ import argparse
> >>  import textwrap
> >>  import xml.etree.ElementTree as et
> >>
> >> +from mako.template import Template
> >> +
> >>  MAX_API_VERSION = 1.0
> >>
> >>  SUPPORTED_EXTENSIONS = [
> >> @@ -45,6 +47,44 @@ SUPPORTED_EXTENSIONS = [
> >>  # function and a power-of-two size table. The prime numbers are determined
> >>  # experimentally.
> >>
> >> +TEMPLATE_H = Template(textwrap.dedent("""\
> >> +/* This file generated from vk_gen.py, don't edit directly. */
> >
> > s/vk_gen.py/anv_entrypoints_gen.py/ :)
> >
> This seems to be rather common across projects. Just an idea -
> sys.argv[0] should work right ?

actually, python has a __file__ constant that I usually use for this. I'll add a
patch.

> 
> IMHO, feel free to address that whenever you prefer.
> Emil


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


Re: [Mesa-dev] [PATCH v2] nir: delete magic number

2017-02-24 Thread tournier.elie
Ping.


On 13 February 2017 at 10:17, tournier.elie  wrote:

> Whoops I answer 2 times.
>
> Would the comment bellow be appropriate?
>
> This limit is chosen fairly arbitrarily.
> GLSL IR max iteration is 32 instructions. (Multiply counting nodes and
> magic number 5).
> But there is no 1:1 mapping between GLSL IR and NIR so 25 was picked
> because
> it seemed to give about the same results. Around 5 instructions per node.
> But some loops that would unroll with GLSL IR fail to unroll if we set
> this to 25 so we set it to 26.
>
> Elie
>
>
> On 13 February 2017 at 01:00, tournier.elie 
> wrote:
>
>>
>> On 9 February 2017 at 02:48, Timothy Arceri 
>> wrote:
>>
>> > On Wed, 8 Feb 2017 15:54:46 -0800
>> > Jason Ekstrand  wrote:
>> >
>> > > On Wed, Feb 8, 2017 at 2:20 PM, Elie Tournier
>> > >  wrote:
>> > >
>> > > > Signed-off-by: Elie Tournier 
>> > > > ---
>> > > >  src/compiler/nir/nir_opt_loop_unroll.c | 10 +-
>> > > >  1 file changed, 9 insertions(+), 1 deletion(-)
>> > > >
>> > > > diff --git a/src/compiler/nir/nir_opt_loop_unroll.c
>> > > > b/src/compiler/nir/nir_opt_loop_unroll.c
>> > > > index 37cbced43d..035a030239 100644
>> > > > --- a/src/compiler/nir/nir_opt_loop_unroll.c
>> > > > +++ b/src/compiler/nir/nir_opt_loop_unroll.c
>> > > > @@ -26,6 +26,14 @@
>> > > >  #include "nir_control_flow.h"
>> > > >  #include "nir_loop_analyze.h"
>> > > >
>> > > > +
>> > > > +/* This limit is chosen fairly arbitrarily.  The GLSL IR limit is
>> > > > 25.
>> > > > + * However, due to slight differences in the way the two IRs count
>> > > > + * instructions, some loops that would unroll with GLSL IR fail to
>> > > > unroll
>> > > > + * if we set this to 25 so we set it to 26.
>> > > >
>> > >
>> > > Ok, I lied in my comment.  It's not 25, it's 32.  Tim, can you
>> > > explain the discrepancy?
>> > > --Jason
>> >
>> > Max iteration is 32 this is number of instructions, in GLSL IR it was
>> > counting nodes and the magic number was 5. There is no 1:1 mapping 25
>> > was picked because it seemed to give about the same results. Around 5
>> > instructions per node.
>> >
>> >
>> So to resume. Is this comment correct for you?
>>
>> This limit is chosen fairly arbitrarily.
>> GLSL IR max iteration is 32 instructions. (Counting nodes by magic number
>> 5).
>> But there is no 1:1 mapping between GLSL IR and NIR so 25 was picked
>> because
>> it seemed to give about the same results. Around 5 instructions per node.
>> But some loops that would unroll with GLSL IR fail to unroll if we set
>> this to 25 so we set it to 26.
>>
>> >
>> > >
>> > > > + */
>> > > > +#define LOOP_UNROLL_LIMIT 26
>> > > > +
>> > > >  /* Prepare this loop for unrolling by first converting to lcssa
>> > > > and then
>> > > >   * converting the phis from the loops first block and the block
>> > > > that follows
>> > > >   * the loop into regs.  Partially converting out of SSA allows us
>> > > > to unroll
>> > > > @@ -460,7 +468,7 @@ is_loop_small_enough_to_unroll(nir_shader
>> > > > *shader, nir_loop_info *li)
>> > > >return true;
>> > > >
>> > > > bool loop_not_too_large =
>> > > > -  li->num_instructions * li->trip_count <= max_iter * 26;
>> > > > +  li->num_instructions * li->trip_count <= max_iter *
>> > > > LOOP_UNROLL_LIMIT;
>> > > >
>> > > > return loop_not_too_large;
>> > > >  }
>> > > > --
>> > > > 2.11.0
>> > > >
>> > > >
>> >
>> >
>>
>>
>> On 9 February 2017 at 02:48, Timothy Arceri 
>> wrote:
>>
>>> On Wed, 8 Feb 2017 15:54:46 -0800
>>> Jason Ekstrand  wrote:
>>>
>>> > On Wed, Feb 8, 2017 at 2:20 PM, Elie Tournier
>>> >  wrote:
>>> >
>>> > > Signed-off-by: Elie Tournier 
>>> > > ---
>>> > >  src/compiler/nir/nir_opt_loop_unroll.c | 10 +-
>>> > >  1 file changed, 9 insertions(+), 1 deletion(-)
>>> > >
>>> > > diff --git a/src/compiler/nir/nir_opt_loop_unroll.c
>>> > > b/src/compiler/nir/nir_opt_loop_unroll.c
>>> > > index 37cbced43d..035a030239 100644
>>> > > --- a/src/compiler/nir/nir_opt_loop_unroll.c
>>> > > +++ b/src/compiler/nir/nir_opt_loop_unroll.c
>>> > > @@ -26,6 +26,14 @@
>>> > >  #include "nir_control_flow.h"
>>> > >  #include "nir_loop_analyze.h"
>>> > >
>>> > > +
>>> > > +/* This limit is chosen fairly arbitrarily.  The GLSL IR limit is
>>> > > 25.
>>> > > + * However, due to slight differences in the way the two IRs count
>>> > > + * instructions, some loops that would unroll with GLSL IR fail to
>>> > > unroll
>>> > > + * if we set this to 25 so we set it to 26.
>>> > >
>>> >
>>> > Ok, I lied in my comment.  It's not 25, it's 32.  Tim, can you
>>> > explain the discrepancy?
>>> > --Jason
>>>
>>>
>> Max iteration is 32 this is number of instructions, in GLSL IR it was
>>> counting nodes and the magic number was 5. There is no 1:1 mapping 25
>>> was picked because it seemed to give about the same results. Around 5
>>> instructions per node.
>>>
>>>
>> So to resume. Is this comment correct for you?
>>
>> Max iteration is 32 this is number of instructions, in GLSL IR it was
>> counting nodes and

Re: [Mesa-dev] pfn_notify in clCreateContext()

2017-02-24 Thread Ilia Mirkin
I'd like to point out that when I hooked up this logic in clover
(after my triumphant addition of KHR_debug in gallium), I had no idea
how OpenCL stuff worked. I still don't. If you think passing this type
of information is inappropriate, or that some of the message types
should be filtered out, you should go ahead and do that.

src/gallium/state_trackers/clover/core/queue.cpp::debug_notify_callback

The API was mostly modeled after the KHR_debug capabilities, so if it
doesn't fit well with what OpenCL wants, you can also just revert my
commit that hooked it up. It was purely speculative, without an actual
use-case in mind.

Cheers,

  -ilia


On Fri, Feb 24, 2017 at 11:00 AM, Vedran Miletić  wrote:
> Hello,
>
> I noticed that Clover outputs si_shader_dump_stats() via pfn_notify
> callback registered clCreateContext() (it's not done directly, but
> that's the result). According to OpenCL standard documentation [1],
> pfn_notify should be used only to report errors.
>
> One of the programs that gets confused by our behavior is OpenMM,
> outputing lines such as:
>
> OpenCL internal error: Shader Stats: SGPRS: 16 VGPRS: 11 Code Size:
> 10804 LDS: 0 Scratch: 0 Max Waves: 10 Spilled SGPRs: 0 Spilled VGPRs: 0
> PrivMem VGPRs: 0
>
> What should we do?
>
> 1) Leave as is in hope that no application is broken by it beyond
> printing non-errors.
> 2) Do not print debug_message() (including si_shader_dump_stats()) via
> pfn_notify.
> 3) Introduce separate error_message() for pfn_notify instead of
> debug_message().
>
> Regards,
> Vedran
>
> [1]
> https://www.khronos.org/registry/OpenCL/sdk/1.1/docs/man/xhtml/clCreateContext.html
>
> --
> Vedran Miletić
> vedran.miletic.net
> ___
> 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] Mesa: Fix performance query id check

2017-02-24 Thread Robert Bragg
Ah, oops, I think the id types iterated a few times over the lifetime
of the original patch. E.g. until pretty much the last moment before
landing it pass a signed int id to the backend.

I suppose it can be return queryid != 0 && queryid_to_index(queryid) <
numQueries

I'll also look to update the local piglit tests I have to try and
catch this case, they currently check for an invalid queryid searching
from UINT_MAX down until it finds one not matching the id of any
discovered query.

I can send out a fix if you don't beat me to it,
Thanks,
- Robert


On Fri, Feb 24, 2017 at 1:21 PM, Juha-Pekka Heikkila
 wrote:
> Oops. Original code can never fail on zero id but my patch is also wrong.
> Please ignore this patch.
>
> /Juha-Pekka
>
>
> On 24.02.2017 15:10, Juha-Pekka Heikkila wrote:
>>
>> In queryid_valid() index is unsigned so checking if it is less
>> than zero is useless. On queryid_to_index() is comment
>> saying 0 is reserved to be invalid thus rule it out.
>>
>> CC: Robert Bragg 
>> Signed-off-by: Juha-Pekka Heikkila 
>> ---
>>  src/mesa/main/performance_query.c | 2 +-
>>  1 file changed, 1 insertion(+), 1 deletion(-)
>>
>> diff --git a/src/mesa/main/performance_query.c
>> b/src/mesa/main/performance_query.c
>> index aa10351..079d3c8 100644
>> --- a/src/mesa/main/performance_query.c
>> +++ b/src/mesa/main/performance_query.c
>> @@ -91,7 +91,7 @@ static inline bool
>>  queryid_valid(const struct gl_context *ctx, unsigned numQueries, GLuint
>> queryid)
>>  {
>> GLuint index = queryid_to_index(queryid);
>> -   return index >= 0 && index < numQueries;
>> +   return index != 0 && index < numQueries;
>>  }
>>
>>  static inline GLuint
>>
>
___
mesa-dev mailing list
mesa-dev@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/mesa-dev


Re: [Mesa-dev] [PATCH 4/4] glsl/tests/optimization-test: correctly manage srcdir/pwd and co

2017-02-24 Thread Eric Engestrom
On Thursday, 2017-02-23 16:43:10 +, Emil Velikov wrote:
> From: Emil Velikov 
> 
> At the moment things are completely bonkers (as can be seen from last
> commit). Regardless if we run the test as part of "make check" or
> standalone the most of the paths are wrong.
> 
> Untangle things by issuing "cd `dirname "$0`" and working from there.
> Otherwise it's nearly impossible to consider all the permutations one
> can use while running outside of "make check"
> 
> Clearly document the variables and the intended behaviour.
> 
> Signed-off-by: Emil Velikov 
> ---
> We really want to cut down all the crazy design here. Dylan ?
> 
> sh script which executes a python one, with the latter creating a bunch
> of sh ones and hardcoding binary location. Then call the generated sh
> scripts, to create the tested OP files. Now compare the expected vs the
> tested via another python script which decodes [in to a temporary file]
> and calls "diff" to compare them.
> ---
>  src/compiler/glsl/tests/optimization-test | 22 +-
>  1 file changed, 17 insertions(+), 5 deletions(-)
> 
> diff --git a/src/compiler/glsl/tests/optimization-test 
> b/src/compiler/glsl/tests/optimization-test
> index d84b83cfaa..e851e13bfb 100755
> --- a/src/compiler/glsl/tests/optimization-test
> +++ b/src/compiler/glsl/tests/optimization-test
> @@ -1,10 +1,18 @@
>  #!/usr/bin/env bash
>  
> -if [ ! -z "$srcdir" ]; then
> -   compare_ir=`pwd`/tests/compare_ir
> -else
> -   compare_ir=./compare_ir
> +# The srcdir variable must point to the location where the Makefile.am or
> +# Makefile.glsl.am in particular is. Even if we execute this test manually.
> +
> +if [ -z "$srcdir" ]; then
> +   srcdir=./../../
> +
> +# In the manual invokation case, we must CD otherwise we cannot manage 
> all
> +# the permutations of our scripts which calls a script to create a script
> +# then execute the script design.
> +cd `dirname "$0"`
> +
>  fi
> +compare_ir=$srcdir/glsl/tests/compare_ir

Like I said in the other email, I think if someone wants to run the
checks manually, they can be expected to set $srcdir correctly.
Bailing out when it's unset would be good enough IMHO.

>  
>  if [ -z "$PYTHON2" ]; then
>  PYTHON2=python2
> @@ -20,10 +28,13 @@ total=0
>  pass=0
>  has_tests=0
>  
> +# Store our location before we start diving into subdirectories.
> +ORIGDIR=`pwd`

How about pushd/popd instead?

>  echo "==   Generating tests  =="
> -for dir in tests/*/; do
> +for dir in $srcdir/glsl/tests/*/; do
>  if [ -e "${dir}create_test_cases.py" ]; then
>  cd $dir;
> +echo found

Guessing this line can go? :)

>  $PYTHON2 create_test_cases.py
>  if [ "x$?" = x0 ]; then
>  has_tests=1
> @@ -32,6 +43,7 @@ for dir in tests/*/; do
>  fi
>  echo "$dir"
>  done
> +cd "$ORIGDIR"
>  
>  if [ "x$has_tests" = x0 ]; then
>  echo "Could not generate any tests."
> -- 
> 2.11.0
> 
___
mesa-dev mailing list
mesa-dev@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/mesa-dev


Re: [Mesa-dev] [PATCH] configure.ac: check require_basic_egl only if egl enabled

2017-02-24 Thread Leo Liu



On 02/24/2017 10:56 AM, Emil Velikov wrote:

On 24 February 2017 at 14:25, Leo Liu  wrote:

On 02/24/2017 09:07 AM, Emil Velikov wrote:

On 23 February 2017 at 18:43, Leo Liu  wrote:

Otherwise the configuration fails when building independant libs
like vdpau, vaapi or omx


I really should have spotted this usecase :-]


Signed-off-by: Leo Liu 
---
   configure.ac | 4 +++-
   1 file changed, 3 insertions(+), 1 deletion(-)

diff --git a/configure.ac b/configure.ac
index 44c7883..890a379 100644
--- a/configure.ac
+++ b/configure.ac
@@ -2310,7 +2310,9 @@ if test -n "$with_gallium_drivers"; then
   PKG_CHECK_MODULES([AMDGPU], [libdrm >=
$LIBDRM_AMDGPU_REQUIRED libdrm_amdgpu >= $LIBDRM_AMDGPU_REQUIRED])
   require_libdrm "radeonsi"
   radeon_llvm_check $LLVM_REQUIRED_RADEONSI "radeonsi"
-require_basic_egl "radeonsi"
+if test "x$enable_egl" = xyes; then
+require_basic_egl "radeonsi"
+fi

I'm split if we want to keep the check as-is or move within
require_basic_egl. In either case:

Fixes: 1ac40173c2a ("configure.ac: simplify EGL requirements for
drivers dependent on EGL")

Yes. This is regression point, I will add it to commit message.
Also I would like to Cc: "17.0"  , where
the issue was found.


Sure adding the mesa-stable tag is fine.

Say the offending commit is cherry-picked into branch A or B - with
the fixes tag, this will be nominated (props to [1]) to all applicable
branches.
it's quite a recent and fancy feature ;-)

-Emil
[1] bin/get-fixes-pick-list.sh

Cool. Will find out what other scripts will do.:-)

Leo



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


[Mesa-dev] pfn_notify in clCreateContext()

2017-02-24 Thread Vedran Miletić
Hello,

I noticed that Clover outputs si_shader_dump_stats() via pfn_notify
callback registered clCreateContext() (it's not done directly, but
that's the result). According to OpenCL standard documentation [1],
pfn_notify should be used only to report errors.

One of the programs that gets confused by our behavior is OpenMM,
outputing lines such as:

OpenCL internal error: Shader Stats: SGPRS: 16 VGPRS: 11 Code Size:
10804 LDS: 0 Scratch: 0 Max Waves: 10 Spilled SGPRs: 0 Spilled VGPRs: 0
PrivMem VGPRs: 0

What should we do?

1) Leave as is in hope that no application is broken by it beyond
printing non-errors.
2) Do not print debug_message() (including si_shader_dump_stats()) via
pfn_notify.
3) Introduce separate error_message() for pfn_notify instead of
debug_message().

Regards,
Vedran

[1]
https://www.khronos.org/registry/OpenCL/sdk/1.1/docs/man/xhtml/clCreateContext.html

-- 
Vedran Miletić
vedran.miletic.net
___
mesa-dev mailing list
mesa-dev@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/mesa-dev


Re: [Mesa-dev] [PATCH 3/4] glsl/tests/optimization-test: error out if we fail to generate any tests

2017-02-24 Thread Eric Engestrom
On Thursday, 2017-02-23 16:43:09 +, Emil Velikov wrote:
> From: Emil Velikov 
> 
> Signed-off-by: Emil Velikov 
> ---
>  src/compiler/glsl/tests/optimization-test | 13 -
>  1 file changed, 12 insertions(+), 1 deletion(-)
> 
> diff --git a/src/compiler/glsl/tests/optimization-test 
> b/src/compiler/glsl/tests/optimization-test
> index ec0f09b125..d84b83cfaa 100755
> --- a/src/compiler/glsl/tests/optimization-test
> +++ b/src/compiler/glsl/tests/optimization-test
> @@ -18,15 +18,26 @@ fi
>  
>  total=0
>  pass=0
> +has_tests=0
>  
>  echo "==   Generating tests  =="
>  for dir in tests/*/; do
>  if [ -e "${dir}create_test_cases.py" ]; then
> -cd $dir; $PYTHON2 create_test_cases.py; cd ..
> +cd $dir;
> +$PYTHON2 create_test_cases.py
> +if [ "x$?" = x0 ]; then

if $PYTHON2 create_test_cases.py; then
...

With or without these nit-pick, patches 1-3 are:
Reviewed-by: Eric Engestrom 

> +has_tests=1
> +fi
> +cd ..
>  fi
>  echo "$dir"
>  done
>  
> +if [ "x$has_tests" = x0 ]; then
> +echo "Could not generate any tests."
> +exit 1
> +fi
> +
>  if [ ! -e "$compare_ir" ]; then
>  echo "Could not find compare_ir. Make sure that srcdir variable is 
> correctly set."
>  exit 1
> -- 
> 2.11.0
> 
___
mesa-dev mailing list
mesa-dev@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/mesa-dev


Re: [Mesa-dev] [PATCH] configure.ac: check require_basic_egl only if egl enabled

2017-02-24 Thread Emil Velikov
On 24 February 2017 at 14:25, Leo Liu  wrote:
> On 02/24/2017 09:07 AM, Emil Velikov wrote:
>>
>> On 23 February 2017 at 18:43, Leo Liu  wrote:
>>>
>>> Otherwise the configuration fails when building independant libs
>>> like vdpau, vaapi or omx
>>>
>> I really should have spotted this usecase :-]
>>
>>> Signed-off-by: Leo Liu 
>>> ---
>>>   configure.ac | 4 +++-
>>>   1 file changed, 3 insertions(+), 1 deletion(-)
>>>
>>> diff --git a/configure.ac b/configure.ac
>>> index 44c7883..890a379 100644
>>> --- a/configure.ac
>>> +++ b/configure.ac
>>> @@ -2310,7 +2310,9 @@ if test -n "$with_gallium_drivers"; then
>>>   PKG_CHECK_MODULES([AMDGPU], [libdrm >=
>>> $LIBDRM_AMDGPU_REQUIRED libdrm_amdgpu >= $LIBDRM_AMDGPU_REQUIRED])
>>>   require_libdrm "radeonsi"
>>>   radeon_llvm_check $LLVM_REQUIRED_RADEONSI "radeonsi"
>>> -require_basic_egl "radeonsi"
>>> +if test "x$enable_egl" = xyes; then
>>> +require_basic_egl "radeonsi"
>>> +fi
>>
>> I'm split if we want to keep the check as-is or move within
>> require_basic_egl. In either case:
>>
>> Fixes: 1ac40173c2a ("configure.ac: simplify EGL requirements for
>> drivers dependent on EGL")
>
> Yes. This is regression point, I will add it to commit message.
> Also I would like to Cc: "17.0"  , where
> the issue was found.
>
Sure adding the mesa-stable tag is fine.

Say the offending commit is cherry-picked into branch A or B - with
the fixes tag, this will be nominated (props to [1]) to all applicable
branches.
it's quite a recent and fancy feature ;-)

-Emil
[1] bin/get-fixes-pick-list.sh
___
mesa-dev mailing list
mesa-dev@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/mesa-dev


Re: [Mesa-dev] [PATCH mesa] egl/dri3: implement query surface hook

2017-02-24 Thread Brendan King

Hi,

On 20/02/17 07:57, Tapani Pälli wrote:

Hi;

On 02/17/2017 05:12 PM, Eric Engestrom wrote:

From: Brendan King 

This is a DRI3 version of a change made for DRI2
(4d6d4f939e0af4252e0b, "egl/dri2: implement query surface hook"),
that fixed failures in dEQP-EGL.functional.resize.surface_size.grow
and dEQP-EGL.functional.resize.surface_size.shrink.


Do these tests fail on some platform? When debugging the original 
failures this failed for me only when using DRI2. It's nice to be 
consistent but is it possible that this is not necessary because of 
differences between DRI2 and DRI3?


The tests failed on the PowerVR driver. The tests resize the drawable 
before calling eglSwapBuffers, and query the drawable width and height 
after the call. The driver hasn't started drawing the next frame at this 
point, and so hasn't requested the new buffers for the drawable yet, 
hence the old width and height were being returned.



Cc: Tapani Pälli 
Cc: Mark Janes 
Cc: Chad Versace 
Signed-off-by: Brendan King 
---
 src/egl/drivers/dri2/platform_x11_dri3.c | 20 
 src/loader/loader_dri3_helper.c  | 23 +++
 src/loader/loader_dri3_helper.h  |  2 ++
 3 files changed, 45 insertions(+)

diff --git a/src/egl/drivers/dri2/platform_x11_dri3.c 
b/src/egl/drivers/dri2/platform_x11_dri3.c

index c4747144d1..c4a54431cc 100644
--- a/src/egl/drivers/dri2/platform_x11_dri3.c
+++ b/src/egl/drivers/dri2/platform_x11_dri3.c
@@ -419,6 +419,25 @@ dri3_query_buffer_age(_EGLDriver *drv, 
_EGLDisplay *dpy, _EGLSurface *surf)

return loader_dri3_query_buffer_age(&dri3_surf->loader_drawable);
 }

+static EGLBoolean
+dri3_query_surface(_EGLDriver *drv, _EGLDisplay *dpy,
+   _EGLSurface *surf, EGLint attribute,
+   EGLint *value)
+{
+   struct dri3_egl_surface *dri3_surf = dri3_egl_surface(surf);
+
+   switch (attribute) {
+   case EGL_WIDTH:
+   case EGL_HEIGHT:
+ loader_dri3_update_drawable_geometry(&dri3_surf->loader_drawable);
+  break;
+   default:
+  break;
+   }
+
+   return _eglQuerySurface(drv, dpy, surf, attribute, value);
+}
+
 static __DRIdrawable *
 dri3_get_dri_drawable(_EGLSurface *surf)
 {
@@ -441,6 +460,7 @@ struct dri2_egl_display_vtbl 
dri3_x11_display_vtbl = {

.post_sub_buffer = dri2_fallback_post_sub_buffer,
.copy_buffers = dri3_copy_buffers,
.query_buffer_age = dri3_query_buffer_age,
+   .query_surface = dri3_query_surface,
.create_wayland_buffer_from_image = 
dri2_fallback_create_wayland_buffer_from_image,

.get_sync_values = dri3_get_sync_values,
.get_dri_drawable = dri3_get_dri_drawable,
diff --git a/src/loader/loader_dri3_helper.c 
b/src/loader/loader_dri3_helper.c

index 6e5d1b8843..493a7f5218 100644
--- a/src/loader/loader_dri3_helper.c
+++ b/src/loader/loader_dri3_helper.c
@@ -1408,3 +1408,26 @@ loader_dri3_get_buffers(__DRIdrawable 
*driDrawable,


return true;
 }
+
+/** loader_dri3_update_drawable_geometry
+ *
+ * Get the current drawable geometry.
+ */
+void
+loader_dri3_update_drawable_geometry(struct loader_dri3_drawable *draw)
+{
+   xcb_get_geometry_cookie_t geom_cookie;
+   xcb_get_geometry_reply_t *geom_reply;
+
+   geom_cookie = xcb_get_geometry(draw->conn, draw->drawable);
+
+   geom_reply = xcb_get_geometry_reply(draw->conn, geom_cookie, NULL);
+
+   if (geom_reply) {
+  draw->width = geom_reply->width;
+  draw->height = geom_reply->height;
+  draw->vtable->set_drawable_size(draw, draw->width, draw->height);
+
+  free(geom_reply);
+   }
+}
diff --git a/src/loader/loader_dri3_helper.h 
b/src/loader/loader_dri3_helper.h

index 1d1f15ebb9..a865e46355 100644
--- a/src/loader/loader_dri3_helper.h
+++ b/src/loader/loader_dri3_helper.h
@@ -239,4 +239,6 @@ loader_dri3_get_buffers(__DRIdrawable *driDrawable,
 uint32_t buffer_mask,
 struct __DRIimageList *buffers);

+void
+loader_dri3_update_drawable_geometry(struct loader_dri3_drawable 
*draw);

 #endif



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


Re: [Mesa-dev] [PATCH 2/4] glsl/tests/optimisation-test: ensure that compare_ir is available

2017-02-24 Thread Eric Engestrom
On Thursday, 2017-02-23 16:43:08 +, Emil Velikov wrote:
> From: Emil Velikov 
> 
> Bail out early if the script is not where we expect it to be.
> 
> Signed-off-by: Emil Velikov 
> ---
>  src/compiler/glsl/tests/optimization-test | 5 +
>  1 file changed, 5 insertions(+)
> 
> diff --git a/src/compiler/glsl/tests/optimization-test 
> b/src/compiler/glsl/tests/optimization-test
> index 7ccbb4467d..ec0f09b125 100755
> --- a/src/compiler/glsl/tests/optimization-test
> +++ b/src/compiler/glsl/tests/optimization-test
> @@ -27,6 +27,11 @@ for dir in tests/*/; do
>  echo "$dir"
>  done
>  
> +if [ ! -e "$compare_ir" ]; then

`-f` to make sure it's a file (not a dir)?
Maybe even `-x` to make sure it can be executed (or just `-r` since it's
actually read by $PYTHON2, not directly executed, so it doesn't *need*
the executable bit).

> +echo "Could not find compare_ir. Make sure that srcdir variable is 
> correctly set."
> +exit 1
> +fi
> +
>  echo "== Testing optimization passes =="
>  for test in `find . -iname '*.opt_test'`; do
>  echo -n "Testing $test..."
> -- 
> 2.11.0
> 
___
mesa-dev mailing list
mesa-dev@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/mesa-dev


Re: [Mesa-dev] [PATCH 1/4] glsl/tests/optimisation-test: make sure that $PYTHON2 is set/available

2017-02-24 Thread Eric Engestrom
On Thursday, 2017-02-23 16:43:07 +, Emil Velikov wrote:
> From: Emil Velikov 
> 
> Otherwise we'll fail when invoking the script outside of "make check"
> 
> Signed-off-by: Emil Velikov 
> ---
>  src/compiler/glsl/tests/optimization-test | 10 ++
>  1 file changed, 10 insertions(+)
> 
> diff --git a/src/compiler/glsl/tests/optimization-test 
> b/src/compiler/glsl/tests/optimization-test
> index 26a51be698..7ccbb4467d 100755
> --- a/src/compiler/glsl/tests/optimization-test
> +++ b/src/compiler/glsl/tests/optimization-test
> @@ -6,6 +6,16 @@ else
> compare_ir=./compare_ir
>  fi
>  
> +if [ -z "$PYTHON2" ]; then
> +PYTHON2=python2
> +fi
> +
> +which $PYTHON2 >/dev/null
> +if [ "x$?" != x0 ]; then

You want a numerical comparison here (`[ $? -ne 0 ]`), not a string
comparison, and you could also simplify it as:
if ! which $PYTHON2 >/dev/null; then
...

> +echo "Could not find python2. Make sure that PYTHON2 variable is 
> correctly set."
> +exit 1
> +fi
> +
>  total=0
>  pass=0
>  
> -- 
> 2.11.0
> 
___
mesa-dev mailing list
mesa-dev@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/mesa-dev


Re: [Mesa-dev] [PATCH 2/2] anv: do not subtract the base layer to copute depth in 3DSTATE_DEPTH_BUFFER

2017-02-24 Thread Jason Ekstrand
On Feb 23, 2017 11:40 PM, "Iago Toral Quiroga"  wrote:

According to the PRM description of the Depth field:

  "This field specifies the total number of levels for a volume texture
   or the number of array elements allowed to be accessed starting at the
   Minimum Array Element for arrayed surfaces"

However, ISL defines array_len as the length of the range
[base_array_layer, base_array_layer + array_len], so it already represents
a value relative to the base array layer like the hardware expects.

This fixes a number of new CTS tests that would crash otherwise:
dEQP-VK.pipeline.render_to_image.*
---
 src/intel/vulkan/genX_cmd_buffer.c | 3 +--
 1 file changed, 1 insertion(+), 2 deletions(-)

diff --git a/src/intel/vulkan/genX_cmd_buffer.c b/src/intel/vulkan/genX_cmd_
buffer.c
index 40a72f4..3c7b544 100644
--- a/src/intel/vulkan/genX_cmd_buffer.c
+++ b/src/intel/vulkan/genX_cmd_buffer.c
@@ -2269,8 +2269,7 @@ cmd_buffer_emit_depth_stencil(struct anv_cmd_buffer
*cmd_buffer)

  assert(image->depth_surface.isl.dim != ISL_SURF_DIM_3D);
  db.Depth =
- db.RenderTargetViewExtent =
-iview->isl.array_len - iview->isl.base_array_layer - 1;
+ db.RenderTargetViewExtent = iview->isl.array_len;


Don't we still want the -1?

 #if GEN_GEN >= 8
  db.SurfaceQPitch =
--
2.7.4
___
mesa-dev mailing list
mesa-dev@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/mesa-dev


Re: [Mesa-dev] [PATCH 37/37] bin/get-fixes-pick-list.sh: do not mandate bash

2017-02-24 Thread Andreas Boll
Reviewed-by: Andreas Boll 

I'll let someone else review the python changes.

2017-02-23 18:14 GMT+01:00 Emil Velikov :
> From: Emil Velikov 
>
> Silly thinko on my end, as I was writing the script. There is nothing
> bash specific in there.
>
> Signed-off-by: Emil Velikov 
> ---
>  bin/get-fixes-pick-list.sh | 2 +-
>  1 file changed, 1 insertion(+), 1 deletion(-)
>
> diff --git a/bin/get-fixes-pick-list.sh b/bin/get-fixes-pick-list.sh
> index 4ce9c92f8a..59bcae4f2d 100755
> --- a/bin/get-fixes-pick-list.sh
> +++ b/bin/get-fixes-pick-list.sh
> @@ -1,4 +1,4 @@
> -#!/bin/bash
> +#!/bin/sh
>
>  # Script for generating a list of candidates [referenced by a Fixes tag] for
>  # cherry-picking to a stable branch
> --
> 2.11.0
>
> ___
> mesa-dev mailing list
> mesa-dev@lists.freedesktop.org
> https://lists.freedesktop.org/mailman/listinfo/mesa-dev
___
mesa-dev mailing list
mesa-dev@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/mesa-dev


Re: [Mesa-dev] [PATCH 36/37] in/shortlog_mesa.sh: remove the final bashism

2017-02-24 Thread Andreas Boll
Typo in commit summary (in/ -> bin/)

with that fixed:
Reviewed-by: Andreas Boll 

2017-02-23 18:14 GMT+01:00 Emil Velikov :
> From: Emil Velikov 
>
> Remove the typeset built-in and toggle to /bin/sh
>
> Signed-off-by: Emil Velikov 
> ---
> Sidenote: seems like there is something in the script which causes bash
> to trip in the odd occasion while zsh works like a charm.
>
> Namely "[rasterizer]" would become "z" while "[rasterizer foo]" will
> remain as-is.
>
> But that for another day ;-)
> ---
>  bin/shortlog_mesa.sh | 4 ++--
>  1 file changed, 2 insertions(+), 2 deletions(-)
>
> diff --git a/bin/shortlog_mesa.sh b/bin/shortlog_mesa.sh
> index 2ba0815de7..c9a4297236 100755
> --- a/bin/shortlog_mesa.sh
> +++ b/bin/shortlog_mesa.sh
> @@ -1,4 +1,4 @@
> -#!/bin/bash
> +#!/bin/sh
>
>  # This script is used to generate the list of changes that
>  # appears in the release notes files, with HTML formatting.
> @@ -10,7 +10,7 @@
>  # $ bin/shortlog_mesa.sh mesa-9.0.2..mesa-9.0.3 | tee changes
>
>
> -typeset -i in_log=0
> +in_log=0
>
>  git shortlog $* | while read l
>  do
> --
> 2.11.0
>
> ___
> mesa-dev mailing list
> mesa-dev@lists.freedesktop.org
> https://lists.freedesktop.org/mailman/listinfo/mesa-dev
___
mesa-dev mailing list
mesa-dev@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/mesa-dev


Re: [Mesa-dev] [PATCH 35/37] bin/bugzilla_mesa.sh: rework the looping method

2017-02-24 Thread Andreas Boll
2017-02-23 18:14 GMT+01:00 Emil Velikov :
> From: Emil Velikov 
>
> We don't use DRYRUN (and no others scripts have one) so just drop it.
>
> This allows us to rework the loop to the more commonly used "git  |
> while read foo; do ... done"
>
> That in itself gets rid of the only remaining bashism and we can toggle
> the shebang to /bin/sh.
>
> Signed-off-by: Emil Velikov 
> ---
>  bin/bugzilla_mesa.sh | 38 --
>  1 file changed, 12 insertions(+), 26 deletions(-)
>
> diff --git a/bin/bugzilla_mesa.sh b/bin/bugzilla_mesa.sh
> index 49b9ce9c75..a8f5305844 100755
> --- a/bin/bugzilla_mesa.sh
> +++ b/bin/bugzilla_mesa.sh
> @@ -1,4 +1,4 @@
> -#!/bin/bash
> +#!/bin/sh
>
>  # This script is used to generate the list of fixed bugs that
>  # appears in the release notes files, with HTML formatting.
> @@ -11,8 +11,6 @@
>  # $ bin/bugzilla_mesa.sh mesa-9.0.2..mesa-9.0.3
>  # $ bin/bugzilla_mesa.sh mesa-9.0.2..mesa-9.0.3 > bugfixes
>  # $ bin/bugzilla_mesa.sh mesa-9.0.2..mesa-9.0.3 | tee bugfixes
> -# $ DRYRUN=yes bin/bugzilla_mesa.sh mesa-9.0.2..mesa-9.0.3
> -# $ DRYRUN=yes bin/bugzilla_mesa.sh mesa-9.0.2..mesa-9.0.3 | wc -l

I guess it was only useful for offline usage and fast counting ;-)

Reviewed-by: Andreas Boll 

>
>
>  # regex pattern: trim before bug number
> @@ -21,29 +19,17 @@ trim_before='s/.*show_bug.cgi?id=\([0-9]*\).*/\1/'
>  # regex pattern: reconstruct the url
>  use_after='s,^,https://bugs.freedesktop.org/show_bug.cgi?id=,'
>
> -# extract fdo urls from commit log
> -urls=$(git log $* | grep 'bugs.freedesktop.org/show_bug' | sed -e 
> $trim_before | sort -n -u | sed -e $use_after)
> -
> -# if DRYRUN is set to "yes", simply print the URLs and don't fetch the
> -# details from fdo bugzilla.
> -#DRYRUN=yes
> +echo ""
> +echo ""
>
> -if [ "x$DRYRUN" = xyes ]; then
> -   for i in $urls
> -   do
> -   echo $i
> -   done
> -else
> -   echo ""
> +# extract fdo urls from commit log
> +git log $* | grep 'bugs.freedesktop.org/show_bug' | sed -e $trim_before | 
> sort -n -u | sed -e $use_after |\
> +while read url
> +do
> +   id=$(echo $url | cut -d'=' -f2)
> +   summary=$(wget --quiet -O - $url | grep -e '.*' | sed 
> -e 's/ *[0-9]\+ – \(.*\)<\/title>/\1/')
> +   echo "Bug $id - $summary"
> echo ""
> +done
>
> -   for i in $urls
> -   do
> -   id=$(echo $i | cut -d'=' -f2)
> -   summary=$(wget --quiet -O - $i | grep -e '.*' 
> | sed -e 's/ *[0-9]\+ – \(.*\)<\/title>/\1/')
> -   echo "Bug $id - $summary"
> -   echo ""
> -   done
> -
> -   echo ""
> -fi
> +echo ""
> --
> 2.11.0
>
> ___
> mesa-dev mailing list
> mesa-dev@lists.freedesktop.org
> https://lists.freedesktop.org/mailman/listinfo/mesa-dev
___
mesa-dev mailing list
mesa-dev@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/mesa-dev


Re: [Mesa-dev] [PATCH 34/37] wayland-egl/wayland-egl-symbols-check: do not mandate bash

2017-02-24 Thread Andreas Boll
Reviewed-by: Andreas Boll 

2017-02-23 18:14 GMT+01:00 Emil Velikov :
> From: Emil Velikov 
>
> Signed-off-by: Emil Velikov 
> ---
>  src/egl/wayland/wayland-egl/wayland-egl-symbols-check | 2 +-
>  1 file changed, 1 insertion(+), 1 deletion(-)
>
> diff --git a/src/egl/wayland/wayland-egl/wayland-egl-symbols-check 
> b/src/egl/wayland/wayland-egl/wayland-egl-symbols-check
> index 0c5fd09a01..e7105ea579 100755
> --- a/src/egl/wayland/wayland-egl/wayland-egl-symbols-check
> +++ b/src/egl/wayland/wayland-egl/wayland-egl-symbols-check
> @@ -1,4 +1,4 @@
> -#!/bin/bash
> +#!/bin/sh
>
>  FUNCS=$(nm -D --defined-only ${1-.libs/libwayland-egl.so} | grep -o "T .*" | 
> cut -c 3- | while read func; do
>  ( grep -q "^$func$" || echo $func )  < --
> 2.11.0
>
> ___
> mesa-dev mailing list
> mesa-dev@lists.freedesktop.org
> https://lists.freedesktop.org/mailman/listinfo/mesa-dev
___
mesa-dev mailing list
mesa-dev@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/mesa-dev


Re: [Mesa-dev] [PATCH 33/37] gbm/gbm-symbols-check: do not mandate bash

2017-02-24 Thread Andreas Boll
Reviewed-by: Andreas Boll 

2017-02-23 18:14 GMT+01:00 Emil Velikov :
> From: Emil Velikov 
>
> Analogous to previous commit.
>
> Signed-off-by: Emil Velikov 
> ---
>  src/gbm/gbm-symbols-check | 2 +-
>  1 file changed, 1 insertion(+), 1 deletion(-)
>
> diff --git a/src/gbm/gbm-symbols-check b/src/gbm/gbm-symbols-check
> index 5a333ffcda..34fe11b874 100755
> --- a/src/gbm/gbm-symbols-check
> +++ b/src/gbm/gbm-symbols-check
> @@ -1,4 +1,4 @@
> -#!/bin/bash
> +#!/bin/sh
>
>  FUNCS=$(nm -D --defined-only ${1-.libs/libgbm.so} | grep -o "T .*" | cut -c 
> 3- | while read func; do
>  ( grep -q "^$func$" || echo $func )  < --
> 2.11.0
>
> ___
> mesa-dev mailing list
> mesa-dev@lists.freedesktop.org
> https://lists.freedesktop.org/mailman/listinfo/mesa-dev
___
mesa-dev mailing list
mesa-dev@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/mesa-dev


Re: [Mesa-dev] [PATCH 32/37] egl/egl-symbols-check: do not mandate bash

2017-02-24 Thread Andreas Boll
Reviewed-by: Andreas Boll 

2017-02-23 18:13 GMT+01:00 Emil Velikov :
> From: Emil Velikov 
>
> There's nothing bash specific in the script.
>
> Signed-off-by: Emil Velikov 
> ---
>  src/egl/egl-symbols-check | 2 +-
>  1 file changed, 1 insertion(+), 1 deletion(-)
>
> diff --git a/src/egl/egl-symbols-check b/src/egl/egl-symbols-check
> index 409867fab6..4c5232cb6c 100755
> --- a/src/egl/egl-symbols-check
> +++ b/src/egl/egl-symbols-check
> @@ -1,4 +1,4 @@
> -#!/bin/bash
> +#!/bin/sh
>
>  FUNCS=$(nm -D --defined-only ${1-.libs/libEGL.so} | grep -o "T .*" | cut -c 
> 3- | while read func; do
>  ( grep -q "^$func$" || echo $func )  < --
> 2.11.0
>
> ___
> mesa-dev mailing list
> mesa-dev@lists.freedesktop.org
> https://lists.freedesktop.org/mailman/listinfo/mesa-dev
___
mesa-dev mailing list
mesa-dev@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/mesa-dev


Re: [Mesa-dev] [PATCH 31/37] glsl/tests: remove any bashisms

2017-02-24 Thread Andreas Boll
Reviewed-by: Andreas Boll 

2017-02-23 18:13 GMT+01:00 Emil Velikov :
> From: Emil Velikov 
>
> Signed-off-by: Emil Velikov 
> ---
>  src/compiler/glsl/tests/optimization-test.sh | 4 ++--
>  src/compiler/glsl/tests/warnings-test.sh | 4 ++--
>  2 files changed, 4 insertions(+), 4 deletions(-)
>
> diff --git a/src/compiler/glsl/tests/optimization-test.sh 
> b/src/compiler/glsl/tests/optimization-test.sh
> index 9cc3cae3a3..dc9740f69f 100755
> --- a/src/compiler/glsl/tests/optimization-test.sh
> +++ b/src/compiler/glsl/tests/optimization-test.sh
> @@ -1,4 +1,4 @@
> -#!/usr/bin/env bash
> +#!/bin/sh
>
>  if [ ! -z "$srcdir" ]; then
> compare_ir=`pwd`/tests/compare_ir.py
> @@ -35,7 +35,7 @@ echo ""
>  echo "$pass/$total tests returned correct results"
>  echo ""
>
> -if [[ $pass == $total ]]; then
> +if [ $pass = $total ]; then
>  exit 0
>  else
>  exit 1
> diff --git a/src/compiler/glsl/tests/warnings-test.sh 
> b/src/compiler/glsl/tests/warnings-test.sh
> index 1bea466539..6a52d4064f 100755
> --- a/src/compiler/glsl/tests/warnings-test.sh
> +++ b/src/compiler/glsl/tests/warnings-test.sh
> @@ -1,4 +1,4 @@
> -#!/usr/bin/env bash
> +#!/bin/sh
>
>  # Execute several shaders, and check that the InfoLog outcome is the 
> expected.
>
> @@ -24,7 +24,7 @@ echo ""
>  echo "$pass/$total tests returned correct results"
>  echo ""
>
> -if [[ $pass == $total ]]; then
> +if [ $pass = $total ]; then
>  exit 0
>  else
>  exit 1
> --
> 2.11.0
>
> ___
> mesa-dev mailing list
> mesa-dev@lists.freedesktop.org
> https://lists.freedesktop.org/mailman/listinfo/mesa-dev
___
mesa-dev mailing list
mesa-dev@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/mesa-dev


Re: [Mesa-dev] [PATCH 30/37] dri: use correct shebang for gen-symbol-redefs.py

2017-02-24 Thread Andreas Boll
Reviewed-by: Andreas Boll 

2017-02-23 18:13 GMT+01:00 Emil Velikov :
> From: Emil Velikov 
>
> This is a python2 script and the generic "python" may point to python3.
>
> Cc: Andreas Boll 
> Signed-off-by: Emil Velikov 
> ---
> We really want to prune/rename all the conflicting entrypoints.
>
> In the radeon/r200 case we could even:
>  - fold the common code to a simple place
>  - drop the symlinks
>  - get smaller binary size and 'compatibilty' with SVN
>  - purge the script
>  - ...
>  - profit
>
> Andreas, any interest in tackling this ? It will drop a couple of
> extend-diff-ignore cases in the Debian packaging :-P
> ---
>  src/mesa/drivers/dri/gen-symbol-redefs.py | 2 +-
>  1 file changed, 1 insertion(+), 1 deletion(-)
>
> diff --git a/src/mesa/drivers/dri/gen-symbol-redefs.py 
> b/src/mesa/drivers/dri/gen-symbol-redefs.py
> index ebe4aaa650..c1e443467e 100755
> --- a/src/mesa/drivers/dri/gen-symbol-redefs.py
> +++ b/src/mesa/drivers/dri/gen-symbol-redefs.py
> @@ -1,4 +1,4 @@
> -#!/usr/bin/env python
> +#!/usr/bin/env python2
>  # -*- coding: utf-8 -*-
>
>  # Copyright © 2013 Intel Corporation
> --
> 2.11.0
>
___
mesa-dev mailing list
mesa-dev@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/mesa-dev


Re: [Mesa-dev] [PATCH 23/37] gallium/tools: do not hardcode bash location

2017-02-24 Thread Andreas Boll
Reviewed-by: Andreas Boll 

2017-02-23 18:13 GMT+01:00 Emil Velikov :
> It is not guaranteed to be in /bin
>
> Signed-off-by: Emil Velikov 
> ---
>  src/gallium/tools/addr2line.sh   | 2 +-
>  src/gallium/tools/trace/tracediff.sh | 2 +-
>  2 files changed, 2 insertions(+), 2 deletions(-)
>
> diff --git a/src/gallium/tools/addr2line.sh b/src/gallium/tools/addr2line.sh
> index 34dec14271..8d7b9cb9d9 100755
> --- a/src/gallium/tools/addr2line.sh
> +++ b/src/gallium/tools/addr2line.sh
> @@ -1,4 +1,4 @@
> -#!/bin/bash
> +#!/usr/bin/env bash
>  # This script processes symbols output by Gallium using glibc to 
> human-readable function names
>
>  lastbin=
> diff --git a/src/gallium/tools/trace/tracediff.sh 
> b/src/gallium/tools/trace/tracediff.sh
> index c7827c0ff1..dccb7a3d51 100755
> --- a/src/gallium/tools/trace/tracediff.sh
> +++ b/src/gallium/tools/trace/tracediff.sh
> @@ -1,4 +1,4 @@
> -#!/bin/bash
> +#!/usr/bin/env bash
>  ##
>  #
>  # Copyright 2011 Jose Fonseca
> --
> 2.11.0
>
> ___
> mesa-dev mailing list
> mesa-dev@lists.freedesktop.org
> https://lists.freedesktop.org/mailman/listinfo/mesa-dev
___
mesa-dev mailing list
mesa-dev@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/mesa-dev


Re: [Mesa-dev] [PATCH mesa v2] glx: add GLXdispatchIndex sort check

2017-02-24 Thread Eric Engestrom
On Thursday, 2017-02-23 16:07:36 +, Emil Velikov wrote:
> You're a star Eric, thank you !
> 
> On 22 February 2017 at 11:24, Eric Engestrom  
> wrote:
> > Signed-off-by: Eric Engestrom 
> > ---
> > v2: make sure the list is in the order C's strcmp uses (Ilia)
> > Ilia: I used LC_ALL instead of LANG, as it takes precedence
> >   (ie. LANG=C in this script would be overridden by
> >   LC_ALL=en_US in the environment).
> Personally I'm safe even without the LC_ALL bit, but it seems like a good 
> idea.
> 
> Perhaps we want that for the EGL test as well ?

Of course, I just didn't want to send a bunch of versions of each until
something was accepted by everyone.

> In both cases we really want to set srcdir, such that ./dispatch-index-check 
> and
> ../some/crazy/path/to/dispatch-index-check also work.
> 
> Perhaps reuse the autogen.sh magic ?

Sure, I could, but I'm not sure I see the point? Are these tests ever
run not through `make check` ?
And if someone does do that, surely they can be expected to know they
need to set $srcdir correctly?

> 
> Feel free to do that as follow-up or let me know otherwise and I'll
> fix it. I'm just fixing our "broken since day 1" glsl tests ;-)
> 
> As-is for this patch and the EGL series:
> Reviewed-by: Emil Velikov 
> 
> -Emil

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


Re: [Mesa-dev] [PATCH 20/37] mapi: do not mandate bash for es*api/ABI-check

2017-02-24 Thread Andreas Boll
Reviewed-by: Andreas Boll 

2017-02-23 18:13 GMT+01:00 Emil Velikov :
> From: Emil Velikov 
>
> Seemingly there is nothing bash specific in these. The Debian
> checkbashisms does not spot neither run in zsh.
>
> Signed-off-by: Emil Velikov 
> ---
>  src/mapi/es1api/ABI-check | 2 +-
>  src/mapi/es2api/ABI-check | 2 +-
>  2 files changed, 2 insertions(+), 2 deletions(-)
>
> diff --git a/src/mapi/es1api/ABI-check b/src/mapi/es1api/ABI-check
> index 819568f6d1..223658b32e 100755
> --- a/src/mapi/es1api/ABI-check
> +++ b/src/mapi/es1api/ABI-check
> @@ -1,4 +1,4 @@
> -#!/usr/bin/env bash
> +#!/bin/sh
>
>  # Print defined gl.* functions not in GL ES 1.1 or in
>  # (FIXME, none of these should be part of the ABI)
> diff --git a/src/mapi/es2api/ABI-check b/src/mapi/es2api/ABI-check
> index e338408c7e..11c95ced64 100755
> --- a/src/mapi/es2api/ABI-check
> +++ b/src/mapi/es2api/ABI-check
> @@ -1,4 +1,4 @@
> -#!/usr/bin/env bash
> +#!/bin/sh
>
>  # Print defined gl.* functions not in GL ES 3.0 or in
>  # (FIXME, none of these should be part of the ABI)
> --
> 2.11.0
>
> ___
> mesa-dev mailing list
> mesa-dev@lists.freedesktop.org
> https://lists.freedesktop.org/mailman/listinfo/mesa-dev
___
mesa-dev mailing list
mesa-dev@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/mesa-dev


Re: [Mesa-dev] [PATCH 03/37] mesa: drop the execute bit from gl.xml

2017-02-24 Thread Andreas Boll
Reviewed-by: Andreas Boll 

2017-02-23 18:13 GMT+01:00 Emil Velikov :
> This is a spec file which is parsed by scripts.
>
> Signed-off-by: Emil Velikov 
> ---
>  src/mapi/glapi/registry/gl.xml | 0
>  1 file changed, 0 insertions(+), 0 deletions(-)
>  mode change 100755 => 100644 src/mapi/glapi/registry/gl.xml
>
> diff --git a/src/mapi/glapi/registry/gl.xml b/src/mapi/glapi/registry/gl.xml
> old mode 100755
> new mode 100644
> --
> 2.11.0
>
> ___
> mesa-dev mailing list
> mesa-dev@lists.freedesktop.org
> https://lists.freedesktop.org/mailman/listinfo/mesa-dev
___
mesa-dev mailing list
mesa-dev@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/mesa-dev


Re: [Mesa-dev] [PATCH 5/8] i965: Add script to gen code for OA counter queries

2017-02-24 Thread Emil Velikov
Hi Robert,

There's a few minor comments below. Feel free to address here or as
follow-up, if applicable.

On 24 February 2017 at 13:58, Robert Bragg  wrote:
> Avoiding lots of error prone boilerplate and easing our ability to add +
> maintain support for multiple OA performance counter queries for each
> generation:
>
> This adds a python script to generate code for building up
> performance_queries from the metric sets and counters described in
> brw_oa_hsw.xml as well as functions to normalize each counter based on
> the RPN expressions given.
>
> Although the XML file currently only includes a single metric set, the
> code generated assumes there could be many sets.
>
> The metrics as described in XML get translated into C structures
> which are registered in a brw->perfquery.oa_metrics_table hash table
> keyed by the GUID of the metric set in XML.
>
Mauro, Tapani, we have another piece which will break Androids. Feel
free to send a fixup for Robert to squash.

> Signed-off-by: Robert Bragg 
> ---
>  src/mesa/drivers/dri/i965/Makefile.am  |  15 +-
>  src/mesa/drivers/dri/i965/Makefile.sources |   2 +
>  src/mesa/drivers/dri/i965/brw_oa.py| 543 
> +
>  3 files changed, 559 insertions(+), 1 deletion(-)
>  create mode 100644 src/mesa/drivers/dri/i965/brw_oa.py
>
> diff --git a/src/mesa/drivers/dri/i965/Makefile.am 
> b/src/mesa/drivers/dri/i965/Makefile.am
> index f87fa67ef8..0130afff5f 100644
> --- a/src/mesa/drivers/dri/i965/Makefile.am
> +++ b/src/mesa/drivers/dri/i965/Makefile.am
> @@ -93,7 +93,9 @@ BUILT_SOURCES = $(i965_compiler_GENERATED_FILES)
>  CLEANFILES = $(BUILT_SOURCES)
>
>  EXTRA_DIST = \
> -   brw_nir_trig_workarounds.py
> +   brw_nir_trig_workarounds.py \
> +   brw_oa_hsw.xml \
> +   brw_oa.py
>
>  TEST_LIBS = \
> libi965_compiler.la \
> @@ -169,3 +171,14 @@ test_eu_validate_SOURCES = \
>  test_eu_validate_LDADD = \
> $(top_builddir)/src/gtest/libgtest.la \
> $(TEST_LIBS)
> +
> +BUILT_SOURCES = \
> +   brw_oa_hsw.h \
> +   brw_oa_hsw.c
> +
> +brw_oa_hsw.h brw_oa_hsw.c: brw_oa_hsw.xml brw_oa.py Makefile
Eric reminded me that this is a bit buggy/racy. Something like the
following should be better:

brw_oa_hsw.h: brw_oa_hsw.c
brw_oa_hsw.c: brw_oa_hsw.xml brw_oa.py
 ...

> +   $(PYTHON2) $(PYTHON_FLAGS) $(srcdir)/brw_oa.py \
> +  --header=$(builddir)/brw_oa_hsw.h \
> +  --code=$(builddir)/brw_oa_hsw.c \
> +  --chipset="hsw" \
> +  $(srcdir)/brw_oa_hsw.xml
> diff --git a/src/mesa/drivers/dri/i965/Makefile.sources 
> b/src/mesa/drivers/dri/i965/Makefile.sources
> index 5278e86339..60acd15d41 100644
> --- a/src/mesa/drivers/dri/i965/Makefile.sources
> +++ b/src/mesa/drivers/dri/i965/Makefile.sources
> @@ -135,6 +135,8 @@ i965_FILES = \
> brw_nir_uniforms.cpp \
> brw_object_purgeable.c \
> brw_pipe_control.c \
> +   brw_oa_hsw.h \
> +   brw_oa_hsw.c \
H is after C ;-)

> brw_performance_query.h \
> brw_performance_query.c \
> brw_program.c \
> diff --git a/src/mesa/drivers/dri/i965/brw_oa.py 
> b/src/mesa/drivers/dri/i965/brw_oa.py

> new file mode 100644
> index 00..2c622531af
> --- /dev/null
> +++ b/src/mesa/drivers/dri/i965/brw_oa.py
> @@ -0,0 +1,543 @@
> +#!/usr/bin/env python2
Thanks for omitting the execute bit !
Maybe drop this, since one should/can not execute the file directly ?

> +
> +if args.header:
> +header_file = open(args.header, 'w')
> +

> +
> +h(copyright)
> +h("""#pragma once
Use proper ifndef guards please.

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


[Mesa-dev] Putbits patches

2017-02-24 Thread Thomas Hellstrom
Hi, Christian!

Are you OK with the updated Putbits patches?

https://lists.freedesktop.org/archives/mesa-dev/2017-February/145269.html

https://lists.freedesktop.org/archives/mesa-dev/2017-February/145258.html


Thanks,

Thomas


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


Re: [Mesa-dev] Putbits patches

2017-02-24 Thread Christian König

Am 24.02.2017 um 15:40 schrieb Thomas Hellstrom:

Hi, Christian!

Are you OK with the updated Putbits patches?

https://lists.freedesktop.org/archives/mesa-dev/2017-February/145269.html

https://lists.freedesktop.org/archives/mesa-dev/2017-February/145258.html


Sorry the second patch never made it into my inbox, so I was still 
waiting for that (probably somehow hit the spam filter).


Anyway just send an Acked-by for them by just taking a look at the list 
archive.


Regards,
Christian.




Thanks,

Thomas




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


Re: [Mesa-dev] [PATCH 1/2] st/vdpau: Provide YV12 to NV12 putBits conversion v2

2017-02-24 Thread Christian König

Am 22.02.2017 um 16:25 schrieb Thomas Hellstrom:

mplayer likes putting YV12 data, and if there is a buffer format mismatch,
the vdpau state tracker would try to reallocate the video surface as an
YV12 surface. A virtual driver doesn't like reallocating and doesn't like YV12
surfaces, so if we can't support YV12, try an YV12 to NV12 conversion
instead.

Also advertize that we actually can do the getBits and putBits conversion.

v2: A previous version of this patch prioritized conversion before
reallocating. This has been changed to prioritize reallocating in this version.

Cc: Christian König 
Signed-off-by: Thomas Hellstrom 


Acked-by: Christian König  for both patches.


---
  src/gallium/auxiliary/util/u_video.h   | 42 +
  src/gallium/state_trackers/vdpau/query.c   | 13 +
  src/gallium/state_trackers/vdpau/surface.c | 94 --
  3 files changed, 130 insertions(+), 19 deletions(-)

diff --git a/src/gallium/auxiliary/util/u_video.h 
b/src/gallium/auxiliary/util/u_video.h
index 99a8fd6..7cd6268 100644
--- a/src/gallium/auxiliary/util/u_video.h
+++ b/src/gallium/auxiliary/util/u_video.h
@@ -107,6 +107,48 @@ u_copy_nv12_to_yv12(void *const *destination_data,
 }
  }
  
+/**

+ * \brief  Copy YV12 chroma data while converting it NV12
+ *
+ * Given a set of YV12 source pointers and -pitches, copy the data to a
+ * layout typical for NV12 video buffers.
+ *
+ * \param source data[in]  The plane data pointers. Array of 3.
+ * \param source_pitches[in]  The plane pitches. Array of 3.
+ * \param dst_plane[in]  The destination plane to copy to. For NV12 always 1.
+ * \param dst_field[in]  The destination field if interlaced.
+ * \param dst_stride[in]  The destination stride for this plane.
+ * \param num_fields[in]  The number of fields in the video buffer.
+ * \param dst[in]  The destination plane pointer.
+ * \param width[in]  The source plane width.
+ * \param height[in]  The source plane height.
+ */
+static inline void
+u_copy_nv12_from_yv12(const void *const *source_data,
+  uint32_t const *source_pitches,
+  int dst_plane, int dst_field,
+  int dst_stride, int num_fields,
+  uint8_t *dst,
+  int width, int height)
+{
+   int x, y;
+   unsigned u_stride = source_pitches[2] * num_fields;
+   unsigned v_stride = source_pitches[1] * num_fields;
+   uint8_t *u_src = (uint8_t *)source_data[2] + source_pitches[2] * dst_field;
+   uint8_t *v_src = (uint8_t *)source_data[1] + source_pitches[1] * dst_field;
+
+   /* TODO: SIMD */
+   for (y = 0; y < height; y++) {
+  for (x = 0; x < width; x++) {
+ dst[2*x] = u_src[x];
+ dst[2*x+1] = v_src[x];
+  }
+  u_src += u_stride;
+  v_src += v_stride;
+  dst += dst_stride;
+   }
+}
+
  static inline void
  u_copy_yv12_to_nv12(void *const *destination_data,
  uint32_t const *destination_pitches,
diff --git a/src/gallium/state_trackers/vdpau/query.c 
b/src/gallium/state_trackers/vdpau/query.c
index e69c9b1..435cafd 100644
--- a/src/gallium/state_trackers/vdpau/query.c
+++ b/src/gallium/state_trackers/vdpau/query.c
@@ -123,8 +123,21 @@ 
vlVdpVideoSurfaceQueryGetPutBitsYCbCrCapabilities(VdpDevice device, VdpChromaTyp
  
 switch(bits_ycbcr_format) {

 case VDP_YCBCR_FORMAT_NV12:
+  *is_supported = surface_chroma_type == VDP_CHROMA_TYPE_420;
+  break;
+
 case VDP_YCBCR_FORMAT_YV12:
*is_supported = surface_chroma_type == VDP_CHROMA_TYPE_420;
+
+  /* We can convert YV12 to NV12 on the fly! */
+  if (*is_supported &&
+  pscreen->is_video_format_supported(pscreen,
+ PIPE_FORMAT_NV12,
+ PIPE_VIDEO_PROFILE_UNKNOWN,
+ PIPE_VIDEO_ENTRYPOINT_BITSTREAM)) 
{
+ pipe_mutex_unlock(dev->mutex);
+ return VDP_STATUS_OK;
+  }
break;
  
 case VDP_YCBCR_FORMAT_UYVY:

diff --git a/src/gallium/state_trackers/vdpau/surface.c 
b/src/gallium/state_trackers/vdpau/surface.c
index 9a80605..e0dff4e 100644
--- a/src/gallium/state_trackers/vdpau/surface.c
+++ b/src/gallium/state_trackers/vdpau/surface.c
@@ -304,9 +304,11 @@ vlVdpVideoSurfacePutBitsYCbCr(VdpVideoSurface surface,
uint32_t const *source_pitches)
  {
 enum pipe_format pformat = FormatYCBCRToPipe(source_ycbcr_format);
+   enum getbits_conversion conversion = CONVERSION_NONE;
 struct pipe_context *pipe;
 struct pipe_sampler_view **sampler_views;
 unsigned i, j;
+   unsigned usage = PIPE_TRANSFER_WRITE;
  
 vlVdpSurface *p_surf = vlGetDataHTAB(surface);

 if (!p_surf)
@@ -320,24 +322,53 @@ vlVdpVideoSurfacePutBitsYCbCr(VdpVideoSurface surface,
 return VDP_STATUS_INVALID_POINTER;
  
 pipe_mutex_lock(p_surf->device->mutex);

-   if (p_surf->video_buffer == NULL || pformat != 
p_surf-

Re: [Mesa-dev] [PATCH v2 8/14] anv: generate anv_entrypoints.{h, c} in one command

2017-02-24 Thread Emil Velikov
On 24 February 2017 at 11:10, Eric Engestrom  wrote:
> On Thursday, 2017-02-23 10:46:21 -0800, Dylan Baker wrote:
>> This changes the python generator to write the files itself, rather than
>> piping them out. This has a couple of advantages: first, it encapsulates
>> the encoding. Second, it ensures that the header file and code file are
>> generated at the same time with the same data.
>>
>> v2: - Update Android.mk
>>
>> Signed-off-by: Dylan Baker 
>> ---
>>  src/intel/vulkan/Android.mk |  7 +-
>>  src/intel/vulkan/Makefile.am|  8 ++
>>  src/intel/vulkan/anv_entrypoints_gen.py | 33 +-
>>  3 files changed, 22 insertions(+), 26 deletions(-)
>>
>> diff --git a/src/intel/vulkan/Android.mk b/src/intel/vulkan/Android.mk
>> index 9dabf1c..df10141 100644
>> --- a/src/intel/vulkan/Android.mk
>> +++ b/src/intel/vulkan/Android.mk
>> @@ -60,8 +60,8 @@ $(intermediates)/dummy.c:
>>   @echo "Gen Dummy: $(PRIVATE_MODULE) <= $(notdir $(@))"
>>   $(hide) touch $@
>>
>> -$(intermediates)/anv_entrypoints.h:
>> - $(VK_ENTRYPOINTS_SCRIPT) header --xml 
>> $(MESA_TOP)/src/vulkan/registry/vk.xml > $@
>> +$(intermediates)/anv_entrypoints.h $(intermediates)/anv_entrypoints.c:
>> + $(VK_ENTRYPOINTS_SCRIPT) --xml $(MESA_TOP)/src/vulkan/registry/vk.xml
>
> You forgot to add the new argument here.
>

>> -anv_entrypoints.h : anv_entrypoints_gen.py $(vulkan_api_xml)
>> - $(AM_V_GEN)$(PYTHON2) $(srcdir)/anv_entrypoints_gen.py header --xml 
>> $(vulkan_api_xml) > $@
>> -
>> -anv_entrypoints.c : anv_entrypoints_gen.py $(vulkan_api_xml)
>> - $(AM_V_GEN)$(PYTHON2) $(srcdir)/anv_entrypoints_gen.py code --xml 
>> $(vulkan_api_xml) > $@
>> +anv_entrypoints.h anv_entrypoints.c: anv_entrypoints_gen.py 
>> $(vulkan_api_xml)
>
> This will run the script twice, once for anv_entrypoints.h and once for
> anv_entrypoints.c, but the script will write both, both times.
> This also introduces a race condition when using `make -j N`, as it will
> have two threads writing to both files, potentially at the same time.
>
Quick and easy fix is to split roughly like:

anv_entrypoints.h: anv_entrypoints.c
anv_entrypoints.c: anv_entrypoints_gen.py $(vulkan_api_xml)
...

Not 100% sure on the above suggestion - someone please correct me.

Yet again, we have this (bug?) rather often so feel free to address it
(and other comment from Eric) as follow-up ?
IMHO the only "blocker" is the missing --outdir in Android.mk

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


  1   2   >