mesa.git
10 years agoi965: Fix crash in do_blit_readpixels()
Anuj Phogat [Wed, 19 Mar 2014 18:55:50 +0000 (11:55 -0700)]
i965: Fix crash in do_blit_readpixels()

Fixes a crash in Khronos CTS packed_pixels tests.

Cc: <mesa-stable@lists.freedesktop.org>
Signed-off-by: Anuj Phogat <anuj.phogat@gmail.com>
Reviewed-by: Ian Romanick <ian.d.romanick@intel.com>
10 years agomesa: Add error condition for format=STENCIL_INDEX in glGetTexImage()
Anuj Phogat [Tue, 18 Mar 2014 23:52:24 +0000 (16:52 -0700)]
mesa: Add error condition for format=STENCIL_INDEX in glGetTexImage()

From OpenGL 4.0 spec, page 306:
   "Calling GetTexImage with a format of STENCIL_INDEX
    causes the error INVALID_ENUM."

Cc: <mesa-stable@lists.freedesktop.org>
Signed-off-by: Anuj Phogat <anuj.phogat@gmail.com>
Reviewed-by: Ian Romanick <ian.d.romanick@intel.com>
10 years agomesa: Add entry for extension ARB_texture_stencil8
Anuj Phogat [Tue, 18 Mar 2014 23:49:03 +0000 (16:49 -0700)]
mesa: Add entry for extension ARB_texture_stencil8

V2: Alphabetize the new entry

Cc: <mesa-stable@lists.freedesktop.org>
Signed-off-by: Anuj Phogat <anuj.phogat@gmail.com>
Reviewed-by: Ian Romanick <ian.d.romanick@intel.com>
10 years agoglsl: Apply the link error conditions to GL_ARB_fragment_coord_conventions
Anuj Phogat [Mon, 10 Feb 2014 22:12:40 +0000 (14:12 -0800)]
glsl: Apply the link error conditions to GL_ARB_fragment_coord_conventions

Link error conditions added in previous patch are equally applicable
to GL_ARB_fragment_coord_conventions implementation. Extension's spec
says:
   "If gl_FragCoord is redeclared in any fragment shader in a program,
    it must be redeclared in all the fragment shaders in that program
    that have a static use of gl_FragCoord. All redeclarations of
    gl_FragCoord in all fragment shaders in a single program must have
    the same set of qualifiers."

Signed-off-by: Anuj Phogat <anuj.phogat@gmail.com>
Cc: <mesa-stable@lists.freedesktop.org>
Reviewed-by: Ian Romanick <ian.d.romanick@intel.com>
10 years agoglsl: Link error if fs defines conflicting qualifiers for gl_FragCoord
Anuj Phogat [Wed, 5 Feb 2014 23:01:58 +0000 (15:01 -0800)]
glsl: Link error if fs defines conflicting qualifiers for gl_FragCoord

GLSL 1.50 spec says:
   "If gl_FragCoord is redeclared in any fragment shader in a program,
    it must be redeclared in all the fragment shaders in that
    program that have a static use gl_FragCoord. All redeclarations of
    gl_FragCoord in all fragment shaders in a single program must
    have the same set of qualifiers."

This patch causes the shader link to fail if we have multiple fragment
shaders with conflicting layout qualifiers for gl_FragCoord.

V2: Restructure the code and add conditions to correctly handle the
    following case:

fragment shader 1:
layout(origin_upper_left) in vec4 gl_FragCoord;
void main()
{
    foo();
    gl_FragColor = gl_FragData;
}

fragment shader 2:
layout(pixel_center_integer) in vec4 gl_FragCoord;
void foo()
{
}

V3:
Allow linking in the following case:
fragment shader 1:
void main()
{
    foo();
    gl_FragColor = gl_FragCoord;
}

fragment shader 2:
in vec4 gl_FragCoord;
void foo()
{
   ...
}

Signed-off-by: Anuj Phogat <anuj.phogat@gmail.com>
Cc: <mesa-stable@lists.freedesktop.org>
Reviewed-by: Ian Romanick <ian.d.romanick@intel.com>
10 years agoglsl: Compile error if fs uses gl_FragCoord before first redeclaration
Anuj Phogat [Fri, 21 Feb 2014 02:32:25 +0000 (18:32 -0800)]
glsl: Compile error if fs uses gl_FragCoord before first redeclaration

Section 4.3.8.1, page 39 of GLSL 1.50 spec says:
  "Within any shader, the first redeclarations of gl_FragCoord
   must appear before any use of gl_FragCoord."

GLSL compiler should generate an error in following case:

vec4 p = gl_FragCoord;
layout(origin_upper_left) in vec4 gl_FragCoord;

void main()
{
}

Signed-off-by: Anuj Phogat <anuj.phogat@gmail.com>
Cc: <mesa-stable@lists.freedesktop.org>
Reviewed-by: Ian Romanick <ian.d.romanick@intel.com>
10 years agoglsl: Compile error if fs defines conflicting qualifiers for gl_FragCoord
Anuj Phogat [Tue, 4 Feb 2014 18:38:18 +0000 (10:38 -0800)]
glsl: Compile error if fs defines conflicting qualifiers for gl_FragCoord

GLSL 1.50 spec says:
   "If gl_FragCoord is redeclared in any fragment shader in a program,
    it must be redeclared in all the fragment shaders in that
    program that have a static use gl_FragCoord. All redeclarations of
    gl_FragCoord in all fragment shaders in a single program must
    have the same set of qualifiers."

This patch makes the glsl compiler to generate an error if we have a
fragment shader defined with conflicting layout qualifier declarations
for gl_FragCoord. For example:

layout(origin_upper_left, pixel_center_integer) in vec4 gl_FragCoord;
layout(pixel_center_integer) in vec4 gl_FragCoord;

void main()
{
}

V2: Some code refactoring for better readability.
    Add compiler error conditions for redeclarations like:

layout(origin_upper_left) in vec4 gl_FragCoord;
layout(origin_upper_left, pixel_center_integer) in vec4 gl_FragCoord;

and

in vec4 gl_FragCoord;
layout(origin_upper_left, pixel_center_integer) in vec4 gl_FragCoord;

V3: Simplify function is_conflicting_fragcoord_redeclaration()
V4: Check for null pointer before doing strcmp(var->name, "gl_FragCoord").

Signed-off-by: Anuj Phogat <anuj.phogat@gmail.com>
Cc: <mesa-stable@lists.freedesktop.org>
Reviewed-by: Ian Romanick <ian.d.romanick@intel.com>
10 years agomesa: Use location VERT_ATTRIB_GENERIC0 for vertex attribute 0
Anuj Phogat [Sat, 29 Mar 2014 00:44:59 +0000 (17:44 -0700)]
mesa: Use location VERT_ATTRIB_GENERIC0 for vertex attribute 0

In OpenGL 3.1 attribute 0 becomes non-magic, just like in
OpenGL ES 2.0. Earlier versions of OpenGL used attribute 0
exclusively for vertex position.

V2: Add a utility function _mesa_attr_zero_aliases_vertex() in
    varray.h

Fixes 4 Khronos OpenGL CTS failures:
glGetVertexAttrib
depth24_basic
depth24_precision
rgb8_rgba8_rgb

Cc: <mesa-stable@lists.freedesktop.org>
Signed-off-by: Anuj Phogat <anuj.phogat@gmail.com>
Reviewed-by: Ian Romanick <ian.d.romanick@intel.com>
10 years agomesa: Fix querying location of nth element of an array variable
Anuj Phogat [Wed, 2 Apr 2014 20:01:43 +0000 (13:01 -0700)]
mesa: Fix querying location of nth element of an array variable

This patch makes changes to the behavior of glGetAttribLocation(),
glGetFragDataLocation() and glGetFragDataIndex() functions.

Code changes handle a case described in following example:

shader program:
layout(location = 1)in vec4[4] a;
void main()
{
}

Currently, glGetAttribLocation("a") returns 1.
glGetAttribLocation("a[i]"), where i = {0, 1, 2, 3}, returns -1.
But the expected locations for array elements are: 1, 2, 3 and 4
respectively.

This clarification came up with the addition of
ARB_program_interface_query to OpenGL 4.3.

From Page 326 (page 347 of the PDF) of OpenGL 4.3 spec:
   "Otherwise, the command is equivalent to

    GetProgramResourceLocation(program, PROGRAM_INPUT, name);"

And, From Page 101 (page 122 of the PDF) of OpenGL 4.3 spec:

   "A string provided to GetProgramResourceLocation or
    GetProgramResourceLocationIndex is considered to match an active
    variable if

    • the string exactly matches the name of the active variable;
    • if the string identifies the base name of an active array, where
      the string would exactly match the name of the variable if the
      suffix "[0]" were appended to the string; or
    • if the string identifies an active element of the array, where
      the string ends with the concatenation of the "[" character, an
      integer (with no "+" sign, extra leading zeroes, or whitespace)
      identifying an array element, and the "]" character, the integer
      is less than the number of active elements of the array variable,
      and where the string would exactly match the enumerated name of
      the array if the decimal integer were replaced with zero."

V2: Simplify get_matching_index() function.
    Add relevant text from OpenGL spec in commit message.

Fixes failures in Khronos OpenGL CTS tests:
explicit_attrib_location_room
draw_instanced_max_vertex_attribs

Proprietary linux drivers of NVIDIA (331.49) matches the behavior
expected by OpenGL 4.3 spec.

Cc: <mesa-stable@lists.freedesktop.org>
Signed-off-by: Anuj Phogat <anuj.phogat@gmail.com>
Reviewed-by: Ian Romanick <ian.d.romanick@intel.com>
10 years agoglsl: Allow overlapping locations for vertex input attributes
Anuj Phogat [Wed, 5 Mar 2014 01:03:28 +0000 (17:03 -0800)]
glsl: Allow overlapping locations for vertex input attributes

Currently overlapping locations of input variables are not allowed for all
the shader types in OpenGL and OpenGL ES.

From OpenGL ES 3.0 spec, page 56:
   "Binding more than one attribute name to the same location is referred
    to as aliasing, and is not permitted in OpenGL ES Shading Language
    3.00 vertex shaders. LinkProgram will fail when this condition exists.
    However, aliasing is possible in OpenGL ES Shading Language 1.00 vertex
    shaders."

Taking in to account what different versions of OpenGL and OpenGL ES specs
say about aliasing:
   - It is allowed only on vertex shader input attributes in OpenGL (2.0 and
     above) and OpenGL ES 2.0.
   - It is explictly disallowed in OpenGL ES 3.0.

Fixes Khronos CTS failing test:
explicit_attrib_location_vertex_input_aliased.test
See more details about this at below mentioned khronos bug.

V2: Fix the case where location exceeds the maximum allowed attribute
    location.
V3: Simplify the condition added in V2.

Signed-off-by: Anuj Phogat <anuj.phogat@gmail.com>
Cc: "9.2 10.0 10.1" <mesa-stable@lists.freedesktop.org>
Bugzilla: Khronos #9609
Reviewed-by: Ian Romanick <ian.d.romanick@intel.com>
10 years agoglx/drisw: fix memory leak when destroying screen.
Roland Scheidegger [Wed, 30 Apr 2014 23:04:31 +0000 (01:04 +0200)]
glx/drisw: fix memory leak when destroying screen.

Reviewed-by: Brian Paul <brianp@vmware.com>
10 years agogallivm: fix 2 leaks in disassembly code
Roland Scheidegger [Wed, 30 Apr 2014 22:31:47 +0000 (00:31 +0200)]
gallivm: fix 2 leaks in disassembly code

don't leak the MCSubtargetInfo (not really big, was already fixed with
llvm master) and TargetMachine (big). While this is only used for debugging
the leak is large enough to get you into trouble in some cases.
Tested with llvm 3.1 and master.
Before (llvm 3.1), GALLIVM_DEBUG=asm glxgears:
==14152== LEAK SUMMARY:
==14152==    definitely lost: 105,228 bytes in 20 blocks
==14152==    indirectly lost: 347,252 bytes in 261 blocks
==14152==      possibly lost: 866,625 bytes in 1,453 blocks
==14152==    still reachable: 7,344,677 bytes in 6,494 blocks
==14152==         suppressed: 0 bytes in 0 blocks

After:
==13799== LEAK SUMMARY:
==13799==    definitely lost: 3,108 bytes in 6 blocks
==13799==    indirectly lost: 0 bytes in 0 blocks
==13799==      possibly lost: 804,143 bytes in 1,429 blocks
==13799==    still reachable: 7,314,267 bytes in 6,473 blocks
==13799==         suppressed: 0 bytes in 0 blocks

Reviewed-by: Brian Paul <brianp@vmware.com>
10 years agomesa: Move declaration to top of block.
José Fonseca [Thu, 1 May 2014 09:00:10 +0000 (10:00 +0100)]
mesa: Move declaration to top of block.

To fix MSVC build.  Trivial.

10 years agoosmesa: Fix typo in _MaxEnabledTexImageUnit.
José Fonseca [Thu, 1 May 2014 08:55:20 +0000 (09:55 +0100)]
osmesa: Fix typo in _MaxEnabledTexImageUnit.

10 years agoi965/vec4: Port untyped atomic message support to Broadwell.
Kenneth Graunke [Fri, 18 Apr 2014 02:33:45 +0000 (19:33 -0700)]
i965/vec4: Port untyped atomic message support to Broadwell.

Bugzilla: https://bugs.freedesktop.org/show_bug.cgi?id=77221
Signed-off-by: Kenneth Graunke <kenneth@whitecape.org>
Reviewed-by: Eric Anholt <eric@anholt.net>
10 years agoi965/vec4: Port untyped surface reads support to Broadwell.
Kenneth Graunke [Fri, 18 Apr 2014 02:22:33 +0000 (19:22 -0700)]
i965/vec4: Port untyped surface reads support to Broadwell.

Bugzilla: https://bugs.freedesktop.org/show_bug.cgi?id=77221
Signed-off-by: Kenneth Graunke <kenneth@whitecape.org>
Reviewed-by: Eric Anholt <eric@anholt.net>
10 years agoi965/fs: Port untyped atomic message support to Broadwell.
Kenneth Graunke [Fri, 18 Apr 2014 01:47:38 +0000 (18:47 -0700)]
i965/fs: Port untyped atomic message support to Broadwell.

v2: Fix SIMD mode comment (caught by Eric Anholt).

Bugzilla: https://bugs.freedesktop.org/show_bug.cgi?id=77221
Signed-off-by: Kenneth Graunke <kenneth@whitecape.org>
Reviewed-by: Eric Anholt <eric@anholt.net>
10 years agoi965/fs: Port untyped surface read support to Broadwell.
Kenneth Graunke [Fri, 18 Apr 2014 01:32:52 +0000 (18:32 -0700)]
i965/fs: Port untyped surface read support to Broadwell.

v2: Drop unused num_components variable; fix SIMD Mode comment
    (caught by Eric Anholt).

Bugzilla: https://bugs.freedesktop.org/show_bug.cgi?id=77221
Signed-off-by: Kenneth Graunke <kenneth@whitecape.org>
Reviewed-by: Eric Anholt <eric@anholt.net>
10 years agoi965/fs: Set fs_inst::header_present for untyped atomics/surface reads.
Kenneth Graunke [Fri, 18 Apr 2014 17:22:13 +0000 (10:22 -0700)]
i965/fs: Set fs_inst::header_present for untyped atomics/surface reads.

The brw_eu_emit.c code manually forces the header present bit when
used in align1 (scalar) mode.  So, this has no effect currently.

However, it is nice to have fs_inst::header_present reflect reality.

Bugzilla: https://bugs.freedesktop.org/show_bug.cgi?id=77221
Signed-off-by: Kenneth Graunke <kenneth@whitecape.org>
Reviewed-by: Eric Anholt <eric@anholt.net>
10 years agoi965: Disassemble atomic operations and other DP:DC1 stuff on Broadwell.
Kenneth Graunke [Fri, 18 Apr 2014 02:07:09 +0000 (19:07 -0700)]
i965: Disassemble atomic operations and other DP:DC1 stuff on Broadwell.

This is similar to what Eric did for Gen7 a little while ago; it also
has support for untyped surface reads.

Signed-off-by: Kenneth Graunke <kenneth@whitecape.org>
Reviewed-by: Eric Anholt <eric@anholt.net>
10 years agoi965: Implement the create_raw_surface() hook on Broadwell.
Kenneth Graunke [Fri, 18 Apr 2014 01:51:02 +0000 (18:51 -0700)]
i965: Implement the create_raw_surface() hook on Broadwell.

Otherwise we crash when setting up atomic buffer objects.

Bugzilla: https://bugs.freedesktop.org/show_bug.cgi?id=77221
Signed-off-by: Kenneth Graunke <kenneth@whitecape.org>
Reviewed-by: Eric Anholt <eric@anholt.net>
10 years agoi965: Drop mark_surface_used from gen8 generators.
Kenneth Graunke [Fri, 18 Apr 2014 02:25:16 +0000 (19:25 -0700)]
i965: Drop mark_surface_used from gen8 generators.

Francisco made brw_mark_surface_used a freestanding function in
commit a32817f3c248125fb537c3a915566445e5600d45.  We should use it.

Signed-off-by: Kenneth Graunke <kenneth@whitecape.org>
Reviewed-by: Eric Anholt <eric@anholt.net>
10 years agoi965/fs: Add support for fs_inst::force_writemask_all on Broadwell.
Kenneth Graunke [Fri, 18 Apr 2014 16:56:43 +0000 (09:56 -0700)]
i965/fs: Add support for fs_inst::force_writemask_all on Broadwell.

This must not have existed when I wrote the original code.  The atomic
operation header setup code uses this.

Signed-off-by: Kenneth Graunke <kenneth@whitecape.org>
Reviewed-by: Eric Anholt <eric@anholt.net>
10 years agoi965: Actually emit PIPELINE_SELECT and 3DSTATE_VF_STATISTICS.
Kenneth Graunke [Tue, 29 Apr 2014 21:29:28 +0000 (14:29 -0700)]
i965: Actually emit PIPELINE_SELECT and 3DSTATE_VF_STATISTICS.

For platforms using hardware contexts (currently Gen6+), we failed to
emit PIPELINE_SELECT and 3DSTATE_VF_STATISTICS, instead emitting MI_NOOP
for both.

During one of the context initialization reordering patches, we
accidentally moved brw_init_state before we set brw->CMD_PIPELINE_SELECT
and brw->CMD_VF_STATISTICS.  So, when brw_init_state uploaded initial
GPU state (brw_init_state -> brw_upload_initial_gpu_state ->
brw_upload_invariant_state), these would be 0 (MI_NOOP).

Storing the commands in the context is not worthwhile.  We have many
generation checks in our state upload code, and for platforms with
hardware contexts, this only gets called once per GL context anyway.
The cost is negligable, and it's easy to botch context creation
ordering.

This may fix hangs on Gen6+ when using the media pipeline.

Cc: "10.0 10.1" <mesa-stable@lists.freedesktop.org>
Signed-off-by: Kenneth Graunke <kenneth@whitecape.org>
Reviewed-by: Eric Anholt <eric@anholt.net>
Reviewed-by: Ben Widawsky <ben@bwidawsk.net>
10 years agoi965: Don't enable reset notification support on Gen4-5.
Kenneth Graunke [Wed, 12 Mar 2014 08:43:40 +0000 (01:43 -0700)]
i965: Don't enable reset notification support on Gen4-5.

arekm reported that using Chrome with GPU acceleration enabled on GM45
triggered the hw_ctx != NULL assertion in brw_get_graphics_reset_status.

We definitely do not want to advertise reset notification support on
Gen4-5 systems, since it needs hardware contexts, and we never even
request a hardware context on those systems.

Cc: "10.1" <mesa-stable@lists.freedesktop.org>
Bugzilla: https://bugs.freedesktop.org/show_bug.cgi?id=75723
Signed-off-by: Kenneth Graunke <kenneth@whitecape.org>
10 years agodoc: Add pointer to the Mesa Stable Queue page.
Carl Worth [Wed, 30 Apr 2014 23:27:03 +0000 (16:27 -0700)]
doc: Add pointer to the Mesa Stable Queue page.

Since this is now updated daily and looks to be useful.

10 years agoi965: Fix state flag comments on color_buffer_write_enabled() calls.
Eric Anholt [Fri, 25 Apr 2014 23:49:46 +0000 (16:49 -0700)]
i965: Fix state flag comments on color_buffer_write_enabled() calls.

Reviewed-by: Kenneth Graunke <kenneth@whitecape.org>
10 years agoi965: Drop bogus state flag comment.
Eric Anholt [Fri, 25 Apr 2014 23:47:35 +0000 (16:47 -0700)]
i965: Drop bogus state flag comment.

This was introduced with the comment and code below it, though the code
only touches prog_data (CACHE_NEW_WM_PROG).

Reviewed-by: Kenneth Graunke <kenneth@whitecape.org>
10 years agoi965: Track the number of samples in the drawbuffer.
Eric Anholt [Fri, 25 Apr 2014 23:39:18 +0000 (16:39 -0700)]
i965: Track the number of samples in the drawbuffer.

This keeps us from having to emit the nonpipelined state packet on every
FBO binding.

-4.42003% +/- 1.09961% effect on cairo-perf-trace runtime on glamor (n=110).

Reviewed-by: Kenneth Graunke <kenneth@whitecape.org>
10 years agomesa: Track maximum CurrentTexUnit to reduce glDeleteTextures() overhead.
Eric Anholt [Fri, 25 Apr 2014 22:57:21 +0000 (15:57 -0700)]
mesa: Track maximum CurrentTexUnit to reduce glDeleteTextures() overhead.

No more walking 96*6 pointers looking to see if they're the current
texture, when we only use the first 2 out of 96 units.  -6.26002% +/-
1.87817% effect on cairo runtime on no-fbo-cache glamor (n=36).

Reviewed-by: Kenneth Graunke <kenneth@whitecape.org>
10 years agomesa: Rewrite shader-based texture image state updates.
Eric Anholt [Thu, 24 Apr 2014 07:57:54 +0000 (00:57 -0700)]
mesa: Rewrite shader-based texture image state updates.

Instead of walking 6 shader stages for each of the 96 combined texture
image units, now we just walk the samplers used in each shader stage.

With cairo-perf-trace on Xephyr with glamor, I'm seeing a -6.50518% +/-
2.55601% effect on runtime (n=22) since the "drop _EnabledUnits" change.
No significant performance difference on an apitrace of minecraft (n=442).

Reviewed-by: Kenneth Graunke <kenneth@whitecape.org>
10 years agomesa: Split the shader texture update logic from fixed function.
Eric Anholt [Wed, 23 Apr 2014 23:27:56 +0000 (16:27 -0700)]
mesa: Split the shader texture update logic from fixed function.

I want to avoid walking the entire long array texture image units, but the
obvious way to do so means walking program samplers, and thus hitting the
units in a random order.

This change replaces the previous behavior of only setting up the fallback
texture for a fragment shader with setting up the fallback texture for any
shader that's missing a complete texture of the right target in its unit.

Reviewed-by: Kenneth Graunke <kenneth@whitecape.org>
10 years agomesa: Finish removing the _ReallyEnabled field.
Eric Anholt [Thu, 24 Apr 2014 01:21:11 +0000 (18:21 -0700)]
mesa: Finish removing the _ReallyEnabled field.

Reviewed-by: Matt Turner <mattst88@gmail.com>
Reviewed-by: Kenneth Graunke <kenneth@whitecape.org>
10 years agoradeon: Drop the remaining driver usage of _ReallyEnabled.
Eric Anholt [Wed, 23 Apr 2014 23:37:03 +0000 (16:37 -0700)]
radeon: Drop the remaining driver usage of _ReallyEnabled.

This is kind of ugly, but I think it's worth it to finish off the last
consumers of _ReallyEnabled.

Reviewed-by: Matt Turner <mattst88@gmail.com>
Reviewed-by: Kenneth Graunke <kenneth@whitecape.org>
10 years agoswrast: Drop remaining use of _ReallyEnabled.
Eric Anholt [Thu, 24 Apr 2014 00:21:57 +0000 (17:21 -0700)]
swrast: Drop remaining use of _ReallyEnabled.

The _MaxEnabledTexImageUnit check assures us that Unit[0].Current != NULL.
This is the last consumer of _ReallyEnabled outside of the radeons.

Reviewed-by: Matt Turner <mattst88@gmail.com>
Reviewed-by: Kenneth Graunke <kenneth@whitecape.org>
10 years agogallium: Drop use of _ReallyEnabled.
Eric Anholt [Thu, 24 Apr 2014 00:21:30 +0000 (17:21 -0700)]
gallium: Drop use of _ReallyEnabled.

Reviewed-by: Matt Turner <mattst88@gmail.com>
Reviewed-by: Kenneth Graunke <kenneth@whitecape.org>
10 years agomesa: Drop _ReallyEnabled usage from ff_fragment_shader.
Eric Anholt [Thu, 24 Apr 2014 00:20:53 +0000 (17:20 -0700)]
mesa: Drop _ReallyEnabled usage from ff_fragment_shader.

Reviewed-by: Matt Turner <mattst88@gmail.com>
Reviewed-by: Kenneth Graunke <kenneth@whitecape.org>
10 years agoi915: Drop use of _ReallyEnabled.
Eric Anholt [Thu, 24 Apr 2014 00:19:41 +0000 (17:19 -0700)]
i915: Drop use of _ReallyEnabled.

We can just look at _Current's target.

Reviewed-by: Matt Turner <mattst88@gmail.com>
Reviewed-by: Kenneth Graunke <kenneth@whitecape.org>
10 years agomesa: Replace use of _ReallyEnabled as a boolean with use of _Current.
Eric Anholt [Thu, 24 Apr 2014 00:14:26 +0000 (17:14 -0700)]
mesa: Replace use of _ReallyEnabled as a boolean with use of _Current.

I'm probably not the only person that has tried to kill _ReallyEnabled.
This does the mechanical part of the work, and cleans _ReallyEnabled from
i965.

I think that using _Current makes texture management clearer: You can't
have multiple targets in use in the same texture image unit at the same
time, because there's just that one pointer.

Reviewed-by: Matt Turner <mattst88@gmail.com>
Reviewed-by: Kenneth Graunke <kenneth@whitecape.org>
10 years agomesa: Ensure that (unit->_Current != 0) == (unit->_ReallyEnabled != 0).
Eric Anholt [Wed, 23 Apr 2014 23:32:39 +0000 (16:32 -0700)]
mesa: Ensure that (unit->_Current != 0) == (unit->_ReallyEnabled != 0).

I'm going to try to delete _ReallyEnabled, which is this weird bitfield
with either 0 or 1 bits set with just the reference to _Current.

Reviewed-by: Matt Turner <mattst88@gmail.com>
Reviewed-by: Kenneth Graunke <kenneth@whitecape.org>
10 years agomesa: Drop dead last_ReallyEnabled fields from drivers.
Eric Anholt [Wed, 23 Apr 2014 23:43:20 +0000 (16:43 -0700)]
mesa: Drop dead last_ReallyEnabled fields from drivers.

Reviewed-by: Matt Turner <mattst88@gmail.com>
Reviewed-by: Kenneth Graunke <kenneth@whitecape.org>
10 years agomesa: Drop _EnabledUnits.
Eric Anholt [Wed, 23 Apr 2014 22:30:27 +0000 (15:30 -0700)]
mesa: Drop _EnabledUnits.

The field wasn't really valid, since we've got more than 32 units now.  It
turns out it was mostly just used for checking != 0, or checking for fixed
function coordinates, though.

v2: Fix mis-conversion in xm_line.c (caught by Ken).

Reviewed-by: Matt Turner <mattst88@gmail.com> (v1)
Reviewed-by: Kenneth Graunke <kenneth@whitecape.org>
10 years agoswrast: Just use _EnabledCoordUnits for figuring out which texcoords to build.
Eric Anholt [Wed, 23 Apr 2014 22:45:50 +0000 (15:45 -0700)]
swrast: Just use _EnabledCoordUnits for figuring out which texcoords to build.

_EnabledUnits is all of the first 32 image units that are used by fixed
function or programs, while _EnabledCoordUnits is just which fixed function
fragment shader texcoords need to be generated.  This is a theoretical bugfix
in the case of a vertex shader texturing from large texture image unit number
(we'd end up flagging something other than a VARYING_SLOT_TEXn as needing to
be generated), but it's actually just motivated by trying to kill
_EnabledUnits.

Reviewed-by: Matt Turner <mattst88@gmail.com>
Reviewed-by: Kenneth Graunke <kenneth@whitecape.org>
10 years agoi915: Redo texture unit walking on i830.
Eric Anholt [Wed, 23 Apr 2014 22:35:27 +0000 (15:35 -0700)]
i915: Redo texture unit walking on i830.

We now know what the max unit is in the context state.

Reviewed-by: Matt Turner <mattst88@gmail.com>
Reviewed-by: Kenneth Graunke <kenneth@whitecape.org>
10 years agoi965/vec4: Remove 'mul_arg' from try_emit_mad().
Matt Turner [Mon, 28 Apr 2014 17:30:50 +0000 (10:30 -0700)]
i965/vec4: Remove 'mul_arg' from try_emit_mad().

Reviewed-by: Ian Romanick <ian.d.romanick@intel.com>
Reviewed-by: Kenneth Graunke <kenneth@whitecape.org>
10 years agoi965/fs: Remove 'mul_arg' from try_emit_mad().
Matt Turner [Tue, 1 Apr 2014 23:42:36 +0000 (16:42 -0700)]
i965/fs: Remove 'mul_arg' from try_emit_mad().

Reviewed-by: Ian Romanick <ian.d.romanick@intel.com>
Reviewed-by: Kenneth Graunke <kenneth@whitecape.org>
10 years agomesa: change invalid texture swizzle error to GL_INVALID_ENUM
Brian Paul [Thu, 24 Apr 2014 20:44:03 +0000 (14:44 -0600)]
mesa: change invalid texture swizzle error to GL_INVALID_ENUM

The original GL_EXT_texture_swizzle extensions said GL_INVALID_OPERATION
was to be generated when the an invalid swizzle was passed to
glTexParameter().  But in OpenGL 3.3 and later, the error should be
GL_INVALID_ENUM.

Reviewed-by: Ian Romanick <ian.d.romanick@intel.com>
10 years agotranslate_sse: Use the correct buffer index in this fast path.
Andreas Hartmetz [Sun, 13 Apr 2014 20:29:35 +0000 (22:29 +0200)]
translate_sse: Use the correct buffer index in this fast path.

It is possible that there are multiple input buffers but only one is
relevant for translation. Then there will be only a single translation
group, which might need to source data from a buffer index != 0.

Fixes wrong vertex shader inputs as observed while debugging with an
application and driver combination that requires translation of a
vertex attribute in a non-trivial set of attributes and input buffers.

Reviewed-by: Ilia Mirkin <imirkin@alum.mit.edu>
10 years agoclover: Query drivers for max clock frequency
Tom Stellard [Fri, 18 Apr 2014 14:28:41 +0000 (16:28 +0200)]
clover: Query drivers for max clock frequency

Igor Gnatenko:

v2: PIPE_COMPUTE_CAP_MAX_CLOCK_FREQUENCY instead of
    PIPE_COMPUTE_MAX_CLOCK_FREQUENCY

Bruno Jiménez:

  v3: Drivers report clock in Mhz

Signed-off-by: Igor Gnatenko <i.gnatenko.brain@gmail.com>
Reviewed-by: Francisco Jerez <currojerez@riseup.net>
10 years agoradeon/compute: Implement PIPE_COMPUTE_CAP_MAX_CLOCK_FREQUENCY
Tom Stellard [Fri, 18 Apr 2014 14:28:40 +0000 (16:28 +0200)]
radeon/compute: Implement PIPE_COMPUTE_CAP_MAX_CLOCK_FREQUENCY

Igor Gnatenko:
  v2: in define RADEON_INFO_MAX_SCLK use 0x1a instead of 0x19 (upstream changes)

Bruno Jiménez:
  v3: Convert the frequency to MHz from kHz after getting it in
  'do_winsys_init'

Signed-off-by: Igor Gnatenko <i.gnatenko.brain@gmail.com>
Reviewed-by: Tom Stellard <thomas.stellard@amd.com>
10 years agogallium: Add PIPE_COMPUTE_CAP_MAX_CLOCK_FREQUENCY
Tom Stellard [Fri, 18 Apr 2014 15:35:59 +0000 (17:35 +0200)]
gallium: Add PIPE_COMPUTE_CAP_MAX_CLOCK_FREQUENCY

Bruno Jiménez:
  v2: Updated the docs
  v3: Remove trailing comma

Reviewed-by: Francisco Jerez <currojerez@riseup.net>
10 years agoi965: Fix a few base addresses on Broadwell.
Kenneth Graunke [Sun, 27 Apr 2014 05:54:36 +0000 (22:54 -0700)]
i965: Fix a few base addresses on Broadwell.

We intended to set these 64-bit addresses to 0, and set the enable bit.
But, I accidentally placed the DWord with the high bits first, when it
should have been second.

This generally worked out, by luck - presumably General State Base
Address is initially zero, and ends up remaining that way in our
contexts since we bungled the "modify enable" bit.

v2: Fix MOCS shift on GSBA.  It should be 4, and I had 2.
    (Caught by Ben Widawsky.)

Signed-off-by: Kenneth Graunke <kenneth@whitecape.org>
Reviewed-by: Ben Widawsky <ben@bwidawsk.net>
10 years agoclover: Stub implementation of CL 1.2 sub-devices.
EdB [Sun, 27 Apr 2014 17:23:25 +0000 (19:23 +0200)]
clover: Stub implementation of CL 1.2 sub-devices.

The implementation is basically a NOP but it conforms with OpenCL 1.2.

[ Francisco Jerez: Initialize property return buffer for
  CL_DEVICE_PARTITION_PROPERTIES, CL_DEVICE_PARTITION_TYPE,
  CL_DEVICE_PARTITION_AFFINITY_DOMAIN, and make the latter a scalar
  rather than a vector.  Some clean-up and code style fixes. ]

Reviewed-by: Francisco Jerez <currojerez@riseup.net>
10 years agoclover: Add clEnqueue{Marker, Barrier}WithWaitList.
EdB [Sat, 26 Apr 2014 17:11:09 +0000 (19:11 +0200)]
clover: Add clEnqueue{Marker, Barrier}WithWaitList.

Reviewed-by: Francisco Jerez <currojerez@riseup.net>
10 years agoclover: Align kernel argument sizes to nearest power of 2
Jan Vesely [Fri, 25 Apr 2014 18:24:55 +0000 (14:24 -0400)]
clover: Align kernel argument sizes to nearest power of 2

v2: use a new variable for aligned size
    add comment
    make both vars const
    only use the aligned value in argument constructors
    fix comment typo

Signed-off-by: Jan Vesely <jan.vesely@rutgers.edu>
Reviewed-by: Francisco Jerez <currojerez@riseup.net>
10 years agoclover: Avoid warnings from references to deprecated CL 1.1 APIs.
Francisco Jerez [Sat, 26 Apr 2014 11:19:37 +0000 (13:19 +0200)]
clover: Avoid warnings from references to deprecated CL 1.1 APIs.

Acked-by: Tom Stellard <thomas.stellard@amd.com>
10 years agoclover: Update OpenCL headers to version 1.2 from Khronos.
Francisco Jerez [Sat, 26 Apr 2014 10:14:59 +0000 (12:14 +0200)]
clover: Update OpenCL headers to version 1.2 from Khronos.

The C++ headers are *not* updated because they rely on CL 1.2 APIs
that we do not implement yet when the core CL 1.2 headers are present.

Acked-by: Tom Stellard <thomas.stellard@amd.com>
10 years agonvc0/ir: offset appears to come before the Z ref
Ilia Mirkin [Sun, 27 Apr 2014 00:29:47 +0000 (20:29 -0400)]
nvc0/ir: offset appears to come before the Z ref

Fixes textureGatherOffset when used with a shadow sampler. Also verified
against blob compiler with textureLodOffset manually (no piglit tests
for texture[Lod]Offset + shadow samplers).

Signed-off-by: Ilia Mirkin <imirkin@alum.mit.edu>
10 years agomesa: remove unused #pragma export on/off lines
Brian Paul [Mon, 28 Apr 2014 22:00:58 +0000 (16:00 -0600)]
mesa: remove unused #pragma export on/off lines

PRAGMA_EXPORT_SUPPORTED is never defined.

Bugzilla: https://bugs.freedesktop.org/show_bug.cgi?id=77749
Reviewed-by: Ian Romanick <ian.d.romanick@intel.com>
10 years agonv50/ir: change texture offsets to ValueRefs, allow nonconst
Ilia Mirkin [Sat, 26 Apr 2014 06:08:23 +0000 (02:08 -0400)]
nv50/ir: change texture offsets to ValueRefs, allow nonconst

This allows us to have non-constant offsets for textureGatherOffset and
textureGatherOffsets.

Signed-off-by: Ilia Mirkin <imirkin@alum.mit.edu>
10 years agonvc0/ir: do constant folding of extbf/insbf
Ilia Mirkin [Sat, 26 Apr 2014 22:44:19 +0000 (18:44 -0400)]
nvc0/ir: do constant folding of extbf/insbf

Signed-off-by: Ilia Mirkin <imirkin@alum.mit.edu>
10 years agonvc0/ir: add support for MUL_HI tgsi opcodes
Ilia Mirkin [Sat, 26 Apr 2014 04:38:39 +0000 (00:38 -0400)]
nvc0/ir: add support for MUL_HI tgsi opcodes

Signed-off-by: Ilia Mirkin <imirkin@alum.mit.edu>
10 years agonvc0/ir: add support for new bitfield manipulation opcodes
Ilia Mirkin [Sat, 26 Apr 2014 02:40:42 +0000 (22:40 -0400)]
nvc0/ir: add support for new bitfield manipulation opcodes

This adds support for:

IBFE, UBFE, BFI, LSB, IMSB, UMSB, BREV, POPC

Which are all required for ARB_gs5 support.

Signed-off-by: Ilia Mirkin <imirkin@alum.mit.edu>
10 years agotgsi: add tgsi_exec support for new bit manipulation opcodes
Ilia Mirkin [Fri, 25 Apr 2014 05:44:19 +0000 (01:44 -0400)]
tgsi: add tgsi_exec support for new bit manipulation opcodes

Signed-off-by: Ilia Mirkin <imirkin@alum.mit.edu>
Reviewed-by: Roland Scheidegger <sroland@vmware.com>
10 years agogallium/util: add helpers for bitfield manipulation
Ilia Mirkin [Fri, 25 Apr 2014 22:07:41 +0000 (18:07 -0400)]
gallium/util: add helpers for bitfield manipulation

Add bitwise reversing and signed MSB helpers for software implementation
of the new TGSI opcodes.

Signed-off-by: Ilia Mirkin <imirkin@alum.mit.edu>
Reviewed-by: Roland Scheidegger <sroland@vmware.com>
10 years agomesa/st: implement new bit manipulation opcodes
Ilia Mirkin [Fri, 25 Apr 2014 05:45:19 +0000 (01:45 -0400)]
mesa/st: implement new bit manipulation opcodes

Also pipe through [IU]MUL_HI, MAD, and lower ldexp. This provides
coverage of all new ARB_gpu_shader5 functions except uaddCarry,
usubBorrow and interpolateAt*.

Signed-off-by: Ilia Mirkin <imirkin@alum.mit.edu>
Reviewed-by: Roland Scheidegger <sroland@vmware.com>
10 years agogallium: add new opcodes for ARB_gs5 bit manipulation support
Ilia Mirkin [Fri, 25 Apr 2014 05:43:05 +0000 (01:43 -0400)]
gallium: add new opcodes for ARB_gs5 bit manipulation support

Signed-off-by: Ilia Mirkin <imirkin@alum.mit.edu>
Reviewed-by: Roland Scheidegger <sroland@vmware.com>
10 years agoglx/drisw: explicitly assign struct components for glx_*_vtable
Emil Velikov [Tue, 18 Feb 2014 19:52:26 +0000 (19:52 +0000)]
glx/drisw: explicitly assign struct components for glx_*_vtable

... to improve readability of code.

Signed-off-by: Emil Velikov <emil.l.velikov@gmail.com>
Reviewed-by: Ian Romanick <ian.d.romanick@intel.com>
Reviewed-by: Kristian Høgsberg <krh@bitplanet.net>
10 years agoglx/dri3: explicitly assign struct components for glx_*_vtable
Emil Velikov [Tue, 18 Feb 2014 19:26:27 +0000 (19:26 +0000)]
glx/dri3: explicitly assign struct components for glx_*_vtable

... to improve readability of code.

Signed-off-by: Emil Velikov <emil.l.velikov@gmail.com>
Reviewed-by: Ian Romanick <ian.d.romanick@intel.com>
Reviewed-by: Kristian Høgsberg <krh@bitplanet.net>
10 years agoglx/dri2: explicitly assign struct components for glx_*_vtable
Emil Velikov [Tue, 18 Feb 2014 19:22:29 +0000 (19:22 +0000)]
glx/dri2: explicitly assign struct components for glx_*_vtable

... to improve readability of code.

Signed-off-by: Emil Velikov <emil.l.velikov@gmail.com>
Reviewed-by: Ian Romanick <ian.d.romanick@intel.com>
Reviewed-by: Kristian Høgsberg <krh@bitplanet.net>
10 years agoglx/dri: explicitly assign struct components for glx_*_vtable
Emil Velikov [Tue, 18 Feb 2014 19:05:57 +0000 (19:05 +0000)]
glx/dri: explicitly assign struct components for glx_*_vtable

... to improve readability of code.

Signed-off-by: Emil Velikov <emil.l.velikov@gmail.com>
Reviewed-by: Ian Romanick <ian.d.romanick@intel.com>
Reviewed-by: Kristian Høgsberg <krh@bitplanet.net>
10 years agoglx/indirect: explicitly assign struct components for glx_*_vtable
Emil Velikov [Tue, 18 Feb 2014 15:51:14 +0000 (15:51 +0000)]
glx/indirect: explicitly assign struct components for glx_*_vtable

... to improve readability of code. Set indirect_screen_vtable as a static const.

Signed-off-by: Emil Velikov <emil.l.velikov@gmail.com>
Reviewed-by: Ian Romanick <ian.d.romanick@intel.com>
Reviewed-by: Kristian Høgsberg <krh@bitplanet.net>
10 years agoglx/apple: explicitly assign struct components for glx_*_vtable
Emil Velikov [Tue, 18 Feb 2014 15:46:10 +0000 (15:46 +0000)]
glx/apple: explicitly assign struct components for glx_*_vtable

... to improve readability of code. Set applegl_screen_vtable as a static const.

Signed-off-by: Emil Velikov <emil.l.velikov@gmail.com>
Reviewed-by: Ian Romanick <ian.d.romanick@intel.com>
Reviewed-by: Kristian Høgsberg <krh@bitplanet.net>
10 years agoegl_dri: rework dri extension handling
Emil Velikov [Wed, 12 Feb 2014 20:13:15 +0000 (20:13 +0000)]
egl_dri: rework dri extension handling

Use designated initialisers, and store the extensions pointers as const.

The loader extensions __DRIdri2LoaderExtension and __DRIswrastLoaderExtension
are setup by the platform backends so they should not be constified.

Signed-off-by: Emil Velikov <emil.l.velikov@gmail.com>
Reviewed-by: Ian Romanick <ian.d.romanick@intel.com>
Reviewed-by: Kristian Høgsberg <krh@bitplanet.net>
10 years agogbm: cleanup __DRI*extension handling
Emil Velikov [Sun, 16 Mar 2014 00:26:53 +0000 (00:26 +0000)]
gbm: cleanup __DRI*extension handling

Use designated initialisers, store all extension pointers as const and use
a const __DRIextensions array over assigning each element individually.

Signed-off-by: Emil Velikov <emil.l.velikov@gmail.com>
Reviewed-by: Ian Romanick <ian.d.romanick@intel.com>
10 years agodri_util: cleanup dri extension handling
Emil Velikov [Wed, 12 Feb 2014 20:47:21 +0000 (20:47 +0000)]
dri_util: cleanup dri extension handling

Explicitly set the version that is implemented, as that may differ from
the one defined in dri_interface.h. The remaining __DRI*Extensions are
treated as constants, so got ahead and declare them as such.

Signed-off-by: Emil Velikov <emil.l.velikov@gmail.com>
Reviewed-by: Ian Romanick <ian.d.romanick@intel.com>
10 years agoglx/tests: explicitly set __DRI2rendererQueryExtension members
Emil Velikov [Wed, 12 Feb 2014 21:00:02 +0000 (21:00 +0000)]
glx/tests: explicitly set __DRI2rendererQueryExtension members

While we're here use the typcast'ed name and constify.

Signed-off-by: Emil Velikov <emil.l.velikov@gmail.com>
Reviewed-by: Ian Romanick <ian.d.romanick@intel.com>
10 years agoglx/dri3: rework __DRIextension handling
Emil Velikov [Sun, 16 Mar 2014 01:17:46 +0000 (01:17 +0000)]
glx/dri3: rework __DRIextension handling

Use a const array with the extensions, rather than assigning each
one to a fixed size array at runtime.

Signed-off-by: Emil Velikov <emil.l.velikov@gmail.com>
Reviewed-by: Ian Romanick <ian.d.romanick@intel.com>
10 years agoglx/dri2: rework __DRIextension handling
Emil Velikov [Wed, 12 Feb 2014 20:14:15 +0000 (20:14 +0000)]
glx/dri2: rework __DRIextension handling

Make sure that the DRI*Extensions report the version of the interface
implemented over the listed in the headers. While both are currently
the same, this may change in the future.

v2: Keep loader extensions handling as is.

Signed-off-by: Emil Velikov <emil.l.velikov@gmail.com>
Reviewed-by: Ian Romanick <ian.d.romanick@intel.com> (v1)
Reviewed-by: Kristian Høgsberg <krh@bitplanet.net>
10 years agost/dri: cleanup dri extension handling
Emil Velikov [Wed, 12 Feb 2014 19:19:17 +0000 (19:19 +0000)]
st/dri: cleanup dri extension handling

Explicitly set the version that is implemented, as that may differ
from the one defined in dri_interface.h. Use designated initialisers
and constify whereever possible.

Note: __DRIimageExtension should not be made const as it's modified
at runtime. This patch should have no side effects on compilers that
do not support designated initialisers, as the existing code in
dri/common already uses them.

Signed-off-by: Emil Velikov <emil.l.velikov@gmail.com>
Reviewed-by: Ian Romanick <ian.d.romanick@intel.com>
Reviewed-by: Kristian Høgsberg <krh@bitplanet.net>
10 years agodri/radeon: use a const __DRIextension array
Emil Velikov [Tue, 18 Feb 2014 03:43:14 +0000 (03:43 +0000)]
dri/radeon: use a const __DRIextension array

Rather than keeping a separate and unused copy of the screen extensions
within the radeon screen, use a constant array that can be used directly
with __DRIscreen.

[Kristian Høgsberg]
The copy in the radeon screen isn't unused, that's where the array is
built and stored, the dri screen just points to that.  The pattern
here was used for cases where the extensions exported by a dri driver
could vary at runtime, for example depending on chipset.  In this
case, it's known at compile time, so it makes sense to use a static
const array instead.

Signed-off-by: Emil Velikov <emil.l.velikov@gmail.com>
Reviewed-by: Ian Romanick <ian.d.romanick@intel.com>
Reviewed-by: Kristian Høgsberg <krh@bitplanet.net>
10 years agodrivers/dri: cleanup dri extension instantiation
Emil Velikov [Wed, 12 Feb 2014 17:47:53 +0000 (17:47 +0000)]
drivers/dri: cleanup dri extension instantiation

Uniformly use the typecasted extension name, constify extension instances
and use designated initialisers. Set the implemented version of the
extension, over the one defined in dri_infertace.h. Patch covers the
following extensions:

__DRItexBufferExtension
__DRIimageExtension
__DRIrobustnessExtension
__DRI2rendererQueryExtension
__DRIdri2LoaderExtension

Signed-off-by: Emil Velikov <emil.l.velikov@gmail.com>
Reviewed-by: Ian Romanick <ian.d.romanick@intel.com>
Reviewed-by: Kristian Høgsberg <krh@bitplanet.net>
10 years agodri_interface: Update __DRItexBufferExtensionRec to version 3
Emil Velikov [Tue, 18 Feb 2014 03:04:03 +0000 (03:04 +0000)]
dri_interface: Update __DRItexBufferExtensionRec to version 3

With commit e59fa4c46c8("dri2: release texture image.") we updated the
extension without bumping the version number. The patch itself added an
interface required to enable texture_from_pixmap on certain platforms.

The new code was effectively never build, as it depended on
__DRI_TEX_BUFFER_VERSION >= 3, which never came to be in upstream mesa.

This commit bumps the version number, drops the __DRI_TEX_BUFFER_VERSION
checks and resolves all the build conflicts. Additionally it add a version
check as egl and dri3, as require version 2 of the extension which does
not have the releaseTexBuffer hook.

Cc: Juan Zhao <juan.j.zhao@intel.com>
Cc: Kristian Høgsberg <krh@bitplanet.net>
Signed-off-by: Emil Velikov <emil.l.velikov@gmail.com>
Reviewed-by: Ian Romanick <ian.d.romanick@intel.com>
Reviewed-by: Kristian Høgsberg <krh@bitplanet.net>
10 years agoCheck for dladdr(), rather than assuming we have it if we have RTLD_DEFAULT
Jon TURNEY [Sat, 5 Apr 2014 16:11:45 +0000 (17:11 +0100)]
Check for dladdr(), rather than assuming we have it if we have RTLD_DEFAULT

Unfortunately, Cygwin defines RTLD_DEFAULT (for glibc compatibility), but can't
provide dladdr(), so add a check for dladdr()

Since I don't think scons is ever used to build for Cygwin, just set HAVE_DLADDR
in SConscript, assuming that if we have RTLD_DEFAULT, we have dladdr().

Cc: Jonathan Gray <jsg@jsg.id.au>
Signed-off-by: Jon TURNEY <jon.turney@dronecode.org.uk>
Reviewed-by: Eric Anholt <eric@anholt.net>
10 years agoutil: Fix cross-compiles between endiannesses
Richard Sandiford [Wed, 19 Mar 2014 17:11:02 +0000 (17:11 +0000)]
util: Fix cross-compiles between endiannesses

The old python code used sys.is_big_endian to select between little-endian
and big-endian formats, which meant that the build and host endiannesses
needed to be the same.  This patch instead generates both big- and little-
endian layouts, using PIPE_ARCH_BIG_ENDIAN to select between them.

Signed-off-by: Richard Sandiford <rsandifo@linux.vnet.ibm.com>
Signed-off-by: José Fonseca <jfonseca@vmware.com>
10 years agoutil: Split out channel-parsing Python code
Richard Sandiford [Wed, 19 Mar 2014 17:10:12 +0000 (17:10 +0000)]
util: Split out channel-parsing Python code

Splits out the code that parses the channel list, so that we
can have different lists for little and big endian.

There is no change to the generated u_format_table.c.

Signed-off-by: Richard Sandiford <rsandifo@linux.vnet.ibm.com>
Signed-off-by: José Fonseca <jfonseca@vmware.com>
10 years agoutil: Split out channel-printing Python code
Richard Sandiford [Wed, 19 Mar 2014 17:09:45 +0000 (17:09 +0000)]
util: Split out channel-printing Python code

Rather than iterate over format.channels and format.swizzles directly,
use Python subfunctions that take the channel and swizzle lists as
arguments.  This allow the channel and swizzle lists to depend on
endianness.

There is no change to the generated u_format_table.c.

Signed-off-by: Richard Sandiford <rsandifo@linux.vnet.ibm.com>
Signed-off-by: José Fonseca <jfonseca@vmware.com>
10 years agoutil: Turn inv_swizzle into a global function
Richard Sandiford [Wed, 19 Mar 2014 17:09:14 +0000 (17:09 +0000)]
util: Turn inv_swizzle into a global function

With the big-endian changes, there can be two swizzle orders for each format.
This patch turns Format.inv_swizzle() into a global function that takes the
swizzle list as a parameter.

There is no change to the generated u_format_table.c.

Signed-off-by: Richard Sandiford <rsandifo@linux.vnet.ibm.com>
Signed-off-by: José Fonseca <jfonseca@vmware.com>
10 years agoutil: Add more query methods to u_format_parse.Format
Richard Sandiford [Wed, 19 Mar 2014 17:08:44 +0000 (17:08 +0000)]
util: Add more query methods to u_format_parse.Format

The main aim is to reduce the number of places that access channels[0],
swizzles[0] and swizzles[1] directly.

There is no change to the generated u_format_table.c.

Signed-off-by: Richard Sandiford <rsandifo@linux.vnet.ibm.com>
Signed-off-by: José Fonseca <jfonseca@vmware.com>
10 years agost/mesa: Fix NULL pointer dereference for incomplete framebuffers
Michel Dänzer [Fri, 25 Apr 2014 02:40:39 +0000 (11:40 +0900)]
st/mesa: Fix NULL pointer dereference for incomplete framebuffers

This can happen with glamor, which uses EGL_KHR_surfaceless_context and
only explicitly binds GL_READ_FRAMEBUFFER for glReadPixels.

Cc: mesa-stable@lists.freedesktop.org
Reviewed-by: Brian Paul <brianp@vmware.com>
10 years agoglsl: fix spelling of derived
Chris Forbes [Sun, 27 Apr 2014 04:49:18 +0000 (16:49 +1200)]
glsl: fix spelling of derived

Signed-off-by: Chris Forbes <chrisf@ijw.co.nz>
10 years agodocs: mark off nv50/nvc0 for ARB_sample_shading, update relnotes
Ilia Mirkin [Sat, 26 Apr 2014 16:38:31 +0000 (12:38 -0400)]
docs: mark off nv50/nvc0 for ARB_sample_shading, update relnotes

relnotes weren't updated this whole time, so I went through all the
GL3.txt changes and picked out the nouveau ones since 10.1.

Signed-off-by: Ilia Mirkin <imirkin@alum.mit.edu>
Reviewed-by: Ian Romanick <ian.d.romanick@intel.com>
10 years agomesa: overhaul debug namespace support
Chia-I Wu [Thu, 24 Apr 2014 03:17:32 +0000 (11:17 +0800)]
mesa: overhaul debug namespace support

_mesa_HashTable is not well-suited for us: it locks a mutex unnecessarily and
it does not accept 0 as the key (and have branches to handle 1 specially).
What we really need is a sparse array.  Whether it should be implemented as a
hash table, a list, or a bsearch()-able array requires investigations of the
use models.

We choose to implement it as a list for now, assuming it is common to have a
short list of IDs in each (source, type) namespace.  The code is simpler, and
the memory footprint is lower.  This also fixes several corner cases such as
making messages to have different states at different severities.

v2: use GLbitfield for State/DefaultState, and add a comment

Signed-off-by: Chia-I Wu <olv@lunarg.com>
Reviewed-by: Brian Paul <brianp@vmware.com>
10 years agomesa: delay copying of debug groups
Chia-I Wu [Wed, 23 Apr 2014 07:19:55 +0000 (15:19 +0800)]
mesa: delay copying of debug groups

Do not copy the debug group until it is about to be written.  One likely
scenario of using glPushDebugGroup/glPopDebugGroup is to enclose a sequence of
GL commands and give them a human-readable description.  There is no message
control change in this scenario, and thus no need to copy.

This also reduces the initial size of gl_debug_state from 306KB to 7KB.

Signed-off-by: Chia-I Wu <olv@lunarg.com>
Reviewed-by: Brian Paul <brianp@vmware.com>
10 years agomesa: clean up debug output namespace handling
Chia-I Wu [Wed, 23 Apr 2014 06:17:55 +0000 (14:17 +0800)]
mesa: clean up debug output namespace handling

Add functions to provide these operations on a struct gl_debug_namespace:

  init():    initialize the namespace
  copy():    copy all elements from one namespace to another
  clear():   clear all elements (to free the memories)
  set():     set the value of an element
  set_all(): set the value of all elements
  get():     get the value of an element

A debug namespace is like a sparse array.  The length of the array is huge,
2^sizeof(GLuint), but most of the elements assume the same value sepcified by
set_all().

Signed-off-by: Chia-I Wu <olv@lunarg.com>
Reviewed-by: Brian Paul <brianp@vmware.com>
10 years agomesa: clean up debug groups
Chia-I Wu [Wed, 23 Apr 2014 05:42:24 +0000 (13:42 +0800)]
mesa: clean up debug groups

Add struct gl_debug_group to hold all namespaces of a debug group.  Replace
the 3-dimensional array, Namespaces, in struct gl_debug_state by a
1-dimensional array of type struct gl_debug_groups.

Turn the 4-dimensional array, Defaults, in struct gl_debug_state to a
1-dimensional array in struct gl_debug_namespace.

Signed-off-by: Chia-I Wu <olv@lunarg.com>
Reviewed-by: Brian Paul <brianp@vmware.com>
10 years agomesa: clean up debug message log
Chia-I Wu [Wed, 23 Apr 2014 05:32:10 +0000 (13:32 +0800)]
mesa: clean up debug message log

Remove NextMsgLength, and move members of struct gl_debug_state that belong to
the message log to a new struct, gl_debug_log.  Rename gl_debug_msg to
gl_debug_message.

Signed-off-by: Chia-I Wu <olv@lunarg.com>
Reviewed-by: Brian Paul <brianp@vmware.com>
10 years agomesa: use accessors for struct gl_debug_state
Chia-I Wu [Tue, 22 Apr 2014 06:22:49 +0000 (14:22 +0800)]
mesa: use accessors for struct gl_debug_state

When GL_DEBUG_OUTPUT_SYNCHRONOUS is GL_TRUE, drivers are allowed to log debug
messages from other threads.  That requires gl_debug_state to be protected by
a mutex, even when it is a context state.  While we do not spawn threads in
Mesa yet, this commit makes it easier to do when we want to.

Since the definition of struct gl_debug_state is no longer needed by the rest
of the driver, move it to main/errors.c.  This should make it even harder to
use the struct incorrectly.

v2: add comments for the accessors

Signed-off-by: Chia-I Wu <olv@lunarg.com>
Reviewed-by: Brian Paul <brianp@vmware.com>
10 years agomesa: eliminate debug output message_insert
Chia-I Wu [Tue, 22 Apr 2014 06:36:25 +0000 (14:36 +0800)]
mesa: eliminate debug output message_insert

Add validate_length, and call it together with log_msg directly instead of
message_insert.  No functional change.

v2: make sure length is non-negative (i.e., known) before calling
    validate_length, noted by Timothy Arceri

Signed-off-by: Chia-I Wu <olv@lunarg.com>
Reviewed-by: Brian Paul <brianp@vmware.com>
10 years agomesa: eliminate debug output should_log
Chia-I Wu [Tue, 22 Apr 2014 05:54:17 +0000 (13:54 +0800)]
mesa: eliminate debug output should_log

In both call sites, it could be easily replaced by direct
debug_is_message_enabled calls.  No functional change.

Signed-off-by: Chia-I Wu <olv@lunarg.com>
Reviewed-by: Brian Paul <brianp@vmware.com>