mesa.git
7 years agoi965: Return Q and UQ types for int64 and uint64
Ian Romanick [Thu, 1 Sep 2016 18:45:22 +0000 (11:45 -0700)]
i965: Return Q and UQ types for int64 and uint64

It seems like maybe this should return a different type based on Gen.  Q
and UQ only exist on Gen8+, but, based on the old comment, I believe
previous Gens can generate 64-bit moves.

Signed-off-by: Ian Romanick <ian.d.romanick@intel.com>
Reviewed-by: Matt Turner <mattst88@gmail.com>
7 years agoi965: Really don't emit Q or UQ moves on Gen < 8
Ian Romanick [Mon, 24 Oct 2016 06:47:14 +0000 (23:47 -0700)]
i965: Really don't emit Q or UQ moves on Gen < 8

It's much easier to do this in the generator rather than while coming
out of NIR.  brw_type_for_nir_type doesn't know the Gen, so we'd have to
add a bunch of plumbing.  The alternate fix is to not emit int64 moves
for doubles in the first place... but that seems even more difficult.

This change won't catch non-MOV instructions that try to use 64-bit
integer types on Gen < 8.  This may convert certain kinds of bugs in to
different kinds of bugs that are more difficult to detect (since the
assertions in the function won't catch them).

NOTE: I don't think anything can emit mixed-type 64-bit moves until the
same platform supports both ARB_gpu_shader_fp64 and
ARB_gpu_shader_int64.  When we enable int64 on Gen < 8, we can solve
this problem other ways.

This prevents regressions on HSW in the next patch.

Signed-off-by: Ian Romanick <ian.d.romanick@intel.com>
Reviewed-by: Matt Turner <mattst88@gmail.com>
7 years agonir: Add support for 64-bit integer types to split_var_copies_block
Ian Romanick [Wed, 7 Sep 2016 21:43:30 +0000 (14:43 -0700)]
nir: Add support for 64-bit integer types to split_var_copies_block

Signed-off-by: Ian Romanick <ian.d.romanick@intel.com>
Reviewed-by: Connor Abbott <cwabbott0@gmail.com>
7 years agonir: Enable 64-bit integer support for almost all unary and binary operations
Ian Romanick [Sat, 3 Sep 2016 01:46:55 +0000 (18:46 -0700)]
nir: Enable 64-bit integer support for almost all unary and binary operations

v2: Don't up-convert the shift count parameter if shift instructions.
Suggested by Connor.  Add type_is_singed() function.  This will make
adding 8- and 16-bit types easier.

Signed-off-by: Ian Romanick <ian.d.romanick@intel.com>
Reviewed-by: Connor Abbott <cwabbott0@gmail.com>
Cc: Jason Ekstrand <jason@jlekstrand.net>
7 years agonir: Shift count for shift opcodes is always 32-bits
Ian Romanick [Thu, 27 Oct 2016 10:02:58 +0000 (03:02 -0700)]
nir: Shift count for shift opcodes is always 32-bits

Previously both sources were unsized.  This caused problems when the
thing being shifted was 64-bit but the shift count was 32-bit.  The
expectation in NIR is that all unsized sources (and destination) will
ultimately have the same size.

The changes in nir_opt_algebraic.py are to prevent errors like:

 Failed to parse transformation:
03:12:25   (('extract_i8', 'a', 'b'), ('ishr', ('ishl', 'a', ('imul', ('isub', 3, 'b'), 8)), 24), 'options->lower_extract_byte')
03:12:25 Traceback (most recent call last):
03:12:25   File "/home/jenkins/workspace/Leeroy_2/repos/mesa/src/compiler/nir/nir_algebraic.py", line 610, in __init__
03:12:25     xform = SearchAndReplace(xform)
03:12:25   File "/home/jenkins/workspace/Leeroy_2/repos/mesa/src/compiler/nir/nir_algebraic.py", line 495, in __init__
03:12:25     BitSizeValidator(varset).validate(self.search, self.replace)
03:12:25   File "/home/jenkins/workspace/Leeroy_2/repos/mesa/src/compiler/nir/nir_algebraic.py", line 311, in validate
03:12:25     validate_dst_class = self._validate_bit_class_up(replace)
03:12:25   File "/home/jenkins/workspace/Leeroy_2/repos/mesa/src/compiler/nir/nir_algebraic.py", line 414, in _validate_bit_class_up
03:12:25     src_class = self._validate_bit_class_up(val.sources[i])
03:12:25   File "/home/jenkins/workspace/Leeroy_2/repos/mesa/src/compiler/nir/nir_algebraic.py", line 420, in _validate_bit_class_up
03:12:25     assert src_class == src_type_bits
03:12:25 AssertionError

Signed-off-by: Ian Romanick <ian.d.romanick@intel.com>
Suggested-by: Connor Abbott <cwabbott0@gmail.com>
Reviewed-by: Connor Abbott <cwabbott0@gmail.com>
Cc: Jason Ekstrand <jason@jlekstrand.net>
7 years agonir: Lower packing and unpacking of 64-bit integer types
Ian Romanick [Fri, 2 Sep 2016 15:09:53 +0000 (08:09 -0700)]
nir: Lower packing and unpacking of 64-bit integer types

This change makes me wonder whether double packing should be
reimplemented as int64BitsToDouble(packInt2x32(v)).  I'm a little on the
fence since not all platforms that support fp64 natively support int64.

Signed-off-by: Ian Romanick <ian.d.romanick@intel.com>
Reviewed-by: Connor Abbott <cwabbott0@gmail.com>
7 years agonir: Add 64-bit integer support for conversions and bitcasts
Ian Romanick [Thu, 1 Sep 2016 22:21:04 +0000 (15:21 -0700)]
nir: Add 64-bit integer support for conversions and bitcasts

v2 (idr): "cut them down later" => Remove ir_unop_b2u64 and
ir_unop_u642b.  Handle these with extra i2u or u2i casts just like
uint(bool) and bool(uint) conversion is done.

v3 (idr): Make the "from" type in a cast unsized.  This reduces the
number of required cast operations at the expensive slightly more
complex code.  However, this will be a dramatic improvement when other
sized integer types are added.  Suggested by Connor.

Signed-off-by: Ian Romanick <ian.d.romanick@intel.com>
Reviewed-by: Connor Abbott <cwabbott0@gmail.com>
7 years agonir: Add 64-bit integer constant support
Ian Romanick [Thu, 1 Sep 2016 21:17:49 +0000 (14:17 -0700)]
nir: Add 64-bit integer constant support

v2: Rebase on 19a541f (nir: Get rid of nir_constant_data)

Signed-off-by: Ian Romanick <ian.d.romanick@intel.com>
Reviewed-by: Connor Abbott <cwabbott0@gmail.com> [v1]
7 years agonir: Add GLSL_TYPE_INT64 and GLSL_TYPE_UINT64 to glsl_get_bit_size
Ian Romanick [Thu, 1 Sep 2016 21:11:32 +0000 (14:11 -0700)]
nir: Add GLSL_TYPE_INT64 and GLSL_TYPE_UINT64 to glsl_get_bit_size

Signed-off-by: Ian Romanick <ian.d.romanick@intel.com>
Reviewed-by: Connor Abbott <cwabbott0@gmail.com>
7 years agoglsl: Optimize redundant pack(unpack()) and unpack(pack()) combinations
Ian Romanick [Wed, 12 Oct 2016 22:31:22 +0000 (15:31 -0700)]
glsl: Optimize redundant pack(unpack()) and unpack(pack()) combinations

The lowering passes 64-bit integer operations will generate a lot of
these.

v2: Modify the HANDLE_PACK_UNPACK_INVERSE so that the breaks apply to
the switch instead of the 'do { } while(true)' loop.

Signed-off-by: Ian Romanick <ian.d.romanick@intel.com>
Reviewed-by: Matt Turner <mattst88@gmail.com>
7 years agoglsl: Add a lowering pass for 64-bit integer modulus
Ian Romanick [Tue, 18 Oct 2016 23:47:14 +0000 (16:47 -0700)]
glsl: Add a lowering pass for 64-bit integer modulus

Signed-off-by: Ian Romanick <ian.d.romanick@intel.com>
Reviewed-by: Matt Turner <mattst88@gmail.com>
7 years agoglsl: Add "built-in" functions to do 64%64 => 64 modulus
Ian Romanick [Tue, 18 Oct 2016 23:46:35 +0000 (16:46 -0700)]
glsl: Add "built-in" functions to do 64%64 => 64 modulus

These functions are directly available in shaders.  A #define is added
to detect the presence.  This allows these functions to be tested using
piglit regardless of whether the driver uses them for lowering.  The
GLSL spec says that functions and macros beginning with __ are reserved
for use by the implementation... hey, that's us!

v2: Use function inlining.

Signed-off-by: Ian Romanick <ian.d.romanick@intel.com>
Reviewed-by: Matt Turner <mattst88@gmail.com>
7 years agoglsl: Add a lowering pass for 64-bit integer division
Ian Romanick [Tue, 18 Oct 2016 00:55:18 +0000 (17:55 -0700)]
glsl: Add a lowering pass for 64-bit integer division

Signed-off-by: Ian Romanick <ian.d.romanick@intel.com>
Reviewed-by: Matt Turner <mattst88@gmail.com>
7 years agoglsl: Add "built-in" functions to do 64/64 => 64 division
Ian Romanick [Tue, 18 Oct 2016 00:54:40 +0000 (17:54 -0700)]
glsl: Add "built-in" functions to do 64/64 => 64 division

These functions are directly available in shaders.  A #define is added
to detect the presence.  This allows these functions to be tested using
piglit regardless of whether the driver uses them for lowering.  The
GLSL spec says that functions and macros beginning with __ are reserved
for use by the implementation... hey, that's us!

v2: Use function inlining.

Signed-off-by: Ian Romanick <ian.d.romanick@intel.com>
Reviewed-by: Matt Turner <mattst88@gmail.com>
7 years agoglsl: Add a lowering pass for 64-bit integer sign()
Ian Romanick [Mon, 17 Oct 2016 20:55:54 +0000 (13:55 -0700)]
glsl: Add a lowering pass for 64-bit integer sign()

Signed-off-by: Ian Romanick <ian.d.romanick@intel.com>
Reviewed-by: Matt Turner <mattst88@gmail.com>
7 years agoglsl: Add "built-in" function for 64-bit integer sign()
Ian Romanick [Mon, 17 Oct 2016 20:55:27 +0000 (13:55 -0700)]
glsl: Add "built-in" function for 64-bit integer sign()

These functions are directly available in shaders.  A #define is added
to detect the presence.  This allows these functions to be tested using
piglit regardless of whether the driver uses them for lowering.  The
GLSL spec says that functions and macros beginning with __ are reserved
for use by the implementation... hey, that's us!

Signed-off-by: Ian Romanick <ian.d.romanick@intel.com>
Reviewed-by: Matt Turner <mattst88@gmail.com>
7 years agoglsl: Add a lowering pass for 64-bit integer multiplication
Ian Romanick [Sat, 15 Oct 2016 01:17:16 +0000 (18:17 -0700)]
glsl: Add a lowering pass for 64-bit integer multiplication

v2: Rename lower_64bit.cpp and lower_64bit_test.cpp to lower_int64.
Suggested by Matt.

Signed-off-by: Ian Romanick <ian.d.romanick@intel.com>
Reviewed-by: Matt Turner <mattst88@gmail.com>
7 years agoglsl: Add "built-in" functions to do 64x64 => 64 multiplication
Ian Romanick [Sat, 15 Oct 2016 01:11:51 +0000 (18:11 -0700)]
glsl: Add "built-in" functions to do 64x64 => 64 multiplication

These functions are directly available in shaders.  A #define is added
to detect the presence.  This allows these functions to be tested using
piglit regardless of whether the driver uses them for lowering.  The
GLSL spec says that functions and macros beginning with __ are reserved
for use by the implementation... hey, that's us!

Signed-off-by: Ian Romanick <ian.d.romanick@intel.com>
Reviewed-by: Matt Turner <mattst88@gmail.com>
7 years agoglsl: Move builtin_function related prototypes to a separate file
Ian Romanick [Fri, 14 Oct 2016 18:02:18 +0000 (11:02 -0700)]
glsl: Move builtin_function related prototypes to a separate file

Signed-off-by: Ian Romanick <ian.d.romanick@intel.com>
Reviewed-by: Matt Turner <mattst88@gmail.com>
7 years agoglsl/standalone: Enable ARB_gpu_shader_int64
Ian Romanick [Thu, 15 Sep 2016 18:21:28 +0000 (11:21 -0700)]
glsl/standalone: Enable ARB_gpu_shader_int64

v2: Add missing break in GLSL_TYPE_INT64 case.  Notice by Matt.

Signed-off-by: Ian Romanick <ian.d.romanick@intel.com>
Reviewed-by: Matt Turner <mattst88@gmail.com>
7 years agoi965: Avoid int64 warnings.
Dave Airlie [Mon, 20 Jun 2016 04:55:35 +0000 (14:55 +1000)]
i965: Avoid int64 warnings.

Just add operations to the switch statement here.

v2 (idr): "cut them down later" => Remove ir_unop_b2u64 and
ir_unop_u642b.  Handle these with extra i2u or u2i casts just like
uint(bool) and bool(uint) conversion is done.

Signed-off-by: Dave Airlie <airlied@redhat.com>
Reviewed-by: Ian Romanick <ian.d.romanick@intel.com>
Reviewed-by: Iago Toral Quiroga <itoral@igalia.com>
Reviewed-by: Matt Turner <mattst88@gmail.com>
7 years agoi965: Avoid int64 induced warnings
Dave Airlie [Mon, 20 Jun 2016 04:54:28 +0000 (14:54 +1000)]
i965: Avoid int64 induced warnings

Just add types into unsupported or double equivalent spots.

Signed-off-by: Dave Airlie <airlied@redhat.com>
Reviewed-by: Ian Romanick <ian.d.romanick@intel.com>
Reviewed-by: Iago Toral Quiroga <itoral@igalia.com>
Reviewed-by: Matt Turner <mattst88@gmail.com>
7 years agomesa/program: Add unused ir operations.
Dave Airlie [Fri, 10 Jun 2016 06:18:51 +0000 (16:18 +1000)]
mesa/program: Add unused ir operations.

v2 (idr): "cut them down later" => Remove ir_unop_b2u64 and
ir_unop_u642b.  Handle these with extra i2u or u2i casts just like
uint(bool) and bool(uint) conversion is done.

Reviewed-by: Ian Romanick <ian.d.romanick@intel.com>
Reviewed-by: Matt Turner <mattst88@gmail.com>
7 years agoglsl: Allow GLSL_TYPE_INT64 for ir_unop_abs and ir_unop_sign
Ian Romanick [Sat, 3 Sep 2016 01:35:38 +0000 (18:35 -0700)]
glsl: Allow GLSL_TYPE_INT64 for ir_unop_abs and ir_unop_sign

Signed-off-by: Ian Romanick <ian.d.romanick@intel.com>
Reviewed-by: Matt Turner <mattst88@gmail.com>
7 years agoglsl: Print GLSL_TYPE_UINT64 and GLSL_TYPE_INT64 values
Ian Romanick [Fri, 2 Sep 2016 20:17:48 +0000 (13:17 -0700)]
glsl: Print GLSL_TYPE_UINT64 and GLSL_TYPE_INT64 values

Signed-off-by: Ian Romanick <ian.d.romanick@intel.com>
Reviewed-by: Matt Turner <mattst88@gmail.com>
7 years agoglsl: Add interaction between ARB_gpu_shader_int64 and ARB_shader_clock
Ian Romanick [Fri, 2 Sep 2016 15:54:48 +0000 (08:54 -0700)]
glsl: Add interaction between ARB_gpu_shader_int64 and ARB_shader_clock

If ARB_gpu_shader_int64 is supported, ARB_shader_clock also adds
clockARB() that returns a uint64_t.  Rather than add new opcodes and
intrinsics for this, just wrap the existing intrinsic with a
packUint2x32.

Signed-off-by: Ian Romanick <ian.d.romanick@intel.com>
Reviewed-by: Matt Turner <mattst88@gmail.com>
7 years agoglsl: Add 64-bit integer functions
Dave Airlie [Thu, 9 Jun 2016 00:11:53 +0000 (10:11 +1000)]
glsl: Add 64-bit integer functions

These are all the allowed 64-bit functions from ARB_gpu_shader_int64
spec.

v2: restrict int64/double functions better.

v3 (idr): Delete spurious blank lines.  Suggested by Matt.

Signed-off-by: Dave Airlie <airlied@redhat.com>
Reviewed-by: Ian Romanick <ian.d.romanick@intel.com>
Reviewed-by: Matt Turner <mattst88@gmail.com>
7 years agoglsl/varying_packing: Add 64-bit integer support
Dave Airlie [Thu, 9 Jun 2016 00:11:16 +0000 (10:11 +1000)]
glsl/varying_packing: Add 64-bit integer support

As for the double code, but using the 64-bit integer conversions.

v2 (idr): Remove some spurious u2i() and i2u() operations when packing
and unpacking, respectively, int64_t varyings.

Signed-off-by: Dave Airlie <airlied@redhat.com>
Reviewed-by: Ian Romanick <ian.d.romanick@intel.com> [v1]
Reviewed-by: Matt Turner <mattst88@gmail.com>
7 years agoglsl/ast: Add 64-bit integer support in some places.
Dave Airlie [Thu, 9 Jun 2016 00:10:26 +0000 (10:10 +1000)]
glsl/ast: Add 64-bit integer support in some places.

Just add support in two more places in ast parsing.

Signed-off-by: Dave Airlie <airlied@redhat.com>
Reviewed-by: Ian Romanick <ian.d.romanick@intel.com>
Reviewed-by: Matt Turner <mattst88@gmail.com>
7 years agoglsl: Add 64-bit integer support to some operations.
Dave Airlie [Thu, 9 Jun 2016 00:08:50 +0000 (10:08 +1000)]
glsl: Add 64-bit integer support to some operations.

This adds 64-bit integer support to some AST and IR operations where
it is needed.

Signed-off-by: Dave Airlie <airlied@redhat.com>
Reviewed-by: Ian Romanick <ian.d.romanick@intel.com>
7 years agoglsl/ir_builder: Add support for some 64-bit bitcasts.
Dave Airlie [Thu, 9 Jun 2016 00:01:40 +0000 (10:01 +1000)]
glsl/ir_builder: Add support for some 64-bit bitcasts.

We need builder support to implement some of the builtins.

Signed-off-by: Dave Airlie <airlied@redhat.com>
Reviewed-by: Ian Romanick <ian.d.romanick@intel.com>
Reviewed-by: Matt Turner <mattst88@gmail.com>
7 years agoglsl/ast: Add 64-bit integer support to conversion functions
Dave Airlie [Thu, 9 Jun 2016 00:01:00 +0000 (10:01 +1000)]
glsl/ast: Add 64-bit integer support to conversion functions

This adds support to call the new operations on conversions.

v2 (idr): Delete an unnecessary break-statement.  Noticed by Matt.  Add
a missing blank line.  Noticed by Ian.

v3 (idr): "cut them down later" => Remove ir_unop_b2u64 and
ir_unop_u642b.  Handle these with extra i2u or u2i casts just like
uint(bool) and bool(uint) conversion is done.

Signed-off-by: Dave Airlie <airlied@redhat.com>
Reviewed-by: Ian Romanick <ian.d.romanick@intel.com> [v1]
Reviewed-by: Matt Turner <mattst88@gmail.com> [v2]
Reviewed-by: Nicolai Hähnle <nicolai.haehnle@amd.com>
7 years agoglsl: Add 64-bit integer support for constant expressions
Dave Airlie [Wed, 8 Jun 2016 23:58:40 +0000 (09:58 +1000)]
glsl: Add 64-bit integer support for constant expressions

This just adds the new operations and add 64-bit integer support to all
the existing cases where it is needed.

v2: fix some issues found in testing.
v2.1: add unreachable (Ian), add missing int/uint pack/unpack (Dave).

v3 (idr): Rebase on top of idr's series to generate
ir_expression_operation_constant.h. In addition, this version:

    Adds missing support for ir_unop_bit_not, ir_binop_all_equal,
    ir_binop_any_nequal, ir_binop_vector_extract,
    ir_triop_vector_insert, and ir_quadop_vector.

    Removes support for uint64_t from ir_unop_abs and ir_unop_sign.

v4 (idr): "cut them down later" => Remove ir_unop_b2u64 and
ir_unop_u642b.  Handle these with extra i2u or u2i casts just like
uint(bool) and bool(uint) conversion is done.

Signed-off-by: Dave Airlie <airlied@redhat.com>
Signed-off-by: Ian Romanick <ian.d.romanick@intel.com>
Reviewed-by: Ian Romanick <ian.d.romanick@intel.com> [v2]
Reviewed-by: Matt Turner <mattst88@gmail.com> [v3]
Reviewed-by: Nicolai Hähnle <nicolai.haehnle@amd.com>
7 years agoglsl/ir: Add support for 64-bit integer conversions.
Dave Airlie [Wed, 8 Jun 2016 23:52:52 +0000 (09:52 +1000)]
glsl/ir: Add support for 64-bit integer conversions.

This adds all the conversions in the world, I'm not 100% sure of all of
these are needed, but add all of them and we can cut them down later.

v2: fix issue with packing output types.

v3 (idr): Rebase on top of idr's series to generate
ir_expression_operation_constant.h.  Fix transposed ir_validate
assertions for ir_unop_u642i64 and ir_unop_i642u64.  Add missing
automatic type setup for ir_unop_u642i64 and ir_unop_i642u64.

v4 (idr): "cut them down later" => Remove ir_unop_b2u64 and
ir_unop_u642b.  Handle these with extra i2u or u2i casts just like
uint(bool) and bool(uint) conversion is done.

Signed-off-by: Dave Airlie <airlied@redhat.com>
Signed-off-by: Ian Romanick <ian.d.romanick@intel.com>
Reviewed-by: Ian Romanick <ian.d.romanick@intel.com> [v2]
Reviewed-by: Matt Turner <mattst88@gmail.com> [v3]
Reviewed-by: Nicolai Hähnle <nicolai.haehnle@amd.com>
7 years agoglsl: Add 64-bit integer support to uniform initialiser code
Dave Airlie [Wed, 8 Jun 2016 23:50:54 +0000 (09:50 +1000)]
glsl: Add 64-bit integer support to uniform initialiser code

Just add support to the double case, same code should work.

Signed-off-by: Dave Airlie <airlied@redhat.com>
Reviewed-by: Ian Romanick <ian.d.romanick@intel.com>
Reviewed-by: Matt Turner <mattst88@gmail.com>
7 years agoglsl/varyings: Add 64-bit integer support.
Dave Airlie [Wed, 8 Jun 2016 23:50:03 +0000 (09:50 +1000)]
glsl/varyings: Add 64-bit integer support.

This adds 64-bit ints to the link_varyings 64-bit support.

Signed-off-by: Dave Airlie <airlied@redhat.com>
Reviewed-by: Ian Romanick <ian.d.romanick@intel.com>
Reviewed-by: Matt Turner <mattst88@gmail.com>
7 years agoglsl/ast/ir: Add 64-bit integer constant support
Dave Airlie [Wed, 8 Jun 2016 23:39:48 +0000 (09:39 +1000)]
glsl/ast/ir: Add 64-bit integer constant support

This adds support for 64-bit integer constants to the parser,
ast and ir.

v2: fix a few issues found in testing.

v3: Add missing ir_constant copy contructor support.

v4: Use PRIu64 and PRId64 in printfs in glsl_parser_extras.cpp.
Suggested by Nicolai.  Rebase on Marek's linalloc changes.

Signed-off-by: Dave Airlie <airlied@redhat.com>
Reviewed-by: Ian Romanick <ian.d.romanick@intel.com> [v2]
Reviewed-by: Matt Turner <mattst88@gmail.com> [v3]
Reviewed-by: Nicolai Hähnle <nicolai.haehnle@amd.com>
7 years agomesa: Add support for 64-bit integer uniforms
Dave Airlie [Wed, 8 Jun 2016 23:20:19 +0000 (09:20 +1000)]
mesa: Add support for 64-bit integer uniforms

This hooks up the API to the internals for 64-bit integer uniforms.

v2: update to use non-strict aliased alternatives

Signed-off-by: Dave Airlie <airlied@redhat.com>
Reviewed-by: Ian Romanick <ian.d.romanick@intel.com>
Reviewed-by: Matt Turner <mattst88@gmail.com>
7 years agoglsl: Add basic ARB_gpu_shader_int64 types
Dave Airlie [Wed, 8 Jun 2016 20:38:57 +0000 (06:38 +1000)]
glsl: Add basic ARB_gpu_shader_int64 types

This adds the builtins and the lexer support.

To avoid too many warnings, it adds basic support to the type in a few
other places in mesa, mostly in the trivial places.

It also adds a query to be used later for if a type is an integer 32 or 64.

Signed-off-by: Dave Airlie <airlied@redhat.com>
Reviewed-by: Ian Romanick <ian.d.romanick@intel.com>
Reviewed-by: Matt Turner <mattst88@gmail.com>
7 years agoglsl: Add ARB_gpu_shader_int64 boilerplate.
Dave Airlie [Wed, 8 Jun 2016 20:35:30 +0000 (06:35 +1000)]
glsl: Add ARB_gpu_shader_int64 boilerplate.

This just adds the basic boilerplate support.

Signed-off-by: Dave Airlie <airlied@redhat.com>
Reviewed-by: Ian Romanick <ian.d.romanick@intel.com>
Reviewed-by: Matt Turner <mattst88@gmail.com>
7 years agomesa: Add ARB_gpu_shader_int64 extension bits
Dave Airlie [Wed, 8 Jun 2016 20:34:17 +0000 (06:34 +1000)]
mesa: Add ARB_gpu_shader_int64 extension bits

This just adds the usual boilerplate in mesa core.

Signed-off-by: Dave Airlie <airlied@redhat.com>
Reviewed-by: Ian Romanick <ian.d.romanick@intel.com>
Reviewed-by: Matt Turner <mattst88@gmail.com>
7 years agomapi: Add support for ARB_gpu_shader_int64.
Dave Airlie [Wed, 8 Jun 2016 20:23:13 +0000 (06:23 +1000)]
mapi: Add support for ARB_gpu_shader_int64.

Just add the boilerplate xml code.

v2 (idr): Update dispatch_sanity.  Only add extension functions in core
profile.

v3 (idr): Remove comment line from gl_API.xml.  Suggested by Matt.

Signed-off-by: Dave Airlie <airlied@redhat.com>
Signed-off-by: Ian Romanick <ian.d.romanick@intel.com>
Reviewed-by: Ian Romanick <ian.d.romanick@intel.com> [v1]
Reviewed-by: Matt Turner <mattst88@gmail.com>
7 years agoanv: don't require render target isl bit for depth/stencil surfaces
Lionel Landwerlin [Thu, 19 Jan 2017 16:20:00 +0000 (16:20 +0000)]
anv: don't require render target isl bit for depth/stencil surfaces

Blorp can deal with depth/stencil surfaces blits/copies without the
render target requirement. Also having both render target and
depth/stencil requirement is incompatible from isl's point of view.

This fixes an image creation issue in the high level quality settings
of the Unity3D player, which requires a depth texture with src/dst
transfer & 4x multisampling.

v2: Simply aspect checking condition (Jason)

Signed-off-by: Lionel Landwerlin <lionel.g.landwerlin@intel.com>
Reviewed-by: Jason Ekstrand <jason@jlekstrand.net>
Cc: 13.0 17.0 <mesa-stable@lists.freedesktop.org>
7 years agospirv: don't assert with location decorations on non i/o variables
Lionel Landwerlin [Fri, 13 Jan 2017 16:08:28 +0000 (16:08 +0000)]
spirv: don't assert with location decorations on non i/o variables

Some applications might add location decoration to samplers. Rather
than raising an error it seems it would make more sense to just
discard these decorations.

Signed-off-by: Lionel Landwerlin <lionel.g.landwerlin@intel.com>
Reviewed-by: Jason Ekstrand <jason@jlekstrand.net>
Cc: 17.0 <mesa-stable@lists.freedesktop.org>
7 years agoi965: Validate "Special Cases for Byte Operations"
Matt Turner [Mon, 21 Nov 2016 18:26:57 +0000 (10:26 -0800)]
i965: Validate "Special Cases for Byte Operations"

Do this in general_restrictions_based_on_operand_types() because the two
rules that "Special Cases for Byte Operations" relax are checked there.

7 years agoi965: Validate "Region Alignment Rules"
Matt Turner [Wed, 16 Nov 2016 00:06:51 +0000 (16:06 -0800)]
i965: Validate "Region Alignment Rules"

7 years agoi965: Validate "General Restrictions Based on Operand Types"
Matt Turner [Wed, 9 Nov 2016 20:00:43 +0000 (12:00 -0800)]
i965: Validate "General Restrictions Based on Operand Types"

7 years agoi965: Validate "General Restrictions on Regioning Parameters"
Matt Turner [Sun, 6 Nov 2016 03:49:48 +0000 (20:49 -0700)]
i965: Validate "General Restrictions on Regioning Parameters"

7 years agoi965: Replace reg_type_size[] with a function.
Matt Turner [Wed, 9 Nov 2016 19:04:24 +0000 (11:04 -0800)]
i965: Replace reg_type_size[] with a function.

A function is necessary to handle immediate types.

Reviewed-by: Kenneth Graunke <kenneth@whitecape.org>
7 years agoi965: Validate math instruction sources.
Matt Turner [Sat, 5 Nov 2016 22:49:14 +0000 (15:49 -0700)]
i965: Validate math instruction sources.

Reviewed-by: Kenneth Graunke <kenneth@whitecape.org>
7 years agoi965: Claim that SEND/math has two sources.
Matt Turner [Mon, 7 Nov 2016 05:50:14 +0000 (21:50 -0800)]
i965: Claim that SEND/math has two sources.

src1 must be a descriptor (including the information to determine that
the SEND is doing an extended math operation), but src0 can actually be
null since it serves as the source of the implicit GRF -> MRF move.

Reviewed-by: Kenneth Graunke <kenneth@whitecape.org>
7 years agoi965: Simplify num_sources_from_inst().
Matt Turner [Tue, 22 Nov 2016 05:19:50 +0000 (21:19 -0800)]
i965: Simplify num_sources_from_inst().

desc will always be non-NULL, because brw_validate_instructions() does
not attempt to validate any instructions that fail the
is_unsupported_inst() check.

Reviewed-by: Kenneth Graunke <kenneth@whitecape.org>
7 years agoi965: Factor out send_restrictions() function.
Matt Turner [Mon, 7 Nov 2016 05:23:34 +0000 (21:23 -0800)]
i965: Factor out send_restrictions() function.

Reviewed-by: Kenneth Graunke <kenneth@whitecape.org>
7 years agoi965: Factor out sources_not_null() validation function.
Matt Turner [Mon, 7 Nov 2016 05:20:16 +0000 (21:20 -0800)]
i965: Factor out sources_not_null() validation function.

Reviewed-by: Kenneth Graunke <kenneth@whitecape.org>
7 years agoi965: Structure code so unsupported inst will not generate more errors.
Matt Turner [Tue, 8 Nov 2016 23:42:01 +0000 (15:42 -0800)]
i965: Structure code so unsupported inst will not generate more errors.

We want to rely on brw_opcode_desc() always returning non-NULL in other
validation functions. Other validation functions will be in the else
case of the block added in this patch.

Reviewed-by: Kenneth Graunke <kenneth@whitecape.org>
7 years agoi965: Add a test for the EU assembly validator.
Matt Turner [Sat, 5 Nov 2016 05:34:53 +0000 (22:34 -0700)]
i965: Add a test for the EU assembly validator.

Reviewed-by: Kenneth Graunke <kenneth@whitecape.org>
7 years agoi965: Add a CHECK macro to call more complicated validation funcs.
Matt Turner [Mon, 7 Nov 2016 05:10:29 +0000 (21:10 -0800)]
i965: Add a CHECK macro to call more complicated validation funcs.

Reviewed-by: Kenneth Graunke <kenneth@whitecape.org>
7 years agoi965: Make ERROR_IF usable from other functions.
Matt Turner [Mon, 7 Nov 2016 05:08:24 +0000 (21:08 -0800)]
i965: Make ERROR_IF usable from other functions.

Reviewed-by: Kenneth Graunke <kenneth@whitecape.org>
7 years agoi965: Mark error annotation on correct SIMD16 inst.
Matt Turner [Sun, 20 Nov 2016 03:20:02 +0000 (19:20 -0800)]
i965: Mark error annotation on correct SIMD16 inst.

inst, whose assignment can be seen in the last line of context pointed
to the correct instruction in the SIMD16 program, but src_offset was the
offset from the beginning of the SIMD16 program.

So if an instruction at offset 0x100 in the SIMD16 program was illegal,
we would mark an error on the instruction at offset 0x100 (which is
likely in the SIMD8 program).

Reviewed-by: Kenneth Graunke <kenneth@whitecape.org>
7 years agoi965/vec4: Use UW-typed operands when dest is UW.
Matt Turner [Sun, 20 Nov 2016 04:04:34 +0000 (20:04 -0800)]
i965/vec4: Use UW-typed operands when dest is UW.

Using a UD-typed operand makes the execution size D, and if the size of
the execution type is greater than the size of the destination type, the
destination must be appropriately strided.

We actually just want UW-types all around.

Reviewed-by: Kenneth Graunke <kenneth@whitecape.org>
7 years agoi965: Use W-typed immediate in brw_F32TO16().
Matt Turner [Sun, 20 Nov 2016 08:10:54 +0000 (00:10 -0800)]
i965: Use W-typed immediate in brw_F32TO16().

Reviewed-by: Kenneth Graunke <kenneth@whitecape.org>
7 years agogtest: Update to 1.8.0.
Matt Turner [Sat, 5 Nov 2016 05:20:10 +0000 (22:20 -0700)]
gtest: Update to 1.8.0.

Acked-by: Kenneth Graunke <kenneth@whitecape.org>
7 years agoi965: Don't change F->VF if dest type is DF.
Matt Turner [Wed, 21 Dec 2016 16:12:39 +0000 (11:12 -0500)]
i965: Don't change F->VF if dest type is DF.

We change the immediate source type to VF to allow instruction
compaction, but there are no entires in the compaction table for DF, so
there's no point in doing this.

Additionally, I mixing floating-point types is now allowed except for
F and VF.

7 years agoanv: fix comment typo
Lionel Landwerlin [Mon, 16 Jan 2017 16:05:07 +0000 (16:05 +0000)]
anv: fix comment typo

Signed-off-by: Lionel Landwerlin <lionel.g.landwerlin@intel.com>
Reviewed-by: Jason Ekstrand <jason@jlekstrand.net>
7 years agospirv: fix warn string typo
Lionel Landwerlin [Fri, 13 Jan 2017 16:07:49 +0000 (16:07 +0000)]
spirv: fix warn string typo

Signed-off-by: Lionel Landwerlin <lionel.g.landwerlin@intel.com>
Reviewed-by: Jason Ekstrand <jason@jlekstrand.net>
7 years agoblorp: remove unnecessary struct declaration
Lionel Landwerlin [Fri, 20 Jan 2017 10:58:46 +0000 (10:58 +0000)]
blorp: remove unnecessary struct declaration

Signed-off-by: Lionel Landwerlin <lionel.g.landwerlin@intel.com>
Reviewed-by: Jason Ekstrand <jason@jlekstrand.net>
7 years agoRevert "radeonsi: reject invalid vertex element formats"
Marek Olšák [Fri, 20 Jan 2017 15:00:45 +0000 (16:00 +0100)]
Revert "radeonsi: reject invalid vertex element formats"

This reverts commit 9e4d1d8a7c0d60a6975d186944cd870e06f94773.

It broke arb_vertex_type_10f_11f_11f_rev-draw-vertices, which has
first_non_void == -1.

7 years agogallium: add pipe_screen::resource_changed callback wrappers
Philipp Zabel [Thu, 19 Jan 2017 14:05:42 +0000 (15:05 +0100)]
gallium: add pipe_screen::resource_changed callback wrappers

Add resource_changed to the ddebug, rbug, and trace wrappers. Since it
is optional, there is no need to add it to noop.

Signed-off-by: Philipp Zabel <p.zabel@pengutronix.de>
Suggested-by: Nicolai Hähnle <nhaehnle@gmail.com>
Reviewed-by: Marek Olšák <marek.olsak@amd.com>
Signed-off-by: Lucas Stach <l.stach@pengutronix.de>
7 years agost/mesa: ask pipe driver to recreate derived internal resources when (re-)binding...
Philipp Zabel [Thu, 19 Jan 2017 14:05:41 +0000 (15:05 +0100)]
st/mesa: ask pipe driver to recreate derived internal resources when (re-)binding external textures

Use the resource_changed callback to invalidate internal resources
derived from external textures when they are (re-)bound. This is needed
to comply with the requirement from the GL_OES_EGL_image_external
extension that a call to glBindTexture guarantees that all further
sampling will return values that correspond to the values in the
external texture at or after the time that glBindTexture was called.

Signed-off-by: Philipp Zabel <p.zabel@pengutronix.de>
Reviewed-by: Marek Olšák <marek.olsak@amd.com>
Signed-off-by: Lucas Stach <l.stach@pengutronix.de>
7 years agomesa: update external textures when (re-)binding
Philipp Zabel [Thu, 19 Jan 2017 14:05:40 +0000 (15:05 +0100)]
mesa: update external textures when (re-)binding

To comply with the requirement from the GL_OES_EGL_image_external
extension that a call to glBindTexture guarantees that all further
sampling will return values that correspond to the values in the
external texture at or after the time that glBindTexture was called,
do not bail out early from mesa_BindTextures if the target is
external.
This will later allow the state tracker to instruct the pipe driver
to invalidate internal resources derived from the external texture.

Signed-off-by: Philipp Zabel <p.zabel@pengutronix.de>
Reviewed-by: Marek Olšák <marek.olsak@amd.com>
Signed-off-by: Lucas Stach <l.stach@pengutronix.de>
7 years agoetnaviv: implement resource_changed to invalidate internal resources derived from...
Philipp Zabel [Thu, 19 Jan 2017 14:05:39 +0000 (15:05 +0100)]
etnaviv: implement resource_changed to invalidate internal resources derived from imported buffers

Implement the resource_changed pipe callback to invalidate internal
resources derived from imported buffers. This is needed to update the
texture for re-imported renderables.

Signed-off-by: Philipp Zabel <p.zabel@pengutronix.de>
Reviewed-by: Reviewed-by: Christian Gmeiner <christian.gmeiner@gmail.com>
Signed-off-by: Lucas Stach <l.stach@pengutronix.de>
7 years agoetnaviv: initialize seqno of imported resources
Philipp Zabel [Thu, 19 Jan 2017 14:05:38 +0000 (15:05 +0100)]
etnaviv: initialize seqno of imported resources

Imported resources already have contents that we want to be copied to
texture resources derived from them. Set initial seqno of imported
resources to 1, just as if it had already been rendered to.

Signed-off-by: Philipp Zabel <p.zabel@pengutronix.de>
Reviewed-by: Christian Gmeiner <christian.gmeiner@gmail.com>
Signed-off-by: Lucas Stach <l.stach@pengutronix.de>
7 years agost/dri: ask the driver to update its internal copies on reimport
Philipp Zabel [Thu, 19 Jan 2017 14:05:37 +0000 (15:05 +0100)]
st/dri: ask the driver to update its internal copies on reimport

For imported buffers that can't be used directly as a source to the
texture samplers, the pipe driver might need to create an internal
copy, for example in a different tiling layout. When buffers are
reimported they may contain new image data, so the driver internal
copies need to be recreated.

Signed-off-by: Philipp Zabel <p.zabel@pengutronix.de>
Reviewed-by: Marek Olšák <marek.olsak@amd.com>
Signed-off-by: Lucas Stach <l.stach@pengutronix.de>
7 years agogallium: add pipe_screen::resource_changed
Philipp Zabel [Thu, 19 Jan 2017 14:05:36 +0000 (15:05 +0100)]
gallium: add pipe_screen::resource_changed

Add a hook to tell drivers that an imported resource may have changed
and they need to update their internal derived resources.

Signed-off-by: Philipp Zabel <p.zabel@pengutronix.de>
Reviewed-by: Roland Scheidegger <sroland@vmware.com>
Reviewed-by: Marek Olšák <marek.olsak@amd.com>
Signed-off-by: Lucas Stach <l.stach@pengutronix.de>
7 years agoconfigure.ac: move require_dri_shared_libs_and_glapi() before its users
Emil Velikov [Thu, 19 Jan 2017 15:19:56 +0000 (15:19 +0000)]
configure.ac: move require_dri_shared_libs_and_glapi() before its users

Otherwise we'll get a lovely message as below:
"require_dri_shared_libs_and_glapi: command not found"

Cc: Steven Newbury <steve@snewbury.org.uk>
Reported-by: Steven Newbury <steve@snewbury.org.uk>
Fixes: da410e6afad "configure: explicitly require shared glapi for
enable-dri"
Signed-off-by: Emil Velikov <emil.l.velikov@gmail.com>
Tested-by: Steven Newbury <steve@snewbury.org.uk>
Reviewed-by: Nicolai Hähnle <nicolai.haehnle@amd.com>
7 years agogallium/hud: add missing break in hud_cpufreq_graph_install()
Samuel Pitoiset [Fri, 20 Jan 2017 00:19:49 +0000 (01:19 +0100)]
gallium/hud: add missing break in hud_cpufreq_graph_install()

Fixes: e99b9395bef "gallium/hud: Add support for CPU frequency monitoring"
Cc: mesa-stable@lists.freedesktop.org
Signed-off-by: Samuel Pitoiset <samuel.pitoiset@gmail.com>
Reviewed-by: Emil Velikov <emil.l.velikov@gmail.com>
7 years agoandroid: correct typo in build
Tapani Pälli [Thu, 19 Jan 2017 07:10:34 +0000 (09:10 +0200)]
android: correct typo in build

Fixes: 63c58dfc653c499aab5b8d0ea07f1dc1af88c856
Signed-off-by: Tapani Pälli <tapani.palli@intel.com>
Reviewed-by: Emil Velikov <emil.velikov@collabora.com>
7 years agonir: add min/max optimisation
Elie TOURNIER [Wed, 18 Jan 2017 11:23:22 +0000 (11:23 +0000)]
nir: add min/max optimisation

Add the following optimisations:

min(x, -x) = -abs(x)
min(x, -abs(x)) = -abs(x)
min(x, abs(x)) = x
max(x, -abs(x)) = x
max(x, abs(x)) = abs(x)
max(x, -x) = abs(x)

shader-db:

total instructions in shared programs: 13067779 -> 13067775 (-0.00%)
instructions in affected programs: 249 -> 245 (-1.61%)
helped: 4
HURT: 0

total cycles in shared programs: 252054838 -> 252054806 (-0.00%)
cycles in affected programs: 504 -> 472 (-6.35%)
helped: 2
HURT: 0

Signed-off-by: Elie Tournier <tournier.elie@gmail.com>
Reviewed-by: Plamena Manolova <plamena.manolova@intel.com>
Reviewed-by: Jason Ekstrand <jason@jlekstrand.net>
7 years agonir/algebraic: Only include nir_search_helpers once
Jason Ekstrand [Wed, 18 Jan 2017 17:21:07 +0000 (09:21 -0800)]
nir/algebraic: Only include nir_search_helpers once

We were including it once per value, so probably around 10k times.
Let's not cause the compiler any more work than we have to.

Reviewed-by: Iago Toral Quiroga <itoral@igalia.com>
7 years agoi965: Remove unnecessary mt->compressed checks
Anuj Phogat [Tue, 10 Jan 2017 22:04:19 +0000 (14:04 -0800)]
i965: Remove unnecessary mt->compressed checks

It's harmless to use ALIGN_NPOT() for uncompressed formats
because they have block width/height = 1.

Signed-off-by: Anuj Phogat <anuj.phogat@gmail.com>
Reviewed-by: Alejandro Piñeiro <apinheiro@igalia.com>
7 years agoi965: Fix indentation in brw_miptree_layout_2d()
Anuj Phogat [Tue, 10 Jan 2017 22:03:58 +0000 (14:03 -0800)]
i965: Fix indentation in brw_miptree_layout_2d()

Signed-off-by: Anuj Phogat <anuj.phogat@gmail.com>
Reviewed-by: Alejandro Piñeiro <apinheiro@igalia.com>
7 years agoi965: Fix comment to include 3d textures
Anuj Phogat [Tue, 10 Jan 2017 22:01:00 +0000 (14:01 -0800)]
i965: Fix comment to include 3d textures

Signed-off-by: Anuj Phogat <anuj.phogat@gmail.com>
Reviewed-by: Alejandro Piñeiro <apinheiro@igalia.com>
7 years agoi965: Delete pending CCS and HiZ ops in intel_miptree_make_shareable()
Chad Versace [Wed, 4 Jan 2017 20:33:56 +0000 (12:33 -0800)]
i965: Delete pending CCS and HiZ ops in intel_miptree_make_shareable()

Fixes crash in piglit
`egl_khr_gl_renderbuffer_image-clear-shared-image GL_DEPTH_COMPONENT24`
on Skylake.

The crash happened because blorp attempted to execute a pending hiz
clear after the hiz buffer was deleted. Deleting the pending hiz ops
when the hiz buffer gets deleted fixes the crash.

For good measure, this patch also deletes all pending CCS/MCS ops when
the CCS/MCS buffer gets deleted. I'm now aware of any bugs
caused by the dangling ops, but deleting them is clearly the right thing
to do.

Cc: Ben Widawsky <ben@bwidawsk.net>
Reviewed-by: Jason Ekstrand <jason@jlekstrand.net>
Bugzilla: https://bugs.freedesktop.org/show_bug.cgi?id=99265

7 years agovulkan/wsi: clarify the severity of lack of DRI3 v2
Andres Rodriguez [Wed, 18 Jan 2017 23:07:56 +0000 (18:07 -0500)]
vulkan/wsi: clarify the severity of lack of DRI3 v2

The current message sounds like a small warning, clarify that it can
result in lack of presentation support and application crashes.

v2: add "if they do" (Bas)

Bugzilla: https://bugs.freedesktop.org/show_bug.cgi?id=98263
Signed-off-by: Andres Rodriguez <andresx7@gmail.com>
Acked-by: Jason ekstrand <jason@jlekstrand.net>
Acked-by: Bas Nieuwenhuizen <bas@basnieuwenhuizen.nl>
Reviewed-by: Emil Velikov <emil.velikov@collabora.com>
7 years agoradv: fix include order for installed headers v2
Andres Rodriguez [Wed, 18 Jan 2017 22:48:36 +0000 (17:48 -0500)]
radv: fix include order for installed headers v2

In situations where libdrm_amdgpu and mesa are installed to the same
location, the mesa installed headers will take precedence over the git
source headers.

This is due to the AMDGPU_CFLAGS containing the install directory.

This situation can cause build errors if the git version of a header is
newer than the currently installed version of a header (e.g. git pull
updates vulkan.h)

Note: using the same install prefix for mesa and libdrm is probably a
common occurrence since it is described in the radeonBuildHowTo wiki:
https://www.x.org/wiki/radeonBuildHowTo/

v2: added sign-off

Signed-off-by: Andres Rodriguez <andresx7@gmail.com>
Reviewed-by: Bas Nieuwenhuizen <bas@basnieuwenhuizen.nl>
Reviewed-by: Emil Velikov <emil.velikov@collabora.com>
7 years agodocs/releasing: document post branch version bump
Emil Velikov [Thu, 19 Jan 2017 15:35:38 +0000 (15:35 +0000)]
docs/releasing: document post branch version bump

Signed-off-by: Emil Velikov <emil.velikov@collabora.com>
7 years agomesa: Bump version to 17.1.0-devel
Emil Velikov [Thu, 19 Jan 2017 15:33:29 +0000 (15:33 +0000)]
mesa: Bump version to 17.1.0-devel

Signed-off-by: Emil Velikov <emil.velikov@collabora.com>
7 years agoradeonsi: reject invalid vertex element formats
Marek Olšák [Wed, 18 Jan 2017 21:35:19 +0000 (22:35 +0100)]
radeonsi: reject invalid vertex element formats

This should fix a coverity defect.

Reviewed-by: Samuel Pitoiset <samuel.pitoiset@gmail.com>
Reviewed-by: Nicolai Hähnle <nicolai.haehnle@amd.com>
Reviewed-by: Edward O'Callaghan <funfunctor@folklore1984.net>
7 years agoradeonsi: don't forget to add HTILE to the buffer list for texturing
Marek Olšák [Wed, 18 Jan 2017 21:15:35 +0000 (22:15 +0100)]
radeonsi: don't forget to add HTILE to the buffer list for texturing

This fixes VM faults. Discovered by Samuel Pitoiset.

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

Cc: 17.0 13.0 <mesa-stable@lists.freedesktop.org>
Reviewed-by: Samuel Pitoiset <samuel.pitoiset@gmail.com>
Reviewed-by: Nicolai Hähnle <nicolai.haehnle@amd.com>
Reviewed-by: Edward O'Callaghan <funfunctor@folklore1984.net>
7 years agost/vdpau: only send buffers with B8G8R8A8 format to X
Nayan Deshmukh [Thu, 19 Jan 2017 09:29:28 +0000 (14:59 +0530)]
st/vdpau: only send buffers with B8G8R8A8 format to X

PresentPixmap only works if the pixmap depth matches with the
window depth, otherwise it returns a BadMatch protocol error.
Even if the depths match, the result won't look correctly
if the VDPAU RGB component order doesn't match the X11 one so
we only allow the X11 format.
For other buffers we copy them to a buffer which is send to X.

v2: only send buffers with format VDP_RGBA_FORMAT_B8G8R8A8
v3: reword commit message
v4: add comment explaining the code

Signed-off-by: Nayan Deshmukh <nayan26deshmukh@gmail.com>
Reviewed-by: Christian König <christian.koenig@amd.com>
7 years agoradeonsi: fix texture gather on stencil textures
Nicolai Hähnle [Wed, 18 Jan 2017 08:28:47 +0000 (09:28 +0100)]
radeonsi: fix texture gather on stencil textures

At least on VI, texture gather doesn't work with a 24_8 data format, so
use 8_8_8_8 and a modified swizzle instead.

A bit of background: When creating a GL_STENCIL_INDEX8 texture, we select
the X24S8 pipe format because we don't support stencil-only render targets
properly. With mip-mapping this can lead to a setup where the tiling is
incompatible with stencil texturing, and a flushed stencil texture is
used. For the flushed stencil, a literal X24S8 is used because there were
issues with an 8bpp DB->CB copy.

Longer term, it would be good if we could get away from these workarounds,
i.e. properly support an S8 format for stencil-only rendering and flushed
stencil. Since stencil texturing is somewhat rare, it's not a high
priority.

Fixes GL45-CTS.texture_cube_map_array.sampling.

Cc: 17.0 <mesa-stable@lists.freedesktop.org>
Reviewed-by: Marek Olšák <marek.olsak@amd.com>
Acked-by: Edward O'Callaghan <funfunctor@folklore1984.net>
7 years agomesa/main: Fix FRAMEBUFFER_ATTACHMENT_OBJECT_TYPE for NONE attachment type
Alejandro Piñeiro [Fri, 13 Jan 2017 13:39:24 +0000 (11:39 -0200)]
mesa/main: Fix FRAMEBUFFER_ATTACHMENT_OBJECT_TYPE for NONE attachment type

When the attachment type is NONE (att->Type),
FRAMEBUFFER_ATTACHMENT_OBJECT_TYPE should be NONE always.

Note that technically, the current behaviour follows the spec. From
OpenGL 4.5 spec, Section 9.2.3 "Framebuffer Object Queries":

   "If the value of FRAMEBUFFER_ATTACHMENT_OBJECT_TYPE is NONE, then
    either no framebuffer is bound to target; or the default
    framebuffer is bound, attachment is DEPTH or STENCIL, and the
    number of depth or stencil bits, respectively, is zero."

Reading literally this paragraph, for the default framebuffer, NONE
should be only returned if attachment is DEPTH and STENCIL without
being allocated.

But it doesn't makes too much sense to return DEFAULT_FRAMEBUFFER if
the attachment type is NONE. For example, this can happens if the
attachment is FRONT_RIGHT run on monoscopic mode, as that attachment
is only available on stereo mode.

With the current behaviour, defensive querying of the object type
would not work properly. So you could query the object type checking
for NONE, get DEFAULT_FRAMEBUFFER, and then get and INVALID_OPERATION
when requesting other pnames (like RED_SIZE), as the real attachment
type is NONE.

This fixes:
GL45-CTS.direct_state_access.framebuffers_get_attachment_parameters

v2: don't change the behaviour for att->Type != GL_NONE, as caused
    some ES CTS regressions
v3: simplify condition (Iago)

Reviewed-by: Iago Toral Quiroga <itoral@igalia.com>
7 years agoradeonsi: Always leave poly_offset in a valid state
Zachary Michaels [Thu, 19 Jan 2017 09:50:16 +0000 (10:50 +0100)]
radeonsi: Always leave poly_offset in a valid state

This commit makes si_update_poly_offset set poly_offset to NULL if
uses_poly_offset is false. This way poly_offset either points into the
currently queued rasterizer, or it is NULL.

Bugzilla: https://bugs.freedesktop.org/show_bug.cgi?id=99451
Cc: "13.0 17.0" <mesa-stable@lists.freedesktop.org>
Reviewed-by: Nicolai Hähnle <nicolai.haehnle@amd.com>
7 years agomesa/main: fix meta caller of _mesa_ClampColor
Nicolai Hähnle [Mon, 16 Jan 2017 11:13:50 +0000 (12:13 +0100)]
mesa/main: fix meta caller of _mesa_ClampColor

Since _mesa_ClampColor properly checks for support of the API function
now, it's meta callers need to check support as well.

Fixes: 963311b71f ("mesa/main: fix version/extension checks in _mesa_ClampColor")
Bugzilla: https://bugs.freedesktop.org/show_bug.cgi?id=99401
Tested-by: Mark Janes <mark.a.janes@intel.com>
Reviewed-by: Alejandro Piñeiro <apinheiro@igalia.com>
Cc: "17.0" <mesa-stable@lists.freedesktop.org>
7 years agomesa/glsl: move TransformFeedbackBufferStride to gl_shader
Timothy Arceri [Tue, 22 Nov 2016 09:24:33 +0000 (20:24 +1100)]
mesa/glsl: move TransformFeedbackBufferStride to gl_shader

Here we remove the single use of this field in gl_linked_shader
which allows us to move the field out of gl_shader_info

While we are at it we rewrite link_xfb_stride_layout_qualifiers()
to be more clear.

Reviewed-by: Lionel Landwerlin <lionel.g.landwerlin@intel.com>
7 years agoglsl: exit loop early if we find xfb layout qualifers
Timothy Arceri [Tue, 22 Nov 2016 08:55:29 +0000 (19:55 +1100)]
glsl: exit loop early if we find xfb layout qualifers

Reviewed-by: Lionel Landwerlin <lionel.g.landwerlin@intel.com>
7 years agoglsl: set InnerCoverage directly in gl_program
Timothy Arceri [Mon, 19 Dec 2016 22:44:20 +0000 (09:44 +1100)]
glsl: set InnerCoverage directly in gl_program

Also move out of the shared gl_shader_info.

Reviewed-by: Lionel Landwerlin <lionel.g.landwerlin@intel.com>
7 years agoglsl: tidy up PostDepthCoverage shader field
Timothy Arceri [Mon, 19 Dec 2016 22:39:00 +0000 (09:39 +1100)]
glsl: tidy up PostDepthCoverage shader field

There is no reason for this to be in the shared gl_shader_info or
to copy it to gl_program at the end of linking (its already there).

Reviewed-by: Lionel Landwerlin <lionel.g.landwerlin@intel.com>
7 years agomesa/glsl: move pixel_center_integer to gl_shader
Timothy Arceri [Tue, 22 Nov 2016 08:47:48 +0000 (19:47 +1100)]
mesa/glsl: move pixel_center_integer to gl_shader

This is only used by gl_linked_shader as a temp during linking
so use a temp there instead.

Reviewed-by: Lionel Landwerlin <lionel.g.landwerlin@intel.com>
7 years agomesa/glsl: move origin_upper_left to gl_shader
Timothy Arceri [Tue, 22 Nov 2016 07:50:03 +0000 (18:50 +1100)]
mesa/glsl: move origin_upper_left to gl_shader

This is only used by gl_linked_shader as a temp during linking
so use a temp there instead.

Reviewed-by: Lionel Landwerlin <lionel.g.landwerlin@intel.com>