[Mesa-dev] [Bug 105371] r600_shader_from_tgsi - GPR limit exceeded - shader requires 360 registers

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

--- Comment #4 from Gert Wollny  ---
The patch is not yet committed, I'll try a bit harder for the 18.3 release
cycle. 

Actually, with the current mesa version you should have the spilling code in
place, and if you see this error then the shader either uses many registers
that are not organized as arrays, so they will not be spilled and my patch will
not help, or you may have encountered a case where the shader uses exactly the
amount of registers that falls in the gap between failing and forcing spilling.
I encountered something like this with the latest Unreal editor and a certain
level design. I plan to send out a patch to deal with this too, but haven't
gotten around this. 

Essentially in r600_shader.c:3550 (more or less) you have 

   if (regno > 124) {
choose_spill_arrays(&ctx, ®no, &pipeshader->scratch_space_needed);
shader->indirect_files = ctx.info.indirect_files;
  }

but the shader needs around 10-20 registers more then regno, so the limit
should be more like 100. That said the spilling has its own problems, there is
still something going wrong with the synchronization I think. 

Apart from that: 
Note that when you apply the mbox, the first "patch" is the cover letter and
this you have to skip with "git am --skip", after that the latest version of
the series should apply cleanly (thanks @mirth for pointing out how to do this
with pwclient and where the github tree is)

hope that helps,

-- 
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] egl/wayland: do not leak wl_buffer when it is locked

2018-08-07 Thread Juan A. Suarez Romero
On Thu, 2018-08-02 at 11:01 +0200, Juan A. Suarez Romero wrote:
> If color buffer is locked, do not set its wayland buffer to NULL;
> otherwise it can not be freed later.
> 
> This also fixes dEQP-EGL.functional.swap_buffers_with_damage.* tests.

CC: Daniel Stone 
CC: Eric Engestrom 

> ---
>  src/egl/drivers/dri2/platform_wayland.c | 7 ---
>  1 file changed, 4 insertions(+), 3 deletions(-)
> 
> diff --git a/src/egl/drivers/dri2/platform_wayland.c 
> b/src/egl/drivers/dri2/platform_wayland.c
> index dca099500a8..69e1dac0ff7 100644
> --- a/src/egl/drivers/dri2/platform_wayland.c
> +++ b/src/egl/drivers/dri2/platform_wayland.c
> @@ -412,8 +412,11 @@ dri2_wl_release_buffers(struct dri2_egl_surface 
> *dri2_surf)
>  
> for (int i = 0; i < ARRAY_SIZE(dri2_surf->color_buffers); i++) {
>if (dri2_surf->color_buffers[i].wl_buffer &&
> -  !dri2_surf->color_buffers[i].locked)
> +  !dri2_surf->color_buffers[i].locked) {
>   wl_buffer_destroy(dri2_surf->color_buffers[i].wl_buffer);
> + dri2_surf->color_buffers[i].wl_buffer = NULL;
> +  }
> +
>if (dri2_surf->color_buffers[i].dri_image)
>   
> dri2_dpy->image->destroyImage(dri2_surf->color_buffers[i].dri_image);
>if (dri2_surf->color_buffers[i].linear_copy)
> @@ -422,11 +425,9 @@ dri2_wl_release_buffers(struct dri2_egl_surface 
> *dri2_surf)
>   munmap(dri2_surf->color_buffers[i].data,
>  dri2_surf->color_buffers[i].data_size);
>  
> -  dri2_surf->color_buffers[i].wl_buffer = NULL;
>dri2_surf->color_buffers[i].dri_image = NULL;
>dri2_surf->color_buffers[i].linear_copy = NULL;
>dri2_surf->color_buffers[i].data = NULL;
> -  dri2_surf->color_buffers[i].locked = false;
> }
>  
> if (dri2_dpy->dri2)

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


[Mesa-dev] [Bug 107508] Crash in st_renderbuffer_delete()

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

Bug ID: 107508
   Summary: Crash in st_renderbuffer_delete()
   Product: Mesa
   Version: unspecified
  Hardware: Other
OS: All
Status: NEW
  Severity: normal
  Priority: medium
 Component: Mesa core
  Assignee: mesa-dev@lists.freedesktop.org
  Reporter: four...@xfce.org
QA Contact: mesa-dev@lists.freedesktop.org

Created attachment 140994
  --> https://bugs.freedesktop.org/attachment.cgi?id=140994&action=edit
Simple reproducer program

Description:

Some X11/GLX clients can cause a crash of the Xserver in Mesa code.

How reproducible:

Always

Steps to reproduce:

1. Run a Xephyr Xserver wit hglamor enabled:

   $ Xephyr -glamor :12

2. Save and build the attached reproducer:

   $ gcc -g gl3.cxx -o gl3 $(pkg-config --cflags --libs  x11) -lGL -lGLU

   (this is based on
https://www.khronos.org/opengl/wiki/Tutorial:_OpenGL_3.0_Context_Creation_(GLX)
modified to use indirect contexts)

3. Run the reproducer against the Xephyr display:

   $ DISPLAY=:12 ./gl3

Actual result:

Crash of the Xserver in Mesa code because of a NULL pointer dereference (see
below).

Expected result:

No crash

Additional data:

This is not a new issue and it seems it's been around for quite some time, yet
it's fairly rare to trigger because it involves trying to use an indirect GLX
context.

One noticeable occurrence of this issue is "Slack" being run from "snap":

  https://bugzilla.redhat.com/1611140
  https://bugs.launchpad.net/ubuntu/+source/xorg-server/+bug/1762971
  https://bugs.launchpad.net/ubuntu/+source/mesa/+bug/1754693
  etc.

I posted a (simple) patch that fixes the issue here:

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

But wanted to get a bit further in my investigation and possibly come up with a
simple[r] reproducer (see “Steps to reproduce” above).

Crash occurs in `st_renderbuffer_delete()` because cts->st in NULL:

Thread 1 "Xephyr" received signal SIGSEGV, Segmentation fault.
in st_renderbuffer_delete () at state_tracker/st_cb_fbo.c:241
241 pipe_surface_release(st->pipe, &strb->surface_srgb);
(gdb) bt
#0  0x7fffe73054d0 in st_renderbuffer_delete (ctx=0x9c6020, rb=0xfc7320) at
state_tracker/st_cb_fbo.c:241
#1  0x7fffe726a931 in _mesa_reference_renderbuffer_
(ptr=ptr@entry=0xfc6fd8, rb=rb@entry=0x0) at main/renderbuffer.c:212
#2  0x7fffe71f96ca in _mesa_reference_renderbuffer (rb=0x0, ptr=0xfc6fd8)
at main/renderbuffer.h:72
#3  _mesa_free_framebuffer_data (fb=fb@entry=0xfc6e90) at
main/framebuffer.c:229
#4  0x7fffe71f971e in _mesa_destroy_framebuffer (fb=0xfc6e90) at
main/framebuffer.c:207
#5  0x7fffe71f97c9 in _mesa_reference_framebuffer_ (ptr=ptr@entry=0xe3d4b0,
fb=fb@entry=0x0) at main/framebuffer.c:265
#6  0x7fffe7160782 in _mesa_reference_framebuffer (fb=0x0, ptr=0xe3d4b0) at
main/framebuffer.h:63
#7  _mesa_free_context_data (ctx=ctx@entry=0xe3d3a0) at main/context.c:1326
#8  0x7fffe7311ef5 in st_destroy_context (st=0xfc0eb0) at
state_tracker/st_context.c:653
#9  0x7fffe74e9cb9 in dri_destroy_context () at dri_context.c:239
#10 0x7fffe74e8c43 in driDestroyContext (pcp=0x895430) at dri_util.c:524
#11 0x005110c9 in __glXDRIcontextDestroy (baseContext=0x895360) at
glxdriswrast.c:132
#12 0x0050fe3b in __glXFreeContext (cx=0x895360) at glxext.c:190
#13 ContextGone (cx=0x895360, id=) at glxext.c:82
#14 0x00468f7d in doFreeResource (res=0xfc6bc0, skip=0) at
resource.c:880
#15 0x00469be5 in FreeResourceByType (id=,
type=, skipFree=) at resource.c:941
#16 0x00514fa1 in __glXDisp_DestroyContext (cl=,
pc=0xdd9440 "\225\004\002") at glxcmds.c:437
#17 0x0052ebc8 in dispatch_DestroyContext (client=0xadbf70) at
vnd_dispatch_stubs.c:86
#18 0x004450e0 in Dispatch () at dispatch.c:478
#19 0x00448fe6 in dix_main (argc=3, argv=0x7fffced8,
envp=) at main.c:276
#20 0x732b024b in __libc_start_main () from /lib64/libc.so.6
#21 0x0042ba5a in _start () at ephyrinit.c:51
(gdb) p st
$1 = (struct st_context *) 0x0

That context `ctx=0x9c6020` with the `ctx->st` == `NULL` was created by glamor
for the screen pixmap:

Thread 1 "Xephyr" hit Breakpoint 3, _mesa_init_renderbuffer (rb=0xadc910,
name=4294967295) at main/renderbuffer.c:41
41 GET_CURRENT_CONTEXT(ctx);
(gdb) bt
#0  _mesa_init_renderbuffer (rb=0xadc910, name=4294967295) at
main/renderbuffer.c:41
#1  0x7fffedec21bc in intel_new_renderbuffer (ctx=,
name=4294967295) at intel_fbo.c:506
#2  0x7fffedb1aa3b in _mesa_update_texture_renderbuffer (ctx=0x9c6020,
fb=0xadd910, att=0xaddb68) at main/fbobject.c:459
#3  0x7fffedb1dc90 in set_texture_attachment (layered=0 '\000', layer=0,
level=0, texTarget=, texObj=0xab5630, att=0xaddb68, 
fb=0xadd910, ctx=0x9c6020) at main/fbobject.c:528
#4  _mesa_framebuffer_texture (ctx=0x9c6020, fb=0xadd910, attachment=36064,
att=0xaddb68, t

Re: [Mesa-dev] [PATCH RFC] st/mesa: check st_context in st_renderbuffer_delete()

2018-08-07 Thread Olivier Fourdan
Hi,

On Fri, Aug 3, 2018 at 7:03 PM Aaron Watry  wrote:
>
> Tested-by: Aaron Watry 
>
> Yay, I can finally use gnome/wayland with the Slack snap again without
> insta-crashing my session.
>
> --Aaron
>
> On Thu, Aug 2, 2018 at 7:29 AM, Olivier Fourdan  wrote:
> > st_renderbuffer_delete() can segfault if we get a non-NULL context
> > pointer but if the st_context is NULL:
> >
> >   Thread 1 "Xwayland" received signal SIGSEGV, Segmentation fault.
> >   in st_renderbuffer_delete () at state_tracker/st_cb_fbo.c:241
> >   241 pipe_surface_release(st->pipe, &strb->surface_srgb);
> >   (gdb) bt
> >   #0  st_renderbuffer_delete () at state_tracker/st_cb_fbo.c:241
> >   #1  _mesa_reference_renderbuffer_ () at main/renderbuffer.c:212
> >   #2  _mesa_reference_renderbuffer () at main/renderbuffer.h:72
> >   #3  _mesa_free_framebuffer_data (0) at main/framebuffer.c:229
> >   #4  _mesa_destroy_framebuffer () at main/framebuffer.c:207
> >   #5  _mesa_reference_framebuffer_ () at main/framebuffer.c:265
> >   #6  _mesa_reference_framebuffer () at main/framebuffer.h:63
> >   #7  _mesa_free_context_data () at main/context.c:1326
> >   #8  st_destroy_context () at state_tracker/st_context.c:653
> >   #9  dri_destroy_context () at dri_context.c:239
> >   #10 driDestroyContext () at dri_util.c:524
> >   #11 __glXDRIcontextDestroy () at glxdriswrast.c:132
> >   #12 __glXFreeContext () at glxext.c:190
> >   #13 ContextGone () at glxext.c:82
> >   #14 doFreeResource () at resource.c:880
> >   #15 FreeResourceByType () at resource.c:941
> >   #16 __glXDisp_DestroyContext () at glxcmds.c:437
> >   #17 dispatch_DestroyContext () at vnd_dispatch_stubs.c:82
> >   #18 Dispatch () at dispatch.c:478
> >   #19 dix_main () at main.c:276
> >   #20 __libc_start_main () from /lib64/libc.so.6
> >   #21 _start () at glxcmds.c:125
> >
> >   (gdb) p st
> >   $1 = (struct st_context *) 0x0
> >
> > Check for a non-NULL st_context pointer as well to avoid the crash.
> >
> > Bugzilla: https://bugzilla.redhat.com/1611140
> > Signed-off-by: Olivier Fourdan 
> > ---
> >  Note: This fixes several bug reported downstream, like:
> >   https://bugzilla.redhat.com/1611140
> >   https://bugs.launchpad.net/ubuntu/+source/xorg-server/+bug/1762971
> >   https://bugs.launchpad.net/ubuntu/+source/mesa/+bug/1754693
> >   etc.
> >  I don't know what this client actually does, but whatever it is it should
> >  not crash Xwayland because of Mesa...
> >  I tested this fix against the given reproducer (run snap on 
> > Wayland/Xwayland)
> >  and it works.
> >
> >  src/mesa/state_tracker/st_cb_fbo.c | 6 --
> >  1 file changed, 4 insertions(+), 2 deletions(-)
> >
> > diff --git a/src/mesa/state_tracker/st_cb_fbo.c 
> > b/src/mesa/state_tracker/st_cb_fbo.c
> > index 73414fdfa1..856d213b73 100644
> > --- a/src/mesa/state_tracker/st_cb_fbo.c
> > +++ b/src/mesa/state_tracker/st_cb_fbo.c
> > @@ -238,8 +238,10 @@ st_renderbuffer_delete(struct gl_context *ctx, struct 
> > gl_renderbuffer *rb)
> > struct st_renderbuffer *strb = st_renderbuffer(rb);
> > if (ctx) {
> >struct st_context *st = st_context(ctx);
> > -  pipe_surface_release(st->pipe, &strb->surface_srgb);
> > -  pipe_surface_release(st->pipe, &strb->surface_linear);
> > +  if (st) {
> > + pipe_surface_release(st->pipe, &strb->surface_srgb);
> > + pipe_surface_release(st->pipe, &strb->surface_linear);
> > +  }
> >strb->surface = NULL;
> > }
> > pipe_resource_reference(&strb->texture, NULL);

To better understand why this crash occurs, I filed:

Bugzilla: https://bugs.freedesktop.org/show_bug.cgi?id=107508

With a simple reproducer program. This is not affecting only Xwayland,
but also Xephyr with glamor backend as well.

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


[Mesa-dev] [Bug 107508] Crash in st_renderbuffer_delete()

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

--- Comment #1 from Olivier Fourdan  ---
Note that I checked with both gdb/breakpoints and valgrind as well, it is not a
double free or memory corruption.

-- 
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 107508] Crash in st_renderbuffer_delete()

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

--- Comment #2 from Olivier Fourdan  ---
Important (sorry I forgot), to reproduce, it requires Ajax' patch:

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

(Otherwise the reproducer dies with a [xcb] “Unknown sequence number while
processing queue”)

-- 
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] i965: do not emit empty sampler state

2018-08-07 Thread Erik Faye-Lund

On 06. aug. 2018 16:15, Lionel Landwerlin wrote:

Hey Erik,

I don't think this is right, because by not filling out_offset, you're 
leaving it at 0 which makes the entry in the binding table point to a 
dynamic state base address.

I would emit the null surface instead.



Hmm, good point. I'll rework it and resend.
___
mesa-dev mailing list
mesa-dev@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/mesa-dev


Re: [Mesa-dev] [PATCH v2] drirc: Allow extension midshader for Metro Redux

2018-08-07 Thread Tapani Pälli

LGTM
Reviewed-by: Tapani Pälli 

On 08/06/2018 03:52 PM, vadym.shovkoplias wrote:

This fixes both Metro 2033 Redux and Metro Last Light Redux

Bugzilla: https://bugs.freedesktop.org/show_bug.cgi?id=99730
Signed-off-by: Eero Tamminen 
Signed-off-by: Vadym Shovkoplias 
---
  src/util/drirc | 4 
  1 file changed, 4 insertions(+)

diff --git a/src/util/drirc b/src/util/drirc
index 8ece875e34..c4f9e060f3 100644
--- a/src/util/drirc
+++ b/src/util/drirc
@@ -120,6 +120,10 @@ TODO: document the other workarounds.
  
  
  
+

+
+
+
  
  
  


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


Re: [Mesa-dev] [PATCH v2] glcpp: Sync line number for macro

2018-08-07 Thread Tapani Pälli


On 07/22/2018 11:36 PM, zhaowei yuan wrote:

Line number of a predefined macro should be set
as where it is referenced rather than declared

Patch v2 does nothing more except ccing more maintainers

Signed-off-by: zhaowei yuan 
Bugzilla: https://patchwork.freedesktop.org/patch/225818/


Probably a copy-paste mistake here, this should be the bug url instead 
of patchwork one, https://bugs.freedesktop.org/show_bug.cgi?id=99730.


IMO commit message should also mention the tests that it fixes, which are:

dEQP-GLES2.functional.shaders.preprocessor.predefined_macros.line_2_vertex
dEQP-GLES2.functional.shaders.preprocessor.predefined_macros.line_2_fragment

(same tests exist also in dEQP-GLES3)

I've run this through Intel CI and did not see any failures, I also run 
some dEQP preprocessor tests with valgrind and did not see anything 
reported;


Tested-by: Tapani Pälli 

some small coding style issues noted below:


---
  src/compiler/glsl/glcpp/glcpp-lex.l   |  1 +
  src/compiler/glsl/glcpp/glcpp-parse.y | 55 ++-
  src/compiler/glsl/glcpp/glcpp.h   |  4 ++-
  src/compiler/glsl/glcpp/pp.c  |  3 +-
  4 files changed, 54 insertions(+), 9 deletions(-)

diff --git a/src/compiler/glsl/glcpp/glcpp-lex.l 
b/src/compiler/glsl/glcpp/glcpp-lex.l
index 9cfcc12..86b82c2 100644
--- a/src/compiler/glsl/glcpp/glcpp-lex.l
+++ b/src/compiler/glsl/glcpp/glcpp-lex.l
@@ -50,6 +50,7 @@ void glcpp_set_column (int  column_no , yyscan_t yyscanner);
yylloc->first_line = yylloc->last_line = yylineno;\
yycolumn += yyleng; \
yylloc->last_column = yycolumn + 1;  \
+   yylloc->position = (yytext - 
YY_CURRENT_BUFFER_LVALUE->yy_ch_buf); \
parser->has_new_line_number = 0; \
parser->has_new_source_number = 0;   \
} while(0);
diff --git a/src/compiler/glsl/glcpp/glcpp-parse.y 
b/src/compiler/glsl/glcpp/glcpp-parse.y
index ccb3aa1..68f8477 100644
--- a/src/compiler/glsl/glcpp/glcpp-parse.y
+++ b/src/compiler/glsl/glcpp/glcpp-parse.y
@@ -1021,7 +1021,7 @@ _token_list_append_list(token_list_t *list, token_list_t 
*tail)
  }
  
  static token_list_t *

-_token_list_copy(glcpp_parser_t *parser, token_list_t *other)
+_token_list_copy(glcpp_parser_t *parser, token_list_t *other, token_node_t 
*macro_node)
  {
 token_list_t *copy;
 token_node_t *node;
@@ -1033,6 +1033,12 @@ _token_list_copy(glcpp_parser_t *parser, token_list_t 
*other)
 for (node = other->head; node; node = node->next) {
token_t *new_token = linear_alloc_child(parser->linalloc, 
sizeof(token_t));
*new_token = *node->token;
+
+  if(macro_node) {


should have space after if


+ new_token->location.first_line = 
macro_node->token->location.first_line;
+ new_token->location.last_line = macro_node->token->location.last_line;
+  }
+
_token_list_append (parser, copy, new_token);
 }
  
@@ -1349,7 +1355,7 @@ add_builtin_define(glcpp_parser_t *parser, const char *name, int value)
  
  glcpp_parser_t *

  glcpp_parser_create(const struct gl_extensions *extension_list,
-glcpp_extension_iterator extensions, void *state, gl_api 
api)
+glcpp_extension_iterator extensions, void *state, gl_api 
api, const char *input)
  {
 glcpp_parser_t *parser;
  
@@ -1377,6 +1383,11 @@ glcpp_parser_create(const struct gl_extensions *extension_list,

 parser->lex_from_list = NULL;
 parser->lex_from_node = NULL;
  
+   parser->input = _mesa_string_buffer_create(parser, strlen(input) + 1);

+   strcpy(parser->input->buf, input);
+   parser->input->buf[strlen(input)] = '\0';
+   parser->input->length = strlen(input);
+
 parser->output = _mesa_string_buffer_create(parser,
 INITIAL_PP_OUTPUT_BUF_SIZE);
 parser->info_log = _mesa_string_buffer_create(parser,
@@ -1441,7 +1452,7 @@ typedef enum function_status
  static function_status_t
  _arguments_parse(glcpp_parser_t *parser,
   argument_list_t *arguments, token_node_t *node,
- token_node_t **last)
+ token_node_t **last, int *end_position)
  {
 token_list_t *argument;
 int paren_count;
@@ -1465,8 +1476,10 @@ _arguments_parse(glcpp_parser_t *parser,
   paren_count++;
} else if (node->token->type == ')') {
   paren_count--;
- if (paren_count == 0)
+ if (paren_count == 0) {
+*end_position = node->token->location.position;
  break;
+ }
}
  
if (node->token->type == ',' && paren_count == 1) {

@@ -1702,6 +1715,28 @@ _glcpp_parser_apply_pastes(glcpp_parser_t *parser, 
token_list_t *list)
 list->non_space_tail = list->tail;
  }
  
+static int

+_glcpp_parser_get_line(glcpp_parser_t *parser, int offset)
+{
+   int line = 1;
+  

[Mesa-dev] [PATCH] intel: don't build tools without -Dtools=intel

2018-08-07 Thread Lionel Landwerlin
Bugzilla: https://bugs.freedesktop.org/show_bug.cgi?id=107487
Fixes: 4334196ab325c6w ("intel: tools: simplify meson build")
Signed-off-by: Lionel Landwerlin 
---
 src/intel/meson.build   |  4 +++-
 src/intel/tools/meson.build | 26 --
 2 files changed, 15 insertions(+), 15 deletions(-)

diff --git a/src/intel/meson.build b/src/intel/meson.build
index ccaf16a76f9..37a231f9567 100644
--- a/src/intel/meson.build
+++ b/src/intel/meson.build
@@ -26,7 +26,9 @@ subdir('genxml')
 subdir('isl')
 subdir('common')
 subdir('compiler')
-subdir('tools')
+if with_tools.contains('intel')
+  subdir('tools')
+endif
 if with_intel_vk
   subdir('vulkan')
 endif
diff --git a/src/intel/tools/meson.build b/src/intel/tools/meson.build
index ac99adb4e1e..cef0f2e956a 100644
--- a/src/intel/tools/meson.build
+++ b/src/intel/tools/meson.build
@@ -18,8 +18,6 @@
 # OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
 # SOFTWARE.
 
-build_intel_tools = with_tools.contains('intel')
-
 aubinator = executable(
   'aubinator',
   files('aubinator.c', 'intel_aub.h'),
@@ -27,8 +25,8 @@ aubinator = executable(
   include_directories : [inc_common, inc_intel],
   link_with : [libintel_common, libintel_compiler, libintel_dev, libmesa_util],
   c_args : [c_vis_args, no_override_init_args],
-  build_by_default : build_intel_tools,
-  install : build_intel_tools
+  build_by_default : true,
+  install : true
 )
 
 aubinator_error_decode = executable(
@@ -38,8 +36,8 @@ aubinator_error_decode = executable(
   include_directories : [inc_common, inc_intel],
   link_with : [libintel_common, libintel_compiler, libintel_dev, libmesa_util],
   c_args : [c_vis_args, no_override_init_args],
-  build_by_default : build_intel_tools,
-  install : build_intel_tools
+  build_by_default : true,
+  install : true
 )
 
 error2aub = executable(
@@ -49,8 +47,8 @@ error2aub = executable(
   include_directories : [inc_common, inc_intel, inc_drm_uapi],
   link_with : [libintel_dev],
   c_args : [c_vis_args, no_override_init_args],
-  build_by_default : build_intel_tools,
-  install : build_intel_tools
+  build_by_default : true,
+  install : true
 )
 
 sanitize_data = configuration_data()
@@ -62,7 +60,7 @@ configure_file(
   input: 'intel_sanitize_gpu.in',
   output: '@BASENAME@',
   install_dir: get_option('bindir'),
-  install: build_intel_tools,
+  install: true,
   configuration: sanitize_data
 )
 
@@ -73,9 +71,9 @@ libintel_sanitize_gpu = shared_library(
   include_directories : [inc_common, inc_intel, inc_drm_uapi],
   link_with : [libintel_common, libmesa_util],
   c_args : [c_vis_args, no_override_init_args],
-  build_by_default : build_intel_tools,
+  build_by_default : true,
   install_dir: get_option('libexecdir'),
-  install: build_intel_tools
+  install: true
 )
 
 configure_file(
@@ -83,7 +81,7 @@ configure_file(
   output : '@BASENAME@',
   install_dir: get_option('bindir'),
   configuration: sanitize_data,
-  install: build_intel_tools
+  install: true
 )
 
 libintel_dump_gpu = shared_library(
@@ -94,7 +92,7 @@ libintel_dump_gpu = shared_library(
   include_directories : [inc_common, inc_intel, inc_drm_uapi],
   link_with : libintel_dev,
   c_args : [c_vis_args, no_override_init_args],
-  build_by_default : build_intel_tools,
+  build_by_default : true,
   install_dir: get_option('libexecdir'),
-  install: build_intel_tools
+  install: true
 )
-- 
2.18.0

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


[Mesa-dev] [Bug 107509] corrupted Box in top Right corner in some games

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

Bug ID: 107509
   Summary: corrupted Box in top Right corner in some games
   Product: Mesa
   Version: unspecified
  Hardware: Other
OS: All
Status: NEW
  Severity: normal
  Priority: medium
 Component: Other
  Assignee: mesa-dev@lists.freedesktop.org
  Reporter: monkeyinastripedsh...@gmail.com
QA Contact: mesa-dev@lists.freedesktop.org

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

In some games there is a whitish box in the top right corner of the game, it
doesn't react to the movement of the ingame player but does shift colors over
time, mostly shades of grey. 

I first found it in Ziggurat, "Applying" settings causes causes it to go away
for a single level, after which it shows up again. In Payday 2 the box also
shows up, changing the resolution seems to not affect the box however changing
the shadow resolution seems to change the "contents" of the box. No other
settings appear to affect the box.

dmesg only shows this:
radeon_dp_aux_transfer_native: 242 callbacks suppressed
radeon_dp_aux_transfer_native: 242 callbacks suppressed
radeon_dp_aux_transfer_native: 74 callbacks suppressed
radeon_dp_aux_transfer_native: 74 callbacks suppressed

Attached should be the glxinfo output along with the xorg logs.

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


[Mesa-dev] [PATCH mesa] i965: gen_shader_sha1() doesn't use the brw_context

2018-08-07 Thread Eric Engestrom
Signed-off-by: Eric Engestrom 
---
 src/mesa/drivers/dri/i965/brw_disk_cache.c | 8 
 1 file changed, 4 insertions(+), 4 deletions(-)

diff --git a/src/mesa/drivers/dri/i965/brw_disk_cache.c 
b/src/mesa/drivers/dri/i965/brw_disk_cache.c
index 9a6f2ff570c275e7ad53..65fcab24b7f93661d348 100644
--- a/src/mesa/drivers/dri/i965/brw_disk_cache.c
+++ b/src/mesa/drivers/dri/i965/brw_disk_cache.c
@@ -53,8 +53,8 @@ debug_enabled_for_stage(gl_shader_stage stage)
 }
 
 static void
-gen_shader_sha1(struct brw_context *brw, struct gl_program *prog,
-gl_shader_stage stage, void *key, unsigned char *out_sha1)
+gen_shader_sha1(struct gl_program *prog, gl_shader_stage stage,
+void *key, unsigned char *out_sha1)
 {
char sha1_buf[41];
unsigned char sha1[20];
@@ -120,7 +120,7 @@ read_and_upload(struct brw_context *brw, struct disk_cache 
*cache,
 */
brw_prog_key_set_id(&prog_key, stage, 0);
 
-   gen_shader_sha1(brw, prog, stage, &prog_key, binary_sha1);
+   gen_shader_sha1(prog, stage, &prog_key, binary_sha1);
 
size_t buffer_size;
uint8_t *buffer = disk_cache_get(cache, binary_sha1, &buffer_size);
@@ -277,7 +277,7 @@ write_program_data(struct brw_context *brw, struct 
gl_program *prog,
 
unsigned char sha1[20];
char buf[41];
-   gen_shader_sha1(brw, prog, stage, key, sha1);
+   gen_shader_sha1(prog, stage, key, sha1);
_mesa_sha1_format(buf, sha1);
if (brw->ctx._Shader->Flags & GLSL_CACHE_INFO) {
   fprintf(stderr, "putting binary in cache: %s\n", buf);
-- 
Cheers,
  Eric

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


[Mesa-dev] [Bug 107509] corrupted Box in top Right corner in some games

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

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

-- 
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 107509] corrupted Box in top Right corner in some games

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

--- Comment #2 from monkeyinastripedsh...@gmail.com ---
Created attachment 140999
  --> https://bugs.freedesktop.org/attachment.cgi?id=140999&action=edit
Payday 2 box

-- 
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 107509] corrupted Box in top Right corner in some games

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

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

-- 
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] intel: don't build tools without -Dtools=intel

2018-08-07 Thread Eric Engestrom
On Tuesday, 2018-08-07 11:42:52 +0100, Lionel Landwerlin wrote:
> Bugzilla: https://bugs.freedesktop.org/show_bug.cgi?id=107487
> Fixes: 4334196ab325c6w ("intel: tools: simplify meson build")
> Signed-off-by: Lionel Landwerlin 

Reviewed-by: Eric Engestrom 

> ---
>  src/intel/meson.build   |  4 +++-
>  src/intel/tools/meson.build | 26 --
>  2 files changed, 15 insertions(+), 15 deletions(-)
> 
> diff --git a/src/intel/meson.build b/src/intel/meson.build
> index ccaf16a76f9..37a231f9567 100644
> --- a/src/intel/meson.build
> +++ b/src/intel/meson.build
> @@ -26,7 +26,9 @@ subdir('genxml')
>  subdir('isl')
>  subdir('common')
>  subdir('compiler')
> -subdir('tools')
> +if with_tools.contains('intel')
> +  subdir('tools')
> +endif
>  if with_intel_vk
>subdir('vulkan')
>  endif
> diff --git a/src/intel/tools/meson.build b/src/intel/tools/meson.build
> index ac99adb4e1e..cef0f2e956a 100644
> --- a/src/intel/tools/meson.build
> +++ b/src/intel/tools/meson.build
> @@ -18,8 +18,6 @@
>  # OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN 
> THE
>  # SOFTWARE.
>  
> -build_intel_tools = with_tools.contains('intel')
> -
>  aubinator = executable(
>'aubinator',
>files('aubinator.c', 'intel_aub.h'),
> @@ -27,8 +25,8 @@ aubinator = executable(
>include_directories : [inc_common, inc_intel],
>link_with : [libintel_common, libintel_compiler, libintel_dev, 
> libmesa_util],
>c_args : [c_vis_args, no_override_init_args],
> -  build_by_default : build_intel_tools,
> -  install : build_intel_tools
> +  build_by_default : true,
> +  install : true
>  )
>  
>  aubinator_error_decode = executable(
> @@ -38,8 +36,8 @@ aubinator_error_decode = executable(
>include_directories : [inc_common, inc_intel],
>link_with : [libintel_common, libintel_compiler, libintel_dev, 
> libmesa_util],
>c_args : [c_vis_args, no_override_init_args],
> -  build_by_default : build_intel_tools,
> -  install : build_intel_tools
> +  build_by_default : true,
> +  install : true
>  )
>  
>  error2aub = executable(
> @@ -49,8 +47,8 @@ error2aub = executable(
>include_directories : [inc_common, inc_intel, inc_drm_uapi],
>link_with : [libintel_dev],
>c_args : [c_vis_args, no_override_init_args],
> -  build_by_default : build_intel_tools,
> -  install : build_intel_tools
> +  build_by_default : true,
> +  install : true
>  )
>  
>  sanitize_data = configuration_data()
> @@ -62,7 +60,7 @@ configure_file(
>input: 'intel_sanitize_gpu.in',
>output: '@BASENAME@',
>install_dir: get_option('bindir'),
> -  install: build_intel_tools,
> +  install: true,
>configuration: sanitize_data
>  )
>  
> @@ -73,9 +71,9 @@ libintel_sanitize_gpu = shared_library(
>include_directories : [inc_common, inc_intel, inc_drm_uapi],
>link_with : [libintel_common, libmesa_util],
>c_args : [c_vis_args, no_override_init_args],
> -  build_by_default : build_intel_tools,
> +  build_by_default : true,
>install_dir: get_option('libexecdir'),
> -  install: build_intel_tools
> +  install: true
>  )
>  
>  configure_file(
> @@ -83,7 +81,7 @@ configure_file(
>output : '@BASENAME@',
>install_dir: get_option('bindir'),
>configuration: sanitize_data,
> -  install: build_intel_tools
> +  install: true
>  )
>  
>  libintel_dump_gpu = shared_library(
> @@ -94,7 +92,7 @@ libintel_dump_gpu = shared_library(
>include_directories : [inc_common, inc_intel, inc_drm_uapi],
>link_with : libintel_dev,
>c_args : [c_vis_args, no_override_init_args],
> -  build_by_default : build_intel_tools,
> +  build_by_default : true,
>install_dir: get_option('libexecdir'),
> -  install: build_intel_tools
> +  install: true
>  )
> -- 
> 2.18.0
> 
> ___
> mesa-dev mailing list
> mesa-dev@lists.freedesktop.org
> https://lists.freedesktop.org/mailman/listinfo/mesa-dev
___
mesa-dev mailing list
mesa-dev@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/mesa-dev


Re: [Mesa-dev] [PATCH mesa] i965: gen_shader_sha1() doesn't use the brw_context

2018-08-07 Thread Tapani Pälli

Reviewed-by: Tapani Pälli 

On 08/07/2018 01:43 PM, Eric Engestrom wrote:

Signed-off-by: Eric Engestrom 
---
  src/mesa/drivers/dri/i965/brw_disk_cache.c | 8 
  1 file changed, 4 insertions(+), 4 deletions(-)

diff --git a/src/mesa/drivers/dri/i965/brw_disk_cache.c 
b/src/mesa/drivers/dri/i965/brw_disk_cache.c
index 9a6f2ff570c275e7ad53..65fcab24b7f93661d348 100644
--- a/src/mesa/drivers/dri/i965/brw_disk_cache.c
+++ b/src/mesa/drivers/dri/i965/brw_disk_cache.c
@@ -53,8 +53,8 @@ debug_enabled_for_stage(gl_shader_stage stage)
  }
  
  static void

-gen_shader_sha1(struct brw_context *brw, struct gl_program *prog,
-gl_shader_stage stage, void *key, unsigned char *out_sha1)
+gen_shader_sha1(struct gl_program *prog, gl_shader_stage stage,
+void *key, unsigned char *out_sha1)
  {
 char sha1_buf[41];
 unsigned char sha1[20];
@@ -120,7 +120,7 @@ read_and_upload(struct brw_context *brw, struct disk_cache 
*cache,
  */
 brw_prog_key_set_id(&prog_key, stage, 0);
  
-   gen_shader_sha1(brw, prog, stage, &prog_key, binary_sha1);

+   gen_shader_sha1(prog, stage, &prog_key, binary_sha1);
  
 size_t buffer_size;

 uint8_t *buffer = disk_cache_get(cache, binary_sha1, &buffer_size);
@@ -277,7 +277,7 @@ write_program_data(struct brw_context *brw, struct 
gl_program *prog,
  
 unsigned char sha1[20];

 char buf[41];
-   gen_shader_sha1(brw, prog, stage, key, sha1);
+   gen_shader_sha1(prog, stage, key, sha1);
 _mesa_sha1_format(buf, sha1);
 if (brw->ctx._Shader->Flags & GLSL_CACHE_INFO) {
fprintf(stderr, "putting binary in cache: %s\n", buf);


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


[Mesa-dev] [PATCH mesa] i965: searching the cache doesn't need to modify it

2018-08-07 Thread Eric Engestrom
Signed-off-by: Eric Engestrom 
---
 src/mesa/drivers/dri/i965/brw_program_cache.c | 10 +-
 1 file changed, 5 insertions(+), 5 deletions(-)

diff --git a/src/mesa/drivers/dri/i965/brw_program_cache.c 
b/src/mesa/drivers/dri/i965/brw_program_cache.c
index 600b0611c8b89095e393..dd8b1cdb8f134ed05193 100644
--- a/src/mesa/drivers/dri/i965/brw_program_cache.c
+++ b/src/mesa/drivers/dri/i965/brw_program_cache.c
@@ -142,11 +142,11 @@ brw_cache_item_equals(const struct brw_cache_item *a,
   (memcmp(a->key, b->key, a->key_size) == 0);
 }
 
-static struct brw_cache_item *
-search_cache(struct brw_cache *cache, GLuint hash,
- struct brw_cache_item *lookup)
+static const struct brw_cache_item *
+search_cache(const struct brw_cache *cache, GLuint hash,
+ const struct brw_cache_item *lookup)
 {
-   struct brw_cache_item *c;
+   const struct brw_cache_item *c;
 
 #if 0
int bucketcount = 0;
@@ -198,7 +198,7 @@ brw_search_cache(struct brw_cache *cache, enum brw_cache_id 
cache_id,
  const void *key, GLuint key_size, uint32_t *inout_offset,
  void *inout_prog_data, bool flag_state)
 {
-   struct brw_cache_item *item;
+   const struct brw_cache_item *item;
struct brw_cache_item lookup;
GLuint hash;
 
-- 
Cheers,
  Eric

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


[Mesa-dev] [Bug 107487] [intel] [tools] intel gpu tools don't honor -D tools=[]

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

Lionel Landwerlin  changed:

   What|Removed |Added

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

--- Comment #2 from Lionel Landwerlin  ---
Should be fixed in :

commit 303e7b39b5df982b0870b2d09d52fbf36ff9a087
Author: Lionel Landwerlin 
Date:   Tue Aug 7 11:38:59 2018 +0100

intel: don't build tools without -Dtools=intel

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


[Mesa-dev] [PATCH mesa v2] i965: searching the cache doesn't need to modify it

2018-08-07 Thread Eric Engestrom
Signed-off-by: Eric Engestrom 
---
v2: forgot the hunk that was the point of this :facepalm:
---
 src/mesa/drivers/dri/i965/brw_program_cache.c | 12 ++--
 1 file changed, 6 insertions(+), 6 deletions(-)

diff --git a/src/mesa/drivers/dri/i965/brw_program_cache.c 
b/src/mesa/drivers/dri/i965/brw_program_cache.c
index 600b0611c8b89095e393..a9a21d911612f9218e2a 100644
--- a/src/mesa/drivers/dri/i965/brw_program_cache.c
+++ b/src/mesa/drivers/dri/i965/brw_program_cache.c
@@ -142,11 +142,11 @@ brw_cache_item_equals(const struct brw_cache_item *a,
   (memcmp(a->key, b->key, a->key_size) == 0);
 }
 
-static struct brw_cache_item *
-search_cache(struct brw_cache *cache, GLuint hash,
- struct brw_cache_item *lookup)
+static const struct brw_cache_item *
+search_cache(const struct brw_cache *cache, GLuint hash,
+ const struct brw_cache_item *lookup)
 {
-   struct brw_cache_item *c;
+   const struct brw_cache_item *c;
 
 #if 0
int bucketcount = 0;
@@ -194,11 +194,11 @@ rehash(struct brw_cache *cache)
  * Returns the buffer object matching cache_id and key, or NULL.
  */
 bool
-brw_search_cache(struct brw_cache *cache, enum brw_cache_id cache_id,
+brw_search_cache(const struct brw_cache *cache, enum brw_cache_id cache_id,
  const void *key, GLuint key_size, uint32_t *inout_offset,
  void *inout_prog_data, bool flag_state)
 {
-   struct brw_cache_item *item;
+   const struct brw_cache_item *item;
struct brw_cache_item lookup;
GLuint hash;
 
-- 
Cheers,
  Eric

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


[Mesa-dev] [Bug 107511] KHR/khrplatform.h not always installed when needed

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

Bug ID: 107511
   Summary: KHR/khrplatform.h not always installed when needed
   Product: Mesa
   Version: git
  Hardware: All
OS: All
Status: NEW
  Severity: blocker
  Priority: medium
 Component: Other
  Assignee: mesa-dev@lists.freedesktop.org
  Reporter: brad.k...@kitware.com
QA Contact: mesa-dev@lists.freedesktop.org

Since commit f7d42ee7d3 (include: update GL & GLES headers (v2), 2018-07-18)
the 'KHR/khrplatform.h' header is included by 'GL/glcorearb.h' and 'GL/glext.h'
but 'configure.ac' still says

AM_CONDITIONAL(NEED_KHRPLATFORM, test "x$enable_egl" = xyes -o \
  "x$enable_gles1" = xyes -o \
  "x$enable_gles2" = xyes)

Therefore configuring with all three of those disabled:

./autogen.sh \
  --prefix="$prefix" \
  --enable-debug \
  --disable-dri \
  --disable-egl \
  --disable-gbm \
  --disable-gles1 \
  --disable-gles2 \
  --disable-shared-glapi \
  --with-platforms=x11 \
  --enable-glx=gallium-xlib \
  --enable-gallium-osmesa \
  --with-gallium-drivers=swrast \
  --enable-gallium-llvm=yes \
LLVM_CONFIG=$llvm_config \
  --enable-llvm-shared-libs \

creates an installation that gives preprocessing errors to clients:

/.../include/GL/glext.h:467:10: fatal error: KHR/khrplatform.h: No such
file or directory

-- 
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 107508] Crash in st_renderbuffer_delete()

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

Olivier Fourdan  changed:

   What|Removed |Added

 Attachment #140994|0   |1
is obsolete||

--- Comment #3 from Olivier Fourdan  ---
Created attachment 141001
  --> https://bugs.freedesktop.org/attachment.cgi?id=141001&action=edit
Simple reproducer program

Simpler version of the reproducer which doesn't need any patch in Mesa.

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


[Mesa-dev] [PATCH mesa] configure: install KHR/khrplatform.h when needed

2018-08-07 Thread Eric Engestrom
Bugzilla: https://bugs.freedesktop.org/show_bug.cgi?id=107511
Fixes: f7d42ee7d319256608ad "include: update GL & GLES headers (v2)"
Signed-off-by: Eric Engestrom 
---
 configure.ac | 1 +
 1 file changed, 1 insertion(+)

diff --git a/configure.ac b/configure.ac
index 7d898aeda9e33a87d815..ecc55a11f6473b086b7f 100644
--- a/configure.ac
+++ b/configure.ac
@@ -1415,6 +1415,7 @@ AM_CONDITIONAL(NEED_OPENGL_COMMON, test "x$enable_opengl" 
= xyes -o \
 "x$enable_gles1" = xyes -o \
 "x$enable_gles2" = xyes)
 AM_CONDITIONAL(NEED_KHRPLATFORM, test "x$enable_egl" = xyes -o \
+  "x$enable_opengl" = xyes -o \
   "x$enable_gles1" = xyes -o \
   "x$enable_gles2" = xyes)
 
-- 
Cheers,
  Eric

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


Re: [Mesa-dev] [PATCH mesa] configure: install KHR/khrplatform.h when needed

2018-08-07 Thread Brad King
On 08/07/2018 07:58 AM, Eric Engestrom wrote:
> Bugzilla: https://bugs.freedesktop.org/show_bug.cgi?id=107511
> Fixes: f7d42ee7d319256608ad "include: update GL & GLES headers (v2)"
[snip]
>  AM_CONDITIONAL(NEED_KHRPLATFORM, test "x$enable_egl" = xyes -o \
> +  "x$enable_opengl" = xyes -o \

That fixes issue 107511, thanks!

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


Re: [Mesa-dev] [PATCH mesa] configure: install KHR/khrplatform.h when needed

2018-08-07 Thread Emil Velikov
On 7 August 2018 at 12:58, Eric Engestrom  wrote:
> Bugzilla: https://bugs.freedesktop.org/show_bug.cgi?id=107511
> Fixes: f7d42ee7d319256608ad "include: update GL & GLES headers (v2)"
> Signed-off-by: Eric Engestrom 
Thanks Eric.

Reviewed-by: Emil Velikov 

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


[Mesa-dev] libdrm: Fix amdgpu build failure

2018-08-07 Thread Mike Lothian
Hi

I'm not sure if this is the right mailing list or not but the
following patch gets things building with meson again

Signed-of-by: Mike Lothian 

diff --git a/amdgpu/meson.build b/amdgpu/meson.build
index f39d7bf6..d9d7de2d 100644
--- a/amdgpu/meson.build
+++ b/amdgpu/meson.build
@@ -26,8 +26,7 @@ libdrm_amdgpu = shared_library(
   [
 files(
   'amdgpu_asic_id.c', 'amdgpu_bo.c', 'amdgpu_cs.c', 'amdgpu_device.c',
-  'amdgpu_gpu_info.c', 'amdgpu_vamgr.c', 'amdgpu_vm.c', 'util_hash.c',
-  'util_hash_table.c',
+  'amdgpu_gpu_info.c', 'amdgpu_vamgr.c', 'amdgpu_vm.c', 'handle_table.c',
 ),
 config_file,
   ],
___
mesa-dev mailing list
mesa-dev@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/mesa-dev


Re: [Mesa-dev] libdrm: Fix amdgpu build failure

2018-08-07 Thread Emil Velikov
On 7 August 2018 at 13:38, Mike Lothian  wrote:
> Hi
>
> I'm not sure if this is the right mailing list or not but the
> following patch gets things building with meson again
>
> Signed-of-by: Mike Lothian 
>
I'll add the following and push in a moment.

Fixes: d6cb0ee408e ("amdgpu: remove the hash table implementation")
Cc: Christian König 

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


Re: [Mesa-dev] libdrm: Fix amdgpu build failure

2018-08-07 Thread Christian König

Hi Mike,

it is not the right mailing list, but thanks for the info.

I'm going to push that patch ASAP.

Christian.

Am 07.08.2018 um 14:38 schrieb Mike Lothian:

Hi

I'm not sure if this is the right mailing list or not but the
following patch gets things building with meson again

Signed-of-by: Mike Lothian 

diff --git a/amdgpu/meson.build b/amdgpu/meson.build
index f39d7bf6..d9d7de2d 100644
--- a/amdgpu/meson.build
+++ b/amdgpu/meson.build
@@ -26,8 +26,7 @@ libdrm_amdgpu = shared_library(
[
  files(
'amdgpu_asic_id.c', 'amdgpu_bo.c', 'amdgpu_cs.c', 'amdgpu_device.c',
-  'amdgpu_gpu_info.c', 'amdgpu_vamgr.c', 'amdgpu_vm.c', 'util_hash.c',
-  'util_hash_table.c',
+  'amdgpu_gpu_info.c', 'amdgpu_vamgr.c', 'amdgpu_vm.c', 'handle_table.c',
  ),
  config_file,
],
___
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 107511] KHR/khrplatform.h not always installed when needed

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

Eric Engestrom  changed:

   What|Removed |Added

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

--- Comment #1 from Eric Engestrom  ---
Fixed in:

commit 87c156183cd668f1341326cc7c88ab6686f27d8f
Author: Eric Engestrom 
Date:   Tue Aug 7 12:56:25 2018 +0100

configure: install KHR/khrplatform.h when needed

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


[Mesa-dev] [PATCH] gl.h: define GLeglImageOES depending on GL_EXT_EGL_image_storage

2018-08-07 Thread Brian Paul
To avoid duplicate typedef with the definition in glext.h

Bugzilla: https://bugs.freedesktop.org/show_bug.cgi?id=107488
Tested-by: Vinson Lee 
---
 include/GL/gl.h | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/include/GL/gl.h b/include/GL/gl.h
index f5bac36..0f7ae70 100644
--- a/include/GL/gl.h
+++ b/include/GL/gl.h
@@ -2086,7 +2086,7 @@ typedef void (APIENTRYP 
PFNGLBLENDEQUATIONSEPARATEATIPROC) (GLenum modeRGB, GLen
 
 
 /* GL_OES_EGL_image */
-#ifndef GL_OES_EGL_image
+#ifndef GL_EXT_EGL_image_storage
 typedef void* GLeglImageOES;
 #endif
 
-- 
2.7.4

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


[Mesa-dev] [PATCH] xlib: remove unused Fake_glXGetAGPOffsetMESA() function

2018-08-07 Thread Brian Paul
To silence compiler warning.
---
 src/mesa/drivers/x11/fakeglx.c | 10 --
 1 file changed, 10 deletions(-)

diff --git a/src/mesa/drivers/x11/fakeglx.c b/src/mesa/drivers/x11/fakeglx.c
index 233b6e2..b946521 100644
--- a/src/mesa/drivers/x11/fakeglx.c
+++ b/src/mesa/drivers/x11/fakeglx.c
@@ -2716,16 +2716,6 @@ Fake_glXReleaseBuffersMESA( Display *dpy, GLXDrawable d )
 
 
 
-/*** GLX_MESA_agp_offset ***/
-
-static GLuint
-Fake_glXGetAGPOffsetMESA( const GLvoid *pointer )
-{
-   (void) pointer;
-   return ~0;
-}
-
-
 /*** GLX_EXT_texture_from_pixmap ***/
 
 static void
-- 
2.7.4

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


[Mesa-dev] [PATCH 1/3] svga: add TGSI_SEMANTIC_FACE switch case in svga_swtnl_update_vdecl()

2018-08-07 Thread Brian Paul
Fixes failed assertion running Piglit polygon-mode-face test.
Though, the test still does not pass.

Reviewed-by: Neha Bhende 
Reviewed-by: Charmaine Lee 
---
 src/gallium/drivers/svga/svga_swtnl_state.c | 1 +
 1 file changed, 1 insertion(+)

diff --git a/src/gallium/drivers/svga/svga_swtnl_state.c 
b/src/gallium/drivers/svga/svga_swtnl_state.c
index 06a9be8..816fef1 100644
--- a/src/gallium/drivers/svga/svga_swtnl_state.c
+++ b/src/gallium/drivers/svga/svga_swtnl_state.c
@@ -288,6 +288,7 @@ svga_swtnl_update_vdecl(struct svga_context *svga)
  nr_decls++;
  break;
   case TGSI_SEMANTIC_POSITION:
+  case TGSI_SEMANTIC_FACE:
  /* generated internally, not a vertex shader output */
  break;
   default:
-- 
2.7.4

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


[Mesa-dev] [PATCH mesa] meson: install KHR/khrplatform.h when needed

2018-08-07 Thread Eric Engestrom
Fixes: f7d42ee7d319256608ad "include: update GL & GLES headers (v2)"
Signed-off-by: Eric Engestrom 
---
For some reason I didn't think to fix meson when I fixed autotools...
---
 include/meson.build | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/include/meson.build b/include/meson.build
index b4555eabbfc7f3a42c24..081c1bc00088c956d47e 100644
--- a/include/meson.build
+++ b/include/meson.build
@@ -43,7 +43,7 @@ if with_gles2
   )
 endif
 
-if with_gles1 or with_gles2 or with_egl
+if with_gles1 or with_gles2 or with_opengl or with_egl
   install_headers('KHR/khrplatform.h', subdir : 'KHR')
 endif
 
-- 
Cheers,
  Eric

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


Re: [Mesa-dev] [PATCH mesa] meson: install KHR/khrplatform.h when needed

2018-08-07 Thread Emil Velikov
On 7 August 2018 at 15:40, Eric Engestrom  wrote:
> Fixes: f7d42ee7d319256608ad "include: update GL & GLES headers (v2)"
> Signed-off-by: Eric Engestrom 
> ---
> For some reason I didn't think to fix meson when I fixed autotools...
I've assumed it was handling this in a completely different manner.

Reviewed-by: Emil Velikov 

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


Re: [Mesa-dev] [PATCH] xlib: remove unused Fake_glXGetAGPOffsetMESA() function

2018-08-07 Thread Emil Velikov
On 7 August 2018 at 15:24, Brian Paul  wrote:
> To silence compiler warning.
> ---
>  src/mesa/drivers/x11/fakeglx.c | 10 --
>  1 file changed, 10 deletions(-)
>
> diff --git a/src/mesa/drivers/x11/fakeglx.c b/src/mesa/drivers/x11/fakeglx.c
> index 233b6e2..b946521 100644
> --- a/src/mesa/drivers/x11/fakeglx.c
> +++ b/src/mesa/drivers/x11/fakeglx.c
> @@ -2716,16 +2716,6 @@ Fake_glXReleaseBuffersMESA( Display *dpy, GLXDrawable 
> d )
>
>
>
> -/*** GLX_MESA_agp_offset ***/
> -
> -static GLuint
> -Fake_glXGetAGPOffsetMESA( const GLvoid *pointer )
> -{
> -   (void) pointer;
> -   return ~0;
> -}
> -
> -
Reviewed-by: Emil Velikov 

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


Re: [Mesa-dev] [PATCH] gl.h: define GLeglImageOES depending on GL_EXT_EGL_image_storage

2018-08-07 Thread Emil Velikov
On 7 August 2018 at 15:23, Brian Paul  wrote:
> To avoid duplicate typedef with the definition in glext.h
>
> Bugzilla: https://bugs.freedesktop.org/show_bug.cgi?id=107488
> Tested-by: Vinson Lee 
> ---
>  include/GL/gl.h | 2 +-
>  1 file changed, 1 insertion(+), 1 deletion(-)
>
> diff --git a/include/GL/gl.h b/include/GL/gl.h
> index f5bac36..0f7ae70 100644
> --- a/include/GL/gl.h
> +++ b/include/GL/gl.h
> @@ -2086,7 +2086,7 @@ typedef void (APIENTRYP 
> PFNGLBLENDEQUATIONSEPARATEATIPROC) (GLenum modeRGB, GLen
>
>
>  /* GL_OES_EGL_image */
> -#ifndef GL_OES_EGL_image
> +#ifndef GL_EXT_EGL_image_storage
>  typedef void* GLeglImageOES;
>  #endif
>
A more robust solution is to check both, as below.
Esp. since the GLES* headers use the OES instance and it's not
uncommon to include both GL and GLES headers.

#if !defined(GL_OES_EGL_image) && !defined(GL_EXT_EGL_image_storage)

Don't have a strong opinion, though. If you keep patch as-is, please
tweak/drop the comment.

Reviewed-by: Emil Velikov 

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


Re: [Mesa-dev] [PATCH 1/2] travis: add ubuntu-toolchain-r-test

2018-08-07 Thread Emil Velikov
On 6 August 2018 at 11:17, Juan A. Suarez Romero  wrote:
> LLVM 6.0 requires GCC 4.9, which is not available in main Travis
> repository.
>

We're not building LLVM 6.0 here, hence the commit message is a bit confusing.
Please add more information on the topic - even a bug report if there is one.

With that
Reviewed-by: Emil Velikov 

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


Re: [Mesa-dev] [PATCH 2/2] travis: meson/Vulkan requires LLVM 6.0

2018-08-07 Thread Emil Velikov
On 6 August 2018 at 11:17, Juan A. Suarez Romero  wrote:
> RADV now requires LLVM 6.0.
>
> Fixes: fd1121e8399 ("amd: remove support for LLVM 5.0")
> CC: Marek Olšák 

It seem that something went wrong splitting this from 1/2 - not too sure.
Regardless,

Reviewed-by: Emil Velikov 

Aside:

> @@ -36,17 +36,19 @@ matrix:
>  - LABEL="meson Vulkan"
>  - BUILD=meson
>  - MESON_OPTIONS="-Ddri-drivers=[] -Dgallium-drivers=[]"
Having the drivers as explicit lists, alike the autoconf build would
be a good move.
Think, subtle bugs in the meson logic, fallback to disabling FOO when
dependencies are not met, etc.

> -- LLVM_VERSION=5.0
> +- LLVM_VERSION=6.0
>  - LLVM_CONFIG="llvm-config-${LLVM_VERSION}"
>addons:
>  apt:
>sources:
> -- llvm-toolchain-trusty-5.0
> +- llvm-toolchain-trusty-6.0
> +# llvm-6 depends on gcc-4.9 which is not in main repo
> +- ubuntu-toolchain-r-test
>packages:
>  # LLVM packaging is broken and misses these dependencies
>  - libedit-dev
Is this still needed? Might be worth poking Debian people about it.

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


Re: [Mesa-dev] [PATCH 1/2] scons: require scons 2.4 or greater

2018-08-07 Thread Emil Velikov
On 1 August 2018 at 18:48, Juan A. Suarez Romero  wrote:
> There is a bug with scons 2.3, used in Travis, where it fails to detect
> some C functions.

Obviously this has landed, but for the future please provide examples
instead of just "some".

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


[Mesa-dev] [PATCH] gl.h: define GLeglImageOES depending on GL_EXT_EGL_image_storage

2018-08-07 Thread Brian Paul
To avoid duplicate typedef with the definition in glext.h

V2: test for both GL_OES_EGL_image and GL_EXT_EGL_image_storage in
case both the GL and GLES headers are included.  Per Emil.

Bugzilla: https://bugs.freedesktop.org/show_bug.cgi?id=107488
Tested-by: Vinson Lee 
---
 include/GL/gl.h | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/include/GL/gl.h b/include/GL/gl.h
index f5bac36..d4475db 100644
--- a/include/GL/gl.h
+++ b/include/GL/gl.h
@@ -2086,7 +2086,7 @@ typedef void (APIENTRYP 
PFNGLBLENDEQUATIONSEPARATEATIPROC) (GLenum modeRGB, GLen
 
 
 /* GL_OES_EGL_image */
-#ifndef GL_OES_EGL_image
+#if !defined(GL_OES_EGL_image) && !defined(GL_EXT_EGL_image_storage)
 typedef void* GLeglImageOES;
 #endif
 
-- 
2.7.4

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


Re: [Mesa-dev] [PATCH 03/10] radeon/vcn: add jpeg decoder creation

2018-08-07 Thread Leo Liu



On 08/02/2018 03:44 PM, boyuan.zh...@amd.com wrote:

From: Boyuan Zhang 

Signed-off-by: Boyuan Zhang 
---
  src/gallium/drivers/radeon/Makefile.sources  |   1 +
  src/gallium/drivers/radeon/meson.build   |   1 +
  src/gallium/drivers/radeon/radeon_vcn_jpeg.c | 212 +++
Most of the changes seems to be duplicated from VCN DEC,  can we just 
re-use them from VCN DEC, and keep something specific for JPEG to this file?


Regards,
Leo


  3 files changed, 214 insertions(+)
  create mode 100644 src/gallium/drivers/radeon/radeon_vcn_jpeg.c

diff --git a/src/gallium/drivers/radeon/Makefile.sources 
b/src/gallium/drivers/radeon/Makefile.sources
index a11bffe..3424e2d 100644
--- a/src/gallium/drivers/radeon/Makefile.sources
+++ b/src/gallium/drivers/radeon/Makefile.sources
@@ -16,6 +16,7 @@ C_SOURCES := \
radeon_vcn_enc.c \
radeon_vcn_enc.h \
radeon_vcn_jpeg.h \
+   radeon_vcn_jpeg.c \
radeon_uvd_enc_1_1.c \
radeon_uvd_enc.c \
radeon_uvd_enc.h \
diff --git a/src/gallium/drivers/radeon/meson.build 
b/src/gallium/drivers/radeon/meson.build
index eb68b57..a12cd4e 100644
--- a/src/gallium/drivers/radeon/meson.build
+++ b/src/gallium/drivers/radeon/meson.build
@@ -36,6 +36,7 @@ files_libradeon = files(
'radeon_vcn_dec.c',
'radeon_vcn_dec.h',
'radeon_vcn_jpeg.h',
+  'radeon_vcn_jpeg.c',
'radeon_uvd_enc_1_1.c',
'radeon_uvd_enc.c',
'radeon_uvd_enc.h',
diff --git a/src/gallium/drivers/radeon/radeon_vcn_jpeg.c 
b/src/gallium/drivers/radeon/radeon_vcn_jpeg.c
new file mode 100644
index 000..c078131
--- /dev/null
+++ b/src/gallium/drivers/radeon/radeon_vcn_jpeg.c
@@ -0,0 +1,212 @@
+/**
+ *
+ * Copyright 2018 Advanced Micro Devices, Inc.
+ * All Rights Reserved.
+ *
+ * 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, sub license, 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 NON-INFRINGEMENT.
+ * IN NO EVENT SHALL THE COPYRIGHT HOLDER(S) OR AUTHOR(S) 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 
+#include 
+
+#include "pipe/p_video_codec.h"
+
+#include "util/u_memory.h"
+#include "util/u_video.h"
+
+#include "radeonsi/si_pipe.h"
+#include "radeon_video.h"
+#include "radeon_vcn_jpeg.h"
+
+#define NUM_BUFFERS4
+
+struct radeon_jpeg_decoder {
+   struct pipe_video_codec base;
+
+   unsignedstream_handle;
+   unsignedstream_type;
+   unsignedframe_number;
+
+   struct pipe_screen  *screen;
+   struct radeon_winsys*ws;
+   struct radeon_winsys_cs *cs;
+
+   void*bs_ptr;
+
+   struct rvid_buffer  bs_buffers[NUM_BUFFERS];
+
+   unsignedbs_size;
+   unsignedcur_buffer;
+   unsignedbsd_size;
+   unsigneddt_pitch;
+   unsigneddt_uv_pitch;
+   unsigneddt_luma_top_offset;
+   unsigneddt_chroma_top_offset;
+};
+
+/* flush IB to the hardware */
+static int flush(struct radeon_jpeg_decoder *dec, unsigned flags)
+{
+   return dec->ws->cs_flush(dec->cs, flags, NULL);
+}
+
+/* cycle to the next set of buffers */
+static void next_buffer(struct radeon_jpeg_decoder *dec)
+{
+   ++dec->cur_buffer;
+   dec->cur_buffer %= NUM_BUFFERS;
+}
+
+/**
+ * destroy this video decoder
+ */
+static void radeon_jpeg_destroy(struct pipe_video_codec *decoder)
+{
+   /* TODO */
+}
+
+/**
+ * start decoding of a new frame
+ */
+static void radeon_jpeg_begin_frame(struct pipe_video_codec *decoder,
+struct pipe_video_buffer *target,
+struct pipe_picture_desc *picture)
+{
+   /* TODO */
+}
+
+/**
+ * decode a macroblock
+ */
+static void radeon_j

Re: [Mesa-dev] [PATCH 04/10] radeon/vcn: implement jpeg decode functions

2018-08-07 Thread Leo Liu



On 08/02/2018 03:44 PM, boyuan.zh...@amd.com wrote:

From: Boyuan Zhang 

Signed-off-by: Boyuan Zhang 
---
  src/gallium/drivers/radeon/radeon_vcn_jpeg.c | 286 ++-
  1 file changed, 281 insertions(+), 5 deletions(-)

diff --git a/src/gallium/drivers/radeon/radeon_vcn_jpeg.c 
b/src/gallium/drivers/radeon/radeon_vcn_jpeg.c
index c078131..72dff57 100644
--- a/src/gallium/drivers/radeon/radeon_vcn_jpeg.c
+++ b/src/gallium/drivers/radeon/radeon_vcn_jpeg.c
@@ -63,12 +63,195 @@ struct radeon_jpeg_decoder {
unsigneddt_chroma_top_offset;
  };
  
+static void radeon_jpeg_destroy_associated_data(void *data)

+{
+   /* NOOP, since we only use an intptr */
+}
+
+static struct pb_buffer *radeon_jpeg_get_decode_param(struct 
radeon_jpeg_decoder *dec,
+   struct pipe_video_buffer *target,
+   struct pipe_picture_desc *picture)
+{
+   struct r600_texture *luma = (struct r600_texture *)
+   ((struct vl_video_buffer 
*)target)->resources[0];
+   struct r600_texture *chroma = (struct r600_texture *)
+   ((struct vl_video_buffer 
*)target)->resources[1];
+
+   dec->bsd_size = align(dec->bs_size, 128);
+   dec->dt_luma_top_offset = luma->surface.u.gfx9.surf_offset;
+   if (target->buffer_format == PIPE_FORMAT_NV12) {
+   dec->dt_chroma_top_offset = chroma->surface.u.gfx9.surf_offset;
+   dec->dt_pitch = luma->surface.u.gfx9.surf_pitch * 
luma->surface.blk_w;
+   }
+   else if (target->buffer_format == PIPE_FORMAT_YUYV)
+   dec->dt_pitch = luma->surface.u.gfx9.surf_pitch;
+   dec->dt_uv_pitch = dec->dt_pitch / 2;
+
+   return luma->resource.buf;
+}
+
+static void get_mjpeg_slice_header(struct radeon_jpeg_decoder *dec, struct 
pipe_mjpeg_picture_desc *pic)
It looks like the reconstruction of bitstream is still required for VCN 
JPEG, which was thought only for UVD FW JPEG decode when implementing 
UVD JPEG decode, that's why it was kept in the driver.
Since both UVD and VCN need this BS reconstruction, and it would be 
better to move it to state tracker.


Regards,
Leo


+{
+   int size = 0, saved_size, len_pos, i;
+   uint16_t *bs;
+   uint8_t *buf = dec->bs_ptr;
+
+   /* SOI */
+   buf[size++] = 0xff;
+   buf[size++] = 0xd8;
+
+   /* DQT */
+   buf[size++] = 0xff;
+   buf[size++] = 0xdb;
+
+   len_pos = size++;
+   size++;
+
+   for (i = 0; i < 4; ++i) {
+   if (pic->quantization_table.load_quantiser_table[i] == 0)
+   continue;
+
+   buf[size++] = i;
+   memcpy((buf + size), 
&pic->quantization_table.quantiser_table[i], 64);
+   size += 64;
+   }
+
+   bs = (uint16_t*)&buf[len_pos];
+   *bs = util_bswap16(size - 4);
+
+   saved_size = size;
+
+   /* DHT */
+   buf[size++] = 0xff;
+   buf[size++] = 0xc4;
+
+   len_pos = size++;
+   size++;
+
+   for (i = 0; i < 2; ++i) {
+   if (pic->huffman_table.load_huffman_table[i] == 0)
+   continue;
+
+   buf[size++] = 0x00 | i;
+   memcpy((buf + size), &pic->huffman_table.table[i].num_dc_codes, 
16);
+   size += 16;
+   memcpy((buf + size), &pic->huffman_table.table[i].dc_values, 
12);
+   size += 12;
+   }
+
+   for (i = 0; i < 2; ++i) {
+   if (pic->huffman_table.load_huffman_table[i] == 0)
+   continue;
+
+   buf[size++] = 0x10 | i;
+   memcpy((buf + size), &pic->huffman_table.table[i].num_ac_codes, 
16);
+   size += 16;
+   memcpy((buf + size), &pic->huffman_table.table[i].ac_values, 
162);
+   size += 162;
+   }
+
+   bs = (uint16_t*)&buf[len_pos];
+   *bs = util_bswap16(size - saved_size - 2);
+
+   saved_size = size;
+
+   /* DRI */
+   if (pic->slice_parameter.restart_interval) {
+   buf[size++] = 0xff;
+   buf[size++] = 0xdd;
+   buf[size++] = 0x00;
+   buf[size++] = 0x04;
+   bs = (uint16_t*)&buf[size++];
+   *bs = util_bswap16(pic->slice_parameter.restart_interval);
+   saved_size = ++size;
+   }
+
+   /* SOF */
+   buf[size++] = 0xff;
+   buf[size++] = 0xc0;
+
+   len_pos = size++;
+   size++;
+
+   buf[size++] = 0x08;
+
+   bs = (uint16_t*)&buf[size++];
+   *bs = util_bswap16(pic->picture_parameter.picture_height);
+   size++;
+
+   bs = (uint16_t*)&buf[size++];
+   *bs = util_bswap16(pic->picture_parameter.picture_width);
+   size++;
+
+   buf[size++] = pic->picture_parameter.num_components;
+
+   for (i = 0; i < pic->picture_parameter.num_components; ++i) {
+   buf[size++] = pic->picture_parameter

Re: [Mesa-dev] [PATCH 1/3] meson: use dependency()+find_program() for wayland-scanner

2018-08-07 Thread Emil Velikov
On 6 August 2018 at 17:39, Dylan Baker  wrote:
> Quoting Emil Velikov (2018-06-28 07:35:44)
>> From: Emil Velikov 
>>
>> Helps when the native wayland-scanner is located outside of PATH.
>> Inspired by the xserver code ;-)
>>
>> Cc: Dylan Baker 
>> Cc: Eric Engestrom 
>> Signed-off-by: Emil Velikov 
>> ---
>>  meson.build | 3 ++-
>>  1 file changed, 2 insertions(+), 1 deletion(-)
>>
>> diff --git a/meson.build b/meson.build
>> index b2722c71e5b..79bac89e7d9 100644
>> --- a/meson.build
>> +++ b/meson.build
>> @@ -1269,7 +1269,8 @@ endif
>>  # TODO: symbol mangling
>>
>>  if with_platform_wayland
>> -  prog_wl_scanner = find_program('wayland-scanner')
>> +  dep_wl_scanner = dependency('wayland-scanner', native: true)
>> +  prog_wl_scanner = 
>> find_program(dep_wl_scanner.get_pkgconfig_variable('wayland_scanner'))
>>dep_wl_protocols = dependency('wayland-protocols', version : '>= 1.8')
>>dep_wayland_client = dependency('wayland-client', version : '>=1.11')
>>dep_wayland_server = dependency('wayland-server', version : '>=1.11')
>> --
>> 2.18.0
>>
>
> Hey Emil, it doesn't look like this ever landed, is there a reason for that 
> I'm
> not seeing in the mailing list discussion?
>
Nothing special - simply forgot.
Will double-check it doesn't break anything and will push in a moment.

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


[Mesa-dev] [PATCH v4 1/2] wayland/egl: initialize window surface size to window size

2018-08-07 Thread Juan A. Suarez Romero
When creating a windows surface with eglCreateWindowSurface(), the
width and height returned by eglQuerySurface(EGL_{WIDTH,HEIGHT}) is
invalid until buffers are updated (like calling glClear()).

But according to EGL 1.5 spec, section 3.5.6 ("Surface Attributes"):

  "Querying EGL_WIDTH and EGL_HEIGHT returns respectively the width and
   height, in pixels, of the surface. For a window or pixmap surface,
   these values are initially equal to the width and height of the
   native window or pixmap with respect to which the surface was
   created"

This fixes dEQP-EGL.functional.color_clears.* CTS tests

v2:
- Do not modify attached_{width,height} (Daniel)
- Do not update size on resizing window (Brendan)

CC: Daniel Stone 
CC: Brendan King 
CC: mesa-sta...@lists.freedesktop.org
Tested-by: Eric Engestrom 
---
 src/egl/drivers/dri2/platform_wayland.c | 3 +++
 1 file changed, 3 insertions(+)

diff --git a/src/egl/drivers/dri2/platform_wayland.c 
b/src/egl/drivers/dri2/platform_wayland.c
index dca099500a8..a5d43094cf3 100644
--- a/src/egl/drivers/dri2/platform_wayland.c
+++ b/src/egl/drivers/dri2/platform_wayland.c
@@ -258,6 +258,9 @@ dri2_wl_create_window_surface(_EGLDriver *drv, _EGLDisplay 
*disp,
   goto cleanup_surf;
}
 
+   dri2_surf->base.Width = window->width;
+   dri2_surf->base.Height = window->height;
+
visual_idx = dri2_wl_visual_idx_from_config(dri2_dpy, config);
assert(visual_idx != -1);
 
-- 
2.17.1

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


[Mesa-dev] [PATCH v4 2/2] wayland/egl: update surface size on window resize

2018-08-07 Thread Juan A. Suarez Romero
According to EGL 1.5 spec, section 3.10.1.1 ("Native Window Resizing"):

  "If the native window corresponding to _surface_ has been resized
   prior to the swap, _surface_ must be resized to match. _surface_ will
   normally be resized by the EGL implementation at the time the native
   window is resized. If the implementation cannot do this transparently
   to the client, then *eglSwapBuffers* must detect the change and
   resize surface prior to copying its pixels to the native window."

So far, resizing a native window in Wayland/EGL was interpreted in Mesa
as a request to resize, which is not executed until the first draw call.
And hence, surface size is not updated until executing it. Thus,
querying the surface size with eglQuerySurface() after a window resize
still returns the old values.

This commit updates the surface size values as soon as the resize is
done, even when the real resize is done in the draw call. This makes the
semantics that any native window resize request take effect inmediately,
and if user calls eglQuerySurface() it will return the new resized
values.

v2: update surface size if there isn't a back surface (Daniel)

CC: Daniel Stone 
CC: mesa-sta...@lists.freedesktop.org
---
 src/egl/drivers/dri2/platform_wayland.c | 19 +++
 1 file changed, 15 insertions(+), 4 deletions(-)

diff --git a/src/egl/drivers/dri2/platform_wayland.c 
b/src/egl/drivers/dri2/platform_wayland.c
index a5d43094cf3..83df0a8776b 100644
--- a/src/egl/drivers/dri2/platform_wayland.c
+++ b/src/egl/drivers/dri2/platform_wayland.c
@@ -201,6 +201,17 @@ resize_callback(struct wl_egl_window *wl_win, void *data)
struct dri2_egl_display *dri2_dpy =
   dri2_egl_display(dri2_surf->base.Resource.Display);
 
+   /* Update the surface size as soon as native window is resized; from user
+* pov, this makes the effect that resize is done inmediately after native
+* window resize, without requiring to wait until the first draw.
+*
+* A more detailed and lengthy explanation can be found at
+* https://lists.freedesktop.org/archives/mesa-dev/2018-June/196474.html
+*/
+   if (!dri2_surf->back) {
+  dri2_surf->base.Width = wl_win->width;
+  dri2_surf->base.Height = wl_win->height;
+   }
dri2_dpy->flush->invalidate(dri2_surf->dri_drawable);
 }
 
@@ -580,8 +591,8 @@ update_buffers(struct dri2_egl_surface *dri2_surf)
struct dri2_egl_display *dri2_dpy =
   dri2_egl_display(dri2_surf->base.Resource.Display);
 
-   if (dri2_surf->base.Width != dri2_surf->wl_win->width ||
-   dri2_surf->base.Height != dri2_surf->wl_win->height) {
+   if (dri2_surf->base.Width != dri2_surf->wl_win->attached_width ||
+   dri2_surf->base.Height != dri2_surf->wl_win->attached_height) {
 
   dri2_wl_release_buffers(dri2_surf);
 
@@ -1635,8 +1646,8 @@ swrast_update_buffers(struct dri2_egl_surface *dri2_surf)
if (dri2_surf->back)
   return 0;
 
-   if (dri2_surf->base.Width != dri2_surf->wl_win->width ||
-   dri2_surf->base.Height != dri2_surf->wl_win->height) {
+   if (dri2_surf->base.Width != dri2_surf->wl_win->attached_width ||
+   dri2_surf->base.Height != dri2_surf->wl_win->attached_height) {
 
   dri2_wl_release_buffers(dri2_surf);
 
-- 
2.17.1

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


[Mesa-dev] [Bug 105371] r600_shader_from_tgsi - GPR limit exceeded - shader requires 360 registers

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

--- Comment #5 from mirh  ---
(In reply to mirh from comment #1)
> Can confirm it fixes shader 2 and 5 of GraphicsFuzz demo 
> http://www.graphicsfuzz.com/benchmark/android-v1.html
> 
> Should I wait for this (or, I dunno, some day sw fp64) to land before
> reporting of the others "gcm_sched_late_pass: unscheduled ops" errors?

Well, colour me shocked, but after building mesa-git with the last patch series
all the tests now pass. 

Which is quite remarkable considering not even latest GCN closed drivers are
compliant.

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


Re: [Mesa-dev] [PATCH 1/2] travis: add ubuntu-toolchain-r-test

2018-08-07 Thread Juan A. Suarez Romero
On Tue, 2018-08-07 at 16:12 +0100, Emil Velikov wrote:
> On 6 August 2018 at 11:17, Juan A. Suarez Romero  wrote:
> > LLVM 6.0 requires GCC 4.9, which is not available in main Travis
> > repository.
> > 
> 
> We're not building LLVM 6.0 here, hence the commit message is a bit confusing.
> Please add more information on the topic - even a bug report if there is one.
> 

We are using now LLVM 6.0, for "make Vulkan" and "make Gallium Drivers
RadeonSI".

Previously we were using LLVM 6.0 for "make Gallium ST Clover LLVM-6.0", which
already had this ubuntu-toolchain-r-test.

Without this, we get an error like in 
https://travis-ci.org/mesa3d/mesa/jobs/413159413



J.A.

> With that
> Reviewed-by: Emil Velikov 
> 
> -Emil
> 

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


Re: [Mesa-dev] [PATCH 2/2] travis: meson/Vulkan requires LLVM 6.0

2018-08-07 Thread Juan A. Suarez Romero
On Tue, 2018-08-07 at 16:20 +0100, Emil Velikov wrote:
> On 6 August 2018 at 11:17, Juan A. Suarez Romero  wrote:
> > RADV now requires LLVM 6.0.
> > 
> > Fixes: fd1121e8399 ("amd: remove support for LLVM 5.0")
> > CC: Marek Olšák 
> 
> It seem that something went wrong splitting this from 1/2 - not too sure.
> Regardless,
> 

Patch 1/2 affected the autotools target in Travis.

This one adds the missing piece in "meson Vulkan" target.

> Reviewed-by: Emil Velikov 
> 
> Aside:
> 
> > @@ -36,17 +36,19 @@ matrix:
> >  - LABEL="meson Vulkan"
> >  - BUILD=meson
> >  - MESON_OPTIONS="-Ddri-drivers=[] -Dgallium-drivers=[]"
> 
> Having the drivers as explicit lists, alike the autoconf build would
> be a good move.
> Think, subtle bugs in the meson logic, fallback to disabling FOO when
> dependencies are not met, etc.

I agree. I'll send a different patch for this.

> 
> > -- LLVM_VERSION=5.0
> > +- LLVM_VERSION=6.0
> >  - LLVM_CONFIG="llvm-config-${LLVM_VERSION}"
> >addons:
> >  apt:
> >sources:
> > -- llvm-toolchain-trusty-5.0
> > +- llvm-toolchain-trusty-6.0
> > +# llvm-6 depends on gcc-4.9 which is not in main repo
> > +- ubuntu-toolchain-r-test
> >packages:
> >  # LLVM packaging is broken and misses these dependencies
> >  - libedit-dev
> 
> Is this still needed? Might be worth poking Debian people about it.
> 

Good question. I'll check it and send a patch if required.


J.A.

> -Emil
> 

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


Re: [Mesa-dev] [PATCH 1/2] travis: add ubuntu-toolchain-r-test

2018-08-07 Thread Jan Vesely
On Tue, Aug 7, 2018 at 12:28 PM, Juan A. Suarez Romero 
wrote:

> On Tue, 2018-08-07 at 16:12 +0100, Emil Velikov wrote:
> > On 6 August 2018 at 11:17, Juan A. Suarez Romero 
> wrote:
> > > LLVM 6.0 requires GCC 4.9, which is not available in main Travis
> > > repository.
> > >
> >
> > We're not building LLVM 6.0 here, hence the commit message is a bit
> confusing.
> > Please add more information on the topic - even a bug report if there is
> one.
> >
>
> We are using now LLVM 6.0, for "make Vulkan" and "make Gallium Drivers
> RadeonSI".
>
> Previously we were using LLVM 6.0 for "make Gallium ST Clover LLVM-6.0",
> which
> already had this ubuntu-toolchain-r-test.
>
> Without this, we get an error like in
> https://travis-ci.org/mesa3d/mesa/jobs/413159413


I think Emil's point was that we actually need libstc++4.9, because
llvm-lib link to it, rather than the gcc compiler itself.

Jan


>
>
>
>
> J.A.
>
> > With that
> > Reviewed-by: Emil Velikov 
> >
> > -Emil
> >
>
> ___
> 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] travis: add ubuntu-toolchain-r-test

2018-08-07 Thread Andres Gomez
With a bit more clarifying commit log, this is:

Reviewed-by: Andres Gomez 

On Mon, 2018-08-06 at 12:17 +0200, Juan A. Suarez Romero wrote:
> LLVM 6.0 requires GCC 4.9, which is not available in main Travis
> repository.
> 
> Fixes: fd1121e8399 ("amd: remove support for LLVM 5.0")
> CC: Marek Olšák 
> ---
>  .travis.yml | 4 
>  1 file changed, 4 insertions(+)
> 
> diff --git a/.travis.yml b/.travis.yml
> index fb192ae82a2..f7c2a8da996 100644
> --- a/.travis.yml
> +++ b/.travis.yml
> @@ -137,6 +137,8 @@ matrix:
>  apt:
>sources:
>  - llvm-toolchain-trusty-6.0
> +# llvm-6 depends on gcc-4.9 which is not in main repo
> +- ubuntu-toolchain-r-test
>packages:
>  # LLVM packaging is broken and misses these dependencies
>  - libedit-dev
> @@ -378,6 +380,8 @@ matrix:
>  apt:
>sources:
>  - llvm-toolchain-trusty-6.0
> +# llvm-6 depends on gcc-4.9 which is not in main repo
> +- ubuntu-toolchain-r-test
>packages:
>  # LLVM packaging is broken and misses these dependencies
>  - libedit-dev
-- 
Br,

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


Re: [Mesa-dev] [PATCH 2/2] travis: meson/Vulkan requires LLVM 6.0

2018-08-07 Thread Andres Gomez
This is:

Reviewed-by: Andres Gomez 

On Mon, 2018-08-06 at 12:17 +0200, Juan A. Suarez Romero wrote:
> RADV now requires LLVM 6.0.
> 
> Fixes: fd1121e8399 ("amd: remove support for LLVM 5.0")
> CC: Marek Olšák 
> ---
>  .travis.yml | 8 +---
>  1 file changed, 5 insertions(+), 3 deletions(-)
> 
> diff --git a/.travis.yml b/.travis.yml
> index f7c2a8da996..77f0dbd8e9e 100644
> --- a/.travis.yml
> +++ b/.travis.yml
> @@ -36,17 +36,19 @@ matrix:
>  - LABEL="meson Vulkan"
>  - BUILD=meson
>  - MESON_OPTIONS="-Ddri-drivers=[] -Dgallium-drivers=[]"
> -- LLVM_VERSION=5.0
> +- LLVM_VERSION=6.0
>  - LLVM_CONFIG="llvm-config-${LLVM_VERSION}"
>addons:
>  apt:
>sources:
> -- llvm-toolchain-trusty-5.0
> +- llvm-toolchain-trusty-6.0
> +# llvm-6 depends on gcc-4.9 which is not in main repo
> +- ubuntu-toolchain-r-test
>packages:
>  # LLVM packaging is broken and misses these dependencies
>  - libedit-dev
>  # From sources above
> -- llvm-5.0-dev
> +- llvm-6.0-dev
>  # Common
>  - xz-utils
>  - libexpat1-dev
-- 
Br,

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


Re: [Mesa-dev] [PATCH 1/2] travis: add ubuntu-toolchain-r-test

2018-08-07 Thread Juan A. Suarez Romero
On Tue, 2018-08-07 at 12:57 -0400, Jan Vesely wrote:
> 
> 
> On Tue, Aug 7, 2018 at 12:28 PM, Juan A. Suarez Romero  
> wrote:
> > On Tue, 2018-08-07 at 16:12 +0100, Emil Velikov wrote:
> > > On 6 August 2018 at 11:17, Juan A. Suarez Romero  
> > > wrote:
> > > > LLVM 6.0 requires GCC 4.9, which is not available in main Travis
> > > > repository.
> > > > 
> > > 
> > > We're not building LLVM 6.0 here, hence the commit message is a bit 
> > > confusing.
> > > Please add more information on the topic - even a bug report if there is 
> > > one.
> > > 
> > 
> > We are using now LLVM 6.0, for "make Vulkan" and "make Gallium Drivers
> > RadeonSI".
> > 
> > Previously we were using LLVM 6.0 for "make Gallium ST Clover LLVM-6.0", 
> > which
> > already had this ubuntu-toolchain-r-test.
> > 
> > Without this, we get an error like in 
> > https://travis-ci.org/mesa3d/mesa/jobs/413159413
> 
> I think Emil's point was that we actually need libstc++4.9, because llvm-lib 
> link to it, rather than the gcc compiler itself.
> 

Ah, I see. I'll update the commit message to say that libstdc++4.9 is required,
instead of GCC 4.9.

Emil: with this change, is this R-b from you?

J.A.

> Jan
>  
> > 
> > 
> > 
> > J.A.
> > 
> > > With that
> > > Reviewed-by: Emil Velikov 
> > > 
> > > -Emil
> > > 
> > 
> > ___
> > 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 v2] vulkan: simplify VK_USE_PLATFORM_*_KHR handling

2018-08-07 Thread Emil Velikov
From: Emil Velikov 

Instead of having multiple guards littered through the code, simply
introduce static inline no-op functions when the respective macros are
not set.

Inspired by the same convention from the kernel.

v2: Also handle PLATFORM_DISPLAY

Signed-off-by: Emil Velikov 
Reviewed-by: Eric Engestrom  (v1)
---
 src/vulkan/wsi/wsi_common.c | 12 
 src/vulkan/wsi/wsi_common_private.h | 47 +
 2 files changed, 47 insertions(+), 12 deletions(-)

diff --git a/src/vulkan/wsi/wsi_common.c b/src/vulkan/wsi/wsi_common.c
index f2d90a6bba2..d2ba7871a1d 100644
--- a/src/vulkan/wsi/wsi_common.c
+++ b/src/vulkan/wsi/wsi_common.c
@@ -80,23 +80,17 @@ wsi_device_init(struct wsi_device *wsi,
WSI_GET_CB(WaitForFences);
 #undef WSI_GET_CB
 
-#ifdef VK_USE_PLATFORM_XCB_KHR
result = wsi_x11_init_wsi(wsi, alloc);
if (result != VK_SUCCESS)
   goto fail;
-#endif
 
-#ifdef VK_USE_PLATFORM_WAYLAND_KHR
result = wsi_wl_init_wsi(wsi, alloc, pdevice);
if (result != VK_SUCCESS)
   goto fail;
-#endif
 
-#ifdef VK_USE_PLATFORM_DISPLAY_KHR
result = wsi_display_init_wsi(wsi, alloc, display_fd);
if (result != VK_SUCCESS)
   goto fail;
-#endif
 
return VK_SUCCESS;
 
@@ -109,15 +103,9 @@ void
 wsi_device_finish(struct wsi_device *wsi,
   const VkAllocationCallbacks *alloc)
 {
-#ifdef VK_USE_PLATFORM_DISPLAY_KHR
wsi_display_finish_wsi(wsi, alloc);
-#endif
-#ifdef VK_USE_PLATFORM_WAYLAND_KHR
wsi_wl_finish_wsi(wsi, alloc);
-#endif
-#ifdef VK_USE_PLATFORM_XCB_KHR
wsi_x11_finish_wsi(wsi, alloc);
-#endif
 }
 
 VkResult
diff --git a/src/vulkan/wsi/wsi_common_private.h 
b/src/vulkan/wsi/wsi_common_private.h
index 9f2aacd6560..7dc1554e38d 100644
--- a/src/vulkan/wsi/wsi_common_private.h
+++ b/src/vulkan/wsi/wsi_common_private.h
@@ -128,17 +128,49 @@ struct wsi_interface {
 struct wsi_swapchain **swapchain);
 };
 
+#ifdef VK_USE_PLATFORM_XCB_KHR
 VkResult wsi_x11_init_wsi(struct wsi_device *wsi_device,
   const VkAllocationCallbacks *alloc);
 void wsi_x11_finish_wsi(struct wsi_device *wsi_device,
 const VkAllocationCallbacks *alloc);
+#else
+static inline
+VkResult wsi_x11_init_wsi(struct wsi_device *wsi_device,
+  const VkAllocationCallbacks *alloc)
+{
+   return VK_SUCCESS;
+}
+
+static inline
+void wsi_x11_finish_wsi(struct wsi_device *wsi_device,
+const VkAllocationCallbacks *alloc)
+{
+}
+#endif
+
+#ifdef VK_USE_PLATFORM_WAYLAND_KHR
 VkResult wsi_wl_init_wsi(struct wsi_device *wsi_device,
  const VkAllocationCallbacks *alloc,
  VkPhysicalDevice physical_device);
 void wsi_wl_finish_wsi(struct wsi_device *wsi_device,
const VkAllocationCallbacks *alloc);
+#else
+static inline
+VkResult wsi_wl_init_wsi(struct wsi_device *wsi_device,
+ const VkAllocationCallbacks *alloc,
+ VkPhysicalDevice physical_device)
+{
+   return VK_SUCCESS;
+}
 
+static inline
+void wsi_wl_finish_wsi(struct wsi_device *wsi_device,
+   const VkAllocationCallbacks *alloc)
+{
+}
+#endif
 
+#ifdef VK_USE_PLATFORM_DISPLAY_KHR
 VkResult
 wsi_display_init_wsi(struct wsi_device *wsi_device,
  const VkAllocationCallbacks *alloc,
@@ -147,6 +179,21 @@ wsi_display_init_wsi(struct wsi_device *wsi_device,
 void
 wsi_display_finish_wsi(struct wsi_device *wsi_device,
const VkAllocationCallbacks *alloc);
+#else
+static inline VkResult
+wsi_display_init_wsi(struct wsi_device *wsi_device,
+ const VkAllocationCallbacks *alloc,
+ int display_fd)
+{
+   return VK_SUCCESS;
+}
+
+static inline void
+wsi_display_finish_wsi(struct wsi_device *wsi_device,
+   const VkAllocationCallbacks *alloc)
+{
+}
+#endif
 
 #define WSI_DEFINE_NONDISP_HANDLE_CASTS(__wsi_type, __VkType)  \
\
-- 
2.18.0

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


Re: [Mesa-dev] [PATCH 1/2] travis: add ubuntu-toolchain-r-test

2018-08-07 Thread Emil Velikov
On 7 August 2018 at 18:06, Juan A. Suarez Romero  wrote:
> On Tue, 2018-08-07 at 12:57 -0400, Jan Vesely wrote:
>>
>>
>> On Tue, Aug 7, 2018 at 12:28 PM, Juan A. Suarez Romero  
>> wrote:
>> > On Tue, 2018-08-07 at 16:12 +0100, Emil Velikov wrote:
>> > > On 6 August 2018 at 11:17, Juan A. Suarez Romero  
>> > > wrote:
>> > > > LLVM 6.0 requires GCC 4.9, which is not available in main Travis
>> > > > repository.
>> > > >
>> > >
>> > > We're not building LLVM 6.0 here, hence the commit message is a bit 
>> > > confusing.
>> > > Please add more information on the topic - even a bug report if there is 
>> > > one.
>> > >
>> >
>> > We are using now LLVM 6.0, for "make Vulkan" and "make Gallium Drivers
>> > RadeonSI".
>> >
>> > Previously we were using LLVM 6.0 for "make Gallium ST Clover LLVM-6.0", 
>> > which
>> > already had this ubuntu-toolchain-r-test.
>> >
>> > Without this, we get an error like in
>> > https://travis-ci.org/mesa3d/mesa/jobs/413159413
>>
>> I think Emil's point was that we actually need libstc++4.9, because llvm-lib 
>> link to it, rather than the gcc compiler itself.
>>
>
> Ah, I see. I'll update the commit message to say that libstdc++4.9 is 
> required,
> instead of GCC 4.9.
>
> Emil: with this change, is this R-b from you?
>
Of course. Pardon for the initial "not using LLVM 6.0" goof-up.

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


[Mesa-dev] [PATCH v2 00/11] intel: tools: Add a UI aub editor/viewer

2018-08-07 Thread Lionel Landwerlin
Hi all,

This is a quick update with some of the patches already marked as
reviewed/acked by Rafael.

The main change here is to move away from GLFW (which doesn't scale on
retina displays with a wayland session, sorry I live in the future) to
Gtk+.

I also added a URB view.

This is available at : 
https://github.com/djdeath/mesa/tree/wip/djdeath/aubinator_viewer

Cheers,

Lionel Landwerlin (11):
  intel: tools: split aub parsing from aubinator
  util: rb_tree: add safe iterators
  intel: tools: split memory management out of aubinator
  intel: tools: aubwrite: wrap function declarations for c++
  intel: tools: create libaub
  intel: tools: aubmem: map gtt data to aub file
  intel: tools: aub_mem: reuse already mapped ppgtt buffers
  intel: tools: import ImGui
  intel: tools: add aubinator viewer
  intel: aubinator_viewer: store urb state during decoding
  intel: aubinator_viewer: add urb view

 meson_options.txt| 2 +-
 src/intel/meson.build| 2 +-
 src/intel/tools/aub_mem.c|   426 +
 src/intel/tools/aub_mem.h|78 +
 src/intel/tools/aub_read.c   |   333 +
 src/intel/tools/aub_read.h   |77 +
 src/intel/tools/aub_write.h  | 8 +
 src/intel/tools/aubinator.c  |   658 +-
 src/intel/tools/aubinator_viewer.cpp |  1193 ++
 src/intel/tools/aubinator_viewer.h   |97 +
 src/intel/tools/aubinator_viewer_decoder.cpp |   964 ++
 src/intel/tools/aubinator_viewer_urb.h   |96 +
 src/intel/tools/imgui/LICENSE.txt|21 +
 src/intel/tools/imgui/README |15 +
 src/intel/tools/imgui/imconfig.h |72 +
 src/intel/tools/imgui/imgui.cpp  | 14184 +
 src/intel/tools/imgui/imgui.h|  1936 +++
 src/intel/tools/imgui/imgui_demo.cpp |  3471 
 src/intel/tools/imgui/imgui_draw.cpp |  3077 
 src/intel/tools/imgui/imgui_impl_gtk3.cpp|   284 +
 src/intel/tools/imgui/imgui_impl_gtk3.h  |15 +
 src/intel/tools/imgui/imgui_impl_opengl3.cpp |   437 +
 src/intel/tools/imgui/imgui_impl_opengl3.h   |25 +
 src/intel/tools/imgui/imgui_internal.h   |  1225 ++
 src/intel/tools/imgui/imgui_memory_editor.h  |   704 +
 src/intel/tools/imgui/meson.build|24 +
 src/intel/tools/imgui/stb_rect_pack.h|   623 +
 src/intel/tools/imgui/stb_textedit.h |  1409 ++
 src/intel/tools/imgui/stb_truetype.h |  4854 ++
 src/intel/tools/meson.build  |29 +-
 src/util/rb_tree.h   |58 +
 31 files changed, 35786 insertions(+), 611 deletions(-)
 create mode 100644 src/intel/tools/aub_mem.c
 create mode 100644 src/intel/tools/aub_mem.h
 create mode 100644 src/intel/tools/aub_read.c
 create mode 100644 src/intel/tools/aub_read.h
 create mode 100644 src/intel/tools/aubinator_viewer.cpp
 create mode 100644 src/intel/tools/aubinator_viewer.h
 create mode 100644 src/intel/tools/aubinator_viewer_decoder.cpp
 create mode 100644 src/intel/tools/aubinator_viewer_urb.h
 create mode 100644 src/intel/tools/imgui/LICENSE.txt
 create mode 100644 src/intel/tools/imgui/README
 create mode 100644 src/intel/tools/imgui/imconfig.h
 create mode 100644 src/intel/tools/imgui/imgui.cpp
 create mode 100644 src/intel/tools/imgui/imgui.h
 create mode 100644 src/intel/tools/imgui/imgui_demo.cpp
 create mode 100644 src/intel/tools/imgui/imgui_draw.cpp
 create mode 100644 src/intel/tools/imgui/imgui_impl_gtk3.cpp
 create mode 100644 src/intel/tools/imgui/imgui_impl_gtk3.h
 create mode 100644 src/intel/tools/imgui/imgui_impl_opengl3.cpp
 create mode 100644 src/intel/tools/imgui/imgui_impl_opengl3.h
 create mode 100644 src/intel/tools/imgui/imgui_internal.h
 create mode 100644 src/intel/tools/imgui/imgui_memory_editor.h
 create mode 100644 src/intel/tools/imgui/meson.build
 create mode 100644 src/intel/tools/imgui/stb_rect_pack.h
 create mode 100644 src/intel/tools/imgui/stb_textedit.h
 create mode 100644 src/intel/tools/imgui/stb_truetype.h

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


[Mesa-dev] [PATCH v2 03/11] intel: tools: split memory management out of aubinator

2018-08-07 Thread Lionel Landwerlin
Signed-off-by: Lionel Landwerlin 
Reviewed-by: Rafael Antognolli 
---
 src/intel/tools/aub_mem.c   | 391 
 src/intel/tools/aub_mem.h   |  72 +++
 src/intel/tools/aubinator.c | 379 +++---
 src/intel/tools/meson.build |   2 +-
 4 files changed, 491 insertions(+), 353 deletions(-)
 create mode 100644 src/intel/tools/aub_mem.c
 create mode 100644 src/intel/tools/aub_mem.h

diff --git a/src/intel/tools/aub_mem.c b/src/intel/tools/aub_mem.c
new file mode 100644
index 000..788a2461130
--- /dev/null
+++ b/src/intel/tools/aub_mem.c
@@ -0,0 +1,391 @@
+/*
+ * Copyright © 2016-2018 Intel Corporation
+ *
+ * Permission is hereby granted, free of charge, to any person obtaining a
+ * copy of this software and associated documentation files (the "Software"),
+ * to deal in the Software without restriction, including without limitation
+ * the rights to use, copy, modify, merge, publish, distribute, sublicense,
+ * and/or sell copies of the Software, and to permit persons to whom the
+ * Software is furnished to do so, subject to the following conditions:
+ *
+ * The above copyright notice and this permission notice (including the next
+ * paragraph) shall be included in all copies or substantial portions of the
+ * Software.
+ *
+ * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
+ * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
+ * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.  IN NO EVENT SHALL
+ * THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
+ * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
+ * FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS
+ * IN THE SOFTWARE.
+ */
+
+#include 
+#include 
+#include 
+#include 
+
+#include "aub_mem.h"
+
+#ifndef HAVE_MEMFD_CREATE
+#include 
+
+static inline int
+memfd_create(const char *name, unsigned int flags)
+{
+   return syscall(SYS_memfd_create, name, flags);
+}
+#endif
+
+struct bo_map {
+   struct list_head link;
+   struct gen_batch_decode_bo bo;
+   bool unmap_after_use;
+};
+
+struct ggtt_entry {
+   struct rb_node node;
+   uint64_t virt_addr;
+   uint64_t phys_addr;
+};
+
+struct phys_mem {
+   struct rb_node node;
+   uint64_t fd_offset;
+   uint64_t phys_addr;
+   uint8_t *data;
+};
+
+static void
+add_gtt_bo_map(struct aub_mem *mem, struct gen_batch_decode_bo bo, bool 
unmap_after_use)
+{
+   struct bo_map *m = calloc(1, sizeof(*m));
+
+   m->bo = bo;
+   m->unmap_after_use = unmap_after_use;
+   list_add(&m->link, &mem->maps);
+}
+
+void
+aub_mem_clear_bo_maps(struct aub_mem *mem)
+{
+   list_for_each_entry_safe(struct bo_map, i, &mem->maps, link) {
+  if (i->unmap_after_use)
+ munmap((void *)i->bo.map, i->bo.size);
+  list_del(&i->link);
+  free(i);
+   }
+}
+
+static inline struct ggtt_entry *
+ggtt_entry_next(struct ggtt_entry *entry)
+{
+   if (!entry)
+  return NULL;
+   struct rb_node *node = rb_node_next(&entry->node);
+   if (!node)
+  return NULL;
+   return rb_node_data(struct ggtt_entry, node, node);
+}
+
+static inline int
+cmp_uint64(uint64_t a, uint64_t b)
+{
+   if (a < b)
+  return -1;
+   if (a > b)
+  return 1;
+   return 0;
+}
+
+static inline int
+cmp_ggtt_entry(const struct rb_node *node, const void *addr)
+{
+   struct ggtt_entry *entry = rb_node_data(struct ggtt_entry, node, node);
+   return cmp_uint64(entry->virt_addr, *(const uint64_t *)addr);
+}
+
+static struct ggtt_entry *
+ensure_ggtt_entry(struct aub_mem *mem, uint64_t virt_addr)
+{
+   struct rb_node *node = rb_tree_search_sloppy(&mem->ggtt, &virt_addr,
+cmp_ggtt_entry);
+   int cmp = 0;
+   if (!node || (cmp = cmp_ggtt_entry(node, &virt_addr))) {
+  struct ggtt_entry *new_entry = calloc(1, sizeof(*new_entry));
+  new_entry->virt_addr = virt_addr;
+  rb_tree_insert_at(&mem->ggtt, node, &new_entry->node, cmp > 0);
+  node = &new_entry->node;
+   }
+
+   return rb_node_data(struct ggtt_entry, node, node);
+}
+
+static struct ggtt_entry *
+search_ggtt_entry(struct aub_mem *mem, uint64_t virt_addr)
+{
+   virt_addr &= ~0xfff;
+
+   struct rb_node *node = rb_tree_search(&mem->ggtt, &virt_addr, 
cmp_ggtt_entry);
+
+   if (!node)
+  return NULL;
+
+   return rb_node_data(struct ggtt_entry, node, node);
+}
+
+static inline int
+cmp_phys_mem(const struct rb_node *node, const void *addr)
+{
+   struct phys_mem *mem = rb_node_data(struct phys_mem, node, node);
+   return cmp_uint64(mem->phys_addr, *(uint64_t *)addr);
+}
+
+static struct phys_mem *
+ensure_phys_mem(struct aub_mem *mem, uint64_t phys_addr)
+{
+   struct rb_node *node = rb_tree_search_sloppy(&mem->mem, &phys_addr, 
cmp_phys_mem);
+   int cmp = 0;
+   if (!node || (cmp = cmp_phys_mem(node, &phys_addr))) {
+  struct phys_mem *new_mem = calloc(1, sizeof(*new_mem));
+  new_mem->phys_addr = phys_addr;
+  

[Mesa-dev] [PATCH v2 04/11] intel: tools: aubwrite: wrap function declarations for c++

2018-08-07 Thread Lionel Landwerlin
Reviewed-by: Rafael Antognolli 
---
 src/intel/tools/aub_write.h | 8 
 1 file changed, 8 insertions(+)

diff --git a/src/intel/tools/aub_write.h b/src/intel/tools/aub_write.h
index b421679b9eb..6a09c1747b9 100644
--- a/src/intel/tools/aub_write.h
+++ b/src/intel/tools/aub_write.h
@@ -31,6 +31,10 @@
 #include "dev/gen_device_info.h"
 #include "common/gen_gem.h"
 
+#ifdef __cplusplus
+extern "C" {
+#endif
+
 struct aub_ppgtt_table {
uint64_t phys_addr;
struct aub_ppgtt_table *subtables[512];
@@ -78,4 +82,8 @@ void aub_write_trace_block(struct aub_file *aub,
 void aub_write_exec(struct aub_file *aub, uint64_t batch_addr,
 uint64_t offset, int ring_flag);
 
+#ifdef __cplusplus
+}
+#endif
+
 #endif /* INTEL_AUB_WRITE */
-- 
2.18.0

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


[Mesa-dev] [PATCH v2 01/11] intel: tools: split aub parsing from aubinator

2018-08-07 Thread Lionel Landwerlin
v2: add parsing error callback (Lionel)

Signed-off-by: Lionel Landwerlin 
Reviewed-by: Rafael Antognolli  (v1)
---
 src/intel/tools/aub_read.c  | 333 
 src/intel/tools/aub_read.h  |  77 +
 src/intel/tools/aubinator.c | 325 +--
 src/intel/tools/meson.build |   2 +-
 4 files changed, 458 insertions(+), 279 deletions(-)
 create mode 100644 src/intel/tools/aub_read.c
 create mode 100644 src/intel/tools/aub_read.h

diff --git a/src/intel/tools/aub_read.c b/src/intel/tools/aub_read.c
new file mode 100644
index 000..5b704e8f78b
--- /dev/null
+++ b/src/intel/tools/aub_read.c
@@ -0,0 +1,333 @@
+/*
+ * Copyright © 2016-2018 Intel Corporation
+ *
+ * Permission is hereby granted, free of charge, to any person obtaining a
+ * copy of this software and associated documentation files (the "Software"),
+ * to deal in the Software without restriction, including without limitation
+ * the rights to use, copy, modify, merge, publish, distribute, sublicense,
+ * and/or sell copies of the Software, and to permit persons to whom the
+ * Software is furnished to do so, subject to the following conditions:
+ *
+ * The above copyright notice and this permission notice (including the next
+ * paragraph) shall be included in all copies or substantial portions of the
+ * Software.
+ *
+ * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
+ * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
+ * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.  IN NO EVENT SHALL
+ * THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
+ * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
+ * FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS
+ * IN THE SOFTWARE.
+ *
+ */
+
+#include 
+#include 
+#include 
+#include 
+
+#include "common/gen_gem.h"
+#include "util/macros.h"
+
+#include "aub_read.h"
+#include "intel_aub.h"
+
+#define TYPE(dw)   (((dw) >> 29) & 7)
+#define OPCODE(dw) (((dw) >> 23) & 0x3f)
+#define SUBOPCODE(dw)  (((dw) >> 16) & 0x7f)
+
+#define MAKE_HEADER(type, opcode, subopcode) \
+   (((type) << 29) | ((opcode) << 23) | ((subopcode) << 16))
+
+#define TYPE_AUB0x7
+
+/* Classic AUB opcodes */
+#define OPCODE_AUB  0x01
+#define SUBOPCODE_HEADER0x05
+#define SUBOPCODE_BLOCK 0x41
+#define SUBOPCODE_BMP   0x1e
+
+/* Newer version AUB opcode */
+#define OPCODE_NEW_AUB  0x2e
+#define SUBOPCODE_REG_POLL  0x02
+#define SUBOPCODE_REG_WRITE 0x03
+#define SUBOPCODE_MEM_POLL  0x05
+#define SUBOPCODE_MEM_WRITE 0x06
+#define SUBOPCODE_VERSION   0x0e
+
+#define MAKE_GEN(major, minor) (((major) << 8) | (minor))
+
+static void
+parse_error(struct aub_read *read, const uint32_t *p, const char *fmt, ...)
+{
+   if (!read->error)
+  return;
+
+   va_list ap;
+   va_start(ap, fmt);
+
+   char msg[80];
+   vsnprintf(msg, sizeof(msg), fmt, ap);
+   read->error(read->user_data, p, msg);
+
+   va_end(ap);
+}
+
+static bool
+handle_trace_header(struct aub_read *read, const uint32_t *p)
+{
+   /* The intel_aubdump tool from IGT is kind enough to put a PCI-ID= tag in
+* the AUB header comment.  If the user hasn't specified a hardware
+* generation, try to use the one from the AUB file.
+*/
+   const uint32_t *end = p + (p[0] & 0x) + 2;
+   int aub_pci_id = 0;
+
+   if (end > &p[12] && p[12] > 0) {
+  if (sscanf((char *)&p[13], "PCI-ID=%i", &aub_pci_id) > 0) {
+ if (!gen_get_device_info(aub_pci_id, &read->devinfo)) {
+parse_error(read, p,
+"can't find device information: pci_id=0x%x\n", 
aub_pci_id);
+return false;
+ }
+  }
+   }
+
+   char app_name[33];
+   strncpy(app_name, (const char *)&p[2], 32);
+   app_name[32] = 0;
+
+   if (read->info)
+  read->info(read->user_data, aub_pci_id, app_name);
+
+   return true;
+}
+
+static bool
+handle_memtrace_version(struct aub_read *read, const uint32_t *p)
+{
+   int header_length = p[0] & 0x;
+   char app_name[64];
+   int app_name_len = MIN2(4 * (header_length + 1 - 5), ARRAY_SIZE(app_name) - 
1);
+   int pci_id_len = 0;
+   int aub_pci_id = 0;
+
+   strncpy(app_name, (const char *)&p[5], app_name_len);
+   app_name[app_name_len] = 0;
+
+   if (sscanf(app_name, "PCI-ID=%i %n", &aub_pci_id, &pci_id_len) > 0) {
+  if (!gen_get_device_info(aub_pci_id, &read->devinfo)) {
+ parse_error(read, p, "can't find device information: pci_id=0x%x\n", 
aub_pci_id);
+ return false;
+  }
+
+  if (read->info)
+ read->info(read->user_data, aub_pci_id, app_name + pci_id_len);
+   }
+
+   return true;
+}
+
+static bool
+handle_trace_block(struct aub_read *read, const uint32_t *p)
+{
+   int operation = p[1] & AUB_TRACE_OPERATION_MASK;
+   int type = p[1] & AUB_TRACE_TYPE_MASK;
+   int address_space = p[1] & AUB_TRACE_ADDRESS_SPACE_MASK;
+   in

[Mesa-dev] [PATCH v2 02/11] util: rb_tree: add safe iterators

2018-08-07 Thread Lionel Landwerlin
v2: Add helper to make iterators more readable (Rafael)
Fix rev iterator bug (Rafael)

Signed-off-by: Lionel Landwerlin 
---
 src/util/rb_tree.h | 58 ++
 1 file changed, 58 insertions(+)

diff --git a/src/util/rb_tree.h b/src/util/rb_tree.h
index c77e9255ea2..1e8aeb4a7b2 100644
--- a/src/util/rb_tree.h
+++ b/src/util/rb_tree.h
@@ -227,6 +227,30 @@ struct rb_node *rb_node_next(struct rb_node *node);
 /** Get the next previous (to the left) in the tree or NULL */
 struct rb_node *rb_node_prev(struct rb_node *node);
 
+/** Get the next node if available or the same node again.
+ *
+ * \param   typeThe type of the containing data structure
+ *
+ * \param   nodeThe variable name for current node in the iteration;
+ *  this will be declared as a pointer to \p type
+ *
+ * \param   field   The rb_node field in containing data structure
+ */
+#define rb_tree_node_next_if_available(type, node, field) \
+   (&node->field != NULL) ? rb_node_data(type, rb_node_next(&node->field), 
field) : node
+
+/** Get the previous node if available or the same node again.
+ *
+ * \param   typeThe type of the containing data structure
+ *
+ * \param   nodeThe variable name for current node in the iteration;
+ *  this will be declared as a pointer to \p type
+ *
+ * \param   field   The rb_node field in containing data structure
+ */
+#define rb_tree_node_prev_if_available(type, node, field) \
+   (&node->field != NULL) ? rb_node_data(type, rb_node_prev(&node->field), 
field) : node
+
 /** Iterate over the nodes in the tree
  *
  * \param   typeThe type of the containing data structure
@@ -243,6 +267,23 @@ struct rb_node *rb_node_prev(struct rb_node *node);
 &node->field != NULL; \
 node = rb_node_data(type, rb_node_next(&node->field), field))
 
+/** Iterate over the nodes in the tree, allowing the current node to be freed
+ *
+ * \param   typeThe type of the containing data structure
+ *
+ * \param   nodeThe variable name for current node in the iteration;
+ *  this will be declared as a pointer to \p type
+ *
+ * \param   T   The red-black tree
+ *
+ * \param   field   The rb_node field in containing data structure
+ */
+#define rb_tree_foreach_safe(type, node, T, field) \
+   for (type *node = rb_node_data(type, rb_tree_first(T), field), \
+   *__next = rb_tree_node_next_if_available(type, node, field); \
+&node->field != NULL; \
+node = __next, __next = rb_tree_node_next_if_available(type, node, 
field))
+
 /** Iterate over the nodes in the tree in reverse
  *
  * \param   typeThe type of the containing data structure
@@ -259,6 +300,23 @@ struct rb_node *rb_node_prev(struct rb_node *node);
 &node->field != NULL; \
 node = rb_node_data(type, rb_node_prev(&node->field), field))
 
+/** Iterate over the nodes in the tree in reverse, allowing the current node 
to be freed
+ *
+ * \param   typeThe type of the containing data structure
+ *
+ * \param   nodeThe variable name for current node in the iteration;
+ *  this will be declared as a pointer to \p type
+ *
+ * \param   T   The red-black tree
+ *
+ * \param   field   The rb_node field in containing data structure
+ */
+#define rb_tree_foreach_rev_safe(type, node, T, field) \
+   for (type *node = rb_node_data(type, rb_tree_last(T), field), \
+   *__prev = rb_tree_node_prev_if_available(type, node, field);  \
+&node->field != NULL; \
+node = __prev, __prev = rb_tree_node_prev_if_available(type, node, 
field))
+
 /** Validate a red-black tree
  *
  * This function walks the tree and validates that this is a valid red-
-- 
2.18.0

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


[Mesa-dev] [PATCH v2 06/11] intel: tools: aubmem: map gtt data to aub file

2018-08-07 Thread Lionel Landwerlin
This will allow the aubinator viewer tool to modify the aub data that
was loaded at a particular gtt address.

Signed-off-by: Lionel Landwerlin 
Reviewed-by: Rafael Antognolli 
---
 src/intel/tools/aub_mem.c | 29 +
 src/intel/tools/aub_mem.h |  6 ++
 2 files changed, 35 insertions(+)

diff --git a/src/intel/tools/aub_mem.c b/src/intel/tools/aub_mem.c
index 788a2461130..2d29386e57c 100644
--- a/src/intel/tools/aub_mem.c
+++ b/src/intel/tools/aub_mem.c
@@ -55,6 +55,7 @@ struct phys_mem {
uint64_t fd_offset;
uint64_t phys_addr;
uint8_t *data;
+   const uint8_t *aub_data;
 };
 
 static void
@@ -220,6 +221,7 @@ aub_mem_phys_write(void *_mem, uint64_t phys_address,
   uint32_t size_this_page = MIN2(to_write, 4096 - offset);
   to_write -= size_this_page;
   memcpy(pmem->data + offset, data, size_this_page);
+  pmem->aub_data = data - offset;
   data = (const uint8_t *)data + size_this_page;
}
 }
@@ -389,3 +391,30 @@ aub_mem_fini(struct aub_mem *mem)
close(mem->mem_fd);
mem->mem_fd = -1;
 }
+
+struct gen_batch_decode_bo
+aub_mem_get_phys_addr_data(struct aub_mem *mem, uint64_t phys_addr)
+{
+   struct phys_mem *page = search_phys_mem(mem, phys_addr);
+   return page ?
+  (struct gen_batch_decode_bo) { .map = page->data, .addr = 
page->phys_addr, .size = 4096 } :
+  (struct gen_batch_decode_bo) {};
+}
+
+struct gen_batch_decode_bo
+aub_mem_get_ppgtt_addr_data(struct aub_mem *mem, uint64_t virt_addr)
+{
+   struct phys_mem *page = ppgtt_walk(mem, mem->pml4, virt_addr);
+   return page ?
+  (struct gen_batch_decode_bo) { .map = page->data, .addr = virt_addr & 
~((1ULL << 12) - 1), .size = 4096 } :
+  (struct gen_batch_decode_bo) {};
+}
+
+struct gen_batch_decode_bo
+aub_mem_get_ppgtt_addr_aub_data(struct aub_mem *mem, uint64_t virt_addr)
+{
+   struct phys_mem *page = ppgtt_walk(mem, mem->pml4, virt_addr);
+   return page ?
+  (struct gen_batch_decode_bo) { .map = page->aub_data, .addr = virt_addr 
& ~((1ULL << 12) - 1), .size = 4096 } :
+  (struct gen_batch_decode_bo) {};
+}
diff --git a/src/intel/tools/aub_mem.h b/src/intel/tools/aub_mem.h
index 98e64214b98..1d73d3340f2 100644
--- a/src/intel/tools/aub_mem.h
+++ b/src/intel/tools/aub_mem.h
@@ -65,6 +65,12 @@ void aub_mem_local_write(void *mem, uint64_t virt_address,
 struct gen_batch_decode_bo aub_mem_get_ggtt_bo(void *mem, uint64_t address);
 struct gen_batch_decode_bo aub_mem_get_ppgtt_bo(void *mem, uint64_t address);
 
+struct gen_batch_decode_bo aub_mem_get_phys_addr_data(struct aub_mem *mem, 
uint64_t phys_addr);
+struct gen_batch_decode_bo aub_mem_get_ppgtt_addr_data(struct aub_mem *mem, 
uint64_t virt_addr);
+
+struct gen_batch_decode_bo aub_mem_get_ppgtt_addr_aub_data(struct aub_mem 
*mem, uint64_t virt_addr);
+
+
 #ifdef __cplusplus
 }
 #endif
-- 
2.18.0

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


[Mesa-dev] [PATCH v2 05/11] intel: tools: create libaub

2018-08-07 Thread Lionel Landwerlin
Signed-off-by: Lionel Landwerlin 
---
 src/intel/tools/meson.build | 14 --
 1 file changed, 12 insertions(+), 2 deletions(-)

diff --git a/src/intel/tools/meson.build b/src/intel/tools/meson.build
index d749a80afed..258bf7011b3 100644
--- a/src/intel/tools/meson.build
+++ b/src/intel/tools/meson.build
@@ -18,12 +18,22 @@
 # OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
 # SOFTWARE.
 
+
+libaub = static_library(
+  'aub',
+  files('aub_read.c', 'aub_mem.c'),
+  include_directories : [inc_common, inc_intel],
+  link_with : [libintel_common, libintel_dev, libmesa_util],
+  c_args : [c_vis_args, no_override_init_args],
+  install : false
+)
+
 aubinator = executable(
   'aubinator',
-  files('aubinator.c', 'intel_aub.h', 'aub_read.h', 'aub_read.c', 'aub_mem.h', 
'aub_mem.c'),
+  files('aubinator.c'),
   dependencies : [dep_expat, dep_zlib, dep_dl, dep_thread, dep_m],
   include_directories : [inc_common, inc_intel],
-  link_with : [libintel_common, libintel_compiler, libintel_dev, libmesa_util],
+  link_with : [libintel_common, libintel_compiler, libintel_dev, libmesa_util, 
libaub],
   c_args : [c_vis_args, no_override_init_args],
   build_by_default : true,
   install : true
-- 
2.18.0

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


[Mesa-dev] [PATCH v2 07/11] intel: tools: aub_mem: reuse already mapped ppgtt buffers

2018-08-07 Thread Lionel Landwerlin
When we map a PPGTT buffer into a continous address space of aubinator
to be able to inspect it, we currently add it to the list of BOs to
unmap once we're finished. An optimization we can apply it to look up
that list before trying to remap PPGTT buffers again (we already do
this for GGTT buffers).

We need to take some care before doing this because the list also
contains GGTT BOs. As GGTT & PPGTT are 2 different address spaces, we
can have matching addresses in both that point to different physical
locations.

This changes adds a flag on the elements of the list of mapped BOs to
differenciate between GGTT & PPGTT, which allows use to reuse that
list when looking up both address spaces.

Signed-off-by: Lionel Landwerlin 
---
 src/intel/tools/aub_mem.c | 16 +++-
 1 file changed, 11 insertions(+), 5 deletions(-)

diff --git a/src/intel/tools/aub_mem.c b/src/intel/tools/aub_mem.c
index 2d29386e57c..3d4dc8061bd 100644
--- a/src/intel/tools/aub_mem.c
+++ b/src/intel/tools/aub_mem.c
@@ -42,6 +42,7 @@ struct bo_map {
struct list_head link;
struct gen_batch_decode_bo bo;
bool unmap_after_use;
+   bool ppgtt;
 };
 
 struct ggtt_entry {
@@ -59,10 +60,11 @@ struct phys_mem {
 };
 
 static void
-add_gtt_bo_map(struct aub_mem *mem, struct gen_batch_decode_bo bo, bool 
unmap_after_use)
+add_gtt_bo_map(struct aub_mem *mem, struct gen_batch_decode_bo bo, bool ppgtt, 
bool unmap_after_use)
 {
struct bo_map *m = calloc(1, sizeof(*m));
 
+   m->ppgtt = ppgtt;
m->bo = bo;
m->unmap_after_use = unmap_after_use;
list_add(&m->link, &mem->maps);
@@ -190,7 +192,7 @@ aub_mem_local_write(void *_mem, uint64_t address,
   .addr = address,
   .size = size,
};
-   add_gtt_bo_map(mem, bo, false);
+   add_gtt_bo_map(mem, bo, false, false);
 }
 
 void
@@ -253,7 +255,7 @@ aub_mem_get_ggtt_bo(void *_mem, uint64_t address)
struct gen_batch_decode_bo bo = {0};
 
list_for_each_entry(struct bo_map, i, &mem->maps, link)
-  if (i->bo.addr <= address && i->bo.addr + i->bo.size > address)
+  if (!i->ppgtt && i->bo.addr <= address && i->bo.addr + i->bo.size > 
address)
  return i->bo;
 
address &= ~0xfff;
@@ -292,7 +294,7 @@ aub_mem_get_ggtt_bo(void *_mem, uint64_t address)
   assert(res != MAP_FAILED);
}
 
-   add_gtt_bo_map(mem, bo, true);
+   add_gtt_bo_map(mem, bo, false, true);
 
return bo;
 }
@@ -328,6 +330,10 @@ aub_mem_get_ppgtt_bo(void *_mem, uint64_t address)
struct aub_mem *mem = _mem;
struct gen_batch_decode_bo bo = {0};
 
+   list_for_each_entry(struct bo_map, i, &mem->maps, link)
+  if (i->ppgtt && i->bo.addr <= address && i->bo.addr + i->bo.size > 
address)
+ return i->bo;
+
address &= ~0xfff;
 
if (!ppgtt_mapped(mem, mem->pml4, address))
@@ -353,7 +359,7 @@ aub_mem_get_ppgtt_bo(void *_mem, uint64_t address)
   assert(res != MAP_FAILED);
}
 
-   add_gtt_bo_map(mem, bo, true);
+   add_gtt_bo_map(mem, bo, true, true);
 
return bo;
 }
-- 
2.18.0

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


[Mesa-dev] [PATCH v2 11/11] intel: aubinator_viewer: add urb view

2018-08-07 Thread Lionel Landwerlin
This is available through a "Show URB" button on the 3DPRIMITIVE
instructions.

Signed-off-by: Lionel Landwerlin 
---
 src/intel/tools/aubinator_viewer.cpp   | 75 
 src/intel/tools/aubinator_viewer_urb.h | 96 ++
 2 files changed, 171 insertions(+)
 create mode 100644 src/intel/tools/aubinator_viewer_urb.h

diff --git a/src/intel/tools/aubinator_viewer.cpp 
b/src/intel/tools/aubinator_viewer.cpp
index f306f99bca5..5f2d50f6e46 100644
--- a/src/intel/tools/aubinator_viewer.cpp
+++ b/src/intel/tools/aubinator_viewer.cpp
@@ -219,6 +219,7 @@ update_mem_for_exec(struct aub_mem *mem, struct aub_file 
*file, int exec_idx)
 #include "imgui_impl_opengl3.h"
 
 #include "aubinator_viewer.h"
+#include "aubinator_viewer_urb.h"
 #include "imgui_memory_editor.h"
 
 struct window {
@@ -267,6 +268,15 @@ struct shader_window {
size_t shader_size;
 };
 
+struct urb_window {
+   struct window base;
+
+   uint32_t end_urb_offset;
+   struct aub_decode_urb_stage_state urb_stages[AUB_DECODE_N_STAGE];
+
+   AubinatorViewerUrb urb_view;
+};
+
 struct batch_window {
struct window base;
 
@@ -389,6 +399,61 @@ new_shader_window(struct aub_mem *mem, uint64_t address, 
const char *desc)
return window;
 }
 
+/* URB windows */
+
+static void
+display_urb_window(struct window *win)
+{
+   struct urb_window *window = (struct urb_window *) win;
+   static const char *stages[] = {
+  [AUB_DECODE_STAGE_VS] = "VS",
+  [AUB_DECODE_STAGE_HS] = "HS",
+  [AUB_DECODE_STAGE_DS] = "DS",
+  [AUB_DECODE_STAGE_GS] = "GS",
+  [AUB_DECODE_STAGE_PS] = "PS",
+  [AUB_DECODE_STAGE_CS] = "CS",
+   };
+
+   ImGui::Text("URB allocation:");
+   window->urb_view.DrawAllocation("##urb",
+   ARRAY_SIZE(window->urb_stages),
+   window->end_urb_offset,
+   stages,
+   &window->urb_stages[0]);
+}
+
+static void
+destroy_urb_window(struct window *win)
+{
+   struct urb_window *window = (struct urb_window *) win;
+
+   free(window);
+}
+
+static struct urb_window *
+new_urb_window(struct aub_viewer_decode_ctx *decode_ctx, uint64_t address)
+{
+   struct urb_window *window = xtzalloc(*window);
+
+   snprintf(window->base.name, sizeof(window->base.name),
+"URB view (0x%lx)##%p", address, window);
+
+   list_inithead(&window->base.parent_link);
+   window->base.position = ImVec2(-1, -1);
+   window->base.size = ImVec2(700, 300);
+   window->base.opened = true;
+   window->base.display = display_urb_window;
+   window->base.destroy = destroy_urb_window;
+
+   window->end_urb_offset = decode_ctx->end_urb_offset;
+   memcpy(window->urb_stages, decode_ctx->urb_stages, 
sizeof(window->urb_stages));
+   window->urb_view = AubinatorViewerUrb();
+
+   list_addtail(&window->base.link, &context.windows);
+
+   return window;
+}
+
 /* Memory editor windows */
 
 static uint8_t
@@ -581,6 +646,15 @@ batch_display_shader(void *user_data, const char 
*shader_desc, uint64_t address)
list_add(&shader_window->base.parent_link, &window->base.children_windows);
 }
 
+static void
+batch_display_urb(void *user_data, const struct aub_decode_urb_stage_state 
*stages)
+{
+   struct batch_window *window = (struct batch_window *) user_data;
+   struct urb_window *urb_window = new_urb_window(&window->decode_ctx, 0);
+
+   list_add(&urb_window->base.parent_link, &window->base.children_windows);
+}
+
 static void
 batch_edit_address(void *user_data, uint64_t address, uint32_t len)
 {
@@ -740,6 +814,7 @@ new_batch_window(int exec_idx)
   NULL,
   window);
window->decode_ctx.display_shader = batch_display_shader;
+   window->decode_ctx.display_urb = batch_display_urb;
window->decode_ctx.edit_address = batch_edit_address;
 
update_batch_window(window, false, exec_idx);
diff --git a/src/intel/tools/aubinator_viewer_urb.h 
b/src/intel/tools/aubinator_viewer_urb.h
new file mode 100644
index 000..6857bc20a8f
--- /dev/null
+++ b/src/intel/tools/aubinator_viewer_urb.h
@@ -0,0 +1,96 @@
+#ifndef AUBINATOR_VIEWER_URB_H
+#define AUBINATOR_VIEWER_URB_H
+
+#include "aubinator_viewer.h"
+
+#include "imgui.h"
+
+struct AubinatorViewerUrb {
+
+   float RowHeight;
+
+   AubinatorViewerUrb() {
+  RowHeight = 10.0f;
+   }
+
+   bool _Hovered(const ImVec2& mouse, bool window_hovered,
+ const ImVec2& tl, const ImVec2& br) {
+  return window_hovered &&
+ tl.x <= mouse.x && tl.y <= mouse.y &&
+ br.x > mouse.x && br.y > mouse.y;
+   }
+
+   void DrawAllocation(const char *label,
+   int n_stages,
+   int end_urb_offset,
+   const char *stage_names[],
+   const struct aub_decode_urb_stage_state *stages) {
+  const ImVec2 label_size = ImGui::CalcTextSize("VS entry:  ", NULL, true);
+  ImVec2 graph_size(ImGui::Cal

[Mesa-dev] [PATCH v2 09/11] intel: tools: add aubinator viewer

2018-08-07 Thread Lionel Landwerlin
A graphical user interface version of aubinator.
Allows you to :

   - simultaneously look at multiple points in the aub file (using all
 the goodness of the existing decoding in aubinator)

   - edit an aub file

Signed-off-by: Lionel Landwerlin 
---
 src/intel/tools/aubinator_viewer.cpp | 1118 ++
 src/intel/tools/aubinator_viewer.h   |   71 ++
 src/intel/tools/aubinator_viewer_decoder.cpp |  860 ++
 src/intel/tools/imgui/imgui_memory_editor.h  |  704 +++
 src/intel/tools/meson.build  |   12 +
 5 files changed, 2765 insertions(+)
 create mode 100644 src/intel/tools/aubinator_viewer.cpp
 create mode 100644 src/intel/tools/aubinator_viewer.h
 create mode 100644 src/intel/tools/aubinator_viewer_decoder.cpp
 create mode 100644 src/intel/tools/imgui/imgui_memory_editor.h

diff --git a/src/intel/tools/aubinator_viewer.cpp 
b/src/intel/tools/aubinator_viewer.cpp
new file mode 100644
index 000..f306f99bca5
--- /dev/null
+++ b/src/intel/tools/aubinator_viewer.cpp
@@ -0,0 +1,1118 @@
+/*
+ * 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 
+#include 
+#include 
+#include 
+#include 
+#include 
+#include 
+#include 
+#include 
+#include 
+#include 
+#include 
+
+#include "util/macros.h"
+
+#include "aub_read.h"
+#include "aub_mem.h"
+
+#include "common/gen_disasm.h"
+
+#define xtzalloc(name) ((decltype(&name)) calloc(1, sizeof(name)))
+#define xtalloc(name) ((decltype(&name)) malloc(sizeof(name)))
+
+struct aub_file {
+   uint8_t *map, *end, *cursor;
+
+   uint16_t pci_id;
+   char app_name[33];
+
+   /* List of batch buffers to process */
+   struct {
+  const uint8_t *start;
+  const uint8_t *end;
+   } *execs;
+   int n_execs;
+   int n_allocated_execs;
+
+   uint32_t idx_reg_write;
+
+   /* Device state */
+   struct gen_device_info devinfo;
+   struct gen_spec *spec;
+   struct gen_disasm *disasm;
+};
+
+static void
+store_exec_begin(struct aub_file *file)
+{
+   if (unlikely(file->n_execs >= file->n_allocated_execs)) {
+  file->n_allocated_execs = MAX2(2U * file->n_allocated_execs,
+ 4096 / sizeof(file->execs[0]));
+  file->execs = (decltype(file->execs))
+ realloc(static_cast(file->execs),
+ file->n_allocated_execs * sizeof(file->execs[0]));
+   }
+
+   file->execs[file->n_execs++].start = file->cursor;
+}
+
+static void
+store_exec_end(struct aub_file *file)
+{
+   if (file->n_execs > 0 && file->execs[file->n_execs - 1].end == NULL)
+  file->execs[file->n_execs - 1].end = file->cursor;
+}
+
+static void
+handle_mem_write(void *user_data, uint64_t phys_addr,
+ const void *data, uint32_t data_len)
+{
+   struct aub_file *file = (struct aub_file *) user_data;
+   file->idx_reg_write = 0;
+   store_exec_end(file);
+}
+
+static void
+handle_ring_write(void *user_data, enum gen_engine engine,
+  const void *ring_data, uint32_t ring_data_len)
+{
+   struct aub_file *file = (struct aub_file *) user_data;
+   file->idx_reg_write = 0;
+   store_exec_begin(file);
+}
+
+static void
+handle_reg_write(void *user_data, uint32_t reg_offset, uint32_t reg_value)
+{
+   struct aub_file *file = (struct aub_file *) user_data;
+
+   /* Only store the first register write of a series (execlist writes take
+* involve 2 dwords).
+*/
+   if (file->idx_reg_write++ == 0)
+  store_exec_begin(file);
+}
+
+static void
+handle_info(void *user_data, int pci_id, const char *app_name)
+{
+   struct aub_file *file = (struct aub_file *) user_data;
+   store_exec_end(file);
+
+   file->pci_id = pci_id;
+   snprintf(file->app_name, sizeof(app_name), "%s", app_name);
+
+   if (!gen_get_device_info(file->pci_id, &file->devinfo)) {
+  fprintf(stderr, "can't find device information: pci_id=0x%x\n", 
file->pci_id);
+  exit(EXIT_FAILU

[Mesa-dev] [PATCH v2 10/11] intel: aubinator_viewer: store urb state during decoding

2018-08-07 Thread Lionel Landwerlin
Signed-off-by: Lionel Landwerlin 
---
 src/intel/tools/aubinator_viewer.h   |  26 
 src/intel/tools/aubinator_viewer_decoder.cpp | 150 ---
 2 files changed, 153 insertions(+), 23 deletions(-)

diff --git a/src/intel/tools/aubinator_viewer.h 
b/src/intel/tools/aubinator_viewer.h
index 2d89d9cf658..4a030efc0d0 100644
--- a/src/intel/tools/aubinator_viewer.h
+++ b/src/intel/tools/aubinator_viewer.h
@@ -33,12 +33,35 @@ struct aub_viewer_decode_cfg {
 show_dwords(true) {}
 };
 
+enum aub_decode_stage {
+   AUB_DECODE_STAGE_VS,
+   AUB_DECODE_STAGE_HS,
+   AUB_DECODE_STAGE_DS,
+   AUB_DECODE_STAGE_GS,
+   AUB_DECODE_STAGE_PS,
+   AUB_DECODE_STAGE_CS,
+   AUB_DECODE_N_STAGE,
+};
+
+struct aub_decode_urb_stage_state {
+   uint32_t start;
+   uint32_t size;
+   uint32_t n_entries;
+
+   uint32_t const_rd_length;
+   uint32_t rd_offset;
+   uint32_t rd_length;
+   uint32_t wr_offset;
+   uint32_t wr_length;
+};
+
 struct aub_viewer_decode_ctx {
struct gen_batch_decode_bo (*get_bo)(void *user_data, uint64_t address);
unsigned (*get_state_size)(void *user_data,
   uint32_t offset_from_dynamic_state_base_addr);
 
void (*display_shader)(void *user_data, const char *shader_desc, uint64_t 
address);
+   void (*display_urb)(void *user_data, const struct 
aub_decode_urb_stage_state *stages);
void (*edit_address)(void *user_data, uint64_t address, uint32_t length);
 
void *user_data;
@@ -53,6 +76,9 @@ struct aub_viewer_decode_ctx {
uint64_t dynamic_base;
uint64_t instruction_base;
 
+   enum aub_decode_stage stage;
+   uint32_t end_urb_offset;
+   struct aub_decode_urb_stage_state urb_stages[AUB_DECODE_N_STAGE];
 };
 
 void aub_viewer_decode_ctx_init(struct aub_viewer_decode_ctx *ctx,
diff --git a/src/intel/tools/aubinator_viewer_decoder.cpp 
b/src/intel/tools/aubinator_viewer_decoder.cpp
index a2ea3ba4a64..273bc2da376 100644
--- a/src/intel/tools/aubinator_viewer_decoder.cpp
+++ b/src/intel/tools/aubinator_viewer_decoder.cpp
@@ -695,38 +695,125 @@ decode_load_register_imm(struct aub_viewer_decode_ctx 
*ctx,
}
 }
 
+static void
+decode_3dprimitive(struct aub_viewer_decode_ctx *ctx,
+   struct gen_group *inst,
+   const uint32_t *p)
+{
+   if (ctx->display_urb) {
+  if (ImGui::Button("Show URB"))
+ ctx->display_urb(ctx->user_data, ctx->urb_stages);
+   }
+}
+
+static void
+handle_urb(struct aub_viewer_decode_ctx *ctx,
+   struct gen_group *inst,
+   const uint32_t *p)
+{
+   struct gen_field_iterator iter;
+   gen_field_iterator_init(&iter, inst, p, 0, false);
+   while (gen_field_iterator_next(&iter)) {
+  if (strstr(iter.name, "URB Starting Address")) {
+ ctx->urb_stages[ctx->stage].start = iter.raw_value * 8192;
+  } else if (strstr(iter.name, "URB Entry Allocation Size")) {
+ ctx->urb_stages[ctx->stage].size = (iter.raw_value + 1) * 64;
+  } else if (strstr(iter.name, "Number of URB Entries")) {
+ ctx->urb_stages[ctx->stage].n_entries = iter.raw_value;
+  }
+   }
+
+   ctx->end_urb_offset = MAX2(ctx->urb_stages[ctx->stage].start +
+  ctx->urb_stages[ctx->stage].n_entries *
+  ctx->urb_stages[ctx->stage].size,
+  ctx->end_urb_offset);
+}
+
+static void
+handle_urb_read(struct aub_viewer_decode_ctx *ctx,
+struct gen_group *inst,
+const uint32_t *p)
+{
+   struct gen_field_iterator iter;
+   gen_field_iterator_init(&iter, inst, p, 0, false);
+   while (gen_field_iterator_next(&iter)) {
+  /* Workaround the "Force * URB Entry Read Length" fields */
+  if (iter.end_bit - iter.start_bit < 2)
+ continue;
+
+  if (strstr(iter.name, "URB Entry Read Offset")) {
+ ctx->urb_stages[ctx->stage].rd_offset = iter.raw_value * 32;
+  } else if (strstr(iter.name, "URB Entry Read Length")) {
+ ctx->urb_stages[ctx->stage].rd_length = iter.raw_value * 32;
+  } else if (strstr(iter.name, "URB Entry Output Read Offset")) {
+ ctx->urb_stages[ctx->stage].wr_offset = iter.raw_value * 32;
+  } else if (strstr(iter.name, "URB Entry Output Length")) {
+ ctx->urb_stages[ctx->stage].wr_length = iter.raw_value * 32;
+  }
+   }
+}
+
+static void
+handle_urb_constant(struct aub_viewer_decode_ctx *ctx,
+struct gen_group *inst,
+const uint32_t *p)
+{
+   struct gen_group *body =
+  gen_spec_find_struct(ctx->spec, "3DSTATE_CONSTANT_BODY");
+
+   struct gen_field_iterator outer;
+   gen_field_iterator_init(&outer, inst, p, 0, false);
+   while (gen_field_iterator_next(&outer)) {
+  if (outer.struct_desc != body)
+ continue;
+
+  struct gen_field_iterator iter;
+  gen_field_iterator_init(&iter, body, &outer.p[outer.start_bit / 32],
+  0, false);
+
+  ctx->urb_stages[ctx->stage].const_rd_length = 0;

Re: [Mesa-dev] [PATCH v3 05/48] gallium: fix ddebug on windows

2018-08-07 Thread Marek Olšák
Reviewed-by: Marek Olšák 

The commit message doesn't match the content of the patch.

Marek

On Mon, Aug 6, 2018 at 8:50 PM, Dylan Baker  wrote:
> By including the proper headers for getpid and for mkdir.
>
> Signed-off-by: Dylan Baker 
> Reviewed-by: Marek Olšák 
> ---
>  src/gallium/auxiliary/meson.build | 6 ++
>  1 file changed, 6 insertions(+)
>
> diff --git a/src/gallium/auxiliary/meson.build 
> b/src/gallium/auxiliary/meson.build
> index 98542d7ef3e..4facaae08d6 100644
> --- a/src/gallium/auxiliary/meson.build
> +++ b/src/gallium/auxiliary/meson.build
> @@ -106,6 +106,12 @@ files_libgallium = files(
>'driver_trace/tr_screen.h',
>'driver_trace/tr_texture.c',
>'driver_trace/tr_texture.h',
> +  'driver_ddebug/dd_context.c',
> +  'driver_ddebug/dd_draw.c',
> +  'driver_ddebug/dd_pipe.h',
> +  'driver_ddebug/dd_public.h',
> +  'driver_ddebug/dd_screen.c',
> +  'driver_ddebug/dd_util.h',
>'hud/font.c',
>'hud/font.h',
>'hud/hud_context.c',
> --
> 2.18.0
>
> ___
> mesa-dev mailing list
> mesa-dev@lists.freedesktop.org
> https://lists.freedesktop.org/mailman/listinfo/mesa-dev
___
mesa-dev mailing list
mesa-dev@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/mesa-dev


Re: [Mesa-dev] [PATCH v3 05/48] gallium: fix ddebug on windows

2018-08-07 Thread Eric Anholt
Dylan Baker  writes:

> By including the proper headers for getpid and for mkdir.

This comment doesn't seem to match what the patch is doing, and I see
these files as already being in the meson.build.  Rebase fail?

Patches 1-4 have my r-b.


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


Re: [Mesa-dev] [PATCH] glsl_to_tgsi: plumb image writable through to driver

2018-08-07 Thread Marek Olšák
Reviewed-by: Marek Olšák 

Marek

On Mon, Aug 6, 2018 at 2:48 PM, Erik Faye-Lund
 wrote:
> The virgl driver cares about the writable-flag on image definitions,
> because it re-emits GLSL from the TGSI. However, so far it was hardcoded
> to true in glsl_to_tgsi, which cause problems when virglrenderer is
> running on top of GLES 3.1, where not all formats are supported for
> writable images.
>
> Signed-off-by: Erik Faye-Lund 
> ---
>
> This patch is needed for this patch-series in virglrenderer to work
> properly:
>
> https://patchwork.freedesktop.org/series/47775/
>
>  src/mesa/state_tracker/st_glsl_to_tgsi.cpp| 19 ++-
>  .../state_tracker/st_glsl_to_tgsi_private.h   |  1 +
>  2 files changed, 15 insertions(+), 5 deletions(-)
>
> diff --git a/src/mesa/state_tracker/st_glsl_to_tgsi.cpp 
> b/src/mesa/state_tracker/st_glsl_to_tgsi.cpp
> index aec5330917..55984ff0c7 100644
> --- a/src/mesa/state_tracker/st_glsl_to_tgsi.cpp
> +++ b/src/mesa/state_tracker/st_glsl_to_tgsi.cpp
> @@ -194,6 +194,7 @@ public:
> int images_used;
> enum tgsi_texture_type image_targets[PIPE_MAX_SHADER_IMAGES];
> enum pipe_format image_formats[PIPE_MAX_SHADER_IMAGES];
> +   bool image_wr[PIPE_MAX_SHADER_IMAGES];
> bool indirect_addr_consts;
> int wpos_transform_const;
>
> @@ -3678,7 +3679,8 @@ glsl_to_tgsi_visitor::visit_shared_intrinsic(ir_call 
> *ir)
>  static void
>  get_image_qualifiers(ir_dereference *ir, const glsl_type **type,
>   bool *memory_coherent, bool *memory_volatile,
> - bool *memory_restrict, unsigned *image_format)
> + bool *memory_restrict, bool *memory_read_only,
> + unsigned *image_format)
>  {
>
> switch (ir->ir_type) {
> @@ -3694,6 +3696,8 @@ get_image_qualifiers(ir_dereference *ir, const 
> glsl_type **type,
>   struct_type->fields.structure[fild_idx].memory_volatile;
>*memory_restrict =
>   struct_type->fields.structure[fild_idx].memory_restrict;
> +  *memory_read_only =
> + struct_type->fields.structure[fild_idx].memory_read_only;
>*image_format =
>   struct_type->fields.structure[fild_idx].image_format;
>break;
> @@ -3703,7 +3707,7 @@ get_image_qualifiers(ir_dereference *ir, const 
> glsl_type **type,
>ir_dereference_array *deref_arr = ir->as_dereference_array();
>get_image_qualifiers((ir_dereference *)deref_arr->array, type,
> memory_coherent, memory_volatile, memory_restrict,
> -   image_format);
> +   memory_read_only, image_format);
>break;
> }
>
> @@ -3714,6 +3718,7 @@ get_image_qualifiers(ir_dereference *ir, const 
> glsl_type **type,
>*memory_coherent = var->data.memory_coherent;
>*memory_volatile = var->data.memory_volatile;
>*memory_restrict = var->data.memory_restrict;
> +  *memory_read_only = var->data.memory_read_only;
>*image_format = var->data.image_format;
>break;
> }
> @@ -3731,12 +3736,13 @@ glsl_to_tgsi_visitor::visit_image_intrinsic(ir_call 
> *ir)
> ir_dereference *img = (ir_dereference *)param;
> const ir_variable *imgvar = img->variable_referenced();
> unsigned sampler_array_size = 1, sampler_base = 0;
> -   bool memory_coherent = false, memory_volatile = false, memory_restrict = 
> false;
> +   bool memory_coherent = false, memory_volatile = false,
> +memory_restrict = false, memory_read_only = false;
> unsigned image_format = 0;
> const glsl_type *type = NULL;
>
> get_image_qualifiers(img, &type, &memory_coherent, &memory_volatile,
> -&memory_restrict, &image_format);
> +&memory_restrict, &memory_read_only, &image_format);
>
> st_src_reg reladdr;
> st_src_reg image(PROGRAM_IMAGE, 0, GLSL_TYPE_UINT);
> @@ -3875,6 +3881,7 @@ glsl_to_tgsi_visitor::visit_image_intrinsic(ir_call *ir)
> inst->tex_target = type->sampler_index();
> inst->image_format = st_mesa_format_to_pipe_format(st_context(ctx),
>   _mesa_get_shader_image_format(image_format));
> +   inst->read_only = memory_read_only;
>
> if (memory_coherent)
>inst->buffer_access |= TGSI_MEMORY_COHERENT;
> @@ -4675,6 +4682,7 @@ count_resources(glsl_to_tgsi_visitor *v, gl_program 
> *prog)
> v->image_targets[idx] =
>st_translate_texture_target(inst->tex_target, false);
> v->image_formats[idx] = inst->image_format;
> +   v->image_wr[idx] = !inst->read_only;
>  }
>   }
>}
> @@ -6770,7 +6778,8 @@ st_translate_program(
>   t->images[i] = ureg_DECL_image(ureg, i,
>  program->image_targets[i],
>  program->image_formats[i],
> -true, false);
> +progra

Re: [Mesa-dev] [PATCH v3 12/48] meson: don't allow glvnd on windows

2018-08-07 Thread Eric Anholt
Dylan Baker  writes:

> ---

6-12 have my r-b.


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


Re: [Mesa-dev] [PATCH] main/tests: Add AMD_framebuffer_multisample_advanced

2018-08-07 Thread Marek Olšák
On Mon, Aug 6, 2018 at 6:57 PM, Ian Romanick  wrote:
> On 08/06/2018 10:02 AM, Dylan Baker wrote:
>> Add dispatch_sanity tests
>>
>> Fixes: 3d6900d76efaef1ff6e84b7b8785bbe3d8f5b29b
>>("glapi: define AMD_framebuffer_multisample_advanced and add its 
>> functions")
>> Cc: Marek Olšák 
>> Cc: Brian Paul 
>> Signed-off-by: Dylan Baker 
>> ---
>>
>> Marek, the XML in mesa and the Khronos XML agree that this works for GLES 
>> 2.0,
>> but the spec says 3.0. I assume the spec is wrong and should be corrected?
>
> Something more than "just" 2.0 is needed because GLES 2.0 doesn't have
> framebuffer objects.  I suspect that's the reason for the 3.0
> requirement.  It sounds more like the Khronos XML is wrong.  I already
> changed Mesa's XML.

The Khronos XML doesn't seem to have the option to set gles3, at least
no extension sets that.

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


Re: [Mesa-dev] [PATCH v3 14/48] meson: Make shader-cache a trillean instead of boolean

2018-08-07 Thread Eric Anholt
Dylan Baker  writes:

> So that it can be implicitly disabled on windows, where it doesn't
> compile.

I don't see how this option successfully controls the shader cache being
built.  Also the "elif with_dri_i965 and get_option('shader-cache')"
looks like it needs to get updated for the trillian, too.


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


Re: [Mesa-dev] [PATCH v3 16/48] meson: Add necessary defines for mesa_gallium on windows

2018-08-07 Thread Eric Anholt
Dylan Baker  writes:

> ---
>  src/mesa/meson.build | 12 ++--
>  1 file changed, 10 insertions(+), 2 deletions(-)
>
> diff --git a/src/mesa/meson.build b/src/mesa/meson.build
> index 29633691ee7..fa086466443 100644
> --- a/src/mesa/meson.build
> +++ b/src/mesa/meson.build
> @@ -728,11 +728,19 @@ libmesa_classic = static_library(
>build_by_default : false,
>  )
>  
> +_mesa_gallium_args = []
> +if with_platform_windows
> +  _mesa_gallium_args += ['-D_GDI32_', '-DBUILD_GL32']
> +  if not with_gles2
> +_mesa_gallium_args += '-D_GLAPI_NO_EXPORTS'
> +  endif
> +endif

It would be nice to retain scons's comment as to what these defines are
doing.  Other than that, 15-16 have my r-b.


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


[Mesa-dev] [PATCH] egl/wayland: Set width/height of EGLSurface at creation

2018-08-07 Thread Chad Versace
Fixes dEQP-EGL.functional.color_clears.single_context.gles2.rgb565_window.

After initializing _EGLSurface::Width and ::Height to 0, Mesa did not
update the width and height again until the DRI driver fetched its
buffers. This produced weird behavior:

  * Immediately after surface creation, eglQuerySurface(EGL_WIDTH)
would return 0.

  * At some non-deterministic time between surface creation and before
the first eglSwapBuffers, likely triggered by a GL call that coerced
the driver to call DRI*::getBuffers, eglQuerySurface(EGL_WIDTH)
would return the actual width.

The dEQP test assertion-failed because eglQuerySurface(EGL_WIDTH)
returned 0 even though the native window had non-zero extent.

Cc: mesa-sta...@lists.freedesktop.org
---
 src/egl/drivers/dri2/platform_wayland.c | 26 +++--
 1 file changed, 16 insertions(+), 10 deletions(-)

diff --git a/src/egl/drivers/dri2/platform_wayland.c 
b/src/egl/drivers/dri2/platform_wayland.c
index dca099500a8..eda17cda903 100644
--- a/src/egl/drivers/dri2/platform_wayland.c
+++ b/src/egl/drivers/dri2/platform_wayland.c
@@ -224,6 +224,15 @@ get_wl_surface_proxy(struct wl_egl_window *window)
return wl_proxy_create_wrapper(window->surface);
 }
 
+static void
+update_size(struct dri2_egl_surface *dri2_surf)
+{
+  dri2_surf->base.Width  = dri2_surf->wl_win->width;
+  dri2_surf->base.Height = dri2_surf->wl_win->height;
+  dri2_surf->dx = dri2_surf->wl_win->dx;
+  dri2_surf->dy = dri2_surf->wl_win->dy;
+}
+
 /**
  * Called via eglCreateWindowSurface(), drv->API.CreateWindowSurface().
  */
@@ -306,6 +315,11 @@ dri2_wl_create_window_surface(_EGLDriver *drv, _EGLDisplay 
*disp,
if (dri2_dpy->flush)
   dri2_surf->wl_win->resize_callback = resize_callback;
 
+   /* Set width so eglQuerySurface(EGL_WIDTH) will return non-zero. Same for
+* height.
+*/
+   update_size(dri2_surf);
+
if (dri2_dpy->image_driver)
   createNewDrawable = dri2_dpy->image_driver->createNewDrawable;
else if (dri2_dpy->dri2)
@@ -581,11 +595,7 @@ update_buffers(struct dri2_egl_surface *dri2_surf)
dri2_surf->base.Height != dri2_surf->wl_win->height) {
 
   dri2_wl_release_buffers(dri2_surf);
-
-  dri2_surf->base.Width  = dri2_surf->wl_win->width;
-  dri2_surf->base.Height = dri2_surf->wl_win->height;
-  dri2_surf->dx = dri2_surf->wl_win->dx;
-  dri2_surf->dy = dri2_surf->wl_win->dy;
+  update_size(dri2_surf);
}
 
if (get_back_bo(dri2_surf) < 0) {
@@ -1636,11 +1646,7 @@ swrast_update_buffers(struct dri2_egl_surface *dri2_surf)
dri2_surf->base.Height != dri2_surf->wl_win->height) {
 
   dri2_wl_release_buffers(dri2_surf);
-
-  dri2_surf->base.Width  = dri2_surf->wl_win->width;
-  dri2_surf->base.Height = dri2_surf->wl_win->height;
-  dri2_surf->dx = dri2_surf->wl_win->dx;
-  dri2_surf->dy = dri2_surf->wl_win->dy;
+  update_size(dri2_surf);
   dri2_surf->current = NULL;
}
 
-- 
2.18.0.597.ga71716f1ad-goog

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


Re: [Mesa-dev] [PATCH v4 1/2] wayland/egl: initialize window surface size to window size

2018-08-07 Thread Chad Versace
On Tue 07 Aug 2018, Juan A. Suarez Romero wrote:
> When creating a windows surface with eglCreateWindowSurface(), the
> width and height returned by eglQuerySurface(EGL_{WIDTH,HEIGHT}) is
> invalid until buffers are updated (like calling glClear()).
> 
> But according to EGL 1.5 spec, section 3.5.6 ("Surface Attributes"):
> 
>   "Querying EGL_WIDTH and EGL_HEIGHT returns respectively the width and
>height, in pixels, of the surface. For a window or pixmap surface,
>these values are initially equal to the width and height of the
>native window or pixmap with respect to which the surface was
>created"
> 
> This fixes dEQP-EGL.functional.color_clears.* CTS tests
> 
> v2:
> - Do not modify attached_{width,height} (Daniel)
> - Do not update size on resizing window (Brendan)
> 
> CC: Daniel Stone 
> CC: Brendan King 
> CC: mesa-sta...@lists.freedesktop.org
> Tested-by: Eric Engestrom 
> ---
>  src/egl/drivers/dri2/platform_wayland.c | 3 +++
>  1 file changed, 3 insertions(+)

Hah. I just sent an equivalent patch to the list. I'll drop my patch.

Just for patch 1,
Reviewed-by: Chad Versace 
Tested-by: Chad Versace 

I don't fully understand attached_width,height. So no rb on patch 2.
___
mesa-dev mailing list
mesa-dev@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/mesa-dev


Re: [Mesa-dev] [PATCH v3 18/48] meson: build wgl state tracker

2018-08-07 Thread Eric Anholt
Dylan Baker  writes:

> ---
>  src/gallium/meson.build|  3 ++
>  src/gallium/state_trackers/wgl/meson.build | 50 ++
>  2 files changed, 53 insertions(+)
>  create mode 100644 src/gallium/state_trackers/wgl/meson.build
>
> diff --git a/src/gallium/meson.build b/src/gallium/meson.build
> index 7754dbdee3c..a4f28dc4757 100644
> --- a/src/gallium/meson.build
> +++ b/src/gallium/meson.build
> @@ -191,6 +191,9 @@ if with_gallium_st_nine
>subdir('state_trackers/nine')
>subdir('targets/d3dadapter9')
>  endif
> +if with_platform_windows
> +  subdir('state_trackers/wgl')
> +endif
>  if with_tests
>subdir('targets/graw-null')
>if with_glx == 'gallium-xlib'
> diff --git a/src/gallium/state_trackers/wgl/meson.build 
> b/src/gallium/state_trackers/wgl/meson.build
> new file mode 100644
> index 000..d78d2b02e83
> --- /dev/null
> +++ b/src/gallium/state_trackers/wgl/meson.build
> @@ -0,0 +1,50 @@
> +# Copyright © 2018 Intel Corporation
> +
> +# Permission is hereby granted, free of charge, to any person obtaining a 
> copy
> +# of this software and associated documentation files (the "Software"), to 
> deal
> +# in the Software without restriction, including without limitation the 
> rights
> +# to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
> +# copies of the Software, and to permit persons to whom the Software is
> +# furnished to do so, subject to the following conditions:
> +
> +# The above copyright notice and this permission notice 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.
> +
> +inc_wgl = include_directories('.')
> +
> +libwgl = static_library(
> +  'wgl',
> +  files(
> +'stw_context.c',
> +'stw_device.c',
> +'stw_ext_context.c',
> +'stw_ext_extensionsstring.c',
> +'stw_ext_pbuffer.c',
> +'stw_ext_pixelformat.c',
> +'stw_ext_rendertexture.c',
> +'stw_ext_swapinterval.c',
> +'stw_framebuffer.c',
> +'stw_getprocaddress.c',
> +'stw_nopfuncs.c',
> +'stw_nopfuncs.h',
> +'stw_pixelformat.c',
> +'stw_st.c',
> +'stw_tls.c',
> +'stw_wgl.c',
> +  ),
> +  c_args : [
> +'-D_GDI32_', '-DBUILD_GL32', '-DWIN32_LEAN_AND_MEAN',
> +'-D_GLAPI_NO_EXPORTS', # XXX: only without gles
> +  ],

In the patch 16 you handled the "without gles" thing, why not here?
Other than that, 17-18 have my r-b.


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


Re: [Mesa-dev] [PATCH v3 19/48] meson: build libgl-gdi target

2018-08-07 Thread Eric Anholt
Dylan Baker  writes:

> ---
>  src/gallium/meson.build   |  1 +
>  src/gallium/targets/libgl-gdi/meson.build | 44 +++
>  2 files changed, 45 insertions(+)
>  create mode 100644 src/gallium/targets/libgl-gdi/meson.build
>
> diff --git a/src/gallium/meson.build b/src/gallium/meson.build
> index a4f28dc4757..5019477788b 100644
> --- a/src/gallium/meson.build
> +++ b/src/gallium/meson.build
> @@ -193,6 +193,7 @@ if with_gallium_st_nine
>  endif
>  if with_platform_windows
>subdir('state_trackers/wgl')
> +  subdir('targets/libgl-gdi')
>  endif
>  if with_tests
>subdir('targets/graw-null')
> diff --git a/src/gallium/targets/libgl-gdi/meson.build 
> b/src/gallium/targets/libgl-gdi/meson.build
> new file mode 100644
> index 000..63cc40b97bc
> --- /dev/null
> +++ b/src/gallium/targets/libgl-gdi/meson.build
> @@ -0,0 +1,44 @@
> +# Copyright © 2018 Intel Corporation
> +
> +# Permission is hereby granted, free of charge, to any person obtaining a 
> copy
> +# of this software and associated documentation files (the "Software"), to 
> deal
> +# in the Software without restriction, including without limitation the 
> rights
> +# to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
> +# copies of the Software, and to permit persons to whom the Software is
> +# furnished to do so, subject to the following conditions:
> +
> +# The above copyright notice and this permission notice 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.
> +
> +if cc.get_id() == 'gcc' and host_machine.cpu_family() == 'x86_64'
> +  ogldef = files('../../state_trackers/wgl/opengl32.mingw.def')[0]
> +else
> +  ogldef = files('../../state_trackers/wgl/opengl32.def')[0]
> +endif

I think you flipped the polarity of the x86_64 check.  Also, please copy
over the comment explaining what this is about.

> +libopengl32 = shared_library(
> +  'opengl32',
> +  ['libgl_gdi.c'],
> +  vs_module_defs : ogldef,
> +  include_directories : [
> +inc_common, inc_wgl, inc_gallium_winsys_sw, inc_gallium_drivers,
> +  ],
> +  link_whole : [libwgl],
> +  link_with : [
> +libmesa_util, libgallium, libglsl, libmesa_gallium, libwsgdi,
> +libglapi_static, libglapi
> +  ],
> +  dependencies : [
> +dep_ws2_32, idep_nir, driver_swrast, driver_swr,
> +  ],
> +  name_prefix : '',  # otherwise mingw will create libopengl32.dll
> +  install : true,

Looks like you're missing the HAVE_SWR, HAVE_LLVMPIPE definitions.


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


Re: [Mesa-dev] [PATCH v3 20/48] meson: build graw-gdi target

2018-08-07 Thread Eric Anholt
Dylan Baker  writes:

> ---
>  src/gallium/meson.build  |  4 ++-
>  src/gallium/targets/graw-gdi/meson.build | 36 
>  2 files changed, 39 insertions(+), 1 deletion(-)
>  create mode 100644 src/gallium/targets/graw-gdi/meson.build
>
> diff --git a/src/gallium/meson.build b/src/gallium/meson.build
> index 5019477788b..e4e0b88e7fc 100644
> --- a/src/gallium/meson.build
> +++ b/src/gallium/meson.build
> @@ -197,7 +197,9 @@ if with_platform_windows
>  endif
>  if with_tests
>subdir('targets/graw-null')
> -  if with_glx == 'gallium-xlib'
> +  if with_platform_windows
> +subdir('targets/graw-gdi')
> +  elif with_glx == 'gallium-xlib'
>  subdir('targets/graw-xlib')
>endif
>subdir('tests')
> diff --git a/src/gallium/targets/graw-gdi/meson.build 
> b/src/gallium/targets/graw-gdi/meson.build
> new file mode 100644
> index 000..e04b454ab53
> --- /dev/null
> +++ b/src/gallium/targets/graw-gdi/meson.build
> @@ -0,0 +1,36 @@
> +# Copyright © 2018 Intel Corporation
> +
> +# Permission is hereby granted, free of charge, to any person obtaining a 
> copy
> +# of this software and associated documentation files (the "Software"), to 
> deal
> +# in the Software without restriction, including without limitation the 
> rights
> +# to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
> +# copies of the Software, and to permit persons to whom the Software is
> +# furnished to do so, subject to the following conditions:
> +
> +# The above copyright notice and this permission notice 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.
> +
> +libgraw_gdi = shared_library(
> +  'graw',
> +  'graw_gdi.c',
> +  include_directories : [
> +inc_include, inc_src, inc_gallium, inc_gallium_aux, inc_gallium_drivers,
> +inc_gallium_winsys_sw,
> +  ],
> +  link_with : [
> +libgraw_util, libmesa_util, libgallium, libwsgdi,
> +  ],
> +  dependencies : [
> +dep_ws2_32, driver_swrast,
> +  ],
> +)

Looks like this is missing GALLIUM_SOFTPIPE/GALLIUM_LLVMPIPE
definitions.


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


Re: [Mesa-dev] [PATCH v3 13/48] meson: add windows compiler checks and libraries

2018-08-07 Thread Eric Anholt
Dylan Baker  writes:

> ---
>  meson.build | 129 
>  1 file changed, 79 insertions(+), 50 deletions(-)
>
> diff --git a/meson.build b/meson.build
> index 25de31bfabd..4350e1af810 100644
> --- a/meson.build
> +++ b/meson.build
> @@ -775,69 +775,96 @@ endif
>  # TODO: this is very incomplete
>  if ['linux', 'cygwin'].contains(host_machine.system())
>pre_args += '-D_GNU_SOURCE'
> +elif host_machine.system() == 'windows'
> +  pre_args += [
> +'-D_WINDOWS', '-D_WIN32_WINNT=0x0601', '-D_WINVER=0x0601',
> +'-DPIPE_SUBSYSTEM_WINDOWS_USER',
> +'-D_USE_MATH_DEFINES',  # XXX: scons doesn't use this for mingw
> +  ]
> +  if cc.get_id() == 'msvc'
> +pre_args += [
> +  '-DVC_EXTRALEAN',
> +  '-D_CRT_SECURE_NO_WARNINGS',
> +  '-D_CRT_SECURE_NO_DEPRECATE',
> +  '-D_SCL_SECURE_NO_WARNINGS',
> +  '-D_SCL_SECURE_NO_DEPRECATE',
> +  '-D_ALLOW_KEYWORD_MACROS',
> +  '-D_HAS_EXCEPTIONS=0', # Tell C++ STL to not use exceptions
> +]
> +  else
> +pre_args += ['-D__MSVCRT_VERSION__=0x0700']
> +  endif
>  endif
>  
>  # Check for generic C arguments
>  c_args = []
> -foreach a : ['-Wall', '-Werror=implicit-function-declaration',
> - '-Werror=missing-prototypes', '-fno-math-errno',
> - '-fno-trapping-math', '-Qunused-arguments']
> -  if cc.has_argument(a)
> -c_args += a
> -  endif
> -endforeach
> -if cc.has_argument('-Wmissing-field-initializers')
> -  c_args += '-Wno-missing-field-initializers'
> -endif
> -
>  c_vis_args = []
> -if cc.has_argument('-fvisibility=hidden')
> -  c_vis_args += '-fvisibility=hidden'
> -endif
> -
> -# Check for generic C++ arguments
> +c_msvc_compat_args = []
> +no_override_init_args = []
>  cpp_args = []
> -foreach a : ['-Wall', '-fno-math-errno', '-fno-trapping-math',
> - '-Qunused-arguments']
> -  if cpp.has_argument(a)
> -cpp_args += a
> +cpp_vis_args = []
> +cpp_msvc_compat_args = []
> +if cc.get_id() == 'msvc'
> +  foreach a : ['/wd4018', '/wd4056', '/wd4244', '/wd4246', '/wd4305',
> +   '/wd4351', '/wd4756', '/wd4800', '/wd4996']

The 4246 entry doesn't match scons (4267).  Could we have a list with
comments of what these do, like scons has?

I haven't reviewed the rest of the patch.  It's hard to read without -b.


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


Re: [Mesa-dev] [PATCH 3/7] dri: Define DRI_MutableRenderBuffer extensions

2018-08-07 Thread Chad Versace
On Mon 06 Aug 2018, Chad Versace wrote:
> On Fri 03 Aug 2018, Tapani Pälli wrote:
> > One tiny nit below but for patches 3,4 and 5:
> > 
> > Reviewed-by: Tapani Pälli 
> > 
> > Special thanks for the documentation. I want to go through rest of changes
> > within Android but I'm currently experiencing some horrible issues with the
> > image building. I'm hoping to resolve those soon and get back to business.

Any luck with the Android patches?

btw, I plan to start working on and/or reviewing
VK_ANDROID_external_memory_android_hardware_buffer this week.
I'll coordinate with you when I start.
___
mesa-dev mailing list
mesa-dev@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/mesa-dev


Re: [Mesa-dev] [PATCH v2 09/11] intel: tools: add aubinator viewer

2018-08-07 Thread Lionel Landwerlin

On 07/08/18 18:35, Lionel Landwerlin wrote:

A graphical user interface version of aubinator.
Allows you to :

- simultaneously look at multiple points in the aub file (using all
  the goodness of the existing decoding in aubinator)

- edit an aub file

Signed-off-by: Lionel Landwerlin
---


Oops forgot to add Rafael's Ack on this one...

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


[Mesa-dev] [PATCH v2] i965: do not emit empty surface state

2018-08-07 Thread Erik Faye-Lund
If called with an empty size, brw_emit_buffer_surface_state asserts.
We already have a dedicated helper for uploading nothing, so let's use
that instead.

Signed-off-by: Erik Faye-Lund 
---

Here's an updated patch.

v2: call emit_null_surface_state to ensure out_offset is initialized
properly. (Lionel)

 src/mesa/drivers/dri/i965/brw_wm_surface_state.c | 5 +
 1 file changed, 5 insertions(+)

diff --git a/src/mesa/drivers/dri/i965/brw_wm_surface_state.c 
b/src/mesa/drivers/dri/i965/brw_wm_surface_state.c
index 9397b637c7..2aef0ef59f 100644
--- a/src/mesa/drivers/dri/i965/brw_wm_surface_state.c
+++ b/src/mesa/drivers/dri/i965/brw_wm_surface_state.c
@@ -1322,6 +1322,11 @@ upload_buffer_surface(struct brw_context *brw,
   if (!binding->AutomaticSize)
  size = MIN2(size, binding->Size);
 
+  if (size == 0) {
+ emit_null_surface_state(brw, NULL, out_offset);
+ return;
+  }
+
   struct intel_buffer_object *iobj =
  intel_buffer_object(binding->BufferObject);
   struct brw_bo *bo =
-- 
2.18.0

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


[Mesa-dev] [PATCH] egl: Fix leak of X11 pixmaps backing pbuffers in DRI3.

2018-08-07 Thread Eric Anholt
This is basically copied from the DRI2 destroy path.  Without this,
Raspberry Pi would quickly run out of CMA during the EGL tests in the CTS
due to all the pixmaps laying around.

Fixes: f35198badeb9 ("egl/x11: Implement dri3 support with loader's dri3 
helper")
---
 src/egl/drivers/dri2/platform_x11_dri3.c | 5 +
 1 file changed, 5 insertions(+)

diff --git a/src/egl/drivers/dri2/platform_x11_dri3.c 
b/src/egl/drivers/dri2/platform_x11_dri3.c
index c3c9c2dd45d6..e1967422f0a8 100644
--- a/src/egl/drivers/dri2/platform_x11_dri3.c
+++ b/src/egl/drivers/dri2/platform_x11_dri3.c
@@ -107,12 +107,17 @@ static const struct loader_dri3_vtable egl_dri3_vtable = {
 static EGLBoolean
 dri3_destroy_surface(_EGLDriver *drv, _EGLDisplay *disp, _EGLSurface *surf)
 {
+   struct dri2_egl_display *dri2_dpy = dri2_egl_display(disp);
struct dri3_egl_surface *dri3_surf = dri3_egl_surface(surf);
+   xcb_drawable_t drawable = dri3_surf->loader_drawable.drawable;
 
(void) drv;
 
loader_dri3_drawable_fini(&dri3_surf->loader_drawable);
 
+   if (surf->Type == EGL_PBUFFER_BIT)
+  xcb_free_pixmap (dri2_dpy->conn, drawable);
+
dri2_fini_surface(surf);
free(surf);
 
-- 
2.18.0

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


[Mesa-dev] [Bug 107457] [Tracker] Mesa 18.2 release tracker

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

Mark Janes  changed:

   What|Removed |Added

 Depends on||107510


Referenced Bugs:

https://bugs.freedesktop.org/show_bug.cgi?id=107510
[Bug 107510] [GEN8+] up to 10% perf drop on several 3D benchmarks
-- 
You are receiving this mail because:
You are the QA Contact for the bug.
You are the assignee for the bug.___
mesa-dev mailing list
mesa-dev@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/mesa-dev


Re: [Mesa-dev] [PATCH 1/3] meson: use dependency()+find_program() for wayland-scanner

2018-08-07 Thread Dylan Baker
Quoting Emil Velikov (2018-08-07 08:41:36)
> On 6 August 2018 at 17:39, Dylan Baker  wrote:
> > Quoting Emil Velikov (2018-06-28 07:35:44)
> >> From: Emil Velikov 
> >>
> >> Helps when the native wayland-scanner is located outside of PATH.
> >> Inspired by the xserver code ;-)
> >>
> >> Cc: Dylan Baker 
> >> Cc: Eric Engestrom 
> >> Signed-off-by: Emil Velikov 
> >> ---
> >>  meson.build | 3 ++-
> >>  1 file changed, 2 insertions(+), 1 deletion(-)
> >>
> >> diff --git a/meson.build b/meson.build
> >> index b2722c71e5b..79bac89e7d9 100644
> >> --- a/meson.build
> >> +++ b/meson.build
> >> @@ -1269,7 +1269,8 @@ endif
> >>  # TODO: symbol mangling
> >>
> >>  if with_platform_wayland
> >> -  prog_wl_scanner = find_program('wayland-scanner')
> >> +  dep_wl_scanner = dependency('wayland-scanner', native: true)
> >> +  prog_wl_scanner = 
> >> find_program(dep_wl_scanner.get_pkgconfig_variable('wayland_scanner'))
> >>dep_wl_protocols = dependency('wayland-protocols', version : '>= 1.8')
> >>dep_wayland_client = dependency('wayland-client', version : '>=1.11')
> >>dep_wayland_server = dependency('wayland-server', version : '>=1.11')
> >> --
> >> 2.18.0
> >>
> >
> > Hey Emil, it doesn't look like this ever landed, is there a reason for that 
> > I'm
> > not seeing in the mailing list discussion?
> >
> Nothing special - simply forgot.
> Will double-check it doesn't break anything and will push in a moment.
> 
> -Emil

Thanks!


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 v3 10/26] python: Use explicit integer divisions

2018-08-07 Thread Dylan Baker
Reviewed-by: Dylan Baker 

Quoting Mathieu Bridon (2018-07-25 02:53:54)
> In Python 2, divisions of integers return an integer:
> 
> >>> 32 / 4
> 8
> 
> In Python 3 though, they return floats:
> 
> >>> 32 / 4
> 8.0
> 
> However, Python 3 has an explicit integer division operator:
> 
> >>> 32 // 4
> 8
> 
> That operator exists on Python >= 2.2, so let's use it everywhere to
> make the scripts compatible with both Python 2 and 3.
> 
> In addition, using __future__.division tells Python 2 to behave the same
> way as Python 3, which helps ensure the scripts produce the same output
> in both versions of Python.
> 
> Signed-off-by: Mathieu Bridon 
> Reviewed-by: Eric Engestrom  (v2)
> ---
>  src/gallium/auxiliary/util/u_format_pack.py  | 4 ++--
>  src/gallium/auxiliary/util/u_format_parse.py | 7 +--
>  src/mapi/glapi/gen/glX_proto_send.py | 4 ++--
>  src/mesa/main/format_info.py | 4 ++--
>  src/mesa/main/format_pack.py | 8 
>  src/mesa/main/format_unpack.py   | 8 
>  6 files changed, 19 insertions(+), 16 deletions(-)
> 
> diff --git a/src/gallium/auxiliary/util/u_format_pack.py 
> b/src/gallium/auxiliary/util/u_format_pack.py
> index 7a952a48b3..ad2e49281f 100644
> --- a/src/gallium/auxiliary/util/u_format_pack.py
> +++ b/src/gallium/auxiliary/util/u_format_pack.py
> @@ -36,7 +36,7 @@
>  '''
>  
>  
> -from __future__ import print_function
> +from __future__ import division, print_function
>  
>  from u_format_parse import *
>  
> @@ -240,7 +240,7 @@ def value_to_native(type, value):
>  return truncate_mantissa(value, 23)
>  return value
>  if type.type == FIXED:
> -return int(value * (1 << (type.size/2)))
> +return int(value * (1 << (type.size // 2)))
>  if not type.norm:
>  return int(value)
>  if type.type == UNSIGNED:
> diff --git a/src/gallium/auxiliary/util/u_format_parse.py 
> b/src/gallium/auxiliary/util/u_format_parse.py
> index c0456f6d15..d3874cd895 100644
> --- a/src/gallium/auxiliary/util/u_format_parse.py
> +++ b/src/gallium/auxiliary/util/u_format_parse.py
> @@ -29,6 +29,9 @@
>  '''
>  
>  
> +from __future__ import division
> +
> +
>  VOID, UNSIGNED, SIGNED, FIXED, FLOAT = range(5)
>  
>  SWIZZLE_X, SWIZZLE_Y, SWIZZLE_Z, SWIZZLE_W, SWIZZLE_0, SWIZZLE_1, 
> SWIZZLE_NONE, = range(7)
> @@ -76,7 +79,7 @@ class Channel:
>  if self.type == FLOAT:
>  return VERY_LARGE
>  if self.type == FIXED:
> -return (1 << (self.size/2)) - 1
> +return (1 << (self.size // 2)) - 1
>  if self.norm:
>  return 1
>  if self.type == UNSIGNED:
> @@ -90,7 +93,7 @@ class Channel:
>  if self.type == FLOAT:
>  return -VERY_LARGE
>  if self.type == FIXED:
> -return -(1 << (self.size/2))
> +return -(1 << (self.size // 2))
>  if self.type == UNSIGNED:
>  return 0
>  if self.norm:
> diff --git a/src/mapi/glapi/gen/glX_proto_send.py 
> b/src/mapi/glapi/gen/glX_proto_send.py
> index a920ecc012..03067d8a3c 100644
> --- a/src/mapi/glapi/gen/glX_proto_send.py
> +++ b/src/mapi/glapi/gen/glX_proto_send.py
> @@ -26,7 +26,7 @@
>  #Ian Romanick 
>  #Jeremy Kolb 
>  
> -from __future__ import print_function
> +from __future__ import division, print_function
>  
>  import argparse
>  
> @@ -809,7 +809,7 @@ generic_%u_byte( GLint rop, const void * ptr )
>  # Dividing by the array size (1 for
>  # non-arrays) gives us this.
>  
> -s = p.size() / p.get_element_count()
> +s = p.size() // p.get_element_count()
>  print("   %s __glXReadReply(dpy, %s, %s, %s);" % 
> (return_str, s, p.name, aa))
>  got_reply = 1
>  
> diff --git a/src/mesa/main/format_info.py b/src/mesa/main/format_info.py
> index bbecaa2451..00e27b3fba 100644
> --- a/src/mesa/main/format_info.py
> +++ b/src/mesa/main/format_info.py
> @@ -21,7 +21,7 @@
>  # TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE
>  # SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
>  
> -from __future__ import print_function
> +from __future__ import division, print_function
>  
>  import format_parser as parser
>  import sys
> @@ -198,7 +198,7 @@ for fmat in formats:
>chan = fmat.array_element()
>norm = chan.norm or chan.type == parser.FLOAT
>print('  .ArrayFormat = MESA_ARRAY_FORMAT({0}),'.format(', '.join([
> - str(chan.size / 8),
> + str(chan.size // 8),
>   str(int(chan.sign)),
>   str(int(chan.type == parser.FLOAT)),
>   str(int(norm)),
> diff --git a/src/mesa/main/format_pack.py b/src/mesa/main/format_pack.py
> index d3c8d24acd..0b9e0d424d 100644
> --- a/src/mesa/main/format_pack.py
> +++ b/src/mesa/main/format_pack.py
> @@ -356,7 +356,7 @@ _mesa_pack_ubyte_rgba_row(mesa_forma

Re: [Mesa-dev] [PATCH] egl/wayland: Set width/height of EGLSurface at creation

2018-08-07 Thread Chad Versace
Ignore this in favor of jasuarez's patch.

On Tue 07 Aug 2018, Chad Versace wrote:
> Fixes dEQP-EGL.functional.color_clears.single_context.gles2.rgb565_window.
> 
> After initializing _EGLSurface::Width and ::Height to 0, Mesa did not
> update the width and height again until the DRI driver fetched its
> buffers. This produced weird behavior:
> 
>   * Immediately after surface creation, eglQuerySurface(EGL_WIDTH)
> would return 0.
> 
>   * At some non-deterministic time between surface creation and before
> the first eglSwapBuffers, likely triggered by a GL call that coerced
> the driver to call DRI*::getBuffers, eglQuerySurface(EGL_WIDTH)
> would return the actual width.
> 
> The dEQP test assertion-failed because eglQuerySurface(EGL_WIDTH)
> returned 0 even though the native window had non-zero extent.
> 
> Cc: mesa-sta...@lists.freedesktop.org
> ---
>  src/egl/drivers/dri2/platform_wayland.c | 26 +++--
>  1 file changed, 16 insertions(+), 10 deletions(-)
> 
> diff --git a/src/egl/drivers/dri2/platform_wayland.c 
> b/src/egl/drivers/dri2/platform_wayland.c
> index dca099500a8..eda17cda903 100644
> --- a/src/egl/drivers/dri2/platform_wayland.c
> +++ b/src/egl/drivers/dri2/platform_wayland.c
> @@ -224,6 +224,15 @@ get_wl_surface_proxy(struct wl_egl_window *window)
> return wl_proxy_create_wrapper(window->surface);
>  }
>  
> +static void
> +update_size(struct dri2_egl_surface *dri2_surf)
> +{
> +  dri2_surf->base.Width  = dri2_surf->wl_win->width;
> +  dri2_surf->base.Height = dri2_surf->wl_win->height;
> +  dri2_surf->dx = dri2_surf->wl_win->dx;
> +  dri2_surf->dy = dri2_surf->wl_win->dy;
> +}
> +
>  /**
>   * Called via eglCreateWindowSurface(), drv->API.CreateWindowSurface().
>   */
> @@ -306,6 +315,11 @@ dri2_wl_create_window_surface(_EGLDriver *drv, 
> _EGLDisplay *disp,
> if (dri2_dpy->flush)
>dri2_surf->wl_win->resize_callback = resize_callback;
>  
> +   /* Set width so eglQuerySurface(EGL_WIDTH) will return non-zero. Same for
> +* height.
> +*/
> +   update_size(dri2_surf);
> +
> if (dri2_dpy->image_driver)
>createNewDrawable = dri2_dpy->image_driver->createNewDrawable;
> else if (dri2_dpy->dri2)
> @@ -581,11 +595,7 @@ update_buffers(struct dri2_egl_surface *dri2_surf)
> dri2_surf->base.Height != dri2_surf->wl_win->height) {
>  
>dri2_wl_release_buffers(dri2_surf);
> -
> -  dri2_surf->base.Width  = dri2_surf->wl_win->width;
> -  dri2_surf->base.Height = dri2_surf->wl_win->height;
> -  dri2_surf->dx = dri2_surf->wl_win->dx;
> -  dri2_surf->dy = dri2_surf->wl_win->dy;
> +  update_size(dri2_surf);
> }
>  
> if (get_back_bo(dri2_surf) < 0) {
> @@ -1636,11 +1646,7 @@ swrast_update_buffers(struct dri2_egl_surface 
> *dri2_surf)
> dri2_surf->base.Height != dri2_surf->wl_win->height) {
>  
>dri2_wl_release_buffers(dri2_surf);
> -
> -  dri2_surf->base.Width  = dri2_surf->wl_win->width;
> -  dri2_surf->base.Height = dri2_surf->wl_win->height;
> -  dri2_surf->dx = dri2_surf->wl_win->dx;
> -  dri2_surf->dy = dri2_surf->wl_win->dy;
> +  update_size(dri2_surf);
>dri2_surf->current = NULL;
> }
>  
> -- 
> 2.18.0.597.ga71716f1ad-goog
> 
> ___
> mesa-dev mailing list
> mesa-dev@lists.freedesktop.org
> https://lists.freedesktop.org/mailman/listinfo/mesa-dev
___
mesa-dev mailing list
mesa-dev@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/mesa-dev


Re: [Mesa-dev] [PATCH v2 11/26] python: Fix rich comparisons

2018-08-07 Thread Dylan Baker
Reviewed-by: Dylan Baker 

Quoting Mathieu Bridon (2018-07-17 13:57:39)
> Python 3 doesn't call objects __cmp__() methods any more to compare
> them. Instead, it requires implementing the rich comparison methods
> explicitly: __eq__(), __ne(), __lt__(), __le__(), __gt__() and __ge__().
> 
> Fortunately Python 2 also supports those.
> 
> This commit only implements the comparison methods which are actually
> used by the build scripts.
> 
> Signed-off-by: Mathieu Bridon 
> ---
>  src/amd/vulkan/radv_extensions.py  |  5 +++--
>  src/intel/vulkan/anv_extensions.py |  5 +++--
>  src/mapi/mapi_abi.py   | 15 +++
>  3 files changed, 13 insertions(+), 12 deletions(-)
> 
> diff --git a/src/amd/vulkan/radv_extensions.py 
> b/src/amd/vulkan/radv_extensions.py
> index a0f1038110..55e14b811a 100644
> --- a/src/amd/vulkan/radv_extensions.py
> +++ b/src/amd/vulkan/radv_extensions.py
> @@ -143,14 +143,15 @@ class VkVersion:
>  patch = self.patch if self.patch is not None else 0
>  return (self.major << 22) | (self.minor << 12) | patch
>  
> -def __cmp__(self, other):
> +def __gt__(self, other):
>  # If only one of them has a patch version, "ignore" it by making
>  # other's patch version match self.
>  if (self.patch is None) != (other.patch is None):
>  other = copy.copy(other)
>  other.patch = self.patch
>  
> -return self.__int_ver().__cmp__(other.__int_ver())
> +return self.__int_ver() > other.__int_ver()
> +
>  
>  MAX_API_VERSION = VkVersion(MAX_API_VERSION)
>  
> diff --git a/src/intel/vulkan/anv_extensions.py 
> b/src/intel/vulkan/anv_extensions.py
> index 0f99f58ecb..56b1ebf96d 100644
> --- a/src/intel/vulkan/anv_extensions.py
> +++ b/src/intel/vulkan/anv_extensions.py
> @@ -155,14 +155,15 @@ class VkVersion:
>  patch = self.patch if self.patch is not None else 0
>  return (self.major << 22) | (self.minor << 12) | patch
>  
> -def __cmp__(self, other):
> +def __gt__(self, other):
>  # If only one of them has a patch version, "ignore" it by making
>  # other's patch version match self.
>  if (self.patch is None) != (other.patch is None):
>  other = copy.copy(other)
>  other.patch = self.patch
>  
> -return self.__int_ver().__cmp__(other.__int_ver())
> +return self.__int_ver() > other.__int_ver()
> +
>  
>  
>  MAX_API_VERSION = VkVersion('0.0.0')
> diff --git a/src/mapi/mapi_abi.py b/src/mapi/mapi_abi.py
> index be1d15d922..e4ce2b6caf 100644
> --- a/src/mapi/mapi_abi.py
> +++ b/src/mapi/mapi_abi.py
> @@ -121,19 +121,18 @@ class ABIEntry(object):
>  def __str__(self):
>  return self.c_prototype()
>  
> -def __cmp__(self, other):
> +def __lt__(self, other):
>  # compare slot, alias, and then name
> -res = cmp(self.slot, other.slot)
> -if not res:
> +if self.slot == other.slot:
>  if not self.alias:
> -res = -1
> +return True
>  elif not other.alias:
> -res = 1
> +return False
>  
> -if not res:
> -res = cmp(self.name, other.name)
> +return self.name < other.name
> +
> +return self.slot < other.slot
>  
> -return res
>  
>  def abi_parse_xml(xml):
>  """Parse a GLAPI XML file for ABI entries."""
> -- 
> 2.17.1
> 
> ___
> mesa-dev mailing list
> mesa-dev@lists.freedesktop.org
> https://lists.freedesktop.org/mailman/listinfo/mesa-dev


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


Re: [Mesa-dev] [PATCH v4 00/15] TGSI: improved live range tracking, also including arrays

2018-08-07 Thread Gert Wollny
Dear all, 

I'd like to get this series in the 18.3 release cycle applied. I've
been using it for quite some time without issues, and it seems to fix a
number of problems on r600. For instance, a number of dEQP-GLES31 tests
fail because of issued with spilling, but with these patches the need
for spilling can be eliminated in these cases. I also didn't see any
piglit regressions, and the patches still apply cleanly. 

Many thanks to anyone who reviews, or at least ack. this series, 
Gert

Am Dienstag, den 05.06.2018, 22:26 +0200 schrieb Gert Wollny:
> taking the comments of Nicolai Hähnle into account I've updated the
> series. I'd also 
> like to thank Benedikt Schemmer for going out on the adventure to
> these these patches
> on radeonsi for which this code path is actually not relevant. It
> made me realize, 
> that I was not tracking the inst->resources register. I think,
> however, that r600 and 
> llvmpipe are not really using that register, so I cannot test whether
> there are any 
> fixes or regressions coming with this (for me the piglit results
> didn't change).
> 
> v4: 
>  - make the TGSI statistics collection routine thread save, 
>  - rework the classes that are used to evaluate and apply the array
> merging (I 
>did not follow Nicolais suggestion to handle the array live range
> also within 
>the class that tracks temporary registers because I think the
> handling is 
>sufficiently different, and because the temporary register live
> range 
>evaluation code is already difficult enough, no need to add more
> complexity 
>to also handle arrays), 
>  - inst->resource to be also taken into account in the live range
> tracking and 
>array remapping
>  - add two patches that add test infrastructure and unit tests for
> array live 
>range tracking and remapping
> 
> v3: 
>  - Add new test mesa/st/tests/meson.build
>  - rebase patches to latest HEAD
> 
> this is the merged version of two series [1] (TGSI: split, merge 
> and interleave arrays) and [2] (mesa/st/glsl_to_tgsi: Properly 
> resolve life times for simple if/else + use constructs) I sent
> earlier. Considering that both parts target the same optimization 
> step and fix a bug if both are applied, I thought it is better to 
> add this second patch to the series. Changes refer to v1 of [1]: 
> 
> v2: 
>  - rebase patches to latest HEAD
>  - add some code that allows obtaining some statistics about register
>and instruction usage
>  - Add patch [2] that improves resolving the live range estimation
> with 
>simple if/else and use constructs. By adding this patch the
> series 
>fixes https://bugs.freedesktop.org/show_bug.cgi?id=105371
> 
>  v1: 
> Patch 1: Split arrays that are only accessed directly:  
> I posted a first version off the the array splitting in patch 1 some 
> time ago. Eric Anholt pointed out that this might be done in 
> opt_array_splitting.cpp, but in another comment Timothy pointed out 
> that this is far from trivial, and he also pointed out that he was 
> proposing similar patches for NIR, but since currently no NIR->TGSI 
> transformation is available, TGSI based drivers can't make use of
> this. 
> 
> While the reminder off the series could be applied without this
> patch, I 
> think it makes less sense to do all the optimizations on arrays that
> could 
> simply be split into individual registers, so I repost the patch with
> some 
> changes. 
> 
> I tried to be exhaustive with comments and make the variable any type
> names 
> self-explaining, but since I've been staring at this code for a long
> time I
> don't think I am capable of seeing any problems any more, so comments
> are very 
> welcome.
> 
> Many thanks for reviews and comments, 
> Gert 
> 
> PS: I have no commit rights. 
> 
> Gert Wollny (15):
>   mesa/st/glsl_to_tgsi: Add method to collect some TGSI statistics
>   mesa/st/glsl_to_tgsi: Split arrays whose elements are only accessed
> directly
>   mesa/st/glsl_to_tgsi: Properly resolve life times simple if/else +
> use
> constructs
>   mesa/st/glsl_to_tgsi:rename lifetime to register_live_range
>   mesa/st/glsl_to_tgsi: Add helper class for array live range merging
> and interleaving
>   mesa/st/glsl_to_tgsi: Add helper classes to apply array merging and
> interleaving
>   mesa/st/glsl_to_tgsi: Add array merge logic
>   mesa/st/tests: Add tests for array merge helper classes.
>   mesa/st/glsl_to_tgsi: rename access_record to register_merge_record
> and some more renames
>   mesa/st/glsl_to_tgsi: move evaluation of read mask up in the call
> hierarchy
>   mesa/st/glsl_to_tgsi: add class for array access tracking
>   mesa/st/glsl_to_tgsi: add array life range evaluation into tracking
> code
>   mesa/st/glsl_to_tgsi: Expose array live range tracking  and merging
>   mesa/st/tests: Add array life range tests infrastructure to common
> test class
>   mesa/st/tests: Add array life range estimation and renumbering
> tests
> 
>  src/mesa/Makefile

[Mesa-dev] [PATCH] glx: Demand success from CreateContext requests (v2)

2018-08-07 Thread Adam Jackson
GLXCreate{,New}Context, like most X resource creation requests, does not
emit a reply and therefore is emitted into the X stream asynchronously.
However, unlike most resource creation requests, the GLXContext we
return is a handle to library state instead of an XID. So if context
creation fails for any reason - say, the server doesn't support indirect
contexts - then we will fail in strange places for strange reasons.

We could make every GLX entrypoint robust against half-created contexts,
or we could just verify that context creation worked. Reuse the
__glXIsDirect code to do this, as a cheap way of verifying that the
XID is real.

glXCreateContextAttribsARB solves this by using the _checked version of
the xcb command, so effectively this change makes the classic context
creation paths as robust as CreateContextAttribs.

v2: Better use of Bool, check that error != NULL first (Olivier Fourdan)

Signed-off-by: Adam Jackson 
---
 src/glx/glxcmds.c | 93 ---
 1 file changed, 55 insertions(+), 38 deletions(-)

diff --git a/src/glx/glxcmds.c b/src/glx/glxcmds.c
index 4db0228eaba..3ed960fbf3c 100644
--- a/src/glx/glxcmds.c
+++ b/src/glx/glxcmds.c
@@ -272,6 +272,44 @@ glx_context_init(struct glx_context *gc,
return True;
 }
 
+/**
+ * Determine if a context uses direct rendering.
+ *
+ * \param dpyDisplay where the context was created.
+ * \param contextID  ID of the context to be tested.
+ * \param error  Out parameter, set to True on error if not NULL
+ *
+ * \returns \c True if the context is direct rendering or not.
+ */
+static Bool
+__glXIsDirect(Display * dpy, GLXContextID contextID, Bool *error)
+{
+   CARD8 opcode;
+   xcb_connection_t *c;
+   xcb_generic_error_t *err;
+   xcb_glx_is_direct_reply_t *reply;
+   Bool is_direct;
+
+   opcode = __glXSetupForCommand(dpy);
+   if (!opcode) {
+  return False;
+   }
+
+   c = XGetXCBConnection(dpy);
+   reply = xcb_glx_is_direct_reply(c, xcb_glx_is_direct(c, contextID), &err);
+   is_direct = (reply != NULL && reply->is_direct) ? True : False;
+
+   if (err != NULL) {
+  if (error)
+ *error = True;
+  __glXSendErrorForXcb(dpy, err);
+  free(err);
+   }
+
+   free(reply);
+
+   return is_direct;
+}
 
 /**
  * Create a new context.
@@ -376,6 +414,21 @@ CreateContext(Display *dpy, int generic_id, struct 
glx_config *config,
gc->share_xid = shareList ? shareList->xid : None;
gc->imported = GL_FALSE;
 
+   /* Unlike most X resource creation requests, we're about to return a handle
+* with client-side state, not just an XID. To simplify error handling
+* elsewhere in libGL, force a round-trip here to ensure the CreateContext
+* request above succeeded.
+*/
+   {
+  Bool error = False;
+  int isDirect = __glXIsDirect(dpy, gc->xid, &error);
+
+  if (error != False || isDirect != gc->isDirect) {
+ gc->vtable->destroy(gc);
+ gc = NULL;
+  }
+   }
+
return (GLXContext) gc;
 }
 
@@ -612,42 +665,6 @@ glXCopyContext(Display * dpy, GLXContext source_user,
 }
 
 
-/**
- * Determine if a context uses direct rendering.
- *
- * \param dpyDisplay where the context was created.
- * \param contextID  ID of the context to be tested.
- *
- * \returns \c True if the context is direct rendering or not.
- */
-static Bool
-__glXIsDirect(Display * dpy, GLXContextID contextID)
-{
-   CARD8 opcode;
-   xcb_connection_t *c;
-   xcb_generic_error_t *err;
-   xcb_glx_is_direct_reply_t *reply;
-   Bool is_direct;
-
-   opcode = __glXSetupForCommand(dpy);
-   if (!opcode) {
-  return False;
-   }
-
-   c = XGetXCBConnection(dpy);
-   reply = xcb_glx_is_direct_reply(c, xcb_glx_is_direct(c, contextID), &err);
-   is_direct = (reply != NULL && reply->is_direct) ? True : False;
-
-   if (err != NULL) {
-  __glXSendErrorForXcb(dpy, err);
-  free(err);
-   }
-
-   free(reply);
-
-   return is_direct;
-}
-
 /**
  * \todo
  * Shouldn't this function \b always return \c False when
@@ -668,7 +685,7 @@ glXIsDirect(Display * dpy, GLXContext gc_user)
 #ifdef GLX_USE_APPLEGL  /* TODO: indirect on darwin */
return False;
 #else
-   return __glXIsDirect(dpy, gc->xid);
+   return __glXIsDirect(dpy, gc->xid, NULL);
 #endif
 }
 
@@ -1428,7 +1445,7 @@ glXImportContextEXT(Display *dpy, GLXContextID contextID)
   return NULL;
}
 
-   if (__glXIsDirect(dpy, contextID))
+   if (__glXIsDirect(dpy, contextID, NULL))
   return NULL;
 
opcode = __glXSetupForCommand(dpy);
-- 
2.17.0

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


Re: [Mesa-dev] [PATCH] r600/eg: rework atomic counter emission with flushes

2018-08-07 Thread Gert Wollny
I have not yet read the patch, just applied it and run, at one point it
locked up again, blancking the screen, and these piglits running: 

   arb_compute_shader-local-id -auto -fbo
   arb_shader_image_load_store-bitcast -auto -fbo
   arb_shader_image_load_store-max-images -auto -fbo
   arb_shader_image_load_store-max-size --quick -auto -fbo
   arb_shader_image_load_store-minmax -auto -fbo
   arb_shader_image_load_store-qualifiers -auto -fbo
 
I couldn't kill the -bitcast process, didn't try the -local-id process,
but starting with -max-size I was able to kill -9 some tests and then
it resolved itself and piglit continued to run to the end.  

I have to retry whether I can do the same without this patch, I thinkat least 
once it worked for me. 

Best, 
Gert 

Am Dienstag, den 07.08.2018, 12:31 +1000 schrieb Dave Airlie:
> From: Dave Airlie 
> 
> With the current code, we didn't do the space checks prior
> to atomic counter setup emission, but we also didn't add
> atomic counters to the space check so we could get a flush
> later as well.
> 
> These flushes would be bad, and lead to problems with
> parallel tests. We have to ensure the atomic counter copy in,
> draw emits and counter copy out are kept in the same command
> submission unit.
> 
> This reworks the code to drop some useless masks, make the
> counting separate to the emits, and make the space checker
> handle atomic counter space.
> ---
>  src/gallium/drivers/r600/evergreen_compute.c  | 11 --
>  .../drivers/r600/evergreen_hw_context.c   |  2 +-
>  src/gallium/drivers/r600/evergreen_state.c| 38 +++
> 
>  src/gallium/drivers/r600/r600_hw_context.c|  7 +++-
>  src/gallium/drivers/r600/r600_pipe.h  | 14 ---
>  src/gallium/drivers/r600/r600_state_common.c  | 13 +--
>  6 files changed, 54 insertions(+), 31 deletions(-)
> 
> diff --git a/src/gallium/drivers/r600/evergreen_compute.c
> b/src/gallium/drivers/r600/evergreen_compute.c
> index 90eae1e2829..a77f58242e3 100644
> --- a/src/gallium/drivers/r600/evergreen_compute.c
> +++ b/src/gallium/drivers/r600/evergreen_compute.c
> @@ -715,7 +715,6 @@ static void compute_emit_cs(struct r600_context
> *rctx,
>   rctx->cmd_buf_is_compute = true;
>   }
>  
> - r600_need_cs_space(rctx, 0, true);
>   if (rctx->cs_shader_state.shader->ir_type ==
> PIPE_SHADER_IR_TGSI) {
>   r600_shader_select(&rctx->b.b, rctx-
> >cs_shader_state.shader->sel, &compute_dirty);
>   current = rctx->cs_shader_state.shader->sel-
> >current;
> @@ -742,16 +741,22 @@ static void compute_emit_cs(struct r600_context
> *rctx,
>   }
>   rctx->cs_block_grid_sizes[3] = rctx-
> >cs_block_grid_sizes[7] = 0;
>   rctx-
> >driver_consts[PIPE_SHADER_COMPUTE].cs_block_grid_size_dirty = true;
> +
> + evergreen_emit_atomic_buffer_setup_count(rctx,
> current, combined_atomics, &atomic_used_mask);
> + r600_need_cs_space(rctx, 0, true,
> util_bitcount(atomic_used_mask));
> +
>   if (need_buf_const) {
>   eg_setup_buffer_constants(rctx,
> PIPE_SHADER_COMPUTE);
>   }
>   r600_update_driver_const_buffers(rctx, true);
>  
> - if (evergreen_emit_atomic_buffer_setup(rctx,
> current, combined_atomics, &atomic_used_mask)) {
> + evergreen_emit_atomic_buffer_setup(rctx, true,
> combined_atomics, atomic_used_mask);
> + if (atomic_used_mask) {
>   radeon_emit(cs, PKT3(PKT3_EVENT_WRITE, 0,
> 0));
>   radeon_emit(cs,
> EVENT_TYPE(EVENT_TYPE_CS_PARTIAL_FLUSH) | EVENT_INDEX(4));
>   }
> - }
> + } else
> + r600_need_cs_space(rctx, 0, true, 0);
>  
>   /* Initialize all the compute-related registers.
>*
> diff --git a/src/gallium/drivers/r600/evergreen_hw_context.c
> b/src/gallium/drivers/r600/evergreen_hw_context.c
> index d3f3e227c1f..5e0e27b0f16 100644
> --- a/src/gallium/drivers/r600/evergreen_hw_context.c
> +++ b/src/gallium/drivers/r600/evergreen_hw_context.c
> @@ -109,7 +109,7 @@ void evergreen_cp_dma_clear_buffer(struct
> r600_context *rctx,
>  
>   r600_need_cs_space(rctx,
>  10 + (rctx->b.flags ?
> R600_MAX_FLUSH_CS_DWORDS : 0) +
> -R600_MAX_PFP_SYNC_ME_DWORDS,
> FALSE);
> +R600_MAX_PFP_SYNC_ME_DWORDS,
> FALSE, 0);
>  
>   /* Flush the caches for the first copy only. */
>   if (rctx->b.flags) {
> diff --git a/src/gallium/drivers/r600/evergreen_state.c
> b/src/gallium/drivers/r600/evergreen_state.c
> index 57e81e30c27..cc41e114369 100644
> --- a/src/gallium/drivers/r600/evergreen_state.c
> +++ b/src/gallium/drivers/r600/evergreen_state.c
> @@ -4030,7 +4030,6 @@ static void
> evergreen_set_hw_atomic_buffers(struct pipe_context *ctx,
>  
>   if (!buffers || !buffers[idx].buffer) {
>

[Mesa-dev] [PATCH] virgl: ARB_texture_barrier support

2018-08-07 Thread Dave Airlie
From: Dave Airlie 

---
 src/gallium/drivers/virgl/virgl_context.c  | 9 +++--
 src/gallium/drivers/virgl/virgl_encode.c   | 8 
 src/gallium/drivers/virgl/virgl_encode.h   | 2 ++
 src/gallium/drivers/virgl/virgl_hw.h   | 1 +
 src/gallium/drivers/virgl/virgl_protocol.h | 5 +
 src/gallium/drivers/virgl/virgl_screen.c   | 2 +-
 6 files changed, 24 insertions(+), 3 deletions(-)

diff --git a/src/gallium/drivers/virgl/virgl_context.c 
b/src/gallium/drivers/virgl/virgl_context.c
index 03c0fd7cd50..dc1dd2d3c29 100644
--- a/src/gallium/drivers/virgl/virgl_context.c
+++ b/src/gallium/drivers/virgl/virgl_context.c
@@ -805,9 +805,14 @@ static void virgl_set_sampler_views(struct pipe_context 
*ctx,
 }
 
 static void
-virgl_texture_barrier(struct pipe_context *pctx, unsigned flags)
+virgl_texture_barrier(struct pipe_context *ctx, unsigned flags)
 {
-   /* stub */
+   struct virgl_context *vctx = virgl_context(ctx);
+   struct virgl_screen *rs = virgl_screen(ctx->screen);
+
+   if (!(rs->caps.caps.v2.capability_bits & VIRGL_CAP_TEXTURE_BARRIER))
+  return;
+   virgl_encode_texture_barrier(vctx, flags);
 }
 
 static void virgl_destroy_sampler_view(struct pipe_context *ctx,
diff --git a/src/gallium/drivers/virgl/virgl_encode.c 
b/src/gallium/drivers/virgl/virgl_encode.c
index 670c5fe6c3d..190c338f458 100644
--- a/src/gallium/drivers/virgl/virgl_encode.c
+++ b/src/gallium/drivers/virgl/virgl_encode.c
@@ -1009,3 +1009,11 @@ int virgl_encode_launch_grid(struct virgl_context *ctx,
virgl_encoder_write_dword(ctx->cbuf, grid_info->indirect_offset);
return 0;
 }
+
+int virgl_encode_texture_barrier(struct virgl_context *ctx,
+ unsigned flags)
+{
+   virgl_encoder_write_cmd_dword(ctx, VIRGL_CMD0(VIRGL_CCMD_TEXTURE_BARRIER, 
0, 1));
+   virgl_encoder_write_dword(ctx->cbuf, flags);
+   return 0;
+}
diff --git a/src/gallium/drivers/virgl/virgl_encode.h 
b/src/gallium/drivers/virgl/virgl_encode.h
index c982eb954f3..749cd330120 100644
--- a/src/gallium/drivers/virgl/virgl_encode.h
+++ b/src/gallium/drivers/virgl/virgl_encode.h
@@ -272,4 +272,6 @@ int virgl_encode_memory_barrier(struct virgl_context *ctx,
 unsigned flags);
 int virgl_encode_launch_grid(struct virgl_context *ctx,
  const struct pipe_grid_info *grid_info);
+int virgl_encode_texture_barrier(struct virgl_context *ctx,
+ unsigned flags);
 #endif
diff --git a/src/gallium/drivers/virgl/virgl_hw.h 
b/src/gallium/drivers/virgl/virgl_hw.h
index 1df9d0e77d1..b56f554b001 100644
--- a/src/gallium/drivers/virgl/virgl_hw.h
+++ b/src/gallium/drivers/virgl/virgl_hw.h
@@ -229,6 +229,7 @@ enum virgl_formats {
 #define VIRGL_CAP_ROBUST_BUFFER_ACCESS (1 << 9)
 #define VIRGL_CAP_TGSI_FBFETCH (1 << 10)
 #define VIRGL_CAP_SHADER_CLOCK (1 << 11)
+#define VIRGL_CAP_TEXTURE_BARRIER  (1 << 12)
 
 /* virgl bind flags - these are compatible with mesa 10.5 gallium.
  * but are fixed, no other should be passed to virgl either.
diff --git a/src/gallium/drivers/virgl/virgl_protocol.h 
b/src/gallium/drivers/virgl/virgl_protocol.h
index 982bc5c8c2b..0a41c0174f2 100644
--- a/src/gallium/drivers/virgl/virgl_protocol.h
+++ b/src/gallium/drivers/virgl/virgl_protocol.h
@@ -91,6 +91,7 @@ enum virgl_context_cmd {
VIRGL_CCMD_MEMORY_BARRIER,
VIRGL_CCMD_LAUNCH_GRID,
VIRGL_CCMD_SET_FRAMEBUFFER_STATE_NO_ATTACH,
+   VIRGL_CCMD_TEXTURE_BARRIER,
 };
 
 /*
@@ -539,4 +540,8 @@ enum virgl_context_cmd {
 #define VIRGL_SET_FRAMEBUFFER_STATE_NO_ATTACH_LAYERS(x) (x & 0x)
 #define VIRGL_SET_FRAMEBUFFER_STATE_NO_ATTACH_SAMPLES(x) ((x >> 16) & 0xff)
 
+/* texture barrier */
+#define VIRGL_TEXTURE_BARRIER_SIZE 1
+#define VIRGL_TEXTURE_BARRIER_FLAGS 1
+
 #endif
diff --git a/src/gallium/drivers/virgl/virgl_screen.c 
b/src/gallium/drivers/virgl/virgl_screen.c
index 421fde5249d..87ce3b7355d 100644
--- a/src/gallium/drivers/virgl/virgl_screen.c
+++ b/src/gallium/drivers/virgl/virgl_screen.c
@@ -124,7 +124,7 @@ virgl_get_param(struct pipe_screen *screen, enum pipe_cap 
param)
case PIPE_CAP_CONDITIONAL_RENDER:
   return vscreen->caps.caps.v1.bset.conditional_render;
case PIPE_CAP_TEXTURE_BARRIER:
-  return 0;
+  return vscreen->caps.caps.v2.capability_bits & VIRGL_CAP_TEXTURE_BARRIER;
case PIPE_CAP_VERTEX_COLOR_UNCLAMPED:
   return 1;
case PIPE_CAP_FRAGMENT_COLOR_CLAMPED:
-- 
2.14.3

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


Re: [Mesa-dev] [PATCH 16/26] python: Explicitly use lists

2018-08-07 Thread Dylan Baker
Quoting Mathieu Bridon (2018-07-06 02:43:46)
> On Thu, 2018-07-05 at 09:31 -0700, Dylan Baker wrote:
> > Quoting Mathieu Bridon (2018-07-05 06:17:47)
> > > On Python 2, the builtin functions filter() and zip() would return
> > > lists.
> > > 
> > > On Python 3, they return iterators.
> > > 
> > > Since we want to use those objects in contexts where we need lists,
> > > we
> > > need to explicitly turn them into lists.
> > > 
> > > This makes the code compatible with both Python 2 and Python 3.
> > > 
> > > Signed-off-by: Mathieu Bridon 
> > > ---
> > >  src/compiler/nir/nir_opt_algebraic.py | 2 +-
> > >  src/mesa/main/get_hash_generator.py   | 4 ++--
> > >  2 files changed, 3 insertions(+), 3 deletions(-)
> > > 
> > > diff --git a/src/compiler/nir/nir_opt_algebraic.py
> > > b/src/compiler/nir/nir_opt_algebraic.py
> > > index 5e07d662b0..7b2ba56990 100644
> > > --- a/src/compiler/nir/nir_opt_algebraic.py
> > > +++ b/src/compiler/nir/nir_opt_algebraic.py
> > > @@ -633,7 +633,7 @@ optimizations = [
> > >  
> > >  invert = OrderedDict([('feq', 'fne'), ('fne', 'feq'), ('fge',
> > > 'flt'), ('flt', 'fge')])
> > >  
> > > -for left, right in list(itertools.combinations(invert.keys(), 2))
> > > + zip(invert.keys(), invert.keys()):
> > > +for left, right in list(itertools.combinations(invert.keys(), 2))
> > > + list(zip(invert.keys(), invert.keys())):
> > 
> > Isn't this just a really expenisve re-implementation of:
> > itertools.combinations_with_replacement(invert.keys(), 2)
> 
> It seems to be, yes. (I was so focused on fixing the "can't concatenate
> list with zip" error that I completely missed it)
> 
> However, since dict.keys() isn't guaranteed to always be in the same
> order, it is theoretically possible that:

ah, but invert is an OrderedDict, so the ordering is guaranteed :)

> 
> >>> zip(invert.keys(), invert.keys())
> 
> doesn't always return the same thing.
> 
> That is, the following could happen:
> 
> >>> d = {'A': \u2026, 'B': \u2026}
> >>> zip(d.keys(), d.keys())
> ['AB', 'BA']
> 
> Which would make the whole line not equivalent to
> `itertools.combinations_with_replacement()` any more.
> 
> In practice it probably doesn't happen though, but that means if the
> intention behind the code was what you suspect, then by using
> `itertools.combinations_with_replacement()` we'd be fixing an actual
> bug, not just making the script compatible with Python 3. :)
> 
> 
> -- 
> Mathieu


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 v3 05/48] gallium: fix ddebug on windows

2018-08-07 Thread Dylan Baker
Yeah, this is git+me screwing up the rebase. The actual useful part of this
patch (that defines mkdir and getpid) is already in master. I'll drop this patch
entirely.

Dylan

Quoting Marek Olšák (2018-08-07 10:45:42)
> Reviewed-by: Marek Olšák 
> 
> The commit message doesn't match the content of the patch.
> 
> Marek
> 
> On Mon, Aug 6, 2018 at 8:50 PM, Dylan Baker  wrote:
> > By including the proper headers for getpid and for mkdir.
> >
> > Signed-off-by: Dylan Baker 
> > Reviewed-by: Marek Olšák 
> > ---
> >  src/gallium/auxiliary/meson.build | 6 ++
> >  1 file changed, 6 insertions(+)
> >
> > diff --git a/src/gallium/auxiliary/meson.build 
> > b/src/gallium/auxiliary/meson.build
> > index 98542d7ef3e..4facaae08d6 100644
> > --- a/src/gallium/auxiliary/meson.build
> > +++ b/src/gallium/auxiliary/meson.build
> > @@ -106,6 +106,12 @@ files_libgallium = files(
> >'driver_trace/tr_screen.h',
> >'driver_trace/tr_texture.c',
> >'driver_trace/tr_texture.h',
> > +  'driver_ddebug/dd_context.c',
> > +  'driver_ddebug/dd_draw.c',
> > +  'driver_ddebug/dd_pipe.h',
> > +  'driver_ddebug/dd_public.h',
> > +  'driver_ddebug/dd_screen.c',
> > +  'driver_ddebug/dd_util.h',
> >'hud/font.c',
> >'hud/font.h',
> >'hud/hud_context.c',
> > --
> > 2.18.0
> >
> > ___
> > mesa-dev mailing list
> > mesa-dev@lists.freedesktop.org
> > https://lists.freedesktop.org/mailman/listinfo/mesa-dev


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


Re: [Mesa-dev] [PATCH 15/26] python: Specify the template output encoding

2018-08-07 Thread Dylan Baker
Quoting Mathieu Bridon (2018-07-06 02:34:56)
> On Thu, 2018-07-05 at 09:14 -0700, Dylan Baker wrote:
> > Does it make more sense to encode, or to use io.open and open the
> > file in text mode? I've gone back and forth on this myself several
> > times.
> 
> Same here, both seem equally valid and I can't really make my mind up
> on which one to pick.
> 
> The general recommendation with Python 3 is to use unicode strings
> everywhere, and only encode/decode at the boundaries.
> 
> I guess the boundary is actually writing to the file, so opening it in
> text mode and handling unicode strings (not encode them ourselves) fits
> that a bit better?
> 
> It seems like a very weak argument though in this specific case, since
> we're not really doing anything with the byte-string other than just
> writing it directly to the file.
> 
> Do you want me to do a v2 with that change?
> 
> 
> -- 
> Mathieu

Eh, it's not a big deal either way. Lets just leave this as-is for now and we
can change it later if we decide we'd prefer to do that. Like when we drop
python 2.7 support.

Dylan


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


Re: [Mesa-dev] [PATCH 12/26] python: Fix unequality comparisons

2018-08-07 Thread Dylan Baker
Quoting Mathieu Bridon (2018-07-06 02:25:53)
> On Thu, 2018-07-05 at 09:10 -0700, Dylan Baker wrote:
> > Quoting Mathieu Bridon (2018-07-05 06:17:43) 
> > > +def __ne__(self, other):
> > > +return not self.__eq__(other)
> > 
> > This can be written as "not (self == other)", right?
> 
> It can, yes.
> 
> The `==` operator is going to end up calling the `__eq__` method
> defined just above anyway, and we're already in the implementation
> details of `__ne__`.
> 
> So it felt more natural to me to have `__ne__` be the opposite of
> `__eq__` rather than the opposite of `==`.
> 
> Also, `not (\u2026 == \u2026)` feels weird, it screams "replace me by `\u2026 
> != \u2026`".
> Which I'm worried someone not paying attention might do in the future.
> 
> I don't feel very strongly about it though, so I'll change it if you
> do.
> 
> 
> -- 
> Mathieu

I go back and forth on it. Calling dunder methods directly feels a little odd to
me, they're more of a protocol than actual methods. For a lot of dunder methods
I'd be very strongly against calling them directly (__iter__ and __next__ for
example), I guess for the comparison methods I can go either way.

Oh, I just noticed the commit message should say "inequality" instead of
"unequality".

Dylan


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


Re: [Mesa-dev] [PATCH 15/26] python: Specify the template output encoding

2018-08-07 Thread Dylan Baker
Reviewed-by: Dylan Baker 

Quoting Mathieu Bridon (2018-07-05 06:17:46)
> We're trying to write a unicode string (i.e decoded) to a file opened
> in binary (i.e encoded) mode.
> 
> In Python 2 this works, because of the automatic conversion between
> byte and unicode strings.
> 
> In Python 3 this fails though, as no automatic conversion is attempted.
> 
> This change makes the scripts compatible with both versions of Python.
> 
> Signed-off-by: Mathieu Bridon 
> ---
>  src/compiler/nir/nir_intrinsics_c.py | 2 +-
>  src/compiler/nir/nir_intrinsics_h.py | 2 +-
>  2 files changed, 2 insertions(+), 2 deletions(-)
> 
> diff --git a/src/compiler/nir/nir_intrinsics_c.py 
> b/src/compiler/nir/nir_intrinsics_c.py
> index 98af67c38a..ac45b94d49 100644
> --- a/src/compiler/nir/nir_intrinsics_c.py
> +++ b/src/compiler/nir/nir_intrinsics_c.py
> @@ -64,7 +64,7 @@ def main():
>  
>  path = os.path.join(args.outdir, 'nir_intrinsics.c')
>  with open(path, 'wb') as f:
> -f.write(Template(template).render(INTR_OPCODES=INTR_OPCODES))
> +f.write(Template(template, 
> output_encoding='utf-8').render(INTR_OPCODES=INTR_OPCODES))
>  
>  if __name__ == '__main__':
>  main()
> diff --git a/src/compiler/nir/nir_intrinsics_h.py 
> b/src/compiler/nir/nir_intrinsics_h.py
> index 8a4f0d501e..8abc6a8626 100644
> --- a/src/compiler/nir/nir_intrinsics_h.py
> +++ b/src/compiler/nir/nir_intrinsics_h.py
> @@ -53,7 +53,7 @@ def main():
>  
>  path = os.path.join(args.outdir, 'nir_intrinsics.h')
>  with open(path, 'wb') as f:
> -f.write(Template(template).render(INTR_OPCODES=INTR_OPCODES))
> +f.write(Template(template, 
> output_encoding='utf-8').render(INTR_OPCODES=INTR_OPCODES))
>  
>  if __name__ == '__main__':
>  main()
> -- 
> 2.17.1
> 
> ___
> mesa-dev mailing list
> mesa-dev@lists.freedesktop.org
> https://lists.freedesktop.org/mailman/listinfo/mesa-dev


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


[Mesa-dev] [Bug 107474] RADV does not support a dedicated transfer queue

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

--- Comment #1 from Dave Airlie  ---
FYI I've had a branch and posted patches for starting this on gfx8 and gfx9.

https://github.com/airlied/mesa/tree/radv-wip-transfer-queue-4

There are lots of corner cases and I hadn't resolved all the CTS tests on gfx9
I don't think.

I'm not sure when I'll loop back around to it, it would be good to have
something more to test it with than CTS.

-- 
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] [PATCH 0/4] Merge vulkan API generators.

2018-08-07 Thread Bas Nieuwenhuizen
radv was always just mirroring a derived version of the anv
version, sometimes hacked together and sometimes very behind.

As we grow more vulkan drivers this repetition makes even less
sense, so lets merge them. I took the anv generators as the
template and made radv use them.

This includes some messy stuff in the build system due to 
difficulties with python includes. I tested with meson and
autotools. Android.mk is updated but not tested.

Bas Nieuwenhuizen (4):
  vulkan: Add central copy of entrypoints/extensions code.
  vulkan/util: Add support to not generate the trampolines.
  anv: Use central api generation scripts.
  radv: Integrate with common generators.

 src/amd/vulkan/Android.mk   |  16 +-
 src/amd/vulkan/Makefile.am  |  29 +-
 src/amd/vulkan/meson.build  |  91 ++--
 src/amd/vulkan/radv_device.c|  56 ++-
 src/amd/vulkan/radv_entrypoints_gen.py  | 462 +---
 src/amd/vulkan/radv_extensions.py   | 236 +--
 src/amd/vulkan/radv_extensions_gen.py   |  44 ++
 src/amd/vulkan/radv_icd.py  |   1 +
 src/amd/vulkan/radv_private.h   |   9 +-
 src/amd/vulkan/radv_wsi.c   |   6 +-
 src/intel/Android.vulkan.mk |   9 +
 src/intel/Makefile.vulkan.am|  25 +-
 src/intel/vulkan/anv_device.c   |  46 ++
 src/intel/vulkan/anv_entrypoints_gen.py | 537 +---
 src/intel/vulkan/anv_extensions.py  |  68 +--
 src/intel/vulkan/anv_extensions_gen.py  | 177 +---
 src/intel/vulkan/meson.build|  15 +-
 src/vulkan/Makefile.am  |   3 +
 src/vulkan/util/meson.build |   2 +
 src/vulkan/util/vk_entrypoints_gen.py   | 522 +++
 src/vulkan/util/vk_extensions.py|  93 
 src/vulkan/util/vk_extensions_gen.py| 205 +
 22 files changed, 1131 insertions(+), 1521 deletions(-)
 create mode 100644 src/amd/vulkan/radv_extensions_gen.py
 create mode 100644 src/vulkan/util/vk_entrypoints_gen.py
 create mode 100644 src/vulkan/util/vk_extensions.py
 create mode 100644 src/vulkan/util/vk_extensions_gen.py

-- 
2.18.0

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


[Mesa-dev] [PATCH 1/4] vulkan: Add central copy of entrypoints/extensions code.

2018-08-07 Thread Bas Nieuwenhuizen
---
 src/vulkan/Makefile.am|   3 +
 src/vulkan/util/meson.build   |   2 +
 src/vulkan/util/vk_entrypoints_gen.py | 515 ++
 src/vulkan/util/vk_extensions.py  |  92 +
 src/vulkan/util/vk_extensions_gen.py  | 205 ++
 5 files changed, 817 insertions(+)
 create mode 100644 src/vulkan/util/vk_entrypoints_gen.py
 create mode 100644 src/vulkan/util/vk_extensions.py
 create mode 100644 src/vulkan/util/vk_extensions_gen.py

diff --git a/src/vulkan/Makefile.am b/src/vulkan/Makefile.am
index db3831229e9..bec5f3a46ab 100644
--- a/src/vulkan/Makefile.am
+++ b/src/vulkan/Makefile.am
@@ -10,6 +10,9 @@ PYTHON_GEN = $(AM_V_GEN)$(PYTHON2) $(PYTHON_FLAGS)
 
 EXTRA_DIST = \
util/gen_enum_to_str.py \
+   util/vk_entrypoints_gen.py \
+   util/vk_extensions_gen.py \
+   util/vk_extensions.py \
util/meson.build \
wsi/meson.build \
meson.build
diff --git a/src/vulkan/util/meson.build b/src/vulkan/util/meson.build
index 78cee0adb50..102b72c1e1d 100644
--- a/src/vulkan/util/meson.build
+++ b/src/vulkan/util/meson.build
@@ -43,3 +43,5 @@ libvulkan_util = static_library(
   c_args : [c_vis_args],
   build_by_default : false,
 )
+
+vk_api_generators_py = files(['vk_extensions.py', 'vk_extensions_gen.py', 
'vk_entrypoints_gen.py'])
diff --git a/src/vulkan/util/vk_entrypoints_gen.py 
b/src/vulkan/util/vk_entrypoints_gen.py
new file mode 100644
index 000..5caaa834aa2
--- /dev/null
+++ b/src/vulkan/util/vk_entrypoints_gen.py
@@ -0,0 +1,515 @@
+# coding=utf-8
+#
+# 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"),
+# 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.
+#
+
+import math
+import os
+import xml.etree.cElementTree as et
+
+from collections import OrderedDict, namedtuple
+from mako.template import Template
+
+from vk_extensions import *
+
+# We generate a static hash table for entry point lookup
+# (vkGetProcAddress). We use a linear congruential generator for our hash
+# function and a power-of-two size table. The prime numbers are determined
+# experimentally.
+
+TEMPLATE_H = Template("""\
+/* This file generated from ${filename}, don't edit directly. */
+
+struct ${name_prefix}_dispatch_table {
+   union {
+  void *entrypoints[${len(entrypoints)}];
+  struct {
+  % for e in entrypoints:
+% if e.guard is not None:
+#ifdef ${e.guard}
+  PFN_${e.name} ${e.name};
+#else
+  void *${e.name};
+# endif
+% else:
+  PFN_${e.name} ${e.name};
+% endif
+  % endfor
+  };
+   };
+};
+
+%for layer in LAYERS:
+extern const struct ${name_prefix}_dispatch_table ${layer}_dispatch_table;
+%endfor
+extern const struct ${name_prefix}_dispatch_table 
${name_prefix}_tramp_dispatch_table;
+
+% for e in entrypoints:
+  % if e.alias:
+<% continue %>
+  % endif
+  % if e.guard is not None:
+#ifdef ${e.guard}
+  % endif
+  % for layer in LAYERS:
+  ${e.return_type} ${e.prefixed_name(layer)}(${e.decl_params()});
+  % endfor
+  % if e.guard is not None:
+#endif // ${e.guard}
+  % endif
+% endfor
+""", output_encoding='utf-8')
+
+TEMPLATE_C = Template(u"""\
+/*
+ * 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 

[Mesa-dev] [PATCH 4/4] radv: Integrate with common generators.

2018-08-07 Thread Bas Nieuwenhuizen
Replace some functions to use the anv idioms. However, I did not
introduce dispatch tables in the instance/device since that seemed
like overkill.
---
 src/amd/vulkan/Android.mk  |  16 +-
 src/amd/vulkan/Makefile.am |  29 +-
 src/amd/vulkan/meson.build |  91 +++--
 src/amd/vulkan/radv_device.c   |  56 ++-
 src/amd/vulkan/radv_entrypoints_gen.py | 462 +
 src/amd/vulkan/radv_extensions.py  | 236 +
 src/amd/vulkan/radv_extensions_gen.py  |  44 +++
 src/amd/vulkan/radv_icd.py |   1 +
 src/amd/vulkan/radv_private.h  |   9 +-
 src/amd/vulkan/radv_wsi.c  |   6 +-
 10 files changed, 211 insertions(+), 739 deletions(-)
 create mode 100644 src/amd/vulkan/radv_extensions_gen.py

diff --git a/src/amd/vulkan/Android.mk b/src/amd/vulkan/Android.mk
index cee3744f40b..a6aae160e0b 100644
--- a/src/amd/vulkan/Android.mk
+++ b/src/amd/vulkan/Android.mk
@@ -83,24 +83,34 @@ LOCAL_GENERATED_SOURCES += 
$(intermediates)/vk_format_table.c
 
 RADV_ENTRYPOINTS_SCRIPT := $(MESA_TOP)/src/amd/vulkan/radv_entrypoints_gen.py
 RADV_EXTENSIONS_SCRIPT := $(MESA_TOP)/src/amd/vulkan/radv_extensions.py
+RADV_EXTENSIONS_GEN_SCRIPT := $(MESA_TOP)/src/amd/vulkan/radv_extensions_gen.py
 VK_FORMAT_TABLE_SCRIPT := $(MESA_TOP)/src/amd/vulkan/vk_format_table.py
 VK_FORMAT_PARSE_SCRIPT := $(MESA_TOP)/src/amd/vulkan/vk_format_parse.py
 
+vulkan_api_generators_py := \
+   $(MESA_TOP)/src/vulkan/util/vk_entrypoints_gen.py \
+   $(MESA_TOP)/src/vulkan/util/vk_extensions_gen.py \
+   $(MESA_TOP)/src/vulkan/util/vk_extensions.py
+
 vulkan_api_xml = $(MESA_TOP)/src/vulkan/registry/vk.xml
 vk_format_layout_csv = $(MESA_TOP)/src/amd/vulkan/vk_format_layout.csv
 
 $(intermediates)/radv_entrypoints.c: $(RADV_ENTRYPOINTS_SCRIPT) \
$(RADV_EXTENSIONS_SCRIPT) \
-   $(vulkan_api_xml)
+   $(vulkan_api_xml) \
+   $(vulkan_api_generators_py)
@mkdir -p $(dir $@)
+   PYTHONPATH=$(MESA_TOP)/src/vulkan/util \
$(MESA_PYTHON2) $(RADV_ENTRYPOINTS_SCRIPT) \
--xml $(vulkan_api_xml) \
--outdir $(dir $@)
 
 $(intermediates)/radv_entrypoints.h: $(intermediates)/radv_entrypoints.c
 
-$(intermediates)/radv_extensions.c: $(RADV_EXTENSIONS_SCRIPT) $(vulkan_api_xml)
-   @mkdir -p $(dir $@)
+$(intermediates)/radv_extensions.c: $(RADV_EXTENSIONS_GEN_SCRIPT) 
$(RADV_EXTENSIONS_SCRIPT) \
+   $(vulkan_api_xml) 
$(vulkan_api_generators_py)
+   @mkdir -p $(dir $@)\
+   PYTHONPATH=$(MESA_TOP)/src/vulkan/util \
$(MESA_PYTHON2) $(RADV_EXTENSIONS_SCRIPT) \
--xml $(vulkan_api_xml) \
--out-c $@ \
diff --git a/src/amd/vulkan/Makefile.am b/src/amd/vulkan/Makefile.am
index e7ccc58a28e..88e5b1de2fd 100644
--- a/src/amd/vulkan/Makefile.am
+++ b/src/amd/vulkan/Makefile.am
@@ -21,6 +21,11 @@
 
 include Makefile.sources
 
+vulkan_api_generators_py = \
+   $(top_srcdir)/src/vulkan/util/vk_entrypoints_gen.py \
+   $(top_srcdir)/src/vulkan/util/vk_extensions_gen.py \
+   $(top_srcdir)/src/vulkan/util/vk_extensions.py
+
 noinst_HEADERS = \
$(top_srcdir)/include/vulkan/vk_platform.h \
$(top_srcdir)/include/vulkan/vulkan_core.h \
@@ -138,17 +143,20 @@ libvulkan_radeon_la_SOURCES = $(VULKAN_GEM_FILES)
 
 vulkan_api_xml = $(top_srcdir)/src/vulkan/registry/vk.xml
 
-radv_entrypoints.c: radv_entrypoints_gen.py radv_extensions.py 
$(vulkan_api_xml)
+radv_entrypoints.c: radv_entrypoints_gen.py radv_extensions.py 
$(vulkan_api_xml) \
+   $(vulkan_api_generators_py)
$(MKDIR_GEN)
-   $(AM_V_GEN)$(PYTHON2) $(srcdir)/radv_entrypoints_gen.py \
+   $(AM_V_GEN) PYTHONPATH=$(top_srcdir)/src/vulkan/util \
+   $(PYTHON2) $(srcdir)/radv_entrypoints_gen.py \
--xml $(vulkan_api_xml) \
--outdir $(builddir)
 radv_entrypoints.h: radv_entrypoints.c
 
-radv_extensions.c: radv_extensions.py \
-$(vulkan_api_xml)
+radv_extensions.c: radv_extensions_gen.py radv_extensions.py \
+  $(vulkan_api_xml) $(vulkan_api_generators_py)
$(MKDIR_GEN)
-   $(AM_V_GEN)$(PYTHON2) $(srcdir)/radv_extensions.py \
+   $(AM_V_GEN) PYTHONPATH=$(top_srcdir)/src/vulkan/util \
+   $(PYTHON2) $(srcdir)/radv_extensions_gen.py \
--xml $(vulkan_api_xml) \
--out-c radv_extensions.c \
--out-h radv_extensions.h
@@ -164,6 +172,7 @@ CLEANFILES = $(BUILT_SOURCES) dev_icd.json 
radeon_icd.@host_cpu@.json
 EXTRA_DIST = \
$(top_srcdir)/include/vulkan/vk_icd.h \
radv_entrypoints_gen.py \
+   radv_extensions_gen.py \
radv_extensions.py \
radv_icd.py \
vk_format_layout.csv \
@@ -189,12 +198,14 @@ icdconf_DATA = radeon_icd.@host_cpu@.json
 

  1   2   >