Re: [Mesa-dev] [PATCH 02/21] glsl: protect locale_t with a mutex

2014-05-05 Thread Kenneth Graunke
On 05/04/2014 02:14 PM, Chia-I Wu wrote:
> On Sat, May 3, 2014 at 1:52 AM, Ian Romanick  wrote:
>> On 04/22/2014 01:58 AM, Chia-I Wu wrote:
>>> There may be two contexts compiling shaders at the same time.  locale_t 
>>> needs
>>> to be protected.
>>
>> Rather than calling glsl_initialize_strtod from other places in the
>> compiler, it seems better to use call_once from the strtof and strtod
>> functions.
> How about having a static object to call newlocale()/freelocale() in
> its constructor/destructor?  It will impose no overead on
> glsl_strtod(), at the expense of little wasted memory when the
> applications do not compile shaders.

That seems like a good plan to me.  I'm actually kind of surprised that
POSIX doesn't provide a pre-existing locale_t object for the POSIX/C locale.

--Ken



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


Re: [Mesa-dev] [PATCH 13/14] mesa: Split the shader texture update logic from fixed function.

2014-05-05 Thread Marek Olšák
Good point. No, we don't.

Marek

On Fri, Apr 25, 2014 at 8:07 PM, Eric Anholt  wrote:
> Marek Olšák  writes:
>
>> Have you considered disabling creating the fallback textures for
>> hardware which can return the correct constant for a texture fetch if
>> a texture isn't bouńd?
>
> No, I hadn't.  Given that nobody ever intentionally executes with a
> fallback texture, do we care to reduce its overhead?
___
mesa-dev mailing list
mesa-dev@lists.freedesktop.org
http://lists.freedesktop.org/mailman/listinfo/mesa-dev


[Mesa-dev] [Bug 77449] Tracker bug for all bugs related to Steam titles

2014-05-05 Thread bugzilla-daemon
https://bugs.freedesktop.org/show_bug.cgi?id=77449

Bug 77449 depends on bug 77207, which changed state.

Bug 77207 Summary: [ivb/hsw] batch overwritten with garbage
https://bugs.freedesktop.org/show_bug.cgi?id=77207

   What|Removed |Added

 Status|RESOLVED|REOPENED
 Resolution|FIXED   |---

-- 
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


[Mesa-dev] [Bug 78298] New: Don't enforce gallium-pipe shared library when enable_xa is set to yes

2014-05-05 Thread bugzilla-daemon
https://bugs.freedesktop.org/show_bug.cgi?id=78298

  Priority: medium
Bug ID: 78298
  Assignee: mesa-dev@lists.freedesktop.org
   Summary: Don't enforce gallium-pipe shared library when
enable_xa is set to yes
  Severity: normal
Classification: Unclassified
OS: All
  Reporter: kwiz...@gmail.com
  Hardware: Other
Status: NEW
   Version: unspecified
 Component: Mesa core
   Product: Mesa

For some reason, enabling xa on ARM (for freedreeno) enforce the gallium-pipe
shared library to be built whereas it is not built with vmware on x86.

This patch drop this enforcement since it's not enabled with the regular vmware
xa driver.

This patch is not yet tested on vmware, I can only do this for freedreeno.


This bug was initially reported here:
https://bugzilla.redhat.com/show_bug.cgi?id=1094199

-- 
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


[Mesa-dev] [Bug 78298] Don't enforce gallium-pipe shared library when enable_xa is set to yes

2014-05-05 Thread bugzilla-daemon
https://bugs.freedesktop.org/show_bug.cgi?id=78298

--- Comment #1 from NicolasChauvet  ---
Created attachment 98481
  --> https://bugs.freedesktop.org/attachment.cgi?id=98481&action=edit
Don-t-enforce-gallium-pipe-loader-when-xa-is-enabled

-- 
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


[Mesa-dev] [Bug 78298] Don't enforce gallium-pipe shared library when enable_xa is set to yes

2014-05-05 Thread bugzilla-daemon
https://bugs.freedesktop.org/show_bug.cgi?id=78298

--- Comment #2 from Emil Velikov  ---
As of Mesa 10.2 we're building libxatracker as a standalone library, that is
not specific to vmware's virtual gpu.

If order to use any hardware pipe-driver we need the corresponding shared
library. Ideally one should be able to opt-out of that behaviour, with that
work coming in the next mesa release.

How did you test freedreno without pipe_msm.so ? AFAICS it will simply not work
(tm).

-- 
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] gallium: remove enum numbers from shader cap queries

2014-05-05 Thread Brian Paul

On 05/03/2014 07:43 AM, Michel Dänzer wrote:

On 03.05.2014 22:29, Brian Paul wrote:

The enum numbers were just cruft.


I disagree. Nothing's changed about the reason I added them in the first
place: When a driver is queried for a cap it doesn't know about, it
prints an error message containing only the numeric value of the cap.
These explicit numbers make it easy to find out which cap the driver is
complaining about.


Hi Michel,

In the past when someone added a new enum and softpipe, llvmpipe or svga 
complained at runtime about an unhandled num, it's been pretty easy to 
spot the new one and fix it.


Actually, what you have in the radeon/si drivers is better:  switch 
statements w/out default cases.  So the compiler will warn about the 
missing enum case by name (not number).  That's a more effective way of 
catching unhandled enums earlier.  I should change softpipe, llvmpipe 
and svga to do the same.


How does that sound?  Are there other drivers you're concerned about?

-Brian

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


[Mesa-dev] [Bug 78298] Don't enforce gallium-pipe shared library when enable_xa is set to yes

2014-05-05 Thread bugzilla-daemon
https://bugs.freedesktop.org/show_bug.cgi?id=78298

Igor Gnatenko  changed:

   What|Removed |Added

 CC||i.gnatenko.br...@gmail.com

-- 
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] drawtex: resolve glDrawTexfOES extension function

2014-05-05 Thread Brian Paul

On 05/04/2014 11:22 PM, Tapani Pälli wrote:

Bugzilla: 
https://urldefense.proofpoint.com/v1/url?u=https://bugs.freedesktop.org/show_bug.cgi?id%3D78101&k=oIvRg1%2BdGAgOoM1BIlLLqw%3D%3D%0A&r=lGQMzzTgII0I7jefp2FHq7WtZ%2BTLs8wadB%2BiIj9xpBY%3D%0A&m=3nZFINPzyuZlUOeQ3unnezx6v2U8BbLSYKVaixUZyo4%3D%0A&s=a93bc14795ff8d399d257b88dc5bdb513fe065dc3d13beba346f3e3c2a525712
Signed-off-by: Tapani Pälli 
---
  src/egl/opengles1/drawtex.c | 10 +-
  1 file changed, 9 insertions(+), 1 deletion(-)

diff --git a/src/egl/opengles1/drawtex.c b/src/egl/opengles1/drawtex.c
index 524f931..1ba8ac7 100644
--- a/src/egl/opengles1/drawtex.c
+++ b/src/egl/opengles1/drawtex.c
@@ -25,13 +25,14 @@ static GLfloat width = 200, height = 200;
  static GLboolean animate = GL_FALSE;
  static int win;

+static PFNGLDRAWTEXFOESPROC glDrawTexfOES_func = NULL;

  static void
  draw(void)
  {
 glClear(GL_COLOR_BUFFER_BIT);

-   glDrawTexfOES(view_posx, view_posy, 0.0, width, height);
+   glDrawTexfOES_func(view_posx, view_posy, 0.0, width, height);
  }


@@ -128,6 +129,13 @@ init(void)
exit(1);
 }

+   glDrawTexfOES_func = eglGetProcAddress("glDrawTexfOES");
+
+   if (!glDrawTexfOES_func) {
+  fprintf(stderr, "Sorry, failed to resolve glDrawTexfOES function\n");
+  exit(1);
+   }
+
 glClearColor(0.4, 0.4, 0.4, 0.0);

 make_smile_texture();



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 13/14] mesa: Split the shader texture update logic from fixed function.

2014-05-05 Thread Brian Paul

On 04/25/2014 12:07 PM, Eric Anholt wrote:

Marek Olšák  writes:


Have you considered disabling creating the fallback textures for
hardware which can return the correct constant for a texture fetch if
a texture isn't bouńd?


No, I hadn't.  Given that nobody ever intentionally executes with a
fallback texture, do we care to reduce its overhead?


FWIW, years ago there was a GL screensaver program that rendered with an 
incomplete texture state and relied on correctly handling of that to 
produce the right image.  That would hit the fallback texture code.


I notified the author of the program about the issue back then.  In any 
case, I wouldn't worry about it.


-Brian

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


Re: [Mesa-dev] [PATCH 03/11] i965: Move has_hiz from the slice to the level.

2014-05-05 Thread Chad Versace
On Thu, May 01, 2014 at 03:57:28PM -0700, Kenneth Graunke wrote:
> On 05/01/2014 02:21 PM, Eric Anholt wrote:
> > The value depends only on the level, so no need to store the bool per slice.
> > Shrinks intel_mipmap_slice from 24 bytes to 16, while slotting into an
> > existing hole in intel_mipmap_level.
> 
> Huh.  I thought that we needed to disable HiZ for array slices that fell
> on bad boundaries, due to the 11*j thing.
> 
> But you're right, the existing code sure doesn't seem to use it.
> 
> I'd like to see Chad's ack on this.

When i965 still programmed the x/y offset in 3DSTATE_DEPTH_BUFFER to
trick the hardware into rendering to a specific miptree slice, then
hiz-enablement was per-slice. But that ceased being the case as of
20799c11eb8fbdd9adf0baf1d4d5a77c0deb68f3. (DISCLAIMER: I didn't review
207999c myself, but I assume its reviewers took due diligence).

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


[Mesa-dev] [PATCH 2/3] tgsi: add missing switch cases in tgsi_exec_get_shader_param()

2014-05-05 Thread Brian Paul
Add cases for PIPE_SHADER_CAP_MAX_SAMPLER_VIEWS and
PIPE_SHADER_CAP_PREFERRED_IR.  Remove default switch case so we
learn of missing cases at compile time.
---
 src/gallium/auxiliary/tgsi/tgsi_exec.h |   10 --
 1 file changed, 8 insertions(+), 2 deletions(-)

diff --git a/src/gallium/auxiliary/tgsi/tgsi_exec.h 
b/src/gallium/auxiliary/tgsi/tgsi_exec.h
index 9b1995c..bb56934 100644
--- a/src/gallium/auxiliary/tgsi/tgsi_exec.h
+++ b/src/gallium/auxiliary/tgsi/tgsi_exec.h
@@ -449,11 +449,17 @@ tgsi_exec_get_shader_param(enum pipe_shader_cap param)
   return 1;
case PIPE_SHADER_CAP_MAX_TEXTURE_SAMPLERS:
   return PIPE_MAX_SAMPLERS;
+   case PIPE_SHADER_CAP_MAX_SAMPLER_VIEWS:
+  return PIPE_MAX_SHADER_SAMPLER_VIEWS;
+   case PIPE_SHADER_CAP_PREFERRED_IR:
+  return PIPE_SHADER_IR_TGSI;
case PIPE_SHADER_CAP_TGSI_SQRT_SUPPORTED:
   return 1;
-   default:
-  return 0;
}
+   /* if we get here, we missed a shader cap above (and should have seen
+* a compiler warning.)
+*/
+   return 0;
 }
 
 #if defined __cplusplus
-- 
1.7.10.4

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


[Mesa-dev] [PATCH 3/3] svga: add switch case for PIPE_SHADER_CAP_PREFERRED_IR, remove default case

2014-05-05 Thread Brian Paul
Remove default switch case so we're warned of missing cases at compile
time.
---
 src/gallium/drivers/svga/svga_screen.c |   18 ++
 1 file changed, 10 insertions(+), 8 deletions(-)

diff --git a/src/gallium/drivers/svga/svga_screen.c 
b/src/gallium/drivers/svga/svga_screen.c
index 8c70bb7..bc914b7 100644
--- a/src/gallium/drivers/svga/svga_screen.c
+++ b/src/gallium/drivers/svga/svga_screen.c
@@ -343,11 +343,12 @@ static int svga_get_shader_param(struct pipe_screen 
*screen, unsigned shader, en
   case PIPE_SHADER_CAP_MAX_TEXTURE_SAMPLERS:
   case PIPE_SHADER_CAP_MAX_SAMPLER_VIEWS:
  return 16;
-  default:
- debug_printf("Unexpected fragment shader query %u\n", param);
- return 0;
+  case PIPE_SHADER_CAP_PREFERRED_IR:
+ return PIPE_SHADER_IR_TGSI;
   }
-  break;
+  /* If we get here, we failed to handle a cap above */
+  debug_printf("Unexpected fragment shader query %u\n", param);
+  return 0;
case PIPE_SHADER_VERTEX:
   switch (param)
   {
@@ -394,11 +395,12 @@ static int svga_get_shader_param(struct pipe_screen 
*screen, unsigned shader, en
   case PIPE_SHADER_CAP_MAX_TEXTURE_SAMPLERS:
   case PIPE_SHADER_CAP_MAX_SAMPLER_VIEWS:
  return 0;
-  default:
- debug_printf("Unexpected vertex shader query %u\n", param);
- return 0;
+  case PIPE_SHADER_CAP_PREFERRED_IR:
+ return PIPE_SHADER_IR_TGSI;
   }
-  break;
+  /* If we get here, we failed to handle a cap above */
+  debug_printf("Unexpected vertex shader query %u\n", param);
+  return 0;
case PIPE_SHADER_GEOMETRY:
case PIPE_SHADER_COMPUTE:
   /* no support for geometry or compute shaders at this time */
-- 
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/3] gallivm: add PIPE_SHADER_CAP_PREFERRED_IR switch case, remove default

2014-05-05 Thread Brian Paul
Return PIPE_SHADER_IR_TGSI for the PIPE_SHADER_CAP_PREFERRED_IR query.
Remove default switch case so we learn of missing switch cases at
compile time.
---
 src/gallium/auxiliary/gallivm/lp_bld_limits.h |8 ++--
 1 file changed, 6 insertions(+), 2 deletions(-)

diff --git a/src/gallium/auxiliary/gallivm/lp_bld_limits.h 
b/src/gallium/auxiliary/gallivm/lp_bld_limits.h
index 87be351..6cb0949 100644
--- a/src/gallium/auxiliary/gallivm/lp_bld_limits.h
+++ b/src/gallium/auxiliary/gallivm/lp_bld_limits.h
@@ -122,11 +122,15 @@ gallivm_get_shader_param(enum pipe_shader_cap param)
   return PIPE_MAX_SAMPLERS;
case PIPE_SHADER_CAP_MAX_SAMPLER_VIEWS:
   return PIPE_MAX_SHADER_SAMPLER_VIEWS;
+   case PIPE_SHADER_CAP_PREFERRED_IR:
+  return PIPE_SHADER_IR_TGSI;
case PIPE_SHADER_CAP_TGSI_SQRT_SUPPORTED:
   return 1;
-   default:
-  return 0;
}
+   /* if we get here, we missed a shader cap above (and should have seen
+* a compiler warning.)
+*/
+   return 0;
 }
 
 
-- 
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 02/21] glsl: protect locale_t with a mutex

2014-05-05 Thread Ian Romanick
On 05/04/2014 02:14 PM, Chia-I Wu wrote:
> On Sat, May 3, 2014 at 1:52 AM, Ian Romanick  wrote:
>> On 04/22/2014 01:58 AM, Chia-I Wu wrote:
>>> There may be two contexts compiling shaders at the same time.  locale_t 
>>> needs
>>> to be protected.
>>
>> Rather than calling glsl_initialize_strtod from other places in the
>> compiler, it seems better to use call_once from the strtof and strtod
>> functions.
> How about having a static object to call newlocale()/freelocale() in
> its constructor/destructor?  It will impose no overead on
> glsl_strtod(), at the expense of little wasted memory when the
> applications do not compile shaders.

The problem I see with that is we don't know what order constructors on
global objects will occur.  Are we sure the contructor will be invoked
before we need the locale now and in the future?


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


[Mesa-dev] [Bug 77449] Tracker bug for all bugs related to Steam titles

2014-05-05 Thread bugzilla-daemon
https://bugs.freedesktop.org/show_bug.cgi?id=77449

Bug 77449 depends on bug 77207, which changed state.

Bug 77207 Summary: [ivb/hsw] batch overwritten with garbage
https://bugs.freedesktop.org/show_bug.cgi?id=77207

   What|Removed |Added

 Status|REOPENED|RESOLVED
 Resolution|--- |FIXED

-- 
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] drawtex: resolve glDrawTexfOES extension function

2014-05-05 Thread Ian Romanick
Reviewed-by: Ian Romanick 

Thanks Tapani.

On 05/04/2014 10:22 PM, Tapani Pälli wrote:
> Bugzilla: https://bugs.freedesktop.org/show_bug.cgi?id=78101
> Signed-off-by: Tapani Pälli 
> ---
>  src/egl/opengles1/drawtex.c | 10 +-
>  1 file changed, 9 insertions(+), 1 deletion(-)
> 
> diff --git a/src/egl/opengles1/drawtex.c b/src/egl/opengles1/drawtex.c
> index 524f931..1ba8ac7 100644
> --- a/src/egl/opengles1/drawtex.c
> +++ b/src/egl/opengles1/drawtex.c
> @@ -25,13 +25,14 @@ static GLfloat width = 200, height = 200;
>  static GLboolean animate = GL_FALSE;
>  static int win;
>  
> +static PFNGLDRAWTEXFOESPROC glDrawTexfOES_func = NULL;
>  
>  static void
>  draw(void)
>  {
> glClear(GL_COLOR_BUFFER_BIT);
>  
> -   glDrawTexfOES(view_posx, view_posy, 0.0, width, height);
> +   glDrawTexfOES_func(view_posx, view_posy, 0.0, width, height);
>  }
>  
>  
> @@ -128,6 +129,13 @@ init(void)
>exit(1);
> }
>  
> +   glDrawTexfOES_func = eglGetProcAddress("glDrawTexfOES");
> +
> +   if (!glDrawTexfOES_func) {
> +  fprintf(stderr, "Sorry, failed to resolve glDrawTexfOES function\n");
> +  exit(1);
> +   }
> +
> glClearColor(0.4, 0.4, 0.4, 0.0);
>  
> make_smile_texture();
> 

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


[Mesa-dev] [Bug 78258] make check link_varyings.gl_ClipDistance failure

2014-05-05 Thread bugzilla-daemon
https://bugs.freedesktop.org/show_bug.cgi?id=78258

Ian Romanick  changed:

   What|Removed |Added

 Status|NEW |ASSIGNED

--- Comment #2 from Ian Romanick  ---
D'oh.  It looks like I disabled the 'make check' part of my build script while
I was doing a long bisect, and I never re-enabled it.  I'll take a look at
this.

-- 
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] glsl: fix bogus layout qualifier warnings

2014-05-05 Thread Anuj Phogat
On Sun, May 4, 2014 at 10:09 PM, Tapani Pälli  wrote:
> Print out GL_ARB_explicit_attrib_location warnings only
> when parsing attribute that uses "location" qualifier.
>
> Bugzilla: https://bugs.freedesktop.org/show_bug.cgi?id=77245
>
> Signed-off-by: Tapani Pälli 
May be tag for the stable branches.

> ---
>  src/glsl/glsl_parser.yy | 11 +++
>  1 file changed, 7 insertions(+), 4 deletions(-)
>
> diff --git a/src/glsl/glsl_parser.yy b/src/glsl/glsl_parser.yy
> index e3ee16a..b09d6e5 100644
> --- a/src/glsl/glsl_parser.yy
> +++ b/src/glsl/glsl_parser.yy
> @@ -1319,6 +1319,13 @@ layout_qualifier_id:
>if (match_layout_qualifier("location", $1, state) == 0) {
>   $$.flags.q.explicit_location = 1;
>
> + if ($$.flags.q.attribute == 1 &&
> + state->ARB_explicit_attrib_location_warn) {
> +_mesa_glsl_warning(& @1, state,
> +   "GL_ARB_explicit_attrib_location layout "
> +   "identifier `%s' used", $1);
> + }
> +
>   if ($3 >= 0) {
>  $$.location = $3;
>   } else {
> @@ -1426,10 +1433,6 @@ layout_qualifier_id:
>   _mesa_glsl_error(& @1, state, "unrecognized layout identifier "
>"`%s'", $1);
>   YYERROR;
> -  } else if (state->ARB_explicit_attrib_location_warn) {
> - _mesa_glsl_warning(& @1, state,
> -"GL_ARB_explicit_attrib_location layout "
> -"identifier `%s' used", $1);
>}
> }
> | interface_block_layout_qualifier
> --
Reviewed-by: Anuj Phogat  
> 1.8.3.1
>
> ___
> mesa-dev mailing list
> mesa-dev@lists.freedesktop.org
> http://lists.freedesktop.org/mailman/listinfo/mesa-dev
___
mesa-dev mailing list
mesa-dev@lists.freedesktop.org
http://lists.freedesktop.org/mailman/listinfo/mesa-dev


[Mesa-dev] [PATCH] linker: Fix consumer_inputs_with_locations indexing

2014-05-05 Thread Ian Romanick
From: Ian Romanick 

In an earlier incarnation of populate_consumer_input_sets and
get_matching_input, the consumer_inputs_with_locations array was indexed
using the user-specified location.  In that version, only user-defined
varyings were included in the array.

In the current incarnation, the Mesa location is used to index the
array, and built-in varyings are included.

This change fixes the unit test to exepect gl_ClipDistance in the array,
and it resizes the arrays to actually be big enough.  It's just dumb
luck that the existing piglit tests use small enough locations to not
stomp the stack. :(

Signed-off-by: Ian Romanick 
Bugzilla: https://bugs.freedesktop.org/show_bug.cgi?id=78258
Cc: "10.2" 
Cc: Vinson Lee 
---
 src/glsl/link_varyings.cpp   |  8 
 src/glsl/tests/varyings_test.cpp | 11 +--
 2 files changed, 9 insertions(+), 10 deletions(-)

diff --git a/src/glsl/link_varyings.cpp b/src/glsl/link_varyings.cpp
index 45f1b10..ac38a2f 100644
--- a/src/glsl/link_varyings.cpp
+++ b/src/glsl/link_varyings.cpp
@@ -1092,11 +1092,11 @@ bool
 populate_consumer_input_sets(void *mem_ctx, exec_list *ir,
  hash_table *consumer_inputs,
  hash_table *consumer_interface_inputs,
- ir_variable 
*consumer_inputs_with_locations[MAX_VARYING])
+ ir_variable 
*consumer_inputs_with_locations[VARYING_SLOT_MAX])
 {
memset(consumer_inputs_with_locations,
   0,
-  sizeof(consumer_inputs_with_locations[0]) * MAX_VARYING);
+  sizeof(consumer_inputs_with_locations[0]) * VARYING_SLOT_MAX);
 
foreach_list(node, ir) {
   ir_variable *const input_var = ((ir_instruction *) node)->as_variable();
@@ -1152,7 +1152,7 @@ get_matching_input(void *mem_ctx,
const ir_variable *output_var,
hash_table *consumer_inputs,
hash_table *consumer_interface_inputs,
-   ir_variable *consumer_inputs_with_locations[MAX_VARYING])
+   ir_variable 
*consumer_inputs_with_locations[VARYING_SLOT_MAX])
 {
ir_variable *input_var;
 
@@ -1277,7 +1277,7 @@ assign_varying_locations(struct gl_context *ctx,
   = hash_table_ctor(0, hash_table_string_hash, hash_table_string_compare);
hash_table *consumer_interface_inputs
   = hash_table_ctor(0, hash_table_string_hash, hash_table_string_compare);
-   ir_variable *consumer_inputs_with_locations[MAX_VARYING] = {
+   ir_variable *consumer_inputs_with_locations[VARYING_SLOT_MAX] = {
   NULL,
};
 
diff --git a/src/glsl/tests/varyings_test.cpp b/src/glsl/tests/varyings_test.cpp
index 8a188a7..662fc0e 100644
--- a/src/glsl/tests/varyings_test.cpp
+++ b/src/glsl/tests/varyings_test.cpp
@@ -39,14 +39,14 @@ bool
 populate_consumer_input_sets(void *mem_ctx, exec_list *ir,
  hash_table *consumer_inputs,
  hash_table *consumer_interface_inputs,
- ir_variable 
*consumer_inputs_with_locations[MAX_VARYING]);
+ ir_variable 
*consumer_inputs_with_locations[VARYING_SLOT_MAX]);
 
 ir_variable *
 get_matching_input(void *mem_ctx,
const ir_variable *output_var,
hash_table *consumer_inputs,
hash_table *consumer_interface_inputs,
-   ir_variable *consumer_inputs_with_locations[MAX_VARYING]);
+   ir_variable 
*consumer_inputs_with_locations[VARYING_SLOT_MAX]);
 }
 
 class link_varyings : public ::testing::Test {
@@ -70,7 +70,7 @@ public:
hash_table *consumer_interface_inputs;
 
const glsl_type *simple_interface;
-   ir_variable *junk[MAX_VARYING];
+   ir_variable *junk[VARYING_SLOT_MAX];
 };
 
 link_varyings::link_varyings()
@@ -197,9 +197,8 @@ TEST_F(link_varyings, gl_ClipDistance)
 consumer_interface_inputs,
 junk));
 
-   EXPECT_EQ((void *) clipdistance,
- hash_table_find(consumer_inputs, "gl_ClipDistance"));
-   EXPECT_EQ(1u, num_elements(consumer_inputs));
+   EXPECT_EQ(clipdistance, junk[VARYING_SLOT_CLIP_DIST0]);
+   EXPECT_TRUE(is_empty(consumer_inputs));
EXPECT_TRUE(is_empty(consumer_interface_inputs));
 }
 
-- 
1.8.1.4

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


[Mesa-dev] [PATCH v2 0/3] Software rasterizer in the DRM EGL platform

2014-05-05 Thread Giovanni Campagna
This is my second attempt to bring swrast to the DRM EGL platform.
It includes both the legacy loader, which will work with any
swrast driver, and the new gallium winsys which works with the
DRI2 loader and softpipe/llvmpipe.

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


[Mesa-dev] [PATCH v2 3/3] Add a new capabilities for drivers that can't share buffers

2014-05-05 Thread Giovanni Campagna
From: Giovanni Campagna 

The kms-dri swrast driver cannot share buffers using the GEM,
so it must tell the loader to disable extensions relying on
that, without disabling the image DRI extension altogheter
(which would prevent the loader from working at all).
This requires a new gallium capability (which is queried on
the pipe_screen and for swrast drivers it's forwared to the
winsys), and requires a new version of the DRI image extension.
---
 include/GL/internal/dri_interface.h| 17 +-
 src/egl/drivers/dri2/egl_dri2.c| 10 -
 src/egl/drivers/dri2/platform_drm.c| 17 +++---
 src/gallium/docs/source/screen.rst |  5 -
 src/gallium/drivers/freedreno/freedreno_screen.c   |  1 +
 src/gallium/drivers/i915/i915_screen.c |  1 +
 src/gallium/drivers/ilo/ilo_screen.c   |  2 ++
 src/gallium/drivers/llvmpipe/lp_screen.c   |  7 ++
 src/gallium/drivers/nouveau/nv30/nv30_screen.c |  1 +
 src/gallium/drivers/nouveau/nv50/nv50_screen.c |  2 ++
 src/gallium/drivers/nouveau/nvc0/nvc0_screen.c |  2 ++
 src/gallium/drivers/r300/r300_screen.c |  1 +
 src/gallium/drivers/r600/r600_pipe.c   |  1 +
 src/gallium/drivers/radeonsi/si_pipe.c |  1 +
 src/gallium/drivers/softpipe/sp_screen.c   |  7 ++
 src/gallium/drivers/svga/svga_screen.c |  2 ++
 src/gallium/include/pipe/p_defines.h   |  1 +
 src/gallium/include/state_tracker/sw_winsys.h  |  5 +
 src/gallium/state_trackers/dri/common/dri_screen.h |  1 +
 src/gallium/state_trackers/dri/drm/dri2.c  | 23 +++
 src/gallium/winsys/sw/kms-dri/kms_dri_sw_winsys.c  | 26 +++---
 21 files changed, 120 insertions(+), 13 deletions(-)

diff --git a/include/GL/internal/dri_interface.h 
b/include/GL/internal/dri_interface.h
index 4d57d0b..fba1cac 100644
--- a/include/GL/internal/dri_interface.h
+++ b/include/GL/internal/dri_interface.h
@@ -1005,7 +1005,7 @@ struct __DRIdri2ExtensionRec {
  * extensions.
  */
 #define __DRI_IMAGE "DRI_IMAGE"
-#define __DRI_IMAGE_VERSION 8
+#define __DRI_IMAGE_VERSION 9
 
 /**
  * These formats correspond to the similarly named MESA_FORMAT_*
@@ -1133,6 +1133,13 @@ enum __DRIChromaSiting {
 #define __DRI_IMAGE_ERROR_BAD_PARAMETER 3
 /*@}*/
 
+/**
+ * \name Capabilities that might be returned by 
__DRIimageExtensionRec::getCapabilities
+ */
+/*@{*/
+#define __DRI_IMAGE_CAP_GLOBAL_NAMES 1
+/*@}*/
+
 typedef struct __DRIimageRec  __DRIimage;
 typedef struct __DRIimageExtensionRec __DRIimageExtension;
 struct __DRIimageExtensionRec {
@@ -1239,6 +1246,14 @@ struct __DRIimageExtensionRec {
  enum __DRIChromaSiting vert_siting,
  unsigned *error,
  void *loaderPrivate);
+
+   /**
+* Query for general capabilities of the driver that concern
+* buffer sharing and image importing.
+*
+* \since 9
+*/
+   int (*getCapabilities)(__DRIscreen *screen);
 };
 
 
diff --git a/src/egl/drivers/dri2/egl_dri2.c b/src/egl/drivers/dri2/egl_dri2.c
index 380bd7b..178a6f7 100644
--- a/src/egl/drivers/dri2/egl_dri2.c
+++ b/src/egl/drivers/dri2/egl_dri2.c
@@ -522,7 +522,15 @@ dri2_setup_screen(_EGLDisplay *disp)
}
 
if (dri2_dpy->image) {
-  disp->Extensions.MESA_drm_image = EGL_TRUE;
+  if (dri2_dpy->image->base.version >= 9 &&
+  dri2_dpy->image->getCapabilities != NULL) {
+ int capabilities;
+
+ capabilities = dri2_dpy->image->getCapabilities(dri2_dpy->dri_screen);
+ disp->Extensions.MESA_drm_image = (capabilities & 
__DRI_IMAGE_CAP_GLOBAL_NAMES) != 0;
+  } else
+ disp->Extensions.MESA_drm_image = EGL_TRUE;
+
   disp->Extensions.KHR_image_base = EGL_TRUE;
   disp->Extensions.KHR_gl_renderbuffer_image = EGL_TRUE;
   if (dri2_dpy->image->base.version >= 5 &&
diff --git a/src/egl/drivers/dri2/platform_drm.c 
b/src/egl/drivers/dri2/platform_drm.c
index 17b93db..2b79612 100644
--- a/src/egl/drivers/dri2/platform_drm.c
+++ b/src/egl/drivers/dri2/platform_drm.c
@@ -266,7 +266,10 @@ back_bo_to_dri_buffer(struct dri2_egl_surface *dri2_surf, 
__DRIbuffer *buffer)
 
bo = (struct gbm_dri_bo *) dri2_surf->back->bo;
 
-   dri2_dpy->image->queryImage(bo->image, __DRI_IMAGE_ATTRIB_NAME, &name);
+   if (dri2_surf->base.Resource.Display->Extensions.MESA_drm_image)
+  dri2_dpy->image->queryImage(bo->image, __DRI_IMAGE_ATTRIB_NAME, &name);
+   else
+  dri2_dpy->image->queryImage(bo->image, __DRI_IMAGE_ATTRIB_HANDLE, &name);
dri2_dpy->image->queryImage(bo->image, __DRI_IMAGE_ATTRIB_STRIDE, &pitch);
 
buffer->attachment = __DRI_BUFFER_BACK_LEFT;
@@ -719,8 +722,16 @@ dri2_initialize_drm(_EGLDriver *drv, _EGLDisplay *disp)
   disp->Extensions.EXT_buffer_age = EGL_TRUE;
 
 #ifdef HAVE_WAYLAND_PLATFORM
-   if (dri2_dpy

Re: [Mesa-dev] [PATCH] st/egl: Flush resources before presentation (android - bug 77966)

2014-05-05 Thread Paulo Sergio
Ok. Name is Paulo Sergio Travaglia. Shall I resend the patch?

Thanks
Em 04/05/2014 18:40, "Chia-I Wu"  escreveu:

> On Sun, May 4, 2014 at 7:02 PM, Marek Olšák  wrote:
> > Reviewed-by: Marek Olšák 
> Looks good to me too, except please use your real name.
> > Marek
> >
> > On Fri, May 2, 2014 at 5:00 PM, pstglia  wrote:
> >> ---
> >>  src/gallium/state_trackers/egl/android/native_android.cpp | 7 +++
> >>  1 file changed, 7 insertions(+)
> >>
> >> diff --git a/src/gallium/state_trackers/egl/android/native_android.cpp
> b/src/gallium/state_trackers/egl/android/native_android.cpp
> >> index e73d031..8620ed8 100644
> >> --- a/src/gallium/state_trackers/egl/android/native_android.cpp
> >> +++ b/src/gallium/state_trackers/egl/android/native_android.cpp
> >> @@ -396,6 +396,13 @@ android_surface_swap_buffers(struct native_surface
> *nsurf)
> >> struct android_surface *asurf = android_surface(nsurf);
> >> struct android_display *adpy = asurf->adpy;
> >>
> >> +   struct native_display *ndpy = &adpy->base;
> >> +   struct pipe_context *pipe = ndpy_get_copy_context(ndpy);
> >> +
> >> +   /* flush buffer */
> >> +   pipe->flush_resource(pipe, asurf->buf_res);
> >> +   pipe->flush(pipe, NULL, 0);
> >> +
> >> android_surface_enqueue_buffer(&asurf->base);
> >>
> >> asurf->stamp++;
> >> --
> >> 1.7.12.1
> >>
> >> ___
> >> 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
>
>
>
> --
> o...@lunarg.com
>
___
mesa-dev mailing list
mesa-dev@lists.freedesktop.org
http://lists.freedesktop.org/mailman/listinfo/mesa-dev


[Mesa-dev] [PATCH v2 2/3] Add a dumb drm/kms winsys for software rendering

2014-05-05 Thread Giovanni Campagna
From: Giovanni Campagna 

Add a new winsys and target that can be used with a dri2 state tracker and
loader instead of drisw. This allows to use gbm as a dri2/image loader
and avoid the extra copy from the backbuffer to the shadow frontbuffer.

The new driver is called "kms_swrast", and is only loaded by gbm
as a fallback, because it is only useful with the gbm platform
(as no buffer sharing is possible)
---
 configure.ac   |   4 +-
 docs/relnotes/10.3.html|   2 +
 src/gallium/targets/Makefile.am|   2 +-
 src/gallium/targets/dri-kms-swrast/Makefile.am |  61 
 .../targets/dri-kms-swrast/kms_swrast_drm_api.c|  65 +
 src/gallium/winsys/Makefile.am |   2 +-
 src/gallium/winsys/sw/kms-dri/Makefile.am  |  33 +++
 src/gallium/winsys/sw/kms-dri/kms_dri_sw_winsys.c  | 310 +
 src/gallium/winsys/sw/kms-dri/kms_dri_sw_winsys.h  |  37 +++
 src/gbm/backends/dri/gbm_dri.c |   6 +-
 10 files changed, 516 insertions(+), 6 deletions(-)
 create mode 100644 src/gallium/targets/dri-kms-swrast/Makefile.am
 create mode 100644 src/gallium/targets/dri-kms-swrast/kms_swrast_drm_api.c
 create mode 100644 src/gallium/winsys/sw/kms-dri/Makefile.am
 create mode 100644 src/gallium/winsys/sw/kms-dri/kms_dri_sw_winsys.c
 create mode 100644 src/gallium/winsys/sw/kms-dri/kms_dri_sw_winsys.h

diff --git a/configure.ac b/configure.ac
index e77ed77..958e03e 100644
--- a/configure.ac
+++ b/configure.ac
@@ -1863,7 +1863,7 @@ if test -n "$with_gallium_drivers"; then
 fi
 
 if test "x$enable_dri" = xyes; then
-GALLIUM_TARGET_DIRS="$GALLIUM_TARGET_DIRS dri-swrast"
+GALLIUM_TARGET_DIRS="$GALLIUM_TARGET_DIRS dri-swrast 
dri-kms-swrast"
 fi
 ;;
 *)
@@ -2080,6 +2080,7 @@ AC_CONFIG_FILES([Makefile
src/gallium/targets/dri-ilo/Makefile
src/gallium/targets/dri-nouveau/Makefile
src/gallium/targets/dri-swrast/Makefile
+   src/gallium/targets/dri-kms-swrast/Makefile
src/gallium/targets/dri-vmwgfx/Makefile
src/gallium/targets/egl-static/Makefile
src/gallium/targets/gbm/Makefile
@@ -2111,6 +2112,7 @@ AC_CONFIG_FILES([Makefile
src/gallium/winsys/nouveau/drm/Makefile
src/gallium/winsys/radeon/drm/Makefile
src/gallium/winsys/svga/drm/Makefile
+   src/gallium/winsys/sw/kms-dri/Makefile
src/gallium/winsys/sw/dri/Makefile
src/gallium/winsys/sw/fbdev/Makefile
src/gallium/winsys/sw/null/Makefile
diff --git a/docs/relnotes/10.3.html b/docs/relnotes/10.3.html
index aebc3ff..92b2cc0 100644
--- a/docs/relnotes/10.3.html
+++ b/docs/relnotes/10.3.html
@@ -45,6 +45,8 @@ Note: some of the new features are only available with 
certain drivers.
 
 
 GL_ARB_stencil_texturing on nv50, nvc0, r600, and radeonsi
+A new software rasterizer driver that works with DRM drivers that
+don't have a full-fledged GEM (such as qxl or simpledrm)
 
 
 
diff --git a/src/gallium/targets/Makefile.am b/src/gallium/targets/Makefile.am
index 5023dbc..95b644e 100644
--- a/src/gallium/targets/Makefile.am
+++ b/src/gallium/targets/Makefile.am
@@ -124,7 +124,7 @@ endif
 
 if HAVE_GALLIUM_SOFTPIPE
 if HAVE_DRI
-SUBDIRS += dri-swrast
+SUBDIRS += dri-swrast dri-kms-swrast
 endif
 endif
 
diff --git a/src/gallium/targets/dri-kms-swrast/Makefile.am 
b/src/gallium/targets/dri-kms-swrast/Makefile.am
new file mode 100644
index 000..09a8d17
--- /dev/null
+++ b/src/gallium/targets/dri-kms-swrast/Makefile.am
@@ -0,0 +1,61 @@
+# 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.
+
+include $(top_srcdir)/src/gallium/Automake.inc
+
+AM_CFLAGS = \
+   $(EXPAT_CFLAGS) \
+   

[Mesa-dev] Compiling Mesa/softpipe for Windows

2014-05-05 Thread André Lochotzke
Hello,

I’m trying to get OpenGL 3.3 working on Windows via the softpipe driver. Can 
somebody tell me the steps to successfully (cross) compile it with either MinGW 
or Visual Studio. I seem to always run into problems.

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


[Mesa-dev] [PATCH v2 1/3] Add support for swrast to the DRM EGL platform

2014-05-05 Thread Giovanni Campagna
From: Giovanni Campagna 

Turn GBM into a swrast loader (providing putimage/getimage backed
by a dumb KMS buffer). This allows to run KMS+DRM GL applications
(such as weston or mutter-wayland) unmodified on cards that don't
have any client side HW acceleration component but that can do
modeset (examples include simpledrm and qxl)
---
 src/egl/drivers/dri2/platform_drm.c | 186 
 src/gbm/backends/dri/gbm_dri.c  | 210 +---
 src/gbm/backends/dri/gbm_driint.h   |  19 +++-
 src/gbm/main/gbm.h  |   3 +
 src/loader/loader.c |   6 ++
 5 files changed, 363 insertions(+), 61 deletions(-)

diff --git a/src/egl/drivers/dri2/platform_drm.c 
b/src/egl/drivers/dri2/platform_drm.c
index 9a7633a..17b93db 100644
--- a/src/egl/drivers/dri2/platform_drm.c
+++ b/src/egl/drivers/dri2/platform_drm.c
@@ -32,6 +32,7 @@
 #include 
 #include 
 #include 
+#include 
 #include 
 #include 
 
@@ -44,6 +45,7 @@ lock_front_buffer(struct gbm_surface *_surf)
 {
struct gbm_dri_surface *surf = (struct gbm_dri_surface *) _surf;
struct dri2_egl_surface *dri2_surf = surf->dri_private;
+   struct gbm_dri_device *device = (struct gbm_dri_device *) _surf->gbm;
struct gbm_bo *bo;
 
if (dri2_surf->current == NULL) {
@@ -52,8 +54,11 @@ lock_front_buffer(struct gbm_surface *_surf)
}
 
bo = dri2_surf->current->bo;
-   dri2_surf->current->locked = 1;
-   dri2_surf->current = NULL;
+
+   if (device->dri2) {
+  dri2_surf->current->locked = 1;
+  dri2_surf->current = NULL;
+   }
 
return bo;
 }
@@ -122,10 +127,18 @@ dri2_drm_create_surface(_EGLDriver *drv, _EGLDisplay 
*disp, EGLint type,
   goto cleanup_surf;
}
 
-   dri2_surf->dri_drawable =
-  (*dri2_dpy->dri2->createNewDrawable) (dri2_dpy->dri_screen,
-   dri2_conf->dri_double_config,
-   dri2_surf->gbm_surf);
+   if (dri2_dpy->dri2) {
+  dri2_surf->dri_drawable =
+ (*dri2_dpy->dri2->createNewDrawable) (dri2_dpy->dri_screen,
+   dri2_conf->dri_double_config,
+   dri2_surf->gbm_surf);
+   } else {
+  assert (dri2_dpy->swrast != NULL);
+  dri2_surf->dri_drawable =
+ (*dri2_dpy->swrast->createNewDrawable) (dri2_dpy->dri_screen,
+ dri2_conf->dri_double_config,
+ dri2_surf->gbm_surf);
+   }
 
if (dri2_surf->dri_drawable == NULL) {
   _eglError(EGL_BAD_ALLOC, "dri2->createNewDrawable");
@@ -221,6 +234,28 @@ get_back_bo(struct dri2_egl_surface *dri2_surf)
return 0;
 }
 
+static int
+get_swrast_front_bo(struct dri2_egl_surface *dri2_surf)
+{
+   struct dri2_egl_display *dri2_dpy =
+  dri2_egl_display(dri2_surf->base.Resource.Display);
+   struct gbm_dri_surface *surf = dri2_surf->gbm_surf;
+
+   if (dri2_surf->current == NULL) {
+  assert (!dri2_surf->color_buffers[0].locked);
+  dri2_surf->current = &dri2_surf->color_buffers[0];
+   }
+
+   if (dri2_surf->current->bo == NULL)
+  dri2_surf->current->bo = gbm_bo_create(&dri2_dpy->gbm_dri->base.base,
+ surf->base.width, 
surf->base.height,
+ surf->base.format, 
surf->base.flags);
+   if (dri2_surf->current->bo == NULL)
+  return -1;
+
+   return 0;
+}
+
 static void
 back_bo_to_dri_buffer(struct dri2_egl_surface *dri2_surf, __DRIbuffer *buffer)
 {
@@ -374,19 +409,23 @@ dri2_drm_swap_buffers(_EGLDriver *drv, _EGLDisplay *disp, 
_EGLSurface *draw)
struct dri2_egl_surface *dri2_surf = dri2_egl_surface(draw);
int i;
 
-   if (dri2_surf->base.Type == EGL_WINDOW_BIT) {
-  if (dri2_surf->current)
-_eglError(EGL_BAD_SURFACE, "dri2_swap_buffers");
-  for (i = 0; i < ARRAY_SIZE(dri2_surf->color_buffers); i++)
- if (dri2_surf->color_buffers[i].age > 0)
-dri2_surf->color_buffers[i].age++;
-  dri2_surf->current = dri2_surf->back;
-  dri2_surf->current->age = 1;
-  dri2_surf->back = NULL;
-   }
+   if (dri2_dpy->swrast) {
+  (*dri2_dpy->core->swapBuffers)(dri2_surf->dri_drawable);
+   } else {
+  if (dri2_surf->base.Type == EGL_WINDOW_BIT) {
+ if (dri2_surf->current)
+_eglError(EGL_BAD_SURFACE, "dri2_swap_buffers");
+ for (i = 0; i < ARRAY_SIZE(dri2_surf->color_buffers); i++)
+if (dri2_surf->color_buffers[i].age > 0)
+   dri2_surf->color_buffers[i].age++;
+ dri2_surf->current = dri2_surf->back;
+ dri2_surf->current->age = 1;
+ dri2_surf->back = NULL;
+  }
 
-   (*dri2_dpy->flush->flush)(dri2_surf->dri_drawable);
-   (*dri2_dpy->flush->invalidate)(dri2_surf->dri_drawable);
+  (*dri2_dpy->flush->flush)(dri2_surf->dri_drawable);
+  (*dri2_dpy->flush->invalidate)(dri2_surf->dri_drawab

Re: [Mesa-dev] Compiling Mesa/softpipe for Windows

2014-05-05 Thread Brian Paul

On 05/04/2014 01:26 PM, André Lochotzke wrote:

Hello,

I’m trying to get OpenGL 3.3 working on Windows via the softpipe driver. Can 
somebody tell me the steps to successfully (cross) compile it with either MinGW 
or Visual Studio. I seem to always run into problems.


The softpipe driver only supports OpenGL 3.0 right now.

scons should build fine on Windows.  For the flex/bison utilities see
ftp://ftp.freedesktop.org/pub/mesa/windows-libs/

If you run into problems you can file a bug or post the relevant output 
here.


-Brian

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


[Mesa-dev] Mesa 10.1.2

2014-05-05 Thread Carl Worth
Mesa 10.1.2 has been released. Mesa 10.1.2 is a bug fix release which
fixes bugs fixed since the 10.1.1 release, (see below for a list of
changes).

The tag in the git repository for Mesa 10.1.2 is 'mesa-10.1.2'.

Mesa 10.1.2 is available for download at
ftp://freedesktop.org/pub/mesa/10.1.2/

md5sums:
37d79f94b1f41852a89d1fc3900bea76  MesaLib-10.1.2.tar.gz
28b60d15ac9f364da1e0155911eaf44e  MesaLib-10.1.2.tar.bz2
05300039085a65fc53c5472c4bb5747a  MesaLib-10.1.2.zip

I have verified building from the .tar.bz2 file by doing:

tar xjf MesaLib-10.1.2.tar.bz2
cd Mesa-10.1.2
./configure --enable-gallium-llvm
make -j6
make install

I have also verified that I pushed the tag.

-Carl

-- 
carl.d.wo...@intel.com

Changes from 10.1.1 to 10.1.2

Ander Conselvan de Oliveira (2):
  gbm/dri: Fix out-of-memory error path in dri_device_create()
  egl: Protect use of gbm_dri with ifdef HAVE_DRM_PLATFORM

Anuj Phogat (27):
  mesa: Fix glGetVertexAttribi(GL_VERTEX_ATTRIB_ARRAY_SIZE)
  swrast: Add glBlitFramebuffer to commands affected by conditional 
rendering
  mesa: Fix error condition for multisample proxy texture targets
  i965: Put an assertion to check valid varying_to_slot[varying]
  i965: Fix component mask and varying_to_slot mapping for gl_Layer
  i965: Fix component mask and varying_to_slot mapping for gl_ViewportIndex
  mesa: Add helper function _mesa_is_format_integer()
  mesa: Add error condition for integer formats in glGetTexImage()
  mesa: Add an error condition in glGetFramebufferAttachmentParameteriv()
  mesa: Fix error code generation in glReadPixels()
  glsl: Allow overlapping locations for vertex input attributes
  mesa: Fix querying location of nth element of an array variable
  mesa: Use location VERT_ATTRIB_GENERIC0 for vertex attribute 0
  glsl: Compile error if fs defines conflicting qualifiers for gl_FragCoord
  glsl: Compile error if fs uses gl_FragCoord before first redeclaration
  mesa: Add entry for extension ARB_texture_stencil8
  mesa: Add error condition for format=STENCIL_INDEX in glGetTexImage()
  i965: Fix crash in do_blit_readpixels()
  mesa: Add missing types in _mesa_texstore_xx_xx() functions
  mesa: Allow srcFormat=GL_DEPTH_STENCIL in _mesa_texstore_xx_xx() functions
  mesa: Add new helper function _mesa_unpack_depth_stencil_row()
  mesa: Add support to unpack depth-stencil texture in to 
FLOAT_32_UNSIGNED_INT_24_8_REV
  mesa: Allow FLOAT_32_UNSIGNED_INT_24_8_REV in get_tex_depth_stencil()
  i965: Add glBlitFramebuffer to commands affected by conditional rendering
  glsl: Use switch to allow adding more shader types
  glsl: Link error if fs defines conflicting qualifiers for gl_FragCoord
  glsl: Apply the link error conditions to GL_ARB_fragment_coord_conventions

Benjamin Bellec (1):
  mesa: fix GetStringi error message with correct function name

Brian Paul (1):
  swrast: allocate swrast_texture_image::ImageSlices array if needed

Carl Worth (5):
  docs: Add the MD5 sums for the 10.1.1 release tar files.
  cherry-ignore: Ignore a patch causing a regression
  cherry-ignore: Drop an ignored patch now that piglit has been updated.
  Update VERSION to 10.1.2
  docs: Add notes for the 10.1.2 release.

Chris Forbes (1):
  glsl: Only allow `invariant` on shader in/out between stages.

Eric Anholt (1):
  i965: Fix render-to-texture in non-FinishRenderTexture cases.

Ian Romanick (1):
  dri3: Enable GLX_MESA_query_renderer on DRI3 too

Kenneth Graunke (2):
  i965: Don't enable reset notification support on Gen4-5.
  i965: Actually emit PIPELINE_SELECT and 3DSTATE_VF_STATISTICS.

Marek Olšák (10):
  r300g: don't crash when getting NULL colorbuffers
  st/mesa: remove trailing NULL colorbuffers
  r600g: fix edge flags and layered rendering on R600-R700
  r600g: disable async DMA on R700
  r600g: fix MSAA resolve on R6xx when the destination is 1D-tiled
  r600g: fix flushing on RV670, RS780, RS880 again
  r600g: fix buffer copying on R600-R700
  r600g: fix for broken CULL_FRONT behavior on R6xx
  r600g: fix for an MSAA hang on RV770
  r600g: fix hang on RV740 by using DX_RASTERIZATION_KILL instead of SX_MISC

Michel Dänzer (2):
  r600g: Disable LLVM by default at runtime for graphics
  st/mesa: Fix NULL pointer dereference for incomplete framebuffers

Neil Roberts (1):
  wayland: Fix the logic in disabling the prime capability

Samuel Iglesias Gonsalvez (1):
  mesa: fix check for dummy renderbuffer in 
_mesa_FramebufferRenderbufferEXT()

Thomas Hellstrom (1):
  st/xa: Cache render target surface

nick (1):
  swrast: Fix vertex color in _swsetup_Translate()


pgpNVQK1Z7pqH.pgp
Description: PGP signature
___
mesa-dev mailing list
mesa-dev@lists.freedesktop.org
http://lists.freedesktop.org/mailman/listinfo/mesa-dev


Re: [Mesa-dev] Mesa 10.2 release candidate 1

2014-05-05 Thread Emil Velikov
On 03/05/14 05:48, Ian Romanick wrote:
> Mesa 10.2 release candidate 1 is now available for testing.  The current
> plan of record is to have an additional release candidate each Friday
> until the 10.2 release on Friday, May 28th.
> 
> The tag in the GIT repository for Mesa 10.2-rc1 is 'mesa-10.2-rc1'.
> 
> After Eric's suggestion, I have also pushed a tag '10.2-branchpoint' the
> mark the point where master and 10.2 diverge.  This should make
> git-describe a bit more useful.
> 
> Mesa 10.2 release candidate 1 is available for download at
> ftp://freedesktop.org/pub/mesa/10.2/
> 
> md5sums:
> 
> d4653afa83e584291bf00687913163b0  MesaLib-10.2.0-rc1.tar.gz
> 7b34588043453e86628037566c4785e3  MesaLib-10.2.0-rc1.tar.bz2
> 70d8f39a48a4d8b10d05f9691f5cbfba  MesaLib-10.2.0-rc1.zip
> 
> I have verified building from the .tar.bz2 file by doing the following
> on my aging Fedora 18 system:
> 
> tar -xjf Mesa-10.2.0-rc1.tar.bz2
> cd Mesa-10.2.0-rc1
> ./configure --enable-gallium-llvm --with-llvm-shared-libs
> make -j6
> make install
> 
Hi Ian,

With 10.2 the option "llvm-shared-libs" is enabled by default now, and has
been changed from --with to --enable. Just letting you know in case you've
been wondering about the warning thrown by the above config.

I'll send a patch in a second that adds a note about it + the libxatracker
split (before the vmwgfx was statically linked in, whereas now the library
loads(dlopen) the shared pipe-driver) to the release notes.

-Emil

> 
> 
> ___
> 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] [Mesa-announce] Mesa 10.2 release candidate 1

2014-05-05 Thread Carl Worth
Ian Romanick  writes:
> Mesa 10.2 release candidate 1 is now available for testing.  The current
> plan of record is to have an additional release candidate each Friday
> until the 10.2 release on Friday, May 28th.

With the 10.2 branch open now, I'd like to remind everyone that
nominations for the stable branch with:

CC: 

will now be interpreted as for the 10.2 branch only. To nominate patches
for the 10.1 branch as well, please use:

CC: "10.1 10.2" 

With 10.1.2 released today, I anticipate making two more releases in the
10.1 series. My plan is for the final 10.1.x release to be 10.1.4
released concurrently with 10.2.

-Carl

PS. Ian, you're not planning on waiting until 2021 for the next Friday,
May 28, right? :-)

-- 
carl.d.wo...@intel.com


pgppVrXhZzcYh.pgp
Description: PGP signature
___
mesa-dev mailing list
mesa-dev@lists.freedesktop.org
http://lists.freedesktop.org/mailman/listinfo/mesa-dev


Re: [Mesa-dev] [PATCH] mesa: Don't use derived vertex state in api_arrayelt.c

2014-05-05 Thread Fredrik Höglund
On Friday 28 February 2014, Fredrik Höglund wrote:
> Cc: "10.1" 
> ---
>  src/mesa/main/api_arrayelt.c | 111 
> ++-
>  1 file changed, 57 insertions(+), 54 deletions(-)
> 
> It's possible that this patch fixes a segfault in FlightGear (see bug 73504),
> so I think it's a candidate for the 10.1 branch, but maybe not for 10.1.0.

Ping?

Fredrik

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


[Mesa-dev] [PATCH 1/2] configure: error out of building GBM without dri

2014-05-05 Thread Emil Velikov
Both backends require --enable-dri, and building an empty libgbm
makes little to no sense. Error out at configure to prevent the
user from shooting themselves in the foot.

Bugzilla: https://bugs.freedesktop.org/show_bug.cgi?id=78225
Cc: "10.1 10.2" 
Signed-off-by: Emil Velikov 
---

Strictly speaking, not crucial for mesa-stable, although it
will be nice to have. I do not feel too strong either way.

-Emil

 configure.ac | 7 +++
 1 file changed, 7 insertions(+)

diff --git a/configure.ac b/configure.ac
index e77ed77..371c17f 100644
--- a/configure.ac
+++ b/configure.ac
@@ -1179,6 +1179,13 @@ if test "x$enable_gbm" = xyes; then
 if test "x$enable_shared_glapi" = xno; then
 AC_MSG_ERROR([gbm_dri requires --enable-shared-glapi])
 fi
+else
+# Strictly speaking libgbm does not require --enable-dri, although
+# both of its backends do. Thus one can build libgbm without any
+# backends if --disable-dri is set.
+# To avoid unnecessary complexity of checking if at least one backend
+# is available when building, just mandate --enable-dri.
+AC_MSG_ERROR([gbm requires --enable-dri])
 fi
 fi
 AM_CONDITIONAL(HAVE_GBM, test "x$enable_gbm" = xyes)
-- 
1.9.2

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


[Mesa-dev] [PATCH 2/2] docs: Add a note about llvm-shared-libs and libxatracker

2014-05-05 Thread Emil Velikov
Both changes landed in 10.2, and for people not following the
development cycle these will come as a surprise. Note that the
pipe_* interface is not stable.

Cc: "10.2" 
Signed-off-by: Emil Velikov 
---

Can someone check if the wording makes sense ? It's perfectly
clear here, although it would be great if other people understand
it as well :)

-Emil

 docs/relnotes/10.2.html | 19 +++
 1 file changed, 19 insertions(+)

diff --git a/docs/relnotes/10.2.html b/docs/relnotes/10.2.html
index 9bbaf88..aea5ffc 100644
--- a/docs/relnotes/10.2.html
+++ b/docs/relnotes/10.2.html
@@ -67,6 +67,25 @@ TBD.
 Changes
 
 
+Renamed --with-llvm-shared-libs to 
--enable-llvm-shared-libs
+
+The option is used to control how mesa is linked against LLVM, and now
+defaults to enabled (shared linking).
+
+
+Split libxatracker.so into a standalone library which can be used
+with any gallium driver.
+
+Previously the library was linked statically against vmware's virtual gpu
+driver(svga), whereas now it loads a shared pipe_*.so driver. Provide the
+following during configure options, if you would like support for svga driver
+--enable-xa --with-gallium-drivers=svga
+
+
+
+Note: The files are installed in $(libdir)/gallium-pipe/ and the interface
+between them and libxatracker.so is not stable.
+
 
 
 
-- 
1.9.2

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


Re: [Mesa-dev] [PATCH 00/21] deferred and threaded glCompileShader

2014-05-05 Thread Fredrik Höglund
On Tuesday 22 April 2014, Chia-I Wu wrote:
> Hi list,
> 
> This series adds a thread pool to the GLSL compiler, and a drirc option to
> defer glCompileShader calls to the pool.  The goal is to reduce the start-up
> time of applications that are aware of this feature.  That is, applications
> that compile shaders first and check the compile status later.
> 
> I do not have numbers from real applications yet.  But trying to compiling a
> set of 2882 shaders extracted from some trace file, with everything else
> idled, the time it takes is
> 
>   8 threads: 17.8s
>   4 threads: 20.3s
>   2 threads: 31.2s
>   1 threads: 58.0s
>   no thread pool: 54.5
> 
> on a quad core system.
> 
> Patches 1-4 fix potential races in the GLSL compiler.  As the compiler is
> already shared by all contexts, these patches could be desirable even without
> the thread pool that I am going to add.
> 
> Patches 5-18 adds true GL_DEBUG_OUTPUT_SYNCHRONOUS support to the KHR_debug
> code.  All except patch 18 are clean-ups.  Patch 18 adds a mutex to protect
> gl_debug_state.
> 
> Patch 19 defines a simple API to create and work with thread pools, as well as
> a test for the API.
> 
> Patch 20 adds the singleton GLSL thread pool and allows glCompileShader to be
> deferred to the pool.  This feature needs to be explicitly enabled with
> _mesa_enable_glsl_threadpool.
> 
> Patch 21 adds a drirc option to enable the thread pool.  The idea is that only
> applications that can benefit from it will enable it.

If applications are supposed to enable this behavior themselves I think
it would be better to add an extension that lets them do:

glEnable(GL_DEFERRED_SHADER_COMPILATION_EXT);

The drirc option can still be useful for overriding the default though.

Fredrik

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


Re: [Mesa-dev] [PATCH] linker: Fix consumer_inputs_with_locations indexing

2014-05-05 Thread Kenneth Graunke
On 05/05/2014 10:56 AM, Ian Romanick wrote:
> From: Ian Romanick 
> 
> In an earlier incarnation of populate_consumer_input_sets and
> get_matching_input, the consumer_inputs_with_locations array was indexed
> using the user-specified location.  In that version, only user-defined
> varyings were included in the array.
> 
> In the current incarnation, the Mesa location is used to index the
> array, and built-in varyings are included.
> 
> This change fixes the unit test to exepect gl_ClipDistance in the array,
> and it resizes the arrays to actually be big enough.  It's just dumb
> luck that the existing piglit tests use small enough locations to not
> stomp the stack. :(
> 
> Signed-off-by: Ian Romanick 
> Bugzilla: https://bugs.freedesktop.org/show_bug.cgi?id=78258
> Cc: "10.2" 
> Cc: Vinson Lee 
> ---
>  src/glsl/link_varyings.cpp   |  8 
>  src/glsl/tests/varyings_test.cpp | 11 +--
>  2 files changed, 9 insertions(+), 10 deletions(-)

Looks reasonable to me.  Presumably this is new code, so we don't need
to backport beyond 10.2.

Reviewed-by: Kenneth Graunke 



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


Re: [Mesa-dev] [PATCH 02/21] glsl: protect locale_t with a mutex

2014-05-05 Thread Kenneth Graunke
On 05/05/2014 10:01 AM, Ian Romanick wrote:
> On 05/04/2014 02:14 PM, Chia-I Wu wrote:
>> On Sat, May 3, 2014 at 1:52 AM, Ian Romanick  wrote:
>>> On 04/22/2014 01:58 AM, Chia-I Wu wrote:
 There may be two contexts compiling shaders at the same time.  locale_t 
 needs
 to be protected.
>>>
>>> Rather than calling glsl_initialize_strtod from other places in the
>>> compiler, it seems better to use call_once from the strtof and strtod
>>> functions.
>> How about having a static object to call newlocale()/freelocale() in
>> its constructor/destructor?  It will impose no overead on
>> glsl_strtod(), at the expense of little wasted memory when the
>> applications do not compile shaders.
> 
> The problem I see with that is we don't know what order constructors on
> global objects will occur.  Are we sure the contructor will be invoked
> before we need the locale now and in the future?

These functions are used during lexing to read floating point
literals...without breaking on locales where the decimal point is a comma.

All constructors have definitely been run by that point, and I can't
imagine we'll ever need to call locale-independent strtof/strtod from
other constructors.

--Ken



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


[Mesa-dev] [PATCH 5/5] meta: Only clear the requested color buffers.

2014-05-05 Thread Kenneth Graunke
This path is used to implement both glClear and glClearBuffer; the
latter is only supposed to clear particular buffers.  Core Mesa provides
us that information in the buffers bitmask; we must only clear buffers
mentioned there.

To accomplish this, we save/restore the color draw buffers state, and
use glDrawBuffers to restrict drawing to the relevant buffers.

Fixes Piglit's spec/!OpenGL 3.0/clearbuffer-mixed-formats and
spec/ARB_framebuffer_object/fbo-drawbuffers-none glClearBuffer tests
for drivers using meta clears (such as Broadwell).

Cc: "10.2" 
Bugzilla: https://bugs.freedesktop.org/show_bug.cgi?id=77852
Bugzilla: https://bugs.freedesktop.org/show_bug.cgi?id=77856
Signed-off-by: Kenneth Graunke 
---
 src/mesa/drivers/common/meta.c | 51 --
 1 file changed, 49 insertions(+), 2 deletions(-)

diff --git a/src/mesa/drivers/common/meta.c b/src/mesa/drivers/common/meta.c
index 7c84c33..b4c3056 100644
--- a/src/mesa/drivers/common/meta.c
+++ b/src/mesa/drivers/common/meta.c
@@ -1655,6 +1655,48 @@ meta_glsl_clear_cleanup(struct clear_state *clear)
 }
 
 /**
+ * Given a bitfield of BUFFER_BIT_x draw buffers, call glDrawBuffers to
+ * set GL to only draw to those buffers.
+ *
+ * Since the bitfield has no associated order, the assignment of draw buffer
+ * indices to color attachment indices is rather arbitrary.
+ */
+static void
+drawbuffers_from_bitfield(GLbitfield bits)
+{
+   GLenum enums[MAX_DRAW_BUFFERS];
+   int i = 0;
+   int n;
+
+   /* This function is only legal for color buffer bitfields. */
+   assert((bits & ~BUFFER_BITS_COLOR) == 0);
+
+   /* Make sure we don't overflow any arrays. */
+   assert(_mesa_bitcount(bits) <= MAX_DRAW_BUFFERS);
+
+   enums[0] = GL_NONE;
+
+   if (bits & BUFFER_BIT_FRONT_LEFT)
+  enums[i++] = GL_FRONT_LEFT;
+
+   if (bits & BUFFER_BIT_FRONT_RIGHT)
+  enums[i++] = GL_FRONT_RIGHT;
+
+   if (bits & BUFFER_BIT_BACK_LEFT)
+  enums[i++] = GL_BACK_LEFT;
+
+   if (bits & BUFFER_BIT_BACK_RIGHT)
+  enums[i++] = GL_BACK_RIGHT;
+
+   for (n = 0; n < MAX_COLOR_ATTACHMENTS; n++) {
+  if (bits & (1 << (BUFFER_COLOR0 + n)))
+ enums[i++] = GL_COLOR_ATTACHMENT0 + n;
+   }
+
+   _mesa_DrawBuffers(i, enums);
+}
+
+/**
  * Meta implementation of ctx->Driver.Clear() in terms of polygon rendering.
  */
 static void
@@ -1690,7 +1732,9 @@ meta_clear(struct gl_context *ctx, GLbitfield buffers, 
bool glsl)
   MESA_META_SELECT_FEEDBACK;
}
 
-   if (!(buffers & BUFFER_BITS_COLOR)) {
+   if (buffers & BUFFER_BITS_COLOR) {
+  metaSave |= MESA_META_DRAW_BUFFERS;
+   } else {
   /* We'll use colormask to disable color writes.  Otherwise,
* respect color mask
*/
@@ -1730,7 +1774,10 @@ meta_clear(struct gl_context *ctx, GLbitfield buffers, 
bool glsl)
 
/* GL_COLOR_BUFFER_BIT */
if (buffers & BUFFER_BITS_COLOR) {
-  /* leave colormask, glDrawBuffer state as-is */
+  /* Only draw to the buffers we were asked to clear. */
+  drawbuffers_from_bitfield(buffers & BUFFER_BITS_COLOR);
+
+  /* leave colormask state as-is */
 
   /* Clears never have the color clamped. */
   if (ctx->Extensions.ARB_color_buffer_float)
-- 
1.9.2

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


[Mesa-dev] [PATCH 1/5] i965: Always intel_prepare_render() after invalidating front buffers.

2014-05-05 Thread Kenneth Graunke
Fixes glean/texture_srgb, which hit recursive-flush prevention
assertions in vbo_exec_FlushVertices.

This probably hurts the performance of front buffer rendering, but
very few people in their right mind do front buffer rendering.

Fixes Glean's texture_srgb test.

Cc: "10.2" 
Signed-off-by: Kenneth Graunke 
---
 src/mesa/drivers/dri/i965/intel_buffers.c | 2 ++
 1 file changed, 2 insertions(+)

diff --git a/src/mesa/drivers/dri/i965/intel_buffers.c 
b/src/mesa/drivers/dri/i965/intel_buffers.c
index f151287..6ad67f1 100644
--- a/src/mesa/drivers/dri/i965/intel_buffers.c
+++ b/src/mesa/drivers/dri/i965/intel_buffers.c
@@ -65,6 +65,7 @@ intelDrawBuffer(struct gl_context * ctx, GLenum mode)
* (including the fake front) before we start rendering again.
*/
   dri2InvalidateDrawable(brw->driContext->driDrawablePriv);
+  intel_prepare_render(brw);
}
 }
 
@@ -80,6 +81,7 @@ intelReadBuffer(struct gl_context * ctx, GLenum mode)
* (including the fake front) before we start reading again.
*/
   dri2InvalidateDrawable(brw->driContext->driReadablePriv);
+  intel_prepare_render(brw);
}
 }
 
-- 
1.9.2

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


[Mesa-dev] [PATCH 3/5] meta: Add a new MESA_META_DRAW_BUFFERS bit.

2014-05-05 Thread Kenneth Graunke
This will be used for saving/restoring the glDrawBuffers state.
For now, make sure that existing users of MESA_META_ALL don't get
the new bit, since they probably won't want it.

Cc: "10.2" 
Signed-off-by: Kenneth Graunke 
---
 src/mesa/drivers/common/meta.c | 5 +++--
 src/mesa/drivers/common/meta.h | 1 +
 src/mesa/drivers/common/meta_blit.c| 2 +-
 src/mesa/drivers/common/meta_generate_mipmap.c | 2 +-
 4 files changed, 6 insertions(+), 4 deletions(-)

This is a candidate for 10.2 because a bug fix later in the series depends
on it.

diff --git a/src/mesa/drivers/common/meta.c b/src/mesa/drivers/common/meta.c
index 7b700c2..36150a5 100644
--- a/src/mesa/drivers/common/meta.c
+++ b/src/mesa/drivers/common/meta.c
@@ -2723,7 +2723,7 @@ copytexsubimage_using_blit_framebuffer(struct gl_context 
*ctx, GLuint dims,
 
_mesa_unlock_texture(ctx, texObj);
 
-   _mesa_meta_begin(ctx, MESA_META_ALL);
+   _mesa_meta_begin(ctx, MESA_META_ALL & ~MESA_META_DRAW_BUFFERS);
 
_mesa_GenFramebuffers(1, &fbo);
_mesa_BindFramebuffer(GL_DRAW_FRAMEBUFFER, fbo);
@@ -2945,7 +2945,8 @@ decompress_texture_image(struct gl_context *ctx,
   break;
}
 
-   _mesa_meta_begin(ctx, MESA_META_ALL & ~MESA_META_PIXEL_STORE);
+   _mesa_meta_begin(ctx, MESA_META_ALL & ~(MESA_META_PIXEL_STORE |
+   MESA_META_DRAW_BUFFERS));
 
samplerSave = ctx->Texture.Unit[ctx->Texture.CurrentUnit].Sampler ?
  ctx->Texture.Unit[ctx->Texture.CurrentUnit].Sampler->Name : 0;
diff --git a/src/mesa/drivers/common/meta.h b/src/mesa/drivers/common/meta.h
index 0a34792..99f1123 100644
--- a/src/mesa/drivers/common/meta.h
+++ b/src/mesa/drivers/common/meta.h
@@ -58,6 +58,7 @@
 #define MESA_META_MULTISAMPLE  0x10
 #define MESA_META_FRAMEBUFFER_SRGB 0x20
 #define MESA_META_OCCLUSION_QUERY  0x40
+#define MESA_META_DRAW_BUFFERS 0x80
 /**\}*/
 
 /**
diff --git a/src/mesa/drivers/common/meta_blit.c 
b/src/mesa/drivers/common/meta_blit.c
index 5d72dd2..c3dc146 100644
--- a/src/mesa/drivers/common/meta_blit.c
+++ b/src/mesa/drivers/common/meta_blit.c
@@ -659,7 +659,7 @@ _mesa_meta_BlitFramebuffer(struct gl_context *ctx,
/* Only scissor affects blit, but we're doing to set a custom scissor if
 * necessary anyway, so save/clear state.
 */
-   _mesa_meta_begin(ctx, MESA_META_ALL);
+   _mesa_meta_begin(ctx, MESA_META_ALL & ~MESA_META_DRAW_BUFFERS);
 
/* If the clipping earlier changed the destination rect at all, then
 * enable the scissor to clip to it.
diff --git a/src/mesa/drivers/common/meta_generate_mipmap.c 
b/src/mesa/drivers/common/meta_generate_mipmap.c
index 3c9ac89..d12806c 100644
--- a/src/mesa/drivers/common/meta_generate_mipmap.c
+++ b/src/mesa/drivers/common/meta_generate_mipmap.c
@@ -182,7 +182,7 @@ _mesa_meta_GenerateMipmap(struct gl_context *ctx, GLenum 
target,
   faceTarget = target;
}
 
-   _mesa_meta_begin(ctx, MESA_META_ALL);
+   _mesa_meta_begin(ctx, MESA_META_ALL & ~MESA_META_DRAW_BUFFERS);
 
/* Choose between glsl version and fixed function version of
 * GenerateMipmap function.
-- 
1.9.2

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


[Mesa-dev] [PATCH 4/5] meta: Add infrastructure for saving/restoring the DrawBuffers state.

2014-05-05 Thread Kenneth Graunke
Sometimes we need to configure what draw buffers we render to, without
creating a new FBO.  This path will make that possible.

Cc: "10.2" 
Signed-off-by: Kenneth Graunke 
---
 src/mesa/drivers/common/meta.c | 39 +++
 src/mesa/drivers/common/meta.h |  3 +++
 2 files changed, 42 insertions(+)

This is a candidate for 10.2 because a bug fix later in the series depends
on it.

diff --git a/src/mesa/drivers/common/meta.c b/src/mesa/drivers/common/meta.c
index 36150a5..7c84c33 100644
--- a/src/mesa/drivers/common/meta.c
+++ b/src/mesa/drivers/common/meta.c
@@ -392,6 +392,24 @@ _mesa_meta_init(struct gl_context *ctx)
ctx->Meta = CALLOC_STRUCT(gl_meta_state);
 }
 
+static GLenum
+gl_buffer_index_to_drawbuffers_enum(gl_buffer_index bufindex)
+{
+   assert(bufindex < BUFFER_COUNT);
+
+   if (bufindex >= BUFFER_COLOR0)
+  return GL_COLOR_ATTACHMENT0 + bufindex - BUFFER_COLOR0;
+   else if (bufindex == BUFFER_FRONT_LEFT)
+  return GL_FRONT_LEFT;
+   else if (bufindex == BUFFER_FRONT_RIGHT)
+  return GL_FRONT_RIGHT;
+   else if (bufindex == BUFFER_BACK_LEFT)
+  return GL_BACK_LEFT;
+   else if (bufindex == BUFFER_BACK_RIGHT)
+  return GL_BACK_RIGHT;
+
+   return GL_NONE;
+}
 
 /**
  * Free context meta-op state.
@@ -778,6 +796,23 @@ _mesa_meta_begin(struct gl_context *ctx, GLbitfield state)
  _mesa_set_framebuffer_srgb(ctx, GL_FALSE);
}
 
+   if (state & MESA_META_DRAW_BUFFERS) {
+  int buf, real_color_buffers = 0;
+  memset(save->ColorDrawBuffers, 0, sizeof(save->ColorDrawBuffers));
+
+  for (buf = 0; buf < MAX_DRAW_BUFFERS; buf++) {
+ int buf_index = ctx->DrawBuffer->_ColorDrawBufferIndexes[buf];
+ if (buf_index == -1)
+continue;
+
+ save->ColorDrawBuffers[buf] =
+gl_buffer_index_to_drawbuffers_enum(buf_index);
+
+ if (++real_color_buffers >= ctx->DrawBuffer->_NumColorDrawBuffers)
+break;
+  }
+   }
+
/* misc */
{
   save->Lighting = ctx->Light.Enabled;
@@ -1176,6 +1211,10 @@ _mesa_meta_end(struct gl_context *ctx)
ctx->CurrentRenderbuffer->Name != save->RenderbufferName)
   _mesa_BindRenderbuffer(GL_RENDERBUFFER, save->RenderbufferName);
 
+   if (state & MESA_META_DRAW_BUFFERS) {
+  _mesa_DrawBuffers(MAX_DRAW_BUFFERS, save->ColorDrawBuffers);
+   }
+
ctx->Meta->SaveStackDepth--;
 
ctx->API = save->API;
diff --git a/src/mesa/drivers/common/meta.h b/src/mesa/drivers/common/meta.h
index 99f1123..32b71fa 100644
--- a/src/mesa/drivers/common/meta.h
+++ b/src/mesa/drivers/common/meta.h
@@ -181,6 +181,9 @@ struct save_state
GLboolean TransformFeedbackNeedsResume;
 
GLuint DrawBufferName, ReadBufferName, RenderbufferName;
+
+   /** MESA_META_DRAW_BUFFERS */
+   GLenum ColorDrawBuffers[MAX_DRAW_BUFFERS];
 };
 
 /**
-- 
1.9.2

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


[Mesa-dev] [PATCH 2/5] meta: Unify the GLSL and fixed-function clear paths.

2014-05-05 Thread Kenneth Graunke
The majority of _mesa_meta_Clear and _mesa_meta_glsl_Clear was the same;
adding a boolean for whether to use GLSL allows us to share most of it
without polluting either path too much.

Tested for regressions by hacking i965 to always use the non-GLSL path.

Cc: "10.2" 
Signed-off-by: Kenneth Graunke 
---
 src/mesa/drivers/common/meta.c | 153 ++---
 1 file changed, 51 insertions(+), 102 deletions(-)

This is a candidate for 10.2 because a bug fix later in the series depends
on it.

diff --git a/src/mesa/drivers/common/meta.c b/src/mesa/drivers/common/meta.c
index d3ff87a..7b700c2 100644
--- a/src/mesa/drivers/common/meta.c
+++ b/src/mesa/drivers/common/meta.c
@@ -86,6 +86,9 @@
 /** Return offset in bytes of the field within a vertex struct */
 #define OFFSET(FIELD) ((void *) offsetof(struct vertex, FIELD))
 
+static void
+meta_clear(struct gl_context *ctx, GLbitfield buffers, bool glsl);
+
 static struct blit_shader *
 choose_blit_shader(GLenum target, struct blit_shader_table *table);
 
@@ -1459,100 +1462,13 @@ _mesa_meta_setup_ff_tnl_for_blit(GLuint *VAO, GLuint 
*VBO,
 void
 _mesa_meta_Clear(struct gl_context *ctx, GLbitfield buffers)
 {
-   struct clear_state *clear = &ctx->Meta->Clear;
-   struct vertex verts[4];
-   /* save all state but scissor, pixel pack/unpack */
-   GLbitfield metaSave = (MESA_META_ALL -
- MESA_META_SCISSOR -
- MESA_META_PIXEL_STORE -
- MESA_META_CONDITIONAL_RENDER -
-  MESA_META_FRAMEBUFFER_SRGB);
-   const GLuint stencilMax = (1 << ctx->DrawBuffer->Visual.stencilBits) - 1;
-
-   if (buffers & BUFFER_BITS_COLOR) {
-  /* if clearing color buffers, don't save/restore colormask */
-  metaSave -= MESA_META_COLOR_MASK;
-   }
-
-   _mesa_meta_begin(ctx, metaSave);
-
-   _mesa_meta_setup_vertex_objects(&clear->VAO, &clear->VBO, false, 3, 0, 4);
-
-   /* GL_COLOR_BUFFER_BIT */
-   if (buffers & BUFFER_BITS_COLOR) {
-  /* leave colormask, glDrawBuffer state as-is */
-
-  /* Clears never have the color clamped. */
-  if (ctx->Extensions.ARB_color_buffer_float)
- _mesa_ClampColor(GL_CLAMP_FRAGMENT_COLOR, GL_FALSE);
-   }
-   else {
-  ASSERT(metaSave & MESA_META_COLOR_MASK);
-  _mesa_ColorMask(GL_FALSE, GL_FALSE, GL_FALSE, GL_FALSE);
-   }
-
-   /* GL_DEPTH_BUFFER_BIT */
-   if (buffers & BUFFER_BIT_DEPTH) {
-  _mesa_set_enable(ctx, GL_DEPTH_TEST, GL_TRUE);
-  _mesa_DepthFunc(GL_ALWAYS);
-  _mesa_DepthMask(GL_TRUE);
-   }
-   else {
-  assert(!ctx->Depth.Test);
-   }
-
-   /* GL_STENCIL_BUFFER_BIT */
-   if (buffers & BUFFER_BIT_STENCIL) {
-  _mesa_set_enable(ctx, GL_STENCIL_TEST, GL_TRUE);
-  _mesa_StencilOpSeparate(GL_FRONT_AND_BACK,
-  GL_REPLACE, GL_REPLACE, GL_REPLACE);
-  _mesa_StencilFuncSeparate(GL_FRONT_AND_BACK, GL_ALWAYS,
-ctx->Stencil.Clear & stencilMax,
-ctx->Stencil.WriteMask[0]);
-   }
-   else {
-  assert(!ctx->Stencil.Enabled);
-   }
-
-   /* vertex positions/colors */
-   {
-  const GLfloat x0 = (GLfloat) ctx->DrawBuffer->_Xmin;
-  const GLfloat y0 = (GLfloat) ctx->DrawBuffer->_Ymin;
-  const GLfloat x1 = (GLfloat) ctx->DrawBuffer->_Xmax;
-  const GLfloat y1 = (GLfloat) ctx->DrawBuffer->_Ymax;
-  const GLfloat z = invert_z(ctx->Depth.Clear);
-  GLuint i;
-
-  verts[0].x = x0;
-  verts[0].y = y0;
-  verts[0].z = z;
-  verts[1].x = x1;
-  verts[1].y = y0;
-  verts[1].z = z;
-  verts[2].x = x1;
-  verts[2].y = y1;
-  verts[2].z = z;
-  verts[3].x = x0;
-  verts[3].y = y1;
-  verts[3].z = z;
-
-  /* vertex colors */
-  for (i = 0; i < 4; i++) {
- verts[i].r = ctx->Color.ClearColor.f[0];
- verts[i].g = ctx->Color.ClearColor.f[1];
- verts[i].b = ctx->Color.ClearColor.f[2];
- verts[i].a = ctx->Color.ClearColor.f[3];
-  }
-
-  /* upload new vertex data */
-  _mesa_BufferData(GL_ARRAY_BUFFER_ARB, sizeof(verts), verts,
- GL_DYNAMIC_DRAW_ARB);
-   }
-
-   /* draw quad */
-   _mesa_DrawArrays(GL_TRIANGLE_FAN, 0, 4);
+   meta_clear(ctx, buffers, false);
+}
 
-   _mesa_meta_end(ctx);
+void
+_mesa_meta_glsl_Clear(struct gl_context *ctx, GLbitfield buffers)
+{
+   meta_clear(ctx, buffers, true);
 }
 
 static void
@@ -1702,19 +1618,16 @@ meta_glsl_clear_cleanup(struct clear_state *clear)
 /**
  * Meta implementation of ctx->Driver.Clear() in terms of polygon rendering.
  */
-void
-_mesa_meta_glsl_Clear(struct gl_context *ctx, GLbitfield buffers)
+static void
+meta_clear(struct gl_context *ctx, GLbitfield buffers, bool glsl)
 {
struct clear_state *clear = &ctx->Meta->Clear;
GLbitfield metaSave;
const GLuint stencilMax = (1 << ctx->DrawBuffer->Visual.stencilBits) - 1;
struct gl_framebuffer *fb = ctx->DrawBuffer;
-   const float x0 = ((float)fb

[Mesa-dev] [Bug 78318] New: [swrast] piglit glsl-kwin-blur-1 regression

2014-05-05 Thread bugzilla-daemon
https://bugs.freedesktop.org/show_bug.cgi?id=78318

  Priority: medium
Bug ID: 78318
  Keywords: regression
CC: i...@freedesktop.org
  Assignee: mesa-dev@lists.freedesktop.org
   Summary: [swrast] piglit glsl-kwin-blur-1 regression
  Severity: normal
Classification: Unclassified
OS: Linux (All)
  Reporter: v...@freedesktop.org
  Hardware: x86-64 (AMD64)
Status: NEW
   Version: git
 Component: Other
   Product: Mesa

mesa: 6dd907c80d3f9f17e24c751e5723e279fd70891b (master 10.3.0-devel)

$ ./bin/glsl-kwin-blur-1 -auto
Probe color at (50,18)
  Expected: 0.00 0.00 0.00
  Observed: 1.00 1.00 1.00
Probe color at (50,81)
  Expected: 0.00 0.00 0.00
  Observed: 1.00 1.00 1.00
Probe color at (18,50)
  Expected: 0.00 0.00 0.00
  Observed: 1.00 1.00 1.00
Probe color at (81,50)
  Expected: 0.00 0.00 0.00
  Observed: 1.00 1.00 1.00
Probe color at (50,19)
  Expected: 0.011765 0.011765 0.011765
  Observed: 1.00 1.00 1.00
Probe color at (50,80)
  Expected: 0.011765 0.011765 0.011765
  Observed: 1.00 1.00 1.00
Probe color at (19,50)
  Expected: 0.011765 0.011765 0.011765
  Observed: 1.00 1.00 1.00
Probe color at (80,50)
  Expected: 0.011765 0.011765 0.011765
  Observed: 1.00 1.00 1.00
Probe color at (50,20)
  Expected: 0.023529 0.023529 0.023529
  Observed: 1.00 1.00 1.00
Probe color at (50,79)
  Expected: 0.023529 0.023529 0.023529
  Observed: 1.00 1.00 1.00
Probe color at (20,50)
  Expected: 0.023529 0.023529 0.023529
  Observed: 1.00 1.00 1.00
Probe color at (79,50)
  Expected: 0.023529 0.023529 0.023529
  Observed: 1.00 1.00 1.00
Probe color at (50,21)
  Expected: 0.082353 0.082353 0.082353
  Observed: 1.00 1.00 1.00
Probe color at (50,78)
  Expected: 0.082353 0.082353 0.082353
  Observed: 1.00 1.00 1.00
Probe color at (21,50)
  Expected: 0.082353 0.082353 0.082353
  Observed: 1.00 1.00 1.00
Probe color at (78,50)
  Expected: 0.082353 0.082353 0.082353
  Observed: 1.00 1.00 1.00
Probe color at (50,22)
  Expected: 0.141176 0.141176 0.141176
  Observed: 1.00 1.00 1.00
Probe color at (50,77)
  Expected: 0.141176 0.141176 0.141176
  Observed: 1.00 1.00 1.00
Probe color at (22,50)
  Expected: 0.141176 0.141176 0.141176
  Observed: 1.00 1.00 1.00
Probe color at (77,50)
  Expected: 0.141176 0.141176 0.141176
  Observed: 1.00 1.00 1.00
Probe color at (50,23)
  Expected: 0.278431 0.278431 0.278431
  Observed: 1.00 1.00 1.00
Probe color at (50,76)
  Expected: 0.278431 0.278431 0.278431
  Observed: 1.00 1.00 1.00
Probe color at (23,50)
  Expected: 0.278431 0.278431 0.278431
  Observed: 1.00 1.00 1.00
Probe color at (76,50)
  Expected: 0.278431 0.278431 0.278431
  Observed: 1.00 1.00 1.00
Probe color at (50,24)
  Expected: 0.415686 0.415686 0.415686
  Observed: 1.00 1.00 1.00
Probe color at (50,75)
  Expected: 0.415686 0.415686 0.415686
  Observed: 1.00 1.00 1.00
Probe color at (24,50)
  Expected: 0.415686 0.415686 0.415686
  Observed: 1.00 1.00 1.00
Probe color at (75,50)
  Expected: 0.415686 0.415686 0.415686
  Observed: 1.00 1.00 1.00
Probe color at (50,25)
  Expected: 0.584314 0.584314 0.584314
  Observed: 1.00 1.00 1.00
Probe color at (50,74)
  Expected: 0.584314 0.584314 0.584314
  Observed: 1.00 1.00 1.00
Probe color at (25,50)
  Expected: 0.584314 0.584314 0.584314
  Observed: 1.00 1.00 1.00
Probe color at (74,50)
  Expected: 0.584314 0.584314 0.584314
  Observed: 1.00 1.00 1.00
Probe color at (50,26)
  Expected: 0.721569 0.721569 0.721569
  Observed: 1.00 1.00 1.00
Probe color at (50,73)
  Expected: 0.721569 0.721569 0.721569
  Observed: 1.00 1.00 1.00
Probe color at (26,50)
  Expected: 0.721569 0.721569 0.721569
  Observed: 1.00 1.00 1.00
Probe color at (73,50)
  Expected: 0.721569 0.721569 0.721569
  Observed: 1.00 1.00 1.00
Probe color at (50,27)
  Expected: 0.858824 0.858824 0.858824
  Observed: 1.00 1.00 1.00
Probe color at (50,72)
  Expected: 0.858824 0.858824 0.858824
  Observed: 1.00 1.00 1.00
Probe color at (27,50)
  Expected: 0.858824 0.858824 0.858824
  Observed: 1.00 1.00 1.00
Probe color at (72,50)
  Expected: 0.858824 0.858824 0.858824
  Observed: 1.00 1.00 1.00
Probe color at (50,28)
  Expected: 0.917647 0.917647 0.917647
  Observed: 1.00 1.00 1.00
Probe color at (50,71)
  Expected: 0.917647 0.917647 0.917647
  Observed: 1.00 1.00 1.00
Probe color at (28,50)
  Expected: 0.917647 0.917647 0.917647
  Observed: 1.00 1.00 1.00

Re: [Mesa-dev] [PATCH] mesa: Don't use derived vertex state in api_arrayelt.c

2014-05-05 Thread Brian Paul
On Mon, May 5, 2014 at 2:49 PM, Fredrik Höglund  wrote:

> On Friday 28 February 2014, Fredrik Höglund wrote:
> > Cc: "10.1" 
> > ---
> >  src/mesa/main/api_arrayelt.c | 111
> ++-
> >  1 file changed, 57 insertions(+), 54 deletions(-)
> >
> > It's possible that this patch fixes a segfault in FlightGear (see bug
> 73504),
> > so I think it's a candidate for the 10.1 branch, but maybe not for
> 10.1.0.
>
> Ping?
>

I took a look.  I guess we don't have much (any?) test coverage of
glArrayElement().  The patch looks good AFAICT.

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 1/5] i965: Always intel_prepare_render() after invalidating front buffers.

2014-05-05 Thread Anuj Phogat
On Mon, May 5, 2014 at 3:50 PM, Kenneth Graunke  wrote:
> Fixes glean/texture_srgb, which hit recursive-flush prevention
> assertions in vbo_exec_FlushVertices.
>
> This probably hurts the performance of front buffer rendering, but
> very few people in their right mind do front buffer rendering.
>
> Fixes Glean's texture_srgb test.
>
> Cc: "10.2" 
> Signed-off-by: Kenneth Graunke 
> ---
>  src/mesa/drivers/dri/i965/intel_buffers.c | 2 ++
>  1 file changed, 2 insertions(+)
>
> diff --git a/src/mesa/drivers/dri/i965/intel_buffers.c 
> b/src/mesa/drivers/dri/i965/intel_buffers.c
> index f151287..6ad67f1 100644
> --- a/src/mesa/drivers/dri/i965/intel_buffers.c
> +++ b/src/mesa/drivers/dri/i965/intel_buffers.c
> @@ -65,6 +65,7 @@ intelDrawBuffer(struct gl_context * ctx, GLenum mode)
> * (including the fake front) before we start rendering again.
> */
>dri2InvalidateDrawable(brw->driContext->driDrawablePriv);
> +  intel_prepare_render(brw);
> }
>  }
>
> @@ -80,6 +81,7 @@ intelReadBuffer(struct gl_context * ctx, GLenum mode)
> * (including the fake front) before we start reading again.
> */
>dri2InvalidateDrawable(brw->driContext->driReadablePriv);
> +  intel_prepare_render(brw);
> }
>  }
>
Patch 1 is:
Acked-by: Anuj Phogat 
Paches 2-5 are:
Reviewed-by: Anuj Phogat 
> --
> 1.9.2
>
> ___
> mesa-dev mailing list
> mesa-dev@lists.freedesktop.org
> http://lists.freedesktop.org/mailman/listinfo/mesa-dev
___
mesa-dev mailing list
mesa-dev@lists.freedesktop.org
http://lists.freedesktop.org/mailman/listinfo/mesa-dev


[Mesa-dev] [PATCH] glsl_to_tgsi: remove unnecessary dead code elimination pass

2014-05-05 Thread Bryan Cain
With the more advanced dead code elimination pass already being run,
eliminate_dead_code was making no difference in instruction count, and had
an undesirable O(n^2) runtime. So remove it and rename
eliminate_dead_code_advanced to eliminate_dead_code.
---
 src/mesa/state_tracker/st_glsl_to_tgsi.cpp |   50 +++-
 1 file changed, 5 insertions(+), 45 deletions(-)

diff --git a/src/mesa/state_tracker/st_glsl_to_tgsi.cpp 
b/src/mesa/state_tracker/st_glsl_to_tgsi.cpp
index 6eb6c8a..b0e0782 100644
--- a/src/mesa/state_tracker/st_glsl_to_tgsi.cpp
+++ b/src/mesa/state_tracker/st_glsl_to_tgsi.cpp
@@ -460,8 +460,7 @@ public:
int get_last_temp_write(int index);
 
void copy_propagate(void);
-   void eliminate_dead_code(void);
-   int eliminate_dead_code_advanced(void);
+   int eliminate_dead_code(void);
void merge_registers(void);
void renumber_registers(void);
 
@@ -3663,7 +3662,8 @@ glsl_to_tgsi_visitor::copy_propagate(void)
 }
 
 /*
- * Tracks available PROGRAM_TEMPORARY registers for dead code elimination.
+ * On a basic block basis, tracks available PROGRAM_TEMPORARY registers for 
dead
+ * code elimination.
  *
  * The glsl_to_tgsi_visitor lazily produces code assuming that this pass
  * will occur.  As an example, a TXP production after copy propagation but 
@@ -3676,48 +3676,9 @@ glsl_to_tgsi_visitor::copy_propagate(void)
  * and after this pass:
  *
  * 0: TXP TEMP[2], INPUT[4].xyyw, texture[0], 2D;
- * 
- * FIXME: assumes that all functions are inlined (no support for BGNSUB/ENDSUB)
- * FIXME: doesn't eliminate all dead code inside of loops; it steps around them
- */
-void
-glsl_to_tgsi_visitor::eliminate_dead_code(void)
-{
-   int i;
-   
-   for (i=0; i < this->next_temp; i++) {
-  int last_read = get_last_temp_read(i);
-  int j = 0;
-  
-  foreach_list_safe(node, &this->instructions) {
- glsl_to_tgsi_instruction *inst = (glsl_to_tgsi_instruction *) node;
-
- if (inst->dst.file == PROGRAM_TEMPORARY && inst->dst.index == i &&
- j > last_read)
- {
-inst->remove();
-delete inst;
- }
- 
- j++;
-  }
-   }
-}
-
-/*
- * On a basic block basis, tracks available PROGRAM_TEMPORARY registers for 
dead
- * code elimination.  This is less primitive than eliminate_dead_code(), as it
- * is per-channel and can detect consecutive writes without a read between them
- * as dead code.  However, there is some dead code that can be eliminated by 
- * eliminate_dead_code() but not this function - for example, this function 
- * cannot eliminate an instruction writing to a register that is never read and
- * is the only instruction writing to that register.
- *
- * The glsl_to_tgsi_visitor lazily produces code assuming that this pass
- * will occur.
  */
 int
-glsl_to_tgsi_visitor::eliminate_dead_code_advanced(void)
+glsl_to_tgsi_visitor::eliminate_dead_code(void)
 {
glsl_to_tgsi_instruction **writes = rzalloc_array(mem_ctx,
  glsl_to_tgsi_instruction 
*,
@@ -5245,9 +5206,8 @@ get_mesa_program(struct gl_context *ctx,
/* Perform optimizations on the instructions in the glsl_to_tgsi_visitor. */
v->simplify_cmp();
v->copy_propagate();
-   while (v->eliminate_dead_code_advanced());
+   while (v->eliminate_dead_code());
 
-   v->eliminate_dead_code();
v->merge_registers();
v->renumber_registers();

-- 
1.7.9.5

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


[Mesa-dev] [PATCH 0/2] Varying packing support for arrays_of_arrays

2014-05-05 Thread Timothy Arceri
Patch 1 is untested as the i965 backend supports packing but it should be easy 
to review.
Patch 2 has been tested with an updated version [1] of the simple packing 
piglit test.

[1] http://lists.freedesktop.org/archives/piglit/2014-May/010639.html
___
mesa-dev mailing list
mesa-dev@lists.freedesktop.org
http://lists.freedesktop.org/mailman/listinfo/mesa-dev


[Mesa-dev] [PATCH 1/2] glsl: calculate component size for arrays of arrays when varying packing disabled

2014-05-05 Thread Timothy Arceri
Signed-off-by: Timothy Arceri 
---
 src/glsl/link_varyings.cpp | 15 ---
 1 file changed, 12 insertions(+), 3 deletions(-)

diff --git a/src/glsl/link_varyings.cpp b/src/glsl/link_varyings.cpp
index 45f1b10..5a18e40 100644
--- a/src/glsl/link_varyings.cpp
+++ b/src/glsl/link_varyings.cpp
@@ -833,9 +833,18 @@ varying_matches::record(ir_variable *producer_var, 
ir_variable *consumer_var)
this->matches[this->num_matches].packing_order
   = this->compute_packing_order(var);
if (this->disable_varying_packing) {
-  unsigned slots = var->type->is_array()
- ? (var->type->length * var->type->fields.array->matrix_columns)
- : var->type->matrix_columns;
+  unsigned slots;
+  if (var->type->is_array()) {
+ const glsl_type *type = var->type;
+ slots = 1;
+ while (type->is_array()) {
+slots *= type->length;
+type = type->fields.array;
+ }
+ slots *= type->matrix_columns;
+  } else {
+ slots = var->type->matrix_columns;
+  }
   this->matches[this->num_matches].num_components = 4 * slots;
} else {
   this->matches[this->num_matches].num_components
-- 
1.9.0

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


[Mesa-dev] [PATCH 2/2] glsl: support packing of arrays of arrays

2014-05-05 Thread Timothy Arceri
Signed-off-by: Timothy Arceri 
---
 src/glsl/lower_packed_varyings.cpp | 7 ++-
 1 file changed, 2 insertions(+), 5 deletions(-)

diff --git a/src/glsl/lower_packed_varyings.cpp 
b/src/glsl/lower_packed_varyings.cpp
index e865474..dd2e22e 100644
--- a/src/glsl/lower_packed_varyings.cpp
+++ b/src/glsl/lower_packed_varyings.cpp
@@ -591,12 +591,9 @@ lower_packed_varyings_visitor::needs_lowering(ir_variable 
*var)
   return false;
 
const glsl_type *type = var->type;
-   if (this->gs_input_vertices != 0) {
-  assert(type->is_array());
-  type = type->element_type();
-   }
-   if (type->is_array())
+   while (type->is_array()) {
   type = type->fields.array;
+   }
if (type->vector_elements == 4)
   return false;
return true;
-- 
1.9.0

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