mesa.git
10 years agometa: Drop a now-trivial helper function.
Eric Anholt [Wed, 12 Feb 2014 00:19:29 +0000 (16:19 -0800)]
meta: Drop a now-trivial helper function.

Reviewed-by: Kenneth Graunke <kenneth@whitecape.org>
Reviewed-by: Ian Romanick <ian.d.romanick@intel.com>
10 years agometa: Fold the glUseProgram() into the blit program generator.
Eric Anholt [Wed, 12 Feb 2014 00:13:21 +0000 (16:13 -0800)]
meta: Fold the glUseProgram() into the blit program generator.

Everyone was just immediately calling it and doing nothing else with the
shader program id.

Reviewed-by: Kenneth Graunke <kenneth@whitecape.org>
Reviewed-by: Ian Romanick <ian.d.romanick@intel.com>
10 years agometa: Simplify the blit shader setup steps.
Eric Anholt [Wed, 12 Feb 2014 00:08:51 +0000 (16:08 -0800)]
meta: Simplify the blit shader setup steps.

The only thing that wants to track the glsl_sampler structure is the
shader string generator.

Reviewed-by: Kenneth Graunke <kenneth@whitecape.org>
Reviewed-by: Ian Romanick <ian.d.romanick@intel.com>
10 years agoi965/vec4: Fix confusion between SWIZZLE and BRW_SWIZZLE macros.
Francisco Jerez [Thu, 28 Nov 2013 06:21:45 +0000 (22:21 -0800)]
i965/vec4: Fix confusion between SWIZZLE and BRW_SWIZZLE macros.

Most of the VEC4 back-end agrees on src_reg::swizzle being one of the
BRW_SWIZZLE macros defined in brw_reg.h, except in two places where we
use Mesa's SWIZZLE macros.  There is even a doxygen comment saying
that Mesa's macros are the right ones.  They are incompatible swizzle
representations (3 bits vs. 2 bits per component), and the code using
Mesa's works by pure luck.  Fix it.

Reviewed-by: Matt Turner <mattst88@gmail.com>
Reviewed-by: Paul Berry <stereotype441@gmail.com>
10 years agoi965/fs: Remove fs_reg::sechalf.
Francisco Jerez [Wed, 15 Jan 2014 21:21:50 +0000 (22:21 +0100)]
i965/fs: Remove fs_reg::sechalf.

The same effect can be achieved using ::subreg_offset.  Remove the
less flexible alternative and define a convenience function to keep
the fs_reg interface sane.

Reviewed-by: Matt Turner <mattst88@gmail.com>
Reviewed-by: Paul Berry <stereotype441@gmail.com>
10 years agoi965/fs: Remove fs_reg::smear.
Francisco Jerez [Wed, 15 Jan 2014 21:21:30 +0000 (22:21 +0100)]
i965/fs: Remove fs_reg::smear.

The same effect can be achieved using a combination of ::stride and
::subreg_offset.  Remove the less flexible ::smear to keep the data
members of fs_reg orthogonal.

Reviewed-by: Matt Turner <mattst88@gmail.com>
Reviewed-by: Paul Berry <stereotype441@gmail.com>
10 years agoi965/fs: Add support for specifying register horizontal strides.
Francisco Jerez [Sun, 8 Dec 2013 03:57:35 +0000 (04:57 +0100)]
i965/fs: Add support for specifying register horizontal strides.

v2: Some improvements for copy propagation with non-contiguous
    register strides and mismatching types.
v3: Add example of the situation that the copy propagation changes are
    intended to avoid.  Clarify that 'fs_reg::apply_stride()' is expected
    to work with zero strides too.

Reviewed-by: Matt Turner <mattst88@gmail.com>
Reviewed-by: Paul Berry <stereotype441@gmail.com>
10 years agoi965/fs: Add support for sub-register byte offsets to the FS back-end IR.
Francisco Jerez [Sun, 8 Dec 2013 03:57:08 +0000 (04:57 +0100)]
i965/fs: Add support for sub-register byte offsets to the FS back-end IR.

It would be nice if we could have a single 'reg_offset' field
expressed in bytes that would serve the purpose of both, but the
semantics of 'reg_offset' are quite complex currently (it's measured
in units of one, eight or sixteen dwords depending on the register
file and the dispatch width) and changing it to bytes would be a very
intrusive change at this stage.  Add a separate 'subreg_offset' field
for now.

Reviewed-by: Matt Turner <mattst88@gmail.com>
Reviewed-by: Paul Berry <stereotype441@gmail.com>
10 years agoglsl: rename _restrict to restrict_flag
Brian Paul [Wed, 12 Feb 2014 20:22:27 +0000 (13:22 -0700)]
glsl: rename _restrict to restrict_flag

To fix MSVC compile breakage.  Evidently, _restrict is an MSVC keyword,
though the docs only mention __restrict (with two underscores).

Note: we may want to also rename _volatile to volatile_flag to be
consistent.

Bugzilla: https://bugs.freedesktop.org/show_bug.cgi?id=74900
Reviewed-by: Ian Romanick <ian.d.romanick@intel.com>
10 years agomesa: assorted clean-ups in detach_shader()
Brian Paul [Mon, 10 Feb 2014 23:13:04 +0000 (16:13 -0700)]
mesa: assorted clean-ups in detach_shader()

Fix formatting, add new comments, get rid of extraneous indentation.
Suggested by Ian in bug 74723.

Reviewed-by: Ian Romanick <ian.d.romanick@intel.com>
10 years agosvga: replace out-of-temps assertion with debug warning
Brian Paul [Mon, 10 Feb 2014 23:12:32 +0000 (16:12 -0700)]
svga: replace out-of-temps assertion with debug warning

Signed-off-by: Brian Paul <brianp@vmware.com>
10 years agomesa: Handle binding of uniforms to image units with glUniform*().
Francisco Jerez [Sat, 23 Nov 2013 03:59:48 +0000 (19:59 -0800)]
mesa: Handle binding of uniforms to image units with glUniform*().

v2: Set driver-specified flag in NewDriverState when glUniform* is
    used to bind an image unit.
v3: Abbreviate argument type check.

Reviewed-by: Paul Berry <stereotype441@gmail.com>
10 years agoglsl/linker: Propagate image uniform access qualifiers to the driver.
Francisco Jerez [Sun, 24 Nov 2013 05:56:56 +0000 (21:56 -0800)]
glsl/linker: Propagate image uniform access qualifiers to the driver.

Reviewed-by: Paul Berry <stereotype441@gmail.com>
10 years agoglsl/linker: Assign image uniform indices.
Francisco Jerez [Fri, 22 Nov 2013 23:53:52 +0000 (15:53 -0800)]
glsl/linker: Assign image uniform indices.

Reviewed-by: Paul Berry <stereotype441@gmail.com>
10 years agoglsl/linker: Count and check image resources.
Francisco Jerez [Fri, 22 Nov 2013 23:53:26 +0000 (15:53 -0800)]
glsl/linker: Count and check image resources.

v2: Add comment about the reason why image variables take up space
    from the default uniform block.

Reviewed-by: Paul Berry <stereotype441@gmail.com>
10 years agoglsl: Add image built-in function generator.
Francisco Jerez [Tue, 26 Nov 2013 04:29:57 +0000 (20:29 -0800)]
glsl: Add image built-in function generator.

Because of the combinatorial explosion of different image built-ins
with different image dimensionalities and base data types, enumerating
all the 242 possibilities would be annoying and a waste of .text
space.  Instead use a special path in the built-in builder that loops
over all the known image types.

v2: Generate built-ins on GLSL version 4.20 too.  Rename
    '_has_float_data_type' to '_supports_float_data_type'.  Avoid
    duplicating enumeration of image built-ins in create_intrinsics()
    and create_builtins().
v3: Use a more orthodox approach for passing image built-in generator
    parameters.
v4: Cosmetic changes.

Acked-by: Paul Berry <stereotype441@gmail.com>
10 years agoglsl: Add built-in constants for ARB_shader_image_load_store.
Francisco Jerez [Wed, 12 Feb 2014 16:15:21 +0000 (17:15 +0100)]
glsl: Add built-in constants for ARB_shader_image_load_store.

v2: Add them on GLSL version 4.20 too.

Reviewed-by: Paul Berry <stereotype441@gmail.com>
10 years agoglcpp: Add built-in define for ARB_shader_image_load_store.
Francisco Jerez [Wed, 12 Feb 2014 16:12:24 +0000 (17:12 +0100)]
glcpp: Add built-in define for ARB_shader_image_load_store.

Reviewed-by: Paul Berry <stereotype441@gmail.com>
10 years agoglsl: Add built-in types defined by ARB_shader_image_load_store.
Francisco Jerez [Mon, 25 Nov 2013 22:09:13 +0000 (14:09 -0800)]
glsl: Add built-in types defined by ARB_shader_image_load_store.

Reviewed-by: Paul Berry <stereotype441@gmail.com>
10 years agoglsl/ast: Generalize some sampler variable restrictions to all opaque types.
Francisco Jerez [Tue, 26 Nov 2013 03:38:37 +0000 (19:38 -0800)]
glsl/ast: Generalize some sampler variable restrictions to all opaque types.

No opaque types may be statically initialized in the shader, all
opaque variables must be declared uniform or be part of an "in"
function parameter declaration, no opaque types may be used as the
return type of a function.

v2: Add explicit check for opaque types in interface blocks.  Check
    for opaque types in ir_dereference::is_lvalue().

Reviewed-by: Paul Berry <stereotype441@gmail.com>
10 years agoglsl/ast: Forbid declaration of image variables in structures and uniform blocks.
Francisco Jerez [Fri, 22 Nov 2013 23:17:05 +0000 (15:17 -0800)]
glsl/ast: Forbid declaration of image variables in structures and uniform blocks.

Aggregating images inside uniform blocks is explicitly disallowed by
the standard, aggregating them inside structures is not (as of GL
4.4), but there is a similar problem as with atomic counters: image
uniform declarations require either a "writeonly" memory qualifier or
an explicit format qualifier, which are explicitly forbidden in
structure member declarations.  In the resolution of Khronos bug
#10903 the same wording applied to atomic counters was decided to mean
that they're not allowed inside structures -- Rejecting image member
declarations within structures seems the most reasonable option for
now.

Reviewed-by: Paul Berry <stereotype441@gmail.com>
10 years agoglsl/ast: Make sure that image argument qualifiers match the function prototype.
Francisco Jerez [Sun, 8 Dec 2013 03:56:06 +0000 (04:56 +0100)]
glsl/ast: Make sure that image argument qualifiers match the function prototype.

Reviewed-by: Paul Berry <stereotype441@gmail.com>
10 years agoglsl/ast: Verify that function calls don't discard image format qualifiers.
Francisco Jerez [Fri, 22 Nov 2013 23:11:50 +0000 (15:11 -0800)]
glsl/ast: Verify that function calls don't discard image format qualifiers.

Reviewed-by: Paul Berry <stereotype441@gmail.com>
10 years agoglsl/ast: Validate and apply memory qualifiers to image variables.
Francisco Jerez [Mon, 25 Nov 2013 23:57:56 +0000 (15:57 -0800)]
glsl/ast: Validate and apply memory qualifiers to image variables.

Reviewed-by: Paul Berry <stereotype441@gmail.com>
10 years agoglsl/parser: Handle image built-in types.
Francisco Jerez [Mon, 25 Nov 2013 23:14:25 +0000 (15:14 -0800)]
glsl/parser: Handle image built-in types.

Reviewed-by: Paul Berry <stereotype441@gmail.com>
10 years agoglsl/parser: Handle image memory qualifiers.
Francisco Jerez [Mon, 25 Nov 2013 23:10:35 +0000 (15:10 -0800)]
glsl/parser: Handle image memory qualifiers.

v2: Make the "map" array static const.

Reviewed-by: Paul Berry <stereotype441@gmail.com>
10 years agoglsl/parser: Handle the early_fragment_tests input layout qualifier.
Francisco Jerez [Wed, 12 Feb 2014 16:10:09 +0000 (17:10 +0100)]
glsl/parser: Handle the early_fragment_tests input layout qualifier.

v2: Only allow the early_fragment_tests qualifier in fragment shaders.

Reviewed-by: Paul Berry <stereotype441@gmail.com>
10 years agoglsl/lexer: Add new tokens for ARB_shader_image_load_store.
Francisco Jerez [Mon, 25 Nov 2013 22:59:46 +0000 (14:59 -0800)]
glsl/lexer: Add new tokens for ARB_shader_image_load_store.

Reviewed-by: Paul Berry <stereotype441@gmail.com>
10 years agoglsl/ast: Keep track of type qualifiers defined by ARB_shader_image_load_store.
Francisco Jerez [Wed, 12 Feb 2014 15:56:01 +0000 (16:56 +0100)]
glsl/ast: Keep track of type qualifiers defined by ARB_shader_image_load_store.

v2: Add comment next to the read_only and write_only qualifier flags.
    Change temporary copies of the type qualifier mask to use uint64_t
    too.

Reviewed-by: Paul Berry <stereotype441@gmail.com>
10 years agoglsl: Add gl_uniform_storage fields to keep track of image uniform indices.
Francisco Jerez [Fri, 22 Nov 2013 23:50:48 +0000 (15:50 -0800)]
glsl: Add gl_uniform_storage fields to keep track of image uniform indices.

v2: Promote anonymous struct into named struct.

Reviewed-by: Paul Berry <stereotype441@gmail.com>
10 years agoglsl: Add image memory and layout qualifiers to ir_variable.
Francisco Jerez [Sat, 23 Nov 2013 04:57:44 +0000 (20:57 -0800)]
glsl: Add image memory and layout qualifiers to ir_variable.

v2: Add comment next to the read_only and write_only qualifier flags.

Reviewed-by: Paul Berry <stereotype441@gmail.com>
10 years agoglsl: Add helper methods to glsl_type for dealing with images.
Francisco Jerez [Mon, 25 Nov 2013 22:03:06 +0000 (14:03 -0800)]
glsl: Add helper methods to glsl_type for dealing with images.

Add predicates to query if a GLSL type is or contains an image.
Rename sampler_coordinate_components() to coordinate_components().

v2: Use assert instead of unreachable.
v3: No need to use a separate code-path for images in
    coordinate_components() after merging image and sampler fields in
    the glsl_type structure.

Reviewed-by: Paul Berry <stereotype441@gmail.com>
10 years agoglsl: Add image type to the GLSL IR.
Francisco Jerez [Mon, 25 Nov 2013 21:50:47 +0000 (13:50 -0800)]
glsl: Add image type to the GLSL IR.

v2: Reuse the glsl_sampler_dim enum for images.  Reuse the
    glsl_type::sampler_* fields instead of creating new ones specific
    to image types.  Reuse the same constructor as for samplers adding
    a new 'base_type' argument.

Reviewed-by: Paul Berry <stereotype441@gmail.com>
10 years agoglsl: Add ARB_shader_image_load_store extension enables.
Francisco Jerez [Wed, 12 Feb 2014 15:54:40 +0000 (16:54 +0100)]
glsl: Add ARB_shader_image_load_store extension enables.

Reviewed-by: Paul Berry <stereotype441@gmail.com>
10 years agomesa: Preserve the NewArrays state when copying a VAO
Fredrik Höglund [Fri, 7 Feb 2014 19:34:08 +0000 (20:34 +0100)]
mesa: Preserve the NewArrays state when copying a VAO

Cc: "10.1" "10.0" <mesa-stable@lists.freedesktop.org>
Bugzilla: https://bugs.freedesktop.org/show_bug.cgi?id=72895
Reviewed-by: Brian Paul <brianp@vmware.com>
10 years agonouveau: create only 1 shared screen between vdpau and opengl
Maarten Lankhorst [Wed, 12 Feb 2014 13:56:53 +0000 (14:56 +0100)]
nouveau: create only 1 shared screen between vdpau and opengl

This fixes bug 73200 "vdpau-GL interop fails due to different screen
objects" in the same way radeon does.

Signed-off-by: Maarten Lankhorst <maarten.lankhorst@canonical.com>
Reviewed-by: Emil Velikov <emil.l.velikov@gmail.com>
10 years agogallium makefiles: use a linker script for building dri drivers
Maarten Lankhorst [Wed, 12 Feb 2014 12:50:43 +0000 (13:50 +0100)]
gallium makefiles: use a linker script for building dri drivers

Only export __driDriverExtensions by default, and radeon_drm_winsys_create on radeons.
Remove -Bsymbolic which should no longer be needed.

As a side effect, it ought to fix a manifestation of bug 73200 on radeon.

Signed-off-by: Maarten Lankhorst<maarten.lankhorst@canonical.com>
Reviewed-by: Christian König <christian.koenig@amd.com>
10 years agoglsl: Do not vectorize vector array dereferences.
Matt Turner [Mon, 10 Feb 2014 20:09:19 +0000 (12:09 -0800)]
glsl: Do not vectorize vector array dereferences.

Array dereferences must have scalar indices, so we cannot vectorize
them.

Cc: "10.1" <mesa-stable@lists.freedesktop.org>
Reported-by: Andrew Guertin <lists@dolphinling.net>
Tested-by: Andrew Guertin <lists@dolphinling.net>
Reviewed-by: Ian Romanick <ian.d.romanick@intel.com>
10 years agometa: Enable cubemap array texture support to decompress_texture_image
Ian Romanick [Tue, 17 Dec 2013 01:11:15 +0000 (17:11 -0800)]
meta: Enable cubemap array texture support to decompress_texture_image

Fixed piglit test getteximage-targets S3TC CUBE_ARRAY on systems that
don't have libtxc_dxtn installed.

Signed-off-by: Ian Romanick <ian.d.romanick@intel.com>
Reviewed-by: Eric Anholt <eric@anholt.net>
10 years agometa: Add cubemap array support to generic blit shader code
Ian Romanick [Tue, 17 Dec 2013 01:10:29 +0000 (17:10 -0800)]
meta: Add cubemap array support to generic blit shader code

Signed-off-by: Ian Romanick <ian.d.romanick@intel.com>
Reviewed-by: Eric Anholt <eric@anholt.net>
10 years agometa: Get the correct info log
Ian Romanick [Tue, 17 Dec 2013 00:25:07 +0000 (16:25 -0800)]
meta: Get the correct info log

Signed-off-by: Ian Romanick <ian.d.romanick@intel.com>
Reviewed-by: Eric Anholt <eric@anholt.net>
10 years agometa: Expand texture coordinate from vec3 to vec4
Ian Romanick [Mon, 16 Dec 2013 23:35:02 +0000 (15:35 -0800)]
meta: Expand texture coordinate from vec3 to vec4

This will be necessary to support cubemap array textures because they
use all four components.

Signed-off-by: Ian Romanick <ian.d.romanick@intel.com>
Reviewed-by: Eric Anholt <eric@anholt.net>
10 years agometa: Use GLSL to decompress 2D-array textures
Ian Romanick [Mon, 16 Dec 2013 23:01:54 +0000 (15:01 -0800)]
meta: Use GLSL to decompress 2D-array textures

Signed-off-by: Ian Romanick <ian.d.romanick@intel.com>
Bugzilla: https://bugs.freedesktop.org/show_bug.cgi?id=72582
Reviewed-by: Eric Anholt <eric@anholt.net>
10 years agometa: Use common GLSL code for blits
Ian Romanick [Mon, 16 Dec 2013 21:10:53 +0000 (13:10 -0800)]
meta: Use common GLSL code for blits

Signed-off-by: Ian Romanick <ian.d.romanick@intel.com>
Reviewed-by: Eric Anholt <eric@anholt.net>
10 years agometa: Improve GLSL version check
Ian Romanick [Mon, 16 Dec 2013 21:10:11 +0000 (13:10 -0800)]
meta: Improve GLSL version check

We want to use the GLSL 1.30-ish path for OpenGL ES 3.0.

Signed-off-by: Ian Romanick <ian.d.romanick@intel.com>
Reviewed-by: Eric Anholt <eric@anholt.net>
10 years agometa: Add rectangle textures to the shader-per-sampler-type table
Ian Romanick [Mon, 16 Dec 2013 19:56:26 +0000 (11:56 -0800)]
meta: Add rectangle textures to the shader-per-sampler-type table

Rectangle textures were not necessary for mipmap generation (because
they cannot have mipmaps), but all of the future users of this common
code will need to support rectangle textures.

Signed-off-by: Ian Romanick <ian.d.romanick@intel.com>
Reviewed-by: Brian Paul <brianp@vmware.com>
Reviewed-by: Eric Anholt <eric@anholt.net>
10 years agometa: Refactor shader generation code out of mipmap generation path
Ian Romanick [Mon, 16 Dec 2013 19:54:08 +0000 (11:54 -0800)]
meta: Refactor shader generation code out of mipmap generation path

This is quite like code we want for blits.  Pull it out so that it can
be shared by other paths.

Signed-off-by: Ian Romanick <ian.d.romanick@intel.com>
Reviewed-by: Brian Paul <brianp@vmware.com>
Reviewed-by: Eric Anholt <eric@anholt.net>
10 years agometa: Refactor the table of glsl_sampler structures
Ian Romanick [Mon, 16 Dec 2013 19:52:38 +0000 (11:52 -0800)]
meta: Refactor the table of glsl_sampler structures

This will allow the same table of shader-per-sampler-type to be used for
paths in meta other than just mipmap generation.  This is also the
reason the declarations of the structures was moved towards the top of
the file.

v2: Code formatting change suggested by Brian.

Signed-off-by: Ian Romanick <ian.d.romanick@intel.com>
Reviewed-by: Brian Paul <brianp@vmware.com>
Reviewed-by: Eric Anholt <eric@anholt.net>
10 years agometa: Use common vertex setup code for _mesa_meta_Bitmap too
Ian Romanick [Sun, 15 Dec 2013 03:33:02 +0000 (19:33 -0800)]
meta: Use common vertex setup code for _mesa_meta_Bitmap too

Signed-off-by: Ian Romanick <ian.d.romanick@intel.com>
Reviewed-by: Brian Paul <brianp@vmware.com>
Reviewed-by: Eric Anholt <eric@anholt.net>
10 years agometa: Add storage to the vertex structure for R, G, B, and A
Ian Romanick [Sun, 15 Dec 2013 03:32:39 +0000 (19:32 -0800)]
meta: Add storage to the vertex structure for R, G, B, and A

Signed-off-by: Ian Romanick <ian.d.romanick@intel.com>
Reviewed-by: Brian Paul <brianp@vmware.com>
Reviewed-by: Eric Anholt <eric@anholt.net>
10 years agometa: Use common routine to configure fixed-function TNL state
Ian Romanick [Sat, 14 Dec 2013 19:36:32 +0000 (11:36 -0800)]
meta: Use common routine to configure fixed-function TNL state

Also... glOrtho(-1.0, 1.0, -1.0, 1.0, -1.0, 1.0) *is* the identity
matrix, so drop the unnecessary call to _mesa_Ortho.

v2: Rename setup_ff_TNL_for_blit() to setup_ff_tnl_for_blit().  Seems
    silly to capitalize one out of two to three acronyms in the name
    (change by anholt, acked by idr).

Signed-off-by: Ian Romanick <ian.d.romanick@intel.com>
Reviewed-by: Brian Paul <brianp@vmware.com> (v1)
Reviewed-by: Eric Anholt <eric@anholt.net>
10 years agoi965: Fix General and Indirect Base Addresses on Broadwell.
Kenneth Graunke [Mon, 3 Feb 2014 22:30:39 +0000 (14:30 -0800)]
i965: Fix General and Indirect Base Addresses on Broadwell.

I set the "address modify enable" bit in the wrong DWord.  The first
DWord is the high 16 bits of the address, while the second is the low
32-bits and enable bit.

Signed-off-by: Kenneth Graunke <kenneth@whitecape.org>
Reviewed-by: Eric Anholt <eric@anholt.net>
10 years agoi965: Drop VECTOR_MASK_ENABLE in Broadwell's 3DSTATE_VS packet.
Kenneth Graunke [Mon, 3 Feb 2014 18:45:31 +0000 (10:45 -0800)]
i965: Drop VECTOR_MASK_ENABLE in Broadwell's 3DSTATE_VS packet.

We never set it on previous generations, but I had to set it in
3DSTATE_PS for correct behavior.  For symmetry, I set it in 3DSTATE_VS
as well, but there's no actual need to do so.  Piglit works fine either
way.  The documentation also remarks that there should never be a need
to program this.

Signed-off-by: Kenneth Graunke <kenneth@whitecape.org>
Reviewed-by: Eric Anholt <eric@anholt.net>
10 years agoi965/gs: Fix EndPrimitive on Broadwell.
Kenneth Graunke [Thu, 30 Jan 2014 00:31:31 +0000 (16:31 -0800)]
i965/gs: Fix EndPrimitive on Broadwell.

My earlier patch (i965: Reserve space for "Vertex Count" in GS outputs.)
incremented Global Offset for most URB writes to make room for the new
"Vertex Count" field, but failed to shift the URB writes used for
writing control bits.

Confusingly, Global Offset must be incremented by 2 here, rather than 1.
The URB writes we use for actual data are HWord writes, which treat
Global Offset as a 256-bit offset.  These are OWord writes, so it's
treated as a 128-bit offset instead.

Signed-off-by: Kenneth Graunke <kenneth@whitecape.org>
Reviewed-by: Eric Anholt <eric@anholt.net>
10 years agoi965/vec4: Support arbitrarily large sampler indices on Broadwell+.
Kenneth Graunke [Thu, 23 Jan 2014 19:05:46 +0000 (11:05 -0800)]
i965/vec4: Support arbitrarily large sampler indices on Broadwell+.

I added support for these on Haswell, but forgot to update the Broadwell
code before landing it.  Fixes Piglit's max-samplers test.

v2: Use get_element_ud() for the destination as well as the source.

Signed-off-by: Kenneth Graunke <kenneth@whitecape.org>
Reviewed-by: Eric Anholt <eric@anholt.net>
10 years agoi965/fs: Support arbitrarily large sampler indices on Broadwell+.
Kenneth Graunke [Thu, 23 Jan 2014 18:58:25 +0000 (10:58 -0800)]
i965/fs: Support arbitrarily large sampler indices on Broadwell+.

I added support for these on Haswell, but forgot to update the Broadwell
code before landing it.  Partially fixes Piglit's max-samplers test.

v2: Use get_element_ud() consistently, rather than using it for the
    source but using brw_vec1_grf for the destination..

Signed-off-by: Kenneth Graunke <kenneth@whitecape.org>
Reviewed-by: Eric Anholt <eric@anholt.net>
10 years agoi965/fs: Fix Broadwell texture header setup to be uncompressed.
Kenneth Graunke [Thu, 23 Jan 2014 18:55:16 +0000 (10:55 -0800)]
i965/fs: Fix Broadwell texture header setup to be uncompressed.

MOV_RAW disables masking, but doesn't force the instruction to be
uncompressed.  That needs to be done by hand.

Fixes textureGather and texture offset tests.

Signed-off-by: Kenneth Graunke <kenneth@whitecape.org>
Reviewed-by: Eric Anholt <eric@anholt.net>
10 years agomesa: GL_ARB_half_float_pixel is not optional
Ian Romanick [Mon, 13 Jan 2014 23:23:48 +0000 (15:23 -0800)]
mesa: GL_ARB_half_float_pixel is not optional

Almost every driver already supported it.  All current and future
Gallium drivers always support it, and most existing classic drivers
support it.

This only changes radeon and nouveau.

This extension only adds data types that can be passed to, for example,
glTexImage2D.  It does not add internal formats.  Since you can already
pass GL_FLOAT to glTexImage2D this shouldn't pose any additional issues
with those drivers.  Note that r200 and i915 already supported this
extension, and they don't support floating-point textures either.

Signed-off-by: Ian Romanick <ian.d.romanick@intel.com>
Reviewed-by: Eric Anholt <eric@anholt.net>
10 years agomesa: Fix extension dependency for half-float TexBOs
Ian Romanick [Mon, 13 Jan 2014 23:18:23 +0000 (15:18 -0800)]
mesa: Fix extension dependency for half-float TexBOs

Half-float TexBOs should require both GL_ARB_half_float_pixel and
GL_ARB_texture_float.  This doesn't matter much in practice.  Every
driver that supports GL_ARB_texture_buffer_object already supports
GL_ARB_half_float_pixel.  We only expose the TexBO extension in core
profiles, and those require GL_ARB_texture_float.

Signed-off-by: Ian Romanick <ian.d.romanick@intel.com>
Reviewed-by: Eric Anholt <eric@anholt.net>
10 years agometa: Silence unused parameter warning in _mesa_meta_CopyTexSubImage
Ian Romanick [Tue, 17 Dec 2013 21:38:50 +0000 (13:38 -0800)]
meta: Silence unused parameter warning in _mesa_meta_CopyTexSubImage

drivers/common/meta.c: In function '_mesa_meta_CopyTexSubImage':
drivers/common/meta.c:3744:52: warning: unused parameter 'rb' [-Wunused-parameter]

Unfortunately, the parameter can't just be removed because it is part of
the dd_function_table::CopyTexSubImage interface.

Signed-off-by: Ian Romanick <ian.d.romanick@intel.com>
Reviewed-by: Eric Anholt <eric@anholt.net>
10 years agometa: Silence unused parameter warning in setup_drawpix_texture
Ian Romanick [Tue, 17 Dec 2013 03:07:24 +0000 (19:07 -0800)]
meta: Silence unused parameter warning in setup_drawpix_texture

drivers/common/meta.c: In function 'setup_drawpix_texture':
drivers/common/meta.c:1572:30: warning: unused parameter 'texIntFormat' [-Wunused-parameter]

setup_drawpix_texture has never used this paramater.  Before the
refactor commit 04f8193aa it was used in several locations.  After that
commit, texIntFormat was only used in alloc_texture.

Signed-off-by: Ian Romanick <ian.d.romanick@intel.com>
Reviewed-by: Eric Anholt <eric@anholt.net>
10 years agometa: Refactor common VAO and VBO initialization code
Ian Romanick [Sat, 14 Dec 2013 19:24:36 +0000 (11:24 -0800)]
meta: Refactor common VAO and VBO initialization code

v2: Clean up some stray binding calls

Signed-off-by: Ian Romanick <ian.d.romanick@intel.com>
Reviewed-by: Brian Paul <brianp@vmware.com> (v1)
Reviewed-by: Eric Anholt <eric@anholt.net> (v2)
10 years agometa: Track the _mesa_meta_DrawPixels VBO just like the others
Ian Romanick [Sat, 14 Dec 2013 20:03:01 +0000 (12:03 -0800)]
meta: Track the _mesa_meta_DrawPixels VBO just like the others

All of the other meta routines have a particular pattern for creating
and tracking the VAO and VBO.  This one function deviated from that
pattern for no apparent reason.

Almost all of the code added in this patch will be removed shortly.

v2: Drop glDeleteBuffers() of the old, now-uninitialized vbo variable.
    Fixes getteximage-formats and fbo-mipmap-copypix regression when "2"
    landed in the variable (change by anholt).

Signed-off-by: Ian Romanick <ian.d.romanick@intel.com>
Reviewed-by: Brian Paul <brianp@vmware.com>
Reviewed-by: Eric Anholt <eric@anholt.net>
10 years agometa: Expand the vertex structure for the GenerateMipmap and decompress paths
Ian Romanick [Sat, 14 Dec 2013 08:57:06 +0000 (00:57 -0800)]
meta: Expand the vertex structure for the GenerateMipmap and decompress paths

Final intermediate step leading to some code sharing.  Note that the new
GemerateMipmap and decompress vertex structures are the same as the new vertex
structure in BlitFramebuffer and the others.

Signed-off-by: Ian Romanick <ian.d.romanick@intel.com>
Reviewed-by: Brian Paul <brianp@vmware.com>
Reviewed-by: Eric Anholt <eric@anholt.net>
10 years agometa: Expand the vertex structure for the DrawPixels paths
Ian Romanick [Sat, 14 Dec 2013 08:55:50 +0000 (00:55 -0800)]
meta: Expand the vertex structure for the DrawPixels paths

Another step leading to some code sharing.  Note that the new DrawPixels
vertex structure is the same as the new vertex structure in BlitFramebuffer
and the others.

Signed-off-by: Ian Romanick <ian.d.romanick@intel.com>
Reviewed-by: Brian Paul <brianp@vmware.com>
Reviewed-by: Eric Anholt <eric@anholt.net>
10 years agometa: Expand the vertex structure for the Clear paths
Ian Romanick [Sat, 14 Dec 2013 03:37:02 +0000 (19:37 -0800)]
meta: Expand the vertex structure for the Clear paths

Another step leading to some code sharing.  Note that the new Clear
vertex structure is the same as the new BlitFramebuffer and CopyPixels
vertex structure.

The "sizeof(float) * 7" hack is temporary.  It will magically disappear
in a just a couple more patches.

Signed-off-by: Ian Romanick <ian.d.romanick@intel.com>
Reviewed-by: Brian Paul <brianp@vmware.com>
Reviewed-by: Eric Anholt <eric@anholt.net>
10 years agometa: Expand the vertex structure for the CopyPixels paths
Ian Romanick [Sat, 14 Dec 2013 03:32:08 +0000 (19:32 -0800)]
meta: Expand the vertex structure for the CopyPixels paths

Another step leading to some code sharing.  Note that the new CopyPixels
vertex structure is the same as the new BlitFramebuffer vertex
structure.

Signed-off-by: Ian Romanick <ian.d.romanick@intel.com>
Reviewed-by: Brian Paul <brianp@vmware.com>
Reviewed-by: Eric Anholt <eric@anholt.net>
10 years agometa: Expand the vertex structure for the BlitFramebuffer paths
Ian Romanick [Sat, 14 Dec 2013 03:04:20 +0000 (19:04 -0800)]
meta: Expand the vertex structure for the BlitFramebuffer paths

This is the first of several steps leading to some code sharing.

Signed-off-by: Ian Romanick <ian.d.romanick@intel.com>
Reviewed-by: Brian Paul <brianp@vmware.com>
Reviewed-by: Eric Anholt <eric@anholt.net>
10 years agonv30,nvc0: only claim a single viewport
Ilia Mirkin [Tue, 11 Feb 2014 05:42:26 +0000 (00:42 -0500)]
nv30,nvc0: only claim a single viewport

It should be possible to make this be 16 on nvc0.

Signed-off-by: Ilia Mirkin <imirkin@alum.mit.edu>
Reviewed-by: Emil Velikov <emil.l.velikov@gmail.com>
10 years agost/clover: use VISIBILITY_CXXFLAGS where approapriate
Emil Velikov [Sat, 8 Feb 2014 04:06:19 +0000 (04:06 +0000)]
st/clover: use VISIBILITY_CXXFLAGS where approapriate

Use the c++ visibility flags when building cpp files.

Signed-off-by: Emil Velikov <emil.l.velikov@gmail.com>
Reviewed-by: Matt Turner <mattst88@gmail.com>
10 years agoomx: use VISIBILITY_CFLAGS to control exported symbols
Emil Velikov [Sat, 8 Feb 2014 03:56:38 +0000 (03:56 +0000)]
omx: use VISIBILITY_CFLAGS to control exported symbols

Initial step of cleaning the exported symbols from targets/omx

 - Mark omx_component_library_Setup as public

v2: Keep export-symbols-regex

Signed-off-by: Emil Velikov <emil.l.velikov@gmail.com>
Reviewed-by: Christian König <christian.koenig@amd.com> (v1)
10 years agoosmesa: drop obsolete AM_CXXFLAGS
Emil Velikov [Sat, 8 Feb 2014 02:56:32 +0000 (02:56 +0000)]
osmesa: drop obsolete AM_CXXFLAGS

There is no cpp files during the build process, thus we
can safely drop the unused cxxflags.

Signed-off-by: Emil Velikov <emil.l.velikov@gmail.com>
Reviewed-by: Matt Turner <mattst88@gmail.com>
10 years agost/vdpau: automake: export only PUBLIC symbols
Emil Velikov [Sat, 8 Feb 2014 01:40:40 +0000 (01:40 +0000)]
st/vdpau: automake: export only PUBLIC symbols

Signed-off-by: Emil Velikov <emil.l.velikov@gmail.com>
Reviewed-by: Matt Turner <mattst88@gmail.com>
Reviewed-by: Christian König <christian.koenig@amd.com>
10 years agost/vdpau: do not export VdpPresentationQueueTargetCreateX11
Emil Velikov [Fri, 7 Feb 2014 16:37:50 +0000 (16:37 +0000)]
st/vdpau: do not export VdpPresentationQueueTargetCreateX11

The function pointer is retrieved via VdpGetProcAddress just
like all the other vdpau functions and should not be exported.

Signed-off-by: Emil Velikov <emil.l.velikov@gmail.com>
Reviewed-by: Matt Turner <mattst88@gmail.com>
Reviewed-by: Christian König <christian.koenig@amd.com>
10 years agowayland-egl: automake: add symbol test
Emil Velikov [Fri, 7 Feb 2014 19:06:02 +0000 (19:06 +0000)]
wayland-egl: automake: add symbol test

Signed-off-by: Emil Velikov <emil.l.velikov@gmail.com>
Reviewed-by: Matt Turner <mattst88@gmail.com>
10 years agost/egl: automake: avoid exporting all symbols
Emil Velikov [Fri, 7 Feb 2014 18:48:21 +0000 (18:48 +0000)]
st/egl: automake: avoid exporting all symbols

Signed-off-by: Emil Velikov <emil.l.velikov@gmail.com>
Reviewed-by: Matt Turner <mattst88@gmail.com>
10 years agotargets/egl-static: automake: don't export local symbols
Emil Velikov [Fri, 7 Feb 2014 18:44:19 +0000 (18:44 +0000)]
targets/egl-static: automake: don't export local symbols

Signed-off-by: Emil Velikov <emil.l.velikov@gmail.com>
Reviewed-by: Matt Turner <mattst88@gmail.com>
10 years agogbm: automake: add symbol tests
Emil Velikov [Fri, 7 Feb 2014 16:08:04 +0000 (16:08 +0000)]
gbm: automake: add symbol tests

Signed-off-by: Emil Velikov <emil.l.velikov@gmail.com>
10 years agotargets/gbm: automake: do not export internal symbols
Emil Velikov [Sat, 25 Jan 2014 17:59:36 +0000 (17:59 +0000)]
targets/gbm: automake: do not export internal symbols

Add VISIBILITY_CFLAGS to automake build, so that
only required symbols are exported.

v2: Rebase

Signed-off-by: Emil Velikov <emil.l.velikov@gmail.com>
Reviewed-by: Matt Turner <mattst88@gmail.com>
10 years agogbm: do not export _gbm_mesa_get_device
Emil Velikov [Sat, 25 Jan 2014 17:19:10 +0000 (17:19 +0000)]
gbm: do not export _gbm_mesa_get_device

This symbol is internal and was never part of the API.
Unused by any of the gbm backends, it makes sense to
simply not export it.

Cc: Kristian Høgsberg <krh@bitplanet.net>
Signed-off-by: Emil Velikov <emil.l.velikov@gmail.com>
Reviewed-by: Matt Turner <mattst88@gmail.com>
10 years agogbm: automake: add
Emil Velikov [Sat, 25 Jan 2014 17:22:05 +0000 (17:22 +0000)]
gbm: automake: add
VISIBILITY_CFLAGS

Currently the library exports every symbol imaginable,
rather than the ones defined by the API.

Note: This may cause issues for libraries that are linking
agaist libgbm's internals.

Cc: Kristian Høgsberg <krh@bitplanet.net>
Signed-off-by: Emil Velikov <emil.l.velikov@gmail.com>
Reviewed-by: Matt Turner <mattst88@gmail.com>
10 years agost/gbm: automake: do not export gbm_gallium_drm_device_create
Emil Velikov [Fri, 7 Feb 2014 20:06:56 +0000 (20:06 +0000)]
st/gbm: automake: do not export gbm_gallium_drm_device_create

Symbol is internal and was never meant to be exported.

Signed-off-by: Emil Velikov <emil.l.velikov@gmail.com>
Reviewed-by: Matt Turner <mattst88@gmail.com>
10 years agoauxiliary/pipe-loader: automake: avoid exporting all symbols
Emil Velikov [Fri, 7 Feb 2014 19:58:20 +0000 (19:58 +0000)]
auxiliary/pipe-loader: automake: avoid exporting all symbols

Signed-off-by: Emil Velikov <emil.l.velikov@gmail.com>
Reviewed-by: Matt Turner <mattst88@gmail.com>
10 years agoegl/dri2/android: free driver_name in dri2_initialize_android error path
Emil Velikov [Sat, 25 Jan 2014 15:56:59 +0000 (15:56 +0000)]
egl/dri2/android: free driver_name in dri2_initialize_android error path

v2:
Cleanup driver name if dri2_load_driver() fails. Spotted by Chad

Signed-off-by: Emil Velikov <emil.l.velikov@gmail.com>
10 years agodri/nouveau: Pass the API into _mesa_initialize_context
Emil Velikov [Sat, 25 Jan 2014 15:23:41 +0000 (15:23 +0000)]
dri/nouveau: Pass the API into _mesa_initialize_context

Currently we create a OPENGL_COMPAT context regardless of
what was requested by the program. Correct that by retaining
the program's request and passing it into _mesa_initialize_context.

Based on a similar commit for radeon/r200 by Ian Romanick.

Cc: "9.1 9.2 10.0" <mesa-stable@lists.freedesktop.org>
Signed-off-by: Emil Velikov <emil.l.velikov@gmail.com>
10 years agoconfigure: cleanup libudev handling
Emil Velikov [Wed, 29 Jan 2014 17:19:46 +0000 (17:19 +0000)]
configure: cleanup libudev handling

Add the explicit note about the required version during configure.
Require the same version (151) of udev when building the pipe-loader.
Mention the udev version requirement in GBM Requires.private.

v2: Resolve a couple of silly typos. Spotted by Ilia
v3: Cleanup platfrom/platform typo. Spotten by Stefan

Signed-off-by: Emil Velikov <emil.l.velikov@gmail.com>
10 years agogbm: drop unneeded dependency of libudev
Emil Velikov [Wed, 29 Jan 2014 16:25:12 +0000 (16:25 +0000)]
gbm: drop unneeded dependency of libudev

As of recently we dlopen the library, additionally the only
code that is including the libudev.h header, is the loader.

Signed-off-by: Emil Velikov <emil.l.velikov@gmail.com>
10 years agoopencl: do not link against libudev
Emil Velikov [Wed, 29 Jan 2014 17:04:19 +0000 (17:04 +0000)]
opencl: do not link against libudev

Previously the linking was required due to dependency of udev in the
pipe-loader. Now this is no longer the case, as we dlopen the library.

Signed-off-by: Emil Velikov <emil.l.velikov@gmail.com>
10 years agogallium/tests: do not link against libudev
Emil Velikov [Wed, 29 Jan 2014 17:03:29 +0000 (17:03 +0000)]
gallium/tests: do not link against libudev

Previously the linking was required due to dependency of udev in the
pipe-loader. Now this is no longer the case, as we dlopen the library.

Signed-off-by: Emil Velikov <emil.l.velikov@gmail.com>
10 years agoegl-static: stop linking against libudev
Emil Velikov [Wed, 29 Jan 2014 16:21:46 +0000 (16:21 +0000)]
egl-static: stop linking against libudev

No longer required since all the udev code is in the loader.

Signed-off-by: Emil Velikov <emil.l.velikov@gmail.com>
10 years agoegl_dri2: remove LIBUDEV_CFLAGS from Makefile.am
Emil Velikov [Wed, 29 Jan 2014 16:51:14 +0000 (16:51 +0000)]
egl_dri2: remove LIBUDEV_CFLAGS from Makefile.am

None of the code within builds or (explicitly) requires udev.

Signed-off-by: Emil Velikov <emil.l.velikov@gmail.com>
10 years agoconfigure: drop LIBUDEV_CFLAGS from X11_INCLUDES
Emil Velikov [Wed, 29 Jan 2014 16:49:41 +0000 (16:49 +0000)]
configure: drop LIBUDEV_CFLAGS from X11_INCLUDES

The cflags are explicitly included in the only Makefile that
handles udev dependant code.

Signed-off-by: Emil Velikov <emil.l.velikov@gmail.com>
10 years agopipe-loader: drop obsolete libudev.h include
Emil Velikov [Wed, 29 Jan 2014 16:23:42 +0000 (16:23 +0000)]
pipe-loader: drop obsolete libudev.h include

All the udev code is in the loader, so there is no
reason for us to include this header.

Signed-off-by: Emil Velikov <emil.l.velikov@gmail.com>
10 years agoconfigure: error out when building radeonsi without gallium-llvm
Emil Velikov [Fri, 7 Feb 2014 22:13:44 +0000 (22:13 +0000)]
configure: error out when building radeonsi without gallium-llvm

--enable-gallium-llvm is required by radeonsi. Currently we
check only for LLVM_VERSION_INT which is 0, whenever gallium-llvm
is disabled explicitly.

./configure --with-gallium-drivers=r600,radeonsi --disable-gallium-llvm

v2: Correct typo in error message. Spotted by Tom Stellard

Signed-off-by: Emil Velikov <emil.l.velikov@gmail.com>
10 years agoomx/radeonsi: fix target
Christian König [Tue, 11 Feb 2014 15:58:24 +0000 (16:58 +0100)]
omx/radeonsi: fix target

Another minor typo.

Signed-off-by: Christian König <christian.koenig@amd.com>
10 years agoomx: fix some minor configure.ac issues
Christian König [Tue, 11 Feb 2014 15:55:30 +0000 (16:55 +0100)]
omx: fix some minor configure.ac issues

Matt Turner noted the incorrect order, but I somehow forgotten to
change it before pushing upstream. The other one is a typo during rebase.

Signed-off-by: Christian König <christian.koenig@amd.com>
10 years agovl: add H264 encoding interface
Christian König [Mon, 15 Jul 2013 15:16:22 +0000 (09:16 -0600)]
vl: add H264 encoding interface

Signed-off-by: Christian König <christian.koenig@amd.com>
Signed-off-by: Leo Liu <leo.liu@amd.com>
10 years agoi965: Don't call abort() on an unknown device.
Kenneth Graunke [Mon, 10 Feb 2014 09:54:23 +0000 (01:54 -0800)]
i965: Don't call abort() on an unknown device.

If we don't recognize the PCI ID, we can't reasonably load the driver.
However, calling abort() is quite rude - it means the application that
tried to initialize us (possibly the X server) can't continue via
fallback paths.  We already have a more polite mechanism - failing to
create the context.  So, just use that.

While we're at it, improve the error message.

Bugzilla: https://bugs.freedesktop.org/show_bug.cgi?id=73024
Signed-off-by: Kenneth Graunke <kenneth@whitecape.org>
Reviewed-by: Ian Romanick <ian.d.romanick@intel.com>
Tested-by: Lu Hua <huax.lu@intel.com>
10 years agoglsl: Add locking to builtin_builder singleton
Daniel Kurtz [Fri, 7 Feb 2014 11:29:06 +0000 (19:29 +0800)]
glsl: Add locking to builtin_builder singleton

Consider a multithreaded program with two contexts A and B, and the
following scenario:

1. Context A calls initialize(), which allocates mem_ctx and starts
   building built-ins.
2. Context B calls initialize(), which sees mem_ctx != NULL and assumes
   everything is already set up.  It returns.
3. Context B calls find(), which fails to find the built-in since it
   hasn't been created yet.
4. Context A finally finishes initializing the built-ins.

This will break at step 3.  Adding a lock ensures that subsequent
callers of initialize() will wait until initialization is actually
complete.

Similarly, if any thread calls release while another thread is still
initializing, or calling find(), the mem_ctx/shader would get free'd while
from under it, leading to corruption or use-after-free crashes.

Fixes sporadic failures in Piglit's glx-multithread-shader-compile.

Bugzilla: https://bugs.freedesktop.org/69200
Signed-off-by: Daniel Kurtz <djkurtz@chromium.org>
Signed-off-by: Kenneth Graunke <kenneth@whitecape.org>
Reviewed-by: Kenneth Graunke <kenneth@whitecape.org>
Cc: "10.1 10.0" <mesa-stable@lists.freedesktop.org>
10 years agoi965/fs: Simplify FS_OPCODE_SET_OMASK stride mashing a bit.
Kenneth Graunke [Mon, 10 Feb 2014 23:37:09 +0000 (15:37 -0800)]
i965/fs: Simplify FS_OPCODE_SET_OMASK stride mashing a bit.

In the first case, we can simply call stride(mask, 16, 8, 2) rather than
creating a new register with a different stride, then immediately
changing it a second time.

In the second case, the stride was already what we wanted, so we can
just use mask without any changes at all.

Signed-off-by: Kenneth Graunke <kenneth@whitecape.org>
Reviewed-by: Ian Romanick <ian.d.romanick@intel.com>