Re: [Mesa-dev] [PATCH 1/5] i965: Make a helper function intel_miptree_set_alignment()

2015-06-10 Thread Abdiel Janulgue


On 06/11/2015 01:30 AM, Anuj Phogat wrote:
> Signed-off-by: Anuj Phogat 
> Cc: Ben Widawsky 
> ---
> Jenkins showed no piglit regressions with this series.
> 
>  src/mesa/drivers/dri/i965/brw_tex_layout.c | 20 +---
>  1 file changed, 13 insertions(+), 7 deletions(-)
> 
> diff --git a/src/mesa/drivers/dri/i965/brw_tex_layout.c 
> b/src/mesa/drivers/dri/i965/brw_tex_layout.c
> index 41a9964..b9ac4cf 100644
> --- a/src/mesa/drivers/dri/i965/brw_tex_layout.c
> +++ b/src/mesa/drivers/dri/i965/brw_tex_layout.c
> @@ -761,16 +761,12 @@ intel_miptree_set_total_width_height(struct brw_context 
> *brw,
> mt->total_width, mt->total_height, mt->cpp);
>  }
>  
> -void
> -brw_miptree_layout(struct brw_context *brw,
> -   bool for_bo,
> -   enum intel_miptree_tiling_mode requested,
> -   struct intel_mipmap_tree *mt)
> +static void
> +intel_miptree_set_alignment(struct brw_context *brw,
> +struct intel_mipmap_tree *mt)
>  {
> bool gen6_hiz_or_stencil = false;
>  
> -   mt->tr_mode = INTEL_MIPTREE_TRMODE_NONE;
> -
> if (brw->gen == 6 && mt->array_layout == ALL_SLICES_AT_EACH_LOD) {
>const GLenum base_format = _mesa_get_format_base_format(mt->format);
>gen6_hiz_or_stencil = _mesa_is_depth_or_stencil_format(base_format);
> @@ -803,7 +799,17 @@ brw_miptree_layout(struct brw_context *brw,
>mt->align_w = intel_horizontal_texture_alignment_unit(brw, mt);
>mt->align_h = intel_vertical_texture_alignment_unit(brw, mt);
> }
> +}
> +
> +void
> +brw_miptree_layout(struct brw_context *brw,
> +   bool for_bo,
> +   enum intel_miptree_tiling_mode requested,
> +   struct intel_mipmap_tree *mt)
> +{
> +   mt->tr_mode = INTEL_MIPTREE_TRMODE_NONE;
>  
> +   intel_miptree_set_alignment(brw, mt);
> intel_miptree_set_total_width_height(brw, mt);
>  
> if (!mt->total_width || !mt->total_height) {
> 

Patches 1, 3, and 4 are
Reviewed-by: Abdiel Janulgue 
___
mesa-dev mailing list
mesa-dev@lists.freedesktop.org
http://lists.freedesktop.org/mailman/listinfo/mesa-dev


Re: [Mesa-dev] Add pbuffer support for drm platform

2015-06-10 Thread Liu, Ying2
Hi, Matt,

I have updated the patch based on your review comments. As for 
createNewDrawable, I add the condition to only use dri2_surf for pbuffer and 
keep everything else unchanged. 

Hi, Emil,

I have rebased my patch to master branch. Our QA team had run several 3D 
workloads in windows7 VM using Mesa10.5, such as 3DMark03, Unigine Heaven 4.0, 
PassMark8  3D and Lightsmark. We didn't run those workloads for master branch.  
We don't use Khronos Conformance suite. We run piglit, but didn't use piglit to 
test pbuffer. QA team also had run Mesa Demos.

Thanks

Ying

-Original Message-
From: Liu, Ying2 
Sent: Wednesday, June 10, 2015 4:05 PM
To: mesa-dev@lists.freedesktop.org
Cc: Liu, Ying2
Subject: EGL: Add pbuffer support for drm platform

Add pbuffer support for drm platform, because some customers are still using 
this feature.

Signed-off-by: Ying Liu 
---
 src/egl/drivers/dri2/egl_dri2.c |  3 +++
 src/egl/drivers/dri2/platform_drm.c | 30 +++---
 2 files changed, 26 insertions(+), 7 deletions(-)

diff --git a/src/egl/drivers/dri2/egl_dri2.c b/src/egl/drivers/dri2/egl_dri2.c 
index 44a6c96..d56795e 100644
--- a/src/egl/drivers/dri2/egl_dri2.c
+++ b/src/egl/drivers/dri2/egl_dri2.c
@@ -909,6 +909,9 @@ dri2_create_context(_EGLDriver *drv, _EGLDisplay *disp, 
_EGLConfig *conf,
*/
   if (conf->SurfaceType & EGL_WINDOW_BIT)
  dri2_ctx->base.WindowRenderBuffer = EGL_BACK_BUFFER;
+
+  if (conf->SurfaceType & EGL_PBUFFER_BIT)
+ dri2_ctx->base.WindowRenderBuffer = EGL_BACK_BUFFER;
}
else
   dri_config = NULL;
diff --git a/src/egl/drivers/dri2/platform_drm.c 
b/src/egl/drivers/dri2/platform_drm.c
index 3391afc..c8b7e92 100644
--- a/src/egl/drivers/dri2/platform_drm.c
+++ b/src/egl/drivers/dri2/platform_drm.c
@@ -123,16 +123,23 @@ dri2_drm_create_surface(_EGLDriver *drv, _EGLDisplay 
*disp, EGLint type,
   dri2_surf->base.Height = surf->base.height;
   surf->dri_private = dri2_surf;
   break;
+   case EGL_PBUFFER_BIT:
+  break;
default:
   goto cleanup_surf;
}
 
if (dri2_dpy->dri2) {
-  dri2_surf->dri_drawable =
- (*dri2_dpy->dri2->createNewDrawable) (dri2_dpy->dri_screen,
-   dri2_conf->dri_double_config,
-   dri2_surf->gbm_surf);
-
+  if (type == EGL_PBUFFER_BIT)
+ dri2_surf->dri_drawable =
+(*dri2_dpy->dri2->createNewDrawable) (dri2_dpy->dri_screen,
+  dri2_conf->dri_double_config,
+  dri2_surf);
+  else
+dri2_surf->dri_drawable =
+(*dri2_dpy->dri2->createNewDrawable) (dri2_dpy->dri_screen,
+  dri2_conf->dri_double_config,
+  dri2_surf->gbm_surf);
} else {
   assert(dri2_dpy->swrast != NULL);
   dri2_surf->dri_drawable =
@@ -155,6 +162,15 @@ dri2_drm_create_surface(_EGLDriver *drv, _EGLDisplay 
*disp, EGLint type,  }
 
 static _EGLSurface *
+dri2_drm_create_pbuffer_surface(_EGLDriver *drv, _EGLDisplay *disp,
+_EGLConfig *conf,
+const EGLint *attrib_list) {
+   return dri2_drm_create_surface(drv, disp, EGL_PBUFFER_BIT, conf,
+  NULL, attrib_list); }
+
+static _EGLSurface *
 dri2_drm_create_window_surface(_EGLDriver *drv, _EGLDisplay *disp,
_EGLConfig *conf, void *native_window,
const EGLint *attrib_list) @@ -576,7 +592,7 @@ 
static struct dri2_egl_display_vtbl dri2_drm_display_vtbl = {
.authenticate = dri2_drm_authenticate,
.create_window_surface = dri2_drm_create_window_surface,
.create_pixmap_surface = dri2_drm_create_pixmap_surface,
-   .create_pbuffer_surface = dri2_fallback_create_pbuffer_surface,
+   .create_pbuffer_surface = dri2_drm_create_pbuffer_surface,
.destroy_surface = dri2_drm_destroy_surface,
.create_image = dri2_drm_create_image_khr,
.swap_interval = dri2_fallback_swap_interval, @@ -693,7 +709,7 @@ 
dri2_initialize_drm(_EGLDriver *drv, _EGLDisplay *disp)
   attr_list[2] = EGL_NONE;
 
   dri2_add_config(disp, dri2_dpy->driver_configs[i],
-  i + 1, EGL_WINDOW_BIT, attr_list, NULL);
+  i + 1, EGL_WINDOW_BIT | EGL_PBUFFER_BIT, 
+ attr_list, NULL);
}
 
disp->Extensions.KHR_image_pixmap = EGL_TRUE;
--
2.1.0

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


Re: [Mesa-dev] [PATCH] i965: Check for miptree pitch alignment before using intel_miptree_map_movntdqa()

2015-06-10 Thread Tapani Pälli
Alignment restriction is for _mm_stream_load_si128 used by 
_mesa_streaming_load_memcpy


("The 128-bit (V)MOVNTDQA addresses must be 16-byte aligned or the 
instruction will cause a #GP.")


Reviewed-by: Tapani Pälli 

On 06/11/2015 02:50 AM, Anuj Phogat wrote:

I don't know where this alignment restriction came from. We have an
assert() in intel_miptree_map_movntdqa() which expects the pitch to
be 16 byte aligned.

Signed-off-by: Anuj Phogat 
---
  src/mesa/drivers/dri/i965/intel_mipmap_tree.c | 4 +++-
  1 file changed, 3 insertions(+), 1 deletion(-)

diff --git a/src/mesa/drivers/dri/i965/intel_mipmap_tree.c 
b/src/mesa/drivers/dri/i965/intel_mipmap_tree.c
index d4d9e76..b0b2697 100644
--- a/src/mesa/drivers/dri/i965/intel_mipmap_tree.c
+++ b/src/mesa/drivers/dri/i965/intel_mipmap_tree.c
@@ -2659,7 +2659,9 @@ intel_miptree_map(struct brw_context *brw,
 } else if (use_intel_mipree_map_blit(brw, mt, mode, level, slice)) {
intel_miptree_map_blit(brw, mt, map, level, slice);
  #if defined(USE_SSE41)
-   } else if (!(mode & GL_MAP_WRITE_BIT) && !mt->compressed && cpu_has_sse4_1) 
{
+   } else if (!(mode & GL_MAP_WRITE_BIT) &&
+  !mt->compressed && cpu_has_sse4_1 &&
+  (mt->pitch % 16 == 0)) {
intel_miptree_map_movntdqa(brw, mt, map, level, slice);
  #endif
 } else {


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


Re: [Mesa-dev] [PATCH] meta: Use is_power_of_two() helper function

2015-06-10 Thread Tapani Pälli

Reviewed-by: Tapani Pälli 

On 06/11/2015 02:50 AM, Anuj Phogat wrote:

Signed-off-by: Anuj Phogat 
---
  src/mesa/drivers/common/meta_blit.c | 6 +++---
  1 file changed, 3 insertions(+), 3 deletions(-)

diff --git a/src/mesa/drivers/common/meta_blit.c 
b/src/mesa/drivers/common/meta_blit.c
index bb21642..9cace2b 100644
--- a/src/mesa/drivers/common/meta_blit.c
+++ b/src/mesa/drivers/common/meta_blit.c
@@ -82,7 +82,7 @@ setup_glsl_msaa_blit_scaled_shader(struct gl_context *ctx,
 y_scale = samples * 0.5;

 /* We expect only power of 2 samples in source multisample buffer. */
-   assert(samples > 0 && (samples & (samples - 1)) == 0);
+   assert(samples > 0 && is_power_of_two(samples));
 while (samples >> (shader_offset + 1)) {
shader_offset++;
 }
@@ -263,7 +263,7 @@ setup_glsl_msaa_blit_shader(struct gl_context *ctx,
 }

 /* We expect only power of 2 samples in source multisample buffer. */
-   assert(samples > 0 && (samples & (samples - 1)) == 0);
+   assert(samples > 0 && is_power_of_two(samples));
 while (samples >> (shader_offset + 1)) {
shader_offset++;
 }
@@ -434,7 +434,7 @@ setup_glsl_msaa_blit_shader(struct gl_context *ctx,
* (so the floating point exponent just gets increased), rather than
* doing a naive sum and dividing.
*/
- assert((samples & (samples - 1)) == 0);
+ assert(is_power_of_two(samples));
   /* Fetch each individual sample. */
   sample_resolve = rzalloc_size(mem_ctx, 1);
   for (i = 0; i < samples; i++) {


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


Re: [Mesa-dev] [PATCH v2] i965: do not round line width when multisampling or antialiaing are enabled

2015-06-10 Thread Iago Toral
On Wed, 2015-06-10 at 17:03 -0700, Kenneth Graunke wrote:
> On Wednesday, June 10, 2015 09:07:32 AM Iago Toral Quiroga wrote:
> > In commit fe74fee8fa721a we rounded the line width to the nearest integer to
> > match the GLES3 spec requirements stated in section 13.4.2.1, but that seems
> > to break a dEQP test that renders wide lines in some multisampling 
> > scenarios.
> > 
> > Ian noted that the Open 4.4 spec has the following similar text:
> > 
> > "The actual width of non-antialiased lines is determined by rounding the
> > supplied width to the nearest integer, then clamping it to the
> > implementation-dependent maximum non-antialiased line width."
> > 
> > and suggested that when ES removed antialiased lines, they removed
> > "non-antialised" from that paragraph but probably should not have.
> > 
> > Going by that note, this patch restricts the quantization implemented in
> > fe74fee8fa721a only to regular aliased lines. This seems to keep the
> > tests fixed with that commit passing while fixing the broken test.
> > 
> > v2:
> >   - Drop one of the clamps (Ken, Marius)
> >   - Add a rule to prevent advertising line widths that when rounded go 
> > beyond
> > the limits allowed by the hardware (Ken)
> >   - Update comments in the code accordingly (Ian)
> >   - Put the code in a utility function (Ian)
> > 
> > Fixes:
> > dEQP-GLES3.functional.rasterization.fbo.rbo_multisample_max.primitives.lines_wide
> > 
> > Bugzilla: https://bugs.freedesktop.org/show_bug.cgi?id=90749
> 
> Looks good to me.  Thanks for doing this!
> 
> Reviewed-by: Kenneth Graunke 
> 
> By the way, I noticed that Marius' line-width < 1.5 code never got added
> to gen8_sf_state.c, so a couple Piglit tests fail still.  It might be
> nice to put that in the helper function too.  Feel like making a
> follow-up patch?

Sure, I'll take care of that.

Iago

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


[Mesa-dev] EGL: Add pbuffer support for drm platform

2015-06-10 Thread Ying Liu
Add pbuffer support for drm platform, because some customers are still using 
this feature.

Signed-off-by: Ying Liu 
---
 src/egl/drivers/dri2/egl_dri2.c |  3 +++
 src/egl/drivers/dri2/platform_drm.c | 30 +++---
 2 files changed, 26 insertions(+), 7 deletions(-)

diff --git a/src/egl/drivers/dri2/egl_dri2.c b/src/egl/drivers/dri2/egl_dri2.c
index 44a6c96..d56795e 100644
--- a/src/egl/drivers/dri2/egl_dri2.c
+++ b/src/egl/drivers/dri2/egl_dri2.c
@@ -909,6 +909,9 @@ dri2_create_context(_EGLDriver *drv, _EGLDisplay *disp, 
_EGLConfig *conf,
*/
   if (conf->SurfaceType & EGL_WINDOW_BIT)
  dri2_ctx->base.WindowRenderBuffer = EGL_BACK_BUFFER;
+
+  if (conf->SurfaceType & EGL_PBUFFER_BIT)
+ dri2_ctx->base.WindowRenderBuffer = EGL_BACK_BUFFER;
}
else
   dri_config = NULL;
diff --git a/src/egl/drivers/dri2/platform_drm.c 
b/src/egl/drivers/dri2/platform_drm.c
index 3391afc..c8b7e92 100644
--- a/src/egl/drivers/dri2/platform_drm.c
+++ b/src/egl/drivers/dri2/platform_drm.c
@@ -123,16 +123,23 @@ dri2_drm_create_surface(_EGLDriver *drv, _EGLDisplay 
*disp, EGLint type,
   dri2_surf->base.Height = surf->base.height;
   surf->dri_private = dri2_surf;
   break;
+   case EGL_PBUFFER_BIT:
+  break;
default:
   goto cleanup_surf;
}
 
if (dri2_dpy->dri2) {
-  dri2_surf->dri_drawable =
- (*dri2_dpy->dri2->createNewDrawable) (dri2_dpy->dri_screen,
-   dri2_conf->dri_double_config,
-   dri2_surf->gbm_surf);
-
+  if (type == EGL_PBUFFER_BIT)
+ dri2_surf->dri_drawable =
+(*dri2_dpy->dri2->createNewDrawable) (dri2_dpy->dri_screen,
+  dri2_conf->dri_double_config,
+  dri2_surf);
+  else
+dri2_surf->dri_drawable =
+(*dri2_dpy->dri2->createNewDrawable) (dri2_dpy->dri_screen,
+  dri2_conf->dri_double_config,
+  dri2_surf->gbm_surf);
} else {
   assert(dri2_dpy->swrast != NULL);
   dri2_surf->dri_drawable =
@@ -155,6 +162,15 @@ dri2_drm_create_surface(_EGLDriver *drv, _EGLDisplay 
*disp, EGLint type,
 }
 
 static _EGLSurface *
+dri2_drm_create_pbuffer_surface(_EGLDriver *drv, _EGLDisplay *disp,
+_EGLConfig *conf,
+const EGLint *attrib_list)
+{
+   return dri2_drm_create_surface(drv, disp, EGL_PBUFFER_BIT, conf,
+  NULL, attrib_list);
+}
+
+static _EGLSurface *
 dri2_drm_create_window_surface(_EGLDriver *drv, _EGLDisplay *disp,
_EGLConfig *conf, void *native_window,
const EGLint *attrib_list)
@@ -576,7 +592,7 @@ static struct dri2_egl_display_vtbl dri2_drm_display_vtbl = 
{
.authenticate = dri2_drm_authenticate,
.create_window_surface = dri2_drm_create_window_surface,
.create_pixmap_surface = dri2_drm_create_pixmap_surface,
-   .create_pbuffer_surface = dri2_fallback_create_pbuffer_surface,
+   .create_pbuffer_surface = dri2_drm_create_pbuffer_surface,
.destroy_surface = dri2_drm_destroy_surface,
.create_image = dri2_drm_create_image_khr,
.swap_interval = dri2_fallback_swap_interval,
@@ -693,7 +709,7 @@ dri2_initialize_drm(_EGLDriver *drv, _EGLDisplay *disp)
   attr_list[2] = EGL_NONE;
 
   dri2_add_config(disp, dri2_dpy->driver_configs[i],
-  i + 1, EGL_WINDOW_BIT, attr_list, NULL);
+  i + 1, EGL_WINDOW_BIT | EGL_PBUFFER_BIT, attr_list, 
NULL);
}
 
disp->Extensions.KHR_image_pixmap = EGL_TRUE;
-- 
2.1.0

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


Re: [Mesa-dev] [PATCH 0/4] drisw/glx: use XShm if possible

2015-06-10 Thread Axel Davy

On 10/06/2015 18:08, Marc-André Lureau wrote :

Hi,

XPutImage requires to copy the images around, and the request may be
split over several chunks. Using XShm should improve performance.




Another way of doing that is to make the swrast loader allocate the buffers,
and have swrast swap buffers instead of copying content.

For example there could be a request to allocate a first buffer,
and then a request to present an already allocated buffer, which
would return a new buffer (could be the same).

Doing that way, it could use XShm behind the scene, and it would fit
different usages, like having a zero copy mechanism for wayland swrast.

Yours,

Axel Davy
___
mesa-dev mailing list
mesa-dev@lists.freedesktop.org
http://lists.freedesktop.org/mailman/listinfo/mesa-dev


[Mesa-dev] [PATCH v3] egl/dri2: implement platform_surfaceless

2015-06-10 Thread Zach Reizner
From: Haixia Shi 

The surfaceless platform is for off-screen rendering only. Render node support
is required.

Only consider the render nodes. Do not use normal nodes as they require
auth hooks.

v3: change platform_null to platform_surfaceless
v4: make libdrm required for surfaceless

Signed-off-by: Haixia Shi 
Signed-off-by: Zach Reizner 
---
 configure.ac|   6 ++
 src/egl/drivers/dri2/Makefile.am|   5 +
 src/egl/drivers/dri2/egl_dri2.c |  11 +-
 src/egl/drivers/dri2/egl_dri2.h |   3 +
 src/egl/drivers/dri2/platform_surfaceless.c | 161 
 src/egl/main/Makefile.am|   4 +
 src/egl/main/egldisplay.c   |   3 +-
 src/egl/main/egldisplay.h   |   1 +
 8 files changed, 191 insertions(+), 3 deletions(-)
 create mode 100644 src/egl/drivers/dri2/platform_surfaceless.c

diff --git a/configure.ac b/configure.ac
index d32aa24..e7c7f87 100644
--- a/configure.ac
+++ b/configure.ac
@@ -1777,6 +1777,11 @@ for plat in $egl_platforms; do
AC_MSG_ERROR([EGL platform drm requires libdrm >= 
$LIBDRM_REQUIRED])
;;
 
+   surfaceless)
+   test "x$have_libdrm" != xyes &&
+   AC_MSG_ERROR([EGL platform surfaceless requires libdrm 
>= $LIBDRM_REQUIRED])
+   ;;
+
android|gdi|null)
;;
 
@@ -1806,6 +1811,7 @@ fi
 AM_CONDITIONAL(HAVE_EGL_PLATFORM_X11, echo "$egl_platforms" | grep -q 'x11')
 AM_CONDITIONAL(HAVE_EGL_PLATFORM_WAYLAND, echo "$egl_platforms" | grep -q 
'wayland')
 AM_CONDITIONAL(HAVE_EGL_PLATFORM_DRM, echo "$egl_platforms" | grep -q 'drm')
+AM_CONDITIONAL(HAVE_EGL_PLATFORM_SURFACELESS, echo "$egl_platforms" | grep -q 
'surfaceless')
 AM_CONDITIONAL(HAVE_EGL_PLATFORM_NULL, echo "$egl_platforms" | grep -q 'null')
 
 AM_CONDITIONAL(HAVE_EGL_DRIVER_DRI2, test "x$HAVE_EGL_DRIVER_DRI2" != "x")
diff --git a/src/egl/drivers/dri2/Makefile.am b/src/egl/drivers/dri2/Makefile.am
index f589600..55be4a7 100644
--- a/src/egl/drivers/dri2/Makefile.am
+++ b/src/egl/drivers/dri2/Makefile.am
@@ -65,4 +65,9 @@ libegl_dri2_la_SOURCES += platform_drm.c
 AM_CFLAGS += -DHAVE_DRM_PLATFORM
 endif
 
+if HAVE_EGL_PLATFORM_SURFACELESS
+libegl_dri2_la_SOURCES += platform_surfaceless.c
+AM_CFLAGS += -DHAVE_SURFACELESS_PLATFORM
+endif
+
 EXTRA_DIST = SConscript
diff --git a/src/egl/drivers/dri2/egl_dri2.c b/src/egl/drivers/dri2/egl_dri2.c
index 82f8843..877cf70 100644
--- a/src/egl/drivers/dri2/egl_dri2.c
+++ b/src/egl/drivers/dri2/egl_dri2.c
@@ -658,6 +658,13 @@ dri2_initialize(_EGLDriver *drv, _EGLDisplay *disp)
   return EGL_FALSE;
 
switch (disp->Platform) {
+#ifdef HAVE_SURFACELESS_PLATFORM
+   case _EGL_PLATFORM_SURFACELESS:
+  if (disp->Options.TestOnly)
+ return EGL_TRUE;
+  return dri2_initialize_surfaceless(drv, disp);
+#endif
+
 #ifdef HAVE_X11_PLATFORM
case _EGL_PLATFORM_X11:
   if (disp->Options.TestOnly)
@@ -1604,7 +1611,7 @@ dri2_create_wayland_buffer_from_image(_EGLDriver *drv, 
_EGLDisplay *dpy,
return dri2_dpy->vtbl->create_wayland_buffer_from_image(drv, dpy, img);
 }
 
-#ifdef HAVE_LIBDRM
+#if defined(HAVE_DRM_PLATFORM) || defined(HAVE_SURFACELESS_PLATFORM)
 static EGLBoolean
 dri2_check_dma_buf_attribs(const _EGLImageAttribs *attrs)
 {
@@ -1862,7 +1869,7 @@ dri2_create_image_khr(_EGLDriver *drv, _EGLDisplay *disp,
case EGL_WAYLAND_BUFFER_WL:
   return dri2_create_image_wayland_wl_buffer(disp, ctx, buffer, attr_list);
 #endif
-#ifdef HAVE_LIBDRM
+#if defined(HAVE_DRM_PLATFORM) || defined(HAVE_SURFACELESS_PLATFORM)
case EGL_LINUX_DMA_BUF_EXT:
   return dri2_create_image_dma_buf(disp, ctx, buffer, attr_list);
 #endif
diff --git a/src/egl/drivers/dri2/egl_dri2.h b/src/egl/drivers/dri2/egl_dri2.h
index adade3d..9985c49 100644
--- a/src/egl/drivers/dri2/egl_dri2.h
+++ b/src/egl/drivers/dri2/egl_dri2.h
@@ -351,6 +351,9 @@ dri2_initialize_wayland(_EGLDriver *drv, _EGLDisplay *disp);
 EGLBoolean
 dri2_initialize_android(_EGLDriver *drv, _EGLDisplay *disp);
 
+EGLBoolean
+dri2_initialize_surfaceless(_EGLDriver *drv, _EGLDisplay *disp);
+
 void
 dri2_flush_drawable_for_swapbuffers(_EGLDisplay *disp, _EGLSurface *draw);
 
diff --git a/src/egl/drivers/dri2/platform_surfaceless.c 
b/src/egl/drivers/dri2/platform_surfaceless.c
new file mode 100644
index 000..f8426bb
--- /dev/null
+++ b/src/egl/drivers/dri2/platform_surfaceless.c
@@ -0,0 +1,161 @@
+/*
+ * Mesa 3-D graphics library
+ *
+ * Copyright (c) 2014 The Chromium OS Authors.
+ * Copyright © 2011 Intel Corporation
+ *
+ * Permission is hereby granted, free of charge, to any person obtaining a
+ * copy of this software and associated documentation files (the "Software"),
+ * to deal in the Software without restriction, including without limitation
+ * the rights to use, copy, modify, merge, publish, distribute, sublicense,
+ * and/or sell copies of the Software, and to permit persons to w

Re: [Mesa-dev] [PATCH] i965: Remove break after return

2015-06-10 Thread Tapani Pälli

Reviewed-by: Tapani Pälli 

On 06/11/2015 02:46 AM, Anuj Phogat wrote:

Signed-off-by: Anuj Phogat 
---
  src/mesa/drivers/dri/i965/intel_blit.c | 3 ---
  1 file changed, 3 deletions(-)

diff --git a/src/mesa/drivers/dri/i965/intel_blit.c 
b/src/mesa/drivers/dri/i965/intel_blit.c
index 987b5f5..068565c 100644
--- a/src/mesa/drivers/dri/i965/intel_blit.c
+++ b/src/mesa/drivers/dri/i965/intel_blit.c
@@ -99,13 +99,10 @@ br13_for_cpp(int cpp)
return BR13_16161616;
 case 4:
return BR13_;
-  break;
 case 2:
return BR13_565;
-  break;
 case 1:
return BR13_8;
-  break;
 default:
unreachable("not reached");
 }


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


Re: [Mesa-dev] Mesa (amdgpu): radeonsi: properly set the raster_config for KV

2015-06-10 Thread Michel Dänzer
On 11.06.2015 04:55, Alex Deucher wrote:
> Module: Mesa
> Branch: amdgpu
> Commit: 0d60a4fb3a41817346a18f56acecdff566effed5
> URL:
> http://cgit.freedesktop.org/mesa/mesa/commit/?id=0d60a4fb3a41817346a18f56acecdff566effed5
> 
> Author: Alex Deucher 
> Date:   Wed Jun 10 11:39:30 2015 -0400
> 
> radeonsi: properly set the raster_config for KV
> 
> This enables the second RB on asics that support it which
> should boost performance.
> 
> Reviewed-by: Marek Olšák 
> Signed-off-by: Alex Deucher 
> Cc: mesa-sta...@lists.freedesktop.org

This patch doesn't work correctly on my desktop Kaveri. glxgears shows
corruption; looks like it is trying to use more execution units, but
half of them don't work correctly.

Interestingly, it seems fine for glamor though.


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


Re: [Mesa-dev] [PATCH 2/5] mesa/st: Use global function _mesa_regions_overlap()

2015-06-10 Thread Ben Widawsky
On Wed, Jun 10, 2015 at 03:34:50PM -0700, Anuj Phogat wrote:
> Signed-off-by: Anuj Phogat 
> Cc: Ben Widawsky 

1 and 2 are:
Reviewed-by: Ben Widawsky 

[snip]

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


[Mesa-dev] [PATCH 7/7] gallium/ttn: add texture-type support

2015-06-10 Thread Rob Clark
From: Rob Clark 

v2: rebased on using SVIEW to hold type information

Signed-off-by: Rob Clark 
---
 src/gallium/auxiliary/nir/tgsi_to_nir.c | 44 -
 1 file changed, 43 insertions(+), 1 deletion(-)

diff --git a/src/gallium/auxiliary/nir/tgsi_to_nir.c 
b/src/gallium/auxiliary/nir/tgsi_to_nir.c
index 1702b41..d0291e5 100644
--- a/src/gallium/auxiliary/nir/tgsi_to_nir.c
+++ b/src/gallium/auxiliary/nir/tgsi_to_nir.c
@@ -58,6 +58,9 @@ struct ttn_compile {
struct ttn_reg_info *temp_regs;
nir_ssa_def **imm_defs;
 
+   unsigned num_samp_types;
+   nir_alu_type *samp_types;
+
nir_register *addr_reg;
 
/**
@@ -156,6 +159,30 @@ ttn_emit_declaration(struct ttn_compile *c)
   /* Nothing to record for system values. */
} else if (file == TGSI_FILE_SAMPLER) {
   /* Nothing to record for samplers. */
+   } else if (file == TGSI_FILE_SAMPLER_VIEW) {
+  struct tgsi_declaration_sampler_view *sview = &decl->SamplerView;
+  nir_alu_type type;
+
+  debug_assert((sview->ReturnTypeX == sview->ReturnTypeY) &&
+  (sview->ReturnTypeX == sview->ReturnTypeZ) &&
+  (sview->ReturnTypeX == sview->ReturnTypeW));
+
+  switch (sview->ReturnTypeX) {
+  case TGSI_RETURN_TYPE_SINT:
+ type = nir_type_int;
+ break;
+  case TGSI_RETURN_TYPE_UINT:
+ type = nir_type_unsigned;
+ break;
+  case TGSI_RETURN_TYPE_FLOAT:
+  default:
+ type = nir_type_float;
+ break;
+  }
+
+  for (i = 0; i < array_size; i++) {
+ c->samp_types[decl->Range.First + i] = type;
+  }
} else {
   nir_variable *var;
   assert(file == TGSI_FILE_INPUT ||
@@ -1026,7 +1053,7 @@ ttn_tex(struct ttn_compile *c, nir_alu_dest dest, 
nir_ssa_def **src)
struct tgsi_full_instruction *tgsi_inst = &c->token->FullInstruction;
nir_tex_instr *instr;
nir_texop op;
-   unsigned num_srcs, samp = 1, i;
+   unsigned num_srcs, samp = 1, sview, i;
 
switch (tgsi_inst->Instruction.Opcode) {
case TGSI_OPCODE_TEX:
@@ -1105,6 +1132,18 @@ ttn_tex(struct ttn_compile *c, nir_alu_dest dest, 
nir_ssa_def **src)
assert(tgsi_inst->Src[samp].Register.File == TGSI_FILE_SAMPLER);
instr->sampler_index = tgsi_inst->Src[samp].Register.Index;
 
+   /* TODO if we supported any opc's which take an explicit SVIEW
+* src, we would use that here instead.  But for the "legacy"
+* texture opc's the SVIEW index is same as SAMP index:
+*/
+   sview = instr->sampler_index;
+
+   if (sview < c->num_samp_types) {
+  instr->dest_type = c->samp_types[sview];
+   } else {
+  instr->dest_type = nir_type_float;
+   }
+
unsigned src_number = 0;
 
instr->src[src_number].src =
@@ -1710,6 +1749,9 @@ tgsi_to_nir(const void *tgsi_tokens,
c->imm_defs = rzalloc_array(c, nir_ssa_def *,
scan.file_max[TGSI_FILE_IMMEDIATE] + 1);
 
+   c->num_samp_types = scan.file_max[TGSI_FILE_SAMPLER_VIEW] + 1;
+   c->samp_types = rzalloc_array(c, nir_alu_type, c->num_samp_types);
+
c->if_stack = rzalloc_array(c, struct exec_list *,
(scan.opcode_count[TGSI_OPCODE_IF] +
 scan.opcode_count[TGSI_OPCODE_UIF]) * 2);
-- 
2.4.2

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


[Mesa-dev] [PATCH 5/7] util/blitter (and friends): generate appropriate SVIEW decls

2015-06-10 Thread Rob Clark
From: Rob Clark 

Some hardware needs to know the sampler type.  Update the blit related
shaders to include SVIEW decl.

Signed-off-by: Rob Clark 
---
Possibly I should have refactored the existing code to pass around a
return_type rather than doing the is_uint/is_sint thing everywhere.
And this does kind of ignore UNORM/SNORM.. although I'm not really
sure that we need shader variants for UNORM/SNORM (we don't have this
information in GLSL IR or NIR IR, and I don't know any hw that doesn't
just treat those as FLOAT in the shader compiler).  Anyways, sending
it out as-is for comments.

 src/gallium/auxiliary/util/u_blit.c   | 32 +
 src/gallium/auxiliary/util/u_blitter.c| 42 
 src/gallium/auxiliary/util/u_simple_shaders.c | 69 +++
 src/gallium/auxiliary/util/u_simple_shaders.h | 15 --
 src/gallium/auxiliary/util/u_tests.c  |  3 +-
 src/gallium/tests/trivial/quad-tex.c  |  2 +-
 6 files changed, 132 insertions(+), 31 deletions(-)

diff --git a/src/gallium/auxiliary/util/u_blit.c 
b/src/gallium/auxiliary/util/u_blit.c
index 3f3b5fe..0062d96 100644
--- a/src/gallium/auxiliary/util/u_blit.c
+++ b/src/gallium/auxiliary/util/u_blit.c
@@ -65,7 +65,7 @@ struct blit_state
struct pipe_vertex_element velem[2];
 
void *vs;
-   void *fs[PIPE_MAX_TEXTURE_TYPES][TGSI_WRITEMASK_XYZW + 1];
+   void *fs[PIPE_MAX_TEXTURE_TYPES][TGSI_WRITEMASK_XYZW + 1][3];
 
struct pipe_resource *vbuf;  /**< quad vertices */
unsigned vbuf_slot;
@@ -135,15 +135,17 @@ void
 util_destroy_blit(struct blit_state *ctx)
 {
struct pipe_context *pipe = ctx->pipe;
-   unsigned i, j;
+   unsigned i, j, k;
 
if (ctx->vs)
   pipe->delete_vs_state(pipe, ctx->vs);
 
for (i = 0; i < Elements(ctx->fs); i++) {
   for (j = 0; j < Elements(ctx->fs[i]); j++) {
- if (ctx->fs[i][j])
-pipe->delete_fs_state(pipe, ctx->fs[i][j]);
+ for (k = 0; k < Elements(ctx->fs[i][j]); k++) {
+if (ctx->fs[i][j][k])
+   pipe->delete_fs_state(pipe, ctx->fs[i][j][k]);
+ }
   }
}
 
@@ -158,18 +160,31 @@ util_destroy_blit(struct blit_state *ctx)
  */
 static INLINE void
 set_fragment_shader(struct blit_state *ctx, uint writemask,
+enum pipe_format format,
 enum pipe_texture_target pipe_tex)
 {
-   if (!ctx->fs[pipe_tex][writemask]) {
+   boolean is_uint = util_format_is_pure_uint(format);
+   boolean is_sint = util_format_is_pure_sint(format);
+   unsigned type;
+
+   if (is_uint)
+  type = 0;
+   else if (is_sint)
+  type = 1;
+   else
+  type = 2;
+
+   if (!ctx->fs[pipe_tex][writemask][type]) {
   unsigned tgsi_tex = util_pipe_tex_to_tgsi_tex(pipe_tex, 0);
 
-  ctx->fs[pipe_tex][writemask] =
+  ctx->fs[pipe_tex][writemask][type] =
  util_make_fragment_tex_shader_writemask(ctx->pipe, tgsi_tex,
  TGSI_INTERPOLATE_LINEAR,
- writemask);
+ writemask,
+ is_uint, is_sint);
}
 
-   cso_set_fragment_shader_handle(ctx->cso, ctx->fs[pipe_tex][writemask]);
+   cso_set_fragment_shader_handle(ctx->cso, 
ctx->fs[pipe_tex][writemask][type]);
 }
 
 
@@ -571,6 +586,7 @@ util_blit_pixels_tex(struct blit_state *ctx,
 
/* shaders */
set_fragment_shader(ctx, TGSI_WRITEMASK_XYZW,
+   src_sampler_view->format,
src_sampler_view->texture->target);
set_vertex_shader(ctx);
cso_set_tessctrl_shader_handle(ctx->cso, NULL);
diff --git a/src/gallium/auxiliary/util/u_blitter.c 
b/src/gallium/auxiliary/util/u_blitter.c
index 16bf90f..27e0d10 100644
--- a/src/gallium/auxiliary/util/u_blitter.c
+++ b/src/gallium/auxiliary/util/u_blitter.c
@@ -81,6 +81,8 @@ struct blitter_context_priv
/* FS which outputs a color from a texture,
   where the index is PIPE_TEXTURE_* to be sampled. */
void *fs_texfetch_col[PIPE_MAX_TEXTURE_TYPES];
+   void *fs_texfetch_col_uint[PIPE_MAX_TEXTURE_TYPES];
+   void *fs_texfetch_col_sint[PIPE_MAX_TEXTURE_TYPES];
 
/* FS which outputs a depth from a texture,
   where the index is PIPE_TEXTURE_* to be sampled. */
@@ -90,6 +92,8 @@ struct blitter_context_priv
 
/* FS which outputs one sample from a multisample texture. */
void *fs_texfetch_col_msaa[PIPE_MAX_TEXTURE_TYPES];
+   void *fs_texfetch_col_msaa_uint[PIPE_MAX_TEXTURE_TYPES];
+   void *fs_texfetch_col_msaa_sint[PIPE_MAX_TEXTURE_TYPES];
void *fs_texfetch_depth_msaa[PIPE_MAX_TEXTURE_TYPES];
void *fs_texfetch_depthstencil_msaa[PIPE_MAX_TEXTURE_TYPES];
void *fs_texfetch_stencil_msaa[PIPE_MAX_TEXTURE_TYPES];
@@ -438,6 +442,10 @@ void util_blitter_destroy(struct blitter_context *blitter)
for (i = 0; i < PIPE_MAX_TEXTURE_TYPES; i++) {
   if (ctx->fs_texfetch_col[i])
  ctx->delete_fs_

[Mesa-dev] [PATCH 6/7] glsl_to_tgsi: add SVIEW decl support

2015-06-10 Thread Rob Clark
From: Rob Clark 

Freedreno needs sampler type information to deal with int/uint textures.
To accomplish this, start creating sampler-view declarations, as
suggested here:

 http://lists.freedesktop.org/archives/mesa-dev/2014-November/071583.html

create a sampler-view with index matching the sampler, to encode the
texture type (ie. SINT/UINT/FLOAT).  Ie:

   DCL SVIEW[n], 2D, UINT
   DCL SAMP[n]
   TEX OUT[1], IN[1], SAMP[n]

For tgsi texture instructions which do not take an explicit SVIEW
argument, the SVIEW index is implied by the SAMP index.

Signed-off-by: Rob Clark 
---
 src/mesa/state_tracker/st_glsl_to_tgsi.cpp | 29 +
 1 file changed, 29 insertions(+)

diff --git a/src/mesa/state_tracker/st_glsl_to_tgsi.cpp 
b/src/mesa/state_tracker/st_glsl_to_tgsi.cpp
index 0e60d95..ce8f2ea 100644
--- a/src/mesa/state_tracker/st_glsl_to_tgsi.cpp
+++ b/src/mesa/state_tracker/st_glsl_to_tgsi.cpp
@@ -239,6 +239,7 @@ public:
st_src_reg sampler; /**< sampler register */
int sampler_array_size; /**< 1-based size of sampler array, 1 if not array 
*/
int tex_target; /**< One of TEXTURE_*_INDEX */
+   glsl_base_type tex_type;
GLboolean tex_shadow;
 
st_src_reg tex_offsets[MAX_GLSL_TEXTURE_OFFSET];
@@ -345,6 +346,8 @@ public:
 
int num_address_regs;
int samplers_used;
+   glsl_base_type sampler_types[PIPE_MAX_SAMPLERS];
+   int sampler_targets[PIPE_MAX_SAMPLERS];   /**< One of TGSI_TEXTURE_* */
bool indirect_addr_consts;
int wpos_transform_const;
 
@@ -3323,6 +3326,8 @@ glsl_to_tgsi_visitor::visit(ir_texture *ir)
   assert(!"Should not get here.");
}
 
+   inst->tex_type = ir->type->base_type;
+
this->result = result_src;
 }
 
@@ -3471,6 +3476,11 @@ count_resources(glsl_to_tgsi_visitor *v, gl_program 
*prog)
  for (int i = 0; i < inst->sampler_array_size; i++) {
 v->samplers_used |= 1 << (inst->sampler.index + i);
 
+debug_assert(i < (int)ARRAY_SIZE(v->sampler_types));
+v->sampler_types[i] = inst->tex_type;
+v->sampler_targets[i] =
+   st_translate_texture_target(inst->tex_target, inst->tex_shadow);
+
 if (inst->tex_shadow) {
prog->ShadowSamplers |= 1 << (inst->sampler.index + i);
 }
@@ -5529,7 +5539,26 @@ st_translate_program(
/* texture samplers */
for (i = 0; i < 
ctx->Const.Program[MESA_SHADER_FRAGMENT].MaxTextureImageUnits; i++) {
   if (program->samplers_used & (1 << i)) {
+ unsigned type;
+
  t->samplers[i] = ureg_DECL_sampler(ureg, i);
+
+ switch (program->sampler_types[i]) {
+ case GLSL_TYPE_INT:
+type = TGSI_RETURN_TYPE_SINT;
+break;
+ case GLSL_TYPE_UINT:
+type = TGSI_RETURN_TYPE_UINT;
+break;
+ case GLSL_TYPE_FLOAT:
+type = TGSI_RETURN_TYPE_FLOAT;
+break;
+ default:
+unreachable("not reached");
+ }
+
+ ureg_DECL_sampler_view( ureg, i, program->sampler_targets[i],
+ type, type, type, type );
   }
}
 
-- 
2.4.2

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


[Mesa-dev] [PATCH 2/7] tgsi/transform: add support for SVIEW decls

2015-06-10 Thread Rob Clark
From: Rob Clark 

Signed-off-by: Rob Clark 
---
 src/gallium/auxiliary/tgsi/tgsi_transform.h | 24 
 1 file changed, 24 insertions(+)

diff --git a/src/gallium/auxiliary/tgsi/tgsi_transform.h 
b/src/gallium/auxiliary/tgsi/tgsi_transform.h
index 921aa906..e7de49e 100644
--- a/src/gallium/auxiliary/tgsi/tgsi_transform.h
+++ b/src/gallium/auxiliary/tgsi/tgsi_transform.h
@@ -143,6 +143,30 @@ tgsi_transform_sampler_decl(struct tgsi_transform_context 
*ctx,
ctx->emit_declaration(ctx, &decl);
 }
 
+static INLINE void
+tgsi_transform_sampler_view_decl(struct tgsi_transform_context *ctx,
+ unsigned index,
+ unsigned target,
+ unsigned return_type_x,
+ unsigned return_type_y,
+ unsigned return_type_z,
+ unsigned return_type_w)
+{
+   struct tgsi_full_declaration decl;
+
+   decl = tgsi_default_full_declaration();
+   decl.Declaration.File = TGSI_FILE_SAMPLER_VIEW;
+   decl.Declaration.UsageMask = 0xf;
+   decl.Range.First =
+   decl.Range.Last = index;
+   decl.SamplerView.Resource = target;
+   decl.SamplerView.ReturnTypeX = return_type_x;
+   decl.SamplerView.ReturnTypeY = return_type_y;
+   decl.SamplerView.ReturnTypeZ = return_type_z;
+   decl.SamplerView.ReturnTypeW = return_type_w;
+
+   ctx->emit_declaration(ctx, &decl);
+}
 
 static INLINE void
 tgsi_transform_immediate_decl(struct tgsi_transform_context *ctx,
-- 
2.4.2

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


[Mesa-dev] [PATCH 1/7] tgsi: update docs for SVIEW usage with TEX* instructions

2015-06-10 Thread Rob Clark
From: Rob Clark 

Based on mailing list discussion here:

http://lists.freedesktop.org/archives/mesa-dev/2014-November/071583.html

Signed-off-by: Rob Clark 
---
 src/gallium/docs/source/tgsi.rst | 12 
 1 file changed, 12 insertions(+)

diff --git a/src/gallium/docs/source/tgsi.rst b/src/gallium/docs/source/tgsi.rst
index f77702a..89ca172 100644
--- a/src/gallium/docs/source/tgsi.rst
+++ b/src/gallium/docs/source/tgsi.rst
@@ -2965,6 +2965,18 @@ resource can be one of BUFFER, 1D, 2D, 3D, 1DArray and 
2DArray.
 type must be 1 or 4 entries (if specifying on a per-component
 level) out of UNORM, SNORM, SINT, UINT and FLOAT.
 
+For TEX\* style texture sample opcodes (as opposed to SAMPLE\* opcodes
+which take an explicit SVIEW[#] source register), there may be optionally
+SVIEW[#] declarations.  In this case, the SVIEW index is implied by the
+SAMP index, and there must be a corresponding SVIEW[#] declaration for
+each SAMP[#] declaration.  Drivers are free to ignore this if they wish.
+But note in particular that some drivers need to know the sampler type
+(float/int/unsigned) in order to generate the correct code, so cases
+where integer textures are sampled, SVIEW[#] declarations should be
+used.
+
+NOTE: It is NOT legal to mix SAMPLE\* style opcodes and TEX\* opcodes
+in the same shader.
 
 Declaration Resource
 
-- 
2.4.2

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


[Mesa-dev] [PATCH 4/7] util/pstipple: updates for SVIEW decls

2015-06-10 Thread Rob Clark
From: Rob Clark 

To allow for shaders which use SVIEW decls for TEX* instructions, we
need to preserve the constraint that the shader either has no SVIEW's or
it has one matching SVIEW for each SAMP.

Signed-off-by: Rob Clark 
---
 src/gallium/auxiliary/util/u_pstipple.c | 25 -
 1 file changed, 20 insertions(+), 5 deletions(-)

diff --git a/src/gallium/auxiliary/util/u_pstipple.c 
b/src/gallium/auxiliary/util/u_pstipple.c
index 0a20bdb..4ab1994 100644
--- a/src/gallium/auxiliary/util/u_pstipple.c
+++ b/src/gallium/auxiliary/util/u_pstipple.c
@@ -55,7 +55,7 @@
 #include "tgsi/tgsi_scan.h"
 
 /** Approx number of new tokens for instructions in pstip_transform_inst() */
-#define NUM_NEW_TOKENS 50
+#define NUM_NEW_TOKENS 53
 
 
 static void
@@ -262,6 +262,7 @@ pstip_transform_prolog(struct tgsi_transform_context *ctx)
   (struct pstip_transform_context *) ctx;
int wincoordInput;
int texTemp;
+   int sampIdx;
 
/* find free texture sampler */
pctx->freeSampler = free_bit(pctx->samplersUsed);
@@ -280,9 +281,24 @@ pstip_transform_prolog(struct tgsi_transform_context *ctx)
 TGSI_INTERPOLATE_LINEAR);
}
 
+   sampIdx = pctx->hasFixedUnit ? pctx->fixedUnit : pctx->freeSampler;
+
/* declare new sampler */
-   tgsi_transform_sampler_decl(ctx,
- pctx->hasFixedUnit ? pctx->fixedUnit : pctx->freeSampler);
+   tgsi_transform_sampler_decl(ctx, sampIdx);
+
+   /* if the src shader has SVIEW decl's for each SAMP decl, we
+* need to continue the trend and ensure there is a matching
+* SVIEW for the new SAMP we just created
+*/
+   if (pctx->info.file_max[TGSI_FILE_SAMPLER_VIEW] != -1) {
+  tgsi_transform_sampler_view_decl(ctx,
+   sampIdx,
+   TGSI_TEXTURE_2D,
+   TGSI_RETURN_TYPE_FLOAT,
+   TGSI_RETURN_TYPE_FLOAT,
+   TGSI_RETURN_TYPE_FLOAT,
+   TGSI_RETURN_TYPE_FLOAT);
+   }
 
/* Declare temp[0] reg if not already declared.
 * We can always use temp[0] since this code is before
@@ -321,8 +337,7 @@ pstip_transform_prolog(struct tgsi_transform_context *ctx)
tgsi_transform_tex_2d_inst(ctx,
   TGSI_FILE_TEMPORARY, texTemp,
   TGSI_FILE_TEMPORARY, texTemp,
-  pctx->hasFixedUnit ? pctx->fixedUnit
- : pctx->freeSampler);
+  sampIdx);
 
/* KILL_IF -texTemp;   # if -texTemp < 0, kill fragment */
tgsi_transform_kill_inst(ctx,
-- 
2.4.2

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


[Mesa-dev] [PATCH 3/7] draw: updates to support SVIEW decls

2015-06-10 Thread Rob Clark
From: Rob Clark 

To allow for shaders which use SVIEW decls for TEX* instructions, we
need to preserve the constraint that the shader either has no SVIEW's or
it has one matching SVIEW for each SAMP.

Signed-off-by: Rob Clark 
---
 src/gallium/auxiliary/draw/draw_pipe_aaline.c   | 20 +++-
 src/gallium/auxiliary/draw/draw_pipe_pstipple.c | 20 +++-
 2 files changed, 38 insertions(+), 2 deletions(-)

diff --git a/src/gallium/auxiliary/draw/draw_pipe_aaline.c 
b/src/gallium/auxiliary/draw/draw_pipe_aaline.c
index 2f14efe..27c69dd 100644
--- a/src/gallium/auxiliary/draw/draw_pipe_aaline.c
+++ b/src/gallium/auxiliary/draw/draw_pipe_aaline.c
@@ -51,7 +51,7 @@
 
 
 /** Approx number of new tokens for instructions in aa_transform_inst() */
-#define NUM_NEW_TOKENS 50
+#define NUM_NEW_TOKENS 53
 
 
 /**
@@ -137,6 +137,7 @@ struct aa_transform_context {
uint tempsUsed;  /**< bitmask */
int colorOutput; /**< which output is the primary color */
uint samplersUsed;  /**< bitfield of samplers used */
+   bool hasSview;
int freeSampler;  /** an available sampler for the pstipple */
int maxInput, maxGeneric;  /**< max input index found */
int colorTemp, texTemp;  /**< temp registers */
@@ -165,6 +166,9 @@ aa_transform_decl(struct tgsi_transform_context *ctx,
  aactx->samplersUsed |= 1 << i;
   }
}
+   else if (decl->Declaration.File == TGSI_FILE_SAMPLER_VIEW) {
+  aactx->hasSview = true;
+   }
else if (decl->Declaration.File == TGSI_FILE_INPUT) {
   if ((int) decl->Range.Last > aactx->maxInput)
  aactx->maxInput = decl->Range.Last;
@@ -232,6 +236,20 @@ aa_transform_prolog(struct tgsi_transform_context *ctx)
/* declare new sampler */
tgsi_transform_sampler_decl(ctx, aactx->freeSampler);
 
+   /* if the src shader has SVIEW decl's for each SAMP decl, we
+* need to continue the trend and ensure there is a matching
+* SVIEW for the new SAMP we just created
+*/
+   if (aactx->hasSview) {
+  tgsi_transform_sampler_view_decl(ctx,
+   aactx->freeSampler,
+   TGSI_TEXTURE_2D,
+   TGSI_RETURN_TYPE_FLOAT,
+   TGSI_RETURN_TYPE_FLOAT,
+   TGSI_RETURN_TYPE_FLOAT,
+   TGSI_RETURN_TYPE_FLOAT);
+   }
+
/* declare new temp regs */
tgsi_transform_temp_decl(ctx, aactx->texTemp);
tgsi_transform_temp_decl(ctx, aactx->colorTemp);
diff --git a/src/gallium/auxiliary/draw/draw_pipe_pstipple.c 
b/src/gallium/auxiliary/draw/draw_pipe_pstipple.c
index 8f21c46..1e6ebe6 100644
--- a/src/gallium/auxiliary/draw/draw_pipe_pstipple.c
+++ b/src/gallium/auxiliary/draw/draw_pipe_pstipple.c
@@ -53,7 +53,7 @@
 
 
 /** Approx number of new tokens for instructions in pstip_transform_inst() */
-#define NUM_NEW_TOKENS 50
+#define NUM_NEW_TOKENS 53
 
 
 /**
@@ -126,6 +126,7 @@ struct pstip_transform_context {
int wincoordInput;
int maxInput;
uint samplersUsed;  /**< bitfield of samplers used */
+   bool hasSview;
int freeSampler;  /** an available sampler for the pstipple */
int texTemp;  /**< temp registers */
int numImmed;
@@ -149,6 +150,9 @@ pstip_transform_decl(struct tgsi_transform_context *ctx,
  pctx->samplersUsed |= 1 << i;
   }
}
+   else if (decl->Declaration.File == TGSI_FILE_SAMPLER_VIEW) {
+  pctx->hasSview = true;
+   }
else if (decl->Declaration.File == TGSI_FILE_INPUT) {
   pctx->maxInput = MAX2(pctx->maxInput, (int) decl->Range.Last);
   if (decl->Semantic.Name == TGSI_SEMANTIC_POSITION)
@@ -232,6 +236,20 @@ pstip_transform_prolog(struct tgsi_transform_context *ctx)
/* declare new sampler */
tgsi_transform_sampler_decl(ctx, pctx->freeSampler);
 
+   /* if the src shader has SVIEW decl's for each SAMP decl, we
+* need to continue the trend and ensure there is a matching
+* SVIEW for the new SAMP we just created
+*/
+   if (pctx->hasSview) {
+  tgsi_transform_sampler_view_decl(ctx,
+   pctx->freeSampler,
+   TGSI_TEXTURE_2D,
+   TGSI_RETURN_TYPE_FLOAT,
+   TGSI_RETURN_TYPE_FLOAT,
+   TGSI_RETURN_TYPE_FLOAT,
+   TGSI_RETURN_TYPE_FLOAT);
+   }
+
/* declare new temp regs */
tgsi_transform_temp_decl(ctx, pctx->texTemp);
 
-- 
2.4.2

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


Re: [Mesa-dev] [PATCH] i965: Momentarily pretend to support ARB_texture_stencil8 for blits.

2015-06-10 Thread Kenneth Graunke
On Wednesday, June 10, 2015 05:57:05 PM Neil Roberts wrote:
> Kenneth Graunke  writes:
> 
> > _mesa_meta_fb_tex_blit_begin(ctx, &blit);
> > +   ctx->Extensions.ARB_texture_stencil8 = true;
> 
> Maybe you could put assert(ctx->Extensions.ARB_texture_stencil8==false)
> just before setting it to true so that we'll definitely remember to
> remove it if we eventually enable the extension. Otherwise as it stands
> if we forget about this it would probably not break any tests but the
> extension would mysteriously disable itself and no-one would notice
> because they would probably check the extensions just once upfront.
> 
> - Neil

Great idea.  Added, retested, and pushed.  Thanks all!


signature.asc
Description: This is a digitally signed message part.
___
mesa-dev mailing list
mesa-dev@lists.freedesktop.org
http://lists.freedesktop.org/mailman/listinfo/mesa-dev


Re: [Mesa-dev] Request for Mentorship

2015-06-10 Thread Matt Turner
On Wed, Jun 10, 2015 at 5:04 PM, Emil Velikov  wrote:
> On 10 June 2015 at 23:56, Rob Clark  wrote:
>> On Wed, Jun 10, 2015 at 7:28 PM, Emil Velikov  
>> wrote:
>>> On 5 June 2015 at 22:08, Rob Clark  wrote:
 so, maybe a bit off topic (and maybe doesn't really help with the
 whole finding a mentor thing).. but a sort of wish-list thing for
 piglit that I've had in the back of my head is something like "tig"
 for piglit.  I suppose it doesn't have to necessarily be a curses
 based UI, it could be gui..  but a lot of times while I find myself
 searching through results.json to find cmdline to re-run failed tests,
 which is kind of time consuming.  Some sort of front-end to piglit
 which would let me do things like filter on test status, then see
 output/results and if I want re-run the selected test(s) would be kind
 of nice.

>>> Sounds like exactly what the html test summary provides. Although I'm
>>> not sure how many people actually use it - json seems to be more
>>> popular nowadays :-) I even recall naggin' on Dylan when things broke
>>> on an occasion or two.
>>
>> except html is neither interactive nor fast/convenient ;-)
>>
>> The use case I'm thinking of is mostly driver devel/debug where I want
>> to check if some updated version of a change I am working on fixed the
>> regressions, and that sort of thing.  (Or re-run the failed tests with
>> some FD_MESA_DEBUG env var debug flag.)  So ability to re-run
>> individual tests (or group of tests based on filtered result status,
>> etc) is what I'm looking for.  Versus digging through .json or html to
>> find individual cmdlines for some 100's of tests ;-)
>>
> I see. I was fortunate enough to rerun only 2-3 regressing tests,
> rather than 100's, so html was convenient enough :) The "rerun all
> {failing,...} tests" does sound like a useful feature.
>
> -Emil

Why are you guys using a thread about requesting an EVoC mentor for this?
___
mesa-dev mailing list
mesa-dev@lists.freedesktop.org
http://lists.freedesktop.org/mailman/listinfo/mesa-dev


Re: [Mesa-dev] Request for Mentorship

2015-06-10 Thread Emil Velikov
On 10 June 2015 at 23:56, Rob Clark  wrote:
> On Wed, Jun 10, 2015 at 7:28 PM, Emil Velikov  
> wrote:
>> On 5 June 2015 at 22:08, Rob Clark  wrote:
>>> so, maybe a bit off topic (and maybe doesn't really help with the
>>> whole finding a mentor thing).. but a sort of wish-list thing for
>>> piglit that I've had in the back of my head is something like "tig"
>>> for piglit.  I suppose it doesn't have to necessarily be a curses
>>> based UI, it could be gui..  but a lot of times while I find myself
>>> searching through results.json to find cmdline to re-run failed tests,
>>> which is kind of time consuming.  Some sort of front-end to piglit
>>> which would let me do things like filter on test status, then see
>>> output/results and if I want re-run the selected test(s) would be kind
>>> of nice.
>>>
>> Sounds like exactly what the html test summary provides. Although I'm
>> not sure how many people actually use it - json seems to be more
>> popular nowadays :-) I even recall naggin' on Dylan when things broke
>> on an occasion or two.
>
> except html is neither interactive nor fast/convenient ;-)
>
> The use case I'm thinking of is mostly driver devel/debug where I want
> to check if some updated version of a change I am working on fixed the
> regressions, and that sort of thing.  (Or re-run the failed tests with
> some FD_MESA_DEBUG env var debug flag.)  So ability to re-run
> individual tests (or group of tests based on filtered result status,
> etc) is what I'm looking for.  Versus digging through .json or html to
> find individual cmdlines for some 100's of tests ;-)
>
I see. I was fortunate enough to rerun only 2-3 regressing tests,
rather than 100's, so html was convenient enough :) The "rerun all
{failing,...} tests" does sound like a useful feature.

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


Re: [Mesa-dev] [PATCH v2] i965: do not round line width when multisampling or antialiaing are enabled

2015-06-10 Thread Kenneth Graunke
On Wednesday, June 10, 2015 09:07:32 AM Iago Toral Quiroga wrote:
> In commit fe74fee8fa721a we rounded the line width to the nearest integer to
> match the GLES3 spec requirements stated in section 13.4.2.1, but that seems
> to break a dEQP test that renders wide lines in some multisampling scenarios.
> 
> Ian noted that the Open 4.4 spec has the following similar text:
> 
> "The actual width of non-antialiased lines is determined by rounding the
> supplied width to the nearest integer, then clamping it to the
> implementation-dependent maximum non-antialiased line width."
> 
> and suggested that when ES removed antialiased lines, they removed
> "non-antialised" from that paragraph but probably should not have.
> 
> Going by that note, this patch restricts the quantization implemented in
> fe74fee8fa721a only to regular aliased lines. This seems to keep the
> tests fixed with that commit passing while fixing the broken test.
> 
> v2:
>   - Drop one of the clamps (Ken, Marius)
>   - Add a rule to prevent advertising line widths that when rounded go beyond
> the limits allowed by the hardware (Ken)
>   - Update comments in the code accordingly (Ian)
>   - Put the code in a utility function (Ian)
> 
> Fixes:
> dEQP-GLES3.functional.rasterization.fbo.rbo_multisample_max.primitives.lines_wide
> 
> Bugzilla: https://bugs.freedesktop.org/show_bug.cgi?id=90749

Looks good to me.  Thanks for doing this!

Reviewed-by: Kenneth Graunke 

By the way, I noticed that Marius' line-width < 1.5 code never got added
to gen8_sf_state.c, so a couple Piglit tests fail still.  It might be
nice to put that in the helper function too.  Feel like making a
follow-up patch?


signature.asc
Description: This is a digitally signed message part.
___
mesa-dev mailing list
mesa-dev@lists.freedesktop.org
http://lists.freedesktop.org/mailman/listinfo/mesa-dev


[Mesa-dev] [PATCH] i965: correct alignment units for 2D compressed textures on Skylake

2015-06-10 Thread Nanley Chery
From: Nanley Chery 

On Gen9+, vertical and horizontal alignment values for compressed textures are
equal to the pre-Gen9 value squared. Each miplevel must be aligned to this
value.

Signed-off-by: Nanley Chery 
---

This fixes an FXT1 Piglit test regression and shows no failures on Jenkins. 

 src/mesa/drivers/dri/i965/brw_tex_layout.c | 20 
 1 file changed, 8 insertions(+), 12 deletions(-)

diff --git a/src/mesa/drivers/dri/i965/brw_tex_layout.c 
b/src/mesa/drivers/dri/i965/brw_tex_layout.c
index 312a887..dffc699 100644
--- a/src/mesa/drivers/dri/i965/brw_tex_layout.c
+++ b/src/mesa/drivers/dri/i965/brw_tex_layout.c
@@ -149,15 +149,8 @@ intel_horizontal_texture_alignment_unit(struct brw_context 
*brw,
   unsigned int i, j;
   _mesa_get_format_block_size(mt->format, &i, &j);
 
-  /* On Gen9+ we can pick our own alignment for compressed textures but it
-   * has to be a multiple of the block size. The minimum alignment we can
-   * pick is 4 so we effectively have to align to 4 times the block
-   * size
-   */
-  if (brw->gen >= 9)
- return i * 4;
-  else
- return i;
+  /* On Gen9+ the alignment value is squared. */
+  return brw->gen >= 9 ? i * i : i;
 }
 
if (mt->format == MESA_FORMAT_S_UINT8)
@@ -269,9 +262,12 @@ intel_vertical_texture_alignment_unit(struct brw_context 
*brw,
 * Where "*" means either VALIGN_2 or VALIGN_4 depending on the setting of
 * the SURFACE_STATE "Surface Vertical Alignment" field.
 */
-   if (_mesa_is_format_compressed(mt->format))
+   if (_mesa_is_format_compressed(mt->format)) {
+  unsigned int i, j;
+  _mesa_get_format_block_size(mt->format, &i, &j);
   /* See comment above for the horizontal alignment */
-  return brw->gen >= 9 ? 16 : 4;
+  return brw->gen >= 9 ? j * j : j;
+   }
 
if (mt->format == MESA_FORMAT_S_UINT8)
   return brw->gen >= 7 ? 8 : 4;
@@ -379,7 +375,7 @@ brw_miptree_layout_2d(struct intel_mipmap_tree *mt)
 
if (mt->compressed) {
   mip1_width = ALIGN(minify(mt->physical_width0, 1), mt->align_w) +
- ALIGN(minify(mt->physical_width0, 2), bw);
+ ALIGN(minify(mt->physical_width0, 2), mt->align_w);
} else {
   mip1_width = ALIGN(minify(mt->physical_width0, 1), mt->align_w) +
  minify(mt->physical_width0, 2);
-- 
2.4.2

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


Re: [Mesa-dev] [PATCH v3] egl/dri2: implement platform_surfaceless (v3)

2015-06-10 Thread Emil Velikov
Hi gents,

On 10 June 2015 at 23:20, Zach Reizner  wrote:
> From: Haixia Shi 
>
> The surfaceless platform is for off-screen rendering only. Render node support
> is required.
>
> Only consider the render nodes. Do not use normal nodes as they require
> auth hooks.
>
> v3: egl/dri2: change platform_null to platform_surfaceless
>
Normal approach in mesa is to list the changes in each version either
in the commit message or after the --- line. Resending revised patch
while keeping the same version tag is confusing/misleading.

> Signed-off-by: Haixia Shi 
> Signed-off-by: Zach Reizner 
> ---
>  configure.ac|   3 +-
>  src/egl/drivers/dri2/Makefile.am|   5 +
>  src/egl/drivers/dri2/egl_dri2.c |  13 ++-
>  src/egl/drivers/dri2/egl_dri2.h |   3 +
>  src/egl/drivers/dri2/platform_surfaceless.c | 167 
> 
>  src/egl/main/Makefile.am|   4 +
>  src/egl/main/egldisplay.c   |   3 +-
>  src/egl/main/egldisplay.h   |   1 +
>  8 files changed, 194 insertions(+), 5 deletions(-)
>  create mode 100644 src/egl/drivers/dri2/platform_surfaceless.c
>
> diff --git a/configure.ac b/configure.ac
> index 4ed4b74..c91c616 100644
> --- a/configure.ac
> +++ b/configure.ac
> @@ -1789,7 +1789,7 @@ for plat in $egl_platforms; do
> AC_MSG_ERROR([EGL platform drm requires libdrm >= 
> $LIBDRM_REQUIRED])
> ;;
>
> -   android|gdi|null)
> +   android|gdi|surfaceless|null)
Afaict surfaceless does require libdrm. Would be nice to check if the
LIBDRM_REQUIRED provides all the requirements, and bump it otherwise.

> diff --git a/src/egl/drivers/dri2/egl_dri2.c b/src/egl/drivers/dri2/egl_dri2.c
> index a428f28..b7ec811 100644
> --- a/src/egl/drivers/dri2/egl_dri2.c
> +++ b/src/egl/drivers/dri2/egl_dri2.c
> @@ -541,7 +541,7 @@ dri2_setup_screen(_EGLDisplay *disp)
>   disp->Extensions.KHR_gl_texture_2D_image = EGL_TRUE;
>   disp->Extensions.KHR_gl_texture_cubemap_image = EGL_TRUE;
>}
> -#ifdef HAVE_LIBDRM
> +#if defined(HAVE_DRM_PLATFORM) || defined(HAVE_SURFACELESS_PLATFORM)
Why change HAVE_LIBDRM to HAVE_DRM_PLATFORM - rebase slip ? If so we
can drop these changes altogether.


> --- /dev/null
> +++ b/src/egl/drivers/dri2/platform_surfaceless.c

> +EGLBoolean
> +dri2_initialize_surfaceless(_EGLDriver *drv, _EGLDisplay *disp)
> +{

> +   for (i = 0; dri2_dpy->driver_configs[i]; i++) {
> +  EGLint attr_list[1];
> +  attr_list[0] = EGL_NONE;
Bikeshed:
Please add an empty line between variable declaration and code +
initialise the variable on declaration. Just like you've already done
in other parts of the patch.

> +  dri2_add_config(disp, dri2_dpy->driver_configs[i],
> +  i + 1, EGL_WINDOW_BIT, attr_list, NULL);
> +   }
> +
> +   disp->Extensions.KHR_image_base = EGL_TRUE;
> +
> +   /* we're supporting EGL 1.4 */
> +   disp->VersionMajor = 1;
> +   disp->VersionMinor = 4;
> +
Marek had a patch that drops these from the platform backends yet it
seems like it never landed :'-(

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


Re: [Mesa-dev] Request for Mentorship

2015-06-10 Thread Rob Clark
On Wed, Jun 10, 2015 at 7:28 PM, Emil Velikov  wrote:
> On 5 June 2015 at 22:08, Rob Clark  wrote:
>> so, maybe a bit off topic (and maybe doesn't really help with the
>> whole finding a mentor thing).. but a sort of wish-list thing for
>> piglit that I've had in the back of my head is something like "tig"
>> for piglit.  I suppose it doesn't have to necessarily be a curses
>> based UI, it could be gui..  but a lot of times while I find myself
>> searching through results.json to find cmdline to re-run failed tests,
>> which is kind of time consuming.  Some sort of front-end to piglit
>> which would let me do things like filter on test status, then see
>> output/results and if I want re-run the selected test(s) would be kind
>> of nice.
>>
> Sounds like exactly what the html test summary provides. Although I'm
> not sure how many people actually use it - json seems to be more
> popular nowadays :-) I even recall naggin' on Dylan when things broke
> on an occasion or two.

except html is neither interactive nor fast/convenient ;-)

The use case I'm thinking of is mostly driver devel/debug where I want
to check if some updated version of a change I am working on fixed the
regressions, and that sort of thing.  (Or re-run the failed tests with
some FD_MESA_DEBUG env var debug flag.)  So ability to re-run
individual tests (or group of tests based on filtered result status,
etc) is what I'm looking for.  Versus digging through .json or html to
find individual cmdlines for some 100's of tests ;-)

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


[Mesa-dev] [PATCH 1/3] mesa: Use helper function need_rgb_to_luminance_conversion()

2015-06-10 Thread Anuj Phogat
Signed-off-by: Anuj Phogat 
---
 src/mesa/main/readpix.c | 11 ---
 1 file changed, 4 insertions(+), 7 deletions(-)

diff --git a/src/mesa/main/readpix.c b/src/mesa/main/readpix.c
index 9166a50..cba9db8 100644
--- a/src/mesa/main/readpix.c
+++ b/src/mesa/main/readpix.c
@@ -421,7 +421,7 @@ read_rgba_pixels( struct gl_context *ctx,
   const struct gl_pixelstore_attrib *packing )
 {
GLbitfield transferOps;
-   bool dst_is_integer, dst_is_luminance, needs_rebase;
+   bool dst_is_integer, convert_rgb_to_lum, needs_rebase;
int dst_stride, src_stride, rb_stride;
uint32_t dst_format, src_format;
GLubyte *dst, *map;
@@ -442,10 +442,7 @@ read_rgba_pixels( struct gl_context *ctx,
dst_is_integer = _mesa_is_enum_format_integer(format);
dst_stride = _mesa_image_row_stride(packing, width, format, type);
dst_format = _mesa_format_from_format_and_type(format, type);
-   dst_is_luminance = format == GL_LUMINANCE ||
-  format == GL_LUMINANCE_ALPHA ||
-  format == GL_LUMINANCE_INTEGER_EXT ||
-  format == GL_LUMINANCE_ALPHA_INTEGER_EXT;
+   convert_rgb_to_lum = need_rgb_to_luminance_conversion(rb->Format, format);
dst = (GLubyte *) _mesa_image_address2d(packing, pixels, width, height,
format, type, 0, 0);
 
@@ -493,7 +490,7 @@ read_rgba_pixels( struct gl_context *ctx,
 */
assert(!transferOps || (transferOps && !dst_is_integer));
 
-   needs_rgba = transferOps || dst_is_luminance;
+   needs_rgba = transferOps || convert_rgb_to_lum;
rgba = NULL;
if (needs_rgba) {
   uint32_t rgba_format;
@@ -566,7 +563,7 @@ read_rgba_pixels( struct gl_context *ctx,
 * If the dst format is Luminance, we need to do the conversion by computing
 * L=R+G+B values.
 */
-   if (!dst_is_luminance) {
+   if (!convert_rgb_to_lum) {
   _mesa_format_convert(dst, dst_format, dst_stride,
src, src_format, src_stride,
width, height,
-- 
1.9.3

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


[Mesa-dev] [PATCH 3/3] meta: Abort meta path if ReadPixels need rgb to luminance conversion

2015-06-10 Thread Anuj Phogat
After recent addition of pbo testing in piglit test getteximage-luminance,
it fails on i965. This patch makes a sub test pass.

Signed-off-by: Anuj Phogat 
Cc: 
---
 src/mesa/drivers/common/meta_tex_subimage.c | 8 
 1 file changed, 8 insertions(+)

diff --git a/src/mesa/drivers/common/meta_tex_subimage.c 
b/src/mesa/drivers/common/meta_tex_subimage.c
index ad6e787..65753f7 100644
--- a/src/mesa/drivers/common/meta_tex_subimage.c
+++ b/src/mesa/drivers/common/meta_tex_subimage.c
@@ -34,6 +34,7 @@
 #include "macros.h"
 #include "meta.h"
 #include "pbo.h"
+#include "readpix.h"
 #include "shaderapi.h"
 #include "state.h"
 #include "teximage.h"
@@ -257,6 +258,7 @@ _mesa_meta_pbo_GetTexSubImage(struct gl_context *ctx, 
GLuint dims,
GLuint pbo = 0, pbo_tex = 0, fbos[2] = { 0, 0 };
int full_height, image_height;
struct gl_texture_image *pbo_tex_image;
+   struct gl_renderbuffer *rb = NULL;
GLenum status;
bool success = false;
int z;
@@ -273,6 +275,12 @@ _mesa_meta_pbo_GetTexSubImage(struct gl_context *ctx, 
GLuint dims,
if (ctx->_ImageTransferState)
   return false;
 
+
+   if (!tex_image) {
+  if (_mesa_need_rgb_to_luminance_conversion(rb->Format, format))
+ return false;
+   }
+
/* For arrays, use a tall (height * depth) 2D texture but taking into
 * account the inter-image padding specified with the image height packing
 * property.
-- 
1.9.3

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


[Mesa-dev] [PATCH 2/3] mesa: Turn need_rgb_to_luminance_conversion() in to a global function

2015-06-10 Thread Anuj Phogat
This will be used by _mesa_meta_pbo_GetTexSubImage() in a later patch.

Signed-off-by: Anuj Phogat 
---
 src/mesa/main/readpix.c | 11 ++-
 src/mesa/main/readpix.h |  3 +++
 2 files changed, 9 insertions(+), 5 deletions(-)

diff --git a/src/mesa/main/readpix.c b/src/mesa/main/readpix.c
index cba9db8..a3357cd 100644
--- a/src/mesa/main/readpix.c
+++ b/src/mesa/main/readpix.c
@@ -46,8 +46,8 @@
 /**
  * Return true if the conversion L=R+G+B is needed.
  */
-static GLboolean
-need_rgb_to_luminance_conversion(mesa_format texFormat, GLenum format)
+GLboolean
+_mesa_need_rgb_to_luminance_conversion(mesa_format texFormat, GLenum format)
 {
GLenum baseTexFormat = _mesa_get_format_base_format(texFormat);
 
@@ -105,7 +105,7 @@ get_readpixels_transfer_ops(const struct gl_context *ctx, 
mesa_format texFormat,
 * have any effect anyway.
 */
if (_mesa_get_format_datatype(texFormat) == GL_UNSIGNED_NORMALIZED &&
-   !need_rgb_to_luminance_conversion(texFormat, format)) {
+   !_mesa_need_rgb_to_luminance_conversion(texFormat, format)) {
   transferOps &= ~IMAGE_CLAMP_BIT;
}
 
@@ -149,7 +149,7 @@ _mesa_readpixels_needs_slow_path(const struct gl_context 
*ctx, GLenum format,
 
default:
   /* Color formats. */
-  if (need_rgb_to_luminance_conversion(rb->Format, format)) {
+  if (_mesa_need_rgb_to_luminance_conversion(rb->Format, format)) {
  return GL_TRUE;
   }
 
@@ -442,7 +442,8 @@ read_rgba_pixels( struct gl_context *ctx,
dst_is_integer = _mesa_is_enum_format_integer(format);
dst_stride = _mesa_image_row_stride(packing, width, format, type);
dst_format = _mesa_format_from_format_and_type(format, type);
-   convert_rgb_to_lum = need_rgb_to_luminance_conversion(rb->Format, format);
+   convert_rgb_to_lum =
+  _mesa_need_rgb_to_luminance_conversion(rb->Format, format);
dst = (GLubyte *) _mesa_image_address2d(packing, pixels, width, height,
format, type, 0, 0);
 
diff --git a/src/mesa/main/readpix.h b/src/mesa/main/readpix.h
index 4bb35e1..1636dd9 100644
--- a/src/mesa/main/readpix.h
+++ b/src/mesa/main/readpix.h
@@ -37,6 +37,9 @@ extern GLboolean
 _mesa_readpixels_needs_slow_path(const struct gl_context *ctx, GLenum format,
  GLenum type, GLboolean uses_blit);
 
+extern GLboolean
+_mesa_need_rgb_to_luminance_conversion(mesa_format texFormat, GLenum format);
+
 extern void
 _mesa_readpixels(struct gl_context *ctx,
  GLint x, GLint y, GLsizei width, GLsizei height,
-- 
1.9.3

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


[Mesa-dev] [PATCH] meta: Use is_power_of_two() helper function

2015-06-10 Thread Anuj Phogat
Signed-off-by: Anuj Phogat 
---
 src/mesa/drivers/common/meta_blit.c | 6 +++---
 1 file changed, 3 insertions(+), 3 deletions(-)

diff --git a/src/mesa/drivers/common/meta_blit.c 
b/src/mesa/drivers/common/meta_blit.c
index bb21642..9cace2b 100644
--- a/src/mesa/drivers/common/meta_blit.c
+++ b/src/mesa/drivers/common/meta_blit.c
@@ -82,7 +82,7 @@ setup_glsl_msaa_blit_scaled_shader(struct gl_context *ctx,
y_scale = samples * 0.5;
 
/* We expect only power of 2 samples in source multisample buffer. */
-   assert(samples > 0 && (samples & (samples - 1)) == 0);
+   assert(samples > 0 && is_power_of_two(samples));
while (samples >> (shader_offset + 1)) {
   shader_offset++;
}
@@ -263,7 +263,7 @@ setup_glsl_msaa_blit_shader(struct gl_context *ctx,
}
 
/* We expect only power of 2 samples in source multisample buffer. */
-   assert(samples > 0 && (samples & (samples - 1)) == 0);
+   assert(samples > 0 && is_power_of_two(samples));
while (samples >> (shader_offset + 1)) {
   shader_offset++;
}
@@ -434,7 +434,7 @@ setup_glsl_msaa_blit_shader(struct gl_context *ctx,
   * (so the floating point exponent just gets increased), rather than
   * doing a naive sum and dividing.
   */
- assert((samples & (samples - 1)) == 0);
+ assert(is_power_of_two(samples));
  /* Fetch each individual sample. */
  sample_resolve = rzalloc_size(mem_ctx, 1);
  for (i = 0; i < samples; i++) {
-- 
1.9.3

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


[Mesa-dev] [PATCH] i965: Check for miptree pitch alignment before using intel_miptree_map_movntdqa()

2015-06-10 Thread Anuj Phogat
I don't know where this alignment restriction came from. We have an
assert() in intel_miptree_map_movntdqa() which expects the pitch to
be 16 byte aligned.

Signed-off-by: Anuj Phogat 
---
 src/mesa/drivers/dri/i965/intel_mipmap_tree.c | 4 +++-
 1 file changed, 3 insertions(+), 1 deletion(-)

diff --git a/src/mesa/drivers/dri/i965/intel_mipmap_tree.c 
b/src/mesa/drivers/dri/i965/intel_mipmap_tree.c
index d4d9e76..b0b2697 100644
--- a/src/mesa/drivers/dri/i965/intel_mipmap_tree.c
+++ b/src/mesa/drivers/dri/i965/intel_mipmap_tree.c
@@ -2659,7 +2659,9 @@ intel_miptree_map(struct brw_context *brw,
} else if (use_intel_mipree_map_blit(brw, mt, mode, level, slice)) {
   intel_miptree_map_blit(brw, mt, map, level, slice);
 #if defined(USE_SSE41)
-   } else if (!(mode & GL_MAP_WRITE_BIT) && !mt->compressed && cpu_has_sse4_1) 
{
+   } else if (!(mode & GL_MAP_WRITE_BIT) &&
+  !mt->compressed && cpu_has_sse4_1 &&
+  (mt->pitch % 16 == 0)) {
   intel_miptree_map_movntdqa(brw, mt, map, level, slice);
 #endif
} else {
-- 
1.9.3

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


[Mesa-dev] [PATCH] i965: Remove break after return

2015-06-10 Thread Anuj Phogat
Signed-off-by: Anuj Phogat 
---
 src/mesa/drivers/dri/i965/intel_blit.c | 3 ---
 1 file changed, 3 deletions(-)

diff --git a/src/mesa/drivers/dri/i965/intel_blit.c 
b/src/mesa/drivers/dri/i965/intel_blit.c
index 987b5f5..068565c 100644
--- a/src/mesa/drivers/dri/i965/intel_blit.c
+++ b/src/mesa/drivers/dri/i965/intel_blit.c
@@ -99,13 +99,10 @@ br13_for_cpp(int cpp)
   return BR13_16161616;
case 4:
   return BR13_;
-  break;
case 2:
   return BR13_565;
-  break;
case 1:
   return BR13_8;
-  break;
default:
   unreachable("not reached");
}
-- 
1.9.3

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


[Mesa-dev] [Bug 90264] [Regression, bisected] Tooltip corruption in Chrome

2015-06-10 Thread bugzilla-daemon
https://bugs.freedesktop.org/show_bug.cgi?id=90264

--- Comment #20 from Furkan  ---
I booted up a Haswell (i7-4770) machine from an Ubuntu 15.04 live USB, and was
able to reproduce the same glitch.

It looks like we can reproduce this on radeon, nouveau, and i965, but not
llvmpipe. What does that mean? I re-classified this under Mesa core for now.

Can anybody confirm that this issue isn't present with the Nvidia proprietary
driver?

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


[Mesa-dev] [Bug 90264] [Regression, bisected] Tooltip corruption in Chrome

2015-06-10 Thread bugzilla-daemon
https://bugs.freedesktop.org/show_bug.cgi?id=90264

Furkan  changed:

   What|Removed |Added

 CC||bri...@vmware.com
  Component|Drivers/Gallium/radeonsi|Mesa core
   Assignee|dri-devel@lists.freedesktop |mesa-dev@lists.freedesktop.
   |.org|org
 QA Contact|dri-devel@lists.freedesktop |mesa-dev@lists.freedesktop.
   |.org|org

--- Comment #19 from Furkan  ---
I booted up a Haswell box from an Ubuntu 15.04 live USB, and was able to
reproduce the same glitch.

It looks like we can reproduce this on radeon, nouveau, and i965, but not
llvmpipe. What does that mean? I am re-classifying this under Mesa core for
now. Would it fit better under any other category?

Can anybody confirm that this issue isn't present with the Nvidia proprietary
driver?

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


[Mesa-dev] [PATCH] mesa: Enable subdir-objects globally.

2015-06-10 Thread Matt Turner
---
Emil,

With your series, I think we can enable subdir-objects globally!

Please give it a test.

 configure.ac  | 2 +-
 src/Makefile.am   | 2 --
 src/gallium/auxiliary/Makefile.am | 2 --
 src/gallium/drivers/freedreno/Makefile.am | 2 --
 src/gallium/drivers/ilo/Makefile.am   | 2 --
 src/gallium/drivers/nouveau/Makefile.am   | 2 --
 src/gallium/drivers/r300/Makefile.am  | 2 --
 src/gallium/drivers/r600/Makefile.am  | 2 --
 src/gallium/drivers/svga/Makefile.am  | 2 --
 src/gallium/drivers/vc4/Makefile.am   | 2 --
 src/gallium/state_trackers/clover/Makefile.am | 2 --
 src/gallium/state_trackers/xvmc/Makefile.am   | 1 -
 src/gallium/targets/opencl/Makefile.am| 2 --
 src/gbm/Makefile.am   | 2 --
 src/glsl/Makefile.am  | 2 --
 src/gtest/Makefile.am | 2 --
 src/mapi/Makefile.am  | 2 --
 src/mesa/Makefile.am  | 2 --
 18 files changed, 1 insertion(+), 34 deletions(-)

diff --git a/configure.ac b/configure.ac
index be0cd7d..f363311 100644
--- a/configure.ac
+++ b/configure.ac
@@ -44,7 +44,7 @@ AC_INIT([Mesa], [MESA_VERSION],
 AC_CONFIG_AUX_DIR([bin])
 AC_CONFIG_MACRO_DIR([m4])
 AC_CANONICAL_SYSTEM
-AM_INIT_AUTOMAKE([foreign tar-ustar dist-xz])
+AM_INIT_AUTOMAKE([foreign tar-ustar dist-xz subdir-objects])
 
 dnl We only support native Windows builds (MinGW/MSVC) through SCons.
 case "$host_os" in
diff --git a/src/Makefile.am b/src/Makefile.am
index 18cb4ce..0df31cc 100644
--- a/src/Makefile.am
+++ b/src/Makefile.am
@@ -19,8 +19,6 @@
 # FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS
 # IN THE SOFTWARE.
 
-AUTOMAKE_OPTIONS = subdir-objects
-
 SUBDIRS = . gtest util mapi/glapi/gen mapi
 
 if NEED_OPENGL_COMMON
diff --git a/src/gallium/auxiliary/Makefile.am 
b/src/gallium/auxiliary/Makefile.am
index 89c7a13..ab91062 100644
--- a/src/gallium/auxiliary/Makefile.am
+++ b/src/gallium/auxiliary/Makefile.am
@@ -1,5 +1,3 @@
-AUTOMAKE_OPTIONS = subdir-objects
-
 if HAVE_LOADER_GALLIUM
 SUBDIRS := pipe-loader
 endif
diff --git a/src/gallium/drivers/freedreno/Makefile.am 
b/src/gallium/drivers/freedreno/Makefile.am
index 4b2629f..6ac70e8 100644
--- a/src/gallium/drivers/freedreno/Makefile.am
+++ b/src/gallium/drivers/freedreno/Makefile.am
@@ -1,5 +1,3 @@
-AUTOMAKE_OPTIONS = subdir-objects
-
 include Makefile.sources
 include $(top_srcdir)/src/gallium/Automake.inc
 
diff --git a/src/gallium/drivers/ilo/Makefile.am 
b/src/gallium/drivers/ilo/Makefile.am
index a8785a5..1f14153 100644
--- a/src/gallium/drivers/ilo/Makefile.am
+++ b/src/gallium/drivers/ilo/Makefile.am
@@ -21,8 +21,6 @@
 # OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER
 # DEALINGS IN THE SOFTWARE.
 
-AUTOMAKE_OPTIONS = subdir-objects
-
 include Makefile.sources
 include $(top_srcdir)/src/gallium/Automake.inc
 
diff --git a/src/gallium/drivers/nouveau/Makefile.am 
b/src/gallium/drivers/nouveau/Makefile.am
index 0aefc03..ce53022 100644
--- a/src/gallium/drivers/nouveau/Makefile.am
+++ b/src/gallium/drivers/nouveau/Makefile.am
@@ -20,8 +20,6 @@
 # OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER
 # DEALINGS IN THE SOFTWARE.
 
-AUTOMAKE_OPTIONS = subdir-objects
-
 include Makefile.sources
 include $(top_srcdir)/src/gallium/Automake.inc
 
diff --git a/src/gallium/drivers/r300/Makefile.am 
b/src/gallium/drivers/r300/Makefile.am
index dd1a5ed..081f332 100644
--- a/src/gallium/drivers/r300/Makefile.am
+++ b/src/gallium/drivers/r300/Makefile.am
@@ -1,5 +1,3 @@
-AUTOMAKE_OPTIONS = subdir-objects
-
 include Makefile.sources
 include $(top_srcdir)/src/gallium/Automake.inc
 
diff --git a/src/gallium/drivers/r600/Makefile.am 
b/src/gallium/drivers/r600/Makefile.am
index dc0d90d..8317da7 100644
--- a/src/gallium/drivers/r600/Makefile.am
+++ b/src/gallium/drivers/r600/Makefile.am
@@ -1,5 +1,3 @@
-AUTOMAKE_OPTIONS = subdir-objects
-
 include Makefile.sources
 include $(top_srcdir)/src/gallium/Automake.inc
 
diff --git a/src/gallium/drivers/svga/Makefile.am 
b/src/gallium/drivers/svga/Makefile.am
index e0a8cad..d46de95 100644
--- a/src/gallium/drivers/svga/Makefile.am
+++ b/src/gallium/drivers/svga/Makefile.am
@@ -20,8 +20,6 @@
 # OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER
 # DEALINGS IN THE SOFTWARE.
 
-AUTOMAKE_OPTIONS = subdir-objects
-
 include Makefile.sources
 include $(top_srcdir)/src/gallium/Automake.inc
 
diff --git a/src/gallium/drivers/vc4/Makefile.am 
b/src/gallium/drivers/vc4/Makefile.am
index 3f62ce2..7744631 100644
--- a/src/gallium/drivers/vc4/Makefile.am
+++ b/src/gallium/drivers/vc4/Makefile.am
@@ -19,8 +19,6 @@
 # FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS
 # IN THE SOFTWARE.
 
-AUTOMAKE_OPTIONS = subdir-objects
-
 include Makefile.sources
 include $(top_srcdir)/src/gallium/Automake.inc
 
diff --git a/src/gallium

Re: [Mesa-dev] Request for Mentorship

2015-06-10 Thread Emil Velikov
On 5 June 2015 at 22:08, Rob Clark  wrote:
> so, maybe a bit off topic (and maybe doesn't really help with the
> whole finding a mentor thing).. but a sort of wish-list thing for
> piglit that I've had in the back of my head is something like "tig"
> for piglit.  I suppose it doesn't have to necessarily be a curses
> based UI, it could be gui..  but a lot of times while I find myself
> searching through results.json to find cmdline to re-run failed tests,
> which is kind of time consuming.  Some sort of front-end to piglit
> which would let me do things like filter on test status, then see
> output/results and if I want re-run the selected test(s) would be kind
> of nice.
>
Sounds like exactly what the html test summary provides. Although I'm
not sure how many people actually use it - json seems to be more
popular nowadays :-) I even recall naggin' on Dylan when things broke
on an occasion or two.

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


[Mesa-dev] [PATCH v3] egl/dri2: implement platform_surfaceless (v3)

2015-06-10 Thread Zach Reizner
From: Haixia Shi 

The surfaceless platform is for off-screen rendering only. Render node support
is required.

Only consider the render nodes. Do not use normal nodes as they require
auth hooks.

v3: egl/dri2: change platform_null to platform_surfaceless

Signed-off-by: Haixia Shi 
Signed-off-by: Zach Reizner 
---
 configure.ac|   3 +-
 src/egl/drivers/dri2/Makefile.am|   5 +
 src/egl/drivers/dri2/egl_dri2.c |  13 ++-
 src/egl/drivers/dri2/egl_dri2.h |   3 +
 src/egl/drivers/dri2/platform_surfaceless.c | 167 
 src/egl/main/Makefile.am|   4 +
 src/egl/main/egldisplay.c   |   3 +-
 src/egl/main/egldisplay.h   |   1 +
 8 files changed, 194 insertions(+), 5 deletions(-)
 create mode 100644 src/egl/drivers/dri2/platform_surfaceless.c

diff --git a/configure.ac b/configure.ac
index 4ed4b74..c91c616 100644
--- a/configure.ac
+++ b/configure.ac
@@ -1789,7 +1789,7 @@ for plat in $egl_platforms; do
AC_MSG_ERROR([EGL platform drm requires libdrm >= 
$LIBDRM_REQUIRED])
;;
 
-   android|gdi|null)
+   android|gdi|surfaceless|null)
;;
 
*)
@@ -1818,6 +1818,7 @@ fi
 AM_CONDITIONAL(HAVE_EGL_PLATFORM_X11, echo "$egl_platforms" | grep -q 'x11')
 AM_CONDITIONAL(HAVE_EGL_PLATFORM_WAYLAND, echo "$egl_platforms" | grep -q 
'wayland')
 AM_CONDITIONAL(HAVE_EGL_PLATFORM_DRM, echo "$egl_platforms" | grep -q 'drm')
+AM_CONDITIONAL(HAVE_EGL_PLATFORM_SURFACELESS, echo "$egl_platforms" | grep -q 
'surfaceless')
 AM_CONDITIONAL(HAVE_EGL_PLATFORM_NULL, echo "$egl_platforms" | grep -q 'null')
 
 AM_CONDITIONAL(HAVE_EGL_DRIVER_DRI2, test "x$HAVE_EGL_DRIVER_DRI2" != "x")
diff --git a/src/egl/drivers/dri2/Makefile.am b/src/egl/drivers/dri2/Makefile.am
index f589600..55be4a7 100644
--- a/src/egl/drivers/dri2/Makefile.am
+++ b/src/egl/drivers/dri2/Makefile.am
@@ -65,4 +65,9 @@ libegl_dri2_la_SOURCES += platform_drm.c
 AM_CFLAGS += -DHAVE_DRM_PLATFORM
 endif
 
+if HAVE_EGL_PLATFORM_SURFACELESS
+libegl_dri2_la_SOURCES += platform_surfaceless.c
+AM_CFLAGS += -DHAVE_SURFACELESS_PLATFORM
+endif
+
 EXTRA_DIST = SConscript
diff --git a/src/egl/drivers/dri2/egl_dri2.c b/src/egl/drivers/dri2/egl_dri2.c
index a428f28..b7ec811 100644
--- a/src/egl/drivers/dri2/egl_dri2.c
+++ b/src/egl/drivers/dri2/egl_dri2.c
@@ -541,7 +541,7 @@ dri2_setup_screen(_EGLDisplay *disp)
  disp->Extensions.KHR_gl_texture_2D_image = EGL_TRUE;
  disp->Extensions.KHR_gl_texture_cubemap_image = EGL_TRUE;
   }
-#ifdef HAVE_LIBDRM
+#if defined(HAVE_DRM_PLATFORM) || defined(HAVE_SURFACELESS_PLATFORM)
   if (dri2_dpy->image->base.version >= 8 &&
   dri2_dpy->image->createImageFromDmaBufs) {
  disp->Extensions.EXT_image_dma_buf_import = EGL_TRUE;
@@ -639,6 +639,13 @@ dri2_initialize(_EGLDriver *drv, _EGLDisplay *disp)
   return EGL_FALSE;
 
switch (disp->Platform) {
+#ifdef HAVE_SURFACELESS_PLATFORM
+   case _EGL_PLATFORM_SURFACELESS:
+  if (disp->Options.TestOnly)
+ return EGL_TRUE;
+  return dri2_initialize_surfaceless(drv, disp);
+#endif
+
 #ifdef HAVE_X11_PLATFORM
case _EGL_PLATFORM_X11:
   if (disp->Options.TestOnly)
@@ -1578,7 +1585,7 @@ dri2_create_wayland_buffer_from_image(_EGLDriver *drv, 
_EGLDisplay *dpy,
return dri2_dpy->vtbl->create_wayland_buffer_from_image(drv, dpy, img);
 }
 
-#ifdef HAVE_LIBDRM
+#if defined(HAVE_DRM_PLATFORM) || defined(HAVE_SURFACELESS_PLATFORM)
 static EGLBoolean
 dri2_check_dma_buf_attribs(const _EGLImageAttribs *attrs)
 {
@@ -1836,7 +1843,7 @@ dri2_create_image_khr(_EGLDriver *drv, _EGLDisplay *disp,
case EGL_WAYLAND_BUFFER_WL:
   return dri2_create_image_wayland_wl_buffer(disp, ctx, buffer, attr_list);
 #endif
-#ifdef HAVE_LIBDRM
+#if defined(HAVE_DRM_PLATFORM) || defined(HAVE_SURFACELESS_PLATFORM)
case EGL_LINUX_DMA_BUF_EXT:
   return dri2_create_image_dma_buf(disp, ctx, buffer, attr_list);
 #endif
diff --git a/src/egl/drivers/dri2/egl_dri2.h b/src/egl/drivers/dri2/egl_dri2.h
index 167b3b1..f400ae1 100644
--- a/src/egl/drivers/dri2/egl_dri2.h
+++ b/src/egl/drivers/dri2/egl_dri2.h
@@ -334,6 +334,9 @@ dri2_initialize_wayland(_EGLDriver *drv, _EGLDisplay *disp);
 EGLBoolean
 dri2_initialize_android(_EGLDriver *drv, _EGLDisplay *disp);
 
+EGLBoolean
+dri2_initialize_surfaceless(_EGLDriver *drv, _EGLDisplay *disp);
+
 void
 dri2_flush_drawable_for_swapbuffers(_EGLDisplay *disp, _EGLSurface *draw);
 
diff --git a/src/egl/drivers/dri2/platform_surfaceless.c 
b/src/egl/drivers/dri2/platform_surfaceless.c
new file mode 100644
index 000..358e44d
--- /dev/null
+++ b/src/egl/drivers/dri2/platform_surfaceless.c
@@ -0,0 +1,167 @@
+/*
+ * Mesa 3-D graphics library
+ *
+ * Copyright (c) 2014 The Chromium OS Authors.
+ * Copyright © 2011 Intel Corporation
+ *
+ * Permission is hereby granted, free of charge, to any person obtaining a
+ * copy of this sof

Re: [Mesa-dev] [PATCH 6/7] mesa: build xmlconfig to a separate static library

2015-06-10 Thread Matt Turner
On Wed, Jun 10, 2015 at 3:54 PM, Emil Velikov  wrote:
> From: Erik Faye-Lund 
>
> As we use the file from both the dri modules and loader, we end up with
> multiple definition of the symbols provided in our gallium dri  modules.
> Additionally we compile the file twice.
>
> Resolve both issues, effectively enabling the build on toolchains which
> don't support -Wl,--allow-multiple-definition.
>
> v2: [Emil Velikov]
>  - Fix the Scons/Android build.
>  - Resolve libgbm build issues (bring back the missing -lm)
>
> Cc: Julien Isorce 
> Cc: "10.5 10.6" 
> Bugzilla: https://bugs.freedesktop.org/show_bug.cgi?id=90310
> Bugzilla: https://bugs.freedesktop.org/show_bug.cgi?id=90905
> Signed-off-by: Emil Velikov 
> ---
>  src/gallium/targets/dri/Makefile.am  |  6 --
>  src/loader/Makefile.am   | 10 +++---
>  src/mesa/drivers/dri/Makefile.am |  1 +
>  src/mesa/drivers/dri/common/Android.mk   |  4 +++-
>  src/mesa/drivers/dri/common/Makefile.am  |  6 +-
>  src/mesa/drivers/dri/common/Makefile.sources |  4 +++-
>  src/mesa/drivers/dri/common/SConscript   |  2 +-
>  src/mesa/drivers/dri/i965/Makefile.am|  1 +
>  8 files changed, 17 insertions(+), 17 deletions(-)
>
> diff --git a/src/gallium/targets/dri/Makefile.am 
> b/src/gallium/targets/dri/Makefile.am
> index f9e4ada..9648396 100644
> --- a/src/gallium/targets/dri/Makefile.am
> +++ b/src/gallium/targets/dri/Makefile.am
> @@ -53,12 +53,6 @@ gallium_dri_la_LIBADD = \
> $(LIBDRM_LIBS) \
> $(GALLIUM_COMMON_LIB_DEPS)
>
> -# XXX: Temporary allow duplicated symbols, as the loader pulls in xmlconfig.c
> -# which already provides driParse* and driQuery* amongst others.
> -# Remove this hack as we come up with a cleaner solution.
> -gallium_dri_la_LDFLAGS += \
> -   -Wl,--allow-multiple-definition
> -
>  EXTRA_gallium_dri_la_DEPENDENCIES = \
> dri.sym \
> $(top_srcdir)/src/gallium/targets/dri-vdpau.dyn
> diff --git a/src/loader/Makefile.am b/src/loader/Makefile.am
> index 36ddba8..aef1bd6 100644
> --- a/src/loader/Makefile.am
> +++ b/src/loader/Makefile.am
> @@ -41,15 +41,11 @@ libloader_la_CPPFLAGS += \
> -I$(top_builddir)/src/mesa/drivers/dri/common/ \
> -I$(top_srcdir)/src/mesa/ \
> -I$(top_srcdir)/src/mapi/ \
> -   -DUSE_DRICONF \
> -   $(EXPAT_CFLAGS)
> +   -DUSE_DRICONF
>
> -libloader_la_SOURCES += \
> -   $(top_srcdir)/src/mesa/drivers/dri/common/xmlconfig.c
> + libloader_la_LIBADD += \

Looks like we have an extra leading space here.

Do I understand correctly that after this patch the Gallium drivers
will get their only copy of xmlconfig via linking against
libloader.la?

If that's correct,

Acked-by: Matt Turner 

> +   $(top_builddir)/src/mesa/drivers/dri/common/libxmlconfig.la
>
> -libloader_la_LIBADD += \
> -   -lm \
> -   $(EXPAT_LIBS)
>  endif
>
>  if !HAVE_LIBDRM
___
mesa-dev mailing list
mesa-dev@lists.freedesktop.org
http://lists.freedesktop.org/mailman/listinfo/mesa-dev


Re: [Mesa-dev] [PATCH 1/5] mesa: Add a new helper function _mesa_regions_overlap()

2015-06-10 Thread Brian Paul

For 1-3,

Reviewed-by: Brian Paul 

On 06/10/2015 04:34 PM, Anuj Phogat wrote:

Signed-off-by: Anuj Phogat 
Cc: Ben Widawsky 
---
Jenkins showed no piglit regressions with this series.

  src/mesa/main/blit.c | 26 ++
  src/mesa/main/blit.h |  6 ++
  2 files changed, 32 insertions(+)

diff --git a/src/mesa/main/blit.c b/src/mesa/main/blit.c
index db8fee5..4765198 100644
--- a/src/mesa/main/blit.c
+++ b/src/mesa/main/blit.c
@@ -37,6 +37,7 @@
  #include "framebuffer.h"
  #include "glformats.h"
  #include "mtypes.h"
+#include "macros.h"
  #include "state.h"


@@ -59,6 +60,31 @@ find_attachment(const struct gl_framebuffer *fb,


  /**
+ * \return true if two regions overlap, false otherwise
+ */
+bool
+_mesa_regions_overlap(int srcX0, int srcY0,
+  int srcX1, int srcY1,
+  int dstX0, int dstY0,
+  int dstX1, int dstY1)
+{
+   if (MAX2(srcX0, srcX1) < MIN2(dstX0, dstX1))
+  return false; /* dst completely right of src */
+
+   if (MAX2(dstX0, dstX1) < MIN2(srcX0, srcX1))
+  return false; /* dst completely left of src */
+
+   if (MAX2(srcY0, srcY1) < MIN2(dstY0, dstY1))
+  return false; /* dst completely above src */
+
+   if (MAX2(dstY0, dstY1) < MIN2(srcY0, srcY1))
+  return false; /* dst completely below src */
+
+   return true; /* some overlap */
+}
+
+
+/**
   * Helper function for checking if the datatypes of color buffers are
   * compatible for glBlitFramebuffer.  From the 3.1 spec, page 198:
   *
diff --git a/src/mesa/main/blit.h b/src/mesa/main/blit.h
index 54b946e..88dd4a9 100644
--- a/src/mesa/main/blit.h
+++ b/src/mesa/main/blit.h
@@ -28,6 +28,12 @@

  #include "glheader.h"

+extern bool
+_mesa_regions_overlap(int srcX0, int srcY0,
+  int srcX1, int srcY1,
+  int dstX0, int dstY0,
+  int dstX1, int dstY1);
+
  extern void
  _mesa_blit_framebuffer(struct gl_context *ctx,
 struct gl_framebuffer *readFb,



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


Re: [Mesa-dev] COMPSIZE function in OpenGL XML registry

2015-06-10 Thread Ian Romanick
On 06/10/2015 03:05 PM, Shervin Sharifi wrote:
> Thanks Ian.
> If I want to implement the actual CompSize function, how should I figure
> out the details? 

The way I did it for the GLX protocol code in Mesa is to make a
glFoo_compsize function for each GL function that has a variable sized
array as input.  Often these functions can be shared (e.g., the function
for glTexParameteriv and glTexParameterfv are the same).

You have to read the docs to figure out that, for example, passing
GL_TEXTURE_BASE_LEVEL to glTexParameteriv means there's 1 value but
passing GL_TEXTURE_BORDER_COLOR means there are 4 values.  I implemented
that in Mesa (many years before the current Khronos XML existed) by
having additional decorations in my XML.  Each enum specifies which
functions can use it and how many values it carries.

The Khronos XML specifies which enums can be passed to which functions
(via ), but it doesn't look like it has any information about how
much data goes along with it. :(

> Thanks, 
>Shervin
> 
> On Wed, Jun 10, 2015 at 2:56 PM, Ian Romanick  > wrote:
> 
> On 06/10/2015 11:25 AM, Shervin Sharifi wrote:
> > Hi,
> >
> >  This may not be the right forum to ask this, but I didn't know of a
> > better forum, so I thought I can ask here.
> >
> >  I'm new to OpenGL. I am looking at XML registry for OpenGL and there
> > are some parameters with attributes containing a function COMPSIZE (I've
> > pasted an example below).
> >  I tried to find information on what the COMPSIZE function is, where/how
> > it is used, etc, but couldn't find documentation or credible information
> > on the Internet.
> >  Any information or pointer to that would be really helpful.
> 
> It's a signal to code generation scripts that the size of the data
> referenced by the "pointer" parameter depends on the values of "type"
> and "stride".  For example, GLX protocol code uses this to know how much
> image data to send to the server for glTexImage2D.
> 
> >  Thanks,
> > Shervin
> >
> >
> >
> > This example is from gl.xml in the OpenGL registry:
> >
> > 
> > void glBinormalPointerEXT
> > GLenum
> > type
> > GLsizei stride
> > const void
> > *pointer
> > 
> >
> >
> > ___
> > mesa-dev mailing list
> > mesa-dev@lists.freedesktop.org 
> > http://lists.freedesktop.org/mailman/listinfo/mesa-dev
> 
> 

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


[Mesa-dev] [PATCH 7/7] vc4: automake: enable subdir-objects

2015-06-10 Thread Emil Velikov
Silence the warnings about the future incompatibility with automake 2.0

Cc: Eric Anholt 
Signed-off-by: Emil Velikov 
---
 src/gallium/drivers/vc4/Makefile.am | 2 ++
 1 file changed, 2 insertions(+)

diff --git a/src/gallium/drivers/vc4/Makefile.am 
b/src/gallium/drivers/vc4/Makefile.am
index 7744631..3f62ce2 100644
--- a/src/gallium/drivers/vc4/Makefile.am
+++ b/src/gallium/drivers/vc4/Makefile.am
@@ -19,6 +19,8 @@
 # FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS
 # IN THE SOFTWARE.
 
+AUTOMAKE_OPTIONS = subdir-objects
+
 include Makefile.sources
 include $(top_srcdir)/src/gallium/Automake.inc
 
-- 
2.4.2

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


[Mesa-dev] [PATCH 4/7] pipe-loader: add libnir and libglsl_util to the link

2015-06-10 Thread Emil Velikov
Based on commit 101142c4010(xa: support for drivers which use NIR)

Cc: Rob Clark 
Cc: "10.6" 
Bugzilla: https://bugs.freedesktop.org/show_bug.cgi?id=90466
Signed-off-by: Emil Velikov 
---
 src/gallium/targets/pipe-loader/Makefile.am | 2 ++
 1 file changed, 2 insertions(+)

diff --git a/src/gallium/targets/pipe-loader/Makefile.am 
b/src/gallium/targets/pipe-loader/Makefile.am
index 967cdb7..e4048b5 100644
--- a/src/gallium/targets/pipe-loader/Makefile.am
+++ b/src/gallium/targets/pipe-loader/Makefile.am
@@ -52,6 +52,8 @@ endif
 
 PIPE_LIBS += \
$(top_builddir)/src/gallium/auxiliary/libgallium.la \
+   $(top_builddir)/src/glsl/libnir.la \
+   $(top_builddir)/src/libglsl_util.la \
$(top_builddir)/src/util/libmesautil.la \
$(top_builddir)/src/gallium/drivers/rbug/librbug.la \
$(top_builddir)/src/gallium/drivers/trace/libtrace.la \
-- 
2.4.2

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


[Mesa-dev] [PATCH 6/7] mesa: build xmlconfig to a separate static library

2015-06-10 Thread Emil Velikov
From: Erik Faye-Lund 

As we use the file from both the dri modules and loader, we end up with
multiple definition of the symbols provided in our gallium dri  modules.
Additionally we compile the file twice.

Resolve both issues, effectively enabling the build on toolchains which
don't support -Wl,--allow-multiple-definition.

v2: [Emil Velikov]
 - Fix the Scons/Android build.
 - Resolve libgbm build issues (bring back the missing -lm)

Cc: Julien Isorce 
Cc: "10.5 10.6" 
Bugzilla: https://bugs.freedesktop.org/show_bug.cgi?id=90310
Bugzilla: https://bugs.freedesktop.org/show_bug.cgi?id=90905
Signed-off-by: Emil Velikov 
---
 src/gallium/targets/dri/Makefile.am  |  6 --
 src/loader/Makefile.am   | 10 +++---
 src/mesa/drivers/dri/Makefile.am |  1 +
 src/mesa/drivers/dri/common/Android.mk   |  4 +++-
 src/mesa/drivers/dri/common/Makefile.am  |  6 +-
 src/mesa/drivers/dri/common/Makefile.sources |  4 +++-
 src/mesa/drivers/dri/common/SConscript   |  2 +-
 src/mesa/drivers/dri/i965/Makefile.am|  1 +
 8 files changed, 17 insertions(+), 17 deletions(-)

diff --git a/src/gallium/targets/dri/Makefile.am 
b/src/gallium/targets/dri/Makefile.am
index f9e4ada..9648396 100644
--- a/src/gallium/targets/dri/Makefile.am
+++ b/src/gallium/targets/dri/Makefile.am
@@ -53,12 +53,6 @@ gallium_dri_la_LIBADD = \
$(LIBDRM_LIBS) \
$(GALLIUM_COMMON_LIB_DEPS)
 
-# XXX: Temporary allow duplicated symbols, as the loader pulls in xmlconfig.c
-# which already provides driParse* and driQuery* amongst others.
-# Remove this hack as we come up with a cleaner solution.
-gallium_dri_la_LDFLAGS += \
-   -Wl,--allow-multiple-definition
-
 EXTRA_gallium_dri_la_DEPENDENCIES = \
dri.sym \
$(top_srcdir)/src/gallium/targets/dri-vdpau.dyn
diff --git a/src/loader/Makefile.am b/src/loader/Makefile.am
index 36ddba8..aef1bd6 100644
--- a/src/loader/Makefile.am
+++ b/src/loader/Makefile.am
@@ -41,15 +41,11 @@ libloader_la_CPPFLAGS += \
-I$(top_builddir)/src/mesa/drivers/dri/common/ \
-I$(top_srcdir)/src/mesa/ \
-I$(top_srcdir)/src/mapi/ \
-   -DUSE_DRICONF \
-   $(EXPAT_CFLAGS)
+   -DUSE_DRICONF
 
-libloader_la_SOURCES += \
-   $(top_srcdir)/src/mesa/drivers/dri/common/xmlconfig.c
+ libloader_la_LIBADD += \
+   $(top_builddir)/src/mesa/drivers/dri/common/libxmlconfig.la
 
-libloader_la_LIBADD += \
-   -lm \
-   $(EXPAT_LIBS)
 endif
 
 if !HAVE_LIBDRM
diff --git a/src/mesa/drivers/dri/Makefile.am b/src/mesa/drivers/dri/Makefile.am
index fa1de10..08a8e64 100644
--- a/src/mesa/drivers/dri/Makefile.am
+++ b/src/mesa/drivers/dri/Makefile.am
@@ -60,6 +60,7 @@ mesa_dri_drivers_la_LIBADD = \
 ../../libmesa.la \
 common/libmegadriver_stub.la \
 common/libdricommon.la \
+common/libxmlconfig.la \
 $(MEGADRIVERS_DEPS) \
 $(DRI_LIB_DEPS) \
 $()
diff --git a/src/mesa/drivers/dri/common/Android.mk 
b/src/mesa/drivers/dri/common/Android.mk
index c003c94..6986f5e 100644
--- a/src/mesa/drivers/dri/common/Android.mk
+++ b/src/mesa/drivers/dri/common/Android.mk
@@ -50,7 +50,9 @@ else
 LOCAL_SHARED_LIBRARIES := libdrm
 endif
 
-LOCAL_SRC_FILES := $(DRI_COMMON_FILES)
+LOCAL_SRC_FILES := \
+   $(DRI_COMMON_FILES) \
+   $(XMLCONFIG_FILES)
 
 MESA_DRI_OPTIONS_H := $(intermediates)/xmlpool/options.h
 LOCAL_GENERATED_SOURCES := $(MESA_DRI_OPTIONS_H)
diff --git a/src/mesa/drivers/dri/common/Makefile.am 
b/src/mesa/drivers/dri/common/Makefile.am
index da8f97a..ae19fcb 100644
--- a/src/mesa/drivers/dri/common/Makefile.am
+++ b/src/mesa/drivers/dri/common/Makefile.am
@@ -33,16 +33,20 @@ AM_CFLAGS = \
-I$(top_srcdir)/src/gallium/include \
-I$(top_srcdir)/src/gallium/auxiliary \
$(DEFINES) \
-   $(EXPAT_CFLAGS) \
$(VISIBILITY_CFLAGS)
 
 noinst_LTLIBRARIES = \
libdricommon.la \
+   libxmlconfig.la \
libmegadriver_stub.la \
libdri_test_stubs.la
 
 libdricommon_la_SOURCES = $(DRI_COMMON_FILES)
 
+libxmlconfig_la_SOURCES = $(XMLCONFIG_FILES)
+libxmlconfig_la_CFLAGS = $(AM_CFLAGS) $(EXPAT_CFLAGS)
+libxmlconfig_la_LIBADD = $(EXPAT_LIBS) -lm
+
 libdri_test_stubs_la_SOURCES = $(test_stubs_FILES)
 libdri_test_stubs_la_CFLAGS = $(AM_CFLAGS) -DNO_MAIN
 
diff --git a/src/mesa/drivers/dri/common/Makefile.sources 
b/src/mesa/drivers/dri/common/Makefile.sources
index d00ec5f..d5d8da8 100644
--- a/src/mesa/drivers/dri/common/Makefile.sources
+++ b/src/mesa/drivers/dri/common/Makefile.sources
@@ -2,7 +2,9 @@ DRI_COMMON_FILES := \
utils.c \
utils.h \
dri_util.c \
-   dri_util.h \
+   dri_util.h
+
+XMLCONFIG_FILES := \
xmlconfig.c \
xmlconfig.h
 
diff --git a/src/mesa/drivers/dri/common/SConscript 
b/src/mesa/drivers/dri/common/SConscript
index 0bee1b4..b402736 100644
--- a/src/mesa/drivers/dri/common/SConscript
+++ b/src/mesa/drivers/dri/common/SConscript
@@ -37,7 +37,7 @@ dr

[Mesa-dev] [PATCH 1/7] freedreno: use CXX linker rather than explicit link against libstdc++

2015-06-10 Thread Emil Velikov
Cc: Rob Clark 
Cc: "10.6" 
Signed-off-by: Emil Velikov 
---
 src/gallium/drivers/freedreno/Makefile.am | 3 ++-
 1 file changed, 2 insertions(+), 1 deletion(-)

diff --git a/src/gallium/drivers/freedreno/Makefile.am 
b/src/gallium/drivers/freedreno/Makefile.am
index 4b2629f..e798e44 100644
--- a/src/gallium/drivers/freedreno/Makefile.am
+++ b/src/gallium/drivers/freedreno/Makefile.am
@@ -21,6 +21,8 @@ libfreedreno_la_SOURCES = \
 
 noinst_PROGRAMS = ir3_compiler
 
+# XXX: Required due to the C++ sources in libnir/libglsl_util
+nodist_EXTRA_ir3_compiler_SOURCES = dummy.cpp
 ir3_compiler_SOURCES = \
ir3/ir3_cmdline.c
 
@@ -29,7 +31,6 @@ ir3_compiler_LDADD = \
../../auxiliary/libgallium.la \
$(top_builddir)/src/glsl/libnir.la \
$(top_builddir)/src/libglsl_util.la \
-   -lstdc++ \
$(top_builddir)/src/util/libmesautil.la \
$(GALLIUM_COMMON_LIB_DEPS) \
$(FREEDRENO_LIBS)
-- 
2.4.2

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


[Mesa-dev] [PATCH 3/7] mesa; add a dummy _mesa_error_no_memory() symbol to libglsl_util

2015-06-10 Thread Emil Velikov
Rather than forcing everyone to provide their own definition of the symbol
provide a common (dummy) one.

This helps us resolve the build of the standalone pipe-drivers (amongst
others), which are missing the symbol.

Cc: Rob Clark 
Cc: "10.6" 
Signed-off-by: Emil Velikov 
---
 src/Makefile.am |  3 ++-
 src/gallium/drivers/freedreno/ir3/ir3_cmdline.c |  8 ---
 src/gallium/state_trackers/xa/xa_tracker.c  | 12 --
 src/glsl/Makefile.am| 13 ---
 src/glsl/SConscript |  4 +++-
 src/glsl/main.cpp   |  6 -
 src/glsl/tests/common.c | 30 -
 src/mesa/Android.libmesa_glsl_utils.mk  |  6 +++--
 src/mesa/program/dummy_errors.c | 30 +
 9 files changed, 43 insertions(+), 69 deletions(-)
 delete mode 100644 src/glsl/tests/common.c
 create mode 100644 src/mesa/program/dummy_errors.c

diff --git a/src/Makefile.am b/src/Makefile.am
index 18cb4ce..5d69abd 100644
--- a/src/Makefile.am
+++ b/src/Makefile.am
@@ -72,4 +72,5 @@ noinst_LTLIBRARIES = libglsl_util.la
 libglsl_util_la_SOURCES = \
mesa/main/imports.c \
mesa/program/prog_hash_table.c \
-   mesa/program/symbol_table.c
+   mesa/program/symbol_table.c \
+   mesa/program/dummy_errors.c
diff --git a/src/gallium/drivers/freedreno/ir3/ir3_cmdline.c 
b/src/gallium/drivers/freedreno/ir3/ir3_cmdline.c
index d0517aa..0b16cc1 100644
--- a/src/gallium/drivers/freedreno/ir3/ir3_cmdline.c
+++ b/src/gallium/drivers/freedreno/ir3/ir3_cmdline.c
@@ -360,11 +360,3 @@ int main(int argc, char **argv)
}
dump_info(&v, info);
 }
-
-void _mesa_error_no_memory(const char *caller);
-
-void
-_mesa_error_no_memory(const char *caller)
-{
-   fprintf(stderr, "Mesa error: out of memory in %s", caller);
-}
diff --git a/src/gallium/state_trackers/xa/xa_tracker.c 
b/src/gallium/state_trackers/xa/xa_tracker.c
index 8901998..f69ac8e 100644
--- a/src/gallium/state_trackers/xa/xa_tracker.c
+++ b/src/gallium/state_trackers/xa/xa_tracker.c
@@ -535,15 +535,3 @@ xa_surface_format(const struct xa_surface *srf)
 {
 return srf->fdesc.xa_format;
 }
-
-/*
- * _mesa_error_no_memory() is expected by NIR to be provided by the
- * user.  Normally this is in mesa st, but other state trackers
- * must provide their own.
- */
-void _mesa_error_no_memory(const char *caller);
-void
-_mesa_error_no_memory(const char *caller)
-{
-   debug_printf("Mesa error: out of memory in %s", caller);
-}
diff --git a/src/glsl/Makefile.am b/src/glsl/Makefile.am
index 1b7b1f8..fa8c9f5 100644
--- a/src/glsl/Makefile.am
+++ b/src/glsl/Makefile.am
@@ -89,8 +89,7 @@ tests_general_ir_test_SOURCES =   \
tests/builtin_variable_test.cpp \
tests/invalidate_locations_test.cpp \
tests/general_ir_test.cpp   \
-   tests/varyings_test.cpp \
-   tests/common.c
+   tests/varyings_test.cpp
 tests_general_ir_test_CFLAGS = \
$(PTHREAD_CFLAGS)
 tests_general_ir_test_LDADD =  \
@@ -103,8 +102,7 @@ tests_uniform_initializer_test_SOURCES =\
tests/copy_constant_to_storage_tests.cpp\
tests/set_uniform_initializer_tests.cpp \
tests/uniform_initializer_utils.cpp \
-   tests/uniform_initializer_utils.h   \
-   tests/common.c
+   tests/uniform_initializer_utils.h
 tests_uniform_initializer_test_CFLAGS =\
$(PTHREAD_CFLAGS)
 tests_uniform_initializer_test_LDADD = \
@@ -114,8 +112,7 @@ tests_uniform_initializer_test_LDADD =  
\
$(PTHREAD_LIBS)
 
 tests_sampler_types_test_SOURCES = \
-   tests/sampler_types_test.cpp\
-   tests/common.c
+   tests/sampler_types_test.cpp
 tests_sampler_types_test_CFLAGS =  \
$(PTHREAD_CFLAGS)
 tests_sampler_types_test_LDADD =   \
@@ -133,8 +130,7 @@ libglcpp_la_SOURCES =   
\
$(LIBGLCPP_FILES)
 
 glcpp_glcpp_SOURCES =  \
-   glcpp/glcpp.c   \
-   tests/common.c
+   glcpp/glcpp.c
 glcpp_glcpp_LDADD =\
libglcpp.la \
$(top_builddir)/src/libglsl_util.la \
@@ -164,7 +160,6 @@ glsl_compiler_LDADD =   
\
 
 glsl_test_SOURCES = \
standalone_scaffolding.cpp \
-   tests/common.c \
test.cpp \
test_optpass.cpp \
test_optpass.h
diff --git a/src/glsl/SConscript b/src/glsl/SConscript
index 284b375..89c6035 100644
--- a/src/glsl/SConscript
+++ b/src/glsl

[Mesa-dev] [PATCH 2/7] gallium: use $(top_builddir) when referencing static archives

2015-06-10 Thread Emil Velikov
Just like every other place in gallium.

Signed-off-by: Emil Velikov 
---
 src/gallium/drivers/freedreno/Makefile.am | 2 +-
 src/gallium/drivers/nouveau/Makefile.am   | 2 +-
 2 files changed, 2 insertions(+), 2 deletions(-)

diff --git a/src/gallium/drivers/freedreno/Makefile.am 
b/src/gallium/drivers/freedreno/Makefile.am
index e798e44..cbf62c6 100644
--- a/src/gallium/drivers/freedreno/Makefile.am
+++ b/src/gallium/drivers/freedreno/Makefile.am
@@ -28,7 +28,7 @@ ir3_compiler_SOURCES = \
 
 ir3_compiler_LDADD = \
libfreedreno.la \
-   ../../auxiliary/libgallium.la \
+   $(top_builddir)/src/gallium/auxiliary/libgallium.la \
$(top_builddir)/src/glsl/libnir.la \
$(top_builddir)/src/libglsl_util.la \
$(top_builddir)/src/util/libmesautil.la \
diff --git a/src/gallium/drivers/nouveau/Makefile.am 
b/src/gallium/drivers/nouveau/Makefile.am
index 0aefc03..d05f0a1 100644
--- a/src/gallium/drivers/nouveau/Makefile.am
+++ b/src/gallium/drivers/nouveau/Makefile.am
@@ -48,7 +48,7 @@ nouveau_compiler_SOURCES = \
 
 nouveau_compiler_LDADD = \
libnouveau.la \
-   ../../auxiliary/libgallium.la \
+   $(top_builddir)/src/gallium/auxiliary/libgallium.la \
$(top_builddir)/src/util/libmesautil.la \
$(GALLIUM_COMMON_LIB_DEPS)
 
-- 
2.4.2

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


[Mesa-dev] [PATCH 5/7] targets/nine: link against libnir/libglsl_util

2015-06-10 Thread Emil Velikov
Based on commit 101142c4010(xa: support for drivers which use NIR)

Cc: "10.6" 
Bugzilla: https://bugs.freedesktop.org/show_bug.cgi?id=90466
Signed-off-by: Emil Velikov 
---
 src/gallium/targets/d3dadapter9/Makefile.am | 2 ++
 1 file changed, 2 insertions(+)

diff --git a/src/gallium/targets/d3dadapter9/Makefile.am 
b/src/gallium/targets/d3dadapter9/Makefile.am
index 1dc55f5..591978f 100644
--- a/src/gallium/targets/d3dadapter9/Makefile.am
+++ b/src/gallium/targets/d3dadapter9/Makefile.am
@@ -74,6 +74,8 @@ endif # HAVE_LD_VERSION_SCRIPT
 d3dadapter9_la_LIBADD = \
$(top_builddir)/src/gallium/auxiliary/libgalliumvl_stub.la \
$(top_builddir)/src/gallium/auxiliary/libgallium.la \
+   $(top_builddir)/src/glsl/libnir.la \
+   $(top_builddir)/src/libglsl_util.la \
$(top_builddir)/src/gallium/state_trackers/nine/libninetracker.la \
$(top_builddir)/src/util/libmesautil.la \
$(top_builddir)/src/gallium/winsys/sw/wrapper/libwsw.la \
-- 
2.4.2

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


[Mesa-dev] [Bug 90905] mesa: Finish subdir-objects transition

2015-06-10 Thread bugzilla-daemon
https://bugs.freedesktop.org/show_bug.cgi?id=90905

--- Comment #3 from Emil Velikov  ---
Yes the situation is a "bit" messy, and considering the interesting use of
xmlconfig by the loader (and effectively libGL) I intentionally stayed away
from it.

Anywho, I've picked Erik's approach, updated+tested the other two build systems
and will send the patch to the ML in a second. Meanwhile Eric pushed some
patches that make autotools complain about another subdir-objects issue. Will
send a patch for that one as well.

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


[Mesa-dev] [PATCH 2/5] mesa/st: Use global function _mesa_regions_overlap()

2015-06-10 Thread Anuj Phogat
Signed-off-by: Anuj Phogat 
Cc: Ben Widawsky 
---
 src/mesa/state_tracker/st_cb_drawpixels.c | 30 +++---
 1 file changed, 3 insertions(+), 27 deletions(-)

diff --git a/src/mesa/state_tracker/st_cb_drawpixels.c 
b/src/mesa/state_tracker/st_cb_drawpixels.c
index a6a98c8..e736d4b 100644
--- a/src/mesa/state_tracker/st_cb_drawpixels.c
+++ b/src/mesa/state_tracker/st_cb_drawpixels.c
@@ -33,6 +33,7 @@
 #include "main/imports.h"
 #include "main/image.h"
 #include "main/bufferobj.h"
+#include "main/blit.h"
 #include "main/format_pack.h"
 #include "main/macros.h"
 #include "main/mtypes.h"
@@ -1313,31 +1314,6 @@ st_get_color_read_renderbuffer(struct gl_context *ctx)
 
 
 /**
- * \return TRUE if two regions overlap, FALSE otherwise
- */
-static boolean
-regions_overlap(int srcX0, int srcY0,
-int srcX1, int srcY1,
-int dstX0, int dstY0,
-int dstX1, int dstY1)
-{
-   if (MAX2(srcX0, srcX1) < MIN2(dstX0, dstX1))
-  return FALSE; /* src completely left of dst */
-
-   if (MAX2(dstX0, dstX1) < MIN2(srcX0, srcX1))
-  return FALSE; /* dst completely left of src */
-
-   if (MAX2(srcY0, srcY1) < MIN2(dstY0, dstY1))
-  return FALSE; /* src completely above dst */
-
-   if (MAX2(dstY0, dstY1) < MIN2(srcY0, srcY1))
-  return FALSE; /* dst completely above src */
-
-   return TRUE; /* some overlap */
-}
-
-
-/**
  * Try to do a glCopyPixels for simple cases with a blit by calling
  * pipe->blit().
  *
@@ -1420,8 +1396,8 @@ blit_copy_pixels(struct gl_context *ctx, GLint srcx, 
GLint srcy,
   }
 
   if (rbRead != rbDraw ||
-  !regions_overlap(readX, readY, readX + readW, readY + readH,
-   drawX, drawY, drawX + drawW, drawY + drawH)) {
+  !_mesa_regions_overlap(readX, readY, readX + readW, readY + readH,
+ drawX, drawY, drawX + drawW, drawY + drawH)) {
  struct pipe_blit_info blit;
 
  memset(&blit, 0, sizeof(blit));
-- 
1.9.3

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


[Mesa-dev] [PATCH 1/5] mesa: Add a new helper function _mesa_regions_overlap()

2015-06-10 Thread Anuj Phogat
Signed-off-by: Anuj Phogat 
Cc: Ben Widawsky 
---
Jenkins showed no piglit regressions with this series.

 src/mesa/main/blit.c | 26 ++
 src/mesa/main/blit.h |  6 ++
 2 files changed, 32 insertions(+)

diff --git a/src/mesa/main/blit.c b/src/mesa/main/blit.c
index db8fee5..4765198 100644
--- a/src/mesa/main/blit.c
+++ b/src/mesa/main/blit.c
@@ -37,6 +37,7 @@
 #include "framebuffer.h"
 #include "glformats.h"
 #include "mtypes.h"
+#include "macros.h"
 #include "state.h"
 
 
@@ -59,6 +60,31 @@ find_attachment(const struct gl_framebuffer *fb,
 
 
 /**
+ * \return true if two regions overlap, false otherwise
+ */
+bool
+_mesa_regions_overlap(int srcX0, int srcY0,
+  int srcX1, int srcY1,
+  int dstX0, int dstY0,
+  int dstX1, int dstY1)
+{
+   if (MAX2(srcX0, srcX1) < MIN2(dstX0, dstX1))
+  return false; /* dst completely right of src */
+
+   if (MAX2(dstX0, dstX1) < MIN2(srcX0, srcX1))
+  return false; /* dst completely left of src */
+
+   if (MAX2(srcY0, srcY1) < MIN2(dstY0, dstY1))
+  return false; /* dst completely above src */
+
+   if (MAX2(dstY0, dstY1) < MIN2(srcY0, srcY1))
+  return false; /* dst completely below src */
+
+   return true; /* some overlap */
+}
+
+
+/**
  * Helper function for checking if the datatypes of color buffers are
  * compatible for glBlitFramebuffer.  From the 3.1 spec, page 198:
  *
diff --git a/src/mesa/main/blit.h b/src/mesa/main/blit.h
index 54b946e..88dd4a9 100644
--- a/src/mesa/main/blit.h
+++ b/src/mesa/main/blit.h
@@ -28,6 +28,12 @@
 
 #include "glheader.h"
 
+extern bool
+_mesa_regions_overlap(int srcX0, int srcY0,
+  int srcX1, int srcY1,
+  int dstX0, int dstY0,
+  int dstX1, int dstY1);
+
 extern void
 _mesa_blit_framebuffer(struct gl_context *ctx,
struct gl_framebuffer *readFb,
-- 
1.9.3

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


[Mesa-dev] [PATCH 3/5] mesa/swrast: Use global function _mesa_regions_overlap()

2015-06-10 Thread Anuj Phogat
Signed-off-by: Anuj Phogat 
---
 src/mesa/swrast/s_copypix.c | 16 +++-
 1 file changed, 3 insertions(+), 13 deletions(-)

diff --git a/src/mesa/swrast/s_copypix.c b/src/mesa/swrast/s_copypix.c
index 68c83e4..8fde0c2 100644
--- a/src/mesa/swrast/s_copypix.c
+++ b/src/mesa/swrast/s_copypix.c
@@ -27,6 +27,7 @@
 #include "main/context.h"
 #include "main/condrender.h"
 #include "main/macros.h"
+#include "main/blit.h"
 #include "main/pixeltransfer.h"
 #include "main/imports.h"
 
@@ -52,19 +53,8 @@ regions_overlap(GLint srcx, GLint srcy,
 GLfloat zoomX, GLfloat zoomY)
 {
if (zoomX == 1.0 && zoomY == 1.0) {
-  /* no zoom */
-  if (srcx >= dstx + width || (srcx + width <= dstx)) {
- return GL_FALSE;
-  }
-  else if (srcy < dsty) { /* this is OK */
- return GL_FALSE;
-  }
-  else if (srcy > dsty + height) {
- return GL_FALSE;
-  }
-  else {
- return GL_TRUE;
-  }
+  return _mesa_regions_overlap(srcx, srcy, srcx + width, srcy + height,
+   dstx, dsty, dstx + width, dsty + height);
}
else {
   /* add one pixel of slop when zooming, just to be safe */
-- 
1.9.3

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


[Mesa-dev] [PATCH 4/5] i965/gen9: Add XY_FAST_COPY_BLT support to intelEmitCopyBlit()

2015-06-10 Thread Anuj Phogat
This patch enables using XY_FAST_COPY_BLT only for Yf/Ys tiled buffers.
It can be later turned on for other tiling patterns (X,Y) too.

V3: Flush in between sequential fast copy blits.
Fix src/dst alignment requirements.
Make can_fast_copy_blit() helper.
Use ffs(), is_power_of_two()
Move overlap computation inside intel_miptree_blit().

V4: Use _mesa_regions_overlap() function.
Simplify horizontal and vertical alignment computations.

Signed-off-by: Anuj Phogat 
Cc: Ben Widawsky 
---
 src/mesa/drivers/dri/i965/intel_blit.c   | 295 ++-
 src/mesa/drivers/dri/i965/intel_blit.h   |   2 +
 src/mesa/drivers/dri/i965/intel_copy_image.c |   2 +
 src/mesa/drivers/dri/i965/intel_reg.h|  16 ++
 4 files changed, 268 insertions(+), 47 deletions(-)

diff --git a/src/mesa/drivers/dri/i965/intel_blit.c 
b/src/mesa/drivers/dri/i965/intel_blit.c
index 5afc771..800ed7e 100644
--- a/src/mesa/drivers/dri/i965/intel_blit.c
+++ b/src/mesa/drivers/dri/i965/intel_blit.c
@@ -27,6 +27,7 @@
 
 
 #include "main/mtypes.h"
+#include "main/blit.h"
 #include "main/context.h"
 #include "main/enums.h"
 #include "main/colormac.h"
@@ -43,6 +44,23 @@
 
 #define FILE_DEBUG_FLAG DEBUG_BLIT
 
+#define SET_TILING_XY_FAST_COPY_BLT(tiling, tr_mode, type)   \
+({   \
+   switch (tiling) { \
+   case I915_TILING_X:   \
+  CMD |= type ## _TILED_X;   \
+  break; \
+   case I915_TILING_Y:   \
+  if (tr_mode == INTEL_MIPTREE_TRMODE_YS)\
+ CMD |= type ## _TILED_64K;  \
+  else   \
+ CMD |= type ## _TILED_Y;\
+  break; \
+   default:  \
+  unreachable("not reached");\
+   } \
+})
+
 static void
 intel_miptree_set_alpha_to_one(struct brw_context *brw,
struct intel_mipmap_tree *mt,
@@ -75,6 +93,10 @@ static uint32_t
 br13_for_cpp(int cpp)
 {
switch (cpp) {
+   case 16:
+  return BR13_32323232;
+   case 8:
+  return BR13_16161616;
case 4:
   return BR13_;
   break;
@@ -89,6 +111,66 @@ br13_for_cpp(int cpp)
}
 }
 
+static uint32_t
+get_tr_horizontal_align(uint32_t tr_mode, uint32_t cpp, bool is_src) {
+   /* Alignment tables for YF/YS tiled surfaces. */
+   const uint32_t align_2d_yf[] = {64, 64, 32, 32, 16};
+   const uint32_t align_2d_ys[] = {256, 256, 128, 128, 64};
+   const uint32_t bpp = cpp * 8;
+   const uint32_t shift = is_src ? 17 : 10;
+   uint32_t align;
+   int i = 0;
+
+   if (tr_mode == INTEL_MIPTREE_TRMODE_NONE)
+  return 0;
+
+   /* Compute array index. */
+   assert (bpp >= 8 && bpp <= 128 && is_power_of_two(bpp));
+   i = ffs(bpp / 8) - 1;
+
+   align = tr_mode == INTEL_MIPTREE_TRMODE_YF ?
+   align_2d_yf[i] :
+   align_2d_ys[i];
+
+   assert(is_power_of_two(align));
+
+   /* XY_FAST_COPY_BLT doesn't support horizontal alignment of 16. */
+   if (align == 16)
+  align = 32;
+
+   return (ffs(align) - 6) << shift;
+}
+
+static uint32_t
+get_tr_vertical_align(uint32_t tr_mode, uint32_t cpp, bool is_src) {
+   /* Vertical alignment tables for YF/YS tiled surfaces. */
+   const unsigned align_2d_yf[] = {64, 32, 32, 16, 16};
+   const unsigned align_2d_ys[] = {256, 128, 128, 64, 64};
+   const uint32_t bpp = cpp * 8;
+   const uint32_t shift = is_src ? 15 : 8;
+   uint32_t align;
+   int i = 0;
+
+   if (tr_mode == INTEL_MIPTREE_TRMODE_NONE)
+  return 0;
+
+   /* Compute array index. */
+   assert (bpp >= 8 && bpp <= 128 && is_power_of_two(bpp));
+   i = ffs(bpp / 8) - 1;
+
+   align = tr_mode == INTEL_MIPTREE_TRMODE_YF ?
+   align_2d_yf[i] :
+   align_2d_ys[i];
+
+   assert(is_power_of_two(align));
+
+   /* XY_FAST_COPY_BLT doesn't support vertical alignments of 16 and 32. */
+   if (align == 16 || align == 32)
+  align = 64;
+
+   return (ffs(align) - 7) << shift;
+}
+
 /**
  * Emits the packet for switching the blitter from X to Y tiled or back.
  *
@@ -281,9 +363,11 @@ intel_miptree_blit(struct brw_context *brw,
   src_pitch,
   src_mt->bo, src_mt->offset,
   src_mt->tiling,
+  src_mt->tr_mode,
   dst_mt->pitch,
   dst_mt->bo, dst_mt->offset,
   dst_mt->tiling,
+  dst_mt->tr_mode,
   

[Mesa-dev] [PATCH 5/5] i965/skl: Extract the blit command setup in to a helper

2015-06-10 Thread Anuj Phogat
Signed-off-by: Anuj Phogat 
---
 src/mesa/drivers/dri/i965/intel_blit.c | 93 ++
 1 file changed, 61 insertions(+), 32 deletions(-)

diff --git a/src/mesa/drivers/dri/i965/intel_blit.c 
b/src/mesa/drivers/dri/i965/intel_blit.c
index 800ed7e..987b5f5 100644
--- a/src/mesa/drivers/dri/i965/intel_blit.c
+++ b/src/mesa/drivers/dri/i965/intel_blit.c
@@ -458,6 +458,51 @@ can_fast_copy_blit(struct brw_context *brw,
return true;
 }
 
+static uint32_t
+xy_blit_cmd(uint32_t src_tiling, uint32_t src_tr_mode,
+uint32_t dst_tiling, uint32_t dst_tr_mode,
+uint32_t cpp, bool use_fast_copy_blit)
+{
+   uint32_t CMD = 0;
+
+   if (use_fast_copy_blit) {
+  CMD = XY_FAST_COPY_BLT_CMD;
+
+  if (dst_tiling != I915_TILING_NONE)
+ SET_TILING_XY_FAST_COPY_BLT(dst_tiling, dst_tr_mode, XY_FAST_DST);
+
+  if (src_tiling != I915_TILING_NONE)
+ SET_TILING_XY_FAST_COPY_BLT(src_tiling, src_tr_mode, XY_FAST_SRC);
+
+  CMD |= get_tr_horizontal_align(src_tr_mode, cpp, true /* is_src */);
+  CMD |= get_tr_vertical_align(src_tr_mode, cpp, true /* is_src */);
+
+  CMD |= get_tr_horizontal_align(dst_tr_mode, cpp, false /* is_src */);
+  CMD |= get_tr_vertical_align(dst_tr_mode, cpp, false /* is_src */);
+
+   } else {
+  assert(cpp <= 4);
+  switch (cpp) {
+  case 1:
+  case 2:
+ CMD = XY_SRC_COPY_BLT_CMD;
+ break;
+  case 4:
+ CMD = XY_SRC_COPY_BLT_CMD | XY_BLT_WRITE_ALPHA | XY_BLT_WRITE_RGB;
+ break;
+  default:
+ unreachable("not reached");
+  }
+
+  if (dst_tiling != I915_TILING_NONE)
+ CMD |= XY_DST_TILED;
+
+  if (src_tiling != I915_TILING_NONE)
+ CMD |= XY_SRC_TILED;
+   }
+   return CMD;
+}
+
 /* Copy BitBlt
  */
 bool
@@ -547,24 +592,18 @@ intelEmitCopyBlit(struct brw_context *brw,
   if (dst_tr_mode == INTEL_MIPTREE_TRMODE_YF)
  BR13 |= XY_FAST_DST_TRMODE_YF;
 
-  CMD = XY_FAST_COPY_BLT_CMD;
+  CMD = xy_blit_cmd(src_tiling, src_tr_mode,
+dst_tiling, dst_tr_mode,
+cpp, use_fast_copy_blit);
 
-  if (dst_tiling != I915_TILING_NONE) {
- SET_TILING_XY_FAST_COPY_BLT(dst_tiling, dst_tr_mode, XY_FAST_DST);
- /* Pitch value should be specified as a number of Dwords. */
+  /* For tiled source and destination, pitch value should be specified
+   * as a number of Dwords.
+   */
+  if (dst_tiling != I915_TILING_NONE)
  dst_pitch /= 4;
-  }
-  if (src_tiling != I915_TILING_NONE) {
- SET_TILING_XY_FAST_COPY_BLT(src_tiling, src_tr_mode, XY_FAST_SRC);
- /* Pitch value should be specified as a number of Dwords. */
- src_pitch /= 4;
-  }
-
-  CMD |= get_tr_horizontal_align(src_tr_mode, cpp, true /* is_src */);
-  CMD |= get_tr_vertical_align(src_tr_mode, cpp, true /* is_src */);
 
-  CMD |= get_tr_horizontal_align(dst_tr_mode, cpp, false /* is_src */);
-  CMD |= get_tr_vertical_align(dst_tr_mode, cpp, false /* is_src */);
+  if (src_tiling != I915_TILING_NONE)
+ src_pitch /= 4;
 
} else {
   /* For big formats (such as floating point), do the copy using 16 or
@@ -599,26 +638,16 @@ intelEmitCopyBlit(struct brw_context *brw,
 
   assert(cpp <= 4);
   BR13 = br13_for_cpp(cpp) | translate_raster_op(logic_op) << 16;
-  switch (cpp) {
-  case 1:
-  case 2:
- CMD = XY_SRC_COPY_BLT_CMD;
- break;
-  case 4:
- CMD = XY_SRC_COPY_BLT_CMD | XY_BLT_WRITE_ALPHA | XY_BLT_WRITE_RGB;
- break;
-  default:
- return false;
-  }
 
-  if (dst_tiling != I915_TILING_NONE) {
- CMD |= XY_DST_TILED;
+  CMD = xy_blit_cmd(src_tiling, src_tr_mode,
+dst_tiling, dst_tr_mode,
+cpp, use_fast_copy_blit);
+
+  if (dst_tiling != I915_TILING_NONE)
  dst_pitch /= 4;
-  }
-  if (src_tiling != I915_TILING_NONE) {
- CMD |= XY_SRC_TILED;
+
+  if (src_tiling != I915_TILING_NONE)
  src_pitch /= 4;
-  }
}
 
if (dst_y2 <= dst_y || dst_x2 <= dst_x) {
-- 
1.9.3

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


[Mesa-dev] [PATCH 4/5] i965: Make a helper function intel_miptree_can_use_tr_mode()

2015-06-10 Thread Anuj Phogat
Signed-off-by: Anuj Phogat 
Cc: Ben Widawsky 
---
 src/mesa/drivers/dri/i965/brw_tex_layout.c | 30 +++---
 1 file changed, 19 insertions(+), 11 deletions(-)

diff --git a/src/mesa/drivers/dri/i965/brw_tex_layout.c 
b/src/mesa/drivers/dri/i965/brw_tex_layout.c
index c185e41..39c6a39 100644
--- a/src/mesa/drivers/dri/i965/brw_tex_layout.c
+++ b/src/mesa/drivers/dri/i965/brw_tex_layout.c
@@ -812,6 +812,23 @@ intel_miptree_release_levels(struct intel_mipmap_tree *mt)
}
 }
 
+static bool
+intel_miptree_can_use_tr_mode(const struct intel_mipmap_tree *mt)
+{
+   if (mt->tiling == I915_TILING_Y ||
+   mt->tiling == (I915_TILING_Y | I915_TILING_X) ||
+   mt->tr_mode == INTEL_MIPTREE_TRMODE_NONE) {
+  /* FIXME: Don't allow YS tiling at the moment. Using 64KB tiling
+   * for small textures might result in to memory wastage. Revisit
+   * this condition when we have more information about the specific
+   * cases where using YS over YF will be useful.
+   */
+  if (mt->tr_mode != INTEL_MIPTREE_TRMODE_YS)
+ return true;
+   }
+   return false;
+}
+
 void
 brw_miptree_layout(struct brw_context *brw,
bool for_bo,
@@ -879,17 +896,8 @@ brw_miptree_layout(struct brw_context *brw,
   if (is_tr_mode_yf_ys_allowed) {
  assert(brw->gen >= 9);
 
- if (mt->tiling == I915_TILING_Y ||
- mt->tiling == (I915_TILING_Y | I915_TILING_X) ||
- mt->tr_mode == INTEL_MIPTREE_TRMODE_NONE) {
-/* FIXME: Don't allow YS tiling at the moment. Using 64KB tiling
- * for small textures might result in to memory wastage. Revisit
- * this condition when we have more information about the specific
- * cases where using YS over YF will be useful.
- */
-if (mt->tr_mode != INTEL_MIPTREE_TRMODE_YS)
-   return;
- }
+ if (intel_miptree_can_use_tr_mode(mt))
+return;
  /* Failed to use selected tr_mode. Free up the memory allocated
   * for miptree levels in intel_miptree_total_width_height().
   */
-- 
1.9.3

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


[Mesa-dev] [PATCH 1/5] i965: Make a helper function intel_miptree_set_alignment()

2015-06-10 Thread Anuj Phogat
Signed-off-by: Anuj Phogat 
Cc: Ben Widawsky 
---
Jenkins showed no piglit regressions with this series.

 src/mesa/drivers/dri/i965/brw_tex_layout.c | 20 +---
 1 file changed, 13 insertions(+), 7 deletions(-)

diff --git a/src/mesa/drivers/dri/i965/brw_tex_layout.c 
b/src/mesa/drivers/dri/i965/brw_tex_layout.c
index 41a9964..b9ac4cf 100644
--- a/src/mesa/drivers/dri/i965/brw_tex_layout.c
+++ b/src/mesa/drivers/dri/i965/brw_tex_layout.c
@@ -761,16 +761,12 @@ intel_miptree_set_total_width_height(struct brw_context 
*brw,
mt->total_width, mt->total_height, mt->cpp);
 }
 
-void
-brw_miptree_layout(struct brw_context *brw,
-   bool for_bo,
-   enum intel_miptree_tiling_mode requested,
-   struct intel_mipmap_tree *mt)
+static void
+intel_miptree_set_alignment(struct brw_context *brw,
+struct intel_mipmap_tree *mt)
 {
bool gen6_hiz_or_stencil = false;
 
-   mt->tr_mode = INTEL_MIPTREE_TRMODE_NONE;
-
if (brw->gen == 6 && mt->array_layout == ALL_SLICES_AT_EACH_LOD) {
   const GLenum base_format = _mesa_get_format_base_format(mt->format);
   gen6_hiz_or_stencil = _mesa_is_depth_or_stencil_format(base_format);
@@ -803,7 +799,17 @@ brw_miptree_layout(struct brw_context *brw,
   mt->align_w = intel_horizontal_texture_alignment_unit(brw, mt);
   mt->align_h = intel_vertical_texture_alignment_unit(brw, mt);
}
+}
+
+void
+brw_miptree_layout(struct brw_context *brw,
+   bool for_bo,
+   enum intel_miptree_tiling_mode requested,
+   struct intel_mipmap_tree *mt)
+{
+   mt->tr_mode = INTEL_MIPTREE_TRMODE_NONE;
 
+   intel_miptree_set_alignment(brw, mt);
intel_miptree_set_total_width_height(brw, mt);
 
if (!mt->total_width || !mt->total_height) {
-- 
1.9.3

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


[Mesa-dev] [PATCH 3/5] i965: Make a helper function intel_miptree_release_levels()

2015-06-10 Thread Anuj Phogat
Signed-off-by: Anuj Phogat 
Cc: Ben Widawsky 
---
 src/mesa/drivers/dri/i965/brw_tex_layout.c | 17 -
 1 file changed, 12 insertions(+), 5 deletions(-)

diff --git a/src/mesa/drivers/dri/i965/brw_tex_layout.c 
b/src/mesa/drivers/dri/i965/brw_tex_layout.c
index c0ef5cc..c185e41 100644
--- a/src/mesa/drivers/dri/i965/brw_tex_layout.c
+++ b/src/mesa/drivers/dri/i965/brw_tex_layout.c
@@ -801,6 +801,17 @@ intel_miptree_set_alignment(struct brw_context *brw,
}
 }
 
+static void
+intel_miptree_release_levels(struct intel_mipmap_tree *mt)
+{
+   unsigned int level = 0;
+
+   for (level = mt->first_level; level <= mt->last_level; level++) {
+  free(mt->level[level].slice);
+  mt->level[level].slice = NULL;
+   }
+}
+
 void
 brw_miptree_layout(struct brw_context *brw,
bool for_bo,
@@ -866,7 +877,6 @@ brw_miptree_layout(struct brw_context *brw,
  mt->tiling = brw_miptree_choose_tiling(brw, requested, mt);
 
   if (is_tr_mode_yf_ys_allowed) {
- unsigned int level = 0;
  assert(brw->gen >= 9);
 
  if (mt->tiling == I915_TILING_Y ||
@@ -883,10 +893,7 @@ brw_miptree_layout(struct brw_context *brw,
  /* Failed to use selected tr_mode. Free up the memory allocated
   * for miptree levels in intel_miptree_total_width_height().
   */
- for (level = mt->first_level; level <= mt->last_level; level++) {
-free(mt->level[level].slice);
-mt->level[level].slice = NULL;
- }
+ intel_miptree_release_levels(mt);
   }
   i++;
}
-- 
1.9.3

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


[Mesa-dev] [PATCH 5/5] i965/gen9: Allocate YF/YS tiled buffer objects

2015-06-10 Thread Anuj Phogat
In case of I915_TILING_{X,Y} we need to pass tiling format to libdrm
using drm_intel_bo_alloc_tiled(). But, In case of YF/YS tiled buffers
libdrm need not know about the tiling format because these buffers
don't have hardware support to be tiled or detiled through a fenced
region. libdrm still need to know buffer alignment value for its use
in kernel when resolving the relocation.

Using drm_intel_bo_alloc_for_render() for YF/YS tiled buffers
satisfy both the above conditions.

Signed-off-by: Anuj Phogat 
Cc: Ben Widawsky 
---
 src/mesa/drivers/dri/i965/intel_mipmap_tree.c | 86 +--
 1 file changed, 80 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 615cbfb..d4d9e76 100644
--- a/src/mesa/drivers/dri/i965/intel_mipmap_tree.c
+++ b/src/mesa/drivers/dri/i965/intel_mipmap_tree.c
@@ -522,6 +522,65 @@ intel_lower_compressed_format(struct brw_context *brw, 
mesa_format format)
}
 }
 
+/* This function computes Yf/Ys tiled bo size and alignment. */
+static uint64_t
+intel_get_yf_ys_bo_size(struct intel_mipmap_tree *mt, unsigned *alignment)
+{
+   const uint32_t bpp = mt->cpp * 8;
+   const uint32_t aspect_ratio = (bpp == 16 || bpp == 64) ? 2 : 1;
+   uint32_t tile_width, tile_height;
+   const uint64_t min_size = 512 * 1024;
+   const uint64_t max_size = 64 * 1024 * 1024;
+   uint64_t i, stride, size, aligned_y;
+
+   assert(mt->tr_mode != INTEL_MIPTREE_TRMODE_NONE);
+
+   switch (bpp) {
+   case 8:
+  tile_height = 64;
+  break;
+   case 16:
+   case 32:
+  tile_height = 32;
+  break;
+   case 64:
+   case 128:
+  tile_height = 16;
+  break;
+   default:
+  tile_height = 0;
+  printf("Invalid bits per pixel in %s: bpp = %d\n",
+ __FUNCTION__, bpp);
+   }
+
+   if (mt->tr_mode == INTEL_MIPTREE_TRMODE_YS)
+  tile_height *= 4;
+
+   aligned_y = ALIGN(mt->total_height, tile_height);
+
+   stride = mt->total_width * mt->cpp;
+   tile_width = tile_height * mt->cpp * aspect_ratio;
+   stride = ALIGN(stride, tile_width);
+   size = stride * aligned_y;
+
+   if (mt->tr_mode == INTEL_MIPTREE_TRMODE_YF) {
+  *alignment = 4096;
+  size = ALIGN(size, 4096);
+   } else {
+  *alignment = 64 * 1024;
+  size = ALIGN(size, 64 * 1024);
+   }
+
+   if (size > max_size) {
+  mt->tr_mode = INTEL_MIPTREE_TRMODE_NONE;
+  return 0;
+   } else {
+  mt->pitch = stride;
+  for (i = min_size; i < size; i <<= 1)
+ ;
+  return i;
+   }
+}
 
 struct intel_mipmap_tree *
 intel_miptree_create(struct brw_context *brw,
@@ -575,12 +634,27 @@ intel_miptree_create(struct brw_context *brw,
 
unsigned long pitch;
mt->etc_format = etc_format;
-   mt->bo = drm_intel_bo_alloc_tiled(brw->bufmgr, "miptree",
- total_width, total_height, mt->cpp,
- &mt->tiling, &pitch,
- (expect_accelerated_upload ?
-  BO_ALLOC_FOR_RENDER : 0));
-   mt->pitch = pitch;
+
+   if (mt->tr_mode != INTEL_MIPTREE_TRMODE_NONE) {
+  unsigned alignment = 0;
+  unsigned long size;
+  size = intel_get_yf_ys_bo_size(mt, &alignment);
+
+  /* intel_get_yf_ys_bo_size() might change the tr_mode. */
+  if (size > 0 && mt->tr_mode != INTEL_MIPTREE_TRMODE_NONE) {
+ mt->bo = drm_intel_bo_alloc_for_render(brw->bufmgr, "miptree",
+size, alignment);
+  }
+   }
+
+   if (mt->tr_mode == INTEL_MIPTREE_TRMODE_NONE) {
+  mt->bo = drm_intel_bo_alloc_tiled(brw->bufmgr, "miptree",
+total_width, total_height, mt->cpp,
+&mt->tiling, &pitch,
+(expect_accelerated_upload ?
+ BO_ALLOC_FOR_RENDER : 0));
+  mt->pitch = pitch;
+   }
 
/* If the BO is too large to fit in the aperture, we need to use the
 * BLT engine to support it.  Prior to Sandybridge, the BLT paths can't
-- 
1.9.3

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


[Mesa-dev] [PATCH 2/5] i965/gen9: Plugin the code for selecting YF/YS tiling on skl+

2015-06-10 Thread Anuj Phogat
Buffers with Yf/Ys tiling end up using meta upload / download
paths or the blitter for cases where they used tiled_memcpy paths
in case of Y tiling. This has exposed some bugs in meta path. To
avoid any piglit regressions on SKL this patch keeps the Yf/Ys
tiling disabled at the moment.

V3: Make brw_miptree_choose_tr_mode() actually choose TRMODE. (Ben)
Few cosmetic changes.
V4: Get rid of brw_miptree_choose_tr_mode().
Take care of all tile resource modes {Yf, Ys, none} for all
generations at one place.

Signed-off-by: Anuj Phogat 
Cc: Ben Widawsky 
---
 src/mesa/drivers/dri/i965/brw_tex_layout.c | 97 --
 1 file changed, 79 insertions(+), 18 deletions(-)

diff --git a/src/mesa/drivers/dri/i965/brw_tex_layout.c 
b/src/mesa/drivers/dri/i965/brw_tex_layout.c
index b9ac4cf..c0ef5cc 100644
--- a/src/mesa/drivers/dri/i965/brw_tex_layout.c
+++ b/src/mesa/drivers/dri/i965/brw_tex_layout.c
@@ -807,27 +807,88 @@ brw_miptree_layout(struct brw_context *brw,
enum intel_miptree_tiling_mode requested,
struct intel_mipmap_tree *mt)
 {
-   mt->tr_mode = INTEL_MIPTREE_TRMODE_NONE;
+   const unsigned bpp = mt->cpp * 8;
+   const bool is_tr_mode_yf_ys_allowed =
+  brw->gen >= 9 &&
+  !for_bo &&
+  !mt->compressed &&
+  /* Enable YF/YS tiling only for color surfaces because depth and
+   * stencil surfaces are not supported in blitter using fast copy
+   * blit and meta PBO upload, download paths. No other paths
+   * currently support Yf/Ys tiled surfaces.
+   * FIXME:  Remove this restriction once we have a tiled_memcpy()
+   * path to do depth/stencil data upload/download to Yf/Ys tiled
+   * surfaces.
+   */
+  _mesa_is_format_color_format(mt->format) &&
+  (requested == INTEL_MIPTREE_TILING_Y ||
+   requested == INTEL_MIPTREE_TILING_ANY) &&
+  (bpp && is_power_of_two(bpp)) &&
+  /* FIXME: To avoid piglit regressions keep the Yf/Ys tiling
+   * disabled at the moment.
+   */
+  false;
 
-   intel_miptree_set_alignment(brw, mt);
-   intel_miptree_set_total_width_height(brw, mt);
+   /* Lower index (Yf) is the higher priority mode */
+   const uint32_t tr_mode[3] = {INTEL_MIPTREE_TRMODE_YF,
+INTEL_MIPTREE_TRMODE_YS,
+INTEL_MIPTREE_TRMODE_NONE};
+   int i = is_tr_mode_yf_ys_allowed ? 0 : ARRAY_SIZE(tr_mode) - 1;
 
-   if (!mt->total_width || !mt->total_height) {
-  intel_miptree_release(&mt);
-  return;
-   }
+   while (i < ARRAY_SIZE(tr_mode)) {
+  if (brw->gen < 9)
+ assert(tr_mode[i] == INTEL_MIPTREE_TRMODE_NONE);
+  else
+ assert(tr_mode[i] == INTEL_MIPTREE_TRMODE_YF ||
+tr_mode[i] == INTEL_MIPTREE_TRMODE_YS ||
+tr_mode[i] == INTEL_MIPTREE_TRMODE_NONE);
 
-   /* On Gen9+ the alignment values are expressed in multiples of the block
-* size
-*/
-   if (brw->gen >= 9) {
-  unsigned int i, j;
-  _mesa_get_format_block_size(mt->format, &i, &j);
-  mt->align_w /= i;
-  mt->align_h /= j;
-   }
+  mt->tr_mode = tr_mode[i];
+  intel_miptree_set_alignment(brw, mt);
+  intel_miptree_set_total_width_height(brw, mt);
 
-   if (!for_bo)
-  mt->tiling = brw_miptree_choose_tiling(brw, requested, mt);
+  if (!mt->total_width || !mt->total_height) {
+ intel_miptree_release(&mt);
+ return;
+  }
+
+  /* On Gen9+ the alignment values are expressed in multiples of the
+   * block size.
+   */
+  if (brw->gen >= 9) {
+ unsigned int i, j;
+ _mesa_get_format_block_size(mt->format, &i, &j);
+ mt->align_w /= i;
+ mt->align_h /= j;
+  }
+
+  if (!for_bo)
+ mt->tiling = brw_miptree_choose_tiling(brw, requested, mt);
+
+  if (is_tr_mode_yf_ys_allowed) {
+ unsigned int level = 0;
+ assert(brw->gen >= 9);
+
+ if (mt->tiling == I915_TILING_Y ||
+ mt->tiling == (I915_TILING_Y | I915_TILING_X) ||
+ mt->tr_mode == INTEL_MIPTREE_TRMODE_NONE) {
+/* FIXME: Don't allow YS tiling at the moment. Using 64KB tiling
+ * for small textures might result in to memory wastage. Revisit
+ * this condition when we have more information about the specific
+ * cases where using YS over YF will be useful.
+ */
+if (mt->tr_mode != INTEL_MIPTREE_TRMODE_YS)
+   return;
+ }
+ /* Failed to use selected tr_mode. Free up the memory allocated
+  * for miptree levels in intel_miptree_total_width_height().
+  */
+ for (level = mt->first_level; level <= mt->last_level; level++) {
+free(mt->level[level].slice);
+mt->level[level].slice = NULL;
+ }
+  }
+  i++;
+   }
 }
 
-- 
1.9.3

___
mesa-dev mailing list
mesa-dev@lists.freedes

Re: [Mesa-dev] [PATCH 1/2] tgsi: texture types

2015-06-10 Thread Roland Scheidegger
Am 10.06.2015 um 23:31 schrieb Rob Clark:
> On Wed, Jun 10, 2015 at 5:13 PM, Jose Fonseca  wrote:
>> I think it make sense for us to start using SVIEW regardless, and uniformize
>> things.
>>
>>
>> Even if GLSL will never support independent texture/samplers, D3D10, OpenCL,
>> Metal, and potential SPIR-V all do.
>>
>> Roland, could you prepare a patch for llvmpipe, so that it infers from
>> SAMPLE_* opcode count instead of SVIEW for, and therefore unblock Rob?
>>
> 
> fwiw, I've got the three tgsi_transform_shader() cases which insert a
> SAMP updated to insert also an SVIEW if the shader is already using
> SVIEW's.. this should be enough to keep llvmpipe happy without
> changes.  I'll send this plus tgsi.rst update shortly.
Sounds like a plan.


> Going forward, I will have to make u_blitter keep track of
> int/unsigned/float variants (which it seems to do already for msaa
> resolve but not other cases), and similar treatment for some freedreno
> internally generated shaders (used to restore the tile buffer).
> 
>>
>> BTW, even if you avoid intermediate TGSI on GLSL -> NIR, don't you still
>> need to handle TGSI generated by the state tracker? (For things like blits,
>> and mipmap generation, identity shaders, clear shaders, etc)
>>
> 
> yeah..  rough idea was add a 'const void *preferred_ir' to
> pipe_shader_state, which could be NIR or whatever based on
> PIPE_SHADER_CAP_PREFERRED_IR.  Or it could be NULL in which case you
> get tgsi tokens ptr instead and have to call tgsi_to_nir yourself.  I
> didn't see an easy way around that, given u_blitter, other state
> trackers, etc.
> 
> The biggest reason that I expect to want to go straight glsl->nir in
> the future is when nir gains mediump support, since that can be a bit
> perf win on mobile (gles oriented) hw, and it didn't seem like fun to
> have to plumb that through tgsi and tgsi_to_nir..
Yes the untyped register file seems to start to look a bit limiting...
That said, d3d11.1 also supports "true" lower precision values (half
floats were supported in hlsl before but in the low-level assembly that
wasn't visible at all, like all the other types which were just using
untyped 32bit wide registers). I have no idea though how this is
actually represented in the assembly, but this shows it should be
possible to do in some hopefully sane way.

Roland


> 
> BR,
> -R
> 
>>
>> Jose
>>
>>
>>
>> On 10/06/15 21:07, Rob Clark wrote:
>>>
>>> that is starting to look more attractive, mostly just because
>>> tgsi_transform stuff is so cumbersome..
>>>
>>> (I did start thinking about just adding type to decl's in general,
>>> since really it would be better to have for type information for IN's
>>> and OUT's too.. but then decided I'd probably rather spend my time on
>>> support in mesa st to go straight from glsl to nir and bypass tgsi,
>>> rather than going down that rabbit hole)
>>>
>>> BR,
>>> -R
>>>
>>> On Wed, Jun 10, 2015 at 3:51 PM, Marek Olšák  wrote:

 There is also the option of adding the sampler type to either the SAMP
 declaration or texture instructions. This will move us further away
 from adopting SVIEW, but I don't see that happening for OpenGL anyway.

 Marek

 On Wed, Jun 10, 2015 at 8:59 PM, Rob Clark  wrote:
>
> So, afaiu, everything that might insert a sampler is using
> tgsi_transform_shader()?  There aren't too many of those, and I think
> I can fix them up to not violate that constraint.
>
> (It does occur to me that I may end up needing to fix u_blitter to
> differentiate between blitting float vs int to avoid some regressions
> in freedreno, since I'd no longer be using shader variants based on
> bound samplers.. but I guess that is unrelated and a separate patch)
>
> BR,
> -R
>
> On Wed, Jun 10, 2015 at 2:55 PM, Roland Scheidegger 
> wrote:
>>
>> My biggest problem with that is the initial case I saw as a problem:
>> draw is going to modify these shaders in some cases (aaline stage for
>> example), adding its own sampler, and it doesn't know anything about
>> distinguishing shaders with sampler views or without.
>> The same goes for any other potential code which may modify shaders
>> similarly - needs to be modified not just to always use sampler views
>> but use them based on if the incoming shader already uses them or not.
>> Which conceptually looks worse to me. But otherwise I agree this should
>> work.
>>
>> Roland
>>
>>
>> Am 10.06.2015 um 20:30 schrieb Rob Clark:
>>>
>>> Hmm, at least tgsi_text_translate() doesn't appear to use tgsi_ureg..
>>> and there are still a number of users of tgsi_text_translate().. I
>>> guess handling this in tgsi_ureg would avoid fixing all the tgsi_ureg
>>> users, but that still leaves a lot of others.  Changing them all still
>>> seems to be too intrusive to me.
>>>
>>> (And also, I have a large collection of saved tgsi s

Re: [Mesa-dev] COMPSIZE function in OpenGL XML registry

2015-06-10 Thread Jose Fonseca

I'm not sure what you are trying to accomplish.

if you're doing some sort of serialization of OpenGL calls other than 
GLX, then it might be worthwhile to look at


  https://github.com/apitrace/apitrace/blob/master/specs/glapi.py
  https://github.com/apitrace/apitrace/blob/master/helpers/glsize.hpp

Jose

On 10/06/15 23:05, Shervin Sharifi wrote:

Thanks Ian.
If I want to implement the actual CompSize function, how should I figure
out the details?

Thanks,
Shervin

On Wed, Jun 10, 2015 at 2:56 PM, Ian Romanick mailto:i...@freedesktop.org>> wrote:

On 06/10/2015 11:25 AM, Shervin Sharifi wrote:
> Hi,
>
>  This may not be the right forum to ask this, but I didn't know of a
> better forum, so I thought I can ask here.
>
>  I'm new to OpenGL. I am looking at XML registry for OpenGL and there
> are some parameters with attributes containing a function COMPSIZE (I've
> pasted an example below).
>  I tried to find information on what the COMPSIZE function is, where/how
> it is used, etc, but couldn't find documentation or credible information
> on the Internet.
>  Any information or pointer to that would be really helpful.

It's a signal to code generation scripts that the size of the data
referenced by the "pointer" parameter depends on the values of "type"
and "stride".  For example, GLX protocol code uses this to know how much
image data to send to the server for glTexImage2D.

>  Thanks,
> Shervin
>
>
>
> This example is from gl.xml in the OpenGL registry:
>
> 
> void glBinormalPointerEXT
> GLenum
> type
> GLsizei stride
> const void
> *pointer
> 
>
>
 > ___
 > mesa-dev mailing list
 > mesa-dev@lists.freedesktop.org

 > http://lists.freedesktop.org/mailman/listinfo/mesa-dev




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



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


Re: [Mesa-dev] COMPSIZE function in OpenGL XML registry

2015-06-10 Thread Shervin Sharifi
Thanks Ian.
If I want to implement the actual CompSize function, how should I figure
out the details?

Thanks,
   Shervin

On Wed, Jun 10, 2015 at 2:56 PM, Ian Romanick  wrote:

> On 06/10/2015 11:25 AM, Shervin Sharifi wrote:
> > Hi,
> >
> >  This may not be the right forum to ask this, but I didn't know of a
> > better forum, so I thought I can ask here.
> >
> >  I'm new to OpenGL. I am looking at XML registry for OpenGL and there
> > are some parameters with attributes containing a function COMPSIZE (I've
> > pasted an example below).
> >  I tried to find information on what the COMPSIZE function is, where/how
> > it is used, etc, but couldn't find documentation or credible information
> > on the Internet.
> >  Any information or pointer to that would be really helpful.
>
> It's a signal to code generation scripts that the size of the data
> referenced by the "pointer" parameter depends on the values of "type"
> and "stride".  For example, GLX protocol code uses this to know how much
> image data to send to the server for glTexImage2D.
>
> >  Thanks,
> > Shervin
> >
> >
> >
> > This example is from gl.xml in the OpenGL registry:
> >
> > 
> > void glBinormalPointerEXT
> > GLenum
> > type
> > GLsizei stride
> > const void
> > *pointer
> > 
> >
> >
> > ___
> > mesa-dev mailing list
> > mesa-dev@lists.freedesktop.org
> > http://lists.freedesktop.org/mailman/listinfo/mesa-dev
>
>
___
mesa-dev mailing list
mesa-dev@lists.freedesktop.org
http://lists.freedesktop.org/mailman/listinfo/mesa-dev


Re: [Mesa-dev] COMPSIZE function in OpenGL XML registry

2015-06-10 Thread Ian Romanick
On 06/10/2015 11:25 AM, Shervin Sharifi wrote:
> Hi,
>  
>  This may not be the right forum to ask this, but I didn't know of a
> better forum, so I thought I can ask here.
> 
>  I'm new to OpenGL. I am looking at XML registry for OpenGL and there
> are some parameters with attributes containing a function COMPSIZE (I've
> pasted an example below).
>  I tried to find information on what the COMPSIZE function is, where/how
> it is used, etc, but couldn't find documentation or credible information
> on the Internet.
>  Any information or pointer to that would be really helpful. 

It's a signal to code generation scripts that the size of the data
referenced by the "pointer" parameter depends on the values of "type"
and "stride".  For example, GLX protocol code uses this to know how much
image data to send to the server for glTexImage2D.

>  Thanks, 
> Shervin
> 
> 
> 
> This example is from gl.xml in the OpenGL registry:
> 
> 
> void glBinormalPointerEXT
> GLenum
> type
> GLsizei stride
> const void
> *pointer
> 
> 
> 
> ___
> mesa-dev mailing list
> mesa-dev@lists.freedesktop.org
> http://lists.freedesktop.org/mailman/listinfo/mesa-dev

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


[Mesa-dev] [Bug 90927] GLSL extensions are not routed from X-Server to client app

2015-06-10 Thread bugzilla-daemon
https://bugs.freedesktop.org/show_bug.cgi?id=90927

Ian Romanick  changed:

   What|Removed |Added

   Severity|critical|enhancement

--- Comment #1 from Ian Romanick  ---
Extensions need to have GLX protocol supported on the client and on the server.
 For some extensions this just means they need to be added to the
known_gl_extensions in src/glx/glxextensions.c in Mesa.  However, all of the
GLSL related extensions need protocol implemented (e.g., glShaderSource).  It's
mostly just a lot of typing and testing.

Patches welcome.

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


Re: [Mesa-dev] [PATCH 1/2] tgsi: texture types

2015-06-10 Thread Rob Clark
On Wed, Jun 10, 2015 at 5:13 PM, Jose Fonseca  wrote:
> I think it make sense for us to start using SVIEW regardless, and uniformize
> things.
>
>
> Even if GLSL will never support independent texture/samplers, D3D10, OpenCL,
> Metal, and potential SPIR-V all do.
>
> Roland, could you prepare a patch for llvmpipe, so that it infers from
> SAMPLE_* opcode count instead of SVIEW for, and therefore unblock Rob?
>

fwiw, I've got the three tgsi_transform_shader() cases which insert a
SAMP updated to insert also an SVIEW if the shader is already using
SVIEW's.. this should be enough to keep llvmpipe happy without
changes.  I'll send this plus tgsi.rst update shortly.

Going forward, I will have to make u_blitter keep track of
int/unsigned/float variants (which it seems to do already for msaa
resolve but not other cases), and similar treatment for some freedreno
internally generated shaders (used to restore the tile buffer).

>
> BTW, even if you avoid intermediate TGSI on GLSL -> NIR, don't you still
> need to handle TGSI generated by the state tracker? (For things like blits,
> and mipmap generation, identity shaders, clear shaders, etc)
>

yeah..  rough idea was add a 'const void *preferred_ir' to
pipe_shader_state, which could be NIR or whatever based on
PIPE_SHADER_CAP_PREFERRED_IR.  Or it could be NULL in which case you
get tgsi tokens ptr instead and have to call tgsi_to_nir yourself.  I
didn't see an easy way around that, given u_blitter, other state
trackers, etc.

The biggest reason that I expect to want to go straight glsl->nir in
the future is when nir gains mediump support, since that can be a bit
perf win on mobile (gles oriented) hw, and it didn't seem like fun to
have to plumb that through tgsi and tgsi_to_nir..

BR,
-R

>
> Jose
>
>
>
> On 10/06/15 21:07, Rob Clark wrote:
>>
>> that is starting to look more attractive, mostly just because
>> tgsi_transform stuff is so cumbersome..
>>
>> (I did start thinking about just adding type to decl's in general,
>> since really it would be better to have for type information for IN's
>> and OUT's too.. but then decided I'd probably rather spend my time on
>> support in mesa st to go straight from glsl to nir and bypass tgsi,
>> rather than going down that rabbit hole)
>>
>> BR,
>> -R
>>
>> On Wed, Jun 10, 2015 at 3:51 PM, Marek Olšák  wrote:
>>>
>>> There is also the option of adding the sampler type to either the SAMP
>>> declaration or texture instructions. This will move us further away
>>> from adopting SVIEW, but I don't see that happening for OpenGL anyway.
>>>
>>> Marek
>>>
>>> On Wed, Jun 10, 2015 at 8:59 PM, Rob Clark  wrote:

 So, afaiu, everything that might insert a sampler is using
 tgsi_transform_shader()?  There aren't too many of those, and I think
 I can fix them up to not violate that constraint.

 (It does occur to me that I may end up needing to fix u_blitter to
 differentiate between blitting float vs int to avoid some regressions
 in freedreno, since I'd no longer be using shader variants based on
 bound samplers.. but I guess that is unrelated and a separate patch)

 BR,
 -R

 On Wed, Jun 10, 2015 at 2:55 PM, Roland Scheidegger 
 wrote:
>
> My biggest problem with that is the initial case I saw as a problem:
> draw is going to modify these shaders in some cases (aaline stage for
> example), adding its own sampler, and it doesn't know anything about
> distinguishing shaders with sampler views or without.
> The same goes for any other potential code which may modify shaders
> similarly - needs to be modified not just to always use sampler views
> but use them based on if the incoming shader already uses them or not.
> Which conceptually looks worse to me. But otherwise I agree this should
> work.
>
> Roland
>
>
> Am 10.06.2015 um 20:30 schrieb Rob Clark:
>>
>> Hmm, at least tgsi_text_translate() doesn't appear to use tgsi_ureg..
>> and there are still a number of users of tgsi_text_translate().. I
>> guess handling this in tgsi_ureg would avoid fixing all the tgsi_ureg
>> users, but that still leaves a lot of others.  Changing them all still
>> seems to be too intrusive to me.
>>
>> (And also, I have a large collection of saved tgsi shaders that I use
>> for standalone testing of my shader compiler and don't really like the
>> idea of fixing up 700 or 800 tgsi shaders by hand :-P)
>>
>> That said, looking at the code like llvmpipe where Roland/Jose where
>> thinking we might have problems..  by making the assumption that we
>> never mix TEX* and SAMPLE* opc's, I think we can loosen the
>> restriction to:
>>
>>for TEX* instructions, the tgsi must either *not* include SVIEW, or
>> *must* include a matching SVIEW[idx] for every SAMP[idx]
>>
>> Which is a restriction that glsl_to_tgsi follows.
>>
>> If you follow this restriction,

Re: [Mesa-dev] COMPSIZE function in OpenGL XML registry

2015-06-10 Thread Shervin Sharifi
Thank you.
I think there should be a way to calculate the size of the memory location
pointed by that pointer.
For cases where there is no shared memory between the client and the
server, the memory contents should be copied back and forth, which means
the size of the pointer should be known (unless I'm missing something).

Thanks,
  Shervin



On Wed, Jun 10, 2015 at 11:44 AM, Matt Turner  wrote:

> On Wed, Jun 10, 2015 at 11:25 AM, Shervin Sharifi 
> wrote:
> > Hi,
> >
> >  This may not be the right forum to ask this, but I didn't know of a
> better
> > forum, so I thought I can ask here.
> >
> >  I'm new to OpenGL. I am looking at XML registry for OpenGL and there are
> > some parameters with attributes containing a function COMPSIZE (I've
> pasted
> > an example below).
> >  I tried to find information on what the COMPSIZE function is, where/how
> it
> > is used, etc, but couldn't find documentation or credible information on
> the
> > Internet.
> >  Any information or pointer to that would be really helpful.
> >
> >  Thanks,
> > Shervin
> >
> >
> >
> > This example is from gl.xml in the OpenGL registry:
> >
> > 
> > void glBinormalPointerEXT
> > GLenum
> > type
> > GLsizei stride
> > const void
> > *pointer
> > 
>
> I'm just speculating, but I don't think there's really a definition of
> COMPSIZE or anything. I think it's just a way of saying that, for
> instance, the size of the memory pointed by the "pointer" parameter to
> glBinormalPointerEXT is a function of the "type" and "stride"
> parameters.
>
> Other functions, like glBitmap have similar things:
>
> const
> GLubyte *bitmap
>
> That is, the size of the block of memory pointed to by "bitmap" is
> described by the "width" and "height" parameters.
>
___
mesa-dev mailing list
mesa-dev@lists.freedesktop.org
http://lists.freedesktop.org/mailman/listinfo/mesa-dev


Re: [Mesa-dev] [PATCH 1/2] tgsi: texture types

2015-06-10 Thread Jose Fonseca
I think it make sense for us to start using SVIEW regardless, and 
uniformize things.



Even if GLSL will never support independent texture/samplers, D3D10, 
OpenCL, Metal, and potential SPIR-V all do.


Roland, could you prepare a patch for llvmpipe, so that it infers from 
SAMPLE_* opcode count instead of SVIEW for, and therefore unblock Rob?



BTW, even if you avoid intermediate TGSI on GLSL -> NIR, don't you still 
need to handle TGSI generated by the state tracker? (For things like 
blits, and mipmap generation, identity shaders, clear shaders, etc)



Jose


On 10/06/15 21:07, Rob Clark wrote:

that is starting to look more attractive, mostly just because
tgsi_transform stuff is so cumbersome..

(I did start thinking about just adding type to decl's in general,
since really it would be better to have for type information for IN's
and OUT's too.. but then decided I'd probably rather spend my time on
support in mesa st to go straight from glsl to nir and bypass tgsi,
rather than going down that rabbit hole)

BR,
-R

On Wed, Jun 10, 2015 at 3:51 PM, Marek Olšák  wrote:

There is also the option of adding the sampler type to either the SAMP
declaration or texture instructions. This will move us further away
from adopting SVIEW, but I don't see that happening for OpenGL anyway.

Marek

On Wed, Jun 10, 2015 at 8:59 PM, Rob Clark  wrote:

So, afaiu, everything that might insert a sampler is using
tgsi_transform_shader()?  There aren't too many of those, and I think
I can fix them up to not violate that constraint.

(It does occur to me that I may end up needing to fix u_blitter to
differentiate between blitting float vs int to avoid some regressions
in freedreno, since I'd no longer be using shader variants based on
bound samplers.. but I guess that is unrelated and a separate patch)

BR,
-R

On Wed, Jun 10, 2015 at 2:55 PM, Roland Scheidegger  wrote:

My biggest problem with that is the initial case I saw as a problem:
draw is going to modify these shaders in some cases (aaline stage for
example), adding its own sampler, and it doesn't know anything about
distinguishing shaders with sampler views or without.
The same goes for any other potential code which may modify shaders
similarly - needs to be modified not just to always use sampler views
but use them based on if the incoming shader already uses them or not.
Which conceptually looks worse to me. But otherwise I agree this should
work.

Roland


Am 10.06.2015 um 20:30 schrieb Rob Clark:

Hmm, at least tgsi_text_translate() doesn't appear to use tgsi_ureg..
and there are still a number of users of tgsi_text_translate().. I
guess handling this in tgsi_ureg would avoid fixing all the tgsi_ureg
users, but that still leaves a lot of others.  Changing them all still
seems to be too intrusive to me.

(And also, I have a large collection of saved tgsi shaders that I use
for standalone testing of my shader compiler and don't really like the
idea of fixing up 700 or 800 tgsi shaders by hand :-P)

That said, looking at the code like llvmpipe where Roland/Jose where
thinking we might have problems..  by making the assumption that we
never mix TEX* and SAMPLE* opc's, I think we can loosen the
restriction to:

   for TEX* instructions, the tgsi must either *not* include SVIEW, or
*must* include a matching SVIEW[idx] for every SAMP[idx]

Which is a restriction that glsl_to_tgsi follows.

If you follow this restriction, then for TEX* shaders which have
SVIEW's, file_max[TGSI_FILE_SAMPLER_VIEW] ==
file_max[TGSI_FILE_SAMPLER] and file_mask[TGSI_FILE_SAMPLER_VIEW] ==
file_mask[TGSI_FILE_SAMPLER].. so code takes a different but
equivalent path.   And for TEX* shaders which don't have SVIEW's
everything continues to work as before.

With this approach, we don't have to fix up everything to create
SVIEW[idx] for every SAMP[idx], as long as glsl_to_tgsi always creates
SVIEW[idx] for each SAMP[idx], and any other tgsi generator that later
adds SVIEW support for TEX* instructions follows the same pattern.

So, tl;dr: I think really all I need to add to this patch is add blurb
in tgsi.rst to explain this restriction and usage of SVIEW for TEX*

Thoughts?

BR,
-R

On Tue, Jun 9, 2015 at 1:20 PM, Marek Olšák  wrote:

If you only want to modify TGSI and not all the users, you only have
to fix tgsi_ureg. tgsi_ureg is a layer that can hide a lot of small
ugly details if needed, including sampler view declarations when the
users don't even know about them.

Marek





On Tue, Jun 9, 2015 at 6:01 PM, Rob Clark  wrote:

On Tue, Jun 9, 2015 at 9:32 AM, Roland Scheidegger  wrote:

Am 09.06.2015 um 15:00 schrieb Rob Clark:

On Tue, Jun 9, 2015 at 5:01 AM, Jose Fonseca  wrote:

On 09/06/15 04:03, Rob Clark wrote:


On Mon, Jun 8, 2015 at 10:50 PM, Roland Scheidegger 
wrote:


Am 09.06.2015 um 04:40 schrieb Rob Clark:


On Mon, Jun 8, 2015 at 10:36 PM, Roland Scheidegger 
wrote:


Am 09.06.2015 um 04:20 schrieb Rob Clark:


On Mon, Jun 8, 2015 at 9:40 PM, Roland Scheidegger
 wrote:


Am 0

Re: [Mesa-dev] [PATCH 4/4] drisw/glx: use XShm if possible

2015-06-10 Thread Adam Jackson
On Wed, 2015-06-10 at 18:08 +0200, Marc-André Lureau wrote:

> +   if (!xshm_error && shmid >= 0) {
> +  pdp->shminfo.shmid = shmid;
> +  pdp->ximage = XShmCreateImage(dpy,
> +pdp->visinfo->visual,
> +pdp->visinfo->depth,
> +ZPixmap,  /* format */
> +NULL, /* data */
> +&pdp->shminfo,/* shminfo */
> +0, 0);/* width, height */
> +  if (pdp->ximage == NULL) {
> + int (*old_handler)(Display *, XErrorEvent *);
> +
> + /* dispatch pending errors */
> + XSync(dpy, False);
> +
> + old_handler = XSetErrorHandler(handle_xerror);
> + /* This may trigger the X protocol error we're ready to catch: */
> + XShmAttach(dpy, &pdp->shminfo);
> + XSync(dpy, False);
> 

Telling the server to attach the image only if creating it failed ain't
gonna work too great:

X Error of failed request:  BadShmSeg (invalid shared segment
parameter)
  Major opcode of failed request:  130 (MIT-SHM)
  Minor opcode of failed request:  3 (X_ShmPutImage)
  Segment id in failed request:  0x1a5
  Serial number of failed request:  31
  Current serial number in output stream:  32

But with the == changed to !=, this does seem to work! Under
(accelerated) gnome-shell, llvmpipe gears gets around 1280fps at its
default window size and 110 fullscreen, compared to about 1110 and 40
with PutImage, respectively. Nice one.

PutImage's semantics are that when it returns the app owns the image
data again: the image has been either copied into xlib's request buffer
or written to the socket. Not so ShmPutImage, which just enqueues the
request and lets the server pick the data up whenever. So it's
possible, if we dirty the front buffer before xserver finishes the
ShmPutImage, that we'd see an inconsistent screen state for a moment.
So I think this wants an XSync after XShmPutImage (which dings windowed
fps by ~50 but doesn't seem to bother fullscreen at all).

With those two things fixed, the series is:

Reviewed-by: Adam Jackson 

Any chance you feel like trying the same trick with ShmGetImage and
EXT_texture_from_pixmap?

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


Re: [Mesa-dev] [PATCH] i965/fs: Remove one more fixed brw_null_reg() from the visitor.

2015-06-10 Thread Jason Ekstrand
LGTM

Reviewed-by: Jason Ekstrand 
On Jun 10, 2015 7:39 AM, "Francisco Jerez"  wrote:

> Instead use fs_builder::null_reg_f() which has the correct register
> width.  Avoids the assertion failure in fs_builder::emit() hit by the
> "ES3-CTS.shaders.loops.for_dynamic_iterations.unconditional_break_fragment"
> GLES3 conformance test introduced by
> 4af4cfba9ee1014baa4a777660fc9d53d57e4c82.
>
> Reported-and-reviewed-by: Tapani Pälli 
> ---
>  src/mesa/drivers/dri/i965/brw_fs.cpp | 2 +-
>  1 file changed, 1 insertion(+), 1 deletion(-)
>
> diff --git a/src/mesa/drivers/dri/i965/brw_fs.cpp
> b/src/mesa/drivers/dri/i965/brw_fs.cpp
> index 7789ca7..5563c5a 100644
> --- a/src/mesa/drivers/dri/i965/brw_fs.cpp
> +++ b/src/mesa/drivers/dri/i965/brw_fs.cpp
> @@ -3234,7 +3234,7 @@ fs_visitor::lower_integer_multiplication()
>   ibld.ADD(dst, low, high);
>
>   if (inst->conditional_mod) {
> -fs_reg null(retype(brw_null_reg(), inst->dst.type));
> +fs_reg null(retype(ibld.null_reg_f(), inst->dst.type));
>  set_condmod(inst->conditional_mod,
>  ibld.MOV(null, inst->dst));
>   }
> --
> 2.3.5
>
> ___
> mesa-dev mailing list
> mesa-dev@lists.freedesktop.org
> http://lists.freedesktop.org/mailman/listinfo/mesa-dev
>
___
mesa-dev mailing list
mesa-dev@lists.freedesktop.org
http://lists.freedesktop.org/mailman/listinfo/mesa-dev


Re: [Mesa-dev] [PATCH] i965: Momentarily pretend to support ARB_texture_stencil8 for blits.

2015-06-10 Thread Jason Ekstrand
On Jun 10, 2015 9:57 AM, "Neil Roberts"  wrote:
>
> Kenneth Graunke  writes:
>
> > _mesa_meta_fb_tex_blit_begin(ctx, &blit);
> > +   ctx->Extensions.ARB_texture_stencil8 = true;
>
> Maybe you could put assert(ctx->Extensions.ARB_texture_stencil8==false)
> just before setting it to true so that we'll definitely remember to
> remove it if we eventually enable the extension. Otherwise as it stands
> if we forget about this it would probably not break any tests but the
> extension would mysteriously disable itself and no-one would notice
> because they would probably check the extensions just once upfront.

I'll second that of it's not already pushed.

> - Neil
> ___
> mesa-dev mailing list
> mesa-dev@lists.freedesktop.org
> http://lists.freedesktop.org/mailman/listinfo/mesa-dev
___
mesa-dev mailing list
mesa-dev@lists.freedesktop.org
http://lists.freedesktop.org/mailman/listinfo/mesa-dev


Re: [Mesa-dev] [PATCH 1/2] tgsi: texture types

2015-06-10 Thread Rob Clark
that is starting to look more attractive, mostly just because
tgsi_transform stuff is so cumbersome..

(I did start thinking about just adding type to decl's in general,
since really it would be better to have for type information for IN's
and OUT's too.. but then decided I'd probably rather spend my time on
support in mesa st to go straight from glsl to nir and bypass tgsi,
rather than going down that rabbit hole)

BR,
-R

On Wed, Jun 10, 2015 at 3:51 PM, Marek Olšák  wrote:
> There is also the option of adding the sampler type to either the SAMP
> declaration or texture instructions. This will move us further away
> from adopting SVIEW, but I don't see that happening for OpenGL anyway.
>
> Marek
>
> On Wed, Jun 10, 2015 at 8:59 PM, Rob Clark  wrote:
>> So, afaiu, everything that might insert a sampler is using
>> tgsi_transform_shader()?  There aren't too many of those, and I think
>> I can fix them up to not violate that constraint.
>>
>> (It does occur to me that I may end up needing to fix u_blitter to
>> differentiate between blitting float vs int to avoid some regressions
>> in freedreno, since I'd no longer be using shader variants based on
>> bound samplers.. but I guess that is unrelated and a separate patch)
>>
>> BR,
>> -R
>>
>> On Wed, Jun 10, 2015 at 2:55 PM, Roland Scheidegger  
>> wrote:
>>> My biggest problem with that is the initial case I saw as a problem:
>>> draw is going to modify these shaders in some cases (aaline stage for
>>> example), adding its own sampler, and it doesn't know anything about
>>> distinguishing shaders with sampler views or without.
>>> The same goes for any other potential code which may modify shaders
>>> similarly - needs to be modified not just to always use sampler views
>>> but use them based on if the incoming shader already uses them or not.
>>> Which conceptually looks worse to me. But otherwise I agree this should
>>> work.
>>>
>>> Roland
>>>
>>>
>>> Am 10.06.2015 um 20:30 schrieb Rob Clark:
 Hmm, at least tgsi_text_translate() doesn't appear to use tgsi_ureg..
 and there are still a number of users of tgsi_text_translate().. I
 guess handling this in tgsi_ureg would avoid fixing all the tgsi_ureg
 users, but that still leaves a lot of others.  Changing them all still
 seems to be too intrusive to me.

 (And also, I have a large collection of saved tgsi shaders that I use
 for standalone testing of my shader compiler and don't really like the
 idea of fixing up 700 or 800 tgsi shaders by hand :-P)

 That said, looking at the code like llvmpipe where Roland/Jose where
 thinking we might have problems..  by making the assumption that we
 never mix TEX* and SAMPLE* opc's, I think we can loosen the
 restriction to:

   for TEX* instructions, the tgsi must either *not* include SVIEW, or
 *must* include a matching SVIEW[idx] for every SAMP[idx]

 Which is a restriction that glsl_to_tgsi follows.

 If you follow this restriction, then for TEX* shaders which have
 SVIEW's, file_max[TGSI_FILE_SAMPLER_VIEW] ==
 file_max[TGSI_FILE_SAMPLER] and file_mask[TGSI_FILE_SAMPLER_VIEW] ==
 file_mask[TGSI_FILE_SAMPLER].. so code takes a different but
 equivalent path.   And for TEX* shaders which don't have SVIEW's
 everything continues to work as before.

 With this approach, we don't have to fix up everything to create
 SVIEW[idx] for every SAMP[idx], as long as glsl_to_tgsi always creates
 SVIEW[idx] for each SAMP[idx], and any other tgsi generator that later
 adds SVIEW support for TEX* instructions follows the same pattern.

 So, tl;dr: I think really all I need to add to this patch is add blurb
 in tgsi.rst to explain this restriction and usage of SVIEW for TEX*

 Thoughts?

 BR,
 -R

 On Tue, Jun 9, 2015 at 1:20 PM, Marek Olšák  wrote:
> If you only want to modify TGSI and not all the users, you only have
> to fix tgsi_ureg. tgsi_ureg is a layer that can hide a lot of small
> ugly details if needed, including sampler view declarations when the
> users don't even know about them.
>
> Marek
>
>
>
>
>
> On Tue, Jun 9, 2015 at 6:01 PM, Rob Clark  wrote:
>> On Tue, Jun 9, 2015 at 9:32 AM, Roland Scheidegger  
>> wrote:
>>> Am 09.06.2015 um 15:00 schrieb Rob Clark:
 On Tue, Jun 9, 2015 at 5:01 AM, Jose Fonseca  
 wrote:
> On 09/06/15 04:03, Rob Clark wrote:
>>
>> On Mon, Jun 8, 2015 at 10:50 PM, Roland Scheidegger 
>> 
>> wrote:
>>>
>>> Am 09.06.2015 um 04:40 schrieb Rob Clark:

 On Mon, Jun 8, 2015 at 10:36 PM, Roland Scheidegger 
 
 wrote:
>
> Am 09.06.2015 um 04:20 schrieb Rob Clark:
>>
>> On Mon, Jun 8, 2015 at 9:40 PM, Roland Scheidegger
>>  wrote:
>>>
>>>

Re: [Mesa-dev] [PATCH] mesa: set override_version per api version override

2015-06-10 Thread Jordan Justen
Whoops. I re-wrote this last night:

http://cgit.freedesktop.org/~jljusten/mesa/commit/?h=cs-33&id=3ebe7b79

On 2015-06-04 21:41:15, Tapani Pälli wrote:
> Before 9b5e92f get_gl_override was called only once, but now it is
> called for multiple APIs (GLES2, GL), version needs to be set always.
> 
> Signed-off-by: Tapani Pälli 
> Bugzilla: https://bugs.freedesktop.org/show_bug.cgi?id=90797
> ---
>  src/mesa/main/version.c | 36 ++--
>  1 file changed, 22 insertions(+), 14 deletions(-)
> 
> diff --git a/src/mesa/main/version.c b/src/mesa/main/version.c
> index 409e5ae..5e9943c 100644
> --- a/src/mesa/main/version.c
> +++ b/src/mesa/main/version.c
> @@ -58,34 +58,42 @@ get_gl_override(gl_api api, int *version, bool 
> *fwd_context,
>? "MESA_GL_VERSION_OVERRIDE" : "MESA_GLES_VERSION_OVERRIDE";
> const char *version_str;
> int major, minor, n;
> -   static int override_version = -1;
> -   static bool fc_suffix = false;
> -   static bool compat_suffix = false;
> +   static struct override_info {
> +  int version;
> +  bool fc_suffix;
> +  bool compat_suffix;
> +   } override[API_OPENGL_LAST + 1] = {
> +  { -1, false, false},
> +  { -1, false, false},
> +  { -1, false, false},
> +  { -1, false, false},
> +   };

I did this a bit differently. Rather than one for each API, I had one
per override env var.

If you think once per API is preferable, how about these changes to
your patch:

   override[API_OPENGL_LAST + 1] => override[]

   STATIC_ASSERT(ARRAY_SIZE(override) == API_OPENGL_LAST + 1);

-Jordan

> if (api == API_OPENGLES)
>return;
>  
> -   if (override_version < 0) {
> -  override_version = 0;
> +   if (override[api].version < 0) {
> +  override[api].version = 0;
>  
>version_str = getenv(env_var);
>if (version_str) {
> - fc_suffix = check_for_ending(version_str, "FC");
> - compat_suffix = check_for_ending(version_str, "COMPAT");
> + override[api].fc_suffix = check_for_ending(version_str, "FC");
> + override[api].compat_suffix = check_for_ending(version_str, 
> "COMPAT");
>  
>   n = sscanf(version_str, "%u.%u", &major, &minor);
>   if (n != 2) {
>  fprintf(stderr, "error: invalid value for %s: %s\n",
>  env_var, version_str);
> -override_version = 0;
> +override[api].version = 0;
>   } else {
> -override_version = major * 10 + minor;
> +override[api].version = major * 10 + minor;
>  
>  /* There is no such thing as compatibility or forward-compatible 
> for
>   * OpenGL ES 2.0 or 3.x APIs.
>   */
> -if ((override_version < 30 && fc_suffix) ||
> -(api == API_OPENGLES2 && (fc_suffix || compat_suffix))) {
> +if ((override[api].version < 30 && override[api].fc_suffix) ||
> +(api == API_OPENGLES2 && (override[api].fc_suffix ||
> +  override[api].compat_suffix))) {
> fprintf(stderr, "error: invalid value for %s: %s\n",
> env_var, version_str);
>  }
> @@ -93,9 +101,9 @@ get_gl_override(gl_api api, int *version, bool 
> *fwd_context,
>}
> }
>  
> -   *version = override_version;
> -   *fwd_context = fc_suffix;
> -   *compat_context = compat_suffix;
> +   *version = override[api].version;
> +   *fwd_context = override[api].fc_suffix;
> +   *compat_context = override[api].compat_suffix;
>  }
>  
>  /**
> -- 
> 2.1.0
> 
> ___
> mesa-dev mailing list
> mesa-dev@lists.freedesktop.org
> http://lists.freedesktop.org/mailman/listinfo/mesa-dev
___
mesa-dev mailing list
mesa-dev@lists.freedesktop.org
http://lists.freedesktop.org/mailman/listinfo/mesa-dev


Re: [Mesa-dev] [PATCH 1/2] tgsi: texture types

2015-06-10 Thread Marek Olšák
There is also the option of adding the sampler type to either the SAMP
declaration or texture instructions. This will move us further away
from adopting SVIEW, but I don't see that happening for OpenGL anyway.

Marek

On Wed, Jun 10, 2015 at 8:59 PM, Rob Clark  wrote:
> So, afaiu, everything that might insert a sampler is using
> tgsi_transform_shader()?  There aren't too many of those, and I think
> I can fix them up to not violate that constraint.
>
> (It does occur to me that I may end up needing to fix u_blitter to
> differentiate between blitting float vs int to avoid some regressions
> in freedreno, since I'd no longer be using shader variants based on
> bound samplers.. but I guess that is unrelated and a separate patch)
>
> BR,
> -R
>
> On Wed, Jun 10, 2015 at 2:55 PM, Roland Scheidegger  
> wrote:
>> My biggest problem with that is the initial case I saw as a problem:
>> draw is going to modify these shaders in some cases (aaline stage for
>> example), adding its own sampler, and it doesn't know anything about
>> distinguishing shaders with sampler views or without.
>> The same goes for any other potential code which may modify shaders
>> similarly - needs to be modified not just to always use sampler views
>> but use them based on if the incoming shader already uses them or not.
>> Which conceptually looks worse to me. But otherwise I agree this should
>> work.
>>
>> Roland
>>
>>
>> Am 10.06.2015 um 20:30 schrieb Rob Clark:
>>> Hmm, at least tgsi_text_translate() doesn't appear to use tgsi_ureg..
>>> and there are still a number of users of tgsi_text_translate().. I
>>> guess handling this in tgsi_ureg would avoid fixing all the tgsi_ureg
>>> users, but that still leaves a lot of others.  Changing them all still
>>> seems to be too intrusive to me.
>>>
>>> (And also, I have a large collection of saved tgsi shaders that I use
>>> for standalone testing of my shader compiler and don't really like the
>>> idea of fixing up 700 or 800 tgsi shaders by hand :-P)
>>>
>>> That said, looking at the code like llvmpipe where Roland/Jose where
>>> thinking we might have problems..  by making the assumption that we
>>> never mix TEX* and SAMPLE* opc's, I think we can loosen the
>>> restriction to:
>>>
>>>   for TEX* instructions, the tgsi must either *not* include SVIEW, or
>>> *must* include a matching SVIEW[idx] for every SAMP[idx]
>>>
>>> Which is a restriction that glsl_to_tgsi follows.
>>>
>>> If you follow this restriction, then for TEX* shaders which have
>>> SVIEW's, file_max[TGSI_FILE_SAMPLER_VIEW] ==
>>> file_max[TGSI_FILE_SAMPLER] and file_mask[TGSI_FILE_SAMPLER_VIEW] ==
>>> file_mask[TGSI_FILE_SAMPLER].. so code takes a different but
>>> equivalent path.   And for TEX* shaders which don't have SVIEW's
>>> everything continues to work as before.
>>>
>>> With this approach, we don't have to fix up everything to create
>>> SVIEW[idx] for every SAMP[idx], as long as glsl_to_tgsi always creates
>>> SVIEW[idx] for each SAMP[idx], and any other tgsi generator that later
>>> adds SVIEW support for TEX* instructions follows the same pattern.
>>>
>>> So, tl;dr: I think really all I need to add to this patch is add blurb
>>> in tgsi.rst to explain this restriction and usage of SVIEW for TEX*
>>>
>>> Thoughts?
>>>
>>> BR,
>>> -R
>>>
>>> On Tue, Jun 9, 2015 at 1:20 PM, Marek Olšák  wrote:
 If you only want to modify TGSI and not all the users, you only have
 to fix tgsi_ureg. tgsi_ureg is a layer that can hide a lot of small
 ugly details if needed, including sampler view declarations when the
 users don't even know about them.

 Marek





 On Tue, Jun 9, 2015 at 6:01 PM, Rob Clark  wrote:
> On Tue, Jun 9, 2015 at 9:32 AM, Roland Scheidegger  
> wrote:
>> Am 09.06.2015 um 15:00 schrieb Rob Clark:
>>> On Tue, Jun 9, 2015 at 5:01 AM, Jose Fonseca  
>>> wrote:
 On 09/06/15 04:03, Rob Clark wrote:
>
> On Mon, Jun 8, 2015 at 10:50 PM, Roland Scheidegger 
> 
> wrote:
>>
>> Am 09.06.2015 um 04:40 schrieb Rob Clark:
>>>
>>> On Mon, Jun 8, 2015 at 10:36 PM, Roland Scheidegger 
>>> 
>>> wrote:

 Am 09.06.2015 um 04:20 schrieb Rob Clark:
>
> On Mon, Jun 8, 2015 at 9:40 PM, Roland Scheidegger
>  wrote:
>>
>> Am 09.06.2015 um 03:20 schrieb Rob Clark:
>>>
>>> On Mon, Jun 8, 2015 at 8:35 PM, Roland Scheidegger
>>>  wrote:

 Am 08.06.2015 um 20:15 schrieb Rob Clark:
>
> From: Rob Clark 
>
> Freedreno needs sampler type information to deal with int/uint
> textures.
> To accomplish this, start creating sampler-view declarations, 
> as
> suggested here:
>
>
>>>

Re: [Mesa-dev] [PATCH] i965/fs_live_variables: Do liveness analysis bottom-to-top

2015-06-10 Thread Matt Turner
On Mon, Jun 8, 2015 at 4:44 PM, Jason Ekstrand  wrote:
> Generally, liveness information propagates up the program, not down.

I'd replace this with an actual quote from the cited text:

"To determine which variables are live at each point in a flowgraph,
we perform a backward data-flow analysis"

> Previously, we were walking the blocks forwards and updating the livein and
> then the liveout.  However, the livein calculation depends on the liveout
> and the liveout depends on the successor blocks.  The net result is that it
> takes one full iteration to go from liveout to livein and then another
> full iteration to propagate to the predecessors.  This works out to an
> O(n^2) computation where n is the number of blocks.  If we run things in
> the other order, it's O(nl) where l is the maximum loop depth which is
> practically bounded by 3.
>
> This seems to shave about 5s off the compile timem of one particular
> shadertoy shader.

typo: time

I'd mention the absolute times as well. Extra points for collecting
actual numbers and using ministat.

> ---
>  .../drivers/dri/i965/brw_fs_live_variables.cpp | 38 
> +++---
>  1 file changed, 19 insertions(+), 19 deletions(-)
>
> diff --git a/src/mesa/drivers/dri/i965/brw_fs_live_variables.cpp 
> b/src/mesa/drivers/dri/i965/brw_fs_live_variables.cpp
> index 502161d..f683a0d 100644
> --- a/src/mesa/drivers/dri/i965/brw_fs_live_variables.cpp
> +++ b/src/mesa/drivers/dri/i965/brw_fs_live_variables.cpp
> @@ -204,27 +204,9 @@ fs_live_variables::compute_live_variables()
> while (cont) {
>cont = false;
>
> -  foreach_block (block, cfg) {
> +  foreach_block_reverse (block, cfg) {

Ken didn't like me putting a space between the macro name and the (.
You could make him happy by removing it when you have the chance. :)

>   struct block_data *bd = &block_data[block->num];
>
> -/* Update livein */
> -for (int i = 0; i < bitset_words; i++) {
> -BITSET_WORD new_livein = (bd->use[i] |
> -  (bd->liveout[i] &
> -   ~bd->def[i]));
> -   if (new_livein & ~bd->livein[i]) {
> -   bd->livein[i] |= new_livein;
> -   cont = true;
> -   }
> -}
> - BITSET_WORD new_livein = (bd->flag_use[0] |
> -   (bd->flag_liveout[0] &
> -~bd->flag_def[0]));
> - if (new_livein & ~bd->flag_livein[0]) {
> -bd->flag_livein[0] |= new_livein;
> -cont = true;
> - }
> -
>  /* Update liveout */
>  foreach_list_typed(bblock_link, child_link, link, &block->children) {
>  struct block_data *child_bd = 
> &block_data[child_link->block->num];
> @@ -244,6 +226,24 @@ fs_live_variables::compute_live_variables()
> cont = true;
>  }
>  }
> +
> +/* Update livein */
> +for (int i = 0; i < bitset_words; i++) {
> +BITSET_WORD new_livein = (bd->use[i] |
> +  (bd->liveout[i] &
> +   ~bd->def[i]));
> +   if (new_livein & ~bd->livein[i]) {
> +   bd->livein[i] |= new_livein;
> +   cont = true;
> +   }
> +}

There are some tabs in the lines your moving, and this line's
indentation is messed up. Fix those while you're here.

> + BITSET_WORD new_livein = (bd->flag_use[0] |
> +   (bd->flag_liveout[0] &
> +~bd->flag_def[0]));
> + if (new_livein & ~bd->flag_livein[0]) {
> +bd->flag_livein[0] |= new_livein;
> +cont = true;
> + }
>}
> }
>  }
> --

With those comments addressed,

Reviewed-by: Matt Turner 
___
mesa-dev mailing list
mesa-dev@lists.freedesktop.org
http://lists.freedesktop.org/mailman/listinfo/mesa-dev


Re: [Mesa-dev] [PATCH 1/2] tgsi: texture types

2015-06-10 Thread Ilia Mirkin
I'll admit to not having followed the conversation *too* closely, but
just want to point out that nouveau has its own blitter implementation
(which has the advantage of actually working for stencil given some
reasonable assumptions about formats), please don't break it. [The
downside of it is that it doesn't actually work for MS... fixing it is
*very* far down on my list, since it *mostly* works for MS... but it
doesn't end up resolving in anything resembling a conformant manner.]
This is all in nv50_surface.c (which nvc0 uses as well).

On Wed, Jun 10, 2015 at 2:59 PM, Rob Clark  wrote:
> So, afaiu, everything that might insert a sampler is using
> tgsi_transform_shader()?  There aren't too many of those, and I think
> I can fix them up to not violate that constraint.
>
> (It does occur to me that I may end up needing to fix u_blitter to
> differentiate between blitting float vs int to avoid some regressions
> in freedreno, since I'd no longer be using shader variants based on
> bound samplers.. but I guess that is unrelated and a separate patch)
>
> BR,
> -R
>
> On Wed, Jun 10, 2015 at 2:55 PM, Roland Scheidegger  
> wrote:
>> My biggest problem with that is the initial case I saw as a problem:
>> draw is going to modify these shaders in some cases (aaline stage for
>> example), adding its own sampler, and it doesn't know anything about
>> distinguishing shaders with sampler views or without.
>> The same goes for any other potential code which may modify shaders
>> similarly - needs to be modified not just to always use sampler views
>> but use them based on if the incoming shader already uses them or not.
>> Which conceptually looks worse to me. But otherwise I agree this should
>> work.
>>
>> Roland
>>
>>
>> Am 10.06.2015 um 20:30 schrieb Rob Clark:
>>> Hmm, at least tgsi_text_translate() doesn't appear to use tgsi_ureg..
>>> and there are still a number of users of tgsi_text_translate().. I
>>> guess handling this in tgsi_ureg would avoid fixing all the tgsi_ureg
>>> users, but that still leaves a lot of others.  Changing them all still
>>> seems to be too intrusive to me.
>>>
>>> (And also, I have a large collection of saved tgsi shaders that I use
>>> for standalone testing of my shader compiler and don't really like the
>>> idea of fixing up 700 or 800 tgsi shaders by hand :-P)
>>>
>>> That said, looking at the code like llvmpipe where Roland/Jose where
>>> thinking we might have problems..  by making the assumption that we
>>> never mix TEX* and SAMPLE* opc's, I think we can loosen the
>>> restriction to:
>>>
>>>   for TEX* instructions, the tgsi must either *not* include SVIEW, or
>>> *must* include a matching SVIEW[idx] for every SAMP[idx]
>>>
>>> Which is a restriction that glsl_to_tgsi follows.
>>>
>>> If you follow this restriction, then for TEX* shaders which have
>>> SVIEW's, file_max[TGSI_FILE_SAMPLER_VIEW] ==
>>> file_max[TGSI_FILE_SAMPLER] and file_mask[TGSI_FILE_SAMPLER_VIEW] ==
>>> file_mask[TGSI_FILE_SAMPLER].. so code takes a different but
>>> equivalent path.   And for TEX* shaders which don't have SVIEW's
>>> everything continues to work as before.
>>>
>>> With this approach, we don't have to fix up everything to create
>>> SVIEW[idx] for every SAMP[idx], as long as glsl_to_tgsi always creates
>>> SVIEW[idx] for each SAMP[idx], and any other tgsi generator that later
>>> adds SVIEW support for TEX* instructions follows the same pattern.
>>>
>>> So, tl;dr: I think really all I need to add to this patch is add blurb
>>> in tgsi.rst to explain this restriction and usage of SVIEW for TEX*
>>>
>>> Thoughts?
>>>
>>> BR,
>>> -R
>>>
>>> On Tue, Jun 9, 2015 at 1:20 PM, Marek Olšák  wrote:
 If you only want to modify TGSI and not all the users, you only have
 to fix tgsi_ureg. tgsi_ureg is a layer that can hide a lot of small
 ugly details if needed, including sampler view declarations when the
 users don't even know about them.

 Marek





 On Tue, Jun 9, 2015 at 6:01 PM, Rob Clark  wrote:
> On Tue, Jun 9, 2015 at 9:32 AM, Roland Scheidegger  
> wrote:
>> Am 09.06.2015 um 15:00 schrieb Rob Clark:
>>> On Tue, Jun 9, 2015 at 5:01 AM, Jose Fonseca  
>>> wrote:
 On 09/06/15 04:03, Rob Clark wrote:
>
> On Mon, Jun 8, 2015 at 10:50 PM, Roland Scheidegger 
> 
> wrote:
>>
>> Am 09.06.2015 um 04:40 schrieb Rob Clark:
>>>
>>> On Mon, Jun 8, 2015 at 10:36 PM, Roland Scheidegger 
>>> 
>>> wrote:

 Am 09.06.2015 um 04:20 schrieb Rob Clark:
>
> On Mon, Jun 8, 2015 at 9:40 PM, Roland Scheidegger
>  wrote:
>>
>> Am 09.06.2015 um 03:20 schrieb Rob Clark:
>>>
>>> On Mon, Jun 8, 2015 at 8:35 PM, Roland Scheidegger
>>>  wrote:

 Am 08.06.2015 um 20:15 schrieb Rob Clark:
>
> F

Re: [Mesa-dev] [PATCH 1/2] tgsi: texture types

2015-06-10 Thread Roland Scheidegger
Yes, I think nowadays everybody uses tgsi_transform_shader() to do that,
so that should probably work.

Roland

Am 10.06.2015 um 20:59 schrieb Rob Clark:
> So, afaiu, everything that might insert a sampler is using
> tgsi_transform_shader()?  There aren't too many of those, and I think
> I can fix them up to not violate that constraint.
> 
> (It does occur to me that I may end up needing to fix u_blitter to
> differentiate between blitting float vs int to avoid some regressions
> in freedreno, since I'd no longer be using shader variants based on
> bound samplers.. but I guess that is unrelated and a separate patch)
> 
> BR,
> -R
> 
> On Wed, Jun 10, 2015 at 2:55 PM, Roland Scheidegger  
> wrote:
>> My biggest problem with that is the initial case I saw as a problem:
>> draw is going to modify these shaders in some cases (aaline stage for
>> example), adding its own sampler, and it doesn't know anything about
>> distinguishing shaders with sampler views or without.
>> The same goes for any other potential code which may modify shaders
>> similarly - needs to be modified not just to always use sampler views
>> but use them based on if the incoming shader already uses them or not.
>> Which conceptually looks worse to me. But otherwise I agree this should
>> work.
>>
>> Roland
>>
>>
>> Am 10.06.2015 um 20:30 schrieb Rob Clark:
>>> Hmm, at least tgsi_text_translate() doesn't appear to use tgsi_ureg..
>>> and there are still a number of users of tgsi_text_translate().. I
>>> guess handling this in tgsi_ureg would avoid fixing all the tgsi_ureg
>>> users, but that still leaves a lot of others.  Changing them all still
>>> seems to be too intrusive to me.
>>>
>>> (And also, I have a large collection of saved tgsi shaders that I use
>>> for standalone testing of my shader compiler and don't really like the
>>> idea of fixing up 700 or 800 tgsi shaders by hand :-P)
>>>
>>> That said, looking at the code like llvmpipe where Roland/Jose where
>>> thinking we might have problems..  by making the assumption that we
>>> never mix TEX* and SAMPLE* opc's, I think we can loosen the
>>> restriction to:
>>>
>>>   for TEX* instructions, the tgsi must either *not* include SVIEW, or
>>> *must* include a matching SVIEW[idx] for every SAMP[idx]
>>>
>>> Which is a restriction that glsl_to_tgsi follows.
>>>
>>> If you follow this restriction, then for TEX* shaders which have
>>> SVIEW's, file_max[TGSI_FILE_SAMPLER_VIEW] ==
>>> file_max[TGSI_FILE_SAMPLER] and file_mask[TGSI_FILE_SAMPLER_VIEW] ==
>>> file_mask[TGSI_FILE_SAMPLER].. so code takes a different but
>>> equivalent path.   And for TEX* shaders which don't have SVIEW's
>>> everything continues to work as before.
>>>
>>> With this approach, we don't have to fix up everything to create
>>> SVIEW[idx] for every SAMP[idx], as long as glsl_to_tgsi always creates
>>> SVIEW[idx] for each SAMP[idx], and any other tgsi generator that later
>>> adds SVIEW support for TEX* instructions follows the same pattern.
>>>
>>> So, tl;dr: I think really all I need to add to this patch is add blurb
>>> in tgsi.rst to explain this restriction and usage of SVIEW for TEX*
>>>
>>> Thoughts?
>>>
>>> BR,
>>> -R
>>>
>>> On Tue, Jun 9, 2015 at 1:20 PM, Marek Olšák  wrote:
 If you only want to modify TGSI and not all the users, you only have
 to fix tgsi_ureg. tgsi_ureg is a layer that can hide a lot of small
 ugly details if needed, including sampler view declarations when the
 users don't even know about them.

 Marek





 On Tue, Jun 9, 2015 at 6:01 PM, Rob Clark  wrote:
> On Tue, Jun 9, 2015 at 9:32 AM, Roland Scheidegger  
> wrote:
>> Am 09.06.2015 um 15:00 schrieb Rob Clark:
>>> On Tue, Jun 9, 2015 at 5:01 AM, Jose Fonseca  
>>> wrote:
 On 09/06/15 04:03, Rob Clark wrote:
>
> On Mon, Jun 8, 2015 at 10:50 PM, Roland Scheidegger 
> 
> wrote:
>>
>> Am 09.06.2015 um 04:40 schrieb Rob Clark:
>>>
>>> On Mon, Jun 8, 2015 at 10:36 PM, Roland Scheidegger 
>>> 
>>> wrote:

 Am 09.06.2015 um 04:20 schrieb Rob Clark:
>
> On Mon, Jun 8, 2015 at 9:40 PM, Roland Scheidegger
>  wrote:
>>
>> Am 09.06.2015 um 03:20 schrieb Rob Clark:
>>>
>>> On Mon, Jun 8, 2015 at 8:35 PM, Roland Scheidegger
>>>  wrote:

 Am 08.06.2015 um 20:15 schrieb Rob Clark:
>
> From: Rob Clark 
>
> Freedreno needs sampler type information to deal with int/uint
> textures.
> To accomplish this, start creating sampler-view declarations, 
> as
> suggested here:
>
>
> http://lists.freedesktop.org/archives/mesa-dev/2014-November/071583.html
>
>>

Re: [Mesa-dev] [PATCH 1/2] tgsi: texture types

2015-06-10 Thread Rob Clark
So, afaiu, everything that might insert a sampler is using
tgsi_transform_shader()?  There aren't too many of those, and I think
I can fix them up to not violate that constraint.

(It does occur to me that I may end up needing to fix u_blitter to
differentiate between blitting float vs int to avoid some regressions
in freedreno, since I'd no longer be using shader variants based on
bound samplers.. but I guess that is unrelated and a separate patch)

BR,
-R

On Wed, Jun 10, 2015 at 2:55 PM, Roland Scheidegger  wrote:
> My biggest problem with that is the initial case I saw as a problem:
> draw is going to modify these shaders in some cases (aaline stage for
> example), adding its own sampler, and it doesn't know anything about
> distinguishing shaders with sampler views or without.
> The same goes for any other potential code which may modify shaders
> similarly - needs to be modified not just to always use sampler views
> but use them based on if the incoming shader already uses them or not.
> Which conceptually looks worse to me. But otherwise I agree this should
> work.
>
> Roland
>
>
> Am 10.06.2015 um 20:30 schrieb Rob Clark:
>> Hmm, at least tgsi_text_translate() doesn't appear to use tgsi_ureg..
>> and there are still a number of users of tgsi_text_translate().. I
>> guess handling this in tgsi_ureg would avoid fixing all the tgsi_ureg
>> users, but that still leaves a lot of others.  Changing them all still
>> seems to be too intrusive to me.
>>
>> (And also, I have a large collection of saved tgsi shaders that I use
>> for standalone testing of my shader compiler and don't really like the
>> idea of fixing up 700 or 800 tgsi shaders by hand :-P)
>>
>> That said, looking at the code like llvmpipe where Roland/Jose where
>> thinking we might have problems..  by making the assumption that we
>> never mix TEX* and SAMPLE* opc's, I think we can loosen the
>> restriction to:
>>
>>   for TEX* instructions, the tgsi must either *not* include SVIEW, or
>> *must* include a matching SVIEW[idx] for every SAMP[idx]
>>
>> Which is a restriction that glsl_to_tgsi follows.
>>
>> If you follow this restriction, then for TEX* shaders which have
>> SVIEW's, file_max[TGSI_FILE_SAMPLER_VIEW] ==
>> file_max[TGSI_FILE_SAMPLER] and file_mask[TGSI_FILE_SAMPLER_VIEW] ==
>> file_mask[TGSI_FILE_SAMPLER].. so code takes a different but
>> equivalent path.   And for TEX* shaders which don't have SVIEW's
>> everything continues to work as before.
>>
>> With this approach, we don't have to fix up everything to create
>> SVIEW[idx] for every SAMP[idx], as long as glsl_to_tgsi always creates
>> SVIEW[idx] for each SAMP[idx], and any other tgsi generator that later
>> adds SVIEW support for TEX* instructions follows the same pattern.
>>
>> So, tl;dr: I think really all I need to add to this patch is add blurb
>> in tgsi.rst to explain this restriction and usage of SVIEW for TEX*
>>
>> Thoughts?
>>
>> BR,
>> -R
>>
>> On Tue, Jun 9, 2015 at 1:20 PM, Marek Olšák  wrote:
>>> If you only want to modify TGSI and not all the users, you only have
>>> to fix tgsi_ureg. tgsi_ureg is a layer that can hide a lot of small
>>> ugly details if needed, including sampler view declarations when the
>>> users don't even know about them.
>>>
>>> Marek
>>>
>>>
>>>
>>>
>>>
>>> On Tue, Jun 9, 2015 at 6:01 PM, Rob Clark  wrote:
 On Tue, Jun 9, 2015 at 9:32 AM, Roland Scheidegger  
 wrote:
> Am 09.06.2015 um 15:00 schrieb Rob Clark:
>> On Tue, Jun 9, 2015 at 5:01 AM, Jose Fonseca  wrote:
>>> On 09/06/15 04:03, Rob Clark wrote:

 On Mon, Jun 8, 2015 at 10:50 PM, Roland Scheidegger 
 
 wrote:
>
> Am 09.06.2015 um 04:40 schrieb Rob Clark:
>>
>> On Mon, Jun 8, 2015 at 10:36 PM, Roland Scheidegger 
>> 
>> wrote:
>>>
>>> Am 09.06.2015 um 04:20 schrieb Rob Clark:

 On Mon, Jun 8, 2015 at 9:40 PM, Roland Scheidegger
  wrote:
>
> Am 09.06.2015 um 03:20 schrieb Rob Clark:
>>
>> On Mon, Jun 8, 2015 at 8:35 PM, Roland Scheidegger
>>  wrote:
>>>
>>> Am 08.06.2015 um 20:15 schrieb Rob Clark:

 From: Rob Clark 

 Freedreno needs sampler type information to deal with int/uint
 textures.
 To accomplish this, start creating sampler-view declarations, 
 as
 suggested here:


 http://lists.freedesktop.org/archives/mesa-dev/2014-November/071583.html

 create a sampler-view with index matching the sampler, to 
 encode
 the
 texture type (ie. SINT/UINT/FLOAT).  Ie:

 DCL SVIEW[n], 2D, UINT
 DCL SAMP[n]
 TEX OUT[1], IN[1],

Re: [Mesa-dev] [PATCH 1/2] tgsi: texture types

2015-06-10 Thread Roland Scheidegger
My biggest problem with that is the initial case I saw as a problem:
draw is going to modify these shaders in some cases (aaline stage for
example), adding its own sampler, and it doesn't know anything about
distinguishing shaders with sampler views or without.
The same goes for any other potential code which may modify shaders
similarly - needs to be modified not just to always use sampler views
but use them based on if the incoming shader already uses them or not.
Which conceptually looks worse to me. But otherwise I agree this should
work.

Roland


Am 10.06.2015 um 20:30 schrieb Rob Clark:
> Hmm, at least tgsi_text_translate() doesn't appear to use tgsi_ureg..
> and there are still a number of users of tgsi_text_translate().. I
> guess handling this in tgsi_ureg would avoid fixing all the tgsi_ureg
> users, but that still leaves a lot of others.  Changing them all still
> seems to be too intrusive to me.
> 
> (And also, I have a large collection of saved tgsi shaders that I use
> for standalone testing of my shader compiler and don't really like the
> idea of fixing up 700 or 800 tgsi shaders by hand :-P)
> 
> That said, looking at the code like llvmpipe where Roland/Jose where
> thinking we might have problems..  by making the assumption that we
> never mix TEX* and SAMPLE* opc's, I think we can loosen the
> restriction to:
> 
>   for TEX* instructions, the tgsi must either *not* include SVIEW, or
> *must* include a matching SVIEW[idx] for every SAMP[idx]
> 
> Which is a restriction that glsl_to_tgsi follows.
> 
> If you follow this restriction, then for TEX* shaders which have
> SVIEW's, file_max[TGSI_FILE_SAMPLER_VIEW] ==
> file_max[TGSI_FILE_SAMPLER] and file_mask[TGSI_FILE_SAMPLER_VIEW] ==
> file_mask[TGSI_FILE_SAMPLER].. so code takes a different but
> equivalent path.   And for TEX* shaders which don't have SVIEW's
> everything continues to work as before.
> 
> With this approach, we don't have to fix up everything to create
> SVIEW[idx] for every SAMP[idx], as long as glsl_to_tgsi always creates
> SVIEW[idx] for each SAMP[idx], and any other tgsi generator that later
> adds SVIEW support for TEX* instructions follows the same pattern.
> 
> So, tl;dr: I think really all I need to add to this patch is add blurb
> in tgsi.rst to explain this restriction and usage of SVIEW for TEX*
> 
> Thoughts?
> 
> BR,
> -R
> 
> On Tue, Jun 9, 2015 at 1:20 PM, Marek Olšák  wrote:
>> If you only want to modify TGSI and not all the users, you only have
>> to fix tgsi_ureg. tgsi_ureg is a layer that can hide a lot of small
>> ugly details if needed, including sampler view declarations when the
>> users don't even know about them.
>>
>> Marek
>>
>>
>>
>>
>>
>> On Tue, Jun 9, 2015 at 6:01 PM, Rob Clark  wrote:
>>> On Tue, Jun 9, 2015 at 9:32 AM, Roland Scheidegger  
>>> wrote:
 Am 09.06.2015 um 15:00 schrieb Rob Clark:
> On Tue, Jun 9, 2015 at 5:01 AM, Jose Fonseca  wrote:
>> On 09/06/15 04:03, Rob Clark wrote:
>>>
>>> On Mon, Jun 8, 2015 at 10:50 PM, Roland Scheidegger 
>>> wrote:

 Am 09.06.2015 um 04:40 schrieb Rob Clark:
>
> On Mon, Jun 8, 2015 at 10:36 PM, Roland Scheidegger 
> 
> wrote:
>>
>> Am 09.06.2015 um 04:20 schrieb Rob Clark:
>>>
>>> On Mon, Jun 8, 2015 at 9:40 PM, Roland Scheidegger
>>>  wrote:

 Am 09.06.2015 um 03:20 schrieb Rob Clark:
>
> On Mon, Jun 8, 2015 at 8:35 PM, Roland Scheidegger
>  wrote:
>>
>> Am 08.06.2015 um 20:15 schrieb Rob Clark:
>>>
>>> From: Rob Clark 
>>>
>>> Freedreno needs sampler type information to deal with int/uint
>>> textures.
>>> To accomplish this, start creating sampler-view declarations, as
>>> suggested here:
>>>
>>>
>>> http://lists.freedesktop.org/archives/mesa-dev/2014-November/071583.html
>>>
>>> create a sampler-view with index matching the sampler, to encode
>>> the
>>> texture type (ie. SINT/UINT/FLOAT).  Ie:
>>>
>>> DCL SVIEW[n], 2D, UINT
>>> DCL SAMP[n]
>>> TEX OUT[1], IN[1], SAMP[n]
>>>
>>> For tgsi texture instructions which do not take an explicit 
>>> SVIEW
>>> argument, the SVIEW index is implied by the SAMP index.
>>
>> I wonder if there should be some doc update somewhere.
>>
>
> yeah, perhaps.. I wasn't quite sure where, tgsi.rst only talks 
> about
> SVIEW in terms of the SAMPLE and related opc's (ie. the ones which
> do
> take an SVIEW arg), and the way things are with this patch, other
> drivers simply need to ignore the extra SVIEW decl's and not
> random

[Mesa-dev] [Bug 90927] GLSL extensions are not routed from X-Server to client app

2015-06-10 Thread bugzilla-daemon
https://bugs.freedesktop.org/show_bug.cgi?id=90927

Bug ID: 90927
   Summary: GLSL extensions are not routed from X-Server to client
app
   Product: Mesa
   Version: 10.5
  Hardware: All
OS: All
Status: NEW
  Severity: critical
  Priority: medium
 Component: GLX
  Assignee: mesa-dev@lists.freedesktop.org
  Reporter: m.sokal...@3dweb.pl
QA Contact: mesa-dev@lists.freedesktop.org

X-Server receives glGetString(GL_EXTENSIONS) request and it replies with:
"GL_ARB_fragment_shader GL_ARB_vertex_shader GL_ARB_shader_objects".

Client process is started with LIBGL_ALWAYS_INDIRECT=1 but it doesn't receive
extensions sent by X-Server, instead it gets "GL_ARB_transpose_matrix
GL_EXT_draw_range_elements GL_EXT_multi_draw_arrays GL_SUN_multi_draw_arrays".


Extra hints:

- Other extensions (like: GL_ARB_occlusion_query) are correctly delivered from
server to client.

- Without LIBGL_ALWAYS_INDIRECT, mesa reports it is capable of GLSL extensions.


Does it mean libGL's GLX encoder is missing something?

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


Re: [Mesa-dev] COMPSIZE function in OpenGL XML registry

2015-06-10 Thread Matt Turner
On Wed, Jun 10, 2015 at 11:25 AM, Shervin Sharifi  wrote:
> Hi,
>
>  This may not be the right forum to ask this, but I didn't know of a better
> forum, so I thought I can ask here.
>
>  I'm new to OpenGL. I am looking at XML registry for OpenGL and there are
> some parameters with attributes containing a function COMPSIZE (I've pasted
> an example below).
>  I tried to find information on what the COMPSIZE function is, where/how it
> is used, etc, but couldn't find documentation or credible information on the
> Internet.
>  Any information or pointer to that would be really helpful.
>
>  Thanks,
> Shervin
>
>
>
> This example is from gl.xml in the OpenGL registry:
>
> 
> void glBinormalPointerEXT
> GLenum
> type
> GLsizei stride
> const void
> *pointer
> 

I'm just speculating, but I don't think there's really a definition of
COMPSIZE or anything. I think it's just a way of saying that, for
instance, the size of the memory pointed by the "pointer" parameter to
glBinormalPointerEXT is a function of the "type" and "stride"
parameters.

Other functions, like glBitmap have similar things:

const
GLubyte *bitmap

That is, the size of the block of memory pointed to by "bitmap" is
described by the "width" and "height" parameters.
___
mesa-dev mailing list
mesa-dev@lists.freedesktop.org
http://lists.freedesktop.org/mailman/listinfo/mesa-dev


Re: [Mesa-dev] [PATCH 1/2] tgsi: texture types

2015-06-10 Thread Rob Clark
Hmm, at least tgsi_text_translate() doesn't appear to use tgsi_ureg..
and there are still a number of users of tgsi_text_translate().. I
guess handling this in tgsi_ureg would avoid fixing all the tgsi_ureg
users, but that still leaves a lot of others.  Changing them all still
seems to be too intrusive to me.

(And also, I have a large collection of saved tgsi shaders that I use
for standalone testing of my shader compiler and don't really like the
idea of fixing up 700 or 800 tgsi shaders by hand :-P)

That said, looking at the code like llvmpipe where Roland/Jose where
thinking we might have problems..  by making the assumption that we
never mix TEX* and SAMPLE* opc's, I think we can loosen the
restriction to:

  for TEX* instructions, the tgsi must either *not* include SVIEW, or
*must* include a matching SVIEW[idx] for every SAMP[idx]

Which is a restriction that glsl_to_tgsi follows.

If you follow this restriction, then for TEX* shaders which have
SVIEW's, file_max[TGSI_FILE_SAMPLER_VIEW] ==
file_max[TGSI_FILE_SAMPLER] and file_mask[TGSI_FILE_SAMPLER_VIEW] ==
file_mask[TGSI_FILE_SAMPLER].. so code takes a different but
equivalent path.   And for TEX* shaders which don't have SVIEW's
everything continues to work as before.

With this approach, we don't have to fix up everything to create
SVIEW[idx] for every SAMP[idx], as long as glsl_to_tgsi always creates
SVIEW[idx] for each SAMP[idx], and any other tgsi generator that later
adds SVIEW support for TEX* instructions follows the same pattern.

So, tl;dr: I think really all I need to add to this patch is add blurb
in tgsi.rst to explain this restriction and usage of SVIEW for TEX*

Thoughts?

BR,
-R

On Tue, Jun 9, 2015 at 1:20 PM, Marek Olšák  wrote:
> If you only want to modify TGSI and not all the users, you only have
> to fix tgsi_ureg. tgsi_ureg is a layer that can hide a lot of small
> ugly details if needed, including sampler view declarations when the
> users don't even know about them.
>
> Marek
>
>
>
>
>
> On Tue, Jun 9, 2015 at 6:01 PM, Rob Clark  wrote:
>> On Tue, Jun 9, 2015 at 9:32 AM, Roland Scheidegger  
>> wrote:
>>> Am 09.06.2015 um 15:00 schrieb Rob Clark:
 On Tue, Jun 9, 2015 at 5:01 AM, Jose Fonseca  wrote:
> On 09/06/15 04:03, Rob Clark wrote:
>>
>> On Mon, Jun 8, 2015 at 10:50 PM, Roland Scheidegger 
>> wrote:
>>>
>>> Am 09.06.2015 um 04:40 schrieb Rob Clark:

 On Mon, Jun 8, 2015 at 10:36 PM, Roland Scheidegger 
 
 wrote:
>
> Am 09.06.2015 um 04:20 schrieb Rob Clark:
>>
>> On Mon, Jun 8, 2015 at 9:40 PM, Roland Scheidegger
>>  wrote:
>>>
>>> Am 09.06.2015 um 03:20 schrieb Rob Clark:

 On Mon, Jun 8, 2015 at 8:35 PM, Roland Scheidegger
  wrote:
>
> Am 08.06.2015 um 20:15 schrieb Rob Clark:
>>
>> From: Rob Clark 
>>
>> Freedreno needs sampler type information to deal with int/uint
>> textures.
>> To accomplish this, start creating sampler-view declarations, as
>> suggested here:
>>
>>
>> http://lists.freedesktop.org/archives/mesa-dev/2014-November/071583.html
>>
>> create a sampler-view with index matching the sampler, to encode
>> the
>> texture type (ie. SINT/UINT/FLOAT).  Ie:
>>
>> DCL SVIEW[n], 2D, UINT
>> DCL SAMP[n]
>> TEX OUT[1], IN[1], SAMP[n]
>>
>> For tgsi texture instructions which do not take an explicit SVIEW
>> argument, the SVIEW index is implied by the SAMP index.
>
> I wonder if there should be some doc update somewhere.
>

 yeah, perhaps.. I wasn't quite sure where, tgsi.rst only talks 
 about
 SVIEW in terms of the SAMPLE and related opc's (ie. the ones which
 do
 take an SVIEW arg), and the way things are with this patch, other
 drivers simply need to ignore the extra SVIEW decl's and not
 randomly
 assert for things to continue working as before..

 hypothetically if something in tree actually created SVIEW decl
 currently, and the shader also had TEX* style instructions, it 
 would
 have to take care to not have conflicting SVIEW's.  But afaict
 nothing
 in-tree creates sampler view decl's currently.

>>
>> Signed-off-by: Rob Clark 
>> ---
>>   src/mesa/state_tracker/st_glsl_to_tgsi.cpp | 29
>> +
>>   1 file changed, 29 insertions(+)
>>
>> diff --git a/src/mesa/state_tracker/st_glsl_to_tgsi.cpp
>> b/src/mesa/s

[Mesa-dev] COMPSIZE function in OpenGL XML registry

2015-06-10 Thread Shervin Sharifi
Hi,

 This may not be the right forum to ask this, but I didn't know of a better
forum, so I thought I can ask here.

 I'm new to OpenGL. I am looking at XML registry for OpenGL and there are
some parameters with attributes containing a function COMPSIZE (I've pasted
an example below).
 I tried to find information on what the COMPSIZE function is, where/how it
is used, etc, but couldn't find documentation or credible information on
the Internet.
 Any information or pointer to that would be really helpful.

 Thanks,
Shervin



This example is from gl.xml in the OpenGL registry:


void glBinormalPointerEXT
GLenum
type
GLsizei stride
const void
*pointer

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


Re: [Mesa-dev] [PATCH v2] i965: do not round line width when multisampling or antialiaing are enabled

2015-06-10 Thread Ian Romanick
If Ken is happy with it now, then I'm happy.

Reviewed-by: Ian Romanick 

I think this should also be marked for 10.6.

Cc: "10.6" 

On 06/10/2015 12:07 AM, Iago Toral Quiroga wrote:
> In commit fe74fee8fa721a we rounded the line width to the nearest integer to
> match the GLES3 spec requirements stated in section 13.4.2.1, but that seems
> to break a dEQP test that renders wide lines in some multisampling scenarios.
> 
> Ian noted that the Open 4.4 spec has the following similar text:
> 
> "The actual width of non-antialiased lines is determined by rounding the
> supplied width to the nearest integer, then clamping it to the
> implementation-dependent maximum non-antialiased line width."
> 
> and suggested that when ES removed antialiased lines, they removed
> "non-antialised" from that paragraph but probably should not have.
> 
> Going by that note, this patch restricts the quantization implemented in
> fe74fee8fa721a only to regular aliased lines. This seems to keep the
> tests fixed with that commit passing while fixing the broken test.
> 
> v2:
>   - Drop one of the clamps (Ken, Marius)
>   - Add a rule to prevent advertising line widths that when rounded go beyond
> the limits allowed by the hardware (Ken)
>   - Update comments in the code accordingly (Ian)
>   - Put the code in a utility function (Ian)
> 
> Fixes:
> dEQP-GLES3.functional.rasterization.fbo.rbo_multisample_max.primitives.lines_wide
> 
> Bugzilla: https://bugs.freedesktop.org/show_bug.cgi?id=90749
> ---
>  src/mesa/drivers/dri/i965/brw_context.c   |  7 +++
>  src/mesa/drivers/dri/i965/brw_util.h  | 15 +++
>  src/mesa/drivers/dri/i965/gen6_sf_state.c |  6 +-
>  src/mesa/drivers/dri/i965/gen7_sf_state.c |  6 +-
>  src/mesa/drivers/dri/i965/gen8_sf_state.c |  6 +-
>  5 files changed, 25 insertions(+), 15 deletions(-)
> 
> diff --git a/src/mesa/drivers/dri/i965/brw_context.c 
> b/src/mesa/drivers/dri/i965/brw_context.c
> index 274a237..1e9ada2 100644
> --- a/src/mesa/drivers/dri/i965/brw_context.c
> +++ b/src/mesa/drivers/dri/i965/brw_context.c
> @@ -442,6 +442,13 @@ brw_initialize_context_constants(struct brw_context *brw)
>ctx->Const.LineWidthGranularity = 0.5;
> }
>  
> +   /* For non-antialiased lines, we have to round the line width to the
> +* nearest whole number. Make sure that we don't advertise a line
> +* width that, when rounded, will be beyond the actual hardware
> +* maximum.
> +*/
> +   assert(roundf(ctx->Const.MaxLineWidth) <= ctx->Const.MaxLineWidth);
> +
> ctx->Const.MinPointSize = 1.0;
> ctx->Const.MinPointSizeAA = 1.0;
> ctx->Const.MaxPointSize = 255.0;
> diff --git a/src/mesa/drivers/dri/i965/brw_util.h 
> b/src/mesa/drivers/dri/i965/brw_util.h
> index b548d23..671d72e 100644
> --- a/src/mesa/drivers/dri/i965/brw_util.h
> +++ b/src/mesa/drivers/dri/i965/brw_util.h
> @@ -35,9 +35,24 @@
>  
>  #include "main/mtypes.h"
>  #include "main/imports.h"
> +#include "brw_context.h"
>  
>  extern GLuint brw_translate_blend_factor( GLenum factor );
>  extern GLuint brw_translate_blend_equation( GLenum mode );
>  extern GLenum brw_fix_xRGB_alpha(GLenum function);
>  
> +static inline float
> +brw_get_line_width(struct brw_context *brw)
> +{
> +   /* From the OpenGL 4.4 spec:
> +*
> +* "The actual width of non-antialiased lines is determined by rounding
> +* the supplied width to the nearest integer, then clamping it to the
> +* implementation-dependent maximum non-antialiased line width."
> +*/
> +   return CLAMP(!brw->ctx.Multisample._Enabled && !brw->ctx.Line.SmoothFlag
> +? roundf(brw->ctx.Line.Width) : brw->ctx.Line.Width,
> +0.0, brw->ctx.Const.MaxLineWidth);
> +}
> +
>  #endif
> diff --git a/src/mesa/drivers/dri/i965/gen6_sf_state.c 
> b/src/mesa/drivers/dri/i965/gen6_sf_state.c
> index e445ce2..d577764 100644
> --- a/src/mesa/drivers/dri/i965/gen6_sf_state.c
> +++ b/src/mesa/drivers/dri/i965/gen6_sf_state.c
> @@ -361,11 +361,7 @@ upload_sf_state(struct brw_context *brw)
>  
> /* _NEW_LINE */
> {
> -  /* OpenGL dictates that line width should be rounded to the nearest
> -   * integer
> -   */
> -  float line_width =
> - roundf(CLAMP(ctx->Line.Width, 0.0, ctx->Const.MaxLineWidth));
> +  float line_width = brw_get_line_width(brw);
>uint32_t line_width_u3_7 = U_FIXED(line_width, 7);
>  
>/* Line width of 0 is not allowed when MSAA enabled */
> diff --git a/src/mesa/drivers/dri/i965/gen7_sf_state.c 
> b/src/mesa/drivers/dri/i965/gen7_sf_state.c
> index 58e3337..87ff284 100644
> --- a/src/mesa/drivers/dri/i965/gen7_sf_state.c
> +++ b/src/mesa/drivers/dri/i965/gen7_sf_state.c
> @@ -192,11 +192,7 @@ upload_sf_state(struct brw_context *brw)
>  
> /* _NEW_LINE */
> {
> -  /* OpenGL dictates that line width should be rounded to the nearest
> -   * integer
> -   */
> -  float line_width =
> - roundf(CLAMP(ctx->Line.W

Re: [Mesa-dev] [PATCH v3] egl/dri2: implement platform_surfaceless (v3)

2015-06-10 Thread Chad Versace
On Mon 08 Jun 2015, Zach Reizner wrote:
> From: Haixia Shi 
> 
> The surfaceless platform is for off-screen rendering only. Render node support
> is required.
> 
> Only consider the render nodes. Do not use normal nodes as they require
> auth hooks.
> 
> v3: change platform_null to platform_surfaceless
> 
> Signed-off-by: Haixia Shi 
> Signed-off-by: Zach Reizner 
> ---

Thanks for fixing up the patch and resubmitting.

I found three small problems. After fixing them, I think this patch will
be ready for merging.

> +static __DRIbuffer *
> +surfaceless_get_buffers_with_format(__DRIdrawable * driDrawable,
> + int *width, int *height,
> + unsigned int *attachments, int count,
> + int *out_count, void *loaderPrivate)
> +{
> +   struct dri2_egl_surface *dri2_surf = loaderPrivate;
> +   struct dri2_egl_display *dri2_dpy =
> +  dri2_egl_display(dri2_surf->base.Resource.Display);

dri2_dpy is unused.

src/egl/drivers/dri2/platform_surfaceless.c|65 col 29| warning: unused variable 
'dri2_dpy' [-Wunused-variable]
   struct dri2_egl_display *dri2_dpy =
^

[...]

> +EGLBoolean
> +dri2_initialize_surfaceless(_EGLDriver *drv, _EGLDisplay *disp)
> +{
> +   struct dri2_egl_display *dri2_dpy;
> +   const char* err;
> +   int i, render_node;

render_node is unused.

src/egl/drivers/dri2/platform_surfaceless.c|84 col 11| warning: unused variable 
'render_node' [-Wunused-variable]
   int i, render_node;
  ^

[...]

> +cleanup_driver:
> +   dlclose(dri2_dpy->driver);
> +   free(dri2_dpy->driver_name);
> +   close(dri2_dpy->fd);
> +cleanup_display:
> +   free(dri2_dpy);

I think `close(dri2_dpy->fd)` should be moved to the cleanup_display
label.

> +
> +   return _eglError(EGL_NOT_INITIALIZED, err);
> +}
___
mesa-dev mailing list
mesa-dev@lists.freedesktop.org
http://lists.freedesktop.org/mailman/listinfo/mesa-dev


[Mesa-dev] [PATCH] gallium: remove explicit values from PIPE_CAP_ enums

2015-06-10 Thread Brian Paul
The other PIPE_CAPF_ and PIPE_SHADER_CAP_ enums don't have explicit values.
---
 src/gallium/include/pipe/p_defines.h | 196 +--
 1 file changed, 98 insertions(+), 98 deletions(-)

diff --git a/src/gallium/include/pipe/p_defines.h 
b/src/gallium/include/pipe/p_defines.h
index a077029..88b7b76 100644
--- a/src/gallium/include/pipe/p_defines.h
+++ b/src/gallium/include/pipe/p_defines.h
@@ -505,106 +505,106 @@ enum pipe_reset_status
  */
 enum pipe_cap
 {
-   PIPE_CAP_NPOT_TEXTURES = 1,
-   PIPE_CAP_TWO_SIDED_STENCIL = 2,
-   PIPE_CAP_MAX_DUAL_SOURCE_RENDER_TARGETS = 4,
-   PIPE_CAP_ANISOTROPIC_FILTER = 5,
-   PIPE_CAP_POINT_SPRITE = 6,
-   PIPE_CAP_MAX_RENDER_TARGETS = 7,
-   PIPE_CAP_OCCLUSION_QUERY = 8,
-   PIPE_CAP_QUERY_TIME_ELAPSED = 9,
-   PIPE_CAP_TEXTURE_SHADOW_MAP = 10,
-   PIPE_CAP_TEXTURE_SWIZZLE = 11,
-   PIPE_CAP_MAX_TEXTURE_2D_LEVELS = 12,
-   PIPE_CAP_MAX_TEXTURE_3D_LEVELS = 13,
-   PIPE_CAP_MAX_TEXTURE_CUBE_LEVELS = 14,
-   PIPE_CAP_TEXTURE_MIRROR_CLAMP = 25,
-   PIPE_CAP_BLEND_EQUATION_SEPARATE = 28,
-   PIPE_CAP_SM3 = 29,  /*< Shader Model, supported */
-   PIPE_CAP_MAX_STREAM_OUTPUT_BUFFERS = 30,
-   PIPE_CAP_PRIMITIVE_RESTART = 31,
+   PIPE_CAP_NPOT_TEXTURES,
+   PIPE_CAP_TWO_SIDED_STENCIL,
+   PIPE_CAP_MAX_DUAL_SOURCE_RENDER_TARGETS,
+   PIPE_CAP_ANISOTROPIC_FILTER,
+   PIPE_CAP_POINT_SPRITE,
+   PIPE_CAP_MAX_RENDER_TARGETS,
+   PIPE_CAP_OCCLUSION_QUERY,
+   PIPE_CAP_QUERY_TIME_ELAPSED,
+   PIPE_CAP_TEXTURE_SHADOW_MAP,
+   PIPE_CAP_TEXTURE_SWIZZLE,
+   PIPE_CAP_MAX_TEXTURE_2D_LEVELS,
+   PIPE_CAP_MAX_TEXTURE_3D_LEVELS,
+   PIPE_CAP_MAX_TEXTURE_CUBE_LEVELS,
+   PIPE_CAP_TEXTURE_MIRROR_CLAMP,
+   PIPE_CAP_BLEND_EQUATION_SEPARATE,
+   PIPE_CAP_SM3,
+   PIPE_CAP_MAX_STREAM_OUTPUT_BUFFERS,
+   PIPE_CAP_PRIMITIVE_RESTART,
/** blend enables and write masks per rendertarget */
-   PIPE_CAP_INDEP_BLEND_ENABLE = 33,
+   PIPE_CAP_INDEP_BLEND_ENABLE,
/** different blend funcs per rendertarget */
-   PIPE_CAP_INDEP_BLEND_FUNC = 34,
-   PIPE_CAP_MAX_TEXTURE_ARRAY_LAYERS = 36,
-   PIPE_CAP_TGSI_FS_COORD_ORIGIN_UPPER_LEFT = 37,
-   PIPE_CAP_TGSI_FS_COORD_ORIGIN_LOWER_LEFT = 38,
-   PIPE_CAP_TGSI_FS_COORD_PIXEL_CENTER_HALF_INTEGER = 39,
-   PIPE_CAP_TGSI_FS_COORD_PIXEL_CENTER_INTEGER = 40,
-   PIPE_CAP_DEPTH_CLIP_DISABLE = 41,
-   PIPE_CAP_SHADER_STENCIL_EXPORT = 42,
-   PIPE_CAP_TGSI_INSTANCEID = 43,
-   PIPE_CAP_VERTEX_ELEMENT_INSTANCE_DIVISOR = 44,
-   PIPE_CAP_FRAGMENT_COLOR_CLAMPED = 45,
-   PIPE_CAP_MIXED_COLORBUFFER_FORMATS = 46,
-   PIPE_CAP_SEAMLESS_CUBE_MAP = 47,
-   PIPE_CAP_SEAMLESS_CUBE_MAP_PER_TEXTURE = 48,
-   PIPE_CAP_MIN_TEXEL_OFFSET = 50,
-   PIPE_CAP_MAX_TEXEL_OFFSET = 51,
-   PIPE_CAP_CONDITIONAL_RENDER = 52,
-   PIPE_CAP_TEXTURE_BARRIER = 53,
-   PIPE_CAP_MAX_STREAM_OUTPUT_SEPARATE_COMPONENTS = 55,
-   PIPE_CAP_MAX_STREAM_OUTPUT_INTERLEAVED_COMPONENTS = 56,
-   PIPE_CAP_STREAM_OUTPUT_PAUSE_RESUME = 57,
-   PIPE_CAP_TGSI_CAN_COMPACT_CONSTANTS = 59, /* temporary */
-   PIPE_CAP_VERTEX_COLOR_UNCLAMPED = 60,
-   PIPE_CAP_VERTEX_COLOR_CLAMPED = 61,
-   PIPE_CAP_GLSL_FEATURE_LEVEL = 62,
-   PIPE_CAP_QUADS_FOLLOW_PROVOKING_VERTEX_CONVENTION = 63,
-   PIPE_CAP_USER_VERTEX_BUFFERS = 64,
-   PIPE_CAP_VERTEX_BUFFER_OFFSET_4BYTE_ALIGNED_ONLY = 65,
-   PIPE_CAP_VERTEX_BUFFER_STRIDE_4BYTE_ALIGNED_ONLY = 66,
-   PIPE_CAP_VERTEX_ELEMENT_SRC_OFFSET_4BYTE_ALIGNED_ONLY = 67,
-   PIPE_CAP_COMPUTE = 68,
-   PIPE_CAP_USER_INDEX_BUFFERS = 69,
-   PIPE_CAP_USER_CONSTANT_BUFFERS = 70,
-   PIPE_CAP_CONSTANT_BUFFER_OFFSET_ALIGNMENT = 71,
-   PIPE_CAP_START_INSTANCE = 72,
-   PIPE_CAP_QUERY_TIMESTAMP = 73,
-   PIPE_CAP_TEXTURE_MULTISAMPLE = 74,
-   PIPE_CAP_MIN_MAP_BUFFER_ALIGNMENT = 75,
-   PIPE_CAP_CUBE_MAP_ARRAY = 76,
-   PIPE_CAP_TEXTURE_BUFFER_OBJECTS = 77,
-   PIPE_CAP_TEXTURE_BUFFER_OFFSET_ALIGNMENT = 78,
-   PIPE_CAP_TGSI_TEXCOORD = 79,
-   PIPE_CAP_PREFER_BLIT_BASED_TEXTURE_TRANSFER = 80,
-   PIPE_CAP_QUERY_PIPELINE_STATISTICS = 81,
-   PIPE_CAP_TEXTURE_BORDER_COLOR_QUIRK = 82,
-   PIPE_CAP_MAX_TEXTURE_BUFFER_SIZE = 83,
-   PIPE_CAP_MAX_VIEWPORTS = 84,
-   PIPE_CAP_ENDIANNESS = 85,
-   PIPE_CAP_MIXED_FRAMEBUFFER_SIZES = 86,
-   PIPE_CAP_TGSI_VS_LAYER_VIEWPORT = 87,
-   PIPE_CAP_MAX_GEOMETRY_OUTPUT_VERTICES = 88,
-   PIPE_CAP_MAX_GEOMETRY_TOTAL_OUTPUT_COMPONENTS = 89,
-   PIPE_CAP_MAX_TEXTURE_GATHER_COMPONENTS = 90,
-   PIPE_CAP_TEXTURE_GATHER_SM5 = 91,
-   PIPE_CAP_BUFFER_MAP_PERSISTENT_COHERENT = 92,
-   PIPE_CAP_FAKE_SW_MSAA = 93,
-   PIPE_CAP_TEXTURE_QUERY_LOD = 94,
-   PIPE_CAP_MIN_TEXTURE_GATHER_OFFSET = 95,
-   PIPE_CAP_MAX_TEXTURE_GATHER_OFFSET = 96,
-   PIPE_CAP_SAMPLE_SHADING = 97,
-   PIPE_CAP_TEXTURE_GATHER_OFFSETS = 98,
-   PIPE_CAP_TGSI_VS_WINDOW_SPACE_POSITION = 99,
-   PIPE_CAP_MAX_VERTEX_STREAMS = 100,
-   PIPE_CAP_DRAW_INDIRECT = 101,
-   PIPE_CAP_TGSI_FS_FINE_DERIVATIVE = 102,
-   PIPE_CAP_VENDOR_ID = 103,
-   PIPE_CAP_DEVICE_ID = 104,
-   PIPE_CAP_ACCELERATED = 105,
-   PIPE_CAP_VIDEO_MEMORY = 106,
-   PIPE_CAP_UMA = 107,
-   PIPE_CAP_CONDITIONA

Re: [Mesa-dev] [PATCH 4/4] drisw/glx: use XShm if possible

2015-06-10 Thread Marc-André Lureau
Hi

On Wed, Jun 10, 2015 at 6:17 PM, Chris Wilson 
wrote:

> I did not find how you serialised the XServer reading from the SHM
> following the call to XShmPutImage (which you may want to flush?) with
> subsequent rendering into the image.
>
>
Correct, there is no sync. And I think that explains the temporary glitches
I observe with gnome-shell when moving windows around for ex (they are
always temporary, there is fortunately always a pending update to fix it).
I am afraid it would have to wait for ShmCompletionEvent, unfortunately in
sync, since there is a single buffer, and mesa doesn't own the event
queue&loop (I think). Note that the sw x11 backend also seems to suffer
from this.

Another trick you may like to investigate is using the X server to do
> format conversions and tune the swrast for a small number of local
> formats (i.e. rgb16, argb32). This of course requires using XRender
> after the PutImage - and at that point keeping it as a ShmPixmap is
> hugely beneficial to UMA drivers.
>

That's an interesting optimization. However, my use case is mostly with
spice/vnc, so I don't think that would improve performance here since it's
all software-based.

thanks

-- 
Marc-André Lureau
___
mesa-dev mailing list
mesa-dev@lists.freedesktop.org
http://lists.freedesktop.org/mailman/listinfo/mesa-dev


Re: [Mesa-dev] [PATCH] i965: Momentarily pretend to support ARB_texture_stencil8 for blits.

2015-06-10 Thread Neil Roberts
Kenneth Graunke  writes:

> _mesa_meta_fb_tex_blit_begin(ctx, &blit);
> +   ctx->Extensions.ARB_texture_stencil8 = true;

Maybe you could put assert(ctx->Extensions.ARB_texture_stencil8==false)
just before setting it to true so that we'll definitely remember to
remove it if we eventually enable the extension. Otherwise as it stands
if we forget about this it would probably not break any tests but the
extension would mysteriously disable itself and no-one would notice
because they would probably check the extensions just once upfront.

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


Re: [Mesa-dev] [PATCH] i965/fs: Fix unused variable warning

2015-06-10 Thread Matt Turner
On Wed, Jun 10, 2015 at 9:52 AM, Chad Versace  wrote:
> Annotate offset_components with attribute 'unused'.
> ---
>  src/mesa/drivers/dri/i965/brw_fs_nir.cpp | 3 ++-
>  1 file changed, 2 insertions(+), 1 deletion(-)
>
> diff --git a/src/mesa/drivers/dri/i965/brw_fs_nir.cpp 
> b/src/mesa/drivers/dri/i965/brw_fs_nir.cpp
> index 0f1a286..3c24a87 100644
> --- a/src/mesa/drivers/dri/i965/brw_fs_nir.cpp
> +++ b/src/mesa/drivers/dri/i965/brw_fs_nir.cpp
> @@ -1599,7 +1599,8 @@ fs_visitor::nir_emit_texture(const fs_builder &bld, 
> nir_tex_instr *instr)
> bool is_cube_array = instr->sampler_dim == GLSL_SAMPLER_DIM_CUBE &&
>  instr->is_array;
>
> -   int lod_components = 0, offset_components = 0;
> +   int lod_components = 0;
> +   int UNUSED offset_components = 0;

Weird, I didn't even realize we had a macro for this -- and it seems
to be yet unused.

I like it.

Reviewed-by: Matt Turner 
___
mesa-dev mailing list
mesa-dev@lists.freedesktop.org
http://lists.freedesktop.org/mailman/listinfo/mesa-dev


[Mesa-dev] [PATCH] i965/fs: Fix unused variable warning

2015-06-10 Thread Chad Versace
Annotate offset_components with attribute 'unused'.
---
 src/mesa/drivers/dri/i965/brw_fs_nir.cpp | 3 ++-
 1 file changed, 2 insertions(+), 1 deletion(-)

diff --git a/src/mesa/drivers/dri/i965/brw_fs_nir.cpp 
b/src/mesa/drivers/dri/i965/brw_fs_nir.cpp
index 0f1a286..3c24a87 100644
--- a/src/mesa/drivers/dri/i965/brw_fs_nir.cpp
+++ b/src/mesa/drivers/dri/i965/brw_fs_nir.cpp
@@ -1599,7 +1599,8 @@ fs_visitor::nir_emit_texture(const fs_builder &bld, 
nir_tex_instr *instr)
bool is_cube_array = instr->sampler_dim == GLSL_SAMPLER_DIM_CUBE &&
 instr->is_array;
 
-   int lod_components = 0, offset_components = 0;
+   int lod_components = 0;
+   int UNUSED offset_components = 0;
 
fs_reg coordinate, shadow_comparitor, lod, lod2, sample_index, mcs, 
tex_offset;
 
-- 
2.4.2

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


Re: [Mesa-dev] [PATCH 7/9] egl: implement EGL_KHR_gl_colorspace

2015-06-10 Thread Marek Olšák
On Wed, Jun 10, 2015 at 6:47 PM, Matt Turner  wrote:
> On Wed, Jun 10, 2015 at 9:27 AM, Marek Olšák  wrote:
>> From: Marek Olšák 
>>
>> ---
>>  src/egl/drivers/dri2/egl_dri2.c | 40 
>> ++---
>>  src/egl/drivers/dri2/egl_dri2.h |  6 +
>>  src/egl/drivers/dri2/platform_android.c |  4 
>>  src/egl/drivers/dri2/platform_drm.c |  9 +---
>>  src/egl/drivers/dri2/platform_wayland.c |  9 +---
>>  src/egl/drivers/dri2/platform_x11.c | 12 +-
>>  src/egl/main/eglconfig.c|  3 ++-
>>  src/egl/main/eglsurface.c   | 24 
>>  src/egl/main/eglsurface.h   |  1 +
>>  9 files changed, 87 insertions(+), 21 deletions(-)
>>
>> diff --git a/src/egl/drivers/dri2/egl_dri2.c 
>> b/src/egl/drivers/dri2/egl_dri2.c
>> index eacb36c..84f0afb 100644
>> --- a/src/egl/drivers/dri2/egl_dri2.c
>> +++ b/src/egl/drivers/dri2/egl_dri2.c
>> @@ -28,6 +28,7 @@
>>  #define WL_HIDE_DEPRECATED
>>
>>  #include 
>> +#include 
>>  #include 
>>  #include 
>>  #include 
>> @@ -109,6 +110,18 @@ EGLint dri2_to_egl_attribute_map[] = {
>> 0,  /* __DRI_ATTRIB_FRAMEBUFFER_SRGB_CAPABLE */
>>  };
>>
>> +const __DRIconfig *
>> +dri2_get_dri_config(struct dri2_egl_config *conf, EGLint surface_type,
>> +EGLenum colorspace)
>> +{
>> +   if (colorspace == EGL_GL_COLORSPACE_SRGB_KHR)
>> +  return surface_type == EGL_WINDOW_BIT ? conf->dri_srgb_double_config :
>> +  conf->dri_srgb_single_config;
>> +   else
>> +  return surface_type == EGL_WINDOW_BIT ? conf->dri_double_config :
>> +  conf->dri_single_config;
>> +}
>> +
>>  static EGLBoolean
>>  dri2_match_config(const _EGLConfig *conf, const _EGLConfig *criteria)
>>  {
>> @@ -130,6 +143,7 @@ dri2_add_config(_EGLDisplay *disp, const __DRIconfig 
>> *dri_config, int id,
>> struct dri2_egl_display *dri2_dpy;
>> _EGLConfig base;
>> unsigned int attrib, value, double_buffer;
>> +   bool srgb = false;
>> EGLint key, bind_to_texture_rgb, bind_to_texture_rgba;
>> unsigned int dri_masks[4] = { 0, 0, 0, 0 };
>> _EGLConfig *matching_config;
>> @@ -202,6 +216,9 @@ dri2_add_config(_EGLDisplay *disp, const __DRIconfig 
>> *dri_config, int id,
>>   /* Don't expose visuals with the accumulation buffer. */
>>   if (value > 0)
>>  return NULL;
>> +
>
> Please mark this with a /* fallthrough */ comment so that static
> analysis tools don't think there's a missing break.

The missing "break" is actually a bug. Thanks.

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


Re: [Mesa-dev] [PATCH 7/9] egl: implement EGL_KHR_gl_colorspace

2015-06-10 Thread Matt Turner
On Wed, Jun 10, 2015 at 9:27 AM, Marek Olšák  wrote:
> From: Marek Olšák 
>
> ---
>  src/egl/drivers/dri2/egl_dri2.c | 40 
> ++---
>  src/egl/drivers/dri2/egl_dri2.h |  6 +
>  src/egl/drivers/dri2/platform_android.c |  4 
>  src/egl/drivers/dri2/platform_drm.c |  9 +---
>  src/egl/drivers/dri2/platform_wayland.c |  9 +---
>  src/egl/drivers/dri2/platform_x11.c | 12 +-
>  src/egl/main/eglconfig.c|  3 ++-
>  src/egl/main/eglsurface.c   | 24 
>  src/egl/main/eglsurface.h   |  1 +
>  9 files changed, 87 insertions(+), 21 deletions(-)
>
> diff --git a/src/egl/drivers/dri2/egl_dri2.c b/src/egl/drivers/dri2/egl_dri2.c
> index eacb36c..84f0afb 100644
> --- a/src/egl/drivers/dri2/egl_dri2.c
> +++ b/src/egl/drivers/dri2/egl_dri2.c
> @@ -28,6 +28,7 @@
>  #define WL_HIDE_DEPRECATED
>
>  #include 
> +#include 
>  #include 
>  #include 
>  #include 
> @@ -109,6 +110,18 @@ EGLint dri2_to_egl_attribute_map[] = {
> 0,  /* __DRI_ATTRIB_FRAMEBUFFER_SRGB_CAPABLE */
>  };
>
> +const __DRIconfig *
> +dri2_get_dri_config(struct dri2_egl_config *conf, EGLint surface_type,
> +EGLenum colorspace)
> +{
> +   if (colorspace == EGL_GL_COLORSPACE_SRGB_KHR)
> +  return surface_type == EGL_WINDOW_BIT ? conf->dri_srgb_double_config :
> +  conf->dri_srgb_single_config;
> +   else
> +  return surface_type == EGL_WINDOW_BIT ? conf->dri_double_config :
> +  conf->dri_single_config;
> +}
> +
>  static EGLBoolean
>  dri2_match_config(const _EGLConfig *conf, const _EGLConfig *criteria)
>  {
> @@ -130,6 +143,7 @@ dri2_add_config(_EGLDisplay *disp, const __DRIconfig 
> *dri_config, int id,
> struct dri2_egl_display *dri2_dpy;
> _EGLConfig base;
> unsigned int attrib, value, double_buffer;
> +   bool srgb = false;
> EGLint key, bind_to_texture_rgb, bind_to_texture_rgba;
> unsigned int dri_masks[4] = { 0, 0, 0, 0 };
> _EGLConfig *matching_config;
> @@ -202,6 +216,9 @@ dri2_add_config(_EGLDisplay *disp, const __DRIconfig 
> *dri_config, int id,
>   /* Don't expose visuals with the accumulation buffer. */
>   if (value > 0)
>  return NULL;
> +

Please mark this with a /* fallthrough */ comment so that static
analysis tools don't think there's a missing break.

> +  case __DRI_ATTRIB_FRAMEBUFFER_SRGB_CAPABLE:
> + srgb = value != 0;
>   break;
>
>default:
___
mesa-dev mailing list
mesa-dev@lists.freedesktop.org
http://lists.freedesktop.org/mailman/listinfo/mesa-dev


Re: [Mesa-dev] [PATCH 1/2] clover: Implement image attribute getters

2015-06-10 Thread Francisco Jerez
Zoltán Gilián  writes:

>> Whether you need to pass the image
>> dimensions and data type to the kernel as explicit parameters or not
>> (e.g. because your hardware already supports some sort of image metadata
>> query opcode) is driver-specific, so it would probably be a better idea
>> to append these parameters at the end of the input buffer in the r600
>> pipe driver itself.
>
> The image data type and channel order get converted to a pipe format value
> in clover before it reaches the driver, so either the driver needs to
> convert it back to OpenCL constants, or clover has to send the data
> explicitly to the pipe e.g. by appending it to the kernel parameters. What
> solution do you think is less problematic? Are there better mechanisms to
> send the image data type and channel order in OpenCL format to the pipe?

Both approaches you mention sound reasonable to me, as long as either
the pipe driver or LLVM back-end has control on whether and how these
implicit arguments are passed to the kernel.

>
> Furthermore IIRC the pipe has no explicit information on the number of
> image arguments, so it would have to gather that information to determine
> the amount of input memory needed by the kernel. Clover has that
> information easily accessible.

Yes, the pipe driver would have to assume that all images bound to the
pipeline may be used by the kernel, and make all their metadata
accessible to the kernel in some hardware-dependent manner (surface
metadata query opcode, implicit constant buffer, implicit arguments,
etc.).

>
> How bad would it be if image attributes were handled similarly to grid
> dimension and grid offset? The get_image_* builtins could be lowered to
> implicit parameter reads, so there is no need to perform the llvm pass.
>
The grid dimension and offset handling we have right now is a hack, it's
done that way because we're missing some target-independent mechanism
(e.g ELF metadata section) for the back-end to provide Clover
information about the implicit arguments it wants.  I guess it's OK if
you use the same approach as grid arguments for now, but we'll
definitely need a better solution for the long term.

> On Tue, Jun 9, 2015 at 11:09 AM, Zoltán Gilián 
> wrote:
>
>> Ok, thanks for the feedback.
>>
>> On Mon, Jun 8, 2015 at 2:18 PM, Francisco Jerez 
>> wrote:
>>
>>> Zoltan Gilian  writes:
>>>
>>> > Image attributes are passed to the kernel as hidden parameters after the
>>> > image attribute itself. An llvm pass replaces the getter builtins to
>>> > the appropriate parameters.
>>> > ---
>>> >  src/gallium/state_trackers/clover/core/kernel.cpp  |  13 ++
>>> >  src/gallium/state_trackers/clover/core/memory.cpp  |   2 +-
>>> >  .../state_trackers/clover/llvm/invocation.cpp  | 158
>>> -
>>> >  3 files changed, 170 insertions(+), 3 deletions(-)
>>> >
>>> > diff --git a/src/gallium/state_trackers/clover/core/kernel.cpp
>>> b/src/gallium/state_trackers/clover/core/kernel.cpp
>>> > index 0756f06..4703899 100644
>>> > --- a/src/gallium/state_trackers/clover/core/kernel.cpp
>>> > +++ b/src/gallium/state_trackers/clover/core/kernel.cpp
>>> > @@ -483,6 +483,19 @@ kernel::image_rd_argument::bind(exec_context &ctx,
>>> > align(ctx.input, marg.target_align);
>>> > insert(ctx.input, v);
>>> >
>>> > +   cl_image_format fmt = img->format();
>>> > +   cl_uint image_attribs[] = {img->width(), img->height(),
>>> img->depth(),
>>> > +  fmt.image_channel_data_type,
>>> > +  fmt.image_channel_order};
>>> > +   for (int i = 0; i < 5; i++) {
>>> > +  auto v = bytes(image_attribs[i]);
>>> > +
>>> > +  extend(v, module::argument::zero_ext, marg.target_size);
>>> > +  byteswap(v, ctx.q->device().endianness());
>>> > +  align(ctx.input, marg.target_align);
>>> > +  insert(ctx.input, v);
>>> > +   }
>>> > +
>>> This seems to be implementing driver-specific policy in a
>>> hardware-independent state tracker.  Whether you need to pass the image
>>> dimensions and data type to the kernel as explicit parameters or not
>>> (e.g. because your hardware already supports some sort of image metadata
>>> query opcode) is driver-specific, so it would probably be a better idea
>>> to append these parameters at the end of the input buffer in the r600
>>> pipe driver itself.
>>>
>>> > st = img->resource(*ctx.q).bind_sampler_view(*ctx.q);
>>> > ctx.sviews.push_back(st);
>>> >  }
>>> > diff --git a/src/gallium/state_trackers/clover/core/memory.cpp
>>> b/src/gallium/state_trackers/clover/core/memory.cpp
>>> > index 055336a..b852e68 100644
>>> > --- a/src/gallium/state_trackers/clover/core/memory.cpp
>>> > +++ b/src/gallium/state_trackers/clover/core/memory.cpp
>>> > @@ -189,7 +189,7 @@ image2d::image2d(clover::context &ctx, cl_mem_flags
>>> flags,
>>> >   const cl_image_format *format, size_t width,
>>> >   size_t height, size_t row_pitch,
>>> >   void *host_ptr) :
>>>

[Mesa-dev] [PATCH 1/9] egl: implement EGL_KHR_gl_texture_3D_image

2015-06-10 Thread Marek Olšák
From: Anatoli Antonovitch 

Most of the code has been in place already.
---
 src/egl/drivers/dri2/egl_dri2.c | 20 +---
 1 file changed, 17 insertions(+), 3 deletions(-)

diff --git a/src/egl/drivers/dri2/egl_dri2.c b/src/egl/drivers/dri2/egl_dri2.c
index 44a6c96..eacb36c 100644
--- a/src/egl/drivers/dri2/egl_dri2.c
+++ b/src/egl/drivers/dri2/egl_dri2.c
@@ -1559,9 +1559,15 @@ dri2_create_image_khr_texture(_EGLDisplay *disp, 
_EGLContext *ctx,
   gl_target = GL_TEXTURE_2D;
   break;
case EGL_GL_TEXTURE_3D_KHR:
-  depth = attrs.GLTextureZOffset;
-  gl_target = GL_TEXTURE_3D;
-  break;
+  if (disp->Extensions.KHR_gl_texture_3D_image) {
+ depth = attrs.GLTextureZOffset;
+ gl_target = GL_TEXTURE_3D;
+ break;
+  }
+  else {
+ _eglError(EGL_BAD_PARAMETER, "dri2_create_image_khr");
+ return EGL_NO_IMAGE_KHR;
+  }
case EGL_GL_TEXTURE_CUBE_MAP_POSITIVE_X_KHR:
case EGL_GL_TEXTURE_CUBE_MAP_NEGATIVE_X_KHR:
case EGL_GL_TEXTURE_CUBE_MAP_POSITIVE_Y_KHR:
@@ -1861,6 +1867,14 @@ dri2_create_image_khr(_EGLDriver *drv, _EGLDisplay *disp,
case EGL_GL_TEXTURE_CUBE_MAP_POSITIVE_Z_KHR:
case EGL_GL_TEXTURE_CUBE_MAP_NEGATIVE_Z_KHR:
   return dri2_create_image_khr_texture(disp, ctx, target, buffer, 
attr_list);
+   case EGL_GL_TEXTURE_3D_KHR:
+  if (disp->Extensions.KHR_gl_texture_3D_image) {
+ return dri2_create_image_khr_texture(disp, ctx, target, buffer, 
attr_list);
+  }
+  else {
+ _eglError(EGL_BAD_PARAMETER, "dri2_create_image_khr");
+ return EGL_NO_IMAGE_KHR;
+  }
case EGL_GL_RENDERBUFFER_KHR:
   return dri2_create_image_khr_renderbuffer(disp, ctx, buffer, attr_list);
 #ifdef HAVE_LIBDRM
-- 
2.1.0

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


[Mesa-dev] [PATCH 0/9] EGL 1.5 complete

2015-06-10 Thread Marek Olšák
Hi,

This patch series adds the remaining pieces for EGL 1.5, which are:
- EGL_KHR_gl_texture_3D_image
- EGL_KHR_gl_colorspace

The latter is non-trivial in that it touches most driver components, but the 
changes are usually small. Drivers can support it by exposing sRGB visuals.

The problem is that exposing sRGB visuals breaks GLX apps with GLES, because if 
they accidentally select such a visual, there is no way to switch off sRGB 
rendering. One such broken app is Ubuntu Unity. I don't know if that's Mesa's 
fault or Canonical's. There is one controversial patch that hides all sRGB 
visuals for GLX to work around the issue.

Please review.

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


[Mesa-dev] [PATCH 4/9] dri/common: allow BGRX sRGB visuals

2015-06-10 Thread Marek Olšák
From: Marek Olšák 

---
 src/mesa/drivers/dri/common/utils.c | 1 +
 1 file changed, 1 insertion(+)

diff --git a/src/mesa/drivers/dri/common/utils.c 
b/src/mesa/drivers/dri/common/utils.c
index 70d34e8..b51b263 100644
--- a/src/mesa/drivers/dri/common/utils.c
+++ b/src/mesa/drivers/dri/common/utils.c
@@ -213,6 +213,7 @@ driCreateConfigs(mesa_format format,
   masks = masks_table[0];
   break;
case MESA_FORMAT_B8G8R8X8_UNORM:
+   case MESA_FORMAT_B8G8R8X8_SRGB:
   masks = masks_table[1];
   break;
case MESA_FORMAT_B8G8R8A8_UNORM:
-- 
2.1.0

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


[Mesa-dev] [PATCH 9/9] st/dri: enable 3D textures and sRGB colorspace for EGL

2015-06-10 Thread Marek Olšák
From: Anatoli Antonovitch 

---
 src/gallium/state_trackers/dri/dri_query_renderer.c | 14 ++
 1 file changed, 14 insertions(+)

diff --git a/src/gallium/state_trackers/dri/dri_query_renderer.c 
b/src/gallium/state_trackers/dri/dri_query_renderer.c
index 4a28ac3..ea31b6c 100644
--- a/src/gallium/state_trackers/dri/dri_query_renderer.c
+++ b/src/gallium/state_trackers/dri/dri_query_renderer.c
@@ -42,6 +42,20 @@ dri2_query_renderer_integer(__DRIscreen *_screen, int param,
   PIPE_CAP_UMA);
   return 0;
 
+   case __DRI2_RENDERER_HAS_TEXTURE_3D:
+  value[0] =
+ screen->base.screen->get_param(screen->base.screen,
+PIPE_CAP_MAX_TEXTURE_3D_LEVELS) != 0;
+  return 0;
+
+   case __DRI2_RENDERER_HAS_FRAMEBUFFER_SRGB:
+  value[0] =
+ screen->base.screen->is_format_supported(screen->base.screen,
+  PIPE_FORMAT_B8G8R8A8_SRGB,
+  PIPE_TEXTURE_2D, 0,
+  PIPE_BIND_RENDER_TARGET);
+  return 0;
+
default:
   return driQueryRendererIntegerCommon(_screen, param, value);
}
-- 
2.1.0

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


[Mesa-dev] [PATCH 7/9] egl: implement EGL_KHR_gl_colorspace

2015-06-10 Thread Marek Olšák
From: Marek Olšák 

---
 src/egl/drivers/dri2/egl_dri2.c | 40 ++---
 src/egl/drivers/dri2/egl_dri2.h |  6 +
 src/egl/drivers/dri2/platform_android.c |  4 
 src/egl/drivers/dri2/platform_drm.c |  9 +---
 src/egl/drivers/dri2/platform_wayland.c |  9 +---
 src/egl/drivers/dri2/platform_x11.c | 12 +-
 src/egl/main/eglconfig.c|  3 ++-
 src/egl/main/eglsurface.c   | 24 
 src/egl/main/eglsurface.h   |  1 +
 9 files changed, 87 insertions(+), 21 deletions(-)

diff --git a/src/egl/drivers/dri2/egl_dri2.c b/src/egl/drivers/dri2/egl_dri2.c
index eacb36c..84f0afb 100644
--- a/src/egl/drivers/dri2/egl_dri2.c
+++ b/src/egl/drivers/dri2/egl_dri2.c
@@ -28,6 +28,7 @@
 #define WL_HIDE_DEPRECATED
 
 #include 
+#include 
 #include 
 #include 
 #include 
@@ -109,6 +110,18 @@ EGLint dri2_to_egl_attribute_map[] = {
0,  /* __DRI_ATTRIB_FRAMEBUFFER_SRGB_CAPABLE */
 };
 
+const __DRIconfig *
+dri2_get_dri_config(struct dri2_egl_config *conf, EGLint surface_type,
+EGLenum colorspace)
+{
+   if (colorspace == EGL_GL_COLORSPACE_SRGB_KHR)
+  return surface_type == EGL_WINDOW_BIT ? conf->dri_srgb_double_config :
+  conf->dri_srgb_single_config;
+   else
+  return surface_type == EGL_WINDOW_BIT ? conf->dri_double_config :
+  conf->dri_single_config;
+}
+
 static EGLBoolean
 dri2_match_config(const _EGLConfig *conf, const _EGLConfig *criteria)
 {
@@ -130,6 +143,7 @@ dri2_add_config(_EGLDisplay *disp, const __DRIconfig 
*dri_config, int id,
struct dri2_egl_display *dri2_dpy;
_EGLConfig base;
unsigned int attrib, value, double_buffer;
+   bool srgb = false;
EGLint key, bind_to_texture_rgb, bind_to_texture_rgba;
unsigned int dri_masks[4] = { 0, 0, 0, 0 };
_EGLConfig *matching_config;
@@ -202,6 +216,9 @@ dri2_add_config(_EGLDisplay *disp, const __DRIconfig 
*dri_config, int id,
  /* Don't expose visuals with the accumulation buffer. */
  if (value > 0)
 return NULL;
+
+  case __DRI_ATTRIB_FRAMEBUFFER_SRGB_CAPABLE:
+ srgb = value != 0;
  break;
 
   default:
@@ -249,28 +266,35 @@ dri2_add_config(_EGLDisplay *disp, const __DRIconfig 
*dri_config, int id,
if (num_configs == 1) {
   conf = (struct dri2_egl_config *) matching_config;
 
-  if (double_buffer && !conf->dri_double_config)
+  if (double_buffer && srgb && !conf->dri_srgb_double_config)
+ conf->dri_srgb_double_config = dri_config;
+  else if (double_buffer && !srgb && !conf->dri_double_config)
  conf->dri_double_config = dri_config;
-  else if (!double_buffer && !conf->dri_single_config)
+  else if (!double_buffer && srgb && !conf->dri_srgb_single_config)
+ conf->dri_srgb_single_config = dri_config;
+  else if (!double_buffer && !srgb && !conf->dri_single_config)
  conf->dri_single_config = dri_config;
   else
  /* a similar config type is already added (unlikely) => discard */
  return NULL;
}
else if (num_configs == 0) {
-  conf = malloc(sizeof *conf);
+  conf = calloc(1, sizeof *conf);
   if (conf == NULL)
  return NULL;
 
   memcpy(&conf->base, &base, sizeof base);
   if (double_buffer) {
- conf->dri_double_config = dri_config;
- conf->dri_single_config = NULL;
+ if (srgb)
+conf->dri_srgb_double_config = dri_config;
+ else
+conf->dri_double_config = dri_config;
   } else {
- conf->dri_single_config = dri_config;
- conf->dri_double_config = NULL;
+ if (srgb)
+conf->dri_srgb_single_config = dri_config;
+ else
+conf->dri_single_config = dri_config;
   }
-  conf->base.SurfaceType = 0;
   conf->base.ConfigID = config_id;
 
   _eglLinkConfig(&conf->base);
diff --git a/src/egl/drivers/dri2/egl_dri2.h b/src/egl/drivers/dri2/egl_dri2.h
index adade3d..6b9a48e 100644
--- a/src/egl/drivers/dri2/egl_dri2.h
+++ b/src/egl/drivers/dri2/egl_dri2.h
@@ -285,6 +285,8 @@ struct dri2_egl_config
_EGLConfig base;
const __DRIconfig *dri_single_config;
const __DRIconfig *dri_double_config;
+   const __DRIconfig *dri_srgb_single_config;
+   const __DRIconfig *dri_srgb_double_config;
 };
 
 struct dri2_egl_image
@@ -354,4 +356,8 @@ dri2_initialize_android(_EGLDriver *drv, _EGLDisplay *disp);
 void
 dri2_flush_drawable_for_swapbuffers(_EGLDisplay *disp, _EGLSurface *draw);
 
+const __DRIconfig *
+dri2_get_dri_config(struct dri2_egl_config *conf, EGLint surface_type,
+EGLenum colorspace);
+
 #endif /* EGL_DRI2_INCLUDED */
diff --git a/src/egl/drivers/dri2/platform_android.c 
b/src/egl/drivers/dri2/platform_android.c
index fed3073..3cb2459 100644
--- a/src/egl/drivers/dri2/platf

[Mesa-dev] [PATCH 2/9] egl: sort extension lists alphabetically

2015-06-10 Thread Marek Olšák
From: Marek Olšák 

and add the missing KHR_gl_colorspace case.
---
 src/egl/main/eglapi.c | 53 +++
 src/egl/main/egldisplay.h | 48 --
 src/egl/main/eglglobals.c |  4 ++--
 3 files changed, 51 insertions(+), 54 deletions(-)

diff --git a/src/egl/main/eglapi.c b/src/egl/main/eglapi.c
index 105e919..824e51e 100644
--- a/src/egl/main/eglapi.c
+++ b/src/egl/main/eglapi.c
@@ -381,48 +381,47 @@ _eglCreateExtensionsString(_EGLDisplay *dpy)
 
char *exts = dpy->ExtensionsString;
 
-   _EGL_CHECK_EXTENSION(MESA_drm_display);
-   _EGL_CHECK_EXTENSION(MESA_drm_image);
-   _EGL_CHECK_EXTENSION(MESA_configless_context);
+   /* Please keep these sorted alphabetically. */
+   _EGL_CHECK_EXTENSION(ANDROID_image_native_buffer);
 
-   _EGL_CHECK_EXTENSION(WL_bind_wayland_display);
-   _EGL_CHECK_EXTENSION(WL_create_wayland_buffer_from_image);
+   _EGL_CHECK_EXTENSION(CHROMIUM_sync_control);
 
-   _EGL_CHECK_EXTENSION(KHR_image_base);
-   _EGL_CHECK_EXTENSION(KHR_image_pixmap);
-   if (dpy->Extensions.KHR_image_base && dpy->Extensions.KHR_image_pixmap)
-  _eglAppendExtension(&exts, "EGL_KHR_image");
+   _EGL_CHECK_EXTENSION(EXT_buffer_age);
+   _EGL_CHECK_EXTENSION(EXT_create_context_robustness);
+   _EGL_CHECK_EXTENSION(EXT_image_dma_buf_import);
+   _EGL_CHECK_EXTENSION(EXT_swap_buffers_with_damage);
 
-   _EGL_CHECK_EXTENSION(KHR_vg_parent_image);
+   _EGL_CHECK_EXTENSION(KHR_cl_event2);
+   _EGL_CHECK_EXTENSION(KHR_create_context);
+   _EGL_CHECK_EXTENSION(KHR_fence_sync);
_EGL_CHECK_EXTENSION(KHR_get_all_proc_addresses);
+   _EGL_CHECK_EXTENSION(KHR_gl_colorspace);
+   _EGL_CHECK_EXTENSION(KHR_gl_renderbuffer_image);
_EGL_CHECK_EXTENSION(KHR_gl_texture_2D_image);
-   _EGL_CHECK_EXTENSION(KHR_gl_texture_cubemap_image);
_EGL_CHECK_EXTENSION(KHR_gl_texture_3D_image);
-   _EGL_CHECK_EXTENSION(KHR_gl_renderbuffer_image);
-
+   _EGL_CHECK_EXTENSION(KHR_gl_texture_cubemap_image);
+   if (dpy->Extensions.KHR_image_base && dpy->Extensions.KHR_image_pixmap)
+  _eglAppendExtension(&exts, "EGL_KHR_image");
+   _EGL_CHECK_EXTENSION(KHR_image_base);
+   _EGL_CHECK_EXTENSION(KHR_image_pixmap);
_EGL_CHECK_EXTENSION(KHR_reusable_sync);
-   _EGL_CHECK_EXTENSION(KHR_fence_sync);
+   _EGL_CHECK_EXTENSION(KHR_surfaceless_context);
+   _EGL_CHECK_EXTENSION(KHR_vg_parent_image);
_EGL_CHECK_EXTENSION(KHR_wait_sync);
-   _EGL_CHECK_EXTENSION(KHR_cl_event2);
 
-   _EGL_CHECK_EXTENSION(KHR_surfaceless_context);
-   _EGL_CHECK_EXTENSION(KHR_create_context);
+   _EGL_CHECK_EXTENSION(MESA_configless_context);
+   _EGL_CHECK_EXTENSION(MESA_drm_display);
+   _EGL_CHECK_EXTENSION(MESA_drm_image);
+   _EGL_CHECK_EXTENSION(MESA_image_dma_buf_export);
 
_EGL_CHECK_EXTENSION(NOK_swap_region);
_EGL_CHECK_EXTENSION(NOK_texture_from_pixmap);
 
-   _EGL_CHECK_EXTENSION(ANDROID_image_native_buffer);
-
-   _EGL_CHECK_EXTENSION(CHROMIUM_sync_control);
-
-   _EGL_CHECK_EXTENSION(EXT_create_context_robustness);
-   _EGL_CHECK_EXTENSION(EXT_buffer_age);
-   _EGL_CHECK_EXTENSION(EXT_swap_buffers_with_damage);
-   _EGL_CHECK_EXTENSION(EXT_image_dma_buf_import);
-
_EGL_CHECK_EXTENSION(NV_post_sub_buffer);
 
-   _EGL_CHECK_EXTENSION(MESA_image_dma_buf_export);
+   _EGL_CHECK_EXTENSION(WL_bind_wayland_display);
+   _EGL_CHECK_EXTENSION(WL_create_wayland_buffer_from_image);
+
 #undef _EGL_CHECK_EXTENSION
 }
 
diff --git a/src/egl/main/egldisplay.h b/src/egl/main/egldisplay.h
index 84cfbe1..7241792 100644
--- a/src/egl/main/egldisplay.h
+++ b/src/egl/main/egldisplay.h
@@ -90,46 +90,44 @@ struct _egl_resource
  */
 struct _egl_extensions
 {
-   EGLBoolean MESA_drm_display;
-   EGLBoolean MESA_drm_image;
-   EGLBoolean MESA_configless_context;
+   /* Please keep these sorted alphabetically. */
+   EGLBoolean ANDROID_image_native_buffer;
 
-   EGLBoolean WL_bind_wayland_display;
-   EGLBoolean WL_create_wayland_buffer_from_image;
+   EGLBoolean CHROMIUM_sync_control;
 
-   EGLBoolean KHR_image_base;
-   EGLBoolean KHR_image_pixmap;
-   EGLBoolean KHR_vg_parent_image;
+   EGLBoolean EXT_buffer_age;
+   EGLBoolean EXT_create_context_robustness;
+   EGLBoolean EXT_image_dma_buf_import;
+   EGLBoolean EXT_swap_buffers_with_damage;
+
+   EGLBoolean KHR_cl_event2;
+   EGLBoolean KHR_create_context;
+   EGLBoolean KHR_fence_sync;
EGLBoolean KHR_get_all_proc_addresses;
EGLBoolean KHR_gl_colorspace;
+   EGLBoolean KHR_gl_renderbuffer_image;
EGLBoolean KHR_gl_texture_2D_image;
-   EGLBoolean KHR_gl_texture_cubemap_image;
EGLBoolean KHR_gl_texture_3D_image;
-   EGLBoolean KHR_gl_renderbuffer_image;
-
+   EGLBoolean KHR_gl_texture_cubemap_image;
+   EGLBoolean KHR_image_base;
+   EGLBoolean KHR_image_pixmap;
EGLBoolean KHR_reusable_sync;
-   EGLBoolean KHR_fence_sync;
+   EGLBoolean KHR_surfaceless_context;
+   EGLBoolean KHR_vg_parent_image;
EGLBoolean KHR_wait_sync;
-   EGLBoolean KHR_cl_event2;
 
-   EGLBoolean KHR_surfaceless_conte

[Mesa-dev] [PATCH 3/9] mesa: fix sRGB rendering for GLES1

2015-06-10 Thread Marek Olšák
From: Marek Olšák 

---
 src/mesa/main/blend.c | 10 --
 1 file changed, 4 insertions(+), 6 deletions(-)

diff --git a/src/mesa/main/blend.c b/src/mesa/main/blend.c
index d869fa2..d365305 100644
--- a/src/mesa/main/blend.c
+++ b/src/mesa/main/blend.c
@@ -930,12 +930,10 @@ void _mesa_init_color( struct gl_context * ctx )
ctx->Color._ClampFragmentColor = GL_FALSE;
ctx->Color.ClampReadColor = GL_FIXED_ONLY_ARB;
 
-   if (ctx->API == API_OPENGLES2) {
-  /* GLES 3 behaves as though GL_FRAMEBUFFER_SRGB is always enabled. */
-  ctx->Color.sRGBEnabled = GL_TRUE;
-   } else {
-  ctx->Color.sRGBEnabled = GL_FALSE;
-   }
+   /* GLES 1/2/3 behaves as though GL_FRAMEBUFFER_SRGB is always enabled
+* if EGL_KHR_gl_colorspace has been used to request sRGB.
+*/
+   ctx->Color.sRGBEnabled = _mesa_is_gles(ctx);
 }
 
 /*@}*/
-- 
2.1.0

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


[Mesa-dev] [PATCH 6/9] st/dri: expose sRGB visuals

2015-06-10 Thread Marek Olšák
From: Marek Olšák 

They are only useful for EGL currently, because the previous patch disables
them for GLX.
---
 src/gallium/state_trackers/dri/dri2.c   |  2 ++
 src/gallium/state_trackers/dri/dri_screen.c | 23 +++
 src/mesa/state_tracker/st_manager.c |  1 +
 3 files changed, 22 insertions(+), 4 deletions(-)

diff --git a/src/gallium/state_trackers/dri/dri2.c 
b/src/gallium/state_trackers/dri/dri2.c
index 792d565..a24c104 100644
--- a/src/gallium/state_trackers/dri/dri2.c
+++ b/src/gallium/state_trackers/dri/dri2.c
@@ -189,9 +189,11 @@ dri2_drawable_get_buffers(struct dri_drawable *drawable,
*/
   switch(format) {
   case PIPE_FORMAT_B8G8R8A8_UNORM:
+  case PIPE_FORMAT_B8G8R8A8_SRGB:
 depth = 32;
 break;
   case PIPE_FORMAT_B8G8R8X8_UNORM:
+  case PIPE_FORMAT_B8G8R8X8_SRGB:
 depth = 24;
 break;
   case PIPE_FORMAT_B5G6R5_UNORM:
diff --git a/src/gallium/state_trackers/dri/dri_screen.c 
b/src/gallium/state_trackers/dri/dri_screen.c
index 85393d8..c4c2d9c 100644
--- a/src/gallium/state_trackers/dri/dri_screen.c
+++ b/src/gallium/state_trackers/dri/dri_screen.c
@@ -103,14 +103,18 @@ dri_fill_st_options(struct st_config_options *options,
 static const __DRIconfig **
 dri_fill_in_modes(struct dri_screen *screen)
 {
-   static const mesa_format mesa_formats[3] = {
+   static const mesa_format mesa_formats[] = {
   MESA_FORMAT_B8G8R8A8_UNORM,
   MESA_FORMAT_B8G8R8X8_UNORM,
+  MESA_FORMAT_B8G8R8A8_SRGB,
+  MESA_FORMAT_B8G8R8X8_SRGB,
   MESA_FORMAT_B5G6R5_UNORM,
};
-   static const enum pipe_format pipe_formats[3] = {
+   static const enum pipe_format pipe_formats[] = {
   PIPE_FORMAT_BGRA_UNORM,
   PIPE_FORMAT_BGRX_UNORM,
+  PIPE_FORMAT_BGRA_SRGB,
+  PIPE_FORMAT_BGRX_SRGB,
   PIPE_FORMAT_B5G6R5_UNORM,
};
mesa_format format;
@@ -186,6 +190,11 @@ dri_fill_in_modes(struct dri_screen *screen)
   unsigned num_msaa_modes = 0; /* includes a single-sample mode */
   uint8_t msaa_modes[MSAA_VISUAL_MAX_SAMPLES];
 
+  if (!p_screen->is_format_supported(p_screen, pipe_formats[format],
+ PIPE_TEXTURE_2D, 0,
+ PIPE_BIND_RENDER_TARGET))
+ continue;
+
   for (i = 1; i <= msaa_samples_max; i++) {
  int samples = i > 1 ? i : 0;
 
@@ -241,9 +250,15 @@ dri_fill_st_visual(struct st_visual *stvis, struct 
dri_screen *screen,
 
if (mode->redBits == 8) {
   if (mode->alphaBits == 8)
- stvis->color_format = PIPE_FORMAT_BGRA_UNORM;
+ if (mode->sRGBCapable)
+stvis->color_format = PIPE_FORMAT_BGRA_SRGB;
+ else
+stvis->color_format = PIPE_FORMAT_BGRA_UNORM;
   else
- stvis->color_format = PIPE_FORMAT_BGRX_UNORM;
+ if (mode->sRGBCapable)
+stvis->color_format = PIPE_FORMAT_BGRX_SRGB;
+ else
+stvis->color_format = PIPE_FORMAT_BGRX_UNORM;
} else {
   stvis->color_format = PIPE_FORMAT_B5G6R5_UNORM;
}
diff --git a/src/mesa/state_tracker/st_manager.c 
b/src/mesa/state_tracker/st_manager.c
index a2dee62..2e2c8ff 100644
--- a/src/mesa/state_tracker/st_manager.c
+++ b/src/mesa/state_tracker/st_manager.c
@@ -368,6 +368,7 @@ st_visual_to_context_mode(const struct st_visual *visual,
 
   mode->rgbBits = mode->redBits +
  mode->greenBits + mode->blueBits + mode->alphaBits;
+  mode->sRGBCapable = util_format_is_srgb(visual->color_format);
}
 
if (visual->depth_stencil_format != PIPE_FORMAT_NONE) {
-- 
2.1.0

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


[Mesa-dev] [PATCH 8/9] egl, dri: use DRI2rendererQueryExtension to enable 3D textures & sRGB

2015-06-10 Thread Marek Olšák
From: Marek Olšák 

---
 include/GL/internal/dri_interface.h |  5 +
 src/egl/drivers/dri2/egl_dri2.c | 23 +++
 src/egl/drivers/dri2/egl_dri2.h |  1 +
 3 files changed, 29 insertions(+)

diff --git a/include/GL/internal/dri_interface.h 
b/include/GL/internal/dri_interface.h
index c827bb6..f04799a 100644
--- a/include/GL/internal/dri_interface.h
+++ b/include/GL/internal/dri_interface.h
@@ -1444,6 +1444,11 @@ typedef struct __DRIDriverVtableExtensionRec {
 #define __DRI2_RENDERER_OPENGL_COMPATIBILITY_PROFILE_VERSION  0x0008
 #define __DRI2_RENDERER_OPENGL_ES_PROFILE_VERSION 0x0009
 #define __DRI2_RENDERER_OPENGL_ES2_PROFILE_VERSION0x000a
+#define __DRI2_RENDERER_HAS_TEXTURE_3D0x000b
+/* Whether there is an sRGB format support for every supported 32-bit UNORM
+ * color format.
+ */
+#define __DRI2_RENDERER_HAS_FRAMEBUFFER_SRGB  0x000c
 
 typedef struct __DRI2rendererQueryExtensionRec __DRI2rendererQueryExtension;
 struct __DRI2rendererQueryExtensionRec {
diff --git a/src/egl/drivers/dri2/egl_dri2.c b/src/egl/drivers/dri2/egl_dri2.c
index 84f0afb..5a2602e 100644
--- a/src/egl/drivers/dri2/egl_dri2.c
+++ b/src/egl/drivers/dri2/egl_dri2.c
@@ -524,6 +524,19 @@ dri2_load_driver_swrast(_EGLDisplay *disp)
return EGL_TRUE;
 }
 
+static unsigned
+dri2_renderer_query_integer(struct dri2_egl_display *dri2_dpy, int param)
+{
+   const __DRI2rendererQueryExtension *rendererQuery = dri2_dpy->rendererQuery;
+   unsigned int value = 0;
+
+   if (!rendererQuery ||
+   rendererQuery->queryInteger(dri2_dpy->dri_screen, param, &value) == -1)
+  return 0;
+
+   return value;
+}
+
 void
 dri2_setup_screen(_EGLDisplay *disp)
 {
@@ -554,6 +567,10 @@ dri2_setup_screen(_EGLDisplay *disp)
disp->Extensions.KHR_surfaceless_context = EGL_TRUE;
disp->Extensions.MESA_configless_context = EGL_TRUE;
 
+   if (dri2_renderer_query_integer(dri2_dpy,
+   __DRI2_RENDERER_HAS_FRAMEBUFFER_SRGB))
+  disp->Extensions.KHR_gl_colorspace = EGL_TRUE;
+
if (dri2_dpy->dri2 && dri2_dpy->dri2->base.version >= 3) {
   disp->Extensions.KHR_create_context = EGL_TRUE;
 
@@ -591,6 +608,9 @@ dri2_setup_screen(_EGLDisplay *disp)
  disp->Extensions.KHR_gl_texture_2D_image = EGL_TRUE;
  disp->Extensions.KHR_gl_texture_cubemap_image = EGL_TRUE;
   }
+  if (dri2_renderer_query_integer(dri2_dpy,
+  __DRI2_RENDERER_HAS_TEXTURE_3D))
+ disp->Extensions.KHR_gl_texture_3D_image = EGL_TRUE;
 #ifdef HAVE_LIBDRM
   if (dri2_dpy->image->base.version >= 8 &&
   dri2_dpy->image->createImageFromDmaBufs) {
@@ -668,6 +688,9 @@ dri2_create_screen(_EGLDisplay *disp)
   if (strcmp(extensions[i]->name, __DRI2_FENCE) == 0) {
  dri2_dpy->fence = (__DRI2fenceExtension *) extensions[i];
   }
+  if (strcmp(extensions[i]->name, __DRI2_RENDERER_QUERY) == 0) {
+ dri2_dpy->rendererQuery = (__DRI2rendererQueryExtension *) 
extensions[i];
+  }
}
 
dri2_setup_screen(disp);
diff --git a/src/egl/drivers/dri2/egl_dri2.h b/src/egl/drivers/dri2/egl_dri2.h
index 6b9a48e..32c7eec 100644
--- a/src/egl/drivers/dri2/egl_dri2.h
+++ b/src/egl/drivers/dri2/egl_dri2.h
@@ -166,6 +166,7 @@ struct dri2_egl_display
const __DRIrobustnessExtension *robustness;
const __DRI2configQueryExtension *config;
const __DRI2fenceExtension *fence;
+   const __DRI2rendererQueryExtension *rendererQuery;
int   fd;
 
int   own_device;
-- 
2.1.0

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


[Mesa-dev] [PATCH 5/9] glx: don't expose sRGB visuals

2015-06-10 Thread Marek Olšák
From: Marek Olšák 

The problem is it makes Ubuntu Unity dark. It's probably using
OpenGL ES 2.0, chooses an sRGB-capable config and there is no way
to turn off sRGB rendering then.
---
 src/glx/dri_common.c | 9 +
 1 file changed, 9 insertions(+)

diff --git a/src/glx/dri_common.c b/src/glx/dri_common.c
index 63c8de3..a5a6c7c 100644
--- a/src/glx/dri_common.c
+++ b/src/glx/dri_common.c
@@ -317,6 +317,15 @@ driConfigEqual(const __DRIcoreExtension *core,
 return GL_FALSE;
  break;
 
+  case __DRI_ATTRIB_FRAMEBUFFER_SRGB_CAPABLE:
+ /* Don't expose sRGB-capable configs.
+  * DRI drivers only expose them for EGL_KHR_gl_colorspace,
+  * but historically no drivers have exposed them for GLX.
+  */
+ if (!scalarEqual(config, attrib, 0))
+return GL_FALSE;
+ break;
+
   default:
  if (!scalarEqual(config, attrib, value))
 return GL_FALSE;
-- 
2.1.0

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


  1   2   >