platform/upstream/mesa.git
7 years agomesa: add KHR_no_error support for flush mapped buffer functions
Timothy Arceri [Thu, 4 May 2017 03:49:02 +0000 (13:49 +1000)]
mesa: add KHR_no_error support for flush mapped buffer functions

Reviewed-by: Eric Anholt <eric@anholt.net>
7 years agomesa: make _mesa_flush_mapped_buffer_range() static
Timothy Arceri [Thu, 4 May 2017 03:39:59 +0000 (13:39 +1000)]
mesa: make _mesa_flush_mapped_buffer_range() static

Reviewed-by: Eric Anholt <eric@anholt.net>
7 years agomesa: add KHR_no_error support for unmap buffer functions
Timothy Arceri [Thu, 4 May 2017 03:31:27 +0000 (13:31 +1000)]
mesa: add KHR_no_error support for unmap buffer functions

Reviewed-by: Eric Anholt <eric@anholt.net>
7 years agomesa: split unmap_buffer() in two
Timothy Arceri [Thu, 4 May 2017 03:26:45 +0000 (13:26 +1000)]
mesa: split unmap_buffer() in two

This will allow us to implement KHR_no_error support for unmap
functions.

Reviewed-by: Eric Anholt <eric@anholt.net>
7 years agomesa: make _mesa_unmap_buffer() static
Timothy Arceri [Thu, 4 May 2017 03:14:27 +0000 (13:14 +1000)]
mesa: make _mesa_unmap_buffer() static

Reviewed-by: Eric Anholt <eric@anholt.net>
7 years agomesa: add KHR_no_error support for some map buffer functions
Timothy Arceri [Thu, 4 May 2017 03:08:57 +0000 (13:08 +1000)]
mesa: add KHR_no_error support for some map buffer functions

Reviewed-by: Eric Anholt <eric@anholt.net>
7 years agomesa: split out validation from map_buffer_range()
Timothy Arceri [Thu, 4 May 2017 02:28:09 +0000 (12:28 +1000)]
mesa: split out validation from map_buffer_range()

This will allow us to add KHR_no_error support for *BufferRange
functions.

Reviewed-by: Eric Anholt <eric@anholt.net>
7 years agomesa: make map_buffer_range() static
Timothy Arceri [Thu, 4 May 2017 02:16:48 +0000 (12:16 +1000)]
mesa: make map_buffer_range() static

Reviewed-by: Eric Anholt <eric@anholt.net>
7 years agoi965: Drop BRW_NEW_BLORP from 3DSTATE_VF atom.
Kenneth Graunke [Thu, 4 May 2017 08:25:21 +0000 (01:25 -0700)]
i965: Drop BRW_NEW_BLORP from 3DSTATE_VF atom.

BLORP doesn't program 3DSTATE_VF, since it doesn't use index buffers,
making the setting irrelevant.  So there's no need to re-emit it after
a BLORP operation - the old setting will still be in place.

Reviewed-by: Topi Pohjolainen <topi.pohjolainen@intel.com>
7 years agoi965: Port 3DSTATE_VF to genxml and simplify the implementation.
Kenneth Graunke [Thu, 4 May 2017 08:17:29 +0000 (01:17 -0700)]
i965: Port 3DSTATE_VF to genxml and simplify the implementation.

The whole "it might be used for non-indexed draws" thing is no longer
true - it turns out this was a mistake, and removed in OpenGL 4.5.
(See Marek's commit 96cbc1ca29e0b1f4f4d6c868b8449999aecb9080.)  So
we can simplify this and just program 0 for non-indexed draws.

We can also use #if blocks to remove the atom on Ivybridge/Baytrail,
now that they have a separate atom list from Haswell.  No more runtime
checks.

Reviewed-by: Topi Pohjolainen <topi.pohjolainen@intel.com>
7 years agomesa: Simplify _mesa_primitive_restart_index().
Kenneth Graunke [Thu, 4 May 2017 08:08:25 +0000 (01:08 -0700)]
mesa: Simplify _mesa_primitive_restart_index().

We can use a simple shift equation rather than a switch statement.

Reviewed-by: Rafael Antognolli <rafael.antognolli@intel.com>
Reviewed-by: Marek Olšák <marek.olsak@amd.com>
7 years agoRevert "radeonsi: constify a bunch of the perfcounter structs."
Marek Olšák [Sat, 6 May 2017 19:15:53 +0000 (21:15 +0200)]
Revert "radeonsi: constify a bunch of the perfcounter structs."

This reverts commit 7088b655e8828bb960f528dd33132de27c505b8f.

It breaks performance counters. If you use them with this commit, they hang
the machine hard. Sysrq and ssh don't work.

7 years agoRevert "radeonsi: fix build with GCC 4.8"
Marek Olšák [Sat, 6 May 2017 19:15:51 +0000 (21:15 +0200)]
Revert "radeonsi: fix build with GCC 4.8"

This reverts commit 485ece83aceb3a35792efbc6fe2bca57ba46c04a.

It's needed to revert 7088b655e8828bb960f528dd33132de27c505b8f.

7 years agofreedreno/a3xx: fix hang w/ large render targets and small gmem
Rob Clark [Sat, 6 May 2017 18:00:35 +0000 (14:00 -0400)]
freedreno/a3xx: fix hang w/ large render targets and small gmem

Possibly other gen's have a similar limit.  Fixes glmark2 -b shadow
with larger resolutions on devices with small gmem (for example,
fullscreen 1080p on 8x16/db410c).

Cc: mesa-stable@lists.freedesktop.org
Signed-off-by: Rob Clark <robdclark@gmail.com>
7 years agofreedreno/ir3: add macro to declare variable length arrays
Rob Clark [Thu, 4 May 2017 18:57:48 +0000 (14:57 -0400)]
freedreno/ir3: add macro to declare variable length arrays

We have enough of these, that we should stop open coding this.

Signed-off-by: Rob Clark <robdclark@gmail.com>
7 years agoglsl: skip tree grafting for sampler and image types
Nicolai Hähnle [Wed, 26 Apr 2017 16:34:27 +0000 (18:34 +0200)]
glsl: skip tree grafting for sampler and image types

v2: - use is_sampler()/is_image() instead (Samuel Pitoiset)

Reviewed-by: Samuel Pitoiset <samuel.pitoiset@gmail.com>
Reviewed-by: Timothy Arceri <tarceri@itsqueeze.com>
7 years agoglsl: teach lower_ubo_reference about samplers inside structures
Samuel Pitoiset [Mon, 1 May 2017 13:53:56 +0000 (15:53 +0200)]
glsl: teach lower_ubo_reference about samplers inside structures

In a situation like:

(tex vec4 (record_ref (var_ref f)  tex)  (constant vec2 (0.000000 0.000000))  0 1 () )

The sampler needs to be lowered, otherwise this ends up with
"ir_dereference_variable @ 0x229a100 specifies undeclared variable
`ubo_load_temp' @ 0x2290440"

Signed-off-by: Samuel Pitoiset <samuel.pitoiset@gmail.com>
Reviewed-by: Nicolai Hähnle <nicolai.haehnle@amd.com>
Reviewed-by: Timothy Arceri <tarceri@itsqueeze.com>
7 years agoglsl: link bindless layout qualifiers
Samuel Pitoiset [Tue, 21 Mar 2017 12:31:05 +0000 (13:31 +0100)]
glsl: link bindless layout qualifiers

From section 4.4.6 of the ARB_bindless_texture spec:

   "If both bindless_sampler and bound_sampler, or bindless_image
    and bound_image, are declared at global scope in any
    compilation unit, a link- time error will be generated."

Signed-off-by: Samuel Pitoiset <samuel.pitoiset@gmail.com>
Reviewed-by: Timothy Arceri <tarceri@itsqueeze.com>
Reviewed-by: Nicolai Hähnle <nicolai.haehnle@amd.com>
7 years agoglsl: do not count bindless samplers/images when linking uniforms
Samuel Pitoiset [Wed, 19 Apr 2017 19:57:02 +0000 (21:57 +0200)]
glsl: do not count bindless samplers/images when linking uniforms

From section 2.14.8 of the ARB_bindless_texture spec:

    "(modify second paragraph, p. 126) ... against the
     MAX_COMBINED_TEXTURE_IMAGE_UNITS limit.  Samplers accessed
     using texture handles (section 3.9.X) are not counted against
     this limit."

Signed-off-by: Samuel Pitoiset <samuel.pitoiset@gmail.com>
Reviewed-by: Nicolai Hähnle <nicolai.haehnle@amd.com>
Reviewed-by: Timothy Arceri <tarceri@itsqueeze.com>
7 years agoglsl: lower bindless sampler/image packed varyings
Samuel Pitoiset [Fri, 21 Apr 2017 12:37:24 +0000 (14:37 +0200)]
glsl: lower bindless sampler/image packed varyings

v3: - rebase (and remove (sampler) ? 1 : vector_elements)

Signed-off-by: Samuel Pitoiset <samuel.pitoiset@gmail.com>
Reviewed-by: Nicolai Hähnle <nicolai.haehnle@amd.com>
Reviewed-by: Timothy Arceri <tarceri@itsqueeze.com>
7 years agoglsl: implement ARB_bindless_texture conversions
Samuel Pitoiset [Fri, 21 Apr 2017 13:27:15 +0000 (15:27 +0200)]
glsl: implement ARB_bindless_texture conversions

From section 5.4.1 of the ARB_bindless_texture spec:

   "In the following four constructors, the low 32 bits of the
    sampler type correspond to the .x component of the uvec2 and
    the high 32 bits correspond to the .y component."

    uvec2(any sampler type)     // Converts a sampler type to a
                                //   pair of 32-bit unsigned integers
    any sampler type(uvec2)     // Converts a pair of 32-bit unsigned integers to
                                //   a sampler type
    uvec2(any image type)       // Converts an image type to a
                                //   pair of 32-bit unsigned integers
    any image type(uvec2)       // Converts a pair of 32-bit unsigned integers to
                                //   an image type

v4: - fix up comment style
v3: - rebase (and remove (sampler) ? 1 : vector_elements)

Signed-off-by: Samuel Pitoiset <samuel.pitoiset@gmail.com>
Reviewed-by: Nicolai Hähnle <nicolai.haehnle@amd.com>
Reviewed-by: Timothy Arceri <tarceri@itsqueeze.com>
7 years agoglsl: allow bindless samplers/images to be used with constructors
Samuel Pitoiset [Fri, 21 Apr 2017 16:45:42 +0000 (18:45 +0200)]
glsl: allow bindless samplers/images to be used with constructors

For the explicit conversions.

From section 4.1.7 of the ARB_bindless_texture spec:

   "Samplers are represented using 64-bit integer handles, and
    may be converted to and from 64-bit integers using constructors."

From section 4.1.X of the ARB_bindless_texture spec:

   "Images are represented using 64-bit integer handles, and
    may be converted to and from 64-bit integers using constructors."

v3: - add spec comment
    - update the glsl error message

Signed-off-by: Samuel Pitoiset <samuel.pitoiset@gmail.com>
Reviewed-by: Timothy Arceri <tarceri@itsqueeze.com> (v2)
Reviewed-by: Nicolai Hähnle <nicolai.haehnle@amd.com>
7 years agoglsl: add is_valid_constructor() helper function
Samuel Pitoiset [Fri, 21 Apr 2017 14:31:52 +0000 (16:31 +0200)]
glsl: add is_valid_constructor() helper function

This will help for the explicit conversions for sampler and
image types as specified by ARB_bindless_texture.

Signed-off-by: Samuel Pitoiset <samuel.pitoiset@gmail.com>
Reviewed-by: Timothy Arceri <tarceri@itsqueeze.com>
Reviewed-by: Nicolai Hähnle <nicolai.haehnle@amd.com>
7 years agoglsl: add ARB_bindless_texture operations
Samuel Pitoiset [Fri, 21 Apr 2017 12:35:32 +0000 (14:35 +0200)]
glsl: add ARB_bindless_texture operations

For the explicit pack/unpack conversions.

Signed-off-by: Samuel Pitoiset <samuel.pitoiset@gmail.com>
Reviewed-by: Timothy Arceri <tarceri@itsqueeze.com>
Reviewed-by: Nicolai Hähnle <nicolai.haehnle@amd.com>
7 years agoglsl: allow bindless samplers/images to be initialized
Samuel Pitoiset [Fri, 21 Apr 2017 17:27:16 +0000 (19:27 +0200)]
glsl: allow bindless samplers/images to be initialized

From section 4.1.7 of the ARB_bindless_texture spec:

   "Samplers may be declared as shader inputs and outputs, as uniform
    variables, as temporary variables, and as function parameters."

From section 4.1.X of the ARB_bindless_texture spec:

   "Images may be declared as shader inputs and outputs, as uniform
    variables, as temporary variables, and as function parameters."

v3: - add spec comment
    - update the glsl error message

Signed-off-by: Samuel Pitoiset <samuel.pitoiset@gmail.com>
Reviewed-by: Timothy Arceri <tarceri@itsqueeze.com>
Reviewed-by: Nicolai Hähnle <nicolai.haehnle@amd.com>
7 years agoglsl: allow bindless samplers/images to be l-values
Samuel Pitoiset [Wed, 19 Apr 2017 16:39:38 +0000 (18:39 +0200)]
glsl: allow bindless samplers/images to be l-values

From section 4.1.7 of the ARB_bindless_texture spec:

   "Samplers can be used as l-values, so can be assigned into and
   used as "out" and "inout" function parameters."

From section 4.1.X of the ARB_bindless_texture spec:

   "Images can be used as l-values, so can be assigned into and
    used as "out" and "inout" function parameters."

v4: - invert the logic
v3: - update spec comment formatting
    - keep the read_only check

Signed-off-by: Samuel Pitoiset <samuel.pitoiset@gmail.com>
Reviewed-by: Nicolai Hähnle <nicolai.haehnle@amd.com>
7 years agoglsl: add _mesa_glsl_parse_state object to is_lvalue()
Samuel Pitoiset [Wed, 19 Apr 2017 16:08:28 +0000 (18:08 +0200)]
glsl: add _mesa_glsl_parse_state object to is_lvalue()

Yes, this is a bit hacky but we don't really have the choice.
Plain GLSL doesn't accept bindless samplers/images as l-values
while it's allowed when ARB_bindless_texture is enabled.

The default NULL parameter is because we can't access the
_mesa_glsl_parse_state object in few places in the compiler.
One is_lvalue(NULL) call is for IR validation but other checks
happen elsewhere, should be safe.

Signed-off-by: Samuel Pitoiset <samuel.pitoiset@gmail.com>
Reviewed-by: Nicolai Hähnle <nicolai.haehnle@amd.com>
Reviewed-by: Timothy Arceri <tarceri@itsqueeze.com>
7 years agoglsl: relax bindless sampler arrays indexing
Samuel Pitoiset [Wed, 19 Apr 2017 16:52:54 +0000 (18:52 +0200)]
glsl: relax bindless sampler arrays indexing

From section 4.1.7 of the ARB_bindless_texture spec:

   "Samplers aggregated into arrays within a shader (using square
    brackets []) can be indexed with arbitrary integer expressions."

v3: - update spec comment formatting

Signed-off-by: Samuel Pitoiset <samuel.pitoiset@gmail.com>
Reviewed-by: Timothy Arceri <tarceri@itsqueeze.com>
Reviewed-by: Nicolai Hähnle <nicolai.haehnle@amd.com>
7 years agoglsl: reject bindless samplers/images frag inputs without 'flat'
Samuel Pitoiset [Wed, 22 Mar 2017 17:34:23 +0000 (18:34 +0100)]
glsl: reject bindless samplers/images frag inputs without 'flat'

From section 4.3.4 of the ARB_bindless_texture spec

   "(modify last paragraph, p. 35, allowing samplers and images as
    fragment shader inputs) ... Fragment inputs can only be signed
    and unsigned integers and integer vectors, floating point scalars,
    floating-point vectors, matrices, sampler and image types, or
    arrays or structures of these.  Fragment shader inputs that are
    signed or unsigned integers, integer vectors, or any
    double-precision floating- point type, or any sampler or image
    type must be qualified with the interpolation qualifier "flat"."

v3: - update spec comment formatting

Signed-off-by: Samuel Pitoiset <samuel.pitoiset@gmail.com>
Reviewed-by: Timothy Arceri <tarceri@itsqueeze.com>
Reviewed-by: Nicolai Hähnle <nicolai.haehnle@amd.com>
7 years agoglsl: allow bindless samplers/images as vertex shader inputs
Samuel Pitoiset [Mon, 20 Mar 2017 20:37:03 +0000 (21:37 +0100)]
glsl: allow bindless samplers/images as vertex shader inputs

From section 4.3.4 of the ARB_bindless_texture spec:

   "(modify third paragraph of the section to allow sampler and
    image types) ...  Vertex shader inputs can only be float,
    single-precision floating-point scalars, single-precision
    floating-point vectors, matrices, signed and unsigned integers
    and integer vectors, sampler and image types."

v3: - update spec comment formatting

Signed-off-by: Samuel Pitoiset <samuel.pitoiset@gmail.com>
Reviewed-by: Timothy Arceri <tarceri@itsqueeze.com>
Reviewed-by: Nicolai Hähnle <nicolai.haehnle@amd.com>
7 years agoglsl: allow bindless samplers/images as varying variables
Samuel Pitoiset [Wed, 22 Mar 2017 17:16:10 +0000 (18:16 +0100)]
glsl: allow bindless samplers/images as varying variables

From section 4.3.4 of the ARB_bindless_texture spec:

   "(modify third paragraph of the section to allow sampler and image
    types) ...  Vertex shader inputs can only be float,
    single-precision floating-point scalars, single-precision
    floating-point vectors, matrices, signed and unsigned integers
    and integer vectors, sampler and image types."

From section 4.3.6 of the ARB_bindless_texture spec:

   "Output variables can only be floating-point scalars,
    floating-point vectors, matrices, signed or unsigned integers or
    integer vectors, sampler or image types, or arrays or structures
    of any these."

v3: - add spec comment

Signed-off-by: Samuel Pitoiset <samuel.pitoiset@gmail.com>
Reviewed-by: Timothy Arceri <tarceri@itsqueeze.com>
Reviewed-by: Nicolai Hähnle <nicolai.haehnle@amd.com>
7 years agoglsl: allow input memory qualifiers for images
Samuel Pitoiset [Mon, 3 Apr 2017 14:06:40 +0000 (16:06 +0200)]
glsl: allow input memory qualifiers for images

ARB_bindless_texture spec allows images to be declared as
shader inputs.

v2: - put the */ on the following line (Timothy Arceri)

Signed-off-by: Samuel Pitoiset <samuel.pitoiset@gmail.com>
Reviewed-by: Timothy Arceri <tarceri@itsqueeze.com>
Reviewed-by: Nicolai Hähnle <nicolai.haehnle@amd.com>
7 years agoglsl: allow image qualifiers inside structures
Samuel Pitoiset [Fri, 7 Apr 2017 12:34:55 +0000 (14:34 +0200)]
glsl: allow image qualifiers inside structures

ARB_bindless_texture allows to declare images inside structures
which means that qualifiers like writeonly should be allowed.

I have a got a confirmation from Jeff Bolz (one author of the spec),
because the spec doesn't clearly explain this.

Signed-off-by: Samuel Pitoiset <samuel.pitoiset@gmail.com>
Reviewed-by: Timothy Arceri <tarceri@itsqueeze.com>
Reviewed-by: Nicolai Hähnle <nicolai.haehnle@amd.com>
7 years agoglsl: allow bindless images to be declared inside structures
Samuel Pitoiset [Wed, 19 Apr 2017 14:44:19 +0000 (16:44 +0200)]
glsl: allow bindless images to be declared inside structures

The spec doesn't clearly state this, but I have got clarification
from the spec authors.

Signed-off-by: Samuel Pitoiset <samuel.pitoiset@gmail.com>
Reviewed-by: Timothy Arceri <tarceri@itsqueeze.com>
Reviewed-by: Nicolai Hähnle <nicolai.haehnle@amd.com>
7 years agoglsl: allow bindless samplers/images inside interface blocks
Samuel Pitoiset [Wed, 19 Apr 2017 14:46:14 +0000 (16:46 +0200)]
glsl: allow bindless samplers/images inside interface blocks

From section 4.3.7 of the ARB_bindless_texture spec:

   "(remove the following bullet from the last list on p. 39, thereby
    permitting sampler types in interface blocks; image types are also
    permitted in blocks by this extension)"

    * sampler types are not allowed

v3: - update the spec comment
    - update the glsl error message

Signed-off-by: Samuel Pitoiset <samuel.pitoiset@gmail.com>
Reviewed-by: Timothy Arceri <tarceri@itsqueeze.com>
Reviewed-by: Nicolai Hähnle <nicolai.haehnle@amd.com>
7 years agoglsl: allow bindless samplers/images as function return
Samuel Pitoiset [Wed, 19 Apr 2017 14:40:38 +0000 (16:40 +0200)]
glsl: allow bindless samplers/images as function return

The ARB_bindless_texture spec doesn't clearly state this, but as
it says "Replace Section 4.1.7 (Samplers), p. 25" and,
"Replace Section 4.1.X, (Images)", this should be allowed.

v3: - add spec comment
    - update the glsl error message

Signed-off-by: Samuel Pitoiset <samuel.pitoiset@gmail.com>
Reviewed-by: Timothy Arceri <tarceri@itsqueeze.com>
Reviewed-by: Nicolai Hähnle <nicolai.haehnle@amd.com>
7 years agoglsl: allow bindless samplers/images as out and inout parameters
Samuel Pitoiset [Wed, 19 Apr 2017 14:38:39 +0000 (16:38 +0200)]
glsl: allow bindless samplers/images as out and inout parameters

From section 4.1.7 of the ARB_bindless_texture spec:

   "Samplers can be used as l-values, so can be assigned into and used
    as "out" and "inout" function parameters."

From section 4.1.X of the ARB_bindless_texture spec:

   "Images can be used as l-values, so can be assigned into and used as
    "out" and "inout" function parameters."

v3: - add spec comment
    - update the glsl error message

Signed-off-by: Samuel Pitoiset <samuel.pitoiset@gmail.com>
Reviewed-by: Timothy Arceri <tarceri@itsqueeze.com>
Reviewed-by: Nicolai Hähnle <nicolai.haehnle@amd.com>
7 years agoglsl: allow to declare bindless samplers/images as non-uniform
Samuel Pitoiset [Wed, 19 Apr 2017 11:43:29 +0000 (13:43 +0200)]
glsl: allow to declare bindless samplers/images as non-uniform

From section 4.1.7 of the ARB_bindless_texture spec:

   "Samplers may be declared as shader inputs and outputs, as uniform
    variables, as temporary variables, and as function parameters."

From section 4.1.X of the ARB_bindless_texture spec:

   "Images may be declared as shader inputs and outputs, as uniform
    variables, as temporary variables, and as function parameters."

v3: - add validate_storage_for_sampler_image_types()
    - update spec comment
    - update the glsl error message

Signed-off-by: Samuel Pitoiset <samuel.pitoiset@gmail.com>
Reviewed-by: Timothy Arceri <tarceri@itsqueeze.com>
Reviewed-by: Nicolai Hähnle <nicolai.haehnle@amd.com>
7 years agoglsl: process bindless/bound layout qualifiers
Samuel Pitoiset [Tue, 21 Mar 2017 12:30:49 +0000 (13:30 +0100)]
glsl: process bindless/bound layout qualifiers

This adds bindless_sampler and bound_sampler (and respectively
bindless_image and bound_image) to the parser.

v3: - add an extra space in apply_bindless_qualifier_to_variable()
    - fix indentation in merge_qualifier()

Signed-off-by: Samuel Pitoiset <samuel.pitoiset@gmail.com>
Reviewed-by: Timothy Arceri <tarceri@itsqueeze.com>
Reviewed-by: Nicolai Hähnle <nicolai.haehnle@amd.com>
7 years agoglsl: do not make sampler/image types readonly variables
Samuel Pitoiset [Thu, 27 Apr 2017 11:45:16 +0000 (13:45 +0200)]
glsl: do not make sampler/image types readonly variables

In plain GLSL, sampler and image types can only be declared
uniform-qualified global variables or 'in' function parameters.

Setting the read_only flag seems quite useless because other
checks will prevent sampler/image variables to be assigned and
also because the flag is not set for atomic_uint types which are
opaque types.

This will also help for ARB_bindless_texture because samplers
and images can be assigned when they are considered bindless.

Signed-off-by: Samuel Pitoiset <samuel.pitoiset@gmail.com>
Reviewed-by: Nicolai Hähnle <nicolai.haehnle@amd.com>
Reviewed-by: Timothy Arceri <tarceri@itsqueeze.com>
7 years agoglsl: make sampler/image scalar types
Samuel Pitoiset [Wed, 26 Apr 2017 14:02:32 +0000 (16:02 +0200)]
glsl: make sampler/image scalar types

As a side effect, this will magically fix std140/std430 interfaces
for bindless samplers/images and will help for implementing the
explicit conversions with constructors.

Signed-off-by: Samuel Pitoiset <samuel.pitoiset@gmail.com>
Reviewed-by: Nicolai Hähnle <nicolai.haehnle@amd.com>
Reviewed-by: Timothy Arceri <tarceri@itsqueeze.com>
7 years agoglsl: make count_attribute_slots() returns 1 for samplers/images
Samuel Pitoiset [Mon, 1 May 2017 20:24:52 +0000 (22:24 +0200)]
glsl: make count_attribute_slots() returns 1 for samplers/images

For packed varyings.

Signed-off-by: Samuel Pitoiset <samuel.pitoiset@gmail.com>
Reviewed-by: Nicolai Hähnle <nicolai.haehnle@amd.com>
Reviewed-by: Timothy Arceri <tarceri@itsqueeze.com>
7 years agoglsl: make component_slots() returns 2 for samplers/images
Samuel Pitoiset [Thu, 20 Apr 2017 12:42:49 +0000 (14:42 +0200)]
glsl: make component_slots() returns 2 for samplers/images

Bindless samplers/images are 64-bit unsigned integers, which
means they consume two components as specified by
ARB_bindless_texture.

It looks like we are not wasting uniform storage by changing
this because default-block uniforms are not packed. So, if
we use N uint uniforms, they occupy N * 16 bytes in the
constant buffer. This is something that could be improved.

Though, count_uniform_size needs to be adjusted to not count
a sampler (or image) twice.

As a side effect, this will probably break the cache if you
have one because it will consider sampler/image types as
two components.

v3: - update the comments

Signed-off-by: Samuel Pitoiset <samuel.pitoiset@gmail.com>
Reviewed-by: Nicolai Hähnle <nicolai.haehnle@amd.com>
Reviewed-by: Timothy Arceri <tarceri@itsqueeze.com>
7 years agoglsl: make sampler/image types as 64-bit
Samuel Pitoiset [Thu, 20 Apr 2017 17:13:50 +0000 (19:13 +0200)]
glsl: make sampler/image types as 64-bit

The ARB_bindless_texture spec says:

   "Samplers are represented using 64-bit integer handles."

and,

   "Images are represented using 64-bit integer handles."

It seems simpler to always consider sampler and image types
as 64-bit unsigned integer.

This introduces a temporary workaround in _mesa_get_uniform()
because at this point no flag are used to distinguish between
bound and bindless samplers. This is going to be removed in a
separate series. This avoids breaking arb_shader_image_load_store-state.

v3: - update the comment slightly

Signed-off-by: Samuel Pitoiset <samuel.pitoiset@gmail.com>
Reviewed-by: Nicolai Hähnle <nicolai.haehnle@amd.com>
Reviewed-by: Timothy Arceri <tarceri@itsqueeze.com>
7 years agoglsl: add ARB_bindless_texture enable
Samuel Pitoiset [Tue, 21 Mar 2017 11:42:47 +0000 (12:42 +0100)]
glsl: add ARB_bindless_texture enable

This also adds the extension to the standalone GLSL compiler.

Signed-off-by: Samuel Pitoiset <samuel.pitoiset@gmail.com>
Reviewed-by: Ilia Mirkin <imirkin@alum.mit.edu>
Reviewed-by: Timothy Arceri <tarceri@itsqueeze.com>
Reviewed-by: Nicolai Hähnle <nicolai.haehnle@amd.com>
7 years agomesa: add ARB_bindless_texture to the extensions list
Samuel Pitoiset [Mon, 10 Apr 2017 22:30:31 +0000 (00:30 +0200)]
mesa: add ARB_bindless_texture to the extensions list

This is required for the following GLSL bits.

Signed-off-by: Samuel Pitoiset <samuel.pitoiset@gmail.com>
Reviewed-by: Nicolai Hähnle <nicolai.haehnle@amd.com>
Reviewed-by: Timothy Arceri <tarceri@itsqueeze.com>
7 years agoradv/meta: fix restoring a push descriptor set
Fredrik Höglund [Tue, 2 May 2017 15:09:27 +0000 (17:09 +0200)]
radv/meta: fix restoring a push descriptor set

radv_bind_descriptor_set cannot be used to bind a push descriptor set
since a push descriptor set does not have a buffer list. However,
there is no need to add the buffers again when restoring a set, so
this fix is also an optimization.

Cc: "17.1" <mesa-stable@lists.freedesktop.org>
Signed-off-by: Fredrik Höglund <fredrik@kde.org>
Reviewed-by: Bas Nieuwenhuizen <bas@basnieuwenhuizen.nl>
7 years agoconfigure.ac: Also match -androideabi tuple
Nicolas Boichat [Fri, 5 May 2017 02:26:00 +0000 (10:26 +0800)]
configure.ac: Also match -androideabi tuple

On ARM Android platforms, the host_os tuple should be linux-androideabi,
so let's match both -android and -androideabi (or any other
-android* tuple) to determine if we should do an Android build.

Reviewed-by: Chad Versace <chadversary@chromium.org>
7 years agoanv/allocator: Only write to _vg_ptr if we have valgrind
Jason Ekstrand [Fri, 5 May 2017 19:11:42 +0000 (12:11 -0700)]
anv/allocator: Only write to _vg_ptr if we have valgrind

This fixes the build when not building against valgrind headers.

Bugzilla: https://bugs.freedesktop.org/show_bug.cgi?id=100945
Reviewed-by: Chad Versace <chadversary@chromium.org>
7 years agoi915: Fix build break with empty unreachable()
Daniel Stone [Fri, 5 May 2017 17:24:44 +0000 (18:24 +0100)]
i915: Fix build break with empty unreachable()

Actually put something in unreachable(), so as not to break the build on
a Friday evening.

Signed-off-by: Daniel Stone <daniels@collabora.com>
Reported-by: Mark Janes <mark.a.janes@intel.com>
7 years agoradeonsi: apply the tess+GS hang workaround to Polaris12 as well
Marek Olšák [Fri, 5 May 2017 15:05:05 +0000 (17:05 +0200)]
radeonsi: apply the tess+GS hang workaround to Polaris12 as well

Cc: 17.1 <mesa-stable@lists.freedesktop.org>
Reviewed-by: Alex Deucher <alexander.deucher@amd.com>
Reviewed-by: Nicolai Hähnle <nicolai.haehnle@amd.com>
7 years agoi965: Set modifier for imported and duplicated images
Daniel Stone [Wed, 3 May 2017 08:38:13 +0000 (09:38 +0100)]
i965: Set modifier for imported and duplicated images

When a buffer is being created from FD or GEM flink import, the current
API makes no provision for passing modifier information along with this.
Set the modifier for such images to DRM_FORMAT_MOD_INVALID.

Also preserve the modifier when duplicating an image, as will be done by
GBM when importing from a wl_buffer.

This doubly tripped up Wayland, as the images would first have been
created (as wl_buffers) with a 0 modifier, and then lost what modifier
they would've had when being duplicated into gbm_bos.

Fixes: d78a36ea624 ("i965/dri: Handle the linear fb modifier")
Signed-off-by: Daniel Stone <daniels@collabora.com>
Reviewed-by: Emil Velikov <emil.velikov@collabora.com>
7 years agoi965: Use helper function for modifier -> tiling
Daniel Stone [Wed, 3 May 2017 17:05:10 +0000 (18:05 +0100)]
i965: Use helper function for modifier -> tiling

Use a helper function and struct to convert between a modifier and
tiling mode, so we can use it later for a tiling -> modifier lookup.

Signed-off-by: Daniel Stone <daniels@collabora.com>
Reviewed-by: Emil Velikov <emil.velikov@collabora.com>
7 years agoradeonsi: fix build with GCC 4.8
Samuel Pitoiset [Fri, 5 May 2017 12:15:33 +0000 (14:15 +0200)]
radeonsi: fix build with GCC 4.8

Fixes: 7088b655e8 ("radeonsi: constify a bunch of the perfcounter structs.")
Bugzilla: https://bugs.freedesktop.org/show_bug.cgi?id=100937
Signed-off-by: Samuel Pitoiset <samuel.pitoiset@gmail.com>
Reviewed-by: Marek Olšák <marek.olsak@amd.com>
7 years agost/glsl_to_tgsi: fix renumber_registers() in presence of dead code
Samuel Pitoiset [Thu, 4 May 2017 08:35:29 +0000 (10:35 +0200)]
st/glsl_to_tgsi: fix renumber_registers() in presence of dead code

The TGSI DCE pass doesn't eliminate dead assignments like
MOV TEMP[0], TEMP[1] in presence of loops because it assumes
that the visitor doesn't emit dead code. This assumption is
actually wrong and this situation happens.

However, it appears that the merge_registers() pass accidentally
takes care of this for some weird reasons. But since this pass has
been disabled for RadeonSI and Nouveau, the renumber_registers()
pass which is called *after*, can't do its job correctly.

This is because it assumes that no dead code is present. But if
there is still a dead assignment, it might re-use the TEMP
register id incorrectly and emits wrong code.

This patches fixes the issue by recording writes instead of reads,
and this has the advantage to be faster.

This should fix Unigine Heaven on RadeonSI and Nouveau.

shader-db results with RadeonSI:

47109 shaders in 29632 tests
Totals:
SGPRS: 1923308 -> 1923316 (0.00 %)
VGPRS: 1133843 -> 1133847 (0.00 %)
Spilled SGPRs: 2516 -> 2518 (0.08 %)
Spilled VGPRs: 65 -> 65 (0.00 %)
Private memory VGPRs: 1184 -> 1184 (0.00 %)
Scratch size: 1308 -> 1308 (0.00 %) dwords per thread
Code Size: 60095968 -> 60096256 (0.00 %) bytes
LDS: 1077 -> 1077 (0.00 %) blocks
Max Waves: 431889 -> 431889 (0.00 %)
Wait states: 0 -> 0 (0.00 %)

It's still interesting to disable the merge_registers() pass.

Signed-off-by: Samuel Pitoiset <samuel.pitoiset@gmail.com>
Reviewed-by: Nicolai Hähnle <nicolai.haehnle@amd.com>
7 years agoanv/query: handle more cases of 'out of host memory'
Iago Toral Quiroga [Wed, 26 Apr 2017 07:03:43 +0000 (09:03 +0200)]
anv/query: handle more cases of 'out of host memory'

Reviewed-by: Samuel Iglesias Gonsálvez <siglesias@igalia.com>
7 years agoegl/android: Set EGLSurface.Lost to EGL_TRUE/EGL_FALSE
Nicolas Boichat [Fri, 5 May 2017 02:43:50 +0000 (10:43 +0800)]
egl/android: Set EGLSurface.Lost to EGL_TRUE/EGL_FALSE

Lost is an EGLBoolean, so we should assign it to EGL_TRUE/EGL_FALSE,
not true/false.

Fixes: e5eace58684 ("egl/android: Mark surface as lost when dequeueBuffer fails")
Fixes: 0212db35040 ("egl/android: Cancel any outstanding ANativeBuffer in surface destructor")
Reviewed-by: Chad Versace <chadversary@chromium.org>
7 years agoanv/allocator: Improve block pool growing asserts
Jason Ekstrand [Wed, 3 May 2017 16:43:58 +0000 (09:43 -0700)]
anv/allocator: Improve block pool growing asserts

Reviewed-by: Juan A. Suarez Romero <jasuarez@igalia.com>
7 years agoanv: Drop the instruction pool block size
Jason Ekstrand [Wed, 26 Apr 2017 14:21:58 +0000 (07:21 -0700)]
anv: Drop the instruction pool block size

Now that we can allocate states larger than the block size, we no longer
need a block size of 1MB which can be rather wasteful.

Reviewed-by: Juan A. Suarez Romero <jasuarez@igalia.com>
7 years agoanv/allocator: Add support for large stream allocations
Jason Ekstrand [Wed, 26 Apr 2017 16:54:41 +0000 (09:54 -0700)]
anv/allocator: Add support for large stream allocations

Reviewed-by: Juan A. Suarez Romero <jasuarez@igalia.com>
7 years agoanv/allocator: Allow state pools to allocate large states
Jason Ekstrand [Mon, 24 Apr 2017 08:51:51 +0000 (01:51 -0700)]
anv/allocator: Allow state pools to allocate large states

Previously, the maximum size of a state that could be allocated from a
state pool was a block.  However, this has caused us various issues
particularly with shaders which are potentially very large.  We've also
hit issues with render passes with a large number of attachments when we
go to allocate the block of surface state.  This effectively removes the
restriction on the maximum size of a single state.  (There's still a
limit of 1MB imposed by a fixed-length bucket array.)

For states larger than the block size, we just grab a large block off of
the block pool rather than sub-allocating.  When we go to allocate some
chunk of state and the current bucket does not have state, we try to
pull a chunk from some larger bucket and split it up.  This should
improve memory usage if a client occasionally allocates a large block of
state.

This commit is inspired by some similar work done by Juan A. Suarez
Romero <jasuarez@igalia.com>.

Reviewed-by: Juan A. Suarez Romero <jasuarez@igalia.com>
7 years agoanv/allocator: Support pushing multiple blocks onto a free list at once
Jason Ekstrand [Mon, 24 Apr 2017 01:57:29 +0000 (18:57 -0700)]
anv/allocator: Support pushing multiple blocks onto a free list at once

Reviewed-by: Juan A. Suarez Romero <jasuarez@igalia.com>
7 years agoanv/allocator: Add helpers for dealing with bucket sizes
Jason Ekstrand [Mon, 24 Apr 2017 02:15:42 +0000 (19:15 -0700)]
anv/allocator: Add helpers for dealing with bucket sizes

Reviewed-by: Juan A. Suarez Romero <jasuarez@igalia.com>
7 years agoanv/allocator: Add the capability to allocate blocks of different sizes
Jason Ekstrand [Wed, 26 Apr 2017 07:49:40 +0000 (00:49 -0700)]
anv/allocator: Add the capability to allocate blocks of different sizes

Reviewed-by: Juan A. Suarez Romero <jasuarez@igalia.com>
7 years agoanv/allocator: Rework a comment
Jason Ekstrand [Wed, 26 Apr 2017 09:28:24 +0000 (02:28 -0700)]
anv/allocator: Rework a comment

This commit just fixes up the English a bit and re-flows the comment.

Reviewed-by: Juan A. Suarez Romero <jasuarez@igalia.com>
7 years agoanv/allocator: Tweak the block pool growing algorithm
Jason Ekstrand [Wed, 26 Apr 2017 16:53:45 +0000 (09:53 -0700)]
anv/allocator: Tweak the block pool growing algorithm

The old algorithm worked fine assuming a constant block size.  We're
about to break that assumption so we need an algorithm that's a bit more
robust against suddenly growing by a huge amount compared to the
currently allocated quantity of memory.

Reviewed-by: Juan A. Suarez Romero <jasuarez@igalia.com>
7 years agoanv/allocator: Embed the block_pool in the state_pool
Jason Ekstrand [Mon, 24 Apr 2017 15:50:23 +0000 (08:50 -0700)]
anv/allocator: Embed the block_pool in the state_pool

Now that the state stream is allocating off of the state pool, there's
no reason why we need the block pool to be separate.

Reviewed-by: Juan A. Suarez Romero <jasuarez@igalia.com>
7 years agoanv/allocator: Get rid of the ability to free blocks
Jason Ekstrand [Mon, 24 Apr 2017 10:11:02 +0000 (03:11 -0700)]
anv/allocator: Get rid of the ability to free blocks

Now that everything is going through the state pools, the block pool no
longer needs to be able to handle re-use.

Reviewed-by: Juan A. Suarez Romero <jasuarez@igalia.com>
7 years agoanv: Allocate binding table blocks through the state pool
Jason Ekstrand [Mon, 24 Apr 2017 09:40:20 +0000 (02:40 -0700)]
anv: Allocate binding table blocks through the state pool

Reviewed-by: Juan A. Suarez Romero <jasuarez@igalia.com>
7 years agoanv/allocator: Add support for "back" allocations to state_pool
Jason Ekstrand [Mon, 24 Apr 2017 09:17:43 +0000 (02:17 -0700)]
anv/allocator: Add support for "back" allocations to state_pool

Reviewed-by: Juan A. Suarez Romero <jasuarez@igalia.com>
7 years agoanv/allocator: Drop the block_size field from block_pool
Jason Ekstrand [Wed, 26 Apr 2017 08:27:33 +0000 (01:27 -0700)]
anv/allocator: Drop the block_size field from block_pool

Since the state_stream is now pulling from a state_pool, the only thing
pulling directly off the block pool is the state pool so we can just
move the block_size there.  The one exception is when we allocate
binding tables but we can just reference the state pool there as well.

The only functional change here is that we no longer grow the block pool
immediately upon creation so no BO gets allocated until our first state
allocation.

Reviewed-by: Juan A. Suarez Romero <jasuarez@igalia.com>
7 years agoanv/allocator: Pull the userptr part of block_pool_grow into a helper
Jason Ekstrand [Wed, 26 Apr 2017 13:01:01 +0000 (06:01 -0700)]
anv/allocator: Pull the userptr part of block_pool_grow into a helper

Reviewed-by: Juan A. Suarez Romero <jasuarez@igalia.com>
7 years agoanv/allocator: Roll fixed_size_state_pool into state_pool
Jason Ekstrand [Mon, 24 Apr 2017 01:48:21 +0000 (18:48 -0700)]
anv/allocator: Roll fixed_size_state_pool into state_pool

The helper functions aren't really gaining us as much as they claim and
are actually about to be in the way.

Reviewed-by: Juan A. Suarez Romero <jasuarez@igalia.com>
7 years agoanv/allocator: Remove the state_size field from fixed_size_state_pool
Jason Ekstrand [Mon, 24 Apr 2017 01:36:33 +0000 (18:36 -0700)]
anv/allocator: Remove the state_size field from fixed_size_state_pool

Reviewed-by: Juan A. Suarez Romero <jasuarez@igalia.com>
7 years agoanv: Get rid of a bunch of uses of size_t
Jason Ekstrand [Mon, 24 Apr 2017 01:25:17 +0000 (18:25 -0700)]
anv: Get rid of a bunch of uses of size_t

We should only use size_t when referring to sizes of bits of CPU memory.
Anything on the GPU or just a regular array length should be a type that
has the same size on both 32 and 64-bit architectures.  For state
objects, we use a uint32_t because we'll never allocate a piece of
driver-internal GPU state larger than 2GB (more like 16KB).

Reviewed-by: Juan A. Suarez Romero <jasuarez@igalia.com>
7 years agoanv/allocator: Convert the state stream to pull from a state pool
Jason Ekstrand [Mon, 24 Apr 2017 00:22:26 +0000 (17:22 -0700)]
anv/allocator: Convert the state stream to pull from a state pool

Reviewed-by: Juan A. Suarez Romero <jasuarez@igalia.com>
7 years agoanv/allocator: Return a null state for zero-size allocations
Jason Ekstrand [Wed, 26 Apr 2017 10:32:06 +0000 (03:32 -0700)]
anv/allocator: Return a null state for zero-size allocations

Reviewed-by: Juan A. Suarez Romero <jasuarez@igalia.com>
7 years agoanv/allocator: Add no-valgrind versions of state_pool_alloc/free
Jason Ekstrand [Wed, 26 Apr 2017 10:28:52 +0000 (03:28 -0700)]
anv/allocator: Add no-valgrind versions of state_pool_alloc/free

Reviewed-by: Juan A. Suarez Romero <jasuarez@igalia.com>
7 years agoradv: enable POLARIS12 support.
Dave Airlie [Fri, 5 May 2017 00:27:33 +0000 (10:27 +1000)]
radv: enable POLARIS12 support.

This just adds the chip in the right places.

We don't set the partial_vs_wave workaround, as radeonsi
doesn't, but have to confirm it's not required.

Reviewed-by: Bas Nieuwenhuizen <bas@basnieuwenhuizen.nl>
Cc: "17.1" <mesa-stable@lists.freedesktop.org>
Signed-off-by: Dave Airlie <airlied@redhat.com>
7 years agoegl/android: Mark surface as lost when dequeueBuffer fails
Chad Versace [Fri, 5 May 2017 00:46:34 +0000 (17:46 -0700)]
egl/android: Mark surface as lost when dequeueBuffer fails

This ensures that future calls to eglSwapBuffers and eglMakeCurrent emit
an error.

This patch is part of a series for fixing
android.hardware.camera2.cts.RobustnessTest#testAbandonRepeatingRequestSurface
on Chrome OS x86 devices.

Cc: mesa-stable@lists.freedesktop.org
Cc: Tomasz Figa <tfiga@chromium.org>
Cc: Tapani Pälli <tapani.palli@intel.com>
Reviewed-by: Nicolas Boichat <drinkcat@chromium.org>
Reviewed-by: Emil Velikov <emil.velikov@collabora.com>
7 years agoegl/android: Cancel any outstanding ANativeBuffer in surface destructor
Chad Versace [Fri, 5 May 2017 00:46:33 +0000 (17:46 -0700)]
egl/android: Cancel any outstanding ANativeBuffer in surface destructor

That is, call ANativeWindow::cancelBuffer in droid_destroy_surface().

This should prevent application deadlock when the app destroys the
EGLSurface after EGL has acquired a buffer from SurfaceFlinger
(ANativeWindow::dequeueBuffer) but before EGL has released it
(ANativeWindow::enqueueBuffer).

This patch is part of a series for fixing
android.hardware.camera2.cts.RobustnessTest#testAbandonRepeatingRequestSurface
on Chrome OS x86 devices.

Cc: mesa-stable@lists.freedesktop.org
Cc: Tomasz Figa <tfiga@chromium.org>
Cc: Tapani Pälli <tapani.palli@intel.com>
Reviewed-by: Nicolas Boichat <drinkcat@chromium.org>
Reviewed-by: Emil Velikov <emil.velikov@collabora.com>
7 years agoegl: Emit error when EGLSurface is lost
Chad Versace [Fri, 5 May 2017 00:46:33 +0000 (17:46 -0700)]
egl: Emit error when EGLSurface is lost

Add a new bool, _EGLSurface::Lost, and check it in eglMakeCurrent and
eglSwapBuffers. The EGL 1.5 spec says that those functions emit errors
when the native surface is no longer valid.

This patch just updates core EGL. No driver sets _EGLSurface::Lost yet.

I discovered that Mesa failed to detect lost surfaces while debugging an
Android CTS camera test,
android.hardware.camera2.cts.RobustnessTest#testAbandonRepeatingRequestSurface.
This patch doesn't fix the test though, though, because the test expects
EGL_BAD_SURFACE when the surface becomes lost, and this patch actually
complies with the EGL spec. If I interpreted the EGL spec correctly,
EGL_BAD_NATIVE_WINDOW or EGL_BAD_CURRENT_SURFACE is the correct error.

Cc: mesa-stable@lists.freedesktop.org
Cc: Tomasz Figa <tfiga@chromium.org>
Cc: Tapani Pälli <tapani.palli@intel.com>
Reviewed-by: Nicolas Boichat <drinkcat@chromium.org>
Reviewed-by: Emil Velikov <emil.velikov@collabora.com>
7 years agowinsys/amdgpu: fix Polaris12 (RX 550) breakage
Marek Olšák [Thu, 4 May 2017 23:16:57 +0000 (01:16 +0200)]
winsys/amdgpu: fix Polaris12 (RX 550) breakage

reported by Greg White.

Bugzilla: https://bugs.freedesktop.org/show_bug.cgi?id=100892
Cc: 17.1 <mesa-stable@lists.freedesktop.org>
7 years agoanv: Simplify Cherryview line handling.
Kenneth Graunke [Thu, 4 May 2017 18:11:44 +0000 (11:11 -0700)]
anv: Simplify Cherryview line handling.

We can just use the new CHVLineWidth field rather than an entirely
different generation's packing function.

v2: Inline the function (requested by Jason)

Reviewed-by: Jason Ekstrand <jason@jlekstrand.net>
7 years agoi965: Fix line width on Cherryview.
Kenneth Graunke [Thu, 4 May 2017 18:03:47 +0000 (11:03 -0700)]
i965: Fix line width on Cherryview.

We just add another field to gen8.xml for the Cherryview line width,
rather than trying to replicate the gymnastics done in the Vulkan
driver to use gen9 SF pack functions.

Reviewed-by: Jason Ekstrand <jason@jlekstrand.net>
7 years agoradeonsi/gfx9: allow the scratch buffer in HS and GS
Marek Olšák [Thu, 27 Apr 2017 00:20:13 +0000 (02:20 +0200)]
radeonsi/gfx9: allow the scratch buffer in HS and GS

It works now.

Reviewed-by: Nicolai Hähnle <nicolai.haehnle@amd.com>
7 years agoradeonsi: prevent race conditions when doing scratch patching
Marek Olšák [Thu, 27 Apr 2017 17:12:22 +0000 (19:12 +0200)]
radeonsi: prevent race conditions when doing scratch patching

Reviewed-by: Nicolai Hähnle <nicolai.haehnle@amd.com>
7 years agoradeonsi: separate scratch state patching code into its own function
Marek Olšák [Fri, 3 Mar 2017 23:25:27 +0000 (00:25 +0100)]
radeonsi: separate scratch state patching code into its own function

Picked from a different branch. When we stop using the scratch patching,
this function will not be called.

Reviewed-by: Nicolai Hähnle <nicolai.haehnle@amd.com>
7 years agoradeonsi/gfx9: also apply scratch relocations to the 1st shader of merged shaders
Marek Olšák [Thu, 27 Apr 2017 17:01:44 +0000 (19:01 +0200)]
radeonsi/gfx9: also apply scratch relocations to the 1st shader of merged shaders

Reviewed-by: Nicolai Hähnle <nicolai.haehnle@amd.com>
7 years agoradeonsi/gfx9: set correct LLVM calling conventions for merged shaders
Marek Olšák [Thu, 27 Apr 2017 00:18:53 +0000 (02:18 +0200)]
radeonsi/gfx9: set correct LLVM calling conventions for merged shaders

for scratch support

Reviewed-by: Nicolai Hähnle <nicolai.haehnle@amd.com>
7 years agoradeonsi: remove unused parameters from si_shader_apply_scratch_relocs
Marek Olšák [Thu, 27 Apr 2017 17:00:56 +0000 (19:00 +0200)]
radeonsi: remove unused parameters from si_shader_apply_scratch_relocs

Reviewed-by: Nicolai Hähnle <nicolai.haehnle@amd.com>
7 years agoradeonsi: inline si_llvm_shader_type into si_llvm_create_func
Marek Olšák [Thu, 27 Apr 2017 00:12:48 +0000 (02:12 +0200)]
radeonsi: inline si_llvm_shader_type into si_llvm_create_func

Reviewed-by: Nicolai Hähnle <nicolai.haehnle@amd.com>
7 years agoradeonsi: don't use util_memcpy_cpu_to_le32 for shader uploads
Marek Olšák [Thu, 27 Apr 2017 17:19:53 +0000 (19:19 +0200)]
radeonsi: don't use util_memcpy_cpu_to_le32 for shader uploads

at least I think this is correct.

Reviewed-by: Nicolai Hähnle <nicolai.haehnle@amd.com>
7 years agoradeonsi: make si_compile_llvm static
Marek Olšák [Fri, 28 Apr 2017 18:31:45 +0000 (20:31 +0200)]
radeonsi: make si_compile_llvm static

Reviewed-by: Nicolai Hähnle <nicolai.haehnle@amd.com>
7 years agoradeonsi: fold surrounding code into si_llvm_finalize_module
Marek Olšák [Fri, 28 Apr 2017 18:23:19 +0000 (20:23 +0200)]
radeonsi: fold surrounding code into si_llvm_finalize_module

and rename to si_llvm_optimize_module.

Reviewed-by: Nicolai Hähnle <nicolai.haehnle@amd.com>
7 years agoradeonsi: don't call eliminate_const_vs_outputs in shaders without VS exports
Marek Olšák [Fri, 28 Apr 2017 14:35:13 +0000 (16:35 +0200)]
radeonsi: don't call eliminate_const_vs_outputs in shaders without VS exports

Reviewed-by: Nicolai Hähnle <nicolai.haehnle@amd.com>
7 years agoradeonsi: drop support for LLVM 3.8
Marek Olšák [Tue, 25 Apr 2017 00:18:10 +0000 (02:18 +0200)]
radeonsi: drop support for LLVM 3.8

LLVM 3.8:
- had broken indirect resource indexing
- didn't have scratch coalescing
- was the last user of problematic v16i8
- only supported OpenGL 4.1

This leaves us with LLVM 3.9 and LLVM 4.0 support for Mesa 17.2.

Reviewed-by: Nicolai Hähnle <nicolai.haehnle@amd.com>
7 years agoradeonsi: stop using v16i8
Marek Olšák [Mon, 24 Apr 2017 22:56:44 +0000 (00:56 +0200)]
radeonsi: stop using v16i8

Reviewed-by: Nicolai Hähnle <nicolai.haehnle@amd.com>
7 years agoradeonsi/gfx9: make some PA & DB registers match the closed Vulkan driver
Marek Olšák [Fri, 28 Apr 2017 17:28:06 +0000 (19:28 +0200)]
radeonsi/gfx9: make some PA & DB registers match the closed Vulkan driver

Cc: 17.1 <mesa-stable@lists.freedesktop.org>
Reviewed-by: Nicolai Hähnle <nicolai.haehnle@amd.com>
7 years agoradv: don't advertise transfer props unless we can do anything else
Dave Airlie [Thu, 4 May 2017 00:51:49 +0000 (10:51 +1000)]
radv: don't advertise transfer props unless we can do anything else

There is no reason to advertise transfer ability for formats we can't
use for anything else. This stops some CTS tests hitting internal
error for 64-bit types when they see the transfer flags.

Reviewed-by: Bas Nieuwenhuizen <bas@basnieuwenhuizen.nl>
Signed-off-by: Dave Airlie <airlied@redhat.com>