Re: [Mesa-dev] [PATCH 5/6] ddebug: opt-out non UNIX code

2018-08-02 Thread Andres Gomez
On Wed, 2018-08-01 at 15:31 -0700, Dylan Baker wrote:
> I pushed a patch earlier that *should* make mkdir and getpid work with msvc

Thanks for the heads up. I'll drop this patch, then.

> 
> Dylan
> 
> Quoting Andres Gomez (2018-08-01 11:53:04)
> > Opt-out the code using mkdir() and getpid() which are spitting
> > warnings in the MSVC build:
> > 
> >   Compiling src\gallium\auxiliary\driver_ddebug\dd_draw.c ...
> > dd_draw.c
> > c:\projects\mesa\src\gallium\auxiliary\driver_ddebug\dd_util.h(62): warning 
> > C4013: 'mkdir' undefined; assuming extern returning int
> > c:\projects\mesa\src\gallium\auxiliary\driver_ddebug\dd_util.h(65): warning 
> > C4013: 'getpid' undefined; assuming extern returning int
> > 
> > Fixes: 6ff0c6f4ebc ("gallium: move ddebug, noop, rbug, trace to auxiliary 
> > to improve build times")
> > Cc: Marek Olšák 
> > Cc: Brian Paul 
> > Cc: Roland Scheidegger 
> > Cc: Nicolai Hähnle 
> > Signed-off-by: Andres Gomez 
> > ---
> >  src/gallium/auxiliary/driver_ddebug/dd_util.h | 4 
> >  1 file changed, 4 insertions(+)
> > 
> > diff --git a/src/gallium/auxiliary/driver_ddebug/dd_util.h 
> > b/src/gallium/auxiliary/driver_ddebug/dd_util.h
> > index 7720e9af9ca..681627c83cb 100644
> > --- a/src/gallium/auxiliary/driver_ddebug/dd_util.h
> > +++ b/src/gallium/auxiliary/driver_ddebug/dd_util.h
> > @@ -60,11 +60,15 @@ dd_get_debug_filename_and_mkdir(char *buf, size_t 
> > buflen, bool verbose)
> >  
> > util_snprintf(dir, sizeof(dir), "%s/"DD_DIR, debug_get_option("HOME", 
> > "."));
> >  
> > +#ifdef PIPE_OS_UNIX
> > if (mkdir(dir, 0774) && errno != EEXIST)
> >fprintf(stderr, "dd: can't create a directory (%i)\n", errno);
> >  
> > util_snprintf(buf, buflen, "%s/%s_%u_%08u", dir, proc_name, getpid(),
> >   p_atomic_inc_return(&index) - 1);
> > +#else
> > +   fprintf(stderr, "dd: can't create a directory (%i)\n", errno);
> > +#endif
> >  
> > if (verbose)
> >fprintf(stderr, "dd: dumping to file %s\n", buf);
> > -- 
> > 2.18.0
> > 
> > ___
> > mesa-dev mailing list
> > mesa-dev@lists.freedesktop.org
> > https://lists.freedesktop.org/mailman/listinfo/mesa-dev
-- 
Br,

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


[Mesa-dev] [PATCH] docs/features: update vulkan 1.1 status

2018-08-02 Thread Fabio Pedretti
---
 docs/features.txt | 46 +++---
 1 file changed, 23 insertions(+), 23 deletions(-)

diff --git a/docs/features.txt b/docs/features.txt
index 46e5a25a75..1225042580 100644
--- a/docs/features.txt
+++ b/docs/features.txt
@@ -356,29 +356,29 @@ Vulkan 1.0 -- all DONE: anv, radv
 
 Vulkan 1.1 -- all DONE: anv, radv
 
-  VK_KHR_16bit_storage  in progress (Alejandro)
-  VK_KHR_bind_memory2   DONE (anv, radv)
-  VK_KHR_dedicated_allocation   DONE (anv, radv)
-  VK_KHR_descriptor_update_template DONE (anv, radv)
-  VK_KHR_device_group   not started
-  VK_KHR_device_group_creation  not started
-  VK_KHR_external_fence DONE (anv, radv)
-  VK_KHR_external_fence_capabilitiesDONE (anv, radv)
-  VK_KHR_external_memoryDONE (anv, radv)
-  VK_KHR_external_memory_capabilities   DONE (anv, radv)
-  VK_KHR_external_semaphore DONE (anv, radv)
-  VK_KHR_external_semaphore_capabilitiesDONE (anv, radv)
-  VK_KHR_get_memory_requirements2   DONE (anv, radv)
-  VK_KHR_get_physical_device_properties2DONE (anv, radv)
-  VK_KHR_maintenance1   DONE (anv, radv)
-  VK_KHR_maintenance2   DONE (anv, radv)
-  VK_KHR_maintenance3   DONE (anv, radv)
-  VK_KHR_multiview  DONE (anv, radv)
-  VK_KHR_relaxed_block_layout   DONE (anv, radv)
-  VK_KHR_sampler_ycbcr_conversion   DONE (anv)
-  VK_KHR_shader_draw_parameters DONE (anv, radv)
-  VK_KHR_storage_buffer_storage_class   DONE (anv, radv)
-  VK_KHR_variable_pointers  DONE (anv, radv)
+  VK_KHR_16bit_storage  DONE ()
+  VK_KHR_bind_memory2   DONE ()
+  VK_KHR_dedicated_allocation   DONE ()
+  VK_KHR_descriptor_update_template DONE ()
+  VK_KHR_device_group   DONE ()
+  VK_KHR_device_group_creation  DONE ()
+  VK_KHR_external_fence DONE ()
+  VK_KHR_external_fence_capabilitiesDONE ()
+  VK_KHR_external_memoryDONE ()
+  VK_KHR_external_memory_capabilities   DONE ()
+  VK_KHR_external_semaphore DONE ()
+  VK_KHR_external_semaphore_capabilitiesDONE ()
+  VK_KHR_get_memory_requirements2   DONE ()
+  VK_KHR_get_physical_device_properties2DONE ()
+  VK_KHR_maintenance1   DONE ()
+  VK_KHR_maintenance2   DONE ()
+  VK_KHR_maintenance3   DONE ()
+  VK_KHR_multiview  DONE ()
+  VK_KHR_relaxed_block_layout   DONE ()
+  VK_KHR_sampler_ycbcr_conversion   DONE ()
+  VK_KHR_shader_draw_parameters DONE ()
+  VK_KHR_storage_buffer_storage_class   DONE ()
+  VK_KHR_variable_pointers  DONE ()
 
 Khronos extensions that are not part of any Vulkan version:
   VK_KHR_8bit_storage   DONE (anv)
-- 
2.17.1

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


Re: [Mesa-dev] [PATCH] glx: Add checks for context being direct before calling GetGLXDRIDrawable

2018-08-02 Thread Danylo Piliaiev



On 01.08.18 19:42, Adam Jackson wrote:

On Wed, 2018-08-01 at 17:15 +0300, Danylo Piliaiev wrote:

If indirect context is explicitly created by application and not
with LIBGL_ALWAYS_INDIRECT=1 then dri may be initialized in
__glXInitialize which allows Mesa to take invalid code paths
due to GetGLXDRIDrawable returning non-null value.

This doesn't make any sense. Initializing DRI doesn't add any GLX
drawables to the hash, unless something deeply insane is going on.
Ok, I see, since my patch seems to be inherently wrong I'll better 
explain what I have found and ask for advice:


The initial issue is the crash in glXSwapBuffers with indirect context, 
there GetGLXDRIDrawable returns
a non-null drawable then driScreen->swapBuffers is called then deep down 
draw->vtable->get_dri_context(draw)

is called which a pointer to glx_dri3_get_dri_context and does such cast:

struct dri3_context *pcp = (struct dri3_context *) gc;

But the context isn't dri3_context.

So why GetGLXDRIDrawable return something that is not null?

When we call glXCreateWindow:
#0 CreateDRIDrawable () at glx_pbuffer.c:209
#1 CreateDrawable () at glx_pbuffer.c:492
#2 glXCreateWindow () at glx_pbuffer.c:967

And since driScreen was created before - driScreen->createDrawable is 
called and succeeds. Now we have dri drawable in hashmap.

So later GetGLXDRIDrawable would return valid drawable.

The creation of drawable happens before we know that context will be 
indirect. Should it be deleted when indirect context is created?

Or something else? I don't know.

In most such places there are already checks for context being
direct before calling GetGLXDRIDrawable. This patch adds checks
where they were missed.

These checks are pretty much all wrong. Whether a drawable has direct
context state is orthogonal to whether the current context is direct,
you could have two contexts with different directness.


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

Signed-off-by: Danylo Piliaiev 
---
  src/glx/glx_pbuffer.c | 12 ++--
  src/glx/glxcmds.c |  3 +++
  2 files changed, 13 insertions(+), 2 deletions(-)

diff --git a/src/glx/glx_pbuffer.c b/src/glx/glx_pbuffer.c
index fd3327f120..6ee2ed58d2 100644
--- a/src/glx/glx_pbuffer.c
+++ b/src/glx/glx_pbuffer.c
@@ -133,6 +133,10 @@ ChangeDrawableAttribute(Display * dpy, GLXDrawable 
drawable,
 SyncHandle();
  
  #ifdef GLX_DIRECT_RENDERING

+   struct glx_context *gc = __glXGetCurrentContext();
+   if (!gc->isDirect)
+  return;
+

This is saying "if the current context is direct, then refuse to tell
the server that we want to change this drawable", which can't be right.


@@ -316,7 +320,11 @@ __glXGetDrawableAttribute(Display * dpy, GLXDrawable 
drawable,
return 0;
  
  #if defined(GLX_DIRECT_RENDERING) && !defined(GLX_USE_APPLEGL)

-   pdraw = GetGLXDRIDrawable(dpy, drawable);
+   struct glx_context *gc = __glXGetCurrentContext();
+
+   if (gc->isDirect) {
+  pdraw = GetGLXDRIDrawable(dpy, drawable);
+   }

Again, whether the drawable has DRI state attached to it is not a
property of the current context.

I don't see how the existing code would be wrong to begin with. Even if
__glXInitialize does set up DRI state on the screen, it's not going to
add any drawables to the hash table, so this should still hit the pdraw
== NULL case below it safely.


 if (attribute == GLX_BACK_BUFFER_AGE_EXT) {
struct glx_context *gc = __glXGetCurrentContext();
diff --git a/src/glx/glxcmds.c b/src/glx/glxcmds.c
index 4db0228eab..3eb86b02a9 100644
--- a/src/glx/glxcmds.c
+++ b/src/glx/glxcmds.c
@@ -799,6 +799,8 @@ glXDestroyGLXPixmap(Display * dpy, GLXPixmap glxpixmap)
 DestroyGLXDrawable(dpy, glxpixmap);
  
  #if defined(GLX_DIRECT_RENDERING) && !defined(GLX_USE_APPLEGL)

+   struct glx_context *gc = __glXGetCurrentContext();
+   if (gc->isDirect)
 {
struct glx_display *const priv = __glXInitialize(dpy);
__GLXDRIdrawable *pdraw = GetGLXDRIDrawable(dpy, glxpixmap);

I believe this would introduce a leak case. If your current context is
indirect, and you glXDestroyGLXPixmap() on a pixmap with DRI state,
you'll never free that DRI state.


@@ -831,6 +833,7 @@ glXSwapBuffers(Display * dpy, GLXDrawable drawable)
 gc = __glXGetCurrentContext();
  
  #if defined(GLX_DIRECT_RENDERING) && !defined(GLX_USE_APPLEGL)

+   if (gc->isDirect)
 {
__GLXDRIdrawable *pdraw = GetGLXDRIDrawable(dpy, drawable);
  

The real problem here, I think, is that we need to store what kind of
DRI a given DRI drawable is, and look up its SwapBuffer method based on
that. Instead we just have one method for the whole screen, so if the
screen happens to support DRI3 and DRISW...
Maybe it's another issue. In this case pdraw is dri3 drawable so the 
correct SwapBuffer method

is called.

- ajax


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


[Mesa-dev] [PATCH] egl/wayland: do not leak wl_buffer when it is locked

2018-08-02 Thread Juan A. Suarez Romero
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.
---
 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)
-- 
2.17.1

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


Re: [Mesa-dev] [PATCH 1/2] xmlconfig: read more config files from drirc.d/

2018-08-02 Thread Michel Dänzer
On 2018-08-01 01:10 PM, Qiang Yu wrote:
> Add two places for hosting drirc config files:
> /usr/share/drirc.d/ /etc/drirc.d/
> 
> Driver and application can put their drirc files in
> these places with name xxx.conf. Config files will be
> read and applied in file name alphabete order.
> 
> So there are four places for drirc listed in order:
> 1. /usr/share/drirc.d/
> 2. /etc/drirc.d/
> 3. /etc/drirc
> 4. ~/.drirc
> 
> Signed-off-by: Qiang Yu 

Mesa's own drirc should also be moved to
$(datadir)/drirc.d/00-mesa-defaults.conf, either in this patch or a
follow-up one.


-- 
Earthling Michel Dänzer   |   http://www.amd.com
Libre software enthusiast | Mesa and X developer
___
mesa-dev mailing list
mesa-dev@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/mesa-dev


Re: [Mesa-dev] [PATCH 2/2] loader: add dri_driver drirc option to override dri driver to load

2018-08-02 Thread Michel Dänzer
On 2018-08-01 01:10 PM, Qiang Yu wrote:
> drirc implementation of MESA_LOADER_DRIVER_OVERRIDE which can be
> used to override dri driver to load.
> 
> Usage:
> 
> override dri driver for device with spec kernel driver name:
> 
>   
> 

I still think a separate kernel_driver attribute would be cleaner and
clearer, and Emil seems to agree. Can you elaborate why you think that
would be overkill?


-- 
Earthling Michel Dänzer   |   http://www.amd.com
Libre software enthusiast | Mesa and X developer
___
mesa-dev mailing list
mesa-dev@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/mesa-dev


[Mesa-dev] [PATCH 02/14] intel: tools: aubwrite: reuse canonical address helper

2018-08-02 Thread Lionel Landwerlin
Signed-off-by: Lionel Landwerlin 
---
 src/intel/tools/aub_write.h | 19 ++-
 1 file changed, 2 insertions(+), 17 deletions(-)

diff --git a/src/intel/tools/aub_write.h b/src/intel/tools/aub_write.h
index 2e42e3d4009..b421679b9eb 100644
--- a/src/intel/tools/aub_write.h
+++ b/src/intel/tools/aub_write.h
@@ -29,6 +29,7 @@
 #include 
 
 #include "dev/gen_device_info.h"
+#include "common/gen_gem.h"
 
 struct aub_ppgtt_table {
uint64_t phys_addr;
@@ -63,23 +64,7 @@ static inline void
 aub_write_reloc(const struct gen_device_info *devinfo, void *p, uint64_t v)
 {
if (devinfo->gen >= 8) {
-  /* From the Broadwell PRM Vol. 2a,
-   * MI_LOAD_REGISTER_MEM::MemoryAddress:
-   *
-   *   "This field specifies the address of the memory
-   *   location where the register value specified in the
-   *   DWord above will read from.  The address specifies
-   *   the DWord location of the data. Range =
-   *   GraphicsVirtualAddress[63:2] for a DWord register
-   *   GraphicsAddress [63:48] are ignored by the HW and
-   *   assumed to be in correct canonical form [63:48] ==
-   *   [47]."
-   *
-   * In practice, this will always mean the top bits are zero
-   * because of the GTT size limitation of the aubdump tool.
-   */
-  const int shift = 63 - 47;
-  *(uint64_t *)p = (((int64_t)v) << shift) >> shift;
+  *(uint64_t *)p = gen_canonical_address(v);
} else {
   *(uint32_t *)p = v;
}
-- 
2.18.0

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


[Mesa-dev] [PATCH 03/14] intel: decoder: remove unused variable

2018-08-02 Thread Lionel Landwerlin
Signed-off-by: Lionel Landwerlin 
---
 src/intel/common/gen_decoder.h | 2 --
 1 file changed, 2 deletions(-)

diff --git a/src/intel/common/gen_decoder.h b/src/intel/common/gen_decoder.h
index d8add4ccdb7..a80c50b6647 100644
--- a/src/intel/common/gen_decoder.h
+++ b/src/intel/common/gen_decoder.h
@@ -202,8 +202,6 @@ struct gen_batch_decode_bo {
const void *map;
 };
 
-struct gen_disasm *disasm;
-
 struct gen_batch_decode_ctx {
/**
 * Return information about the buffer containing the given address.
-- 
2.18.0

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


[Mesa-dev] [PATCH 01/14] intel: aubinator: fix read the context/ring

2018-08-02 Thread Lionel Landwerlin
Up to now we've been lucky that the buffer returned was always exactly
at the address we requested.

Fixes: 144b40db5411 ("intel: aubinator: drop the 1Tb GTT mapping")
Signed-off-by: Lionel Landwerlin 
---
 src/intel/tools/aubinator.c | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

diff --git a/src/intel/tools/aubinator.c b/src/intel/tools/aubinator.c
index 8989d558b66..3fec04c24c4 100644
--- a/src/intel/tools/aubinator.c
+++ b/src/intel/tools/aubinator.c
@@ -590,7 +590,7 @@ handle_memtrace_reg_write(uint32_t *p)
uint32_t pphwsp_addr = context_descriptor & 0xf000;
struct gen_batch_decode_bo pphwsp_bo = get_ggtt_batch_bo(NULL, pphwsp_addr);
uint32_t *context = (uint32_t *)((uint8_t *)pphwsp_bo.map +
-(pphwsp_bo.addr - pphwsp_addr) +
+(pphwsp_addr - pphwsp_bo.addr) +
 pphwsp_size);
 
uint32_t ring_buffer_head = context[5];
@@ -601,7 +601,7 @@ handle_memtrace_reg_write(uint32_t *p)
struct gen_batch_decode_bo ring_bo = get_ggtt_batch_bo(NULL,
   ring_buffer_start);
assert(ring_bo.size > 0);
-   void *commands = (uint8_t *)ring_bo.map + (ring_bo.addr - 
ring_buffer_start);
+   void *commands = (uint8_t *)ring_bo.map + (ring_buffer_start - 
ring_bo.addr);
 
if (context_descriptor & 0x100 /* ppgtt */) {
   batch_ctx.get_bo = get_ppgtt_batch_bo;
-- 
2.18.0

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


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

2018-08-02 Thread Lionel Landwerlin
Hi all,

This is an iteration on a series I sent about 8 months ago to add a
new tool to inspect aub files. Rafael expressed some interest so here
is an updated version.

This version isn't as feature complete as the previous version but we
can iterate on that later. The main new addition here is that you can
edit the aub file while looking at it (something I needed to modifiy a
workload generated with intel_error2aub).

Some commits might not make it to the list (especially the ImGui
import). You can find the branch here :

   https://github.com/djdeath/mesa/tree/wip/djdeath/aubinator_viewer

Cheers,

Lionel Landwerlin (14):
  intel: aubinator: fix read the context/ring
  intel: tools: aubwrite: reuse canonical address helper
  intel: decoder: remove unused variable
  intel: common: add missing stdint include
  intel: aubinator: simplify decoding
  intel: tools: simplify meson build
  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: aubmem: map gtt data to aub file
  build: new tool option for intel ui tools
  intel: tools: add aubinator viewer
  intel: tools: ui: fix edition in memory view

 meson_options.txt| 2 +-
 src/intel/common/gen_decoder.h   | 2 -
 src/intel/common/gen_gem.h   | 2 +
 src/intel/tools/aub_mem.c|   420 +
 src/intel/tools/aub_mem.h|78 +
 src/intel/tools/aub_read.c   |   307 +
 src/intel/tools/aub_read.h   |75 +
 src/intel/tools/aub_write.h  |27 +-
 src/intel/tools/aubinator.c  |   669 +-
 src/intel/tools/aubinator_viewer.cpp |  1173 ++
 src/intel/tools/aubinator_viewer.h   |61 +
 src/intel/tools/aubinator_viewer_decoder.cpp |   849 +
 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_glfw.cpp|   292 +
 src/intel/tools/imgui/imgui_impl_glfw.h  |32 +
 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  |   426 +
 src/intel/tools/imgui/meson.build|17 +
 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  |   114 +-
 src/util/rb_tree.h   |36 +
 31 files changed, 35245 insertions(+), 686 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/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_glfw.cpp
 create mode 100644 src/intel/tools/imgui/imgui_impl_glfw.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 05/14] intel: aubinator: simplify decoding

2018-08-02 Thread Lionel Landwerlin
Since we don't support streaming an aub file, we can drop the decoding
status enum.

Signed-off-by: Lionel Landwerlin 
---
 src/intel/tools/aubinator.c | 14 --
 1 file changed, 4 insertions(+), 10 deletions(-)

diff --git a/src/intel/tools/aubinator.c b/src/intel/tools/aubinator.c
index 3fec04c24c4..7caccb31d4d 100644
--- a/src/intel/tools/aubinator.c
+++ b/src/intel/tools/aubinator.c
@@ -712,13 +712,7 @@ aub_file_open(const char *filename)
 
 #define MAKE_GEN(major, minor) ( ((major) << 8) | (minor) )
 
-enum {
-   AUB_ITEM_DECODE_OK,
-   AUB_ITEM_DECODE_FAILED,
-   AUB_ITEM_DECODE_NEED_MORE_DATA,
-};
-
-static int
+static bool
 aub_file_decode_batch(struct aub_file *file)
 {
uint32_t *p, h, *new_cursor;
@@ -741,7 +735,7 @@ aub_file_decode_batch(struct aub_file *file)
   fprintf(outfile, "unknown opcode %d at %td/%td\n",
   OPCODE(h), file->cursor - file->map,
   file->end - file->map);
-  return AUB_ITEM_DECODE_FAILED;
+  return false;
}
 
new_cursor = p + header_length + bias;
@@ -782,7 +776,7 @@ aub_file_decode_batch(struct aub_file *file)
}
file->cursor = new_cursor;
 
-   return AUB_ITEM_DECODE_OK;
+   return true;
 }
 
 static int
@@ -914,7 +908,7 @@ int main(int argc, char *argv[])
file = aub_file_open(input_file);
 
while (aub_file_more_stuff(file) &&
-  aub_file_decode_batch(file) == AUB_ITEM_DECODE_OK);
+  aub_file_decode_batch(file));
 
fflush(stdout);
/* close the stdout which is opened to write the output */
-- 
2.18.0

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


[Mesa-dev] [PATCH 06/14] intel: tools: simplify meson build

2018-08-02 Thread Lionel Landwerlin
Remove the if tools condition and just put it through the install:
parameter.

Signed-off-by: Lionel Landwerlin 
---
 src/intel/tools/meson.build | 96 +++--
 1 file changed, 50 insertions(+), 46 deletions(-)

diff --git a/src/intel/tools/meson.build b/src/intel/tools/meson.build
index 37bc04d8301..ac99adb4e1e 100644
--- a/src/intel/tools/meson.build
+++ b/src/intel/tools/meson.build
@@ -18,6 +18,8 @@
 # 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'),
@@ -25,8 +27,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 : with_tools.contains('intel'),
-  install : with_tools.contains('intel'),
+  build_by_default : build_intel_tools,
+  install : build_intel_tools
 )
 
 aubinator_error_decode = executable(
@@ -36,8 +38,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 : with_tools.contains('intel'),
-  install : with_tools.contains('intel'),
+  build_by_default : build_intel_tools,
+  install : build_intel_tools
 )
 
 error2aub = executable(
@@ -47,50 +49,52 @@ 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 : with_tools.contains('intel'),
-  install : with_tools.contains('intel'),
+  build_by_default : build_intel_tools,
+  install : build_intel_tools
 )
 
-if with_tools.contains('intel')
-  sanitize_data = configuration_data()
-  sanitize_data.set(
-'install_libexecdir',
-join_paths(get_option('prefix'), get_option('libexecdir'))
-  )
-  configure_file(
-input: 'intel_sanitize_gpu.in',
-output: '@BASENAME@',
-install_dir: get_option('bindir'),
-configuration: sanitize_data,
-  )
+sanitize_data = configuration_data()
+sanitize_data.set(
+  'install_libexecdir',
+  join_paths(get_option('prefix'), get_option('libexecdir'))
+)
+configure_file(
+  input: 'intel_sanitize_gpu.in',
+  output: '@BASENAME@',
+  install_dir: get_option('bindir'),
+  install: build_intel_tools,
+  configuration: sanitize_data
+)
 
-  libintel_sanitize_gpu = shared_library(
-'intel_sanitize_gpu',
-files('intel_sanitize_gpu.c'),
-dependencies : [dep_dl, dep_thread],
-include_directories : [inc_common, inc_intel, inc_drm_uapi],
-link_with : [libintel_common, libmesa_util],
-c_args : [c_vis_args, no_override_init_args],
-install_dir: get_option('libexecdir'),
-install: true,
-  )
+libintel_sanitize_gpu = shared_library(
+  'intel_sanitize_gpu',
+  files('intel_sanitize_gpu.c'),
+  dependencies : [dep_dl, dep_thread],
+  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,
+  install_dir: get_option('libexecdir'),
+  install: build_intel_tools
+)
 
-  configure_file(
-input : 'intel_dump_gpu.in',
-output : '@BASENAME@',
-install_dir: get_option('bindir'),
-configuration: sanitize_data,
-  )
+configure_file(
+  input : 'intel_dump_gpu.in',
+  output : '@BASENAME@',
+  install_dir: get_option('bindir'),
+  configuration: sanitize_data,
+  install: build_intel_tools
+)
 
-  libintel_dump_gpu = shared_library(
-'intel_dump_gpu',
-files('gen_context.h', 'gen8_context.h', 'gen10_context.h',
-  'intel_aub.h', 'aub_write.h', 'aub_write.c', 'intel_dump_gpu.c'),
-dependencies : dep_dl,
-include_directories : [inc_common, inc_intel, inc_drm_uapi],
-link_with : libintel_dev,
-c_args : [c_vis_args, no_override_init_args],
-install_dir: get_option('libexecdir'),
-install : true
-  )
-endif
+libintel_dump_gpu = shared_library(
+  'intel_dump_gpu',
+  files('gen_context.h', 'gen8_context.h', 'gen10_context.h',
+'intel_aub.h', 'aub_write.h', 'aub_write.c', 'intel_dump_gpu.c'),
+  dependencies : dep_dl,
+  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_dir: get_option('libexecdir'),
+  install: build_intel_tools
+)
-- 
2.18.0

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


[Mesa-dev] [PATCH 04/14] intel: common: add missing stdint include

2018-08-02 Thread Lionel Landwerlin
---
 src/intel/common/gen_gem.h | 2 ++
 1 file changed, 2 insertions(+)

diff --git a/src/intel/common/gen_gem.h b/src/intel/common/gen_gem.h
index 7dd9ae6d548..8df2c249e48 100644
--- a/src/intel/common/gen_gem.h
+++ b/src/intel/common/gen_gem.h
@@ -24,6 +24,8 @@
 #ifndef GEN_GEM_H
 #define GEN_GEM_H
 
+#include 
+
 static inline uint64_t
 gen_canonical_address(uint64_t v)
 {
-- 
2.18.0

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


[Mesa-dev] [PATCH 10/14] intel: tools: aubwrite: wrap function declarations for c++

2018-08-02 Thread Lionel Landwerlin
---
 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 13/14] intel: tools: add aubinator viewer

2018-08-02 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 | 1173 ++
 src/intel/tools/aubinator_viewer.h   |   61 +
 src/intel/tools/aubinator_viewer_decoder.cpp |  849 +
 src/intel/tools/imgui/imgui_memory_editor.h  |  426 +++
 src/intel/tools/meson.build  |   13 +
 5 files changed, 2522 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..ef111a52229
--- /dev/null
+++ b/src/intel/tools/aubinator_viewer.cpp
@@ -0,0 +1,1173 @@
+/*
+ * 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 "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_FAILURE);
+   }
+   fi

[Mesa-dev] [PATCH 07/14] intel: tools: split aub parsing from aubinator

2018-08-02 Thread Lionel Landwerlin
Signed-off-by: Lionel Landwerlin 
---
 src/intel/tools/aub_read.c  | 307 ++
 src/intel/tools/aub_read.h  |  75 +
 src/intel/tools/aubinator.c | 324 +---
 src/intel/tools/meson.build |   2 +-
 4 files changed, 426 insertions(+), 282 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..e4578c687ff
--- /dev/null
+++ b/src/intel/tools/aub_read.c
@@ -0,0 +1,307 @@
+/*
+ * 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 "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
+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)) {
+fprintf(stderr, "can't find device information: pci_id=0x%x\n", 
aub_pci_id);
+exit(EXIT_FAILURE);
+ }
+  }
+   }
+
+   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);
+}
+
+static void
+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)) {
+ fprintf(stderr, "can't find device information: pci_id=0x%x\n", 
aub_pci_id);
+ exit(EXIT_FAILURE);
+  }
+
+  if (read->info)
+ read->info(read->user_data, aub_pci_id, app_name + pci_id_len);
+   }
+}
+
+static void
+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;
+   int header_length = p[0] & 0x;
+   int engine = GEN_ENGINE_RENDER;
+   const void *data = p + header_length + 2;
+   uint64_t address = gen_48b_address((read->devinfo.gen >= 8 ? ((uint64_t) 
p[5] << 32) : 0) |
+  ((uint64_t) p[3]));
+   uint32_t size = p[4];
+
+   switch (operation) {
+   case AUB_TRACE_OP_DATA_WRITE:
+  if (address_space == AUB_TRACE_MEMTYPE_GTT) {
+ if (read->local_write)
+

[Mesa-dev] [PATCH 08/14] util: rb_tree: add safe iterators

2018-08-02 Thread Lionel Landwerlin
Signed-off-by: Lionel Landwerlin 
---
 src/util/rb_tree.h | 36 
 1 file changed, 36 insertions(+)

diff --git a/src/util/rb_tree.h b/src/util/rb_tree.h
index c77e9255ea2..df1a4197b8a 100644
--- a/src/util/rb_tree.h
+++ b/src/util/rb_tree.h
@@ -243,6 +243,24 @@ 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 = (&node->field != NULL) ? rb_node_data(type, 
rb_node_next(&node->field), field) : node; \
+&node->field != NULL; \
+node = _next, \
+   _next = (&_next->field != NULL) ? rb_node_data(type, 
rb_node_next(&_next->field), field) : _next)
+
 /** Iterate over the nodes in the tree in reverse
  *
  * \param   typeThe type of the containing data structure
@@ -259,6 +277,24 @@ 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_node_prev(&node->field) ? rb_node_data(type, 
rb_node_prev(&node->field), field) : NULL; \
+&node->field != NULL; \
+node = _prev, \
+   _prev = (prev && rb_node_prev(&_prev->field)) ? rb_node_data(type, 
rb_node_prev(&_prev->field), field) : NULL)
+
 /** 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 14/14] intel: tools: ui: fix edition in memory view

2018-08-02 Thread Lionel Landwerlin
Based on https://github.com/ocornut/imgui_club/pull/5

Signed-off-by: Lionel Landwerlin 
---
 src/intel/tools/imgui/imgui_memory_editor.h | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/src/intel/tools/imgui/imgui_memory_editor.h 
b/src/intel/tools/imgui/imgui_memory_editor.h
index 914f03bb8bb..8fa8212f609 100644
--- a/src/intel/tools/imgui/imgui_memory_editor.h
+++ b/src/intel/tools/imgui/imgui_memory_editor.h
@@ -174,7 +174,7 @@ struct MemoryEditor
 ImGuiStyle& style = ImGui::GetStyle();
 
 const float footer_height_to_reserve = ImGui::GetStyle().ItemSpacing.y 
+ ImGui::GetFrameHeightWithSpacing(); // 1 separator, 1 input text
-ImGui::BeginChild("##scrolling", ImVec2(0, -footer_height_to_reserve));
+ImGui::BeginChild("##scrolling", ImVec2(0, -footer_height_to_reserve), 
false, ImGuiWindowFlags_NoMove);
 ImDrawList* draw_list = ImGui::GetWindowDrawList();
 
 ImGui::PushStyleVar(ImGuiStyleVar_FramePadding, ImVec2(0, 0));
-- 
2.18.0

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


[Mesa-dev] [PATCH 09/14] intel: tools: split memory management out of aubinator

2018-08-02 Thread Lionel Landwerlin
Signed-off-by: Lionel Landwerlin 
---
 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;
+  new_mem->fd_offset = mem->mem_fd

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

2018-08-02 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 
---
 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


Re: [Mesa-dev] [PATCH 0/1] swr: Remove unnecessary memset call

2018-08-02 Thread Eric Engestrom
On Wednesday, 2018-08-01 20:56:22 +0300, Vlad Golovkin wrote:
> This patch is identical to the previous one, but that time I forgot to
> mention that I didn't have commit rights, so I am sending the rebased
> patch for the review.

Reviewed and pushed, thanks :)

> 
> Vlad Golovkin (1):
>   swr: Remove unnecessary memset call
> 
>  src/gallium/drivers/swr/swr_screen.cpp | 1 -
>  1 file changed, 1 deletion(-)
> 
> -- 
> 2.17.1
> 
> ___
> mesa-dev mailing list
> mesa-dev@lists.freedesktop.org
> https://lists.freedesktop.org/mailman/listinfo/mesa-dev
___
mesa-dev mailing list
mesa-dev@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/mesa-dev


Re: [Mesa-dev] [PATCH] anv: Use separate MOCS settings for external BOs on gen8

2018-08-02 Thread Lionel Landwerlin

On 10/07/18 05:59, Jason Ekstrand wrote:

On all other platforms, it's safe to use the usual PTE settings for both
internal and external BOs.  On Broadwell, however, we can't get the
right caching behavior for scanout without disabling eLLC and we really
don't want to do this on everything.

In order to do this, we add an anv-specific BO flag for "external" and
use that to distinguish between buffers which may be shared with other
processes and/or display and those which are entirely internal.  That,
together with an anv_mocs_for_bo helper lets us choose the right MOCS
settings for each BO use.

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


Hey Jason,

Looking at Eero's comment on the bug entry, it seems we would need this 
external MOCS on eLLC platforms, not just Gen8?


Cheers,

-
Lionel


Cc: mesa-sta...@lists.freedesktop.org
---
  src/intel/vulkan/anv_allocator.c   | 12 ++--
  src/intel/vulkan/anv_batch_chain.c |  2 +-
  src/intel/vulkan/anv_blorp.c   | 15 ---
  src/intel/vulkan/anv_device.c  |  9 +++--
  src/intel/vulkan/anv_image.c   |  5 +++--
  src/intel/vulkan/anv_intel.c   |  2 +-
  src/intel/vulkan/anv_private.h | 20 
  src/intel/vulkan/gen7_cmd_buffer.c |  3 ++-
  src/intel/vulkan/gen8_cmd_buffer.c |  3 ++-
  src/intel/vulkan/genX_cmd_buffer.c | 18 +-
  src/intel/vulkan/genX_gpu_memcpy.c |  5 ++---
  src/intel/vulkan/genX_state.c  |  6 ++
  12 files changed, 71 insertions(+), 29 deletions(-)

diff --git a/src/intel/vulkan/anv_allocator.c b/src/intel/vulkan/anv_allocator.c
index ab01d46cbeb..f62d48ae3fe 100644
--- a/src/intel/vulkan/anv_allocator.c
+++ b/src/intel/vulkan/anv_allocator.c
@@ -1253,7 +1253,8 @@ anv_bo_cache_lookup(struct anv_bo_cache *cache, uint32_t 
gem_handle)
 (EXEC_OBJECT_WRITE | \
  EXEC_OBJECT_ASYNC | \
  EXEC_OBJECT_SUPPORTS_48B_ADDRESS | \
-EXEC_OBJECT_PINNED)
+EXEC_OBJECT_PINNED | \
+ANV_BO_EXTERNAL)
  
  VkResult

  anv_bo_cache_alloc(struct anv_device *device,
@@ -1311,6 +1312,7 @@ anv_bo_cache_import(struct anv_device *device,
  struct anv_bo **bo_out)
  {
 assert(bo_flags == (bo_flags & ANV_BO_CACHE_SUPPORTED_FLAGS));
+   assert(bo_flags & ANV_BO_EXTERNAL);
  
 pthread_mutex_lock(&cache->mutex);
  
@@ -1327,7 +1329,7 @@ anv_bo_cache_import(struct anv_device *device,

 * client has imported a BO twice in different ways and they get what
 * they have coming.
 */
-  uint64_t new_flags = 0;
+  uint64_t new_flags = ANV_BO_EXTERNAL;
new_flags |= (bo->bo.flags | bo_flags) & EXEC_OBJECT_WRITE;
new_flags |= (bo->bo.flags & bo_flags) & EXEC_OBJECT_ASYNC;
new_flags |= (bo->bo.flags & bo_flags) & 
EXEC_OBJECT_SUPPORTS_48B_ADDRESS;
@@ -1411,6 +1413,12 @@ anv_bo_cache_export(struct anv_device *device,
 assert(anv_bo_cache_lookup(cache, bo_in->gem_handle) == bo_in);
 struct anv_cached_bo *bo = (struct anv_cached_bo *)bo_in;
  
+   /* This BO must have been flagged external in order for us to be able

+* to export it.  This is done based on external options passed into
+* anv_AllocateMemory.
+*/
+   assert(bo->bo.flags & ANV_BO_EXTERNAL);
+
 int fd = anv_gem_handle_to_fd(device, bo->bo.gem_handle);
 if (fd < 0)
return vk_error(VK_ERROR_TOO_MANY_OBJECTS);
diff --git a/src/intel/vulkan/anv_batch_chain.c 
b/src/intel/vulkan/anv_batch_chain.c
index c47a81c8a4d..33b1735460b 100644
--- a/src/intel/vulkan/anv_batch_chain.c
+++ b/src/intel/vulkan/anv_batch_chain.c
@@ -1088,7 +1088,7 @@ anv_execbuf_add_bo(struct anv_execbuf *exec,
obj->relocs_ptr = 0;
obj->alignment = 0;
obj->offset = bo->offset;
-  obj->flags = bo->flags | extra_flags;
+  obj->flags = (bo->flags & ~ANV_BO_FLAG_MASK) | extra_flags;
obj->rsvd1 = 0;
obj->rsvd2 = 0;
 }
diff --git a/src/intel/vulkan/anv_blorp.c b/src/intel/vulkan/anv_blorp.c
index c76392fcd97..a024f8a380a 100644
--- a/src/intel/vulkan/anv_blorp.c
+++ b/src/intel/vulkan/anv_blorp.c
@@ -155,7 +155,7 @@ get_blorp_surf_for_anv_buffer(struct anv_device *device,
.addr = {
   .buffer = buffer->address.bo,
   .offset = buffer->address.offset + offset,
- .mocs = device->default_mocs,
+ .mocs = anv_mocs_for_bo(device, buffer->address.bo),
},
 };
  
@@ -208,7 +208,7 @@ get_blorp_surf_for_anv_image(const struct anv_device *device,

.addr = {
   .buffer = image->planes[plane].address.bo,
   .offset = image->planes[plane].address.offset + surface->offset,
- .mocs = device->default_mocs,
+ .mocs = anv_mocs_for_bo(device, image->planes[plane].address.bo),
},
 };
  
@@ -218,7 +218,7 @@ get_blorp_surf_for_anv_image(const struct anv_device *device,

blorp_surf->aux_addr = (struct blorp_address) {
   .buffer = image->planes[plane].address.bo,
   .offset = imag

[Mesa-dev] [PATCH mesa] loader: fix indentation

2018-08-02 Thread Eric Engestrom
Signed-off-by: Eric Engestrom 
---
 src/loader/loader.c | 4 ++--
 src/loader/loader_dri3_helper.c | 2 +-
 2 files changed, 3 insertions(+), 3 deletions(-)

diff --git a/src/loader/loader.c b/src/loader/loader.c
index 43275484cc2e0c845e10..fda49521aae4056214d5 100644
--- a/src/loader/loader.c
+++ b/src/loader/loader.c
@@ -408,8 +408,8 @@ loader_get_extensions_name(const char *driver_name)
 
const size_t len = strlen(name);
for (size_t i = 0; i < len; i++) {
-  if (name[i] == '-')
-  name[i] = '_';
+  if (name[i] == '-')
+ name[i] = '_';
}
 
return name;
diff --git a/src/loader/loader_dri3_helper.c b/src/loader/loader_dri3_helper.c
index 473fe6c9089d457faa4a..91bad86afd8479865aa2 100644
--- a/src/loader/loader_dri3_helper.c
+++ b/src/loader/loader_dri3_helper.c
@@ -444,7 +444,7 @@ dri3_handle_present_event(struct loader_dri3_drawable *draw,
 }
  }
 
-/* If the server tells us that our allocation is suboptimal, we
+ /* If the server tells us that our allocation is suboptimal, we
   * reallocate once.
   */
 #ifdef HAVE_DRI3_MODIFIERS
-- 
Cheers,
  Eric

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


[Mesa-dev] [PATCH mesa] egl/main: fix indentation

2018-08-02 Thread Eric Engestrom
Signed-off-by: Eric Engestrom 
---
egl platforms are full of randomly-indented lines, so I won't bother
to avoid rebase conflicts and blurring the history.
---
 src/egl/main/eglconfig.c  | 2 +-
 src/egl/main/egldisplay.c | 2 +-
 2 files changed, 2 insertions(+), 2 deletions(-)

diff --git a/src/egl/main/eglconfig.c b/src/egl/main/eglconfig.c
index 2d3b3ddd90894a083459..461feb06423f3ee8eba2 100644
--- a/src/egl/main/eglconfig.c
+++ b/src/egl/main/eglconfig.c
@@ -538,7 +538,7 @@ _eglParseConfigAttribList(_EGLConfig *conf, _EGLDisplay 
*dpy,
   val = attrib_list[i + 1];
 
   if (!_eglIsConfigAttribValid(conf, attr))
-return EGL_FALSE;
+ return EGL_FALSE;
 
   _eglSetConfigKey(conf, attr, val);
}
diff --git a/src/egl/main/egldisplay.c b/src/egl/main/egldisplay.c
index fe963c805ef366b2c4cd..387df6a66d025aec19fe 100644
--- a/src/egl/main/egldisplay.c
+++ b/src/egl/main/egldisplay.c
@@ -134,7 +134,7 @@ _eglNativePlatformDetectNativeDisplay(void *nativeDisplay)
 #endif
 
 #ifdef HAVE_HAIKU_PLATFORM
-   return _EGL_PLATFORM_HAIKU;
+  return _EGL_PLATFORM_HAIKU;
 #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] loader: fix indentation

2018-08-02 Thread Frank Binns
Reviewed-by: Frank Binns 

Eric Engestrom  writes:

> Signed-off-by: Eric Engestrom 
> ---
>  src/loader/loader.c | 4 ++--
>  src/loader/loader_dri3_helper.c | 2 +-
>  2 files changed, 3 insertions(+), 3 deletions(-)
>
> diff --git a/src/loader/loader.c b/src/loader/loader.c
> index 43275484cc2e0c845e10..fda49521aae4056214d5 100644
> --- a/src/loader/loader.c
> +++ b/src/loader/loader.c
> @@ -408,8 +408,8 @@ loader_get_extensions_name(const char *driver_name)
>  
> const size_t len = strlen(name);
> for (size_t i = 0; i < len; i++) {
> -if (name[i] == '-')
> -name[i] = '_';
> +  if (name[i] == '-')
> + name[i] = '_';
> }
>  
> return name;
> diff --git a/src/loader/loader_dri3_helper.c b/src/loader/loader_dri3_helper.c
> index 473fe6c9089d457faa4a..91bad86afd8479865aa2 100644
> --- a/src/loader/loader_dri3_helper.c
> +++ b/src/loader/loader_dri3_helper.c
> @@ -444,7 +444,7 @@ dri3_handle_present_event(struct loader_dri3_drawable 
> *draw,
>  }
>   }
>  
> -  /* If the server tells us that our allocation is suboptimal, we
> + /* If the server tells us that our allocation is suboptimal, we
>* reallocate once.
>*/
>  #ifdef HAVE_DRI3_MODIFIERS

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


Re: [Mesa-dev] [PATCH 1/2] loader: add loader_open_name(..)

2018-08-02 Thread Eric Engestrom
On Wednesday, 2018-08-01 23:07:02 +0200, Christian Gmeiner wrote:
> Add an improved drmOpenWithType(..) clone which fixes some serious
> flaws. Some highlights:
>  - using busid works only with PCI devices
>  - open() w/o O_CLOEXEC
>  - when build w/o udev - it creates a node: mkdir, chown(root), chmod, mknod
>  - calls back into Xserver/DDX module
>  - last but no least - borderline hacks with massive documentation [1]
>to keep this running.
> 
> Signed-off-by: Christian Gmeiner 

The idea sounds good, but I have a few remarks below.

> ---
>  src/loader/loader.c | 79 +
>  src/loader/loader.h |  3 ++
>  2 files changed, 82 insertions(+)
> 
> diff --git a/src/loader/loader.c b/src/loader/loader.c
> index 43275484cc..c2d2122bb8 100644
> --- a/src/loader/loader.c
> +++ b/src/loader/loader.c
> @@ -82,6 +82,85 @@ loader_open_device(const char *device_name)
> return fd;
>  }
>  
> +static int
> +open_minor(int minor, int type)
> +{
> +   const char *dev_name;
> +   char buf[64];
> +
> +   switch (type) {
> +   case DRM_NODE_PRIMARY:
> +  dev_name = DRM_DEV_NAME;
> +  break;
> +   case DRM_NODE_CONTROL:
> +  dev_name = DRM_CONTROL_DEV_NAME;
> +  break;
> +   case DRM_NODE_RENDER:
> +  dev_name = DRM_RENDER_DEV_NAME;
> +  break;
> +   default:
> +  return -EINVAL;

This function is returning an fd, so this should be -1.
That said, giving an invalid type here is a serious misuse of the api,
so I think you should replace the default return here and below ([1])
with an `unreachable("invalid DRM node type");`

> +   };

Nit: no need for `;` after a switch

> +
> +   sprintf(buf, dev_name, DRM_DIR_NAME, minor);

unlikely, but you should probably use snprintf(buf, sizeof(buf), ...)

You should also use the `util_*` versions from u_string.h for
compatibility with toolchains that don't support them natively.

> +
> +   return loader_open_device(buf);
> +}
> +
> +static int minor_base(int type)
> +{
> +switch (type) {
> +case DRM_NODE_PRIMARY:
> +return 0;
> +case DRM_NODE_CONTROL:
> +return 64;
> +case DRM_NODE_RENDER:
> +return 128;
> +default:
> +return -1;

[1] ^ to replace with unreachable()

> +};

(`;` again)

> +}
> +
> +int
> +loader_open_name(const char *name, int type)
> +{
> +   int base = minor_base(type);
> +   drmVersionPtr version;
> +   int i, fd;
> +   char *id;
> +
> +   if (base < 0)
> +  return -1;

with unreachable() above, this can go

> +
> +   /*
> +   * Open the first minor number that matches the driver name and isn't
> +   * already in use.  If it's in use it will have a busid assigned already.
> +   */
> +   for (i = base; i < base + DRM_MAX_MINOR; i++) {
> +  if ((fd = open_minor(i, type)) >= 0) {
> + if ((version = drmGetVersion(fd))) {
> +if (!strcmp(version->name, name)) {

I would suggest inverting these `if`s to avoid nesting so deep.

> +   drmFreeVersion(version);
> +   id = drmGetBusid(fd);
> +   drmMsg("drmGetBusid returned '%s'\n", id ? id : "NULL");
> +   if (!id || !*id) {
> +  if (id)
> + drmFreeBusid(id);
> +  return fd;

This condition looks wrong; surely you want to keep the one that has
a bus id, not the one that doesn't?

The `if(!id) if(id)` also looks weird; I suggest rewriting this bit of
your code. Flattening your logic should also make it more readable.

> +   } else {
> +  drmFreeBusid(id);
> +   }
> +} else {
> +   drmFreeVersion(version);
> +}
> + }
> + close(fd);
> +  }
> +   }
> +
> +   return -1;
> +}
> +
>  #if defined(HAVE_LIBDRM)
>  #ifdef USE_DRICONF
>  static const char __driConfigOptionsLoader[] =
> diff --git a/src/loader/loader.h b/src/loader/loader.h
> index 3859b45dc4..7e1612301a 100644
> --- a/src/loader/loader.h
> +++ b/src/loader/loader.h
> @@ -38,6 +38,9 @@ extern "C" {
>  int
>  loader_open_device(const char *);
>  
> +int
> +loader_open_name(const char *name, int type);
> +
>  int
>  loader_get_pci_id_for_fd(int fd, int *vendor_id, int *chip_id);
>  
> -- 
> 2.17.1
> 
> ___
> mesa-dev mailing list
> mesa-dev@lists.freedesktop.org
> https://lists.freedesktop.org/mailman/listinfo/mesa-dev
___
mesa-dev mailing list
mesa-dev@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/mesa-dev


Re: [Mesa-dev] [PATCH mesa] egl/main: fix indentation

2018-08-02 Thread Frank Binns
Reviewed-by: Frank Binns 

Eric Engestrom  writes:

> Signed-off-by: Eric Engestrom 
> ---
> egl platforms are full of randomly-indented lines, so I won't bother
> to avoid rebase conflicts and blurring the history.
> ---
>  src/egl/main/eglconfig.c  | 2 +-
>  src/egl/main/egldisplay.c | 2 +-
>  2 files changed, 2 insertions(+), 2 deletions(-)
>
> diff --git a/src/egl/main/eglconfig.c b/src/egl/main/eglconfig.c
> index 2d3b3ddd90894a083459..461feb06423f3ee8eba2 100644
> --- a/src/egl/main/eglconfig.c
> +++ b/src/egl/main/eglconfig.c
> @@ -538,7 +538,7 @@ _eglParseConfigAttribList(_EGLConfig *conf, _EGLDisplay 
> *dpy,
>val = attrib_list[i + 1];
>  
>if (!_eglIsConfigAttribValid(conf, attr))
> -  return EGL_FALSE;
> + return EGL_FALSE;
>  
>_eglSetConfigKey(conf, attr, val);
> }
> diff --git a/src/egl/main/egldisplay.c b/src/egl/main/egldisplay.c
> index fe963c805ef366b2c4cd..387df6a66d025aec19fe 100644
> --- a/src/egl/main/egldisplay.c
> +++ b/src/egl/main/egldisplay.c
> @@ -134,7 +134,7 @@ _eglNativePlatformDetectNativeDisplay(void *nativeDisplay)
>  #endif
>  
>  #ifdef HAVE_HAIKU_PLATFORM
> - return _EGL_PLATFORM_HAIKU;
> +  return _EGL_PLATFORM_HAIKU;
>  #endif
> }

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


[Mesa-dev] [PATCH v3] mesa: enable EXT_render_snorm extension

2018-08-02 Thread Tapani Pälli
Patch sets additional formats renderable and enables the extension
when OpenGL ES 3.1 is supported.

v2: instead of dummy_true, have a separate toggle for extension
(Eric Anholt)

v3: add missing checks, simplify some existing checks and fix
glCopyTexImage2D check (Nanley Chery)

add SHORT and BYTE support in read_pixels_es3_error_check

Signed-off-by: Tapani Pälli 
---
 src/mesa/main/extensions_table.h |  1 +
 src/mesa/main/fbobject.c | 31 +++
 src/mesa/main/glformats.c|  9 +
 src/mesa/main/mtypes.h   |  1 +
 src/mesa/main/readpix.c  | 19 +++
 src/mesa/main/teximage.c |  3 ++-
 6 files changed, 55 insertions(+), 9 deletions(-)

diff --git a/src/mesa/main/extensions_table.h b/src/mesa/main/extensions_table.h
index 3f01896cae..c3a69b8987 100644
--- a/src/mesa/main/extensions_table.h
+++ b/src/mesa/main/extensions_table.h
@@ -246,6 +246,7 @@ EXT(EXT_polygon_offset_clamp, 
ARB_polygon_offset_clamp
 EXT(EXT_primitive_bounding_box  , OES_primitive_bounding_box   
  ,  x ,  x ,  x ,  31, 2014)
 EXT(EXT_provoking_vertex, EXT_provoking_vertex 
  , GLL, GLC,  x ,  x , 2009)
 EXT(EXT_read_format_bgra, dummy_true   
  ,  x ,  x , ES1, ES2, 2009)
+EXT(EXT_render_snorm, EXT_render_snorm 
  ,  x ,  x ,  x,   31, 2014)
 EXT(EXT_rescale_normal  , dummy_true   
  , GLL,  x ,  x ,  x , 1997)
 EXT(EXT_robustness  , KHR_robustness   
  ,  x,   x,   x , ES2, 2011)
 EXT(EXT_secondary_color , dummy_true   
  , GLL,  x ,  x ,  x , 1999)
diff --git a/src/mesa/main/fbobject.c b/src/mesa/main/fbobject.c
index cfe2174ef1..2534b1df29 100644
--- a/src/mesa/main/fbobject.c
+++ b/src/mesa/main/fbobject.c
@@ -728,7 +728,15 @@ is_format_color_renderable(const struct gl_context *ctx, 
mesa_format format,
 
/* Reject additional cases for GLES */
switch (internalFormat) {
+   case GL_R8_SNORM:
+   case GL_RG8_SNORM:
case GL_RGBA8_SNORM:
+  return _mesa_has_EXT_render_snorm(ctx);
+   case GL_R16_SNORM:
+   case GL_RG16_SNORM:
+   case GL_RGBA16_SNORM:
+  return _mesa_has_EXT_texture_norm16(ctx) &&
+ _mesa_has_EXT_render_snorm(ctx);
case GL_RGB32F:
case GL_RGB32I:
case GL_RGB32UI:
@@ -741,8 +749,6 @@ is_format_color_renderable(const struct gl_context *ctx, 
mesa_format format,
case GL_SRGB8:
case GL_RGB10:
case GL_RGB9_E5:
-   case GL_RG8_SNORM:
-   case GL_R8_SNORM:
   return GL_FALSE;
default:
   break;
@@ -1997,25 +2003,34 @@ _mesa_base_fbo_format(const struct gl_context *ctx, 
GLenum internalFormat)
   return ctx->API != API_OPENGLES && ctx->Extensions.ARB_texture_rg
  ? GL_RG : 0;
/* signed normalized texture formats */
-   case GL_RED_SNORM:
case GL_R8_SNORM:
+  return _mesa_has_EXT_texture_snorm(ctx) || 
_mesa_has_EXT_render_snorm(ctx)
+ ? GL_RED : 0;
+   case GL_RED_SNORM:
+  return _mesa_has_EXT_texture_snorm(ctx) ? GL_RED : 0;
case GL_R16_SNORM:
-  return _mesa_is_desktop_gl(ctx) && ctx->Extensions.EXT_texture_snorm
+  return _mesa_has_EXT_texture_snorm(ctx) || 
_mesa_has_EXT_render_snorm(ctx)
  ? GL_RED : 0;
-   case GL_RG_SNORM:
case GL_RG8_SNORM:
+  return _mesa_has_EXT_texture_snorm(ctx) || 
_mesa_has_EXT_render_snorm(ctx)
+ ? GL_RG : 0;
+   case GL_RG_SNORM:
+  _mesa_has_EXT_texture_snorm(ctx) ? GL_RG : 0;
case GL_RG16_SNORM:
-  return _mesa_is_desktop_gl(ctx) && ctx->Extensions.EXT_texture_snorm
+  return _mesa_has_EXT_texture_snorm(ctx) || 
_mesa_has_EXT_render_snorm(ctx)
  ? GL_RG : 0;
case GL_RGB_SNORM:
case GL_RGB8_SNORM:
case GL_RGB16_SNORM:
   return _mesa_is_desktop_gl(ctx) && ctx->Extensions.EXT_texture_snorm
  ? GL_RGB : 0;
-   case GL_RGBA_SNORM:
case GL_RGBA8_SNORM:
+  return _mesa_has_EXT_texture_snorm(ctx) || 
_mesa_has_EXT_render_snorm(ctx)
+ ? GL_RGBA : 0;
+   case GL_RGBA_SNORM:
+  return _mesa_has_EXT_texture_snorm(ctx) ? GL_RGBA : 0;
case GL_RGBA16_SNORM:
-  return _mesa_is_desktop_gl(ctx) && ctx->Extensions.EXT_texture_snorm
+  return _mesa_has_EXT_texture_snorm(ctx) || 
_mesa_has_EXT_render_snorm(ctx)
  ? GL_RGBA : 0;
case GL_ALPHA_SNORM:
case GL_ALPHA8_SNORM:
diff --git a/src/mesa/main/glformats.c b/src/mesa/main/glformats.c
index 667020c193..bbeb6034dd 100644
--- a/src/mesa/main/glformats.c
+++ b/src/mesa/main/glformats.c
@@ -3794,6 +3794,15 @@ _mesa_is_es3_color_renderable(const struct gl_context 
*ctx,
case GL_RG16:
case GL_RGBA16:
   return _mesa_has_EXT_texture_norm16(ctx);
+   case GL_R8_SNORM:
+   case GL_RG8_SNORM:
+   case GL_RGBA8_SNORM:
+  return _mesa_has_EXT_r

[Mesa-dev] [PATCH] i965: enable EXT_render_snorm

2018-08-02 Thread Tapani Pälli
Signed-off-by: Tapani Pälli 
---
 src/mesa/drivers/dri/i965/intel_extensions.c | 1 +
 1 file changed, 1 insertion(+)

diff --git a/src/mesa/drivers/dri/i965/intel_extensions.c 
b/src/mesa/drivers/dri/i965/intel_extensions.c
index 2e28445ae3..f1c3aeff13 100644
--- a/src/mesa/drivers/dri/i965/intel_extensions.c
+++ b/src/mesa/drivers/dri/i965/intel_extensions.c
@@ -103,6 +103,7 @@ intelInitExtensions(struct gl_context *ctx)
ctx->Extensions.EXT_pixel_buffer_object = true;
ctx->Extensions.EXT_point_parameters = true;
ctx->Extensions.EXT_provoking_vertex = true;
+   ctx->Extensions.EXT_render_snorm = true;
ctx->Extensions.EXT_stencil_two_side = true;
ctx->Extensions.EXT_texture_array = true;
ctx->Extensions.EXT_texture_env_dot3 = true;
-- 
2.14.4

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


[Mesa-dev] [PATCH 10/15] compiler/spirv: add XFB and GeometryStreams capability check support

2018-08-02 Thread Alejandro Piñeiro
FWIW, this is the only patch pending to be reviewed on the series (sorry
Timothy, I used wrong patch numbers when I pinged you on IRC).

BR


On 20/07/18 17:08, Alejandro Piñeiro wrote:
> ---
>  src/compiler/shader_info.h|  2 ++
>  src/compiler/spirv/spirv_to_nir.c | 10 --
>  2 files changed, 10 insertions(+), 2 deletions(-)
>
> diff --git a/src/compiler/shader_info.h b/src/compiler/shader_info.h
> index 3b95d5962c0..958e6bb98bf 100644
> --- a/src/compiler/shader_info.h
> +++ b/src/compiler/shader_info.h
> @@ -59,6 +59,8 @@ struct spirv_supported_capabilities {
> bool stencil_export;
> bool atomic_storage;
> bool storage_8bit;
> +   bool transform_feedback;
> +   bool geometry_streams;
>  };
>  
>  typedef struct shader_info {
> diff --git a/src/compiler/spirv/spirv_to_nir.c 
> b/src/compiler/spirv/spirv_to_nir.c
> index 0957efb2aa1..c8b91f068a8 100644
> --- a/src/compiler/spirv/spirv_to_nir.c
> +++ b/src/compiler/spirv/spirv_to_nir.c
> @@ -3424,7 +3424,6 @@ vtn_handle_preamble_instruction(struct vtn_builder *b, 
> SpvOp opcode,
>case SpvCapabilityStorageImageExtendedFormats:
>   break;
>  
> -  case SpvCapabilityGeometryStreams:
>case SpvCapabilityLinkage:
>case SpvCapabilityVector16:
>case SpvCapabilityFloat16Buffer:
> @@ -3434,7 +3433,6 @@ vtn_handle_preamble_instruction(struct vtn_builder *b, 
> SpvOp opcode,
>case SpvCapabilityInt8:
>case SpvCapabilitySparseResidency:
>case SpvCapabilityMinLod:
> -  case SpvCapabilityTransformFeedback:
>   vtn_warn("Unsupported SPIR-V capability: %s",
>spirv_capability_to_string(cap));
>   break;
> @@ -3453,6 +3451,14 @@ vtn_handle_preamble_instruction(struct vtn_builder *b, 
> SpvOp opcode,
>   spv_check_supported(int16, cap);
>   break;
>  
> +  case SpvCapabilityTransformFeedback:
> + spv_check_supported(transform_feedback, cap);
> + break;
> +
> +  case SpvCapabilityGeometryStreams:
> + spv_check_supported(geometry_streams, cap);
> + break;
> +
>case SpvCapabilityAddresses:
>case SpvCapabilityKernel:
>case SpvCapabilityImageBasic:


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


[Mesa-dev] [PATCH 0/1] swr: Remove unnecessary memset call

2018-08-02 Thread Vlad Golovkin
This patch is identical to the one I sent in April, but that time I
forgot to mention that I didn't have commit rights, so I am sending the
rebased patch for the review.

Vlad Golovkin (1):
  swr: Remove unnecessary memset call

 src/gallium/drivers/swr/swr_screen.cpp | 1 -
 1 file changed, 1 deletion(-)

-- 
2.17.1

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


[Mesa-dev] [PATCH] include: update GL & GLES headers

2018-08-02 Thread Marek Olšák
From: Marek Olšák 

---
 include/GL/glcorearb.h |  68 --
 include/GL/glext.h |  77 +---
 include/GL/glxext.h|  22 --
 include/GLES2/gl2.h|   8 +--
 include/GLES2/gl2ext.h | 159 +++--
 include/GLES3/gl3.h|   8 +--
 6 files changed, 309 insertions(+), 33 deletions(-)

diff --git a/include/GL/glcorearb.h b/include/GL/glcorearb.h
index a78bbb6e182..82cbfbafbda 100644
--- a/include/GL/glcorearb.h
+++ b/include/GL/glcorearb.h
@@ -1,19 +1,19 @@
-#ifndef __glcorearb_h_
-#define __glcorearb_h_ 1
+#ifndef __gl_glcorearb_h_
+#define __gl_glcorearb_h_ 1
 
 #ifdef __cplusplus
 extern "C" {
 #endif
 
 /*
-** Copyright (c) 2013-2017 The Khronos Group Inc.
+** Copyright (c) 2013-2018 The Khronos Group Inc.
 **
 ** Permission is hereby granted, free of charge, to any person obtaining a
 ** copy of this software and/or associated documentation files (the
 ** "Materials"), to deal in the Materials without restriction, including
 ** without limitation the rights to use, copy, modify, merge, publish,
 ** distribute, sublicense, and/or sell copies of the Materials, and to
 ** permit persons to whom the Materials are furnished to do so, subject to
 ** the following conditions:
 **
 ** The above copyright notice and this permission notice shall be included
@@ -299,21 +299,21 @@ typedef void (APIENTRYP PFNGLGETDOUBLEVPROC) (GLenum 
pname, GLdouble *data);
 typedef GLenum (APIENTRYP PFNGLGETERRORPROC) (void);
 typedef void (APIENTRYP PFNGLGETFLOATVPROC) (GLenum pname, GLfloat *data);
 typedef void (APIENTRYP PFNGLGETINTEGERVPROC) (GLenum pname, GLint *data);
 typedef const GLubyte *(APIENTRYP PFNGLGETSTRINGPROC) (GLenum name);
 typedef void (APIENTRYP PFNGLGETTEXIMAGEPROC) (GLenum target, GLint level, 
GLenum format, GLenum type, void *pixels);
 typedef void (APIENTRYP PFNGLGETTEXPARAMETERFVPROC) (GLenum target, GLenum 
pname, GLfloat *params);
 typedef void (APIENTRYP PFNGLGETTEXPARAMETERIVPROC) (GLenum target, GLenum 
pname, GLint *params);
 typedef void (APIENTRYP PFNGLGETTEXLEVELPARAMETERFVPROC) (GLenum target, GLint 
level, GLenum pname, GLfloat *params);
 typedef void (APIENTRYP PFNGLGETTEXLEVELPARAMETERIVPROC) (GLenum target, GLint 
level, GLenum pname, GLint *params);
 typedef GLboolean (APIENTRYP PFNGLISENABLEDPROC) (GLenum cap);
-typedef void (APIENTRYP PFNGLDEPTHRANGEPROC) (GLdouble near, GLdouble far);
+typedef void (APIENTRYP PFNGLDEPTHRANGEPROC) (GLdouble n, GLdouble f);
 typedef void (APIENTRYP PFNGLVIEWPORTPROC) (GLint x, GLint y, GLsizei width, 
GLsizei height);
 #ifdef GL_GLEXT_PROTOTYPES
 GLAPI void APIENTRY glCullFace (GLenum mode);
 GLAPI void APIENTRY glFrontFace (GLenum mode);
 GLAPI void APIENTRY glHint (GLenum target, GLenum mode);
 GLAPI void APIENTRY glLineWidth (GLfloat width);
 GLAPI void APIENTRY glPointSize (GLfloat size);
 GLAPI void APIENTRY glPolygonMode (GLenum face, GLenum mode);
 GLAPI void APIENTRY glScissor (GLint x, GLint y, GLsizei width, GLsizei 
height);
 GLAPI void APIENTRY glTexParameterf (GLenum target, GLenum pname, GLfloat 
param);
@@ -348,21 +348,21 @@ GLAPI void APIENTRY glGetDoublev (GLenum pname, GLdouble 
*data);
 GLAPI GLenum APIENTRY glGetError (void);
 GLAPI void APIENTRY glGetFloatv (GLenum pname, GLfloat *data);
 GLAPI void APIENTRY glGetIntegerv (GLenum pname, GLint *data);
 GLAPI const GLubyte *APIENTRY glGetString (GLenum name);
 GLAPI void APIENTRY glGetTexImage (GLenum target, GLint level, GLenum format, 
GLenum type, void *pixels);
 GLAPI void APIENTRY glGetTexParameterfv (GLenum target, GLenum pname, GLfloat 
*params);
 GLAPI void APIENTRY glGetTexParameteriv (GLenum target, GLenum pname, GLint 
*params);
 GLAPI void APIENTRY glGetTexLevelParameterfv (GLenum target, GLint level, 
GLenum pname, GLfloat *params);
 GLAPI void APIENTRY glGetTexLevelParameteriv (GLenum target, GLint level, 
GLenum pname, GLint *params);
 GLAPI GLboolean APIENTRY glIsEnabled (GLenum cap);
-GLAPI void APIENTRY glDepthRange (GLdouble near, GLdouble far);
+GLAPI void APIENTRY glDepthRange (GLdouble n, GLdouble f);
 GLAPI void APIENTRY glViewport (GLint x, GLint y, GLsizei width, GLsizei 
height);
 #endif
 #endif /* GL_VERSION_1_0 */
 
 #ifndef GL_VERSION_1_1
 #define GL_VERSION_1_1 1
 typedef float GLclampf;
 typedef double GLclampd;
 #define GL_COLOR_LOGIC_OP 0x0BF2
 #define GL_POLYGON_OFFSET_UNITS   0x2A00
@@ -3951,20 +3951,34 @@ GLAPI void APIENTRY glMaxShaderCompilerThreadsKHR 
(GLuint count);
 #endif /* GL_KHR_texture_compression_astc_hdr */
 
 #ifndef GL_KHR_texture_compression_astc_ldr
 #define GL_KHR_texture_compression_astc_ldr 1
 #endif /* GL_KHR_texture_compression_astc_ldr */
 
 #ifndef GL_KHR_texture_compression_astc_sliced_3d
 #define GL_KHR_texture_compression_astc_sliced_3d 1
 #endif /* GL_KHR_texture_compression_astc_sliced_3d */
 
+#ifndef GL_AMD_framebuffer_multisample_advanced
+#define GL_AMD_framebuffer_multisample_advanced
+#define GL_RENDERBUFFER_STORAGE_SAMPLE

[Mesa-dev] [PATCH 4/7] dri: Add param driCreateConfigs(mutable_render_buffer)

2018-08-02 Thread Chad Versace
If set, then the config will have __DRI_ATTRIB_MUTABLE_RENDER_BUFFER,
which translates to EGL_MUTABLE_RENDER_BUFFER_BIT_KHR.

Not used yet.
---
 src/gallium/state_trackers/dri/dri_screen.c   | 4 ++--
 src/mesa/drivers/dri/common/utils.c   | 9 +++--
 src/mesa/drivers/dri/common/utils.h   | 3 ++-
 src/mesa/drivers/dri/i915/intel_screen.c  | 4 ++--
 src/mesa/drivers/dri/i965/intel_screen.c  | 6 +++---
 src/mesa/drivers/dri/nouveau/nouveau_screen.c | 2 +-
 src/mesa/drivers/dri/radeon/radeon_screen.c   | 2 +-
 src/mesa/drivers/dri/swrast/swrast.c  | 2 +-
 8 files changed, 19 insertions(+), 13 deletions(-)

diff --git a/src/gallium/state_trackers/dri/dri_screen.c 
b/src/gallium/state_trackers/dri/dri_screen.c
index 87729c190a8..99fb9e595ca 100644
--- a/src/gallium/state_trackers/dri/dri_screen.c
+++ b/src/gallium/state_trackers/dri/dri_screen.c
@@ -274,7 +274,7 @@ dri_fill_in_modes(struct dri_screen *screen)
 depth_buffer_factor, back_buffer_modes,
 ARRAY_SIZE(back_buffer_modes),
 msaa_modes, 1,
-GL_TRUE, !mixed_color_depth);
+GL_TRUE, !mixed_color_depth, GL_FALSE);
  configs = driConcatConfigs(configs, new_configs);
 
  /* Multi-sample configs without an accumulation buffer. */
@@ -284,7 +284,7 @@ dri_fill_in_modes(struct dri_screen *screen)
depth_buffer_factor, 
back_buffer_modes,
ARRAY_SIZE(back_buffer_modes),
msaa_modes+1, num_msaa_modes-1,
-   GL_FALSE, !mixed_color_depth);
+   GL_FALSE, !mixed_color_depth, 
GL_FALSE);
 configs = driConcatConfigs(configs, new_configs);
  }
   }
diff --git a/src/mesa/drivers/dri/common/utils.c 
b/src/mesa/drivers/dri/common/utils.c
index 86169d5c214..88835a7add5 100644
--- a/src/mesa/drivers/dri/common/utils.c
+++ b/src/mesa/drivers/dri/common/utils.c
@@ -147,7 +147,10 @@ driGetRendererString( char * buffer, const char * 
hardware_name,
  * \param color_depth_match Whether the color depth must match the zs depth
  *  This forces 32-bit color to have 24-bit depth, and
  *  16-bit color to have 16-bit depth.
- * 
+ * \param mutable_render_buffer Enable __DRI_ATTRIB_MUTABLE_RENDER_BUFFER,
+ *  which translates to
+ *  EGL_MUTABLE_RENDER_BUFFER_BIT_KHR.
+ *
  * \returns
  * Pointer to any array of pointers to the \c __DRIconfig structures created
  * for the specified formats.  If there is an error, \c NULL is returned.
@@ -160,7 +163,8 @@ driCreateConfigs(mesa_format format,
 unsigned num_depth_stencil_bits,
 const GLenum * db_modes, unsigned num_db_modes,
 const uint8_t * msaa_samples, unsigned num_msaa_modes,
-GLboolean enable_accum, GLboolean color_depth_match)
+GLboolean enable_accum, GLboolean color_depth_match,
+GLboolean mutable_render_buffer)
 {
static const uint32_t masks_table[][4] = {
   /* MESA_FORMAT_B5G6R5_UNORM */
@@ -325,6 +329,7 @@ driCreateConfigs(mesa_format format,
 
modes->yInverted = GL_TRUE;
modes->sRGBCapable = is_srgb;
+   modes->mutableRenderBuffer = mutable_render_buffer;
}
}
}
diff --git a/src/mesa/drivers/dri/common/utils.h 
b/src/mesa/drivers/dri/common/utils.h
index 7be0465c261..7c9719f9f42 100644
--- a/src/mesa/drivers/dri/common/utils.h
+++ b/src/mesa/drivers/dri/common/utils.h
@@ -45,7 +45,8 @@ driCreateConfigs(mesa_format format,
 unsigned num_depth_stencil_bits,
 const GLenum * db_modes, unsigned num_db_modes,
 const uint8_t * msaa_samples, unsigned num_msaa_modes,
-GLboolean enable_accum, GLboolean color_depth_match);
+GLboolean enable_accum, GLboolean color_depth_match,
+GLboolean mutable_render_buffer);
 
 __DRIconfig **driConcatConfigs(__DRIconfig **a,
   __DRIconfig **b);
diff --git a/src/mesa/drivers/dri/i915/intel_screen.c 
b/src/mesa/drivers/dri/i915/intel_screen.c
index 882c498622f..27be9219e47 100644
--- a/src/mesa/drivers/dri/i915/intel_screen.c
+++ b/src/mesa/drivers/dri/i915/intel_screen.c
@@ -1094,7 +1094,7 @@ intel_screen_make_configs(__DRIscreen *dri_screen)
  num_depth_stencil_bits,
  back_buffer_modes, 2,
  singlesample_samples, 1,
- false, false);
+ fal

[Mesa-dev] [PATCH] gallium/u_vbuf: handle indirect multidraws correctly and efficiently (v3)

2018-08-02 Thread Marek Olšák
From: Marek Olšák 

v2: need to do MAX{start+count} instead of MAX{count}
added piglit tests
v3: use malloc
---
 src/gallium/auxiliary/util/u_vbuf.c | 204 
 1 file changed, 180 insertions(+), 24 deletions(-)

diff --git a/src/gallium/auxiliary/util/u_vbuf.c 
b/src/gallium/auxiliary/util/u_vbuf.c
index 746ff1085ce..a7a8a3be21b 100644
--- a/src/gallium/auxiliary/util/u_vbuf.c
+++ b/src/gallium/auxiliary/util/u_vbuf.c
@@ -1124,20 +1124,45 @@ static void u_vbuf_set_driver_vertex_buffers(struct 
u_vbuf *mgr)
unsigned start_slot, count;
 
start_slot = ffs(mgr->dirty_real_vb_mask) - 1;
count = util_last_bit(mgr->dirty_real_vb_mask >> start_slot);
 
pipe->set_vertex_buffers(pipe, start_slot, count,
 mgr->real_vertex_buffer + start_slot);
mgr->dirty_real_vb_mask = 0;
 }
 
+static void
+u_vbuf_split_indexed_multidraw(struct u_vbuf *mgr, struct pipe_draw_info *info,
+   unsigned *indirect_data, unsigned stride,
+   unsigned draw_count)
+{
+   assert(info->index_size);
+   info->indirect = NULL;
+
+   for (unsigned i = 0; i < draw_count; i++) {
+  unsigned offset = i * stride / 4;
+
+  info->count = indirect_data[offset + 0];
+  info->instance_count = indirect_data[offset + 1];
+
+  if (!info->count || !info->instance_count)
+ continue;
+
+  info->start = indirect_data[offset + 2];
+  info->index_bias = indirect_data[offset + 3];
+  info->start_instance = indirect_data[offset + 4];
+
+  u_vbuf_draw_vbo(mgr, info);
+   }
+}
+
 void u_vbuf_draw_vbo(struct u_vbuf *mgr, const struct pipe_draw_info *info)
 {
struct pipe_context *pipe = mgr->pipe;
int start_vertex;
unsigned min_index;
unsigned num_vertices;
boolean unroll_indices = FALSE;
const uint32_t used_vb_mask = mgr->ve->used_vb_mask;
uint32_t user_vb_mask = mgr->user_vb_mask & used_vb_mask;
const uint32_t incompatible_vb_mask =
@@ -1153,47 +1178,177 @@ void u_vbuf_draw_vbo(struct u_vbuf *mgr, const struct 
pipe_draw_info *info)
   if (mgr->dirty_real_vb_mask & used_vb_mask) {
  u_vbuf_set_driver_vertex_buffers(mgr);
   }
 
   pipe->draw_vbo(pipe, info);
   return;
}
 
new_info = *info;
 
-   /* Fallback. We need to know all the parameters. */
+   /* Handle indirect (multi)draws. */
if (new_info.indirect) {
-  struct pipe_transfer *transfer = NULL;
-  int *data;
-
-  if (new_info.index_size) {
- data = pipe_buffer_map_range(pipe, new_info.indirect->buffer,
-  new_info.indirect->offset, 20,
-  PIPE_TRANSFER_READ, &transfer);
- new_info.index_bias = data[3];
- new_info.start_instance = data[4];
-  }
-  else {
- data = pipe_buffer_map_range(pipe, new_info.indirect->buffer,
-  new_info.indirect->offset, 16,
-  PIPE_TRANSFER_READ, &transfer);
- new_info.start_instance = data[3];
+  const struct pipe_draw_indirect_info *indirect = new_info.indirect;
+  unsigned draw_count = 0;
+
+  /* Get the number of draws. */
+  if (indirect->indirect_draw_count) {
+ pipe_buffer_read(pipe, indirect->indirect_draw_count,
+  indirect->indirect_draw_count_offset,
+  4, &draw_count);
+  } else {
+ draw_count = indirect->draw_count;
   }
 
-  new_info.count = data[0];
-  new_info.instance_count = data[1];
-  new_info.start = data[2];
-  pipe_buffer_unmap(pipe, transfer);
-  new_info.indirect = NULL;
-
-  if (!new_info.count)
+  if (!draw_count)
  return;
+
+  unsigned data_size = (draw_count - 1) * indirect->stride +
+   (new_info.index_size ? 20 : 16);
+  unsigned *data = malloc(data_size);
+  if (!data)
+ return; /* report an error? */
+
+  /* Read the used buffer range only once, because the read can be
+   * uncached.
+   */
+  pipe_buffer_read(pipe, indirect->buffer, indirect->offset, data_size,
+   data);
+
+  if (info->index_size) {
+ /* Indexed multidraw. */
+ unsigned index_bias0 = data[3];
+ bool index_bias_same = true;
+
+ /* If we invoke the translate path, we have to split the multidraw. */
+ if (incompatible_vb_mask ||
+ mgr->ve->incompatible_elem_mask) {
+u_vbuf_split_indexed_multidraw(mgr, &new_info, data,
+   indirect->stride, draw_count);
+free(data);
+return;
+ }
+
+ /* See if index_bias is the same for all draws. */
+ for (unsigned i = 1; i < draw_count; i++) {
+if (data[i * indirect->stride / 4 + 3] != index_bias0) {
+   index_bias_same = false;
+ 

[Mesa-dev] [PATCH 6/7] egl/android: Implement EGL_KHR_mutable_render_buffer

2018-08-02 Thread Chad Versace
Specifically, implement the extension DRI_MutableRenderBufferLoader.
However, the loader enables EGL_KHR_mutable_render_buffer only if the
DRI driver implements its half of the extension,
DRI_MutableRenderBufferDriver.
---
 src/egl/drivers/dri2/egl_dri2.c |  38 +-
 src/egl/drivers/dri2/egl_dri2.h |   7 +
 src/egl/drivers/dri2/platform_android.c | 168 +++-
 3 files changed, 206 insertions(+), 7 deletions(-)

diff --git a/src/egl/drivers/dri2/egl_dri2.c b/src/egl/drivers/dri2/egl_dri2.c
index 1208ebb3156..1a7338aa51d 100644
--- a/src/egl/drivers/dri2/egl_dri2.c
+++ b/src/egl/drivers/dri2/egl_dri2.c
@@ -272,7 +272,10 @@ dri2_add_config(_EGLDisplay *disp, const __DRIconfig 
*dri_config, int id,
  _eglSetConfigKey(&base, EGL_MAX_PBUFFER_HEIGHT,
   _EGL_MAX_PBUFFER_HEIGHT);
  break;
-
+  case __DRI_ATTRIB_MUTABLE_RENDER_BUFFER:
+ if (disp->Extensions.KHR_mutable_render_buffer)
+surface_type |= EGL_MUTABLE_RENDER_BUFFER_BIT_KHR;
+ break;
   default:
  key = dri2_to_egl_attribute_map[attrib];
  if (key != 0)
@@ -432,6 +435,7 @@ static const struct dri2_extension_match 
optional_core_extensions[] = {
{ __DRI_IMAGE, 1, offsetof(struct dri2_egl_display, image) },
{ __DRI2_FLUSH_CONTROL, 1, offsetof(struct dri2_egl_display, flush_control) 
},
{ __DRI2_BLOB, 1, offsetof(struct dri2_egl_display, blob) },
+   { __DRI_MUTABLE_RENDER_BUFFER_DRIVER, 1, offsetof(struct dri2_egl_display, 
mutable_render_buffer) },
{ NULL, 0, 0 }
 };
 
@@ -1459,6 +1463,8 @@ dri2_make_current(_EGLDriver *drv, _EGLDisplay *disp, 
_EGLSurface *dsurf,
 {
struct dri2_egl_display *dri2_dpy = dri2_egl_display(disp);
struct dri2_egl_context *dri2_ctx = dri2_egl_context(ctx);
+   _EGLDisplay *old_disp = NULL;
+   struct dri2_egl_display *old_dri2_dpy = NULL;
_EGLContext *old_ctx;
_EGLSurface *old_dsurf, *old_rsurf;
_EGLSurface *tmp_dsurf, *tmp_rsurf;
@@ -1475,6 +1481,11 @@ dri2_make_current(_EGLDriver *drv, _EGLDisplay *disp, 
_EGLSurface *dsurf,
   return EGL_FALSE;
}
 
+   if (old_ctx) {
+  old_disp = old_ctx->Resource.Display;
+  old_dri2_dpy = dri2_egl_display(old_disp);
+   }
+
/* flush before context switch */
if (old_ctx)
   dri2_gl_flush();
@@ -1488,6 +1499,13 @@ dri2_make_current(_EGLDriver *drv, _EGLDisplay *disp, 
_EGLSurface *dsurf,
 
   if (old_dsurf)
  dri2_surf_update_fence_fd(old_ctx, disp, old_dsurf);
+
+  /* Disable shared buffer mode */
+  if (old_dsurf && _eglSurfaceInSharedBufferMode(old_dsurf) &&
+  old_dri2_dpy->vtbl->set_shared_buffer_mode) {
+ old_dri2_dpy->vtbl->set_shared_buffer_mode(old_disp, old_dsurf, 
false);
+  }
+
   dri2_dpy->core->unbindContext(old_cctx);
}
 
@@ -1500,6 +1518,11 @@ dri2_make_current(_EGLDriver *drv, _EGLDisplay *disp, 
_EGLSurface *dsurf,
  tmp_dsurf == dsurf &&
  tmp_rsurf == rsurf);
 
+  if (old_dsurf && _eglSurfaceInSharedBufferMode(old_dsurf) &&
+  old_dri2_dpy->vtbl->set_shared_buffer_mode) {
+ old_dri2_dpy->vtbl->set_shared_buffer_mode(old_disp, old_dsurf, true);
+  }
+
   _eglPutSurface(dsurf);
   _eglPutSurface(rsurf);
   _eglPutContext(ctx);
@@ -1522,11 +1545,22 @@ dri2_make_current(_EGLDriver *drv, _EGLDisplay *disp, 
_EGLSurface *dsurf,
   dri2_dpy->ref_count++;
 
if (old_ctx) {
-  EGLDisplay old_disp = _eglGetDisplayHandle(old_ctx->Resource.Display);
   dri2_destroy_context(drv, disp, old_ctx);
   dri2_display_release(old_disp);
}
 
+   if (dsurf && _eglSurfaceHasMutableRenderBuffer(dsurf) &&
+   dri2_dpy->vtbl->set_shared_buffer_mode) {
+  /* Always update the shared buffer mode. This is obviously needed when
+   * the active EGL_RENDER_BUFFER is EGL_SINGLE_BUFFER. When
+   * EGL_RENDER_BUFFER is EGL_BACK_BUFFER, the update protects us in the
+   * case where external non-EGL API may have changed window's shared
+   * buffer mode since we last saw it.
+   */
+  bool mode = (dsurf->ActiveRenderBuffer == EGL_SINGLE_BUFFER);
+  dri2_dpy->vtbl->set_shared_buffer_mode(disp, dsurf, mode);
+   }
+
return EGL_TRUE;
 }
 
diff --git a/src/egl/drivers/dri2/egl_dri2.h b/src/egl/drivers/dri2/egl_dri2.h
index 5d8fbfa2356..d8a65be7085 100644
--- a/src/egl/drivers/dri2/egl_dri2.h
+++ b/src/egl/drivers/dri2/egl_dri2.h
@@ -151,6 +151,12 @@ struct dri2_egl_display_vtbl {
__DRIdrawable *(*get_dri_drawable)(_EGLSurface *surf);
 
void (*close_screen_notify)(_EGLDisplay *dpy);
+
+   /* Used in EGL_KHR_mutable_render_buffer to update the native window's
+* shared buffer mode.
+*/
+   bool (*set_shared_buffer_mode)(_EGLDisplay *dpy, _EGLSurface *surf,
+  bool mode);
 };
 
 struct dri2_egl_display
@@ -178,6 +184,7 @@ struct dri2_egl_display
const __DRI2blobExtension *blob;
const __DRI2rendererQuery

Re: [Mesa-dev] [PATCH 2/2] gallium/u_vbuf: handle indirect multidraws correctly and efficiently (v2)

2018-08-02 Thread Marek Olšák
On Fri, Jul 27, 2018 at 5:46 PM, Marek Olšák  wrote:
> On Fri, Jul 27, 2018 at 5:08 PM, Eric Anholt  wrote:
>> Marek Olšák  writes:
>>
>>> From: Marek Olšák 
>>>
>>> v2: need to do MAX{start+count} instead of MAX{count}
>>> added piglit tests
>>> ---
>>>  src/gallium/auxiliary/util/u_vbuf.c | 199 
>>>  1 file changed, 175 insertions(+), 24 deletions(-)
>>>
>>> diff --git a/src/gallium/auxiliary/util/u_vbuf.c 
>>> b/src/gallium/auxiliary/util/u_vbuf.c
>>> index 746ff1085ce..ca53e6218fd 100644
>>> --- a/src/gallium/auxiliary/util/u_vbuf.c
>>> +++ b/src/gallium/auxiliary/util/u_vbuf.c
>>> @@ -1124,20 +1124,45 @@ static void u_vbuf_set_driver_vertex_buffers(struct 
>>> u_vbuf *mgr)
>>> unsigned start_slot, count;
>>>
>>> start_slot = ffs(mgr->dirty_real_vb_mask) - 1;
>>> count = util_last_bit(mgr->dirty_real_vb_mask >> start_slot);
>>>
>>> pipe->set_vertex_buffers(pipe, start_slot, count,
>>>  mgr->real_vertex_buffer + start_slot);
>>> mgr->dirty_real_vb_mask = 0;
>>>  }
>>>
>>> +static void
>>> +u_vbuf_split_indexed_multidraw(struct u_vbuf *mgr, struct pipe_draw_info 
>>> *info,
>>> +   unsigned *indirect_data, unsigned stride,
>>> +   unsigned draw_count)
>>> +{
>>> +   assert(info->index_size);
>>> +   info->indirect = NULL;
>>> +
>>> +   for (unsigned i = 0; i < draw_count; i++) {
>>> +  unsigned offset = i * stride / 4;
>>> +
>>> +  info->count = indirect_data[offset + 0];
>>> +  info->instance_count = indirect_data[offset + 1];
>>> +
>>> +  if (!info->count || !info->instance_count)
>>> + continue;
>>> +
>>> +  info->start = indirect_data[offset + 2];
>>> +  info->index_bias = indirect_data[offset + 3];
>>> +  info->start_instance = indirect_data[offset + 4];
>>> +
>>> +  u_vbuf_draw_vbo(mgr, info);
>>> +   }
>>> +}
>>> +
>>>  void u_vbuf_draw_vbo(struct u_vbuf *mgr, const struct pipe_draw_info *info)
>>>  {
>>> struct pipe_context *pipe = mgr->pipe;
>>> int start_vertex;
>>> unsigned min_index;
>>> unsigned num_vertices;
>>> boolean unroll_indices = FALSE;
>>> const uint32_t used_vb_mask = mgr->ve->used_vb_mask;
>>> uint32_t user_vb_mask = mgr->user_vb_mask & used_vb_mask;
>>> const uint32_t incompatible_vb_mask =
>>> @@ -1153,47 +1178,172 @@ void u_vbuf_draw_vbo(struct u_vbuf *mgr, const 
>>> struct pipe_draw_info *info)
>>>if (mgr->dirty_real_vb_mask & used_vb_mask) {
>>>   u_vbuf_set_driver_vertex_buffers(mgr);
>>>}
>>>
>>>pipe->draw_vbo(pipe, info);
>>>return;
>>> }
>>>
>>> new_info = *info;
>>>
>>> -   /* Fallback. We need to know all the parameters. */
>>> +   /* Handle indirect (multi)draws. */
>>> if (new_info.indirect) {
>>> -  struct pipe_transfer *transfer = NULL;
>>> -  int *data;
>>> -
>>> -  if (new_info.index_size) {
>>> - data = pipe_buffer_map_range(pipe, new_info.indirect->buffer,
>>> -  new_info.indirect->offset, 20,
>>> -  PIPE_TRANSFER_READ, &transfer);
>>> - new_info.index_bias = data[3];
>>> - new_info.start_instance = data[4];
>>> -  }
>>> -  else {
>>> - data = pipe_buffer_map_range(pipe, new_info.indirect->buffer,
>>> -  new_info.indirect->offset, 16,
>>> -  PIPE_TRANSFER_READ, &transfer);
>>> - new_info.start_instance = data[3];
>>> +  const struct pipe_draw_indirect_info *indirect = new_info.indirect;
>>> +  unsigned draw_count = 0;
>>> +
>>> +  /* Get the number of draws. */
>>> +  if (indirect->indirect_draw_count) {
>>> + pipe_buffer_read(pipe, indirect->indirect_draw_count,
>>> +  indirect->indirect_draw_count_offset,
>>> +  4, &draw_count);
>>> +  } else {
>>> + draw_count = indirect->draw_count;
>>>}
>>>
>>> -  new_info.count = data[0];
>>> -  new_info.instance_count = data[1];
>>> -  new_info.start = data[2];
>>> -  pipe_buffer_unmap(pipe, transfer);
>>> -  new_info.indirect = NULL;
>>> -
>>> -  if (!new_info.count)
>>> +  if (!draw_count)
>>>   return;
>>> +
>>> +  unsigned data_size = (draw_count - 1) * indirect->stride +
>>> +   (new_info.index_size ? 20 : 16);
>>> +  unsigned *data = alloca(data_size);
>>
>> I continue to believe that alloca isn't something we should be using on
>> unbounded data_size like this.  We should be returing GL_OUT_OF_MEMORY
>> when we fail, not segfaulting.
>>
>> We're already reading back the BOs, it's not like the allocation is a
>> performance concern at this point.
>
> radeonsi has optimizations where reading back BOs has no performance
> impact other than reading from uncached memory, i.e. no sync and no
> mmap overhead.

Re: [Mesa-dev] [PATCH] drisw: Fix build on Android Nougat, which lacks shm (v2)

2018-08-02 Thread David Airlie
On Tue, Jul 31, 2018 at 1:17 PM, Chad Versace 
wrote:

> In commit cf54bd5e8, dri_sw_winsys.c began using  to support
> the new functions putImageShm, getImageShm in DRI_SWRastLoader. But
> Android began supporting System V shared memory only in Oreo. Nougat has
> no shm headers.
>
> Fix the build by ifdef'ing out the shm code on Nougat.


> Fixes: cf54bd5e8 "drisw: use shared memory when possible"
> Cc: Marc-André Lureau 
> Cc: Dave Airlie 
> ---
>
> Dave, is this what you had in mind?
>

Yeah that seems a lot more acceptable.

Reviewed-by: Dave Airlie 

>
> I considered putting a check in configure.ac for HAVE_SHM, but decided
> against it because (1) another Autoconf check would slow down everyone's
> build for a niche case that only a few people care about, and (2) it
> only affected this file.
>
>  src/gallium/winsys/sw/dri/dri_sw_winsys.c | 11 +++
>  1 file changed, 11 insertions(+)
>
> diff --git a/src/gallium/winsys/sw/dri/dri_sw_winsys.c
> b/src/gallium/winsys/sw/dri/dri_sw_winsys.c
> index 40007200a5d..d519bcfedd3 100644
> --- a/src/gallium/winsys/sw/dri/dri_sw_winsys.c
> +++ b/src/gallium/winsys/sw/dri/dri_sw_winsys.c
> @@ -26,8 +26,12 @@
>   *
>   
> **/
>
> +#if !defined(ANDROID) || ANDROID_API_LEVEL >= 26
> +/* Android's libc began supporting shm in Oreo */
> +#define HAVE_SHM
>  #include 
>  #include 
> +#endif
>
>  #include "pipe/p_compiler.h"
>  #include "pipe/p_format.h"
> @@ -83,6 +87,7 @@ dri_sw_is_displaytarget_format_supported( struct
> sw_winsys *ws,
> return TRUE;
>  }
>
> +#ifdef HAVE_SHM
>  static char *
>  alloc_shm(struct dri_sw_displaytarget *dri_sw_dt, unsigned size)
>  {
> @@ -101,6 +106,7 @@ alloc_shm(struct dri_sw_displaytarget *dri_sw_dt,
> unsigned size)
>
> return addr;
>  }
> +#endif
>
>  static struct sw_displaytarget *
>  dri_sw_displaytarget_create(struct sw_winsys *winsys,
> @@ -131,8 +137,11 @@ dri_sw_displaytarget_create(struct sw_winsys *winsys,
> size = dri_sw_dt->stride * nblocksy;
>
> dri_sw_dt->shmid = -1;
> +
> +#ifdef HAVE_SHM
> if (ws->lf->put_image_shm)
>dri_sw_dt->data = alloc_shm(dri_sw_dt, size);
> +#endif
>
> if(!dri_sw_dt->data)
>dri_sw_dt->data = align_malloc(size, alignment);
> @@ -156,8 +165,10 @@ dri_sw_displaytarget_destroy(struct sw_winsys *ws,
> struct dri_sw_displaytarget *dri_sw_dt = dri_sw_displaytarget(dt);
>
> if (dri_sw_dt->shmid >= 0) {
> +#ifdef HAVE_SHM
>shmdt(dri_sw_dt->data);
>shmctl(dri_sw_dt->shmid, IPC_RMID, 0);
> +#endif
> } else {
>align_free(dri_sw_dt->data);
> }
> --
> 2.18.0.345.g5c9ce644c3-goog
>
>
___
mesa-dev mailing list
mesa-dev@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/mesa-dev


Re: [Mesa-dev] [RFC] add a config file for dri loader to choose a different dri driver

2018-08-02 Thread Marek Olšák
On my machine, the global drirc resides in /usr/etc/. I guess it's in
a different place for each person. :)

Marek

On Tue, Jul 31, 2018 at 2:08 PM, Adam Jackson  wrote:
> On Tue, 2018-07-31 at 08:03 +, Yu, Qiang wrote:
>> Seems the mesa driconf infrastructure is just what I need:
>> https://dri.freedesktop.org/wiki/ConfigurationInfrastructure/
>>
>> So I can reference the loader_get_dri_config_device_id implementation
>> for adding loader driver override functionality in /etc/drirc:
>> 
>>   
>> 
>>   
>> 
>>
>> Thoughts?
>
> If you're going to go down this route, please also teach Mesa to look
> for drirc (or drirc.d) under /usr/share first, then /etc. /etc really
> is for per-machine configuration, Mesa and driver defaults properly
> belong in /usr/share.
>
> - ajax
> ___
> 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 2/2] gallium/u_vbuf: handle indirect multidraws correctly and efficiently (v2)

2018-08-02 Thread Eric Anholt
Marek Olšák  writes:

> On Fri, Jul 27, 2018 at 5:46 PM, Marek Olšák  wrote:
>> On Fri, Jul 27, 2018 at 5:08 PM, Eric Anholt  wrote:
>>> Marek Olšák  writes:
>>>
 From: Marek Olšák 

 v2: need to do MAX{start+count} instead of MAX{count}
 added piglit tests
 ---
  src/gallium/auxiliary/util/u_vbuf.c | 199 
  1 file changed, 175 insertions(+), 24 deletions(-)

 diff --git a/src/gallium/auxiliary/util/u_vbuf.c 
 b/src/gallium/auxiliary/util/u_vbuf.c
 index 746ff1085ce..ca53e6218fd 100644
 --- a/src/gallium/auxiliary/util/u_vbuf.c
 +++ b/src/gallium/auxiliary/util/u_vbuf.c
 @@ -1124,20 +1124,45 @@ static void 
 u_vbuf_set_driver_vertex_buffers(struct u_vbuf *mgr)
 unsigned start_slot, count;

 start_slot = ffs(mgr->dirty_real_vb_mask) - 1;
 count = util_last_bit(mgr->dirty_real_vb_mask >> start_slot);

 pipe->set_vertex_buffers(pipe, start_slot, count,
  mgr->real_vertex_buffer + start_slot);
 mgr->dirty_real_vb_mask = 0;
  }

 +static void
 +u_vbuf_split_indexed_multidraw(struct u_vbuf *mgr, struct pipe_draw_info 
 *info,
 +   unsigned *indirect_data, unsigned stride,
 +   unsigned draw_count)
 +{
 +   assert(info->index_size);
 +   info->indirect = NULL;
 +
 +   for (unsigned i = 0; i < draw_count; i++) {
 +  unsigned offset = i * stride / 4;
 +
 +  info->count = indirect_data[offset + 0];
 +  info->instance_count = indirect_data[offset + 1];
 +
 +  if (!info->count || !info->instance_count)
 + continue;
 +
 +  info->start = indirect_data[offset + 2];
 +  info->index_bias = indirect_data[offset + 3];
 +  info->start_instance = indirect_data[offset + 4];
 +
 +  u_vbuf_draw_vbo(mgr, info);
 +   }
 +}
 +
  void u_vbuf_draw_vbo(struct u_vbuf *mgr, const struct pipe_draw_info 
 *info)
  {
 struct pipe_context *pipe = mgr->pipe;
 int start_vertex;
 unsigned min_index;
 unsigned num_vertices;
 boolean unroll_indices = FALSE;
 const uint32_t used_vb_mask = mgr->ve->used_vb_mask;
 uint32_t user_vb_mask = mgr->user_vb_mask & used_vb_mask;
 const uint32_t incompatible_vb_mask =
 @@ -1153,47 +1178,172 @@ void u_vbuf_draw_vbo(struct u_vbuf *mgr, const 
 struct pipe_draw_info *info)
if (mgr->dirty_real_vb_mask & used_vb_mask) {
   u_vbuf_set_driver_vertex_buffers(mgr);
}

pipe->draw_vbo(pipe, info);
return;
 }

 new_info = *info;

 -   /* Fallback. We need to know all the parameters. */
 +   /* Handle indirect (multi)draws. */
 if (new_info.indirect) {
 -  struct pipe_transfer *transfer = NULL;
 -  int *data;
 -
 -  if (new_info.index_size) {
 - data = pipe_buffer_map_range(pipe, new_info.indirect->buffer,
 -  new_info.indirect->offset, 20,
 -  PIPE_TRANSFER_READ, &transfer);
 - new_info.index_bias = data[3];
 - new_info.start_instance = data[4];
 -  }
 -  else {
 - data = pipe_buffer_map_range(pipe, new_info.indirect->buffer,
 -  new_info.indirect->offset, 16,
 -  PIPE_TRANSFER_READ, &transfer);
 - new_info.start_instance = data[3];
 +  const struct pipe_draw_indirect_info *indirect = new_info.indirect;
 +  unsigned draw_count = 0;
 +
 +  /* Get the number of draws. */
 +  if (indirect->indirect_draw_count) {
 + pipe_buffer_read(pipe, indirect->indirect_draw_count,
 +  indirect->indirect_draw_count_offset,
 +  4, &draw_count);
 +  } else {
 + draw_count = indirect->draw_count;
}

 -  new_info.count = data[0];
 -  new_info.instance_count = data[1];
 -  new_info.start = data[2];
 -  pipe_buffer_unmap(pipe, transfer);
 -  new_info.indirect = NULL;
 -
 -  if (!new_info.count)
 +  if (!draw_count)
   return;
 +
 +  unsigned data_size = (draw_count - 1) * indirect->stride +
 +   (new_info.index_size ? 20 : 16);
 +  unsigned *data = alloca(data_size);
>>>
>>> I continue to believe that alloca isn't something we should be using on
>>> unbounded data_size like this.  We should be returing GL_OUT_OF_MEMORY
>>> when we fail, not segfaulting.
>>>
>>> We're already reading back the BOs, it's not like the allocation is a
>>> performance concern at this point.
>>

Re: [Mesa-dev] [PATCH v3 1/8] nir: evaluate if condition uses inside the if branches

2018-08-02 Thread Marek Olšák
On Wed, Aug 1, 2018 at 2:39 AM, Dieter Nützel  wrote:
> Am 01.08.2018 05:56, schrieb Timothy Arceri:
>>
>> On 01/08/18 13:09, Dieter Nützel wrote:
>>>
>>> Am 31.07.2018 13:34, schrieb Timothy Arceri:

 On 31/07/18 13:50, Dieter Nützel wrote:
>
> Am 30.07.2018 05:24, schrieb Dieter Nützel:
>>
>> For the series
>>
>> Tested-by: Dieter Nützel 
>>
>> with glmark2, glxgears, UH, UV, Blender 2.79 and FreeCAD 0.17
>>
>> on RX 580.
>>
>> With UH I saw some small light blue triangles spreading around.
>> Have to bisect which patch set was the culprit. (If I have some time.)
>> Tried your's above
>> configure-bump-libdrm-for-AMDGPU-to-2.4.92.mbox (Samuel)
>> ASTC-texture-compression-for-all-Gallium-drivers.mbox (Marek)
>>
>> Dieter
>
>
> It has something to do with tessellation.
> If I disable it (F3) all small light blue triangles are _gone_.


 Are you able to bisect?
>>>
>>>
>>> In short, it has _nothing_ to do with _this_ series.
>>> Tested on e6ff5ac446.
>>> So my tb stands.
>>>
>>> After some sleep (Nothern Germany is _very_ hot and _dry_ this year) I'll
>>> do my very best... ;-)
>>
>>
>> hehe. Yes I've experienced a "heat wave" in Northern Europe before,
>> but some of us have very different definitions of _very_ hot and _dry_
>> :P
>
>
> With tonight's shower we had only _4_ (really 3, first day was 10 minutes
> with only some drops)
> days with rain since last week of April!!!
> Our fields and forests need badly water.
> We never had such dry spring/early summer/summer for ages.
>
> So back to work.
>
> /opt/mesa> git bisect bad
> 86b52d42368ac496fe24bc6674e754c323381635 is the first bad commit
> commit 86b52d42368ac496fe24bc6674e754c323381635
> Author: Marek Olšák 
> Date:   Fri Jul 13 00:23:36 2018 -0400
>
> radeonsi: reduce LDS stalls by 40% for tessellation
>
> 40% is the decrease in the LGKM counter (which includes SMEM too)
> for the GFX9 LSHS stage.
>
> This will make the LDS size slightly larger, but I wasn't able to
> increase
> the patch stride without corruption, so I'm increasing the vertex
> stride.
>
> :04 04 8d457bbd593fe44ca0c7080820f3428f64d5ba19
> 56feae85455f50d6e5ab7a0285db7319d0601afe M src
>
> Reverting it (on top of master + _this_ series) makes all smooth and
> dandy, again - at least on RX580.
>
> Going to bed.

Can you provide more info? Is it only happening with NIR?

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


Re: [Mesa-dev] [PATCH v3 1/8] nir: evaluate if condition uses inside the if branches

2018-08-02 Thread Dieter Nützel

Am 30.07.2018 05:24, schrieb Dieter Nützel:

For the series

Tested-by: Dieter Nützel 

with glmark2, glxgears, UH, UV, Blender 2.79 and FreeCAD 0.17

on RX 580.

With UH I saw some small light blue triangles spreading around.
Have to bisect which patch set was the culprit. (If I have some time.)
Tried your's above
configure-bump-libdrm-for-AMDGPU-to-2.4.92.mbox (Samuel)
ASTC-texture-compression-for-all-Gallium-drivers.mbox (Marek)

Dieter


It has something to do with tessellation.
If I disable it (F3) all small light blue triangles are _gone_.

Regards,
Dieter


Am 28.07.2018 03:07, schrieb Timothy Arceri:

On 28/07/18 11:06, Timothy Arceri wrote:

Since we know what side of the branch we ended up on we can just
replace the use with a constant.

All the spill changes in shader-db are from Dolphin uber shaders,
despite some small regressions the change is clearly positive.

V2: insert new constant after any phis in the
 use->parent_instr->type == nir_instr_type_phi path.


Meh this was meant to be V3
___
mesa-dev mailing list
mesa-dev@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/mesa-dev

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

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


Re: [Mesa-dev] [PATCH] vc4: Fix automake linking error.

2018-08-02 Thread Andres Gomez
The problem seemed to be scons itself.

Therefore, this is:

Reviewed-by: Andres Gomez 


On Wed, 2018-08-01 at 18:03 +0300, Andres Gomez wrote:
> This looks good but, unfortunately, it seems to be breaking Travis
> build for the scons targets:
> https://travis-ci.org/Igalia/mesa/jobs/410431266
> 
> Please, Eric, could you try to see a way of solving this. I'm stuck not
>  being able to create the 18.2 branch because of this build regression.
> 
> On Tue, 2018-07-31 at 19:14 +0200, Juan A. Suarez Romero wrote:
> >   CXXLDgallium_dri.la
> > ../../../../src/gallium/drivers/vc4/.libs/libvc4.a(vc4_cl_dump.o): In 
> > function `vc4_dump_cl':
> > src/gallium/drivers/vc4/vc4_cl_dump.c:45: undefined reference to 
> > `clif_dump_init'
> > src/gallium/drivers/vc4/vc4_cl_dump.c:82: undefined reference to 
> > `clif_dump_destroy'
> > ../../../../src/broadcom/cle/.libs/libbroadcom_cle.a(cle_libbroadcom_cle_la-v3d_decoder.o):
> >  In function `v3d_field_iterator_next':
> > src/broadcom/cle/v3d_decoder.c:902: undefined reference to `clif_lookup_bo'
> > 
> > Fixes: e92959c4e0 ("v3d: Pass the whole clif_dump structure to 
> > v3d_print_group().")
> > CC: Eric Anholt 
> > ---
> >  src/gallium/drivers/vc4/Automake.inc | 7 +++
> >  1 file changed, 7 insertions(+)
> > 
> > diff --git a/src/gallium/drivers/vc4/Automake.inc 
> > b/src/gallium/drivers/vc4/Automake.inc
> > index b1aa9726bd6..c9afa2478e9 100644
> > --- a/src/gallium/drivers/vc4/Automake.inc
> > +++ b/src/gallium/drivers/vc4/Automake.inc
> > @@ -7,4 +7,11 @@ TARGET_LIB_DEPS += \
> > $(top_builddir)/src/gallium/drivers/vc4/libvc4.la \
> > $(top_builddir)/src/broadcom/cle/libbroadcom_cle.la
> >  
> > +if !HAVE_GALLIUM_V3D
> > +TARGET_LIB_DEPS += \
> > +   $(top_builddir)/src/broadcom/libbroadcom.la \
> > +   $(top_builddir)/src/broadcom/libbroadcom_v33.la \
> > +   $(top_builddir)/src/broadcom/libbroadcom_v41.la
> > +endif
> > +
> >  endif
> 
> ___
> mesa-dev mailing list
> mesa-dev@lists.freedesktop.org
> https://lists.freedesktop.org/mailman/listinfo/mesa-dev
-- 
Br,

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


Re: [Mesa-dev] [PATCH 6/6] mesa: replace binary constants with hexadecimal constants

2018-08-02 Thread Ilia Mirkin
On Wed, Aug 1, 2018 at 2:53 PM, Andres Gomez  wrote:
> The binary constant notation "0b" is a GCC extension. Instead, we use
> hexadecimal notation to fix the MSVC 2013 build:
>
> Compiling src\mesa\main\texcompress_astc.cpp ...
> texcompress_astc.cpp
> src\mesa\main\texcompress_astc.cpp(111) : error C2059: syntax error : 'bad 
> suffix on number'
>
> ...
>
> src\mesa\main\texcompress_astc.cpp(1007) : fatal error C1003: error count 
> exceeds 100; stopping compilation
> scons: *** [build\windows-x86-debug\mesa\main\texcompress_astc.obj] Error 2
> scons: building terminated because of errors.
>
> Fixes: 38ab39f6501 ("mesa: add ASTC 2D LDR decoder")
> Cc: Marek Olšák 
> Cc: Brian Paul 
> Cc: Roland Scheidegger 
> Cc: Mike Lothian 
> Cc: Gert Wollny 
> Cc: Dieter Nützel 
> Signed-off-by: Andres Gomez 
> ---
>  src/mesa/main/texcompress_astc.cpp | 116 ++---
>  1 file changed, 58 insertions(+), 58 deletions(-)
>
> diff --git a/src/mesa/main/texcompress_astc.cpp 
> b/src/mesa/main/texcompress_astc.cpp
> index 996e8ea28d6..ae2733ea333 100644
> --- a/src/mesa/main/texcompress_astc.cpp
> +++ b/src/mesa/main/texcompress_astc.cpp
> @@ -1345,30 +1345,30 @@ void Block::unquantise_colour_endpoints()
>  D = v >> 1;
>  break;
>   case 2:
> -B = (v & 0b10) ? 0b100010110 : 0b0;
> +B = (v & 0x2) ? 0x116 : 0x000;
>  C = 93;
>  D = v >> 2;
>  break;
>   case 3:
> -t = ((v >> 1) & 0b11);
> +t = ((v >> 1) & 0x3);
>  B = t | (t << 2) | (t << 7);
>  C = 44;
>  D = v >> 3;
>  break;
>   case 4:
> -t = ((v >> 1) & 0b111);
> +t = ((v >> 1) & 0x5);

0x7

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


Re: [Mesa-dev] [PATCH] glx: Add checks for context being direct before calling GetGLXDRIDrawable

2018-08-02 Thread Adam Jackson
On Wed, 2018-08-01 at 17:15 +0300, Danylo Piliaiev wrote:
> If indirect context is explicitly created by application and not
> with LIBGL_ALWAYS_INDIRECT=1 then dri may be initialized in
> __glXInitialize which allows Mesa to take invalid code paths
> due to GetGLXDRIDrawable returning non-null value.

This doesn't make any sense. Initializing DRI doesn't add any GLX
drawables to the hash, unless something deeply insane is going on.

> In most such places there are already checks for context being
> direct before calling GetGLXDRIDrawable. This patch adds checks
> where they were missed.

These checks are pretty much all wrong. Whether a drawable has direct
context state is orthogonal to whether the current context is direct,
you could have two contexts with different directness.

> Bugzilla: https://bugs.freedesktop.org/show_bug.cgi?id=42699
> 
> Signed-off-by: Danylo Piliaiev 
> ---
>  src/glx/glx_pbuffer.c | 12 ++--
>  src/glx/glxcmds.c |  3 +++
>  2 files changed, 13 insertions(+), 2 deletions(-)
> 
> diff --git a/src/glx/glx_pbuffer.c b/src/glx/glx_pbuffer.c
> index fd3327f120..6ee2ed58d2 100644
> --- a/src/glx/glx_pbuffer.c
> +++ b/src/glx/glx_pbuffer.c
> @@ -133,6 +133,10 @@ ChangeDrawableAttribute(Display * dpy, GLXDrawable 
> drawable,
> SyncHandle();
>  
>  #ifdef GLX_DIRECT_RENDERING
> +   struct glx_context *gc = __glXGetCurrentContext();
> +   if (!gc->isDirect)
> +  return;
> +

This is saying "if the current context is direct, then refuse to tell
the server that we want to change this drawable", which can't be right.

> @@ -316,7 +320,11 @@ __glXGetDrawableAttribute(Display * dpy, GLXDrawable 
> drawable,
>return 0;
>  
>  #if defined(GLX_DIRECT_RENDERING) && !defined(GLX_USE_APPLEGL)
> -   pdraw = GetGLXDRIDrawable(dpy, drawable);
> +   struct glx_context *gc = __glXGetCurrentContext();
> +
> +   if (gc->isDirect) {
> +  pdraw = GetGLXDRIDrawable(dpy, drawable);
> +   }

Again, whether the drawable has DRI state attached to it is not a
property of the current context.

I don't see how the existing code would be wrong to begin with. Even if
__glXInitialize does set up DRI state on the screen, it's not going to
add any drawables to the hash table, so this should still hit the pdraw
== NULL case below it safely.

> if (attribute == GLX_BACK_BUFFER_AGE_EXT) {
>struct glx_context *gc = __glXGetCurrentContext();
> diff --git a/src/glx/glxcmds.c b/src/glx/glxcmds.c
> index 4db0228eab..3eb86b02a9 100644
> --- a/src/glx/glxcmds.c
> +++ b/src/glx/glxcmds.c
> @@ -799,6 +799,8 @@ glXDestroyGLXPixmap(Display * dpy, GLXPixmap glxpixmap)
> DestroyGLXDrawable(dpy, glxpixmap);
>  
>  #if defined(GLX_DIRECT_RENDERING) && !defined(GLX_USE_APPLEGL)
> +   struct glx_context *gc = __glXGetCurrentContext();
> +   if (gc->isDirect)
> {
>struct glx_display *const priv = __glXInitialize(dpy);
>__GLXDRIdrawable *pdraw = GetGLXDRIDrawable(dpy, glxpixmap);

I believe this would introduce a leak case. If your current context is
indirect, and you glXDestroyGLXPixmap() on a pixmap with DRI state,
you'll never free that DRI state.

> @@ -831,6 +833,7 @@ glXSwapBuffers(Display * dpy, GLXDrawable drawable)
> gc = __glXGetCurrentContext();
>  
>  #if defined(GLX_DIRECT_RENDERING) && !defined(GLX_USE_APPLEGL)
> +   if (gc->isDirect)
> {
>__GLXDRIdrawable *pdraw = GetGLXDRIDrawable(dpy, drawable);
>  

The real problem here, I think, is that we need to store what kind of
DRI a given DRI drawable is, and look up its SwapBuffer method based on
that. Instead we just have one method for the whole screen, so if the
screen happens to support DRI3 and DRISW...

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


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

2018-08-02 Thread Ian Romanick
Yes, please!  I have a similar patch around somewhere that was waiting
for a user before sending.

Reviewed-by: Ian Romanick 

On 07/26/2018 08:59 AM, Jason Ekstrand wrote:
> They're all just querying things about the list and not mutating
> anything.
> ---
>  src/util/list.h | 8 
>  1 file changed, 4 insertions(+), 4 deletions(-)
> 
> diff --git a/src/util/list.h b/src/util/list.h
> index 6edb7501109..09d1b4cae64 100644
> --- a/src/util/list.h
> +++ b/src/util/list.h
> @@ -72,7 +72,7 @@ static inline void list_addtail(struct list_head *item, 
> struct list_head *list)
>  list->prev = item;
>  }
>  
> -static inline bool list_empty(struct list_head *list);
> +static inline bool list_empty(const struct list_head *list);
>  
>  static inline void list_replace(struct list_head *from, struct list_head *to)
>  {
> @@ -101,7 +101,7 @@ static inline void list_delinit(struct list_head *item)
>  item->prev = item;
>  }
>  
> -static inline bool list_empty(struct list_head *list)
> +static inline bool list_empty(const struct list_head *list)
>  {
> return list->next == list;
>  }
> @@ -114,7 +114,7 @@ static inline bool list_is_singular(const struct 
> list_head *list)
> return list->next != NULL && list->next != list && list->next->next == 
> list;
>  }
>  
> -static inline unsigned list_length(struct list_head *list)
> +static inline unsigned list_length(const struct list_head *list)
>  {
> struct list_head *node;
> unsigned length = 0;
> @@ -145,7 +145,7 @@ static inline void list_splicetail(struct list_head *src, 
> struct list_head *dst)
> dst->prev = src->prev;
>  }
>  
> -static inline void list_validate(struct list_head *list)
> +static inline void list_validate(const struct list_head *list)
>  {
> struct list_head *node;
> assert(list->next->prev == list && list->prev->next == list);
> 

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


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

2018-08-02 Thread Chad Versace
On Tue 17 Jul 2018, Eric Engestrom wrote:
> On Thursday, 2018-07-12 16:13:55 -0700, David Riley wrote:
> > Allow platform_surfaceless to use swrast even if DRM is not available.
> > To be used to allow a fuzzer for virgl to be run on a jailed VM without
> > hardware GL or DRM support.
> > 
> > Signed-off-by: David Riley 
> > ---
> >  src/egl/drivers/dri2/platform_surfaceless.c | 20 
> >  1 file changed, 20 insertions(+)
> > 
> > diff --git a/src/egl/drivers/dri2/platform_surfaceless.c 
> > b/src/egl/drivers/dri2/platform_surfaceless.c
> > index f5fe711..3b17e95 100644
> > --- a/src/egl/drivers/dri2/platform_surfaceless.c
> > +++ b/src/egl/drivers/dri2/platform_surfaceless.c
> > @@ -293,6 +293,7 @@ surfaceless_probe_device(_EGLDisplay *dpy, bool swrast)
> > int fd;
> > int i;
> >  
> > +   // Attempt to find DRM device.
> 
> Nit: we use C-style comments in Mesa (`/* foo */`).
> 
> This can be fixed up when pushing your patches, which are both:
> Reviewed-by: Eric Engestrom 
> 
> Would you like me to push the patches for you?

Hi David & Eric, I pushed these to master.
___
mesa-dev mailing list
mesa-dev@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/mesa-dev


[Mesa-dev] [PATCH] docs/features: update vulkan 1.1 status

2018-08-02 Thread Fabio Pedretti
---
 docs/features.txt | 46 +++---
 1 file changed, 23 insertions(+), 23 deletions(-)

diff --git a/docs/features.txt b/docs/features.txt
index 46e5a25a75..1225042580 100644
--- a/docs/features.txt
+++ b/docs/features.txt
@@ -356,29 +356,29 @@ Vulkan 1.0 -- all DONE: anv, radv
 
 Vulkan 1.1 -- all DONE: anv, radv
 
-  VK_KHR_16bit_storage  in progress (Alejandro)
-  VK_KHR_bind_memory2   DONE (anv, radv)
-  VK_KHR_dedicated_allocation   DONE (anv, radv)
-  VK_KHR_descriptor_update_template DONE (anv, radv)
-  VK_KHR_device_group   not started
-  VK_KHR_device_group_creation  not started
-  VK_KHR_external_fence DONE (anv, radv)
-  VK_KHR_external_fence_capabilitiesDONE (anv, radv)
-  VK_KHR_external_memoryDONE (anv, radv)
-  VK_KHR_external_memory_capabilities   DONE (anv, radv)
-  VK_KHR_external_semaphore DONE (anv, radv)
-  VK_KHR_external_semaphore_capabilitiesDONE (anv, radv)
-  VK_KHR_get_memory_requirements2   DONE (anv, radv)
-  VK_KHR_get_physical_device_properties2DONE (anv, radv)
-  VK_KHR_maintenance1   DONE (anv, radv)
-  VK_KHR_maintenance2   DONE (anv, radv)
-  VK_KHR_maintenance3   DONE (anv, radv)
-  VK_KHR_multiview  DONE (anv, radv)
-  VK_KHR_relaxed_block_layout   DONE (anv, radv)
-  VK_KHR_sampler_ycbcr_conversion   DONE (anv)
-  VK_KHR_shader_draw_parameters DONE (anv, radv)
-  VK_KHR_storage_buffer_storage_class   DONE (anv, radv)
-  VK_KHR_variable_pointers  DONE (anv, radv)
+  VK_KHR_16bit_storage  DONE ()
+  VK_KHR_bind_memory2   DONE ()
+  VK_KHR_dedicated_allocation   DONE ()
+  VK_KHR_descriptor_update_template DONE ()
+  VK_KHR_device_group   DONE ()
+  VK_KHR_device_group_creation  DONE ()
+  VK_KHR_external_fence DONE ()
+  VK_KHR_external_fence_capabilitiesDONE ()
+  VK_KHR_external_memoryDONE ()
+  VK_KHR_external_memory_capabilities   DONE ()
+  VK_KHR_external_semaphore DONE ()
+  VK_KHR_external_semaphore_capabilitiesDONE ()
+  VK_KHR_get_memory_requirements2   DONE ()
+  VK_KHR_get_physical_device_properties2DONE ()
+  VK_KHR_maintenance1   DONE ()
+  VK_KHR_maintenance2   DONE ()
+  VK_KHR_maintenance3   DONE ()
+  VK_KHR_multiview  DONE ()
+  VK_KHR_relaxed_block_layout   DONE ()
+  VK_KHR_sampler_ycbcr_conversion   DONE ()
+  VK_KHR_shader_draw_parameters DONE ()
+  VK_KHR_storage_buffer_storage_class   DONE ()
+  VK_KHR_variable_pointers  DONE ()
 
 Khronos extensions that are not part of any Vulkan version:
   VK_KHR_8bit_storage   DONE (anv)
-- 
2.17.1

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


[Mesa-dev] [PATCH 3/6] kutil/queue: use util_snprintf() in util_queue_init

2018-08-02 Thread Andres Gomez
Instead of plain snprintf(). To fix the MSVC 2013 build:

  Compiling src\util\u_queue.c ...
u_queue.c
src\util\u_queue.c(325) : warning C4013: 'snprintf' undefined; assuming extern 
returning int

...

mesautil.lib(u_queue.obj) : error LNK2001: unresolved external symbol _snprintf
scons: building terminated because of errors.

Fixes: b238e33bc9d ("kutil/queue: add a process name into a thread name")
Cc: Marek Olšák 
Cc: Brian Paul 
Cc: Roland Scheidegger 
Cc: Timothy Arceri 
Cc: Eric Engestrom 
Signed-off-by: Andres Gomez 
---
 src/util/u_queue.c | 6 +++---
 1 file changed, 3 insertions(+), 3 deletions(-)

diff --git a/src/util/u_queue.c b/src/util/u_queue.c
index be95d9eec3f..95cb543494e 100644
--- a/src/util/u_queue.c
+++ b/src/util/u_queue.c
@@ -322,10 +322,10 @@ util_queue_init(struct util_queue *queue,
memset(queue, 0, sizeof(*queue));
 
if (process_len) {
-  snprintf(queue->name, sizeof(queue->name), "%.*s:%s",
-   process_len, process_name, name);
+  util_snprintf(queue->name, sizeof(queue->name), "%.*s:%s",
+process_len, process_name, name);
} else {
-  snprintf(queue->name, sizeof(queue->name), "%s", name);
+  util_snprintf(queue->name, sizeof(queue->name), "%s", name);
}
 
queue->flags = flags;
-- 
2.18.0

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


[Mesa-dev] [PATCH 4/6] ddebug: use util_snprintf() in dd_get_debug_filename_and_mkdir

2018-08-02 Thread Andres Gomez
Instead of plain snprintf(). To fix the MSVC 2013 build:

  Compiling src\gallium\auxiliary\driver_ddebug\dd_draw.c ...
dd_draw.c
c:\projects\mesa\src\gallium\auxiliary\driver_ddebug\dd_util.h(60) : warning 
C4013: 'snprintf' undefined; assuming extern returning int

...

gallium.lib(dd_draw.obj) : error LNK2001: unresolved external symbol _snprintf
build\windows-x86-debug\gallium\targets\graw-gdi\graw.dll : fatal error 
LNK1120: 1 unresolved externals
scons: *** [build\windows-x86-debug\gallium\targets\graw-gdi\graw.dll] Error 
1120
scons: building terminated because of errors.

Fixes: 6ff0c6f4ebc ("gallium: move ddebug, noop, rbug, trace to auxiliary to 
improve build times")
Cc: Marek Olšák 
Cc: Brian Paul 
Cc: Roland Scheidegger 
Cc: Nicolai Hähnle 
Signed-off-by: Andres Gomez 
---
 src/gallium/auxiliary/driver_ddebug/dd_util.h | 7 ---
 1 file changed, 4 insertions(+), 3 deletions(-)

diff --git a/src/gallium/auxiliary/driver_ddebug/dd_util.h 
b/src/gallium/auxiliary/driver_ddebug/dd_util.h
index 8953e34d588..7720e9af9ca 100644
--- a/src/gallium/auxiliary/driver_ddebug/dd_util.h
+++ b/src/gallium/auxiliary/driver_ddebug/dd_util.h
@@ -35,6 +35,7 @@
 #include "os/os_process.h"
 #include "util/u_atomic.h"
 #include "util/u_debug.h"
+#include "util/u_string.h"
 
 #include "pipe/p_config.h"
 #ifdef PIPE_OS_UNIX
@@ -57,13 +58,13 @@ dd_get_debug_filename_and_mkdir(char *buf, size_t buflen, 
bool verbose)
   strcpy(proc_name, "unknown");
}
 
-   snprintf(dir, sizeof(dir), "%s/"DD_DIR, debug_get_option("HOME", "."));
+   util_snprintf(dir, sizeof(dir), "%s/"DD_DIR, debug_get_option("HOME", "."));
 
if (mkdir(dir, 0774) && errno != EEXIST)
   fprintf(stderr, "dd: can't create a directory (%i)\n", errno);
 
-   snprintf(buf, buflen, "%s/%s_%u_%08u", dir, proc_name, getpid(),
-p_atomic_inc_return(&index) - 1);
+   util_snprintf(buf, buflen, "%s/%s_%u_%08u", dir, proc_name, getpid(),
+ p_atomic_inc_return(&index) - 1);
 
if (verbose)
   fprintf(stderr, "dd: dumping to file %s\n", buf);
-- 
2.18.0

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


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

2018-08-02 Thread Olivier Fourdan
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);
-- 
2.17.1

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


Re: [Mesa-dev] [PATCH 1/2] xmlconfig: read more config files from drirc.d/

2018-08-02 Thread Eric Engestrom
On Thursday, 2018-08-02 11:33:05 +0200, Michel Dänzer wrote:
> On 2018-08-01 01:10 PM, Qiang Yu wrote:
> > Add two places for hosting drirc config files:
> > /usr/share/drirc.d/ /etc/drirc.d/
> > 
> > Driver and application can put their drirc files in
> > these places with name xxx.conf. Config files will be
> > read and applied in file name alphabete order.
> > 
> > So there are four places for drirc listed in order:
> > 1. /usr/share/drirc.d/
> > 2. /etc/drirc.d/
> > 3. /etc/drirc
> > 4. ~/.drirc
> > 
> > Signed-off-by: Qiang Yu 
> 
> Mesa's own drirc should also be moved to
> $(datadir)/drirc.d/00-mesa-defaults.conf, either in this patch or a
> follow-up one.

Agreed, which means there won't be a /etc/drirc anymore.

If we do keep it though, I would expect /etc/drirc.d/10-foo.conf to
override /etc/drirc; in other words, I would swap 2 & 3 in that list
(and in the code).

With that, the patch itself is:
Reviewed-by: Eric Engestrom 
___
mesa-dev mailing list
mesa-dev@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/mesa-dev


Re: [Mesa-dev] [PATCH 05/14] intel: aubinator: simplify decoding

2018-08-02 Thread Eric Engestrom
On Thursday, 2018-08-02 10:39:17 +0100, Lionel Landwerlin wrote:
> Since we don't support streaming an aub file, we can drop the decoding
> status enum.
> 
> Signed-off-by: Lionel Landwerlin 
> ---
>  src/intel/tools/aubinator.c | 14 --
>  1 file changed, 4 insertions(+), 10 deletions(-)
> 
> diff --git a/src/intel/tools/aubinator.c b/src/intel/tools/aubinator.c
> index 3fec04c24c4..7caccb31d4d 100644
> --- a/src/intel/tools/aubinator.c
> +++ b/src/intel/tools/aubinator.c
> @@ -712,13 +712,7 @@ aub_file_open(const char *filename)
>  
>  #define MAKE_GEN(major, minor) ( ((major) << 8) | (minor) )
>  
> -enum {
> -   AUB_ITEM_DECODE_OK,
> -   AUB_ITEM_DECODE_FAILED,
> -   AUB_ITEM_DECODE_NEED_MORE_DATA,
> -};
> -
> -static int
> +static bool

You'll need to add #include 

With that, 2-6 are
Reviewed-by: Eric Engestrom 

>  aub_file_decode_batch(struct aub_file *file)
>  {
> uint32_t *p, h, *new_cursor;
> @@ -741,7 +735,7 @@ aub_file_decode_batch(struct aub_file *file)
>fprintf(outfile, "unknown opcode %d at %td/%td\n",
>OPCODE(h), file->cursor - file->map,
>file->end - file->map);
> -  return AUB_ITEM_DECODE_FAILED;
> +  return false;
> }
>  
> new_cursor = p + header_length + bias;
> @@ -782,7 +776,7 @@ aub_file_decode_batch(struct aub_file *file)
> }
> file->cursor = new_cursor;
>  
> -   return AUB_ITEM_DECODE_OK;
> +   return true;
>  }
>  
>  static int
> @@ -914,7 +908,7 @@ int main(int argc, char *argv[])
> file = aub_file_open(input_file);
>  
> while (aub_file_more_stuff(file) &&
> -  aub_file_decode_batch(file) == AUB_ITEM_DECODE_OK);
> +  aub_file_decode_batch(file));
>  
> fflush(stdout);
> /* close the stdout which is opened to write the output */
> -- 
> 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 1/2] xmlconfig: read more config files from drirc.d/

2018-08-02 Thread Michel Dänzer
On 2018-08-02 02:50 PM, Eric Engestrom wrote:
> On Thursday, 2018-08-02 11:33:05 +0200, Michel Dänzer wrote:
>> On 2018-08-01 01:10 PM, Qiang Yu wrote:
>>> Add two places for hosting drirc config files:
>>> /usr/share/drirc.d/ /etc/drirc.d/
>>>
>>> Driver and application can put their drirc files in
>>> these places with name xxx.conf. Config files will be
>>> read and applied in file name alphabete order.
>>>
>>> So there are four places for drirc listed in order:
>>> 1. /usr/share/drirc.d/
>>> 2. /etc/drirc.d/
>>> 3. /etc/drirc
>>> 4. ~/.drirc
>>>
>>> Signed-off-by: Qiang Yu 
>>
>> Mesa's own drirc should also be moved to
>> $(datadir)/drirc.d/00-mesa-defaults.conf, either in this patch or a
>> follow-up one.
> 
> Agreed, which means there won't be a /etc/drirc anymore.
> 
> If we do keep it though, I would expect /etc/drirc.d/10-foo.conf to
> override /etc/drirc; in other words, I would swap 2 & 3 in that list
> (and in the code).

Hmm, based on experience with Xorg, I'd rather keep /etc/drirc and not
add /etc/drirc.d/ than the other way around.

Is there a use case for an administrator using multiple snippets in
/etc/drirc.d/ ?


-- 
Earthling Michel Dänzer   |   http://www.amd.com
Libre software enthusiast | Mesa and X developer
___
mesa-dev mailing list
mesa-dev@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/mesa-dev


[Mesa-dev] [PATCH] meson: use correct keyword to fix a meson warning

2018-08-02 Thread Jon Turney
With a sufficently recent meson, the following warning is produced:

WARNING: Passed invalid keyword argument "extra_args".
WARNING: This will become a hard error in the future.

It seems that compiler.links(args:) is meant here.

Signed-off-by: Jon Turney 
---
 meson.build | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/meson.build b/meson.build
index 86a4a4ce6d..cbf88b5013 100644
--- a/meson.build
+++ b/meson.build
@@ -989,7 +989,7 @@ if cc.links('''
   freelocale(loc);
   return 0;
 }''',
-extra_args : pre_args,
+args : pre_args,
 name : 'strtod has locale support')
   pre_args += '-DHAVE_STRTOD_L'
 endif
-- 
2.17.0

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


Re: [Mesa-dev] [PATCH] meson: use correct keyword to fix a meson warning

2018-08-02 Thread Eric Engestrom
On Thursday, 2018-08-02 14:58:07 +0100, Jon Turney wrote:
> With a sufficently recent meson, the following warning is produced:
> 
> WARNING: Passed invalid keyword argument "extra_args".
> WARNING: This will become a hard error in the future.
> 
> It seems that compiler.links(args:) is meant here.
> 
> Signed-off-by: Jon Turney 

Noticed that warning too, but hadn't looked at what caused it.
Reviewed-and-Tested-by: Eric Engestrom 

> ---
>  meson.build | 2 +-
>  1 file changed, 1 insertion(+), 1 deletion(-)
> 
> diff --git a/meson.build b/meson.build
> index 86a4a4ce6d..cbf88b5013 100644
> --- a/meson.build
> +++ b/meson.build
> @@ -989,7 +989,7 @@ if cc.links('''
>freelocale(loc);
>return 0;
>  }''',
> -extra_args : pre_args,
> +args : pre_args,
>  name : 'strtod has locale support')
>pre_args += '-DHAVE_STRTOD_L'
>  endif
> -- 
> 2.17.0
> 
> ___
> mesa-dev mailing list
> mesa-dev@lists.freedesktop.org
> https://lists.freedesktop.org/mailman/listinfo/mesa-dev
___
mesa-dev mailing list
mesa-dev@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/mesa-dev


Re: [Mesa-dev] [PATCH 0/8] GL_AMD_framebuffer_multisample_advanced for RadeonSI

2018-08-02 Thread Brian Paul

On 08/01/2018 05:25 PM, Marek Olšák wrote:

Hi,

This implements GL_AMD_framebuffer_multisample_advanced, which is
AMD EQAA.

I have also sent out a piglit test that tests the new API.

Please review.


I did a quick read-through and it looks OK to me.

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


Re: [Mesa-dev] [PATCH 1/2] loader: add loader_open_name(..)

2018-08-02 Thread Christian Gmeiner
Hi Eric

Thanks for you code review!

Am Do., 2. Aug. 2018 um 13:09 Uhr schrieb Eric Engestrom
:
>
> On Wednesday, 2018-08-01 23:07:02 +0200, Christian Gmeiner wrote:
> > Add an improved drmOpenWithType(..) clone which fixes some serious
> > flaws. Some highlights:
> >  - using busid works only with PCI devices
> >  - open() w/o O_CLOEXEC
> >  - when build w/o udev - it creates a node: mkdir, chown(root), chmod, mknod
> >  - calls back into Xserver/DDX module
> >  - last but no least - borderline hacks with massive documentation [1]
> >to keep this running.
> >
> > Signed-off-by: Christian Gmeiner 
>
> The idea sounds good, but I have a few remarks below.
>
> > ---
> >  src/loader/loader.c | 79 +
> >  src/loader/loader.h |  3 ++
> >  2 files changed, 82 insertions(+)
> >
> > diff --git a/src/loader/loader.c b/src/loader/loader.c
> > index 43275484cc..c2d2122bb8 100644
> > --- a/src/loader/loader.c
> > +++ b/src/loader/loader.c
> > @@ -82,6 +82,85 @@ loader_open_device(const char *device_name)
> > return fd;
> >  }
> >
> > +static int
> > +open_minor(int minor, int type)
> > +{
> > +   const char *dev_name;
> > +   char buf[64];
> > +
> > +   switch (type) {
> > +   case DRM_NODE_PRIMARY:
> > +  dev_name = DRM_DEV_NAME;
> > +  break;
> > +   case DRM_NODE_CONTROL:
> > +  dev_name = DRM_CONTROL_DEV_NAME;
> > +  break;
> > +   case DRM_NODE_RENDER:
> > +  dev_name = DRM_RENDER_DEV_NAME;
> > +  break;
> > +   default:
> > +  return -EINVAL;
>
> This function is returning an fd, so this should be -1.
> That said, giving an invalid type here is a serious misuse of the api,
> so I think you should replace the default return here and below ([1])
> with an `unreachable("invalid DRM node type");`
>

Good idea.

> > +   };
>
> Nit: no need for `;` after a switch
>
> > +
> > +   sprintf(buf, dev_name, DRM_DIR_NAME, minor);
>
> unlikely, but you should probably use snprintf(buf, sizeof(buf), ...)
>
> You should also use the `util_*` versions from u_string.h for
> compatibility with toolchains that don't support them natively.
>

Will be changed in v2.

> > +
> > +   return loader_open_device(buf);
> > +}
> > +
> > +static int minor_base(int type)
> > +{
> > +switch (type) {
> > +case DRM_NODE_PRIMARY:
> > +return 0;
> > +case DRM_NODE_CONTROL:
> > +return 64;
> > +case DRM_NODE_RENDER:
> > +return 128;
> > +default:
> > +return -1;
>
> [1] ^ to replace with unreachable()
>

yep

> > +};
>
> (`;` again)
>
> > +}
> > +
> > +int
> > +loader_open_name(const char *name, int type)
> > +{
> > +   int base = minor_base(type);
> > +   drmVersionPtr version;
> > +   int i, fd;
> > +   char *id;
> > +
> > +   if (base < 0)
> > +  return -1;
>
> with unreachable() above, this can go
>

correct

> > +
> > +   /*
> > +   * Open the first minor number that matches the driver name and isn't
> > +   * already in use.  If it's in use it will have a busid assigned already.
> > +   */
> > +   for (i = base; i < base + DRM_MAX_MINOR; i++) {
> > +  if ((fd = open_minor(i, type)) >= 0) {
> > + if ((version = drmGetVersion(fd))) {
> > +if (!strcmp(version->name, name)) {
>
> I would suggest inverting these `if`s to avoid nesting so deep.
>

Makes lot of sense - yes.

> > +   drmFreeVersion(version);
> > +   id = drmGetBusid(fd);
> > +   drmMsg("drmGetBusid returned '%s'\n", id ? id : "NULL");
> > +   if (!id || !*id) {
> > +  if (id)
> > + drmFreeBusid(id);
> > +  return fd;
>
> This condition looks wrong; surely you want to keep the one that has
> a bus id, not the one that doesn't?
>
> The `if(!id) if(id)` also looks weird; I suggest rewriting this bit of
> your code. Flattening your logic should also make it more readable.
>

Btw, you have just reviewed big parts of existing stuff I have taken
1:1 which can be found here :)
https://cgit.freedesktop.org/mesa/drm/tree/xf86drm.c

> > +   } else {
> > +  drmFreeBusid(id);
> > +   }
> > +} else {
> > +   drmFreeVersion(version);
> > +}
> > + }
> > + close(fd);
> > +  }
> > +   }
> > +
> > +   return -1;
> > +}
> > +
> >  #if defined(HAVE_LIBDRM)
> >  #ifdef USE_DRICONF
> >  static const char __driConfigOptionsLoader[] =
> > diff --git a/src/loader/loader.h b/src/loader/loader.h
> > index 3859b45dc4..7e1612301a 100644
> > --- a/src/loader/loader.h
> > +++ b/src/loader/loader.h
> > @@ -38,6 +38,9 @@ extern "C" {
> >  int
> >  loader_open_device(const char *);
> >
> > +int
> > +loader_open_name(const char *name, int type);
> > +
> >  int
> >  loader_get_pci_id_for_fd(int fd, int *vendor_id, int *chip_id);
> >
> > --
> > 2.17.1
> >
> > ___
> > mesa-dev mailing list
> > mesa-dev@lists.freedesktop.org
> 

[Mesa-dev] [PATCH] mesa: add switch case for GL 2.0 in _mesa_compute_version()

2018-08-02 Thread Brian Paul
Previously, I added a switch case for GL 2.1 (ed7a0770b881791dd697f3).
I don't know of any driver which only supports GL 2.0, but adding
this switch case avoids a failure if the app queries
GL_SHADING_LANGUAGE_VERSION.
---
 src/mesa/main/version.c | 2 ++
 1 file changed, 2 insertions(+)

diff --git a/src/mesa/main/version.c b/src/mesa/main/version.c
index 2c5bd77..9df8c11 100644
--- a/src/mesa/main/version.c
+++ b/src/mesa/main/version.c
@@ -617,6 +617,8 @@ _mesa_compute_version(struct gl_context *ctx)
 */
if (_mesa_is_desktop_gl(ctx)) {
   switch (ctx->Version) {
+  case 20:
+ /* fall-through, GLSL 1.20 is the minimum we support */
   case 21:
  ctx->Const.GLSLVersion = 120;
  break;
-- 
2.7.4

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


[Mesa-dev] Mesa master branch vulkan/build question

2018-08-02 Thread Guang Bai
All,

I'm seeing build failures on mesa 18.2 & master branches with
"--with-vulkan-drivers=intel"

And also notice some web-posting that libxcb-xrandr 1.13 would be
needed to get the build successful.

What's the correct solution for my build issue?
(I'm still new to mesa)

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


Re: [Mesa-dev] [PATCH 1/2] loader: add loader_open_name(..)

2018-08-02 Thread Emil Velikov
On 1 August 2018 at 22:07, Christian Gmeiner
 wrote:
> Add an improved drmOpenWithType(..) clone which fixes some serious
> flaws. Some highlights:
>  - using busid works only with PCI devices
>  - open() w/o O_CLOEXEC
>  - when build w/o udev - it creates a node: mkdir, chown(root), chmod, mknod
>  - calls back into Xserver/DDX module
>  - last but no least - borderline hacks with massive documentation [1]
>to keep this running.
>
Please don't copy random hunks from libdrm. There are some hidden
dragons in there - just like the one Eric pointed out.
Instead you can move/factor out tegra_open_render_node() into a helper
and use that ;-)

Bonus points, if you plug the mem leak, just after strcmp call.

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


Re: [Mesa-dev] vulkan.radv build trouble w/ AOSP

2018-08-02 Thread Emil Velikov
On 2 August 2018 at 07:47, Mauro Rossi  wrote:
> Hi,
>
> Il giorno gio 2 ago 2018 alle ore 02:06 John Stultz 
> ha scritto:
>>
>> Just as a heads up, with mesa3d master (plus my other build fixups I
>> just sent out), I'm seeing a new build failure when building under
>> AOSP/master:
>>
>> external/mesa3d/src/amd/vulkan/Android.mk: error: vulkan.radv
>> (SHARED_LIBRARIES android-arm64) missing libLLVM (SHARED_LIBRARIES
>> android-arm64)
>> You can set ALLOW_MISSING_DEPENDENCIES=true in your environment if
>> this is intentional, but that may defer real problems until later in
>> the build.
>> external/mesa3d/src/amd/vulkan/Android.mk: error: vulkan.radv
>> (SHARED_LIBRARIES android-arm) missing libLLVM (SHARED_LIBRARIES
>> android-arm)
>> You can set ALLOW_MISSING_DEPENDENCIES=true in your environment if
>> this is intentional, but that may defer real problems until later in
>> the build.
>> build/make/core/main.mk:842: error: exiting from previous errors.
>> 22:56:25 ckati failed with: exit status 1
>>
>> This seems to be coming from the $(call mesa-build-with-llvm) line here:
>> https://github.com/mesa3d/mesa/blob/master/src/amd/vulkan/Android.mk#L144
>>
>> (as commenting that out avoids the issue)
>>
>> This gets pulled in as AOSP will check library dependencies for all
>> SHARED_LIBRARIES, so that's why the vulkan.radv trips this while other
>> "mesa-build-with-llvm" callers don't (they are built as
>> STATIC_LIBRARIES).
>>
>> Last time we had this issue, it was with the libpciaccess library,
>> which we solved it by dropping it.
>>
>> In this case I'm not sure what the best solution might be.
>>
>> * We could set it as a static library instead?
>>
>> * Alternatively, it seems we might be able to use the libLLVM_android
>> library instead of libLLVM here:
>>   https://github.com/mesa3d/mesa/blob/master/Android.mk#L107
>>
>> Other ideas/suggestions?
>>
>> thanks
>> -john
>
>
> A couple of ideas, but not yet tested in a build
>
> option 3) - use LOCAL_MODULE_TARGET_ARCH in the local vulkan.radv Android.mk
> and see if that solves the problem
>
> option 4) - brace the 'include $(LOCAL_PATH)/vulkan/Android.mk' in
> vulkan.radv src/amd/Android.mk in like this:
>
>  # Import variables
>  include $(LOCAL_PATH)/Makefile.sources
>  include $(LOCAL_PATH)/Android.addrlib.mk
>  include $(LOCAL_PATH)/Android.common.mk
> +ifneq ($(filter radeonsi,$(BOARD_GPU_DRIVERS)),)
> include $(LOCAL_PATH)/vulkan/Android.mk
> +endif
>
> I think the option 4) seems simpler than the others , if the assumption that
> ARM does not have radeonsi stands
> Mauro
>
Such a guard sounds perfectly reasonable IMHO.

Note that ANV does not have equivalent hunk, although it will be a great idea.
IIRC the lack of it, is the core reason behind xgettext workaround
that John sent out recently.

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


[Mesa-dev] [ANNOUNCE] mesa 18.0-0-rc1

2018-08-02 Thread Andres Gomez
The first release candidate for Mesa 18.2.0 is now available.

The plan is to have one release candidate every Wednesday, until the
anticipated final release on 22nd August 2018.

The expectation is that the 18.1 branch will remain alive with bi-
weekly releases until the 18.2.1 release.

NOTE: Building intel tools with meson is currently not possible.
Please, use autotools until the issue is resolved.

Here are the people which helped shape the current release.

 2  Aaron Watry
 2  Adam Jackson
18  Alejandro Piñeiro
 5  Alex Smith
 1  Alexander von Gluck IV
17  Alok Hota
 1  Alyssa Rosenzweig
10  Andres Gomez
 3  Andres Rodriguez
 2  Andrew Galante
 1  Andrii Simiklit
 8  Antia Puentes
 4  Anuj Phogat
61  Bas Nieuwenhuizen
 1  Benedikt Schemmer
 1  Boyan Ding
 2  Boyuan Zhang
20  Brian Paul
30  Caio Marcelo de Oliveira Filho
 1  Cameron Kumar
 4  Chad Versace
 3  Charmaine Lee
 1  Chih-Wei Huang
11  Chris Wilson
 7  Christian Gmeiner
 1  Christoph Haag
 8  Daniel Schürmann
 2  Daniel Stone
 5  Danylo Piliaiev
74  Dave Airlie
 2  David Riley
 1  Deepak Rawat
 4  Denis Pauk
 2  Dieter Nützel
 3  Drew Davenport
51  Dylan Baker
 9  Eduardo Lima Mitev
 9  Emil Velikov
   172  Eric Anholt
53  Eric Engestrom
11  Erik Faye-Lund
55  Francisco Jerez
 2  Fritz Koenig
28  George Kyriazis
43  Gert Wollny
 3  Grazvydas Ignotas
 1  Gurchetan Singh
 2  Gustavo Lima Chaves
 1  Harish Krupo
27  Iago Toral Quiroga
29  Ian Romanick
 8  Ilia Mirkin
 1  Jakob Bornecrantz
19  Jan Vesely
   281  Jason Ekstrand
 1  Joe M. Kniss
 1  Johan Klokkhammer Helsing
 3  Jon Turney
 5  Jonathan Marek
25  Jordan Justen
 1  Jose Dapena Paz
30  Jose Maria Casanova Crespo
 5  José Fonseca
25  Juan A. Suarez Romero
 1  Józef Kucia
 1  Kai Wasserbäch
23  Karol Herbst
17  Keith Packard
37  Kenneth Graunke
 5  Konstantin Kharlamov
 1  Kyle Brenneman
 1  Leo Liu
 2  Lepton Wu
45  Lionel Landwerlin
 1  Lucas Stach
 2  Lukas Rusak
 8  Marc-André Lureau
   221  Marek Olšák
 2  Mario Kleiner
 2  Mark Janes
 1  Martin Pelikán
16  Mathias Fröhlich
19  Mathieu Bridon
 1  Matt Atwood
 5  Matt Turner
 1  Matthew Nicholls
 1  Matthias Groß
 8  Mauro Rossi
 4  Michel Dänzer
 2  Miguel Casas
47  Nanley Chery
23  Neil Roberts
 3  Nicolai Hähnle
 1  Nicolas Boichat
 1  Olivier Fourdan
 1  Philip Rebohle
 2  Pierre Moreau
 3  Plamena Manolova
 5  Rafael Antognolli
31  Rhys Perry
89  Rob Clark
 1  Rob Herring
 2  Robert Foss
15  Roland Scheidegger
 3  Ross Burton
 1  Sagar Ghuge
 4  Samuel Iglesias Gonsálvez
   131  Samuel Pitoiset
21  Scott D Phillips
 1  Sergii Romantsov
 9  Sonny Jiang
 6  Stefan Schake
 1  Stuart Young
16  Tapani Pälli
 3  Thierry Reding
 1  Thomas Hellstrom
 1  Thomas Petazzoni
59  Timothy Arceri
 1  Timothy Pearson
 1  Tom Stellard
 5  Tomeu Vizoso
 1  Topi Pohjolainen
 1  Ville Syrjälä
 6  Vinson Lee
 2  Vlad Golovkin
 2  Xiong, James
 2  gurchetansi...@chromium.org
 2  jenny.q.cao
 1  vadym.shovkoplias
 2  zhaowei yuan


git tag: mesa-18.2.0-rc1

https://mesa.freedesktop.org/archive/mesa-18.2.0-rc1.tar.gz
MD5:  9c6d95d5d3929aa2760eb5b7b0a40ec3  mesa-18.2.0-rc1.tar.gz
SHA1: cf926038958e04521774af1a2f4e85df09180b4e  mesa-18.2.0-rc1.tar.gz
SHA256: 0a06dbde689d64589a85526c421baa6680060c54fffd831ad97bd95f1d780407  
mesa-18.2.0-rc1.tar.gz
SHA512: 
8616c02500d62a3dd89f73aaa7516240c9b933bade44b9351feeb50f72023db8d89f2fc1eb7de9d2062c41af189606f4ff37d37d86901e4861d982a21b3b06d4
  mesa-18.2.0-rc1.tar.gz
PGP:  https://mesa.freedesktop.org/archive/mesa-18.2.0-rc1.tar.gz.sig

https://mesa.freedesktop.org/archive/mesa-18.2.0-rc1.tar.xz
MD5:  2883aebdcdaac26c445bc72ab895f173  mesa-18.2.0-rc1.tar.xz
SHA1: 99133ed53f84f23750b9a18c710550eee6d16372  mesa-18.2.0-rc1.tar.xz
SHA256: 4b9feafc38622f3dc595592e016b6fa39063b9d3387c55b31f1fc1401ded6255  
mesa-18.2.0-rc1.tar.xz
SHA512: 
119b27faed7b1cb45822bb53a520065ef52b5eb8134cece60bb26f49e675179cd2c97f7b3a96ca3d9e89df765ea342c941e55ec2fdd2f560f0959d248dab8dc5
  mesa-18.2.0-rc1.tar.xz
PGP:  https://mesa.freedesktop.org/archive/mesa-18.2.0-rc1.tar.xz.sig
___
mesa-dev mailing list
mesa-dev@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/mesa-dev


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

2018-08-02 Thread Emil Velikov
On 2 August 2018 at 00:20, John Stultz  wrote:
> From: Sumit Semwal 
>
> This is a forward port of a patch from the AOSP/master tree:
> https://android.googlesource.com/platform/external/mesa3d/+/bd30b663f55f8af73a0be4446349c5a2d4c641b0%5E%21/
>
> Since https://android-review.googlesource.com/c/718518 added
> timespec_get() to bionic, mesa3d doesn't build due to redefinition
> of timespec_get().
>
> Avoid redefinition by defining HAVE_TIMESPEC_GET flag.
>
> Test: build and boot tested db820c to UI.
>
> Change-Id: I3dcc8034b48785e45cd3fa50e4d9cf2c684694a0
> Cc: Rob Herring 
> Cc: Alistair Strachan 
> Cc: Marissa Wall 
> Cc: Sumit Semwal 
> Cc: Emil Velikov 
> Cc: Rob Clark 
> Reviewed-by: Emil Velikov 
> Signed-off-by: Sumit Semwal 
> Signed-off-by: John Stultz 
> ---
> v2: Conditionalize it for PLATFORM_VERSION Q and higher
> v3: Rework conditionalization to numbered releases prior
> to P (9.0)

RobH, feel free to push the series if the update looks reasonable.

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


Re: [Mesa-dev] Mesa master branch vulkan/build question

2018-08-02 Thread Mike Lothian
Hi

It would be helpful if you posted the failure output, without it its
difficult to diagnose

I'm not seeing any issues with the master branch on the meson build

Is this your first time building mesa, or has something suddenly stopped
working?

Cheers

Mike

On Thu, 2 Aug 2018 at 16:46 Guang Bai  wrote:

> All,
>
> I'm seeing build failures on mesa 18.2 & master branches with
> "--with-vulkan-drivers=intel"
>
> And also notice some web-posting that libxcb-xrandr 1.13 would be
> needed to get the build successful.
>
> What's the correct solution for my build issue?
> (I'm still new to mesa)
>
> Thanks!
> Guang
> ___
> 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] [ANNOUNCE] mesa 18.2.0-rc1

2018-08-02 Thread Andres Gomez
The subject was obviously wrong 😕

On Thu, 2018-08-02 at 18:52 +0300, Andres Gomez wrote:
> The first release candidate for Mesa 18.2.0 is now available.
> 
> The plan is to have one release candidate every Wednesday, until the
> anticipated final release on 22nd August 2018.
> 
> The expectation is that the 18.1 branch will remain alive with bi-
> weekly releases until the 18.2.1 release.
> 
> NOTE: Building intel tools with meson is currently not possible.
> Please, use autotools until the issue is resolved.
> 
> Here are the people which helped shape the current release.
> 
>  2Aaron Watry
>  2Adam Jackson
> 18Alejandro Piñeiro
>  5Alex Smith
>  1Alexander von Gluck IV
> 17Alok Hota
>  1Alyssa Rosenzweig
> 10Andres Gomez
>  3Andres Rodriguez
>  2Andrew Galante
>  1Andrii Simiklit
>  8Antia Puentes
>  4Anuj Phogat
> 61Bas Nieuwenhuizen
>  1Benedikt Schemmer
>  1Boyan Ding
>  2Boyuan Zhang
> 20Brian Paul
> 30Caio Marcelo de Oliveira Filho
>  1Cameron Kumar
>  4Chad Versace
>  3Charmaine Lee
>  1Chih-Wei Huang
> 11Chris Wilson
>  7Christian Gmeiner
>  1Christoph Haag
>  8Daniel Schürmann
>  2Daniel Stone
>  5Danylo Piliaiev
> 74Dave Airlie
>  2David Riley
>  1Deepak Rawat
>  4Denis Pauk
>  2Dieter Nützel
>  3Drew Davenport
> 51Dylan Baker
>  9Eduardo Lima Mitev
>  9Emil Velikov
>172Eric Anholt
> 53Eric Engestrom
> 11Erik Faye-Lund
> 55Francisco Jerez
>  2Fritz Koenig
> 28George Kyriazis
> 43Gert Wollny
>  3Grazvydas Ignotas
>  1Gurchetan Singh
>  2Gustavo Lima Chaves
>  1Harish Krupo
> 27Iago Toral Quiroga
> 29Ian Romanick
>  8Ilia Mirkin
>  1Jakob Bornecrantz
> 19Jan Vesely
>281Jason Ekstrand
>  1Joe M. Kniss
>  1Johan Klokkhammer Helsing
>  3Jon Turney
>  5Jonathan Marek
> 25Jordan Justen
>  1Jose Dapena Paz
> 30Jose Maria Casanova Crespo
>  5José Fonseca
> 25Juan A. Suarez Romero
>  1Józef Kucia
>  1Kai Wasserbäch
> 23Karol Herbst
> 17Keith Packard
> 37Kenneth Graunke
>  5Konstantin Kharlamov
>  1Kyle Brenneman
>  1Leo Liu
>  2Lepton Wu
> 45Lionel Landwerlin
>  1Lucas Stach
>  2Lukas Rusak
>  8Marc-André Lureau
>221Marek Olšák
>  2Mario Kleiner
>  2Mark Janes
>  1Martin Pelikán
> 16Mathias Fröhlich
> 19Mathieu Bridon
>  1Matt Atwood
>  5Matt Turner
>  1Matthew Nicholls
>  1Matthias Groß
>  8Mauro Rossi
>  4Michel Dänzer
>  2Miguel Casas
> 47Nanley Chery
> 23Neil Roberts
>  3Nicolai Hähnle
>  1Nicolas Boichat
>  1Olivier Fourdan
>  1Philip Rebohle
>  2Pierre Moreau
>  3Plamena Manolova
>  5Rafael Antognolli
> 31Rhys Perry
> 89Rob Clark
>  1Rob Herring
>  2Robert Foss
> 15Roland Scheidegger
>  3Ross Burton
>  1Sagar Ghuge
>  4Samuel Iglesias Gonsálvez
>131Samuel Pitoiset
> 21Scott D Phillips
>  1Sergii Romantsov
>  9Sonny Jiang
>  6Stefan Schake
>  1Stuart Young
> 16Tapani Pälli
>  3Thierry Reding
>  1Thomas Hellstrom
>  1Thomas Petazzoni
> 59Timothy Arceri
>  1Timothy Pearson
>  1Tom Stellard
>  5Tomeu Vizoso
>  1Topi Pohjolainen
>  1Ville Syrjälä
>  6Vinson Lee
>  2Vlad Golovkin
>  2Xiong, James
>  2gurchetansi...@chromium.org
>  2jenny.q.cao
>  1vadym.shovkoplias
>  2zhaowei yuan
> 
> 
> git tag: mesa-18.2.0-rc1
> 
> https://mesa.freedesktop.org/archive/mesa-18.2.0-rc1.tar.gz
> MD5:  9c6d95d5d3929aa2760eb5b7b0a40ec3  mesa-18.2.0-rc1.tar.gz
> SHA1: cf926038958e04521774af1a2f4e85df09180b4e  mesa-18.2.0-rc1.tar.gz
> SHA256: 0a06dbde689d64589a85526c421baa6680060c54fffd831ad97bd95f1d780407  
> mesa-18.2.0-rc1.tar.gz
> SHA512: 
> 8616c02500d62a3dd89f73aaa7516240c9b933bade44b9351

[Mesa-dev] [PATCH] intel/tools: add error2aub creation into autotools

2018-08-02 Thread Andres Gomez
Tarball distribution is done through "make distcheck". We include the
meson targets also into autotools so they won't fail when building
from the tarball.

Fixes: 6a60beba408 ("intel/tools: Add an error state to aub translator")
Cc: Jason Ekstrand 
Cc: Lionel Landwerlin 
Cc: Dylan Baker 
Signed-off-by: Andres Gomez 
---
This just fixes running the default "meson _build" from the inflated
tarball. Not sure we need to include more targets.

 src/intel/Makefile.tools.am | 24 +++-
 1 file changed, 23 insertions(+), 1 deletion(-)

diff --git a/src/intel/Makefile.tools.am b/src/intel/Makefile.tools.am
index b00cc8cc2cb..00624084e6f 100644
--- a/src/intel/Makefile.tools.am
+++ b/src/intel/Makefile.tools.am
@@ -21,7 +21,9 @@
 
 noinst_PROGRAMS += \
tools/aubinator \
-   tools/aubinator_error_decode
+   tools/aubinator_error_decode \
+   tools/error2aub
+
 
 tools_aubinator_SOURCES = \
tools/aubinator.c \
@@ -59,3 +61,23 @@ tools_aubinator_error_decode_LDADD = \
 tools_aubinator_error_decode_CFLAGS = \
$(AM_CFLAGS) \
$(ZLIB_CFLAGS)
+
+
+tools_error2aub_SOURCES = \
+   tools/gen_context.h \
+   tools/gen8_context.h \
+   tools/gen10_context.h \
+   tools/aub_write.h \
+   tools/aub_write.c \
+   tools/error2aub.c
+
+tools_error2aub_CFLAGS = \
+   $(AM_CFLAGS) \
+   $(ZLIB_CFLAGS)
+
+tools_error2aub_LDADD = \
+   dev/libintel_dev.la \
+   $(PTHREAD_LIBS) \
+   $(DLOPEN_LIBS) \
+   $(ZLIB_LIBS) \
+   -lm
-- 
2.18.0

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


Re: [Mesa-dev] [PATCH] intel/tools: add error2aub creation into autotools

2018-08-02 Thread Lionel Landwerlin

On 02/08/18 17:39, Andres Gomez wrote:

Tarball distribution is done through "make distcheck". We include the
meson targets also into autotools so they won't fail when building
from the tarball.

Fixes: 6a60beba408 ("intel/tools: Add an error state to aub translator")
Cc: Jason Ekstrand 
Cc: Lionel Landwerlin 
Cc: Dylan Baker 
Signed-off-by: Andres Gomez 


Looks like I'll have to update some stuff on my branches.
I was hoping that we could start forgetting about autotools but forgot 
about about released tarballs :(


Reviewed-by: Lionel Landwerlin 


---
This just fixes running the default "meson _build" from the inflated
tarball. Not sure we need to include more targets.

  src/intel/Makefile.tools.am | 24 +++-
  1 file changed, 23 insertions(+), 1 deletion(-)

diff --git a/src/intel/Makefile.tools.am b/src/intel/Makefile.tools.am
index b00cc8cc2cb..00624084e6f 100644
--- a/src/intel/Makefile.tools.am
+++ b/src/intel/Makefile.tools.am
@@ -21,7 +21,9 @@
  
  noinst_PROGRAMS += \

tools/aubinator \
-   tools/aubinator_error_decode
+   tools/aubinator_error_decode \
+   tools/error2aub
+
  
  tools_aubinator_SOURCES = \

tools/aubinator.c \
@@ -59,3 +61,23 @@ tools_aubinator_error_decode_LDADD = \
  tools_aubinator_error_decode_CFLAGS = \
$(AM_CFLAGS) \
$(ZLIB_CFLAGS)
+
+
+tools_error2aub_SOURCES = \
+   tools/gen_context.h \
+   tools/gen8_context.h \
+   tools/gen10_context.h \
+   tools/aub_write.h \
+   tools/aub_write.c \
+   tools/error2aub.c
+
+tools_error2aub_CFLAGS = \
+   $(AM_CFLAGS) \
+   $(ZLIB_CFLAGS)
+
+tools_error2aub_LDADD = \
+   dev/libintel_dev.la \
+   $(PTHREAD_LIBS) \
+   $(DLOPEN_LIBS) \
+   $(ZLIB_LIBS) \
+   -lm



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


Re: [Mesa-dev] [PATCH] meson: use correct keyword to fix a meson warning

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

Quoting Jon Turney (2018-08-02 06:58:07)
> With a sufficently recent meson, the following warning is produced:
> 
> WARNING: Passed invalid keyword argument "extra_args".
> WARNING: This will become a hard error in the future.
> 
> It seems that compiler.links(args:) is meant here.
> 
> Signed-off-by: Jon Turney 
> ---
>  meson.build | 2 +-
>  1 file changed, 1 insertion(+), 1 deletion(-)
> 
> diff --git a/meson.build b/meson.build
> index 86a4a4ce6d..cbf88b5013 100644
> --- a/meson.build
> +++ b/meson.build
> @@ -989,7 +989,7 @@ if cc.links('''
>freelocale(loc);
>return 0;
>  }''',
> -extra_args : pre_args,
> +args : pre_args,
>  name : 'strtod has locale support')
>pre_args += '-DHAVE_STRTOD_L'
>  endif
> -- 
> 2.17.0
> 


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


[Mesa-dev] [Bug 107455] [TRACKER] Mesa 18.3 feature tracker

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

Bug ID: 107455
   Summary: [TRACKER] Mesa 18.3 feature tracker
   Product: Mesa
   Version: git
  Hardware: Other
OS: All
Status: NEW
  Severity: normal
  Priority: medium
 Component: Other
  Assignee: mesa-dev@lists.freedesktop.org
  Reporter: ago...@igalia.com
QA Contact: mesa-dev@lists.freedesktop.org
CC: baker.dyla...@gmail.com, emil.l.veli...@gmail.com,
jasua...@igalia.com

This is a tracker for features planned for the 18.3.0 release.

Note: features should be merged prior to the branchpoint - schedule is on
mesa3d.org

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


Re: [Mesa-dev] Mesa master branch vulkan/build question

2018-08-02 Thread Mike Lothian
Which distro are you using?

On Thu, 2 Aug 2018 at 17:35 Guang Bai  wrote:

> This is the reason for me to look for helps from our mesa-dev community.
> Thanks,
> Guang
>
> On Thu, 2 Aug 2018 17:10:16 +0100
> Mike Lothian  wrote:
>
> > Yeah the lease stuff was added in the newer version of xcb-protos I
> > think, I'm surprised the configure didn't error out
> >
> > On Thu, 2 Aug 2018, 17:07 Guang Bai,  wrote:
> >
> > > On Thu, 2 Aug 2018 16:54:58 +0100
> > > Mike Lothian  wrote:
> > >
> > > > Hi
> > > My mesa build was ok with 18.1 and previous versions and it's just
> > > broken with latest master and 18.2.
> > >
> > > Here are my build errors with 18.2 & master -
> > >
> > > Thanks,
> > > Guang
> > >
> > >  Making all in vulkan
> > > make[3]: Entering directory '.../mesa/src/vulkan'
> > >   CC   wsi/wsi_common_display.lo
> > >   CCLD libvulkan_util.la
> > > ar: `u' modifier ignored since `D' is the default (see `U')
> > > wsi/wsi_common_display.c:1134:4: error: unknown field
> > > ‘sequence_handler’ specified in initializer
> > > .sequence_handler = wsi_display_sequence_handler,
> > > ^
> > > wsi/wsi_common_display.c:1134:24: warning: initialization from
> > > incompatible pointer type [-Wincompatible-pointer-types]
> > > .sequence_handler = wsi_display_sequence_handler,
> > > ^
> > > wsi/wsi_common_display.c:1134:24: note: (near initialization for
> > > ‘event_context.page_flip_handler’)
> > > wsi/wsi_common_display.c: In function ‘wsi_register_vblank_event’:
> > > wsi/wsi_common_display.c:1516:17: error: implicit declaration of
> > > function
> > > ‘drmCrtcQueueSequence’ [-Werror=implicit-function-declaration] int
> > > ret = drmCrtcQueueSequence(wsi->fd, connector->crtc_id, ^
> > > wsi/wsi_common_display.c: In function ‘wsi_acquire_xlib_display’:
> > > wsi/wsi_common_display.c:2307:4: error: unknown type name
> > > ‘xcb_randr_lease_t’
> > > xcb_randr_lease_t lease = xcb_generate_id(connection);
> > > ^
> > > wsi/wsi_common_display.c:2308:4: error: unknown type name
> > > ‘xcb_randr_create_lease_cookie_t’
> > > xcb_randr_create_lease_cookie_t cl_c =
> > > ^
> > > wsi/wsi_common_display.c:2309:7: error: implicit declaration of
> > > function
> > > ‘xcb_randr_create_lease’ [-Werror=implicit-function-declaration]
> > > xcb_randr_create_lease(connection, root, lease, 1, 1, ^
> > > wsi/wsi_common_display.c:2311:4: error: unknown type name
> > > ‘xcb_randr_create_lease_reply_t’
> > > xcb_randr_create_lease_reply_t *cl_r =
> > > ^
> > > wsi/wsi_common_display.c:2312:7: error: implicit declaration of
> > > function
> > > ‘xcb_randr_create_lease_reply’ [-Werror=implicit-function-declaration]
> > > xcb_randr_create_lease_reply(connection, cl_c, NULL); ^
> > > wsi/wsi_common_display.c:2312:7: warning: initialization makes
> > > pointer from integer without a cast [-Wint-conversion]
> > > wsi/wsi_common_display.c:2317:12: error: request for member ‘nfd’ in
> > > something not a structure or union
> > > if (cl_r->nfd > 0) {
> > > ^
> > > wsi/wsi_common_display.c:2318:20: error: implicit declaration of
> > > function
> > > ‘xcb_randr_create_lease_reply_fds’
> [-Werror=implicit-function-declaration]
> > > int *rcl_f = xcb_randr_create_lease_reply_fds(connection, cl_r); ^
> > > wsi/wsi_common_display.c:2318:20: warning: initialization makes
> > > pointer from integer without a cast [-Wint-conversion]
> > > wsi/wsi_common_display.c: In function ‘wsi_get_swapchain_counter’:
> > > wsi/wsi_common_display.c:2456:14: error: implicit declaration of
> > > function
> > > ‘drmCrtcGetSequence’ [-Werror=implicit-function-declaration] int
> > > ret = drmCrtcGetSequence(wsi->fd, connector->crtc_id, value, NULL);
> > > ^ cc1: some warnings being treated as errors
> > > Makefile:743: recipe for target 'wsi/wsi_common_display.lo' failed
> > > make[3]: *** [wsi/wsi_common_display.lo] Error 1
> > >
> > > > It would be helpful if you posted the failure output, without it
> > > > its difficult to diagnose
> > > >
> > > > I'm not seeing any issues with the master branch on the meson
> > > > build
> > > >
> > > > Is this your first time building mesa, or has something suddenly
> > > > stopped working?
> > > >
> > > > Cheers
> > > >
> > > > Mike
> > > >
> > > > On Thu, 2 Aug 2018 at 16:46 Guang Bai  wrote:
> > > >
> > > > > All,
> > > > >
> > > > > I'm seeing build failures on mesa 18.2 & master branches with
> > > > > "--with-vulkan-drivers=intel"
> > > > >
> > > > > And also notice some web-posting that libxcb-xrandr 1.13 would
> > > > > be needed to get the build successful.
> > > > >
> > > > > What's the correct solution for my build issue?
> > > > > (I'm still new to mesa)
> > > > >
> > > > > Thanks!
> > > > > Guang
> > > > > ___
> > > > > mesa-dev mailing list
> > > > > mesa-dev@lists.freedesktop.org
> > > > > https://lists.freedesktop.org/mailman/listinfo/mesa-dev
> > > > >
> > >
> > >
>
>
___

Re: [Mesa-dev] [PATCH v2 6/6] mesa: replace binary constants with hexadecimal constants

2018-08-02 Thread Marek Olšák
On Thu, Aug 2, 2018, 2:42 AM Andres Gomez  wrote:

> On Wed, 2018-08-01 at 19:54 -0400, Marek Olšák wrote:
> > For patches 5 & 6:
> >
> > Reviewed-by: Marek Olšák 
>
> Thanks, Marek!
>
> > I can't see patches 3 & 4 on the list.
>
> The list has been having some troubles in the last hours. I will resend
> those 2 patches. However, I originally sent them with you in Cc so you
> should have a copy or I would really have to start worrying about my
> mail delivery system ... 😕
>

It's probably there. I don't use my amd mailbox to read mailing lists.

Marek


> Br.
>
> >
> > Marek
> >
> > On Wed, Aug 1, 2018 at 6:02 PM, Andres Gomez  wrote:
> > > The binary constant notation "0b" is a GCC extension. Instead, we use
> > > hexadecimal notation to fix the MSVC 2013 build:
> > >
> > > Compiling src\mesa\main\texcompress_astc.cpp ...
> > > texcompress_astc.cpp
> > > src\mesa\main\texcompress_astc.cpp(111) : error C2059: syntax error :
> 'bad suffix on number'
> > >
> > > ...
> > >
> > > src\mesa\main\texcompress_astc.cpp(1007) : fatal error C1003: error
> count exceeds 100; stopping compilation
> > > scons: *** [build\windows-x86-debug\mesa\main\texcompress_astc.obj]
> Error 2
> > > scons: building terminated because of errors.
> > >
> > > v2: Fix wrong conversion (Ilia).
> > >
> > > Fixes: 38ab39f6501 ("mesa: add ASTC 2D LDR decoder")
> > > Cc: Marek Olšák 
> > > Cc: Brian Paul 
> > > Cc: Roland Scheidegger 
> > > Cc: Mike Lothian 
> > > Cc: Gert Wollny 
> > > Cc: Dieter Nützel 
> > > Cc: Ilia Mirkin 
> > > Signed-off-by: Andres Gomez 
> > > ---
> > >  src/mesa/main/texcompress_astc.cpp | 116 ++---
> > >  1 file changed, 58 insertions(+), 58 deletions(-)
> > >
> > > diff --git a/src/mesa/main/texcompress_astc.cpp
> b/src/mesa/main/texcompress_astc.cpp
> > > index 996e8ea28d6..23540c47017 100644
> > > --- a/src/mesa/main/texcompress_astc.cpp
> > > +++ b/src/mesa/main/texcompress_astc.cpp
> > > @@ -108,14 +108,14 @@ static void unpack_trit_block(int n, T in,
> uint8_t *out)
> > >  {
> > > assert(n <= 6); /* else output will overflow uint8_t */
> > >
> > > -   uint8_t T0 = (in >> (n)) & 0b1;
> > > -   uint8_t T1 = (in >> (n+1)) & 0b1;
> > > -   uint8_t T2 = (in >> (2*n+2)) & 0b1;
> > > -   uint8_t T3 = (in >> (2*n+3)) & 0b1;
> > > -   uint8_t T4 = (in >> (3*n+4)) & 0b1;
> > > -   uint8_t T5 = (in >> (4*n+5)) & 0b1;
> > > -   uint8_t T6 = (in >> (4*n+6)) & 0b1;
> > > -   uint8_t T7 = (in >> (5*n+7)) & 0b1;
> > > +   uint8_t T0 = (in >> (n)) & 0x1;
> > > +   uint8_t T1 = (in >> (n+1)) & 0x1;
> > > +   uint8_t T2 = (in >> (2*n+2)) & 0x1;
> > > +   uint8_t T3 = (in >> (2*n+3)) & 0x1;
> > > +   uint8_t T4 = (in >> (3*n+4)) & 0x1;
> > > +   uint8_t T5 = (in >> (4*n+5)) & 0x1;
> > > +   uint8_t T6 = (in >> (4*n+6)) & 0x1;
> > > +   uint8_t T7 = (in >> (5*n+7)) & 0x1;
> > > uint8_t mmask = (1 << n) - 1;
> > > uint8_t m0 = (in >> (0)) & mmask;
> > > uint8_t m1 = (in >> (n+2)) & mmask;
> > > @@ -125,12 +125,12 @@ static void unpack_trit_block(int n, T in,
> uint8_t *out)
> > >
> > > uint8_t C;
> > > uint8_t t4, t3, t2, t1, t0;
> > > -   if (CAT_BITS_3(T4, T3, T2) == 0b111) {
> > > +   if (CAT_BITS_3(T4, T3, T2) == 0x7) {
> > >C = CAT_BITS_5(T7, T6, T5, T1, T0);
> > >t4 = t3 = 2;
> > > } else {
> > >C = CAT_BITS_5(T4, T3, T2, T1, T0);
> > > -  if (CAT_BITS_2(T6, T5) == 0b11) {
> > > +  if (CAT_BITS_2(T6, T5) == 0x3) {
> > >   t4 = 2;
> > >   t3 = T7;
> > >} else {
> > > @@ -139,21 +139,21 @@ static void unpack_trit_block(int n, T in,
> uint8_t *out)
> > >}
> > > }
> > >
> > > -   if ((C & 0b11) == 0b11) {
> > > +   if ((C & 0x3) == 0x3) {
> > >t2 = 2;
> > > -  t1 = (C >> 4) & 0b1;
> > > -  uint8_t C3 = (C >> 3) & 0b1;
> > > -  uint8_t C2 = (C >> 2) & 0b1;
> > > +  t1 = (C >> 4) & 0x1;
> > > +  uint8_t C3 = (C >> 3) & 0x1;
> > > +  uint8_t C2 = (C >> 2) & 0x1;
> > >t0 = (C3 << 1) | (C2 & ~C3);
> > > -   } else if (((C >> 2) & 0b11) == 0b11) {
> > > +   } else if (((C >> 2) & 0x3) == 0x3) {
> > >t2 = 2;
> > >t1 = 2;
> > > -  t0 = C & 0b11;
> > > +  t0 = C & 0x3;
> > > } else {
> > > -  t2 = (C >> 4) & 0b1;
> > > -  t1 = (C >> 2) & 0b11;
> > > -  uint8_t C1 = (C >> 1) & 0b1;
> > > -  uint8_t C0 = (C >> 0) & 0b1;
> > > +  t2 = (C >> 4) & 0x1;
> > > +  t1 = (C >> 2) & 0x3;
> > > +  uint8_t C1 = (C >> 1) & 0x1;
> > > +  uint8_t C0 = (C >> 0) & 0x1;
> > >t0 = (C1 << 1) | (C0 & ~C1);
> > > }
> > >
> > > @@ -171,13 +171,13 @@ static void unpack_quint_block(int n, uint32_t
> in, uint8_t *out)
> > >  {
> > > assert(n <= 5); /* else output will overflow uint8_t */
> > >
> > > -   uint8_t Q0 = (in >> (n)) & 0b1;
> > > -   uint8_t Q1 = (in >> (n+1)) & 0b1;
> > > -   uint8_t Q2 = (in >> (n+2)) & 0b1;
> > > -   uint8_t Q3 = (in >> (2*n+3)) & 0b1;
> > > -   uint8_t Q4 = (in >> (2*n+4)) & 0b1;
> > > -   uint8_t Q5 =

Re: [Mesa-dev] Mesa master branch vulkan/build question

2018-08-02 Thread Guang Bai
On Thu, 2 Aug 2018 17:55:21 +0100
Mike Lothian  wrote:

> Which distro are you using?

uBuntu-14.045 & uBuntu-16.04
Thanks,
Guang

> 
> On Thu, 2 Aug 2018 at 17:35 Guang Bai  wrote:
> 
> > This is the reason for me to look for helps from our mesa-dev
> > community. Thanks,
> > Guang
> >
> > On Thu, 2 Aug 2018 17:10:16 +0100
> > Mike Lothian  wrote:
> >  
> > > Yeah the lease stuff was added in the newer version of xcb-protos
> > > I think, I'm surprised the configure didn't error out
> > >
> > > On Thu, 2 Aug 2018, 17:07 Guang Bai,  wrote:
> > >  
> > > > On Thu, 2 Aug 2018 16:54:58 +0100
> > > > Mike Lothian  wrote:
> > > >  
> > > > > Hi  
> > > > My mesa build was ok with 18.1 and previous versions and it's
> > > > just broken with latest master and 18.2.
> > > >
> > > > Here are my build errors with 18.2 & master -
> > > >
> > > > Thanks,
> > > > Guang
> > > >
> > > >  Making all in vulkan
> > > > make[3]: Entering directory '.../mesa/src/vulkan'
> > > >   CC   wsi/wsi_common_display.lo
> > > >   CCLD libvulkan_util.la
> > > > ar: `u' modifier ignored since `D' is the default (see `U')
> > > > wsi/wsi_common_display.c:1134:4: error: unknown field
> > > > ‘sequence_handler’ specified in initializer
> > > > .sequence_handler = wsi_display_sequence_handler,
> > > > ^
> > > > wsi/wsi_common_display.c:1134:24: warning: initialization from
> > > > incompatible pointer type [-Wincompatible-pointer-types]
> > > > .sequence_handler = wsi_display_sequence_handler,
> > > > ^
> > > > wsi/wsi_common_display.c:1134:24: note: (near initialization for
> > > > ‘event_context.page_flip_handler’)
> > > > wsi/wsi_common_display.c: In function
> > > > ‘wsi_register_vblank_event’: wsi/wsi_common_display.c:1516:17:
> > > > error: implicit declaration of function
> > > > ‘drmCrtcQueueSequence’ [-Werror=implicit-function-declaration]
> > > > int ret = drmCrtcQueueSequence(wsi->fd, connector->crtc_id, ^
> > > > wsi/wsi_common_display.c: In function
> > > > ‘wsi_acquire_xlib_display’: wsi/wsi_common_display.c:2307:4:
> > > > error: unknown type name ‘xcb_randr_lease_t’
> > > > xcb_randr_lease_t lease = xcb_generate_id(connection);
> > > > ^
> > > > wsi/wsi_common_display.c:2308:4: error: unknown type name
> > > > ‘xcb_randr_create_lease_cookie_t’
> > > > xcb_randr_create_lease_cookie_t cl_c =
> > > > ^
> > > > wsi/wsi_common_display.c:2309:7: error: implicit declaration of
> > > > function
> > > > ‘xcb_randr_create_lease’ [-Werror=implicit-function-declaration]
> > > > xcb_randr_create_lease(connection, root, lease, 1, 1, ^
> > > > wsi/wsi_common_display.c:2311:4: error: unknown type name
> > > > ‘xcb_randr_create_lease_reply_t’
> > > > xcb_randr_create_lease_reply_t *cl_r =
> > > > ^
> > > > wsi/wsi_common_display.c:2312:7: error: implicit declaration of
> > > > function
> > > > ‘xcb_randr_create_lease_reply’ [-Werror=implicit-function-declaration]
> > > > xcb_randr_create_lease_reply(connection, cl_c, NULL); ^
> > > > wsi/wsi_common_display.c:2312:7: warning: initialization makes
> > > > pointer from integer without a cast [-Wint-conversion]
> > > > wsi/wsi_common_display.c:2317:12: error: request for member
> > > > ‘nfd’ in something not a structure or union
> > > > if (cl_r->nfd > 0) {
> > > > ^
> > > > wsi/wsi_common_display.c:2318:20: error: implicit declaration of
> > > > function
> > > > ‘xcb_randr_create_lease_reply_fds’  
> > [-Werror=implicit-function-declaration]  
> > > > int *rcl_f = xcb_randr_create_lease_reply_fds(connection,
> > > > cl_r); ^ wsi/wsi_common_display.c:2318:20: warning:
> > > > initialization makes pointer from integer without a cast
> > > > [-Wint-conversion] wsi/wsi_common_display.c: In function
> > > > ‘wsi_get_swapchain_counter’: wsi/wsi_common_display.c:2456:14:
> > > > error: implicit declaration of function
> > > > ‘drmCrtcGetSequence’ [-Werror=implicit-function-declaration] int
> > > > ret = drmCrtcGetSequence(wsi->fd, connector->crtc_id, value,
> > > > NULL); ^ cc1: some warnings being treated as errors
> > > > Makefile:743: recipe for target 'wsi/wsi_common_display.lo'
> > > > failed make[3]: *** [wsi/wsi_common_display.lo] Error 1
> > > >  
> > > > > It would be helpful if you posted the failure output, without
> > > > > it its difficult to diagnose
> > > > >
> > > > > I'm not seeing any issues with the master branch on the meson
> > > > > build
> > > > >
> > > > > Is this your first time building mesa, or has something
> > > > > suddenly stopped working?
> > > > >
> > > > > Cheers
> > > > >
> > > > > Mike
> > > > >
> > > > > On Thu, 2 Aug 2018 at 16:46 Guang Bai 
> > > > > wrote: 
> > > > > > All,
> > > > > >
> > > > > > I'm seeing build failures on mesa 18.2 & master branches
> > > > > > with "--with-vulkan-drivers=intel"
> > > > > >
> > > > > > And also notice some web-posting that libxcb-xrandr 1.13
> > > > > > would be needed to get the build successful.
> > > > > >
> > > > > > What's the correct sol

Re: [Mesa-dev] [PATCH v2 6/6] mesa: replace binary constants with hexadecimal constants

2018-08-02 Thread Andres Gomez
On Thu, 2018-08-02 at 12:55 -0400, Marek Olšák wrote:
> 
> 
> On Thu, Aug 2, 2018, 2:42 AM Andres Gomez  wrote:
> > On Wed, 2018-08-01 at 19:54 -0400, Marek Olšák wrote:
> > > For patches 5 & 6:
> > > 
> > > Reviewed-by: Marek Olšák 
> > 
> > Thanks, Marek!
> > 
> > > I can't see patches 3 & 4 on the list.
> > 
> > The list has been having some troubles in the last hours. I will resend
> > those 2 patches. However, I originally sent them with you in Cc so you
> > should have a copy or I would really have to start worrying about my
> > mail delivery system ... 😕
> 
> It's probably there. I don't use my amd mailbox to read mailing lists.

No prob. Daniel flushed the mail queue and now we have duplicates in
the ML 😄

-- 
Br,

Andres
___
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-02 Thread bugzilla-daemon
https://bugs.freedesktop.org/show_bug.cgi?id=107457

Bug ID: 107457
   Summary: [Tracker] Mesa 18.2 release tracker
   Product: Mesa
   Version: 18.2
  Hardware: Other
OS: All
Status: NEW
  Severity: normal
  Priority: medium
 Component: Other
  Assignee: mesa-dev@lists.freedesktop.org
  Reporter: ago...@igalia.com
QA Contact: mesa-dev@lists.freedesktop.org
Depends on: 106865

This is a tracker for all regressions from 18.1 until 18.2.0 release.


Referenced Bugs:

https://bugs.freedesktop.org/show_bug.cgi?id=106865
[Bug 106865] [GLK] piglit.spec.ext_framebuffer_multisample.accuracy stencil
tests fail
-- 
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] Mesa master branch vulkan/build question

2018-08-02 Thread Mike Lothian
That's packaged for bionic, might be worth creating your own PPA and base
the pkgbuild on that - apologies if I'm getting the lingo wrong - I don't
use Ubuntu myself

Alternatively maybe check for other PPAs that might have them already
packaged for you, I think Padoka and Oibaf might have what you're after

On Thu, 2 Aug 2018 at 18:00 Guang Bai  wrote:

> On Thu, 2 Aug 2018 17:55:21 +0100
> Mike Lothian  wrote:
>
> > Which distro are you using?
>
> uBuntu-14.045 & uBuntu-16.04
> Thanks,
> Guang
>
> >
> > On Thu, 2 Aug 2018 at 17:35 Guang Bai  wrote:
> >
> > > This is the reason for me to look for helps from our mesa-dev
> > > community. Thanks,
> > > Guang
> > >
> > > On Thu, 2 Aug 2018 17:10:16 +0100
> > > Mike Lothian  wrote:
> > >
> > > > Yeah the lease stuff was added in the newer version of xcb-protos
> > > > I think, I'm surprised the configure didn't error out
> > > >
> > > > On Thu, 2 Aug 2018, 17:07 Guang Bai,  wrote:
> > > >
> > > > > On Thu, 2 Aug 2018 16:54:58 +0100
> > > > > Mike Lothian  wrote:
> > > > >
> > > > > > Hi
> > > > > My mesa build was ok with 18.1 and previous versions and it's
> > > > > just broken with latest master and 18.2.
> > > > >
> > > > > Here are my build errors with 18.2 & master -
> > > > >
> > > > > Thanks,
> > > > > Guang
> > > > >
> > > > >  Making all in vulkan
> > > > > make[3]: Entering directory '.../mesa/src/vulkan'
> > > > >   CC   wsi/wsi_common_display.lo
> > > > >   CCLD libvulkan_util.la
> > > > > ar: `u' modifier ignored since `D' is the default (see `U')
> > > > > wsi/wsi_common_display.c:1134:4: error: unknown field
> > > > > ‘sequence_handler’ specified in initializer
> > > > > .sequence_handler = wsi_display_sequence_handler,
> > > > > ^
> > > > > wsi/wsi_common_display.c:1134:24: warning: initialization from
> > > > > incompatible pointer type [-Wincompatible-pointer-types]
> > > > > .sequence_handler = wsi_display_sequence_handler,
> > > > > ^
> > > > > wsi/wsi_common_display.c:1134:24: note: (near initialization for
> > > > > ‘event_context.page_flip_handler’)
> > > > > wsi/wsi_common_display.c: In function
> > > > > ‘wsi_register_vblank_event’: wsi/wsi_common_display.c:1516:17:
> > > > > error: implicit declaration of function
> > > > > ‘drmCrtcQueueSequence’ [-Werror=implicit-function-declaration]
> > > > > int ret = drmCrtcQueueSequence(wsi->fd, connector->crtc_id, ^
> > > > > wsi/wsi_common_display.c: In function
> > > > > ‘wsi_acquire_xlib_display’: wsi/wsi_common_display.c:2307:4:
> > > > > error: unknown type name ‘xcb_randr_lease_t’
> > > > > xcb_randr_lease_t lease = xcb_generate_id(connection);
> > > > > ^
> > > > > wsi/wsi_common_display.c:2308:4: error: unknown type name
> > > > > ‘xcb_randr_create_lease_cookie_t’
> > > > > xcb_randr_create_lease_cookie_t cl_c =
> > > > > ^
> > > > > wsi/wsi_common_display.c:2309:7: error: implicit declaration of
> > > > > function
> > > > > ‘xcb_randr_create_lease’ [-Werror=implicit-function-declaration]
> > > > > xcb_randr_create_lease(connection, root, lease, 1, 1, ^
> > > > > wsi/wsi_common_display.c:2311:4: error: unknown type name
> > > > > ‘xcb_randr_create_lease_reply_t’
> > > > > xcb_randr_create_lease_reply_t *cl_r =
> > > > > ^
> > > > > wsi/wsi_common_display.c:2312:7: error: implicit declaration of
> > > > > function
> > > > > ‘xcb_randr_create_lease_reply’
> [-Werror=implicit-function-declaration]
> > > > > xcb_randr_create_lease_reply(connection, cl_c, NULL); ^
> > > > > wsi/wsi_common_display.c:2312:7: warning: initialization makes
> > > > > pointer from integer without a cast [-Wint-conversion]
> > > > > wsi/wsi_common_display.c:2317:12: error: request for member
> > > > > ‘nfd’ in something not a structure or union
> > > > > if (cl_r->nfd > 0) {
> > > > > ^
> > > > > wsi/wsi_common_display.c:2318:20: error: implicit declaration of
> > > > > function
> > > > > ‘xcb_randr_create_lease_reply_fds’
> > > [-Werror=implicit-function-declaration]
> > > > > int *rcl_f = xcb_randr_create_lease_reply_fds(connection,
> > > > > cl_r); ^ wsi/wsi_common_display.c:2318:20: warning:
> > > > > initialization makes pointer from integer without a cast
> > > > > [-Wint-conversion] wsi/wsi_common_display.c: In function
> > > > > ‘wsi_get_swapchain_counter’: wsi/wsi_common_display.c:2456:14:
> > > > > error: implicit declaration of function
> > > > > ‘drmCrtcGetSequence’ [-Werror=implicit-function-declaration] int
> > > > > ret = drmCrtcGetSequence(wsi->fd, connector->crtc_id, value,
> > > > > NULL); ^ cc1: some warnings being treated as errors
> > > > > Makefile:743: recipe for target 'wsi/wsi_common_display.lo'
> > > > > failed make[3]: *** [wsi/wsi_common_display.lo] Error 1
> > > > >
> > > > > > It would be helpful if you posted the failure output, without
> > > > > > it its difficult to diagnose
> > > > > >
> > > > > > I'm not seeing any issues with the master branch on the meson
> > > > > > build
> > > > > >
> > > > > 

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

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

Andrés Gómez García  changed:

   What|Removed |Added

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

--- Comment #2 from Andrés Gómez García  ---
The branch has been created today.

Therefore, I'm closing this and moving bug 106865 to the new release tracker
bug 107457.

New features will need to wait for 18.3, possibly added to bug 107455.

-- 
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] [ANNOUNCE] mesa 18.2.0-rc1

2018-08-02 Thread Andres Gomez
Forgot to mention that, in the path to 18.2.0, there is now a tracker
bug for the regressions found since 18.1:
https://bugs.freedesktop.org/show_bug.cgi?id=107457


On Thu, 2018-08-02 at 19:05 +0300, Andres Gomez wrote:
> The subject was obviously wrong 😕
> 
> On Thu, 2018-08-02 at 18:52 +0300, Andres Gomez wrote:
> > The first release candidate for Mesa 18.2.0 is now available.
> > 
> > The plan is to have one release candidate every Wednesday, until the
> > anticipated final release on 22nd August 2018.
> > 
> > The expectation is that the 18.1 branch will remain alive with bi-
> > weekly releases until the 18.2.1 release.
> > 
> > NOTE: Building intel tools with meson is currently not possible.
> > Please, use autotools until the issue is resolved.
> > 
> > Here are the people which helped shape the current release.
> > 
> >  2  Aaron Watry
> >  2  Adam Jackson
> > 18  Alejandro Piñeiro
> >  5  Alex Smith
> >  1  Alexander von Gluck IV
> > 17  Alok Hota
> >  1  Alyssa Rosenzweig
> > 10  Andres Gomez
> >  3  Andres Rodriguez
> >  2  Andrew Galante
> >  1  Andrii Simiklit
> >  8  Antia Puentes
> >  4  Anuj Phogat
> > 61  Bas Nieuwenhuizen
> >  1  Benedikt Schemmer
> >  1  Boyan Ding
> >  2  Boyuan Zhang
> > 20  Brian Paul
> > 30  Caio Marcelo de Oliveira Filho
> >  1  Cameron Kumar
> >  4  Chad Versace
> >  3  Charmaine Lee
> >  1  Chih-Wei Huang
> > 11  Chris Wilson
> >  7  Christian Gmeiner
> >  1  Christoph Haag
> >  8  Daniel Schürmann
> >  2  Daniel Stone
> >  5  Danylo Piliaiev
> > 74  Dave Airlie
> >  2  David Riley
> >  1  Deepak Rawat
> >  4  Denis Pauk
> >  2  Dieter Nützel
> >  3  Drew Davenport
> > 51  Dylan Baker
> >  9  Eduardo Lima Mitev
> >  9  Emil Velikov
> >172  Eric Anholt
> > 53  Eric Engestrom
> > 11  Erik Faye-Lund
> > 55  Francisco Jerez
> >  2  Fritz Koenig
> > 28  George Kyriazis
> > 43  Gert Wollny
> >  3  Grazvydas Ignotas
> >  1  Gurchetan Singh
> >  2  Gustavo Lima Chaves
> >  1  Harish Krupo
> > 27  Iago Toral Quiroga
> > 29  Ian Romanick
> >  8  Ilia Mirkin
> >  1  Jakob Bornecrantz
> > 19  Jan Vesely
> >281  Jason Ekstrand
> >  1  Joe M. Kniss
> >  1  Johan Klokkhammer Helsing
> >  3  Jon Turney
> >  5  Jonathan Marek
> > 25  Jordan Justen
> >  1  Jose Dapena Paz
> > 30  Jose Maria Casanova Crespo
> >  5  José Fonseca
> > 25  Juan A. Suarez Romero
> >  1  Józef Kucia
> >  1  Kai Wasserbäch
> > 23  Karol Herbst
> > 17  Keith Packard
> > 37  Kenneth Graunke
> >  5  Konstantin Kharlamov
> >  1  Kyle Brenneman
> >  1  Leo Liu
> >  2  Lepton Wu
> > 45  Lionel Landwerlin
> >  1  Lucas Stach
> >  2  Lukas Rusak
> >  8  Marc-André Lureau
> >221  Marek Olšák
> >  2  Mario Kleiner
> >  2  Mark Janes
> >  1  Martin Pelikán
> > 16  Mathias Fröhlich
> > 19  Mathieu Bridon
> >  1  Matt Atwood
> >  5  Matt Turner
> >  1  Matthew Nicholls
> >  1  Matthias Groß
> >  8  Mauro Rossi
> >  4  Michel Dänzer
> >  2  Miguel Casas
> > 47  Nanley Chery
> > 23  Neil Roberts
> >  3  Nicolai Hähnle
> >  1  Nicolas Boichat
> >  1  Olivier Fourdan
> >  1  Philip Rebohle
> >  2  Pierre Moreau
> >  3  Plamena Manolova
> >  5  Rafael Antognolli
> > 31  Rhys Perry
> > 89  Rob Clark
> >  1  Rob Herring
> >  2  Robert Foss
> > 15  Roland Scheidegger
> >  3  Ross Burton
> >  1  Sagar Ghuge
> >  4  Samuel Iglesias Gonsálvez
> >131  Samuel Pitoiset
> > 21  Scott D Phillips
> >  1  Sergii Romantsov
> >  9  Sonny Jiang
> >  6  Stefan Schake
> >  1  Stuart Young
> > 16  Tapani Pälli
> >  3  Thierry Reding
> >  1  Thomas Hellstrom
> >  1  Thomas Petazzoni
> > 59  Timothy Arceri
> >  1  Timothy Pearson
> >  1  Tom Stellard
> >  5  Tomeu Vizoso
> >  1  Topi Pohjolainen
> >  1  Ville Syrjälä
> >  6  Vinson Lee
> >  2  Vlad Golovkin
> >  2  Xiong, James
> >  2  gurchetansi...@chromium.org
> >  2  jenny.q.cao
> >  1  vadym.shovkoplias
> >  2  zhaowei yuan
> > 
> > 
> > git tag: mesa-18.2.0-rc1
> > 
> > https://mesa.freedesktop.org/archive/mesa-18.2.0-rc1.tar.gz
> > MD5:  9c6d95d5d3929aa2760eb5b7b0a40

Re: [Mesa-dev] vulkan.radv build trouble w/ AOSP

2018-08-02 Thread Mauro Rossi
Hi,


Il giorno gio 2 ago 2018 alle ore 17:51 Emil Velikov <
emil.l.veli...@gmail.com> ha scritto:

> On 2 August 2018 at 07:47, Mauro Rossi  wrote:
> > Hi,
> >
> > Il giorno gio 2 ago 2018 alle ore 02:06 John Stultz <
> john.stu...@linaro.org>
> > ha scritto:
> >>
> >> Just as a heads up, with mesa3d master (plus my other build fixups I
> >> just sent out), I'm seeing a new build failure when building under
> >> AOSP/master:
> >>
> >> external/mesa3d/src/amd/vulkan/Android.mk: error: vulkan.radv
> >> (SHARED_LIBRARIES android-arm64) missing libLLVM (SHARED_LIBRARIES
> >> android-arm64)
> >> You can set ALLOW_MISSING_DEPENDENCIES=true in your environment if
> >> this is intentional, but that may defer real problems until later in
> >> the build.
> >> external/mesa3d/src/amd/vulkan/Android.mk: error: vulkan.radv
> >> (SHARED_LIBRARIES android-arm) missing libLLVM (SHARED_LIBRARIES
> >> android-arm)
> >> You can set ALLOW_MISSING_DEPENDENCIES=true in your environment if
> >> this is intentional, but that may defer real problems until later in
> >> the build.
> >> build/make/core/main.mk:842: error: exiting from previous errors.
> >> 22:56:25 ckati failed with: exit status 1
> >>
> >> This seems to be coming from the $(call mesa-build-with-llvm) line here:
> >>
> https://github.com/mesa3d/mesa/blob/master/src/amd/vulkan/Android.mk#L144
> >>
> >> (as commenting that out avoids the issue)
> >>
> >> This gets pulled in as AOSP will check library dependencies for all
> >> SHARED_LIBRARIES, so that's why the vulkan.radv trips this while other
> >> "mesa-build-with-llvm" callers don't (they are built as
> >> STATIC_LIBRARIES).
> >>
> >> Last time we had this issue, it was with the libpciaccess library,
> >> which we solved it by dropping it.
> >>
> >> In this case I'm not sure what the best solution might be.
> >>
> >> * We could set it as a static library instead?
> >>
> >> * Alternatively, it seems we might be able to use the libLLVM_android
> >> library instead of libLLVM here:
> >>   https://github.com/mesa3d/mesa/blob/master/Android.mk#L107
> >>
> >> Other ideas/suggestions?
> >>
> >> thanks
> >> -john
> >
> >
> > A couple of ideas, but not yet tested in a build
> >
> > option 3) - use LOCAL_MODULE_TARGET_ARCH in the local vulkan.radv
> Android.mk
> > and see if that solves the problem
> >
> > option 4) - brace the 'include $(LOCAL_PATH)/vulkan/Android.mk' in
> > vulkan.radv src/amd/Android.mk in like this:
> >
> >  # Import variables
> >  include $(LOCAL_PATH)/Makefile.sources
> >  include $(LOCAL_PATH)/Android.addrlib.mk
> >  include $(LOCAL_PATH)/Android.common.mk
> > +ifneq ($(filter radeonsi,$(BOARD_GPU_DRIVERS)),)
> > include $(LOCAL_PATH)/vulkan/Android.mk
> > +endif
> >
> > I think the option 4) seems simpler than the others , if the assumption
> that
> > ARM does not have radeonsi stands
> > Mauro
> >
> Such a guard sounds perfectly reasonable IMHO.
>
> Note that ANV does not have equivalent hunk, although it will be a great
> idea.
> IIRC the lack of it, is the core reason behind xgettext workaround
> that John sent out recently.
>
> Thanks
> Emil
>

Thanks,
I will submit to mesa-dev and Cc: "18.2" mesa-stable to have it in the
18.2.0 release.
John, is it ok for you?

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


[Mesa-dev] meas master branch build failure related with vulkan

2018-08-02 Thread Guang Bai
All,

Is there any fix expected for mesa/master branch build failures related
with vulkan?
And the "xcb-randr" 1.13+ has to be installed to build the mesa/master
branch?
Where can I download the xcb-randr 1.13 - I can only find the 1.12
package now.

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


Re: [Mesa-dev] [PATCH] intel/tools: add error2aub creation into autotools

2018-08-02 Thread Dylan Baker
Quoting Lionel Landwerlin (2018-08-02 09:46:59)
> On 02/08/18 17:39, Andres Gomez wrote:
> > Tarball distribution is done through "make distcheck". We include the
> > meson targets also into autotools so they won't fail when building
> > from the tarball.
> >
> > Fixes: 6a60beba408 ("intel/tools: Add an error state to aub translator")
> > Cc: Jason Ekstrand 
> > Cc: Lionel Landwerlin 
> > Cc: Dylan Baker 
> > Signed-off-by: Andres Gomez 
> 
> Looks like I'll have to update some stuff on my branches.
> I was hoping that we could start forgetting about autotools but forgot 
> about about released tarballs :(
> 
> Reviewed-by: Lionel Landwerlin 

We could just shove all of the sources into EXTRA_DIST and call it good.

> 
> > ---
> > This just fixes running the default "meson _build" from the inflated
> > tarball. Not sure we need to include more targets.
> >
> >   src/intel/Makefile.tools.am | 24 +++-
> >   1 file changed, 23 insertions(+), 1 deletion(-)
> >
> > diff --git a/src/intel/Makefile.tools.am b/src/intel/Makefile.tools.am
> > index b00cc8cc2cb..00624084e6f 100644
> > --- a/src/intel/Makefile.tools.am
> > +++ b/src/intel/Makefile.tools.am
> > @@ -21,7 +21,9 @@
> >   
> >   noinst_PROGRAMS += \
> >   tools/aubinator \
> > - tools/aubinator_error_decode
> > + tools/aubinator_error_decode \
> > + tools/error2aub
> > +
> >   
> >   tools_aubinator_SOURCES = \
> >   tools/aubinator.c \
> > @@ -59,3 +61,23 @@ tools_aubinator_error_decode_LDADD = \
> >   tools_aubinator_error_decode_CFLAGS = \
> >   $(AM_CFLAGS) \
> >   $(ZLIB_CFLAGS)
> > +
> > +
> > +tools_error2aub_SOURCES = \
> > + tools/gen_context.h \
> > + tools/gen8_context.h \
> > + tools/gen10_context.h \
> > + tools/aub_write.h \
> > + tools/aub_write.c \
> > + tools/error2aub.c
> > +
> > +tools_error2aub_CFLAGS = \
> > + $(AM_CFLAGS) \
> > + $(ZLIB_CFLAGS)
> > +
> > +tools_error2aub_LDADD = \
> > + dev/libintel_dev.la \
> > + $(PTHREAD_LIBS) \
> > + $(DLOPEN_LIBS) \
> > + $(ZLIB_LIBS) \
> > + -lm
> 
> 


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] intel/tools: add error2aub creation into autotools

2018-08-02 Thread Dylan Baker
This seems like a fine thing to do, I don't know how many people actually build
tools from the tarball, but making them work seems useful.

Reviewed-by: Dylan Baker 

Quoting Andres Gomez (2018-08-02 09:39:06)
> Tarball distribution is done through "make distcheck". We include the
> meson targets also into autotools so they won't fail when building
> from the tarball.
> 
> Fixes: 6a60beba408 ("intel/tools: Add an error state to aub translator")
> Cc: Jason Ekstrand 
> Cc: Lionel Landwerlin 
> Cc: Dylan Baker 
> Signed-off-by: Andres Gomez 
> ---
> This just fixes running the default "meson _build" from the inflated
> tarball. Not sure we need to include more targets.
> 
>  src/intel/Makefile.tools.am | 24 +++-
>  1 file changed, 23 insertions(+), 1 deletion(-)
> 
> diff --git a/src/intel/Makefile.tools.am b/src/intel/Makefile.tools.am
> index b00cc8cc2cb..00624084e6f 100644
> --- a/src/intel/Makefile.tools.am
> +++ b/src/intel/Makefile.tools.am
> @@ -21,7 +21,9 @@
>  
>  noinst_PROGRAMS += \
> tools/aubinator \
> -   tools/aubinator_error_decode
> +   tools/aubinator_error_decode \
> +   tools/error2aub
> +
>  
>  tools_aubinator_SOURCES = \
> tools/aubinator.c \
> @@ -59,3 +61,23 @@ tools_aubinator_error_decode_LDADD = \
>  tools_aubinator_error_decode_CFLAGS = \
> $(AM_CFLAGS) \
> $(ZLIB_CFLAGS)
> +
> +
> +tools_error2aub_SOURCES = \
> +   tools/gen_context.h \
> +   tools/gen8_context.h \
> +   tools/gen10_context.h \
> +   tools/aub_write.h \
> +   tools/aub_write.c \
> +   tools/error2aub.c
> +
> +tools_error2aub_CFLAGS = \
> +   $(AM_CFLAGS) \
> +   $(ZLIB_CFLAGS)
> +
> +tools_error2aub_LDADD = \
> +   dev/libintel_dev.la \
> +   $(PTHREAD_LIBS) \
> +   $(DLOPEN_LIBS) \
> +   $(ZLIB_LIBS) \
> +   -lm
> -- 
> 2.18.0
> 


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


[Mesa-dev] [PATCH] anv/pipeline: Disable FS dispatch for pointless fragment shaders

2018-08-02 Thread Jason Ekstrand
---
 src/intel/vulkan/anv_pipeline.c | 37 +
 1 file changed, 33 insertions(+), 4 deletions(-)

diff --git a/src/intel/vulkan/anv_pipeline.c b/src/intel/vulkan/anv_pipeline.c
index 85f38da60ff..86e0211a29d 100644
--- a/src/intel/vulkan/anv_pipeline.c
+++ b/src/intel/vulkan/anv_pipeline.c
@@ -831,9 +831,25 @@ anv_pipeline_compile_fs(const struct brw_compiler 
*compiler,
fs_stage->key.wm.input_slots_valid =
   prev_stage->prog_data.vue.vue_map.slots_valid;
 
-   return brw_compile_fs(compiler, NULL, mem_ctx, &fs_stage->key.wm,
- &fs_stage->prog_data.wm, fs_stage->nir,
- NULL, -1, -1, -1, true, false, NULL, NULL);
+   const unsigned *code =
+  brw_compile_fs(compiler, NULL, mem_ctx, &fs_stage->key.wm,
+ &fs_stage->prog_data.wm, fs_stage->nir,
+ NULL, -1, -1, -1, true, false, NULL, NULL);
+
+   if (fs_stage->key.wm.nr_color_regions == 0 &&
+   !fs_stage->prog_data.wm.has_side_effects &&
+   !fs_stage->prog_data.wm.uses_kill &&
+   fs_stage->prog_data.wm.computed_depth_mode == BRW_PSCDEPTH_OFF &&
+   !fs_stage->prog_data.wm.computed_stencil) {
+  /* This fragment shader has not outputs and no side effects.  Go ahead
+   * and return the code pointer so we don't accidentally think the
+   * compile failed but zero out prog_data which will set program_size to
+   * zero and disable the stage.
+   */
+  memset(&fs_stage->prog_data, 0, sizeof(fs_stage->prog_data));
+   }
+
+   return code;
 }
 
 static VkResult
@@ -915,7 +931,7 @@ anv_pipeline_compile_graphics(struct anv_pipeline *pipeline,
 
if (found == __builtin_popcount(pipeline->active_stages)) {
   /* We found all our shaders in the cache.  We're done. */
-  return VK_SUCCESS;
+  goto done;
} else if (found > 0) {
   /* We found some but not all of our shaders.  This shouldn't happen
* most of the time but it can if we have a partially populated
@@ -1057,6 +1073,19 @@ anv_pipeline_compile_graphics(struct anv_pipeline 
*pipeline,
 
ralloc_free(pipeline_ctx);
 
+done:
+
+   if (pipeline->shaders[MESA_SHADER_FRAGMENT] &&
+   pipeline->shaders[MESA_SHADER_FRAGMENT]->prog_data->program_size == 0) {
+  /* This can happen if we decided to implicitly disable the fragment
+   * shader.  See anv_pipeline_compile_fs().
+   */
+  anv_shader_bin_unref(pipeline->device,
+   pipeline->shaders[MESA_SHADER_FRAGMENT]);
+  pipeline->shaders[MESA_SHADER_FRAGMENT] = NULL;
+  pipeline->active_stages &= ~VK_SHADER_STAGE_FRAGMENT_BIT;
+   }
+
return VK_SUCCESS;
 
 fail:
-- 
2.17.1

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


Re: [Mesa-dev] meas master branch build failure related with vulkan

2018-08-02 Thread Bai, Guang
Please ignore this mail - I posted before joining the "mesa-dev" mailing list.
There is already a new email loop to address my questions.
Thanks,
Guang

-Original Message-
From: mesa-dev [mailto:mesa-dev-boun...@lists.freedesktop.org] On Behalf Of 
Guang Bai
Sent: Wednesday, August 01, 2018 1:03 PM
To: mesa-dev@lists.freedesktop.org
Subject: [Mesa-dev] meas master branch build failure related with vulkan

All,

Is there any fix expected for mesa/master branch build failures related with 
vulkan?
And the "xcb-randr" 1.13+ has to be installed to build the mesa/master branch?
Where can I download the xcb-randr 1.13 - I can only find the 1.12 package now.

Regards,
Guang
___
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] vulkan.radv build trouble w/ AOSP

2018-08-02 Thread John Stultz
On Thu, Aug 2, 2018 at 10:25 AM, Mauro Rossi  wrote:
> Hi,
>
>
> Il giorno gio 2 ago 2018 alle ore 17:51 Emil Velikov
>  ha scritto:
>>
>> On 2 August 2018 at 07:47, Mauro Rossi  wrote:
>> > Hi,
>> >
>> > Il giorno gio 2 ago 2018 alle ore 02:06 John Stultz
>> > 
>> > ha scritto:
>> >>
>> >> Just as a heads up, with mesa3d master (plus my other build fixups I
>> >> just sent out), I'm seeing a new build failure when building under
>> >> AOSP/master:
>> >>
>> >> external/mesa3d/src/amd/vulkan/Android.mk: error: vulkan.radv
>> >> (SHARED_LIBRARIES android-arm64) missing libLLVM (SHARED_LIBRARIES
>> >> android-arm64)
>> >> You can set ALLOW_MISSING_DEPENDENCIES=true in your environment if
>> >> this is intentional, but that may defer real problems until later in
>> >> the build.
>> >> external/mesa3d/src/amd/vulkan/Android.mk: error: vulkan.radv
>> >> (SHARED_LIBRARIES android-arm) missing libLLVM (SHARED_LIBRARIES
>> >> android-arm)
>> >> You can set ALLOW_MISSING_DEPENDENCIES=true in your environment if
>> >> this is intentional, but that may defer real problems until later in
>> >> the build.
>> >> build/make/core/main.mk:842: error: exiting from previous errors.
>> >> 22:56:25 ckati failed with: exit status 1
>> >>
>> >> This seems to be coming from the $(call mesa-build-with-llvm) line
>> >> here:
>> >>
>> >> https://github.com/mesa3d/mesa/blob/master/src/amd/vulkan/Android.mk#L144
>> >>
>> >> (as commenting that out avoids the issue)
>> >>
>> >> This gets pulled in as AOSP will check library dependencies for all
>> >> SHARED_LIBRARIES, so that's why the vulkan.radv trips this while other
>> >> "mesa-build-with-llvm" callers don't (they are built as
>> >> STATIC_LIBRARIES).
>> >>
>> >> Last time we had this issue, it was with the libpciaccess library,
>> >> which we solved it by dropping it.
>> >>
>> >> In this case I'm not sure what the best solution might be.
>> >>
>> >> * We could set it as a static library instead?
>> >>
>> >> * Alternatively, it seems we might be able to use the libLLVM_android
>> >> library instead of libLLVM here:
>> >>   https://github.com/mesa3d/mesa/blob/master/Android.mk#L107
>> >>
>> >> Other ideas/suggestions?
>> >>
>> >> thanks
>> >> -john
>> >
>> >
>> > A couple of ideas, but not yet tested in a build
>> >
>> > option 3) - use LOCAL_MODULE_TARGET_ARCH in the local vulkan.radv
>> > Android.mk
>> > and see if that solves the problem
>> >
>> > option 4) - brace the 'include $(LOCAL_PATH)/vulkan/Android.mk' in
>> > vulkan.radv src/amd/Android.mk in like this:
>> >
>> >  # Import variables
>> >  include $(LOCAL_PATH)/Makefile.sources
>> >  include $(LOCAL_PATH)/Android.addrlib.mk
>> >  include $(LOCAL_PATH)/Android.common.mk
>> > +ifneq ($(filter radeonsi,$(BOARD_GPU_DRIVERS)),)
>> > include $(LOCAL_PATH)/vulkan/Android.mk
>> > +endif
>> >
>> > I think the option 4) seems simpler than the others , if the assumption
>> > that
>> > ARM does not have radeonsi stands
>> > Mauro
>> >
>> Such a guard sounds perfectly reasonable IMHO.
>>
>> Note that ANV does not have equivalent hunk, although it will be a great
>> idea.
>> IIRC the lack of it, is the core reason behind xgettext workaround
>> that John sent out recently.
>>
>> Thanks
>> Emil
>
>
> Thanks,
> I will submit to mesa-dev and Cc: "18.2" mesa-stable to have it in the
> 18.2.0 release.
> John, is it ok for you?

Yea. I just tried it and option 4 does seem to avoid the issue!

Thanks so much for the quick turnaround!
-john
___
mesa-dev mailing list
mesa-dev@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/mesa-dev


Re: [Mesa-dev] [PATCH] mesa: add switch case for GL 2.0 in _mesa_compute_version()

2018-08-02 Thread Eric Anholt
Brian Paul  writes:

> Previously, I added a switch case for GL 2.1 (ed7a0770b881791dd697f3).
> I don't know of any driver which only supports GL 2.0, but adding
> this switch case avoids a failure if the app queries
> GL_SHADING_LANGUAGE_VERSION.

Reviewed-by: Eric Anholt 


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


Re: [Mesa-dev] [PATCH] gallium/u_vbuf: handle indirect multidraws correctly and efficiently (v3)

2018-08-02 Thread Eric Anholt
Marek Olšák  writes:

> From: Marek Olšák 
>
> v2: need to do MAX{start+count} instead of MAX{count}
> added piglit tests
> v3: use malloc
> ---
>  src/gallium/auxiliary/util/u_vbuf.c | 204 
>  1 file changed, 180 insertions(+), 24 deletions(-)
>
> diff --git a/src/gallium/auxiliary/util/u_vbuf.c 
> b/src/gallium/auxiliary/util/u_vbuf.c
> index 746ff1085ce..a7a8a3be21b 100644
> --- a/src/gallium/auxiliary/util/u_vbuf.c
> +++ b/src/gallium/auxiliary/util/u_vbuf.c

> -  new_info.count = data[0];
> -  new_info.instance_count = data[1];
> -  new_info.start = data[2];
> -  pipe_buffer_unmap(pipe, transfer);
> -  new_info.indirect = NULL;
> -
> -  if (!new_info.count)
> +  if (!draw_count)
>   return;
> +
> +  unsigned data_size = (draw_count - 1) * indirect->stride +
> +   (new_info.index_size ? 20 : 16);
> +  unsigned *data = malloc(data_size);
> +  if (!data)
> + return; /* report an error? */

I think you can just _mesa_error(ctx, GL_OUT_OF_MEMORY, "glDrawPixels");
and then return.  With that, 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] mesa: add switch case for GL 2.0 in _mesa_compute_version()

2018-08-02 Thread Ian Romanick
Reviewed-by: Ian Romanick 

On 08/02/2018 08:45 AM, Brian Paul wrote:
> Previously, I added a switch case for GL 2.1 (ed7a0770b881791dd697f3).
> I don't know of any driver which only supports GL 2.0, but adding
> this switch case avoids a failure if the app queries
> GL_SHADING_LANGUAGE_VERSION.
> ---
>  src/mesa/main/version.c | 2 ++
>  1 file changed, 2 insertions(+)
> 
> diff --git a/src/mesa/main/version.c b/src/mesa/main/version.c
> index 2c5bd77..9df8c11 100644
> --- a/src/mesa/main/version.c
> +++ b/src/mesa/main/version.c
> @@ -617,6 +617,8 @@ _mesa_compute_version(struct gl_context *ctx)
>  */
> if (_mesa_is_desktop_gl(ctx)) {
>switch (ctx->Version) {
> +  case 20:
> + /* fall-through, GLSL 1.20 is the minimum we support */
>case 21:
>   ctx->Const.GLSLVersion = 120;
>   break;
> 

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


[Mesa-dev] [PATCH 03/13] nir: Don't compare i2f or u2i with zero

2018-08-02 Thread Ian Romanick
From: Ian Romanick 

Broadwell and Skylake had similar results. (Skylake shown)
total instructions in shared programs: 14277620 -> 14277230 (<.01%)
instructions in affected programs: 36905 -> 36515 (-1.06%)
helped: 101
HURT: 6
helped stats (abs) min: 1 max: 6 x̄: 4.46 x̃: 6
helped stats (rel) min: 0.32% max: 7.69% x̄: 1.80% x̃: 1.51%
HURT stats (abs)   min: 1 max: 28 x̄: 10.00 x̃: 1
HURT stats (rel)   min: 0.33% max: 1.74% x̄: 0.68% x̃: 0.47%
95% mean confidence interval for instructions value: -4.59 -2.70
95% mean confidence interval for instructions %-change: -1.90% -1.41%
Instructions are helped.

total cycles in shared programs: 532580716 -> 532577947 (<.01%)
cycles in affected programs: 940575 -> 937806 (-0.29%)
helped: 92
HURT: 12
helped stats (abs) min: 2 max: 158 x̄: 51.04 x̃: 62
helped stats (rel) min: 0.24% max: 3.99% x̄: 2.14% x̃: 2.41%
HURT stats (abs)   min: 10 max: 1112 x̄: 160.58 x̃: 63
HURT stats (rel)   min: 0.06% max: 21.90% x̄: 4.22% x̃: 0.20%
95% mean confidence interval for cycles value: -50.66 -2.59
95% mean confidence interval for cycles %-change: -2.09% -0.73%
Cycles are helped.

total spills in shared programs: 8116 -> 8124 (0.10%)
spills in affected programs: 200 -> 208 (4.00%)
helped: 0
HURT: 2

total fills in shared programs: 11086 -> 11094 (0.07%)
fills in affected programs: 436 -> 444 (1.83%)
helped: 0
HURT: 2

Ivy Bridge and Haswell had similar results. (Haswell shown)
total instructions in shared programs: 12979054 -> 12978067 (<.01%)
instructions in affected programs: 33633 -> 32646 (-2.93%)
helped: 120
HURT: 2
helped stats (abs) min: 1 max: 13 x̄: 8.53 x̃: 13
helped stats (rel) min: 0.30% max: 16.67% x̄: 4.55% x̃: 3.17%
HURT stats (abs)   min: 18 max: 18 x̄: 18.00 x̃: 18
HURT stats (rel)   min: 1.15% max: 2.84% x̄: 2.00% x̃: 2.00%
95% mean confidence interval for instructions value: -9.19 -6.99
95% mean confidence interval for instructions %-change: -5.27% -3.62%
Instructions are helped.

total cycles in shared programs: 411212880 -> 411199636 (<.01%)
cycles in affected programs: 696441 -> 683197 (-1.90%)
helped: 107
HURT: 5
helped stats (abs) min: 2 max: 864 x̄: 124.90 x̃: 146
helped stats (rel) min: 0.03% max: 29.20% x̄: 8.58% x̃: 5.88%
HURT stats (abs)   min: 2 max: 50 x̄: 24.00 x̃: 22
HURT stats (rel)   min: 0.01% max: 5.35% x̄: 1.29% x̃: 0.25%
95% mean confidence interval for cycles value: -136.96 -99.54
95% mean confidence interval for cycles %-change: -9.75% -6.53%
Cycles are helped.

total spills in shared programs: 78623 -> 78631 (0.01%)
spills in affected programs: 66 -> 74 (12.12%)
helped: 0
HURT: 2

total fills in shared programs: 80104 -> 80108 (<.01%)
fills in affected programs: 133 -> 137 (3.01%)
helped: 0
HURT: 2

No changes on Sandy Bridge, Iron Lake, or GM45.

Signed-off-by: Ian Romanick 
---
 src/compiler/nir/nir_opt_algebraic.py | 13 +
 1 file changed, 13 insertions(+)

diff --git a/src/compiler/nir/nir_opt_algebraic.py 
b/src/compiler/nir/nir_opt_algebraic.py
index 9aeafcb8c46..fdd1af9d177 100644
--- a/src/compiler/nir/nir_opt_algebraic.py
+++ b/src/compiler/nir/nir_opt_algebraic.py
@@ -193,6 +193,19 @@ optimizations = [
(('ieq', ('b2i', a), 0),   ('inot', a)),
(('ine', ('b2i', a), 0),   a),
 
+   (('fne', ('u2f32', a), 0.0), ('ine', a, 0)),
+   (('feq', ('u2f32', a), 0.0), ('ieq', a, 0)),
+   (('fge', ('u2f32', a), 0.0), True),
+   (('fge', 0.0, ('u2f32', a)), ('uge', 0, a)),# ieq instead?
+   (('flt', ('u2f32', a), 0.0), False),
+   (('flt', 0.0, ('u2f32', a)), ('ult', 0, a)),# ine instead?
+   (('fne', ('i2f32', a), 0.0), ('ine', a, 0)),
+   (('feq', ('i2f32', a), 0.0), ('ieq', a, 0)),
+   (('fge', ('i2f32', a), 0.0), ('ige', a, 0)),
+   (('fge', 0.0, ('i2f32', a)), ('ige', 0, a)),
+   (('flt', ('i2f32', a), 0.0), ('ilt', a, 0)),
+   (('flt', 0.0, ('i2f32', a)), ('ilt', 0, a)),
+
# 0.0 < fabs(a)
# fabs(a) > 0.0
# fabs(a) != 0.0 because fabs(a) must be >= 0
-- 
2.14.4

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


[Mesa-dev] [PATCH 02/13] nir: Remove f2i(i2f(x)) conversions

2018-08-02 Thread Ian Romanick
From: Ian Romanick 

Broadwell and Skylake had similar results. (Skylake shown)
total instructions in shared programs: 14277978 -> 14277620 (<.01%)
instructions in affected programs: 36957 -> 36599 (-0.97%)
helped: 76
HURT: 1
helped stats (abs) min: 2 max: 90 x̄: 4.89 x̃: 4
helped stats (rel) min: 0.44% max: 5.88% x̄: 1.04% x̃: 0.87%
HURT stats (abs)   min: 14 max: 14 x̄: 14.00 x̃: 14
HURT stats (rel)   min: 0.36% max: 0.36% x̄: 0.36% x̃: 0.36%
95% mean confidence interval for instructions value: -7.06 -2.24
95% mean confidence interval for instructions %-change: -1.28% -0.77%
Instructions are helped.

total cycles in shared programs: 532584581 -> 532580716 (<.01%)
cycles in affected programs: 973591 -> 969726 (-0.40%)
helped: 76
HURT: 1
helped stats (abs) min: 2 max: 9940 x̄: 159.80 x̃: 32
helped stats (rel) min: <.01% max: 8.70% x̄: 1.15% x̃: 1.19%
HURT stats (abs)   min: 8280 max: 8280 x̄: 8280.00 x̃: 8280
HURT stats (rel)   min: 2.10% max: 2.10% x̄: 2.10% x̃: 2.10%
95% mean confidence interval for cycles value: -386.98 286.59
95% mean confidence interval for cycles %-change: -1.41% -0.81%
Inconclusive result (value mean confidence interval includes 0).

total spills in shared programs: 8127 -> 8116 (-0.14%)
spills in affected programs: 108 -> 97 (-10.19%)
helped: 1
HURT: 0

total fills in shared programs: 11090 -> 11086 (-0.04%)
fills in affected programs: 440 -> 436 (-0.91%)
helped: 1
HURT: 1

Haswell
total instructions in shared programs: 12979174 -> 12979054 (<.01%)
instructions in affected programs: 9040 -> 8920 (-1.33%)
helped: 14
HURT: 1
helped stats (abs) min: 2 max: 34 x̄: 8.79 x̃: 6
helped stats (rel) min: 0.41% max: 7.04% x̄: 2.66% x̃: 1.14%
HURT stats (abs)   min: 3 max: 3 x̄: 3.00 x̃: 3
HURT stats (rel)   min: 0.19% max: 0.19% x̄: 0.19% x̃: 0.19%
95% mean confidence interval for instructions value: -13.58 -2.42
95% mean confidence interval for instructions %-change: -3.94% -1.01%
Instructions are helped.

total cycles in shared programs: 411227148 -> 411212880 (<.01%)
cycles in affected programs: 630506 -> 616238 (-2.26%)
helped: 15
HURT: 0
helped stats (abs) min: 2 max: 11192 x̄: 951.20 x̃: 38
helped stats (rel) min: <.01% max: 16.01% x̄: 3.92% x̃: 0.17%
95% mean confidence interval for cycles value: -2544.28 641.88
95% mean confidence interval for cycles %-change: -6.89% -0.94%
Inconclusive result (value mean confidence interval includes 0).

total spills in shared programs: 78626 -> 78623 (<.01%)
spills in affected programs: 42 -> 39 (-7.14%)
helped: 1
HURT: 0

total fills in shared programs: 80111 -> 80104 (<.01%)
fills in affected programs: 140 -> 133 (-5.00%)
helped: 1
HURT: 1

Ivy Bridge
total instructions in shared programs: 11684101 -> 11684030 (<.01%)
instructions in affected programs: 3080 -> 3009 (-2.31%)
helped: 4
HURT: 1
helped stats (abs) min: 5 max: 59 x̄: 18.50 x̃: 5
helped stats (rel) min: 6.47% max: 7.04% x̄: 6.87% x̃: 6.99%
HURT stats (abs)   min: 3 max: 3 x̄: 3.00 x̃: 3
HURT stats (rel)   min: 0.15% max: 0.15% x̄: 0.15% x̃: 0.15%
95% mean confidence interval for instructions value: -45.59 17.19
95% mean confidence interval for instructions %-change: -9.38% -1.56%
Inconclusive result (value mean confidence interval includes 0).

total cycles in shared programs: 258407697 -> 258389653 (<.01%)
cycles in affected programs: 328323 -> 310279 (-5.50%)
helped: 5
HURT: 0
helped stats (abs) min: 32 max: 14908 x̄: 3608.80 x̃: 32
helped stats (rel) min: 1.26% max: 17.22% x̄: 9.30% x̃: 10.60%
95% mean confidence interval for cycles value: -11616.71 4399.11
95% mean confidence interval for cycles %-change: -16.56% -2.03%
Inconclusive result (value mean confidence interval includes 0).

total spills in shared programs: 4537 -> 4528 (-0.20%)
spills in affected programs: 64 -> 55 (-14.06%)
helped: 1
HURT: 0

total fills in shared programs: 4823 -> 4815 (-0.17%)
fills in affected programs: 189 -> 181 (-4.23%)
helped: 1
HURT: 1

Sandy Bridge
total instructions in shared programs: 10488464 -> 10488449 (<.01%)
instructions in affected programs: 272 -> 257 (-5.51%)
helped: 3
HURT: 0
helped stats (abs) min: 5 max: 5 x̄: 5.00 x̃: 5
helped stats (rel) min: 5.49% max: 5.56% x̄: 5.51% x̃: 5.49%

total cycles in shared programs: 150263359 -> 150263263 (<.01%)
cycles in affected programs: 7978 -> 7882 (-1.20%)
helped: 3
HURT: 0
helped stats (abs) min: 32 max: 32 x̄: 32.00 x̃: 32
helped stats (rel) min: 1.15% max: 1.23% x̄: 1.20% x̃: 1.23%

No changes on Iron Lake or GM45.

Signed-off-by: Ian Romanick 
---
 src/compiler/nir/nir_opt_algebraic.py | 8 
 1 file changed, 8 insertions(+)

diff --git a/src/compiler/nir/nir_opt_algebraic.py 
b/src/compiler/nir/nir_opt_algebraic.py
index c4f46b56d95..9aeafcb8c46 100644
--- a/src/compiler/nir/nir_opt_algebraic.py
+++ b/src/compiler/nir/nir_opt_algebraic.py
@@ -455,6 +455,14 @@ optimizations = [
(('iabs', ('b2i', a)), ('b2i', a)),
(('inot', ('f2b', a)), ('feq', a, 0.0)),
 
+   # Ironically, mark these as imprecise because removing the conversio

[Mesa-dev] [PATCH 07/13] nir: Transform expressions of b2f(a) and b2f(b) to a || b

2018-08-02 Thread Ian Romanick
From: Ian Romanick 

All Gen6+ platforms had pretty similar results. (Skylake shown)
total instructions in shared programs: 14277184 -> 14276964 (<.01%)
instructions in affected programs: 10082 -> 9862 (-2.18%)
helped: 37
HURT: 1
helped stats (abs) min: 1 max: 30 x̄: 5.97 x̃: 4
helped stats (rel) min: 0.14% max: 16.00% x̄: 5.23% x̃: 2.04%
HURT stats (abs)   min: 1 max: 1 x̄: 1.00 x̃: 1
HURT stats (rel)   min: 0.70% max: 0.70% x̄: 0.70% x̃: 0.70%
95% mean confidence interval for instructions value: -7.87 -3.71
95% mean confidence interval for instructions %-change: -6.98% -3.16%
Instructions are helped.

total cycles in shared programs: 532577990 -> 532577062 (<.01%)
cycles in affected programs: 170959 -> 170031 (-0.54%)
helped: 33
HURT: 9
helped stats (abs) min: 2 max: 120 x̄: 30.91 x̃: 30
helped stats (rel) min: 0.02% max: 7.65% x̄: 2.66% x̃: 1.13%
HURT stats (abs)   min: 2 max: 24 x̄: 10.22 x̃: 8
HURT stats (rel)   min: 0.09% max: 1.79% x̄: 0.61% x̃: 0.22%
95% mean confidence interval for cycles value: -31.23 -12.96
95% mean confidence interval for cycles %-change: -2.90% -1.02%
Cycles are helped.

Iron Lake and GM45 had similar results. (Iron Lake shown)
total instructions in shared programs: 7781539 -> 7781301 (<.01%)
instructions in affected programs: 10169 -> 9931 (-2.34%)
helped: 32
HURT: 0
helped stats (abs) min: 2 max: 20 x̄: 7.44 x̃: 6
helped stats (rel) min: 0.47% max: 17.02% x̄: 4.03% x̃: 1.88%
95% mean confidence interval for instructions value: -9.53 -5.34
95% mean confidence interval for instructions %-change: -5.94% -2.12%
Instructions are helped.

total cycles in shared programs: 177878590 -> 177878932 (<.01%)
cycles in affected programs: 78706 -> 79048 (0.43%)
helped: 7
HURT: 21
helped stats (abs) min: 6 max: 34 x̄: 24.57 x̃: 28
helped stats (rel) min: 0.15% max: 8.33% x̄: 4.66% x̃: 6.37%
HURT stats (abs)   min: 2 max: 86 x̄: 24.48 x̃: 22
HURT stats (rel)   min: 0.01% max: 4.28% x̄: 1.21% x̃: 0.70%
95% mean confidence interval for cycles value: 0.30 24.13
95% mean confidence interval for cycles %-change: -1.52% 1.01%
Inconclusive result (%-change mean confidence interval includes 0).

Signed-off-by: Ian Romanick 
---
 src/compiler/nir/nir_opt_algebraic.py | 19 +++
 1 file changed, 19 insertions(+)

diff --git a/src/compiler/nir/nir_opt_algebraic.py 
b/src/compiler/nir/nir_opt_algebraic.py
index 8300d6d01f5..4d60467fbac 100644
--- a/src/compiler/nir/nir_opt_algebraic.py
+++ b/src/compiler/nir/nir_opt_algebraic.py
@@ -166,6 +166,25 @@ optimizations = [
 
(('fge', ('fneg', ('b2f', a)), 0.0), ('inot', a)),
 
+   (('fne', ('fadd', ('b2f', a), ('b2f', b)), 0.0), ('ior', a, b)),
+   (('fne', ('fmin', ('b2f', a), ('b2f', b)), 0.0), ('ior', a, b)),
+   (('fne', ('bcsel', a, 1.0, ('b2f', b))   , 0.0), ('ior', a, b)),
+   (('fne', ('b2f', a), ('fneg', ('b2f', b))),  ('ior', a, b)),
+
+   # -(b2f(a) + b2f(b)) < 0
+   # 0 < b2f(a) + b2f(b)
+   # 0 != b2f(a) + b2f(b)   b2f must be 0 or 1, so the sum is non-negative
+   # a || b
+   (('flt', ('fneg', ('fadd', ('b2f', a), ('b2f', b))), 0.0), ('ior', a, b)),
+   (('flt', 0.0, ('fadd', ('b2f', a), ('b2f', b))), ('ior', a, b)),
+
+   # Some optimizations (below) convert things like (a < b || c < b) into
+   # (min(a, c) < b).  However, this interfers with the previous optimizations
+   # that try to remove comparisons with negated sums of b2f.  This just
+   # breaks that apart.
+   (('flt', ('fmin', c, ('fneg', ('fadd', ('b2f', a), ('b2f', b, 0.0),
+('ior', ('flt', c, 0.0), ('ior', a, b))),
+
(('~flt', ('fadd', a, b), a), ('flt', b, 0.0)),
(('~fge', ('fadd', a, b), a), ('fge', b, 0.0)),
(('~feq', ('fadd', a, b), a), ('feq', b, 0.0)),
-- 
2.14.4

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


[Mesa-dev] [PATCH 01/13] nir: Mark the 0.0 < abs(a) transformation as imprecise

2018-08-02 Thread Ian Romanick
From: Ian Romanick 

Unlike the much older -abs(a) >= 0.0 transformation, this is not
precise.  The behavior changes if the source is NaN.

No shader-db changes on any platform.

Signed-off-by: Ian Romanick 
---
 src/compiler/nir/nir_opt_algebraic.py | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/src/compiler/nir/nir_opt_algebraic.py 
b/src/compiler/nir/nir_opt_algebraic.py
index 7fc4ff1d407..c4f46b56d95 100644
--- a/src/compiler/nir/nir_opt_algebraic.py
+++ b/src/compiler/nir/nir_opt_algebraic.py
@@ -197,7 +197,7 @@ optimizations = [
# fabs(a) > 0.0
# fabs(a) != 0.0 because fabs(a) must be >= 0
# a != 0.0
-   (('flt', 0.0, ('fabs', a)), ('fne', a, 0.0)),
+   (('~flt', 0.0, ('fabs', a)), ('fne', a, 0.0)),
 
(('fmax',('b2f(is_used_once)', a),   
('b2f', b)),   ('b2f', ('ior', a, b))),
(('fmax', ('fneg(is_used_once)', ('b2f(is_used_once)', a)), ('fneg', 
('b2f', b))), ('fneg', ('b2f', ('ior', a, b,
-- 
2.14.4

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


[Mesa-dev] [PATCH 05/13] nir: Rearrange bcsel with two bcsel sources

2018-08-02 Thread Ian Romanick
From: Ian Romanick 

All Gen platforms had pretty similar results. (Skylake shown)
total instructions in shared programs: 14277220 -> 14277216 (<.01%)
instructions in affected programs: 422 -> 418 (-0.95%)
helped: 2
HURT: 0

total cycles in shared programs: 532577908 -> 532577848 (<.01%)
cycles in affected programs: 2800 -> 2740 (-2.14%)
helped: 2
HURT: 0

Signed-off-by: Ian Romanick 
---
 src/compiler/nir/nir_opt_algebraic.py | 4 
 1 file changed, 4 insertions(+)

diff --git a/src/compiler/nir/nir_opt_algebraic.py 
b/src/compiler/nir/nir_opt_algebraic.py
index 388c6354ff0..b96a7f93c08 100644
--- a/src/compiler/nir/nir_opt_algebraic.py
+++ b/src/compiler/nir/nir_opt_algebraic.py
@@ -236,6 +236,10 @@ optimizations = [
(('bcsel', ('inot', a), b, c), ('bcsel', a, c, b)),
(('bcsel', a, ('bcsel', a, b, c), d), ('bcsel', a, b, d)),
(('bcsel', a, b, ('bcsel', a, c, d)), ('bcsel', a, b, d)),
+   (('bcsel', a, ('bcsel', b, c, d), ('bcsel(is_used_once)', b, c, 'e')), 
('bcsel', b, c, ('bcsel', a, d, 'e'))),
+   (('bcsel', a, ('bcsel(is_used_once)', b, c, d), ('bcsel', b, c, 'e')), 
('bcsel', b, c, ('bcsel', a, d, 'e'))),
+   (('bcsel', a, ('bcsel', b, c, d), ('bcsel(is_used_once)', b, 'e', d)), 
('bcsel', b, ('bcsel', a, c, 'e'), d)),
+   (('bcsel', a, ('bcsel(is_used_once)', b, c, d), ('bcsel', b, 'e', d)), 
('bcsel', b, ('bcsel', a, c, 'e'), d)),
(('bcsel', a, True, 'b@bool'), ('ior', a, b)),
(('fmin', a, a), a),
(('fmax', a, a), a),
-- 
2.14.4

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


[Mesa-dev] [PATCH 11/13] nir: Transform expressions of b2f(a) and b2f(b) to !(a && b)

2018-08-02 Thread Ian Romanick
From: Ian Romanick 

All Gen platforms had pretty similar results. (Skylake shown)
total cycles in shared programs: 532578400 -> 532578397 (<.01%)
cycles in affected programs: 2784 -> 2781 (-0.11%)
helped: 1
HURT: 1
helped stats (abs) min: 4 max: 4 x̄: 4.00 x̃: 4
helped stats (rel) min: 0.26% max: 0.26% x̄: 0.26% x̃: 0.26%
HURT stats (abs)   min: 1 max: 1 x̄: 1.00 x̃: 1
HURT stats (rel)   min: 0.08% max: 0.08% x̄: 0.08% x̃: 0.08%

Signed-off-by: Ian Romanick 
---
 src/compiler/nir/nir_opt_algebraic.py | 3 +++
 1 file changed, 3 insertions(+)

diff --git a/src/compiler/nir/nir_opt_algebraic.py 
b/src/compiler/nir/nir_opt_algebraic.py
index 629cae5f381..4e5e47fa133 100644
--- a/src/compiler/nir/nir_opt_algebraic.py
+++ b/src/compiler/nir/nir_opt_algebraic.py
@@ -177,6 +177,9 @@ optimizations = [
(('feq', ('fmin', ('b2f', a), ('b2f', b)), 0.0), ('inot', ('ior', a, b))),
(('feq', ('bcsel', a, 1.0, ('b2f', b))   , 0.0), ('inot', ('ior', a, b))),
(('feq', ('b2f', a), ('fneg', ('b2f', b))),  ('inot', ('ior', a, b))),
+   (('feq', ('fmul', ('b2f', a), ('b2f', b)), 0.0), ('inot', ('iand', a, b))),
+   (('feq', ('fmax', ('b2f', a), ('b2f', b)), 0.0), ('inot', ('iand', a, b))),
+   (('feq', ('bcsel', a, ('b2f', b), 0.0)   , 0.0), ('inot', ('iand', a, b))),
 
# -(b2f(a) + b2f(b)) < 0
# 0 < b2f(a) + b2f(b)
-- 
2.14.4

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


[Mesa-dev] [PATCH 08/13] nir: Transform -fabs(a) >= 0 to a == 0

2018-08-02 Thread Ian Romanick
From: Ian Romanick 

All Gen platforms had pretty similar results. (Skylake shown)
total instructions in shared programs: 14276964 -> 14276961 (<.01%)
instructions in affected programs: 411 -> 408 (-0.73%)
helped: 3
HURT: 0
helped stats (abs) min: 1 max: 1 x̄: 1.00 x̃: 1
helped stats (rel) min: 0.47% max: 1.96% x̄: 1.04% x̃: 0.68%

total cycles in shared programs: 532577062 -> 532577068 (<.01%)
cycles in affected programs: 1093 -> 1099 (0.55%)
helped: 1
HURT: 1
helped stats (abs) min: 16 max: 16 x̄: 16.00 x̃: 16
helped stats (rel) min: 7.77% max: 7.77% x̄: 7.77% x̃: 7.77%
HURT stats (abs)   min: 22 max: 22 x̄: 22.00 x̃: 22
HURT stats (rel)   min: 2.48% max: 2.48% x̄: 2.48% x̃: 2.48%

Signed-off-by: Ian Romanick 
---
 src/compiler/nir/nir_opt_algebraic.py | 9 +
 1 file changed, 9 insertions(+)

diff --git a/src/compiler/nir/nir_opt_algebraic.py 
b/src/compiler/nir/nir_opt_algebraic.py
index 4d60467fbac..e1e2ef09845 100644
--- a/src/compiler/nir/nir_opt_algebraic.py
+++ b/src/compiler/nir/nir_opt_algebraic.py
@@ -235,6 +235,15 @@ optimizations = [
# fabs(a) > 0.0
(('~flt', ('fneg', ('fabs', a)), 0.0), ('fne', a, 0.0)),
 
+   # 0.0 >= fabs(a)
+   # 0.0 == fabs(a)   because fabs(a) must be >= 0
+   # 0.0 == a
+   (('fge', 0.0, ('fabs', a)), ('feq', a, 0.0)),
+
+   # -fabs(a) >= 0.0
+   # 0.0 >= fabs(a)
+   (('fge', ('fneg', ('fabs', a)), 0.0), ('feq', a, 0.0)),
+
(('fmax',('b2f(is_used_once)', a),   
('b2f', b)),   ('b2f', ('ior', a, b))),
(('fmax', ('fneg(is_used_once)', ('b2f(is_used_once)', a)), ('fneg', 
('b2f', b))), ('fneg', ('b2f', ('ior', a, b,
(('fmin',('b2f(is_used_once)', a),   
('b2f', b)),   ('b2f', ('iand', a, b))),
-- 
2.14.4

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


[Mesa-dev] [PATCH 04/13] nir: Collapse more repeated bcsels on the same argument

2018-08-02 Thread Ian Romanick
From: Ian Romanick 

All Gen platforms had pretty similar results. (Skylake shown)
total instructions in shared programs: 14277230 -> 14277220 (<.01%)
instructions in affected programs: 751 -> 741 (-1.33%)
helped: 4
HURT: 0
helped stats (abs) min: 2 max: 3 x̄: 2.50 x̃: 2
helped stats (rel) min: 1.23% max: 1.40% x̄: 1.32% x̃: 1.32%
95% mean confidence interval for instructions value: -3.42 -1.58
95% mean confidence interval for instructions %-change: -1.47% -1.17%
Instructions are helped.

total cycles in shared programs: 532577947 -> 532577908 (<.01%)
cycles in affected programs: 10641 -> 10602 (-0.37%)
helped: 4
HURT: 3
helped stats (abs) min: 1 max: 40 x̄: 13.75 x̃: 7
helped stats (rel) min: 0.11% max: 3.08% x̄: 1.10% x̃: 0.60%
HURT stats (abs)   min: 2 max: 8 x̄: 5.33 x̃: 6
HURT stats (rel)   min: 0.13% max: 0.55% x̄: 0.30% x̃: 0.23%
95% mean confidence interval for cycles value: -20.69 9.55
95% mean confidence interval for cycles %-change: -1.63% 0.63%
Inconclusive result (value mean confidence interval includes 0).

Signed-off-by: Ian Romanick 
---
 src/compiler/nir/nir_opt_algebraic.py | 1 +
 1 file changed, 1 insertion(+)

diff --git a/src/compiler/nir/nir_opt_algebraic.py 
b/src/compiler/nir/nir_opt_algebraic.py
index fdd1af9d177..388c6354ff0 100644
--- a/src/compiler/nir/nir_opt_algebraic.py
+++ b/src/compiler/nir/nir_opt_algebraic.py
@@ -235,6 +235,7 @@ optimizations = [
(('~bcsel', ('fge', b, a), b, a), ('fmax', a, b)),
(('bcsel', ('inot', a), b, c), ('bcsel', a, c, b)),
(('bcsel', a, ('bcsel', a, b, c), d), ('bcsel', a, b, d)),
+   (('bcsel', a, b, ('bcsel', a, c, d)), ('bcsel', a, b, d)),
(('bcsel', a, True, 'b@bool'), ('ior', a, b)),
(('fmin', a, a), a),
(('fmax', a, a), a),
-- 
2.14.4

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


[Mesa-dev] [PATCH 12/13] nir: Transform expressions of b2f(a) and b2f(b) to a ^^ b

2018-08-02 Thread Ian Romanick
From: Ian Romanick 

All Gen platforms had pretty similar results. (Skylake shown)
total instructions in shared programs: 14276892 -> 14276886 (<.01%)
instructions in affected programs: 484 -> 478 (-1.24%)
helped: 2
HURT: 0

total cycles in shared programs: 532578397 -> 532578395 (<.01%)
cycles in affected programs: 3522 -> 3520 (-0.06%)
helped: 1
HURT: 0

Signed-off-by: Ian Romanick 
---
 src/compiler/nir/nir_opt_algebraic.py | 3 +++
 1 file changed, 3 insertions(+)

diff --git a/src/compiler/nir/nir_opt_algebraic.py 
b/src/compiler/nir/nir_opt_algebraic.py
index 4e5e47fa133..87e370e891a 100644
--- a/src/compiler/nir/nir_opt_algebraic.py
+++ b/src/compiler/nir/nir_opt_algebraic.py
@@ -173,6 +173,9 @@ optimizations = [
(('fne', ('fmul', ('b2f', a), ('b2f', b)), 0.0), ('iand', a, b)),
(('fne', ('fmax', ('b2f', a), ('b2f', b)), 0.0), ('iand', a, b)),
(('fne', ('bcsel', a, ('b2f', b), 0.0)   , 0.0), ('iand', a, b)),
+   (('fne', ('fadd', ('b2f', a), ('fneg', ('b2f', b))), 0.0), ('ixor', a, b)),
+   (('fne',  ('b2f', a) ,  ('b2f', b) ),  ('ixor', a, b)),
+   (('fne', ('fneg', ('b2f', a)), ('fneg', ('b2f', b))),  ('ixor', a, b)),
(('feq', ('fadd', ('b2f', a), ('b2f', b)), 0.0), ('inot', ('ior', a, b))),
(('feq', ('fmin', ('b2f', a), ('b2f', b)), 0.0), ('inot', ('ior', a, b))),
(('feq', ('bcsel', a, 1.0, ('b2f', b))   , 0.0), ('inot', ('ior', a, b))),
-- 
2.14.4

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


[Mesa-dev] [PATCH 09/13] nir: Transform expressions of b2f(a) and b2f(b) to !(a || b)

2018-08-02 Thread Ian Romanick
From: Ian Romanick 

All Gen6+ platforms had similar results. (Skylake shown)
total instructions in shared programs: 14276961 -> 14276892 (<.01%)
instructions in affected programs: 3215 -> 3146 (-2.15%)
helped: 28
HURT: 0
helped stats (abs) min: 1 max: 6 x̄: 2.46 x̃: 2
helped stats (rel) min: 0.47% max: 9.52% x̄: 4.34% x̃: 1.92%
95% mean confidence interval for instructions value: -2.87 -2.06
95% mean confidence interval for instructions %-change: -5.73% -2.95%
Instructions are helped.

total cycles in shared programs: 532577068 -> 532578400 (<.01%)
cycles in affected programs: 121864 -> 123196 (1.09%)
helped: 35
HURT: 30
helped stats (abs) min: 2 max: 268 x̄: 42.34 x̃: 22
helped stats (rel) min: 0.12% max: 12.14% x̄: 3.22% x̃: 1.86%
HURT stats (abs)   min: 2 max: 246 x̄: 93.80 x̃: 36
HURT stats (rel)   min: 0.09% max: 13.63% x̄: 4.47% x̃: 2.58%
95% mean confidence interval for cycles value: -5.02 46.01
95% mean confidence interval for cycles %-change: -0.99% 1.65%
Inconclusive result (value mean confidence interval includes 0).

Iron Lake and GM45 had similar results. (Iron Lake shown)
total instructions in shared programs: 7781299 -> 7781342 (<.01%)
instructions in affected programs: 22300 -> 22343 (0.19%)
helped: 13
HURT: 40
helped stats (abs) min: 2 max: 3 x̄: 2.85 x̃: 3
helped stats (rel) min: 1.15% max: 7.69% x̄: 3.72% x̃: 3.33%
HURT stats (abs)   min: 2 max: 2 x̄: 2.00 x̃: 2
HURT stats (rel)   min: 0.26% max: 1.30% x̄: 0.47% x̃: 0.43%
95% mean confidence interval for instructions value: 0.23 1.39
95% mean confidence interval for instructions %-change: -1.18% 0.07%
Inconclusive result (%-change mean confidence interval includes 0).

total cycles in shared programs: 177878928 -> 177879332 (<.01%)
cycles in affected programs: 383298 -> 383702 (0.11%)
helped: 7
HURT: 43
helped stats (abs) min: 2 max: 18 x̄: 10.00 x̃: 10
helped stats (rel) min: 0.17% max: 4.81% x̄: 2.62% x̃: 3.40%
HURT stats (abs)   min: 2 max: 38 x̄: 11.02 x̃: 12
HURT stats (rel)   min: 0.08% max: 1.54% x̄: 0.25% x̃: 0.09%
95% mean confidence interval for cycles value: 5.21 10.95
95% mean confidence interval for cycles %-change: -0.51% 0.21%
Inconclusive result (%-change mean confidence interval includes 0).

Signed-off-by: Ian Romanick 
---
 src/compiler/nir/nir_opt_algebraic.py | 11 +++
 1 file changed, 11 insertions(+)

diff --git a/src/compiler/nir/nir_opt_algebraic.py 
b/src/compiler/nir/nir_opt_algebraic.py
index e1e2ef09845..64400f92ddc 100644
--- a/src/compiler/nir/nir_opt_algebraic.py
+++ b/src/compiler/nir/nir_opt_algebraic.py
@@ -170,6 +170,10 @@ optimizations = [
(('fne', ('fmin', ('b2f', a), ('b2f', b)), 0.0), ('ior', a, b)),
(('fne', ('bcsel', a, 1.0, ('b2f', b))   , 0.0), ('ior', a, b)),
(('fne', ('b2f', a), ('fneg', ('b2f', b))),  ('ior', a, b)),
+   (('feq', ('fadd', ('b2f', a), ('b2f', b)), 0.0), ('inot', ('ior', a, b))),
+   (('feq', ('fmin', ('b2f', a), ('b2f', b)), 0.0), ('inot', ('ior', a, b))),
+   (('feq', ('bcsel', a, 1.0, ('b2f', b))   , 0.0), ('inot', ('ior', a, b))),
+   (('feq', ('b2f', a), ('fneg', ('b2f', b))),  ('inot', ('ior', a, b))),
 
# -(b2f(a) + b2f(b)) < 0
# 0 < b2f(a) + b2f(b)
@@ -178,6 +182,13 @@ optimizations = [
(('flt', ('fneg', ('fadd', ('b2f', a), ('b2f', b))), 0.0), ('ior', a, b)),
(('flt', 0.0, ('fadd', ('b2f', a), ('b2f', b))), ('ior', a, b)),
 
+   # -(b2f(a) + b2f(b)) >= 0
+   # 0 >= b2f(a) + b2f(b)
+   # 0 == b2f(a) + b2f(b)   b2f must be 0 or 1, so the sum is non-negative
+   # !(a || b)
+   (('fge', ('fneg', ('fadd', ('b2f', a), ('b2f', b))), 0.0), ('inot', ('ior', 
a, b))),
+   (('fge', 0.0, ('fadd', ('b2f', a), ('b2f', b))), ('inot', ('ior', a, b))),
+
# Some optimizations (below) convert things like (a < b || c < b) into
# (min(a, c) < b).  However, this interfers with the previous optimizations
# that try to remove comparisons with negated sums of b2f.  This just
-- 
2.14.4

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


[Mesa-dev] [PATCH 10/13] nir: Transform expressions of b2f(a) and b2f(b) to a && b

2018-08-02 Thread Ian Romanick
From: Ian Romanick 

No changes on any Gen platform.

Signed-off-by: Ian Romanick 
---
 src/compiler/nir/nir_opt_algebraic.py | 3 +++
 1 file changed, 3 insertions(+)

diff --git a/src/compiler/nir/nir_opt_algebraic.py 
b/src/compiler/nir/nir_opt_algebraic.py
index 64400f92ddc..629cae5f381 100644
--- a/src/compiler/nir/nir_opt_algebraic.py
+++ b/src/compiler/nir/nir_opt_algebraic.py
@@ -170,6 +170,9 @@ optimizations = [
(('fne', ('fmin', ('b2f', a), ('b2f', b)), 0.0), ('ior', a, b)),
(('fne', ('bcsel', a, 1.0, ('b2f', b))   , 0.0), ('ior', a, b)),
(('fne', ('b2f', a), ('fneg', ('b2f', b))),  ('ior', a, b)),
+   (('fne', ('fmul', ('b2f', a), ('b2f', b)), 0.0), ('iand', a, b)),
+   (('fne', ('fmax', ('b2f', a), ('b2f', b)), 0.0), ('iand', a, b)),
+   (('fne', ('bcsel', a, ('b2f', b), 0.0)   , 0.0), ('iand', a, b)),
(('feq', ('fadd', ('b2f', a), ('b2f', b)), 0.0), ('inot', ('ior', a, b))),
(('feq', ('fmin', ('b2f', a), ('b2f', b)), 0.0), ('inot', ('ior', a, b))),
(('feq', ('bcsel', a, 1.0, ('b2f', b))   , 0.0), ('inot', ('ior', a, b))),
-- 
2.14.4

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


[Mesa-dev] [PATCH 06/13] nir: Transform -fabs(a) < 0 to a != 0

2018-08-02 Thread Ian Romanick
From: Ian Romanick 

Unlike the much older -abs(a) >= 0.0 transformation, this is not
precise.  The behavior changes if a is NaN.

All Gen platforms had pretty similar results. (Skylake shown)
total instructions in shared programs: 14277216 -> 14277184 (<.01%)
instructions in affected programs: 2300 -> 2268 (-1.39%)
helped: 8
HURT: 0
helped stats (abs) min: 1 max: 8 x̄: 4.00 x̃: 3
helped stats (rel) min: 0.48% max: 15.15% x̄: 4.41% x̃: 1.01%
95% mean confidence interval for instructions value: -6.45 -1.55
95% mean confidence interval for instructions %-change: -9.96% 1.13%
Inconclusive result (%-change mean confidence interval includes 0).

total cycles in shared programs: 532577848 -> 532577990 (<.01%)
cycles in affected programs: 17486 -> 17628 (0.81%)
helped: 2
HURT: 5
helped stats (abs) min: 2 max: 6 x̄: 4.00 x̃: 4
helped stats (rel) min: 0.06% max: 1.81% x̄: 0.93% x̃: 0.93%
HURT stats (abs)   min: 6 max: 50 x̄: 30.00 x̃: 26
HURT stats (rel)   min: 0.55% max: 2.17% x̄: 1.19% x̃: 1.02%
95% mean confidence interval for cycles value: -1.06 41.63
95% mean confidence interval for cycles %-change: -0.58% 1.74%
Inconclusive result (value mean confidence interval includes 0).

Signed-off-by: Ian Romanick 
---
 src/compiler/nir/nir_opt_algebraic.py | 4 
 1 file changed, 4 insertions(+)

diff --git a/src/compiler/nir/nir_opt_algebraic.py 
b/src/compiler/nir/nir_opt_algebraic.py
index b96a7f93c08..8300d6d01f5 100644
--- a/src/compiler/nir/nir_opt_algebraic.py
+++ b/src/compiler/nir/nir_opt_algebraic.py
@@ -212,6 +212,10 @@ optimizations = [
# a != 0.0
(('~flt', 0.0, ('fabs', a)), ('fne', a, 0.0)),
 
+   # -fabs(a) < 0.0
+   # fabs(a) > 0.0
+   (('~flt', ('fneg', ('fabs', a)), 0.0), ('fne', a, 0.0)),
+
(('fmax',('b2f(is_used_once)', a),   
('b2f', b)),   ('b2f', ('ior', a, b))),
(('fmax', ('fneg(is_used_once)', ('b2f(is_used_once)', a)), ('fneg', 
('b2f', b))), ('fneg', ('b2f', ('ior', a, b,
(('fmin',('b2f(is_used_once)', a),   
('b2f', b)),   ('b2f', ('iand', a, b))),
-- 
2.14.4

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


[Mesa-dev] [PATCH 13/13] nir: Transform expressions of b2f(a) and b2f(b) to a == b

2018-08-02 Thread Ian Romanick
From: Ian Romanick 

All Gen7+ platforms had similar results. (Skylake shown)
total instructions in shared programs: 14276886 -> 14276838 (<.01%)
instructions in affected programs: 312 -> 264 (-15.38%)
helped: 2
HURT: 0

total cycles in shared programs: 532578395 -> 532570985 (<.01%)
cycles in affected programs: 682562 -> 675152 (-1.09%)
helped: 374
HURT: 4
helped stats (abs) min: 2 max: 200 x̄: 20.39 x̃: 18
helped stats (rel) min: 0.07% max: 11.64% x̄: 1.25% x̃: 1.28%
HURT stats (abs)   min: 2 max: 114 x̄: 53.50 x̃: 49
HURT stats (rel)   min: 0.06% max: 11.70% x̄: 5.02% x̃: 4.15%
95% mean confidence interval for cycles value: -21.30 -17.91
95% mean confidence interval for cycles %-change: -1.30% -1.06%
Cycles are helped.

Sandy Bridge
total instructions in shared programs: 10488123 -> 10488075 (<.01%)
instructions in affected programs: 336 -> 288 (-14.29%)
helped: 2
HURT: 0

total cycles in shared programs: 150260379 -> 150260439 (<.01%)
cycles in affected programs: 4726 -> 4786 (1.27%)
helped: 0
HURT: 2

No changes on Iron Lake or GM45.

Signed-off-by: Ian Romanick 
---
 src/compiler/nir/nir_opt_algebraic.py | 3 +++
 1 file changed, 3 insertions(+)

diff --git a/src/compiler/nir/nir_opt_algebraic.py 
b/src/compiler/nir/nir_opt_algebraic.py
index 87e370e891a..e7e5aeaed04 100644
--- a/src/compiler/nir/nir_opt_algebraic.py
+++ b/src/compiler/nir/nir_opt_algebraic.py
@@ -183,6 +183,9 @@ optimizations = [
(('feq', ('fmul', ('b2f', a), ('b2f', b)), 0.0), ('inot', ('iand', a, b))),
(('feq', ('fmax', ('b2f', a), ('b2f', b)), 0.0), ('inot', ('iand', a, b))),
(('feq', ('bcsel', a, ('b2f', b), 0.0)   , 0.0), ('inot', ('iand', a, b))),
+   (('feq', ('fadd', ('b2f', a), ('fneg', ('b2f', b))), 0.0), ('ieq', a, b)),
+   (('feq',  ('b2f', a) ,  ('b2f', b) ),  ('ieq', a, b)),
+   (('feq', ('fneg', ('b2f', a)), ('fneg', ('b2f', b))),  ('ieq', a, b)),
 
# -(b2f(a) + b2f(b)) < 0
# 0 < b2f(a) + b2f(b)
-- 
2.14.4

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


  1   2   >