Re: [Mesa-dev] [PATCH] gallium: trace: Add missing fence related wrappers

2019-04-09 Thread Guido Günther
Hi,
On Fri, Mar 29, 2019 at 05:48:31PM +0100, Guido Günther wrote:
> Without that kmscube with GALLIUM_TRACE would segfault like:
> 
>   #0  0x in  ()
>   #1  0x8f311760 in dri2_create_fence_fd (_ctx=0xe266b8b0, fd=10) 
> at ../src/gallium/state_trackers/dri/dri_helpers.c:122
>   #2  0x90788670 in dri2_create_sync (drv=0xe2667910, 
> disp=0xe26691f0, type=12612, attrib_list=0xe26b9290) at 
> ../src/egl/drivers/dri2/egl_dri2.c:2993
>   #3  0x90776a9c in _eglCreateSync (disp=0xe26691f0, type=12612, 
> attrib_list=0xe26b9290, orig_is_EGLAttrib=0, invalid_type_error=12292) at 
> ../src/egl/main/eglapi.c:1823
>   #4  0x90776be4 in eglCreateSyncKHR (dpy=0xe26691f0, type=12612, 
> int_list=0xf662e828) at ../src/egl/main/eglapi.c:1848
> 
> Signed-off-by: Guido Günther 

These are similar to the already applied (thanks Lucas!) GALLIUM_DDEBUG
fixes:

https://lists.freedesktop.org/archives/mesa-dev/2019-April/217422.html

but for GALLIUM_TRACE - just in case they looked to similar when flying
by.
Cheers,
 -- Guido

> ---
>  .../auxiliary/driver_trace/tr_context.c   | 44 +++
>  .../auxiliary/driver_trace/tr_screen.c| 24 ++
>  2 files changed, 68 insertions(+)
> 
> diff --git a/src/gallium/auxiliary/driver_trace/tr_context.c 
> b/src/gallium/auxiliary/driver_trace/tr_context.c
> index 7859a3395ca..9f3926a32a4 100644
> --- a/src/gallium/auxiliary/driver_trace/tr_context.c
> +++ b/src/gallium/auxiliary/driver_trace/tr_context.c
> @@ -1314,6 +1314,48 @@ trace_context_flush(struct pipe_context *_pipe,
>  }
>  
>  
> +static void
> +trace_context_create_fence_fd(struct pipe_context *_pipe,
> +  struct pipe_fence_handle **fence,
> +  int fd,
> +  enum pipe_fd_type type)
> +{
> +   struct trace_context *tr_ctx = trace_context(_pipe);
> +   struct pipe_context *pipe = tr_ctx->pipe;
> +
> +   trace_dump_call_begin("pipe_context", "create_fence_fd");
> +
> +   trace_dump_arg(ptr, pipe);
> +   trace_dump_arg(int, fd);
> +   trace_dump_arg(uint, type);
> +
> +   pipe->create_fence_fd(pipe, fence, fd, type);
> +
> +   if (fence)
> +  trace_dump_ret(ptr, *fence);
> +
> +   trace_dump_call_end();
> +}
> +
> +
> +static void
> +trace_context_fence_server_sync(struct pipe_context *_pipe,
> +struct pipe_fence_handle *fence)
> +{
> +   struct trace_context *tr_ctx = trace_context(_pipe);
> +   struct pipe_context *pipe = tr_ctx->pipe;
> +
> +   trace_dump_call_begin("pipe_context", "fence_server_sync");
> +
> +   trace_dump_arg(ptr, pipe);
> +   trace_dump_arg(ptr, fence);
> +
> +   pipe->fence_server_sync(pipe, fence);
> +
> +   trace_dump_call_end();
> +}
> +
> +
>  static inline boolean
>  trace_context_generate_mipmap(struct pipe_context *_pipe,
>struct pipe_resource *res,
> @@ -1946,6 +1988,8 @@ trace_context_create(struct trace_screen *tr_scr,
> TR_CTX_INIT(clear_depth_stencil);
> TR_CTX_INIT(clear_texture);
> TR_CTX_INIT(flush);
> +   TR_CTX_INIT(create_fence_fd);
> +   TR_CTX_INIT(fence_server_sync);
> TR_CTX_INIT(generate_mipmap);
> TR_CTX_INIT(texture_barrier);
> TR_CTX_INIT(memory_barrier);
> diff --git a/src/gallium/auxiliary/driver_trace/tr_screen.c 
> b/src/gallium/auxiliary/driver_trace/tr_screen.c
> index b5bd3e11c46..e42aef63552 100644
> --- a/src/gallium/auxiliary/driver_trace/tr_screen.c
> +++ b/src/gallium/auxiliary/driver_trace/tr_screen.c
> @@ -495,6 +495,29 @@ trace_screen_fence_reference(struct pipe_screen *_screen,
>  }
>  
>  
> +static int
> +trace_screen_fence_get_fd(struct pipe_screen *_screen,
> +  struct pipe_fence_handle *fence)
> +{
> +   struct trace_screen *tr_scr = trace_screen(_screen);
> +   struct pipe_screen *screen = tr_scr->screen;
> +   int result;
> +
> +   trace_dump_call_begin("pipe_screen", "fence_get_fd");
> +
> +   trace_dump_arg(ptr, screen);
> +   trace_dump_arg(ptr, fence);
> +
> +   result = screen->fence_get_fd(screen, fence);
> +
> +   trace_dump_ret(int, result);
> +
> +   trace_dump_call_end();
> +
> +   return result;
> +}
> +
> +
>  static boolean
>  trace_screen_fence_finish(struct pipe_screen *_screen,
>struct pipe_context *_ctx,
> @@ -654,6 +677,7 @@ trace_screen_create(struct pipe_screen *screen)
> SCR_INIT(resource_changed);
> tr_scr->base.resource_destroy =

[Mesa-dev] [PATCH] gallium/u_dump: util_dump_sampler_view: Dump u.tex.first_level

2019-04-03 Thread Guido Günther
Dump u.tex.first_level instead of dumping u.tex.last_level twice.

Signed-off-by: Guido Günther 
---
 src/gallium/auxiliary/util/u_dump_state.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/src/gallium/auxiliary/util/u_dump_state.c 
b/src/gallium/auxiliary/util/u_dump_state.c
index 638dac79db2..6b11f10408a 100644
--- a/src/gallium/auxiliary/util/u_dump_state.c
+++ b/src/gallium/auxiliary/util/u_dump_state.c
@@ -789,7 +789,7 @@ util_dump_sampler_view(FILE *stream, const struct 
pipe_sampler_view *state)
else {
   util_dump_member(stream, uint, state, u.tex.first_layer);
   util_dump_member(stream, uint, state, u.tex.last_layer);
-  util_dump_member(stream, uint, state, u.tex.last_level);
+  util_dump_member(stream, uint, state, u.tex.first_level);
   util_dump_member(stream, uint, state, u.tex.last_level);
}
 
-- 
2.20.1
___
mesa-dev mailing list
mesa-dev@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/mesa-dev

Re: [Mesa-dev] [PATCH] gallium: ddebug: Add missing fence related wrappers

2019-04-03 Thread Guido Günther
Hi,
On Wed, Apr 03, 2019 at 12:43:05PM +0200, Lucas Stach wrote:
> Hi Guido,
> 
> Am Montag, den 01.04.2019, 14:19 +0200 schrieb Guido Günther:
> > Without that `GALLIUM_DDEBUG=always kmscube -A` would segfault like
> > 
> >   #0  0x in  ()
> >   #1  0xa72a3c54 in dri2_get_fence_fd (_screen=0xed4f2090, 
> > _fence=0xed9ef880) at 
> > ../src/gallium/state_trackers/dri/dri_helpers.c:140
> >   #2  0xa8744824 in dri2_dup_native_fence_fd (drv=0xed5010c0, 
> > disp=0xed5029a0, sync=0xed9ef7c0) at 
> > ../src/egl/drivers/dri2/egl_dri2.c:3050
> >   #3  0xa87339b8 in eglDupNativeFenceFDANDROID (dpy=0xed5029a0, 
> > sync=0xed9ef7c0) at ../src/egl/main/eglapi.c:2107
> >   #4  0xaaaabd29ca90 in  ()
> >   #5  0xbd401000 in  ()
> > 
> > > Signed-off-by: Guido Günther 
> > ---
> > This is similar in spirit to the patches for GALLIUM_TRACE send out earlier.
> > 
> > 
> >  .../auxiliary/driver_ddebug/dd_context.c  | 40 +++
> >  .../auxiliary/driver_ddebug/dd_screen.c   | 10 +
> >  2 files changed, 50 insertions(+)
> > 
> > diff --git a/src/gallium/auxiliary/driver_ddebug/dd_context.c 
> > b/src/gallium/auxiliary/driver_ddebug/dd_context.c
> > index 4ea0b16de6f..3152c664630 100644
> > --- a/src/gallium/auxiliary/driver_ddebug/dd_context.c
> > +++ b/src/gallium/auxiliary/driver_ddebug/dd_context.c
> > @@ -575,6 +575,43 @@ dd_context_set_stream_output_targets(struct 
> > pipe_context *_pipe,
> > pipe->set_stream_output_targets(pipe, num_targets, tgs, offsets);
> >  }
> >  
> > +
> > +static void
> > +dd_context_flush(struct pipe_context *_pipe,
> > + struct pipe_fence_handle **fence,
> > + unsigned flags)
> > +{
> > +   struct dd_context *dctx = dd_context(_pipe);
> > +   struct pipe_context *pipe = dctx->pipe;
> > +
> > +   pipe->flush(pipe, fence, flags);
> > +}
> 
> dd_context_flush() is already implemented in dd_draw.c

You're right - only looked in dd_context. I've removed that part in v2.
Cheers,
 -- Guido

> 
> Regards,
> Lucas
> 
> > +
> > +
> > +static void
> > +dd_context_fence_server_sync(struct pipe_context *_pipe,
> > + struct pipe_fence_handle *fence)
> > +{
> > +   struct dd_context *dctx = dd_context(_pipe);
> > +   struct pipe_context *pipe = dctx->pipe;
> > +
> > +   pipe->fence_server_sync(pipe, fence);
> > +}
> > +
> > +
> > +static void
> > +dd_context_create_fence_fd(struct pipe_context *_pipe,
> > +   struct pipe_fence_handle **fence,
> > +   int fd,
> > +   enum pipe_fd_type type)
> > +{
> > +   struct dd_context *dctx = dd_context(_pipe);
> > +   struct pipe_context *pipe = dctx->pipe;
> > +
> > +   pipe->create_fence_fd(pipe, fence, fd, type);
> > +}
> > +
> > +
> >  void
> >  dd_thread_join(struct dd_context *dctx)
> >  {
> > @@ -867,6 +904,9 @@ dd_context_create(struct dd_screen *dscreen, struct 
> > pipe_context *pipe)
> > CTX_INIT(create_stream_output_target);
> > CTX_INIT(stream_output_target_destroy);
> > CTX_INIT(set_stream_output_targets);
> > +   CTX_INIT(flush);
> > +   CTX_INIT(create_fence_fd);
> > +   CTX_INIT(fence_server_sync);
> > CTX_INIT(create_sampler_view);
> > CTX_INIT(sampler_view_destroy);
> > CTX_INIT(create_surface);
> > diff --git a/src/gallium/auxiliary/driver_ddebug/dd_screen.c 
> > b/src/gallium/auxiliary/driver_ddebug/dd_screen.c
> > index a89af8a8d62..b2108adfa32 100644
> > --- a/src/gallium/auxiliary/driver_ddebug/dd_screen.c
> > +++ b/src/gallium/auxiliary/driver_ddebug/dd_screen.c
> > @@ -348,6 +348,15 @@ dd_screen_fence_finish(struct pipe_screen *_screen,
> > return screen->fence_finish(screen, ctx, fence, timeout);
> >  }
> >  
> > +static int
> > +dd_screen_fence_get_fd(struct pipe_screen *_screen,
> > +   struct pipe_fence_handle *fence)
> > +{
> > +   struct pipe_screen *screen = dd_screen(_screen)->screen;
> > +
> > +   return screen->fence_get_fd(screen, fence);
> > +}
> > +
> >  /
> >   * memobj
> >   */
> > @@ -550,6 +559,7 @@ ddebug_screen_create(struct pipe_screen *screen)
> > SCR_INIT(flush_frontbuffer);
> > SCR_INIT(fence_reference);
> > SCR_INIT(fence_finish);
> > +   SCR_INIT(fence_get_fd);
> > SCR_INIT(memobj_create_from_handle);
> > SCR_INIT(memobj_destroy);
> > SCR_INIT(get_driver_query_info);
> 
___
mesa-dev mailing list
mesa-dev@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/mesa-dev

[Mesa-dev] [PATCH v2] gallium: ddebug: Add missing fence related wrappers

2019-04-03 Thread Guido Günther
Without that `GALLIUM_DDEBUG=always kmscube -A` would segfault like

  #0  0x in  ()
  #1  0xa72a3c54 in dri2_get_fence_fd (_screen=0xed4f2090, 
_fence=0xed9ef880) at ../src/gallium/state_trackers/dri/dri_helpers.c:140
  #2  0xa8744824 in dri2_dup_native_fence_fd (drv=0xed5010c0, 
disp=0xed5029a0, sync=0xed9ef7c0) at 
../src/egl/drivers/dri2/egl_dri2.c:3050
  #3  0xa87339b8 in eglDupNativeFenceFDANDROID (dpy=0xed5029a0, 
sync=0xed9ef7c0) at ../src/egl/main/eglapi.c:2107
  #4  0xbd29ca90 in  ()
  #5  0xbd401000 in  ()

Signed-off-by: Guido Günther 

---
Changes from v1:
- Drop duplicate dd_context_flush() as noticed by Lucas Stach
---
 .../auxiliary/driver_ddebug/dd_context.c  | 27 +++
 .../auxiliary/driver_ddebug/dd_screen.c   | 10 +++
 2 files changed, 37 insertions(+)

diff --git a/src/gallium/auxiliary/driver_ddebug/dd_context.c 
b/src/gallium/auxiliary/driver_ddebug/dd_context.c
index 4ea0b16de6f..ab3043a8b87 100644
--- a/src/gallium/auxiliary/driver_ddebug/dd_context.c
+++ b/src/gallium/auxiliary/driver_ddebug/dd_context.c
@@ -575,6 +575,31 @@ dd_context_set_stream_output_targets(struct pipe_context 
*_pipe,
pipe->set_stream_output_targets(pipe, num_targets, tgs, offsets);
 }
 
+
+static void
+dd_context_fence_server_sync(struct pipe_context *_pipe,
+ struct pipe_fence_handle *fence)
+{
+   struct dd_context *dctx = dd_context(_pipe);
+   struct pipe_context *pipe = dctx->pipe;
+
+   pipe->fence_server_sync(pipe, fence);
+}
+
+
+static void
+dd_context_create_fence_fd(struct pipe_context *_pipe,
+   struct pipe_fence_handle **fence,
+   int fd,
+   enum pipe_fd_type type)
+{
+   struct dd_context *dctx = dd_context(_pipe);
+   struct pipe_context *pipe = dctx->pipe;
+
+   pipe->create_fence_fd(pipe, fence, fd, type);
+}
+
+
 void
 dd_thread_join(struct dd_context *dctx)
 {
@@ -867,6 +892,8 @@ dd_context_create(struct dd_screen *dscreen, struct 
pipe_context *pipe)
CTX_INIT(create_stream_output_target);
CTX_INIT(stream_output_target_destroy);
CTX_INIT(set_stream_output_targets);
+   CTX_INIT(create_fence_fd);
+   CTX_INIT(fence_server_sync);
CTX_INIT(create_sampler_view);
CTX_INIT(sampler_view_destroy);
CTX_INIT(create_surface);
diff --git a/src/gallium/auxiliary/driver_ddebug/dd_screen.c 
b/src/gallium/auxiliary/driver_ddebug/dd_screen.c
index a89af8a8d62..b2108adfa32 100644
--- a/src/gallium/auxiliary/driver_ddebug/dd_screen.c
+++ b/src/gallium/auxiliary/driver_ddebug/dd_screen.c
@@ -348,6 +348,15 @@ dd_screen_fence_finish(struct pipe_screen *_screen,
return screen->fence_finish(screen, ctx, fence, timeout);
 }
 
+static int
+dd_screen_fence_get_fd(struct pipe_screen *_screen,
+   struct pipe_fence_handle *fence)
+{
+   struct pipe_screen *screen = dd_screen(_screen)->screen;
+
+   return screen->fence_get_fd(screen, fence);
+}
+
 /
  * memobj
  */
@@ -550,6 +559,7 @@ ddebug_screen_create(struct pipe_screen *screen)
SCR_INIT(flush_frontbuffer);
SCR_INIT(fence_reference);
SCR_INIT(fence_finish);
+   SCR_INIT(fence_get_fd);
SCR_INIT(memobj_create_from_handle);
SCR_INIT(memobj_destroy);
SCR_INIT(get_driver_query_info);
-- 
2.20.1
___
mesa-dev mailing list
mesa-dev@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/mesa-dev

Re: [Mesa-dev] [PATCH 2/2] etnaviv: flush all pending contexts when accessing a resource with the CPU

2019-04-02 Thread Guido Günther
Hi Lucas,
On Wed, Mar 27, 2019 at 12:22:58PM +0100, Lucas Stach wrote:
> When setting up a transfer to a resource, all contexts where the resource
> is pending must be flushed. Otherwise a write transfer might be started
> in the current context before all contexts that access the resource in
> shared (read) mode have been executed.
> 
> Fixes: 64813541d575 (etnaviv: fix resource usage tracking across
> different pipe_context's)
> Signed-off-by: Lucas Stach 
> ---
>  src/gallium/drivers/etnaviv/etnaviv_transfer.c | 10 --
>  1 file changed, 8 insertions(+), 2 deletions(-)
> 
> diff --git a/src/gallium/drivers/etnaviv/etnaviv_transfer.c 
> b/src/gallium/drivers/etnaviv/etnaviv_transfer.c
> index 45cd31207f70..d875803bde26 100644
> --- a/src/gallium/drivers/etnaviv/etnaviv_transfer.c
> +++ b/src/gallium/drivers/etnaviv/etnaviv_transfer.c
> @@ -360,8 +360,14 @@ etna_transfer_map(struct pipe_context *pctx, struct 
> pipe_resource *prsc,
>if ((trans->rsc && (etna_resource(trans->rsc)->status & 
> ETNA_PENDING_WRITE)) ||
>(!trans->rsc &&
> (((usage & PIPE_TRANSFER_READ) && (rsc->status & 
> ETNA_PENDING_WRITE)) ||
> -   ((usage & PIPE_TRANSFER_WRITE) && rsc->status
> - pctx->flush(pctx, NULL, 0);
> +   ((usage & PIPE_TRANSFER_WRITE) && rsc->status {
> + set_foreach(rsc->pending_ctx, entry) {
> +struct etna_context *pend_ctx = (struct etna_context 
> *)entry->key;
> +struct pipe_context *pend_pctx = _ctx->base;
> +
> +pend_pctx->flush(pend_pctx, NULL, 0);
> + }
> +  }
>  
>mtx_unlock(>lock);

I would not say that I have understood all the details of resource
flushing but in my tests it doesn't break anything so:

Tested-By: Guido Günther  

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

[Mesa-dev] [PATCH] docs: Fix 19.0.x version numbers

2019-04-01 Thread Guido Günther
The list has 19.0.2 twice.

Signed-off-by: Guido Günther 
---
 docs/release-calendar.html | 8 
 1 file changed, 4 insertions(+), 4 deletions(-)

diff --git a/docs/release-calendar.html b/docs/release-calendar.html
index 0b0bb138b12..35965f68de8 100644
--- a/docs/release-calendar.html
+++ b/docs/release-calendar.html
@@ -64,25 +64,25 @@ if you'd like to nominate a patch in the next stable 
release.
 
 
 2019-04-23
-19.0.2
+19.0.3
 Dylan Baker
 
 
 
 2019-05-07
-19.0.3
+19.0.4
 Dylan Baker
 
 
 
 2019-05-21
-19.0.4
+19.0.5
 Dylan Baker
 
 
 
 2019-06-04
-19.0.5
+19.0.6
 Dylan Baker
 Last planned 19.0.x release
 
-- 
2.20.1
___
mesa-dev mailing list
mesa-dev@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/mesa-dev

[Mesa-dev] [PATCH] gallium: ddebug: Add missing fence related wrappers

2019-04-01 Thread Guido Günther
Without that `GALLIUM_DDEBUG=always kmscube -A` would segfault like

  #0  0x in  ()
  #1  0xa72a3c54 in dri2_get_fence_fd (_screen=0xed4f2090, 
_fence=0xed9ef880) at ../src/gallium/state_trackers/dri/dri_helpers.c:140
  #2  0xa8744824 in dri2_dup_native_fence_fd (drv=0xed5010c0, 
disp=0xed5029a0, sync=0xed9ef7c0) at 
../src/egl/drivers/dri2/egl_dri2.c:3050
  #3  0xa87339b8 in eglDupNativeFenceFDANDROID (dpy=0xed5029a0, 
sync=0xed9ef7c0) at ../src/egl/main/eglapi.c:2107
  #4  0xbd29ca90 in  ()
  #5  0xbd401000 in  ()

Signed-off-by: Guido Günther 
---
This is similar in spirit to the patches for GALLIUM_TRACE send out earlier.


 .../auxiliary/driver_ddebug/dd_context.c  | 40 +++
 .../auxiliary/driver_ddebug/dd_screen.c   | 10 +
 2 files changed, 50 insertions(+)

diff --git a/src/gallium/auxiliary/driver_ddebug/dd_context.c 
b/src/gallium/auxiliary/driver_ddebug/dd_context.c
index 4ea0b16de6f..3152c664630 100644
--- a/src/gallium/auxiliary/driver_ddebug/dd_context.c
+++ b/src/gallium/auxiliary/driver_ddebug/dd_context.c
@@ -575,6 +575,43 @@ dd_context_set_stream_output_targets(struct pipe_context 
*_pipe,
pipe->set_stream_output_targets(pipe, num_targets, tgs, offsets);
 }
 
+
+static void
+dd_context_flush(struct pipe_context *_pipe,
+ struct pipe_fence_handle **fence,
+ unsigned flags)
+{
+   struct dd_context *dctx = dd_context(_pipe);
+   struct pipe_context *pipe = dctx->pipe;
+
+   pipe->flush(pipe, fence, flags);
+}
+
+
+static void
+dd_context_fence_server_sync(struct pipe_context *_pipe,
+ struct pipe_fence_handle *fence)
+{
+   struct dd_context *dctx = dd_context(_pipe);
+   struct pipe_context *pipe = dctx->pipe;
+
+   pipe->fence_server_sync(pipe, fence);
+}
+
+
+static void
+dd_context_create_fence_fd(struct pipe_context *_pipe,
+   struct pipe_fence_handle **fence,
+   int fd,
+   enum pipe_fd_type type)
+{
+   struct dd_context *dctx = dd_context(_pipe);
+   struct pipe_context *pipe = dctx->pipe;
+
+   pipe->create_fence_fd(pipe, fence, fd, type);
+}
+
+
 void
 dd_thread_join(struct dd_context *dctx)
 {
@@ -867,6 +904,9 @@ dd_context_create(struct dd_screen *dscreen, struct 
pipe_context *pipe)
CTX_INIT(create_stream_output_target);
CTX_INIT(stream_output_target_destroy);
CTX_INIT(set_stream_output_targets);
+   CTX_INIT(flush);
+   CTX_INIT(create_fence_fd);
+   CTX_INIT(fence_server_sync);
CTX_INIT(create_sampler_view);
CTX_INIT(sampler_view_destroy);
CTX_INIT(create_surface);
diff --git a/src/gallium/auxiliary/driver_ddebug/dd_screen.c 
b/src/gallium/auxiliary/driver_ddebug/dd_screen.c
index a89af8a8d62..b2108adfa32 100644
--- a/src/gallium/auxiliary/driver_ddebug/dd_screen.c
+++ b/src/gallium/auxiliary/driver_ddebug/dd_screen.c
@@ -348,6 +348,15 @@ dd_screen_fence_finish(struct pipe_screen *_screen,
return screen->fence_finish(screen, ctx, fence, timeout);
 }
 
+static int
+dd_screen_fence_get_fd(struct pipe_screen *_screen,
+   struct pipe_fence_handle *fence)
+{
+   struct pipe_screen *screen = dd_screen(_screen)->screen;
+
+   return screen->fence_get_fd(screen, fence);
+}
+
 /
  * memobj
  */
@@ -550,6 +559,7 @@ ddebug_screen_create(struct pipe_screen *screen)
SCR_INIT(flush_frontbuffer);
SCR_INIT(fence_reference);
SCR_INIT(fence_finish);
+   SCR_INIT(fence_get_fd);
SCR_INIT(memobj_create_from_handle);
SCR_INIT(memobj_destroy);
SCR_INIT(get_driver_query_info);
-- 
2.20.1
___
mesa-dev mailing list
mesa-dev@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/mesa-dev

[Mesa-dev] [PATCH] gallium: trace: Add missing fence related wrappers

2019-03-29 Thread Guido Günther
Without that kmscube with GALLIUM_TRACE would segfault like:

  #0  0x in  ()
  #1  0x8f311760 in dri2_create_fence_fd (_ctx=0xe266b8b0, fd=10) 
at ../src/gallium/state_trackers/dri/dri_helpers.c:122
  #2  0x90788670 in dri2_create_sync (drv=0xe2667910, 
disp=0xe26691f0, type=12612, attrib_list=0xe26b9290) at 
../src/egl/drivers/dri2/egl_dri2.c:2993
  #3  0x90776a9c in _eglCreateSync (disp=0xe26691f0, type=12612, 
attrib_list=0xe26b9290, orig_is_EGLAttrib=0, invalid_type_error=12292) at 
../src/egl/main/eglapi.c:1823
  #4  0x90776be4 in eglCreateSyncKHR (dpy=0xe26691f0, type=12612, 
int_list=0xf662e828) at ../src/egl/main/eglapi.c:1848

Signed-off-by: Guido Günther 
---
 .../auxiliary/driver_trace/tr_context.c   | 44 +++
 .../auxiliary/driver_trace/tr_screen.c| 24 ++
 2 files changed, 68 insertions(+)

diff --git a/src/gallium/auxiliary/driver_trace/tr_context.c 
b/src/gallium/auxiliary/driver_trace/tr_context.c
index 7859a3395ca..9f3926a32a4 100644
--- a/src/gallium/auxiliary/driver_trace/tr_context.c
+++ b/src/gallium/auxiliary/driver_trace/tr_context.c
@@ -1314,6 +1314,48 @@ trace_context_flush(struct pipe_context *_pipe,
 }
 
 
+static void
+trace_context_create_fence_fd(struct pipe_context *_pipe,
+  struct pipe_fence_handle **fence,
+  int fd,
+  enum pipe_fd_type type)
+{
+   struct trace_context *tr_ctx = trace_context(_pipe);
+   struct pipe_context *pipe = tr_ctx->pipe;
+
+   trace_dump_call_begin("pipe_context", "create_fence_fd");
+
+   trace_dump_arg(ptr, pipe);
+   trace_dump_arg(int, fd);
+   trace_dump_arg(uint, type);
+
+   pipe->create_fence_fd(pipe, fence, fd, type);
+
+   if (fence)
+  trace_dump_ret(ptr, *fence);
+
+   trace_dump_call_end();
+}
+
+
+static void
+trace_context_fence_server_sync(struct pipe_context *_pipe,
+struct pipe_fence_handle *fence)
+{
+   struct trace_context *tr_ctx = trace_context(_pipe);
+   struct pipe_context *pipe = tr_ctx->pipe;
+
+   trace_dump_call_begin("pipe_context", "fence_server_sync");
+
+   trace_dump_arg(ptr, pipe);
+   trace_dump_arg(ptr, fence);
+
+   pipe->fence_server_sync(pipe, fence);
+
+   trace_dump_call_end();
+}
+
+
 static inline boolean
 trace_context_generate_mipmap(struct pipe_context *_pipe,
   struct pipe_resource *res,
@@ -1946,6 +1988,8 @@ trace_context_create(struct trace_screen *tr_scr,
TR_CTX_INIT(clear_depth_stencil);
TR_CTX_INIT(clear_texture);
TR_CTX_INIT(flush);
+   TR_CTX_INIT(create_fence_fd);
+   TR_CTX_INIT(fence_server_sync);
TR_CTX_INIT(generate_mipmap);
TR_CTX_INIT(texture_barrier);
TR_CTX_INIT(memory_barrier);
diff --git a/src/gallium/auxiliary/driver_trace/tr_screen.c 
b/src/gallium/auxiliary/driver_trace/tr_screen.c
index b5bd3e11c46..e42aef63552 100644
--- a/src/gallium/auxiliary/driver_trace/tr_screen.c
+++ b/src/gallium/auxiliary/driver_trace/tr_screen.c
@@ -495,6 +495,29 @@ trace_screen_fence_reference(struct pipe_screen *_screen,
 }
 
 
+static int
+trace_screen_fence_get_fd(struct pipe_screen *_screen,
+  struct pipe_fence_handle *fence)
+{
+   struct trace_screen *tr_scr = trace_screen(_screen);
+   struct pipe_screen *screen = tr_scr->screen;
+   int result;
+
+   trace_dump_call_begin("pipe_screen", "fence_get_fd");
+
+   trace_dump_arg(ptr, screen);
+   trace_dump_arg(ptr, fence);
+
+   result = screen->fence_get_fd(screen, fence);
+
+   trace_dump_ret(int, result);
+
+   trace_dump_call_end();
+
+   return result;
+}
+
+
 static boolean
 trace_screen_fence_finish(struct pipe_screen *_screen,
   struct pipe_context *_ctx,
@@ -654,6 +677,7 @@ trace_screen_create(struct pipe_screen *screen)
SCR_INIT(resource_changed);
tr_scr->base.resource_destroy = trace_screen_resource_destroy;
tr_scr->base.fence_reference = trace_screen_fence_reference;
+   SCR_INIT(fence_get_fd);
tr_scr->base.fence_finish = trace_screen_fence_finish;
SCR_INIT(memobj_create_from_handle);
SCR_INIT(memobj_destroy);
-- 
2.20.1
___
mesa-dev mailing list
mesa-dev@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/mesa-dev

Re: [Mesa-dev] [PATCH 1/2] etnaviv: don't flush own context when updating resource use

2019-03-29 Thread Guido Günther
Hi,
On Wed, Mar 27, 2019 at 12:22:57PM +0100, Lucas Stach wrote:
> The context is self synchronizing at the GPU side, as commands are
> executed in order. We must not flush our own context when updating the
> resource use, as that leads to excessive flushing on effectively every
> draw call, causing huge CPU overhead.
> 
> Fixes: 64813541d575 (etnaviv: fix resource usage tracking across
> different pipe_context's)
> Signed-off-by: Lucas Stach 
> ---
>  src/gallium/drivers/etnaviv/etnaviv_resource.c | 11 ++-
>  1 file changed, 10 insertions(+), 1 deletion(-)
> 
> diff --git a/src/gallium/drivers/etnaviv/etnaviv_resource.c 
> b/src/gallium/drivers/etnaviv/etnaviv_resource.c
> index ab40414fbe2c..c7eedab74187 100644
> --- a/src/gallium/drivers/etnaviv/etnaviv_resource.c
> +++ b/src/gallium/drivers/etnaviv/etnaviv_resource.c
> @@ -666,9 +666,18 @@ etna_resource_used(struct etna_context *ctx, struct 
> pipe_resource *prsc,
>   struct etna_context *extctx = (struct etna_context *)entry->key;
>   struct pipe_context *pctx = >base;
>  
> + if (extctx == ctx)
> +continue;
> +
>   pctx->flush(pctx, NULL, 0);
> + /* It's safe to clear the status here. If we need to flush it means
> +  * either another context had the resource in exclusive (write) use,
> +  * or we transition the resource to exclusive use in our context.
> +  * In both cases the new status accurately reflects the resource use
> +  * after the flush.
> +  */
> + rsc->status = 0;
>}
> -  rsc->status = 0;
> }
>  
> rsc->status |= status;

Reviewed-By: Guido Günther  
___
mesa-dev mailing list
mesa-dev@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/mesa-dev

Re: [Mesa-dev] [PATCH v5] etnaviv: fix resource usage tracking across different pipe_context's

2019-02-01 Thread Guido Günther
Hi,
On Wed, Jan 30, 2019 at 05:28:14AM +0100, Marek Vasut wrote:
> From: Christian Gmeiner 
> 
> A pipe_resource can be shared by all the pipe_context's hanging off the
> same pipe_screen.
> 
> Signed-off-by: Christian Gmeiner 
> Signed-off-by: Marek Vasut 
> To: mesa-dev@lists.freedesktop.org
> Cc: etna...@lists.freedesktop.org

Tested-By: Guido Günther 

I'm not bold enough to add a
    Reviewed-By: Guido Günther 

Cheers,
 -- Guido

> ---
> Changes from v1 -> v2:
>  - to remove the resource from the used_resources set when it is destroyed
> Changes from v2 -> v3:
>  - add locking with mtx_*() to resource and screen (Marek)
> Changes from v3 -> v4:
>  - drop rsc->lock, just use screen->lock for the entire serialization (Marek)
>  - simplify etna_resource_used() flush condition, which also prevents
>potentially flushing resources twice (Marek)
>  - don't remove resouces from screen->used_resources in
>etna_cmd_stream_reset_notify(), they may still be used in other
>contexts and may need flushing there later on (Marek)
> Changes from v4 -> v5:
>  - Fix coding style issues reported by Guido
> ---
>  src/gallium/drivers/etnaviv/etnaviv_context.c | 26 +-
>  src/gallium/drivers/etnaviv/etnaviv_context.h |  3 --
>  .../drivers/etnaviv/etnaviv_resource.c| 52 +++
>  .../drivers/etnaviv/etnaviv_resource.h|  8 +--
>  src/gallium/drivers/etnaviv/etnaviv_screen.c  | 12 +
>  src/gallium/drivers/etnaviv/etnaviv_screen.h  |  6 +++
>  6 files changed, 78 insertions(+), 29 deletions(-)
> 
> diff --git a/src/gallium/drivers/etnaviv/etnaviv_context.c 
> b/src/gallium/drivers/etnaviv/etnaviv_context.c
> index 3038d21..2f8cae8 100644
> --- a/src/gallium/drivers/etnaviv/etnaviv_context.c
> +++ b/src/gallium/drivers/etnaviv/etnaviv_context.c
> @@ -36,6 +36,7 @@
>  #include "etnaviv_query.h"
>  #include "etnaviv_query_hw.h"
>  #include "etnaviv_rasterizer.h"
> +#include "etnaviv_resource.h"
>  #include "etnaviv_screen.h"
>  #include "etnaviv_shader.h"
>  #include "etnaviv_state.h"
> @@ -329,7 +330,8 @@ static void
>  etna_cmd_stream_reset_notify(struct etna_cmd_stream *stream, void *priv)
>  {
> struct etna_context *ctx = priv;
> -   struct etna_resource *rsc, *rsc_tmp;
> +   struct etna_screen *screen = ctx->screen;
> +   struct set_entry *entry;
>  
> etna_set_state(stream, VIVS_GL_API_MODE, VIVS_GL_API_MODE_OPENGL);
> etna_set_state(stream, VIVS_GL_VERTEX_ELEMENT_CONFIG, 0x0001);
> @@ -384,16 +386,18 @@ etna_cmd_stream_reset_notify(struct etna_cmd_stream 
> *stream, void *priv)
> ctx->dirty = ~0L;
> ctx->dirty_sampler_views = ~0L;
>  
> -   /* go through all the used resources and clear their status flag */
> -   LIST_FOR_EACH_ENTRY_SAFE(rsc, rsc_tmp, >used_resources, list)
> -   {
> -  debug_assert(rsc->status != 0);
> -  rsc->status = 0;
> -  rsc->pending_ctx = NULL;
> -  list_delinit(>list);
> -   }
> +   /*
> +* Go through all _resources_ associated with this _screen_, pending
> +* in this _context_ and mark them as not pending in this _context_
> +* anymore, since they were just flushed.
> +*/
> +   mtx_lock(>lock);
> +   set_foreach(screen->used_resources, entry) {
> +  struct etna_resource *rsc = (struct etna_resource *)entry->key;
>  
> -   assert(LIST_IS_EMPTY(>used_resources));
> +  _mesa_set_remove_key(rsc->pending_ctx, ctx);
> +   }
> +   mtx_unlock(>lock);
>  }
>  
>  static void
> @@ -437,8 +441,6 @@ etna_context_create(struct pipe_screen *pscreen, void 
> *priv, unsigned flags)
> /* need some sane default in case state tracker doesn't set some state: */
> ctx->sample_mask = 0x;
>  
> -   list_inithead(>used_resources);
> -
> /*  Set sensible defaults for state */
> etna_cmd_stream_reset_notify(ctx->stream, ctx);
>  
> diff --git a/src/gallium/drivers/etnaviv/etnaviv_context.h 
> b/src/gallium/drivers/etnaviv/etnaviv_context.h
> index 584caa7..eff0a23 100644
> --- a/src/gallium/drivers/etnaviv/etnaviv_context.h
> +++ b/src/gallium/drivers/etnaviv/etnaviv_context.h
> @@ -136,9 +136,6 @@ struct etna_context {
> uint32_t prim_hwsupport;
> struct primconvert_context *primconvert;
>  
> -   /* list of resources used by currently-unsubmitted renders */
> -   struct list_head used_resources;
> -
> struct slab_child_pool transfer_pool;
> struct blitter_context *blitter;
>  
> diff --git a/src/gallium/drivers/etnaviv/etnaviv_resource.c 
> b/src/gallium/drivers/etnaviv/etnaviv_resource.c
&

Re: [Mesa-dev] [PATCH v4] etnaviv: fix resource usage tracking across different pipe_context's

2019-01-28 Thread Guido Günther
Hi,
On Wed, Jan 16, 2019 at 12:14:43PM +0100, Lucas Stach wrote:
> Am Samstag, den 12.01.2019, 22:22 +0100 schrieb Marek Vasut:
> > > From: Christian Gmeiner 
> > 
> > A pipe_resource can be shared by all the pipe_context's hanging off the
> > same pipe_screen.
> > 
> > > Signed-off-by: Christian Gmeiner 
> > > Signed-off-by: Marek Vasut 
> > To: mesa-dev@lists.freedesktop.org
> > Cc: etna...@lists.freedesktop.org
> 
> I would appreciate if this can get a review from someone who didn't
> totally mess up the mental model of the locking involved. To me this
> change looks good. I'll push this through some internal testing and
> push upstream by the end of the week if there aren't any objections.

The locking looks good to me as well (with my limited understanding of
the driver).
 -- Guido
___
mesa-dev mailing list
mesa-dev@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/mesa-dev


Re: [Mesa-dev] [PATCH v4] etnaviv: fix resource usage tracking across different pipe_context's

2019-01-28 Thread Guido Günther
Hi,
just style nits:

On Sat, Jan 12, 2019 at 10:22:20PM +0100, Marek Vasut wrote:
> From: Christian Gmeiner 
> 
> A pipe_resource can be shared by all the pipe_context's hanging off the
> same pipe_screen.
> 
> Signed-off-by: Christian Gmeiner 
> Signed-off-by: Marek Vasut 
> To: mesa-dev@lists.freedesktop.org
> Cc: etna...@lists.freedesktop.org
> ---
> Changes from v1 -> v2:
>  - to remove the resource from the used_resources set when it is destroyed
> Changes from v2 -> v3:
>  - add locking with mtx_*() to resource and screen (Marek)
> Changes from v3 -> v4:
>  - drop rsc->lock, just use screen->lock for the entire serialization (Marek)
>  - simplify etna_resource_used() flush condition, which also prevents
>potentially flushing resources twice (Marek)
>  - don't remove resouces from screen->used_resources in
>etna_cmd_stream_reset_notify(), they may still be used in other
>contexts and may need flushing there later on (Marek)
> ---
>  src/gallium/drivers/etnaviv/etnaviv_context.c | 26 +-
>  src/gallium/drivers/etnaviv/etnaviv_context.h |  3 --
>  .../drivers/etnaviv/etnaviv_resource.c| 52 +++
>  .../drivers/etnaviv/etnaviv_resource.h|  8 +--
>  src/gallium/drivers/etnaviv/etnaviv_screen.c  | 12 +
>  src/gallium/drivers/etnaviv/etnaviv_screen.h  |  6 +++
>  6 files changed, 78 insertions(+), 29 deletions(-)
> 
> diff --git a/src/gallium/drivers/etnaviv/etnaviv_context.c 
> b/src/gallium/drivers/etnaviv/etnaviv_context.c
> index 3038d21..2f8cae8 100644
> --- a/src/gallium/drivers/etnaviv/etnaviv_context.c
> +++ b/src/gallium/drivers/etnaviv/etnaviv_context.c
> @@ -36,6 +36,7 @@
>  #include "etnaviv_query.h"
>  #include "etnaviv_query_hw.h"
>  #include "etnaviv_rasterizer.h"
> +#include "etnaviv_resource.h"
>  #include "etnaviv_screen.h"
>  #include "etnaviv_shader.h"
>  #include "etnaviv_state.h"
> @@ -329,7 +330,8 @@ static void
>  etna_cmd_stream_reset_notify(struct etna_cmd_stream *stream, void *priv)
>  {
> struct etna_context *ctx = priv;
> -   struct etna_resource *rsc, *rsc_tmp;
> +   struct etna_screen *screen = ctx->screen;
> +   struct set_entry *entry;
>  
> etna_set_state(stream, VIVS_GL_API_MODE, VIVS_GL_API_MODE_OPENGL);
> etna_set_state(stream, VIVS_GL_VERTEX_ELEMENT_CONFIG, 0x0001);
> @@ -384,16 +386,18 @@ etna_cmd_stream_reset_notify(struct etna_cmd_stream 
> *stream, void *priv)
> ctx->dirty = ~0L;
> ctx->dirty_sampler_views = ~0L;
>  
> -   /* go through all the used resources and clear their status flag */
> -   LIST_FOR_EACH_ENTRY_SAFE(rsc, rsc_tmp, >used_resources, list)
> -   {
> -  debug_assert(rsc->status != 0);
> -  rsc->status = 0;
> -  rsc->pending_ctx = NULL;
> -  list_delinit(>list);
> -   }
> +   /*
> +* Go through all _resources_ associated with this _screen_, pending
> +* in this _context_ and mark them as not pending in this _context_
> +* anymore, since they were just flushed.
> +*/
> +   mtx_lock(>lock);
> +   set_foreach(screen->used_resources, entry) {
> +  struct etna_resource *rsc = (struct etna_resource *)entry->key;
>  
> -   assert(LIST_IS_EMPTY(>used_resources));
> +  _mesa_set_remove_key(rsc->pending_ctx, ctx);
> +   }
> +   mtx_unlock(>lock);
>  }
>  
>  static void
> @@ -437,8 +441,6 @@ etna_context_create(struct pipe_screen *pscreen, void 
> *priv, unsigned flags)
> /* need some sane default in case state tracker doesn't set some state: */
> ctx->sample_mask = 0x;
>  
> -   list_inithead(>used_resources);
> -
> /*  Set sensible defaults for state */
> etna_cmd_stream_reset_notify(ctx->stream, ctx);
>  
> diff --git a/src/gallium/drivers/etnaviv/etnaviv_context.h 
> b/src/gallium/drivers/etnaviv/etnaviv_context.h
> index 584caa7..eff0a23 100644
> --- a/src/gallium/drivers/etnaviv/etnaviv_context.h
> +++ b/src/gallium/drivers/etnaviv/etnaviv_context.h
> @@ -136,9 +136,6 @@ struct etna_context {
> uint32_t prim_hwsupport;
> struct primconvert_context *primconvert;
>  
> -   /* list of resources used by currently-unsubmitted renders */
> -   struct list_head used_resources;
> -
> struct slab_child_pool transfer_pool;
> struct blitter_context *blitter;
>  
> diff --git a/src/gallium/drivers/etnaviv/etnaviv_resource.c 
> b/src/gallium/drivers/etnaviv/etnaviv_resource.c
> index 3808c29..46ab849 100644
> --- a/src/gallium/drivers/etnaviv/etnaviv_resource.c
> +++ b/src/gallium/drivers/etnaviv/etnaviv_resource.c
> @@ -33,6 +33,7 @@
>  #include "etnaviv_screen.h"
>  #include "etnaviv_translate.h"
>  
> +#include "util/hash_table.h"
>  #include "util/u_inlines.h"
>  #include "util/u_memory.h"
>  
> @@ -275,7 +276,6 @@ etna_resource_alloc(struct pipe_screen *pscreen, unsigned 
> layout,
> rsc->halign = halign;
>  
> pipe_reference_init(>base.reference, 1);
> -   list_inithead(>list);
>  
> size = setup_miptree(rsc, paddingX, paddingY, msaa_xscale, msaa_yscale);
>  
> @@ -296,6 +296,11 @@ 

[Mesa-dev] [PATCH] etnaviv_screen: Fix typo in cflush_all description

2019-01-07 Thread Guido Günther
Signed-off-by: Guido Günther 
---
 src/gallium/drivers/etnaviv/etnaviv_screen.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/src/gallium/drivers/etnaviv/etnaviv_screen.c 
b/src/gallium/drivers/etnaviv/etnaviv_screen.c
index fb51aa5f4e8..fd320232528 100644
--- a/src/gallium/drivers/etnaviv/etnaviv_screen.c
+++ b/src/gallium/drivers/etnaviv/etnaviv_screen.c
@@ -63,7 +63,7 @@ static const struct debug_named_value debug_options[] = {
{"no_autodisable", ETNA_DBG_NO_AUTODISABLE, "Disable autodisable"},
{"no_supertile",   ETNA_DBG_NO_SUPERTILE, "Disable supertiles"},
{"no_early_z", ETNA_DBG_NO_EARLY_Z, "Disable early z"},
-   {"cflush_all", ETNA_DBG_CFLUSH_ALL, "Flush every cash before state 
update"},
+   {"cflush_all", ETNA_DBG_CFLUSH_ALL, "Flush every cache before state 
update"},
{"msaa2x", ETNA_DBG_MSAA_2X, "Force 2x msaa"},
{"msaa4x", ETNA_DBG_MSAA_4X, "Force 4x msaa"},
{"flush_all",  ETNA_DBG_FLUSH_ALL, "Flush after every rendered 
primitive"},
-- 
2.19.2
___
mesa-dev mailing list
mesa-dev@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/mesa-dev


Re: [Mesa-dev] [PATCH] etnaviv: Make sure rs alignment checks match

2018-10-09 Thread Guido Günther
Hi,
On Mon, Sep 17, 2018 at 04:06:57PM +0200, Guido Günther wrote:
> etna_resource_alloc and etna_resource_from_handle currently use different 
> checks.
> This leads to
> 
>etna_resource_from_handle:492: target=2, 
> format=PIPE_FORMAT_B8G8R8X8_UNORM, 1080x1920x1, array_size=1, last_level=0, 
> nr_samples=0, usage=0, bind=8000a, flags=0
>etna_resource_from_handle:541: BO stride 4320 is too small for RS engine 
> width padding (4352, format PIPE_FORMAT_B8G8R8X8_UNORM)
> 
> since etna_resource_from_handle wants to be aligned to a 16 byte
> boundary while the etna_resource_alloc does not.
> 
> Adjust the two checks by using a common function.

Ping?

> 
> Broken by baff59ebf07a114f95ad66d1f54e4b1f409eebee
> 
> Signed-off-by: Guido Günther 
> ---
>  .../drivers/etnaviv/etnaviv_resource.c| 19 +--
>  1 file changed, 13 insertions(+), 6 deletions(-)
> 
> diff --git a/src/gallium/drivers/etnaviv/etnaviv_resource.c 
> b/src/gallium/drivers/etnaviv/etnaviv_resource.c
> index 7fd374ae23d..f18c6ec6bfc 100644
> --- a/src/gallium/drivers/etnaviv/etnaviv_resource.c
> +++ b/src/gallium/drivers/etnaviv/etnaviv_resource.c
> @@ -176,6 +176,15 @@ setup_miptree(struct etna_resource *rsc, unsigned 
> paddingX, unsigned paddingY,
> return size;
>  }
>  
> +/* Is rs alignment needed? */
> +static bool is_rs_align(struct etna_screen *screen,
> +const struct pipe_resource *tmpl)
> +{
> +   return screen->specs.use_blt ? false : (
> +  VIV_FEATURE(screen, chipMinorFeatures1, TEXTURE_HALIGN) ||
> +  !etna_resource_sampler_only(tmpl));
> +}
> +
>  /* Create a new resource object, using the given template info */
>  struct pipe_resource *
>  etna_resource_alloc(struct pipe_screen *pscreen, unsigned layout,
> @@ -217,11 +226,9 @@ etna_resource_alloc(struct pipe_screen *pscreen, 
> unsigned layout,
> * resolve engine's width.  If not, we must not align resources used
> * only for textures. If this GPU uses the BLT engine, never do RS 
> align.
> */
> -  bool rs_align = screen->specs.use_blt ? false : (
> - VIV_FEATURE(screen, chipMinorFeatures1, 
> TEXTURE_HALIGN) ||
> - !etna_resource_sampler_only(templat));
> -  etna_layout_multiple(layout, screen->specs.pixel_pipes, rs_align, 
> ,
> -   , );
> +  etna_layout_multiple(layout, screen->specs.pixel_pipes,
> +   is_rs_align (screen, templat),
> +   , , );
>assert(paddingX && paddingY);
> } else {
>/* Compressed textures are padded to their block size, but we don't 
> have
> @@ -519,7 +526,7 @@ etna_resource_from_handle(struct pipe_screen *pscreen,
> /* Determine padding of the imported resource. */
> unsigned paddingX = 0, paddingY = 0;
> etna_layout_multiple(rsc->layout, screen->specs.pixel_pipes,
> -VIV_FEATURE(screen, chipMinorFeatures1, 
> TEXTURE_HALIGN),
> +is_rs_align(screen, tmpl),
>  , , >halign);
>  
> if (!screen->specs.use_blt)
> -- 
> 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


[Mesa-dev] [PATCH] etnaviv: Use write combine instead of unached mappings for shader bo

2018-10-01 Thread Guido Günther
The later are sensitive to unalligned accesses on arm64[1] and we don't
need an uncached mapping here.

[1]: https://lists.freedesktop.org/archives/etnaviv/2018-September/001956.html

Signed-off-by: Guido Günther 
---
 src/gallium/drivers/etnaviv/etnaviv_shader.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/src/gallium/drivers/etnaviv/etnaviv_shader.c 
b/src/gallium/drivers/etnaviv/etnaviv_shader.c
index 04ababc801f..27c735b83bd 100644
--- a/src/gallium/drivers/etnaviv/etnaviv_shader.c
+++ b/src/gallium/drivers/etnaviv/etnaviv_shader.c
@@ -41,7 +41,7 @@ static bool etna_icache_upload_shader(struct etna_context 
*ctx, struct etna_shad
 {
if (v->bo)
   return true;
-   v->bo = etna_bo_new(ctx->screen->dev, v->code_size*4, 
DRM_ETNA_GEM_CACHE_UNCACHED);
+   v->bo = etna_bo_new(ctx->screen->dev, v->code_size*4, 
DRM_ETNA_GEM_CACHE_WC);
if (!v->bo)
   return false;
 
-- 
2.19.0
___
mesa-dev mailing list
mesa-dev@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/mesa-dev


[Mesa-dev] [PATCH] etnaviv: Make sure rs alignment checks match

2018-09-17 Thread Guido Günther
etna_resource_alloc and etna_resource_from_handle currently use different 
checks.
This leads to

   etna_resource_from_handle:492: target=2, format=PIPE_FORMAT_B8G8R8X8_UNORM, 
1080x1920x1, array_size=1, last_level=0, nr_samples=0, usage=0, bind=8000a, 
flags=0
   etna_resource_from_handle:541: BO stride 4320 is too small for RS engine 
width padding (4352, format PIPE_FORMAT_B8G8R8X8_UNORM)

since etna_resource_from_handle wants to be aligned to a 16 byte
boundary while the etna_resource_alloc does not.

Adjust the two checks by using a common function.

Broken by baff59ebf07a114f95ad66d1f54e4b1f409eebee

Signed-off-by: Guido Günther 
---
 .../drivers/etnaviv/etnaviv_resource.c| 19 +--
 1 file changed, 13 insertions(+), 6 deletions(-)

diff --git a/src/gallium/drivers/etnaviv/etnaviv_resource.c 
b/src/gallium/drivers/etnaviv/etnaviv_resource.c
index 7fd374ae23d..f18c6ec6bfc 100644
--- a/src/gallium/drivers/etnaviv/etnaviv_resource.c
+++ b/src/gallium/drivers/etnaviv/etnaviv_resource.c
@@ -176,6 +176,15 @@ setup_miptree(struct etna_resource *rsc, unsigned 
paddingX, unsigned paddingY,
return size;
 }
 
+/* Is rs alignment needed? */
+static bool is_rs_align(struct etna_screen *screen,
+const struct pipe_resource *tmpl)
+{
+   return screen->specs.use_blt ? false : (
+  VIV_FEATURE(screen, chipMinorFeatures1, TEXTURE_HALIGN) ||
+  !etna_resource_sampler_only(tmpl));
+}
+
 /* Create a new resource object, using the given template info */
 struct pipe_resource *
 etna_resource_alloc(struct pipe_screen *pscreen, unsigned layout,
@@ -217,11 +226,9 @@ etna_resource_alloc(struct pipe_screen *pscreen, unsigned 
layout,
* resolve engine's width.  If not, we must not align resources used
* only for textures. If this GPU uses the BLT engine, never do RS align.
*/
-  bool rs_align = screen->specs.use_blt ? false : (
- VIV_FEATURE(screen, chipMinorFeatures1, 
TEXTURE_HALIGN) ||
- !etna_resource_sampler_only(templat));
-  etna_layout_multiple(layout, screen->specs.pixel_pipes, rs_align, 
,
-   , );
+  etna_layout_multiple(layout, screen->specs.pixel_pipes,
+   is_rs_align (screen, templat),
+   , , );
   assert(paddingX && paddingY);
} else {
   /* Compressed textures are padded to their block size, but we don't have
@@ -519,7 +526,7 @@ etna_resource_from_handle(struct pipe_screen *pscreen,
/* Determine padding of the imported resource. */
unsigned paddingX = 0, paddingY = 0;
etna_layout_multiple(rsc->layout, screen->specs.pixel_pipes,
-VIV_FEATURE(screen, chipMinorFeatures1, 
TEXTURE_HALIGN),
+is_rs_align(screen, tmpl),
 , , >halign);
 
if (!screen->specs.use_blt)
-- 
2.18.0
___
mesa-dev mailing list
mesa-dev@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/mesa-dev


Re: [Mesa-dev] [PATCH 0/2] Introduce and use cap for MaxVertexAttribRelativeOffset.

2018-09-10 Thread Guido Günther
Hi,
On Thu, Sep 06, 2018 at 04:31:12PM +0200, mathias.froehl...@gmx.net wrote:
> From: Mathias Fröhlich 
> 
> Hi all,
> 
> The following two patches introduce a gallium capability
> to feed gl_constants::MaxVertexAttribRelativeOffset.
> Then adapt etnyviv to return what it can really handle.
> That prevents _mesa_update_vao_derived_arrays from collapsing
> too many attribute arrays into a single binding which is a
> problem for etnaviv.

Thanks. This resolves the issue reported in

https://lists.freedesktop.org/archives/mesa-dev/2018-August/204104.html

on etnaviv (GC7000) for me.
 -- Guido

> 
> Please review!
> best
> Mathias
> 
> 
> Mathias Fröhlich (2):
>   gallium: New cap PIPE_CAP_MAX_VERTEX_ELEMENT_SRC_OFFSET.
>   etnaviv: Reduce max offset to available hardware bits.
> 
>  src/gallium/auxiliary/util/u_screen.c| 3 +++
>  src/gallium/docs/source/screen.rst   | 3 +++
>  src/gallium/drivers/etnaviv/etnaviv_screen.c | 2 ++
>  src/gallium/include/pipe/p_defines.h | 1 +
>  src/mesa/state_tracker/st_extensions.c   | 6 ++
>  5 files changed, 15 insertions(+)
> 
> -- 
> 2.17.1
> 
___
mesa-dev mailing list
mesa-dev@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/mesa-dev


Re: [Mesa-dev] [PATCH 2/2] etnaviv: Reduce max offset to available hardware bits.

2018-09-10 Thread Guido Günther
Hi,
On Thu, Sep 06, 2018 at 04:31:14PM +0200, mathias.froehl...@gmx.net wrote:
> From: Mathias Fröhlich 
> 
> Signed-off-by: Mathias Fröhlich 

I know it's pushed already but for the record (Just came back form vacation):

Tested-By: Guido Gúnther 

> ---
>  src/gallium/drivers/etnaviv/etnaviv_screen.c | 2 ++
>  1 file changed, 2 insertions(+)
> 
> diff --git a/src/gallium/drivers/etnaviv/etnaviv_screen.c 
> b/src/gallium/drivers/etnaviv/etnaviv_screen.c
> index 9ddba62855..0081f9a173 100644
> --- a/src/gallium/drivers/etnaviv/etnaviv_screen.c
> +++ b/src/gallium/drivers/etnaviv/etnaviv_screen.c
> @@ -308,6 +308,8 @@ etna_screen_get_param(struct pipe_screen *pscreen, enum 
> pipe_cap param)
>  
> case PIPE_CAP_MAX_VERTEX_ATTRIB_STRIDE:
>return 128;
> +   case PIPE_CAP_MAX_VERTEX_ELEMENT_SRC_OFFSET:
> +  return 255;
>  
> /* Texturing. */
> case PIPE_CAP_MAX_TEXTURE_2D_LEVELS:
> -- 
> 2.17.1
> 
___
mesa-dev mailing list
mesa-dev@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/mesa-dev


Re: [Mesa-dev] Etnaviv on mesa master vs. Array._DrawVAO

2018-09-01 Thread Guido Günther
Hi,
On Sat, Sep 01, 2018 at 09:07:46AM +0200, Mathias Fröhlich wrote:
> Hi,
> 
> On Friday, 31 August 2018 12:40:01 CEST Guido Günther wrote:
> > Hi,
> > I'm looking into forward porting laanwj's patches for GC7000 support to
> > current mesa master. Luckily most of it already got merged last November
> > with mostly only the texture descriptor support missing(
> > https://github.com/laanwj/mesa/commit/b71802207432543745dff471c68fbc40495b48
> > 58)
> > 
> > Putting this on current master leads to this assertion in mesa when running
> > kmscube like:
> > 
> > kmscube: ../src/gallium/drivers/etnaviv/etnaviv_state.c:536:
> > etna_vertex_elements_state_create: Assertion `element_size != 0 &&
> > end_offset <= 256' failed.
> > 
> > Printing the value there gives:
> > 
> > etna_vertex_elements_state_create:535: size: 12, offset: 0, end_offset:
> > 12 etna_vertex_elements_state_create:535: size: 12, offset: 576,
> > end_offset: 588
> > 
> > And the bt is:
> > 
> >Stack trace of thread 2158:
> >#0  0xa93427c0 raise (libc.so.6)
> >#1  0xa934274c raise (libc.so.6)
> >#2  0xa9343bac abort (libc.so.6)
> >#3  0xa933bd2c n/a (libc.so.6)
> >#4  0xa933bdac __assert_fail (libc.so.6)
> >#5  0xa8de468c etna_vertex_elements_state_create
> > (imx-drm_dri.so) #6  0xa8757178 u_vbuf_set_vertex_elements_internal
> > (imx-drm_dri.so) #7  0xa875726c u_vbuf_set_vertex_elements
> > (imx-drm_dri.so) #8  0xa8711bcc cso_set_vertex_elements
> > (imx-drm_dri.so) #9  0xa8b28760 set_vertex_attribs (imx-drm_dri.so)
> >#10 0xa8b28c9c st_update_array (imx-drm_dri.so)
> >#11 0xa8ad4e44 st_validate_state (imx-drm_dri.so)
> >#12 0xa8a1e410 prepare_draw (imx-drm_dri.so)
> >#13 0xa8a1e488 st_draw_vbo (imx-drm_dri.so)
> >#14 0xa8a0ea9c vbo_draw_arrays (imx-drm_dri.so)
> >#15 0xa8a0f408 vbo_exec_DrawArrays (imx-drm_dri.so)
> >#16 0xa953f7e0 glDrawArrays (libGLESv2.so.2)
> >#17 0xd7e62ea0 draw_cube_smooth (kmscube)
> >#18 0xd7e64160 atomic_run (kmscube)
> >#19 0xa93306e0 __libc_start_main (libc.so.6)
> >#20 0xd7e621fc $x (kmscube)
> >#21 0xd7e621fc $x (kmscube)
> > 
> > I've traced this back to this commit:
> > 
> > 19a91841c347107d877bc750371c5fa4e9b4de19 is the first bad commit
> > commit 19a91841c347107d877bc750371c5fa4e9b4de19
> > Author: Mathias Fröhlich 
> > Date:   Sun Apr 1 20:18:36 2018 +0200
> > 
> > st/mesa: Use Array._DrawVAO in st_atom_array.c.
> > 
> > Finally make use of the binding information in the VAO when
> > setting up arrays for draw.
> > 
> > v2: Emit less relocations also for interleaved userspace arrays.
> > 
> > Reviewed-by: Brian Paul 
> > Signed-off-by: Mathias Fröhlich 
> > 
> > And indeed commits prior to that one work as expected. Any hints what
> > would be the right fix to not trigger the assert?
> 
> 
> Introduce a gallium cap and feed ctx->Const.MaxVertexAttribRelativeOffset 
> with 
> the value that limits the actual hardware.
> 
> I have something prepared for that but did not get any response for a some 
> preparation patch so put that issue somehow down on my list.
> The point for today is, is that my development system is down, means I can 
> prepare this once this machine is back up hopefully by the beginning of this 
> week.
> Else feel free to just introduce that cap.

I will be away from the hw for the next week but I'm happy to cook up a
patch and test it afterwards.
Cheers,
 -- Guido
___
mesa-dev mailing list
mesa-dev@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/mesa-dev


[Mesa-dev] Etnaviv on mesa master vs. Array._DrawVAO

2018-08-31 Thread Guido Günther
Hi,
I'm looking into forward porting laanwj's patches for GC7000 support to
current mesa master. Luckily most of it already got merged last November
with mostly only the texture descriptor support missing(
https://github.com/laanwj/mesa/commit/b71802207432543745dff471c68fbc40495b4858)

Putting this on current master leads to this assertion in mesa when running 
kmscube like:

kmscube: ../src/gallium/drivers/etnaviv/etnaviv_state.c:536: 
etna_vertex_elements_state_create: Assertion `element_size != 0 && end_offset 
<= 256' failed.

Printing the value there gives:

etna_vertex_elements_state_create:535: size: 12, offset: 0, end_offset: 12
etna_vertex_elements_state_create:535: size: 12, offset: 576, end_offset: 
588

And the bt is:

   Stack trace of thread 2158:
   #0  0xa93427c0 raise (libc.so.6)
   #1  0xa934274c raise (libc.so.6)
   #2  0xa9343bac abort (libc.so.6)
   #3  0xa933bd2c n/a (libc.so.6)
   #4  0xa933bdac __assert_fail (libc.so.6)
   #5  0xa8de468c etna_vertex_elements_state_create (imx-drm_dri.so)
   #6  0xa8757178 u_vbuf_set_vertex_elements_internal 
(imx-drm_dri.so)
   #7  0xa875726c u_vbuf_set_vertex_elements (imx-drm_dri.so)
   #8  0xa8711bcc cso_set_vertex_elements (imx-drm_dri.so)
   #9  0xa8b28760 set_vertex_attribs (imx-drm_dri.so)
   #10 0xa8b28c9c st_update_array (imx-drm_dri.so)
   #11 0xa8ad4e44 st_validate_state (imx-drm_dri.so)
   #12 0xa8a1e410 prepare_draw (imx-drm_dri.so)
   #13 0xa8a1e488 st_draw_vbo (imx-drm_dri.so)
   #14 0xa8a0ea9c vbo_draw_arrays (imx-drm_dri.so)
   #15 0xa8a0f408 vbo_exec_DrawArrays (imx-drm_dri.so)
   #16 0xa953f7e0 glDrawArrays (libGLESv2.so.2)
   #17 0xd7e62ea0 draw_cube_smooth (kmscube)
   #18 0xd7e64160 atomic_run (kmscube)
   #19 0xa93306e0 __libc_start_main (libc.so.6)
   #20 0xd7e621fc $x (kmscube)
   #21 0xd7e621fc $x (kmscube)

I've traced this back to this commit:

19a91841c347107d877bc750371c5fa4e9b4de19 is the first bad commit
commit 19a91841c347107d877bc750371c5fa4e9b4de19
Author: Mathias Fröhlich 
Date:   Sun Apr 1 20:18:36 2018 +0200

st/mesa: Use Array._DrawVAO in st_atom_array.c.

Finally make use of the binding information in the VAO when
setting up arrays for draw.

v2: Emit less relocations also for interleaved userspace arrays.

Reviewed-by: Brian Paul 
Signed-off-by: Mathias Fröhlich 

And indeed commits prior to that one work as expected. Any hints what
would be the right fix to not trigger the assert?

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


Re: [Mesa-dev] [PATCH 1/2] meson: Be a bit more helpful when arch or OS is unknown

2018-08-27 Thread Guido Günther
Hi,
On Mon, Aug 27, 2018 at 09:23:44AM -0700, Dylan Baker wrote:
> Quoting Guido Günther (2018-08-26 13:23:59)
> > V2: Add one missing @0@
> > 
> > Signed-off-by: Guido Günther 
> > ---
> >  meson.build | 21 ++---
> >  1 file changed, 14 insertions(+), 7 deletions(-)
> > 
> > diff --git a/meson.build b/meson.build
> > index 1b3dfa221c9..c3a7e8cdd74 100644
> > --- a/meson.build
> > +++ b/meson.build
> > @@ -102,13 +102,15 @@ if _drivers.contains('auto')
> >  elif ['arm', 'aarch64'].contains(host_machine.cpu_family())
> >_drivers = []
> >  else
> > -  error('Unknown architecture. Please pass -Ddri-drivers to set driver 
> > options. Patches gladly accepted to fix this.')
> > +  error('Unknown architecture @0@. Please pass -Ddri-drivers to set 
> > driver options. Patches gladly accepted to fix this.'.format(
> > +host_machine.cpu_family()))
> >  endif
> >elif ['darwin', 'windows', 'cygwin', 
> > 'haiku'].contains(host_machine.system())
> >  # only swrast would make sense here, but gallium swrast is a much 
> > better default
> >  _drivers = []
> >else
> > -error('Unknown OS. Please pass -Ddri-drivers to set driver options. 
> > Patches gladly accepted to fix this.')
> > +error('Unknown OS @0@. Please pass -Ddri-drivers to set driver 
> > options. Patches gladly accepted to fix this.'.format(
> > +  host_machine.system()))
> >endif
> >  endif
> >  
> > @@ -135,12 +137,14 @@ if _drivers.contains('auto')
> >  'tegra', 'virgl', 'swrast',
> >]
> >  else
> > -  error('Unknown architecture. Please pass -Dgallium-drivers to set 
> > driver options. Patches gladly accepted to fix this.')
> > +  error('Unknown architecture @0@. Please pass -Dgallium-drivers to 
> > set driver options. Patches gladly accepted to fix this.'.format(
> > +host_machine.cpu_family()))
> >  endif
> >elif ['darwin', 'windows', 'cygwin', 
> > 'haiku'].contains(host_machine.system())
> >  _drivers = ['swrast']
> >else
> > -error('Unknown OS. Please pass -Dgallium-drivers to set driver 
> > options. Patches gladly accepted to fix this.')
> > +error('Unknown OS @0@. Please pass -Dgallium-drivers to set driver 
> > options. Patches gladly accepted to fix this.'.format(
> > +  host_machine.system()))
> >endif
> >  endif
> >  with_gallium_pl111 = _drivers.contains('pl111')
> > @@ -176,13 +180,15 @@ if _vulkan_drivers.contains('auto')
> >  if host_machine.cpu_family().startswith('x86')
> >_vulkan_drivers = ['amd', 'intel']
> >  else
> > -  error('Unknown architecture. Please pass -Dvulkan-drivers to set 
> > driver options. Patches gladly accepted to fix this.')
> > +  error('Unknown architecture @0@. Please pass -Dvulkan-drivers to set 
> > driver options. Patches gladly accepted to fix this.'.format(
> > +host_machine.cpu_family()))
> >  endif
> >elif ['darwin', 'windows', 'cygwin', 
> > 'haiku'].contains(host_machine.system())
> >  # No vulkan driver supports windows or macOS currently
> >  _vulkan_drivers = []
> >else
> > -error('Unknown OS. Please pass -Dvulkan-drivers to set driver options. 
> > Patches gladly accepted to fix this.')
> > +error('Unknown OS @0@. Please pass -Dvulkan-drivers to set driver 
> > options. Patches gladly accepted to fix this.'.format(
> > +  host_machine.system()))
> >endif
> >  endif
> >  
> > @@ -230,7 +236,8 @@ if _platforms.contains('auto')
> >elif ['haiku'].contains(host_machine.system())
> >  _platforms = ['haiku']
> >else
> > -error('Unknown OS. Please pass -Dplatforms to set platforms. Patches 
> > gladly accepted to fix this.')
> > +error('Unknown OS @0@. Please pass -Dplatforms to set platforms. 
> > Patches gladly accepted to fix this.'.format(
> > +  host_machine.system()))
> >endif
> >  endif
> >  
> > -- 
> > 2.18.0
> > 
> 
> for the series,
> Reviewed-by: Dylan Baker 

Thanks!

> 
> Do you need me to push these for you?

Yes, please.
 -- Guido


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


[Mesa-dev] [PATCH 1/2] meson: Be a bit more helpful when arch or OS is unknown

2018-08-26 Thread Guido Günther
V2: Add one missing @0@

Signed-off-by: Guido Günther 
---
 meson.build | 21 ++---
 1 file changed, 14 insertions(+), 7 deletions(-)

diff --git a/meson.build b/meson.build
index 1b3dfa221c9..c3a7e8cdd74 100644
--- a/meson.build
+++ b/meson.build
@@ -102,13 +102,15 @@ if _drivers.contains('auto')
 elif ['arm', 'aarch64'].contains(host_machine.cpu_family())
   _drivers = []
 else
-  error('Unknown architecture. Please pass -Ddri-drivers to set driver 
options. Patches gladly accepted to fix this.')
+  error('Unknown architecture @0@. Please pass -Ddri-drivers to set driver 
options. Patches gladly accepted to fix this.'.format(
+host_machine.cpu_family()))
 endif
   elif ['darwin', 'windows', 'cygwin', 'haiku'].contains(host_machine.system())
 # only swrast would make sense here, but gallium swrast is a much better 
default
 _drivers = []
   else
-error('Unknown OS. Please pass -Ddri-drivers to set driver options. 
Patches gladly accepted to fix this.')
+error('Unknown OS @0@. Please pass -Ddri-drivers to set driver options. 
Patches gladly accepted to fix this.'.format(
+  host_machine.system()))
   endif
 endif
 
@@ -135,12 +137,14 @@ if _drivers.contains('auto')
 'tegra', 'virgl', 'swrast',
   ]
 else
-  error('Unknown architecture. Please pass -Dgallium-drivers to set driver 
options. Patches gladly accepted to fix this.')
+  error('Unknown architecture @0@. Please pass -Dgallium-drivers to set 
driver options. Patches gladly accepted to fix this.'.format(
+host_machine.cpu_family()))
 endif
   elif ['darwin', 'windows', 'cygwin', 'haiku'].contains(host_machine.system())
 _drivers = ['swrast']
   else
-error('Unknown OS. Please pass -Dgallium-drivers to set driver options. 
Patches gladly accepted to fix this.')
+error('Unknown OS @0@. Please pass -Dgallium-drivers to set driver 
options. Patches gladly accepted to fix this.'.format(
+  host_machine.system()))
   endif
 endif
 with_gallium_pl111 = _drivers.contains('pl111')
@@ -176,13 +180,15 @@ if _vulkan_drivers.contains('auto')
 if host_machine.cpu_family().startswith('x86')
   _vulkan_drivers = ['amd', 'intel']
 else
-  error('Unknown architecture. Please pass -Dvulkan-drivers to set driver 
options. Patches gladly accepted to fix this.')
+  error('Unknown architecture @0@. Please pass -Dvulkan-drivers to set 
driver options. Patches gladly accepted to fix this.'.format(
+host_machine.cpu_family()))
 endif
   elif ['darwin', 'windows', 'cygwin', 'haiku'].contains(host_machine.system())
 # No vulkan driver supports windows or macOS currently
 _vulkan_drivers = []
   else
-error('Unknown OS. Please pass -Dvulkan-drivers to set driver options. 
Patches gladly accepted to fix this.')
+error('Unknown OS @0@. Please pass -Dvulkan-drivers to set driver options. 
Patches gladly accepted to fix this.'.format(
+  host_machine.system()))
   endif
 endif
 
@@ -230,7 +236,8 @@ if _platforms.contains('auto')
   elif ['haiku'].contains(host_machine.system())
 _platforms = ['haiku']
   else
-error('Unknown OS. Please pass -Dplatforms to set platforms. Patches 
gladly accepted to fix this.')
+error('Unknown OS @0@. Please pass -Dplatforms to set platforms. Patches 
gladly accepted to fix this.'.format(
+  host_machine.system()))
   endif
 endif
 
-- 
2.18.0

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


[Mesa-dev] [PATCH 2/2] meson: Don't enable any vulkan drivers on arm, aarch64

2018-08-26 Thread Guido Günther
There's no Vulkan support for arm atm.

Signed-off-by: Guido Günther 
---
 meson.build | 2 ++
 1 file changed, 2 insertions(+)

diff --git a/meson.build b/meson.build
index c3a7e8cdd74..7f6f128e0b2 100644
--- a/meson.build
+++ b/meson.build
@@ -179,6 +179,8 @@ if _vulkan_drivers.contains('auto')
   if system_has_kms_drm
 if host_machine.cpu_family().startswith('x86')
   _vulkan_drivers = ['amd', 'intel']
+elif ['arm', 'aarch64'].contains(host_machine.cpu_family())
+  _vulkan_drivers = []
 else
   error('Unknown architecture @0@. Please pass -Dvulkan-drivers to set 
driver options. Patches gladly accepted to fix this.'.format(
 host_machine.cpu_family()))
-- 
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] meson: Be a bit more helpful when arch or OS is unknown

2018-08-26 Thread Guido Günther
Hi,
On Sat, Aug 25, 2018 at 05:18:33PM +1000, Stuart Young wrote:
>On Fri, 24 Aug 2018 at 22:23, Guido Günther <[1]a...@sigxcpu.org> wrote:
> 
>  @@ -230,7 +236,8 @@ if _platforms.contains('auto')
>     elif ['haiku'].contains(host_machine.system())
>       _platforms = ['haiku']
>     else
>  -    error('Unknown OS. Please pass -Dplatforms to set platforms.
>  Patches gladly accepted to fix this.')
>  +    error('Unknown OS. Please pass -Dplatforms to set platforms.
>  Patches gladly accepted to fix this.'.format(
>  +          host_machine.system()))
>     endif
>   endif
> 
>Did you mean that last "Unknown OS." to be "Unknown OS @0@." like all the
>others?

Thanks for catching this, I'll send out a fixed version.
 -- Guido
___
mesa-dev mailing list
mesa-dev@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/mesa-dev


Re: [Mesa-dev] [PATCH 2/2] meson: Enable readeon vulkan driver on arm, aarch64

2018-08-26 Thread Guido Günther
Hi,
On Sun, Aug 26, 2018 at 10:15:38AM -0700, Dylan Baker wrote:
> Quoting Guido Günther (2018-08-24 05:22:06)
> > This is similar to what the Debian package does so it looks like a sane
> > default.
> > 
> > Signed-off-by: Guido Günther 
> > ---
> >  meson.build | 2 ++
> >  1 file changed, 2 insertions(+)
> > 
> > diff --git a/meson.build b/meson.build
> > index ccc0ed6a0ea..bf8f0770915 100644
> > --- a/meson.build
> > +++ b/meson.build
> > @@ -179,6 +179,8 @@ if _vulkan_drivers.contains('auto')
> >if system_has_kms_drm
> >  if host_machine.cpu_family().startswith('x86')
> >_vulkan_drivers = ['amd', 'intel']
> > +elif ['arm', 'aarch64'].contains(host_machine.cpu_family())
> > +  _vulkan_drivers = ['amd']
> 
> This seems odd to me since we don't build either r600 or radeonsi for arm.

Good point! I'm fine with building no vulkan drivers at all on arm by
default. The main point of this patch is to have good defaults.
 -- Guido
___
mesa-dev mailing list
mesa-dev@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/mesa-dev


[Mesa-dev] [PATCH 2/2] meson: Enable readeon vulkan driver on arm, aarch64

2018-08-24 Thread Guido Günther
This is similar to what the Debian package does so it looks like a sane
default.

Signed-off-by: Guido Günther 
---
 meson.build | 2 ++
 1 file changed, 2 insertions(+)

diff --git a/meson.build b/meson.build
index ccc0ed6a0ea..bf8f0770915 100644
--- a/meson.build
+++ b/meson.build
@@ -179,6 +179,8 @@ if _vulkan_drivers.contains('auto')
   if system_has_kms_drm
 if host_machine.cpu_family().startswith('x86')
   _vulkan_drivers = ['amd', 'intel']
+elif ['arm', 'aarch64'].contains(host_machine.cpu_family())
+  _vulkan_drivers = ['amd']
 else
   error('Unknown architecture @0@. Please pass -Dvulkan-drivers to set 
driver options. Patches gladly accepted to fix this.'.format(
 host_machine.cpu_family()))
-- 
2.18.0

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


[Mesa-dev] [PATCH 1/2] meson: Be a bit more helpful when arch or OS is unknown

2018-08-24 Thread Guido Günther
Signed-off-by: Guido Günther 
---
 meson.build | 21 ++---
 1 file changed, 14 insertions(+), 7 deletions(-)

diff --git a/meson.build b/meson.build
index 1b3dfa221c9..ccc0ed6a0ea 100644
--- a/meson.build
+++ b/meson.build
@@ -102,13 +102,15 @@ if _drivers.contains('auto')
 elif ['arm', 'aarch64'].contains(host_machine.cpu_family())
   _drivers = []
 else
-  error('Unknown architecture. Please pass -Ddri-drivers to set driver 
options. Patches gladly accepted to fix this.')
+  error('Unknown architecture @0@. Please pass -Ddri-drivers to set driver 
options. Patches gladly accepted to fix this.'.format(
+host_machine.cpu_family()))
 endif
   elif ['darwin', 'windows', 'cygwin', 'haiku'].contains(host_machine.system())
 # only swrast would make sense here, but gallium swrast is a much better 
default
 _drivers = []
   else
-error('Unknown OS. Please pass -Ddri-drivers to set driver options. 
Patches gladly accepted to fix this.')
+error('Unknown OS @0@. Please pass -Ddri-drivers to set driver options. 
Patches gladly accepted to fix this.'.format(
+  host_machine.system()))
   endif
 endif
 
@@ -135,12 +137,14 @@ if _drivers.contains('auto')
 'tegra', 'virgl', 'swrast',
   ]
 else
-  error('Unknown architecture. Please pass -Dgallium-drivers to set driver 
options. Patches gladly accepted to fix this.')
+  error('Unknown architecture @0@. Please pass -Dgallium-drivers to set 
driver options. Patches gladly accepted to fix this.'.format(
+host_machine.cpu_family()))
 endif
   elif ['darwin', 'windows', 'cygwin', 'haiku'].contains(host_machine.system())
 _drivers = ['swrast']
   else
-error('Unknown OS. Please pass -Dgallium-drivers to set driver options. 
Patches gladly accepted to fix this.')
+error('Unknown OS @0@. Please pass -Dgallium-drivers to set driver 
options. Patches gladly accepted to fix this.'.format(
+  host_machine.system()))
   endif
 endif
 with_gallium_pl111 = _drivers.contains('pl111')
@@ -176,13 +180,15 @@ if _vulkan_drivers.contains('auto')
 if host_machine.cpu_family().startswith('x86')
   _vulkan_drivers = ['amd', 'intel']
 else
-  error('Unknown architecture. Please pass -Dvulkan-drivers to set driver 
options. Patches gladly accepted to fix this.')
+  error('Unknown architecture @0@. Please pass -Dvulkan-drivers to set 
driver options. Patches gladly accepted to fix this.'.format(
+host_machine.cpu_family()))
 endif
   elif ['darwin', 'windows', 'cygwin', 'haiku'].contains(host_machine.system())
 # No vulkan driver supports windows or macOS currently
 _vulkan_drivers = []
   else
-error('Unknown OS. Please pass -Dvulkan-drivers to set driver options. 
Patches gladly accepted to fix this.')
+error('Unknown OS @0@. Please pass -Dvulkan-drivers to set driver options. 
Patches gladly accepted to fix this.'.format(
+  host_machine.system()))
   endif
 endif
 
@@ -230,7 +236,8 @@ if _platforms.contains('auto')
   elif ['haiku'].contains(host_machine.system())
 _platforms = ['haiku']
   else
-error('Unknown OS. Please pass -Dplatforms to set platforms. Patches 
gladly accepted to fix this.')
+error('Unknown OS. Please pass -Dplatforms to set platforms. Patches 
gladly accepted to fix this.'.format(
+  host_machine.system()))
   endif
 endif
 
-- 
2.18.0

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