Re: [Mesa-dev] [PATCH gles3] i965: Fix maximum supported OpenGL ES2 context version

2012-11-21 Thread Ian Romanick

On 11/20/2012 03:31 PM, Chad Versace wrote:

brwCreateContext unconditionally set the maximum supported OpenGL ES2
context version to 3.0. Instead, we need to predicate it on hardware
capabilities. Set it to 3.0 only if and only if OpenGL 3.0 is supported.

Signed-off-by: Chad Versace chad.vers...@linux.intel.com


I modified Ken's patch the same way earlier today.  For now this can 
only go on the gles3 branch... obviously. :)


Reviewed-by: Ian Romanick ian.d.roman...@intel.com


---
  src/mesa/drivers/dri/i965/brw_context.c | 2 +-
  1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/src/mesa/drivers/dri/i965/brw_context.c 
b/src/mesa/drivers/dri/i965/brw_context.c
index 976cb67..6b04290 100644
--- a/src/mesa/drivers/dri/i965/brw_context.c
+++ b/src/mesa/drivers/dri/i965/brw_context.c
@@ -111,7 +111,7 @@ brwCreateContext(int api,
max_supported_version = 11;
break;
 case API_OPENGLES2:
-  max_supported_version = 30;
+  max_supported_version = supports_gl30 ? 30 : 20;
break;
 case API_OPENGL_CORE:
max_supported_version = supports_gl30 ? 31 : 0;



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


Re: [Mesa-dev] [PATCH] i915: Fix wrong sizeof argument in i915_update_tex_unit.

2012-11-21 Thread Ian Romanick

On 11/20/2012 09:51 PM, Vinson Lee wrote:

The bug was found by Coverity.

Signed-off-by: Vinson Lee v...@freedesktop.org


Heh... since sizeof(state) and sizeof(*state) are the same on 32-bit 
platforms, this only could have cause problems for a small subset of 
users.  This is probably part of the reason it was never noticed. :) 
It's pretty shocking that this line of code has existed since the driver 
first landed in 2006!


Could you also mark this for inclusion in all stable branches?

Reviewed-by: Ian Romanick ian.d.roman...@intel.com


---
  src/mesa/drivers/dri/i915/i915_texstate.c | 2 +-
  1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/src/mesa/drivers/dri/i915/i915_texstate.c 
b/src/mesa/drivers/dri/i915/i915_texstate.c
index 4bd5e72..94a8e55 100644
--- a/src/mesa/drivers/dri/i915/i915_texstate.c
+++ b/src/mesa/drivers/dri/i915/i915_texstate.c
@@ -146,7 +146,7 @@ i915_update_tex_unit(struct intel_context *intel, GLuint 
unit, GLuint ss3)
 GLubyte border[4];
 GLfloat maxlod;

-   memset(state, 0, sizeof(state));
+   memset(state, 0, sizeof(*state));

 /*We need to refcount these. */




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


Re: [Mesa-dev] [PATCH] build: fix --without-glut

2012-11-21 Thread Ross Burton
On Tuesday, 20 November 2012 at 21:48, Brian Paul wrote:
 Personally, I trust Kilgard's GLUT more freeglut.
 
 Some versions of freeglut (hopefully fixed by now but I don't know)
 spend an inordinate amount of time in a InitSpaceBall() function,
 with a significant FPS hit.
 
 Another problem I've seen is the first window draw happens twice
 instead of once (even when not animating). I've seen GL bugs where
 the first frame drawn has a glitch but the second frame is fine. That
 kind of bug is hard to spot if you always draw twice.
 
 And FWIW, just because a project hasn't had recent commits doesn't
 mean it's bad software. It's really just _done_.

I'll admit to semi-trolling - if Mesa's GLUT is considered finished and not 
abandoned, then I'll happily switch to Mesa's GLUT over FreeGLUT for the simple 
reason that we're already using Mesa and Mesa's GLU.

Ross 


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


Re: [Mesa-dev] [PATCH] i915: Fix wrong sizeof argument in i915_update_tex_unit.

2012-11-21 Thread Matt Turner
On Wed, Nov 21, 2012 at 12:02 AM, Ian Romanick i...@freedesktop.org wrote:
 On 11/20/2012 09:51 PM, Vinson Lee wrote:

 The bug was found by Coverity.

 Signed-off-by: Vinson Lee v...@freedesktop.org


 Heh... since sizeof(state) and sizeof(*state) are the same on 32-bit
 platforms, this only could have cause problems for a small subset of users.
 This is probably part of the reason it was never noticed. :) It's pretty
 shocking that this line of code has existed since the driver first landed in
 2006!

And the bad part is that Chad noticed and fixed this in
/i830/_update_tex_unit (735070c45b403a9631415b09e9fd519f601f0229) back
in July but not this one. :)
___
mesa-dev mailing list
mesa-dev@lists.freedesktop.org
http://lists.freedesktop.org/mailman/listinfo/mesa-dev


Re: [Mesa-dev] [PATCH] build: fix --without-glut

2012-11-21 Thread Matt Turner
On Tue, Nov 20, 2012 at 1:52 PM, Ross Burton ross.bur...@intel.com wrote:
 On Tuesday, 20 November 2012 at 21:48, Brian Paul wrote:
 Personally, I trust Kilgard's GLUT more freeglut.

 Some versions of freeglut (hopefully fixed by now but I don't know)
 spend an inordinate amount of time in a InitSpaceBall() function,
 with a significant FPS hit.

 Another problem I've seen is the first window draw happens twice
 instead of once (even when not animating). I've seen GL bugs where
 the first frame drawn has a glitch but the second frame is fine. That
 kind of bug is hard to spot if you always draw twice.

 And FWIW, just because a project hasn't had recent commits doesn't
 mean it's bad software. It's really just _done_.

 I'll admit to semi-trolling - if Mesa's GLUT is considered finished and not 
 abandoned, then I'll happily switch to Mesa's GLUT over FreeGLUT for the 
 simple reason that we're already using Mesa and Mesa's GLU.

To be clear, Mesa's GLU was a thing, but it is not this thing:
http://cgit.freedesktop.org/mesa/glu

That's SGI's GLU. I hope you're not using Mesa's GLU.
___
mesa-dev mailing list
mesa-dev@lists.freedesktop.org
http://lists.freedesktop.org/mailman/listinfo/mesa-dev


Re: [Mesa-dev] [PATCH] build: Fix AX_PROG_{CC, CXX}_FOR_BUILD macros

2012-11-21 Thread Thierry Reding
On Tue, Nov 20, 2012 at 08:29:04PM +0100, Thierry Reding wrote:
 On Tue, Nov 20, 2012 at 11:07:03AM -0800, Matt Turner wrote:
  On Tue, Nov 20, 2012 at 7:50 AM, Thierry Reding
  thierry.red...@avionic-design.de wrote:
   Override the cross_compiling and ac_tool_prefix variables by reassigning
   to them instead of redefining the macros. Redefining them will actually
   cause the variable names to be replaced instead of their content.
  
   Furthermore push the definition of CPPFLAGS before running the checks
   for the build tools to avoid the host CPPFLAGS from leaking into the
   build CPPFLAGS.
  
   While at it drop the redefinition of AC_TRY_COMPILER which hasn't been
   used since autoconf 2.50 and make sure that all definitions are properly
   popped when done (LDFLAGS, ac_cv_prog_CPP, ac_cv_prog_CXXCPP).
  
   Signed-off-by: Thierry Reding thierry.red...@avionic-design.de
   ---
m4/ax_prog_cc_for_build.m4  | 37 +++--
m4/ax_prog_cxx_for_build.m4 | 38 --
2 files changed, 23 insertions(+), 52 deletions(-)
 [...]
  Are these changes from upstream? I really have concerns about making
  non-trivial changes to these files.
 
 No, they're not. I do plan to send these changes upstream, but quite
 honestly I'm not sure that they'll be accepted given that I have none of
 the copyright assigment forms filled with the FSF. Looking at the
 autoconf-archive website doesn't actually say anything about copyright
 assignment, but as the project is hosted on GNU I'm a bit sceptical.
 Also note that AX_PROG_CXX_FOR_BUILD doesn't actually exist upstream. I
 essentially copied it from AX_PROG_CC_FOR_BUILD.
 
 I'm actually a bit confused as to why the original cross-compilation
 patches that I sent in worked at all (and I'm sure they did because I
 tested them fairly extensively at the time), but looking at configure
 as generated with the macros as they are in the repository right now,
 things are severely broken. Running the configure script shows a bunch
 of
 
   checking for 2... no
 
 messages, and cross-compiling doesn't actually succeed. With the above
 patches I've verified that Mesa cross-builds from x86_64 to ARM.
 
 Still, if you have any doubts I can try feeding those changes upstream
 and see what comes of it. If that happens we can easily sync the changes
 back by copying the files.

For reference, I've submitted patches for both macros upstream. They are
available here:

http://savannah.gnu.org/patch/index.php?7890
http://savannah.gnu.org/patch/index.php?7891

Thierry


pgp7txOqoV1mI.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] build: fix --without-glut

2012-11-21 Thread Burton, Ross
On 21 November 2012 08:27, Matt Turner matts...@gmail.com wrote:
 To be clear, Mesa's GLU was a thing, but it is not this thing:
 http://cgit.freedesktop.org/mesa/glu

 That's SGI's GLU. I hope you're not using Mesa's GLU.

Ah, thanks.  Yes, I'm using that repository.

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


[Mesa-dev] [Bug 57372] New: x11-libs/libxcb media-libs/mesa segfault in __glXGetString

2012-11-21 Thread bugzilla-daemon
https://bugs.freedesktop.org/show_bug.cgi?id=57372

  Priority: medium
Bug ID: 57372
  Assignee: mesa-dev@lists.freedesktop.org
   Summary: x11-libs/libxcb media-libs/mesa segfault in
__glXGetString
  Severity: normal
Classification: Unclassified
OS: Linux (All)
  Reporter: ri...@gentoo.org
  Hardware: x86-64 (AMD64)
Status: NEW
   Version: 9.0
 Component: GLX
   Product: Mesa

Created attachment 70371
  -- https://bugs.freedesktop.org/attachment.cgi?id=70371action=edit
backtrace

Downstream bug:
https://bugs.gentoo.org/show_bug.cgi?id=444159

I'm getting a segfault in libxcb, which seems to be the result of calling
xcb_glx_get_string_string_length with a null parameter in __glXGetString.  The
call into mesa originates in qt-opengl, called from the application sleepyhead.

Full backtrace attached - happy to generate additional info as required.

I couldn't find documentation concerning error handling in these functions, so
I'm not sure what point in the call chain is considered at-fault for passing
along bad input.  I did note that __glXGetString does not check the value of
reply before passing it along, which might or might not be intended.

-- 
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 57121] corrupted GLSL built-in function results when using Uniform Buffer contents as arguments

2012-11-21 Thread bugzilla-daemon
https://bugs.freedesktop.org/show_bug.cgi?id=57121

--- Comment #7 from Tomasz Kaźmierczak tome...@wp.eu ---
Hi again.

Adding a small test program (one c++ source and two shader sources). In order
to compile, just call:
$ g++ main.cpp -o gl3test -lX11 -lGL

It draws a triangle whose color is set directly in a fragment shader, and then
the gamma correction is applied to the color. The gamma factor comes from a UBO
and is an argument to the pow() function used to calculate the gamma
correction. I've tried to keep it as simple as possible, so even the vertex
transform matrix is hardcoded into the vertex shader.

Also attaching new images with the error and the expected result (the expected
result has been produced by hardcoding the gamma value into the fragment
shader).

If you look into the fragment shader source (simple.frag) you can see one line
commented out (line 18). If you use line 18 instead of line 16, then the
problem is gone, so this demonstrates that the uniform itself contains propper
value - it's just the pow() function that reads from somewhere else rather than
from the uniform (as mentioned earlier, other built-in functions have the same
problem, and it happens only for uniforms that come from UBOs).

The source code is based on code copied from here:
http://www.opengl.org/wiki/Tutorial:_OpenGL_3.0_Context_Creation_%28GLX%29

I've added three functions: readShader(), linkProgram() and doTests().
Besides that, I've added the #define GL_GLEXT_PROTOTYPES directive at the
begining of the file, so that I didn't have to load the function pointers
manually.

The program draws 5 frames (one frame per second) and exits.

-- 
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 57121] corrupted GLSL built-in function results when using Uniform Buffer contents as arguments

2012-11-21 Thread bugzilla-daemon
https://bugs.freedesktop.org/show_bug.cgi?id=57121

--- Comment #8 from Tomasz Kaźmierczak tome...@wp.eu ---
Created attachment 70373
  -- https://bugs.freedesktop.org/attachment.cgi?id=70373action=edit
a small test program

-- 
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 57121] corrupted GLSL built-in function results when using Uniform Buffer contents as arguments

2012-11-21 Thread bugzilla-daemon
https://bugs.freedesktop.org/show_bug.cgi?id=57121

Tomasz Kaźmierczak tome...@wp.eu changed:

   What|Removed |Added

  Attachment #70079|0   |1
is obsolete||

--- Comment #9 from Tomasz Kaźmierczak tome...@wp.eu ---
Created attachment 70374
  -- https://bugs.freedesktop.org/attachment.cgi?id=70374action=edit
The expected result

-- 
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 57121] corrupted GLSL built-in function results when using Uniform Buffer contents as arguments

2012-11-21 Thread bugzilla-daemon
https://bugs.freedesktop.org/show_bug.cgi?id=57121

Tomasz Kaźmierczak tome...@wp.eu changed:

   What|Removed |Added

  Attachment #70080|0   |1
is obsolete||

--- Comment #10 from Tomasz Kaźmierczak tome...@wp.eu ---
Created attachment 70375
  -- https://bugs.freedesktop.org/attachment.cgi?id=70375action=edit
The actual result (the bug)

-- 
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 57121] corrupted GLSL built-in function results when using Uniform Buffer contents as arguments

2012-11-21 Thread bugzilla-daemon
https://bugs.freedesktop.org/show_bug.cgi?id=57121

Tomasz Kaźmierczak tome...@wp.eu changed:

   What|Removed |Added

  Attachment #70374|text/plain  |image/png
  mime type||

-- 
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 57121] corrupted GLSL built-in function results when using Uniform Buffer contents as arguments

2012-11-21 Thread bugzilla-daemon
https://bugs.freedesktop.org/show_bug.cgi?id=57121

Tomasz Kaźmierczak tome...@wp.eu changed:

   What|Removed |Added

  Attachment #70375|text/plain  |image/png
  mime type||

-- 
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] r600g: Fix flush issue with llvm on r700

2012-11-21 Thread Vadim Girlin
On Tue, 2012-11-20 at 23:26 +0100, Vincent Lejeune wrote:
 ---
  src/gallium/drivers/r600/r600_llvm.c | 5 -
  1 file changed, 4 insertions(+), 1 deletion(-)
 
 diff --git a/src/gallium/drivers/r600/r600_llvm.c 
 b/src/gallium/drivers/r600/r600_llvm.c
 index b3d4e6b..170dac7 100644
 --- a/src/gallium/drivers/r600/r600_llvm.c
 +++ b/src/gallium/drivers/r600/r600_llvm.c
 @@ -11,6 +11,7 @@
  #include r600_asm.h
  #include r600_opcodes.h
  #include r600_shader.h
 +#include r600_pipe.h
  #include radeon_llvm.h
  #include radeon_llvm_emit.h
  
 @@ -324,8 +325,10 @@ static void llvm_emit_tex(
  
   sampler_src = emit_data-inst-Instruction.NumSrcRegs-1;
  
 + // XXX: Resource ID offset is R600_MAX_CONST_BUFFERS but LLVM already 
 adds 2
 + // to the generated machine resource id
   args[c++] = lp_build_const_int32(gallivm,
 - 
 emit_data-inst-Src[sampler_src].Register.Index);
 + 
 emit_data-inst-Src[sampler_src].Register.Index + R600_MAX_CONST_BUFFERS - 
 2);
   args[c++] = lp_build_const_int32(gallivm,
   emit_data-inst-Texture.Texture);
  

As Marek said, it's not a flushing issue. The problem is with the
difference in sampler_id/resource_id mapping between the compiler and
the driver introduced by recent driver changes. There is a temporary fix
in the Tom's llvm tree:

http://cgit.freedesktop.org/~tstellar/llvm/commit/?id=dca75e6619ed9262936a233deb03de9da897aa93

Actually I think that the compiler shouldn't be aware of these internal
driver details at all, driver should precompute and pass both id's to
the compiler, and then these id's should go through the llvm backend
unchanged (at least while we are not using indexing for
resource_id/sampler_id and not trying to optimize it somehow).

Vadim

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


[Mesa-dev] [Bug 57374] New: compilation issue with gcc 4.7.2

2012-11-21 Thread bugzilla-daemon
https://bugs.freedesktop.org/show_bug.cgi?id=57374

  Priority: medium
Bug ID: 57374
  Assignee: mesa-dev@lists.freedesktop.org
   Summary: compilation issue with gcc 4.7.2
  Severity: normal
Classification: Unclassified
OS: Linux (All)
  Reporter: andr...@grapentin.org
  Hardware: x86-64 (AMD64)
Status: NEW
   Version: 9.0
 Component: Other
   Product: Mesa

Mesa-9.0.1/src/gallium/auxiliary/draw/draw_vs.h:170

  #if HAVE_LLVM
 [...]
  #endif

some other files have this construct, too.

I guess that's not valid anymore with recent gcc versions?
please enlighten me :)

if my assumption is correct, this can be fixed by using

  #if defined(HAVE_LLVM)
 [...]
  #endif

instead.

I'll create a patch for that. if you want it, send a ping :)

Thanks,
Andy

-- 
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 57374] compilation issue with gcc 4.7.2

2012-11-21 Thread bugzilla-daemon
https://bugs.freedesktop.org/show_bug.cgi?id=57374

--- Comment #1 from andr...@grapentin.org ---
oh, maybe I was too hasty. now it sais:

In file included from /usr/include/llvm-c/Core.h:18:0,
 from ./gallivm/lp_bld.h:49,
 from ./gallivm/lp_bld_init.h:35,
 from draw/draw_context.c:44:
/usr/include/llvm/Support/DataTypes.h:53:3: error: #error Must #define
__STDC_CONSTANT_MACROS before  #including Support/DataTypes.h

I'll quickly look into that and post what I find here.

-- 
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] [PATCH 1/3] gallium/tests/trivial: updates for util_draw_vertex_buffer changes

2012-11-21 Thread Andreas Boll
Fixes build error with configure option --enable-gallium-tests
introduced in e73bf3b805de78299f1a652668ba4e6eab9bac94

Cc: Marek Olšák mar...@gmail.com
---
 src/gallium/tests/trivial/quad-tex.c |2 +-
 src/gallium/tests/trivial/tri.c  |2 +-
 2 files changed, 2 insertions(+), 2 deletions(-)

diff --git a/src/gallium/tests/trivial/quad-tex.c 
b/src/gallium/tests/trivial/quad-tex.c
index 6162dd0..f0c30d9 100644
--- a/src/gallium/tests/trivial/quad-tex.c
+++ b/src/gallium/tests/trivial/quad-tex.c
@@ -329,7 +329,7 @@ static void draw(struct program *p)
cso_set_vertex_elements(p-cso, 2, p-velem);
 
util_draw_vertex_buffer(p-pipe, p-cso,
-   p-vbuf, 0,
+   p-vbuf, 0, 0,
PIPE_PRIM_QUADS,
4,  /* verts */
2); /* attribs/vert */
diff --git a/src/gallium/tests/trivial/tri.c b/src/gallium/tests/trivial/tri.c
index f3e1e94..f9b4696 100644
--- a/src/gallium/tests/trivial/tri.c
+++ b/src/gallium/tests/trivial/tri.c
@@ -262,7 +262,7 @@ static void draw(struct program *p)
cso_set_vertex_elements(p-cso, 2, p-velem);
 
util_draw_vertex_buffer(p-pipe, p-cso,
-   p-vbuf, 0,
+   p-vbuf, 0, 0,
PIPE_PRIM_TRIANGLES,
3,  /* verts */
2); /* attribs/vert */
-- 
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/3] gallium/tests/trivial: updates for CSO interface changes

2012-11-21 Thread Andreas Boll
Fixes build error with configure option --enable-gallium-tests
introduced in ea6f035ae90895bd4ee3247408eb179dfdf96d22

Cc: Brian Paul bri...@vmware.com
---
 src/gallium/tests/trivial/quad-tex.c |4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

diff --git a/src/gallium/tests/trivial/quad-tex.c 
b/src/gallium/tests/trivial/quad-tex.c
index f0c30d9..feff902 100644
--- a/src/gallium/tests/trivial/quad-tex.c
+++ b/src/gallium/tests/trivial/quad-tex.c
@@ -315,8 +315,8 @@ static void draw(struct program *p)
cso_set_viewport(p-cso, p-viewport);
 
/* sampler */
-   cso_single_sampler(p-cso, 0, p-sampler);
-   cso_single_sampler_done(p-cso);
+   cso_single_sampler(p-cso, PIPE_SHADER_FRAGMENT, 0, p-sampler);
+   cso_single_sampler_done(p-cso, PIPE_SHADER_FRAGMENT);
 
/* texture sampler view */
cso_set_sampler_views(p-cso, PIPE_SHADER_FRAGMENT, 1, p-view);
-- 
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] gallium/tests/trivial: updates for transfer functions changes

2012-11-21 Thread Andreas Boll
Fixes build error with configure option --enable-gallium-tests
introduced in 369e46888904c6d379b8b477d9242cff1608e30e

Compile tested only.

Cc: Marek Olšák mar...@gmail.com
---
 src/gallium/tests/trivial/compute.c |   14 --
 1 file changed, 4 insertions(+), 10 deletions(-)

diff --git a/src/gallium/tests/trivial/compute.c 
b/src/gallium/tests/trivial/compute.c
index 1812090..a6ebc7c 100644
--- a/src/gallium/tests/trivial/compute.c
+++ b/src/gallium/tests/trivial/compute.c
@@ -201,13 +201,11 @@ static void init_tex(struct context *ctx, int slot,
 *tex = ctx-screen-resource_create(ctx-screen, ttex);
 assert(*tex);
 
-xfer = pipe-get_transfer(pipe, *tex, 0, PIPE_TRANSFER_WRITE,
+map = pipe-transfer_map(pipe, *tex, 0, PIPE_TRANSFER_WRITE,
   (struct pipe_box) { .width = w,
   .height = h,
-  .depth = 1 });
+  .depth = 1 }, xfer);
 assert(xfer);
-
-map = pipe-transfer_map(pipe, xfer);
 assert(map);
 
 for (y = 0; y  ny; ++y) {
@@ -217,7 +215,6 @@ static void init_tex(struct context *ctx, int slot,
 }
 
 pipe-transfer_unmap(pipe, xfer);
-pipe-transfer_destroy(pipe, xfer);
 
 ctx-tex_rw[slot] = rw;
 }
@@ -246,13 +243,11 @@ static void check_tex(struct context *ctx, int slot,
 if (!check)
 check = default_check;
 
-xfer = pipe-get_transfer(pipe, tex, 0, PIPE_TRANSFER_READ,
+map = pipe-transfer_map(pipe, tex, 0, PIPE_TRANSFER_READ,
   (struct pipe_box) { .width = tex-width0,
 .height = tex-height0,
-.depth = 1 });
+.depth = 1 }, xfer);
 assert(xfer);
-
-map = pipe-transfer_map(pipe, xfer);
 assert(map);
 
 for (y = 0; y  ny; ++y) {
@@ -285,7 +280,6 @@ static void check_tex(struct context *ctx, int slot,
 }
 
 pipe-transfer_unmap(pipe, xfer);
-pipe-transfer_destroy(pipe, xfer);
 
 if (err)
 printf((%d, %d): \x1b[31mFAIL\x1b[0m (%d)\n, x, y, err);
-- 
1.7.10.4

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


[Mesa-dev] Attention: gles3 branch is rebased

2012-11-21 Thread Chad Versace
I performed a minor rebase of the gles3 branch at 9:31 Wed 21 in which I
squashed a fixup patch into the patch it fixed. HEAD is
now 1056a30870ad9bf8d0c692c5b39219e1612fe660.

The rebase should not cause you any merge conflicts.

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


Re: [Mesa-dev] Proposal: allow hidden security bugs on Mesa's Bugzilla

2012-11-21 Thread Chad Versace
On 11/20/2012 09:29 AM, Benoit Jacob wrote:

 Any questions?
 Do you support or oppose me asking FD.o admins to allow hidden bugs on
 Mesa's bugzilla?
 
 Benoit

I support this. It seems a sensible proposal for addressing security bugs.

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


[Mesa-dev] [Bug 56710] src/mapi/glapi/glapitemp.h:1640:1: warning: no previous prototype for ‘glReadBufferNV’ [-Wmissing-prototypes]

2012-11-21 Thread bugzilla-daemon
https://bugs.freedesktop.org/show_bug.cgi?id=56710

Jon TURNEY jon.tur...@dronecode.org.uk changed:

   What|Removed |Added

 CC||jon.tur...@dronecode.org.uk

--- Comment #1 from Jon TURNEY jon.tur...@dronecode.org.uk ---
These warnings are also seen with the autotool build if you ./configure with
--disable-asm (or build for a target where that is the default)

-- 
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 v3 4/7] mesa dispatch_sanity: call new functions to initialize exec table

2012-11-21 Thread Ian Romanick

On 11/19/2012 05:01 PM, Jordan Justen wrote:

In a future patch the exec functions will no longer set up
by _mesa_initialize_context and _vbo_CreateContext.

Therefore we must call _mesa_initialize_exec_table and
_mesa_initialize_exec_table_vbo.

v3:
  * Initialize VBO functions with _mesa_initialize_exec_table_vbo


Are these changes necessary to make the test pass after previous 
changes?  If so, this should get squashed with the patch that changes 
the interfaces.  There's shouldn't be any commit where 'make check' 
breaks.  Bisecting is very irritating otherwise.



Signed-off-by: Jordan Justen jordan.l.jus...@intel.com
---
  src/mesa/main/tests/dispatch_sanity.cpp |7 ++-
  1 file changed, 6 insertions(+), 1 deletion(-)

diff --git a/src/mesa/main/tests/dispatch_sanity.cpp 
b/src/mesa/main/tests/dispatch_sanity.cpp
index 56f0dfb..d61d6de 100644
--- a/src/mesa/main/tests/dispatch_sanity.cpp
+++ b/src/mesa/main/tests/dispatch_sanity.cpp
@@ -52,6 +52,7 @@ extern C {
  #include main/api_exec.h
  #include main/context.h
  #include main/remap.h
+#include main/vtxfmt.h
  #include glapi/glapi.h
  #include drivers/common/driverfuncs.h

@@ -103,13 +104,17 @@ DispatchSanity_test::SetUp()
  void
  DispatchSanity_test::SetUpCtx(gl_api api, unsigned int version)
  {
-   ctx.Version = version;
 _mesa_initialize_context(ctx,
  api,
  visual,
  NULL, // share_list
  driver_functions);
 _vbo_CreateContext(ctx);
+
+   ctx.Version = version;
+
+   _mesa_initialize_exec_table(ctx);
+   _mesa_initialize_vbo_vtxfmt(ctx);
  }

  static const char *



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


Re: [Mesa-dev] [PATCH v3 4/7] mesa dispatch_sanity: call new functions to initialize exec table

2012-11-21 Thread Jordan Justen
On Wed, Nov 21, 2012 at 10:12 AM, Ian Romanick i...@freedesktop.org wrote:
 On 11/19/2012 05:01 PM, Jordan Justen wrote:

 In a future patch the exec functions will no longer set up
 by _mesa_initialize_context and _vbo_CreateContext.

 Therefore we must call _mesa_initialize_exec_table and
 _mesa_initialize_exec_table_vbo.

 v3:
   * Initialize VBO functions with _mesa_initialize_exec_table_vbo

 Are these changes necessary to make the test pass after previous changes?
 If so, this should get squashed with the patch that changes the interfaces.
 There's shouldn't be any commit where 'make check' breaks.  Bisecting is
 very irritating otherwise.

I definitely tried to create the series with bisect in mind. I think
it should build and function properly at each point, but I didn't
verify each point. I did just verify 'make check' works before this
commit.

There is some duplicate initialization of the dispatch functions near
the middle of the series, but this is removed in patches 5  6.

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


Re: [Mesa-dev] [PATCH 1/3] gallium/tests/trivial: updates for util_draw_vertex_buffer changes

2012-11-21 Thread Marek Olšák
For the series:

Reviewed-by: Marek Olšák mar...@gmail.com

Marek

On Wed, Nov 21, 2012 at 6:12 PM, Andreas Boll
andreas.boll@gmail.com wrote:
 Fixes build error with configure option --enable-gallium-tests
 introduced in e73bf3b805de78299f1a652668ba4e6eab9bac94

 Cc: Marek Olšák mar...@gmail.com
 ---
  src/gallium/tests/trivial/quad-tex.c |2 +-
  src/gallium/tests/trivial/tri.c  |2 +-
  2 files changed, 2 insertions(+), 2 deletions(-)

 diff --git a/src/gallium/tests/trivial/quad-tex.c 
 b/src/gallium/tests/trivial/quad-tex.c
 index 6162dd0..f0c30d9 100644
 --- a/src/gallium/tests/trivial/quad-tex.c
 +++ b/src/gallium/tests/trivial/quad-tex.c
 @@ -329,7 +329,7 @@ static void draw(struct program *p)
 cso_set_vertex_elements(p-cso, 2, p-velem);

 util_draw_vertex_buffer(p-pipe, p-cso,
 -   p-vbuf, 0,
 +   p-vbuf, 0, 0,
 PIPE_PRIM_QUADS,
 4,  /* verts */
 2); /* attribs/vert */
 diff --git a/src/gallium/tests/trivial/tri.c b/src/gallium/tests/trivial/tri.c
 index f3e1e94..f9b4696 100644
 --- a/src/gallium/tests/trivial/tri.c
 +++ b/src/gallium/tests/trivial/tri.c
 @@ -262,7 +262,7 @@ static void draw(struct program *p)
 cso_set_vertex_elements(p-cso, 2, p-velem);

 util_draw_vertex_buffer(p-pipe, p-cso,
 -   p-vbuf, 0,
 +   p-vbuf, 0, 0,
 PIPE_PRIM_TRIANGLES,
 3,  /* verts */
 2); /* attribs/vert */
 --
 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] i965: Fix hangs with FP KIL instructions pre-gen6.

2012-11-21 Thread Eric Anholt
Ian Romanick i...@freedesktop.org writes:

 On 11/20/2012 12:46 PM, Eric Anholt wrote:
 We can't support IF statements in 16-wide on these.  To get back to 16-wide
 for these shaders, we need to support predicate on discard instructions in 
 the
 backend IR, which is something we've sort of got on the list to do anyway.

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

 Does this bug exist in 9.0?

This file doesn't exist in 9.0.


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


[Mesa-dev] [Bug 57044] build failure: make[4]: *** No rule to make target `../../src/mesa/program/libprogram.la', needed by `libmesagallium.la'. Stop.

2012-11-21 Thread bugzilla-daemon
https://bugs.freedesktop.org/show_bug.cgi?id=57044

Jon TURNEY jon.tur...@dronecode.org.uk changed:

   What|Removed |Added

 CC||jon.tur...@dronecode.org.uk

--- Comment #5 from Jon TURNEY jon.tur...@dronecode.org.uk ---
(In reply to comment #1)
 commit 3a5ad21cd3f026579eeacc25b39513711556c7ee
 Author: Eric Anholt e...@anholt.net
 Date:   Mon Nov 12 19:32:58 2012 -0800
 
 mesa: Fix gallium build since 6991c2922f
 
 Looks like I screwed up and didn't test gallium again after tweaking the
 Makefile.
 
 Bugzilla: https://bugs.freedesktop.org/show_bug.cgi?id=57044

This change doesn't seem to be correct.

Reading src/mesa/Makefile.am, it looks to me like it will need libprogram.la if
NEED_LIBMESA or HAVE_GALLIUM is true.

-- 
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 57372] x11-libs/libxcb media-libs/mesa segfault in __glXGetString

2012-11-21 Thread bugzilla-daemon
https://bugs.freedesktop.org/show_bug.cgi?id=57372

Richard Freeman ri...@gentoo.org changed:

   What|Removed |Added

  Attachment #70371|0   |1
is obsolete||

--- Comment #1 from Richard Freeman ri...@gentoo.org ---
Created attachment 70391
  -- https://bugs.freedesktop.org/attachment.cgi?id=70391action=edit
backtrace -O0

-- 
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] [PATCH 0/5 v2] (gles3) Add plubming for EGL_OPENGL_ES3_BIT

2012-11-21 Thread Chad Versace
Fixes error EGL_BAD_ATTRIBUTE in the tests below on Intel Sandybridge:  
 
  * piglit egl-create-context-verify-gl-flavor, testcase OpenGL ES 3.0
  * gles3conform, revision 19700, when GL3Tests are ran with -fbo

The series lives on my es3-bit-v3 branch. It adds a new enum, __DRI_API_GLES3,
and does the needed plumbing in the EGL and DRI layers and the Intel drivers
to support EGL_OPENGL_ES3_BIT_KHR. The GLX layer and core mesa are left
untouched.

I tested the series against gen6 with piglit
egl-create-context-verify-gl-flavor. I verified that the series, other than
exposing ES3, does not change the set of exposed EGL context flavors.


v2: Only expose the ES3 bit if the hardware/driver combo is capable of
creating an ES3 context, as requested by Ian.


Chad Versace (5):
  intel: Set screen's api mask according to hw capabilities
  intel: Move validation of context version into intelInitContext
  dri: Define enum __DRI_API_GLES3
  intel: Expose support for DRI_API_GLES3
  egl/dri2: Add plumbing for EGL_OPENGL_ES3_BIT_KHR

 include/GL/internal/dri_interface.h|   3 +-
 src/egl/drivers/dri2/egl_dri2.c|  11 ++-
 src/egl/main/eglconfig.c   |   1 +
 src/egl/main/eglcontext.c  |   4 +-
 src/egl/main/eglcurrent.h  |   1 +
 src/egl/main/eglmisc.c |   3 +
 src/egl/main/eglsurface.c  |   5 +-
 src/mesa/drivers/dri/common/dri_util.c |   1 +
 src/mesa/drivers/dri/common/drisw_util.c   |   1 +
 src/mesa/drivers/dri/i915/i830_context.c   |  20 +++--
 src/mesa/drivers/dri/i915/i830_context.h   |   6 +-
 src/mesa/drivers/dri/i915/i915_context.c   |  32 ++-
 src/mesa/drivers/dri/i965/brw_context.c|  47 ++
 src/mesa/drivers/dri/intel/intel_context.c |  56 +++-
 src/mesa/drivers/dri/intel/intel_context.h |  13 +--
 src/mesa/drivers/dri/intel/intel_screen.c  | 134 +
 src/mesa/drivers/dri/intel/intel_screen.h  |   5 ++
 17 files changed, 221 insertions(+), 122 deletions(-)

-- 
1.7.11.7

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


[Mesa-dev] [PATCH 1/5] (gles3) intel: Set screen's api mask according to hw capabilities

2012-11-21 Thread Chad Versace
Before this patch, intelInitScreen2 set DRIScreen::api_mask with the hacky
heuristic below:

if (gen = 3)
api_mask = GL | GLES1 | GLES2;
else
api_mask = 0;

I don't understand why this hack works with gen2 (i830), or even if it
works properly at all. I don't care enough to investigate. On first
glance, it appears that this will cause every EGLConfig on i830 to have
EGL_RENDERABLE_TYPE=0, and thus prevent eglCreateContext from ever
succeeding. Anyway, moving on to living drivers...

With the arrival of EGL_OPENGL_ES3_BIT_KHR, this heuristic is now
insufficient. We must enable the GLES3 bit if and only if the driver is
capable of creating a GLES3 context. This requires us to determine the
maximum supported context version supported by the hardware/driver for
each api *during initialization of intel_screen*.

Therefore, this patch adds four new fields to intel_screen which indicate
the maximum supported context version for each api:
  max_gl_core_version
  max_gl_compat_version
  max_gl_es1_version
  max_gl_es2_version

The api mask is now correctly set as:

if (max_gl_core_version  0 || max_gl_compat_version  0)
api_mask |= GL;
if (max_gl_es1_version  0)
api_mask |= GLES1;
if (max_gl_es2_version  0)
api_mask |= GLES2;

Tested against gen6 with piglit egl-create-context-verify-gl-flavor.
Verified that this patch does not change the set of exposed EGL context
flavors.

Signed-off-by: Chad Versace chad.vers...@linux.intel.com
---
 src/mesa/drivers/dri/intel/intel_screen.c | 99 +++
 src/mesa/drivers/dri/intel/intel_screen.h |  5 ++
 2 files changed, 93 insertions(+), 11 deletions(-)

diff --git a/src/mesa/drivers/dri/intel/intel_screen.c 
b/src/mesa/drivers/dri/intel/intel_screen.c
index 0194804..b63e4f7 100644
--- a/src/mesa/drivers/dri/intel/intel_screen.c
+++ b/src/mesa/drivers/dri/intel/intel_screen.c
@@ -1046,6 +1046,85 @@ intel_screen_make_configs(__DRIscreen *dri_screen)
return configs;
 }
 
+static void
+set_max_gl_versions(struct intel_screen *screen)
+{
+#ifdef TEXTURE_FLOAT_ENABLED
+   bool has_texture_float = true;
+#else
+   bool has_texture_float = false;
+#endif
+
+   if (screen-gen = 7) {
+  screen-max_gl_es1_version = 11;
+
+  if (has_texture_float  screen-kernel_has_gen7_sol_reset) {
+ screen-max_gl_core_version = 31;
+ screen-max_gl_compat_version = 30;
+ screen-max_gl_es2_version = 30;
+  } else {
+ screen-max_gl_core_version = 0;
+ screen-max_gl_compat_version = 21;
+ screen-max_gl_es2_version = 20;
+  }
+
+   } else if (screen-gen = 6) {
+  screen-max_gl_es1_version = 11;
+
+  if (has_texture_float) {
+ screen-max_gl_core_version = 31;
+ screen-max_gl_compat_version = 30;
+ screen-max_gl_es2_version = 30;
+  } else {
+ screen-max_gl_core_version = 0;
+ screen-max_gl_compat_version = 21;
+ screen-max_gl_es2_version = 20;
+  }
+
+   } else if (screen-gen = 4) {
+  screen-max_gl_core_version = 0;
+  screen-max_gl_compat_version = 21;
+  screen-max_gl_es2_version = 20;
+  screen-max_gl_es1_version = 11;
+
+   } else if (screen-gen = 3) {
+  bool has_fragment_shader = driQueryOptionb(screen-optionCache, 
fragment_shader);
+  bool has_occlusion_query = driQueryOptionb(screen-optionCache, 
stub_occlusion_query);
+
+  screen-max_gl_core_version = 0;
+  screen-max_gl_es1_version = 11;
+
+  if (has_fragment_shader  has_occlusion_query) {
+ screen-max_gl_compat_version = 21;
+  } else {
+ screen-max_gl_compat_version = 15;
+  }
+
+  if (has_fragment_shader) {
+ screen-max_gl_es2_version = 20;
+  } else {
+ screen-max_gl_es2_version = 0;
+  }
+
+   } else if (screen-gen = 2) {
+  screen-max_gl_core_version = 0;
+  screen-max_gl_compat_version = 13;
+  screen-max_gl_es2_version = 0;
+  screen-max_gl_es1_version = 11;
+
+   } else {
+  assert(false);
+   }
+
+#ifndef FEATURE_ES1
+   screen-max_gl_es1_version = 0;
+#endif
+
+#ifndef FEATURE_ES2
+   screen-max_gl_es2_version = 0;
+#endif
+}
+
 /**
  * This is the driver specific part of the createNewScreen entry point.
  * Called when using DRI2.
@@ -1056,7 +1135,6 @@ static const
 __DRIconfig **intelInitScreen2(__DRIscreen *psp)
 {
struct intel_screen *intelScreen;
-   unsigned int api_mask;
 
if (psp-dri2.loader-base.version = 2 ||
psp-dri2.loader-getBuffersWithFormat == NULL) {
@@ -1115,18 +1193,17 @@ __DRIconfig **intelInitScreen2(__DRIscreen *psp)
 
intel_override_separate_stencil(intelScreen);
 
-   api_mask = (1  __DRI_API_OPENGL);
-#if FEATURE_ES1
-   api_mask |= (1  __DRI_API_GLES);
-#endif
-#if FEATURE_ES2
-   api_mask |= (1  __DRI_API_GLES2);
-#endif
+   intelScreen-hw_has_swizzling = intel_detect_swizzling(intelScreen);
 
-   if (IS_9XX(intelScreen-deviceID) || IS_965(intelScreen-deviceID))
-  

[Mesa-dev] [PATCH 2/5] (gles3) intel: Move validation of context version into intelInitContext

2012-11-21 Thread Chad Versace
Each driver (i830, i915, i965) used independent but similar code to
validate the requested context version. With the rececnt arrival of GLES3,
that logic has needed an update. Rather than apply identical updates to
each drivers validation code, let's just move the validation into the
shared routine intelInitContext.

This refactor required some incidental changes to functions
i830CreateContext and intelInitContext. For each function, this patch:
- Adds context version parameters to the signature.
- Adds a DRI_CTX_ERROR out param to the signature.
- Sets the DRI_CTX_ERROR at each early return.

Tested against gen6 with piglit egl-create-context-verify-gl-flavor.
Verified that this patch does not change the set of exposed EGL context
flavors.

Signed-off-by: Chad Versace chad.vers...@linux.intel.com
---
 src/mesa/drivers/dri/i915/i830_context.c   | 20 ---
 src/mesa/drivers/dri/i915/i830_context.h   |  6 +++-
 src/mesa/drivers/dri/i915/i915_context.c   | 32 +++--
 src/mesa/drivers/dri/i965/brw_context.c| 47 +++--
 src/mesa/drivers/dri/intel/intel_context.c | 56 --
 src/mesa/drivers/dri/intel/intel_context.h | 13 ---
 src/mesa/drivers/dri/intel/intel_screen.c  | 31 +
 7 files changed, 100 insertions(+), 105 deletions(-)

diff --git a/src/mesa/drivers/dri/i915/i830_context.c 
b/src/mesa/drivers/dri/i915/i830_context.c
index e822660..288dfcc 100644
--- a/src/mesa/drivers/dri/i915/i830_context.c
+++ b/src/mesa/drivers/dri/i915/i830_context.c
@@ -52,23 +52,33 @@ i830InitDriverFunctions(struct dd_function_table *functions)
 extern const struct tnl_pipeline_stage *intel_pipeline[];
 
 bool
-i830CreateContext(const struct gl_config * mesaVis,
+i830CreateContext(int api,
+  const struct gl_config * mesaVis,
   __DRIcontext * driContextPriv,
+  unsigned major_version,
+  unsigned minor_version,
+  unsigned *error,
   void *sharedContextPrivate)
 {
struct dd_function_table functions;
struct i830_context *i830 = rzalloc(NULL, struct i830_context);
struct intel_context *intel = i830-intel;
struct gl_context *ctx = intel-ctx;
-   if (!i830)
+
+   if (!i830) {
+  *error = __DRI_CTX_ERROR_NO_MEMORY;
   return false;
+   }
 
i830InitVtbl(i830);
i830InitDriverFunctions(functions);
 
-   if (!intelInitContext(intel, __DRI_API_OPENGL, mesaVis, driContextPriv,
- sharedContextPrivate, functions)) {
-  free(i830);
+   if (!intelInitContext(intel, __DRI_API_OPENGL,
+ major_version, minor_version,
+ mesaVis, driContextPriv,
+ sharedContextPrivate, functions,
+ error)) {
+  ralloc_free(i830);
   return false;
}
 
diff --git a/src/mesa/drivers/dri/i915/i830_context.h 
b/src/mesa/drivers/dri/i915/i830_context.h
index d9e2fcf..ab6222b 100644
--- a/src/mesa/drivers/dri/i915/i830_context.h
+++ b/src/mesa/drivers/dri/i915/i830_context.h
@@ -178,8 +178,12 @@ i830_state_draw_region(struct intel_context *intel,
 /* i830_context.c
  */
 extern bool
-i830CreateContext(const struct gl_config * mesaVis,
+i830CreateContext(int api,
+  const struct gl_config * mesaVis,
   __DRIcontext * driContextPriv,
+  unsigned major_version,
+  unsigned minor_version,
+  unsigned *error,
   void *sharedContextPrivate);
 
 /* i830_tex.c, i830_texstate.c
diff --git a/src/mesa/drivers/dri/i915/i915_context.c 
b/src/mesa/drivers/dri/i915/i915_context.c
index 3ef4eca..75a1a2c 100644
--- a/src/mesa/drivers/dri/i915/i915_context.c
+++ b/src/mesa/drivers/dri/i915/i915_context.c
@@ -168,33 +168,11 @@ i915CreateContext(int api,
 
i915InitDriverFunctions(functions);
 
-   if (!intelInitContext(intel, api, mesaVis, driContextPriv,
- sharedContextPrivate, functions)) {
-  *error = __DRI_CTX_ERROR_NO_MEMORY;
-  return false;
-   }
-
-   /* Now that the extension bits are known, filter against the requested API
-* and version.
-*/
-   switch (api) {
-   case API_OPENGL: {
-  const unsigned max_version =
- (ctx-Extensions.ARB_fragment_shader 
-  ctx-Extensions.ARB_occlusion_query) ? 20 : 15;
-  const unsigned req_version = major_version * 10 + minor_version;
-
-  if (req_version  max_version) {
- *error = __DRI_CTX_ERROR_BAD_VERSION;
- return false;
-  }
-  break;
-   }
-   case API_OPENGLES:
-   case API_OPENGLES2:
-  break;
-   default:
-  *error = __DRI_CTX_ERROR_BAD_API;
+   if (!intelInitContext(intel, api, major_version, minor_version,
+ mesaVis, driContextPriv,
+ sharedContextPrivate, functions,
+ error)) {
+  ralloc_free(i915);
   

[Mesa-dev] [PATCH 3/5] (gles3) dri: Define enum __DRI_API_GLES3

2012-11-21 Thread Chad Versace
This enum corresponds to EGL_OPENGL_ES3_BIT_KHR.
Neither the GLX nor EGL layer use the enum yet.

I don't like the GLES bits. I'd prefer that all GLES APIs be exposed
through a single API bit, as is done in GLX_EXT_create_context_es_profile.
But, we need this GLES3 enum in order to do the plumbing necessary to
correctly support EGL_OPENGL_ES3_BIT_KHR as required by the
EGL_KHR_create_context spec.

Signed-off-by: Chad Versace chad.vers...@linux.intel.com
---
 include/GL/internal/dri_interface.h  | 3 ++-
 src/mesa/drivers/dri/common/dri_util.c   | 1 +
 src/mesa/drivers/dri/common/drisw_util.c | 1 +
 3 files changed, 4 insertions(+), 1 deletion(-)

diff --git a/include/GL/internal/dri_interface.h 
b/include/GL/internal/dri_interface.h
index 1e0f1d0..5cc3225 100644
--- a/include/GL/internal/dri_interface.h
+++ b/include/GL/internal/dri_interface.h
@@ -801,8 +801,9 @@ struct __DRIdri2LoaderExtensionRec {
 
 #define __DRI_API_OPENGL   0   /** OpenGL compatibility profile */
 #define __DRI_API_GLES 1   /** OpenGL ES 1.x */
-#define __DRI_API_GLES22   /** OpenGL ES 2.0 or 3.0 */
+#define __DRI_API_GLES22   /** OpenGL ES 2.x */
 #define __DRI_API_OPENGL_CORE  3   /** OpenGL 3.2+ core profile */
+#define __DRI_API_GLES34   /** OpenGL ES 3.x */
 
 #define __DRI_CTX_ATTRIB_MAJOR_VERSION 0
 #define __DRI_CTX_ATTRIB_MINOR_VERSION 1
diff --git a/src/mesa/drivers/dri/common/dri_util.c 
b/src/mesa/drivers/dri/common/dri_util.c
index 983bbea..50a06cb 100644
--- a/src/mesa/drivers/dri/common/dri_util.c
+++ b/src/mesa/drivers/dri/common/dri_util.c
@@ -189,6 +189,7 @@ dri2CreateContextAttribs(__DRIscreen *screen, int api,
mesa_api = API_OPENGLES;
break;
 case __DRI_API_GLES2:
+case __DRI_API_GLES3:
mesa_api = API_OPENGLES2;
break;
 case __DRI_API_OPENGL_CORE:
diff --git a/src/mesa/drivers/dri/common/drisw_util.c 
b/src/mesa/drivers/dri/common/drisw_util.c
index d692748..8e43168 100644
--- a/src/mesa/drivers/dri/common/drisw_util.c
+++ b/src/mesa/drivers/dri/common/drisw_util.c
@@ -123,6 +123,7 @@ driCreateContextAttribs(__DRIscreen *screen, int api,
 mesa_api = API_OPENGLES;
 break;
 case __DRI_API_GLES2:
+case __DRI_API_GLES3:
 mesa_api = API_OPENGLES2;
 break;
 case __DRI_API_OPENGL_CORE:
-- 
1.7.11.7

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


[Mesa-dev] [PATCH 4/5] (gles3) intel: Expose support for DRI_API_GLES3

2012-11-21 Thread Chad Versace
If the hardware/driver combo supports GLES3, then set the GLES3 bit in
intel_screen's bitmask of supported DRI API's.  Neither the EGL nor GLX
layer uses the bit yet.

Signed-off-by: Chad Versace chad.vers...@linux.intel.com
---
 src/mesa/drivers/dri/intel/intel_screen.c | 2 ++
 1 file changed, 2 insertions(+)

diff --git a/src/mesa/drivers/dri/intel/intel_screen.c 
b/src/mesa/drivers/dri/intel/intel_screen.c
index feca162..66a27cd 100644
--- a/src/mesa/drivers/dri/intel/intel_screen.c
+++ b/src/mesa/drivers/dri/intel/intel_screen.c
@@ -1191,6 +1191,8 @@ __DRIconfig **intelInitScreen2(__DRIscreen *psp)
   psp-api_mask |= (1  __DRI_API_GLES);
if (intelScreen-max_gl_es2_version  0)
   psp-api_mask |= (1  __DRI_API_GLES2);
+   if (intelScreen-max_gl_es2_version = 30)
+  psp-api_mask |= (1  __DRI_API_GLES3);
 
psp-extensions = intelScreenExtensions;
 
-- 
1.7.11.7

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


[Mesa-dev] [PATCH 5/5] (gles3) egl/dri2: Add plumbing for EGL_OPENGL_ES3_BIT_KHR

2012-11-21 Thread Chad Versace
Fixes error EGL_BAD_ATTRIBUTE in the tests below on Intel Sandybridge:
* piglit egl-create-context-verify-gl-flavor, testcase OpenGL ES 3.0
* gles3conform, revision 19700, when runnning GL3Tests with -fbo

This plumbing is added in order to comply with the EGL_KHR_create_context
spec. According to the EGL_KHR_create_context spec, it is illegal to call
eglCreateContext(EGL_CONTEXT_MAJOR_VERSION_KHR=3) with a config whose
EGL_RENDERABLE_TYPE does not contain the EGL_OPENGL_ES3_BIT_KHR. The
pertinent
portion of the spec is quoted below; the key word is respectively.

  * If config is not a valid EGLConfig, or does not support the
requested client API, then an EGL_BAD_CONFIG error is generated
(this includes requesting creation of an OpenGL ES 1.x, 2.0, or
3.0 context when the EGL_RENDERABLE_TYPE attribute of config
does not contain EGL_OPENGL_ES_BIT, EGL_OPENGL_ES2_BIT, or
EGL_OPENGL_ES3_BIT_KHR respectively).

To create this patch, I searched for all the ES2 bit plumbing by calling
`git grep ES2_BIT\|DRI_API_GLES2 src/egl`, and then at each location
added a case for ES3.

Signed-off-by: Chad Versace chad.vers...@linux.intel.com
---
 src/egl/drivers/dri2/egl_dri2.c | 11 +--
 src/egl/main/eglconfig.c|  1 +
 src/egl/main/eglcontext.c   |  4 +++-
 src/egl/main/eglcurrent.h   |  1 +
 src/egl/main/eglmisc.c  |  3 +++
 src/egl/main/eglsurface.c   |  5 -
 6 files changed, 21 insertions(+), 4 deletions(-)

diff --git a/src/egl/drivers/dri2/egl_dri2.c b/src/egl/drivers/dri2/egl_dri2.c
index 1f13d79..0965959 100644
--- a/src/egl/drivers/dri2/egl_dri2.c
+++ b/src/egl/drivers/dri2/egl_dri2.c
@@ -465,7 +465,10 @@ dri2_setup_screen(_EGLDisplay *disp)
   api_mask = dri2_dpy-dri2-getAPIMask(dri2_dpy-dri_screen);
} else {
   assert(dri2_dpy-swrast);
-  api_mask = 1  __DRI_API_OPENGL | 1  __DRI_API_GLES | 1  
__DRI_API_GLES2;
+  api_mask = 1  __DRI_API_OPENGL |
+ 1  __DRI_API_GLES |
+ 1  __DRI_API_GLES2 |
+ 1  __DRI_API_GLES3;
}
 
disp-ClientAPIs = 0;
@@ -475,6 +478,8 @@ dri2_setup_screen(_EGLDisplay *disp)
   disp-ClientAPIs |= EGL_OPENGL_ES_BIT;
if (api_mask  (1  __DRI_API_GLES2))
   disp-ClientAPIs |= EGL_OPENGL_ES2_BIT;
+   if (api_mask  (1  __DRI_API_GLES3))
+  disp-ClientAPIs |= EGL_OPENGL_ES3_BIT_KHR;
 
assert(dri2_dpy-dri2 || dri2_dpy-swrast);
disp-Extensions.KHR_surfaceless_context = EGL_TRUE;
@@ -737,8 +742,10 @@ dri2_create_context(_EGLDriver *drv, _EGLDisplay *disp, 
_EGLConfig *conf,
  api = __DRI_API_GLES;
  break;
   case 2:
+ api = __DRI_API_GLES3;
+ break;
   case 3:
- api = __DRI_API_GLES2;
+ api = __DRI_API_GLES3;
  break;
   default:
 _eglError(EGL_BAD_PARAMETER, eglCreateContext);
diff --git a/src/egl/main/eglconfig.c b/src/egl/main/eglconfig.c
index e1d53da..b18f301 100644
--- a/src/egl/main/eglconfig.c
+++ b/src/egl/main/eglconfig.c
@@ -331,6 +331,7 @@ _eglValidateConfig(const _EGLConfig *conf, EGLBoolean 
for_matching)
 mask = EGL_OPENGL_ES_BIT |
EGL_OPENVG_BIT |
EGL_OPENGL_ES2_BIT |
+   EGL_OPENGL_ES3_BIT_KHR |
EGL_OPENGL_BIT;
 break;
  default:
diff --git a/src/egl/main/eglcontext.c b/src/egl/main/eglcontext.c
index 4efb76b..86af91d 100644
--- a/src/egl/main/eglcontext.c
+++ b/src/egl/main/eglcontext.c
@@ -54,9 +54,11 @@ _eglGetContextAPIBit(_EGLContext *ctx)
  bit = EGL_OPENGL_ES_BIT;
  break;
   case 2:
-  case 3:
  bit = EGL_OPENGL_ES2_BIT;
  break;
+  case 3:
+ bit = EGL_OPENGL_ES3_BIT_KHR;
+ break;
   default:
  break;
   }
diff --git a/src/egl/main/eglcurrent.h b/src/egl/main/eglcurrent.h
index a64821e..45fcc64 100644
--- a/src/egl/main/eglcurrent.h
+++ b/src/egl/main/eglcurrent.h
@@ -37,6 +37,7 @@
(EGL_OPENGL_ES_BIT   | \
 EGL_OPENVG_BIT  | \
 EGL_OPENGL_ES2_BIT  | \
+EGL_OPENGL_ES3_BIT_KHR | \
 EGL_OPENGL_BIT)
 
 
diff --git a/src/egl/main/eglmisc.c b/src/egl/main/eglmisc.c
index b7599d0..0733b9d 100644
--- a/src/egl/main/eglmisc.c
+++ b/src/egl/main/eglmisc.c
@@ -139,6 +139,9 @@ _eglUpdateAPIsString(_EGLDisplay *dpy)
if (dpy-ClientAPIs  EGL_OPENGL_ES2_BIT)
   strcat(apis, OpenGL_ES2 );
 
+   if (dpy-ClientAPIs  EGL_OPENGL_ES3_BIT_KHR)
+  strcat(apis, OpenGL_ES3 );
+
if (dpy-ClientAPIs  EGL_OPENVG_BIT)
   strcat(apis, OpenVG );
 
diff --git a/src/egl/main/eglsurface.c b/src/egl/main/eglsurface.c
index 52d85ef..56d68a4 100644
--- a/src/egl/main/eglsurface.c
+++ b/src/egl/main/eglsurface.c
@@ -427,11 +427,14 @@ _eglSurfaceAttrib(_EGLDriver *drv, _EGLDisplay *dpy, 
_EGLSurface *surface,
 {
EGLint confval;
EGLint err = EGL_SUCCESS;
+   EGLint all_es_bits = EGL_OPENGL_ES_BIT |
+EGL_OPENGL_ES2_BIT |
+

[Mesa-dev] [Bug 57372] x11-libs/libxcb media-libs/mesa segfault in __glXGetString

2012-11-21 Thread bugzilla-daemon
https://bugs.freedesktop.org/show_bug.cgi?id=57372

--- Comment #2 from Richard Freeman ri...@gentoo.org ---
I've been doing some debugging, and some observations:

1.  xcb_glx_get_string is returning a cookie.
2.  xcb_connection_has_error is 0 both before and after
xcb_glx_get_string_reply is called.

I'm slowly teaching myself far more xcb than I ever expected to learn, but if
there is anything I can do to capture more useful info let me know - I can
patch any libraries as needed as long as it isn't disruptive to the rest of the
system.

-- 
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] [PATCH V3 1/7] i965: implement get_size for 2_10_10_10 formats

2012-11-21 Thread Chris Forbes
Signed-off-by: Chris Forbes chr...@ijw.co.nz
---
 src/mesa/drivers/dri/i965/brw_draw_upload.c | 4 
 1 file changed, 4 insertions(+)

diff --git a/src/mesa/drivers/dri/i965/brw_draw_upload.c 
b/src/mesa/drivers/dri/i965/brw_draw_upload.c
index 51531ce..58803f5 100644
--- a/src/mesa/drivers/dri/i965/brw_draw_upload.c
+++ b/src/mesa/drivers/dri/i965/brw_draw_upload.c
@@ -290,6 +290,10 @@ static GLuint get_size( GLenum type )
case GL_UNSIGNED_SHORT: return sizeof(GLushort);
case GL_UNSIGNED_BYTE: return sizeof(GLubyte);
case GL_FIXED: return sizeof(GLuint);
+   /* packed formats: always have 4 components, and element size is
+   * 4 bytes, so pretend each component is 1 byte. */
+   case GL_INT_2_10_10_10_REV: return sizeof(GLbyte);
+   case GL_UNSIGNED_INT_2_10_10_10_REV: return sizeof(GLubyte);
default: assert(0); return 0;
}
 }
-- 
1.8.0

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


[Mesa-dev] [PATCH V3] i965: Add support for ARB_vertex_type_2_10_10_10_rev on Gen4+

2012-11-21 Thread Chris Forbes
This series adds support for ARB_vertex_type_2_10_10_10_rev, and lays the
groundwork for the equivalent bits in ES3.

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


[Mesa-dev] [PATCH V3 2/7] i965: support 2_10_10_10 formats in get_surface_type.

2012-11-21 Thread Chris Forbes
Always use R10G10B10A2_UINT; Most of the other formats we'd like
don't actually work on the hardware. Will emit w/a for scaling,
sign recovery and BGRA swizzle in the VS.

Signed-off-by: Chris Forbes chr...@ijw.co.nz
---
 src/mesa/drivers/dri/i965/brw_draw_upload.c | 18 +-
 1 file changed, 17 insertions(+), 1 deletion(-)

diff --git a/src/mesa/drivers/dri/i965/brw_draw_upload.c 
b/src/mesa/drivers/dri/i965/brw_draw_upload.c
index 58803f5..b0e02db 100644
--- a/src/mesa/drivers/dri/i965/brw_draw_upload.c
+++ b/src/mesa/drivers/dri/i965/brw_draw_upload.c
@@ -252,10 +252,26 @@ static GLuint get_surface_type( GLenum type, GLuint size,
  else {
 return ubyte_types_norm[size];
  }
+  /* See GL_ARB_vertex_type_2_10_10_10_rev */
+  /* W/A: the hardware doesn't really support the formats we'd
+   * like to use here, so upload everything as UINT and fix
+   * it in the shader */
+  case GL_INT_2_10_10_10_REV:
+  case GL_UNSIGNED_INT_2_10_10_10_REV:
+ assert(size == 4);
+ return BRW_SURFACEFORMAT_R10G10B10A2_UINT;
   default: assert(0); return 0;
-  }  
+  }
}
else {
+  /* See GL_ARB_vertex_type_2_10_10_10_rev */
+  /* W/A: the hardware doesn't really support the formats we'd
+   * like to use here, so upload everything as UINT and fix
+   * it in the shader */
+  if (type == GL_INT_2_10_10_10_REV || type == 
GL_UNSIGNED_INT_2_10_10_10_REV) {
+ assert(size == 4);
+return BRW_SURFACEFORMAT_R10G10B10A2_UINT;
+  }
   assert(format == GL_RGBA); /* sanity check */
   switch (type) {
   case GL_DOUBLE: return double_types[size];
-- 
1.8.0

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


[Mesa-dev] [PATCH V3 3/7] i965: Generalize GL_FIXED VS w/a support

2012-11-21 Thread Chris Forbes
Next few patches build on this to add other workarounds
for packed formats.

V2: rename BRW_ATTRIB_WA_COMPONENTS to BRW_ATTRIB_WA_COMPONENT_MASK;
add a separate bit for ES3 signed normalization, since it's
different.

Signed-off-by: Chris Forbes chr...@ijw.co.nz
---
 src/mesa/drivers/dri/i965/brw_vec4_visitor.cpp | 14 +++---
 src/mesa/drivers/dri/i965/brw_vs.c |  9 +
 src/mesa/drivers/dri/i965/brw_vs.h | 15 ---
 3 files changed, 24 insertions(+), 14 deletions(-)

diff --git a/src/mesa/drivers/dri/i965/brw_vec4_visitor.cpp 
b/src/mesa/drivers/dri/i965/brw_vec4_visitor.cpp
index 72766a2..4e05360 100644
--- a/src/mesa/drivers/dri/i965/brw_vec4_visitor.cpp
+++ b/src/mesa/drivers/dri/i965/brw_vec4_visitor.cpp
@@ -812,13 +812,13 @@ vec4_visitor::visit(ir_variable *ir)
* come in as floating point conversions of the integer values.
*/
   for (int i = ir-location; i  ir-location + type_size(ir-type); i++) {
-if (!c-key.gl_fixed_input_size[i])
-   continue;
-
-dst_reg dst = *reg;
- dst.type = brw_type_for_base_type(ir-type);
-dst.writemask = (1  c-key.gl_fixed_input_size[i]) - 1;
-emit(MUL(dst, src_reg(dst), src_reg(1.0f / 65536.0f)));
+ uint8_t wa_flags = c-key.gl_attrib_wa_flags[i];
+ if (wa_flags  BRW_ATTRIB_WA_COMPONENT_MASK) {
+dst_reg dst = *reg;
+dst.type = brw_type_for_base_type(ir-type);
+dst.writemask = (1  (wa_flags  BRW_ATTRIB_WA_COMPONENT_MASK)) - 
1;
+emit(MUL(dst, src_reg(dst), src_reg(1.0f / 65536.0f)));
+ }
   }
   break;
 
diff --git a/src/mesa/drivers/dri/i965/brw_vs.c 
b/src/mesa/drivers/dri/i965/brw_vs.c
index 4466731..0d2292f 100644
--- a/src/mesa/drivers/dri/i965/brw_vs.c
+++ b/src/mesa/drivers/dri/i965/brw_vs.c
@@ -362,9 +362,9 @@ brw_vs_debug_recompile(struct brw_context *brw,
}
 
for (unsigned int i = 0; i  VERT_ATTRIB_MAX; i++) {
-  found |= key_debug(GL_FIXED rescaling,
- old_key-gl_fixed_input_size[i],
- key-gl_fixed_input_size[i]);
+  found |= key_debug(Vertex attrib w/a flags,
+ old_key-gl_attrib_wa_flags[i],
+ key-gl_attrib_wa_flags[i]);
}
 
found |= key_debug(user clip flags,
@@ -446,9 +446,10 @@ static void brw_upload_vs_prog(struct brw_context *brw)
 
/* BRW_NEW_VERTICES */
for (i = 0; i  VERT_ATTRIB_MAX; i++) {
+  /* TODO: flag w/a for packed vertex formats here too */
   if (vp-program.Base.InputsRead  BITFIELD64_BIT(i) 
  brw-vb.inputs[i].glarray-Type == GL_FIXED) {
-key.gl_fixed_input_size[i] = brw-vb.inputs[i].glarray-Size;
+key.gl_attrib_wa_flags[i] = brw-vb.inputs[i].glarray-Size;
   }
}
 
diff --git a/src/mesa/drivers/dri/i965/brw_vs.h 
b/src/mesa/drivers/dri/i965/brw_vs.h
index 8edc92f..0562cea 100644
--- a/src/mesa/drivers/dri/i965/brw_vs.h
+++ b/src/mesa/drivers/dri/i965/brw_vs.h
@@ -39,13 +39,22 @@
 #include brw_program.h
 #include program/program.h
 
+/* fixup bits for gl_packed_input_flags,
+ * to enable various VS workarounds */
+#define BRW_ATTRIB_WA_COMPONENT_MASK7  /* mask for GL_FIXED scale channel 
count */
+#define BRW_ATTRIB_WA_NORMALIZE 8  /* normalize in shader */
+#define BRW_ATTRIB_WA_BGRA  16 /* swap r/b channels in shader */
+#define BRW_ATTRIB_WA_SIGN  32 /* interpret as signed in shader */
+#define BRW_ATTRIB_WA_SCALE 64 /* interpret as scaled in shader */
+#define BRW_ATTRIB_WA_NORMALIZE_ES3 128 /* normalize in shader using ES3/GL4+ 
rule */
 
 struct brw_vs_prog_key {
GLuint program_string_id;
-   /**
-* Number of channels of the vertex attribute that need GL_FIXED rescaling
+
+   /*
+* Per-attribute workaround flags
 */
-   uint8_t gl_fixed_input_size[VERT_ATTRIB_MAX];
+   uint8_t gl_attrib_wa_flags[VERT_ATTRIB_MAX];
 
/**
 * True if at least one clip flag is enabled, regardless of whether the
-- 
1.8.0

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


[Mesa-dev] [PATCH V3 5/7] i965: vs: add support for emitting SHL, SHR, ASR

2012-11-21 Thread Chris Forbes
Signed-off-by: Chris Forbes chr...@ijw.co.nz
---
 src/mesa/drivers/dri/i965/brw_vec4.h   |  3 +++
 src/mesa/drivers/dri/i965/brw_vec4_visitor.cpp | 11 +++
 2 files changed, 10 insertions(+), 4 deletions(-)

diff --git a/src/mesa/drivers/dri/i965/brw_vec4.h 
b/src/mesa/drivers/dri/i965/brw_vec4.h
index 5f35de5..ac1fb46 100644
--- a/src/mesa/drivers/dri/i965/brw_vec4.h
+++ b/src/mesa/drivers/dri/i965/brw_vec4.h
@@ -353,6 +353,9 @@ public:
vec4_instruction *DP3(dst_reg dst, src_reg src0, src_reg src1);
vec4_instruction *DP4(dst_reg dst, src_reg src0, src_reg src1);
vec4_instruction *DPH(dst_reg dst, src_reg src0, src_reg src1);
+   vec4_instruction *SHL(dst_reg dst, src_reg src0, src_reg src1);
+   vec4_instruction *SHR(dst_reg dst, src_reg src0, src_reg src1);
+   vec4_instruction *ASR(dst_reg dst, src_reg src0, src_reg src1);
vec4_instruction *CMP(dst_reg dst, src_reg src0, src_reg src1,
 uint32_t condition);
vec4_instruction *IF(src_reg src0, src_reg src1, uint32_t condition);
diff --git a/src/mesa/drivers/dri/i965/brw_vec4_visitor.cpp 
b/src/mesa/drivers/dri/i965/brw_vec4_visitor.cpp
index 4e05360..a176e8a 100644
--- a/src/mesa/drivers/dri/i965/brw_vec4_visitor.cpp
+++ b/src/mesa/drivers/dri/i965/brw_vec4_visitor.cpp
@@ -120,6 +120,9 @@ ALU2(XOR)
 ALU2(DP3)
 ALU2(DP4)
 ALU2(DPH)
+ALU2(SHL)
+ALU2(SHR)
+ALU2(ASR)
 
 /** Gen4 predicated IF. */
 vec4_instruction *
@@ -1324,14 +1327,14 @@ vec4_visitor::visit(ir_expression *ir)
   break;
 
case ir_binop_lshift:
-  inst = emit(BRW_OPCODE_SHL, result_dst, op[0], op[1]);
+  inst = emit(SHL(result_dst, op[0], op[1]));
   break;
 
case ir_binop_rshift:
   if (ir-type-base_type == GLSL_TYPE_INT)
-inst = emit(BRW_OPCODE_ASR, result_dst, op[0], op[1]);
+ inst = emit(ASR(result_dst, op[0], op[1]));
   else
-inst = emit(BRW_OPCODE_SHR, result_dst, op[0], op[1]);
+ inst = emit(SHR(result_dst, op[0], op[1]));
   break;
 
case ir_binop_ubo_load: {
@@ -1350,7 +1353,7 @@ vec4_visitor::visit(ir_expression *ir)
   if (const_offset_ir) {
  offset = src_reg(const_offset / 16);
   } else {
- emit(BRW_OPCODE_SHR, dst_reg(offset), offset, src_reg(4));
+ emit(SHR(dst_reg(offset), offset, src_reg(4)));
   }
 
   vec4_instruction *pull =
-- 
1.8.0

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


[Mesa-dev] [PATCH V3 4/7] i965: set attribute w/a bits for packed formats

2012-11-21 Thread Chris Forbes
Flag the need for various workarounds to be applied by
the vertex shader.

Signed-off-by: Chris Forbes chr...@ijw.co.nz
---
 src/mesa/drivers/dri/i965/brw_vs.c | 34 ++
 1 file changed, 30 insertions(+), 4 deletions(-)

diff --git a/src/mesa/drivers/dri/i965/brw_vs.c 
b/src/mesa/drivers/dri/i965/brw_vs.c
index 0d2292f..10a3a2e 100644
--- a/src/mesa/drivers/dri/i965/brw_vs.c
+++ b/src/mesa/drivers/dri/i965/brw_vs.c
@@ -446,10 +446,36 @@ static void brw_upload_vs_prog(struct brw_context *brw)
 
/* BRW_NEW_VERTICES */
for (i = 0; i  VERT_ATTRIB_MAX; i++) {
-  /* TODO: flag w/a for packed vertex formats here too */
-  if (vp-program.Base.InputsRead  BITFIELD64_BIT(i) 
- brw-vb.inputs[i].glarray-Type == GL_FIXED) {
-key.gl_attrib_wa_flags[i] = brw-vb.inputs[i].glarray-Size;
+  if (vp-program.Base.InputsRead  BITFIELD64_BIT(i)) {
+ uint8_t wa_flags = 0;
+
+ switch (brw-vb.inputs[i].glarray-Type) {
+
+ case GL_FIXED:
+wa_flags = brw-vb.inputs[i].glarray-Size;
+break;
+
+ case GL_INT_2_10_10_10_REV:
+wa_flags |= BRW_ATTRIB_WA_SIGN;
+/* fallthough */
+
+ case GL_UNSIGNED_INT_2_10_10_10_REV:
+if (brw-vb.inputs[i].glarray-Format == GL_BGRA)
+   wa_flags |= BRW_ATTRIB_WA_BGRA;
+
+if (brw-vb.inputs[i].glarray-Normalized) {
+   /* TODO: if need to use ES3 rules, and signed, then
+* set BRW_ATTRIB_WA_NORMALIZE_ES3 instead */
+
+   wa_flags |= BRW_ATTRIB_WA_NORMALIZE;
+}
+else if (!brw-vb.inputs[i].glarray-Integer)
+   wa_flags |= BRW_ATTRIB_WA_SCALE;
+
+break;
+ }
+
+ key.gl_attrib_wa_flags[i] = wa_flags;
   }
}
 
-- 
1.8.0

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


[Mesa-dev] [PATCH V3 6/7] i965: emit w/a for packed attribute formats in VS

2012-11-21 Thread Chris Forbes
Implements BGRA swizzle, sign recovery, and normalization
as required by ARB_vertex_type_10_10_10_2_rev.

V2: Ported to the new VS backend, since that's all that's left;
fixed normalization.

V3: Moved fixups out of the GLSL-only path, so it works for FF/VP too.

Signed-off-by: Chris Forbes chr...@ijw.co.nz
---
 src/mesa/drivers/dri/i965/brw_vec4.h   |   1 +
 src/mesa/drivers/dri/i965/brw_vec4_emit.cpp|   2 +
 src/mesa/drivers/dri/i965/brw_vec4_visitor.cpp | 124 ++---
 3 files changed, 114 insertions(+), 13 deletions(-)

diff --git a/src/mesa/drivers/dri/i965/brw_vec4.h 
b/src/mesa/drivers/dri/i965/brw_vec4.h
index ac1fb46..f0a2417 100644
--- a/src/mesa/drivers/dri/i965/brw_vec4.h
+++ b/src/mesa/drivers/dri/i965/brw_vec4.h
@@ -376,6 +376,7 @@ public:
void visit_instructions(const exec_list *list);
 
void setup_vp_regs();
+   void emit_attribute_fixups();
void emit_vertex_program_code();
void emit_vp_sop(uint32_t condmod, dst_reg dst,
 src_reg src0, src_reg src1, src_reg one);
diff --git a/src/mesa/drivers/dri/i965/brw_vec4_emit.cpp 
b/src/mesa/drivers/dri/i965/brw_vec4_emit.cpp
index a162420..dbfcd0f 100644
--- a/src/mesa/drivers/dri/i965/brw_vec4_emit.cpp
+++ b/src/mesa/drivers/dri/i965/brw_vec4_emit.cpp
@@ -776,6 +776,8 @@ vec4_visitor::generate_vs_instruction(vec4_instruction 
*instruction,
 bool
 vec4_visitor::run()
 {
+   emit_attribute_fixups();
+
/* Generate VS IR for main().  (the visitor only descends into
 * functions called main).
 */
diff --git a/src/mesa/drivers/dri/i965/brw_vec4_visitor.cpp 
b/src/mesa/drivers/dri/i965/brw_vec4_visitor.cpp
index a176e8a..f243699 100644
--- a/src/mesa/drivers/dri/i965/brw_vec4_visitor.cpp
+++ b/src/mesa/drivers/dri/i965/brw_vec4_visitor.cpp
@@ -799,6 +799,117 @@ vec4_visitor::emit_if_gen6(ir_if *ir)
emit(IF(this-result, src_reg(0), BRW_CONDITIONAL_NZ));
 }
 
+static dst_reg
+with_writemask(dst_reg const  r, int mask)
+{
+   dst_reg result = r;
+   result.writemask = mask;
+   return result;
+}
+
+void
+vec4_visitor::emit_attribute_fixups()
+{
+   dst_reg * sign_recovery_shift = NULL;
+   dst_reg * normalize_factor = NULL;
+   dst_reg * es3_normalize_factor = NULL;
+
+   for (int i = 0; i  VERT_ATTRIB_MAX; i++) {
+  if (prog_data-inputs_read  BITFIELD64_BIT(i)) {
+ uint8_t wa_flags = c-key.gl_attrib_wa_flags[i];
+ dst_reg * reg = new (mem_ctx) dst_reg(ATTR, i);
+ dst_reg reg_d = *reg;
+ reg_d.type = BRW_REGISTER_TYPE_D;
+ dst_reg reg_ud = *reg;
+ reg_ud.type = BRW_REGISTER_TYPE_UD;
+
+ /* Do GL_FIXED rescaling for GLES2.0.  Our GL_FIXED attributes
+  * come in as floating point conversions of the integer values.
+  */
+ if (wa_flags  BRW_ATTRIB_WA_COMPONENT_MASK) {
+dst_reg dst = *reg;
+dst.type = brw_type_for_base_type(glsl_type::vec4_type);
+dst.writemask = (1  (wa_flags  BRW_ATTRIB_WA_COMPONENT_MASK)) - 
1;
+emit(MUL(dst, src_reg(dst), src_reg(1.0f / 65536.0f)));
+ }
+
+ /* Do sign recovery for 2101010 formats if required. */
+ if (wa_flags  BRW_ATTRIB_WA_SIGN) {
+if (!sign_recovery_shift) {
+   // shift constant: 22,22,22,30
+   sign_recovery_shift = new (mem_ctx) dst_reg(this, 
glsl_type::uvec4_type);
+   emit(MOV(with_writemask(*sign_recovery_shift, WRITEMASK_XYZ), 
src_reg(22u)));
+   emit(MOV(with_writemask(*sign_recovery_shift, WRITEMASK_W), 
src_reg(30u)));
+}
+
+emit(SHL(reg_ud, src_reg(reg_ud), src_reg(*sign_recovery_shift)));
+emit(ASR(reg_d, src_reg(reg_d), src_reg(*sign_recovery_shift)));
+ }
+
+ /* Apply BGRA swizzle if required. */
+ if (wa_flags  BRW_ATTRIB_WA_BGRA) {
+src_reg temp = src_reg(*reg);
+temp.swizzle = BRW_SWIZZLE4(2,1,0,3);
+emit(MOV(*reg, temp));
+ }
+
+ if (wa_flags  BRW_ATTRIB_WA_NORMALIZE_ES3) {
+// 2.3 signed normalization for ES3
+// f = c / (2^(b-1)-1)
+if (!es3_normalize_factor) {
+   // mul constant: 1 / (2^(b-1) - 1)
+   es3_normalize_factor = new (mem_ctx) dst_reg(this, 
glsl_type::vec4_type);
+   emit(MOV(with_writemask(*es3_normalize_factor, WRITEMASK_XYZ),
+  src_reg(1.0f / ((19) - 1;
+   emit(MOV(with_writemask(*es3_normalize_factor, WRITEMASK_W),
+  src_reg(1.0f / ((11) - 1;
+}
+
+dst_reg dst = *reg;
+dst.type = brw_type_for_base_type(glsl_type::vec4_type);
+emit(MOV(dst, src_reg(reg_d)));
+emit(MUL(dst, src_reg(dst), src_reg(*es3_normalize_factor)));
+emit_minmax(BRW_CONDITIONAL_G, dst, src_reg(dst), src_reg(-1.0f));
+ }
+
+ if (wa_flags  BRW_ATTRIB_WA_NORMALIZE) {
+// 2.1 unsigned 

[Mesa-dev] [PATCH V3 7/7] i965: enable ARB_vertex_type_2_10_10_10_rev

2012-11-21 Thread Chris Forbes
Enabled on Gen4+.

Signed-off-by: Chris Forbes chr...@ijw.co.nz
---
 docs/GL3.txt  | 2 +-
 src/mesa/drivers/dri/intel/intel_extensions.c | 3 +++
 2 files changed, 4 insertions(+), 1 deletion(-)

diff --git a/docs/GL3.txt b/docs/GL3.txt
index 9b87e8b..aebba0b 100644
--- a/docs/GL3.txt
+++ b/docs/GL3.txt
@@ -81,7 +81,7 @@ GL_ARB_texture_rgb10_a2ui DONE 
(i965, r600)
 GL_ARB_texture_swizzleDONE (same as EXT 
version) (i965, r300, r600, swrast)
 GL_ARB_timer_queryDONE (i965)
 GL_ARB_instanced_arrays   DONE (i965, r300, r600)
-GL_ARB_vertex_type_2_10_10_10_rev DONE (r600)
+GL_ARB_vertex_type_2_10_10_10_rev DONE (i965, r600)
 
 
 GL 4.0:
diff --git a/src/mesa/drivers/dri/intel/intel_extensions.c 
b/src/mesa/drivers/dri/intel/intel_extensions.c
index 702e40f..34701ba 100755
--- a/src/mesa/drivers/dri/intel/intel_extensions.c
+++ b/src/mesa/drivers/dri/intel/intel_extensions.c
@@ -89,6 +89,9 @@ intelInitExtensions(struct gl_context *ctx)
ctx-Extensions.OES_compressed_ETC1_RGB8_texture = true;
ctx-Extensions.ARB_texture_rgb10_a2ui = true;
 
+   if (intel-gen = 4)
+   ctx-Extensions.ARB_vertex_type_2_10_10_10_rev = true;
+
if (intel-gen = 6)
   if (ctx-API == API_OPENGL_CORE) {
  ctx-Const.GLSLVersion = 140;
-- 
1.8.0

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


[Mesa-dev] [PATCH 1/2] mesa/vbo: Plumb ctx through to the conv_i(10|2)_to_norm_float functions.

2012-11-21 Thread Kenneth Graunke
The rules for converting these values actually depend on the current
context API and version.  The next patch will implement those changes.
---
 src/mesa/vbo/vbo_attrib_tmp.h | 118 +-
 1 file changed, 59 insertions(+), 59 deletions(-)

diff --git a/src/mesa/vbo/vbo_attrib_tmp.h b/src/mesa/vbo/vbo_attrib_tmp.h
index 077ca31..7ebc94e0 100644
--- a/src/mesa/vbo/vbo_attrib_tmp.h
+++ b/src/mesa/vbo/vbo_attrib_tmp.h
@@ -113,14 +113,14 @@ static inline float conv_i2_to_i(int i2)
return (float)val.x;
 }
 
-static inline float conv_i10_to_norm_float(int i10)
+static inline float conv_i10_to_norm_float(struct gl_context *ctx, int i10)
 {
struct attr_bits_10 val;
val.x = i10;
return (2.0F * (float)val.x + 1.0F) * (1.0F  / 1023.0F);
 }
 
-static inline float conv_i2_to_norm_float(int i2)
+static inline float conv_i2_to_norm_float(struct gl_context *ctx, int i2)
 {
struct attr_bits_2 val;
val.x = i2;
@@ -142,21 +142,21 @@ static inline float conv_i2_to_norm_float(int i2)
conv_i2_to_i(((I10)  30)  0x3))
 
 
-#define ATTRI10N_1( A, I10 ) ATTR( A, 1, GL_FLOAT, 
conv_i10_to_norm_float((I10)  0x3ff), 0, 0, 1 )
-#define ATTRI10N_2( A, I10 ) ATTR( A, 2, GL_FLOAT, \
-   conv_i10_to_norm_float((I10)  0x3ff),  
\
-   conv_i10_to_norm_float(((I10)  10)  0x3ff), 
0, 1 )
-#define ATTRI10N_3( A, I10 ) ATTR( A, 3, GL_FLOAT, \
-   conv_i10_to_norm_float((I10)  0x3ff),  \
-   conv_i10_to_norm_float(((I10)  10)  0x3ff), \
-   conv_i10_to_norm_float(((I10)  20)  0x3ff), 
1 )
-#define ATTRI10N_4( A, I10 ) ATTR( A, 4, GL_FLOAT, \
-   conv_i10_to_norm_float((I10)  0x3ff),  
\
-   conv_i10_to_norm_float(((I10)  10)  0x3ff), \
-   conv_i10_to_norm_float(((I10)  20)  0x3ff), \
-   conv_i2_to_norm_float(((I10)  30)  0x3))
-
-#define ATTR_UI(val, type, normalized, attr, arg) do { \
+#define ATTRI10N_1(ctx, A, I10) ATTR(A, 1, GL_FLOAT, 
conv_i10_to_norm_float(ctx, (I10)  0x3ff), 0, 0, 1 )
+#define ATTRI10N_2(ctx, A, I10) ATTR(A, 2, GL_FLOAT, \
+   conv_i10_to_norm_float(ctx, (I10)  0x3ff), 
\
+   conv_i10_to_norm_float(ctx, ((I10)  10)  
0x3ff), 0, 1 )
+#define ATTRI10N_3(ctx, A, I10) ATTR(A, 3, GL_FLOAT, \
+   conv_i10_to_norm_float(ctx, (I10)  0x3ff), 
\
+   conv_i10_to_norm_float(ctx, ((I10)  10)  
0x3ff), \
+   conv_i10_to_norm_float(ctx, ((I10)  20)  
0x3ff), 1 )
+#define ATTRI10N_4(ctx, A, I10) ATTR(A, 4, GL_FLOAT, \
+   conv_i10_to_norm_float(ctx, (I10)  0x3ff), 
\
+   conv_i10_to_norm_float(ctx, ((I10)  10)  
0x3ff), \
+   conv_i10_to_norm_float(ctx, ((I10)  20)  
0x3ff), \
+   conv_i2_to_norm_float(ctx, ((I10)  30)  0x3))
+
+#define ATTR_UI(ctx, val, type, normalized, attr, arg) do {\
if ((type) == GL_UNSIGNED_INT_2_10_10_10_REV) { \
   if (normalized) {\
 ATTRUI10N_##val((attr), (arg));\
@@ -165,7 +165,7 @@ static inline float conv_i2_to_norm_float(int i2)
   }\
}   else if ((type) == GL_INT_2_10_10_10_REV) { \
   if (normalized) {\
-ATTRI10N_##val((attr), (arg)); \
+ATTRI10N_##val(ctx, (attr), (arg));\
   } else { \
 ATTRI10_##val((attr), (arg));  \
   }\
@@ -173,11 +173,11 @@ static inline float conv_i2_to_norm_float(int i2)
   ERROR(GL_INVALID_VALUE); \
} while(0)
 
-#define ATTR_UI_INDEX(val, type, normalized, index, arg) do {  \
+#define ATTR_UI_INDEX(ctx, val, type, normalized, index, arg) do { \
   if ((index) == 0) {  \
-ATTR_UI(val, (type), normalized, 0, (arg));\
+ATTR_UI(ctx, val, (type), normalized, 0, (arg));   \
   } else if ((index)  MAX_VERTEX_GENERIC_ATTRIBS) {   \
-ATTR_UI(val, (type), normalized, VBO_ATTRIB_GENERIC0 + (index), 
(arg)); \
+ATTR_UI(ctx, val, (type), normalized, VBO_ATTRIB_GENERIC0 + (index), 
(arg)); \
   } else   \
 ERROR(GL_INVALID_VALUE);   \

[Mesa-dev] [PATCH 2/2] mesa/vbo: Support the ES 3.0 signed normalized scaling rules.

2012-11-21 Thread Kenneth Graunke
Traditionally, OpenGL has had two separate equations for converting from
signed normalized fixed-point data to floating point data.  One was used
primarily for vertex data, while the other was primarily for texturing
and framebuffer data.

However, ES 3.0 and GL 4.2 change this, declaring there's only one
equation to be used in all cases.  Unfortunately, it's the other one.
---
 src/mesa/vbo/vbo_attrib_tmp.h | 39 +--
 1 file changed, 37 insertions(+), 2 deletions(-)

Untested.

diff --git a/src/mesa/vbo/vbo_attrib_tmp.h b/src/mesa/vbo/vbo_attrib_tmp.h
index 7ebc94e0..63d2f2c 100644
--- a/src/mesa/vbo/vbo_attrib_tmp.h
+++ b/src/mesa/vbo/vbo_attrib_tmp.h
@@ -117,14 +117,49 @@ static inline float conv_i10_to_norm_float(struct 
gl_context *ctx, int i10)
 {
struct attr_bits_10 val;
val.x = i10;
-   return (2.0F * (float)val.x + 1.0F) * (1.0F  / 1023.0F);
+
+   /* Traditionally, OpenGL has had two equations for converting from
+* normalized fixed-point data to floating-point data.  In the OpenGL 3.2
+* specification, these are equations 2.2 and 2.3, respectively:
+*
+*f = (2c + 1)/(2^b - 1).(2.2)
+*
+* Comments below this equation state: In general, this representation is
+* used for signed normalized fixed-point parameters in GL commands, such
+* as vertex attribute values.  Which is what we're doing here.
+*
+*f = max{c/(2^(b-1) - 1), -1.0} (2.3)
+*
+* Comments below this equation state: In general, this representation is
+* used for signed normalized fixed-point texture or floating point values.
+*
+* OpenGL 4.2+ and ES 3.0 remedy this and state that equation 2.3 (above)
+* is used in every case.  They remove equation 2.2 completely.
+*/
+   if (_mesa_is_gles3(ctx) ||
+   (ctx-API == API_OPENGL_CORE  ctx-Version = 42)) {
+  /* Equation 2.3 above. */
+  float f = ((float) val.x) / 511.0F;
+  return MAX2(f, -1.0);
+   } else {
+  /* Equation 2.2 above. */
+  return (2.0F * (float)val.x + 1.0F) * (1.0F  / 1023.0F);
+   }
 }
 
 static inline float conv_i2_to_norm_float(struct gl_context *ctx, int i2)
 {
struct attr_bits_2 val;
val.x = i2;
-   return (2.0F * (float)val.x + 1.0F) * (1.0F / 3.0F);
+
+   if (_mesa_is_gles3(ctx) ||
+   (ctx-API == API_OPENGL_CORE  ctx-Version = 42)) {
+  /* Equation 2.3 above. */
+  return (float) val.x;
+   } else {
+  /* Equation 2.2 above. */
+  return (2.0F * (float)val.x + 1.0F) * (1.0F / 3.0F);
+   }
 }
 
 #define ATTRI10_1( A, I10 ) ATTR( A, 1, GL_FLOAT, conv_i10_to_i((I10)  
0x3ff), 0, 0, 1 )
-- 
1.8.0

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


Re: [Mesa-dev] [PATCH 2/2] mesa/vbo: Support the ES 3.0 signed normalized scaling rules.

2012-11-21 Thread Chris Forbes
On Thu, Nov 22, 2012 at 5:44 PM, Kenneth Graunke kenn...@whitecape.orgwrote:

  static inline float conv_i2_to_norm_float(struct gl_context *ctx, int i2)
  {
 struct attr_bits_2 val;
 val.x = i2;
 -   return (2.0F * (float)val.x + 1.0F) * (1.0F / 3.0F);
 +
 +   if (_mesa_is_gles3(ctx) ||
 +   (ctx-API == API_OPENGL_CORE  ctx-Version = 42)) {
 +  /* Equation 2.3 above. */
 +  return (float) val.x;


This needs to be MAX2((float)val.x, -1.0) -- otherwise 0b10 maps to -2.

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