mesa.git
11 years agoclover: Pass corresponding module::argument to kernel::argument::bind().
Francisco Jerez [Sat, 20 Jul 2013 22:43:18 +0000 (00:43 +0200)]
clover: Pass corresponding module::argument to kernel::argument::bind().

And remove size information from most kernel::argument derived
classes, it's no longer going to be necessary.

Cc: mesa-stable@lists.freedesktop.org
Reviewed-by: Tom Stellard <thomas.stellard@amd.com>
11 years agoclover: Return correct value for CL_DEVICE_ENDIAN_LITTLE
Tom Stellard [Wed, 10 Jul 2013 04:21:40 +0000 (21:21 -0700)]
clover: Return correct value for CL_DEVICE_ENDIAN_LITTLE

Query the driver using PIPE_CAP_ENDIANNESS rather than always returning
true.

Cc: mesa-stable@lists.freedesktop.org
Reviewed-by: Francisco Jerez <currojerez@riseup.net>
11 years agogallium: Add PIPE_CAP_ENDIANNESS
Tom Stellard [Wed, 10 Jul 2013 04:21:39 +0000 (21:21 -0700)]
gallium: Add PIPE_CAP_ENDIANNESS

Cc: mesa-stable@lists.freedesktop.org
[ Francisco Jerez: Fix "PIPE_ENDIAN_SMALL" in the documentation,
  define PIPE_ENDIAN_NATIVE. ]

11 years agoconfigure.ac: Use correct options names in AC_ARG_ENABLE.
Matt Turner [Sun, 10 Mar 2013 01:35:12 +0000 (17:35 -0800)]
configure.ac: Use correct options names in AC_ARG_ENABLE.

11 years agoegl/build: Remove unused GLAPI_LIB.
Matt Turner [Sun, 10 Mar 2013 01:29:19 +0000 (17:29 -0800)]
egl/build: Remove unused GLAPI_LIB.

11 years agobuild: Remove unused EGL_PLATFORMS.
Matt Turner [Sun, 10 Mar 2013 01:26:43 +0000 (17:26 -0800)]
build: Remove unused EGL_PLATFORMS.

11 years agobuild: Add tests directories to SUBDIRS
Matt Turner [Mon, 21 Jan 2013 02:00:14 +0000 (18:00 -0800)]
build: Add tests directories to SUBDIRS

Fixes a problem with distcheck.

11 years agollvmpipe: Ensure FTZ/DAZ flags are set on deferred draw flushes.
Zack Rusin [Mon, 22 Jul 2013 17:08:48 +0000 (18:08 +0100)]
llvmpipe: Ensure FTZ/DAZ flags are set on deferred draw flushes.

Tested-by: José Fonseca <jfonseca@vmware.com>
11 years agollvmpipe: Remove lp_rast_get_num_threads().
José Fonseca [Mon, 22 Jul 2013 17:08:39 +0000 (18:08 +0100)]
llvmpipe: Remove lp_rast_get_num_threads().

Never called.

Trivial.

11 years agoscons: Don't use -z defs ld option on Mac.
José Fonseca [Sun, 21 Jul 2013 08:55:04 +0000 (09:55 +0100)]
scons: Don't use -z defs ld option on Mac.

Should fix fdo bug 67098.

11 years agoglsl: Initialize ast_function member variables.
Vinson Lee [Sun, 10 Feb 2013 00:38:53 +0000 (01:38 +0100)]
glsl: Initialize ast_function member variables.

Fixes "Uninitialized pointer field" defect reported by Coverity.

Signed-off-by: Vinson Lee <vlee@freedesktop.org>
11 years agoApple: glFlush() is not needed with CGLFlushDrawable()
Jeremy Huddleston Sequoia [Sat, 20 Jul 2013 17:25:28 +0000 (10:25 -0700)]
Apple: glFlush() is not needed with CGLFlushDrawable()

<rdar://problem/14496373>

Signed-off-by: Jeremy Huddleston Sequoia <jeremyhu@apple.com>
11 years agoutil/u_math: Define NAN/INFINITY macros for MSVC.
José Fonseca [Fri, 19 Jul 2013 23:31:18 +0000 (00:31 +0100)]
util/u_math: Define NAN/INFINITY macros for MSVC.

Untested. But should hopefully fix the build.

11 years agollvmpipe/tests: update arith test to check for edge cases
Zack Rusin [Thu, 18 Jul 2013 07:33:22 +0000 (03:33 -0400)]
llvmpipe/tests: update arith test to check for edge cases

Test infs, zeros and nans with our arith functions to assure
correct/defined behavior with those values.

Signed-off-by: Zack Rusin <zackr@vmware.com>
Reviewed-by: Jose Fonseca <jfonseca@vmware.com>
Reviewed-by: Roland Scheidegger <sroland@vmware.com>
11 years agogallivm: add a log function that handles edge cases
Zack Rusin [Thu, 18 Jul 2013 07:32:02 +0000 (03:32 -0400)]
gallivm: add a log function that handles edge cases

Same as log2_safe, which means that it can handle infs, 0s and
nans.

Signed-off-by: Zack Rusin <zackr@vmware.com>
Reviewed-by: Jose Fonseca <jfonseca@vmware.com>
Reviewed-by: Roland Scheidegger <sroland@vmware.com>
11 years agogallivm: export unordered/ordered cmp to a common function
Zack Rusin [Thu, 18 Jul 2013 07:05:01 +0000 (03:05 -0400)]
gallivm: export unordered/ordered cmp to a common function

Only the floating point operarators change everything else
is the same so it makes sense to share the code.

Signed-off-by: Zack Rusin <zackr@vmware.com>
Reviewed-by: Jose Fonseca <jfonseca@vmware.com>
Reviewed-by: Roland Scheidegger <sroland@vmware.com>
11 years agogallivm: handle -inf, inf and nan's in sin/cos instructions
Zack Rusin [Wed, 17 Jul 2013 20:55:52 +0000 (16:55 -0400)]
gallivm: handle -inf, inf and nan's in sin/cos instructions

sin/cos for anything not finite is nan and everything else has
to be between [-1, 1].

Signed-off-by: Zack Rusin <zackr@vmware.com>
Reviewed-by: Jose Fonseca <jfonseca@vmware.com>
Reviewed-by: Roland Scheidegger <sroland@vmware.com>
11 years agogallivm: add a version of log2 which handles edge cases
Zack Rusin [Tue, 16 Jul 2013 19:57:11 +0000 (15:57 -0400)]
gallivm: add a version of log2 which handles edge cases

That means that if input is:
 * - less than zero (to and including -inf) then NaN will be returned
 * - equal to zero (-denorm, -0, +0 or +denorm), then -inf will be returned
 * - +infinity, then +infinity will be returned
 * - NaN, then NaN will be returned
It's a separate function because the checks are a little bit costly
and in most cases are likely unnecessary.

Signed-off-by: Zack Rusin <zackr@vmware.com>
Reviewed-by: Jose Fonseca <jfonseca@vmware.com>
Reviewed-by: Roland Scheidegger <sroland@vmware.com>
11 years agogallivm: fix edge cases in exp2
Zack Rusin [Thu, 18 Jul 2013 06:38:54 +0000 (02:38 -0400)]
gallivm: fix edge cases in exp2

exp(0) has to be exactly 1, exp(-inf) has to be 0, exp(inf) has
to be inf and exp(nan) has to be nan, this fixes all of those
cases.

Signed-off-by: Zack Rusin <zackr@vmware.com>
Reviewed-by: Jose Fonseca <jfonseca@vmware.com>
Reviewed-by: Roland Scheidegger <sroland@vmware.com>
11 years agogallivm: handle nan's in min/max
Zack Rusin [Tue, 16 Jul 2013 17:06:24 +0000 (13:06 -0400)]
gallivm: handle nan's in min/max

Both D3D10 and OpenCL say that if one the inputs is nan then
the other should be returned. To preserve that behavior
the patch fixes both the sse and the non-sse paths in both
functions and adds helper code for handling nans.

Signed-off-by: Zack Rusin <zackr@vmware.com>
Reviewed-by: Jose Fonseca <jfonseca@vmware.com>
Reviewed-by: Roland Scheidegger <sroland@vmware.com>
11 years agoscons: Disallow undefined symbols in Xlib libGL.so.
José Fonseca [Fri, 19 Jul 2013 12:08:07 +0000 (13:08 +0100)]
scons: Disallow undefined symbols in Xlib libGL.so.

It's not the first time that, due to missing build dependencies or
incomplete commits, we end up with a broken libGL.so that's missing
symbols, causing all tests to fail catastrophically.

Instead try to catch this sort of issues earlier.

11 years agomesa: Dispatch ARB_framebuffer_object and EXT_framebuffer_object differently
Tomasz Lis [Tue, 16 Jul 2013 18:57:26 +0000 (20:57 +0200)]
mesa: Dispatch ARB_framebuffer_object and EXT_framebuffer_object differently

Almost all of the functions between the ARB and the EXT share the same
GLX protocol because the functionality is, essentially, identical.
However, there are some differences between the extensions:

- In the ARB extension, names must come from glGenBuffers.

- In the ARB extension, framebuffer objects are not shared (but they are
  in the EXT).

For these reasons, glBindFramebuffer and glBindRenderbuffer have
different GLX protocol opcodes than their EXT counterparts.  Currently
these functions alias each other in the dispatch table.  This makes it
impossible to be truly spec conformant.

This patch enables fixing the conformance issue by splitting
glBindFramebuffer / glBindFramebufferEXT and glBindRenderbuffer /
glBindRenderbufferEXT into separate dispatch table entries.

Patches will be available shortly to:

- Fix the conformance issue.

- Stop advertising the EXT in OpenGL 3.1 (or core profiles).

HOWEVER, this does represent a compatibility break between the loader
(libGL or the Xserver GLX module) and the driver.  Mesa drivers compiled
without this change will request a single dispatch table entry for
glBindFramebuffer and glBindFramebufferEXT.  Since the updated loader
has different entries for each, the request will fail, and the driver
will die in a fire.

Drivers built with the change should continue to load fine on loaders
without the change.  In this case, the driver will separately ask for
entries for glBindFramebuffer and glBindFramebufferEXT, and the loader
will tell it the same location.  Since the loader in the server's GLX
module is not (yet) updated, this should not be a problem.  We also do
not advertise the ARB extension from the server, so, again, this should
not be a problem for the server.

HOWEVER, this means that DRI1 drivers (remember mga_dri.so?) will no
longer load with libGL build hereafter.  That means this patch will need
to be back ported to the 8.0 branch.

v2 (idr): Added missing GLX protocol opcodes for the EXT functions and
corrected the opcodes for the ARB functions.  Updated GLX indirect_api
unit test and dispatch sanity unit test.

Signed-off-by: Tomasz Lis <tomasz.lis@intel.com>
Signed-off-by: Bartosz Zawistowski <bartosz.l.zawistowski@intel.com>
Signed-off-by: Ian Romanick <ian.d.romanick@intel.com>
Reviewed-by: Ian Romanick <ian.d.romanick@intel.com> [v1]
11 years agost/mesa: Enable the ARB_shading_language_420pack extension for 1.30+.
Kenneth Graunke [Thu, 18 Jul 2013 18:49:44 +0000 (11:49 -0700)]
st/mesa: Enable the ARB_shading_language_420pack extension for 1.30+.

Any driver that supports GLSL 1.30 should be able to handle this
extension, as it's entirely implemented in the GLSL compiler.

Signed-off-by: Kenneth Graunke <kenneth@whitecape.org>
Reviewed-by: Marek Olšák <maraeo@gmail.com>
11 years agoi965: Enable the GL_ARB_shading_language_420pack extension on Gen6+.
Kenneth Graunke [Thu, 18 Jul 2013 01:18:00 +0000 (18:18 -0700)]
i965: Enable the GL_ARB_shading_language_420pack extension on Gen6+.

While all the work is in the shared GLSL compiler, this extension
requires GLSL 1.30, which is currently only supported on Gen6+.

Signed-off-by: Kenneth Graunke <kenneth@whitecape.org>
Reviewed-by: Paul Berry <stereotype441@gmail.com>
11 years agoglsl: Handle the binding qualifier for UBO variables.
Kenneth Graunke [Thu, 18 Jul 2013 01:11:55 +0000 (18:11 -0700)]
glsl: Handle the binding qualifier for UBO variables.

layout(binding = N) is equivalent to calling glUniformBlockBinding(_,N).

This currently only handles the GLSL 1.40 case - no interface names, no
arrays of uniform blocks.  This is okay since we don't yet support GLSL
1.50, and don't expose ARB_shading_language_420pack in ES 3.0.

v2: Move into the other function; use binding, not constant_value.

Signed-off-by: Kenneth Graunke <kenneth@whitecape.org>
Acked-by: Paul Berry <stereotype441@gmail.com>
11 years agoglsl: Propagate UBO binding qualifier into UBO member variables.
Kenneth Graunke [Thu, 18 Jul 2013 01:06:57 +0000 (18:06 -0700)]
glsl: Propagate UBO binding qualifier into UBO member variables.

Without an instance name, there is no ir_variable representing the
actual uniform block declaration.  When the linker goes to set uniform
initializers, it only sees the members as ir_variables; never the block.

So, unfortunately, the members need to know about the binding.

There has to be a better way to do this.

Signed-off-by: Kenneth Graunke <kenneth@whitecape.org>
Reviewed-by: Paul Berry <stereotype441@gmail.com>
11 years agoglsl: Handle the binding qualifier for arrays of samplers.
Kenneth Graunke [Wed, 17 Jul 2013 18:24:11 +0000 (11:24 -0700)]
glsl: Handle the binding qualifier for arrays of samplers.

Normally, uniform array variables are initialized by array literals.
That is, val->type->array_elements >= storage->array_elements.

However, samplers are different.  Consider a declaration such as:

   layout(binding = 5) uniform sampler2D[3];

The initializer value is a single integer (5), while the storage has 3
array elements.  The proper behavior here is to increment one for each
element; they should be initialized to 5, 6, and 7.

This patch introduces new code for sampler types which handles both
arrays of samplers and single samplers correctly.

v2: Move into the other function; use binding, not constant_value.

Signed-off-by: Kenneth Graunke <kenneth@whitecape.org>
Acked-by: Paul Berry <stereotype441@gmail.com>
11 years agoglsl: Add plumbing for handling uniform binding qualifiers.
Kenneth Graunke [Thu, 18 Jul 2013 21:28:05 +0000 (14:28 -0700)]
glsl: Add plumbing for handling uniform binding qualifiers.

Sampler uniforms and uniform blocks do not have a var->constant_value.
Instead, they have an integer var->binding value.

This makes extending set_uniform_initializer() somewhat problematic: it
assumes that there is an ir_constant * which represents the initializer,
and that it's safe to dereference that without any NULL checks.

Instead, this patch creates an analogous function for binding
qualifiers, and calls one or the other as appropriate.

Signed-off-by: Kenneth Graunke <kenneth@whitecape.org>
Reviewed-by: Paul Berry <stereotype441@gmail.com>
11 years agoglsl: Delete unused code for handling samplers in array-initializers.
Kenneth Graunke [Wed, 17 Jul 2013 18:45:57 +0000 (11:45 -0700)]
glsl: Delete unused code for handling samplers in array-initializers.

There is existing code to handle sampler uniform initializers.  Prior to
GLSL 4.20's "binding" keyword, sampler uniforms don't have initializers
at all, so this is somewhat surprising.

The existing code is broken into two cases: one where both the variable and
initializer are arrays, and a second where the variable and initializer are
scalars.

The first case should never occur, since array-typed initializers do not
exist for sampler uniforms.  Even with the binding keyword, the
initializer is a single integer which represents the texture unit to use
for the first array element.

The second is apparently used for some fixed-function code.

v2: Rewrite the commit message - suggested by Paul.

Signed-off-by: Kenneth Graunke <kenneth@whitecape.org>
Reviewed-by: Paul Berry <stereotype441@gmail.com>
11 years agoglsl: Cross-validate explicit binding points.
Kenneth Graunke [Tue, 16 Jul 2013 19:18:57 +0000 (12:18 -0700)]
glsl: Cross-validate explicit binding points.

All compilation units need to agree on the binding point, if they
specify one at all.

v2: Use binding, not constant_value.

Signed-off-by: Kenneth Graunke <kenneth@whitecape.org>
Reviewed-by: Paul Berry <stereotype441@gmail.com>
11 years agoglsl: Propagate explicit binding information from AST to IR.
Kenneth Graunke [Thu, 18 Jul 2013 22:11:57 +0000 (15:11 -0700)]
glsl: Propagate explicit binding information from AST to IR.

Rather than creating a new "binding" field in ir_variable, we reuse
constant_value since the linker code for handling uniform initializers
uses that.

Since UBOs and samplers can't otherwise have initializers/constant
values, there shouldn't be a conflict.

v2: Propagate the new binding variable around too.

Signed-off-by: Kenneth Graunke <kenneth@whitecape.org>
Reviewed-by: Paul Berry <stereotype441@gmail.com>
11 years agoglsl: Add ir_variable fields for explicit bindings.
Kenneth Graunke [Thu, 18 Jul 2013 22:10:49 +0000 (15:10 -0700)]
glsl: Add ir_variable fields for explicit bindings.

These are not used yet, but they exist and are copied appropriately.

v2: Add an explicit "int binding" variable rather than reusing
    constant_value, as suggested by Paul Berry.

Signed-off-by: Kenneth Graunke <kenneth@whitecape.org>
Reviewed-by: Paul Berry <stereotype441@gmail.com>
11 years agoglsl: Add validation for the "binding" qualifier.
Kenneth Graunke [Tue, 16 Jul 2013 19:03:28 +0000 (12:03 -0700)]
glsl: Add validation for the "binding" qualifier.

The "binding" qualifier only applies to UBO blocks and samplers, along
with arrays of those types.  (It would also apply to images and atomic
counters, but we don't support those yet.)

This also validates sampler bindings against the maximum number of
texture units, and UBO bindings against the number of uniform buffer
binding points.

Signed-off-by: Kenneth Graunke <kenneth@whitecape.org>
Reviewed-by: Paul Berry <stereotype441@gmail.com>
11 years agoglsl: Parse the "binding" keyword and store it in ast_type_qualifier.
Kenneth Graunke [Tue, 16 Jul 2013 05:20:03 +0000 (22:20 -0700)]
glsl: Parse the "binding" keyword and store it in ast_type_qualifier.

Nothing actually uses this yet.

v2: Remove >= 0 checks.  They'll be handled in later validation.

Signed-off-by: Kenneth Graunke <kenneth@whitecape.org>
Reviewed-by: Paul Berry <stereotype441@gmail.com>
11 years agoglsl: Have the lexer return LAYOUT_TOK if 420pack is enabled.
Kenneth Graunke [Wed, 17 Jul 2013 17:39:59 +0000 (10:39 -0700)]
glsl: Have the lexer return LAYOUT_TOK if 420pack is enabled.

GL_ARB_shading_language_420pack also provides layout qualifiers.

Signed-off-by: Kenneth Graunke <kenneth@whitecape.org>
Reviewed-by: Paul Berry <stereotype441@gmail.com>
11 years agoglsl: Use has_layout() rather than a partial open coded version.
Kenneth Graunke [Tue, 16 Jul 2013 18:39:01 +0000 (11:39 -0700)]
glsl: Use has_layout() rather than a partial open coded version.

The idea of this code is to disallow layout(...) sections with the
deprecated "varying" or "attribute" keywords, unless a few select
extensions are enabled which allow a more relaxed check.

In order to detect a layout(...) section, the code checks for a number
of layout qualifiers.  However, it failed to check for all of them,
which could lead to layout(...) not being detected when it should.

By replacing this with has_layout(), we properly check for all layout
qualifiers, and also guarantees that new qualifiers added in the future
will not be forgotten.

Signed-off-by: Kenneth Graunke <kenneth@whitecape.org>
Reviewed-by: Paul Berry <stereotype441@gmail.com>
11 years agoglsl: Relax auxiliary storage ordering requirements with 420pack.
Kenneth Graunke [Tue, 16 Jul 2013 02:01:28 +0000 (19:01 -0700)]
glsl: Relax auxiliary storage ordering requirements with 420pack.

These were already semi-relaxed, since the storage qualifier rule
already skipped when 420pack was enabled.

Signed-off-by: Kenneth Graunke <kenneth@whitecape.org>
Reviewed-by: Matt Turner <mattst88@gmail.com>
11 years agoglsl: Handle centroid qualifier ordering in C code, not the parser.
Kenneth Graunke [Sun, 14 Jul 2013 02:35:02 +0000 (19:35 -0700)]
glsl: Handle centroid qualifier ordering in C code, not the parser.

The GL_ARB_shading_language_420pack extension/GLSL 4.20 split centroid
off into a new category, "auxiliary storage qualifiers," and allow these
to be placed anywhere in the series.  So we have to stop recognizing
"centroid in"/"centroid out"/"centroid varying" in the grammar and get
more creative.

The same approach used before works here, too.

Signed-off-by: Kenneth Graunke <kenneth@whitecape.org>
Reviewed-by: Matt Turner <mattst88@gmail.com>
11 years agoglsl: Allow precision qualifiers to be flexibly ordered with 420pack.
Kenneth Graunke [Tue, 16 Jul 2013 01:42:26 +0000 (18:42 -0700)]
glsl: Allow precision qualifiers to be flexibly ordered with 420pack.

Signed-off-by: Kenneth Graunke <kenneth@whitecape.org>
Reviewed-by: Matt Turner <mattst88@gmail.com>
11 years agoglsl: Move precision handling to be part of qualifier handling.
Kenneth Graunke [Mon, 15 Jul 2013 22:58:29 +0000 (15:58 -0700)]
glsl: Move precision handling to be part of qualifier handling.

This is necessary for the parser to be able to accept precision
qualifiers not immediately adjacent to the type, such as "const highp
inout float foo".

Signed-off-by: Kenneth Graunke <kenneth@whitecape.org>
Reviewed-by: Matt Turner <mattst88@gmail.com>
11 years agoglsl: Change is_precision_statement to default_precision != none.
Kenneth Graunke [Mon, 15 Jul 2013 22:39:35 +0000 (15:39 -0700)]
glsl: Change is_precision_statement to default_precision != none.

Currently, we store precision in ast_type_specifier, rather than
ast_type_qualifier.  This works because precision is the last qualifier,
and immediately adjacent to the type.

Default precision statements (such as "precision highp float") are
represented as ast_type_specifier objects, with a boolean to indicate
that it's a default precision statement rather than an ordinary type.

ast_type_specifier::precision will be moving to ast_type_qualifier soon,
in order to support arbitrary qualifier ordering.  However, we still
need to store a "this is a precision statement" flag /and/ the default
precision in ast_type_specifier.

This patch changes the boolean into a new field, default_precision.
If default_precision != ast_precision_none, it's a precision statement
with the specified precision.  Otherwise, it's an ordinary type.

Signed-off-by: Kenneth Graunke <kenneth@whitecape.org>
Reviewed-by: Matt Turner <mattst88@gmail.com>
11 years agoglsl: Disable ordering checks for const parameters with 420pack.
Kenneth Graunke [Tue, 16 Jul 2013 00:02:21 +0000 (17:02 -0700)]
glsl: Disable ordering checks for const parameters with 420pack.

This makes the complier accept both "const in" and "in const".

Signed-off-by: Kenneth Graunke <kenneth@whitecape.org>
Reviewed-by: Matt Turner <mattst88@gmail.com>
11 years agoglsl: Handle "const" as a parameter qualifier.
Kenneth Graunke [Mon, 15 Jul 2013 22:06:31 +0000 (15:06 -0700)]
glsl: Handle "const" as a parameter qualifier.

This will make it easy to support both "const in" and "in const", as
required by GLSL 4.20/ARB_shading_language_420pack.

Signed-off-by: Kenneth Graunke <kenneth@whitecape.org>
Reviewed-by: Matt Turner <mattst88@gmail.com>
11 years agoglsl: Refactor parameter qualifier handling.
Kenneth Graunke [Mon, 15 Jul 2013 18:45:24 +0000 (11:45 -0700)]
glsl: Refactor parameter qualifier handling.

"Parameter direction qualifier" is a new term I invented just now; it's
not part of any GLSL specification.

This paves the way handling multiple parameter qualifiers, in any order,
as required by GLSL 4.20/ARB_shading_language_420pack.

Signed-off-by: Kenneth Graunke <kenneth@whitecape.org>
Reviewed-by: Matt Turner <mattst88@gmail.com>
11 years agoglsl: Use merge_qualifier() when processing qualifier lists.
Kenneth Graunke [Mon, 15 Jul 2013 17:50:35 +0000 (10:50 -0700)]
glsl: Use merge_qualifier() when processing qualifier lists.

Most of ast_type_qualifier is simply a bitfield (represented as a
structure of unsigned:1 bits in a union with an unsigned).  However, it
also contains ARB_explicit_attrib_location's location/index fields.

In the past, this has worked by simply returning the layout qualifier's
ast_type_qualifier and merging the other bits into it.  However, that's
not obvious until you break it by switching $1 and $2.

Using merge_qualifier() copies them appropriately, and also properly
overrides layout qualifiers.  It also checks for duplicate qualifiers,
which renders some of the checks in the previous patch unnecessary.
However, those checks provide better error messages, such as "Duplicate
interpolation qualifier", rather than just "duplicate qualifier".

Signed-off-by: Kenneth Graunke <kenneth@whitecape.org>
Reviewed-by: Matt Turner <mattst88@gmail.com>
11 years agoglsl: Allow duplicate layout qualifiers with 420pack.
Kenneth Graunke [Thu, 18 Jul 2013 23:31:05 +0000 (16:31 -0700)]
glsl: Allow duplicate layout qualifiers with 420pack.

The new 4.20 rules explicitly allow multiple layout(...) sections.

Signed-off-by: Kenneth Graunke <kenneth@whitecape.org>
Reviewed-by: Matt Turner <mattst88@gmail.com>
11 years agoglsl: Disable ordering checks on most qualifiers for 420pack.
Kenneth Graunke [Mon, 15 Jul 2013 23:11:00 +0000 (16:11 -0700)]
glsl: Disable ordering checks on most qualifiers for 420pack.

This makes the compiler accept invariant, storage, layout, and
interpolation qualifiers in any order when ARB_shading_language_420pack
is enabled.

Signed-off-by: Kenneth Graunke <kenneth@whitecape.org>
Reviewed-by: Matt Turner <mattst88@gmail.com>
11 years agoglsl: Handle most qualifier ordering in C code rather than the grammar.
Kenneth Graunke [Sat, 13 Jul 2013 22:27:52 +0000 (15:27 -0700)]
glsl: Handle most qualifier ordering in C code rather than the grammar.

The GL_ARB_shading_language_420pack extension/GLSL 4.20 allow qualifiers
to be specified in (basically) any order.  In order to support this, we
can't hardcode the ordering restrictions in the grammar.

This patch alters the grammar to accept invariant, storage, layout, and
interpolation qualifiers in any order, but adds C code to enforce the
ordering requirements.  In the 420pack case, we should be able to simply
skip the error checks.

As a bonus, this also lets us generate decent error messages, rather
than Bison's awful "unexpected TOKEN" errors.

Signed-off-by: Kenneth Graunke <kenneth@whitecape.org>
Reviewed-by: Matt Turner <mattst88@gmail.com>
11 years agoglsl: Add a new ast_type_qualifier::has_auxiliary_storage() method.
Kenneth Graunke [Sun, 14 Jul 2013 02:20:37 +0000 (19:20 -0700)]
glsl: Add a new ast_type_qualifier::has_auxiliary_storage() method.

"Auxiliary storage qualifiers" is the new term given to "centroid",
"patch", and "sample" by GLSL 4.20/GL_ARB_shading_language_420pack.

Even though we only support "centroid", it's useful to add this now
so that all auxiliary storage qualifiers get handled in the right places
once they're eventually supported.

Signed-off-by: Kenneth Graunke <kenneth@whitecape.org>
Reviewed-by: Matt Turner <mattst88@gmail.com>
11 years agoglsl: Add a new ast_type_qualifier::has_storage() method.
Kenneth Graunke [Sat, 13 Jul 2013 05:36:31 +0000 (22:36 -0700)]
glsl: Add a new ast_type_qualifier::has_storage() method.

This makes it easy to check if any storage qualifiers are set.

"centroid" is not considered a storage qualifier.  In the old language
rules, you can't specify "centroid" by itself; it's always "centroid
in", "centroid out", or "centroid varying."  So one of the other storage
qualifiers will always be set; there's no need to specifically check for
centroid.

In the new 4.20 rules, centroid is an auxiliary storage qualifier, not a
storage qualifier.

Signed-off-by: Kenneth Graunke <kenneth@whitecape.org>
Reviewed-by: Matt Turner <mattst88@gmail.com>
11 years agoglsl: Add a new ast_type_qualifier::has_layout() method.
Kenneth Graunke [Sat, 13 Jul 2013 05:34:19 +0000 (22:34 -0700)]
glsl: Add a new ast_type_qualifier::has_layout() method.

This makes it easy to check if any layout qualifiers are set.

Signed-off-by: Kenneth Graunke <kenneth@whitecape.org>
Reviewed-by: Matt Turner <mattst88@gmail.com>
11 years agoi965: Combine URB code emission into a single group.
Kenneth Graunke [Thu, 11 Jul 2013 17:24:15 +0000 (10:24 -0700)]
i965: Combine URB code emission into a single group.

All four URB packets need to be programmed together in order for the GPU
state to be valid.  Putting them in separate BEGIN..ADVANCE blocks is
risky: if we're nearing the end of a batch, the batch could be flushed
inbetween two of the commands, causing the URB programming to be split
into two batchbuffers.

This -might- be okay with hardware contexts, but it offers no advantages
over keeping them together, and has a potential for hangs.

Putting them into a single BEGIN..ADVANCE block ensures they'll be kept
in the same batch, which seems wise.

Signed-off-by: Kenneth Graunke <kenneth@whitecape.org>
11 years agoi965/hsw: Change L3 MOCS for depth, hiz, and stencil
Chad Versace [Thu, 18 Jul 2013 17:07:30 +0000 (10:07 -0700)]
i965/hsw: Change L3 MOCS for depth, hiz, and stencil

Change from "not cacheable" to "cacheable" in L3.
Do so for the draw upload path and blorp.

Reviewed-by: Kenneth Graunke <kenneth@whitecape.org>
Signed-off-by: Chad Versace <chad.versace@linux.intel.com>
11 years agoi965/hsw: Change L3 MOCS of 3DSTATE_CONSTANT_VS/PS
Chad Versace [Thu, 18 Jul 2013 17:04:17 +0000 (10:04 -0700)]
i965/hsw: Change L3 MOCS of 3DSTATE_CONSTANT_VS/PS

Change from "not cacheable" to "cacheable" in L3.
Do so for the draw upload path and blorp.

In blorp, change only the PS packet, because the VS packet is disabled.

Reviewed-by: Kenneth Graunke <kenneth@whitecape.org>
Signed-off-by: Chad Versace <chad.versace@linux.intel.com>
11 years agoi965/hsw: Change L3 MOCS of SURFACE_STAT
Chad Versace [Thu, 18 Jul 2013 17:00:15 +0000 (10:00 -0700)]
i965/hsw: Change L3 MOCS of SURFACE_STAT

Change from "not cacheable" to "cacheable" in L3.
Do so for the draw upload path and blorp.

Reviewed-by: Kenneth Graunke <kenneth@whitecape.org>
Signed-off-by: Chad Versace <chad.versace@linux.intel.com>
11 years agoi965/hsw: Change L3 MOCS of 3DSTATE_VERTEX_BUFFERS
Chad Versace [Thu, 18 Jul 2013 16:58:06 +0000 (09:58 -0700)]
i965/hsw: Change L3 MOCS of 3DSTATE_VERTEX_BUFFERS

Change from "not cacheable" to "cacheable" in L3.
Do so for the draw upload path and blorp.

Reviewed-by: Kenneth Graunke <kenneth@whitecape.org>
Signed-off-by: Chad Versace <chad.versace@linux.intel.com>
11 years agoglx: Enable floating-point fbconfig extensions
Tomasz Lis [Wed, 17 Jul 2013 11:49:23 +0000 (13:49 +0200)]
glx: Enable floating-point fbconfig extensions

Signed-off-by: Tomasz Lis <listom@gmail.com>
Reviewed-by: Ian Romanick <ian.d.romanick@intel.com>
11 years agoegl: Drop configs with unknown or invalide __DRI_ATTRIB_RENDER_TYPE
Ian Romanick [Thu, 18 Jul 2013 22:13:45 +0000 (15:13 -0700)]
egl: Drop configs with unknown or invalide __DRI_ATTRIB_RENDER_TYPE

Some render types, such as floating-point, aren't valid with EGL.
Return NULL in those cases to drop them.

Signed-off-by: Ian Romanick <ian.d.romanick@intel.com>
11 years agodri: Introduce new flags in __DRI_ATTRIB_RENDER_TYPE
Tomasz Lis [Wed, 17 Jul 2013 11:49:21 +0000 (13:49 +0200)]
dri: Introduce new flags in __DRI_ATTRIB_RENDER_TYPE

Mark __DRI_ATTRIB_FLOAT_MODE as deprecated, and introduce new flags to
__DRI_ATTRIB_RENDER_TYPE for float modes.  Both signed float
(fbconfig_float) and unsigned (packed_float) are introduced. The old
attribute should be set for both float modes.

v2 (idr): Require that the render mode from the DRI attributes matches the
render mode of the config exactly.  This is the behavior of the old code.

Signed-off-by: Tomasz Lis <tomasz.lis@intel.com>
Signed-off-by: Ian Romanick <ian.d.romanick@intel.com>
Reviewed-by: Ian Romanick <ian.d.romanick@intel.com>
11 years agoglx: Require proper drawableType in init_fbconfig_for_chooser
Tomasz Lis [Wed, 17 Jul 2013 11:49:20 +0000 (13:49 +0200)]
glx: Require proper drawableType in init_fbconfig_for_chooser

Make sure that init_fbconfig_for_chooser sets correct value of
drawableType for visual configs and fbconfigs.

Signed-off-by: Tomasz Lis <tomasz.lis@intel.com>
Reviewed-by: Ian Romanick <ian.d.romanick@intel.com>
11 years agoglx: Validate the GLX_RENDER_TYPE value
Tomasz Lis [Thu, 18 Jul 2013 21:19:38 +0000 (14:19 -0700)]
glx: Validate the GLX_RENDER_TYPE value

Correctly handle the value of renderType in GLX context.  In case of the
value being incorrect, context creation fails.

v2 (idr): indirect_create_context is just a memory allocator, so don't
validate the GLX_RENDER_TYPE there.  Fixes regressions in several
GLX_ARB_create_context piglit tests.

Signed-off-by: Tomasz Lis <tomasz.lis@intel.com>
Signed-off-by: Ian Romanick <ian.d.romanick@intel.com>
Reviewed-by: Ian Romanick <ian.d.romanick@intel.com>
11 years agoglx: Store the RENDER_TYPE in indirect rendering
Tomasz Lis [Wed, 17 Jul 2013 11:49:18 +0000 (13:49 +0200)]
glx: Store the RENDER_TYPE in indirect rendering

v2 (idr): Open-code the check for GLX_RENDER_TYPE.
dri2_convert_glx_attribs can't be called from here because that function
only exists in direct-rendering builds.  Also add a stub version of
indirect_create_context_attribs to tests/fake_glx_screen.cpp to prevent
'make check' regressions.

Signed-off-by: Tomasz Lis <tomasz.lis@intel.com>
Signed-off-by: Ian Romanick <ian.d.romanick@intel.com>
Reviewed-by: Ian Romanick <ian.d.romanick@intel.com>
11 years agoglx: Handling RENDER_TYPE in glXCreateContext and init_fbconfig_for_chooser
Tomasz Lis [Wed, 17 Jul 2013 11:49:17 +0000 (13:49 +0200)]
glx: Handling RENDER_TYPE in glXCreateContext and init_fbconfig_for_chooser

Set the correct values of renderType in glXCreateContext and
init_fbconfig_for_chooser.

Signed-off-by: Tomasz Lis <tomasz.lis@intel.com>
Reviewed-by: Ian Romanick <ian.d.romanick@intel.com>
11 years agoglx: Changes to visual configs initialization.
Tomasz Lis [Wed, 17 Jul 2013 11:49:16 +0000 (13:49 +0200)]
glx: Changes to visual configs initialization.

Correctly handle the value of renderType and drawableType in
fbconfig. Modify glXInitializeVisualConfigFromTags to read the parameter
value, or detect it if it's not there.

v2 (idr): If there was no GLX_RENDER_TYPE property, set the type based
purely on the rgbMode as the previous code did.  It is impossible for
floatMode to be set at this point, so we can't have a float config.  The
previous code regressed a large number of piglit GLX tests because those
tests don't set GLX_RENDER_TYPE in the glXChooseConfig call.  Restoring
the old behavior for that case fixes those regressions.

Also fix handling of GLX_DONT_CARE for GLX_RENDER_TYPE.  Fixes a
regression in glx-dont-care-mask.

Signed-off-by: Tomasz Lis <tomasz.lis@intel.com>
Signed-off-by: Ian Romanick <ian.d.romanick@intel.com>
Reviewed-by: Ian Romanick <ian.d.romanick@intel.com>
11 years agoglx: Retrieve the value of RENDER_TYPE from GLX attribs array
Tomasz Lis [Wed, 17 Jul 2013 11:49:15 +0000 (13:49 +0200)]
glx: Retrieve the value of RENDER_TYPE from GLX attribs array

Make sure that context creation routines are provided with the value of
RENDER_TYPE retrieved from GLX attribs.

v2 (idr): Minor formatting changes.  Change type of
dri2_convert_glx_attribs render_type parameter to uint32_t to silence
some GCC warnings.

Signed-off-by: Tomasz Lis <tomasz.lis@intel.com>
Signed-off-by: Ian Romanick <ian.d.romanick@intel.com>
Reviewed-by: Ian Romanick <ian.d.romanick@intel.com>
11 years agoglx: Store the value of renderType while creating context
Tomasz Lis [Wed, 17 Jul 2013 11:49:14 +0000 (13:49 +0200)]
glx: Store the value of renderType while creating context

Make sure that renderType property value is stored in GLX context while
it's being created.  Further patches will be provided to make the value
correspond to fbconfig's renderType.

v2 (idr): Move a hunk from the next patch to this patch to prevent a
build break.

Signed-off-by: Tomasz Lis <tomasz.lis@intel.com>
Signed-off-by: Ian Romanick <ian.d.romanick@intel.com>
Reviewed-by: Ian Romanick <ian.d.romanick@intel.com>
11 years agoi965: Add #defines for Memory Object Control State fields on Gen7-7.5.
Kenneth Graunke [Wed, 10 Jul 2013 03:47:54 +0000 (20:47 -0700)]
i965: Add #defines for Memory Object Control State fields on Gen7-7.5.

The L3 controls are identical on all platforms, but LLC differs:
- Ivybridge has a "cache in LLC" flag
- Baytrail has no LLC, but instead has a snoop bit:
  "data accesses in this page must be snooped in the CPU caches."
- Haswell has writeback/uncached flags for LLC and eLLC (eDRAM).

Signed-off-by: Kenneth Graunke <kenneth@whitecape.org>
Reviewed-by: Chad Versace <chad.versace@linux.intel.com>
11 years agoglsl/linker: Use correct array length when linking inter-stage uniforms and varyings.
Fabian Bieler [Fri, 14 Jun 2013 11:37:07 +0000 (13:37 +0200)]
glsl/linker: Use correct array length when linking inter-stage uniforms and varyings.

Reviewed-by: Paul Berry <stereotype441@gmail.com>
Reviewed-by: Ian Romanick <ian.d.romanick@intel.com>
Signed-off-by: Fabian Bieler <fabianbieler@fastmail.fm>
11 years agogen_matypes: fix cross-compiling with gcc
Mike Frysinger [Tue, 5 Feb 2013 02:27:40 +0000 (21:27 -0500)]
gen_matypes: fix cross-compiling with gcc

The current gen_matypes logic assumes that the host compiler will produce
information that is useful for the target compiler.  Unfortunately, this
is not the case whenever cross-compiling.

When we detect that we're cross-compiling and using GCC, use the target
compiler to produce assembly from the gen_matypes.c source, then process
it with a shell script to create a usable header.  This is similar to how
the linux kernel creates its asm-offsets.c file.

Reviewed-by: Matt Turner <mattst88@gmail.com>
Signed-off-by: Mike Frysinger <vapier@gentoo.org>
11 years agoax_prog_flex.m4: change grep syntax to accept e.g. flex.real
Andreas Oberritter [Mon, 15 Apr 2013 20:46:06 +0000 (22:46 +0200)]
ax_prog_flex.m4: change grep syntax to accept e.g. flex.real

This is required in case a wrapper or symlink is used. This patch
has also been sent upstream, awaiting moderation.

Reviewed-by: Matt Turner <mattst88@gmail.com>
Signed-off-by: Andreas Oberritter <obi@saftware.de>
11 years agobuiltin_compiler/build: Avoid using libtool if cross compiling
Jonathan Liu [Tue, 4 Jun 2013 13:03:55 +0000 (23:03 +1000)]
builtin_compiler/build: Avoid using libtool if cross compiling

Adds the dependencies of builtin_compiler as sources when cross
compiling instead of using libtool to share compilation with src/glsl.
The builtin_compiler executable is built for the host when cross
compiling so it doesn't make sense to share compilation with src/glsl
built for the target in this case.

Bugzilla: https://bugs.freedesktop.org/show_bug.cgi?id=44618
Reviewed-by: Matt Turner <mattst88@gmail.com>
Signed-off-by: Jonathan Liu <net147@gmail.com>
11 years agoi965: Add MOCS shift and mask for SURFACE_STATE entries.
Kenneth Graunke [Wed, 1 May 2013 00:54:23 +0000 (17:54 -0700)]
i965: Add MOCS shift and mask for SURFACE_STATE entries.

Signed-off-by: Kenneth Graunke <kenneth@whitecape.org>
Reviewed-by: Chad Versace <chad.versace@linux.intel.com>
11 years agollvmpipe: clamp inputs for srgb render buffers
Roland Scheidegger [Thu, 18 Jul 2013 00:10:27 +0000 (02:10 +0200)]
llvmpipe: clamp inputs for srgb render buffers

Usually with fixed point renderbuffers clamping is done as part of conversion.
However, since we blend in float format, we essentially skip all conversion
steps pre-blend but since this is still a fixed point renderbuffer we must
still clamp the inputs in this case. Makes no difference for piglit though.
Obviously we could skip this if fragment color clamping is enabled, but a)
this is deprecated in OpenGL (d3d never had it) and b) we don't support it
natively so it gets baked into the shader.
Also add some comment about logic ops being broken for srgb, luckily no test
tries to do that as there's no easy fix...

Reviewed-by: Jose Fonseca <jfonseca@vmware.com>
Reviewed-by: Zack Rusin <zackr@vmware.com>
11 years agollvmpipe: fix blending with SRC_ALPHA_SATURATE with some formats without alpha
Roland Scheidegger [Thu, 18 Jul 2013 00:05:34 +0000 (02:05 +0200)]
llvmpipe: fix blending with SRC_ALPHA_SATURATE with some formats without alpha

We were fixing up the blend factor to ZERO, however this only works correctly
with fixed point render buffers where the input values are clamped to 0/1
(because src_alpha_saturate is min(As, 1-Ad) so can be negative with unclamped
inputs). Haven't seen any failure anywhere due to that with fixed point SNORM
buffers (which clamp inputs to -1/1) but it should apply there as well (snorm
blending is rare, even opengl 4.3 doesn't require snorm rendertargets at all,
d3d10 requires them but they are not blendable).
Doesn't look like piglit hits this though (some internal testing hits the
float case at least). (With legacy OpenGL we could theoretically still use the
fixup to zero if the fragment color clamp is enabled, but we can't detect that
easily since we don't support native clamping hence it gets baked into the
shader.)

Reviewed-by: Jose Fonseca <jfonseca@vmware.com>
Reviewed-by: Zack Rusin <zackr@vmware.com>
11 years agor600g: use WAIT_3D_IDLE before using CP DMA
Marek Olšák [Tue, 16 Jul 2013 20:48:48 +0000 (22:48 +0200)]
r600g: use WAIT_3D_IDLE before using CP DMA

I broke this with 7948ed1250cae78ae1b22dbce4ab23aceacc6159 for r700 at least.

11 years agor300g: make use of gallium's os_get_process_name()
Jonathan Gray [Thu, 18 Jul 2013 06:44:25 +0000 (16:44 +1000)]
r300g: make use of gallium's os_get_process_name()

Lets the code compile on non Linux systems.

Signed-off-by: Jonathan Gray <jsg@jsg.id.au>
Signed-off-by: Marek Olšák <maraeo@gmail.com>
11 years agoconfigure.ac: On some systems, "x86-64" is called "amd64"
Jean-Sébastien Pédron [Wed, 5 Jun 2013 11:27:37 +0000 (13:27 +0200)]
configure.ac: On some systems, "x86-64" is called "amd64"

For instance, this is the case on FreeBSD.

Signed-off-by: Vinson Lee <vlee@freedesktop.org>
11 years agonv50: H.264/MPEG2 decoding support via VP2, available on NV84-NV96, NVA0
Ilia Mirkin [Tue, 16 Jul 2013 21:50:43 +0000 (17:50 -0400)]
nv50: H.264/MPEG2 decoding support via VP2, available on NV84-NV96, NVA0

Adds H.264 and MPEG2 codec support via VP2, using firmware from the
blob. Acceleration is supported at the bitstream level for H.264 and
IDCT level for MPEG2.

Known issues:
 - H.264 interlaced doesn't render properly
 - H.264 shows very occasional artifacts on a small fraction of videos
 - MPEG2 + VDPAU shows frequent but small artifacts, which aren't there
   when using XvMC on the same videos

Signed-off-by: Ilia Mirkin <imirkin@alum.mit.edu>
11 years agoconfigure.ac: make grep tests more portable
Jonathan Gray [Thu, 20 Jun 2013 10:14:33 +0000 (20:14 +1000)]
configure.ac: make grep tests more portable

Use grep -w instead of the empty string escape sequences
which are less portable.  Makes the grep tests
function as intended on OpenBSD.

Signed-off-by: Jonathan Gray <jsg@jsg.id.au>
Reviewed-by: Vinson Lee <vlee@freedesktop.org>
Signed-off-by: Vinson Lee <vlee@freedesktop.org>
11 years agoconfigure.ac: add OpenBSD
Jonathan Gray [Wed, 26 Jun 2013 07:11:57 +0000 (17:11 +1000)]
configure.ac: add OpenBSD

Signed-off-by: Jonathan Gray <jsg@jsg.id.au>
Reviewed-by: Vinson Lee <vlee@freedesktop.org>
Signed-off-by: Vinson Lee <vlee@freedesktop.org>
11 years agoglsl: Remove comma at end of enumerator list.
Vinson Lee [Thu, 18 Jul 2013 03:51:50 +0000 (20:51 -0700)]
glsl: Remove comma at end of enumerator list.

Fixes this build error on OpenBSD 5.3.

In file included from ../../src/mesa/main/ff_fragment_shader.cpp:53:
./../glsl/ir_optimization.h:64: error: comma at end of enumerator list

Signed-off-by: Vinson Lee <vlee@freedesktop.org>
11 years agomesa: Remove commas at end of enumerator lists.
Vinson Lee [Thu, 18 Jul 2013 03:42:03 +0000 (20:42 -0700)]
mesa: Remove commas at end of enumerator lists.

Fixes these build errors on OpenBSD 5.3.

In file included from ../../src/mesa/main/errors.h:47,
                 from ../../src/mesa/main/imports.h:41,
                 from ../../src/mesa/main/ff_fragment_shader.cpp:32:
../../src/mesa/main/mtypes.h:3286: error: comma at end of enumerator list
../../src/mesa/main/mtypes.h:3296: error: comma at end of enumerator list
../../src/mesa/main/mtypes.h:3303: error: comma at end of enumerator list
../../src/mesa/main/mtypes.h:3356: error: comma at end of enumerator list

Signed-off-by: Vinson Lee <vlee@freedesktop.org>
11 years agodocs: Import 9.1.5 release notes
Carl Worth [Thu, 18 Jul 2013 03:10:50 +0000 (20:10 -0700)]
docs: Import 9.1.5 release notes

And add news item for the release.

11 years agogallivm: (trivial) simplify lp_build_cos/lp_build_sin a tiny bit
Roland Scheidegger [Wed, 17 Jul 2013 16:13:41 +0000 (18:13 +0200)]
gallivm: (trivial) simplify lp_build_cos/lp_build_sin a tiny bit

Use "or" instead of "add" (this is a classic select sequence, which at
least newer llvm versions can actually recognize (3.2+?), and the "add"
might prevent that - and we really don't want an add instead of an or with
avx if it isn't recognized (even without avx logic ops might be cheaper)).

Reviewed-by: Jose Fonseca <jfonseca@vmware.com>
11 years agoutil/u_format_s3tc: handle srgb formats correctly.
Roland Scheidegger [Wed, 17 Jul 2013 16:13:10 +0000 (18:13 +0200)]
util/u_format_s3tc: handle srgb formats correctly.

Instead of just ignoring the srgb/linear conversions, simply call the
corresponding conversion functions, for all of pack/unpack/fetch,
both for float and unorm8 versions (though some don't make a whole
lot of sense, i.e. unorm8/unorm8 srgb/linear combinations).
Refactored some functions a bit so don't have to duplicate all the code
(there's a slight change for packing dxt1_rgb, as there will now be
always 4 components initialized and sent to the external compression
function so the same code can be used for all, the quite horrid and
ad-hoc interface (by now) should always have worked with that).

Fixes llvmpipe/softpipe piglit texwrap GL_EXT_texture_sRGB-s3tc.

Reviewed-by: Jose Fonseca <jfonseca@vmware.com>
11 years agor600g/sb: improve alu packing on cayman
Vadim Girlin [Wed, 17 Jul 2013 14:29:56 +0000 (18:29 +0400)]
r600g/sb: improve alu packing on cayman

Scheduler/register allocator in r600-sb was developed and optimized
on evergreen (VLIW-5) hardware, so currently it's not optimal for
VLIW-4 chips.
This patch should improve performance on cayman gpus due to better alu
packing, but also it tends to increase register usage, so overall positive
effect on performance has to be proven by real benchmarks yet.

Some results with bfgminer kernel on cayman:
source bytecode:       60 gprs, 3905 alu groups,
sbcl before the patch: 45 gprs, 4088 alu groups,
sbcl with this patch:  55 gprs, 3474 alu groups.

Signed-off-by: Vadim Girlin <vadimgirlin@gmail.com>
11 years agor600g/sb: fix handling of new multislot instructions on cayman
Vadim Girlin [Tue, 16 Jul 2013 08:28:52 +0000 (12:28 +0400)]
r600g/sb: fix handling of new multislot instructions on cayman

Ex-scalar instructions that became multislot on cayman do replicate result
to all channels - handle them similar to DOT4.

Signed-off-by: Vadim Girlin <vadimgirlin@gmail.com>
11 years agor600g/sb: fix debug dump code in scheduler
Vadim Girlin [Wed, 17 Jul 2013 08:10:40 +0000 (12:10 +0400)]
r600g/sb: fix debug dump code in scheduler

Update the stale debug code for other changes related to debug output.

Signed-off-by: Vadim Girlin <vadimgirlin@gmail.com>
11 years agor600g/sb: fix initial register allocation
Vadim Girlin [Wed, 17 Jul 2013 08:05:32 +0000 (12:05 +0400)]
r600g/sb: fix initial register allocation

Mark values that are members of the 'same register' constraint as
preallocated in ra_init pass, this will prevent incorrect
reallocation in scheduler in some cases.

Should fix https://bugs.freedesktop.org/show_bug.cgi?id=66713

Signed-off-by: Vadim Girlin <vadimgirlin@gmail.com>
11 years agor600g/sb: move chip & class name functions to sb_context
Vadim Girlin [Tue, 16 Jul 2013 10:45:29 +0000 (14:45 +0400)]
r600g/sb: move chip & class name functions to sb_context

Signed-off-by: Vadim Girlin <vadimgirlin@gmail.com>
11 years agor600g/sb: fix handling of PS in source bytecode on cayman
Vadim Girlin [Wed, 17 Jul 2013 08:00:43 +0000 (12:00 +0400)]
r600g/sb: fix handling of PS in source bytecode on cayman

Actually PS doesn't make sense for cayman and isn't even mentioned in
cayman docs, but llvm backend currently uses it in bytecode and, assuming
that hw seems to be mostly ok with it, this will allow sb to parse such
source bytecode correctly.

Signed-off-by: Vadim Girlin <vadimgirlin@gmail.com>
11 years agor600g/sb: Initialize ra_checker member variables.
Vinson Lee [Sat, 13 Jul 2013 06:41:08 +0000 (23:41 -0700)]
r600g/sb: Initialize ra_checker member variables.

Fixes "Uninitialized scalar field" defect reported by Coverity.

Signed-off-by: Vinson Lee <vlee@freedesktop.org>
11 years agogallium/util: use explicily sized types for {un, }pack_rgba_{s, u}int
Emil Velikov [Mon, 8 Jul 2013 18:56:35 +0000 (19:56 +0100)]
gallium/util: use explicily sized types for {un, }pack_rgba_{s, u}int

Every function but the above four uses explicitly sized types for their
src and dst arguments. Even fetch_rgba_{s,u}int follows the convention.

Signed-off-by: Emil Velikov <emil.l.velikov@gmail.com>
Signed-off-by: Marek Olšák <maraeo@gmail.com>
11 years agollvmpipe: use MCJIT on ARM and AArch64
Kyle McMartin [Mon, 15 Jul 2013 14:51:15 +0000 (10:51 -0400)]
llvmpipe: use MCJIT on ARM and AArch64

MCJIT is the only supported LLVM JIT on AArch64 and ARM (the regular
JIT has bit-rotted badly on ARM and doesn't exist on AArch64.)

Signed-off-by: Kyle McMartin <kyle@redhat.com>
Signed-off-by: Dave Airlie <airlied@gmail.com>
11 years agoglsl: Fix absurd whitespace conventions in the parser.
Kenneth Graunke [Sat, 13 Jul 2013 21:44:45 +0000 (14:44 -0700)]
glsl: Fix absurd whitespace conventions in the parser.

Historically, we indented grammar production rules with a single 8-space
tab, but code inside of blocks used Mesa's 3-space indents.

This meant when editing code, you had to use an 8-space tab for the
first level of indentation, and 3-spaces after that.  Unless you
specifically configure your editor to understand this, it will get the
indentation wrong on every single line you touch, which quickly devolves
into a colossal waste of time.

It's also inconsistent with every other file in the entire project.

This patch removes all tabs and moves to a consistent 3-space indent.

Signed-off-by: Kenneth Graunke <kenneth@whitecape.org>
Reviewed-by: Matt Turner <mattst88@gmail.com>
Reviewed-by: Chris Forbes <chrisf@ijw.co.nz>
11 years agoglsl: Fail the build if the grammar contains shift/reduce errors.
Kenneth Graunke [Sat, 13 Jul 2013 06:18:44 +0000 (23:18 -0700)]
glsl: Fail the build if the grammar contains shift/reduce errors.

When working on a parser, it's very easy to accidentally introduce
new shift/reduce conflicts.  Failing the build guarantees they'll
be noticed and fixed.

Signed-off-by: Kenneth Graunke <kenneth@whitecape.org>
Reviewed-by: Chris Forbes <chrisf@ijw.co.nz>
11 years agoglsl: Silence the last shift/reduce conflict warning in the grammar.
Kenneth Graunke [Sat, 13 Jul 2013 06:10:14 +0000 (23:10 -0700)]
glsl: Silence the last shift/reduce conflict warning in the grammar.

The single remaining shift/reduce conflict was the classic ELSE problem:

  292 selection_rest_statement: statement . ELSE statement
  293                         | statement .

    ELSE  shift, and go to state 479

    ELSE      [reduce using rule 293 (selection_rest_statement)]
    $default  reduce using rule 293 (selection_rest_statement)

The correct behavior here is to shift, which is what happens by default.
However, resolving it explicitly will make it possible to fail the build
on new errors, making them much easier to detect.

The classic way to solve this is to use right associativity:
http://www.gnu.org/software/bison/manual/html_node/Non-Operators.html

Since there is no THEN token in GLSL, we need to fake one.  %right THEN
creates a new terminal symbol; the %prec directive says to use the
precedence of that terminal.

Signed-off-by: Kenneth Graunke <kenneth@whitecape.org>
Reviewed-by: Chris Forbes <chrisf@ijw.co.nz>
11 years agoglsl: Initialize ast_jump_statement::opt_return_value.
Vinson Lee [Sun, 14 Jul 2013 07:57:22 +0000 (00:57 -0700)]
glsl: Initialize ast_jump_statement::opt_return_value.

opt_return_value was not initialized if mode != ast_return.

Fixes "Uninitialized pointer field" defect reported by Coverity.

Signed-off-by: Vinson Lee <vlee@freedesktop.org>
Reviewed-by: Chad Versace <chad.versace@linux.intel.com>
11 years agoglapi: Do not use backtrace on OpenBSD.
Vinson Lee [Sat, 13 Jul 2013 00:01:57 +0000 (17:01 -0700)]
glapi: Do not use backtrace on OpenBSD.

execinfo.h is not available on OpenBSD.

Signed-off-by: Vinson Lee <vlee@freedesktop.org>
Reviewed-by: Chad Versace <chad.versace@linux.intel.com>
11 years agoosmesa: link against static libglapi library too to get the gl exports
Maarten Lankhorst [Tue, 16 Jul 2013 08:18:38 +0000 (10:18 +0200)]
osmesa: link against static libglapi library too to get the gl exports

This should fix missing symbols in a osmesa built against shared glapi
osmesa build. All opengl exports were missing that are defined in the
static glapi, so link against both to fix this.

This is a candidate for the stable series.

Bugzilla: https://bugs.freedesktop.org/show_bug.cgi?id=47824
Signed-off-by: Maarten Lankhorst <maarten.lankhorst@canonical.com>