Re: [Mesa-dev] [PATCH 2/3] state_tracker: allow to utilize GLSL workaround for broken apps in Gallium

2012-08-23 Thread Vadim Girlin
On Wed, 2012-08-22 at 19:08 +0300, Maxim Levitsky wrote:
> On Wed, 2012-08-22 at 19:54 +0400, Vadim Girlin wrote: 
> > On Wed, 2012-08-22 at 11:31 -0400, Alex Deucher wrote:
> > > On Wed, Aug 22, 2012 at 11:24 AM, Vadim Girlin  
> > > wrote:
> > > > On Wed, 2012-08-22 at 11:23 +0300, Maxim Levitsky wrote:
> > > >> Currently Gallium has no way to activate the
> > > >> 'force_glsl_extensions_warn' workaround that allows
> > > >> buggy apps that use GLSL extensions without asking for them to work.
> > > >>
> > > >> Since gallium mesa state tracker is essentially split into two,
> > > >> (dri (src/gallium/state_trackers/dri) and mesa 
> > > >> (src/mesa/state_tracker))
> > > >> and only former has access to driconf options while later knows nothing
> > > >> about dri, I added this support by reading an environment variable.
> > > >>
> > > >> export force_glsl_extensions_warn=true
> > > >>
> > > >
> > > > I just remembered that I sent some patches for passing the driconf
> > > > options to the state tracker but then forgot about them completely.
> > > >
> > > > Feel free to reuse anything from that series if it might help:
> > > >
> > > > http://lists.freedesktop.org/archives/mesa-dev/2012-April/020729.html
> > > 
> > > Series looks good to me.  Looks like Michel added his reviewed-by at
> > > the time as well.  
> > 
> > Yes, it was reviewed, but then I found that it breaks swrast build due
> > to missing driver descriptor, so I asked if it's OK to simply add the
> > descriptor to swrast and it seems I'm still waiting for the answer... :)
> > 
> > > If it still applies, I'd say go ahead and commit it.
> > 
> > I'll check if it still works and if it's enough to run Unigine apps
> > correctly with current mesa. IIRC it doesn't contain GLSL version hacks
> > as in Maxim's patch 3, so possibly it should be included too, and maybe
> > something else.
> Unless you enable 'ambient occlusion' in Heaven, just GLSL force
> extension hack (which is included in this series), is enough.
> 
> With it, it starts using  ARB_shader_bit_encoding extension, and to make
> it aviable you need my patch #3, but even that is not enough as demo
> introduces unrelated compile error, when extension is enabled.
> I have a local hack to override this, but its not worth looking at.
> Just for reference I attach it.

It seems the support for this extension (ARB_shader_bit_encoding) in
Unigine is too broken, so I guess we could disable it completely for
those apps instead of applying multiple hacks/workarounds for
compatibility. Currently we can do it using the environment variable:

MESA_EXTENSION_OVERRIDE=-GL_ARB_shader_bit_encoding

AFAICS with Heaven 3.0 and r600g it's enough to disable the extension as
shown above and use "force_glsl_extensions_warn=true" to run that demo
without noticeable problems on current git mesa.

Probably we might want to add similar config option (extension override)
to ".drirc", so the users will be able to use the config file with
app-specific compatibility options instead of playing with env vars.

Vadim

> 
> Today I will test this patch series,
> and thanks for telling about it, as I was about to stop being lazy and
> implement the same thing.
> 
> 
> Best regards,
> Maxim Levitsky



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


[Mesa-dev] [PATCH] swrast: implement cubical depth texture sampling

2012-08-23 Thread Brian Paul
From: Brian Paul 

Fixes a few more failures in the piglit copyteximage test.
---
 src/mesa/swrast/s_texfilter.c |  115 ++---
 1 files changed, 74 insertions(+), 41 deletions(-)

diff --git a/src/mesa/swrast/s_texfilter.c b/src/mesa/swrast/s_texfilter.c
index 3c2aae9..d116a05 100644
--- a/src/mesa/swrast/s_texfilter.c
+++ b/src/mesa/swrast/s_texfilter.c
@@ -800,6 +800,42 @@ get_border_color(const struct gl_sampler_object *samp,
 }
 
 
+/**
+ * Put z into texel according to GL_DEPTH_MODE.
+ */
+static INLINE void
+apply_depth_mode(GLenum depthMode, GLfloat z, GLfloat texel[4])
+{
+   switch (depthMode) {
+   case GL_LUMINANCE:
+  ASSIGN_4V(texel, z, z, z, 1.0F);
+  break;
+   case GL_INTENSITY:
+  ASSIGN_4V(texel, z, z, z, z);
+  break;
+   case GL_ALPHA:
+  ASSIGN_4V(texel, 0.0F, 0.0F, 0.0F, z);
+  break;
+   case GL_RED:
+  ASSIGN_4V(texel, z, 0.0F, 0.0F, 1.0F);
+  break;
+   default:
+  _mesa_problem(NULL, "Bad depth texture mode");
+   }
+}
+
+
+/**
+ * Is the given texture a depth (or depth/stencil) texture?
+ */
+static GLboolean
+is_depth_texture(const struct gl_texture_object *tObj)
+{
+   GLenum format = tObj->Image[0][tObj->BaseLevel]->_BaseFormat;
+   return format == GL_DEPTH_COMPONENT || format == GL_DEPTH_STENCIL_EXT;
+}
+
+
 /**/
 /*1-D Texture Sampling Functions  */
 /**/
@@ -2391,6 +2427,11 @@ sample_nearest_cube(struct gl_context *ctx,
   sample_2d_nearest(ctx, samp, images[tObj->BaseLevel],
 newCoord, rgba[i]);
}
+   if (is_depth_texture(tObj)) {
+  for (i = 0; i < n; i++) {
+ apply_depth_mode(tObj->DepthMode, rgba[i][0], rgba[i]);
+  }
+   }
 }
 
 
@@ -2410,6 +2451,11 @@ sample_linear_cube(struct gl_context *ctx,
   sample_2d_linear(ctx, samp, images[tObj->BaseLevel],
newCoord, rgba[i]);
}
+   if (is_depth_texture(tObj)) {
+  for (i = 0; i < n; i++) {
+ apply_depth_mode(tObj->DepthMode, rgba[i][0], rgba[i]);
+  }
+   }
 }
 
 
@@ -2440,6 +2486,11 @@ sample_cube_nearest_mipmap_nearest(struct gl_context 
*ctx,
 
   sample_2d_nearest(ctx, samp, images[level], newCoord, rgba[i]);
}
+   if (is_depth_texture(tObj)) {
+  for (i = 0; i < n; i++) {
+ apply_depth_mode(tObj->DepthMode, rgba[i][0], rgba[i]);
+  }
+   }
 }
 
 
@@ -2460,6 +2511,11 @@ sample_cube_linear_mipmap_nearest(struct gl_context *ctx,
   images = choose_cube_face(tObj, texcoord[i], newCoord);
   sample_2d_linear(ctx, samp, images[level], newCoord, rgba[i]);
}
+   if (is_depth_texture(tObj)) {
+  for (i = 0; i < n; i++) {
+ apply_depth_mode(tObj->DepthMode, rgba[i][0], rgba[i]);
+  }
+   }
 }
 
 
@@ -2490,6 +2546,11 @@ sample_cube_nearest_mipmap_linear(struct gl_context *ctx,
  lerp_rgba(rgba[i], f, t0, t1);
   }
}
+   if (is_depth_texture(tObj)) {
+  for (i = 0; i < n; i++) {
+ apply_depth_mode(tObj->DepthMode, rgba[i][0], rgba[i]);
+  }
+   }
 }
 
 
@@ -2520,6 +2581,11 @@ sample_cube_linear_mipmap_linear(struct gl_context *ctx,
  lerp_rgba(rgba[i], f, t0, t1);
   }
}
+   if (is_depth_texture(tObj)) {
+  for (i = 0; i < n; i++) {
+ apply_depth_mode(tObj->DepthMode, rgba[i][0], rgba[i]);
+  }
+   }
 }
 
 
@@ -3520,23 +3586,7 @@ sample_depth_texture( struct gl_context *ctx,
 
  result = shadow_compare(function, depthRef, depthSample);
 
- switch (tObj->DepthMode) {
- case GL_LUMINANCE:
-ASSIGN_4V(texel[i], result, result, result, 1.0F);
-break;
- case GL_INTENSITY:
-ASSIGN_4V(texel[i], result, result, result, result);
-break;
- case GL_ALPHA:
-ASSIGN_4V(texel[i], 0.0F, 0.0F, 0.0F, result);
-break;
- case GL_RED:
-ASSIGN_4V(texel[i], result, 0.0F, 0.0F, 1.0F);
-break;
- default:
-_mesa_problem(ctx, "Bad depth texture mode");
-break;
- }
+ apply_depth_mode(tObj->DepthMode, result, texel[i]);
   }
}
else {
@@ -3615,20 +3665,7 @@ sample_depth_texture( struct gl_context *ctx,
   depth00, depth01, depth10, depth11,
   wi, wj);
 
- switch (tObj->DepthMode) {
- case GL_LUMINANCE:
-ASSIGN_4V(texel[i], result, result, result, 1.0F);
-break;
- case GL_INTENSITY:
-ASSIGN_4V(texel[i], result, result, result, result);
-break;
- case GL_ALPHA:
-ASSIGN_4V(texel[i], 0.0F, 0.0F, 0.0F, result);
-break;
- default:
-_mesa_problem(ctx, "Bad depth texture mode");
- }
-
+ apply_depth_mode(tObj->DepthMode, re

Re: [Mesa-dev] [PATCH 2/2] i965: don't clear resolve map when doing fast depth clears.

2012-08-23 Thread Chad Versace
On 08/22/2012 03:21 PM, Eric Anholt wrote:
> Paul Berry  writes:
> 
>> On 22 August 2012 12:35, Eric Anholt  wrote:
>>
>>> Paul Berry  writes:
>>>
 Previously, when performing a fast depth clear, we would also clear
 the miptree's resolve map.  This destroyed important information,
 since the resolve map contains information about needed resolves for
 all levels and layers of the miptree, whereas a depth clear only
 applies to a single level/layer combination at a time.  As a result,
 resolves would sometimes fail to occur, leading to incorrect
 rendering.

 Fixes rendering artifacts with shadow maps in Unigine Heaven and
 Unigine Sanctuary.
>>>
>>> Nice catch!
>>>
>>> However, isn't the issue really that we're incorrectly setting
>>> needs_depth_resolve on layers/levels of the referenced mt that we're not
>>> actually changing hiz state for, since they didn't get cleared?  It
>>> seems like this fixes the current issue, but leaves that bug in place.
>>>
>>
>> No, those other layers of the miptree really did need a depth resolve,
>> because they were previously cleared and then rendered to.  The complete
>> sequence of operations performed by the Unigine engine in the bug looks
>> like this:
> 
> Yeah, I had misread the resolve code in place while insufficiently awake
> (I thought we were setting our new resolve flag on all layers, not just
> the one referenced by the rb).  Not clearing all resolve flags for other
> layers is obviously a requirement.
> 
> I'm ambivalent about losing the assertion, since it caught a bug for
> Chad apparently, but it looks like a good series in that it fixes the
> bug.
> 
> Reviewed-by: Eric Anholt 

It would be nice to preserve the assertion, but this does fix the bug.

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


Re: [Mesa-dev] [PATCH 3/7] r600g: fix evergreen 8x MSAA sample positions

2012-08-23 Thread Paul Berry
On 23 August 2012 10:42, Marek Olšák  wrote:

> On Thu, Aug 23, 2012 at 6:42 PM, Paul Berry 
> wrote:
> > On 22 August 2012 18:54, Marek Olšák  wrote:
> >>
> >> The original samples positions took samples outside of the pixel
> boundary,
> >> leading to dark pixels on the edge of the colorbuffer, among other
> things.
> >
> >
> > Does this address the issues you were having with the error thresholds in
> > the EXT_framebuffer_multisample piglit tests (Re: your Aug 13 email
> > "[Piglit] [PATCH] ext_framebuffer_multisample: relax MSAA precision")?
>
> Yes, it does. The accuracy tests now pass for me.
>
> Marek
>

Excellent.  Glad to hear it.
___
mesa-dev mailing list
mesa-dev@lists.freedesktop.org
http://lists.freedesktop.org/mailman/listinfo/mesa-dev


Re: [Mesa-dev] [PATCH 0/7] MSAA on R700 and improvements for Evergreen

2012-08-23 Thread Dave Airlie
On Fri, Aug 24, 2012 at 1:09 AM, Marek Olšák  wrote:
> On Thu, Aug 23, 2012 at 4:38 PM, Jerome Glisse  wrote:
>> On Wed, Aug 22, 2012 at 9:54 PM, Marek Olšák  wrote:
>>> This series adds R700 MSAA support along with compression of MSAA 
>>> colorbuffers for R700 and Evergreen, which should save a lot of bandwidth 
>>> with MSAA. There are also some minor fixes.
>>>
>>> Please review.
>>>
>>> Marek Olšák (7):
>>>   gallium/u_blitter: initialize sample mask in resolve
>>>   r600g: set CB_TARGET_MASK to 0xf and not 0xff for resolve on evergreen
>>>   r600g: fix evergreen 8x MSAA sample positions
>>>   r600g: cleanup names around depth decompression
>>>   r600g: implement compression for MSAA colorbuffers for evergreen
>>>   r600g: change programming of CB_SHADER_MASK on r600-r700
>>>   r600g: implement MSAA for r700
>>
>> For the serie :
>> Reviewed-by: Jerome Glisse 
>>
>> What's wrong with r6xx ?
>
> Nothing, I haven't tried it yet. I will take a look at r6xx next (or cayman).

Just FYI, I think original r600 and rv6xx had different registers for
the sample locations.

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


Re: [Mesa-dev] [PATCH 2/2] build: Fix installation of GLES2 headers

2012-08-23 Thread Eoff, Ullysses A
This patch worked for me :)

U. Artie 


>-Original Message-
>From: Matt Turner [mailto:matts...@gmail.com]
>Sent: Thursday, August 23, 2012 1:42 PM
>To: mesa-dev@lists.freedesktop.org
>Cc: Eoff, Ullysses A; Matt Turner
>Subject: [PATCH 2/2] build: Fix installation of GLES2 headers
>
>Reported-by: U. Artie Eoff 
>---
> src/mapi/es2api/Makefile.am |   11 +--
> 1 files changed, 5 insertions(+), 6 deletions(-)
>
>diff --git a/src/mapi/es2api/Makefile.am b/src/mapi/es2api/Makefile.am
>index edd3c9f..c77f07e 100644
>--- a/src/mapi/es2api/Makefile.am
>+++ b/src/mapi/es2api/Makefile.am
>@@ -31,12 +31,11 @@ AM_CFLAGS = $(VISIBILITY_CFLAGS)
> pkgconfigdir = $(libdir)/pkgconfig
> pkgconfig_DATA = glesv2.pc
>
>-GLES_includedir = $(includedir)/GLES
>-GLES_include_HEADERS = \
>-  $(top_srcdir)/include/GLES/egl.h \
>-  $(top_srcdir)/include/GLES/gl.h \
>-  $(top_srcdir)/include/GLES/glext.h \
>-  $(top_srcdir)/include/GLES/glplatform.h
>+GLES2_includedir = $(includedir)/GLES2
>+GLES2_include_HEADERS = \
>+  $(top_srcdir)/include/GLES2/gl2.h \
>+  $(top_srcdir)/include/GLES2/gl2ext.h \
>+  $(top_srcdir)/include/GLES2/gl2platform.h
>
> lib_LTLIBRARIES = libGLESv2.la
>
>--
>1.7.8.6

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


[Mesa-dev] [PATCH 1/2] build: Fix GLES linkage with libglapi

2012-08-23 Thread Matt Turner
Reported-by: Ian Romanick 
---
Previous patch was wrong, since it depended on the system libglapi.

 src/mapi/es1api/Makefile.am |2 +-
 src/mapi/es2api/Makefile.am |2 +-
 2 files changed, 2 insertions(+), 2 deletions(-)

diff --git a/src/mapi/es1api/Makefile.am b/src/mapi/es1api/Makefile.am
index 5c7258f..c49c86e 100644
--- a/src/mapi/es1api/Makefile.am
+++ b/src/mapi/es1api/Makefile.am
@@ -41,7 +41,7 @@ GLES_include_HEADERS = \
 lib_LTLIBRARIES = libGLESv1_CM.la
 
 libGLESv1_CM_la_SOURCES = ../mapi/entry.c glapi_mapi_tmp.h
-libGLESv1_CM_la_LIBADD = $(GLESv1_CM_LIB_DEPS)
+libGLESv1_CM_la_LIBADD = $(GLESv1_CM_LIB_DEPS) ../shared-glapi/libglapi.la
 libGLESv1_CM_la_LDFLAGS = -version-number 1:1 -no-undefined
 
 include ../glapi/gen/glapi_gen.mk
diff --git a/src/mapi/es2api/Makefile.am b/src/mapi/es2api/Makefile.am
index edd3c9f..7430780 100644
--- a/src/mapi/es2api/Makefile.am
+++ b/src/mapi/es2api/Makefile.am
@@ -41,7 +41,7 @@ GLES_include_HEADERS = \
 lib_LTLIBRARIES = libGLESv2.la
 
 libGLESv2_la_SOURCES = ../mapi/entry.c glapi_mapi_tmp.h
-libGLESv2_la_LIBADD = $(GLESv2_LIB_DEPS)
+libGLESv2_la_LIBADD = $(GLESv2_LIB_DEPS) ../shared-glapi/libglapi.la
 libGLESv2_la_LDFLAGS = -version-number 2 -no-undefined
 
 include ../glapi/gen/glapi_gen.mk
-- 
1.7.8.6

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


Re: [Mesa-dev] [PATCH 3/4] i965/gen7: Add support for GL_ARB_timer_query.

2012-08-23 Thread Kenneth Graunke
On 08/23/2012 01:22 PM, Eric Anholt wrote:
> Needs updated libdrm.
> ---
>  configure.ac  |2 +-
>  docs/GL3.txt  |2 +-
>  src/mesa/drivers/dri/i965/brw_context.c   |2 +
>  src/mesa/drivers/dri/i965/brw_queryobj.c  |   50 
> +
>  src/mesa/drivers/dri/intel/intel_extensions.c |8 
>  src/mesa/drivers/dri/intel/intel_reg.h|2 +
>  6 files changed, 64 insertions(+), 2 deletions(-)
> 
> diff --git a/configure.ac b/configure.ac
> index 2ecedaf..3e1ec8c 100644
> --- a/configure.ac
> +++ b/configure.ac
> @@ -29,7 +29,7 @@ LT_INIT([disable-static])
>  dnl Versions for external dependencies
>  LIBDRM_REQUIRED=2.4.24
>  LIBDRM_RADEON_REQUIRED=2.4.31
> -LIBDRM_INTEL_REQUIRED=2.4.37
> +LIBDRM_INTEL_REQUIRED=2.4.38
>  LIBDRM_NVVIEUX_REQUIRED=2.4.33
>  LIBDRM_NOUVEAU_REQUIRED=2.4.33
>  DRI2PROTO_REQUIRED=2.6
> diff --git a/docs/GL3.txt b/docs/GL3.txt
> index 55b108c..8b8e003 100644
> --- a/docs/GL3.txt
> +++ b/docs/GL3.txt
> @@ -80,7 +80,7 @@ GL_ARB_sampler_objectsDONE 
> (i965, r300, r600)
>  GL_ARB_shader_bit_encodingDONE
>  GL_ARB_texture_rgb10_a2ui DONE (r600)
>  GL_ARB_texture_swizzleDONE (same as EXT 
> version) (i965, r300, r600, swrast)
> -GL_ARB_timer_queryDONE
> +GL_ARB_timer_queryDONE (i965)
>  GL_ARB_instanced_arrays   DONE (i965, r300, r600)
>  GL_ARB_vertex_type_2_10_10_10_rev DONE (r600)
>  
> diff --git a/src/mesa/drivers/dri/i965/brw_context.c 
> b/src/mesa/drivers/dri/i965/brw_context.c
> index a5711e4..f8d7643 100644
> --- a/src/mesa/drivers/dri/i965/brw_context.c
> +++ b/src/mesa/drivers/dri/i965/brw_context.c
> @@ -222,6 +222,8 @@ brwCreateContext(int api,
> if (intel->gen >= 6)
> ctx->Const.QuadsFollowProvokingVertexConvention = false;
>  
> +   ctx->Const.QueryCounterBits.Timestamp = 36;
> +
> if (intel->is_g4x || intel->gen >= 5) {
>brw->CMD_VF_STATISTICS = GM45_3DSTATE_VF_STATISTICS;
>brw->CMD_PIPELINE_SELECT = CMD_PIPELINE_SELECT_GM45;
> diff --git a/src/mesa/drivers/dri/i965/brw_queryobj.c 
> b/src/mesa/drivers/dri/i965/brw_queryobj.c
> index 3f9e065..87c8dac 100644
> --- a/src/mesa/drivers/dri/i965/brw_queryobj.c
> +++ b/src/mesa/drivers/dri/i965/brw_queryobj.c
> @@ -41,6 +41,7 @@
>  #include "main/imports.h"
>  
>  #include "brw_context.h"
> +#include "brw_defines.h"
>  #include "brw_state.h"
>  #include "intel_batchbuffer.h"
>  #include "intel_reg.h"
> @@ -155,6 +156,32 @@ brw_queryobj_get_results(struct gl_context *ctx,
>query->Base.Result += 1000 * ((results[1] >> 32) - (results[0] >> 32));
>break;
>  
> +   case GL_TIMESTAMP:
> +  if (intel->gen >= 6) {
> + /* Our timer is a clock that increments every 80ns (regardless of
> +  * other clock scaling in the system).  The timestamp register we 
> can
> +  * read for glGetTimestamp() masks out the top 32 bits, so we do 
> that
> +  * here too to let the two counters be compared against each other.
> +  *
> +  * If we just multiplied that 32 bits of data by 80, it would roll
> +  * over at a non-power-of-two, so an application couldn't use
> +  * GL_QUERY_COUNTER_BITS to handle rollover correctly.  Instead, we
> +  * report 36 bits and truncate at that (rolling over 5 times as 
> often
> +  * as the HW counter), and when the 32-bit counter rolls over, it
> +  * happens to also be at a rollover in the reported value from near
> +  * (1<<36) to 0.
> +  *
> +  * The low 32 bits rolls over in ~343 seconds.  Our 36-bit result
> +  * rolls over every ~69 seconds.
> +  */
> +  query->Base.Result = 80 * (results[1] & 0x);
> + query->Base.Result &= (1ull << 36) - 1;
> +  } else {
> +  query->Base.Result = 1000 * (results[1] >> 32);
> +  }
> +
> +  break;
> +
> case GL_SAMPLES_PASSED_ARB:
>/* Map and count the pixels from the current query BO */
>for (i = query->first_index; i <= query->last_index; i++) {
> @@ -262,6 +289,12 @@ brw_end_query(struct gl_context *ctx, struct 
> gl_query_object *q)
> struct brw_query_object *query = (struct brw_query_object *)q;
>  
> switch (query->Base.Target) {
> +   case GL_TIMESTAMP:
> +  drm_intel_bo_unreference(query->bo);
> +  query->bo = drm_intel_bo_alloc(intel->bufmgr, "timer query",
> +  4096, 4096);
> +  /* FALLTHROUGH */
> +
> case GL_TIME_ELAPSED_EXT:
>write_timestamp(intel, query->bo, 1);
>intel_batchbuffer_flush(intel);
> @@ -404,6 +437,22 @@ brw_emit_query_end(struct brw_context *brw)
> brw->query.index++;
>  }
>  
> +static uint64_t
> +brw_

[Mesa-dev] [PATCH 2/2] build: Fix installation of GLES2 headers

2012-08-23 Thread Matt Turner
Reported-by: U. Artie Eoff 
---
 src/mapi/es2api/Makefile.am |   11 +--
 1 files changed, 5 insertions(+), 6 deletions(-)

diff --git a/src/mapi/es2api/Makefile.am b/src/mapi/es2api/Makefile.am
index edd3c9f..c77f07e 100644
--- a/src/mapi/es2api/Makefile.am
+++ b/src/mapi/es2api/Makefile.am
@@ -31,12 +31,11 @@ AM_CFLAGS = $(VISIBILITY_CFLAGS)
 pkgconfigdir = $(libdir)/pkgconfig
 pkgconfig_DATA = glesv2.pc
 
-GLES_includedir = $(includedir)/GLES
-GLES_include_HEADERS = \
-   $(top_srcdir)/include/GLES/egl.h \
-   $(top_srcdir)/include/GLES/gl.h \
-   $(top_srcdir)/include/GLES/glext.h \
-   $(top_srcdir)/include/GLES/glplatform.h
+GLES2_includedir = $(includedir)/GLES2
+GLES2_include_HEADERS = \
+   $(top_srcdir)/include/GLES2/gl2.h \
+   $(top_srcdir)/include/GLES2/gl2ext.h \
+   $(top_srcdir)/include/GLES2/gl2platform.h
 
 lib_LTLIBRARIES = libGLESv2.la
 
-- 
1.7.8.6

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


[Mesa-dev] [PATCH 1/2] build: Fix GLES linkage with libglapi

2012-08-23 Thread Matt Turner
Reported-by: Ian Romanick 
---
 configure.ac |4 ++--
 1 files changed, 2 insertions(+), 2 deletions(-)

diff --git a/configure.ac b/configure.ac
index e9d4e79..6a1bbab 100644
--- a/configure.ac
+++ b/configure.ac
@@ -897,9 +897,9 @@ esac
 # builds.
 AM_CONDITIONAL(HAVE_XF86VIDMODE, test "x$HAVE_XF86VIDMODE" = xyes)
 
-GLESv1_CM_LIB_DEPS="$LIBDRM_LIBS -lm -lpthread $DLOPEN_LIBS"
+GLESv1_CM_LIB_DEPS="$LIBDRM_LIBS -lm -lpthread -lglapi $DLOPEN_LIBS"
 GLESv1_CM_PC_LIB_PRIV="-lm -lpthread $DLOPEN_LIBS"
-GLESv2_LIB_DEPS="$LIBDRM_LIBS -lm -lpthread $DLOPEN_LIBS"
+GLESv2_LIB_DEPS="$LIBDRM_LIBS -lm -lpthread -lglapi $DLOPEN_LIBS"
 GLESv2_PC_LIB_PRIV="-lm -lpthread $DLOPEN_LIBS"
 
 AC_SUBST([GL_LIB_DEPS])
-- 
1.7.8.6

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


Re: [Mesa-dev] [PATCH 1/4] mesa: Add constants for the GL_QUERY_COUNTER_BITS per target.

2012-08-23 Thread Brian Paul

On 08/23/2012 02:22 PM, Eric Anholt wrote:

Drivers need to be able to communicate their actual number of bits populated
in the field in order for applications to be able to properly handle rollover.

There's a small behavior change here: Instead of reporting the
GL_SAMPLES_PASSED bits for GL_ANY_SAMPLES_PASSED (which would also be valid),
just return 1, because more bits don't make any sense.
---
  src/mesa/main/mtypes.h   |8 
  src/mesa/main/queryobj.c |   37 -
  2 files changed, 44 insertions(+), 1 deletion(-)

diff --git a/src/mesa/main/mtypes.h b/src/mesa/main/mtypes.h
index 8fcb6b4..40b8860 100644
--- a/src/mesa/main/mtypes.h
+++ b/src/mesa/main/mtypes.h
@@ -2821,6 +2821,14 @@ struct gl_constants
 GLuint MaxProgramMatrices;
 GLuint MaxProgramMatrixStackDepth;

+   struct {
+  GLuint SamplesPassed;
+  GLuint TimeElapsed;
+  GLuint Timestamp;
+  GLuint PrimitivesGenerated;
+  GLuint PrimitivesWritten;
+   } QueryCounterBits;
+
 /** vertex array / buffer object bounds checking */
 GLboolean CheckArrayBounds;

diff --git a/src/mesa/main/queryobj.c b/src/mesa/main/queryobj.c
index 4492a17..6f5c79a 100644
--- a/src/mesa/main/queryobj.c
+++ b/src/mesa/main/queryobj.c
@@ -482,7 +482,36 @@ _mesa_GetQueryIndexediv(GLenum target, GLuint index, 
GLenum pname,

 switch (pname) {
case GL_QUERY_COUNTER_BITS_ARB:
- *params = 8 * sizeof(q->Result);
+ switch (target) {
+ case GL_SAMPLES_PASSED:
+*params = ctx->Const.QueryCounterBits.SamplesPassed;
+break;
+ case GL_ANY_SAMPLES_PASSED:
+/* The minimum value of this is 1 if it's nonzero, and the value
+ * is only ever GL_TRUE or GL_FALSE, so no sense in reporting more
+ * bits.
+ */
+*params = 1;
+break;
+ case GL_TIME_ELAPSED:
+*params = ctx->Const.QueryCounterBits.TimeElapsed;
+break;
+ case GL_TIMESTAMP:
+*params = ctx->Const.QueryCounterBits.Timestamp;
+break;
+ case GL_PRIMITIVES_GENERATED:
+*params = ctx->Const.QueryCounterBits.PrimitivesGenerated;
+break;
+ case GL_TRANSFORM_FEEDBACK_PRIMITIVES_WRITTEN:
+*params = ctx->Const.QueryCounterBits.PrimitivesWritten;
+break;
+ default:
+_mesa_problem(ctx,
+  "Unknown target in glGetQueryIndexediv(target = %s",


Missing closing ')' in the string.



+  _mesa_lookup_enum_by_nr(target));
+*params = 0;
+break;
+ }
   break;
case GL_CURRENT_QUERY_ARB:
   *params = q ? q->Id : 0;
@@ -716,6 +745,12 @@ _mesa_init_queryobj(struct gl_context *ctx)
  {
 ctx->Query.QueryObjects = _mesa_NewHashTable();
 ctx->Query.CurrentOcclusionObject = NULL;
+
+   ctx->Const.QueryCounterBits.SamplesPassed = 64;
+   ctx->Const.QueryCounterBits.TimeElapsed = 64;
+   ctx->Const.QueryCounterBits.Timestamp = 64;
+   ctx->Const.QueryCounterBits.PrimitivesGenerated = 64;
+   ctx->Const.QueryCounterBits.PrimitivesWritten = 64;
  }


Otherwise LGTM.  I'll let someone else review the i965 patches.

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


[Mesa-dev] [XDC 2012] Conference Update #2

2012-08-23 Thread Egbert Eich

We are a little less than one month into XDC 2012 so 
here's some update:

Registration:
-

So far we have 32 registered participants - which is pretty good.
If you plan to come and haven't added yourself to the participants
list at http://wiki.x.org/wiki/Events/XDC2012/Attendees, please do 
so!

Presentations:
--

Our program list is still quite empty, so if you have something to 
present, please add yourself to http://wiki.x.org/wiki/Events/XDC2012/Program!

Weekend Event:
--

As announced we are planning a hiking trip to the Frankonian countryside
on Saturday for all those are still there for the weekend. On this trip
we will have the opportunity to visit some local brewery beergardens.
if you would like to join us for this trip please register yourself
at http://wiki.x.org/wiki/Events/XDC2012/Weekend so that we get
a rough estimate on how many people to expect.

Hotel Reservation:
--

The reservation period for which we allocated rooms and negotiated
a special price at the Azimut Hotel is over - I've been informed 
by the hotel that it is completely booked out at this time.
You may still try at one of the other hotels listed. All of them
are still at walking distance to the venue.
There are other hotels in the vicinity - however I have not stayed
at any of them. if you have difficulties finding a hotel please 
contact the organizers.

Limited Email Access:
-

Speaking of contacting the organizers, I will have limited email
access for the next two weeks, thus if you have urgent inquiries,
please contact Stefan Dirsch  for assistance.


I've also updated the event Wiki pages accordingly.

See you in Nuernberg!

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


[Mesa-dev] [PATCH 3/4] i965/gen7: Add support for GL_ARB_timer_query.

2012-08-23 Thread Eric Anholt
Needs updated libdrm.
---
 configure.ac  |2 +-
 docs/GL3.txt  |2 +-
 src/mesa/drivers/dri/i965/brw_context.c   |2 +
 src/mesa/drivers/dri/i965/brw_queryobj.c  |   50 +
 src/mesa/drivers/dri/intel/intel_extensions.c |8 
 src/mesa/drivers/dri/intel/intel_reg.h|2 +
 6 files changed, 64 insertions(+), 2 deletions(-)

diff --git a/configure.ac b/configure.ac
index 2ecedaf..3e1ec8c 100644
--- a/configure.ac
+++ b/configure.ac
@@ -29,7 +29,7 @@ LT_INIT([disable-static])
 dnl Versions for external dependencies
 LIBDRM_REQUIRED=2.4.24
 LIBDRM_RADEON_REQUIRED=2.4.31
-LIBDRM_INTEL_REQUIRED=2.4.37
+LIBDRM_INTEL_REQUIRED=2.4.38
 LIBDRM_NVVIEUX_REQUIRED=2.4.33
 LIBDRM_NOUVEAU_REQUIRED=2.4.33
 DRI2PROTO_REQUIRED=2.6
diff --git a/docs/GL3.txt b/docs/GL3.txt
index 55b108c..8b8e003 100644
--- a/docs/GL3.txt
+++ b/docs/GL3.txt
@@ -80,7 +80,7 @@ GL_ARB_sampler_objectsDONE 
(i965, r300, r600)
 GL_ARB_shader_bit_encodingDONE
 GL_ARB_texture_rgb10_a2ui DONE (r600)
 GL_ARB_texture_swizzleDONE (same as EXT 
version) (i965, r300, r600, swrast)
-GL_ARB_timer_queryDONE
+GL_ARB_timer_queryDONE (i965)
 GL_ARB_instanced_arrays   DONE (i965, r300, r600)
 GL_ARB_vertex_type_2_10_10_10_rev DONE (r600)
 
diff --git a/src/mesa/drivers/dri/i965/brw_context.c 
b/src/mesa/drivers/dri/i965/brw_context.c
index a5711e4..f8d7643 100644
--- a/src/mesa/drivers/dri/i965/brw_context.c
+++ b/src/mesa/drivers/dri/i965/brw_context.c
@@ -222,6 +222,8 @@ brwCreateContext(int api,
if (intel->gen >= 6)
ctx->Const.QuadsFollowProvokingVertexConvention = false;
 
+   ctx->Const.QueryCounterBits.Timestamp = 36;
+
if (intel->is_g4x || intel->gen >= 5) {
   brw->CMD_VF_STATISTICS = GM45_3DSTATE_VF_STATISTICS;
   brw->CMD_PIPELINE_SELECT = CMD_PIPELINE_SELECT_GM45;
diff --git a/src/mesa/drivers/dri/i965/brw_queryobj.c 
b/src/mesa/drivers/dri/i965/brw_queryobj.c
index 3f9e065..87c8dac 100644
--- a/src/mesa/drivers/dri/i965/brw_queryobj.c
+++ b/src/mesa/drivers/dri/i965/brw_queryobj.c
@@ -41,6 +41,7 @@
 #include "main/imports.h"
 
 #include "brw_context.h"
+#include "brw_defines.h"
 #include "brw_state.h"
 #include "intel_batchbuffer.h"
 #include "intel_reg.h"
@@ -155,6 +156,32 @@ brw_queryobj_get_results(struct gl_context *ctx,
 query->Base.Result += 1000 * ((results[1] >> 32) - (results[0] >> 32));
   break;
 
+   case GL_TIMESTAMP:
+  if (intel->gen >= 6) {
+ /* Our timer is a clock that increments every 80ns (regardless of
+  * other clock scaling in the system).  The timestamp register we can
+  * read for glGetTimestamp() masks out the top 32 bits, so we do that
+  * here too to let the two counters be compared against each other.
+  *
+  * If we just multiplied that 32 bits of data by 80, it would roll
+  * over at a non-power-of-two, so an application couldn't use
+  * GL_QUERY_COUNTER_BITS to handle rollover correctly.  Instead, we
+  * report 36 bits and truncate at that (rolling over 5 times as often
+  * as the HW counter), and when the 32-bit counter rolls over, it
+  * happens to also be at a rollover in the reported value from near
+  * (1<<36) to 0.
+  *
+  * The low 32 bits rolls over in ~343 seconds.  Our 36-bit result
+  * rolls over every ~69 seconds.
+  */
+query->Base.Result = 80 * (results[1] & 0x);
+ query->Base.Result &= (1ull << 36) - 1;
+  } else {
+query->Base.Result = 1000 * (results[1] >> 32);
+  }
+
+  break;
+
case GL_SAMPLES_PASSED_ARB:
   /* Map and count the pixels from the current query BO */
   for (i = query->first_index; i <= query->last_index; i++) {
@@ -262,6 +289,12 @@ brw_end_query(struct gl_context *ctx, struct 
gl_query_object *q)
struct brw_query_object *query = (struct brw_query_object *)q;
 
switch (query->Base.Target) {
+   case GL_TIMESTAMP:
+  drm_intel_bo_unreference(query->bo);
+  query->bo = drm_intel_bo_alloc(intel->bufmgr, "timer query",
+4096, 4096);
+  /* FALLTHROUGH */
+
case GL_TIME_ELAPSED_EXT:
   write_timestamp(intel, query->bo, 1);
   intel_batchbuffer_flush(intel);
@@ -404,6 +437,22 @@ brw_emit_query_end(struct brw_context *brw)
brw->query.index++;
 }
 
+static uint64_t
+brw_get_timestamp(struct gl_context *ctx)
+{
+   struct intel_context *intel = intel_context(ctx);
+   uint64_t result = 0;
+
+   drm_intel_reg_read(intel->bufmgr, TIMESTAMP, &result);
+
+   /* See logic in brw_queryobj_get_results() */
+   result = result >> 32;
+   result *= 80;
+   r

[Mesa-dev] [PATCH 4/4] i965: Rewrite the comment describing the query object support.

2012-08-23 Thread Eric Anholt
---
 src/mesa/drivers/dri/i965/brw_queryobj.c |   22 --
 1 file changed, 12 insertions(+), 10 deletions(-)

diff --git a/src/mesa/drivers/dri/i965/brw_queryobj.c 
b/src/mesa/drivers/dri/i965/brw_queryobj.c
index 87c8dac..d5c4fdf 100644
--- a/src/mesa/drivers/dri/i965/brw_queryobj.c
+++ b/src/mesa/drivers/dri/i965/brw_queryobj.c
@@ -25,18 +25,20 @@
  *
  */
 
-/** @file support for ARB_query_object
+/** @file brw_queryobj.c
  *
- * ARB_query_object is implemented by using the PIPE_CONTROL command to stall
- * execution on the completion of previous depth tests, and write the
- * current PS_DEPTH_COUNT to a buffer object.
+ * Support for query objects (GL_ARB_occlusion_query, GL_ARB_timer_query,
+ * GL_EXT_transform_feedback, and friends).
  *
- * We use before and after counts when drawing during a query so that
- * we don't pick up other clients' query data in ours.  To reduce overhead,
- * a single BO is used to record the query data for all active queries at
- * once.  This also gives us a simple bound on how much batchbuffer space is
- * required for handling queries, so that we can be sure that we won't
- * have to emit a batchbuffer without getting the ending PS_DEPTH_COUNT.
+ * The hardware provides a PIPE_CONTROL command that can report the number of
+ * fragments that passed the depth test, or the hardware timer.  They are
+ * appropriately synced with the stage of the pipeline for our extensions'
+ * needs.
+ *
+ * To avoid getting samples from another context's rendering in our results,
+ * we capture the counts at the start and end of every batchbuffer while the
+ * query is active, and sum up the differences.  (We should do so for
+ * GL_TIME_ELAPSED as well, but don't).
  */
 #include "main/imports.h"
 
-- 
1.7.10.4

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


[Mesa-dev] [PATCH 1/4] mesa: Add constants for the GL_QUERY_COUNTER_BITS per target.

2012-08-23 Thread Eric Anholt
Drivers need to be able to communicate their actual number of bits populated
in the field in order for applications to be able to properly handle rollover.

There's a small behavior change here: Instead of reporting the
GL_SAMPLES_PASSED bits for GL_ANY_SAMPLES_PASSED (which would also be valid),
just return 1, because more bits don't make any sense.
---
 src/mesa/main/mtypes.h   |8 
 src/mesa/main/queryobj.c |   37 -
 2 files changed, 44 insertions(+), 1 deletion(-)

diff --git a/src/mesa/main/mtypes.h b/src/mesa/main/mtypes.h
index 8fcb6b4..40b8860 100644
--- a/src/mesa/main/mtypes.h
+++ b/src/mesa/main/mtypes.h
@@ -2821,6 +2821,14 @@ struct gl_constants
GLuint MaxProgramMatrices;
GLuint MaxProgramMatrixStackDepth;
 
+   struct {
+  GLuint SamplesPassed;
+  GLuint TimeElapsed;
+  GLuint Timestamp;
+  GLuint PrimitivesGenerated;
+  GLuint PrimitivesWritten;
+   } QueryCounterBits;
+
/** vertex array / buffer object bounds checking */
GLboolean CheckArrayBounds;
 
diff --git a/src/mesa/main/queryobj.c b/src/mesa/main/queryobj.c
index 4492a17..6f5c79a 100644
--- a/src/mesa/main/queryobj.c
+++ b/src/mesa/main/queryobj.c
@@ -482,7 +482,36 @@ _mesa_GetQueryIndexediv(GLenum target, GLuint index, 
GLenum pname,
 
switch (pname) {
   case GL_QUERY_COUNTER_BITS_ARB:
- *params = 8 * sizeof(q->Result);
+ switch (target) {
+ case GL_SAMPLES_PASSED:
+*params = ctx->Const.QueryCounterBits.SamplesPassed;
+break;
+ case GL_ANY_SAMPLES_PASSED:
+/* The minimum value of this is 1 if it's nonzero, and the value
+ * is only ever GL_TRUE or GL_FALSE, so no sense in reporting more
+ * bits.
+ */
+*params = 1;
+break;
+ case GL_TIME_ELAPSED:
+*params = ctx->Const.QueryCounterBits.TimeElapsed;
+break;
+ case GL_TIMESTAMP:
+*params = ctx->Const.QueryCounterBits.Timestamp;
+break;
+ case GL_PRIMITIVES_GENERATED:
+*params = ctx->Const.QueryCounterBits.PrimitivesGenerated;
+break;
+ case GL_TRANSFORM_FEEDBACK_PRIMITIVES_WRITTEN:
+*params = ctx->Const.QueryCounterBits.PrimitivesWritten;
+break;
+ default:
+_mesa_problem(ctx,
+  "Unknown target in glGetQueryIndexediv(target = %s",
+  _mesa_lookup_enum_by_nr(target));
+*params = 0;
+break;
+ }
  break;
   case GL_CURRENT_QUERY_ARB:
  *params = q ? q->Id : 0;
@@ -716,6 +745,12 @@ _mesa_init_queryobj(struct gl_context *ctx)
 {
ctx->Query.QueryObjects = _mesa_NewHashTable();
ctx->Query.CurrentOcclusionObject = NULL;
+
+   ctx->Const.QueryCounterBits.SamplesPassed = 64;
+   ctx->Const.QueryCounterBits.TimeElapsed = 64;
+   ctx->Const.QueryCounterBits.Timestamp = 64;
+   ctx->Const.QueryCounterBits.PrimitivesGenerated = 64;
+   ctx->Const.QueryCounterBits.PrimitivesWritten = 64;
 }
 
 
-- 
1.7.10.4

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


[Mesa-dev] [PATCH 2/4] i965: Add support for GL_ARB_occlusion_query2.

2012-08-23 Thread Eric Anholt
This extension is just a bit of core code on top of the GL_ARB_occlusion_query
support.
---
 docs/GL3.txt  |2 +-
 src/mesa/drivers/dri/intel/intel_extensions.c |1 +
 2 files changed, 2 insertions(+), 1 deletion(-)

diff --git a/docs/GL3.txt b/docs/GL3.txt
index d41c052..55b108c 100644
--- a/docs/GL3.txt
+++ b/docs/GL3.txt
@@ -75,7 +75,7 @@ GL 3.3:
 GLSL 3.30 new features in this 
version pretty much done
 GL_ARB_blend_func_extendedDONE (i965, r600, 
softpipe)
 GL_ARB_explicit_attrib_location   DONE (i915, i965, r300, 
r600, swrast)
-GL_ARB_occlusion_query2   DONE (r300, r600, swrast)
+GL_ARB_occlusion_query2   DONE (i965, r300, r600, 
swrast)
 GL_ARB_sampler_objectsDONE (i965, r300, r600)
 GL_ARB_shader_bit_encodingDONE
 GL_ARB_texture_rgb10_a2ui DONE (r600)
diff --git a/src/mesa/drivers/dri/intel/intel_extensions.c 
b/src/mesa/drivers/dri/intel/intel_extensions.c
index 76b56a2..5a813b0 100755
--- a/src/mesa/drivers/dri/intel/intel_extensions.c
+++ b/src/mesa/drivers/dri/intel/intel_extensions.c
@@ -122,6 +122,7 @@ intelInitExtensions(struct gl_context *ctx)
   ctx->Extensions.ARB_fragment_shader = true;
   ctx->Extensions.ARB_half_float_vertex = true;
   ctx->Extensions.ARB_occlusion_query = true;
+  ctx->Extensions.ARB_occlusion_query2 = true;
   ctx->Extensions.ARB_point_sprite = true;
   ctx->Extensions.ARB_seamless_cube_map = true;
   ctx->Extensions.ARB_shader_bit_encoding = true;
-- 
1.7.10.4

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


Re: [Mesa-dev] [PATCH 2/2] automake: convert es2api

2012-08-23 Thread Matt Turner
On Thu, Aug 23, 2012 at 11:26 AM, Ian Romanick  wrote:
> On 08/21/2012 03:47 PM, Matt Turner wrote:
>
> This patch appears to have broken the world with ES2:
>
> bin/GTF: symbol lookup error: /opt/xorg-master-x86_64/lib64/libGLESv2.so.2:
> undefined symbol: _glapi_tls_Dispatch

Weird. scanelf shows me that libglapi.so isn't required, and nm shows
me that _glapi_tls_Dispatch is a needed function, but gles demos still
work. Does this patch help?


p.patch
Description: Binary data
___
mesa-dev mailing list
mesa-dev@lists.freedesktop.org
http://lists.freedesktop.org/mailman/listinfo/mesa-dev


Re: [Mesa-dev] [PATCH 2/2] automake: convert es2api

2012-08-23 Thread Ian Romanick

On 08/21/2012 03:47 PM, Matt Turner wrote:

This patch appears to have broken the world with ES2:

bin/GTF: symbol lookup error: 
/opt/xorg-master-x86_64/lib64/libGLESv2.so.2: undefined symbol: 
_glapi_tls_Dispatch



---
  configure.ac |2 +
  src/mapi/es2api/.gitignore   |4 +--
  src/mapi/es2api/Makefile |3 --
  src/mapi/es2api/Makefile.am  |   60 ++
  src/mapi/es2api/glesv2.pc.in |   12 
  5 files changed, 69 insertions(+), 12 deletions(-)
  delete mode 100644 src/mapi/es2api/Makefile
  create mode 100644 src/mapi/es2api/Makefile.am

diff --git a/configure.ac b/configure.ac
index f7dd47d..25760fd 100644
--- a/configure.ac
+++ b/configure.ac
@@ -2095,6 +2095,8 @@ AC_CONFIG_FILES([configs/current
src/glx/tests/Makefile
src/mapi/es1api/Makefile
src/mapi/es1api/glesv1_cm.pc
+   src/mapi/es2api/Makefile
+   src/mapi/es2api/glesv2.pc
src/mapi/glapi/Makefile
src/mapi/glapi/gen/Makefile
src/mapi/shared-glapi/Makefile
diff --git a/src/mapi/es2api/.gitignore b/src/mapi/es2api/.gitignore
index b21f1d1..39b0e7c 100644
--- a/src/mapi/es2api/.gitignore
+++ b/src/mapi/es2api/.gitignore
@@ -1,4 +1,2 @@
  glapi_mapi_tmp.h
-glapi-stamp
-glapi
-main
+Makefile
diff --git a/src/mapi/es2api/Makefile b/src/mapi/es2api/Makefile
deleted file mode 100644
index 21816a6..000
--- a/src/mapi/es2api/Makefile
+++ /dev/null
@@ -1,3 +0,0 @@
-# src/mapi/es2api/Makefile
-ES := es2
-include ../es1api/Makefile
diff --git a/src/mapi/es2api/Makefile.am b/src/mapi/es2api/Makefile.am
new file mode 100644
index 000..8b047e7
--- /dev/null
+++ b/src/mapi/es2api/Makefile.am
@@ -0,0 +1,60 @@
+# Copyright © 2012 Intel Corporation
+#
+# Permission is hereby granted, free of charge, to any person obtaining a
+# copy of this software and associated documentation files (the "Software"),
+# to deal in the Software without restriction, including without limitation
+# the rights to use, copy, modify, merge, publish, distribute, sublicense,
+# and/or sell copies of the Software, and to permit persons to whom the
+# Software is furnished to do so, subject to the following conditions:
+#
+# The above copyright notice and this permission notice (including the next
+# paragraph) shall be included in all copies or substantial portions of the
+# Software.
+#
+# THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
+# IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
+# FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.  IN NO EVENT SHALL
+# THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
+# LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
+# FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS
+# IN THE SOFTWARE.
+
+AM_CPPFLAGS = \
+   $(DEFINES) \
+   -I$(top_srcdir)/include \
+   -I$(top_srcdir)/src/mapi \
+   -DMAPI_MODE_BRIDGE \
+   -DMAPI_ABI_HEADER=\"glapi_mapi_tmp.h\"
+
+AM_CFLAGS = $(VISIBILITY_CFLAGS)
+
+pkgconfigdir = $(libdir)/pkgconfig
+pkgconfig_DATA = glesv2.pc
+
+GLES_includedir = $(includedir)/GLES
+GLES_include_HEADERS = \
+   $(top_srcdir)/include/GLES/egl.h \
+   $(top_srcdir)/include/GLES/gl.h \
+   $(top_srcdir)/include/GLES/glext.h \
+   $(top_srcdir)/include/GLES/glplatform.h
+
+lib_LTLIBRARIES = libGLESv2.la
+
+libGLESv2_la_SOURCES = ../mapi/entry.c glapi_mapi_tmp.h
+libGLESv2_la_LIBADD = $(GLESv2_LIB_DEPS)
+libGLESv2_la_LDFLAGS = -version-info 2 -no-undefined
+
+include ../glapi/gen/glapi_gen.mk
+glapi_mapi_tmp.h: ../glapi/gen/gl_and_es_API.xml $(glapi_gen_mapi_deps)
+   $(call glapi_gen_mapi,$<,es2api)
+
+BUILT_SOURCES = glapi_mapi_tmp.h
+CLEANFILES = $(BUILT_SOURCES)
+
+# Provide compatibility with scripts for the old Mesa build system for
+# a while by putting a link to the driver into /lib of the build tree.
+all-local: libGLESv2.la
+   $(MKDIR_P) $(top_builddir)/$(LIB_DIR);
+   ln -f .libs/libGLESv2.so $(top_builddir)/$(LIB_DIR)/libGLESv2.so
+   ln -f .libs/libGLESv2.so.2 $(top_builddir)/$(LIB_DIR)/libGLESv2.so.2
+   ln -f .libs/libGLESv2.so.2.0.0 
$(top_builddir)/$(LIB_DIR)/libGLESv2.so.2.0.0
diff --git a/src/mapi/es2api/glesv2.pc.in b/src/mapi/es2api/glesv2.pc.in
index 3b747cb..e5bf12f 100644
--- a/src/mapi/es2api/glesv2.pc.in
+++ b/src/mapi/es2api/glesv2.pc.in
@@ -1,12 +1,12 @@
-prefix=@INSTALL_DIR@
+prefix=@prefix@
  exec_prefix=${prefix}
-libdir=@INSTALL_LIB_DIR@
-includedir=@INSTALL_INC_DIR@
+libdir=@libdir@
+includedir=@includedir@

  Name: glesv2
  Description: Mesa OpenGL ES 2.0 library
-Requires.private: @GLESv2_PC_REQ_PRIV@
+Requires.private:
  Version: @VERSION@
-Libs: -L${libdir} -l@GLESv2_LIB@
+Libs: -L${libdir} -lGLESv2
  Libs.private: @GLESv2_PC_LIB_PRIV@
-Cflags: -I${includedir} @GLESv2_PC_CFLAGS@
+Cflags: -I${includedir}




__

Re: [Mesa-dev] [PATCH 0/3] Validate shader related enums in Mesa

2012-08-23 Thread Kenneth Graunke
On 08/21/2012 05:09 PM, Ian Romanick wrote:
> This continues the series to remove the ES wrappers.  This should take
> care of all the program / shader related checking.

This series of three patches is:
Reviewed-by: Kenneth Graunke 

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


Re: [Mesa-dev] [PATCH 3/7] r600g: fix evergreen 8x MSAA sample positions

2012-08-23 Thread Marek Olšák
On Thu, Aug 23, 2012 at 6:42 PM, Paul Berry  wrote:
> On 22 August 2012 18:54, Marek Olšák  wrote:
>>
>> The original samples positions took samples outside of the pixel boundary,
>> leading to dark pixels on the edge of the colorbuffer, among other things.
>
>
> Does this address the issues you were having with the error thresholds in
> the EXT_framebuffer_multisample piglit tests (Re: your Aug 13 email
> "[Piglit] [PATCH] ext_framebuffer_multisample: relax MSAA precision")?

Yes, it does. The accuracy tests now pass for me.

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


Re: [Mesa-dev] [PATCH] build/glsl: fix android build v2

2012-08-23 Thread Matt Turner
On Fri, Aug 17, 2012 at 12:32 AM, Tapani Pälli  wrote:
> Commit 77a3efc6b907943903190b385fdf107c4acfcdca broke android build that
> sets its own value for GLSL_SRCDIR before including Makefile.sources.
> Patch moves overriding the value after include, this works as GLSL_SRCDIR
> variable gets expanded only later.
>
> Signed-off-by: Tapani Pälli 
> ---
>  src/glsl/Android.mk | 2 +-
>  1 file changed, 1 insertion(+), 1 deletion(-)
>
> diff --git a/src/glsl/Android.mk b/src/glsl/Android.mk
> index 66c8bec..87a02f5 100644
> --- a/src/glsl/Android.mk
> +++ b/src/glsl/Android.mk
> @@ -25,9 +25,9 @@
>
>  LOCAL_PATH := $(call my-dir)
>
> -GLSL_SRCDIR = .
>  include $(LOCAL_PATH)/Makefile.sources
>
> +GLSL_SRCDIR = .
>  # ---
>  # Build libmesa_glsl
>  # ---
> --
> 1.7.11.4

This looks fine to me. Committed.
___
mesa-dev mailing list
mesa-dev@lists.freedesktop.org
http://lists.freedesktop.org/mailman/listinfo/mesa-dev


Re: [Mesa-dev] [PATCH] meta: Don't modify GL_GENERATE_MIPMAP state when it doesn't exist

2012-08-23 Thread Kenneth Graunke
On 08/22/2012 06:58 PM, Ian Romanick wrote:
> From: Ian Romanick 
> 
> This is a bit of a hack.  _mesa_meta_GenerateMipmap shouldn't even be
> used in contexts where GL_GENERATE_MIPMAP doesn't exist (i.e., core
> profile and ES2) because it uses fixed-function, and fixed-function
> doesn't exist there either!
> 
> A GLSL-based _mesa_meta_GenerateMipmap should be available soon.
> 
> Signed-off-by: Ian Romanick 
> Cc: Kenneth Graunke 
> ---
> Without this patch, the in-reply-to patch breaks glGenerateMipmaps in
> OpenGL ES 2.0 contexts.  With a Reviewed-by, I'll commit this patch
> before the other 18 patch series.
> 
>  src/mesa/drivers/common/meta.c |8 ++--
>  1 files changed, 6 insertions(+), 2 deletions(-)
> 
> diff --git a/src/mesa/drivers/common/meta.c b/src/mesa/drivers/common/meta.c
> index db49d90..5d219c7 100644
> --- a/src/mesa/drivers/common/meta.c
> +++ b/src/mesa/drivers/common/meta.c
> @@ -3010,7 +3010,10 @@ _mesa_meta_GenerateMipmap(struct gl_context *ctx, 
> GLenum target,
>  
> _mesa_BindFramebufferEXT(GL_FRAMEBUFFER_EXT, mipmap->FBO);
>  
> -   _mesa_TexParameteri(target, GL_GENERATE_MIPMAP, GL_FALSE);
> +   if (ctx->API != API_OPENGLES2 && ctx->API != API_OPENGL_CORE)
> +  _mesa_TexParameteri(target, GL_GENERATE_MIPMAP, GL_FALSE);
> +   else
> +  assert(!genMipmapSave);
>  
> if (ctx->Extensions.EXT_framebuffer_sRGB) {
>_mesa_set_enable(ctx, GL_FRAMEBUFFER_SRGB_EXT, GL_FALSE);
> @@ -3149,7 +3152,8 @@ _mesa_meta_GenerateMipmap(struct gl_context *ctx, 
> GLenum target,
> _mesa_meta_end(ctx);
>  
> _mesa_TexParameteri(target, GL_TEXTURE_MAX_LEVEL, maxLevelSave);
> -   _mesa_TexParameteri(target, GL_GENERATE_MIPMAP, genMipmapSave);
> +   if (genMipmapSave)
> +  _mesa_TexParameteri(target, GL_GENERATE_MIPMAP, genMipmapSave);
>  
> _mesa_BindFramebufferEXT(GL_FRAMEBUFFER_EXT, fboSave);
>  }

Ultimately, since this is a fixed-function implementation, we don't want
to have checks for shader-based APIs, since shader-based APIs can't use
this.

That said, this keeps it working as well as it used to, so we should:
1) apply this patch
2) add the GLSL-based implementation
3) use the FF version for ES1 and non-GLSL capable HW, otherwise use the
GLSL one
4) revert this patch

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


Re: [Mesa-dev] [PATCH] radeonsi: remove old tilling handling

2012-08-23 Thread Michel Dänzer
On Don, 2012-08-23 at 18:16 +0200, Christian König wrote: 
> Just use the functionality provided by the surface manager instead.
> 
> This fixes just another bunch of piglit tests.

Awesome. Looks good.


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


Re: [Mesa-dev] [PATCH 3/7] r600g: fix evergreen 8x MSAA sample positions

2012-08-23 Thread Paul Berry
On 22 August 2012 18:54, Marek Olšák  wrote:

> The original samples positions took samples outside of the pixel boundary,
> leading to dark pixels on the edge of the colorbuffer, among other things.
>

Does this address the issues you were having with the error thresholds in
the EXT_framebuffer_multisample piglit tests (Re: your Aug 13 email
"[Piglit] [PATCH] ext_framebuffer_multisample: relax MSAA precision")?


> ---
>  src/gallium/drivers/r600/evergreen_state.c |   32
> ++--
>  1 file changed, 16 insertions(+), 16 deletions(-)
>
> diff --git a/src/gallium/drivers/r600/evergreen_state.c
> b/src/gallium/drivers/r600/evergreen_state.c
> index 4e86693..e12706e 100644
> --- a/src/gallium/drivers/r600/evergreen_state.c
> +++ b/src/gallium/drivers/r600/evergreen_state.c
> @@ -1516,24 +1516,24 @@ static uint32_t evergreen_set_ms_pos(struct
> pipe_context *ctx, struct r600_pipe_
> static unsigned max_dist_4x = 6;
> /* 8xMSAA */
> static uint32_t eg_sample_locs_8x[] = {
> -   FILL_SREG(-2, -5, 4, -4,  1, 6, -6, -2),
> -   FILL_SREG( 6,  1, 0,  0, -5, 4,  7, -8),
> -   FILL_SREG(-2, -5, 4, -4,  1, 6, -6, -2),
> -   FILL_SREG( 6,  1, 0,  0, -5, 4,  7, -8),
> -   FILL_SREG(-2, -5, 4, -4,  1, 6, -6, -2),
> -   FILL_SREG( 6,  1, 0,  0, -5, 4,  7, -8),
> -   FILL_SREG(-2, -5, 4, -4,  1, 6, -6, -2),
> -   FILL_SREG( 6,  1, 0,  0, -5, 4,  7, -8),
> +   FILL_SREG(-2, -5, 3, -4, -1, 5, -6, -2),
> +   FILL_SREG( 6,  0, 0,  0, -5, 3,  4,  4),
> +   FILL_SREG(-2, -5, 3, -4, -1, 5, -6, -2),
> +   FILL_SREG( 6,  0, 0,  0, -5, 3,  4,  4),
> +   FILL_SREG(-2, -5, 3, -4, -1, 5, -6, -2),
> +   FILL_SREG( 6,  0, 0,  0, -5, 3,  4,  4),
> +   FILL_SREG(-2, -5, 3, -4, -1, 5, -6, -2),
> +   FILL_SREG( 6,  0, 0,  0, -5, 3,  4,  4),
> };
> static uint32_t cm_sample_locs_8x[] = {
> -   FILL_SREG(-2, -5, 4, -4,  1, 6, -6, -2),
> -   FILL_SREG(-2, -5, 4, -4,  1, 6, -6, -2),
> -   FILL_SREG(-2, -5, 4, -4,  1, 6, -6, -2),
> -   FILL_SREG(-2, -5, 4, -4,  1, 6, -6, -2),
> -   FILL_SREG( 6,  1, 0,  0, -5, 4,  7, -8),
> -   FILL_SREG( 6,  1, 0,  0, -5, 4,  7, -8),
> -   FILL_SREG( 6,  1, 0,  0, -5, 4,  7, -8),
> -   FILL_SREG( 6,  1, 0,  0, -5, 4,  7, -8),
> +   FILL_SREG(-2, -5, 3, -4, -1, 5, -6, -2),
> +   FILL_SREG(-2, -5, 3, -4, -1, 5, -6, -2),
> +   FILL_SREG(-2, -5, 3, -4, -1, 5, -6, -2),
> +   FILL_SREG(-2, -5, 3, -4, -1, 5, -6, -2),
> +   FILL_SREG( 6,  0, 0,  0, -5, 3,  4,  4),
> +   FILL_SREG( 6,  0, 0,  0, -5, 3,  4,  4),
> +   FILL_SREG( 6,  0, 0,  0, -5, 3,  4,  4),
> +   FILL_SREG( 6,  0, 0,  0, -5, 3,  4,  4),
> };
> static unsigned max_dist_8x = 8;
> /* 16xMSAA */
> --
> 1.7.9.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 3/3] mesa: glsl: force version too when force_glsl_extensions_warn is used

2012-08-23 Thread Ian Romanick

On 08/22/2012 01:23 AM, Maxim Levitsky wrote:

Unfortunelly some buggy programs use extensions without asking ether for
proper GLSL version nor ask for particular extension.

Moreover the force_glsl_extensions_warn hack is only effective for some
extensions (GL_EXT_texture_array) but unfortunelly isnt effective for other
extensions (I suspect these that declare new built in functions)
Example of this is recently added ARB_shader_bit_encoding extension.
Forcing GLSL version to high value seems to fix this, not sure if this
is acceptable hack though.

This can be reproducted in Unigine Heaven with "ambient occlusion" on.
Note that even with this path shader compilatin fails, because code in Unigine
that gets activated when this extension gets enabled expects implicit 
conversions
between signed and unsigned immidiate constants. Whether GLSL shold allow this 
is open
for debate.

Signed-off-by: Maxim Levitsky 
---
  src/glsl/glsl_parser_extras.cpp |4 +++-
  1 file changed, 3 insertions(+), 1 deletion(-)

diff --git a/src/glsl/glsl_parser_extras.cpp b/src/glsl/glsl_parser_extras.cpp
index 872fcda..754166b 100644
--- a/src/glsl/glsl_parser_extras.cpp
+++ b/src/glsl/glsl_parser_extras.cpp
@@ -105,8 +105,10 @@ _mesa_glsl_parse_state::_mesa_glsl_parse_state(struct 
gl_context *_ctx,

 this->supported_version_string = supported;

-   if (ctx->Const.ForceGLSLExtensionsWarn)
+   if (ctx->Const.ForceGLSLExtensionsWarn) {
_mesa_glsl_process_extension("all", NULL, "warn", NULL, this);
+  this->language_version = 130;
+   }


Even if we do this, this is not the way to do it.  I think a separate 
over-ride to a specific GLSL version is preferable.  This is for two 
main reasons.  First, this will explode on an implementation that 
doesn't support GLSL 1.30.  Second, applications like this tend to 
detect the maximum version and assume that.  If we set 1.30, but the 
application is expecting 1.40, it will still fail.



 this->default_uniform_qualifier = new(this) ast_type_qualifier();
 this->default_uniform_qualifier->flags.q.shared = 1;


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


Re: [Mesa-dev] [PATCH 3/3] mesa: glsl: force version too when force_glsl_extensions_warn is used

2012-08-23 Thread Ian Romanick

On 08/22/2012 08:54 AM, Maxim Levitsky wrote:

On Wed, 2012-08-22 at 18:53 +0300, Maxim Levitsky wrote:

On Wed, 2012-08-22 at 08:48 -0600, Brian Paul wrote:

On 08/22/2012 02:23 AM, Maxim Levitsky wrote:

Unfortunelly some buggy programs use extensions without asking ether for
proper GLSL version nor ask for particular extension.

Moreover the force_glsl_extensions_warn hack is only effective for some
extensions (GL_EXT_texture_array) but unfortunelly isnt effective for other
extensions (I suspect these that declare new built in functions)
Example of this is recently added ARB_shader_bit_encoding extension.
Forcing GLSL version to high value seems to fix this, not sure if this
is acceptable hack though.

This can be reproducted in Unigine Heaven with "ambient occlusion" on.
Note that even with this path shader compilatin fails, because code in Unigine
that gets activated when this extension gets enabled expects implicit 
conversions
between signed and unsigned immidiate constants.


Can you give a short example of the GLSL code that's causing the problem?



Whether GLSL shold allow this is open
for debate.



In my opinion, it's better to bend the rules a bit to allow broken
apps to run than to just give up so I'm OK with this patch.  But let's
hear what Ian thinks.

-Brian

Sure!

uniform uint foo;
void main() {
float x = float(foo & 0xffu);
}

Best regards,
Maxim Levitsky


Oops, that is the "fixed" code.

This doesn't compile.

uniform uint normal;
void main() {
float x = float(normal & 0xff);
}


If they really only need to add one character to their shader, I'm not 
excited about hacking around in our type checker.

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


Re: [Mesa-dev] [PATCH 2/3] state_tracker: allow to utilize GLSL workaround for broken apps in Gallium

2012-08-23 Thread Vadim Girlin
On Wed, 2012-08-22 at 19:08 +0300, Maxim Levitsky wrote:
> On Wed, 2012-08-22 at 19:54 +0400, Vadim Girlin wrote: 
> > On Wed, 2012-08-22 at 11:31 -0400, Alex Deucher wrote:
> > > On Wed, Aug 22, 2012 at 11:24 AM, Vadim Girlin  
> > > wrote:
> > > > On Wed, 2012-08-22 at 11:23 +0300, Maxim Levitsky wrote:
> > > >> Currently Gallium has no way to activate the
> > > >> 'force_glsl_extensions_warn' workaround that allows
> > > >> buggy apps that use GLSL extensions without asking for them to work.
> > > >>
> > > >> Since gallium mesa state tracker is essentially split into two,
> > > >> (dri (src/gallium/state_trackers/dri) and mesa 
> > > >> (src/mesa/state_tracker))
> > > >> and only former has access to driconf options while later knows nothing
> > > >> about dri, I added this support by reading an environment variable.
> > > >>
> > > >> export force_glsl_extensions_warn=true
> > > >>
> > > >
> > > > I just remembered that I sent some patches for passing the driconf
> > > > options to the state tracker but then forgot about them completely.
> > > >
> > > > Feel free to reuse anything from that series if it might help:
> > > >
> > > > http://lists.freedesktop.org/archives/mesa-dev/2012-April/020729.html
> > > 
> > > Series looks good to me.  Looks like Michel added his reviewed-by at
> > > the time as well.  
> > 
> > Yes, it was reviewed, but then I found that it breaks swrast build due
> > to missing driver descriptor, so I asked if it's OK to simply add the
> > descriptor to swrast and it seems I'm still waiting for the answer... :)
> > 
> > > If it still applies, I'd say go ahead and commit it.
> > 
> > I'll check if it still works and if it's enough to run Unigine apps
> > correctly with current mesa. IIRC it doesn't contain GLSL version hacks
> > as in Maxim's patch 3, so possibly it should be included too, and maybe
> > something else.
> Unless you enable 'ambient occlusion' in Heaven, just GLSL force
> extension hack (which is included in this series), is enough.
> 
> With it, it starts using  ARB_shader_bit_encoding extension, and to make
> it aviable you need my patch #3, but even that is not enough as demo
> introduces unrelated compile error, when extension is enabled.
> I have a local hack to override this, but its not worth looking at.
> Just for reference I attach it.
> 
> Today I will test this patch series,
> and thanks for telling about it, as I was about to stop being lazy and
> implement the same thing.
> 

I'm not sure when I'll have the time to find out exactly what is missing
for complete compatibility with Unigine, so I've pushed those patches as
is for now. We can add remaining fixes on top of them.

Vadim

> 
> Best regards,
> Maxim Levitsky



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


[Mesa-dev] [PATCH] radeonsi: remove old tilling handling

2012-08-23 Thread Christian König
Just use the functionality provided by the surface manager instead.

This fixes just another bunch of piglit tests.

Signed-off-by: Christian König 
---
 src/gallium/drivers/radeonsi/r600_resource.h |9 -
 src/gallium/drivers/radeonsi/r600_texture.c  |  275 ++
 src/gallium/drivers/radeonsi/si_state.c  |   26 ++-
 3 files changed, 31 insertions(+), 279 deletions(-)

diff --git a/src/gallium/drivers/radeonsi/r600_resource.h 
b/src/gallium/drivers/radeonsi/r600_resource.h
index e539eed..be11b5d 100644
--- a/src/gallium/drivers/radeonsi/r600_resource.h
+++ b/src/gallium/drivers/radeonsi/r600_resource.h
@@ -46,13 +46,7 @@ struct r600_resource_texture {
 * for the stencil buffer below. */
enum pipe_formatreal_format;
 
-   unsignedoffset[PIPE_MAX_TEXTURE_LEVELS];
-   unsigned
pitch_in_bytes[PIPE_MAX_TEXTURE_LEVELS];  /* transfer */
-   unsigned
pitch_in_blocks[PIPE_MAX_TEXTURE_LEVELS]; /* texture resource */
-   unsignedlayer_size[PIPE_MAX_TEXTURE_LEVELS];
-   unsignedarray_mode[PIPE_MAX_TEXTURE_LEVELS];
unsignedpitch_override;
-   unsignedsize;
unsigneddepth;
unsigneddirty_db;
struct r600_resource_texture*flushed_depth_texture;
@@ -60,11 +54,8 @@ struct r600_resource_texture {
struct radeon_surface   surface;
 };
 
-#define R600_TEX_IS_TILED(tex, level) ((tex)->array_mode[level] != 
V_009910_ARRAY_LINEAR_GENERAL && (tex)->array_mode[level] != 
V_009910_ARRAY_LINEAR_ALIGNED)
-
 struct r600_surface {
struct pipe_surface base;
-   unsignedaligned_height;
 };
 
 void r600_init_screen_resource_functions(struct pipe_screen *screen);
diff --git a/src/gallium/drivers/radeonsi/r600_texture.c 
b/src/gallium/drivers/radeonsi/r600_texture.c
index 905f218..5b831fd 100644
--- a/src/gallium/drivers/radeonsi/r600_texture.c
+++ b/src/gallium/drivers/radeonsi/r600_texture.c
@@ -69,175 +69,8 @@ static void r600_copy_from_staging_texture(struct 
pipe_context *ctx, struct r600
 static unsigned r600_texture_get_offset(struct r600_resource_texture *rtex,
unsigned level, unsigned layer)
 {
-   unsigned offset = rtex->offset[level];
-
-   switch (rtex->resource.b.b.target) {
-   case PIPE_TEXTURE_3D:
-   case PIPE_TEXTURE_CUBE:
-   default:
-   return offset + layer * rtex->layer_size[level];
-   }
-}
-
-static unsigned r600_get_block_alignment(struct pipe_screen *screen,
-enum pipe_format format,
-unsigned array_mode)
-{
-   struct r600_screen* rscreen = (struct r600_screen *)screen;
-   unsigned pixsize = util_format_get_blocksize(format);
-   int p_align;
-
-   switch(array_mode) {
-   case V_009910_ARRAY_1D_TILED_THIN1:
-   p_align = MAX2(8,
-  ((rscreen->tiling_info.group_bytes / 8 / 
pixsize)));
-   break;
-   case V_009910_ARRAY_2D_TILED_THIN1:
-   p_align = MAX2(rscreen->tiling_info.num_banks,
-  (((rscreen->tiling_info.group_bytes / 8 / 
pixsize)) *
-   rscreen->tiling_info.num_banks)) * 8;
-   break;
-   case V_009910_ARRAY_LINEAR_ALIGNED:
-   p_align = MAX2(64, rscreen->tiling_info.group_bytes / pixsize);
-   break;
-   case V_009910_ARRAY_LINEAR_GENERAL:
-   default:
-   p_align = rscreen->tiling_info.group_bytes / pixsize;
-   break;
-   }
-   return p_align;
-}
-
-static unsigned r600_get_height_alignment(struct pipe_screen *screen,
- unsigned array_mode)
-{
-   struct r600_screen* rscreen = (struct r600_screen *)screen;
-   int h_align;
-
-   switch (array_mode) {
-   case V_009910_ARRAY_2D_TILED_THIN1:
-   h_align = rscreen->tiling_info.num_channels * 8;
-   break;
-   case V_009910_ARRAY_1D_TILED_THIN1:
-   case V_009910_ARRAY_LINEAR_ALIGNED:
-   h_align = 8;
-   break;
-   case V_009910_ARRAY_LINEAR_GENERAL:
-   default:
-   h_align = 1;
-   break;
-   }
-   return h_align;
-}
-
-static unsigned r600_get_base_alignment(struct pipe_screen *screen,
-   enum pipe_format format,
-   unsigned array_mode)
-{
-   struct r600_screen* rscreen = (struct r600_screen *)screen;
-   unsigned pixsize = util_format_get_blocksize(format);
-   int p_align = r600_get_block_alignment(screen, format, array_mode);
-   int h_align = r600

Re: [Mesa-dev] [PATCH 05/12] mesa/es: Remove redundant vertex attrib pointer type validation

2012-08-23 Thread Ian Romanick

On 08/23/2012 12:15 AM, Kenneth Graunke wrote:

On 08/22/2012 07:26 PM, Ian Romanick wrote:

From: Ian Romanick 

Signed-off-by: Ian Romanick 
---
  src/mesa/main/APIspec.xml |   22 --
  1 files changed, 0 insertions(+), 22 deletions(-)

diff --git a/src/mesa/main/APIspec.xml b/src/mesa/main/APIspec.xml
index 1f6f35d..6d4ae0d 100644
--- a/src/mesa/main/APIspec.xml
+++ b/src/mesa/main/APIspec.xml
@@ -1780,28 +1780,6 @@



-
-   
-   
-   
-   
-   
-   
-   
-   
-   
-   


GL_INT is missing from this list, meaning it used to be disallowed on
ES, but I don't see you filtering INT_BIT out for ES in patch #2.

According to the ES2 spec, GL_INT is not allowed as a type for
VertexAttribPointer.  In ES3, it /is/ allowed.


Blarg.  I'll fix that in the earlier patch and resend.


Aside from that, I agree, it appears to be redundant.


-   
-
-   
-   
-   
-
-   
-   
-   
-   
-   
  

  


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


Re: [Mesa-dev] [PATCH 02/12] mesa: Rearrange array type checking, filter more types in ES

2012-08-23 Thread Ian Romanick

On 08/23/2012 12:00 AM, Kenneth Graunke wrote:

On 08/22/2012 07:26 PM, Ian Romanick wrote:

From: Ian Romanick 

Signed-off-by: Ian Romanick 
---
  src/mesa/main/varray.c |   28 +++-
  1 files changed, 19 insertions(+), 9 deletions(-)

diff --git a/src/mesa/main/varray.c b/src/mesa/main/varray.c
index 327fabb..36d0eb8 100644
--- a/src/mesa/main/varray.c
+++ b/src/mesa/main/varray.c
@@ -133,16 +133,26 @@ update_array(struct gl_context *ctx,
 GLsizei elementSize;
 GLenum format = GL_RGBA;

-   if (ctx->API != API_OPENGLES && ctx->API != API_OPENGLES2) {
-  /* fixed point arrays / data is only allowed with OpenGL ES 1.x/2.0 */
+   if (ctx->API == API_OPENGLES || ctx->API == API_OPENGLES2) {


if (_mesa_is_gles(ctx)) {


Right.  Most of the patches in this series are pretty old, so they 
predate the existence of that function.  I converted most, but I 
obviously missed some.



+  /* Once Mesa gets support for GL_OES_vertex_half_float this mask will
+   * change.  Adding support for this extension isn't quite as trivial as
+   * we'd like because ES uses a different enum value for GL_HALF_FLOAT.
+   */
+  legalTypesMask &= ~(FIXED_GL_BIT
+  | UNSIGNED_INT_2_10_10_10_REV_BIT
+  | INT_2_10_10_10_REV_BIT
+  | HALF_BIT | DOUBLE_BIT);
+   } else {
+  assert(ctx->API == API_OPENGL);


I believe this assertion is wrong.  Both VertexAttribPointer and
VertexAttribIPointer call update_arrays, and neither of those functions
are deprecated.  So it's possible to get here from API_OPENGL_CORE.

I would just remove it.


Yeah.  When I wrote that assertion there was no API_OPENGL_CORE.


+
legalTypesMask &= ~FIXED_ES_BIT;
-   }
-   if (!ctx->Extensions.ARB_ES2_compatibility) {
-  legalTypesMask &= ~FIXED_GL_BIT;
-   }
-   if (!ctx->Extensions.ARB_vertex_type_2_10_10_10_rev) {
-  legalTypesMask &= ~(UNSIGNED_INT_2_10_10_10_REV_BIT |
-  INT_2_10_10_10_REV_BIT);
+
+  if (!ctx->Extensions.ARB_ES2_compatibility)
+ legalTypesMask &= ~FIXED_GL_BIT;
+
+  if (!ctx->Extensions.ARB_vertex_type_2_10_10_10_rev)
+ legalTypesMask &= ~(UNSIGNED_INT_2_10_10_10_REV_BIT |
+ INT_2_10_10_10_REV_BIT);
 }

 typeBit = type_to_bit(ctx, type);



This is also not a mere refactor---unless I'm reading something wrong,
it changes behavior rather substantially.

Consider the old code:

if (ctx->API != API_OPENGLES && ctx->API != API_OPENGLES2) {
   /* fixed point arrays / data is only allowed with OpenGL ES 1.x/2.0 */
   legalTypesMask &= ~FIXED_ES_BIT;
}
if (!ctx->Extensions.ARB_ES2_compatibility) {
   legalTypesMask &= ~FIXED_GL_BIT;
}

In the API_OPENGL case, the first conditional would mask out
FIXED_ES_BIT, disallowing it even if ARB_ES2_compatibility was
supported.  Your new code allows it, which is a bug fix.  (The
ARB_ES2_compatibility spec explicitly allows GL_FIXED with
VertexAttribPointer.)


Not exactly.  FIXED_ES_BIT and FIXED_GL_BIT are generated depending on 
the context API.


   case GL_FIXED:
  return _mesa_is_desktop_gl(ctx) ? FIXED_GL_BIT : FIXED_ES_BIT;

In a non-ES context, FIXED_ES_BIT should be impossible, and likewise for 
FIXED_GL_BIT in an ES context.  It's weird, and I don't understand why 
it is the way it is.  I didn't want to change it in this series, and I 
forgot about it after writing these patches.



In the API_OPENGLES (1 or 2) case, if the driver supports
ARB_ES2_compatibility, the second conditional would /still/ mask out
FIXED_ES_BIT, disallowing it even on ES!  Your new code correctly allows
that (another serious bug fix).

So unless I'm misreading it, the old code was just completely broken
regarding GL_FIXED data, and your new code is reasonable and fixes it.
I believe at least a comment in the commit message is in order; maybe
even a mark for stable?  (Unless GL_FIXED is just totally broken
elsewhere and allowing it through here causes worse bugs...)

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


[Mesa-dev] [Bug 53962] [build error] ln: accessing `.libs/libGL.so.1.6.0': No such file or directory

2012-08-23 Thread bugzilla-daemon
https://bugs.freedesktop.org/show_bug.cgi?id=53962

--- Comment #1 from Matt Turner  2012-08-23 15:41:39 UTC ---
Yeah. I sent patches yesterday to fix this.

-- 
Configure bugmail: https://bugs.freedesktop.org/userprefs.cgi?tab=email
--- You are receiving this mail because: ---
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] automake: convert es1api

2012-08-23 Thread Matt Turner
On Thu, Aug 23, 2012 at 5:08 AM, Emil Velikov  wrote:
>
>
> Hi Matt
>
> I believe that this patch would break the es2 build, as they both use the
> same
> Makefile. Can you change their commir order ?

Good point. I didn't really notice that. Thanks!

> A few notes in-line as well
>
>
> On Tue, 21 Aug 2012 23:47:03 +0100, Matt Turner  wrote:
>
>> ---
>>  configure.ac|2 +
>>  src/mapi/es1api/.gitignore  |1 +
>>  src/mapi/es1api/Makefile|  137
>> ---
>>  src/mapi/es1api/Makefile.am |   60 +
>>  src/mapi/es1api/glesv1_cm.pc.in |   12 ++--
>>  src/mapi/glapi/gen/glapi_gen.mk |4 -
>>  6 files changed, 69 insertions(+), 147 deletions(-)
>>  delete mode 100644 src/mapi/es1api/Makefile
>>  create mode 100644 src/mapi/es1api/Makefile.am
>>
>> diff --git a/configure.ac b/configure.ac
>> index 7dac091..f7dd47d 100644
>> --- a/configure.ac
>> +++ b/configure.ac
>> @@ -2093,6 +2093,8 @@ AC_CONFIG_FILES([configs/current
>> src/glsl/tests/Makefile
>> src/glx/Makefile
>> src/glx/tests/Makefile
>> +   src/mapi/es1api/Makefile
>> +   src/mapi/es1api/glesv1_cm.pc
>> src/mapi/glapi/Makefile
>> src/mapi/glapi/gen/Makefile
>> src/mapi/shared-glapi/Makefile
>> diff --git a/src/mapi/es1api/.gitignore b/src/mapi/es1api/.gitignore
>> index dfe4656..39b0e7c 100644
>> --- a/src/mapi/es1api/.gitignore
>> +++ b/src/mapi/es1api/.gitignore
>> @@ -1 +1,2 @@
>>  glapi_mapi_tmp.h
>> +Makefile
>> diff --git a/src/mapi/es1api/Makefile b/src/mapi/es1api/Makefile
>> deleted file mode 100644
>> index 6f4c35a..000
>> --- a/src/mapi/es1api/Makefile
>> +++ /dev/null
>> @@ -1,137 +0,0 @@
>> -# src/mapi/es1api/Makefile
>> -
>> -TOP := ../../..
>> -include $(TOP)/configs/current
>> -
>> -# this Makefile can build both OpenGL ES 1.1 and 2.0
>> -ifeq ($(ES),)
>> -ES := es1
>> -
>> -esapi_HEADER := GLES
>> -esapi_PC := glesv1_cm.pc
>> -
>> -esapi_LIB := $(GLESv1_CM_LIB)
>> -esapi_LIB_NAME := $(GLESv1_CM_LIB_NAME)
>> -esapi_LIB_GLOB := $(GLESv1_CM_LIB_GLOB)
>> -esapi_LIB_DEPS := $(GLESv1_CM_LIB_DEPS)
>> -esapi_LIB_MAJOR := 1
>> -esapi_LIB_MINOR := 1
>> -esapi_LIB_PATCH := 0
>> -else
>> -esapi_HEADER := GLES2
>> -esapi_PC := glesv2.pc
>> -
>> -esapi_LIB := $(GLESv2_LIB)
>> -esapi_LIB_NAME := $(GLESv2_LIB_NAME)
>> -esapi_LIB_GLOB := $(GLESv2_LIB_GLOB)
>> -esapi_LIB_DEPS := $(GLESv2_LIB_DEPS)
>> -esapi_LIB_MAJOR := 2
>> -esapi_LIB_MINOR := 0
>> -esapi_LIB_PATCH := 0
>> -endif
>> -
>> -ESAPI = $(ES)api
>> -
>> -GLAPI := $(TOP)/src/mapi/glapi
>> -MAPI := $(TOP)/src/mapi/mapi
>> -
>> -esapi_CPPFLAGS := \
>> -   -I$(TOP)/include \
>> -   -I$(TOP)/src/mapi \
>> -   -DMAPI_ABI_HEADER=\"$(ESAPI)/glapi_mapi_tmp.h\"
>> -
>> -
>> -# This is a lie when doing out-of-tree builds, but it's no worse than the
>> -# current situation, and can be dropped should this get automakified
>> -top_srcdir = $(TOP)
>> -include $(MAPI)/sources.mak
>> -esapi_SOURCES := $(MAPI_BRIDGE_FILES)
>> -esapi_OBJECTS := $(notdir $(MAPI_BRIDGE_FILES:.c=.o))
>> -esapi_CPPFLAGS += -DMAPI_MODE_BRIDGE
>> -
>> -esapi_LIB_DEPS := -L$(TOP)/$(LIB_DIR) -l$(GLAPI_LIB) $(esapi_LIB_DEPS)
>> -
>> -.PHONY: default
>> -default: depend $(TOP)/$(LIB_DIR)/$(esapi_LIB_NAME)
>> -
>> -$(TOP)/$(LIB_DIR)/$(esapi_LIB_NAME): $(esapi_OBJECTS)
>> -   $(MKLIB) -o $(esapi_LIB) -linker '$(CC)' -ldflags '$(LDFLAGS)' \
>> -   -major $(esapi_LIB_MAJOR) \
>> -   -minor $(esapi_LIB_MINOR) \
>> -   -patch $(esapi_LIB_PATCH) \
>> -   -id
>> $(INSTALL_LIB_DIR)/lib$(esapi_LIB).$(esapi_LIB_MAJOR).dylib \
>> -   $(MKLIB_OPTIONS) -install $(TOP)/$(LIB_DIR) \
>> -   $(esapi_OBJECTS) $(esapi_LIB_DEPS)
>> -
>> -# not used, but kept for completeness
>> -lib$(ESAPI).a: $(esapi_OBJECTS)
>> -   @$(MKLIB) -o $(ESAPI) -static $(esapi_OBJECTS)
>> -
>> -$(esapi_OBJECTS): %.o: $(MAPI)/%.c
>> -   $(CC) -c $(esapi_CPPFLAGS) $(CFLAGS) $< -o $@
>> -
>> -$(esapi_SOURCES): glapi_mapi_tmp.h
>> -
>> -include $(GLAPI)/gen/glapi_gen.mk
>> -glapi_mapi_tmp.h: $(GLAPI)/gen/gl_and_es_API.xml $(glapi_gen_mapi_deps)
>> -   $(call glapi_gen_mapi,$<,$(ESAPI))
>> -
>> -.PHONY: clean
>> -clean:
>> -   -rm -f $(esapi_PC)
>> -   -rm -f $(TOP)/$(LIB_DIR)/$(esapi_LIB_NAME)
>> -   -rm -f lib$(ESAPI).a
>> -   -rm -f $(esapi_OBJECTS)
>> -   -rm -f depend depend.bak
>> -   -rm -f glapi_mapi_tmp.h
>> -
>> -pcedit = \
>> -   -e 's,@INSTALL_DIR@,$(INSTALL_DIR),' \
>> -   -e 's,@INSTALL_LIB_DIR@,$(INSTALL_LIB_DIR),' \
>> -   -e 's,@INSTALL_INC_DIR@,$(INSTALL_INC_DIR),' \
>> -   -e 's,@VERSION@,$(MESA_MAJOR).$(MESA_MINOR).$(MESA_TINY),' \
>> -
>> -pcedit-es1 = \
>> -   $(pcedit) \
>> -   -e 's,@GLESv1_CM_PC_REQ_PRIV@,$(GLESv1_CM_PC_REQ_PRIV),' \
>> -   -e 's,@GLESv1_CM_PC_LIB_PRIV@,$(GLESv1_CM_PC_LIB_PRIV),' \
>> 

Re: [Mesa-dev] [PATCH 01/12] mesa: Refactor element type checking into its own function

2012-08-23 Thread Ian Romanick

On 08/22/2012 11:36 PM, Kenneth Graunke wrote:

On 08/22/2012 07:26 PM, Ian Romanick wrote:

From: Ian Romanick 

This consolidates the tests and makes the emitted error message
consistent.

Signed-off-by: Ian Romanick 
---
  src/mesa/main/api_validate.c |   46 +-
  1 files changed, 23 insertions(+), 23 deletions(-)

diff --git a/src/mesa/main/api_validate.c b/src/mesa/main/api_validate.c
index eaf614b..e8c8333 100644
--- a/src/mesa/main/api_validate.c
+++ b/src/mesa/main/api_validate.c
@@ -262,6 +262,25 @@ _mesa_valid_prim_mode(struct gl_context *ctx, GLenum mode, 
const char *name)
 return GL_TRUE;
  }

+/**
+ * Verify that the element type is valid.
+ *
+ * Generates \c GL_INVALID_ENUM and returns \c false if it is not.
+ */
+static bool
+_mesa_valid_element_type(struct gl_context *ctx, GLenum type, const char *name)
+{


Could we call this _mesa_valid_draw_elements_type()?  When I first saw
this, I was thinking more broadly..."elements of what?", "only unsigned
elements are allowed?", and so on.


+   switch (type) {
+   case GL_UNSIGNED_BYTE:
+   case GL_UNSIGNED_SHORT:
+   case GL_UNSIGNED_INT:
+  return true;
+
+   default:
+  _mesa_error(ctx, GL_INVALID_ENUM, "%s(type = 0x%04x)", name, type);


Could we also please do:

   _mesa_error(ctx, GL_INVALID_ENUM, "%s(type = %s)", name,
   _mesa_lookup_enum_by_nr(type));

May as well make it a bit friendlier, right?  These enums are
unambiguous so the string will be correct.


Maybe.  This is a case when an app is passing in a value that could 
never be valid, so who knows what it passed.  0?  1234?  42?  When a 
value that could sometimes be valid is rejected, I like to print the 
string.  When a value that could never be valid is rejected (and may not 
even be an enum), the string may or may not be more friendly.


I don't have too strong of any opinion either way.


Otherwise, I like the idea.
Reviewed-by: Kenneth Graunke 


+  return false;
+   }
+}

  /**
   * Error checking for glDrawElements().  Includes parameter checking
@@ -286,13 +305,8 @@ _mesa_validate_DrawElements(struct gl_context *ctx,
return GL_FALSE;
 }

-   if (type != GL_UNSIGNED_INT &&
-   type != GL_UNSIGNED_BYTE &&
-   type != GL_UNSIGNED_SHORT)
-   {
-  _mesa_error(ctx, GL_INVALID_ENUM, "glDrawElements(type)" );
+   if (!_mesa_valid_element_type(ctx, type, "glDrawElements"))
return GL_FALSE;
-   }

 if (!check_valid_to_render(ctx, "glDrawElements"))
return GL_FALSE;
@@ -348,13 +362,8 @@ _mesa_validate_MultiDrawElements(struct gl_context *ctx,
return GL_FALSE;
 }

-   if (type != GL_UNSIGNED_INT &&
-   type != GL_UNSIGNED_BYTE &&
-   type != GL_UNSIGNED_SHORT)
-   {
-  _mesa_error(ctx, GL_INVALID_ENUM, "glMultiDrawElements(type)" );
+   if (!_mesa_valid_element_type(ctx, type, "glMultiDrawElements"))
return GL_FALSE;
-   }

 if (!check_valid_to_render(ctx, "glMultiDrawElements"))
return GL_FALSE;
@@ -419,12 +428,8 @@ _mesa_validate_DrawRangeElements(struct gl_context *ctx, 
GLenum mode,
return GL_FALSE;
 }

-   if (type != GL_UNSIGNED_INT &&
-   type != GL_UNSIGNED_BYTE &&
-   type != GL_UNSIGNED_SHORT) {
-  _mesa_error(ctx, GL_INVALID_ENUM, "glDrawRangeElements(type)" );
+   if (!_mesa_valid_element_type(ctx, type, "glDrawRangeElements"))
return GL_FALSE;
-   }

 if (!check_valid_to_render(ctx, "glDrawRangeElements"))
return GL_FALSE;
@@ -548,13 +553,8 @@ _mesa_validate_DrawElementsInstanced(struct gl_context 
*ctx,
return GL_FALSE;
 }

-   if (type != GL_UNSIGNED_INT &&
-   type != GL_UNSIGNED_BYTE &&
-   type != GL_UNSIGNED_SHORT) {
-  _mesa_error(ctx, GL_INVALID_ENUM,
-  "glDrawElementsInstanced(type=0x%x)", type);
+   if (!_mesa_valid_element_type(ctx, type, "glDrawElementsInstanced"))
return GL_FALSE;
-   }

 if (numInstances <= 0) {
if (numInstances < 0)


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


Re: [Mesa-dev] [PATCH 3/3] mesa: glGet: fix parameter lookup for apps using multiple APIs

2012-08-23 Thread Imre Deak
On Thu, 2012-08-23 at 09:13 -0600, Brian Paul wrote:
> On 08/23/2012 08:55 AM, Imre Deak wrote:
> > The glGet hash was initialized only once for a single GL API, even if
> > the application later created a context for a different API. This
> > resulted in glGet failing for otherwise valid parameters in a context
> > if that parameter was invalid in another context created earlier.
> >
> > Amend this by also adding to the hash the parameters of a new API if the
> > application starts to use one.
> >
> > With the change the hash collision statistics reported by GET_DEBUG for
> > the combined API lookup tables aren't significantly different from the
> > single API case. The worst case is still 6 collisions for a single
> > parameter.
> >
> > Signed-off-by: Imre Deak
> > ---
> >   src/mesa/main/context.c |5 ++---
> >   src/mesa/main/get.c |   41 -
> >   2 files changed, 34 insertions(+), 12 deletions(-)
> >
> > diff --git a/src/mesa/main/context.c b/src/mesa/main/context.c
> > index b78bcee..9831a5f 100644
> > --- a/src/mesa/main/context.c
> > +++ b/src/mesa/main/context.c
> > @@ -404,9 +404,6 @@ one_time_init( struct gl_context *ctx )
> >
> > _mesa_get_cpu_features();
> >
> > -  /* context dependence is never a one-time thing... */
> > -  _mesa_init_get_hash(ctx);
> > -
> > for (i = 0; i<  256; i++) {
> >_mesa_ubyte_to_float_color_tab[i] = (float) i / 255.0F;
> > }
> > @@ -425,6 +422,8 @@ one_time_init( struct gl_context *ctx )
> >
> >  /* per-API one-time init */
> >  if (!(api_init_mask&  (1<<  ctx->API))) {
> > +  _mesa_init_get_hash(ctx);
> > +
> > /*
> >  * This is fine as ES does not use the remap table, but it may not 
> > be
> >  * future-proof.  We cannot always initialize the remap table 
> > because
> > diff --git a/src/mesa/main/get.c b/src/mesa/main/get.c
> > index 38d6cc3..e4818ba 100644
> > --- a/src/mesa/main/get.c
> > +++ b/src/mesa/main/get.c
> > @@ -1380,7 +1380,14 @@ static const struct value_desc values[] = {
> >* collisions for any enum (typical numbers).  And the code is very
> >* simple, even though it feels a little magic. */
> >
> > -static unsigned short table[1024];
> > +#define TABLE_IDX_BITS10
> > +
> > +#define TABLE_IDX(v)  ((v)&  ((1<<  TABLE_IDX_BITS) - 1))
> > +#define TABLE_API(v)  ((v)>>  TABLE_IDX_BITS)
> > +
> > +#define TABLE_VALUE(api, idx) (((api)<<  TABLE_IDX_BITS) | (idx))
> > +
> > +static unsigned short table[1<<  TABLE_IDX_BITS];
> >   static const int prime_factor = 89, prime_step = 281;
> >
> >   #ifdef GET_DEBUG
> > @@ -1398,14 +1405,14 @@ print_table_stats(void)
> > if (!table[i])
> >  continue;
> > count++;
> > -  d =&values[table[i]];
> > +  d =&values[TABLE_IDX(table[i])];
> > hash = (d->pname * prime_factor);
> > j = 0;
> > while (1) {
> > -if (values[table[hash&  mask]].pname == d->pname)
> > -   break;
> > -hash += prime_step;
> > -j++;
> > +if (values[TABLE_IDX(table[hash&  mask])].pname == d->pname)
> > +   break;
> > +hash += prime_step;
> > +j++;
> > }
> >
> > if (j<  10)
> > @@ -1435,6 +1442,8 @@ void _mesa_init_get_hash(struct gl_context *ctx)
> >  int i, hash, index, mask;
> >  int api_mask = 0, api_bit;
> >
> > +   assert(Elements(values)<= 1<<  TABLE_IDX_BITS);
> > +
> >  mask = Elements(table) - 1;
> >  api_bit = 1<<  ctx->API;
> >
> > @@ -1450,9 +1459,13 @@ void _mesa_init_get_hash(struct gl_context *ctx)
> > while (1) {
> >index = hash&  mask;
> >if (!table[index]) {
> > -table[index] = i;
> > +table[index] = TABLE_VALUE(api_mask, i);
> >   break;
> >}
> > + /* Did some other API install the entry already? */
> > + if (TABLE_IDX(table[index]) == i&&
> > + TABLE_API(table[index]) == api_mask)
> > +   break;
> >hash += prime_step;
> > }
> >  }
> > @@ -1981,11 +1994,16 @@ find_value(const char *func, GLenum pname, void 
> > **p, union value *v)
> >  struct gl_texture_unit *unit;
> >  int mask, hash;
> >  const struct value_desc *d;
> > +   int api_bit;
> > +
> > +   api_bit = 1<<  ctx->API;
> >
> >  mask = Elements(table) - 1;
> >  hash = (pname * prime_factor);
> >  while (1) {
> > -  d =&values[table[hash&  mask]];
> > +  unsigned table_val = table[hash&  mask];
> > +
> > +  d =&values[TABLE_IDX(table_val)];
> >
> > /* If the enum isn't valid, the hash walk ends with index 0,
> >  * which is the API mask entry at the beginning of values[]. */
> > @@ -1995,7 +2013,12 @@ find_value(const char *func, GLenum pname, void **p, 
> > union value *v)
> >return&error_value;
> > }
> >
> > -  if (likely(d->pname == pname))
> > +  if (likely(d->pnam

[Mesa-dev] [PATCH] build: don't leave git_sha1.h.tmp after build/install

2012-08-23 Thread Vadim Girlin
See https://bugs.freedesktop.org/show_bug.cgi?id=52064
---
 src/mesa/Makefile.am | 2 ++
 1 file changed, 2 insertions(+)

diff --git a/src/mesa/Makefile.am b/src/mesa/Makefile.am
index 3b5ef24..1ac64e6 100644
--- a/src/mesa/Makefile.am
+++ b/src/mesa/Makefile.am
@@ -39,6 +39,8 @@ main/git_sha1.h: main/git_sha1.h.tmp
@echo "updating main/git_sha1.h"
@if ! cmp -s main/git_sha1.h.tmp main/git_sha1.h; then \
mv main/git_sha1.h.tmp main/git_sha1.h ;\
+   else \
+   rm main/git_sha1.h.tmp ;\
fi
 
 # include glapi_gen.mk for generating glapi headers for GLES
-- 
1.7.11.4

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


Re: [Mesa-dev] [PATCH] egl_dri2: Fix segmentation fault

2012-08-23 Thread Brian Paul

On 08/22/2012 05:15 PM, Paulo Alcantara wrote:

From: Paulo Alcantara
Date: Fri, 17 Aug 2012 14:08:10 -0300


The segmentation fault occurs when DRI2 is not loaded up and
dri2_setup_screen() function deferences dri2_dpy->dri2 (since it's NULL
at this point).

This patch fixes the segmentation fault by checking if dri2 pointer is
not NULL before deferencing it.

Signed-off-by: Paulo Alcantara
---
  src/egl/drivers/dri2/egl_dri2.c |2 +-
  1 file changed, 1 insertion(+), 1 deletion(-)


Bump...


Looks like Ian give his R-b.  I'll push this in a bit.

-Brian

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


Re: [Mesa-dev] [PATCH 3/3] mesa: glGet: fix parameter lookup for apps using multiple APIs

2012-08-23 Thread Brian Paul

On 08/23/2012 08:55 AM, Imre Deak wrote:

The glGet hash was initialized only once for a single GL API, even if
the application later created a context for a different API. This
resulted in glGet failing for otherwise valid parameters in a context
if that parameter was invalid in another context created earlier.

Amend this by also adding to the hash the parameters of a new API if the
application starts to use one.

With the change the hash collision statistics reported by GET_DEBUG for
the combined API lookup tables aren't significantly different from the
single API case. The worst case is still 6 collisions for a single
parameter.

Signed-off-by: Imre Deak
---
  src/mesa/main/context.c |5 ++---
  src/mesa/main/get.c |   41 -
  2 files changed, 34 insertions(+), 12 deletions(-)

diff --git a/src/mesa/main/context.c b/src/mesa/main/context.c
index b78bcee..9831a5f 100644
--- a/src/mesa/main/context.c
+++ b/src/mesa/main/context.c
@@ -404,9 +404,6 @@ one_time_init( struct gl_context *ctx )

_mesa_get_cpu_features();

-  /* context dependence is never a one-time thing... */
-  _mesa_init_get_hash(ctx);
-
for (i = 0; i<  256; i++) {
   _mesa_ubyte_to_float_color_tab[i] = (float) i / 255.0F;
}
@@ -425,6 +422,8 @@ one_time_init( struct gl_context *ctx )

 /* per-API one-time init */
 if (!(api_init_mask&  (1<<  ctx->API))) {
+  _mesa_init_get_hash(ctx);
+
/*
 * This is fine as ES does not use the remap table, but it may not be
 * future-proof.  We cannot always initialize the remap table because
diff --git a/src/mesa/main/get.c b/src/mesa/main/get.c
index 38d6cc3..e4818ba 100644
--- a/src/mesa/main/get.c
+++ b/src/mesa/main/get.c
@@ -1380,7 +1380,14 @@ static const struct value_desc values[] = {
   * collisions for any enum (typical numbers).  And the code is very
   * simple, even though it feels a little magic. */

-static unsigned short table[1024];
+#define TABLE_IDX_BITS10
+
+#define TABLE_IDX(v)  ((v)&  ((1<<  TABLE_IDX_BITS) - 1))
+#define TABLE_API(v)  ((v)>>  TABLE_IDX_BITS)
+
+#define TABLE_VALUE(api, idx) (((api)<<  TABLE_IDX_BITS) | (idx))
+
+static unsigned short table[1<<  TABLE_IDX_BITS];
  static const int prime_factor = 89, prime_step = 281;

  #ifdef GET_DEBUG
@@ -1398,14 +1405,14 @@ print_table_stats(void)
if (!table[i])
 continue;
count++;
-  d =&values[table[i]];
+  d =&values[TABLE_IDX(table[i])];
hash = (d->pname * prime_factor);
j = 0;
while (1) {
-if (values[table[hash&  mask]].pname == d->pname)
-   break;
-hash += prime_step;
-j++;
+if (values[TABLE_IDX(table[hash&  mask])].pname == d->pname)
+   break;
+hash += prime_step;
+j++;
}

if (j<  10)
@@ -1435,6 +1442,8 @@ void _mesa_init_get_hash(struct gl_context *ctx)
 int i, hash, index, mask;
 int api_mask = 0, api_bit;

+   assert(Elements(values)<= 1<<  TABLE_IDX_BITS);
+
 mask = Elements(table) - 1;
 api_bit = 1<<  ctx->API;

@@ -1450,9 +1459,13 @@ void _mesa_init_get_hash(struct gl_context *ctx)
while (1) {
   index = hash&  mask;
   if (!table[index]) {
-table[index] = i;
+table[index] = TABLE_VALUE(api_mask, i);
  break;
   }
+ /* Did some other API install the entry already? */
+ if (TABLE_IDX(table[index]) == i&&
+ TABLE_API(table[index]) == api_mask)
+   break;
   hash += prime_step;
}
 }
@@ -1981,11 +1994,16 @@ find_value(const char *func, GLenum pname, void **p, 
union value *v)
 struct gl_texture_unit *unit;
 int mask, hash;
 const struct value_desc *d;
+   int api_bit;
+
+   api_bit = 1<<  ctx->API;

 mask = Elements(table) - 1;
 hash = (pname * prime_factor);
 while (1) {
-  d =&values[table[hash&  mask]];
+  unsigned table_val = table[hash&  mask];
+
+  d =&values[TABLE_IDX(table_val)];

/* If the enum isn't valid, the hash walk ends with index 0,
 * which is the API mask entry at the beginning of values[]. */
@@ -1995,7 +2013,12 @@ find_value(const char *func, GLenum pname, void **p, 
union value *v)
   return&error_value;
}

-  if (likely(d->pname == pname))
+  if (likely(d->pname == pname&&  (TABLE_API(table_val)&  api_bit)))
+ /*
+  * Don't bail out here if the API doesn't match, since the same pname
+  * can be present in the table for other APIs (with different
+  * semantics).
+  */
   break;

hash += prime_step;


I don't fully grok the hashing changes but this looks OK to me 
assuming you've run piglit, etc.


Is this a candidate for the 8.0 branch too?

For the series:
Reviewed-by: Brian Paul 

-Brian
___
mesa-dev mail

[Mesa-dev] [Bug 52064] build fails with "git_sha1.h.tmp": permission denied

2012-08-23 Thread bugzilla-daemon
https://bugs.freedesktop.org/show_bug.cgi?id=52064

--- Comment #10 from Vadim Girlin  2012-08-23 15:13:09 UTC ---
Created attachment 66020
  --> https://bugs.freedesktop.org/attachment.cgi?id=66020
[PATCH] build: don't leave git_sha1.h.tmp after build/install

Probably this patch is a bit more clean and simple.

-- 
Configure bugmail: https://bugs.freedesktop.org/userprefs.cgi?tab=email
--- You are receiving this mail because: ---
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] meta: Don't modify GL_GENERATE_MIPMAP state when it doesn't exist

2012-08-23 Thread Ian Romanick

On 08/23/2012 07:56 AM, Brian Paul wrote:

On 08/22/2012 07:58 PM, Ian Romanick wrote:

From: Ian Romanick

This is a bit of a hack.  _mesa_meta_GenerateMipmap shouldn't even be
used in contexts where GL_GENERATE_MIPMAP doesn't exist (i.e., core
profile and ES2) because it uses fixed-function, and fixed-function
doesn't exist there either!

A GLSL-based _mesa_meta_GenerateMipmap should be available soon.

Signed-off-by: Ian Romanick
Cc: Kenneth Graunke
---
Without this patch, the in-reply-to patch breaks glGenerateMipmaps in
OpenGL ES 2.0 contexts.  With a Reviewed-by, I'll commit this patch
before the other 18 patch series.

  src/mesa/drivers/common/meta.c |8 ++--
  1 files changed, 6 insertions(+), 2 deletions(-)

diff --git a/src/mesa/drivers/common/meta.c
b/src/mesa/drivers/common/meta.c
index db49d90..5d219c7 100644
--- a/src/mesa/drivers/common/meta.c
+++ b/src/mesa/drivers/common/meta.c
@@ -3010,7 +3010,10 @@ _mesa_meta_GenerateMipmap(struct gl_context
*ctx, GLenum target,

 _mesa_BindFramebufferEXT(GL_FRAMEBUFFER_EXT, mipmap->FBO);

-   _mesa_TexParameteri(target, GL_GENERATE_MIPMAP, GL_FALSE);
+   if (ctx->API != API_OPENGLES2&&  ctx->API != API_OPENGL_CORE)
+  _mesa_TexParameteri(target, GL_GENERATE_MIPMAP, GL_FALSE);
+   else
+  assert(!genMipmapSave);


I don't think the GL_GENERATE_MIPMAP tex parameter is supported in GLES
3 so wouldn't it be more future-proof to write this as:


Since GLES 3.0 is backwards compatible with GLES 2.0, I've been using 
the same API enum for both.  The difference is in gl_context::Version. 
See also the _mesa_is_gles3 function in context.h.


That said, I don't think there's any harm in changing this condition 
from a negative test to a positive test.



if (ctx->API == API_OPENGLES || ctx->API == API_OPENGL)
   _mesa_TexParameteri(target, GL_GENERATE_MIPMAP, GL_FALSE);
else
   assert(!genMipmapSave);



 if (ctx->Extensions.EXT_framebuffer_sRGB) {
_mesa_set_enable(ctx, GL_FRAMEBUFFER_SRGB_EXT, GL_FALSE);
@@ -3149,7 +3152,8 @@ _mesa_meta_GenerateMipmap(struct gl_context
*ctx, GLenum target,
 _mesa_meta_end(ctx);

 _mesa_TexParameteri(target, GL_TEXTURE_MAX_LEVEL, maxLevelSave);
-   _mesa_TexParameteri(target, GL_GENERATE_MIPMAP, genMipmapSave);
+   if (genMipmapSave)
+  _mesa_TexParameteri(target, GL_GENERATE_MIPMAP, genMipmapSave);

 _mesa_BindFramebufferEXT(GL_FRAMEBUFFER_EXT, fboSave);
  }


Looks good otherwise.

Reviewed-by: Brian Paul 





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


Re: [Mesa-dev] [PATCH 0/7] MSAA on R700 and improvements for Evergreen

2012-08-23 Thread Marek Olšák
On Thu, Aug 23, 2012 at 4:38 PM, Jerome Glisse  wrote:
> On Wed, Aug 22, 2012 at 9:54 PM, Marek Olšák  wrote:
>> This series adds R700 MSAA support along with compression of MSAA 
>> colorbuffers for R700 and Evergreen, which should save a lot of bandwidth 
>> with MSAA. There are also some minor fixes.
>>
>> Please review.
>>
>> Marek Olšák (7):
>>   gallium/u_blitter: initialize sample mask in resolve
>>   r600g: set CB_TARGET_MASK to 0xf and not 0xff for resolve on evergreen
>>   r600g: fix evergreen 8x MSAA sample positions
>>   r600g: cleanup names around depth decompression
>>   r600g: implement compression for MSAA colorbuffers for evergreen
>>   r600g: change programming of CB_SHADER_MASK on r600-r700
>>   r600g: implement MSAA for r700
>
> For the serie :
> Reviewed-by: Jerome Glisse 
>
> What's wrong with r6xx ?

Nothing, I haven't tried it yet. I will take a look at r6xx next (or cayman).

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


Re: [Mesa-dev] [PATCH] meta: Don't modify GL_GENERATE_MIPMAP state when it doesn't exist

2012-08-23 Thread Brian Paul

On 08/22/2012 07:58 PM, Ian Romanick wrote:

From: Ian Romanick

This is a bit of a hack.  _mesa_meta_GenerateMipmap shouldn't even be
used in contexts where GL_GENERATE_MIPMAP doesn't exist (i.e., core
profile and ES2) because it uses fixed-function, and fixed-function
doesn't exist there either!

A GLSL-based _mesa_meta_GenerateMipmap should be available soon.

Signed-off-by: Ian Romanick
Cc: Kenneth Graunke
---
Without this patch, the in-reply-to patch breaks glGenerateMipmaps in
OpenGL ES 2.0 contexts.  With a Reviewed-by, I'll commit this patch
before the other 18 patch series.

  src/mesa/drivers/common/meta.c |8 ++--
  1 files changed, 6 insertions(+), 2 deletions(-)

diff --git a/src/mesa/drivers/common/meta.c b/src/mesa/drivers/common/meta.c
index db49d90..5d219c7 100644
--- a/src/mesa/drivers/common/meta.c
+++ b/src/mesa/drivers/common/meta.c
@@ -3010,7 +3010,10 @@ _mesa_meta_GenerateMipmap(struct gl_context *ctx, GLenum 
target,

 _mesa_BindFramebufferEXT(GL_FRAMEBUFFER_EXT, mipmap->FBO);

-   _mesa_TexParameteri(target, GL_GENERATE_MIPMAP, GL_FALSE);
+   if (ctx->API != API_OPENGLES2&&  ctx->API != API_OPENGL_CORE)
+  _mesa_TexParameteri(target, GL_GENERATE_MIPMAP, GL_FALSE);
+   else
+  assert(!genMipmapSave);


I don't think the GL_GENERATE_MIPMAP tex parameter is supported in 
GLES 3 so wouldn't it be more future-proof to write this as:


   if (ctx->API == API_OPENGLES || ctx->API == API_OPENGL)
  _mesa_TexParameteri(target, GL_GENERATE_MIPMAP, GL_FALSE);
   else
  assert(!genMipmapSave);



 if (ctx->Extensions.EXT_framebuffer_sRGB) {
_mesa_set_enable(ctx, GL_FRAMEBUFFER_SRGB_EXT, GL_FALSE);
@@ -3149,7 +3152,8 @@ _mesa_meta_GenerateMipmap(struct gl_context *ctx, GLenum 
target,
 _mesa_meta_end(ctx);

 _mesa_TexParameteri(target, GL_TEXTURE_MAX_LEVEL, maxLevelSave);
-   _mesa_TexParameteri(target, GL_GENERATE_MIPMAP, genMipmapSave);
+   if (genMipmapSave)
+  _mesa_TexParameteri(target, GL_GENERATE_MIPMAP, genMipmapSave);

 _mesa_BindFramebufferEXT(GL_FRAMEBUFFER_EXT, fboSave);
  }


Looks good otherwise.

Reviewed-by: Brian Paul 

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


[Mesa-dev] [PATCH 3/3] mesa: glGet: fix parameter lookup for apps using multiple APIs

2012-08-23 Thread Imre Deak
The glGet hash was initialized only once for a single GL API, even if
the application later created a context for a different API. This
resulted in glGet failing for otherwise valid parameters in a context
if that parameter was invalid in another context created earlier.

Amend this by also adding to the hash the parameters of a new API if the
application starts to use one.

With the change the hash collision statistics reported by GET_DEBUG for
the combined API lookup tables aren't significantly different from the
single API case. The worst case is still 6 collisions for a single
parameter.

Signed-off-by: Imre Deak 
---
 src/mesa/main/context.c |5 ++---
 src/mesa/main/get.c |   41 -
 2 files changed, 34 insertions(+), 12 deletions(-)

diff --git a/src/mesa/main/context.c b/src/mesa/main/context.c
index b78bcee..9831a5f 100644
--- a/src/mesa/main/context.c
+++ b/src/mesa/main/context.c
@@ -404,9 +404,6 @@ one_time_init( struct gl_context *ctx )
 
   _mesa_get_cpu_features();
 
-  /* context dependence is never a one-time thing... */
-  _mesa_init_get_hash(ctx);
-
   for (i = 0; i < 256; i++) {
  _mesa_ubyte_to_float_color_tab[i] = (float) i / 255.0F;
   }
@@ -425,6 +422,8 @@ one_time_init( struct gl_context *ctx )
 
/* per-API one-time init */
if (!(api_init_mask & (1 << ctx->API))) {
+  _mesa_init_get_hash(ctx);
+
   /*
* This is fine as ES does not use the remap table, but it may not be
* future-proof.  We cannot always initialize the remap table because
diff --git a/src/mesa/main/get.c b/src/mesa/main/get.c
index 38d6cc3..e4818ba 100644
--- a/src/mesa/main/get.c
+++ b/src/mesa/main/get.c
@@ -1380,7 +1380,14 @@ static const struct value_desc values[] = {
  * collisions for any enum (typical numbers).  And the code is very
  * simple, even though it feels a little magic. */
 
-static unsigned short table[1024];
+#define TABLE_IDX_BITS10
+
+#define TABLE_IDX(v)  ((v) & ((1 << TABLE_IDX_BITS) - 1))
+#define TABLE_API(v)  ((v) >> TABLE_IDX_BITS)
+
+#define TABLE_VALUE(api, idx) (((api) << TABLE_IDX_BITS) | (idx))
+
+static unsigned short table[1 << TABLE_IDX_BITS];
 static const int prime_factor = 89, prime_step = 281;
 
 #ifdef GET_DEBUG
@@ -1398,14 +1405,14 @@ print_table_stats(void)
   if (!table[i])
 continue;
   count++;
-  d = &values[table[i]];
+  d = &values[TABLE_IDX(table[i])];
   hash = (d->pname * prime_factor);
   j = 0;
   while (1) {
-if (values[table[hash & mask]].pname == d->pname)
-   break;
-hash += prime_step;
-j++;
+if (values[TABLE_IDX(table[hash & mask])].pname == d->pname)
+   break;
+hash += prime_step;
+j++;
   }
 
   if (j < 10)
@@ -1435,6 +1442,8 @@ void _mesa_init_get_hash(struct gl_context *ctx)
int i, hash, index, mask;
int api_mask = 0, api_bit;
 
+   assert(Elements(values) <= 1 << TABLE_IDX_BITS);
+
mask = Elements(table) - 1;
api_bit = 1 << ctx->API;
 
@@ -1450,9 +1459,13 @@ void _mesa_init_get_hash(struct gl_context *ctx)
   while (1) {
  index = hash & mask;
  if (!table[index]) {
-table[index] = i;
+table[index] = TABLE_VALUE(api_mask, i);
 break;
  }
+ /* Did some other API install the entry already? */
+ if (TABLE_IDX(table[index]) == i &&
+ TABLE_API(table[index]) == api_mask)
+   break;
  hash += prime_step;
   }
}
@@ -1981,11 +1994,16 @@ find_value(const char *func, GLenum pname, void **p, 
union value *v)
struct gl_texture_unit *unit;
int mask, hash;
const struct value_desc *d;
+   int api_bit;
+
+   api_bit = 1 << ctx->API;
 
mask = Elements(table) - 1;
hash = (pname * prime_factor);
while (1) {
-  d = &values[table[hash & mask]];
+  unsigned table_val = table[hash & mask];
+
+  d = &values[TABLE_IDX(table_val)];
 
   /* If the enum isn't valid, the hash walk ends with index 0,
* which is the API mask entry at the beginning of values[]. */
@@ -1995,7 +2013,12 @@ find_value(const char *func, GLenum pname, void **p, 
union value *v)
  return &error_value;
   }
 
-  if (likely(d->pname == pname))
+  if (likely(d->pname == pname && (TABLE_API(table_val) & api_bit)))
+ /*
+  * Don't bail out here if the API doesn't match, since the same pname
+  * can be present in the table for other APIs (with different
+  * semantics).
+  */
  break;
 
   hash += prime_step;
-- 
1.7.9.5

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


[Mesa-dev] [PATCH 2/3] mesa: glGet: fix indentation of find_value

2012-08-23 Thread Imre Deak
No functional change.

Signed-off-by: Imre Deak 
---
 src/mesa/main/get.c |8 
 1 file changed, 4 insertions(+), 4 deletions(-)

diff --git a/src/mesa/main/get.c b/src/mesa/main/get.c
index 8d0195f..38d6cc3 100644
--- a/src/mesa/main/get.c
+++ b/src/mesa/main/get.c
@@ -1990,13 +1990,13 @@ find_value(const char *func, GLenum pname, void **p, 
union value *v)
   /* If the enum isn't valid, the hash walk ends with index 0,
* which is the API mask entry at the beginning of values[]. */
   if (unlikely(d->type == TYPE_API_MASK)) {
-_mesa_error(ctx, GL_INVALID_ENUM, "%s(pname=%s)", func,
- _mesa_lookup_enum_by_nr(pname));
-return &error_value;
+ _mesa_error(ctx, GL_INVALID_ENUM, "%s(pname=%s)", func,
+   _mesa_lookup_enum_by_nr(pname));
+ return &error_value;
   }
 
   if (likely(d->pname == pname))
-break;
+ break;
 
   hash += prime_step;
}
-- 
1.7.9.5

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


[Mesa-dev] [PATCH 1/3] mesa: glGet: fix indentation of _mesa_init_get_hash

2012-08-23 Thread Imre Deak
No functional change.

Signed-off-by: Imre Deak 
---
 src/mesa/main/get.c |   18 +-
 1 file changed, 9 insertions(+), 9 deletions(-)

diff --git a/src/mesa/main/get.c b/src/mesa/main/get.c
index 332dfaf..8d0195f 100644
--- a/src/mesa/main/get.c
+++ b/src/mesa/main/get.c
@@ -1440,20 +1440,20 @@ void _mesa_init_get_hash(struct gl_context *ctx)
 
for (i = 0; i < Elements(values); i++) {
   if (values[i].type == TYPE_API_MASK) {
-api_mask = values[i].offset;
-continue;
+ api_mask = values[i].offset;
+ continue;
   }
   if (!(api_mask & api_bit))
-continue;
+ continue;
 
   hash = (values[i].pname * prime_factor) & mask;
   while (1) {
-index = hash & mask;
-if (!table[index]) {
-   table[index] = i;
-   break;
-}
-hash += prime_step;
+ index = hash & mask;
+ if (!table[index]) {
+table[index] = i;
+break;
+ }
+ hash += prime_step;
   }
}
 
-- 
1.7.9.5

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


Re: [Mesa-dev] [PATCH 0/7] MSAA on R700 and improvements for Evergreen

2012-08-23 Thread Jerome Glisse
On Wed, Aug 22, 2012 at 9:54 PM, Marek Olšák  wrote:
> This series adds R700 MSAA support along with compression of MSAA 
> colorbuffers for R700 and Evergreen, which should save a lot of bandwidth 
> with MSAA. There are also some minor fixes.
>
> Please review.
>
> Marek Olšák (7):
>   gallium/u_blitter: initialize sample mask in resolve
>   r600g: set CB_TARGET_MASK to 0xf and not 0xff for resolve on evergreen
>   r600g: fix evergreen 8x MSAA sample positions
>   r600g: cleanup names around depth decompression
>   r600g: implement compression for MSAA colorbuffers for evergreen
>   r600g: change programming of CB_SHADER_MASK on r600-r700
>   r600g: implement MSAA for r700

For the serie :
Reviewed-by: Jerome Glisse 

What's wrong with r6xx ?

>
>  src/gallium/auxiliary/util/u_blitter.c  |   46 
>  src/gallium/auxiliary/util/u_blitter.h  |5 +
>  src/gallium/drivers/r600/evergreen_hw_context.c |   64 ++
>  src/gallium/drivers/r600/evergreen_state.c  |   87 ++--
>  src/gallium/drivers/r600/evergreend.h   |   76 ++-
>  src/gallium/drivers/r600/r600_blit.c|   97 -
>  src/gallium/drivers/r600/r600_hw_context.c  |   16 ++
>  src/gallium/drivers/r600/r600_pipe.c|6 +
>  src/gallium/drivers/r600/r600_pipe.h|   16 +-
>  src/gallium/drivers/r600/r600_resource.h|   14 +-
>  src/gallium/drivers/r600/r600_state.c   |  262 
> +++
>  src/gallium/drivers/r600/r600_state_common.c|   45 +++-
>  src/gallium/drivers/r600/r600_texture.c |  116 +-
>  src/gallium/drivers/r600/r600d.h|   20 ++
>  14 files changed, 770 insertions(+), 100 deletions(-)
>
> Marek
> ___
> 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] radeonsi: fix SPI_PS_INPUT_ENA handling

2012-08-23 Thread Michel Dänzer
On Mit, 2012-08-22 at 12:54 +0200, Christian König wrote: 
> 
> + /* we need to enable at least one of them, otherwise we hang the GPU */
> + if (!spi_ps_input_ena & (C_0286CC_PERSP_SAMPLE_ENA |
> +  C_0286CC_PERSP_CENTROID_ENA |
> +  C_0286CC_PERSP_PULL_MODEL_ENA |
> +  C_0286CC_LINEAR_SAMPLE_ENA |
> +  C_0286CC_LINEAR_CENTER_ENA |
> +  C_0286CC_LINEAR_CENTROID_ENA |
> +  C_0286CC_LINE_STIPPLE_TEX_ENA)) {
> + spi_ps_input_ena |= S_0286CC_PERSP_SAMPLE_ENA(1);
> + }

I just noticed that this causes a warning:

si_state_draw.c: In function ‘si_pipe_shader_ps’:
si_state_draw.c:179:6: warning: suggest parentheses around operand of ‘!’ or 
change ‘&’ to ‘&&’ or ‘!’ to ‘~’ [-Wparentheses]

Did you mean the following?

if (!(spi_ps_input_ena & (~C_0286CC_PERSP_SAMPLE_ENA |
  ~C_0286CC_PERSP_CENTROID_ENA |
  ~C_0286CC_PERSP_PULL_MODEL_ENA |
  ~C_0286CC_LINEAR_SAMPLE_ENA |
  ~C_0286CC_LINEAR_CENTER_ENA |
  ~C_0286CC_LINEAR_CENTROID_ENA |
  ~C_0286CC_LINE_STIPPLE_TEX_ENA)) {
spi_ps_input_ena |= S_0286CC_PERSP_SAMPLE_ENA(1);
}


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


Re: [Mesa-dev] [PATCH] Remove OpenVMS support

2012-08-23 Thread Brian Paul

On 08/22/2012 08:50 PM, Matt Turner wrote:

Not maintained since 2008. Doubtful that it's worked in quite a while.


Agreed.

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


Re: [Mesa-dev] [PATCH 01/12] mesa: Refactor element type checking into its own function

2012-08-23 Thread Brian Paul

On 08/23/2012 12:36 AM, Kenneth Graunke wrote:

On 08/22/2012 07:26 PM, Ian Romanick wrote:

From: Ian Romanick

This consolidates the tests and makes the emitted error message
consistent.

Signed-off-by: Ian Romanick
---
  src/mesa/main/api_validate.c |   46 +-
  1 files changed, 23 insertions(+), 23 deletions(-)

diff --git a/src/mesa/main/api_validate.c b/src/mesa/main/api_validate.c
index eaf614b..e8c8333 100644
--- a/src/mesa/main/api_validate.c
+++ b/src/mesa/main/api_validate.c
@@ -262,6 +262,25 @@ _mesa_valid_prim_mode(struct gl_context *ctx, GLenum mode, 
const char *name)
 return GL_TRUE;
  }

+/**
+ * Verify that the element type is valid.
+ *
+ * Generates \c GL_INVALID_ENUM and returns \c false if it is not.
+ */
+static bool
+_mesa_valid_element_type(struct gl_context *ctx, GLenum type, const char *name)
+{


Could we call this _mesa_valid_draw_elements_type()?  When I first saw
this, I was thinking more broadly..."elements of what?", "only unsigned
elements are allowed?", and so on.


And FWIW, I usually don't put the _mesa_ prefix on static functions. 
A function w/out _mesa_ tells me the function is defined earlier in 
this file and not somewhere else.


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


[Mesa-dev] [Bug 52064] build fails with "git_sha1.h.tmp": permission denied

2012-08-23 Thread bugzilla-daemon
https://bugs.freedesktop.org/show_bug.cgi?id=52064

--- Comment #9 from Knut Petersen  2012-08-23 
13:34:14 UTC ---
(In reply to comment #0)
> This happens sometimes when building mesa. Somehow 
> src/mesa/main/git_sha1.h.tmp
> gets created with root user (necessary?) Then on a later build, Makefile can 
> no
> longer "touch" it:
> 
> Making all in mesa
> make[2]: Entering directory `/home/bpaterni/usr/src/mesa/src/mesa'
> touch: cannot touch `main/git_sha1.h.tmp': Permission denied
> make[2]: *** [main/git_sha1.h.tmp] Error 1
> make[2]: Leaving directory `/home/bpaterni/usr/src/mesa/src/mesa'
> make[1]: *** [all-recursive] Error 1
> make[1]: Leaving directory `/home/bpaterni/usr/src/mesa/src'
> make: *** [all-recursive] Error 1


Run "make clean" and "make distclean", then "git clean -dfx".
You´ll see that git finds more than 100 files missed by the
cleaning targets.

Maye you could extend your patch a bit ...

cu,
 Knut

-- 
Configure bugmail: https://bugs.freedesktop.org/userprefs.cgi?tab=email
--- You are receiving this mail because: ---
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 v2 2/3] glapi/glx: call __glEmptyImage if USE_XCB, not memcpy directly

2012-08-23 Thread Julien Cristau
On Sat, Jul 28, 2012 at 13:04:56 +0200, Julien Cristau wrote:

> On Fri, Jul 20, 2012 at 11:09:19 +0200, Julien Cristau wrote:
> 
> > From: Julien Cristau 
> > 
> > We were stomping on the caller's buffer by ignoring their alignment
> > requests and other pixel store modes.  This patch makes the USE_XCB path 
> > match
> > the older one more closely.
> > 
> > Bugzilla: https://bugs.freedesktop.org/show_bug.cgi?id=52059
> > 
> > Signed-off-by: Julien Cristau 
> > ---
> > v2: add explicit bugzilla reference to commit message, drop unused
> > assignment
> > 
> >  src/mapi/glapi/gen/glX_proto_send.py |   35 
> > -
> >  1 files changed, 25 insertions(+), 10 deletions(-)
> > 
> Ping?
> 
Ping?

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


[Mesa-dev] [Bug 52064] build fails with "git_sha1.h.tmp": permission denied

2012-08-23 Thread bugzilla-daemon
https://bugs.freedesktop.org/show_bug.cgi?id=52064

--- Comment #8 from Alex Deucher  2012-08-23 13:14:47 UTC ---
(In reply to comment #7)
> My patch from comment #3 allows me to use 'make' (as non-root) after 'make
> install' (as root) without 'make clean'. That's the behavior I'd like to see 
> in
> mesa. If my patch isn't a correct solution - I'm OK with any other solution
> providing the similar result.

I'd like those semantics as well.  Patch looks good to me.

-- 
Configure bugmail: https://bugs.freedesktop.org/userprefs.cgi?tab=email
--- You are receiving this mail because: ---
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] [RFC patch 2/2] Build libgallium shared

2012-08-23 Thread Maarten Lankhorst
Hey Matt,

Op 22-08-12 17:45, Matt Turner schreef:
> On Wed, Aug 22, 2012 at 3:21 AM, Maarten Lankhorst
>  wrote:
>> And build gallium shared :)
> Seems reasonable to me, given that we do this for dricore.
>
> I've got a bunch of build patches waiting for review, so I'd
> appreciate holding this until those patches go in.
>
> I'm going to try to automake Gallium before 9.0, which may mean that
> this can get folded into that series.

Great, I'll leave this one be for now then, hopefully the build error
from patch 1/2 will disappear as well by proper autotooling.

If not I'll rework the patch then.

~Maarten

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


Re: [Mesa-dev] [PATCH 1/2] automake: convert es1api

2012-08-23 Thread Emil Velikov



Hi Matt

I believe that this patch would break the es2 build, as they both use the  
same

Makefile. Can you change their commir order ?

A few notes in-line as well

On Tue, 21 Aug 2012 23:47:03 +0100, Matt Turner  wrote:


---
 configure.ac|2 +
 src/mapi/es1api/.gitignore  |1 +
 src/mapi/es1api/Makefile|  137  
---

 src/mapi/es1api/Makefile.am |   60 +
 src/mapi/es1api/glesv1_cm.pc.in |   12 ++--
 src/mapi/glapi/gen/glapi_gen.mk |4 -
 6 files changed, 69 insertions(+), 147 deletions(-)
 delete mode 100644 src/mapi/es1api/Makefile
 create mode 100644 src/mapi/es1api/Makefile.am

diff --git a/configure.ac b/configure.ac
index 7dac091..f7dd47d 100644
--- a/configure.ac
+++ b/configure.ac
@@ -2093,6 +2093,8 @@ AC_CONFIG_FILES([configs/current
src/glsl/tests/Makefile
src/glx/Makefile
src/glx/tests/Makefile
+   src/mapi/es1api/Makefile
+   src/mapi/es1api/glesv1_cm.pc
src/mapi/glapi/Makefile
src/mapi/glapi/gen/Makefile
src/mapi/shared-glapi/Makefile
diff --git a/src/mapi/es1api/.gitignore b/src/mapi/es1api/.gitignore
index dfe4656..39b0e7c 100644
--- a/src/mapi/es1api/.gitignore
+++ b/src/mapi/es1api/.gitignore
@@ -1 +1,2 @@
 glapi_mapi_tmp.h
+Makefile
diff --git a/src/mapi/es1api/Makefile b/src/mapi/es1api/Makefile
deleted file mode 100644
index 6f4c35a..000
--- a/src/mapi/es1api/Makefile
+++ /dev/null
@@ -1,137 +0,0 @@
-# src/mapi/es1api/Makefile
-
-TOP := ../../..
-include $(TOP)/configs/current
-
-# this Makefile can build both OpenGL ES 1.1 and 2.0
-ifeq ($(ES),)
-ES := es1
-
-esapi_HEADER := GLES
-esapi_PC := glesv1_cm.pc
-
-esapi_LIB := $(GLESv1_CM_LIB)
-esapi_LIB_NAME := $(GLESv1_CM_LIB_NAME)
-esapi_LIB_GLOB := $(GLESv1_CM_LIB_GLOB)
-esapi_LIB_DEPS := $(GLESv1_CM_LIB_DEPS)
-esapi_LIB_MAJOR := 1
-esapi_LIB_MINOR := 1
-esapi_LIB_PATCH := 0
-else
-esapi_HEADER := GLES2
-esapi_PC := glesv2.pc
-
-esapi_LIB := $(GLESv2_LIB)
-esapi_LIB_NAME := $(GLESv2_LIB_NAME)
-esapi_LIB_GLOB := $(GLESv2_LIB_GLOB)
-esapi_LIB_DEPS := $(GLESv2_LIB_DEPS)
-esapi_LIB_MAJOR := 2
-esapi_LIB_MINOR := 0
-esapi_LIB_PATCH := 0
-endif
-
-ESAPI = $(ES)api
-
-GLAPI := $(TOP)/src/mapi/glapi
-MAPI := $(TOP)/src/mapi/mapi
-
-esapi_CPPFLAGS := \
-   -I$(TOP)/include \
-   -I$(TOP)/src/mapi \
-   -DMAPI_ABI_HEADER=\"$(ESAPI)/glapi_mapi_tmp.h\"
-
-
-# This is a lie when doing out-of-tree builds, but it's no worse than  
the

-# current situation, and can be dropped should this get automakified
-top_srcdir = $(TOP)
-include $(MAPI)/sources.mak
-esapi_SOURCES := $(MAPI_BRIDGE_FILES)
-esapi_OBJECTS := $(notdir $(MAPI_BRIDGE_FILES:.c=.o))
-esapi_CPPFLAGS += -DMAPI_MODE_BRIDGE
-
-esapi_LIB_DEPS := -L$(TOP)/$(LIB_DIR) -l$(GLAPI_LIB) $(esapi_LIB_DEPS)
-
-.PHONY: default
-default: depend $(TOP)/$(LIB_DIR)/$(esapi_LIB_NAME)
-
-$(TOP)/$(LIB_DIR)/$(esapi_LIB_NAME): $(esapi_OBJECTS)
-   $(MKLIB) -o $(esapi_LIB) -linker '$(CC)' -ldflags '$(LDFLAGS)' \
-   -major $(esapi_LIB_MAJOR) \
-   -minor $(esapi_LIB_MINOR) \
-   -patch $(esapi_LIB_PATCH) \
-   -id $(INSTALL_LIB_DIR)/lib$(esapi_LIB).$(esapi_LIB_MAJOR).dylib 
\
-   $(MKLIB_OPTIONS) -install $(TOP)/$(LIB_DIR) \
-   $(esapi_OBJECTS) $(esapi_LIB_DEPS)
-
-# not used, but kept for completeness
-lib$(ESAPI).a: $(esapi_OBJECTS)
-   @$(MKLIB) -o $(ESAPI) -static $(esapi_OBJECTS)
-
-$(esapi_OBJECTS): %.o: $(MAPI)/%.c
-   $(CC) -c $(esapi_CPPFLAGS) $(CFLAGS) $< -o $@
-
-$(esapi_SOURCES): glapi_mapi_tmp.h
-
-include $(GLAPI)/gen/glapi_gen.mk
-glapi_mapi_tmp.h: $(GLAPI)/gen/gl_and_es_API.xml $(glapi_gen_mapi_deps)
-   $(call glapi_gen_mapi,$<,$(ESAPI))
-
-.PHONY: clean
-clean:
-   -rm -f $(esapi_PC)
-   -rm -f $(TOP)/$(LIB_DIR)/$(esapi_LIB_NAME)
-   -rm -f lib$(ESAPI).a
-   -rm -f $(esapi_OBJECTS)
-   -rm -f depend depend.bak
-   -rm -f glapi_mapi_tmp.h
-
-pcedit = \
-   -e 's,@INSTALL_DIR@,$(INSTALL_DIR),' \
-   -e 's,@INSTALL_LIB_DIR@,$(INSTALL_LIB_DIR),' \
-   -e 's,@INSTALL_INC_DIR@,$(INSTALL_INC_DIR),' \
-   -e 's,@VERSION@,$(MESA_MAJOR).$(MESA_MINOR).$(MESA_TINY),' \
-
-pcedit-es1 = \
-   $(pcedit) \
-   -e 's,@GLESv1_CM_PC_REQ_PRIV@,$(GLESv1_CM_PC_REQ_PRIV),' \
-   -e 's,@GLESv1_CM_PC_LIB_PRIV@,$(GLESv1_CM_PC_LIB_PRIV),' \
-   -e 's,@GLESv1_CM_PC_CFLAGS@,$(GLESv1_CM_PC_CFLAGS),' \
-   -e 's,@GLESv1_CM_LIB@,$(GLESv1_CM_LIB),'
-
-pcedit-es2 = \
-   $(pcedit) \
-   -e 's,@GLESv2_PC_REQ_PRIV@,$(GLESv2_PC_REQ_PRIV),' \
-   -e 's,@GLESv2_PC_LIB_PRIV@,$(GLESv2_PC_LIB_PRIV),' \
-   -e 's,@GLESv2_PC_CFLAGS@,$(GLESv2_PC_CFLAGS),' \
-   -e 's,@GLESv2_LIB@,$(GLESv2_LIB),'
-
-$(esapi_PC): $(esapi_PC).in
-   @sed $(pcedit-$(ES)) $< > $@
-
-install-headers:
-   $(INSTALL) -d $(DESTDIR)$(INSTALL_INC_DIR)/$(esapi_HE

[Mesa-dev] [PATCH] clover: Accept CL_MEM_READ_WRITE flag

2012-08-23 Thread Blaž Tomažič
Fix API functions for memory objects to accept CL_MEM_READ_WRITE flag.

Signed-off-by: Blaž Tomažič 
---
 src/gallium/state_trackers/clover/api/memory.cpp | 11 ++-
 1 file changed, 6 insertions(+), 5 deletions(-)

diff --git a/src/gallium/state_trackers/clover/api/memory.cpp 
b/src/gallium/state_trackers/clover/api/memory.cpp
index 1b1ae73..ae6d3a0 100644
--- a/src/gallium/state_trackers/clover/api/memory.cpp
+++ b/src/gallium/state_trackers/clover/api/memory.cpp
@@ -39,7 +39,7 @@ clCreateBuffer(cl_context ctx, cl_mem_flags flags, size_t 
size,
if (!size)
   throw error(CL_INVALID_BUFFER_SIZE);
 
-   if (flags & ~(CL_MEM_WRITE_ONLY | CL_MEM_READ_ONLY |
+   if (flags & ~(CL_MEM_READ_WRITE | CL_MEM_WRITE_ONLY | CL_MEM_READ_ONLY |
  CL_MEM_USE_HOST_PTR | CL_MEM_ALLOC_HOST_PTR |
  CL_MEM_COPY_HOST_PTR))
   throw error(CL_INVALID_VALUE);
@@ -63,7 +63,8 @@ clCreateSubBuffer(cl_mem obj, cl_mem_flags flags, 
cl_buffer_create_type op,
if ((flags & (CL_MEM_USE_HOST_PTR |
  CL_MEM_ALLOC_HOST_PTR |
  CL_MEM_COPY_HOST_PTR)) ||
-   (~flags & parent->flags() & (CL_MEM_READ_ONLY |
+   (~flags & parent->flags() & (CL_MEM_READ_WRITE |
+CL_MEM_READ_ONLY |
 CL_MEM_WRITE_ONLY)))
   throw error(CL_INVALID_VALUE);
 
@@ -98,7 +99,7 @@ clCreateImage2D(cl_context ctx, cl_mem_flags flags,
if (!ctx)
   throw error(CL_INVALID_CONTEXT);
 
-   if (flags & ~(CL_MEM_WRITE_ONLY | CL_MEM_READ_ONLY |
+   if (flags & ~(CL_MEM_READ_WRITE | CL_MEM_WRITE_ONLY | CL_MEM_READ_ONLY |
  CL_MEM_USE_HOST_PTR | CL_MEM_ALLOC_HOST_PTR |
  CL_MEM_COPY_HOST_PTR))
   throw error(CL_INVALID_VALUE);
@@ -134,7 +135,7 @@ clCreateImage3D(cl_context ctx, cl_mem_flags flags,
if (!ctx)
   throw error(CL_INVALID_CONTEXT);
 
-   if (flags & ~(CL_MEM_WRITE_ONLY | CL_MEM_READ_ONLY |
+   if (flags & ~(CL_MEM_READ_WRITE | CL_MEM_WRITE_ONLY | CL_MEM_READ_ONLY |
  CL_MEM_USE_HOST_PTR | CL_MEM_ALLOC_HOST_PTR |
  CL_MEM_COPY_HOST_PTR))
   throw error(CL_INVALID_VALUE);
@@ -168,7 +169,7 @@ clGetSupportedImageFormats(cl_context ctx, cl_mem_flags 
flags,
if (!ctx)
   throw error(CL_INVALID_CONTEXT);
 
-   if (flags & ~(CL_MEM_WRITE_ONLY | CL_MEM_READ_ONLY |
+   if (flags & ~(CL_MEM_READ_WRITE | CL_MEM_WRITE_ONLY | CL_MEM_READ_ONLY |
  CL_MEM_USE_HOST_PTR | CL_MEM_ALLOC_HOST_PTR |
  CL_MEM_COPY_HOST_PTR))
   throw error(CL_INVALID_VALUE);
-- 
1.7.12

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


[Mesa-dev] [Bug 7459] GLX_USE_TLS breaks -fPIC build

2012-08-23 Thread bugzilla-daemon
https://bugs.freedesktop.org/show_bug.cgi?id=7459

wbr...@gmail.com changed:

   What|Removed |Added

 CC||wbr...@gmail.com

--- Comment #23 from wbr...@gmail.com 2012-08-23 10:17:19 UTC ---
What is status of this bug?

-- 
Configure bugmail: https://bugs.freedesktop.org/userprefs.cgi?tab=email
--- You are receiving this mail because: ---
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 2/2] Move _mesa_dl* functions into dlopen.h and inline them

2012-08-23 Thread Tapani Pälli
On 08/22/2012 10:48 PM, Matt Turner wrote:
> No point in having an extra function call for inlinable functions.
> 
> Cc: Tapani Pälli 

works fine for me

Reviewed-by: Tapani Pälli 


> ---
>  src/mesa/SConscript|1 -
>  src/mesa/main/dlopen.c |  112 
> 
>  src/mesa/main/dlopen.h |   83 ---
>  src/mesa/sources.mak   |1 -
>  4 files changed, 75 insertions(+), 122 deletions(-)
>  delete mode 100644 src/mesa/main/dlopen.c
> 
> diff --git a/src/mesa/SConscript b/src/mesa/SConscript
> index 1b98b04..5668962 100644
> --- a/src/mesa/SConscript
> +++ b/src/mesa/SConscript
> @@ -60,7 +60,6 @@ main_sources = [
>  'main/debug.c',
>  'main/depth.c',
>  'main/dlist.c',
> -'main/dlopen.c',
>  'main/drawpix.c',
>  'main/drawtex.c',
>  'main/enable.c',
> diff --git a/src/mesa/main/dlopen.c b/src/mesa/main/dlopen.c
> deleted file mode 100644
> index aaee963..000
> --- a/src/mesa/main/dlopen.c
> +++ /dev/null
> @@ -1,112 +0,0 @@
> -/*
> - * Mesa 3-D graphics library
> - *
> - * Copyright (C) 1999-2008  Brian Paul   All Rights Reserved.
> - *
> - * Permission is hereby granted, free of charge, to any person obtaining a
> - * copy of this software and associated documentation files (the "Software"),
> - * to deal in the Software without restriction, including without limitation
> - * the rights to use, copy, modify, merge, publish, distribute, sublicense,
> - * and/or sell copies of the Software, and to permit persons to whom the
> - * Software is furnished to do so, subject to the following conditions:
> - *
> - * The above copyright notice and this permission notice shall be included
> - * in all copies or substantial portions of the Software.
> - *
> - * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS
> - * OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF 
> MERCHANTABILITY,
> - * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.  IN NO EVENT SHALL
> - * BRIAN PAUL BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN
> - * AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN
> - * CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
> - */
> -
> -
> -/**
> - * Wrapper functions for dlopen(), dlsym(), dlclose().
> - * Note that the #ifdef tests for various environments should be expanded.
> - */
> -
> -
> -#include "compiler.h"
> -#include "dlopen.h"
> -
> -#if defined(HAVE_DLOPEN)
> -#include 
> -#endif
> -#if defined(_WIN32)
> -#include 
> -#endif
> -
> -
> -/**
> - * Wrapper for dlopen().
> - * Note that 'flags' isn't used at this time.
> - */
> -void *
> -_mesa_dlopen(const char *libname, int flags)
> -{
> -#if defined(__blrts)
> -   return NULL;
> -#elif defined(HAVE_DLOPEN)
> -   flags = RTLD_LAZY | RTLD_GLOBAL; /* Overriding flags at this time */
> -   return dlopen(libname, flags);
> -#elif defined(__MINGW32__)
> -   return LoadLibraryA(libname);
> -#else
> -   return NULL;
> -#endif
> -}
> -
> -
> -/**
> - * Wrapper for dlsym() that does a cast to a generic function type,
> - * rather than a void *.  This reduces the number of warnings that are
> - * generated.
> - */
> -GenericFunc
> -_mesa_dlsym(void *handle, const char *fname)
> -{
> -   union {
> -  void *v;
> -  GenericFunc f;
> -   } u;
> -#if defined(__blrts)
> -   u.v = NULL;
> -#elif defined(__DJGPP__)
> -   /* need '_' prefix on symbol names */
> -   char fname2[1000];
> -   fname2[0] = '_';
> -   strncpy(fname2 + 1, fname, 998);
> -   fname2[999] = 0;
> -   u.v = dlsym(handle, fname2);
> -#elif defined(HAVE_DLOPEN)
> -   u.v = dlsym(handle, fname);
> -#elif defined(__MINGW32__)
> -   u.v = (void *) GetProcAddress(handle, fname);
> -#else
> -   u.v = NULL;
> -#endif
> -   return u.f;
> -}
> -
> -
> -/**
> - * Wrapper for dlclose().
> - */
> -void
> -_mesa_dlclose(void *handle)
> -{
> -#if defined(__blrts)
> -   (void) handle;
> -#elif defined(HAVE_DLOPEN)
> -   dlclose(handle);
> -#elif defined(__MINGW32__)
> -   FreeLibrary(handle);
> -#else
> -   (void) handle;
> -#endif
> -}
> -
> -
> -
> diff --git a/src/mesa/main/dlopen.h b/src/mesa/main/dlopen.h
> index 9895a22..a5366a1 100644
> --- a/src/mesa/main/dlopen.h
> +++ b/src/mesa/main/dlopen.h
> @@ -25,18 +25,85 @@
>  #ifndef DLOPEN_H
>  #define DLOPEN_H
>  
> +/**
> + * Wrapper functions for dlopen(), dlsym(), dlclose().
> + * Note that the #ifdef tests for various environments should be expanded.
> + */
>  
> -typedef void (*GenericFunc)(void);
> -
> +#if defined(HAVE_DLOPEN)
> +#include 
> +#endif
> +#if defined(_WIN32)
> +#include 
> +#endif
>  
> -extern void *
> -_mesa_dlopen(const char *libname, int flags);
> +typedef void (*GenericFunc)(void);
>  
> -extern GenericFunc
> -_mesa_dlsym(void *handle, const char *fname);
> +/**
> + * Wrapper for dlopen().
> + * Note that 'flags' isn't used at this time.
> + */
> +static inline void *
> +_mesa_dlopen(const char *libname, int flags)
> +{
>

[Mesa-dev] [Bug 53962] New: [build error] ln: accessing `.libs/libGL.so.1.6.0': No such file or directory

2012-08-23 Thread bugzilla-daemon
https://bugs.freedesktop.org/show_bug.cgi?id=53962

 Bug #: 53962
   Summary: [build error] ln: accessing `.libs/libGL.so.1.6.0': No
such file or directory
Classification: Unclassified
   Product: Mesa
   Version: git
  Platform: Other
OS/Version: All
Status: NEW
  Severity: normal
  Priority: medium
 Component: Mesa core
AssignedTo: mesa-dev@lists.freedesktop.org
ReportedBy: fabio@libero.it


When building with:
cd /build/buildd/mesa-8.1~git1208231006.bee2ed~gd~p/build/swx11+glu-static && \
../../configure --prefix=/usr --mandir=\${prefix}/share/man \
 --infodir=\${prefix}/share/info --sysconfdir=/etc \
 --libdir=\${prefix}/lib/i386-linux-gnu \
 --localstatedir=/var --build=i686-linux-gnu --disable-egl
--with-gallium-drivers= --enable-xlib-glx --disable-dri --enable-static
--disable-egl CFLAGS="-Wall -g -O2" CXXFLAGS="-Wall -g -O2"

I get this error:
  CXXLD  libGL.la
/bin/mkdir -p ../../../../i386-linux-gnu;
ln -f .libs/libGL.so.1.6.0 ../../../../i386-linux-gnu/libGL.so.1
ln: accessing `.libs/libGL.so.1.6.0': No such file or directory

Full log at:
https://launchpadlibrarian.net/113314189/buildlog_ubuntu-precise-i386.mesa_8.1~git1208231006.bee2ed~gd~p_FAILEDTOBUILD.txt.gz

-- 
Configure bugmail: https://bugs.freedesktop.org/userprefs.cgi?tab=email
--- You are receiving this mail because: ---
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 05/12] mesa/es: Remove redundant vertex attrib pointer type validation

2012-08-23 Thread Kenneth Graunke
On 08/22/2012 07:26 PM, Ian Romanick wrote:
> From: Ian Romanick 
> 
> Signed-off-by: Ian Romanick 
> ---
>  src/mesa/main/APIspec.xml |   22 --
>  1 files changed, 0 insertions(+), 22 deletions(-)
> 
> diff --git a/src/mesa/main/APIspec.xml b/src/mesa/main/APIspec.xml
> index 1f6f35d..6d4ae0d 100644
> --- a/src/mesa/main/APIspec.xml
> +++ b/src/mesa/main/APIspec.xml
> @@ -1780,28 +1780,6 @@
>   
>   
>   
> -
> - 
> - 
> - 
> - 
> - 
> - 
> - 
> -  category="OES_vertex_half_float"/>
> -  category="OES_vertex_type_10_10_10_2"/>
> -  category="OES_vertex_type_10_10_10_2"/>

GL_INT is missing from this list, meaning it used to be disallowed on
ES, but I don't see you filtering INT_BIT out for ES in patch #2.

According to the ES2 spec, GL_INT is not allowed as a type for
VertexAttribPointer.  In ES3, it /is/ allowed.

Aside from that, I agree, it appears to be redundant.

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


Re: [Mesa-dev] [PATCH 02/12] mesa: Rearrange array type checking, filter more types in ES

2012-08-23 Thread Kenneth Graunke
On 08/22/2012 07:26 PM, Ian Romanick wrote:
> From: Ian Romanick 
> 
> Signed-off-by: Ian Romanick 
> ---
>  src/mesa/main/varray.c |   28 +++-
>  1 files changed, 19 insertions(+), 9 deletions(-)
> 
> diff --git a/src/mesa/main/varray.c b/src/mesa/main/varray.c
> index 327fabb..36d0eb8 100644
> --- a/src/mesa/main/varray.c
> +++ b/src/mesa/main/varray.c
> @@ -133,16 +133,26 @@ update_array(struct gl_context *ctx,
> GLsizei elementSize;
> GLenum format = GL_RGBA;
>  
> -   if (ctx->API != API_OPENGLES && ctx->API != API_OPENGLES2) {
> -  /* fixed point arrays / data is only allowed with OpenGL ES 1.x/2.0 */
> +   if (ctx->API == API_OPENGLES || ctx->API == API_OPENGLES2) {

if (_mesa_is_gles(ctx)) {

> +  /* Once Mesa gets support for GL_OES_vertex_half_float this mask will
> +   * change.  Adding support for this extension isn't quite as trivial as
> +   * we'd like because ES uses a different enum value for GL_HALF_FLOAT.
> +   */
> +  legalTypesMask &= ~(FIXED_GL_BIT
> +  | UNSIGNED_INT_2_10_10_10_REV_BIT
> +  | INT_2_10_10_10_REV_BIT
> +  | HALF_BIT | DOUBLE_BIT);
> +   } else {
> +  assert(ctx->API == API_OPENGL);

I believe this assertion is wrong.  Both VertexAttribPointer and
VertexAttribIPointer call update_arrays, and neither of those functions
are deprecated.  So it's possible to get here from API_OPENGL_CORE.

I would just remove it.

> +
>legalTypesMask &= ~FIXED_ES_BIT;
> -   }
> -   if (!ctx->Extensions.ARB_ES2_compatibility) {
> -  legalTypesMask &= ~FIXED_GL_BIT;
> -   }
> -   if (!ctx->Extensions.ARB_vertex_type_2_10_10_10_rev) {
> -  legalTypesMask &= ~(UNSIGNED_INT_2_10_10_10_REV_BIT |
> -  INT_2_10_10_10_REV_BIT);
> +
> +  if (!ctx->Extensions.ARB_ES2_compatibility)
> + legalTypesMask &= ~FIXED_GL_BIT;
> +
> +  if (!ctx->Extensions.ARB_vertex_type_2_10_10_10_rev)
> + legalTypesMask &= ~(UNSIGNED_INT_2_10_10_10_REV_BIT |
> + INT_2_10_10_10_REV_BIT);
> }
>  
> typeBit = type_to_bit(ctx, type);
> 

This is also not a mere refactor---unless I'm reading something wrong,
it changes behavior rather substantially.

Consider the old code:

   if (ctx->API != API_OPENGLES && ctx->API != API_OPENGLES2) {
  /* fixed point arrays / data is only allowed with OpenGL ES 1.x/2.0 */
  legalTypesMask &= ~FIXED_ES_BIT;
   }
   if (!ctx->Extensions.ARB_ES2_compatibility) {
  legalTypesMask &= ~FIXED_GL_BIT;
   }

In the API_OPENGL case, the first conditional would mask out
FIXED_ES_BIT, disallowing it even if ARB_ES2_compatibility was
supported.  Your new code allows it, which is a bug fix.  (The
ARB_ES2_compatibility spec explicitly allows GL_FIXED with
VertexAttribPointer.)

In the API_OPENGLES (1 or 2) case, if the driver supports
ARB_ES2_compatibility, the second conditional would /still/ mask out
FIXED_ES_BIT, disallowing it even on ES!  Your new code correctly allows
that (another serious bug fix).

So unless I'm misreading it, the old code was just completely broken
regarding GL_FIXED data, and your new code is reasonable and fixes it.
I believe at least a comment in the commit message is in order; maybe
even a mark for stable?  (Unless GL_FIXED is just totally broken
elsewhere and allowing it through here causes worse bugs...)
___
mesa-dev mailing list
mesa-dev@lists.freedesktop.org
http://lists.freedesktop.org/mailman/listinfo/mesa-dev