Re: [Mesa-dev] [PATCH] i965/miptree: Set supports_fast_clear = false in make_shareable

2017-08-06 Thread Tapani Pälli

Reviewed-by: Tapani Pälli <tapani.pa...@intel.com>

On 08/03/2017 07:52 PM, Jason Ekstrand wrote:

The make_shareable function deletes the aux buffer and then whacks
aux_usage to ISL_AUX_USAGE_NONE but not unsetting supports_fast_clear.
Since we only look at supports_fast_clear to decide whether or not to do
fast clears, this was causing assertion failures.

Reported-by: Tapani Pälli <tapani.pa...@intel.com>
Bugzilla: https://bugs.freedesktop.org/show_bug.cgi?id=101925
---
  src/mesa/drivers/dri/i965/intel_mipmap_tree.c | 1 +
  1 file changed, 1 insertion(+)

diff --git a/src/mesa/drivers/dri/i965/intel_mipmap_tree.c 
b/src/mesa/drivers/dri/i965/intel_mipmap_tree.c
index 17ac563..6fca7e3 100644
--- a/src/mesa/drivers/dri/i965/intel_mipmap_tree.c
+++ b/src/mesa/drivers/dri/i965/intel_mipmap_tree.c
@@ -2706,6 +2706,7 @@ intel_miptree_make_shareable(struct brw_context *brw,
 }
  
 mt->aux_usage = ISL_AUX_USAGE_NONE;

+   mt->supports_fast_clear = false;
  }
  
  


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


[Mesa-dev] [PATCH] android: anv_extensions.c is generated to libmesa_vulkan_common

2017-08-03 Thread Tapani Pälli
Fixes build error with anv_extensions.c not found for
libmesa_anv_entrypoints.

Fixes: d62063c "anv: Autogenerate extension query and lookup"
Signed-off-by: Tapani Pälli <tapani.pa...@intel.com>
---
 src/intel/Android.vulkan.mk | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/src/intel/Android.vulkan.mk b/src/intel/Android.vulkan.mk
index 449d1fc..17ae4b0 100644
--- a/src/intel/Android.vulkan.mk
+++ b/src/intel/Android.vulkan.mk
@@ -55,7 +55,6 @@ LOCAL_C_INCLUDES := \
$(VULKAN_COMMON_INCLUDES)
 
 LOCAL_GENERATED_SOURCES += $(intermediates)/vulkan/anv_entrypoints.h
-LOCAL_GENERATED_SOURCES += $(intermediates)/vulkan/anv_extensions.c
 LOCAL_GENERATED_SOURCES += $(intermediates)/vulkan/dummy.c
 
 $(intermediates)/vulkan/dummy.c:
@@ -209,6 +208,7 @@ LOCAL_WHOLE_STATIC_LIBRARIES := \
 # conditions since they are stored in another location.
 
 LOCAL_GENERATED_SOURCES += $(intermediates)/vulkan/anv_entrypoints.c
+LOCAL_GENERATED_SOURCES += $(intermediates)/vulkan/anv_extensions.c
 
 $(intermediates)/vulkan/anv_entrypoints.c:
@mkdir -p $(dir $@)
-- 
2.9.4

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


[Mesa-dev] [PATCH] i965: do not attempt fast clear with ISL_AUX_USAGE_NONE

2017-08-03 Thread Tapani Pälli
Aux usage is ISL_AUX_USAGE_NONE when miptree is set shareable
within (intel_miptree_make_shareable).

Signed-off-by: Tapani Pälli <tapani.pa...@intel.com>
Bugzilla: https://bugs.freedesktop.org/show_bug.cgi?id=101925
---
 src/mesa/drivers/dri/i965/brw_blorp.c | 4 
 1 file changed, 4 insertions(+)

diff --git a/src/mesa/drivers/dri/i965/brw_blorp.c 
b/src/mesa/drivers/dri/i965/brw_blorp.c
index b2987ca..7483e7c 100644
--- a/src/mesa/drivers/dri/i965/brw_blorp.c
+++ b/src/mesa/drivers/dri/i965/brw_blorp.c
@@ -791,6 +791,10 @@ do_single_blorp_clear(struct brw_context *brw, struct 
gl_framebuffer *fb,
!brw_is_color_fast_clear_compatible(brw, irb->mt, 
>Color.ClearColor))
   can_fast_clear = false;
 
+   /* Aux surface usage has been disabled. */
+   if (irb->mt->aux_usage == ISL_AUX_USAGE_NONE)
+  can_fast_clear = false;
+
/* Surface state can only record one fast clear color value. Therefore
 * unless different levels/layers agree on the color it can be used to
 * represent only single level/layer. Here it will be reserved for the
-- 
2.9.4

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


Re: [Mesa-dev] [PATCH 08/11] i965/miptree: Call alloc_aux in create_for_bo

2017-08-03 Thread Tapani Pälli



On 08/03/2017 09:33 AM, Tapani Pälli wrote:



On 08/03/2017 09:28 AM, Jason Ekstrand wrote:
On August 2, 2017 11:21:33 PM Tapani Pälli <tapani.pa...@intel.com> 
wrote:



Hi Jason;

Unfortunately this patch does not fix the mentioned bug. I've tested
both with Piglit on desktop and on Android and issue persists on both.


Can you provide a but now detail?  I tried today but wasn't able to 
reproduce the piglit failure.


Sure, so for me it looks like this:

[tpalli@tpalli-mobl2 piglit]$ mesa_run bin/egl-create-pbuffer-surface
egl-create-pbuffer-surface: brw_blorp.c:808: do_single_blorp_clear: 
Assertion `irb->mt->aux_usage == ISL_AUX_USAGE_CCS_D' failed.


I tried taking away that assert but that leads to another one and so on. 
I'm running this on Fedora25.


Forgot to say that machine is HSW and backtrace is from glClear like this:

#3  0x74e27e12 in __assert_fail () from /lib64/libc.so.6
#4  0x715a72cb in do_single_blorp_clear 
(brw=brw@entry=0x77f71040, fb=fb@entry=0x774c00, rb=0x775060, 
buf=buf@entry=0, partial_clear=partial_clear@entry=false, 
encode_srgb=encode_srgb@entry=true)

at brw_blorp.c:808
#5  0x715a8785 in brw_blorp_clear_color 
(brw=brw@entry=0x77f71040, fb=fb@entry=0x774c00, mask=1, 
partial_clear=partial_clear@entry=false, encode_srgb=true) at 
brw_blorp.c:928
#6  0x715ab734 in brw_clear (ctx=, 
mask=) at brw_clear.c:285

#7  0x004020ea in draw ()
#8  0x00401e8c in egl_util_run ()






On 08/02/2017 11:35 PM, Jason Ekstrand wrote:
Originally, I had moved it to the caller to make some things easier 
when

adding the CCS modifier.  However, this broke DRI2 because
intel_process_dri2_buffer calls intel_miptree_create_for_bo but never
calls intel_miptree_alloc_aux.  Also, in hindsight, it should be pretty
easy to make the CCS modifier stuff work even if create_for_bo 
allocates

the CCS when DISABLE_AUX is not set.

Bugzilla: https://bugs.freedesktop.org/show_bug.cgi?id=101925
Cc: Tapani Palli <tapani.pa...@intel.com>
Cc: "17.2" <mesa-sta...@lists.freedesktop.org>
---
  src/mesa/drivers/dri/i965/intel_mipmap_tree.c | 13 +++--
  1 file changed, 7 insertions(+), 6 deletions(-)

diff --git a/src/mesa/drivers/dri/i965/intel_mipmap_tree.c 
b/src/mesa/drivers/dri/i965/intel_mipmap_tree.c

index 910bb46..305912c 100644
--- a/src/mesa/drivers/dri/i965/intel_mipmap_tree.c
+++ b/src/mesa/drivers/dri/i965/intel_mipmap_tree.c
@@ -839,9 +839,15 @@ intel_miptree_create_for_bo(struct brw_context 
*brw,

 mt->bo = bo;
 mt->offset = offset;

-   if (!(layout_flags & MIPTREE_LAYOUT_DISABLE_AUX))
+   if (!(layout_flags & MIPTREE_LAYOUT_DISABLE_AUX)) {
intel_miptree_choose_aux_usage(brw, mt);

+  if (!intel_miptree_alloc_aux(brw, mt)) {
+ intel_miptree_release();
+ return NULL;
+  }
+   }
+
 return mt;
  }

@@ -978,11 +984,6 @@ intel_miptree_create_for_dri_image(struct 
brw_context *brw,

 if (is_winsys_image)
image->bo->cache_coherent = false;

-   if (!intel_miptree_alloc_aux(brw, mt)) {
-  intel_miptree_release();
-  return NULL;
-   }
-
 return mt;
  }






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


Re: [Mesa-dev] [PATCH 08/11] i965/miptree: Call alloc_aux in create_for_bo

2017-08-03 Thread Tapani Pälli



On 08/03/2017 09:28 AM, Jason Ekstrand wrote:

On August 2, 2017 11:21:33 PM Tapani Pälli <tapani.pa...@intel.com> wrote:


Hi Jason;

Unfortunately this patch does not fix the mentioned bug. I've tested
both with Piglit on desktop and on Android and issue persists on both.


Can you provide a but now detail?  I tried today but wasn't able to 
reproduce the piglit failure.


Sure, so for me it looks like this:

[tpalli@tpalli-mobl2 piglit]$ mesa_run bin/egl-create-pbuffer-surface
egl-create-pbuffer-surface: brw_blorp.c:808: do_single_blorp_clear: 
Assertion `irb->mt->aux_usage == ISL_AUX_USAGE_CCS_D' failed.


I tried taking away that assert but that leads to another one and so on. 
I'm running this on Fedora25.




On 08/02/2017 11:35 PM, Jason Ekstrand wrote:

Originally, I had moved it to the caller to make some things easier when
adding the CCS modifier.  However, this broke DRI2 because
intel_process_dri2_buffer calls intel_miptree_create_for_bo but never
calls intel_miptree_alloc_aux.  Also, in hindsight, it should be pretty
easy to make the CCS modifier stuff work even if create_for_bo allocates
the CCS when DISABLE_AUX is not set.

Bugzilla: https://bugs.freedesktop.org/show_bug.cgi?id=101925
Cc: Tapani Palli <tapani.pa...@intel.com>
Cc: "17.2" <mesa-sta...@lists.freedesktop.org>
---
  src/mesa/drivers/dri/i965/intel_mipmap_tree.c | 13 +++--
  1 file changed, 7 insertions(+), 6 deletions(-)

diff --git a/src/mesa/drivers/dri/i965/intel_mipmap_tree.c 
b/src/mesa/drivers/dri/i965/intel_mipmap_tree.c

index 910bb46..305912c 100644
--- a/src/mesa/drivers/dri/i965/intel_mipmap_tree.c
+++ b/src/mesa/drivers/dri/i965/intel_mipmap_tree.c
@@ -839,9 +839,15 @@ intel_miptree_create_for_bo(struct brw_context 
*brw,

 mt->bo = bo;
 mt->offset = offset;

-   if (!(layout_flags & MIPTREE_LAYOUT_DISABLE_AUX))
+   if (!(layout_flags & MIPTREE_LAYOUT_DISABLE_AUX)) {
intel_miptree_choose_aux_usage(brw, mt);

+  if (!intel_miptree_alloc_aux(brw, mt)) {
+ intel_miptree_release();
+ return NULL;
+  }
+   }
+
 return mt;
  }

@@ -978,11 +984,6 @@ intel_miptree_create_for_dri_image(struct 
brw_context *brw,

 if (is_winsys_image)
image->bo->cache_coherent = false;

-   if (!intel_miptree_alloc_aux(brw, mt)) {
-  intel_miptree_release();
-  return NULL;
-   }
-
 return mt;
  }






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


Re: [Mesa-dev] [PATCH 08/11] i965/miptree: Call alloc_aux in create_for_bo

2017-08-03 Thread Tapani Pälli

Hi Jason;

Unfortunately this patch does not fix the mentioned bug. I've tested 
both with Piglit on desktop and on Android and issue persists on both.



On 08/02/2017 11:35 PM, Jason Ekstrand wrote:

Originally, I had moved it to the caller to make some things easier when
adding the CCS modifier.  However, this broke DRI2 because
intel_process_dri2_buffer calls intel_miptree_create_for_bo but never
calls intel_miptree_alloc_aux.  Also, in hindsight, it should be pretty
easy to make the CCS modifier stuff work even if create_for_bo allocates
the CCS when DISABLE_AUX is not set.

Bugzilla: https://bugs.freedesktop.org/show_bug.cgi?id=101925
Cc: Tapani Palli 
Cc: "17.2" 
---
  src/mesa/drivers/dri/i965/intel_mipmap_tree.c | 13 +++--
  1 file changed, 7 insertions(+), 6 deletions(-)

diff --git a/src/mesa/drivers/dri/i965/intel_mipmap_tree.c 
b/src/mesa/drivers/dri/i965/intel_mipmap_tree.c
index 910bb46..305912c 100644
--- a/src/mesa/drivers/dri/i965/intel_mipmap_tree.c
+++ b/src/mesa/drivers/dri/i965/intel_mipmap_tree.c
@@ -839,9 +839,15 @@ intel_miptree_create_for_bo(struct brw_context *brw,
 mt->bo = bo;
 mt->offset = offset;
  
-   if (!(layout_flags & MIPTREE_LAYOUT_DISABLE_AUX))

+   if (!(layout_flags & MIPTREE_LAYOUT_DISABLE_AUX)) {
intel_miptree_choose_aux_usage(brw, mt);
  
+  if (!intel_miptree_alloc_aux(brw, mt)) {

+ intel_miptree_release();
+ return NULL;
+  }
+   }
+
 return mt;
  }
  
@@ -978,11 +984,6 @@ intel_miptree_create_for_dri_image(struct brw_context *brw,

 if (is_winsys_image)
image->bo->cache_coherent = false;
  
-   if (!intel_miptree_alloc_aux(brw, mt)) {

-  intel_miptree_release();
-  return NULL;
-   }
-
 return mt;
  }
  


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


Re: [Mesa-dev] [PATCH mesa 1/3] egl: deduplicate swap interval clamping logic

2017-08-01 Thread Tapani Pälli

lgtm
Reviewed-by: Tapani Pälli <tapani.pa...@intel.com>

On 08/01/2017 03:55 PM, Eric Engestrom wrote:

Signed-off-by: Eric Engestrom <eric.engest...@imgtec.com>
Reviewed-by: Daniel Stone <dani...@collabora.com>
---
  src/egl/drivers/dri2/platform_wayland.c | 14 +-
  src/egl/drivers/dri2/platform_x11.c |  9 +
  src/egl/main/eglapi.c   | 12 +++-
  src/egl/main/eglsurface.c   | 19 +--
  4 files changed, 14 insertions(+), 40 deletions(-)

diff --git a/src/egl/drivers/dri2/platform_wayland.c 
b/src/egl/drivers/dri2/platform_wayland.c
index ff35507d25..02db473c8c 100644
--- a/src/egl/drivers/dri2/platform_wayland.c
+++ b/src/egl/drivers/dri2/platform_wayland.c
@@ -63,10 +63,6 @@ enum wl_drm_format_flags {
 HAS_RGB565 = 4,
  };
  
-static EGLBoolean

-dri2_wl_swap_interval(_EGLDriver *drv, _EGLDisplay *disp, _EGLSurface *surf,
-  EGLint interval);
-
  static int
  roundtrip(struct dri2_egl_display *dri2_dpy)
  {
@@ -230,8 +226,7 @@ dri2_wl_create_window_surface(_EGLDriver *drv, _EGLDisplay 
*disp,
 goto cleanup_surf;
  }
  
-   dri2_wl_swap_interval(drv, disp, _surf->base,

- dri2_dpy->default_swap_interval);
+   dri2_surf->base.SwapInterval = dri2_dpy->default_swap_interval;
  
 return _surf->base;
  
@@ -1150,13 +1145,6 @@ dri2_wl_swap_interval(_EGLDriver *drv,

 _EGLSurface *surf,
 EGLint interval)
  {
-   if (interval > surf->Config->MaxSwapInterval)
-  interval = surf->Config->MaxSwapInterval;
-   else if (interval < surf->Config->MinSwapInterval)
-  interval = surf->Config->MinSwapInterval;
-
-   surf->SwapInterval = interval;
-
 return EGL_TRUE;
  }
  
diff --git a/src/egl/drivers/dri2/platform_x11.c b/src/egl/drivers/dri2/platform_x11.c

index b01f739010..35c62a4975 100644
--- a/src/egl/drivers/dri2/platform_x11.c
+++ b/src/egl/drivers/dri2/platform_x11.c
@@ -956,16 +956,9 @@ dri2_x11_swap_interval(_EGLDriver *drv, _EGLDisplay *disp, 
_EGLSurface *surf,
 struct dri2_egl_display *dri2_dpy = dri2_egl_display(disp);
 struct dri2_egl_surface *dri2_surf = dri2_egl_surface(surf);
  
-   if (interval > surf->Config->MaxSwapInterval)

-  interval = surf->Config->MaxSwapInterval;
-   else if (interval < surf->Config->MinSwapInterval)
-  interval = surf->Config->MinSwapInterval;
-
-   if (interval != surf->SwapInterval && dri2_dpy->swap_available)
+   if (dri2_dpy->swap_available)
xcb_dri2_swap_interval(dri2_dpy->conn, dri2_surf->drawable, interval);
  
-   surf->SwapInterval = interval;

-
 return EGL_TRUE;
  }
  
diff --git a/src/egl/main/eglapi.c b/src/egl/main/eglapi.c

index 000368a46a..c5e3955c48 100644
--- a/src/egl/main/eglapi.c
+++ b/src/egl/main/eglapi.c
@@ -1201,7 +1201,17 @@ eglSwapInterval(EGLDisplay dpy, EGLint interval)
 if (_eglGetSurfaceHandle(surf) == EGL_NO_SURFACE)
RETURN_EGL_ERROR(disp, EGL_BAD_SURFACE, EGL_FALSE);
  
-   ret = drv->API.SwapInterval(drv, disp, surf, interval);

+   interval = CLAMP(interval,
+surf->Config->MinSwapInterval,
+surf->Config->MaxSwapInterval);
+
+   if (surf->SwapInterval != interval)
+  ret = drv->API.SwapInterval(drv, disp, surf, interval);
+   else
+  ret = EGL_TRUE;
+
+   if (ret)
+  surf->SwapInterval = interval;
  
 RETURN_EGL_EVAL(disp, ret);

  }
diff --git a/src/egl/main/eglsurface.c b/src/egl/main/eglsurface.c
index f6e41f10d7..3bd14a8cd0 100644
--- a/src/egl/main/eglsurface.c
+++ b/src/egl/main/eglsurface.c
@@ -45,22 +45,6 @@
  #include "eglsurface.h"
  
  
-static void

-_eglClampSwapInterval(_EGLSurface *surf, EGLint interval)
-{
-   EGLint bound = surf->Config->MaxSwapInterval;
-   if (interval >= bound) {
-  interval = bound;
-   }
-   else {
-  bound = surf->Config->MinSwapInterval;
-  if (interval < bound)
- interval = bound;
-   }
-   surf->SwapInterval = interval;
-}
-
-
  /**
   * Parse the list of surface attributes and return the proper error code.
   */
@@ -319,7 +303,7 @@ _eglInitSurface(_EGLSurface *surf, _EGLDisplay *dpy, EGLint 
type,
 surf->BufferAgeRead = EGL_FALSE;
  
 /* the default swap interval is 1 */

-   _eglClampSwapInterval(surf, 1);
+   surf->SwapInterval = 1;
  
 err = _eglParseSurfaceAttribList(surf, attrib_list);

 if (err != EGL_SUCCESS)
@@ -565,6 +549,5 @@ EGLBoolean
  _eglSwapInterval(_EGLDriver *drv, _EGLDisplay *dpy, _EGLSurface *surf,
   EGLint interval)
  {
-   _eglClampSwapInterval(surf, interval);
 return EGL_TRUE;
  }



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


Re: [Mesa-dev] [PATCH] intel/isl: Stop padding surfaces

2017-08-01 Thread Tapani Pälli
Did some testing with this and run GL applications, Vulkan applications, 
video playback + some selected dEQP and did not observe any regression.


Tested-by: Tapani Pälli <tapani.pa...@intel.com>

On 07/31/2017 09:27 PM, Jason Ekstrand wrote:

The docs contain a bunch of commentary about the need to pad various
surfaces out to multiples of something or other.  However, all of those
requirements are about avoiding GTT errors due to missing pages when the
data port or sampler accesses slightly out-of-bounds.  However, because
the kernel already fills all the empty space in our GTT with the scratch
page, we never have to worry about faulting due to OOB reads.  There are
two caveats to this:

  1) There is some potential for issues with caches here if extra data
 ends up in a cache we don't expect due to OOB reads.  However,
 because we always trash the entire cache whenever we need to move
 anything between cache domains, this shouldn't be an issue.

  2) There is a potential issue if a surface gets placed at the very top
 of the GTT by the kernel.  In this case, the hardware could
 potentially end up trying to read past the top of the GTT.  If it
 nicely wraps around at the 48-bit (or 32-bit) boundary, then this
 shouldn't be an issue thanks to the scratch page.  If it doesn't,
 then we need to come up with something to handle it.

Up until some of the GL move to ISL, having the padding code in there
just caused us to harmlessly use a bit more memory in Vulkan.  However,
now that we're using ISL sizes to validate external dma-buf images,
these padding requirements are causing us to reject otherwise valid
images due to the size of the BO being too small.

Cc: "17.2" <mesa-sta...@lists.freedesktop.org>
Cc: Chad Versace <chadvers...@chromium.org>
Cc: Tomasz Figa <tf...@chromium.org>
Cc: Tapani Palli <tapani.pa...@intel.com>
---
  src/intel/isl/isl.c | 119 +---
  1 file changed, 2 insertions(+), 117 deletions(-)

diff --git a/src/intel/isl/isl.c b/src/intel/isl/isl.c
index 5e3d279..d3124de 100644
--- a/src/intel/isl/isl.c
+++ b/src/intel/isl/isl.c
@@ -1374,116 +1374,6 @@ isl_calc_row_pitch(const struct isl_device *dev,
 return true;
  }
  
-/**

- * Calculate and apply any padding required for the surface.
- *
- * @param[inout] total_h_el is updated with the new height
- * @param[out] pad_bytes is overwritten with additional padding requirements.
- */
-static void
-isl_apply_surface_padding(const struct isl_device *dev,
-  const struct isl_surf_init_info *restrict info,
-  const struct isl_tile_info *tile_info,
-  uint32_t *total_h_el,
-  uint32_t *pad_bytes)
-{
-   const struct isl_format_layout *fmtl = isl_format_get_layout(info->format);
-
-   *pad_bytes = 0;
-
-   /* From the Broadwell PRM >> Volume 5: Memory Views >> Common Surface
-* Formats >> Surface Padding Requirements >> Render Target and Media
-* Surfaces:
-*
-*   The data port accesses data (pixels) outside of the surface if they
-*   are contained in the same cache request as pixels that are within the
-*   surface. These pixels will not be returned by the requesting message,
-*   however if these pixels lie outside of defined pages in the GTT,
-*   a GTT error will result when the cache request is processed. In
-*   order to avoid these GTT errors, “padding” at the bottom of the
-*   surface is sometimes necessary.
-*
-* From the Broadwell PRM >> Volume 5: Memory Views >> Common Surface
-* Formats >> Surface Padding Requirements >> Sampling Engine Surfaces:
-*
-*... Lots of padding requirements, all listed separately below.
-*/
-
-   /* We can safely ignore the first padding requirement, quoted below,
-* because isl doesn't do buffers.
-*
-*- [pre-BDW] For buffers, which have no inherent “height,” padding
-*  requirements are different. A buffer must be padded to the next
-*  multiple of 256 array elements, with an additional 16 bytes added
-*  beyond that to account for the L1 cache line.
-*/
-
-   /*
-*- For compressed textures [...], padding at the bottom of the surface
-*  is to an even compressed row.
-*/
-   if (isl_format_is_compressed(info->format))
-  *total_h_el = isl_align(*total_h_el, 2);
-
-   /*
-*- For cube surfaces, an additional two rows of padding are required
-*  at the bottom of the surface.
-*/
-   if (info->usage & ISL_SURF_USAGE_CUBE_BIT)
-  *total_h_el += 2;
-
-   /*
-*- For packed YUV, 96 bpt, 48 bpt, and 24 bpt surface formats,
-*  additional padding is required. These surfaces require an extra row
-*  plus 16 bytes of padding at the bottom in add

Re: [Mesa-dev] [PATCH] android: add libmesa_util include path to MESA_DRI_C_INCLUDES

2017-08-01 Thread Tapani Pälli


On 08/01/2017 02:04 PM, Eric Engestrom wrote:

On Tuesday, 2017-08-01 10:51:54 +0300, Tapani Pälli wrote:

It is required by libmesa_dri_common and i965_dri modules which both
already use MESA_DRI_C_INCLUDES. Fixes following build errors:

In file included from 
vendor/intel/external/android_ia/mesa/src/mesa/drivers/dri/common/dri_util.c:45:
vendor/intel/external/android_ia/mesa/src/util/xmlpool.h:103:10: fatal error: 
'xmlpool/options.h' file not found
---


Careful if you `git am` this patch, the above line will drop everything below.



That is true. I've sent another proposal here:
https://lists.freedesktop.org/archives/mesa-dev/2017-August/164985.html


In file included from 
vendor/intel/external/android_ia/mesa/src/mesa/drivers/dri/i965/intel_screen.c:44:
vendor/intel/external/android_ia/mesa/src/util/xmlpool.h:103:10: fatal error: 
'xmlpool/options.h' file not found

Signed-off-by: Tapani Pälli <tapani.pa...@intel.com>
---
  src/mesa/drivers/dri/Android.mk | 1 +
  1 file changed, 1 insertion(+)

diff --git a/src/mesa/drivers/dri/Android.mk b/src/mesa/drivers/dri/Android.mk
index 53ff4b4..9314479 100644
--- a/src/mesa/drivers/dri/Android.mk
+++ b/src/mesa/drivers/dri/Android.mk
@@ -33,6 +33,7 @@ MESA_DRI_CFLAGS := \
  
  MESA_DRI_C_INCLUDES := \

$(addprefix $(MESA_TOP)/, $(mesa_dri_common_INCLUDES)) \
+   $(call generated-sources-dir-for,STATIC_LIBRARIES,libmesa_util,,) \
$(MESA_TOP)/src/gallium/include \
$(MESA_TOP)/src/gallium/auxiliary \
external/expat/lib
--
2.9.4


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


[Mesa-dev] [PATCH] android: export intermediates from libmesa_util

2017-08-01 Thread Tapani Pälli
Fixes following build issues:

   In file included from 
vendor/intel/external/android_ia/mesa/src/mesa/drivers/dri/common/dri_util.c:45:
   vendor/intel/external/android_ia/mesa/src/util/xmlpool.h:103:10: fatal 
error: 'xmlpool/options.h' file not found
   ...
   In file included from 
vendor/intel/external/android_ia/mesa/src/mesa/drivers/dri/i965/intel_screen.c:44:
   vendor/intel/external/android_ia/mesa/src/util/xmlpool.h:103:10: fatal 
error: 'xmlpool/options.h' file not found

Signed-off-by: Tapani Pälli <tapani.pa...@intel.com>
---
 src/mesa/drivers/dri/common/Android.mk | 2 ++
 src/util/Android.mk| 3 +++
 2 files changed, 5 insertions(+)

diff --git a/src/mesa/drivers/dri/common/Android.mk 
b/src/mesa/drivers/dri/common/Android.mk
index 573189d..f15a3b9 100644
--- a/src/mesa/drivers/dri/common/Android.mk
+++ b/src/mesa/drivers/dri/common/Android.mk
@@ -46,6 +46,8 @@ LOCAL_EXPORT_C_INCLUDE_DIRS := \
 LOCAL_SRC_FILES := \
$(DRI_COMMON_FILES)
 
+LOCAL_STATIC_LIBRARIES := libmesa_util
+
 include $(MESA_COMMON_MK)
 include $(BUILD_STATIC_LIBRARY)
 
diff --git a/src/util/Android.mk b/src/util/Android.mk
index ecf3eb7..7e54ae7 100644
--- a/src/util/Android.mk
+++ b/src/util/Android.mk
@@ -51,6 +51,9 @@ LOCAL_MODULE := libmesa_util
 LOCAL_MODULE_CLASS := STATIC_LIBRARIES
 
 intermediates := $(call local-generated-sources-dir)
+
+LOCAL_EXPORT_C_INCLUDE_DIRS := $(intermediates)
+
 UTIL_GENERATED_SOURCES := $(addprefix 
$(intermediates)/,$(MESA_UTIL_GENERATED_FILES))
 LOCAL_GENERATED_SOURCES := $(UTIL_GENERATED_SOURCES)
 
-- 
2.9.4

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


Re: [Mesa-dev] [PATCH] android: add libmesa_util include path to MESA_DRI_C_INCLUDES

2017-08-01 Thread Tapani Pälli



On 08/01/2017 12:20 PM, Chih-Wei Huang wrote:

2017-08-01 15:51 GMT+08:00 Tapani Pälli <tapani.pa...@intel.com>:

It is required by libmesa_dri_common and i965_dri modules which both
already use MESA_DRI_C_INCLUDES. Fixes following build errors:

In file included from 
vendor/intel/external/android_ia/mesa/src/mesa/drivers/dri/common/dri_util.c:45:
vendor/intel/external/android_ia/mesa/src/util/xmlpool.h:103:10: fatal error: 
'xmlpool/options.h' file not found
---
In file included from 
vendor/intel/external/android_ia/mesa/src/mesa/drivers/dri/i965/intel_screen.c:44:
vendor/intel/external/android_ia/mesa/src/util/xmlpool.h:103:10: fatal error: 
'xmlpool/options.h' file not found


What commit caused the errors?


It's likely this one:

601093f95ddf6b49a79baa91dc51d4f163dfc8de

but did not attempt to bisect since busy with another bug ..


Signed-off-by: Tapani Pälli <tapani.pa...@intel.com>
---
  src/mesa/drivers/dri/Android.mk | 1 +
  1 file changed, 1 insertion(+)

diff --git a/src/mesa/drivers/dri/Android.mk b/src/mesa/drivers/dri/Android.mk
index 53ff4b4..9314479 100644
--- a/src/mesa/drivers/dri/Android.mk
+++ b/src/mesa/drivers/dri/Android.mk
@@ -33,6 +33,7 @@ MESA_DRI_CFLAGS := \

  MESA_DRI_C_INCLUDES := \
 $(addprefix $(MESA_TOP)/, $(mesa_dri_common_INCLUDES)) \
+   $(call generated-sources-dir-for,STATIC_LIBRARIES,libmesa_util,,) \


It would be better to export the include path
from libmesa_util.


OK, I can send another patch.


 $(MESA_TOP)/src/gallium/include \
 $(MESA_TOP)/src/gallium/auxiliary \
 external/expat/lib
--



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


[Mesa-dev] [PATCH] android: add libmesa_util include path to MESA_DRI_C_INCLUDES

2017-08-01 Thread Tapani Pälli
It is required by libmesa_dri_common and i965_dri modules which both
already use MESA_DRI_C_INCLUDES. Fixes following build errors:

In file included from 
vendor/intel/external/android_ia/mesa/src/mesa/drivers/dri/common/dri_util.c:45:
vendor/intel/external/android_ia/mesa/src/util/xmlpool.h:103:10: fatal error: 
'xmlpool/options.h' file not found
---
In file included from 
vendor/intel/external/android_ia/mesa/src/mesa/drivers/dri/i965/intel_screen.c:44:
vendor/intel/external/android_ia/mesa/src/util/xmlpool.h:103:10: fatal error: 
'xmlpool/options.h' file not found

Signed-off-by: Tapani Pälli <tapani.pa...@intel.com>
---
 src/mesa/drivers/dri/Android.mk | 1 +
 1 file changed, 1 insertion(+)

diff --git a/src/mesa/drivers/dri/Android.mk b/src/mesa/drivers/dri/Android.mk
index 53ff4b4..9314479 100644
--- a/src/mesa/drivers/dri/Android.mk
+++ b/src/mesa/drivers/dri/Android.mk
@@ -33,6 +33,7 @@ MESA_DRI_CFLAGS := \
 
 MESA_DRI_C_INCLUDES := \
$(addprefix $(MESA_TOP)/, $(mesa_dri_common_INCLUDES)) \
+   $(call generated-sources-dir-for,STATIC_LIBRARIES,libmesa_util,,) \
$(MESA_TOP)/src/gallium/include \
$(MESA_TOP)/src/gallium/auxiliary \
external/expat/lib
-- 
2.9.4

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


Re: [Mesa-dev] [PATCH 1/2] android: link libmesa_intel_common with zlib and expat

2017-07-31 Thread Tapani Pälli



On 08/01/2017 12:17 AM, Rob Herring wrote:

On Mon, Jul 31, 2017 at 3:45 PM, Emil Velikov <emil.l.veli...@gmail.com> wrote:

On 31 July 2017 at 09:32, Tapani Pälli <tapani.pa...@intel.com> wrote:

Makes it possible to build Mesa on Android with -DDEBUG with
the next patch that reverts 4f695731.

Signed-off-by: Tapani Pälli <tapani.pa...@intel.com>
---
  src/intel/Android.common.mk | 5 +
  1 file changed, 5 insertions(+)

diff --git a/src/intel/Android.common.mk b/src/intel/Android.common.mk
index f056f0a..12cea6e 100644
--- a/src/intel/Android.common.mk
+++ b/src/intel/Android.common.mk
@@ -32,10 +32,15 @@ LOCAL_MODULE_CLASS := STATIC_LIBRARIES
  LOCAL_SRC_FILES := $(COMMON_FILES)

  LOCAL_C_INCLUDES := \
+   external/zlib \

Ideally this will be part of zlib's LOCAL_EXPORT_C_INCLUDE_DIRS, at
some point in the future.


FYI, it already is and has been since M. So it depends whether you
care about L support. IMO, with O coming out soon, it's time to drop
L. 3 years/versions of Android support in master seems like plenty to
me.



Yeah, this was to not break L support like with commit 
bfc0c23843008fd510afa263ebe371bef3346445. Android-IA is fine with 
dropping L support, not sure if Android-x86 wants it?


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


[Mesa-dev] [PATCH 2/2] intel: move gen_decoder.* back to COMMON_FILES

2017-07-31 Thread Tapani Pälli
this change reverts commit 4f695731, we want to be able to build
with -DDEBUG and gen_decoder on Android.

Signed-off-by: Tapani Pälli <tapani.pa...@intel.com>
---
 src/intel/Makefile.common.am | 2 +-
 src/intel/Makefile.sources   | 6 ++
 2 files changed, 3 insertions(+), 5 deletions(-)

diff --git a/src/intel/Makefile.common.am b/src/intel/Makefile.common.am
index 1c1c2ee..49e9c6a 100644
--- a/src/intel/Makefile.common.am
+++ b/src/intel/Makefile.common.am
@@ -22,7 +22,7 @@
 noinst_LTLIBRARIES += common/libintel_common.la
 
 common_libintel_common_la_CFLAGS = $(AM_CFLAGS) $(LIBDRM_CFLAGS)
-common_libintel_common_la_SOURCES = $(COMMON_FILES) $(DECODER_FILES)
+common_libintel_common_la_SOURCES = $(COMMON_FILES)
 
 if HAVE_PLATFORM_ANDROID
 common_libintel_common_la_CFLAGS += $(ANDROID_CFLAGS)
diff --git a/src/intel/Makefile.sources b/src/intel/Makefile.sources
index 2b3065e..10abef6 100644
--- a/src/intel/Makefile.sources
+++ b/src/intel/Makefile.sources
@@ -11,6 +11,8 @@ COMMON_FILES = \
common/gen_clflush.h \
common/gen_debug.c \
common/gen_debug.h \
+   common/gen_decoder.c \
+   common/gen_decoder.h \
common/gen_device_info.c \
common/gen_device_info.h \
common/gen_l3_config.c \
@@ -18,10 +20,6 @@ COMMON_FILES = \
common/gen_urb_config.c \
common/gen_sample_positions.h
 
-DECODER_FILES = \
-   common/gen_decoder.h \
-   common/gen_decoder.c
-
 COMPILER_FILES = \
compiler/brw_cfg.cpp \
compiler/brw_cfg.h \
-- 
2.9.4

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


[Mesa-dev] [PATCH 1/2] android: link libmesa_intel_common with zlib and expat

2017-07-31 Thread Tapani Pälli
Makes it possible to build Mesa on Android with -DDEBUG with
the next patch that reverts 4f695731.

Signed-off-by: Tapani Pälli <tapani.pa...@intel.com>
---
 src/intel/Android.common.mk | 5 +
 1 file changed, 5 insertions(+)

diff --git a/src/intel/Android.common.mk b/src/intel/Android.common.mk
index f056f0a..12cea6e 100644
--- a/src/intel/Android.common.mk
+++ b/src/intel/Android.common.mk
@@ -32,10 +32,15 @@ LOCAL_MODULE_CLASS := STATIC_LIBRARIES
 LOCAL_SRC_FILES := $(COMMON_FILES)
 
 LOCAL_C_INCLUDES := \
+   external/zlib \
$(MESA_TOP)/src/gallium/include \
$(MESA_TOP)/src/gallium/auxiliary \
$(MESA_TOP)/src/mapi \
$(MESA_TOP)/src/mesa
 
+LOCAL_SHARED_LIBRARIES := libexpat libz
+
+LOCAL_WHOLE_STATIC_LIBRARIES := libmesa_genxml
+
 include $(MESA_COMMON_MK)
 include $(BUILD_STATIC_LIBRARY)
-- 
2.9.4

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


Re: [Mesa-dev] i965: Transition the rest of surfaces (i.e., color) to isl

2017-07-30 Thread Tapani Pälli



On 07/29/2017 08:21 AM, Jason Ekstrand wrote:
On Fri, Jul 28, 2017 at 10:14 PM, Tomasz Figa > wrote:


On Sat, Jul 29, 2017 at 2:06 PM, Jason Ekstrand
> wrote:
 > On Fri, Jul 28, 2017 at 8:17 PM, Tomasz Figa > wrote:
 >>
 >> Hi Topi, Jason,
 >>
 >> On Sat, Jul 22, 2017 at 12:00 AM, Topi Pohjolainen
 >> >
wrote:
 >> > First patch actually should have been included already when
 >> > gen6 stencil got transitioned - it has been giving warning ever
 >> > since.
 >> >
 >> > Most of the work actually got already done for depth surfaces
(which
 >> > is y-tiled such as color surfaces). What is left are color surface
 >> > specifics, mostly preparing for corner cases.
 >> >
 >> > This is now all green in ci-system. For snb and older i965 wasn't
 >> > checking hardware incapabilities as hard as isl does. Certain
 >> > format/size/msaa combinations were allowed that shouldn't have.
 >> > Moving to isl exposed code paths that didn't report surface
creation
 >> > failures resulting in asserts firing later on. Patches 10 and 11
 >> > now properly tell the client if the surface type can't be
supported
 >> > allowing piglit tests to skip them.
 >>
 >> I think it might be related to previously merged patches, but the
 >> topic is still ISL, so let me ask my question here. Is there any
 >> possibility to add some diagnostic information to the validation
code?
 >> We've been seeing EGL image import failures on new Mesa as a
result of
 >> ISL catching issues in our allocator (cros_gralloc on top of
ChromeOS
 >> minigbm), but it's close to impossible to identify the cause without
 >> manually inserting some printfs and recompiling the code. I think
 >> having some error messages printed in case of a buffer validation
 >> failure would be a great benefit.
 >
 >
 > What kind of prints are you looking for exactly?  I've run into
some issues
 > myself but if you could provide a concrete example, that would help.

For example, we hit two different issues where the total size check in
intel_create_image_from_fds_common() was failing and the only way to
figure out the exact reason was digging deep into the calculations in
ISL:

1) missing 64-byte padding from the end of linear buffers,

2) (total) height of the buffer not aligned to 4-lines - actually the
problem is much more interesting, because this was specifically with
Android's HAL_PIXEL_FORMAT_YV12 (3-plane YVU420), which doesn't permit
height alignment higher than 2 defined by the spec. Mesa seems to care
about total size of the buffer only, so we could work around this by
simply adding enough padding at the end of the buffer.


Right... I was concerned about that when I landed those changes but 
never saw a problem in my testing (probably due to piglit always 
choosing "nice" sizes).  I've considered simply deleting that code from 
ISL because I'm not at all convinced that it's needed.  Chad, do you 
have any thoughts on this?  my understanding is that the padding is only 
needed to avoid page faults in the GPU and, since every byte of our 
address space has pages (thanks to the scratch page) this shouldn't 
actually be a problem.




Please CC me if some of these restrictions will be removed, we applied 
fixes for these in minigbm when Mesa was rebased in Android-IA.


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


Re: [Mesa-dev] [PATCH] util: fix warning/error on 32bit build

2017-07-25 Thread Tapani Pälli

On 07/25/2017 09:08 AM, Michel Dänzer wrote:

On 25/07/17 03:02 PM, Michel Dänzer wrote:

On 25/07/17 02:42 PM, Tapani Pälli wrote:

Add uintptr_t cast to fix 'cast to pointer from integer of different size'
warning on 32bit build (build error on Android M).

Signed-off-by: Tapani Pälli <tapani.pa...@intel.com>
---
  src/util/hash_table.c | 4 ++--
  1 file changed, 2 insertions(+), 2 deletions(-)

diff --git a/src/util/hash_table.c b/src/util/hash_table.c
index a9d442d..1bda214 100644
--- a/src/util/hash_table.c
+++ b/src/util/hash_table.c
@@ -588,7 +588,7 @@ _mesa_hash_table_u64_insert(struct hash_table_u64 *ht, 
uint64_t key,
 }
  
 if (sizeof(void *) == 8) {

-  _mesa_hash_table_insert(ht->table, (void *)key, data);
+  _mesa_hash_table_insert(ht->table, (void *)(uintptr_t)key, data);
 } else {
struct hash_key_u64 *_key = CALLOC_STRUCT(hash_key_u64);
  
@@ -604,7 +604,7 @@ static struct hash_entry *

  hash_table_u64_search(struct hash_table_u64 *ht, uint64_t key)
  {
 if (sizeof(void *) == 8) {
-  return _mesa_hash_table_search(ht->table, (void *)key);
+  return _mesa_hash_table_search(ht->table, (void *)(uintptr_t)key);
 } else {
struct hash_key_u64 _key = { .value = key };
return _mesa_hash_table_search(ht->table, &_key);


This means that the upper 32 bits of the key are ignored on 32-bit
platforms, right? Is that okay?

Never mind, I missed that the changed code is guarded by if (sizeof(void
*) == 8).

Reviewed-by: Michel Dänzer <michel.daen...@amd.com>


Yep, it's the 64bit path, thanks for review!


// Tapani

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


[Mesa-dev] [PATCH] util: fix warning/error on 32bit build

2017-07-24 Thread Tapani Pälli
Add uintptr_t cast to fix 'cast to pointer from integer of different size'
warning on 32bit build (build error on Android M).

Signed-off-by: Tapani Pälli <tapani.pa...@intel.com>
---
 src/util/hash_table.c | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

diff --git a/src/util/hash_table.c b/src/util/hash_table.c
index a9d442d..1bda214 100644
--- a/src/util/hash_table.c
+++ b/src/util/hash_table.c
@@ -588,7 +588,7 @@ _mesa_hash_table_u64_insert(struct hash_table_u64 *ht, 
uint64_t key,
}
 
if (sizeof(void *) == 8) {
-  _mesa_hash_table_insert(ht->table, (void *)key, data);
+  _mesa_hash_table_insert(ht->table, (void *)(uintptr_t)key, data);
} else {
   struct hash_key_u64 *_key = CALLOC_STRUCT(hash_key_u64);
 
@@ -604,7 +604,7 @@ static struct hash_entry *
 hash_table_u64_search(struct hash_table_u64 *ht, uint64_t key)
 {
if (sizeof(void *) == 8) {
-  return _mesa_hash_table_search(ht->table, (void *)key);
+  return _mesa_hash_table_search(ht->table, (void *)(uintptr_t)key);
} else {
   struct hash_key_u64 _key = { .value = key };
   return _mesa_hash_table_search(ht->table, &_key);
-- 
2.9.4

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


Re: [Mesa-dev] [PATCH] egl: guard wayland header dep. tracking behind HAVE_PLATFORM_WAYLAND

2017-07-24 Thread Tapani Pälli

Reviewed-by: Tapani Pälli <tapani.pa...@intel.com>

On 07/24/2017 03:27 PM, Emil Velikov wrote:

From: Emil Velikov <emil.veli...@collabora.com>

Otherwise we'll attemt to generate the header even we don't need to.
In that case the dependencies may not be met, leading to build failure.

Cc: Tapani Pälli <tapani.pa...@intel.com>
Fixes: 166852e "configure.ac: rework wayland-protocols handling"
Signed-off-by: Emil Velikov <emil.veli...@collabora.com>
---
  src/egl/Makefile.am | 2 +-
  1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/src/egl/Makefile.am b/src/egl/Makefile.am
index f881145c0e3..ecaf148aaec 100644
--- a/src/egl/Makefile.am
+++ b/src/egl/Makefile.am
@@ -74,10 +74,10 @@ drivers/dri2/linux-dmabuf-unstable-v1-client-protocol.h: 
$(WL_DMABUF_XML)
$(MKDIR_GEN)
$(AM_V_GEN)$(WAYLAND_SCANNER) client-header < $< > $@
  
+if HAVE_PLATFORM_WAYLAND

  drivers/dri2/linux-dmabuf-unstable-v1-protocol.lo: 
drivers/dri2/linux-dmabuf-unstable-v1-client-protocol.h
  drivers/dri2/egl_dri2.lo: 
drivers/dri2/linux-dmabuf-unstable-v1-client-protocol.h
  
-if HAVE_PLATFORM_WAYLAND

  AM_CFLAGS += $(WAYLAND_CFLAGS)
  libEGL_common_la_LIBADD += $(WAYLAND_LIBS)
  libEGL_common_la_LIBADD += $(LIBDRM_LIBS)


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


Re: [Mesa-dev] [PATCH 2/2] egl: add linux-dmabuf-unstable-v1-protocol.c to "nodist"

2017-07-24 Thread Tapani Pälli

I sent attempt to fix this here:
https://patchwork.freedesktop.org/patch/168609/

On 07/24/2017 03:25 PM, Luke A. Guest wrote:

master currently fails when enabling egl because
drivers/dri2/linux-dmabuf-unstable-v1-protocol.c doesn't exist, should it?

Luke.


On 19/07/17 23:44, Andres Gomez wrote:

This fixes `make distcheck`


make[3]: *** No rule to make target 
'drivers/dri2/linux-dmabuf-unstable-v1-protocol.c', needed by 'distdir'.  Stop.
make[3]: Entering directory '/home/local/mesa/src/egl'
make[3]: Leaving directory '/home/local/mesa/src/egl'
make[2]: *** [distdir] Error 1
make[1]: *** [distdir] Error 1
make: *** [dist] Error 2

Fixes: 02cc359372 ("egl/wayland: Use linux-dmabuf interface for buffers")
Cc: Emil Velikov 
Signed-off-by: Andres Gomez 
---
  src/egl/Makefile.am | 10 --
  1 file changed, 8 insertions(+), 2 deletions(-)

diff --git a/src/egl/Makefile.am b/src/egl/Makefile.am
index 7c1a4929b8..6ee1fb9be8 100644
--- a/src/egl/Makefile.am
+++ b/src/egl/Makefile.am
@@ -44,10 +44,13 @@ noinst_LTLIBRARIES = libEGL_common.la
  libEGL_common_la_SOURCES = \
$(LIBEGL_C_FILES)
  
+nodist_libEGL_common_la_SOURCES =

+
  libEGL_common_la_LIBADD = \
$(EGL_LIB_DEPS)
  
  dri2_backend_FILES =

+nodist_dri2_backend_FILES =
  dri3_backend_FILES =
  
  if HAVE_PLATFORM_X11

@@ -84,8 +87,8 @@ libEGL_common_la_LIBADD += $(WAYLAND_LIBS)
  libEGL_common_la_LIBADD += $(LIBDRM_LIBS)
  libEGL_common_la_LIBADD += 
$(top_builddir)/src/egl/wayland/wayland-drm/libwayland-drm.la
  libEGL_common_la_LIBADD += $(top_builddir)/src/util/libmesautil.la
-dri2_backend_FILES += drivers/dri2/platform_wayland.c  \
-   drivers/dri2/linux-dmabuf-unstable-v1-protocol.c
+dri2_backend_FILES += drivers/dri2/platform_wayland.c
+nodist_dri2_backend_FILES += drivers/dri2/linux-dmabuf-unstable-v1-protocol.c
  endif
  
  if HAVE_PLATFORM_DRM

@@ -119,6 +122,9 @@ libEGL_common_la_SOURCES += \
$(dri2_backend_FILES) \
$(dri3_backend_FILES)
  
+nodist_libEGL_common_la_SOURCES += \

+   $(nodist_dri2_backend_FILES)
+
  libEGL_common_la_LIBADD += $(top_builddir)/src/loader/libloader.la
  libEGL_common_la_LIBADD += $(DLOPEN_LIBS) $(LIBDRM_LIBS) $(CLOCK_LIB)
  


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


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


[Mesa-dev] [PATCH 2/2] egl: guard wayland specific bits with HAVE_PLATFORM_WAYLAND

2017-07-24 Thread Tapani Pälli
Fixes: 166852e "configure.ac: rework wayland-protocols handling"
Signed-off-by: Tapani Pälli <tapani.pa...@intel.com>
---
This fixes following build error for me:
   make[4]: *** No rule to make target 
'/unstable/linux-dmabuf/linux-dmabuf-unstable-v1.xml', needed by 
'drivers/dri2/linux-dmabuf-unstable-v1-client-protocol.h'.  Stop.

 src/egl/Makefile.am | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/src/egl/Makefile.am b/src/egl/Makefile.am
index f881145..e765ac6 100644
--- a/src/egl/Makefile.am
+++ b/src/egl/Makefile.am
@@ -64,6 +64,7 @@ libEGL_common_la_LIBADD += 
$(top_builddir)/src/loader/libloader_dri3_helper.la
 endif
 endif
 
+if HAVE_PLATFORM_WAYLAND
 WL_DMABUF_XML = 
$(WAYLAND_PROTOCOLS_DATADIR)/unstable/linux-dmabuf/linux-dmabuf-unstable-v1.xml
 
 drivers/dri2/linux-dmabuf-unstable-v1-protocol.c: $(WL_DMABUF_XML)
@@ -77,7 +78,6 @@ drivers/dri2/linux-dmabuf-unstable-v1-client-protocol.h: 
$(WL_DMABUF_XML)
 drivers/dri2/linux-dmabuf-unstable-v1-protocol.lo: 
drivers/dri2/linux-dmabuf-unstable-v1-client-protocol.h
 drivers/dri2/egl_dri2.lo: 
drivers/dri2/linux-dmabuf-unstable-v1-client-protocol.h
 
-if HAVE_PLATFORM_WAYLAND
 AM_CFLAGS += $(WAYLAND_CFLAGS)
 libEGL_common_la_LIBADD += $(WAYLAND_LIBS)
 libEGL_common_la_LIBADD += $(LIBDRM_LIBS)
-- 
2.9.4

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


[Mesa-dev] [PATCH 1/2] egl: fix whitespace issues from eglimage code

2017-07-24 Thread Tapani Pälli
Signed-off-by: Tapani Pälli <tapani.pa...@intel.com>
---
 src/egl/main/eglimage.c | 20 ++--
 1 file changed, 10 insertions(+), 10 deletions(-)

diff --git a/src/egl/main/eglimage.c b/src/egl/main/eglimage.c
index 72a556e..46bf0c5 100644
--- a/src/egl/main/eglimage.c
+++ b/src/egl/main/eglimage.c
@@ -41,7 +41,7 @@ _eglParseKHRImageAttribs(_EGLImageAttribs *attrs, _EGLDisplay 
*dpy,
switch (attr) {
case EGL_IMAGE_PRESERVED_KHR:
   if (!dpy->Extensions.KHR_image_base)
-  return EGL_BAD_PARAMETER;
+ return EGL_BAD_PARAMETER;
 
   attrs->ImagePreserved = val;
   break;
@@ -144,9 +144,9 @@ _eglParseEXTImageDmaBufImportAttribs(_EGLImageAttribs 
*attrs, _EGLDisplay *dpy,
   attrs->DMABufPlanePitches[0].IsPresent = EGL_TRUE;
   break;
case EGL_DMA_BUF_PLANE1_FD_EXT:
-   attrs->DMABufPlaneFds[1].Value = val;
-   attrs->DMABufPlaneFds[1].IsPresent = EGL_TRUE;
-   break;
+  attrs->DMABufPlaneFds[1].Value = val;
+  attrs->DMABufPlaneFds[1].IsPresent = EGL_TRUE;
+  break;
case EGL_DMA_BUF_PLANE1_OFFSET_EXT:
   attrs->DMABufPlaneOffsets[1].Value = val;
   attrs->DMABufPlaneOffsets[1].IsPresent = EGL_TRUE;
@@ -288,30 +288,30 @@ _eglParseImageAttribList(_EGLImageAttribs *attrs, 
_EGLDisplay *dpy,
 
   err = _eglParseKHRImageAttribs(attrs, dpy, attr, val);
   if (err == EGL_SUCCESS)
-  continue;
+ continue;
 
   err = _eglParseMESADrmImageAttribs(attrs, dpy, attr, val);
   if (err == EGL_SUCCESS)
-  continue;
+ continue;
 
   err = _eglParseWLBindWaylandDisplayAttribs(attrs, dpy, attr, val);
   if (err == EGL_SUCCESS)
-  continue;
+ continue;
 
   err = _eglParseEXTImageDmaBufImportAttribs(attrs, dpy, attr, val);
   if (err == EGL_SUCCESS)
-  continue;
+ continue;
 
   /* EXT_image_dma_buf_import states that if invalid value is provided for
* its attributes, we should return EGL_BAD_ATTRIBUTE.
* Bail out ASAP, since follow-up calls can return another EGL_BAD error.
*/
   if (err == EGL_BAD_ATTRIBUTE)
-  return _eglError(err, __func__);
+ return _eglError(err, __func__);
 
   err = _eglParseEXTImageDmaBufImportModifiersAttribs(attrs, dpy, attr, 
val);
   if (err == EGL_SUCCESS)
-  continue;
+ continue;
 
   return _eglError(err, __func__);
}
-- 
2.9.4

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


Re: [Mesa-dev] [PATCH] Android: fix spirv_info.c generation

2017-07-20 Thread Tapani Pälli

Nice, I think it was done like this in some other occurence too;

Reviewed-by: Tapani Pälli <tapani.pa...@intel.com>

On 07/20/2017 01:30 PM, Chih-Wei Huang wrote:

It's incorrect to use $(LOCAL_PATH) in makefile recipes since it's
changing. The typical way to handle it is to use private variable.
Fortunately in this case we can just simplify them to $^.

See further:
https://patchwork.freedesktop.org/patch/167718/

Also simplify LOCAL_GENERATED_SOURCES.

Fixes: 2dd4e2ec (spirv: Generate spirv_info.c)

Signed-off-by: Chih-Wei Huang <cwhu...@linux.org.tw>
---
  src/compiler/Android.nir.gen.mk | 7 ++-
  1 file changed, 2 insertions(+), 5 deletions(-)

diff --git a/src/compiler/Android.nir.gen.mk b/src/compiler/Android.nir.gen.mk
index 4507ac4..e2187d0 100644
--- a/src/compiler/Android.nir.gen.mk
+++ b/src/compiler/Android.nir.gen.mk
@@ -41,7 +41,7 @@ LOCAL_EXPORT_C_INCLUDE_DIRS += \
$(MESA_TOP)/src/compiler/nir
  
  LOCAL_GENERATED_SOURCES += $(addprefix $(intermediates)/, \

-   $(NIR_GENERATED_FILES))
+   $(NIR_GENERATED_FILES) $(SPIRV_GENERATED_FILES))
  
  # Modules using libmesa_nir must set LOCAL_GENERATED_SOURCES to this

  MESA_GEN_NIR_H := $(addprefix $(call local-generated-sources-dir)/, \
@@ -95,9 +95,6 @@ $(intermediates)/nir/nir_opt_algebraic.c: 
$(nir_opt_algebraic_deps)
@mkdir -p $(dir $@)
$(hide) $(MESA_PYTHON2) $(nir_opt_algebraic_gen) $< > $@
  
-LOCAL_GENERATED_SOURCES += $(addprefix $(intermediates)/, \

-   $(SPIRV_GENERATED_FILES))
-
  $(intermediates)/spirv/spirv_info.c: $(LOCAL_PATH)/spirv/spirv_info_c.py 
$(LOCAL_PATH)/spirv/spirv.core.grammar.json
@mkdir -p $(dir $@)
-   $(hide) $(MESA_PYTHON2) $(LOCAL_PATH)/spirv/spirv_info_c.py 
$(LOCAL_PATH)/spirv/spirv.core.grammar.json $@ || ($(RM) $@; false)
+   $(hide) $(MESA_PYTHON2) $^ $@ || ($(RM) $@; false)



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


Re: [Mesa-dev] [PATCH] Revert "i965: Call intel_prepare_render() from intel_update_state()"

2017-07-20 Thread Tapani Pälli

Works for Android-IA:
Tested-by: Tapani Pälli <tapani.pa...@intel.com>

On 07/20/2017 09:00 AM, Kenneth Graunke wrote:

This reverts commit b7153c3e9f9d2d430b0338313587a00e531e4800.

The point of that commit was to ensure intel_prepare_render() occurred
before color resolves on the current framebuffer.  In 0673bbfd9ba16be8
(i965: Move surface resolves back to draw/dispatch time), Jason moved
brw_predraw_resolve_framebuffer back to draw time, which is already
after a intel_prepare_render() call.  So, this is no longer necessary.

Furthermore, it caused problems.  "mpv" would only display a small
corner of movies, and Android started failing camera CTS tests.

This is because intel_prepare_render() ended up handling DRI2 events
which caused the drawable to be resized at an inopportune time, flagging
ctx->NewState |= _NEW_BUFFERS, but at a point where we've already copied
ctx->NewState, and failed to notice the newly set flag.

The lack of _NEW_BUFFERS caused us to skip 3DSTATE_DRAWING_RECTANGLE,
so the drawing ended up being clipped to an outdated framebuffer size.

Just drop the hack and go back to handling this at the proper time.

Thanks to Matti Hämäläinen (ccr) and Tomasz Figa (tfiga) for reporting
these issues.

Bugzilla: https://bugs.freedesktop.org/show_bug.cgi?id=101558
Bugzilla: https://bugs.freedesktop.org/show_bug.cgi?id=101704
---
  src/mesa/drivers/dri/i965/brw_context.c | 2 --
  1 file changed, 2 deletions(-)

diff --git a/src/mesa/drivers/dri/i965/brw_context.c 
b/src/mesa/drivers/dri/i965/brw_context.c
index bd26e2332c7..102d7223a93 100644
--- a/src/mesa/drivers/dri/i965/brw_context.c
+++ b/src/mesa/drivers/dri/i965/brw_context.c
@@ -194,8 +194,6 @@ intel_update_state(struct gl_context * ctx)
 if (new_state & _NEW_POLYGON)
brw->polygon_front_bit = _mesa_polygon_get_front_bit(ctx);
  
-   intel_prepare_render(brw);

-
 if (new_state & _NEW_BUFFERS) {
intel_update_framebuffer(ctx, ctx->DrawBuffer);
if (ctx->DrawBuffer != ctx->ReadBuffer)


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


Re: [Mesa-dev] [PATCH 2/2] android: fix spirv_info generation

2017-07-20 Thread Tapani Pälli



On 07/19/2017 05:01 PM, Rob Herring wrote:

On Wed, Jul 19, 2017 at 8:56 AM, Emil Velikov <emil.l.veli...@gmail.com> wrote:

On 19 July 2017 at 14:14, Tapani Pälli <tapani.pa...@intel.com> wrote:

On 07/19/2017 03:29 PM, Emil Velikov wrote:


On 19 July 2017 at 08:12, Tapani Pälli <tapani.pa...@intel.com> wrote:


Depending on build order, LOCAL_PATH maybe set or not (and can't
be trusted to have assumed path), change modifies all occurences
of LOCAL_PATH as locally defined COMPILER_PATH instead.


Sounds like a bug somewhere or a fundamental breakage in the Android
world.

$cat src/compiler/Android.mk
...
LOCAL_PATH := $(call my-dir)

include $(LOCAL_PATH)/Android.glsl.mk
include $(LOCAL_PATH)/Android.nir.mk
...

$cat src/compiler/Android.nir.mk
...
LOCAL_PATH := $(call my-dir)
...
include $(CLEAR_VARS) // is this one one causing problems?
...
include $(LOCAL_PATH)/Android.nir.gen.mk
...

Hence LOCAL_PATH should be set, and should point to the correct place.



Signed-off-by: Tapani Pälli <tapani.pa...@intel.com>
---
   src/compiler/Android.nir.gen.mk | 38
--
   1 file changed, 20 insertions(+), 18 deletions(-)

diff --git a/src/compiler/Android.nir.gen.mk
b/src/compiler/Android.nir.gen.mk
index 4507ac4..81511de 100644
--- a/src/compiler/Android.nir.gen.mk
+++ b/src/compiler/Android.nir.gen.mk
@@ -27,6 +27,8 @@ ifeq ($(LOCAL_MODULE_CLASS),)
   LOCAL_MODULE_CLASS := STATIC_LIBRARIES
   endif

+COMPILER_PATH := $(MESA_TOP)/src/compiler
+


A define LOCAL_PATH at the top of the file should also work, right?



Right but this would override what LOCAL_PATH was before so did not want to
do that. I can try alternative approach. Maybe it is CLEAR_VARS that causes
this as in my case LOCAL_PATH had something like 'build/core' or
'core/build' and that did not work.


Not sure what causes the fallout here, but if LOCAL_PATH is off then
we should be fine with correcting it.


Agreed.


I've tried this and it does not work. Setting LOCAL_PATH in the file 
results in following (same as before) error:


--- 8< ---
FAILED: /bin/bash -c "python build/core/spirv/spirv_info_c.py 
build/core/spirv/spirv.core.grammar.json 
out/target/product/androidia_64/gen/STATIC_LIBRARIES/libmesa_nir_intermediates/spirv/spirv_info.c 
|| ( 
out/target/product/androidia_64/gen/STATIC_LIBRARIES/libmesa_nir_intermediates/spirv/spirv_info.c; 
false)"
python: can't open file 'build/core/spirv/spirv_info_c.py': [Errno 2] No 
such file or directory

--- 8< ---

Only using something else than LOCAL_PATH, like MY_LOCAL_PATH works.


Quick grep through my very limited checkout shows the following odd
bits. Seemingly unrelated, yet wrong.

system/core/liblog/Android.mk:LOCAL_PATH := $(my-dir)
system/core/Android.mk:LOCAL_PATH := $(my-dir)


"call" is not required when there are no parameters.

Rob


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


Re: [Mesa-dev] [PATCH 2/2] android: fix spirv_info generation

2017-07-19 Thread Tapani Pälli

On 07/19/2017 03:29 PM, Emil Velikov wrote:

On 19 July 2017 at 08:12, Tapani Pälli <tapani.pa...@intel.com> wrote:

Depending on build order, LOCAL_PATH maybe set or not (and can't
be trusted to have assumed path), change modifies all occurences
of LOCAL_PATH as locally defined COMPILER_PATH instead.


Sounds like a bug somewhere or a fundamental breakage in the Android world.

$cat src/compiler/Android.mk
...
LOCAL_PATH := $(call my-dir)

include $(LOCAL_PATH)/Android.glsl.mk
include $(LOCAL_PATH)/Android.nir.mk
...

$cat src/compiler/Android.nir.mk
...
LOCAL_PATH := $(call my-dir)
...
include $(CLEAR_VARS) // is this one one causing problems?
...
include $(LOCAL_PATH)/Android.nir.gen.mk
...

Hence LOCAL_PATH should be set, and should point to the correct place.



Signed-off-by: Tapani Pälli <tapani.pa...@intel.com>
---
  src/compiler/Android.nir.gen.mk | 38 --
  1 file changed, 20 insertions(+), 18 deletions(-)

diff --git a/src/compiler/Android.nir.gen.mk b/src/compiler/Android.nir.gen.mk
index 4507ac4..81511de 100644
--- a/src/compiler/Android.nir.gen.mk
+++ b/src/compiler/Android.nir.gen.mk
@@ -27,6 +27,8 @@ ifeq ($(LOCAL_MODULE_CLASS),)
  LOCAL_MODULE_CLASS := STATIC_LIBRARIES
  endif

+COMPILER_PATH := $(MESA_TOP)/src/compiler
+

A define LOCAL_PATH at the top of the file should also work, right?


Right but this would override what LOCAL_PATH was before so did not want 
to do that. I can try alternative approach. Maybe it is CLEAR_VARS that 
causes this as in my case LOCAL_PATH had something like 'build/core' or 
'core/build' and that did not work.



Thanks
Emil



// Tapani


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


[Mesa-dev] [PATCH 1/2] android: fix libmesa_nir build

2017-07-19 Thread Tapani Pälli
current build did not find required include 'spirv_info.h'

Signed-off-by: Tapani Pälli <tapani.pa...@intel.com>
---
 src/compiler/Android.nir.mk | 1 +
 1 file changed, 1 insertion(+)

diff --git a/src/compiler/Android.nir.mk b/src/compiler/Android.nir.mk
index f021b80..75a247a 100644
--- a/src/compiler/Android.nir.mk
+++ b/src/compiler/Android.nir.mk
@@ -37,6 +37,7 @@ LOCAL_SRC_FILES := \
 LOCAL_C_INCLUDES := \
$(MESA_TOP)/src/mapi \
$(MESA_TOP)/src/mesa \
+   $(MESA_TOP)/src/compiler/spirv \
$(MESA_TOP)/src/gallium/include \
$(MESA_TOP)/src/gallium/auxiliary
 
-- 
2.9.4

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


[Mesa-dev] [PATCH 2/2] android: fix spirv_info generation

2017-07-19 Thread Tapani Pälli
Depending on build order, LOCAL_PATH maybe set or not (and can't
be trusted to have assumed path), change modifies all occurences
of LOCAL_PATH as locally defined COMPILER_PATH instead.

Signed-off-by: Tapani Pälli <tapani.pa...@intel.com>
---
 src/compiler/Android.nir.gen.mk | 38 --
 1 file changed, 20 insertions(+), 18 deletions(-)

diff --git a/src/compiler/Android.nir.gen.mk b/src/compiler/Android.nir.gen.mk
index 4507ac4..81511de 100644
--- a/src/compiler/Android.nir.gen.mk
+++ b/src/compiler/Android.nir.gen.mk
@@ -27,6 +27,8 @@ ifeq ($(LOCAL_MODULE_CLASS),)
 LOCAL_MODULE_CLASS := STATIC_LIBRARIES
 endif
 
+COMPILER_PATH := $(MESA_TOP)/src/compiler
+
 intermediates := $(call local-generated-sources-dir)
 
 LOCAL_SRC_FILES := $(LOCAL_SRC_FILES)
@@ -48,48 +50,48 @@ MESA_GEN_NIR_H := $(addprefix $(call 
local-generated-sources-dir)/, \
nir/nir_opcodes.h \
nir/nir_builder_opcodes.h)
 
-nir_builder_opcodes_gen := $(LOCAL_PATH)/nir/nir_builder_opcodes_h.py
+nir_builder_opcodes_gen := $(COMPILER_PATH)/nir/nir_builder_opcodes_h.py
 nir_builder_opcodes_deps := \
-   $(LOCAL_PATH)/nir/nir_opcodes.py \
-   $(LOCAL_PATH)/nir/nir_builder_opcodes_h.py
+   $(COMPILER_PATH)/nir/nir_opcodes.py \
+   $(COMPILER_PATH)/nir/nir_builder_opcodes_h.py
 
 $(intermediates)/nir/nir_builder_opcodes.h: $(nir_builder_opcodes_deps)
@mkdir -p $(dir $@)
$(hide) $(MESA_PYTHON2) $(nir_builder_opcodes_gen) $< > $@
 
-nir_constant_expressions_gen := $(LOCAL_PATH)/nir/nir_constant_expressions.py
+nir_constant_expressions_gen := 
$(COMPILER_PATH)/nir/nir_constant_expressions.py
 nir_constant_expressions_deps := \
-   $(LOCAL_PATH)/nir/nir_opcodes.py \
-   $(LOCAL_PATH)/nir/nir_constant_expressions.py
+   $(COMPILER_PATH)/nir/nir_opcodes.py \
+   $(COMPILER_PATH)/nir/nir_constant_expressions.py
 
 $(intermediates)/nir/nir_constant_expressions.c: 
$(nir_constant_expressions_deps)
@mkdir -p $(dir $@)
$(hide) $(MESA_PYTHON2) $(nir_constant_expressions_gen) $< > $@
 
-nir_opcodes_h_gen := $(LOCAL_PATH)/nir/nir_opcodes_h.py
+nir_opcodes_h_gen := $(COMPILER_PATH)/nir/nir_opcodes_h.py
 nir_opcodes_h_deps := \
-   $(LOCAL_PATH)/nir/nir_opcodes.py \
-   $(LOCAL_PATH)/nir/nir_opcodes_h.py
+   $(COMPILER_PATH)/nir/nir_opcodes.py \
+   $(COMPILER_PATH)/nir/nir_opcodes_h.py
 
 $(intermediates)/nir/nir_opcodes.h: $(nir_opcodes_h_deps)
@mkdir -p $(dir $@)
$(hide) $(MESA_PYTHON2) $(nir_opcodes_h_gen) $< > $@
 
-$(LOCAL_PATH)/nir/nir.h: $(intermediates)/nir/nir_opcodes.h
+$(COMPILER_PATH)/nir/nir.h: $(intermediates)/nir/nir_opcodes.h
 
-nir_opcodes_c_gen := $(LOCAL_PATH)/nir/nir_opcodes_c.py
+nir_opcodes_c_gen := $(COMPILER_PATH)/nir/nir_opcodes_c.py
 nir_opcodes_c_deps := \
-   $(LOCAL_PATH)/nir/nir_opcodes.py \
-   $(LOCAL_PATH)/nir/nir_opcodes_c.py
+   $(COMPILER_PATH)/nir/nir_opcodes.py \
+   $(COMPILER_PATH)/nir/nir_opcodes_c.py
 
 $(intermediates)/nir/nir_opcodes.c: $(nir_opcodes_c_deps)
@mkdir -p $(dir $@)
$(hide) $(MESA_PYTHON2) $(nir_opcodes_c_gen) $< > $@
 
-nir_opt_algebraic_gen := $(LOCAL_PATH)/nir/nir_opt_algebraic.py
+nir_opt_algebraic_gen := $(COMPILER_PATH)/nir/nir_opt_algebraic.py
 nir_opt_algebraic_deps := \
-   $(LOCAL_PATH)/nir/nir_opt_algebraic.py \
-   $(LOCAL_PATH)/nir/nir_algebraic.py
+   $(COMPILER_PATH)/nir/nir_opt_algebraic.py \
+   $(COMPILER_PATH)/nir/nir_algebraic.py
 
 $(intermediates)/nir/nir_opt_algebraic.c: $(nir_opt_algebraic_deps)
@mkdir -p $(dir $@)
@@ -98,6 +100,6 @@ $(intermediates)/nir/nir_opt_algebraic.c: 
$(nir_opt_algebraic_deps)
 LOCAL_GENERATED_SOURCES += $(addprefix $(intermediates)/, \
$(SPIRV_GENERATED_FILES))
 
-$(intermediates)/spirv/spirv_info.c: $(LOCAL_PATH)/spirv/spirv_info_c.py 
$(LOCAL_PATH)/spirv/spirv.core.grammar.json
+$(intermediates)/spirv/spirv_info.c: $(COMPILER_PATH)/spirv/spirv_info_c.py 
$(COMPILER_PATH)/spirv/spirv.core.grammar.json
@mkdir -p $(dir $@)
-   $(hide) $(MESA_PYTHON2) $(LOCAL_PATH)/spirv/spirv_info_c.py 
$(LOCAL_PATH)/spirv/spirv.core.grammar.json $@ || ($(RM) $@; false)
+   $(hide) $(MESA_PYTHON2) $(COMPILER_PATH)/spirv/spirv_info_c.py 
$(COMPILER_PATH)/spirv/spirv.core.grammar.json $@ || ($(RM) $@; false)
-- 
2.9.4

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


Re: [Mesa-dev] [PATCH] i965: don't call dup() twice when calling eglDupNativeFenceFDANDROID.

2017-06-16 Thread Tapani Pälli
Oops sorry, forget about this one. This does not work ok :/ Need to take 
a closer look why.


On 06/16/2017 10:21 AM, Tapani Pälli wrote:

From: Randy Xu <randy...@intel.com>

This was causing crashes in Vulkan and GLES stress testing.

Currently, both libEGL and the DRI module call dup when the function
is called. Remove the former since it's ultimately a driver decision
how to manage the file descriptor.

v2: remove dup from the EGL layer (Emil Velikov)

Fixes: 0201f01dc4e ("egl: add EGL_ANDROID_native_fence_sync")
Signed-off-by: Randy Xu <randy...@intel.com>
---
  src/egl/drivers/dri2/egl_dri2.c | 2 +-
  1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/src/egl/drivers/dri2/egl_dri2.c b/src/egl/drivers/dri2/egl_dri2.c
index 020a0bc..0caccd4 100644
--- a/src/egl/drivers/dri2/egl_dri2.c
+++ b/src/egl/drivers/dri2/egl_dri2.c
@@ -2885,7 +2885,7 @@ dri2_dup_native_fence_fd(_EGLDriver *drv, _EGLDisplay 
*dpy, _EGLSync *sync)
return EGL_NO_NATIVE_FENCE_FD_ANDROID;
 }
  
-   return dup(sync->SyncFd);

+   return sync->SyncFd;
  }
  
  static EGLint



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


[Mesa-dev] [PATCH] i965: don't call dup() twice when calling eglDupNativeFenceFDANDROID.

2017-06-16 Thread Tapani Pälli
From: Randy Xu 

This was causing crashes in Vulkan and GLES stress testing.

Currently, both libEGL and the DRI module call dup when the function
is called. Remove the former since it's ultimately a driver decision
how to manage the file descriptor.

v2: remove dup from the EGL layer (Emil Velikov)

Fixes: 0201f01dc4e ("egl: add EGL_ANDROID_native_fence_sync")
Signed-off-by: Randy Xu 
---
 src/egl/drivers/dri2/egl_dri2.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/src/egl/drivers/dri2/egl_dri2.c b/src/egl/drivers/dri2/egl_dri2.c
index 020a0bc..0caccd4 100644
--- a/src/egl/drivers/dri2/egl_dri2.c
+++ b/src/egl/drivers/dri2/egl_dri2.c
@@ -2885,7 +2885,7 @@ dri2_dup_native_fence_fd(_EGLDriver *drv, _EGLDisplay 
*dpy, _EGLSync *sync)
   return EGL_NO_NATIVE_FENCE_FD_ANDROID;
}
 
-   return dup(sync->SyncFd);
+   return sync->SyncFd;
 }
 
 static EGLint
-- 
2.9.4

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


Re: [Mesa-dev] [PATCH v1 0/7] Android etnaviv and imx support

2017-06-16 Thread Tapani Pälli
I sent some small nitpicking on commented lines in mk files, otherwise 
everything LGTM.


I'm not sure about patch to enable texture-float, should this be left as 
a 'policy decision' for end distribution, it's not enabled by default on 
desktop?


other patches (with those small nits fixed) are
Reviewed-by: Tapani Pälli <tapani.pa...@intel.com>


On 06/15/2017 11:47 PM, Robert Foss wrote:

This series enables etnaviv and imx for the android platform.
This is done through updating the Android build scripts.

Additionally 4 small fixes are included in the series.

Rob Herring (4):
   gallium: os_process fixes for Android
   gbm: add XBGR support for dumb buffers
   android: enable texture-float
   android: add etnaviv driver build support

Robert Foss (1):
   egl/android: Fix typ-o

Tomeu Vizoso (2):
   etnaviv: Add return statement to etna_amode so compiler is happy
   android: build imx-drm winsys

  Android.common.mk  |  1 +
  Android.mk |  6 ++--
  src/egl/drivers/dri2/platform_android.c|  2 +-
  src/gallium/Android.mk |  2 ++
  src/gallium/auxiliary/Android.mk   |  5 +--
  src/gallium/auxiliary/os/os_process.c  |  5 +--
  src/gallium/auxiliary/renderonly/renderonly.c  |  1 +
  src/gallium/drivers/etnaviv/Android.mk | 47 ++
  src/gallium/drivers/etnaviv/etnaviv_compiler.c |  2 ++
  src/gallium/winsys/etnaviv/drm/Android.mk  | 35 +++
  src/gallium/winsys/imx/drm/Android.mk  | 40 ++
  src/gbm/backends/dri/gbm_dri.c |  2 +-
  12 files changed, 140 insertions(+), 8 deletions(-)
  create mode 100644 src/gallium/drivers/etnaviv/Android.mk
  create mode 100644 src/gallium/winsys/etnaviv/drm/Android.mk
  create mode 100644 src/gallium/winsys/imx/drm/Android.mk


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


Re: [Mesa-dev] [PATCH v1 6/7] android: add etnaviv driver build support

2017-06-16 Thread Tapani Pälli



On 06/16/2017 09:28 AM, Tapani Pälli wrote:



On 06/15/2017 11:47 PM, Robert Foss wrote:

From: Rob Herring <r...@kernel.org>

Add etnaviv to Android makefiles.

Signed-off-by: Rob Herring <r...@kernel.org>
---
  Android.mk|  5 +--
  src/gallium/Android.mk|  1 +
  src/gallium/auxiliary/Android.mk  |  5 +--
  src/gallium/auxiliary/renderonly/renderonly.c |  1 +
  src/gallium/drivers/etnaviv/Android.mk| 47 
+++

  src/gallium/winsys/etnaviv/drm/Android.mk | 35 
  6 files changed, 90 insertions(+), 4 deletions(-)
  create mode 100644 src/gallium/drivers/etnaviv/Android.mk
  create mode 100644 src/gallium/winsys/etnaviv/drm/Android.mk

diff --git a/Android.mk b/Android.mk
index de37f4600f..b4dc8321a6 100644
--- a/Android.mk
+++ b/Android.mk
@@ -24,7 +24,7 @@
  # BOARD_GPU_DRIVERS should be defined.  The valid values are
  #
  #   classic drivers: i915 i965
-#   gallium drivers: swrast freedreno i915g nouveau r300g r600g 
radeonsi vc4 virgl vmwgfx
+#   gallium drivers: swrast freedreno i915g nouveau r300g r600g 
radeonsi vc4 virgl vmwgfx etnaviv

  #
  # The main target is libGLES_mesa.  For each classic driver enabled, 
a DRI
  # module will also be built.  DRI modules will be loaded by 
libGLES_mesa.

@@ -56,7 +56,8 @@ gallium_drivers := \
  radeonsi.HAVE_GALLIUM_RADEONSI \
  vmwgfx.HAVE_GALLIUM_VMWGFX \
  vc4.HAVE_GALLIUM_VC4 \
-virgl.HAVE_GALLIUM_VIRGL
+virgl.HAVE_GALLIUM_VIRGL \
+etnaviv.HAVE_GALLIUM_ETNAVIV
  ifeq ($(BOARD_GPU_DRIVERS),all)
  MESA_BUILD_CLASSIC := $(filter HAVE_%, $(subst ., , 
$(classic_drivers)))

diff --git a/src/gallium/Android.mk b/src/gallium/Android.mk
index 0915579127..0280574405 100644
--- a/src/gallium/Android.mk
+++ b/src/gallium/Android.mk
@@ -43,6 +43,7 @@ SUBDIRS += winsys/radeon/drm winsys/amdgpu/drm 
drivers/radeonsi drivers/radeon

  SUBDIRS += winsys/vc4/drm drivers/vc4
  SUBDIRS += winsys/virgl/drm winsys/virgl/vtest drivers/virgl
  SUBDIRS += winsys/svga/drm drivers/svga
+SUBDIRS += winsys/etnaviv/drm drivers/etnaviv drivers/renderonly
  SUBDIRS += state_trackers/dri
  # sort to eliminate any duplicates
diff --git a/src/gallium/auxiliary/Android.mk 
b/src/gallium/auxiliary/Android.mk

index e2a1fc214e..a562774a9a 100644
--- a/src/gallium/auxiliary/Android.mk
+++ b/src/gallium/auxiliary/Android.mk
@@ -31,7 +31,8 @@ include $(CLEAR_VARS)
  LOCAL_SRC_FILES := \
  $(C_SOURCES) \
  $(NIR_SOURCES) \
-$(VL_STUB_SOURCES)
+$(VL_STUB_SOURCES) \
+$(RENDERONLY_SOURCES)
  LOCAL_C_INCLUDES := \
  $(GALLIUM_TOP)/auxiliary/util
@@ -46,7 +47,7 @@ LOCAL_CPPFLAGS += -std=c++11
  # We need libmesa_nir to get NIR's generated include directories.
  LOCAL_MODULE := libmesa_gallium
-LOCAL_STATIC_LIBRARIES += libmesa_nir
+LOCAL_STATIC_LIBRARIES += libmesa_nir libmesa_loader
  LOCAL_WHOLE_STATIC_LIBRARIES += cpufeatures
diff --git a/src/gallium/auxiliary/renderonly/renderonly.c 
b/src/gallium/auxiliary/renderonly/renderonly.c

index d3ed214f4e..dda7f4471a 100644
--- a/src/gallium/auxiliary/renderonly/renderonly.c
+++ b/src/gallium/auxiliary/renderonly/renderonly.c
@@ -35,6 +35,7 @@
  #include "pipe/p_screen.h"
  #include "util/u_inlines.h"
  #include "util/u_memory.h"
+#include "loader.h"
  struct renderonly *
  renderonly_dup(const struct renderonly *ro)
diff --git a/src/gallium/drivers/etnaviv/Android.mk 
b/src/gallium/drivers/etnaviv/Android.mk

new file mode 100644
index 00..7e9b2ae1b2
--- /dev/null
+++ b/src/gallium/drivers/etnaviv/Android.mk
@@ -0,0 +1,47 @@
+# Copyright (C) 2016 Linaro, Ltd, Rob Herring <r...@kernel.org>
+#
+# Permission is hereby granted, free of charge, to any person 
obtaining a
+# copy of this software and associated documentation files (the 
"Software"),
+# to deal in the Software without restriction, including without 
limitation
+# the rights to use, copy, modify, merge, publish, distribute, 
sublicense,

+# and/or sell copies of the Software, and to permit persons to whom the
+# Software is furnished to do so, subject to the following conditions:
+#
+# The above copyright notice and this permission notice shall be 
included

+# in all copies or substantial portions of the Software.
+#
+# THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, 
EXPRESS OR
+# IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF 
MERCHANTABILITY,
+# FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.  IN NO EVENT 
SHALL
+# THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES 
OR OTHER
+# LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, 
ARISING

+# FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER
+# DEALINGS IN THE SOFTWARE.
+
+LOCAL_PATH := $(call my-dir)
+
+# get C_SOURCES
+include $(LOCAL_PATH)/Makefile.sources
+
+include $(CLEAR_VARS)
+
+LOCAL_S

Re: [Mesa-dev] [PATCH v1 7/7] android: build imx-drm winsys

2017-06-16 Thread Tapani Pälli



On 06/15/2017 11:47 PM, Robert Foss wrote:

From: Tomeu Vizoso 

Signed-off-by: Tomeu Vizoso 
---
  Android.mk|  5 +++--
  src/gallium/Android.mk|  1 +
  src/gallium/winsys/imx/drm/Android.mk | 40 +++
  3 files changed, 44 insertions(+), 2 deletions(-)
  create mode 100644 src/gallium/winsys/imx/drm/Android.mk

diff --git a/Android.mk b/Android.mk
index b4dc8321a6..7622004d2d 100644
--- a/Android.mk
+++ b/Android.mk
@@ -24,7 +24,7 @@
  # BOARD_GPU_DRIVERS should be defined.  The valid values are
  #
  #   classic drivers: i915 i965
-#   gallium drivers: swrast freedreno i915g nouveau r300g r600g radeonsi vc4 
virgl vmwgfx etnaviv
+#   gallium drivers: swrast freedreno i915g nouveau r300g r600g radeonsi vc4 
virgl vmwgfx etnaviv imx
  #
  # The main target is libGLES_mesa.  For each classic driver enabled, a DRI
  # module will also be built.  DRI modules will be loaded by libGLES_mesa.
@@ -57,7 +57,8 @@ gallium_drivers := \
vmwgfx.HAVE_GALLIUM_VMWGFX \
vc4.HAVE_GALLIUM_VC4 \
virgl.HAVE_GALLIUM_VIRGL \
-   etnaviv.HAVE_GALLIUM_ETNAVIV
+   etnaviv.HAVE_GALLIUM_ETNAVIV \
+   imx.HAVE_GALLIUM_IMX
  
  ifeq ($(BOARD_GPU_DRIVERS),all)

  MESA_BUILD_CLASSIC := $(filter HAVE_%, $(subst ., , $(classic_drivers)))
diff --git a/src/gallium/Android.mk b/src/gallium/Android.mk
index 0280574405..2710831588 100644
--- a/src/gallium/Android.mk
+++ b/src/gallium/Android.mk
@@ -44,6 +44,7 @@ SUBDIRS += winsys/vc4/drm drivers/vc4
  SUBDIRS += winsys/virgl/drm winsys/virgl/vtest drivers/virgl
  SUBDIRS += winsys/svga/drm drivers/svga
  SUBDIRS += winsys/etnaviv/drm drivers/etnaviv drivers/renderonly
+SUBDIRS += winsys/imx/drm
  SUBDIRS += state_trackers/dri
  
  # sort to eliminate any duplicates

diff --git a/src/gallium/winsys/imx/drm/Android.mk 
b/src/gallium/winsys/imx/drm/Android.mk
new file mode 100644
index 00..d4144f34aa
--- /dev/null
+++ b/src/gallium/winsys/imx/drm/Android.mk
@@ -0,0 +1,40 @@
+# Copyright (C) 2016 Linaro, Ltd, Rob Herring 
+#
+# Permission is hereby granted, free of charge, to any person obtaining a
+# copy of this software and associated documentation files (the "Software"),
+# to deal in the Software without restriction, including without limitation
+# the rights to use, copy, modify, merge, publish, distribute, sublicense,
+# and/or sell copies of the Software, and to permit persons to whom the
+# Software is furnished to do so, subject to the following conditions:
+#
+# The above copyright notice and this permission notice shall be included
+# in all copies or substantial portions of the Software.
+#
+# THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
+# IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
+# FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.  IN NO EVENT SHALL
+# THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
+# LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
+# FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER
+# DEALINGS IN THE SOFTWARE.
+
+LOCAL_PATH := $(call my-dir)
+
+# get C_SOURCES
+#include $(LOCAL_PATH)/Makefile.sources


copypaste leftover? can be removed


+
+include $(CLEAR_VARS)
+
+LOCAL_SRC_FILES := imx_drm_winsys.c
+
+LOCAL_SHARED_LIBRARIES := libdrm_etnaviv
+
+LOCAL_MODULE := libmesa_winsys_imx
+
+include $(GALLIUM_COMMON_MK)
+include $(BUILD_STATIC_LIBRARY)
+
+ifneq ($(HAVE_GALLIUM_FREEDRENO),)
+$(eval GALLIUM_LIBS += $(LOCAL_MODULE) libmesa_winsys_freedreno)
+$(eval GALLIUM_SHARED_LIBS += $(LOCAL_SHARED_LIBRARIES))
+endif


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


Re: [Mesa-dev] [PATCH v1 6/7] android: add etnaviv driver build support

2017-06-16 Thread Tapani Pälli



On 06/15/2017 11:47 PM, Robert Foss wrote:

From: Rob Herring 

Add etnaviv to Android makefiles.

Signed-off-by: Rob Herring 
---
  Android.mk|  5 +--
  src/gallium/Android.mk|  1 +
  src/gallium/auxiliary/Android.mk  |  5 +--
  src/gallium/auxiliary/renderonly/renderonly.c |  1 +
  src/gallium/drivers/etnaviv/Android.mk| 47 +++
  src/gallium/winsys/etnaviv/drm/Android.mk | 35 
  6 files changed, 90 insertions(+), 4 deletions(-)
  create mode 100644 src/gallium/drivers/etnaviv/Android.mk
  create mode 100644 src/gallium/winsys/etnaviv/drm/Android.mk

diff --git a/Android.mk b/Android.mk
index de37f4600f..b4dc8321a6 100644
--- a/Android.mk
+++ b/Android.mk
@@ -24,7 +24,7 @@
  # BOARD_GPU_DRIVERS should be defined.  The valid values are
  #
  #   classic drivers: i915 i965
-#   gallium drivers: swrast freedreno i915g nouveau r300g r600g radeonsi vc4 
virgl vmwgfx
+#   gallium drivers: swrast freedreno i915g nouveau r300g r600g radeonsi vc4 
virgl vmwgfx etnaviv
  #
  # The main target is libGLES_mesa.  For each classic driver enabled, a DRI
  # module will also be built.  DRI modules will be loaded by libGLES_mesa.
@@ -56,7 +56,8 @@ gallium_drivers := \
radeonsi.HAVE_GALLIUM_RADEONSI \
vmwgfx.HAVE_GALLIUM_VMWGFX \
vc4.HAVE_GALLIUM_VC4 \
-   virgl.HAVE_GALLIUM_VIRGL
+   virgl.HAVE_GALLIUM_VIRGL \
+   etnaviv.HAVE_GALLIUM_ETNAVIV
  
  ifeq ($(BOARD_GPU_DRIVERS),all)

  MESA_BUILD_CLASSIC := $(filter HAVE_%, $(subst ., , $(classic_drivers)))
diff --git a/src/gallium/Android.mk b/src/gallium/Android.mk
index 0915579127..0280574405 100644
--- a/src/gallium/Android.mk
+++ b/src/gallium/Android.mk
@@ -43,6 +43,7 @@ SUBDIRS += winsys/radeon/drm winsys/amdgpu/drm 
drivers/radeonsi drivers/radeon
  SUBDIRS += winsys/vc4/drm drivers/vc4
  SUBDIRS += winsys/virgl/drm winsys/virgl/vtest drivers/virgl
  SUBDIRS += winsys/svga/drm drivers/svga
+SUBDIRS += winsys/etnaviv/drm drivers/etnaviv drivers/renderonly
  SUBDIRS += state_trackers/dri
  
  # sort to eliminate any duplicates

diff --git a/src/gallium/auxiliary/Android.mk b/src/gallium/auxiliary/Android.mk
index e2a1fc214e..a562774a9a 100644
--- a/src/gallium/auxiliary/Android.mk
+++ b/src/gallium/auxiliary/Android.mk
@@ -31,7 +31,8 @@ include $(CLEAR_VARS)
  LOCAL_SRC_FILES := \
$(C_SOURCES) \
$(NIR_SOURCES) \
-   $(VL_STUB_SOURCES)
+   $(VL_STUB_SOURCES) \
+   $(RENDERONLY_SOURCES)
  
  LOCAL_C_INCLUDES := \

$(GALLIUM_TOP)/auxiliary/util
@@ -46,7 +47,7 @@ LOCAL_CPPFLAGS += -std=c++11
  
  # We need libmesa_nir to get NIR's generated include directories.

  LOCAL_MODULE := libmesa_gallium
-LOCAL_STATIC_LIBRARIES += libmesa_nir
+LOCAL_STATIC_LIBRARIES += libmesa_nir libmesa_loader
  
  LOCAL_WHOLE_STATIC_LIBRARIES += cpufeatures
  
diff --git a/src/gallium/auxiliary/renderonly/renderonly.c b/src/gallium/auxiliary/renderonly/renderonly.c

index d3ed214f4e..dda7f4471a 100644
--- a/src/gallium/auxiliary/renderonly/renderonly.c
+++ b/src/gallium/auxiliary/renderonly/renderonly.c
@@ -35,6 +35,7 @@
  #include "pipe/p_screen.h"
  #include "util/u_inlines.h"
  #include "util/u_memory.h"
+#include "loader.h"
  
  struct renderonly *

  renderonly_dup(const struct renderonly *ro)
diff --git a/src/gallium/drivers/etnaviv/Android.mk 
b/src/gallium/drivers/etnaviv/Android.mk
new file mode 100644
index 00..7e9b2ae1b2
--- /dev/null
+++ b/src/gallium/drivers/etnaviv/Android.mk
@@ -0,0 +1,47 @@
+# Copyright (C) 2016 Linaro, Ltd, Rob Herring 
+#
+# Permission is hereby granted, free of charge, to any person obtaining a
+# copy of this software and associated documentation files (the "Software"),
+# to deal in the Software without restriction, including without limitation
+# the rights to use, copy, modify, merge, publish, distribute, sublicense,
+# and/or sell copies of the Software, and to permit persons to whom the
+# Software is furnished to do so, subject to the following conditions:
+#
+# The above copyright notice and this permission notice shall be included
+# in all copies or substantial portions of the Software.
+#
+# THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
+# IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
+# FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.  IN NO EVENT SHALL
+# THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
+# LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
+# FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER
+# DEALINGS IN THE SOFTWARE.
+
+LOCAL_PATH := $(call my-dir)
+
+# get C_SOURCES
+include $(LOCAL_PATH)/Makefile.sources
+
+include $(CLEAR_VARS)
+
+LOCAL_SRC_FILES := \
+   $(C_SOURCES)
+
+LOCAL_C_INCLUDES := \
+   $(LOCAL_PATH)/hw
+

Re: [Mesa-dev] egl/android: fence_fd being forced to -1

2017-06-15 Thread Tapani Pälli

On 06/15/2017 07:57 PM, Rob Clark wrote:

On Thu, Jun 15, 2017 at 12:04 PM, Tapani Pälli <tapani.pa...@intel.com> wrote:

On 06/15/2017 06:52 PM, Rob Clark wrote:

On Thu, Jun 15, 2017 at 9:59 AM, Eric Engestrom
<eric.engest...@imgtec.com> wrote:

On Thursday, 2017-06-15 13:27:06 +, Marathe, Yogesh wrote:

Hello,

I'm tyring to run flatland native app on android. It apparantly fails
because of a fence issue.
while debuging further it is observed that droid_window_enqueue_buffer()
is forcing
fence_fd =-1.

Yogesh, can you describe a bit more what "fails" means?  What sequence
of gl calls, for example, is it making?



The problem described shortly: Flatland uses timestamps from Fence objects
for calculating time (using getSignalTime API) and in case of having -1 from
producer (Mesa) we will end up having same timestamp for startFence and
endFence (since both are Fence::NO_FENCE) and thus flatland will keep
running forever as it thinks no time has been passed between 2 fences. It is
stuck in a loop where it tries to find how many frames are required so that
driver will spend certain amount of time doing it.


hmm, any idea what the getSignalTime() API sits on top of?  I don't
think we have such a capability with fence fd's..


I don't know much of libsync but it uses libsync functions 
'sync_fence_info' and 'sync_pt_info' to retrieve data from fence fd.



BR,
-R



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


Re: [Mesa-dev] egl/android: fence_fd being forced to -1

2017-06-15 Thread Tapani Pälli

On 06/15/2017 06:52 PM, Rob Clark wrote:

On Thu, Jun 15, 2017 at 9:59 AM, Eric Engestrom
 wrote:

On Thursday, 2017-06-15 13:27:06 +, Marathe, Yogesh wrote:

Hello,

I'm tyring to run flatland native app on android. It apparantly fails because 
of a fence issue.
while debuging further it is observed that droid_window_enqueue_buffer() is 
forcing
fence_fd =-1.

Yogesh, can you describe a bit more what "fails" means?  What sequence
of gl calls, for example, is it making?



The problem described shortly: Flatland uses timestamps from Fence 
objects for calculating time (using getSignalTime API) and in case of 
having -1 from producer (Mesa) we will end up having same timestamp for 
startFence and endFence (since both are Fence::NO_FENCE) and thus 
flatland will keep running forever as it thinks no time has been passed 
between 2 fences. It is stuck in a loop where it tries to find how many 
frames are required so that driver will spend certain amount of time 
doing it.


So it uses Android framework classes and makes the assumption that fence 
with a timestamp will be there. I believe we should be inserting a fence 
after current commands in the batchbuffer at that point and then 
returning that fence but so far my attempts have not really worked out 
well :/






I assume you've read the comment on the line above the one you mentioned?

/* Queue the buffer without a sync fence. This informs the ANativeWindow
 * that it may access the buffer immediately.
 *
 * From ANativeWindow::dequeueBuffer:
 *
 *The fenceFd argument specifies a libsync fence file descriptor for
 *a fence that must signal before the buffer can be accessed.  If
 *the buffer can be accessed immediately then a value of -1 should
 *be used.  The caller must not use the file descriptor after it
 *is passed to queueBuffer, and the ANativeWindow implementation
 *is responsible for closing it.
 */
int fence_fd = -1;
dri2_surf->window->queueBuffer(dri2_surf->window, dri2_surf->buffer,
   fence_fd);


Whats the expectation here if app wants to use fence sync?

If we want to have this native app working with the lib where exactly fence 
should be
created / populated, it should be with buffer producer, right?

I don't know this code personally, so I Cc'ed Chad, who wrote this code
in commit bfe28b8d93 (albeit 5 years ago, so he might not remember all
of it) and Tapani who reviewed it.

I suspect this code pre-dates fence-fd support in upstream kernel (and
mesa).. so it is probably relying on implicit sync.  I suspect we
might be wanting to create fence-fd's internally and passing them to
queueBuffer (for the subset of drivers that support fence fd's).
Although haven't really thought about the implementation much.

Are fence fd's exposed to the application at all in android?  IIRC the
android shim egl/gles layer was hiding that extension, so I *guess* it
is only meant to be used internally and not by applications.


Not exposed to applications, this is a framework level test.


BR,
-R
___
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/5] GL_OES_required_internalformat

2017-06-14 Thread Tapani Pälli

On 06/14/2017 01:12 AM, Eric Anholt wrote:

Tapani Pälli <tapani.pa...@intel.com> writes:


On 06/12/2017 09:52 AM, Tapani Pälli wrote:


On 05/18/2017 09:39 PM, Eric Anholt wrote:

Eric Anholt <e...@anholt.net> writes:


This series came out of fixing dEQP failures on vc4's GLES2 context.
Mesa was allowing RGB565 textures, which is only valid with
GL_OES_required_internalformat.  Rather than disable RGB565, I decided
the extension was easy enough to support.

I've sent one piglit test for renderbuffer sizing, and dEQP has tests
for whether enums get accepted for TexImage.

There's a functional question in patch #2, see the comment there, and
there's a question of whether the extension should be dummy_true in
patch #5.

branch: https://github.com/anholt/mesa/commits/required-internalformat

I would still love review on this series.


Earlier I took a brief look at series and run through our CI, there were
many failing tests but t seems I forgot to reply/report .. I'll run it
again and let you know what's the result.


'36 failures' (many likely duplicates of some same issue), these ones ..

ES3-CTS.functional.fbo.completeness.renderable.texture.stencil.rgb10.bdwm64
ES3-CTS.gtf.GL3Tests.packed_pixels.packed_pixels_pbo.bdwm64
ES3-CTS.gtf.GL3Tests.packed_pixels.packed_pixels_pixelstore.hswm64
ES3-CTS.functional.fbo.completeness.renderable.texture.stencil.rgb10.sklm64
ES3-CTS.gtf.GL3Tests.packed_pixels.packed_pixels_pbo.sklm64
ES3-CTS.functional.fbo.completeness.renderable.texture.depth.rgb10.bdwm64
ES3-CTS.gtf.GL3Tests.packed_pixels.packed_pixels_pixelstore.bdwm64
ES3-CTS.gtf.GL3Tests.packed_pixels.packed_pixels.hswm64
ES3-CTS.gtf.GL3Tests.packed_pixels.packed_pixels_pixelstore.sklm64
ES3-CTS.functional.fbo.completeness.renderable.texture.color0.rgb10.hswm64
ES3-CTS.functional.fbo.completeness.renderable.texture.depth.rgb10.hswm64
ES3-CTS.functional.fbo.completeness.renderable.texture.stencil.rgb10.hswm64
ES3-CTS.gtf.GL3Tests.packed_pixels.packed_pixels_pbo.hswm64
ES3-CTS.functional.fbo.completeness.renderable.texture.color0.rgb10.bdwm64
ES3-CTS.gtf.GL3Tests.packed_pixels.packed_pixels.bdwm64
ES3-CTS.functional.fbo.completeness.renderable.texture.depth.rgb10.sklm64
ES3-CTS.functional.fbo.completeness.renderable.texture.color0.rgb10.sklm64
ES3-CTS.gtf.GL3Tests.packed_pixels.packed_pixels.sklm64
ES2-CTS.functional.fbo.completeness.renderable.texture.depth.rgb10.bdwm64
ES2-CTS.functional.fbo.completeness.renderable.texture.depth.rgb10.sklm64
ES2-CTS.functional.fbo.completeness.renderable.texture.stencil.rgb10.bdwm64
ES2-CTS.functional.fbo.completeness.renderable.texture.depth.rgb10.hswm64
ES2-CTS.functional.fbo.completeness.renderable.texture.stencil.rgb10.hswm64
ES2-CTS.functional.fbo.completeness.renderable.texture.stencil.rgb10.sklm64

piglit.spec.oes_texture_float.oes_texture_float half.g965m64
piglit.spec.oes_texture_float.oes_texture_float.g965m64
piglit.spec.oes_texture_float.oes_texture_float half linear.g965m64
piglit.spec.oes_texture_float.oes_texture_float linear.g965m64
piglit.spec.oes_texture_float.oes_texture_float half.g45m64
piglit.spec.oes_texture_float.oes_texture_float half linear.g45m64
piglit.spec.oes_texture_float.oes_texture_float linear.g45m64
piglit.spec.oes_texture_float.oes_texture_float.g45m64
piglit.spec.oes_texture_float.oes_texture_float.ilkm64
piglit.spec.oes_texture_float.oes_texture_float half linear.ilkm64
piglit.spec.oes_texture_float.oes_texture_float half.ilkm64
piglit.spec.oes_texture_float.oes_texture_float linear.ilkm64

Are you able to reproduce/run these tests on some machine?

I have a SKL desktop, so I reproduced the GLES2 rgb10 failure and fixed
it, and I think I've fixed the pre-snb failures in piglit.  New branch
up at https://github.com/anholt/mesa/commits/required-internalformat
which I'll piglit now.



OK, seems the packed_pixels ones are still failing. I'll try to debug 
this a bit to see what's going on.


// Tapani

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


Re: [Mesa-dev] [PATCH mesa 0/2] egl: wire up swap_with_damage() and enable it on Android

2017-06-13 Thread Tapani Pälli



On 06/12/2017 04:30 PM, Eric Engestrom wrote:

On Monday, 2017-06-12 09:39:15 +0300, Tapani Pälli wrote:

Hi Eric;

EGL_KHR_swap_buffers_with_damage is implemented by Android's EGL wrapper
library so these tests are passing already, no implementation required in
Mesa side.


Right, I keep forgetting that android intercepts some stuff and lets the
rest through to mesa.
So 2/2 is unnecessary, but should we still land 1/2?

At worst, it's an unnecessary call to a `return false` function, and at
best it sets the correct damage before swapping.

There's an alternative "worst", which would be a platform on which
swap_buffers_with_damage != set_damage_region + swap_buffers,
but on such a platform the fallback shouldn't be used anyway, so using
it would be the bug.

What do you think?



Sure, I'm OK going ahead with patch 1 (r-b)!

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


Re: [Mesa-dev] [PATCH 0/5] GL_OES_required_internalformat

2017-06-12 Thread Tapani Pälli


On 06/12/2017 09:52 AM, Tapani Pälli wrote:



On 05/18/2017 09:39 PM, Eric Anholt wrote:

Eric Anholt <e...@anholt.net> writes:


This series came out of fixing dEQP failures on vc4's GLES2 context.
Mesa was allowing RGB565 textures, which is only valid with
GL_OES_required_internalformat.  Rather than disable RGB565, I decided
the extension was easy enough to support.

I've sent one piglit test for renderbuffer sizing, and dEQP has tests
for whether enums get accepted for TexImage.

There's a functional question in patch #2, see the comment there, and
there's a question of whether the extension should be dummy_true in
patch #5.

branch: https://github.com/anholt/mesa/commits/required-internalformat


I would still love review on this series.



Earlier I took a brief look at series and run through our CI, there were 
many failing tests but t seems I forgot to reply/report .. I'll run it 
again and let you know what's the result.




'36 failures' (many likely duplicates of some same issue), these ones ..

ES3-CTS.functional.fbo.completeness.renderable.texture.stencil.rgb10.bdwm64
ES3-CTS.gtf.GL3Tests.packed_pixels.packed_pixels_pbo.bdwm64
ES3-CTS.gtf.GL3Tests.packed_pixels.packed_pixels_pixelstore.hswm64
ES3-CTS.functional.fbo.completeness.renderable.texture.stencil.rgb10.sklm64
ES3-CTS.gtf.GL3Tests.packed_pixels.packed_pixels_pbo.sklm64
ES3-CTS.functional.fbo.completeness.renderable.texture.depth.rgb10.bdwm64
ES3-CTS.gtf.GL3Tests.packed_pixels.packed_pixels_pixelstore.bdwm64
ES3-CTS.gtf.GL3Tests.packed_pixels.packed_pixels.hswm64
ES3-CTS.gtf.GL3Tests.packed_pixels.packed_pixels_pixelstore.sklm64
ES3-CTS.functional.fbo.completeness.renderable.texture.color0.rgb10.hswm64
ES3-CTS.functional.fbo.completeness.renderable.texture.depth.rgb10.hswm64
ES3-CTS.functional.fbo.completeness.renderable.texture.stencil.rgb10.hswm64
ES3-CTS.gtf.GL3Tests.packed_pixels.packed_pixels_pbo.hswm64
ES3-CTS.functional.fbo.completeness.renderable.texture.color0.rgb10.bdwm64
ES3-CTS.gtf.GL3Tests.packed_pixels.packed_pixels.bdwm64
ES3-CTS.functional.fbo.completeness.renderable.texture.depth.rgb10.sklm64
ES3-CTS.functional.fbo.completeness.renderable.texture.color0.rgb10.sklm64
ES3-CTS.gtf.GL3Tests.packed_pixels.packed_pixels.sklm64
ES2-CTS.functional.fbo.completeness.renderable.texture.depth.rgb10.bdwm64
ES2-CTS.functional.fbo.completeness.renderable.texture.depth.rgb10.sklm64
ES2-CTS.functional.fbo.completeness.renderable.texture.stencil.rgb10.bdwm64
ES2-CTS.functional.fbo.completeness.renderable.texture.depth.rgb10.hswm64
ES2-CTS.functional.fbo.completeness.renderable.texture.stencil.rgb10.hswm64
ES2-CTS.functional.fbo.completeness.renderable.texture.stencil.rgb10.sklm64

piglit.spec.oes_texture_float.oes_texture_float half.g965m64
piglit.spec.oes_texture_float.oes_texture_float.g965m64
piglit.spec.oes_texture_float.oes_texture_float half linear.g965m64
piglit.spec.oes_texture_float.oes_texture_float linear.g965m64
piglit.spec.oes_texture_float.oes_texture_float half.g45m64
piglit.spec.oes_texture_float.oes_texture_float half linear.g45m64
piglit.spec.oes_texture_float.oes_texture_float linear.g45m64
piglit.spec.oes_texture_float.oes_texture_float.g45m64
piglit.spec.oes_texture_float.oes_texture_float.ilkm64
piglit.spec.oes_texture_float.oes_texture_float half linear.ilkm64
piglit.spec.oes_texture_float.oes_texture_float half.ilkm64
piglit.spec.oes_texture_float.oes_texture_float linear.ilkm64

Are you able to reproduce/run these tests on some machine?

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


Re: [Mesa-dev] [PATCH 0/5] GL_OES_required_internalformat

2017-06-12 Thread Tapani Pälli



On 05/18/2017 09:39 PM, Eric Anholt wrote:

Eric Anholt  writes:


This series came out of fixing dEQP failures on vc4's GLES2 context.
Mesa was allowing RGB565 textures, which is only valid with
GL_OES_required_internalformat.  Rather than disable RGB565, I decided
the extension was easy enough to support.

I've sent one piglit test for renderbuffer sizing, and dEQP has tests
for whether enums get accepted for TexImage.

There's a functional question in patch #2, see the comment there, and
there's a question of whether the extension should be dummy_true in
patch #5.

branch: https://github.com/anholt/mesa/commits/required-internalformat


I would still love review on this series.



Earlier I took a brief look at series and run through our CI, there were 
many failing tests but t seems I forgot to reply/report .. I'll run it 
again and let you know what's the result.


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


Re: [Mesa-dev] [PATCH mesa 0/2] egl: wire up swap_with_damage() and enable it on Android

2017-06-12 Thread Tapani Pälli

Hi Eric;

EGL_KHR_swap_buffers_with_damage is implemented by Android's EGL wrapper 
library so these tests are passing already, no implementation required 
in Mesa side.


Thanks;

On 06/12/2017 01:09 AM, Eric Engestrom wrote:

This is completely untested, as I don't have access to an Android
test device, which is the only platform that can benefit from this
improvement so far.

Can someone run dEQP-EGL.functional.swap_buffers_with_damage.*
on Android for me?

Cheers,
   Eric

---

Eric Engestrom (2):
   egl: improve dri2_fallback_swap_buffers_with_damage()
   egl/android: enable EGL_EXT_swap_buffers_with_damage

  src/egl/drivers/dri2/egl_dri2_fallbacks.h | 1 +
  src/egl/drivers/dri2/platform_android.c   | 1 +
  2 files changed, 2 insertions(+)


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


Re: [Mesa-dev] [PATCH] i965: Call intel_prepare_render() from intel_update_state()

2017-06-11 Thread Tapani Pälli

This fixes also the crashes seen on Android;

Tested-by: Tapani Pälli <tapani.pa...@intel.com>

On 06/10/2017 12:11 AM, Kenneth Graunke wrote:

The resolve code looks at the current color draw buffers.  These are not
valid until intel_prepare_render() is called.  You can end up with one
color buffer bound, but where the renderbuffer has zero width/height and
no miptree allocated.

You can get a call chain like: _mesa_Clear -> _mesa_update_state ->
intel_update_state, where no brw driver hooks were called, so there is
no other point at which we could have called this.

Fixes crashes in KWin where Clear was causing intel_disable_rb_aux_buffer
to crash on irb != NULL but irb->mt == NULL.

Tested-by: Tobias Klausmann <tobias.johannes.klausm...@mni.thm.de>
Cc: Jason Ekstrand <ja...@jlekstrand.net>
---
  src/mesa/drivers/dri/i965/brw_context.c | 2 ++
  1 file changed, 2 insertions(+)

diff --git a/src/mesa/drivers/dri/i965/brw_context.c 
b/src/mesa/drivers/dri/i965/brw_context.c
index 6d27866fcea..5433f9080ee 100644
--- a/src/mesa/drivers/dri/i965/brw_context.c
+++ b/src/mesa/drivers/dri/i965/brw_context.c
@@ -201,6 +201,8 @@ intel_update_state(struct gl_context * ctx)
  
 _mesa_unlock_context_textures(ctx);
  
+   intel_prepare_render(brw);

+
 /* Resolve the depth buffer's HiZ buffer. */
 depth_irb = intel_get_renderbuffer(ctx->DrawBuffer, BUFFER_DEPTH);
 if (depth_irb && depth_irb->mt) {


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


Re: [Mesa-dev] [RFC 3/3] egl: remove EGL_NOK_swap_region

2017-06-09 Thread Tapani Pälli



On 06/05/2017 03:21 PM, Emil Velikov wrote:

On 5 June 2017 at 09:32, Tapani Pälli <tapani.pa...@intel.com> wrote:



On 06/05/2017 02:52 AM, Emil Velikov wrote:


From: Emil Velikov <emil.veli...@collabora.com>

Analogous to previous commit - only one platform (of 6?) implements
this, and there's no implementations seen in the wild that use this.

Hmm the extension isn't even available anywhere :-\



There is EGL_NOK_swap_region2, it seems that Qt is the only user for this
which makes sense as it was built for Maemo/Meego. Not sure how actively
this is utilized in today's Qt apps/desktops?


Indeed most NOK extensions are from the Maemo/Meego days and are
(were?) used around Qt.

Currently neither extension (or any Nokia one fwiw) is used by Qt
4.8.7 or 5.8.0 itself. Perhaps the biggest Qt user - KDE does not seem
to use them either.
Disclaimer: I've only checked the latest supported binaries - KDE Apps
17.04.1 and KDE Plasma 5.10.0, I haven't gone through the dozens of
git repos.



Right, I'm fine removing it as there are now modern alternatives to it.

Acked-by: Tapani Pälli <tapani.pa...@intel.com>

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


Re: [Mesa-dev] [PATCH 0/6] i965: Add RGBX, RGBA configs, even on gen9

2017-06-09 Thread Tapani Pälli



On 06/08/2017 09:27 PM, Chad Versace wrote:

On Thu 08 Jun 2017, Tomasz Figa wrote:

On Thu, Jun 8, 2017 at 4:08 PM, Tapani Pälli <tapani.pa...@intel.com> wrote:


On 06/08/2017 09:36 AM, Tapani Pälli wrote:




On 06/08/2017 06:05 AM, Tomasz Figa wrote:


On Wed, Jun 7, 2017 at 5:36 AM, Chad Versace <chadvers...@chromium.org>
wrote:


More patches to break your formats... again ;)

The Android framework requires support for EGLConfigs with
HAL_PIXEL_FORMAT_RGBX_ and HAL_PIXEL_FORMAT_RGBA_. This prevents
Chrome OS from updating its Android drivers, because earlier this year
Intel disabled all rgbx formats for gen >=9 in brw_surface_formats.c.
This patch series safely (hopefully?) fixes that problem.

If you want the meat, read patches 2 and 6.

Chad Versace (6):
mesa: Add _mesa_format_fallback_rgba_to_rgbx()
i965: Add a RGBX->RGBA fallback for glEGLImageTextureTarget2D()
i965: Rename some vague format members of brw_context
i965/dri: Add intel_screen param to intel_create_winsys_renderbuffer
i965: Move brw_context format arrays to intel_screen
i965/dri: Support R8G8B8A8 and R8G8B8X8 configs



Thanks a lot Chad!

Just to make sure, did you have a chance to test it with X11 apps,
that were reported to have incorrect colors last time we tried
enabling these formats? I.e.
https://bugs.freedesktop.org/show_bug.cgi?id=95071


tfiga, I only tested with glxgears. To be safe, I'll also test the KDE
apps in that bug report and reply back with the results.


I just tested this set on Android and I'm getting wrong colors with this,
red and blue swapped.


Uh oh.

I did something dumb. When testing this on ARC++, I chose
a BLACK-AND-WHITE game! I'll retest with a color game.


It was pretty hard to keep coffee in mouth when reading this comment.


https://play.google.com/store/apps/details?id=com.ZephirothGames.AsteroidStormFREE=en


I can 'fix' this by reordering the configs in intel_screen_make_configs so
that the new configs (RGBA, RGBX) required by Android are before the old
ones (BGRA, BGRX).


I think that would have exactly the opposite effect on the X11 apps I
mentioned before. In my testing, they were sensitive to the order of
configs, due to component bit masks not being considered in selection,
only bit depths.


Yes.


However, for Android, I thought EGL already used bit masks, so
possibly there is still an unrelated bug somewhere.


Android certainly inspects the channel masks, using dri2_add_config().
So I'm also curious why Tapani sees swapped channels. The
platform_android.c is patched with format hacks, and I assume the same
is true for android-ia. Maybe the hacks are intefering somehow. I'll
investigate.


We shouldn't have related 'hacks', but here are some changes that might 
be interesting or somehow related:


add EGL_ALPHA_SIZE attrib:

https://github.com/android-ia/frameworks-native/commit/8237c9f8eb36d4f9ead40c8cb4a68ae9518d3c9f

sorting display configs:

https://github.com/android-ia/frameworks-native/pull/2/commits/bb29af0777e747effacd239565f52aad96c45558

visuals being added:

https://github.com/android-ia/external-mesa/commit/ceac31ff7e53ec5034bc379d37ce365c000e9e4a


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


Re: [Mesa-dev] [PATCH v4] egl/android: support for EGL_KHR_partial_update

2017-06-09 Thread Tapani Pälli

With the suggestions from Emil and Eric, this is:

Reviewed-by: Tapani Pälli <tapani.pa...@intel.com>

On 06/07/2017 07:11 PM, Harish Krupo wrote:

This patch adds support for the EGL_KHR_partial_update extension for
android platform. It passes 36/37 tests in dEQP for EGL_KHR_partial_update.
1 test not supported.

v2: add fallback for eglSetDamageRegionKHR (Tapani)

v3: The native_window_set_surface_damage call is available only from
 Android version 6.0. Reintroduce the ANDROID_VERSION guard and
 advertise extension only if version is >= 6.0. (Emil Velikov)

v4: use newly introduced ANDROID_API_LEVEL guard rather than
 ANDROID_VERSION guard to advertise the extension.The extension
 is advertised only if ANDROID_API_LEVEL >= 23 (Android 6.0 or
 greater). Add fallback function for platforms other than Android.
 Fix possible math overflow. (Emil Velikov)
 Return immediately when n_rects is 0. Place function's entrypoint
 in alphabetical order. (Eric Engestrom)

Signed-off-by: Harish Krupo <harish.krupo@intel.com>
---
  src/egl/drivers/dri2/egl_dri2.c |  9 
  src/egl/drivers/dri2/egl_dri2.h |  4 ++
  src/egl/drivers/dri2/egl_dri2_fallbacks.h   |  8 +++
  src/egl/drivers/dri2/platform_android.c | 41 ++
  src/egl/drivers/dri2/platform_drm.c |  1 +
  src/egl/drivers/dri2/platform_surfaceless.c |  1 +
  src/egl/drivers/dri2/platform_wayland.c |  1 +
  src/egl/drivers/dri2/platform_x11.c |  2 +
  src/egl/drivers/dri2/platform_x11_dri3.c|  1 +
  src/egl/main/eglapi.c   | 83 +
  src/egl/main/eglapi.h   |  2 +
  src/egl/main/egldisplay.h   |  1 +
  src/egl/main/eglentrypoint.h|  1 +
  src/egl/main/eglfallbacks.c |  1 +
  src/egl/main/eglsurface.c   |  9 
  src/egl/main/eglsurface.h   | 12 +
  16 files changed, 177 insertions(+)

diff --git a/src/egl/drivers/dri2/egl_dri2.c b/src/egl/drivers/dri2/egl_dri2.c
index d31a0bf8e0..a1d72166df 100644
--- a/src/egl/drivers/dri2/egl_dri2.c
+++ b/src/egl/drivers/dri2/egl_dri2.c
@@ -1512,6 +1512,14 @@ dri2_swap_buffers_region(_EGLDriver *drv, _EGLDisplay 
*dpy, _EGLSurface *surf,
  }
  
  static EGLBoolean

+dri2_set_damage_region(_EGLDriver *drv, _EGLDisplay *dpy, _EGLSurface *surf,
+   EGLint *rects, EGLint n_rects)
+{
+   struct dri2_egl_display *dri2_dpy = dri2_egl_display(dpy);
+   return dri2_dpy->vtbl->set_damage_region(drv, dpy, surf, rects, n_rects);
+}
+
+static EGLBoolean
  dri2_post_sub_buffer(_EGLDriver *drv, _EGLDisplay *dpy, _EGLSurface *surf,
   EGLint x, EGLint y, EGLint width, EGLint height)
  {
@@ -3141,6 +3149,7 @@ _eglBuiltInDriverDRI2(const char *args)
 dri2_drv->base.API.SwapBuffers = dri2_swap_buffers;
 dri2_drv->base.API.SwapBuffersWithDamageEXT = 
dri2_swap_buffers_with_damage;
 dri2_drv->base.API.SwapBuffersRegionNOK = dri2_swap_buffers_region;
+   dri2_drv->base.API.SetDamageRegion = dri2_set_damage_region;
 dri2_drv->base.API.PostSubBufferNV = dri2_post_sub_buffer;
 dri2_drv->base.API.CopyBuffers = dri2_copy_buffers,
 dri2_drv->base.API.QueryBufferAge = dri2_query_buffer_age;
diff --git a/src/egl/drivers/dri2/egl_dri2.h b/src/egl/drivers/dri2/egl_dri2.h
index 449016093a..ba7a7be57b 100644
--- a/src/egl/drivers/dri2/egl_dri2.h
+++ b/src/egl/drivers/dri2/egl_dri2.h
@@ -118,6 +118,10 @@ struct dri2_egl_display_vtbl {
_EGLSurface *surface,
const EGLint *rects, EGLint 
n_rects);
  
+   EGLBoolean (*set_damage_region)(_EGLDriver *drv, _EGLDisplay *dpy,

+   _EGLSurface *surface,
+   const EGLint *rects, EGLint n_rects);
+
 EGLBoolean (*swap_buffers_region)(_EGLDriver *drv, _EGLDisplay *dpy,
   _EGLSurface *surf, EGLint numRects,
   const EGLint *rects);
diff --git a/src/egl/drivers/dri2/egl_dri2_fallbacks.h 
b/src/egl/drivers/dri2/egl_dri2_fallbacks.h
index 67a9c5034a..d8363c9bdd 100644
--- a/src/egl/drivers/dri2/egl_dri2_fallbacks.h
+++ b/src/egl/drivers/dri2/egl_dri2_fallbacks.h
@@ -95,6 +95,14 @@ dri2_fallback_copy_buffers(_EGLDriver *drv, _EGLDisplay *dpy,
 return EGL_FALSE;
  }
  
+static inline EGLBoolean

+dri2_fallback_set_damage_region(_EGLDriver *drv, _EGLDisplay *dpy,
+_EGLSurface *surf,
+const EGLint *rects, EGLint n_rects)
+{
+   return EGL_FALSE;
+}
+
  static inline EGLint
  dri2_fallback_query_buffer_age(_EGLDriver *drv, _EGLDisplay *dpy,
 _EGLSurface *surf)
diff --git a/src/egl/drivers/dri2/platform_android.c 
b/src/egl/drivers/dri2/platform_android.c

Re: [Mesa-dev] [PATCH v4] egl/android: support for EGL_KHR_partial_update

2017-06-09 Thread Tapani Pälli



On 06/08/2017 04:53 PM, Emil Velikov wrote:

Hi all,

On 8 June 2017 at 13:06, Harish Krupo <harish.krupo@intel.com> wrote:

Hi Tapani,


On 06/08/2017 04:32 PM, Tapani Pälli wrote:


Harish, please find small addition below.

I noticed we still have one crasher in tests when this extension is
enabled, it's related to buffer age so I've sent a fix separately here:

https://lists.freedesktop.org/archives/mesa-dev/2017-June/158391.html

On 06/07/2017 07:11 PM, Harish Krupo wrote:


This patch adds support for the EGL_KHR_partial_update extension for
android platform. It passes 36/37 tests in dEQP for
EGL_KHR_partial_update.
1 test not supported.

v2: add fallback for eglSetDamageRegionKHR (Tapani)

v3: The native_window_set_surface_damage call is available only from
  Android version 6.0. Reintroduce the ANDROID_VERSION guard and
  advertise extension only if version is >= 6.0. (Emil Velikov)

v4: use newly introduced ANDROID_API_LEVEL guard rather than
  ANDROID_VERSION guard to advertise the extension.The extension
  is advertised only if ANDROID_API_LEVEL >= 23 (Android 6.0 or
  greater). Add fallback function for platforms other than Android.
  Fix possible math overflow. (Emil Velikov)
  Return immediately when n_rects is 0. Place function's entrypoint
  in alphabetical order. (Eric Engestrom)

Signed-off-by: Harish Krupo <harish.krupo@intel.com>
---
   src/egl/drivers/dri2/egl_dri2.c |  9 
   src/egl/drivers/dri2/egl_dri2.h |  4 ++
   src/egl/drivers/dri2/egl_dri2_fallbacks.h   |  8 +++
   src/egl/drivers/dri2/platform_android.c | 41 ++
   src/egl/drivers/dri2/platform_drm.c |  1 +
   src/egl/drivers/dri2/platform_surfaceless.c |  1 +
   src/egl/drivers/dri2/platform_wayland.c |  1 +
   src/egl/drivers/dri2/platform_x11.c |  2 +
   src/egl/drivers/dri2/platform_x11_dri3.c|  1 +
   src/egl/main/eglapi.c   | 83
+
   src/egl/main/eglapi.h   |  2 +
   src/egl/main/egldisplay.h   |  1 +
   src/egl/main/eglentrypoint.h|  1 +
   src/egl/main/eglfallbacks.c |  1 +
   src/egl/main/eglsurface.c   |  9 
   src/egl/main/eglsurface.h   | 12 +
   16 files changed, 177 insertions(+)

diff --git a/src/egl/drivers/dri2/egl_dri2.c
b/src/egl/drivers/dri2/egl_dri2.c
index d31a0bf8e0..a1d72166df 100644
--- a/src/egl/drivers/dri2/egl_dri2.c
+++ b/src/egl/drivers/dri2/egl_dri2.c
@@ -1512,6 +1512,14 @@ dri2_swap_buffers_region(_EGLDriver *drv,
_EGLDisplay *dpy, _EGLSurface *surf,
   }
   static EGLBoolean
+dri2_set_damage_region(_EGLDriver *drv, _EGLDisplay *dpy, _EGLSurface
*surf,
+   EGLint *rects, EGLint n_rects)
+{
+   struct dri2_egl_display *dri2_dpy = dri2_egl_display(dpy);
+   return dri2_dpy->vtbl->set_damage_region(drv, dpy, surf, rects,
n_rects);
+}
+
+static EGLBoolean
   dri2_post_sub_buffer(_EGLDriver *drv, _EGLDisplay *dpy, _EGLSurface
*surf,
EGLint x, EGLint y, EGLint width, EGLint height)
   {
@@ -3141,6 +3149,7 @@ _eglBuiltInDriverDRI2(const char *args)
  dri2_drv->base.API.SwapBuffers = dri2_swap_buffers;
  dri2_drv->base.API.SwapBuffersWithDamageEXT =
dri2_swap_buffers_with_damage;
  dri2_drv->base.API.SwapBuffersRegionNOK = dri2_swap_buffers_region;
+   dri2_drv->base.API.SetDamageRegion = dri2_set_damage_region;
  dri2_drv->base.API.PostSubBufferNV = dri2_post_sub_buffer;
  dri2_drv->base.API.CopyBuffers = dri2_copy_buffers,
  dri2_drv->base.API.QueryBufferAge = dri2_query_buffer_age;
diff --git a/src/egl/drivers/dri2/egl_dri2.h
b/src/egl/drivers/dri2/egl_dri2.h
index 449016093a..ba7a7be57b 100644
--- a/src/egl/drivers/dri2/egl_dri2.h
+++ b/src/egl/drivers/dri2/egl_dri2.h
@@ -118,6 +118,10 @@ struct dri2_egl_display_vtbl {
 _EGLSurface *surface,
 const EGLint *rects, EGLint
n_rects);
+   EGLBoolean (*set_damage_region)(_EGLDriver *drv, _EGLDisplay *dpy,
+   _EGLSurface *surface,
+   const EGLint *rects, EGLint n_rects);
+
  EGLBoolean (*swap_buffers_region)(_EGLDriver *drv, _EGLDisplay *dpy,
_EGLSurface *surf, EGLint
numRects,
const EGLint *rects);
diff --git a/src/egl/drivers/dri2/egl_dri2_fallbacks.h
b/src/egl/drivers/dri2/egl_dri2_fallbacks.h
index 67a9c5034a..d8363c9bdd 100644
--- a/src/egl/drivers/dri2/egl_dri2_fallbacks.h
+++ b/src/egl/drivers/dri2/egl_dri2_fallbacks.h
@@ -95,6 +95,14 @@ dri2_fallback_copy_buffers(_EGLDriver *drv,
_EGLDisplay *dpy,
  return EGL_FALSE;
   }
+static inline EGLBoolean
+dri2_fallback_set_damage_region(_EGLDriver *drv, _EGLDisplay *dpy,
+

Re: [Mesa-dev] [PATCH] egl: fix _eglQuerySurface in EGL_BUFFER_AGE_EXT case

2017-06-08 Thread Tapani Pälli



On 06/08/2017 06:01 PM, Emil Velikov wrote:

On 8 June 2017 at 11:10, Tapani Pälli <tapani.pa...@intel.com> wrote:

Specification states that in case of error, value should not be
written, patch changes buffer age queries to return -1 in case of
error so that we can skip changing the value.

In addition, small change to droid_query_buffer_age to return 0
in case buffer does not have a back buffer available.

Fixes:
dEQP-EGL.functional.negative_partial_update.not_postable_surface


Great find Tapani. Please don't forget the stable tag.

Cc: mesa-sta...@lists.freedesktop.org


Signed-off-by: Tapani Pälli <tapani.pa...@intel.com>
---
  src/egl/drivers/dri2/platform_android.c | 4 ++--
  src/egl/drivers/dri2/platform_drm.c | 2 +-
  src/egl/main/eglsurface.c   | 6 +-
  3 files changed, 8 insertions(+), 4 deletions(-)

diff --git a/src/egl/drivers/dri2/platform_android.c 
b/src/egl/drivers/dri2/platform_android.c
index 48ecb9f..4c97935 100644
--- a/src/egl/drivers/dri2/platform_android.c
+++ b/src/egl/drivers/dri2/platform_android.c
@@ -614,10 +614,10 @@ droid_query_buffer_age(_EGLDriver *drv,

 if (update_buffers(dri2_surf) < 0) {

Completely unrelated:

This combined with the following discrepancy might be the reason why
Android is special wrt get_back_bo()
On wayland/drm we have
- getBuffers{WithFormat,} (dri2/image respectively) -> misc -> get_back_bo
- swap_buffers -> age buffers -> get_back_bo -> pick unlocked (and
oldest for gbm) buffer -> create image -> init. age
- query_buffer_age -> get_back_bo -> return age

while on Android
- getBuffers{WithFormat,} (dri2/image respectively) -> misc ->
_missing_ get_back_bo from update_buffers()
- swap_buffers -> age buffers -> if we have back bo -> init. age
- query_buffer_age -> get_back_bo -> return age

Hence, things won't fly on Android if a query_buffer_age is not called
before swapbuffers.


_eglError(EGL_BAD_ALLOC, "droid_query_buffer_age");
-  return 0;
+  return -1;
 }

-   return dri2_surf->back->age;
+   return dri2_surf->back ? dri2_surf->back->age : 0;
  }

  static EGLBoolean
diff --git a/src/egl/drivers/dri2/platform_drm.c 
b/src/egl/drivers/dri2/platform_drm.c
index 2f04589..36c89fc 100644
--- a/src/egl/drivers/dri2/platform_drm.c
+++ b/src/egl/drivers/dri2/platform_drm.c
@@ -464,7 +464,7 @@ dri2_drm_query_buffer_age(_EGLDriver *drv,

 if (get_back_bo(dri2_surf) < 0) {
_eglError(EGL_BAD_ALLOC, "dri2_query_buffer_age");
-  return 0;
+  return -1;

dri2_wl_query_buffer_age() could use an identical fix.

Please either squash a wayland fix in (adding a note that x11 needs
similar fix) or split them up.


Oopsie yes, I'll add dri2_wl_query_buffer_age in the mix too, x11 will 
be a separate thing, I took a look at it and it is .. different.



In either case
Reviewed-by: Emil Velikov <emil.veli...@collabora.com>

Warning slight diversion incoming :-\

On platform_x11.c side similar fix is needed, but let's keep that separate.
Mostly since we need to update loader_dri3_query_buffer_age() as well
as libGLX :-\
... Not to mention there's some fun points around glXQueryDrawable.


Agreed, will take a look separately.


Spec states that the function returns "void", same as the XML file and
headers (Mesa, Khronos and Nvidia shipped ones). Yet nearly all
documentation pages [1] [2] [3] claim that "int" is returned.
An older man page [4] seems to be more accurate, yet the only correct
instance that I can find.

Might be worth checking with other vendors/Khronos and following from there.

Checking python-opengl - seems to be doing the right thing. So we
should be fine - barring that the manuals that need fixing ;-)

-Emil

[1] 
https://www.khronos.org/registry/OpenGL-Refpages/gl2.1/xhtml/glXQueryDrawable.xml
[2] 
http://pyopengl.sourceforge.net/documentation/manual-3.0/glXQueryDrawable.html
[3] http://code.nabla.net/doc/OpenGL/api/OpenGL/man/glXQueryDrawable.html
[4] http://nixdoc.net/man-pages/IRIX/man3/glxquerydrawable.3.html


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


Re: [Mesa-dev] [PATCH 22/30] i965: Move images to the new resolve functions

2017-06-08 Thread Tapani Pälli
FYI I bisected that starting from this commit (or maybe somewhere within 
this series) there are segfaults with systemui (using libhwui) in 
Android, it looks like below. Seems rather hard case to debug as it does 
not seem to always happen (!) but will try to figure out what is going 
wrong.


 8< 
01-01 00:00:43.607  2926  2959 F libc: Fatal signal 11 (SIGSEGV), 
code 1, fault addr 0x0 in tid 2959 (RenderThread)
01-01 00:00:43.608  1532  1532 W : debuggerd: handling request: 
pid=2926 uid=10013 gid=10013 tid=2959
01-01 00:00:43.667  2975  2975 F DEBUG   : *** *** *** *** *** *** *** 
*** *** *** *** *** *** *** *** ***
01-01 00:00:43.667  2975  2975 F DEBUG   : Build fingerprint: 
'AndroidIA/androidia_64/androidia_64:7.1.1/NMF26Q/tpalli06060923:eng/test-keys'

01-01 00:00:43.667  2975  2975 F DEBUG   : Revision: '0'
01-01 00:00:43.667  2975  2975 F DEBUG   : ABI: 'x86_64'
01-01 00:00:43.667  2975  2975 F DEBUG   : pid: 2926, tid: 2959, name: 
RenderThread  >>> com.android.systemui <<<
01-01 00:00:43.667  2975  2975 F DEBUG   : signal 11 (SIGSEGV), code 1 
(SEGV_MAPERR), fault addr 0x0
01-01 00:00:43.667  2975  2975 F DEBUG   : rax 70332c1ae400  rbx 
70332c13a070  rcx 0001  rdx 703329a27320
01-01 00:00:43.667  2975  2975 F DEBUG   : rsi   rdi 

01-01 00:00:43.667  2975  2975 F DEBUG   : r8    r9 
  r10 703349b2ab50  r11 0246
01-01 00:00:43.667  2975  2975 F DEBUG   : r12   r13 
70332d86ab1f  r14 70332c15f0d8  r15 0001
01-01 00:00:43.667  2975  2975 F DEBUG   : cs  0033  ss 
002b
01-01 00:00:43.667  2975  2975 F DEBUG   : rip 70332c32416f  rbp 
70332c1fb800  rsp 70332d86ab10  eflags 00010246

01-01 00:00:43.673  2975  2975 F DEBUG   :
01-01 00:00:43.673  2975  2975 F DEBUG   : backtrace:
01-01 00:00:43.673  2975  2975 F DEBUG   : #00 pc 0006616f 
/system/lib64/dri/i965_dri.so (intel_update_state+463)
01-01 00:00:43.673  2975  2975 F DEBUG   : #01 pc 0031e753 
/system/lib64/dri/i965_dri.so (_mesa_update_state_locked+1555)
01-01 00:00:43.673  2975  2975 F DEBUG   : #02 pc 0031e790 
/system/lib64/dri/i965_dri.so (_mesa_update_state+16)
01-01 00:00:43.673  2975  2975 F DEBUG   : #03 pc 0024577b 
/system/lib64/dri/i965_dri.so (_mesa_Clear+171)




On 05/27/2017 02:30 AM, Jason Ekstrand wrote:

---
  src/mesa/drivers/dri/i965/brw_context.c   | 9 +
  src/mesa/drivers/dri/i965/intel_mipmap_tree.c | 9 +
  src/mesa/drivers/dri/i965/intel_mipmap_tree.h | 3 +++
  3 files changed, 13 insertions(+), 8 deletions(-)

diff --git a/src/mesa/drivers/dri/i965/brw_context.c 
b/src/mesa/drivers/dri/i965/brw_context.c
index 671af42..ed57012 100644
--- a/src/mesa/drivers/dri/i965/brw_context.c
+++ b/src/mesa/drivers/dri/i965/brw_context.c
@@ -253,14 +253,7 @@ intel_update_state(struct gl_context * ctx, GLuint 
new_state)
  tex_obj = intel_texture_object(u->TexObj);
  
  if (tex_obj && tex_obj->mt) {

-   /* Access to images is implemented using indirect messages
-* against data port. Normal render target write understands
-* lossless compression but unfortunately the typed/untyped
-* read/write interface doesn't. Therefore even lossless
-* compressed surfaces need to be resolved prior to accessing
-* them. Hence skip setting INTEL_MIPTREE_IGNORE_CCS_E.
-*/
-   intel_miptree_all_slices_resolve_color(brw, tex_obj->mt, 0);
+   intel_miptree_prepare_image(brw, tex_obj->mt);
  
 if (intel_miptree_is_lossless_compressed(brw, tex_obj->mt) &&

 intel_disable_rb_aux_buffer(brw, tex_obj->mt->bo)) {
diff --git a/src/mesa/drivers/dri/i965/intel_mipmap_tree.c 
b/src/mesa/drivers/dri/i965/intel_mipmap_tree.c
index 76fe8b8..5739508 100644
--- a/src/mesa/drivers/dri/i965/intel_mipmap_tree.c
+++ b/src/mesa/drivers/dri/i965/intel_mipmap_tree.c
@@ -2439,6 +2439,15 @@ intel_miptree_prepare_texture(struct brw_context *brw,
  }
  
  void

+intel_miptree_prepare_image(struct brw_context *brw,
+struct intel_mipmap_tree *mt)
+{
+   /* The data port doesn't understand any compression */
+   intel_miptree_prepare_access(brw, mt, 0, INTEL_REMAINING_LEVELS,
+0, INTEL_REMAINING_LAYERS, false, false);
+}
+
+void
  intel_miptree_prepare_fb_fetch(struct brw_context *brw,
 struct intel_mipmap_tree *mt, uint32_t level,
 uint32_t start_layer, uint32_t num_layers)
diff --git a/src/mesa/drivers/dri/i965/intel_mipmap_tree.h 
b/src/mesa/drivers/dri/i965/intel_mipmap_tree.h
index 9ab9039..2136eff 100644
--- a/src/mesa/drivers/dri/i965/intel_mipmap_tree.h
+++ 

Re: [Mesa-dev] [PATCH v4] egl/android: support for EGL_KHR_partial_update

2017-06-08 Thread Tapani Pälli

Harish, please find small addition below.

I noticed we still have one crasher in tests when this extension is 
enabled, it's related to buffer age so I've sent a fix separately here:


https://lists.freedesktop.org/archives/mesa-dev/2017-June/158391.html

On 06/07/2017 07:11 PM, Harish Krupo wrote:

This patch adds support for the EGL_KHR_partial_update extension for
android platform. It passes 36/37 tests in dEQP for EGL_KHR_partial_update.
1 test not supported.

v2: add fallback for eglSetDamageRegionKHR (Tapani)

v3: The native_window_set_surface_damage call is available only from
 Android version 6.0. Reintroduce the ANDROID_VERSION guard and
 advertise extension only if version is >= 6.0. (Emil Velikov)

v4: use newly introduced ANDROID_API_LEVEL guard rather than
 ANDROID_VERSION guard to advertise the extension.The extension
 is advertised only if ANDROID_API_LEVEL >= 23 (Android 6.0 or
 greater). Add fallback function for platforms other than Android.
 Fix possible math overflow. (Emil Velikov)
 Return immediately when n_rects is 0. Place function's entrypoint
 in alphabetical order. (Eric Engestrom)

Signed-off-by: Harish Krupo 
---
  src/egl/drivers/dri2/egl_dri2.c |  9 
  src/egl/drivers/dri2/egl_dri2.h |  4 ++
  src/egl/drivers/dri2/egl_dri2_fallbacks.h   |  8 +++
  src/egl/drivers/dri2/platform_android.c | 41 ++
  src/egl/drivers/dri2/platform_drm.c |  1 +
  src/egl/drivers/dri2/platform_surfaceless.c |  1 +
  src/egl/drivers/dri2/platform_wayland.c |  1 +
  src/egl/drivers/dri2/platform_x11.c |  2 +
  src/egl/drivers/dri2/platform_x11_dri3.c|  1 +
  src/egl/main/eglapi.c   | 83 +
  src/egl/main/eglapi.h   |  2 +
  src/egl/main/egldisplay.h   |  1 +
  src/egl/main/eglentrypoint.h|  1 +
  src/egl/main/eglfallbacks.c |  1 +
  src/egl/main/eglsurface.c   |  9 
  src/egl/main/eglsurface.h   | 12 +
  16 files changed, 177 insertions(+)

diff --git a/src/egl/drivers/dri2/egl_dri2.c b/src/egl/drivers/dri2/egl_dri2.c
index d31a0bf8e0..a1d72166df 100644
--- a/src/egl/drivers/dri2/egl_dri2.c
+++ b/src/egl/drivers/dri2/egl_dri2.c
@@ -1512,6 +1512,14 @@ dri2_swap_buffers_region(_EGLDriver *drv, _EGLDisplay 
*dpy, _EGLSurface *surf,
  }
  
  static EGLBoolean

+dri2_set_damage_region(_EGLDriver *drv, _EGLDisplay *dpy, _EGLSurface *surf,
+   EGLint *rects, EGLint n_rects)
+{
+   struct dri2_egl_display *dri2_dpy = dri2_egl_display(dpy);
+   return dri2_dpy->vtbl->set_damage_region(drv, dpy, surf, rects, n_rects);
+}
+
+static EGLBoolean
  dri2_post_sub_buffer(_EGLDriver *drv, _EGLDisplay *dpy, _EGLSurface *surf,
   EGLint x, EGLint y, EGLint width, EGLint height)
  {
@@ -3141,6 +3149,7 @@ _eglBuiltInDriverDRI2(const char *args)
 dri2_drv->base.API.SwapBuffers = dri2_swap_buffers;
 dri2_drv->base.API.SwapBuffersWithDamageEXT = 
dri2_swap_buffers_with_damage;
 dri2_drv->base.API.SwapBuffersRegionNOK = dri2_swap_buffers_region;
+   dri2_drv->base.API.SetDamageRegion = dri2_set_damage_region;
 dri2_drv->base.API.PostSubBufferNV = dri2_post_sub_buffer;
 dri2_drv->base.API.CopyBuffers = dri2_copy_buffers,
 dri2_drv->base.API.QueryBufferAge = dri2_query_buffer_age;
diff --git a/src/egl/drivers/dri2/egl_dri2.h b/src/egl/drivers/dri2/egl_dri2.h
index 449016093a..ba7a7be57b 100644
--- a/src/egl/drivers/dri2/egl_dri2.h
+++ b/src/egl/drivers/dri2/egl_dri2.h
@@ -118,6 +118,10 @@ struct dri2_egl_display_vtbl {
_EGLSurface *surface,
const EGLint *rects, EGLint 
n_rects);
  
+   EGLBoolean (*set_damage_region)(_EGLDriver *drv, _EGLDisplay *dpy,

+   _EGLSurface *surface,
+   const EGLint *rects, EGLint n_rects);
+
 EGLBoolean (*swap_buffers_region)(_EGLDriver *drv, _EGLDisplay *dpy,
   _EGLSurface *surf, EGLint numRects,
   const EGLint *rects);
diff --git a/src/egl/drivers/dri2/egl_dri2_fallbacks.h 
b/src/egl/drivers/dri2/egl_dri2_fallbacks.h
index 67a9c5034a..d8363c9bdd 100644
--- a/src/egl/drivers/dri2/egl_dri2_fallbacks.h
+++ b/src/egl/drivers/dri2/egl_dri2_fallbacks.h
@@ -95,6 +95,14 @@ dri2_fallback_copy_buffers(_EGLDriver *drv, _EGLDisplay *dpy,
 return EGL_FALSE;
  }
  
+static inline EGLBoolean

+dri2_fallback_set_damage_region(_EGLDriver *drv, _EGLDisplay *dpy,
+_EGLSurface *surf,
+const EGLint *rects, EGLint n_rects)
+{
+   return EGL_FALSE;
+}
+
  static inline EGLint
  dri2_fallback_query_buffer_age(_EGLDriver *drv, _EGLDisplay *dpy,
 

[Mesa-dev] [PATCH] egl: fix _eglQuerySurface in EGL_BUFFER_AGE_EXT case

2017-06-08 Thread Tapani Pälli
Specification states that in case of error, value should not be
written, patch changes buffer age queries to return -1 in case of
error so that we can skip changing the value.

In addition, small change to droid_query_buffer_age to return 0
in case buffer does not have a back buffer available.

Fixes:
   dEQP-EGL.functional.negative_partial_update.not_postable_surface

Signed-off-by: Tapani Pälli <tapani.pa...@intel.com>
---
 src/egl/drivers/dri2/platform_android.c | 4 ++--
 src/egl/drivers/dri2/platform_drm.c | 2 +-
 src/egl/main/eglsurface.c   | 6 +-
 3 files changed, 8 insertions(+), 4 deletions(-)

diff --git a/src/egl/drivers/dri2/platform_android.c 
b/src/egl/drivers/dri2/platform_android.c
index 48ecb9f..4c97935 100644
--- a/src/egl/drivers/dri2/platform_android.c
+++ b/src/egl/drivers/dri2/platform_android.c
@@ -614,10 +614,10 @@ droid_query_buffer_age(_EGLDriver *drv,
 
if (update_buffers(dri2_surf) < 0) {
   _eglError(EGL_BAD_ALLOC, "droid_query_buffer_age");
-  return 0;
+  return -1;
}
 
-   return dri2_surf->back->age;
+   return dri2_surf->back ? dri2_surf->back->age : 0;
 }
 
 static EGLBoolean
diff --git a/src/egl/drivers/dri2/platform_drm.c 
b/src/egl/drivers/dri2/platform_drm.c
index 2f04589..36c89fc 100644
--- a/src/egl/drivers/dri2/platform_drm.c
+++ b/src/egl/drivers/dri2/platform_drm.c
@@ -464,7 +464,7 @@ dri2_drm_query_buffer_age(_EGLDriver *drv,
 
if (get_back_bo(dri2_surf) < 0) {
   _eglError(EGL_BAD_ALLOC, "dri2_query_buffer_age");
-  return 0;
+  return -1;
}
 
return dri2_surf->back->age;
diff --git a/src/egl/main/eglsurface.c b/src/egl/main/eglsurface.c
index e935c83..5b3e83e 100644
--- a/src/egl/main/eglsurface.c
+++ b/src/egl/main/eglsurface.c
@@ -409,7 +409,11 @@ _eglQuerySurface(_EGLDriver *drv, _EGLDisplay *dpy, 
_EGLSurface *surface,
  _eglError(EGL_BAD_ATTRIBUTE, "eglQuerySurface");
  return EGL_FALSE;
   }
-  *value = drv->API.QueryBufferAge(drv, dpy, surface);
+  EGLint result = drv->API.QueryBufferAge(drv, dpy, surface);
+  /* error happened */
+  if (result < 0)
+ return EGL_FALSE;
+  *value = result;
   break;
default:
   _eglError(EGL_BAD_ATTRIBUTE, "eglQuerySurface");
-- 
2.9.4

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


Re: [Mesa-dev] [PATCH] Android: vulkan: fix build error due to extra )

2017-06-08 Thread Tapani Pälli



On 06/08/2017 11:03 AM, Alex Smith wrote:

Oops, sorry about that!


my bad, for me it actually compiles fine even with the ')' but there is 
maybe some differences between mine and Rob's way of building Mesa




Alex

On 8 June 2017 at 03:00, Rob Herring <r...@kernel.org 
<mailto:r...@kernel.org>> wrote:


Commit 621b3410f5f8 ("util/vulkan: Move Vulkan utilities to
src/vulkan/util") broke the Android build with the following error:

build/core/binary.mk:1427 <http://binary.mk:1427>: error:
external/mesa3d/src/vulkan/Android.mk: libmesa_vulkan_util: Unused
source files: util/vk_util.h).

Fixes: 621b3410f5f8 ("util/vulkan: Move Vulkan utilities to
    src/vulkan/util")
Cc: Tapani Pälli <tapani.pa...@intel.com
<mailto:tapani.pa...@intel.com>>
Cc: Alex Smith <asm...@feralinteractive.com
<mailto:asm...@feralinteractive.com>>
Signed-off-by: Rob Herring <r...@kernel.org <mailto:r...@kernel.org>>
---
  src/vulkan/Android.mk | 2 +-
  1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/src/vulkan/Android.mk b/src/vulkan/Android.mk
index 8eb42ece8786..e19a33dd4f9f 100644
--- a/src/vulkan/Android.mk
+++ b/src/vulkan/Android.mk
@@ -41,7 +41,7 @@ LOCAL_C_INCLUDES := \
  LOCAL_GENERATED_SOURCES := $(addprefix $(intermediates)/, \
 $(VULKAN_UTIL_GENERATED_FILES))

-LOCAL_SRC_FILES := $(VULKAN_UTIL_FILES))
+LOCAL_SRC_FILES := $(VULKAN_UTIL_FILES)

  vulkan_api_xml = $(MESA_TOP)/src/vulkan/registry/vk.xml

--
2.11.0



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


Re: [Mesa-dev] [PATCH 0/6] i965: Add RGBX, RGBA configs, even on gen9

2017-06-08 Thread Tapani Pälli


On 06/08/2017 09:36 AM, Tapani Pälli wrote:



On 06/08/2017 06:05 AM, Tomasz Figa wrote:
On Wed, Jun 7, 2017 at 5:36 AM, Chad Versace 
<chadvers...@chromium.org> wrote:

More patches to break your formats... again ;)

The Android framework requires support for EGLConfigs with
HAL_PIXEL_FORMAT_RGBX_ and HAL_PIXEL_FORMAT_RGBA_. This prevents
Chrome OS from updating its Android drivers, because earlier this year
Intel disabled all rgbx formats for gen >=9 in brw_surface_formats.c.
This patch series safely (hopefully?) fixes that problem.

If you want the meat, read patches 2 and 6.

Chad Versace (6):
   mesa: Add _mesa_format_fallback_rgba_to_rgbx()
   i965: Add a RGBX->RGBA fallback for glEGLImageTextureTarget2D()
   i965: Rename some vague format members of brw_context
   i965/dri: Add intel_screen param to intel_create_winsys_renderbuffer
   i965: Move brw_context format arrays to intel_screen
   i965/dri: Support R8G8B8A8 and R8G8B8X8 configs


Thanks a lot Chad!

Just to make sure, did you have a chance to test it with X11 apps,
that were reported to have incorrect colors last time we tried
enabling these formats? I.e.
https://bugs.freedesktop.org/show_bug.cgi?id=95071



I just tested this set on Android and I'm getting wrong colors with 
this, red and blue swapped.


I can 'fix' this by reordering the configs in intel_screen_make_configs 
so that the new configs (RGBA, RGBX) required by Android are before the 
old ones (BGRA, BGRX).


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


Re: [Mesa-dev] [PATCH 0/6] i965: Add RGBX, RGBA configs, even on gen9

2017-06-08 Thread Tapani Pälli



On 06/08/2017 06:05 AM, Tomasz Figa wrote:

On Wed, Jun 7, 2017 at 5:36 AM, Chad Versace  wrote:

More patches to break your formats... again ;)

The Android framework requires support for EGLConfigs with
HAL_PIXEL_FORMAT_RGBX_ and HAL_PIXEL_FORMAT_RGBA_. This prevents
Chrome OS from updating its Android drivers, because earlier this year
Intel disabled all rgbx formats for gen >=9 in brw_surface_formats.c.
This patch series safely (hopefully?) fixes that problem.

If you want the meat, read patches 2 and 6.

Chad Versace (6):
   mesa: Add _mesa_format_fallback_rgba_to_rgbx()
   i965: Add a RGBX->RGBA fallback for glEGLImageTextureTarget2D()
   i965: Rename some vague format members of brw_context
   i965/dri: Add intel_screen param to intel_create_winsys_renderbuffer
   i965: Move brw_context format arrays to intel_screen
   i965/dri: Support R8G8B8A8 and R8G8B8X8 configs


Thanks a lot Chad!

Just to make sure, did you have a chance to test it with X11 apps,
that were reported to have incorrect colors last time we tried
enabling these formats? I.e.
https://bugs.freedesktop.org/show_bug.cgi?id=95071



I just tested this set on Android and I'm getting wrong colors with 
this, red and blue swapped.


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


Re: [Mesa-dev] [PATCH] Android: vulkan: fix build error due to extra )

2017-06-07 Thread Tapani Pälli

argh, how did that get there ...

Reviewed-by: Tapani Pälli <tapani.pa...@intel.com>

On 06/08/2017 05:00 AM, Rob Herring wrote:

Commit 621b3410f5f8 ("util/vulkan: Move Vulkan utilities to
src/vulkan/util") broke the Android build with the following error:

build/core/binary.mk:1427: error: external/mesa3d/src/vulkan/Android.mk: 
libmesa_vulkan_util: Unused source files: util/vk_util.h).

Fixes: 621b3410f5f8 ("util/vulkan: Move Vulkan utilities to src/vulkan/util")
Cc: Tapani Pälli <tapani.pa...@intel.com>
Cc: Alex Smith <asm...@feralinteractive.com>
Signed-off-by: Rob Herring <r...@kernel.org>
---
  src/vulkan/Android.mk | 2 +-
  1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/src/vulkan/Android.mk b/src/vulkan/Android.mk
index 8eb42ece8786..e19a33dd4f9f 100644
--- a/src/vulkan/Android.mk
+++ b/src/vulkan/Android.mk
@@ -41,7 +41,7 @@ LOCAL_C_INCLUDES := \
  LOCAL_GENERATED_SOURCES := $(addprefix $(intermediates)/, \
$(VULKAN_UTIL_GENERATED_FILES))
  
-LOCAL_SRC_FILES := $(VULKAN_UTIL_FILES))

+LOCAL_SRC_FILES := $(VULKAN_UTIL_FILES)
  
  vulkan_api_xml = $(MESA_TOP)/src/vulkan/registry/vk.xml
  


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


Re: [Mesa-dev] [PATCH] i965: Don't try to resolve CCS with MESA_FORMAT_NONE.

2017-06-06 Thread Tapani Pälli



On 06/06/2017 02:58 AM, Kenneth Graunke wrote:

On Monday, June 5, 2017 2:03:45 AM PDT Tapani Pälli wrote:

FWIW this change fixes also regression on Android wallpaper since that
commit.


I'm planning on dropping this patch, as it seems that

commit 708664159e18487b6676fd5b4c33f52003f81d9e
Author: Jason Ekstrand <jason.ekstr...@intel.com>
Date:   Fri May 26 10:57:33 2017 -0700

 i965: Finalize miptrees before prepare_texture

has already fixed the problem for me.  Hopefully that also fixes the
Android wallpaper issue?



Yep, I verified that it fixes the issue!

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


Re: [Mesa-dev] [PATCH 1/3] util/vulkan: Move Vulkan utilities to src/vulkan/util

2017-06-06 Thread Tapani Pälli



On 06/06/2017 02:13 PM, Alex Smith wrote:
Aha, sorry, I missed that. Do you want me to fold your patch into this 
one and send a v2?


That would be ideal as working build makes bisecting a lot less painful, 
thanks!



Alex

On 6 June 2017 at 12:11, Tapani Pälli <tapani.pa...@intel.com 
<mailto:tapani.pa...@intel.com>> wrote:


Looks nice to me, I've sent required changes to Android build system
for this change as addition.


On 06/06/2017 12:42 PM, Alex Smith wrote:

We have Vulkan utilities in both src/util and src/vulkan/util. The
latter seems a more appropriate place for Vulkan-specific things, so
move them there.

Signed-off-by: Alex Smith <asm...@feralinteractive.com
<mailto:asm...@feralinteractive.com>>
---
   src/amd/vulkan/radv_device.c| 2 +-
   src/amd/vulkan/radv_formats.c   | 3 ++-
   src/amd/vulkan/radv_private.h   | 2 +-
   src/amd/vulkan/radv_wsi.c   | 2 +-
   src/intel/vulkan/anv_device.c   | 2 +-
   src/intel/vulkan/anv_formats.c  | 3 +--
   src/intel/vulkan/anv_pass.c | 2 +-
   src/intel/vulkan/anv_private.h  | 2 +-
   src/intel/vulkan/anv_queue.c| 2 +-
   src/intel/vulkan/anv_wsi.c  | 2 +-
   src/intel/vulkan/genX_cmd_buffer.c  | 2 +-
   src/util/Makefile.sources   | 4 +---
   src/vulkan/Makefile.am  | 7 ++-
   src/vulkan/Makefile.sources | 4 
   src/{ => vulkan}/util/vk_alloc.h| 0
   src/{ => vulkan}/util/vk_util.h | 0
   src/vulkan/wsi/wsi_common.h | 2 +-
   src/vulkan/wsi/wsi_common_wayland.c | 2 +-
   src/vulkan/wsi/wsi_common_x11.c | 2 +-
   19 files changed, 26 insertions(+), 19 deletions(-)
   rename src/{ => vulkan}/util/vk_alloc.h (100%)
   rename src/{ => vulkan}/util/vk_util.h (100%)

diff --git a/src/amd/vulkan/radv_device.c
b/src/amd/vulkan/radv_device.c
index 887916f..a812527 100644
--- a/src/amd/vulkan/radv_device.c
+++ b/src/amd/vulkan/radv_device.c
@@ -33,7 +33,7 @@
   #include "radv_cs.h"
   #include "util/disk_cache.h"
   #include "util/strtod.h"
-#include "util/vk_util.h"
+#include "vk_util.h"
   #include 
   #include 
   #include 
diff --git a/src/amd/vulkan/radv_formats.c
b/src/amd/vulkan/radv_formats.c
index 6cff0a5..b13adb9 100644
--- a/src/amd/vulkan/radv_formats.c
+++ b/src/amd/vulkan/radv_formats.c
@@ -28,7 +28,8 @@
   #include "sid.h"
   #include "r600d_common.h"
   -#include "util/vk_util.h"
+#include "vk_util.h"
+
   #include "util/u_half.h"
   #include "util/format_srgb.h"
   #include "util/format_r11g11b10f.h"
diff --git a/src/amd/vulkan/radv_private.h
b/src/amd/vulkan/radv_private.h
index ed80ba7..a3920a7 100644
--- a/src/amd/vulkan/radv_private.h
+++ b/src/amd/vulkan/radv_private.h
@@ -47,8 +47,8 @@
   #include "compiler/shader_enums.h"
   #include "util/macros.h"
   #include "util/list.h"
-#include "util/vk_alloc.h"
   #include "main/macros.h"
+#include "vk_alloc.h"
 #include "radv_radeon_winsys.h"
   #include "ac_binary.h"
diff --git a/src/amd/vulkan/radv_wsi.c b/src/amd/vulkan/radv_wsi.c
index 51fe159..cdb04ca 100644
--- a/src/amd/vulkan/radv_wsi.c
+++ b/src/amd/vulkan/radv_wsi.c
@@ -26,7 +26,7 @@
   #include "radv_private.h"
   #include "radv_meta.h"
   #include "wsi_common.h"
-#include "util/vk_util.h"
+#include "vk_util.h"
 static const struct wsi_callbacks wsi_cbs = {
  .get_phys_device_format_properties =
radv_GetPhysicalDeviceFormatProperties,
diff --git a/src/intel/vulkan/anv_device.c
b/src/intel/vulkan/anv_device.c
index aacd07f..6079588 100644
--- a/src/intel/vulkan/anv_device.c
+++ b/src/intel/vulkan/anv_device.c
@@ -35,7 +35,7 @@
   #include "util/debug.h"
   #include "util/build_id.h"
   #include "util/mesa-sha1.h"
-#include "util/vk_util.h"
+#include "vk_util.h"
 #include "genxml/gen7_pack.h"
   diff --git a/src/intel/vulkan/anv_formats.c
b/src/intel/vulkan/anv_formats.c
index 25801

Re: [Mesa-dev] [PATCH 1/3] util/vulkan: Move Vulkan utilities to src/vulkan/util

2017-06-06 Thread Tapani Pälli
Looks nice to me, I've sent required changes to Android build system for 
this change as addition.


On 06/06/2017 12:42 PM, Alex Smith wrote:

We have Vulkan utilities in both src/util and src/vulkan/util. The
latter seems a more appropriate place for Vulkan-specific things, so
move them there.

Signed-off-by: Alex Smith 
---
  src/amd/vulkan/radv_device.c| 2 +-
  src/amd/vulkan/radv_formats.c   | 3 ++-
  src/amd/vulkan/radv_private.h   | 2 +-
  src/amd/vulkan/radv_wsi.c   | 2 +-
  src/intel/vulkan/anv_device.c   | 2 +-
  src/intel/vulkan/anv_formats.c  | 3 +--
  src/intel/vulkan/anv_pass.c | 2 +-
  src/intel/vulkan/anv_private.h  | 2 +-
  src/intel/vulkan/anv_queue.c| 2 +-
  src/intel/vulkan/anv_wsi.c  | 2 +-
  src/intel/vulkan/genX_cmd_buffer.c  | 2 +-
  src/util/Makefile.sources   | 4 +---
  src/vulkan/Makefile.am  | 7 ++-
  src/vulkan/Makefile.sources | 4 
  src/{ => vulkan}/util/vk_alloc.h| 0
  src/{ => vulkan}/util/vk_util.h | 0
  src/vulkan/wsi/wsi_common.h | 2 +-
  src/vulkan/wsi/wsi_common_wayland.c | 2 +-
  src/vulkan/wsi/wsi_common_x11.c | 2 +-
  19 files changed, 26 insertions(+), 19 deletions(-)
  rename src/{ => vulkan}/util/vk_alloc.h (100%)
  rename src/{ => vulkan}/util/vk_util.h (100%)

diff --git a/src/amd/vulkan/radv_device.c b/src/amd/vulkan/radv_device.c
index 887916f..a812527 100644
--- a/src/amd/vulkan/radv_device.c
+++ b/src/amd/vulkan/radv_device.c
@@ -33,7 +33,7 @@
  #include "radv_cs.h"
  #include "util/disk_cache.h"
  #include "util/strtod.h"
-#include "util/vk_util.h"
+#include "vk_util.h"
  #include 
  #include 
  #include 
diff --git a/src/amd/vulkan/radv_formats.c b/src/amd/vulkan/radv_formats.c
index 6cff0a5..b13adb9 100644
--- a/src/amd/vulkan/radv_formats.c
+++ b/src/amd/vulkan/radv_formats.c
@@ -28,7 +28,8 @@
  #include "sid.h"
  #include "r600d_common.h"
  
-#include "util/vk_util.h"

+#include "vk_util.h"
+
  #include "util/u_half.h"
  #include "util/format_srgb.h"
  #include "util/format_r11g11b10f.h"
diff --git a/src/amd/vulkan/radv_private.h b/src/amd/vulkan/radv_private.h
index ed80ba7..a3920a7 100644
--- a/src/amd/vulkan/radv_private.h
+++ b/src/amd/vulkan/radv_private.h
@@ -47,8 +47,8 @@
  #include "compiler/shader_enums.h"
  #include "util/macros.h"
  #include "util/list.h"
-#include "util/vk_alloc.h"
  #include "main/macros.h"
+#include "vk_alloc.h"
  
  #include "radv_radeon_winsys.h"

  #include "ac_binary.h"
diff --git a/src/amd/vulkan/radv_wsi.c b/src/amd/vulkan/radv_wsi.c
index 51fe159..cdb04ca 100644
--- a/src/amd/vulkan/radv_wsi.c
+++ b/src/amd/vulkan/radv_wsi.c
@@ -26,7 +26,7 @@
  #include "radv_private.h"
  #include "radv_meta.h"
  #include "wsi_common.h"
-#include "util/vk_util.h"
+#include "vk_util.h"
  
  static const struct wsi_callbacks wsi_cbs = {

 .get_phys_device_format_properties = 
radv_GetPhysicalDeviceFormatProperties,
diff --git a/src/intel/vulkan/anv_device.c b/src/intel/vulkan/anv_device.c
index aacd07f..6079588 100644
--- a/src/intel/vulkan/anv_device.c
+++ b/src/intel/vulkan/anv_device.c
@@ -35,7 +35,7 @@
  #include "util/debug.h"
  #include "util/build_id.h"
  #include "util/mesa-sha1.h"
-#include "util/vk_util.h"
+#include "vk_util.h"
  
  #include "genxml/gen7_pack.h"
  
diff --git a/src/intel/vulkan/anv_formats.c b/src/intel/vulkan/anv_formats.c

index 25801e8..104d4f7 100644
--- a/src/intel/vulkan/anv_formats.c
+++ b/src/intel/vulkan/anv_formats.c
@@ -23,8 +23,7 @@
  
  #include "anv_private.h"

  #include "vk_format_info.h"
-
-#include "util/vk_util.h"
+#include "vk_util.h"
  
  /*

   * gcc-4 and earlier don't allow compound literals where a constant
diff --git a/src/intel/vulkan/anv_pass.c b/src/intel/vulkan/anv_pass.c
index 93f1483..1b30c14 100644
--- a/src/intel/vulkan/anv_pass.c
+++ b/src/intel/vulkan/anv_pass.c
@@ -23,7 +23,7 @@
  
  #include "anv_private.h"
  
-#include "util/vk_util.h"

+#include "vk_util.h"
  
  static unsigned

  num_subpass_attachments(const VkSubpassDescription *desc)
diff --git a/src/intel/vulkan/anv_private.h b/src/intel/vulkan/anv_private.h
index c261faa..fe6ac3b 100644
--- a/src/intel/vulkan/anv_private.h
+++ b/src/intel/vulkan/anv_private.h
@@ -47,7 +47,7 @@
  #include "util/macros.h"
  #include "util/list.h"
  #include "util/u_vector.h"
-#include "util/vk_alloc.h"
+#include "vk_alloc.h"
  
  /* Pre-declarations needed for WSI entrypoints */

  struct wl_surface;
diff --git a/src/intel/vulkan/anv_queue.c b/src/intel/vulkan/anv_queue.c
index be7fd31..fd4d362 100644
--- a/src/intel/vulkan/anv_queue.c
+++ b/src/intel/vulkan/anv_queue.c
@@ -30,7 +30,7 @@
  #include 
  
  #include "anv_private.h"

-#include "util/vk_util.h"
+#include "vk_util.h"
  
  #include "genxml/gen7_pack.h"
  
diff --git a/src/intel/vulkan/anv_wsi.c b/src/intel/vulkan/anv_wsi.c

index 7575f58..9369f26 100644
--- a/src/intel/vulkan/anv_wsi.c
+++ b/src/intel/vulkan/anv_wsi.c
@@ 

[Mesa-dev] [PATCH] android: build system changes for Vulkan utilities move

2017-06-06 Thread Tapani Pälli
Signed-off-by: Tapani Pälli <tapani.pa...@intel.com>
---

Android build system changes required for:
   https://lists.freedesktop.org/archives/mesa-dev/2017-June/158027.html

 Android.common.mk   | 1 +
 src/intel/Android.vulkan.mk | 1 +
 src/vulkan/Android.mk   | 2 ++
 3 files changed, 4 insertions(+)

diff --git a/Android.common.mk b/Android.common.mk
index bf4d709..c2de22b 100644
--- a/Android.common.mk
+++ b/Android.common.mk
@@ -38,6 +38,7 @@ LOCAL_CFLAGS += \
-Wno-missing-field-initializers \
-Wno-initializer-overrides \
-Wno-mismatched-tags \
+   -DVERSION=\"$(MESA_VERSION)\" \
-DPACKAGE_VERSION=\"$(MESA_VERSION)\" \

-DPACKAGE_BUGREPORT=\"https://bugs.freedesktop.org/enter_bug.cgi?product=Mesa\;
 
diff --git a/src/intel/Android.vulkan.mk b/src/intel/Android.vulkan.mk
index be23a00..0bca2ad 100644
--- a/src/intel/Android.vulkan.mk
+++ b/src/intel/Android.vulkan.mk
@@ -31,6 +31,7 @@ VULKAN_COMMON_INCLUDES := \
$(MESA_TOP)/src/gallium/include \
$(MESA_TOP)/src/mesa \
$(MESA_TOP)/src/vulkan/wsi \
+   $(MESA_TOP)/src/vulkan/util \
$(MESA_TOP)/src/intel \
$(MESA_TOP)/src/intel/vulkan \
frameworks/native/libs/nativewindow/include \
diff --git a/src/vulkan/Android.mk b/src/vulkan/Android.mk
index 2e34093..c8b886d 100644
--- a/src/vulkan/Android.mk
+++ b/src/vulkan/Android.mk
@@ -44,6 +44,8 @@ LOCAL_C_INCLUDES := \
 LOCAL_GENERATED_SOURCES := $(addprefix $(intermediates)/, \
$(VULKAN_UTIL_GENERATED_FILES))
 
+LOCAL_SRC_FILES := $(VULKAN_UTIL_FILES))
+
 vulkan_api_xml = $(MESA_TOP)/src/vulkan/registry/vk.xml
 
 $(LOCAL_GENERATED_SOURCES): $(MESA_TOP)/src/vulkan/util/gen_enum_to_str.py 
$(vulkan_api_xml)
-- 
2.9.4

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


Re: [Mesa-dev] [PATCH] i965: Don't try to resolve CCS with MESA_FORMAT_NONE.

2017-06-05 Thread Tapani Pälli
FWIW this change fixes also regression on Android wallpaper since that 
commit.


On 06/04/2017 10:26 PM, Kenneth Graunke wrote:

Since commit e9f5004d5ea38a21019e0affcd63d353b98d499a, KDE's Plasma
Shell started crashing when intel_disable_rb_aux_buffer tried to
dereference irb->mt, and there was no miptree.  This happened during
intel_texture_view_requires_resolve, coming from a glClear().

Apparently intel_tex->_Format is MESA_FORMAT_NONE.  We used to translate
MESA_FORMAT_NONE to 0, which happens to be ISL_FORMAT_R32G32B32A32_FLOAT,
which happens to support CCS_E, so we assumed no resolves were needed.

That patch began translating MESA_FORMAT_NONE as ISL_FORMAT_UNSUPPORTED,
which claims not to support CCS_E, so we thought we needed resolves,
even though the buffer was in a bad state.

For now, detect intel_tex->_Format == MESA_FORMAT_NONE and bail, like
we used to.  This is an ugly band-aid fix, but that's okay, given that
Jason has patches on the mailing list to rewrite the resolve code.

This makes KDE usable again.
---
  src/mesa/drivers/dri/i965/brw_context.c | 3 +++
  1 file changed, 3 insertions(+)

diff --git a/src/mesa/drivers/dri/i965/brw_context.c 
b/src/mesa/drivers/dri/i965/brw_context.c
index 9878cae9d4b..d8219cb57e0 100644
--- a/src/mesa/drivers/dri/i965/brw_context.c
+++ b/src/mesa/drivers/dri/i965/brw_context.c
@@ -205,6 +205,9 @@ intel_texture_view_requires_resolve(struct brw_context *brw,
 !intel_miptree_is_lossless_compressed(brw, intel_tex->mt))
   return false;
  
+   if (intel_tex->_Format == MESA_FORMAT_NONE)

+  return false;
+
 const enum isl_format isl_format =
brw_isl_format_for_mesa_format(intel_tex->_Format);
  


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


Re: [Mesa-dev] [RFC 3/3] egl: remove EGL_NOK_swap_region

2017-06-05 Thread Tapani Pälli



On 06/05/2017 02:52 AM, Emil Velikov wrote:

From: Emil Velikov 

Analogous to previous commit - only one platform (of 6?) implements
this, and there's no implementations seen in the wild that use this.

Hmm the extension isn't even available anywhere :-\


There is EGL_NOK_swap_region2, it seems that Qt is the only user for 
this which makes sense as it was built for Maemo/Meego. Not sure how 
actively this is utilized in today's Qt apps/desktops?



Signed-off-by: Emil Velikov 
---
  src/egl/drivers/dri2/egl_dri2.c |  9 
  src/egl/drivers/dri2/egl_dri2.h |  4 
  src/egl/drivers/dri2/egl_dri2_fallbacks.h   |  8 ---
  src/egl/drivers/dri2/platform_android.c |  1 -
  src/egl/drivers/dri2/platform_drm.c |  1 -
  src/egl/drivers/dri2/platform_surfaceless.c |  1 -
  src/egl/drivers/dri2/platform_wayland.c |  2 --
  src/egl/drivers/dri2/platform_x11.c | 33 -
  src/egl/drivers/dri2/platform_x11_dri3.c|  1 -
  src/egl/main/eglapi.c   | 29 -
  src/egl/main/eglapi.h   |  4 
  src/egl/main/egldisplay.h   |  1 -
  src/egl/main/eglentrypoint.h|  1 -
  src/egl/main/eglfallbacks.c |  2 --
  14 files changed, 97 deletions(-)

diff --git a/src/egl/drivers/dri2/egl_dri2.c b/src/egl/drivers/dri2/egl_dri2.c
index 977482f4b55..384b8043e4a 100644
--- a/src/egl/drivers/dri2/egl_dri2.c
+++ b/src/egl/drivers/dri2/egl_dri2.c
@@ -1505,14 +1505,6 @@ dri2_swap_buffers_with_damage(_EGLDriver *drv, 
_EGLDisplay *dpy,
  }
  
  static EGLBoolean

-dri2_swap_buffers_region(_EGLDriver *drv, _EGLDisplay *dpy, _EGLSurface *surf,
- EGLint numRects, const EGLint *rects)
-{
-   struct dri2_egl_display *dri2_dpy = dri2_egl_display(dpy);
-   return dri2_dpy->vtbl->swap_buffers_region(drv, dpy, surf, numRects, rects);
-}
-
-static EGLBoolean
  dri2_copy_buffers(_EGLDriver *drv, _EGLDisplay *dpy, _EGLSurface *surf,
void *native_pixmap_target)
  {
@@ -3133,7 +3125,6 @@ _eglBuiltInDriverDRI2(const char *args)
 dri2_drv->base.API.SwapInterval = dri2_swap_interval;
 dri2_drv->base.API.SwapBuffers = dri2_swap_buffers;
 dri2_drv->base.API.SwapBuffersWithDamageEXT = 
dri2_swap_buffers_with_damage;
-   dri2_drv->base.API.SwapBuffersRegionNOK = dri2_swap_buffers_region;
 dri2_drv->base.API.CopyBuffers = dri2_copy_buffers,
 dri2_drv->base.API.QueryBufferAge = dri2_query_buffer_age;
 dri2_drv->base.API.CreateImageKHR = dri2_create_image;
diff --git a/src/egl/drivers/dri2/egl_dri2.h b/src/egl/drivers/dri2/egl_dri2.h
index 8cc0d87acde..27722ef7322 100644
--- a/src/egl/drivers/dri2/egl_dri2.h
+++ b/src/egl/drivers/dri2/egl_dri2.h
@@ -118,10 +118,6 @@ struct dri2_egl_display_vtbl {
_EGLSurface *surface,
const EGLint *rects, EGLint 
n_rects);
  
-   EGLBoolean (*swap_buffers_region)(_EGLDriver *drv, _EGLDisplay *dpy,

- _EGLSurface *surf, EGLint numRects,
- const EGLint *rects);
-
 EGLBoolean (*copy_buffers)(_EGLDriver *drv, _EGLDisplay *dpy,
_EGLSurface *surf, void *native_pixmap_target);
  
diff --git a/src/egl/drivers/dri2/egl_dri2_fallbacks.h b/src/egl/drivers/dri2/egl_dri2_fallbacks.h

index 44d50dd3925..8f7debfdf51 100644
--- a/src/egl/drivers/dri2/egl_dri2_fallbacks.h
+++ b/src/egl/drivers/dri2/egl_dri2_fallbacks.h
@@ -72,14 +72,6 @@ dri2_fallback_swap_buffers_with_damage(_EGLDriver *drv, 
_EGLDisplay *dpy,
  }
  
  static inline EGLBoolean

-dri2_fallback_swap_buffers_region(_EGLDriver *drv, _EGLDisplay *dpy,
-  _EGLSurface *surf,
-  EGLint numRects, const EGLint *rects)
-{
-   return EGL_FALSE;
-}
-
-static inline EGLBoolean
  dri2_fallback_copy_buffers(_EGLDriver *drv, _EGLDisplay *dpy,
 _EGLSurface *surf,
 void *native_pixmap_target)
diff --git a/src/egl/drivers/dri2/platform_android.c 
b/src/egl/drivers/dri2/platform_android.c
index 08037e34de2..6365755af6d 100644
--- a/src/egl/drivers/dri2/platform_android.c
+++ b/src/egl/drivers/dri2/platform_android.c
@@ -1065,7 +1065,6 @@ static const struct dri2_egl_display_vtbl 
droid_display_vtbl = {
 .swap_interval = dri2_fallback_swap_interval,
 .swap_buffers = droid_swap_buffers,
 .swap_buffers_with_damage = dri2_fallback_swap_buffers_with_damage,
-   .swap_buffers_region = dri2_fallback_swap_buffers_region,
 .copy_buffers = dri2_fallback_copy_buffers,
 .query_buffer_age = droid_query_buffer_age,
 .query_surface = droid_query_surface,
diff --git a/src/egl/drivers/dri2/platform_drm.c 
b/src/egl/drivers/dri2/platform_drm.c
index 

Re: [Mesa-dev] [RFC 1/3] egl/dri2: enable EGL_NOK_texture_from_pixmap everywhere

2017-06-05 Thread Tapani Pälli
Android does not support pixmaps, so this should be set to false there. 
I think otherwise this should be fine.


On 06/05/2017 02:52 AM, Emil Velikov wrote:

From: Emil Velikov 

There's nothing platform specific in the extension - all the required
core parts are already implemented.

Signed-off-by: Emil Velikov 
---
This and the following are an RFC, since I'm not 100% sure if there
isn't anything too subtle that enforces the current state of affairs.

E.g. EGL_NOK_swap_region - the extension documentation is nowhere to be
found, there's no implementations or software out there (that I can see)
which honours it, yet we implement it. Barring the single piglit test.

  src/egl/drivers/dri2/egl_dri2.c | 1 +
  src/egl/drivers/dri2/platform_x11.c | 2 --
  2 files changed, 1 insertion(+), 2 deletions(-)

diff --git a/src/egl/drivers/dri2/egl_dri2.c b/src/egl/drivers/dri2/egl_dri2.c
index d31a0bf8e09..f6d2d5464a8 100644
--- a/src/egl/drivers/dri2/egl_dri2.c
+++ b/src/egl/drivers/dri2/egl_dri2.c
@@ -666,6 +666,7 @@ dri2_setup_screen(_EGLDisplay *disp)
 assert(dri2_dpy->image_driver || dri2_dpy->dri2 || dri2_dpy->swrast);
 disp->Extensions.KHR_no_config_context = EGL_TRUE;
 disp->Extensions.KHR_surfaceless_context = EGL_TRUE;
+   disp->Extensions.NOK_texture_from_pixmap = EGL_TRUE;
  
 if (dri2_renderer_query_integer(dri2_dpy,

 __DRI2_RENDERER_HAS_FRAMEBUFFER_SRGB))
diff --git a/src/egl/drivers/dri2/platform_x11.c 
b/src/egl/drivers/dri2/platform_x11.c
index 8d8c7cb4905..1985818e119 100644
--- a/src/egl/drivers/dri2/platform_x11.c
+++ b/src/egl/drivers/dri2/platform_x11.c
@@ -1359,7 +1359,6 @@ dri2_initialize_x11_dri3(_EGLDriver *drv, _EGLDisplay 
*disp)
  
 if (!dri2_dpy->is_different_gpu)

disp->Extensions.KHR_image_pixmap = EGL_TRUE;
-   disp->Extensions.NOK_texture_from_pixmap = EGL_TRUE;
 disp->Extensions.CHROMIUM_sync_control = EGL_TRUE;
 disp->Extensions.EXT_buffer_age = EGL_TRUE;
  
@@ -1459,7 +1458,6 @@ dri2_initialize_x11_dri2(_EGLDriver *drv, _EGLDisplay *disp)
  
 disp->Extensions.KHR_image_pixmap = EGL_TRUE;

 disp->Extensions.NOK_swap_region = EGL_TRUE;
-   disp->Extensions.NOK_texture_from_pixmap = EGL_TRUE;
 disp->Extensions.NV_post_sub_buffer = EGL_TRUE;
 disp->Extensions.CHROMIUM_sync_control = EGL_TRUE;
  


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


Re: [Mesa-dev] [PATCH] Android: use bionic pthread_barrier_* if possible

2017-06-05 Thread Tapani Pälli

that seems the case

Acked-by: Tapani Pälli <tapani.pa...@intel.com>

On 06/04/2017 07:53 AM, Chih-Wei Huang wrote:

The pthread_barrier_* functions were introduced to bionic
since Nougat.

Signed-off-by: Chih-Wei Huang <cwhu...@linux.org.tw>
---
  Android.common.mk| 1 +
  src/gallium/auxiliary/os/os_thread.h | 2 +-
  2 files changed, 2 insertions(+), 1 deletion(-)

diff --git a/Android.common.mk b/Android.common.mk
index 57c31fc..44ad97b 100644
--- a/Android.common.mk
+++ b/Android.common.mk
@@ -44,6 +44,7 @@ LOCAL_CFLAGS += \
  # It's likely due to a bug elsewhere, but let's temporarily add them
  # here to fix the radeonsi build.
  LOCAL_CFLAGS += \
+   -DANDROID_API_LEVEL=$(PLATFORM_SDK_VERSION) \
-DENABLE_SHADER_CACHE \
-D__STDC_CONSTANT_MACROS \
-D__STDC_LIMIT_MACROS \
diff --git a/src/gallium/auxiliary/os/os_thread.h 
b/src/gallium/auxiliary/os/os_thread.h
index b6e0698..0a238e5 100644
--- a/src/gallium/auxiliary/os/os_thread.h
+++ b/src/gallium/auxiliary/os/os_thread.h
@@ -75,7 +75,7 @@ __pipe_mutex_assert_locked(mtx_t *mutex)
   * pipe_barrier
   */
  
-#if (defined(PIPE_OS_LINUX) || defined(PIPE_OS_BSD) || defined(PIPE_OS_SOLARIS) || defined(PIPE_OS_HURD)) && !defined(PIPE_OS_ANDROID)

+#if (defined(PIPE_OS_LINUX) || defined(PIPE_OS_BSD) || defined(PIPE_OS_SOLARIS) || 
defined(PIPE_OS_HURD)) && (!defined(PIPE_OS_ANDROID) || ANDROID_API_LEVEL >= 24)
  
  typedef pthread_barrier_t pipe_barrier;
  


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


Re: [Mesa-dev] [PATCH 10/24] i965/cnl: Wire up android Mesa build files for gen10

2017-06-05 Thread Tapani Pälli

looks correct and builds fine for Android-IA;

Reviewed-by: Tapani Pälli <tapani.pa...@intel.com>

On 05/13/2017 02:38 AM, Anuj Phogat wrote:

Note: This patch is untested.

Signed-off-by: Anuj Phogat <anuj.pho...@gmail.com>
---
  src/intel/Android.genxml.mk  |  5 +
  src/intel/Android.isl.mk | 20 
  src/intel/Android.vulkan.mk  | 21 +
  src/mesa/drivers/dri/i965/Android.mk | 24 +++-
  4 files changed, 69 insertions(+), 1 deletion(-)

diff --git a/src/intel/Android.genxml.mk b/src/intel/Android.genxml.mk
index 4b0746c..e4d8dd8 100644
--- a/src/intel/Android.genxml.mk
+++ b/src/intel/Android.genxml.mk
@@ -96,6 +96,11 @@ $(intermediates)/genxml/gen9_pack.h: PRIVATE_XML := 
$(LOCAL_PATH)/genxml/gen9.xm
  $(intermediates)/genxml/gen9_pack.h: $(LOCAL_PATH)/genxml/gen9.xml 
$(LOCAL_PATH)/genxml/gen_pack_header.py
$(call header-gen)
  
+$(intermediates)/genxml/gen10_pack.h: PRIVATE_SCRIPT := $(MESA_PYTHON2) $(LOCAL_PATH)/genxml/gen_pack_header.py

+$(intermediates)/genxml/gen10_pack.h: PRIVATE_XML := 
$(LOCAL_PATH)/genxml/gen10.xml
+$(intermediates)/genxml/gen10_pack.h: $(LOCAL_PATH)/genxml/gen10.xml 
$(LOCAL_PATH)/genxml/gen_pack_header.py
+   $(call header-gen)
+
  $(intermediates)/genxml/genX_xml.h: $(addprefix 
$(MESA_TOP)/src/intel/,$(GENXML_XML_FILES)) 
$(MESA_TOP)/src/intel/genxml/gen_zipped_file.py
@mkdir -p $(dir $@)
@echo "Gen Header: $(PRIVATE_MODULE) <= $(notdir $(@))"
diff --git a/src/intel/Android.isl.mk b/src/intel/Android.isl.mk
index 67e6d2d..516ac3a 100644
--- a/src/intel/Android.isl.mk
+++ b/src/intel/Android.isl.mk
@@ -161,6 +161,25 @@ include $(MESA_COMMON_MK)
  include $(BUILD_STATIC_LIBRARY)
  
  # ---

+# Build libmesa_isl_gen10
+# ---
+
+include $(CLEAR_VARS)
+
+LOCAL_MODULE := libmesa_isl_gen10
+
+LOCAL_SRC_FILES := $(ISL_GEN10_FILES)
+
+LOCAL_CFLAGS := -DGEN_VERSIONx10=100
+
+LOCAL_C_INCLUDES := $(LIBISL_GENX_COMMON_INCLUDES)
+
+LOCAL_WHOLE_STATIC_LIBRARIES := libmesa_genxml
+
+include $(MESA_COMMON_MK)
+include $(BUILD_STATIC_LIBRARY)
+
+# ---
  # Build libmesa_isl
  # ---
  
@@ -187,6 +206,7 @@ LOCAL_WHOLE_STATIC_LIBRARIES := \

libmesa_isl_gen75 \
libmesa_isl_gen8 \
libmesa_isl_gen9 \
+   libmesa_isl_gen10 \
libmesa_genxml
  
  # Autogenerated sources

diff --git a/src/intel/Android.vulkan.mk b/src/intel/Android.vulkan.mk
index 831b658..566db29 100644
--- a/src/intel/Android.vulkan.mk
+++ b/src/intel/Android.vulkan.mk
@@ -158,6 +158,26 @@ include $(MESA_COMMON_MK)
  include $(BUILD_STATIC_LIBRARY)
  
  #

+# libanv for gen10
+#
+
+include $(CLEAR_VARS)
+LOCAL_MODULE := libmesa_anv_gen10
+LOCAL_MODULE_CLASS := STATIC_LIBRARIES
+
+LOCAL_SRC_FILES := $(VULKAN_GEN10_FILES)
+LOCAL_CFLAGS := -DGEN_VERSIONx10=100
+
+LOCAL_C_INCLUDES := $(ANV_INCLUDES)
+
+LOCAL_WHOLE_STATIC_LIBRARIES := libmesa_anv_entrypoints libmesa_genxml
+
+LOCAL_SHARED_LIBRARIES := libdrm
+
+include $(MESA_COMMON_MK)
+include $(BUILD_STATIC_LIBRARY)
+
+#
  # libmesa_vulkan_common
  #
  
@@ -228,6 +248,7 @@ LOCAL_WHOLE_STATIC_LIBRARIES := \

libmesa_anv_gen75 \
libmesa_anv_gen8 \
libmesa_anv_gen9 \
+   libmesa_anv_gen10 \
libmesa_intel_compiler \
libmesa_anv_entrypoints
  
diff --git a/src/mesa/drivers/dri/i965/Android.mk b/src/mesa/drivers/dri/i965/Android.mk

index 7c4fada..7ee9ab7 100644
--- a/src/mesa/drivers/dri/i965/Android.mk
+++ b/src/mesa/drivers/dri/i965/Android.mk
@@ -47,7 +47,8 @@ I965_PERGEN_LIBS := \
libmesa_i965_gen7 \
libmesa_i965_gen75 \
libmesa_i965_gen8 \
-   libmesa_i965_gen9
+   libmesa_i965_gen9 \
+   libmesa_i965_gen10
  
  # ---

  # Build libmesa_i965_gen4
@@ -218,6 +219,27 @@ include $(MESA_COMMON_MK)
  include $(BUILD_STATIC_LIBRARY)
  
  # ---

+# Build libmesa_i965_gen10
+# ---
+
+include $(CLEAR_VARS)
+
+LOCAL_MODULE := libmesa_i965_gen10
+
+LOCAL_C_INCLUDES := $(I965_PERGEN_COMMON_INCLUDES)
+
+LOCAL_SRC_FILES := $(i965_gen10_FILES)
+
+LOCAL_SHARED_LIBRARIES := $(I965_PERGEN_SHARED_LIBRARIES)
+
+LOCAL_STATIC_LIBRARIES := $(I965_PERGEN_STATIC_LIBRARIES)
+
+LOCAL_CFLAGS := -DGEN_VERSIONx10=100
+
+include $(MESA_COMMON_MK)
+include $(BUILD_STATIC_LIBRARY)
+
+# ---
  # Build i965_dri
  # ---
  


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


Re: [Mesa-dev] [PATCH] egl/android: support for EGL_KHR_partial_update

2017-06-01 Thread Tapani Pälli

Hi Harish;

One thing left for the basic plumbing, sorry I did not mention this 
earlier. Please add a "_eglReturnFalse" fallback for 
eglSetDamageRegionKHR (see _eglInitDriverFallbacks).


Also see one small but significant change below in 'ClampRects' ..

On 06/01/2017 07:42 AM, Harish Krupo wrote:

This patch adds support for the EGL_KHR_partial_update extension for
android platform. It passes 36/37 tests in dEQP for EGL_KHR_partial_update.
1 test not supported.

Signed-off-by: Harish Krupo 
---
  src/egl/drivers/dri2/egl_dri2.c | 12 +
  src/egl/drivers/dri2/egl_dri2.h |  4 ++
  src/egl/drivers/dri2/platform_android.c | 33 +
  src/egl/main/eglapi.c   | 85 +
  src/egl/main/eglapi.h   |  2 +
  src/egl/main/egldisplay.h   |  1 +
  src/egl/main/eglentrypoint.h|  1 +
  src/egl/main/eglsurface.c   |  8 
  src/egl/main/eglsurface.h   | 12 +
  9 files changed, 158 insertions(+)

diff --git a/src/egl/drivers/dri2/egl_dri2.c b/src/egl/drivers/dri2/egl_dri2.c
index 0be7132ac5..c58efbf4d6 100644
--- a/src/egl/drivers/dri2/egl_dri2.c
+++ b/src/egl/drivers/dri2/egl_dri2.c
@@ -1464,6 +1464,17 @@ dri2_swap_buffers_region(_EGLDriver *drv, _EGLDisplay 
*dpy, _EGLSurface *surf,
  }
  
  static EGLBoolean

+dri2_set_damage_region(_EGLDriver *drv, _EGLDisplay *dpy, _EGLSurface *surf,
+   EGLint *rects, EGLint n_rects)
+{
+   struct dri2_egl_display *dri2_dpy = dri2_egl_display(dpy);
+   if (dri2_dpy->vtbl->set_damage_region)
+  return dri2_dpy->vtbl->set_damage_region(drv, dpy, surf, rects, n_rects);
+
+   return EGL_FALSE;
+}
+
+static EGLBoolean
  dri2_post_sub_buffer(_EGLDriver *drv, _EGLDisplay *dpy, _EGLSurface *surf,
   EGLint x, EGLint y, EGLint width, EGLint height)
  {
@@ -2958,6 +2969,7 @@ _eglBuiltInDriverDRI2(const char *args)
 dri2_drv->base.API.SwapBuffers = dri2_swap_buffers;
 dri2_drv->base.API.SwapBuffersWithDamageEXT = 
dri2_swap_buffers_with_damage;
 dri2_drv->base.API.SwapBuffersRegionNOK = dri2_swap_buffers_region;
+   dri2_drv->base.API.SetDamageRegion = dri2_set_damage_region;
 dri2_drv->base.API.PostSubBufferNV = dri2_post_sub_buffer;
 dri2_drv->base.API.CopyBuffers = dri2_copy_buffers,
 dri2_drv->base.API.QueryBufferAge = dri2_query_buffer_age;
diff --git a/src/egl/drivers/dri2/egl_dri2.h b/src/egl/drivers/dri2/egl_dri2.h
index fdeffb3a85..d2aeda2c83 100644
--- a/src/egl/drivers/dri2/egl_dri2.h
+++ b/src/egl/drivers/dri2/egl_dri2.h
@@ -118,6 +118,10 @@ struct dri2_egl_display_vtbl {
_EGLSurface *surface,
const EGLint *rects, EGLint 
n_rects);
  
+   EGLBoolean (*set_damage_region)(_EGLDriver *drv, _EGLDisplay *dpy,

+   _EGLSurface *surface,
+   const EGLint *rects, EGLint n_rects);
+
 EGLBoolean (*swap_buffers_region)(_EGLDriver *drv, _EGLDisplay *dpy,
   _EGLSurface *surf, EGLint numRects,
   const EGLint *rects);
diff --git a/src/egl/drivers/dri2/platform_android.c 
b/src/egl/drivers/dri2/platform_android.c
index 1ae779e59c..0752e330b4 100644
--- a/src/egl/drivers/dri2/platform_android.c
+++ b/src/egl/drivers/dri2/platform_android.c
@@ -651,6 +651,37 @@ droid_swap_buffers(_EGLDriver *drv, _EGLDisplay *disp, 
_EGLSurface *draw)
 return EGL_TRUE;
  }
  
+static EGLBoolean

+droid_set_damage_region(_EGLDriver *drv,
+_EGLDisplay *disp,
+_EGLSurface *draw, const EGLint* rects, EGLint n_rects)
+{
+   struct dri2_egl_display *dri2_dpy = dri2_egl_display(disp);
+   struct dri2_egl_surface *dri2_surf = dri2_egl_surface(draw);
+   android_native_rect_t* droid_rects = NULL;
+   if (n_rects != 0)
+  droid_rects = (android_native_rect_t *)
+ calloc(n_rects, sizeof(android_native_rect_t));
+
+   EGLint surfWidth = dri2_surf->base.Width;
+   EGLint surfHeight = dri2_surf->base.Height;
+   EGLint dIndex;
+
+   for (dIndex = 0; dIndex < n_rects; dIndex++) {
+  EGLint i = dIndex * 4;
+  droid_rects[dIndex].left = rects[i]; // left == x
+  droid_rects[dIndex].bottom = rects[i + 1]; // bottom == y
+  droid_rects[dIndex].right = rects[i] + rects[i + 2]; // left + width
+  droid_rects[dIndex].top = rects[i + 1] + rects[i + 3]; // bottom + height
+   }
+
+   native_window_set_surface_damage(dri2_surf->window, droid_rects, n_rects);
+
+   free(droid_rects);
+
+   return EGL_TRUE;
+}
+
  static _EGLImage *
  droid_create_image_from_prime_fd_yuv(_EGLDisplay *disp, _EGLContext *ctx,
   struct ANativeWindowBuffer *buf, int fd)
@@ -1101,6 +1132,7 @@ static struct dri2_egl_display_vtbl droid_display_vtbl = {
 .swap_buffers = 

Re: [Mesa-dev] [PATCH] Android: major/minor/makedev live in

2017-05-30 Thread Tapani Pälli

Reviewed-by: Tapani Pälli <tapani.pa...@intel.com>

On 05/30/2017 03:23 PM, Rob Herring wrote:

sysmacros.h was getting implicitly included in types.h until recently in
AOSP master. Define MAJOR_IN_SYSMACROS to explicitly include sysmacros.h.

Signed-off-by: Rob Herring <r...@kernel.org>
---
  Android.common.mk | 1 +
  1 file changed, 1 insertion(+)

diff --git a/Android.common.mk b/Android.common.mk
index b2bb11a74c17..8496c6ec09ce 100644
--- a/Android.common.mk
+++ b/Android.common.mk
@@ -65,6 +65,7 @@ LOCAL_CFLAGS += \
-DHAVE_DLOPEN \
-DHAVE_DL_ITERATE_PHDR \
-DTEXTURE_FLOAT_ENABLED \
+   -DMAJOR_IN_SYSMACROS \
-fvisibility=hidden \
-Wno-sign-compare
  



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


Re: [Mesa-dev] [PATCH 2/9] i965/dri: Combine declaration and assignment in intelCreateBuffer

2017-05-29 Thread Tapani Pälli



On 05/29/2017 09:55 AM, Martin Peres wrote:

On 27/05/17 01:15, Chad Versace wrote:

Trivial cleanup.
---
  src/mesa/drivers/dri/i965/intel_screen.c | 3 +--
  1 file changed, 1 insertion(+), 2 deletions(-)

diff --git a/src/mesa/drivers/dri/i965/intel_screen.c 
b/src/mesa/drivers/dri/i965/intel_screen.c
index 5de6f18b84..24123e7986 100644
--- a/src/mesa/drivers/dri/i965/intel_screen.c
+++ b/src/mesa/drivers/dri/i965/intel_screen.c
@@ -1169,12 +1169,11 @@ intelCreateBuffer(__DRIscreen *dri_screen,
 mesa_format rgbFormat;
 unsigned num_samples =
intel_quantize_num_samples(screen, mesaVis->samples);
-   struct gl_framebuffer *fb;
  
 if (isPixmap)

return false;
  
-   fb = CALLOC_STRUCT(gl_framebuffer);

+   struct gl_framebuffer *fb = CALLOC_STRUCT(gl_framebuffer);
 if (!fb)
return false;
  



Do we compile mesa with c99 nowadays? Did I miss anything?


Yes, AFAICT has been in use some years already :)

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


Re: [Mesa-dev] [PATCH 0/9] i965: A few tiny trivial cleanups

2017-05-29 Thread Tapani Pälli

LGTM
Reviewed-by: Tapani Pälli <tapani.pa...@intel.com>

On 05/27/2017 01:15 AM, Chad Versace wrote:

I was hacking on the i965/DRI glue, and on brw_surface_formats.c, and
I found several little cleanups to make the code nicer. All these
patches are super small.

Chad Versace (9):
   i965/dri: Rewrite comment for intelCreateBuffer
   i965/dri: Combine declaration and assignment in intelCreateBuffer
   i965: Rename intel_create_renderbuffer
   i965: Fix type of intel_update_image_buffers::format
   i965: Move an 'i' declaration into its 'for' loop
   i965: Add whitespace in intel_update_image_buffers()
   i965: Document type of GLuint __DRIimage::format
   i965: Move func to right comment block in brw_context.h
   i965: Fix type of brw_context::render_target_format[]

  src/mesa/drivers/dri/i965/brw_blorp.c|  4 ++--
  src/mesa/drivers/dri/i965/brw_context.c  |  7 ---
  src/mesa/drivers/dri/i965/brw_context.h  |  4 ++--
  src/mesa/drivers/dri/i965/brw_wm_surface_state.c |  4 ++--
  src/mesa/drivers/dri/i965/intel_fbo.c| 11 ++-
  src/mesa/drivers/dri/i965/intel_fbo.h|  2 +-
  src/mesa/drivers/dri/i965/intel_image.h  |  2 +-
  src/mesa/drivers/dri/i965/intel_screen.c | 13 -
  8 files changed, 26 insertions(+), 21 deletions(-)


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


Re: [Mesa-dev] [PATCH 0/2] egl/android: A few trivial cleanups

2017-05-28 Thread Tapani Pälli

Reviewed-by: Tapani Pälli <tapani.pa...@intel.com>

On 05/27/2017 01:09 AM, Chad Versace wrote:

Chad Versace (2):
   egl/android: Align channel masks in HAL_PIXEL_FORMAT table
   egl/android: Drop unused 'format' param in get_back_bo()

  src/egl/drivers/dri2/platform_android.c | 12 ++--
  1 file changed, 6 insertions(+), 6 deletions(-)


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


[Mesa-dev] [PATCH] android: add -Wl, --build-id=sha1 to LDFLAGS for libvulkan_intel

2017-05-19 Thread Tapani Pälli
Just like is done on desktop and what is expected by the build-id code.

Signed-off-by: Tapani Pälli <tapani.pa...@intel.com>
---

Jason, I commented before that this did not work but it seems I had other
changes when testing that screwed up things, sorry for that, this works
just fine!

 src/intel/Android.vulkan.mk | 2 ++
 1 file changed, 2 insertions(+)

diff --git a/src/intel/Android.vulkan.mk b/src/intel/Android.vulkan.mk
index adb2a93..be23a00 100644
--- a/src/intel/Android.vulkan.mk
+++ b/src/intel/Android.vulkan.mk
@@ -209,6 +209,8 @@ include $(CLEAR_VARS)
 LOCAL_MODULE := libvulkan_intel
 LOCAL_MODULE_CLASS := SHARED_LIBRARIES
 
+LOCAL_LDFLAGS += -Wl,--build-id=sha1
+
 LOCAL_SRC_FILES := \
$(VULKAN_GEM_FILES)
 
-- 
2.9.3

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


Re: [Mesa-dev] [PATCH] i965: Add RGBX8888 and RGBA8888 to EGL configure and reorder the list

2017-05-18 Thread Tapani Pälli



On 05/19/2017 04:19 AM, Xu, Randy wrote:

-Original Message-
From: Rob Herring [mailto:r...@kernel.org]
Sent: Friday, May 19, 2017 6:01 AM
To: Emil Velikov 
Cc: Chih-Wei Huang ; ML mesa-dev ; Xu, Randy 
Subject: Re: [Mesa-dev] [PATCH] i965: Add RGBX and RGBA to EGL
configure and reorder the list

On Thu, May 18, 2017 at 5:25 AM, Emil Velikov 
wrote:

On 18 May 2017 at 05:10, Chih-Wei Huang 

wrote:

2017-05-18 12:01 GMT+08:00 Xu, Randy :



-Original Message-
From: Palli, Tapani


It's just applied. Isn't it?
Yesterday without this patch
the color format is mismatch apparently.


Yeah we do need this. TBH I don't quite understand why but will try
to figure it out. I remember we used to have a patch in
Surfaceflinger at one point because visual was hardcoded there and this

might be related.


// Tapani


Sorry, that's for different issue, I mix it with RGB565 blending one.
This patch is required because some Android GLES test apps, like

gl2_basic, need to create RGBA surface.


Indeed it is.

As Emil pointed out, the patch was merged before but reverted later
since it broke desktop.

So what's the current upstreaming plan?


No idea about a plan, but how you can fix it once and for all:

Extend the loader extension(s) to have a get_caps() callback,
analogous to __DRIimageExtension::getCapabilities.
Then the DRI module will query [the loader] and advertise the
RGBX/RGBA visuals when possible.


Could we do something compile time instead to enable just for Android?
Seems like a lot of complexity when the platform needing these pixel formats
doesn't need the backwards compatibility. Or maybe there are other things
needing this interface?


I also wish that, can we use macro, like "#if ANDROID" ?
It's not necessary to enable these two visuals for all platform, but it's 
really important for Android.


IMO we should fix Android instead, there is no reason why it would 
*require* these formats.


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


Re: [Mesa-dev] [Mesa-stable] [PATCH] egl: Partially revert 23c86c74, fix eglMakeCurrent

2017-05-18 Thread Tapani Pälli

On 05/18/2017 12:16 AM, Tomasz Figa wrote:

Hi,

On Tue, May 16, 2017 at 11:35 PM, Tapani Pälli <tapani.pa...@intel.com> wrote:


On 05/16/2017 08:10 PM, Chad Versace wrote:

On Tue 16 May 2017, Tapani Pälli wrote:



On 05/16/2017 02:04 AM, Chad Versace wrote:

Fixes regressions in Android CtsVerifier.apk on Intel Chrome OS devices
due to incorrect error handling in eglMakeCurrent. See below on how to
confirm the regression is fixed.

This partially reverts

   commit 23c86c74cc450a23848b85cfe914376caede1cdf
   Author:  Chad Versace <chadvers...@chromium.org>
   Subject: egl: Emit error when EGLSurface is lost

The bad commit added the error handling below. #2 and #3 were right,
but #1 was wrong.

   1. eglMakeCurrent emits EGL_BAD_CURRENT_SURFACE if the calling
  thread has unflushed commands and either previous surface is no
  longer valid.

   2. eglMakeCurrent emits EGL_BAD_NATIVE_WINDOW if either new
surface
  is no longer valid.

   3. eglSwapBuffers emits EGL_BAD_NATIVE_WINDOW if the swapped
surface
  is no longer valid.

Whe I wrote the bad commit, I misunderstood the EGL spec language
for #1. The correct behavior is, if I understand correctly now:

   - Assume a bound EGLSurface is no longer valid.
   - Assume the bound EGLContext has unflushed commands.
   - The app calls eglMakeCurrent. The spec requires eglMakeCurrent
to
 implicitly flush. After flushing, eglMakeCurrent emits
 EGL_BAD_CURRENT_SURFACE and does *not* alter the thread's
 current bindings.
   - If the app calls eglMakeCurrent again, and the app inserts no
 commands into the GL command stream between the two
eglMakeCurrent
 calls, then this second eglMakeCurrent succeeds without emitting
an
 error.

How to confirm this fixes the regression:

   Download android-cts-verifier-7.1_r5-linux_x86-x86.zip from
   source.android.com, unpack, and `adb install CtsVerifier.apk`.
   Run test "Projection Cube". Click the Pass button (a
   green checkmark). Then run test "Projection Widget". Confirm that
   widgets are visible and that logcat does not complain about
   eglMakeCurrent failure.

   Then confirm there are no regressions in the cts-traded module
that
   commit 263243b1 fixed:

   cts-tf > run cts --skip-preconditions --skip-device-info \
-m CtsCameraTestCases \
-t android.hardware.camera2.cts.RobustnessTest

   Tested with Chrome OS board "reef".


both tests passed on Android-IA with this patch ... but if I minimize
"Projection Widget" test it starts to bang EGL_BAD_NATIVE_WINDOW heavily.
Is
this expected behavior?


I'm unsure. I haven't yet tried that experiment. I'll give it a try when
I'm back at my desk.

Which EGL function is emitting EGL_BAD_NATIVE_WINDOW in logcat?
eglMakeCurrent or eglSwapBuffers, or something else?


doh sorry, I actually meant 'Projection Cube' test, not the widget test. But
yep, when tapping switcher button eglMakeCurrent starts to emit the error
(likely the app just continues to submit frames even when it's
'minimized'?). When switching back to app it cannot draw anymore as it keeps
getting the error.

I don't remember exactly and I'm not an Android app expert either, but
I remember hearing something that the app needs to stop drawing when
the activity is paused (stopped?). Isn't that what's happening when an
app gets minimized?


Yep, this is very likely the case and the app here is just not obeying 
the rules. Considering that Android wraps EGL layer it seems weird that 
it just let's application to do this. Any case, since everything else 
works fine this is definitely not a blocker for me for this patch;


Acked-by: Tapani Pälli <tapani.pa...@intel.com>


Best regards,
Tomasz


What was the behavior before this patch? And before
commit 23c86c74 (egl: Emit error when EGLSurface is lost)?


Without this patch (and before commit 23c86c74) I can minimize app to
switcher and bring it back and it continues to draw.

Note that everything else seems to work just fine though (tested lots of GL
apps) so is this just something specific what cts-verifier is doing or not
handling properly?




Cc: "17.1" <mesa-sta...@lists.freedesktop.org>
Cc: Tomasz Figa <tf...@chromium.org>
Cc: Nicolas Boichat <drink...@chromium.org>
Cc: Emil Velikov <emil.veli...@collabora.com>
Fixes: 23c86c74 (egl: Emit error when EGLSurface is lost)
---
src/egl/main/eglapi.c | 19 ---
1 file changed, 19 deletions(-)

diff --git a/src/egl/main/eglapi.c b/src/egl/main/eglapi.c
index aa0eb94666..9cea2f41ff 100644
--- a/src/egl/main/eglapi.c
+++ b/src/egl/main/eglapi.c
@@ -828,25 +828,6 @@ eglMakeCurrent(EGLDisplay dpy, EGLSurface draw,
EGLSurface read,
 RETURN_EGL_ERROR(disp, EGL_BAD_MATCH, EGL_FALSE);
 

[Mesa-dev] [PATCH] egl/android: fix segfault within swap_buffers

2017-05-18 Thread Tapani Pälli
Function droid_swap_buffers may get called without dri2_surf->buffer set,
in these cases we don't have a back buffer set either. Patch fixes segfault
seen with 3DMark that uses android.opengl.GLSurfaceView for rendering it's UI.

backtrace:
   #00 pc 00013f88  /system/lib/egl/libGLES_mesa.so (droid_swap_buffers+104)
   #01 pc 000117b2  /system/lib/egl/libGLES_mesa.so (dri2_swap_buffers+50)
   #02 pc 58b2  /system/lib/egl/libGLES_mesa.so (eglSwapBuffers+386)
   #03 pc 00011329  /system/lib/libEGL.so (eglSwapBuffersWithDamageKHR+553)
   #04 pc 000118e7  /system/lib/libEGL.so (eglSwapBuffers+55)
   #05 pc 000754dc  /system/lib/libandroid_runtime.so

Note, this is v1 as v2 caused dEQP regressions.

Fixes: 2acc69d ("EGL/Android: Add EGL_EXT_buffer_age extension")
Signed-off-by: Tapani Pälli <tapani.pa...@intel.com>
---
 src/egl/drivers/dri2/platform_android.c | 4 +++-
 1 file changed, 3 insertions(+), 1 deletion(-)

diff --git a/src/egl/drivers/dri2/platform_android.c 
b/src/egl/drivers/dri2/platform_android.c
index 49cbeb4..88f6af8 100644
--- a/src/egl/drivers/dri2/platform_android.c
+++ b/src/egl/drivers/dri2/platform_android.c
@@ -628,7 +628,9 @@ droid_swap_buffers(_EGLDriver *drv, _EGLDisplay *disp, 
_EGLSurface *draw)
   if (dri2_surf->color_buffers[i].age > 0)
  dri2_surf->color_buffers[i].age++;
}
-   dri2_surf->back->age = 1;
+
+   if (dri2_surf->back)
+  dri2_surf->back->age = 1;
 
dri2_flush_drawable_for_swapbuffers(disp, draw);
 
-- 
2.9.3

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


Re: [Mesa-dev] [PATCH] i965: Add RGBX8888 and RGBA8888 to EGL configure and reorder the list

2017-05-17 Thread Tapani Pälli

On 05/18/2017 07:10 AM, Chih-Wei Huang wrote:

2017-05-18 12:01 GMT+08:00 Xu, Randy :

-Original Message-
From: Palli, Tapani

It's just applied. Isn't it?
Yesterday without this patch
the color format is mismatch apparently.

Yeah we do need this. TBH I don't quite understand why but will try to figure
it out. I remember we used to have a patch in Surfaceflinger at one point
because visual was hardcoded there and this might be related.

// Tapani

Sorry, that's for different issue, I mix it with RGB565 blending one.
This patch is required because some Android GLES test apps, like gl2_basic, 
need to create RGBA surface.

Indeed it is.

As Emil pointed out, the patch was merged before
but reverted later since it broke desktop.

So what's the current upstreaming plan?



I believe this visual is not supported by our driver properly, as 
example the angeles demo (one of those 'native test apps') has a lot of 
rendering artifacts so at least for now this will be only in Android tree.



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


Re: [Mesa-dev] [PATCH] i965: Add RGBX8888 and RGBA8888 to EGL configure and reorder the list

2017-05-17 Thread Tapani Pälli

On 05/18/2017 06:41 AM, Chih-Wei Huang wrote:

2017-05-18 11:26 GMT+08:00 Xu, Randy :

-Original Message-
From: Chih-Wei Huang [mailto:cwhu...@android-x86.org]
Sent: Thursday, May 18, 2017 11:04 AM
To: Xu, Randy 
Cc: Emil Velikov ; ML mesa-dev 
Subject: Re: [Mesa-dev] [PATCH] i965: Add RGBX and RGBA to EGL
configure and reorder the list

2017-05-12 12:04 GMT+08:00 Xu, Randy :

Thanks, Emil

dEQP has patch to exclude 565 blend cases (commit named "Exclude

RGB565 blending cases from the must-pass"), so we don’t need any patches
now.

Hi Randy, Tapani,
I think we still need a patch. Right?
I see the similar patch is still applied to Android-IA codebase.

Which patch do you means? As Google has excluded the RGB565 for blending test, 
we don’t need patch Mesa

This one:
https://github.com/android-ia/external-mesa/commit/72d5e389c6adfbca8ec18885c93191dc62c78c82

It's just applied. Isn't it?
Yesterday without this patch
the color format is mismatch apparently.



Yeah we do need this. TBH I don't quite understand why but will try to 
figure it out. I remember we used to have a patch in Surfaceflinger at 
one point because visual was hardcoded there and this might be related.


// Tapani

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


Re: [Mesa-dev] [PATCH] mesa: Allow MESA_FORMAT_LAYOUT_S3TC in non-desktop mesa

2017-05-17 Thread Tapani Pälli



On 05/17/2017 12:05 PM, Tapani Pälli wrote:



On 05/17/2017 11:49 AM, Gao, Chun wrote:
Thanks for your comments. Are we working on GL_EXT_sRGB, or is there 
any plan for that?


There has been work done to enable it:

https://patchwork.freedesktop.org/patch/148975/

I believe Harish has been fixing some of the faults, work is still ongoing.


although yeah now when reading the spec, it's not going to solve this 
one, it says:


--- 8< ---

3) Should we allow the SRGB_*_S3TC_DXT* or any of the other COMPRESSED 
formats if the implementation supports any of those formats?


No since all hardware doesn't support this.  It can be added as a 
separate extension if needed.

--- 8< ---

so ... ATM I'm not sure what the correct solution here is.





-Original Message-
From: Palli, Tapani
Sent: Wednesday, May 17, 2017 4:35 PM
To: Gao, Chun <chun@intel.com>; mesa-dev@lists.freedesktop.org
Subject: Re: [Mesa-dev] [PATCH] mesa: Allow MESA_FORMAT_LAYOUT_S3TC in 
non-desktop mesa




On 05/17/2017 11:09 AM, Gao, Chun wrote:

I know EXT_texture_sRGB  is desktop OpenGL extension.
On Android-IA and ChromeOS ARC++, the game 
https://play.google.com/store/apps/details?id=com.eline.neveralonemobile 
could not display some texture correctly. I found the following 
formats which the game uses were blocked in 
_mesa_is_compressed_format():

GL_COMPRESSED_SRGB_ALPHA_S3TC_DXT5_EXT
GL_COMPRESSED_SRGB_S3TC_DXT1_EXT
GL_COMPRESSED_RGBA_S3TC_DXT5_EXT
GL_COMPRESSED_RGB_S3TC_DXT1_EXT

After removing _mesa_is_desktop_gl(ctx), the issue get fixed. I don't 
know why the android game uses desktop OpenGL formats 
GL_COMPRESSED_SRGB_ALPHA_S3TC_DXT5_EXT and 
GL_COMPRESSED_SRGB_S3TC_DXT1_EXT.  To make it work, I removed the 
desktop check.


OK, this is useful information and means that the game has a bug.

If I understand requirements correctly here if/when GL_EXT_sRGB 
extension support is added, then this game should start to work OK.





-Original Message-
From: Palli, Tapani
Sent: Wednesday, May 17, 2017 3:36 PM
To: Gao, Chun <chun@intel.com>; mesa-dev@lists.freedesktop.org
Subject: Re: [Mesa-dev] [PATCH] mesa: Allow MESA_FORMAT_LAYOUT_S3TC 
in non-desktop mesa


IMO this is not correct. Are you having problems with some application?

For Android games Mesa should already return true for the previous check
(ANGLE_texture_compression_dxt) and things should work OK. The check 
you are touching is desktop specific because EXT_texture_sRGB is 
available only on desktop GL (closest gles equivalent being 
GL_EXT_sRGB which we don't support).



On 05/17/2017 10:22 AM, Gao Chun wrote:

As s3tc formats are used in many Android games, desktop mesa check
should be removed for MESA_FORMAT_LAYOUT_S3TC.
---
src/mesa/main/glformats.c | 3 +--
1 file changed, 1 insertion(+), 2 deletions(-)

diff --git a/src/mesa/main/glformats.c b/src/mesa/main/glformats.c
index 4f240206ff45..e4f283c4dfa8 100644
--- a/src/mesa/main/glformats.c
+++ b/src/mesa/main/glformats.c
@@ -1376,8 +1376,7 @@ _mesa_is_compressed_format(const struct 
gl_context *ctx, GLenum format)

  */
 return ctx->Extensions.ANGLE_texture_compression_dxt;
  } else {
- return _mesa_is_desktop_gl(ctx)
-&& ctx->Extensions.EXT_texture_sRGB
+ return ctx->Extensions.EXT_texture_sRGB
&& ctx->Extensions.EXT_texture_compression_s3tc;
  }
   case MESA_FORMAT_LAYOUT_FXT1:


___
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: Allow MESA_FORMAT_LAYOUT_S3TC in non-desktop mesa

2017-05-17 Thread Tapani Pälli



On 05/17/2017 11:49 AM, Gao, Chun wrote:

Thanks for your comments. Are we working on GL_EXT_sRGB, or is there any plan 
for that?


There has been work done to enable it:

https://patchwork.freedesktop.org/patch/148975/

I believe Harish has been fixing some of the faults, work is still ongoing.



-Original Message-
From: Palli, Tapani
Sent: Wednesday, May 17, 2017 4:35 PM
To: Gao, Chun ; mesa-dev@lists.freedesktop.org
Subject: Re: [Mesa-dev] [PATCH] mesa: Allow MESA_FORMAT_LAYOUT_S3TC in 
non-desktop mesa



On 05/17/2017 11:09 AM, Gao, Chun wrote:

I know EXT_texture_sRGB  is desktop OpenGL extension.
On Android-IA and ChromeOS ARC++, the game 
https://play.google.com/store/apps/details?id=com.eline.neveralonemobile could 
not display some texture correctly. I found the following formats which the 
game uses were blocked in _mesa_is_compressed_format():
GL_COMPRESSED_SRGB_ALPHA_S3TC_DXT5_EXT
GL_COMPRESSED_SRGB_S3TC_DXT1_EXT
GL_COMPRESSED_RGBA_S3TC_DXT5_EXT
GL_COMPRESSED_RGB_S3TC_DXT1_EXT

After removing _mesa_is_desktop_gl(ctx), the issue get fixed. I don't know why 
the android game uses desktop OpenGL formats 
GL_COMPRESSED_SRGB_ALPHA_S3TC_DXT5_EXT and GL_COMPRESSED_SRGB_S3TC_DXT1_EXT.  
To make it work, I removed the desktop check.


OK, this is useful information and means that the game has a bug.

If I understand requirements correctly here if/when GL_EXT_sRGB extension 
support is added, then this game should start to work OK.




-Original Message-
From: Palli, Tapani
Sent: Wednesday, May 17, 2017 3:36 PM
To: Gao, Chun ; mesa-dev@lists.freedesktop.org
Subject: Re: [Mesa-dev] [PATCH] mesa: Allow MESA_FORMAT_LAYOUT_S3TC in 
non-desktop mesa

IMO this is not correct. Are you having problems with some application?

For Android games Mesa should already return true for the previous check
(ANGLE_texture_compression_dxt) and things should work OK. The check you are 
touching is desktop specific because EXT_texture_sRGB is available only on 
desktop GL (closest gles equivalent being GL_EXT_sRGB which we don't support).


On 05/17/2017 10:22 AM, Gao Chun wrote:

As s3tc formats are used in many Android games, desktop mesa check
should be removed for MESA_FORMAT_LAYOUT_S3TC.
---
src/mesa/main/glformats.c | 3 +--
1 file changed, 1 insertion(+), 2 deletions(-)

diff --git a/src/mesa/main/glformats.c b/src/mesa/main/glformats.c
index 4f240206ff45..e4f283c4dfa8 100644
--- a/src/mesa/main/glformats.c
+++ b/src/mesa/main/glformats.c
@@ -1376,8 +1376,7 @@ _mesa_is_compressed_format(const struct gl_context *ctx, 
GLenum format)
  */
 return ctx->Extensions.ANGLE_texture_compression_dxt;
  } else {
- return _mesa_is_desktop_gl(ctx)
-&& ctx->Extensions.EXT_texture_sRGB
+ return ctx->Extensions.EXT_texture_sRGB
&& ctx->Extensions.EXT_texture_compression_s3tc;
  }
   case MESA_FORMAT_LAYOUT_FXT1:


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


Re: [Mesa-dev] [PATCH] mesa: Allow MESA_FORMAT_LAYOUT_S3TC in non-desktop mesa

2017-05-17 Thread Tapani Pälli



On 05/17/2017 11:09 AM, Gao, Chun wrote:

I know EXT_texture_sRGB  is desktop OpenGL extension.
On Android-IA and ChromeOS ARC++, the game 
https://play.google.com/store/apps/details?id=com.eline.neveralonemobile could 
not display some texture correctly. I found the following formats which the 
game uses were blocked in _mesa_is_compressed_format():
GL_COMPRESSED_SRGB_ALPHA_S3TC_DXT5_EXT
GL_COMPRESSED_SRGB_S3TC_DXT1_EXT
GL_COMPRESSED_RGBA_S3TC_DXT5_EXT
GL_COMPRESSED_RGB_S3TC_DXT1_EXT

After removing _mesa_is_desktop_gl(ctx), the issue get fixed. I don't know why 
the android game uses desktop OpenGL formats 
GL_COMPRESSED_SRGB_ALPHA_S3TC_DXT5_EXT and GL_COMPRESSED_SRGB_S3TC_DXT1_EXT.  
To make it work, I removed the desktop check.


OK, this is useful information and means that the game has a bug.

If I understand requirements correctly here if/when GL_EXT_sRGB 
extension support is added, then this game should start to work OK.





-Original Message-
From: Palli, Tapani
Sent: Wednesday, May 17, 2017 3:36 PM
To: Gao, Chun ; mesa-dev@lists.freedesktop.org
Subject: Re: [Mesa-dev] [PATCH] mesa: Allow MESA_FORMAT_LAYOUT_S3TC in 
non-desktop mesa

IMO this is not correct. Are you having problems with some application?

For Android games Mesa should already return true for the previous check
(ANGLE_texture_compression_dxt) and things should work OK. The check you are 
touching is desktop specific because EXT_texture_sRGB is available only on 
desktop GL (closest gles equivalent being GL_EXT_sRGB which we don't support).


On 05/17/2017 10:22 AM, Gao Chun wrote:

As s3tc formats are used in many Android games, desktop mesa check
should be removed for MESA_FORMAT_LAYOUT_S3TC.
---
   src/mesa/main/glformats.c | 3 +--
   1 file changed, 1 insertion(+), 2 deletions(-)

diff --git a/src/mesa/main/glformats.c b/src/mesa/main/glformats.c
index 4f240206ff45..e4f283c4dfa8 100644
--- a/src/mesa/main/glformats.c
+++ b/src/mesa/main/glformats.c
@@ -1376,8 +1376,7 @@ _mesa_is_compressed_format(const struct gl_context *ctx, 
GLenum format)
 */
return ctx->Extensions.ANGLE_texture_compression_dxt;
 } else {
- return _mesa_is_desktop_gl(ctx)
-&& ctx->Extensions.EXT_texture_sRGB
+ return ctx->Extensions.EXT_texture_sRGB
   && ctx->Extensions.EXT_texture_compression_s3tc;
 }
  case MESA_FORMAT_LAYOUT_FXT1:


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


Re: [Mesa-dev] [PATCH] mesa: Allow MESA_FORMAT_LAYOUT_S3TC in non-desktop mesa

2017-05-17 Thread Tapani Pälli

IMO this is not correct. Are you having problems with some application?

For Android games Mesa should already return true for the previous check 
(ANGLE_texture_compression_dxt) and things should work OK. The check you 
are touching is desktop specific because EXT_texture_sRGB is available 
only on desktop GL (closest gles equivalent being GL_EXT_sRGB which we 
don't support).



On 05/17/2017 10:22 AM, Gao Chun wrote:

As s3tc formats are used in many Android games, desktop mesa
check should be removed for MESA_FORMAT_LAYOUT_S3TC.
---
  src/mesa/main/glformats.c | 3 +--
  1 file changed, 1 insertion(+), 2 deletions(-)

diff --git a/src/mesa/main/glformats.c b/src/mesa/main/glformats.c
index 4f240206ff45..e4f283c4dfa8 100644
--- a/src/mesa/main/glformats.c
+++ b/src/mesa/main/glformats.c
@@ -1376,8 +1376,7 @@ _mesa_is_compressed_format(const struct gl_context *ctx, 
GLenum format)
*/
   return ctx->Extensions.ANGLE_texture_compression_dxt;
} else {
- return _mesa_is_desktop_gl(ctx)
-&& ctx->Extensions.EXT_texture_sRGB
+ return ctx->Extensions.EXT_texture_sRGB
  && ctx->Extensions.EXT_texture_compression_s3tc;
}
 case MESA_FORMAT_LAYOUT_FXT1:


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


Re: [Mesa-dev] [PATCH] Android: correct libz dependency

2017-05-17 Thread Tapani Pälli

Reviewed-by: Tapani Pälli <tapani.pa...@intel.com>

On 05/17/2017 08:10 AM, Chih-Wei Huang wrote:

Commit 6facb0c0 ("android: fix libz dynamic library dependencies")
unconditionally adds libz as a dependency to all shared libraries.
That is unnecessary.

Commit 85a9b1b5 introduced libz as a dependency to libmesa_util.
So only the shared libraries that use libmesa_util need libz.

Fix Android Lollipop build by adding the include path of zlib to
libmesa_util explicitly instead of getting the path implicitly
from zlib since it doesn't export the include path in Lollipop.

Fixes: 6facb0c0 "android: fix libz dynamic library dependencies"

Signed-off-by: Chih-Wei Huang <cwhu...@linux.org.tw>
---
  Android.common.mk  | 4 
  src/gallium/targets/dri/Android.mk | 3 ++-
  src/intel/Android.vulkan.mk| 2 +-
  src/mesa/drivers/dri/Android.mk| 3 ++-
  src/util/Android.mk| 1 +
  5 files changed, 6 insertions(+), 7 deletions(-)

diff --git a/Android.common.mk b/Android.common.mk
index 5e7fd94..a79c331 100644
--- a/Android.common.mk
+++ b/Android.common.mk
@@ -103,7 +103,3 @@ endif
  
  # Quiet down the build system and remove any .h files from the sources

  LOCAL_SRC_FILES := $(patsubst %.h, , $(LOCAL_SRC_FILES))
-
-ifneq ($(LOCAL_IS_HOST_MODULE),true)
-LOCAL_SHARED_LIBRARIES += libz
-endif
diff --git a/src/gallium/targets/dri/Android.mk 
b/src/gallium/targets/dri/Android.mk
index f72551c..8c8fb5d 100644
--- a/src/gallium/targets/dri/Android.mk
+++ b/src/gallium/targets/dri/Android.mk
@@ -35,7 +35,8 @@ LOCAL_CFLAGS :=
  LOCAL_SHARED_LIBRARIES := \
libdl \
libglapi \
-   libexpat
+   libexpat \
+   libz
  
  $(foreach d, $(MESA_BUILD_GALLIUM), $(eval LOCAL_CFLAGS += $(patsubst HAVE_%,-D%,$(d
  
diff --git a/src/intel/Android.vulkan.mk b/src/intel/Android.vulkan.mk

index 831b658..2bf56a4 100644
--- a/src/intel/Android.vulkan.mk
+++ b/src/intel/Android.vulkan.mk
@@ -231,7 +231,7 @@ LOCAL_WHOLE_STATIC_LIBRARIES := \
libmesa_intel_compiler \
libmesa_anv_entrypoints
  
-LOCAL_SHARED_LIBRARIES := libdrm

+LOCAL_SHARED_LIBRARIES := libdrm libz
  
  include $(MESA_COMMON_MK)

  include $(BUILD_SHARED_LIBRARY)
diff --git a/src/mesa/drivers/dri/Android.mk b/src/mesa/drivers/dri/Android.mk
index d4fb670..53ff4b4 100644
--- a/src/mesa/drivers/dri/Android.mk
+++ b/src/mesa/drivers/dri/Android.mk
@@ -51,7 +51,8 @@ MESA_DRI_SHARED_LIBRARIES := \
libdl \
libexpat \
libglapi \
-   liblog
+   liblog \
+   libz
  
  #---

  # Build drivers and libmesa_dri_common
diff --git a/src/util/Android.mk b/src/util/Android.mk
index 64aafbe..facdcf8 100644
--- a/src/util/Android.mk
+++ b/src/util/Android.mk
@@ -34,6 +34,7 @@ LOCAL_SRC_FILES := \
$(MESA_UTIL_FILES)
  
  LOCAL_C_INCLUDES := \

+   external/zlib \
$(MESA_TOP)/src/mesa \
$(MESA_TOP)/src/mapi \
$(MESA_TOP)/src/gallium/include \


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


Re: [Mesa-dev] [PATCH] egl: Partially revert 23c86c74, fix eglMakeCurrent

2017-05-17 Thread Tapani Pälli



On 05/16/2017 08:10 PM, Chad Versace wrote:

On Tue 16 May 2017, Tapani Pälli wrote:



On 05/16/2017 02:04 AM, Chad Versace wrote:

Fixes regressions in Android CtsVerifier.apk on Intel Chrome OS devices
due to incorrect error handling in eglMakeCurrent. See below on how to
confirm the regression is fixed.

This partially reverts

  commit 23c86c74cc450a23848b85cfe914376caede1cdf
  Author:  Chad Versace <chadvers...@chromium.org>
  Subject: egl: Emit error when EGLSurface is lost

The bad commit added the error handling below. #2 and #3 were right,
but #1 was wrong.

  1. eglMakeCurrent emits EGL_BAD_CURRENT_SURFACE if the calling
 thread has unflushed commands and either previous surface is no
 longer valid.

  2. eglMakeCurrent emits EGL_BAD_NATIVE_WINDOW if either new surface
 is no longer valid.

  3. eglSwapBuffers emits EGL_BAD_NATIVE_WINDOW if the swapped surface
 is no longer valid.

Whe I wrote the bad commit, I misunderstood the EGL spec language
for #1. The correct behavior is, if I understand correctly now:

  - Assume a bound EGLSurface is no longer valid.
  - Assume the bound EGLContext has unflushed commands.
  - The app calls eglMakeCurrent. The spec requires eglMakeCurrent to
implicitly flush. After flushing, eglMakeCurrent emits
EGL_BAD_CURRENT_SURFACE and does *not* alter the thread's
current bindings.
  - If the app calls eglMakeCurrent again, and the app inserts no
commands into the GL command stream between the two eglMakeCurrent
calls, then this second eglMakeCurrent succeeds without emitting an
error.

How to confirm this fixes the regression:

  Download android-cts-verifier-7.1_r5-linux_x86-x86.zip from
  source.android.com, unpack, and `adb install CtsVerifier.apk`.
  Run test "Projection Cube". Click the Pass button (a
  green checkmark). Then run test "Projection Widget". Confirm that
  widgets are visible and that logcat does not complain about
  eglMakeCurrent failure.

  Then confirm there are no regressions in the cts-traded module that
  commit 263243b1 fixed:

  cts-tf > run cts --skip-preconditions --skip-device-info \
   -m CtsCameraTestCases \
   -t android.hardware.camera2.cts.RobustnessTest

  Tested with Chrome OS board "reef".


both tests passed on Android-IA with this patch ... but if I minimize
"Projection Widget" test it starts to bang EGL_BAD_NATIVE_WINDOW heavily. Is
this expected behavior?


I'm unsure. I haven't yet tried that experiment. I'll give it a try when
I'm back at my desk.

Which EGL function is emitting EGL_BAD_NATIVE_WINDOW in logcat?
eglMakeCurrent or eglSwapBuffers, or something else?


doh sorry, I actually meant 'Projection Cube' test, not the widget test. 
But yep, when tapping switcher button eglMakeCurrent starts to emit the 
error (likely the app just continues to submit frames even when it's 
'minimized'?). When switching back to app it cannot draw anymore as it 
keeps getting the error.



What was the behavior before this patch? And before
commit 23c86c74 (egl: Emit error when EGLSurface is lost)?


Without this patch (and before commit 23c86c74) I can minimize app to 
switcher and bring it back and it continues to draw.


Note that everything else seems to work just fine though (tested lots of 
GL apps) so is this just something specific what cts-verifier is doing 
or not handling properly?




Cc: "17.1" <mesa-sta...@lists.freedesktop.org>
Cc: Tomasz Figa <tf...@chromium.org>
Cc: Nicolas Boichat <drink...@chromium.org>
Cc: Emil Velikov <emil.veli...@collabora.com>
Fixes: 23c86c74 (egl: Emit error when EGLSurface is lost)
---
   src/egl/main/eglapi.c | 19 ---
   1 file changed, 19 deletions(-)

diff --git a/src/egl/main/eglapi.c b/src/egl/main/eglapi.c
index aa0eb94666..9cea2f41ff 100644
--- a/src/egl/main/eglapi.c
+++ b/src/egl/main/eglapi.c
@@ -828,25 +828,6 @@ eglMakeCurrent(EGLDisplay dpy, EGLSurface draw, EGLSurface 
read,
RETURN_EGL_ERROR(disp, EGL_BAD_MATCH, EGL_FALSE);
  }
-   _EGLThreadInfo *t =_eglGetCurrentThread();
-   _EGLContext *old_ctx = t->CurrentContext;
-   _EGLSurface *old_draw_surf = old_ctx ? old_ctx->DrawSurface : NULL;
-   _EGLSurface *old_read_surf = old_ctx ? old_ctx->ReadSurface : NULL;
-
-   /* From the EGL 1.5 spec, Section 3.7.3 Binding Context and Drawables:
-*
-*If the previous context of the calling thread has unflushed commands,
-*and the previous surface is no longer valid, an
-*EGL_BAD_CURRENT_SURFACE error is generated.
-*
-* It's difficult to check if the context has unflushed commands, but it's
-* easy to check if the surface is no longer valid.
-*/
-   if (old_draw_surf && old_draw_surf->Lost)
-  R

Re: [Mesa-dev] [PATCH] egl: Partially revert 23c86c74, fix eglMakeCurrent

2017-05-15 Thread Tapani Pälli



On 05/16/2017 02:04 AM, Chad Versace wrote:

Fixes regressions in Android CtsVerifier.apk on Intel Chrome OS devices
due to incorrect error handling in eglMakeCurrent. See below on how to
confirm the regression is fixed.

This partially reverts

 commit 23c86c74cc450a23848b85cfe914376caede1cdf
 Author:  Chad Versace 
 Subject: egl: Emit error when EGLSurface is lost

The bad commit added the error handling below. #2 and #3 were right,
but #1 was wrong.

 1. eglMakeCurrent emits EGL_BAD_CURRENT_SURFACE if the calling
thread has unflushed commands and either previous surface is no
longer valid.

 2. eglMakeCurrent emits EGL_BAD_NATIVE_WINDOW if either new surface
is no longer valid.

 3. eglSwapBuffers emits EGL_BAD_NATIVE_WINDOW if the swapped surface
is no longer valid.

Whe I wrote the bad commit, I misunderstood the EGL spec language
for #1. The correct behavior is, if I understand correctly now:

 - Assume a bound EGLSurface is no longer valid.
 - Assume the bound EGLContext has unflushed commands.
 - The app calls eglMakeCurrent. The spec requires eglMakeCurrent to
   implicitly flush. After flushing, eglMakeCurrent emits
   EGL_BAD_CURRENT_SURFACE and does *not* alter the thread's
   current bindings.
 - If the app calls eglMakeCurrent again, and the app inserts no
   commands into the GL command stream between the two eglMakeCurrent
   calls, then this second eglMakeCurrent succeeds without emitting an
   error.

How to confirm this fixes the regression:

 Download android-cts-verifier-7.1_r5-linux_x86-x86.zip from
 source.android.com, unpack, and `adb install CtsVerifier.apk`.
 Run test "Projection Cube". Click the Pass button (a
 green checkmark). Then run test "Projection Widget". Confirm that
 widgets are visible and that logcat does not complain about
 eglMakeCurrent failure.

 Then confirm there are no regressions in the cts-traded module that
 commit 263243b1 fixed:

 cts-tf > run cts --skip-preconditions --skip-device-info \
  -m CtsCameraTestCases \
  -t android.hardware.camera2.cts.RobustnessTest

 Tested with Chrome OS board "reef".


both tests passed on Android-IA with this patch ... but if I minimize 
"Projection Widget" test it starts to bang EGL_BAD_NATIVE_WINDOW 
heavily. Is this expected behavior?



Cc: "17.1" 
Cc: Tomasz Figa 
Cc: Nicolas Boichat 
Cc: Emil Velikov 
Fixes: 23c86c74 (egl: Emit error when EGLSurface is lost)
---
  src/egl/main/eglapi.c | 19 ---
  1 file changed, 19 deletions(-)

diff --git a/src/egl/main/eglapi.c b/src/egl/main/eglapi.c
index aa0eb94666..9cea2f41ff 100644
--- a/src/egl/main/eglapi.c
+++ b/src/egl/main/eglapi.c
@@ -828,25 +828,6 @@ eglMakeCurrent(EGLDisplay dpy, EGLSurface draw, EGLSurface 
read,
   RETURN_EGL_ERROR(disp, EGL_BAD_MATCH, EGL_FALSE);
 }
  
-   _EGLThreadInfo *t =_eglGetCurrentThread();

-   _EGLContext *old_ctx = t->CurrentContext;
-   _EGLSurface *old_draw_surf = old_ctx ? old_ctx->DrawSurface : NULL;
-   _EGLSurface *old_read_surf = old_ctx ? old_ctx->ReadSurface : NULL;
-
-   /* From the EGL 1.5 spec, Section 3.7.3 Binding Context and Drawables:
-*
-*If the previous context of the calling thread has unflushed commands,
-*and the previous surface is no longer valid, an
-*EGL_BAD_CURRENT_SURFACE error is generated.
-*
-* It's difficult to check if the context has unflushed commands, but it's
-* easy to check if the surface is no longer valid.
-*/
-   if (old_draw_surf && old_draw_surf->Lost)
-  RETURN_EGL_ERROR(disp, EGL_BAD_CURRENT_SURFACE, EGL_FALSE);
-   if (old_read_surf && old_read_surf->Lost)
-  RETURN_EGL_ERROR(disp, EGL_BAD_CURRENT_SURFACE, EGL_FALSE);
-
 /*If a native window underlying either draw or read is no longer valid,
  *an EGL_BAD_NATIVE_WINDOW error is generated.
  */


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


Re: [Mesa-dev] [PATCH 1/3] egl/android: use the image_driver alongside the image_loader

2017-05-15 Thread Tapani Pälli



On 05/12/2017 01:22 AM, Emil Velikov wrote:

From: Emil Velikov <emil.veli...@collabora.com>

They are meant to be used together. Otherwise we'll need workarounds
like egl/wayland. Namely register an image_loader_extension even thought
we should be using only DRI2.

Signed-off-by: Emil Velikov <emil.veli...@collabora.com>
---
  src/egl/drivers/dri2/platform_android.c | 29 +++--
  1 file changed, 19 insertions(+), 10 deletions(-)

diff --git a/src/egl/drivers/dri2/platform_android.c 
b/src/egl/drivers/dri2/platform_android.c
index 49cbeb4698e..8e5bc457e00 100644
--- a/src/egl/drivers/dri2/platform_android.c
+++ b/src/egl/drivers/dri2/platform_android.c
@@ -315,6 +315,7 @@ droid_create_surface(_EGLDriver *drv, _EGLDisplay *disp, 
EGLint type,
_EGLConfig *conf, void *native_window,
const EGLint *attrib_list)
  {
+   __DRIcreateNewDrawableFunc createNewDrawable;
 struct dri2_egl_display *dri2_dpy = dri2_egl_display(disp);
 struct dri2_egl_config *dri2_conf = dri2_egl_config(conf);
 struct dri2_egl_surface *dri2_surf;
@@ -356,11 +357,15 @@ droid_create_surface(_EGLDriver *drv, _EGLDisplay *disp, 
EGLint type,
 if (!config)
goto cleanup_surface;
  
-   dri2_surf->dri_drawable =

-  dri2_dpy->dri2->createNewDrawable(dri2_dpy->dri_screen, config,
-dri2_surf);
+   if (dri2_dpy->image_driver)
+  createNewDrawable = dri2_dpy->image_driver->createNewDrawable;
+   else
+  createNewDrawable = dri2_dpy->dri2->createNewDrawable;
+
+   dri2_surf->dri_drawable = (*createNewDrawable)(dri2_dpy->dri_screen, config,
+  dri2_surf);
 if (dri2_surf->dri_drawable == NULL) {
-  _eglError(EGL_BAD_ALLOC, "dri2->createNewDrawable");
+  _eglError(EGL_BAD_ALLOC, "createNewDrawable");
goto cleanup_surface;
 }
  
@@ -1128,19 +1133,23 @@ dri2_initialize_android(_EGLDriver *drv, _EGLDisplay *dpy)

goto cleanup_device;
 }
  
-   if (!dri2_load_driver(dpy)) {

-  err = "DRI2: failed to load driver";
-  goto cleanup_driver_name;
-   }
-
 dri2_dpy->is_render_node = drmGetNodeTypeFromFd(dri2_dpy->fd) == 
DRM_NODE_RENDER;
  
 /* render nodes cannot use Gem names, and thus do not support

  * the __DRI_DRI2_LOADER extension */
 if (!dri2_dpy->is_render_node)
dri2_dpy->loader_extensions = droid_dri2_loader_extensions;
-   else
+  if (!dri2_load_driver(dpy)) {
+ err = "DRI2: failed to load driver";
+ goto cleanup_driver_name;
+  }
+   } else {


there is no '{' for the '}' here, you probably expect one in 
if(!dri2_dpy->is_render_node)?


This is OK change for me with that one fixed. There was some small 
amount of pain to get it to blend with Tomasz's changes that are 
required for dma-buf support (which we really should integrate, need to 
visit why those got rejected and what would be solution there).


Reviewed-by: Tapani Pälli <tapani.pa...@intel.com>




dri2_dpy->loader_extensions = droid_image_loader_extensions;
+  if (!dri2_load_driver_dri3(dpy)) {
+ err = "DRI3: failed to load driver";
+ goto cleanup_driver_name;
+  }
+   }
  
 if (!dri2_create_screen(dpy)) {

err = "DRI2: failed to create screen";


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


Re: [Mesa-dev] [PATCH 1/2] intel: gen-decoder: fix xml parser leak

2017-05-14 Thread Tapani Pälli

Reviewed-by: Tapani Pälli <tapani.pa...@intel.com>

On 05/12/2017 02:37 PM, Lionel Landwerlin wrote:

In the unlikely case the parsing of genxml files fails, we were
leaking an xml parser object.

Signed-off-by: Lionel Landwerlin <lionel.g.landwer...@intel.com>
---
  src/intel/common/gen_decoder.c | 13 +++--
  1 file changed, 7 insertions(+), 6 deletions(-)

diff --git a/src/intel/common/gen_decoder.c b/src/intel/common/gen_decoder.c
index 24147340f58..35aa9f63ffa 100644
--- a/src/intel/common/gen_decoder.c
+++ b/src/intel/common/gen_decoder.c
@@ -650,9 +650,9 @@ gen_spec_load_from_path(const struct gen_device_info 
*devinfo,
len = fread(buf, 1, XML_BUFFER_SIZE, input);
if (len == 0) {
   fprintf(stderr, "fread: %m\n");
- fclose(input);
- free(filename);
- return NULL;
+ free(ctx.spec);
+ ctx.spec = NULL;
+ goto end;
}
if (XML_ParseBuffer(ctx.parser, len, len == 0) == 0) {
   fprintf(stderr,
@@ -660,12 +660,13 @@ gen_spec_load_from_path(const struct gen_device_info 
*devinfo,
   XML_GetCurrentLineNumber(ctx.parser),
   XML_GetCurrentColumnNumber(ctx.parser),
   XML_ErrorString(XML_GetErrorCode(ctx.parser)));
- fclose(input);
- free(filename);
- return NULL;
+ free(ctx.spec);
+ ctx.spec = NULL;
+ goto end;
}
 } while (len > 0);
  
+ end:

 XML_ParserFree(ctx.parser);
  
 fclose(input);



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


Re: [Mesa-dev] [PATCH v2 2/2] i965: perf: fix pointer to integer cast

2017-05-14 Thread Tapani Pälli

Reviewed-by: Tapani Pälli <tapani.pa...@intel.com>

On 05/12/2017 06:49 PM, Lionel Landwerlin wrote:

v2: Just use cast to uintptr_t (Chris)

Reported-by: Mauro Rossi <issor.or...@gmail.com>
Signed-off-by: Lionel Landwerlin <lionel.g.landwer...@intel.com>
---
  src/mesa/drivers/dri/i965/brw_performance_query.c | 2 +-
  1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/src/mesa/drivers/dri/i965/brw_performance_query.c 
b/src/mesa/drivers/dri/i965/brw_performance_query.c
index 95f112e99f0..d1c4b6514bc 100644
--- a/src/mesa/drivers/dri/i965/brw_performance_query.c
+++ b/src/mesa/drivers/dri/i965/brw_performance_query.c
@@ -833,7 +833,7 @@ open_i915_perf_oa_stream(struct brw_context *brw,
 I915_PERF_FLAG_FD_NONBLOCK |
 I915_PERF_FLAG_DISABLED,
.num_properties = ARRAY_SIZE(properties) / 2,
-  .properties_ptr = (uint64_t)properties
+  .properties_ptr = (uintptr_t) properties,
 };
 int fd = drmIoctl(drm_fd, DRM_IOCTL_I915_PERF_OPEN, );
 if (fd == -1) {
--
2.11.0
___
mesa-dev mailing list
mesa-dev@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/mesa-dev


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


Re: [Mesa-dev] [PATCH 10/13] egl/x11: make use of the dri2_display_destroy() helper

2017-05-12 Thread Tapani Pälli

this patch causes a crash with egl-create-surface Piglit test

On 05/11/2017 09:57 PM, Emil Velikov wrote:

From: Emil Velikov 

Signed-off-by: Emil Velikov 
---
  src/egl/drivers/dri2/platform_x11.c | 78 +++--
  1 file changed, 23 insertions(+), 55 deletions(-)

diff --git a/src/egl/drivers/dri2/platform_x11.c 
b/src/egl/drivers/dri2/platform_x11.c
index 3bce0bb3f21..c512448952d 100644
--- a/src/egl/drivers/dri2/platform_x11.c
+++ b/src/egl/drivers/dri2/platform_x11.c
@@ -1235,25 +1235,25 @@ dri2_initialize_x11_swrast(_EGLDriver *drv, _EGLDisplay 
*disp)
 if (!dri2_dpy)
return _eglError(EGL_BAD_ALLOC, "eglInitialize");
  
+   dri2_dpy->fd = -1;

 if (!dri2_get_xcb_connection(drv, disp, dri2_dpy))
-  goto cleanup_dpy;
+  goto cleanup;
  
 /*

  * Every hardware driver_name is set using strdup. Doing the same in
  * here will allow is to simply free the memory at dri2_terminate().
  */
-   dri2_dpy->fd = -1;
 dri2_dpy->driver_name = strdup("swrast");
 if (!dri2_load_driver_swrast(disp))
-  goto cleanup_conn;
+  goto cleanup;
  
 dri2_dpy->loader_extensions = swrast_loader_extensions;
  
 if (!dri2_create_screen(disp))

-  goto cleanup_driver;
+  goto cleanup;
  
 if (!dri2_x11_add_configs_for_visuals(dri2_dpy, disp, true))

-  goto cleanup_configs;
+  goto cleanup;
  
 /* Fill vtbl last to prevent accidentally calling virtual function during

  * initialization.
@@ -1262,19 +1262,8 @@ dri2_initialize_x11_swrast(_EGLDriver *drv, _EGLDisplay 
*disp)
  
 return EGL_TRUE;
  
- cleanup_configs:

-   _eglCleanupDisplay(disp);
-   dri2_dpy->core->destroyScreen(dri2_dpy->dri_screen);
- cleanup_driver:
-   dlclose(dri2_dpy->driver);
- cleanup_conn:
-   free(dri2_dpy->driver_name);
-   if (disp->PlatformDisplay == NULL)
-  xcb_disconnect(dri2_dpy->conn);
- cleanup_dpy:
-   free(dri2_dpy);
-   disp->DriverData = NULL;
-
+ cleanup:
+   dri2_display_destroy(disp);
 return EGL_FALSE;
  }
  
@@ -1342,14 +1331,15 @@ dri2_initialize_x11_dri3(_EGLDriver *drv, _EGLDisplay *disp)

 if (!dri2_dpy)
return _eglError(EGL_BAD_ALLOC, "eglInitialize");
  
+   dri2_dpy->fd = -1;

 if (!dri2_get_xcb_connection(drv, disp, dri2_dpy))
-  goto cleanup_dpy;
+  goto cleanup;
  
 if (!dri3_x11_connect(dri2_dpy))

-  goto cleanup_conn;
+  goto cleanup;
  
 if (!dri2_load_driver_dri3(disp))

-  goto cleanup_conn;
+  goto cleanup;
  
 dri2_dpy->loader_extensions = dri3_image_loader_extensions;
  
@@ -1357,7 +1347,7 @@ dri2_initialize_x11_dri3(_EGLDriver *drv, _EGLDisplay *disp)

 dri2_dpy->invalidate_available = true;
  
 if (!dri2_create_screen(disp))

-  goto cleanup_fd;
+  goto cleanup;
  
 dri2_x11_setup_swap_interval(dri2_dpy);
  
@@ -1370,7 +1360,7 @@ dri2_initialize_x11_dri3(_EGLDriver *drv, _EGLDisplay *disp)

 dri2_set_WL_bind_wayland_display(drv, disp);
  
 if (!dri2_x11_add_configs_for_visuals(dri2_dpy, disp, false))

-  goto cleanup_configs;
+  goto cleanup;
  
 dri2_dpy->loader_dri3_ext.core = dri2_dpy->core;

 dri2_dpy->loader_dri3_ext.image_driver = dri2_dpy->image_driver;
@@ -1388,19 +1378,8 @@ dri2_initialize_x11_dri3(_EGLDriver *drv, _EGLDisplay 
*disp)
  
 return EGL_TRUE;
  
- cleanup_configs:

-   _eglCleanupDisplay(disp);
-   dri2_dpy->core->destroyScreen(dri2_dpy->dri_screen);
-   dlclose(dri2_dpy->driver);
- cleanup_fd:
-   close(dri2_dpy->fd);
- cleanup_conn:
-   if (disp->PlatformDisplay == NULL)
-  xcb_disconnect(dri2_dpy->conn);
- cleanup_dpy:
-   free(dri2_dpy);
-   disp->DriverData = NULL;
-
+ cleanup:
+   dri2_display_destroy(disp);
 return EGL_FALSE;
  }
  #endif
@@ -1444,14 +1423,15 @@ dri2_initialize_x11_dri2(_EGLDriver *drv, _EGLDisplay 
*disp)
 if (!dri2_dpy)
return _eglError(EGL_BAD_ALLOC, "eglInitialize");
  
+   dri2_dpy->fd = -1;

 if (!dri2_get_xcb_connection(drv, disp, dri2_dpy))
-  goto cleanup_dpy;
+  goto cleanup;
  
 if (!dri2_x11_connect(dri2_dpy))

-  goto cleanup_conn;
+  goto cleanup;
  
 if (!dri2_load_driver(disp))

-  goto cleanup_fd;
+  goto cleanup;
  
 if (dri2_dpy->dri2_minor >= 1)

dri2_dpy->loader_extensions = dri2_loader_extensions;
@@ -1462,7 +1442,7 @@ dri2_initialize_x11_dri2(_EGLDriver *drv, _EGLDisplay 
*disp)
 dri2_dpy->invalidate_available = (dri2_dpy->dri2_minor >= 3);
  
 if (!dri2_create_screen(disp))

-  goto cleanup_driver;
+  goto cleanup;
  
 dri2_x11_setup_swap_interval(dri2_dpy);
  
@@ -1475,7 +1455,7 @@ dri2_initialize_x11_dri2(_EGLDriver *drv, _EGLDisplay *disp)

 dri2_set_WL_bind_wayland_display(drv, disp);
  
 if (!dri2_x11_add_configs_for_visuals(dri2_dpy, disp, true))

-  goto cleanup_configs;
+  goto cleanup;
  
 /* Fill vtbl last to prevent accidentally calling virtual 

Re: [Mesa-dev] [PATCH 06/13] egl/android: make use of dri2_display_destroy() helper

2017-05-12 Thread Tapani Pälli



On 05/11/2017 09:57 PM, Emil Velikov wrote:

From: Emil Velikov <emil.veli...@collabora.com>

Cc: Tomasz Figa <tf...@chromium.org>
Cc: Tapani Pälli <tapani.pa...@intel.com>
Signed-off-by: Emil Velikov <emil.veli...@collabora.com>
---
  src/egl/drivers/dri2/platform_android.c | 27 +--
  1 file changed, 9 insertions(+), 18 deletions(-)

diff --git a/src/egl/drivers/dri2/platform_android.c 
b/src/egl/drivers/dri2/platform_android.c
index 49cbeb4698e..f1038957850 100644
--- a/src/egl/drivers/dri2/platform_android.c
+++ b/src/egl/drivers/dri2/platform_android.c
@@ -1107,11 +1107,12 @@ dri2_initialize_android(_EGLDriver *drv, _EGLDisplay 
*dpy)
 if (!dri2_dpy)
return _eglError(EGL_BAD_ALLOC, "eglInitialize");
  
+   dri2_dpy->fd = -1;

 ret = hw_get_module(GRALLOC_HARDWARE_MODULE_ID,
 (const hw_module_t **)_dpy->gralloc);
 if (ret) {
err = "DRI2: failed to get gralloc module";
-  goto cleanup_display;
+  goto cleanup;
 }
  
 dpy->DriverData = (void *) dri2_dpy;

@@ -1119,18 +1120,18 @@ dri2_initialize_android(_EGLDriver *drv, _EGLDisplay 
*dpy)
 dri2_dpy->fd = droid_open_device(dri2_dpy);
 if (dri2_dpy->fd < 0) {
err = "DRI2: failed to open device";
-  goto cleanup_display;
+  goto cleanup;
 }
  
 dri2_dpy->driver_name = loader_get_driver_for_fd(dri2_dpy->fd);

 if (dri2_dpy->driver_name == NULL) {
err = "DRI2: failed to get driver name";
-  goto cleanup_device;
+  goto cleanup;
 }
  
 if (!dri2_load_driver(dpy)) {

err = "DRI2: failed to load driver";
-  goto cleanup_driver_name;
+  goto cleanup;
 }
  
 dri2_dpy->is_render_node = drmGetNodeTypeFromFd(dri2_dpy->fd) == DRM_NODE_RENDER;

@@ -1144,12 +1145,12 @@ dri2_initialize_android(_EGLDriver *drv, _EGLDisplay 
*dpy)
  
 if (!dri2_create_screen(dpy)) {

err = "DRI2: failed to create screen";
-  goto cleanup_driver;
+  goto cleanup;
 }
  
 if (!droid_add_configs_for_visuals(drv, dpy)) {

err = "DRI2: failed to add configs";
-  goto cleanup_screen;
+  goto cleanup;
 }
  
 dpy->Extensions.ANDROID_framebuffer_target = EGL_TRUE;

@@ -1164,17 +1165,7 @@ dri2_initialize_android(_EGLDriver *drv, _EGLDisplay 
*dpy)
  
 return EGL_TRUE;
  
-cleanup_screen:

-   dri2_dpy->core->destroyScreen(dri2_dpy->dri_screen);
-cleanup_driver:
-   dlclose(dri2_dpy->driver);
-cleanup_driver_name:
-   free(dri2_dpy->driver_name);
-cleanup_device:
-   close(dri2_dpy->fd);
-cleanup_display:
-   free(dri2_dpy);
-   dpy->DriverData = NULL;
-
+cleanup:
+   dri2_display_destroy(disp);


disp -> dpy


 return _eglError(EGL_NOT_INITIALIZED, err);
  }


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


[Mesa-dev] [PATCH v2] egl: fix android logger compilation

2017-05-12 Thread Tapani Pälli
1ce5853 broken compilation since LOG_ERROR is not defined and also
macro expansion won't work as planned (expands to 'ANDROID_egl2alog[level]')

v2: append 'ANDROID' to egl2alog table and use LOG_PRI
(suggested by Chih-Wei Huang)

Fixes: 1ce5853 ("egl: simplify the Android logger")
Signed-off-by: Tapani Pälli <tapani.pa...@intel.com>
---
 src/egl/main/egllog.c | 10 +-
 1 file changed, 5 insertions(+), 5 deletions(-)

diff --git a/src/egl/main/egllog.c b/src/egl/main/egllog.c
index 6de2a50..64ff474 100644
--- a/src/egl/main/egllog.c
+++ b/src/egl/main/egllog.c
@@ -82,12 +82,12 @@ _eglDefaultLogger(EGLint level, const char *msg)
 {
 #ifdef HAVE_ANDROID_PLATFORM
static const int egl2alog[] = {
-  [_EGL_FATAL] = LOG_ERROR,
-  [_EGL_WARNING]  = LOG_WARN,
-  [_EGL_INFO] = LOG_INFO,
-  [_EGL_DEBUG] = LOG_DEBUG,
+  [_EGL_FATAL] = ANDROID_LOG_ERROR,
+  [_EGL_WARNING]  = ANDROID_LOG_WARN,
+  [_EGL_INFO] = ANDROID_LOG_INFO,
+  [_EGL_DEBUG] = ANDROID_LOG_DEBUG,
};
-   ALOG(egl2alog[level], LOG_TAG, "%s", msg);
+   LOG_PRI(egl2alog[level], LOG_TAG, "%s", msg);
 #else
fprintf(stderr, "libEGL %s: %s\n", level_strings[level], msg);
 #endif /* HAVE_ANDROID_PLATFORM */
-- 
2.9.3

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


Re: [Mesa-dev] [PATCH] egl: fix android logger compilation

2017-05-12 Thread Tapani Pälli



On 05/12/2017 09:19 AM, Chih-Wei Huang wrote:

2017-05-12 14:15 GMT+08:00 Tapani Pälli <tapani.pa...@intel.com>:



On 05/12/2017 09:13 AM, Chih-Wei Huang wrote:


2017-05-12 13:37 GMT+08:00 Tapani Pälli <tapani.pa...@intel.com>:


this patch is a partial revert of 1ce5853 that break compilation
since LOG_ERROR etc are not defined and also macro expansion won't
work as planned (expands to 'ANDROID_egl2alog[level]')

Fixes: 1ce5853 ("egl: simplify the Android logger")
Signed-off-by: Tapani Pälli <tapani.pa...@intel.com>
---
   src/egl/main/egllog.c | 21 ++---
   1 file changed, 14 insertions(+), 7 deletions(-)

diff --git a/src/egl/main/egllog.c b/src/egl/main/egllog.c
index 6de2a50..51ab76f 100644
--- a/src/egl/main/egllog.c
+++ b/src/egl/main/egllog.c
@@ -81,13 +81,20 @@ static void
   _eglDefaultLogger(EGLint level, const char *msg)
   {
   #ifdef HAVE_ANDROID_PLATFORM
-   static const int egl2alog[] = {
-  [_EGL_FATAL] = LOG_ERROR,
-  [_EGL_WARNING]  = LOG_WARN,
-  [_EGL_INFO] = LOG_INFO,
-  [_EGL_DEBUG] = LOG_DEBUG,



How about just change LOG_* to ANDROID_LOG_* ?
You also need to include "android/log.h".


Correction: this has already included (from cutils/log.h)


LOG_* are not real macros defined in Android headers.
They are concatenated to ANDROID_LOG_*
defined in android/log.h. (in system/core/include/)



problem is that ALOG stringifies (is that a word?) the first argument and
concats that with 'ANDROID_', so currently you get 'ANDROID_egl2alog[level]'
which does not exist. With ANDROID applied, you would get 'ANDROID_ANDROID
..'


Ah, I see. Then change ALOG to LOG_PRI
(or android_printLog).


yeah, adding ANDROID and using LOG_PRI should do it as well, although 
I'm kind of missing the point of playing with such small LUT here 
instead of just using a simple and clear switch






-   };
-   ALOG(egl2alog[level], LOG_TAG, "%s", msg);
+   switch (level) {
+   case _EGL_FATAL:
+  ALOGE("%s", msg);
+  break;
+   case _EGL_WARNING:
+  ALOGW("%s", msg);
+  break;
+   case _EGL_INFO:
+  ALOGI("%s", msg);
+  break;
+   case _EGL_DEBUG:
+  ALOGD("%s", msg);
+  break;
+   }
   #else
  fprintf(stderr, "libEGL %s: %s\n", level_strings[level], msg);
   #endif /* HAVE_ANDROID_PLATFORM */




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


Re: [Mesa-dev] [PATCH] i965: fix cast in OA performance query code

2017-05-12 Thread Tapani Pälli



On 05/11/2017 04:00 PM, Lionel Landwerlin wrote:

On 11/05/17 13:58, Lionel Landwerlin wrote:

On 11/05/17 12:27, Tapani Pälli wrote:



On 05/11/2017 02:23 PM, Emil Velikov wrote:

On 1 May 2017 at 12:09, Mauro Rossi <issor.or...@gmail.com> wrote:

Fixes the following building error happening on marshmallow-x86
with Ubuntu 16.04 LTS stock build essentials package
and by the book Android build system.

external/mesa/src/mesa/drivers/dri/i965/brw_performance_query.c: In 
function 'open_i915_perf_oa_stream':
external/mesa/src/mesa/drivers/dri/i965/brw_performance_query.c:836:25: 

error: cast from pointer to integer of different size 
[-Werror=pointer-to-int-cast]

.properties_ptr = (uint64_t)properties
  ^

Fixes: 458468c "i965: Expose OA counters via INTEL_performance_query"
---
  src/mesa/drivers/dri/i965/brw_performance_query.c | 2 +-
  1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/src/mesa/drivers/dri/i965/brw_performance_query.c 
b/src/mesa/drivers/dri/i965/brw_performance_query.c

index 95f112e..7436b39 100644
--- a/src/mesa/drivers/dri/i965/brw_performance_query.c
+++ b/src/mesa/drivers/dri/i965/brw_performance_query.c
@@ -833,7 +833,7 @@ open_i915_perf_oa_stream(struct brw_context *brw,
 I915_PERF_FLAG_FD_NONBLOCK |
 I915_PERF_FLAG_DISABLED,
.num_properties = ARRAY_SIZE(properties) / 2,
-  .properties_ptr = (uint64_t)properties
+  .properties_ptr = (uint64_t *)properties

Rob, others - do we still need this?


I did brief look here but not 100% sure if this is right fix, 
properties_ptr is uint64_t so I guess you might end up with another 
warning/error here, should uintptr_t be used instead?


Casting to uint64_t* doesn't seem right.
Maybe do it like this :

https://cgit.freedesktop.org/mesa/mesa/tree/src/mesa/drivers/dri/i965/brw_bufmgr.c#n687 



Sorry, picked up the wrong line :

https://cgit.freedesktop.org/mesa/mesa/tree/src/mesa/drivers/dri/i965/brw_bufmgr.c#n862 


Yes, this looks the correct solution.






Thanks
Emil


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



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




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


Re: [Mesa-dev] [PATCH] egl: fix android logger compilation

2017-05-12 Thread Tapani Pälli



On 05/12/2017 09:13 AM, Chih-Wei Huang wrote:

2017-05-12 13:37 GMT+08:00 Tapani Pälli <tapani.pa...@intel.com>:

this patch is a partial revert of 1ce5853 that break compilation
since LOG_ERROR etc are not defined and also macro expansion won't
work as planned (expands to 'ANDROID_egl2alog[level]')

Fixes: 1ce5853 ("egl: simplify the Android logger")
Signed-off-by: Tapani Pälli <tapani.pa...@intel.com>
---
  src/egl/main/egllog.c | 21 ++---
  1 file changed, 14 insertions(+), 7 deletions(-)

diff --git a/src/egl/main/egllog.c b/src/egl/main/egllog.c
index 6de2a50..51ab76f 100644
--- a/src/egl/main/egllog.c
+++ b/src/egl/main/egllog.c
@@ -81,13 +81,20 @@ static void
  _eglDefaultLogger(EGLint level, const char *msg)
  {
  #ifdef HAVE_ANDROID_PLATFORM
-   static const int egl2alog[] = {
-  [_EGL_FATAL] = LOG_ERROR,
-  [_EGL_WARNING]  = LOG_WARN,
-  [_EGL_INFO] = LOG_INFO,
-  [_EGL_DEBUG] = LOG_DEBUG,


How about just change LOG_* to ANDROID_LOG_* ?
You also need to include "android/log.h".

LOG_* are not real macros defined in Android headers.
They are concatenated to ANDROID_LOG_*
defined in android/log.h. (in system/core/include/)


problem is that ALOG stringifies (is that a word?) the first argument 
and concats that with 'ANDROID_', so currently you get 
'ANDROID_egl2alog[level]' which does not exist. With ANDROID applied, 
you would get 'ANDROID_ANDROID ..'




-   };
-   ALOG(egl2alog[level], LOG_TAG, "%s", msg);
+   switch (level) {
+   case _EGL_FATAL:
+  ALOGE("%s", msg);
+  break;
+   case _EGL_WARNING:
+  ALOGW("%s", msg);
+  break;
+   case _EGL_INFO:
+  ALOGI("%s", msg);
+  break;
+   case _EGL_DEBUG:
+  ALOGD("%s", msg);
+  break;
+   }
  #else
 fprintf(stderr, "libEGL %s: %s\n", level_strings[level], msg);
  #endif /* HAVE_ANDROID_PLATFORM */
--





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


Re: [Mesa-dev] [PATCH 2/2] i965/formats: Update the RGB_DXT1 mappings

2017-05-12 Thread Tapani Pälli
Yep, this fixes the issue, also other DXT tests what I have are passing 
fine.


Acked-by: Tapani Pälli <tapani.pa...@intel.com>

On 05/12/2017 02:46 AM, Nanley Chery wrote:

The DXT1_RGB* format does not provide the correct behavior for OpenGL in
the case where color_0 <= color_1. BC1_RGB_UNORM with a alpha set to 1
provides the behavior which matches the spec.

Bugzilla: https://bugs.freedesktop.org/show_bug.cgi?id=100925
Cc: <mesa-sta...@lists.freedesktop.org>
Signed-off-by: Nanley Chery <nanley.g.ch...@intel.com>
---
  src/mesa/drivers/dri/i965/brw_surface_formats.c | 15 ++-
  1 file changed, 2 insertions(+), 13 deletions(-)

diff --git a/src/mesa/drivers/dri/i965/brw_surface_formats.c 
b/src/mesa/drivers/dri/i965/brw_surface_formats.c
index 7b17e11125..b176a21c22 100644
--- a/src/mesa/drivers/dri/i965/brw_surface_formats.c
+++ b/src/mesa/drivers/dri/i965/brw_surface_formats.c
@@ -94,14 +94,14 @@ brw_isl_format_for_mesa_format(mesa_format mesa_format)
[MESA_FORMAT_L_SRGB8] = ISL_FORMAT_L8_UNORM_SRGB,
[MESA_FORMAT_L8A8_SRGB] = ISL_FORMAT_L8A8_UNORM_SRGB,
[MESA_FORMAT_A8L8_SRGB] = 0,
-  [MESA_FORMAT_SRGB_DXT1] = ISL_FORMAT_DXT1_RGB_SRGB,
+  [MESA_FORMAT_SRGB_DXT1] = ISL_FORMAT_BC1_UNORM_SRGB,
[MESA_FORMAT_SRGBA_DXT1] = ISL_FORMAT_BC1_UNORM_SRGB,
[MESA_FORMAT_SRGBA_DXT3] = ISL_FORMAT_BC2_UNORM_SRGB,
[MESA_FORMAT_SRGBA_DXT5] = ISL_FORMAT_BC3_UNORM_SRGB,
  
[MESA_FORMAT_RGB_FXT1] = ISL_FORMAT_FXT1,

[MESA_FORMAT_RGBA_FXT1] = ISL_FORMAT_FXT1,
-  [MESA_FORMAT_RGB_DXT1] = ISL_FORMAT_DXT1_RGB,
+  [MESA_FORMAT_RGB_DXT1] = ISL_FORMAT_BC1_UNORM,
[MESA_FORMAT_RGBA_DXT1] = ISL_FORMAT_BC1_UNORM,
[MESA_FORMAT_RGBA_DXT3] = ISL_FORMAT_BC2_UNORM,
[MESA_FORMAT_RGBA_DXT5] = ISL_FORMAT_BC3_UNORM,
@@ -541,17 +541,6 @@ translate_tex_format(struct brw_context *brw,
 */
return ISL_FORMAT_R32G32B32A32_FLOAT;
  
-   case MESA_FORMAT_SRGB_DXT1:

-  if (brw->gen == 4 && !brw->is_g4x) {
- /* Work around missing SRGB DXT1 support on original gen4 by just
-  * skipping SRGB decode.  It's not worth not supporting sRGB in
-  * general to prevent this.
-  */
- WARN_ONCE(true, "Demoting sRGB DXT1 texture to non-sRGB\n");
- mesa_format = MESA_FORMAT_RGB_DXT1;
-  }
-  return brw_isl_format_for_mesa_format(mesa_format);
-
 case MESA_FORMAT_RGBA_ASTC_4x4:
 case MESA_FORMAT_RGBA_ASTC_5x4:
 case MESA_FORMAT_RGBA_ASTC_5x5:


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


[Mesa-dev] [PATCH] egl: fix android logger compilation

2017-05-11 Thread Tapani Pälli
this patch is a partial revert of 1ce5853 that break compilation
since LOG_ERROR etc are not defined and also macro expansion won't
work as planned (expands to 'ANDROID_egl2alog[level]')

Fixes: 1ce5853 ("egl: simplify the Android logger")
Signed-off-by: Tapani Pälli <tapani.pa...@intel.com>
---
 src/egl/main/egllog.c | 21 ++---
 1 file changed, 14 insertions(+), 7 deletions(-)

diff --git a/src/egl/main/egllog.c b/src/egl/main/egllog.c
index 6de2a50..51ab76f 100644
--- a/src/egl/main/egllog.c
+++ b/src/egl/main/egllog.c
@@ -81,13 +81,20 @@ static void
 _eglDefaultLogger(EGLint level, const char *msg)
 {
 #ifdef HAVE_ANDROID_PLATFORM
-   static const int egl2alog[] = {
-  [_EGL_FATAL] = LOG_ERROR,
-  [_EGL_WARNING]  = LOG_WARN,
-  [_EGL_INFO] = LOG_INFO,
-  [_EGL_DEBUG] = LOG_DEBUG,
-   };
-   ALOG(egl2alog[level], LOG_TAG, "%s", msg);
+   switch (level) {
+   case _EGL_FATAL:
+  ALOGE("%s", msg);
+  break;
+   case _EGL_WARNING:
+  ALOGW("%s", msg);
+  break;
+   case _EGL_INFO:
+  ALOGI("%s", msg);
+  break;
+   case _EGL_DEBUG:
+  ALOGD("%s", msg);
+  break;
+   }
 #else
fprintf(stderr, "libEGL %s: %s\n", level_strings[level], msg);
 #endif /* HAVE_ANDROID_PLATFORM */
-- 
2.9.3

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


Re: [Mesa-dev] [PATCH] i965: fix cast in OA performance query code

2017-05-11 Thread Tapani Pälli



On 05/11/2017 02:23 PM, Emil Velikov wrote:

On 1 May 2017 at 12:09, Mauro Rossi  wrote:

Fixes the following building error happening on marshmallow-x86
with Ubuntu 16.04 LTS stock build essentials package
and by the book Android build system.

external/mesa/src/mesa/drivers/dri/i965/brw_performance_query.c: In function 
'open_i915_perf_oa_stream':
external/mesa/src/mesa/drivers/dri/i965/brw_performance_query.c:836:25:
error: cast from pointer to integer of different size 
[-Werror=pointer-to-int-cast]
.properties_ptr = (uint64_t)properties
  ^

Fixes: 458468c "i965: Expose OA counters via INTEL_performance_query"
---
  src/mesa/drivers/dri/i965/brw_performance_query.c | 2 +-
  1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/src/mesa/drivers/dri/i965/brw_performance_query.c 
b/src/mesa/drivers/dri/i965/brw_performance_query.c
index 95f112e..7436b39 100644
--- a/src/mesa/drivers/dri/i965/brw_performance_query.c
+++ b/src/mesa/drivers/dri/i965/brw_performance_query.c
@@ -833,7 +833,7 @@ open_i915_perf_oa_stream(struct brw_context *brw,
 I915_PERF_FLAG_FD_NONBLOCK |
 I915_PERF_FLAG_DISABLED,
.num_properties = ARRAY_SIZE(properties) / 2,
-  .properties_ptr = (uint64_t)properties
+  .properties_ptr = (uint64_t *)properties

Rob, others - do we still need this?


I did brief look here but not 100% sure if this is right fix, 
properties_ptr is uint64_t so I guess you might end up with another 
warning/error here, should uintptr_t be used instead?



Thanks
Emil


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


Re: [Mesa-dev] [PATCH 4/9] mesa: fix misleading indentation

2017-05-11 Thread Tapani Pälli



On 04/12/2017 01:04 AM, Thomas Hindoe Paaboel Andersen wrote:

---
  src/mesa/main/shaderapi.c | 2 +-
  1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/src/mesa/main/shaderapi.c b/src/mesa/main/shaderapi.c
index 187475f..9efb2e0 100644
--- a/src/mesa/main/shaderapi.c
+++ b/src/mesa/main/shaderapi.c
@@ -1110,7 +1110,7 @@ _mesa_link_program(struct gl_context *ctx, struct 
gl_shader_program *shProg)
   ctx->_Shader->CurrentProgram[stage]->Id == shProg->Name) {
  programs_in_use |= 1 << stage;
   }
-   }
+  }


IMO while fixing this you should also add braces to the toplevel condition




 FLUSH_VERTICES(ctx, 0);
 _mesa_glsl_link_shader(ctx, shProg);


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


Re: [Mesa-dev] Trivial code cleanups

2017-05-11 Thread Tapani Pälli

Patches 3 & 7

Reviewed-by: Tapani Pälli <tapani.pa...@intel.com>


On 04/12/2017 01:03 AM, Thomas Hindoe Paaboel Andersen wrote:

A mix of fixes for static analysis warnings, recent indentation
mistakes, and unnecessary null checks before free.

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


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


Re: [Mesa-dev] [PATCH 5/9] i965: remove unused context

2017-05-11 Thread Tapani Pälli



On 04/12/2017 01:04 AM, Thomas Hindoe Paaboel Andersen wrote:

---
  src/mesa/drivers/dri/i965/intel_mipmap_tree.c | 2 --
  src/mesa/drivers/dri/i965/intel_pixel_draw.c  | 2 --
  2 files changed, 4 deletions(-)

diff --git a/src/mesa/drivers/dri/i965/intel_mipmap_tree.c 
b/src/mesa/drivers/dri/i965/intel_mipmap_tree.c
index 81e2d6e..5d5c77f 100644
--- a/src/mesa/drivers/dri/i965/intel_mipmap_tree.c
+++ b/src/mesa/drivers/dri/i965/intel_mipmap_tree.c
@@ -2593,8 +2593,6 @@ intel_miptree_unmap_blit(struct brw_context *brw,
 unsigned int level,
 unsigned int slice)
  {
-   struct gl_context *ctx = >ctx;
-


is used by WARN_ONCE


 intel_miptree_unmap_raw(map->linear_mt);
  
 if (map->mode & GL_MAP_WRITE_BIT) {

diff --git a/src/mesa/drivers/dri/i965/intel_pixel_draw.c 
b/src/mesa/drivers/dri/i965/intel_pixel_draw.c
index e84e473..a435800 100644
--- a/src/mesa/drivers/dri/i965/intel_pixel_draw.c
+++ b/src/mesa/drivers/dri/i965/intel_pixel_draw.c
@@ -151,8 +151,6 @@ intelDrawPixels(struct gl_context * ctx,
  const struct gl_pixelstore_attrib *unpack,
  const GLvoid * pixels)
  {
-   struct brw_context *brw = brw_context(ctx);
-


is used by perf_debug


 if (!_mesa_check_conditional_render(ctx))
return;
  


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


Re: [Mesa-dev] [PATCH] i965: avoid fence fd dup in EGL layer

2017-05-09 Thread Tapani Pälli



On 05/05/2017 10:14 AM, Randy Xu wrote:

Follow up "i965: Solve Android native fence fd double close"
The _EGLSync.SyncFd is not neccesary to keep after pass to
dri driver.

Test: Run Vulkan and GLES stress test and no crash.


Yep I've verified as well that no crashes happen. Lots of tearing though 
but that happens independent of this patch so I'm assuming it's a bug 
elsewhere.




---
  src/egl/drivers/dri2/egl_dri2.c  | 10 ++
  src/mesa/drivers/dri/i965/brw_sync.c |  2 +-
  2 files changed, 7 insertions(+), 5 deletions(-)

diff --git a/src/egl/drivers/dri2/egl_dri2.c b/src/egl/drivers/dri2/egl_dri2.c
index 0be7132..9ef35d3 100644
--- a/src/egl/drivers/dri2/egl_dri2.c
+++ b/src/egl/drivers/dri2/egl_dri2.c
@@ -2637,6 +2637,7 @@ dri2_create_sync(_EGLDriver *drv, _EGLDisplay *dpy,
   free(dri2_sync);
   return NULL;
}
+  dri2_sync->base.SyncFd = EGL_NO_NATIVE_FENCE_FD_ANDROID;
break;
 }
  
@@ -2678,24 +2679,25 @@ dri2_dup_native_fence_fd(_EGLDriver *drv, _EGLDisplay *dpy, _EGLSync *sync)


please rename this to dri2_get_native_fence_fd


  {
 struct dri2_egl_display *dri2_dpy = dri2_egl_display(dpy);
 struct dri2_egl_sync *dri2_sync = dri2_egl_sync(sync);
+   EGLint SyncFd = sync->SyncFd;
  
 assert(sync->Type == EGL_SYNC_NATIVE_FENCE_ANDROID);
  
-   if (sync->SyncFd == EGL_NO_NATIVE_FENCE_FD_ANDROID) {

+   if (SyncFd == EGL_NO_NATIVE_FENCE_FD_ANDROID) {
/* try to retrieve the actual native fence fd.. if rendering is
 * not flushed this will just return -1, aka NO_NATIVE_FENCE_FD:
 */
-  sync->SyncFd = dri2_dpy->fence->get_fence_fd(dri2_dpy->dri_screen,
+  SyncFd = dri2_dpy->fence->get_fence_fd(dri2_dpy->dri_screen,
 dri2_sync->fence);


code indentation went wrong here


 }
  
-   if (sync->SyncFd == EGL_NO_NATIVE_FENCE_FD_ANDROID) {

+   if (SyncFd == EGL_NO_NATIVE_FENCE_FD_ANDROID) {
/* if native fence fd still not created, return an error: */
_eglError(EGL_BAD_PARAMETER, "eglDupNativeFenceFDANDROID");
return EGL_NO_NATIVE_FENCE_FD_ANDROID;
 }
  
-   return dup(sync->SyncFd);

+   return SyncFd;
  }
  
  static EGLint

diff --git a/src/mesa/drivers/dri/i965/brw_sync.c 
b/src/mesa/drivers/dri/i965/brw_sync.c
index a8356c3..5b78503 100644
--- a/src/mesa/drivers/dri/i965/brw_sync.c
+++ b/src/mesa/drivers/dri/i965/brw_sync.c
@@ -470,7 +470,7 @@ brw_dri_create_fence_fd(__DRIcontext *dri_ctx, int fd)
   goto fail;
 } else {
/* Import the sync fd as an in-fence. */
-  fence->sync_fd = dup(fd);
+  fence->sync_fd = fd;
 }
  
 assert(fence->sync_fd != -1);



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


Re: [Mesa-dev] Sampling DRM_FORMAT_YUYV in GLSL

2017-05-09 Thread Tapani Pälli



On 05/09/2017 12:29 PM, Tapani Pälli wrote:



On 05/09/2017 12:14 PM, Volker Vogelhuber wrote:

Hi,

first sorry, for missing the subject in my mail to the mailing list, 
then thanks
for the hint with the "ext_image_dma_buf_import-sample_yuv". 
Unfortunately
things don't become clearer. In the samples as far as I can see, there 
is also
only one sampler defined in the shader. So how are the different 
planes accessed

in the shader? In the example only a simple copy is done:
gl_FragColor = texture2D(sampler, texcoords);
In the comment in intel_screen.c it says:

/* For YUYV buffers, we set up two overlapping DRI images and treat
 * them as planar buffers in the compositors.  Plane 0 is GR88 and
 * samples YU or YV pairs and places Y into the R component, while
 * plane 1 is ARGB and samples YUYV clusters and places pairs and
 * places U into the G component and V into A.  This lets the
 * texture sampler interpolate the Y components correctly when
 * sampling from plane 0, and interpolate U and V correctly when
 * sampling from plane 1. */

So how are the pixels transfered from the YUYV memory to the vec4 in 
the shader?
Do I have to calculate the chroma values by interpolating myself based 
on the
current texture coordinate? Or is it done automatically in some way? 
 From my
experience the texture call only returns the values from plane0 which 
leads me to the
suspicion that I have to interpolate myself. But why is there then the 
plane 1 which

don't seem to be accessible in the shader?

BTW: I'm using the OES_EGL_image extension not the 
OES_EGL_image_external, so my
sampler is sampler2D not samplerExternalOES but that shouldn't make a 
difference should it?


IMO that is a big difference as samplerExternalOES does the YUV2RGB 
conversion and returns RGB values for you.


I have to add that "this is how I think it works", I haven't tried this 
myself :)



And I use "texture" instead of "texture2D" because I'm on OpenGL 3.3, 
but that does not seem

to cause any differences.

On 09.05.2017 06:37, Tapani Pälli wrote:

Hi;

Take a look at Piglit test "ext_image_dma_buf_import-sample_yuv", 
(https://cgit.freedesktop.org/piglit). Test creates EGLImage from dma 
buf, binds to a texture and then samples this in a shader with 
samplerExternalOES type from GL_OES_EGL_image_external extension.



On 05/09/2017 01:57 AM, Volker Vogelhuber wrote:

I'm currently trying to render a V4L2 image with OpenGL
on an Intel Apollo Lake using Linux 4.10 and Mesa 13.
Supprisingly I noticed that importing a DMABUF with format
DRM_FORMAT_YUYV into OpenGL using
   eglCreateImage/glEGLImageTargetTexture2DOES
worked out of the box. But I noticed that there seem to be a split into
two textures when importing the buffer. At least the nplanes
variable in the __DRIimage's planar_format is set to 2 and in the
intel_screen.c there is a comment for __DRI_IMAGE_FOURCC_YUYV:
"For YUYV buffers, we set up two overlapping DRI images
   and treat them as planar buffers in the compositors."
So far so good, but how do I access the second texture in the GLSL
shader. I only created one texture object before calling
glEGLImageTargetTexture2DOES with the EGLImage I got from
eglCreateImage. And using the GLSL function texture( source, 
texCoord ) on this

texture samples only the Y and U channel, what seems obvious
as the first plane's texture is created as GL_RG texture.
Can anyone explain to me, how one accesses the second plane.
And if there is an example somewhere how the two planes
have to be sampled to convert the values back to RGB, it would
be nice if someone can send a link to such an example.

Thanks
___
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] Sampling DRM_FORMAT_YUYV in GLSL

2017-05-09 Thread Tapani Pälli



On 05/09/2017 12:14 PM, Volker Vogelhuber wrote:

Hi,

first sorry, for missing the subject in my mail to the mailing list, 
then thanks

for the hint with the "ext_image_dma_buf_import-sample_yuv". Unfortunately
things don't become clearer. In the samples as far as I can see, there 
is also
only one sampler defined in the shader. So how are the different planes 
accessed

in the shader? In the example only a simple copy is done:
gl_FragColor = texture2D(sampler, texcoords);
In the comment in intel_screen.c it says:

/* For YUYV buffers, we set up two overlapping DRI images and treat
 * them as planar buffers in the compositors.  Plane 0 is GR88 and
 * samples YU or YV pairs and places Y into the R component, while
 * plane 1 is ARGB and samples YUYV clusters and places pairs and
 * places U into the G component and V into A.  This lets the
 * texture sampler interpolate the Y components correctly when
 * sampling from plane 0, and interpolate U and V correctly when
 * sampling from plane 1. */

So how are the pixels transfered from the YUYV memory to the vec4 in the 
shader?
Do I have to calculate the chroma values by interpolating myself based 
on the
current texture coordinate? Or is it done automatically in some way? 
 From my
experience the texture call only returns the values from plane0 which 
leads me to the
suspicion that I have to interpolate myself. But why is there then the 
plane 1 which

don't seem to be accessible in the shader?

BTW: I'm using the OES_EGL_image extension not the 
OES_EGL_image_external, so my
sampler is sampler2D not samplerExternalOES but that shouldn't make a 
difference should it?


IMO that is a big difference as samplerExternalOES does the YUV2RGB 
conversion and returns RGB values for you.


And I use "texture" instead of "texture2D" because I'm on OpenGL 3.3, 
but that does not seem

to cause any differences.

On 09.05.2017 06:37, Tapani Pälli wrote:

Hi;

Take a look at Piglit test "ext_image_dma_buf_import-sample_yuv", 
(https://cgit.freedesktop.org/piglit). Test creates EGLImage from dma 
buf, binds to a texture and then samples this in a shader with 
samplerExternalOES type from GL_OES_EGL_image_external extension.



On 05/09/2017 01:57 AM, Volker Vogelhuber wrote:

I'm currently trying to render a V4L2 image with OpenGL
on an Intel Apollo Lake using Linux 4.10 and Mesa 13.
Supprisingly I noticed that importing a DMABUF with format
DRM_FORMAT_YUYV into OpenGL using
   eglCreateImage/glEGLImageTargetTexture2DOES
worked out of the box. But I noticed that there seem to be a split into
two textures when importing the buffer. At least the nplanes
variable in the __DRIimage's planar_format is set to 2 and in the
intel_screen.c there is a comment for __DRI_IMAGE_FOURCC_YUYV:
"For YUYV buffers, we set up two overlapping DRI images
   and treat them as planar buffers in the compositors."
So far so good, but how do I access the second texture in the GLSL
shader. I only created one texture object before calling
glEGLImageTargetTexture2DOES with the EGLImage I got from
eglCreateImage. And using the GLSL function texture( source, texCoord 
) on this

texture samples only the Y and U channel, what seems obvious
as the first plane's texture is created as GL_RG texture.
Can anyone explain to me, how one accesses the second plane.
And if there is an example somewhere how the two planes
have to be sampled to convert the values back to RGB, it would
be nice if someone can send a link to such an example.

Thanks
___
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] (no subject)

2017-05-08 Thread Tapani Pälli

Hi;

Take a look at Piglit test "ext_image_dma_buf_import-sample_yuv", 
(https://cgit.freedesktop.org/piglit). Test creates EGLImage from dma 
buf, binds to a texture and then samples this in a shader with 
samplerExternalOES type from GL_OES_EGL_image_external extension.



On 05/09/2017 01:57 AM, Volker Vogelhuber wrote:

I'm currently trying to render a V4L2 image with OpenGL
on an Intel Apollo Lake using Linux 4.10 and Mesa 13.
Supprisingly I noticed that importing a DMABUF with format
DRM_FORMAT_YUYV into OpenGL using
   eglCreateImage/glEGLImageTargetTexture2DOES
worked out of the box. But I noticed that there seem to be a split into
two textures when importing the buffer. At least the nplanes
variable in the __DRIimage's planar_format is set to 2 and in the
intel_screen.c there is a comment for __DRI_IMAGE_FOURCC_YUYV:
"For YUYV buffers, we set up two overlapping DRI images
   and treat them as planar buffers in the compositors."
So far so good, but how do I access the second texture in the GLSL
shader. I only created one texture object before calling
glEGLImageTargetTexture2DOES with the EGLImage I got from
eglCreateImage. And using the GLSL function texture( source, texCoord ) on this
texture samples only the Y and U channel, what seems obvious
as the first plane's texture is created as GL_RG texture.
Can anyone explain to me, how one accesses the second plane.
And if there is an example somewhere how the two planes
have to be sampled to convert the values back to RGB, it would
be nice if someone can send a link to such an example.

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


<    4   5   6   7   8   9   10   11   12   13   >