mesa.git
8 years agoglsl: use bitmask of active xfb buffer indices
Timothy Arceri [Thu, 3 Mar 2016 02:20:01 +0000 (13:20 +1100)]
glsl: use bitmask of active xfb buffer indices

This allows us to print the correct binding point when not all
buffers declared in the shader are bound.

For example if we use a single buffer:

layout(xfb_buffer=2, offset=0) out vec4 v;

We now print '2' when the buffer is not bound rather than '0'.

Reviewed-by: Dave Airlie <airlied@redhat.com>
8 years agoglsl: sort xfb varyings in offset/buffer order
Timothy Arceri [Fri, 11 Mar 2016 12:16:16 +0000 (23:16 +1100)]
glsl: sort xfb varyings in offset/buffer order

The existing transform feedback code expects to receive the list
of varyings in increasing buffer order.

Reviewed-by: Dave Airlie <airlied@redhat.com>
8 years agoglsl: basic linking support for xfb qualifiers
Timothy Arceri [Wed, 24 Feb 2016 05:40:32 +0000 (16:40 +1100)]
glsl: basic linking support for xfb qualifiers

This adds the initial infrastructure for enabling transform feedback
mode via in shader qualifiers and adds initial buffer support.

Reviewed-by: Dave Airlie <airlied@redhat.com>
8 years agoglsl: add xfb helpers and fields to the tfeedback_decl class
Timothy Arceri [Wed, 24 Feb 2016 05:37:02 +0000 (16:37 +1100)]
glsl: add xfb helpers and fields to the tfeedback_decl class

We also apply any array/struct offsets.

Reviewed-by: Dave Airlie <airlied@redhat.com>
8 years agoglsl: add helper to process xfb qualifiers during linking
Timothy Arceri [Wed, 24 Feb 2016 05:27:03 +0000 (16:27 +1100)]
glsl: add helper to process xfb qualifiers during linking

This function checks for any xfb_* qualifiers which will enable
transform feedback mode and cause any API defined xfb varyings
to be ignored.

It also counts the number of varyings that have a xfb_offset
qualifier and finally it calls the create_xfb_varying_names()
helper to generate the names of varyings to be caputured.

Reviewed-by: Dave Airlie <airlied@redhat.com>
8 years agoglsl: add helper to generate xfb varying names
Timothy Arceri [Wed, 24 Feb 2016 04:40:31 +0000 (15:40 +1100)]
glsl: add helper to generate xfb varying names

Reviewed-by: Dave Airlie <airlied@redhat.com>
8 years agoglsl: add helper for counting varyings
Timothy Arceri [Tue, 15 Mar 2016 06:52:06 +0000 (17:52 +1100)]
glsl: add helper for counting varyings

This will be used to get a count of the number of varying name
strings we are required to generate for use with the query api.

Reviewed-by: Dave Airlie <airlied@redhat.com>
8 years agoglsl: add xfb qualifier lowering support for named blocks
Timothy Arceri [Mon, 15 Feb 2016 02:27:55 +0000 (13:27 +1100)]
glsl: add xfb qualifier lowering support for named blocks

Reviewed-by: Dave Airlie <airlied@redhat.com>
8 years agoglsl: add xfb qualifiers to has_layout helper
Timothy Arceri [Fri, 22 Jan 2016 05:22:40 +0000 (16:22 +1100)]
glsl: add xfb qualifiers to has_layout helper

Reviewed-by: Dave Airlie <airlied@redhat.com>
8 years agoglsl: apply xfb_stride to implicit offsets for ifc block members
Timothy Arceri [Thu, 10 Mar 2016 00:51:48 +0000 (11:51 +1100)]
glsl: apply xfb_stride to implicit offsets for ifc block members

When we have an interface block like:

layout (xfb_buffer = 0, xfb_offset = 0) out Block {
                             vec4 var1;
    layout (xfb_stride = 32) vec4 var2;
                             vec4 var3;
};

We take into account the stride of var2 when calculating the offset
for var3.

Reviewed-by: Dave Airlie <airlied@redhat.com>
8 years agoglsl: add xfb_stride compile time rules
Timothy Arceri [Sat, 13 Feb 2016 03:53:45 +0000 (14:53 +1100)]
glsl: add xfb_stride compile time rules

From the ARB_enhanced_layouts spec:

   "The *xfb_stride* qualifier specifies how many bytes are consumed
   by each captured vertex.  It applies to the transform feedback
   buffer for that declaration, whether it is inherited or explicitly
   declared. It can be applied to variables, blocks, block members,
   or just the qualifier out.  If the buffer is capturing any
   double-typed outputs, the stride must be a multiple of 8, otherwise
   it must be a multiple of 4, or a compile-time or link-time error
   results.

   ...

   The resulting stride (implicit or explicit) must be less than or
   equal to the implementation-dependent constant
   gl_MaxTransformFeedbackInterleavedComponents."

Reviewed-by: Dave Airlie <airlied@redhat.com>
8 years agoglsl: add xfb_offset compile time rules
Timothy Arceri [Wed, 24 Feb 2016 04:21:59 +0000 (15:21 +1100)]
glsl: add xfb_offset compile time rules

We also copy the qualifier values to the IR in this step.

Reviewed-by: Dave Airlie <airlied@redhat.com>
8 years agoglsl: add xfb_buffer compile time rules
Timothy Arceri [Fri, 11 Mar 2016 12:00:16 +0000 (23:00 +1100)]
glsl: add xfb_buffer compile time rules

Also copies the qualifier values to GLSL IR.

From the ARB_enhanced_layouts spec:

    "The *xfb_buffer* qualifier can be applied to the qualifier out,
    to output variables, to output blocks, and to output block
    members.  Shaders in the transform  feedback capturing mode have
    an initial global default of

        layout(xfb_buffer = 0) out;

    This default can be changed by declaring a different buffer with
    xfb_buffer on the interface qualifier out.  This is the only way
    the global default can be changed.  When a variable or output block
    is declared without an  xfb_buffer qualifier, it inherits the global
    default buffer.  When a variable or output block is declared with an
    xfb_buffer qualifier, it has that declared buffer.  All members of a
    block inherit the block's buffer.  A  member is allowed to declare
    an xfb_buffer, but it must match the buffer inherited from its
    block, or a compile-time error results.

    The *xfb_buffer* qualifier follows the same conventions, behavior,
    defaults, and inheritance rules as the qualifier stream, and the
    examples for stream apply here as well.  This includes a block's
    inheritance of the current global default buffer, a block member's
    inheritance of  the block's buffer, and the requirement that any
    *xfb_buffer* declared on a block member must match the buffer
    inherited from the block.

    ...

    It is a compile-time error to specify an *xfb_buffer* that is
    greater than  the implementation-dependent constant
    gl_MaxTransformFeedbackBuffers."

Reviewed-by: Dave Airlie <airlied@redhat.com>
8 years agoglsl: add field to track if xfb_buffer is an explicit or implicit value
Timothy Arceri [Wed, 24 Feb 2016 04:18:09 +0000 (15:18 +1100)]
glsl: add field to track if xfb_buffer is an explicit or implicit value

Since any of the xfb_* qualifiers trigger the shader to be in
transform feedback mode we need an extra field to track if
the xfb_buffer on interface members was set explicitly since
xfb_buffer will always have a default value.

Reviewed-by: Dave Airlie <airlied@redhat.com>
8 years agoglsl: add xfb_* qualifiers to glsl_struct_field
Timothy Arceri [Wed, 24 Feb 2016 05:06:00 +0000 (16:06 +1100)]
glsl: add xfb_* qualifiers to glsl_struct_field

These will be used to hold qualifier values for interface and
struct members.

Support is added to the struct/interface constructors to copy these
fields upon creation.

We also update record_compare() to ensure we don't reuse a glsl_type
with the wrong xfb_* qualifier values.

Reviewed-by: Dave Airlie <airlied@redhat.com>
8 years agoglsl: add IR fields for transform feedback layout qualifiers
Timothy Arceri [Thu, 21 Jan 2016 05:22:12 +0000 (16:22 +1100)]
glsl: add IR fields for transform feedback layout qualifiers

Adds xfb_buffer/stride fields and adds comment to offset field
which is reused for xfb_offset.

Reviewed-by: Dave Airlie <airlied@redhat.com>
8 years agoglsl: add validation for out layout qualifiers
Timothy Arceri [Tue, 9 Feb 2016 11:24:30 +0000 (22:24 +1100)]
glsl: add validation for out layout qualifiers

This adds validation for all qualifiers as allowed by the
table in Section 4.4 (Layout Qualifiers) of the GLSL 4.5 spec.

Reviewed-by: Dave Airlie <airlied@redhat.com>
8 years agoglsl: relax stage restrictions on layout defaults for outputs
Timothy Arceri [Mon, 18 Jan 2016 09:46:29 +0000 (20:46 +1100)]
glsl: relax stage restrictions on layout defaults for outputs

The new xfb_buffer and xfb_stride global qualifiers are allowed in
geom, tess and vertex stages.

Reviewed-by: Dave Airlie <airlied@redhat.com>
8 years agoglsl: parse new transform feedback layout qualifiers
Timothy Arceri [Fri, 22 Jan 2016 01:45:10 +0000 (12:45 +1100)]
glsl: parse new transform feedback layout qualifiers

We reuse the existing offset field for holding the xfb_offset
expression but create a new flag as to avoid hitting the rules
for the offset qualifier for UBOs.

xfb_buffer qualifiers require extra processing when merging as
they can be applied to global out defaults. We just apply the
same rules as we do for the stream qualifier as the spec says:

   "The *xfb_buffer* qualifier follows the same conventions,
    behavior, defaults, and inheritance rules as the qualifier
    stream, and the examples for stream apply here as well."

For xfb_stride we push everything into a global out field for
later processing as xfb_stride applies to the entire buffer.
We still need to have a separate field to store per variable
strides because they can still effect implicit offsets
e.g. when applied to block members with implicit offsets.

Reviewed-by: Dave Airlie <airlied@redhat.com>
8 years agoglsl: move process_qualifier_constant() to ast_type.cpp
Timothy Arceri [Sat, 5 Mar 2016 01:16:22 +0000 (12:16 +1100)]
glsl: move process_qualifier_constant() to ast_type.cpp

We will make use of this function being here in the following patch.

Reviewed-by: Dave Airlie <airlied@redhat.com>
8 years agoglsl: add transform feedback built-in constants
Timothy Arceri [Wed, 13 Jan 2016 03:40:05 +0000 (14:40 +1100)]
glsl: add transform feedback built-in constants

These are new built-ins added by ARB_enhanced_layouts.

Reviewed-by: Dave Airlie <airlied@redhat.com>
8 years agoglsl: generate named interface block names correctly
Timothy Arceri [Fri, 11 Mar 2016 05:15:02 +0000 (16:15 +1100)]
glsl: generate named interface block names correctly

Firstly this updates the named interface lowering pass to store the
interface without the arrays removed.

Note we need to remove the arrays in the interface/varying matching
code to not regress things but in future this should be fixed
futher as it would seem we currently successfully match interface
blocks with differnt array sizes.

Since we now know if the interface was an array we can reduce the
IR flags from_named_ifc_block_array and from_named_ifc_block_nonarray
to just from_named_ifc_block.

Next rather than having a different code path for named interface
blocks in program_resource_visitor we just make use of the one used
by UBOs this allows us to now handle arrays of arrays correctly.

Finally we add a new param to the recursion function
named_ifc_member this is because we only want to process a single
member at a time. Note that this is also the glsl_struct_field
from the original ifc type before lowering rather than the type
from the lowered variable. This fixes a bug in Mesa where we would
generate the names like WithInstArray[0].g[0][0] when it should be
WithInstArray[0].g[0] for the following interface.

   out WithInstArray {
      float g[3];
   } instArray[2];

Reviewed-by: Dave Airlie <airlied@redhat.com>
8 years agoglsl: Fix segfault when lhs is error_type in TCS
Timothy Arceri [Wed, 9 Mar 2016 05:58:29 +0000 (16:58 +1100)]
glsl: Fix segfault when lhs is error_type in TCS

It seems expected that both lhs and rhs could be of type error_type
in this code however the TCS case wasn't expecting it.

Fixes segfault in an enhanced layouts GL CTS test.

Reviewed-by: Dave Airlie <airlied@redhat.com>
8 years agodocs: update softpipe status for shader_image_load_store.
Dave Airlie [Mon, 21 Mar 2016 22:00:52 +0000 (08:00 +1000)]
docs: update softpipe status for shader_image_load_store.

Reviewed-by: Brian Paul <brianp@vmware.com>
Signed-off-by: Dave Airlie <airlied@redhat.com>
8 years agosoftpipe: add image support to softpipe (v3)
Dave Airlie [Mon, 21 Mar 2016 21:59:35 +0000 (07:59 +1000)]
softpipe: add image support to softpipe (v3)

This adds support for ARB_shader_image_load_store to softpipe.

v2: add RESQ support (Ilia)
v3: constify, cleanup internals, add some comments (Brian).

Reviewed-by: Brian Paul <brianp@vmware.com>
Signed-off-by: Dave Airlie <airlied@redhat.com>
8 years agodraw: add support for passing images to vs/gs shaders.
Dave Airlie [Mon, 21 Mar 2016 21:58:39 +0000 (07:58 +1000)]
draw: add support for passing images to vs/gs shaders.

This just adds support for passing through images to the
tgsi execution stage.

Reviewed-by: Brian Paul <brianp@vmware.com>
Signed-off-by: Dave Airlie <airlied@redhat.com>
8 years agotgsi: add support for image operations to tgsi_exec. (v2.1)
Dave Airlie [Mon, 21 Mar 2016 21:53:48 +0000 (07:53 +1000)]
tgsi: add support for image operations to tgsi_exec. (v2.1)

This adds support for load/store/atomic operations on images
along with image tracking support.

v2: add RESQ support. (Ilia)
v2.1: constify interface (Brian)
split get_image_coord_dim (Brian)

Reviewed-by: Brian Paul <brianp@vmware.com>
Signed-off-by: Dave Airlie <airlied@redhat.com>
8 years agosoftpipe: add support for explicit early depth testing
Dave Airlie [Mon, 21 Mar 2016 21:52:26 +0000 (07:52 +1000)]
softpipe: add support for explicit early depth testing

ARB_shader_image_load_store adds support for explicit early
depth testing. However we need to make sure we don't overwrite
values using the shader written values in this case.

This fixes early depth testing in softpipe to conform with
those requirements.

Reviewed-by: Brian Paul <brianp@vmware.com>
Signed-off-by: Dave Airlie <airlied@redhat.com>
8 years agotgsi: introduce NonHelperMask
Dave Airlie [Mon, 21 Mar 2016 21:50:37 +0000 (07:50 +1000)]
tgsi: introduce NonHelperMask

This is a mask of which of the current 2x2 grid are non-helper
invocations. This allows us to mask off the helper invocations
later for the image operations.

Reviewed-by: Brian Paul <brianp@vmware.com>
Signed-off-by: Dave Airlie <airlied@redhat.com>
8 years agotgsi_exec: handle execmask when doing indirect lookups
Dave Airlie [Sun, 20 Mar 2016 22:52:14 +0000 (08:52 +1000)]
tgsi_exec: handle execmask when doing indirect lookups

Reviewed-by: Brian Paul <brianp@vmware.com>
Signed-off-by: Dave Airlie <airlied@redhat.com>
8 years agotgsi_exec: add support for up to 3 address registers (v2)
Dave Airlie [Sun, 20 Mar 2016 22:51:54 +0000 (08:51 +1000)]
tgsi_exec: add support for up to 3 address registers (v2)

v2: be consistent with other definitions.

Reviewed-by: Brian Paul <brianp@vmware.com>
Signed-off-by: Dave Airlie <airlied@redhat.com>
8 years agonir: Propagate negates up multiplication chains.
Matt Turner [Mon, 22 Feb 2016 23:16:49 +0000 (15:16 -0800)]
nir: Propagate negates up multiplication chains.

total instructions in shared programs: 7112159 -> 7088092 (-0.34%)
instructions in affected programs: 1374915 -> 1350848 (-1.75%)
helped: 7392
HURT: 621

GAINED: 2
LOST:   2

8 years agoi965: Don't inline intel_batchbuffer_require_space().
Matt Turner [Wed, 25 Nov 2015 01:17:29 +0000 (17:17 -0800)]
i965: Don't inline intel_batchbuffer_require_space().

It's called by the inline intel_batchbuffer_begin() function which
itself is used in BEGIN_BATCH. So in sequence of code emitting multiple
packets, we have inlined this ~200 byte function multiple times. Making
it an out-of-line function presumably improved icache usage.

Improves performance of Gl32Batch7 by 3.39898% +/- 0.358674% (n=155) on
Ivybridge.

Reviewed-by: Abdiel Janulgue <abdiel.janulgue@linux.intel.com>
8 years agor600: ignore PIPE_BIND_LINEAR in *_is_format_supported
Christian König [Wed, 30 Mar 2016 13:38:29 +0000 (15:38 +0200)]
r600: ignore PIPE_BIND_LINEAR in *_is_format_supported

Similar to radeonsi linear layout should work for all not compressed
or depth/stencil formats. Fixes issues with VDPAU on r600.

Signed-off-by: Christian König <christian.koenig@amd.com>
Tested-by: Dieter Nützel <Dieter@nuetzel-hh.de>
8 years agost/vdpau: correct null check
Thomas Hindoe Paaboel Andersen [Wed, 30 Mar 2016 06:13:24 +0000 (08:13 +0200)]
st/vdpau: correct null check

The null check of result was the wrong way around. Also, move memset
and dereference of result after the null check.

Reviewed-by: Christian König <christian.koenig@amd.com>
8 years agodocs: remove docs/COPYING which contains GPL license
Brian Paul [Wed, 30 Mar 2016 17:22:07 +0000 (11:22 -0600)]
docs: remove docs/COPYING which contains GPL license

There hasn't been GPL code in Mesa for a long time now.

Reviewed-by: Jose Fonseca <jfonseca@vmware.com>
8 years agoglsl: add missing types for buffer images
Samuel Pitoiset [Tue, 29 Mar 2016 21:11:07 +0000 (23:11 +0200)]
glsl: add missing types for buffer images

Type of GLSL_SAMPLER_DIM_BUF can be sampler or image.

Spotted while trying to run dEQP tests related to
ARB_shader_image_load_store.

Signed-off-by: Samuel Pitoiset <samuel.pitoiset@gmail.com>
Reviewed-by: Kenneth Graunke <kenneth@whitecape.org>
Tested-by: Ilia Mirkin <imirkin@alum.mit.edu>
8 years agoglsl: invalidate float suffixes for GLSL 1.10 and GLSL ES 1.00
Lars Hamre [Tue, 29 Mar 2016 00:42:14 +0000 (20:42 -0400)]
glsl: invalidate float suffixes for GLSL 1.10 and GLSL ES 1.00

Float suffixes are not allowed in GLSL 1.10 nor GLSL ES 1.00.

Fixes the following piglit tests:
tests/spec/glsl-1.10/compiler/literals/invalid-float-suffix-capital-f.vert
tests/spec/glsl-1.10/compiler/literals/invalid-float-suffix-f.vert`

v2: modify error message
v3: parse the float instead of returning an ERROR_TOK
v4: (by Ken) Change to is_version(120, 300) to avoid breaking ES3
    shaders; update commit message accordingly.

Bugzilla: https://bugs.freedesktop.org/show_bug.cgi?id=81585
Signed-off-by: Lars Hamre <chemecse@gmail.com>
Reviewed-by: Timothy Arceri <timothy.arceri@collabora.com>
Reviewed-by: Kenneth Graunke <kenneth@whitecape.org>
8 years agotgsi: (trivial) only verify target for is_tex instructions
Roland Scheidegger [Wed, 30 Mar 2016 02:25:45 +0000 (04:25 +0200)]
tgsi: (trivial) only verify target for is_tex instructions

d3d10 state tracker does not encode (valid) target (only offsets are
really used from the texture bits), since that information always comes
from the sview dcl, and not the instruction (note the meaning of target
is actually slightly different between gl and d3d10 in any case, because
d3d10 target does never include shadow bit).
Also move the msaa sampler identification as well - would need to set that
on the sview not sampler, so while this does not fix it make it at least
obvious it won't work with sample instructions.

8 years agomesa: allow mutable buffer textures to back GL ES images
Ilia Mirkin [Tue, 29 Mar 2016 19:31:05 +0000 (15:31 -0400)]
mesa: allow mutable buffer textures to back GL ES images

Since there is no way to create immutable texture buffers in GL ES,
mutable buffer textures are allowed to back images. See issue 7 of the
GL_OES_texture_buffer specification.

Signed-off-by: Ilia Mirkin <imirkin@alum.mit.edu>
Reviewed-by: Samuel Pitoiset <samuel.pitoiset@gmail.com>
8 years agomesa: make _mesa_prepare_mipmap_level() static
Brian Paul [Mon, 28 Mar 2016 23:27:27 +0000 (17:27 -0600)]
mesa: make _mesa_prepare_mipmap_level() static

No longer called from any other file.

Reviewed-by: José Fonseca <jfonseca@vmware.com>
Reviewed-by: Roland Scheidegger <sroland@vmware.com>
Reviewed-by: Ian Romanick <ian.d.romanick@intel.com>
Tested-by: Ian Romanick <ian.d.romanick@intel.com>
8 years agometa: use _mesa_prepare_mipmap_levels()
Brian Paul [Tue, 29 Mar 2016 23:44:00 +0000 (17:44 -0600)]
meta: use _mesa_prepare_mipmap_levels()

The prepare_mipmap_level() wrapper for _mesa_prepare_mipmap_level() is
not needed.  It only served to undo the GL_TEXTURE_1D_ARRAY height/depth
change was was made before the call to prepare_mipmap_level()

Said another way, regardless of how the meta code manipulates the height/
depth dims for GL_TEXTURE_1D_ARRAY, the gl_texture_image dimensions are
correctly set up by _mesa_prepare_mipmap_levels().

Tested by plugging _mesa_meta_GenerateMipmap() into the swrast driver
and testing with piglit.

v2 (idr): Early out of the mipmap generation loop with dstImage is NULL.
This can occur for immutable textures that have a limited range of
levels or in the presense of memory allocation failures.  Fixes
arb_texture_view-mipgen on Intel platforms.

Reviewed-by: José Fonseca <jfonseca@vmware.com>
Reviewed-by: Roland Scheidegger <sroland@vmware.com>
Reviewed-by: Ian Romanick <ian.d.romanick@intel.com>
Tested-by: Ian Romanick <ian.d.romanick@intel.com>
Reviewed-by: Brian Paul <brianp@vmware.com>
8 years agodocs: add HTTP link for Mesa downloads
Brian Paul [Tue, 29 Mar 2016 18:54:10 +0000 (12:54 -0600)]
docs: add HTTP link for Mesa downloads

Bugzilla: https://bugs.freedesktop.org/show_bug.cgi?id=92628
Reviewed-by: Jose Fonseca <jfonseca@vmware.com>
Reviewed-by: Ian Romanick <ian.d.romanick@intel.com>
8 years agotgsi: simplify tgsi_shader_info::is_msaa_sampler checking
Brian Paul [Tue, 29 Mar 2016 17:43:02 +0000 (11:43 -0600)]
tgsi: simplify tgsi_shader_info::is_msaa_sampler checking

We assert that fullinst->Instruction.Texture != 0 above so no need to
check it in the conditional.  We also have the fullinst->Texture.Texture
value in a local variable, so use it.

Reviewed-by: José Fonseca <jfonseca@vmware.com>
Reviewed-by: Roland Scheidegger <sroland@vmware.com>
8 years agotgsi: collect texture sampler target info in tgsi_scan_shader()
Brian Paul [Sat, 26 Mar 2016 17:46:53 +0000 (11:46 -0600)]
tgsi: collect texture sampler target info in tgsi_scan_shader()

Texture sample instructions specify a sampler unit and texture target
such as "1D", "2D", "CUBE", etc.  Sampler view declarations also specify
the sampler unit and texture target.

This patch checks that the texture instructions agree with the declarations
and collects the texture target type for each sampler unit.

v2: only compare instruction's texture target to the sampler view declaration
target if the instruction is a TEX instruction, not a SAMPLE instruction.

Reviewed-by: José Fonseca <jfonseca@vmware.com>
Reviewed-by: Roland Scheidegger <sroland@vmware.com>
8 years agogallium/docs: s/gven/given/
Brian Paul [Tue, 29 Mar 2016 17:32:24 +0000 (11:32 -0600)]
gallium/docs: s/gven/given/

8 years agoxlib: add support for GLX_ARB_create_context
Brian Paul [Sat, 26 Mar 2016 17:35:00 +0000 (11:35 -0600)]
xlib: add support for GLX_ARB_create_context

This adds the glXCreateContextAttribsARB() function for the xlib/swrast
driver.  This allows more piglit tests to run with this driver.

For example, without this patch we get:
$ bin/fbo-generatemipmap-1d -auto
piglit: error: waffle_config_choose failed due to WAFFLE_ERROR_UNSUPPORTED_
ON_PLATFORM: GLX_ARB_create_context is required in order to request an OpenGL
version not equal to the default value 1.0
piglit: error: Failed to create waffle_config for OpenGL 2.0 Compatibility Context
piglit: info: Failed to create any GL context
PIGLIT: {"result": "skip" }

Reviewed-by: Jose Fonseca <jfonseca@vmware.com>
Acked-by: Roland Scheidegger <sroland@vmware.com>
8 years agost/mesa: simplify st_generate_mipmap()
Brian Paul [Thu, 24 Mar 2016 20:09:24 +0000 (14:09 -0600)]
st/mesa: simplify st_generate_mipmap()

The whole st_generate_mipmap() function was overly complicated.  Now
we just call the new _mesa_prepare_mipmap_levels() function to prepare
the texture mipmap memory, then call the generate function which fills
in the texture images.

This fixes a failed assertion in llvmpipe/softpipe which is hit with the
new piglit generatemipmap-base-change test.  Also fixes some device errors
(format mismatches) with the VMware svga driver.

v2: fix a comment typo, per Sinclair

Reviewed-by: Sinclair Yeh <syeh@vmware.com>
Reviewed-by: Jose Fonseca <jfonseca@vmware.com>
Reviewed-by: Roland Scheidegger <sroland@vmware.com>
8 years agomesa: new _mesa_prepare_mipmap_levels() function for mipmap generation
Brian Paul [Thu, 24 Mar 2016 17:24:33 +0000 (11:24 -0600)]
mesa: new _mesa_prepare_mipmap_levels() function for mipmap generation

Simplifies the loops in generate_mipmap_uncompressed() and
generate_mipmap_compressed().  Will be used in the state tracker too.
Could probably be used in the meta code.  If so, some additional
clean-ups can be done after that.

v2: use unsigned types instead of GLuint, per Ian

Reviewed-by: Roland Scheidegger <sroland@vmware.com>
Reviewed-by: Jose Fonseca <jfonseca@vmware.com>
8 years agoi965: Don't use CUBE wrap modes for integer formats on IVB/BYT.
Kenneth Graunke [Tue, 29 Mar 2016 03:07:13 +0000 (20:07 -0700)]
i965: Don't use CUBE wrap modes for integer formats on IVB/BYT.

There is no linear filtering for integer formats, so we should always
be using CLAMP_TO_EDGE mode.

Fixes 46 dEQP cases on Ivybridge (which were likely broken by commit
0faf26e6a0a34c3544644852802484f2404cc83e).

This workaround doesn't appear to be necessary on any other hardware;
I haven't found any documentation mentioning errata in this area.

v2: Only apply on Ivybridge/Baytrail to avoid regressing GLES3.1 tests.

Signed-off-by: Kenneth Graunke <kenneth@whitecape.org>
Reviewed-by: Jason Ekstrand <jason@jlekstrand.net> [v1]
8 years agoRevert "i965: Set address rounding bits for GL_NEAREST filtering as well."
Kenneth Graunke [Tue, 29 Mar 2016 22:35:07 +0000 (15:35 -0700)]
Revert "i965: Set address rounding bits for GL_NEAREST filtering as well."

This reverts commit 60d6a8989ab44cf47accee6bc692ba6fb98f6a9f.

It's pretty sketchy, and apparently regressed a bunch of dEQP tests
on Sandybridge.

8 years agogallium: Format code in pb_buffer_fenced.c according to style guide.
Rovanion Luckey [Tue, 29 Mar 2016 19:43:00 +0000 (13:43 -0600)]
gallium: Format code in pb_buffer_fenced.c according to style guide.

This is a tiny housekeeping patch which does the following:

  * Replaced tabs with three spaces.
  * Formatted oneline and multiline code comments. Some doxygen
    comments weren't marked as such and some code comments were marked
    as doxygen comments.
  * Spaces between if- and while-statements and their parenthesis.

According to the mesa coding style guidelines.

Reviewed-by: Brian Paul <brianp@vmware.com>
8 years agosvga: emit sampler declarations in the helper function for non vgpu10
Charmaine Lee [Tue, 29 Mar 2016 19:34:36 +0000 (13:34 -0600)]
svga: emit sampler declarations in the helper function for non vgpu10

With commit dc9ecf58c0c5c8a97cd41362e78c2fcd9f6e3b80,
we are now getting the sampler target from the sampler view
declaration. But since a sampler view declaration can be defined
after a sampler declaration, we need to emit the
sampler declarations in the pre-helpers function, otherwise,
the sampler target might not have defined yet for the sampler declaration.

Fixes viewperf maya-03 and various gl trace regressions in hwv11.

Reviewed-by: Brian Paul <brianp@vmware.com>
8 years agosvga: avoid freeing non-malloced memory
Brian Paul [Tue, 29 Mar 2016 19:34:36 +0000 (13:34 -0600)]
svga: avoid freeing non-malloced memory

svga_shader_expand() will fall back to using non-malloced memory for
emit.buf if malloc fails. We should check if the memory is malloced
before freeing it in the error path of svga_tgsi_vgpu9_translate.

Original patch by Thomas Hindoe Paaboel Andersen <phomes@gmail.com>.
Remove trivial svga_destroy_shader_emitter() function, by BrianP.

Signed-off-by: Brian Paul <brianp@vmware.com>
8 years agonvc0/ir: move load/store lowering pass to handleLDST()
Samuel Pitoiset [Tue, 29 Mar 2016 17:27:49 +0000 (19:27 +0200)]
nvc0/ir: move load/store lowering pass to handleLDST()

Having all this code in a big switch is not really a good pratice.

Signed-off-by: Samuel Pitoiset <samuel.pitoiset@gmail.com>
Reviewed-by: Ilia Mirkin <imirkin@alum.mit.edu>
8 years agost/mesa: implement new DMA-buf based VDPAU interop v2
Christian König [Thu, 14 Jan 2016 15:46:57 +0000 (16:46 +0100)]
st/mesa: implement new DMA-buf based VDPAU interop v2

Avoid using internal structures from another API.

v2: rebase and moved includes so they don't cause problem when VDPAU isn't installed.

Signed-off-by: Christian König <christian.koenig@amd.com>
Reviewed-by: Marek Olšák <marek.olsak@amd.com> (v1)
Reviewed-by: Leo Liu <leo.liu@amd.com>
8 years agost/vdpau: implement the new DMA-buf based interop v2
Christian König [Thu, 14 Jan 2016 15:45:29 +0000 (16:45 +0100)]
st/vdpau: implement the new DMA-buf based interop v2

That should allow us to get away from passing internal structures around.

v2: rebased

Signed-off-by: Christian König <christian.koenig@amd.com>
Reviewed-by: Leo Liu <leo.liu@amd.com>
8 years agost/vdpau: move FormatRGBAToPipe into the interop
Christian König [Wed, 13 Jan 2016 15:42:44 +0000 (16:42 +0100)]
st/vdpau: move FormatRGBAToPipe into the interop

We are going to need that in the Mesa state tracker as well.

Signed-off-by: Christian König <christian.koenig@amd.com>
Reviewed-by: Leo Liu <leo.liu@amd.com>
8 years agost/vdpau: add new interop interface
Christian König [Tue, 12 Jan 2016 15:07:58 +0000 (16:07 +0100)]
st/vdpau: add new interop interface

Use DMA-buf for the VDPAU interop interface instead of using
internal structures.

Signed-off-by: Christian König <christian.koenig@amd.com>
Reviewed-by: Leo Liu <leo.liu@amd.com>
8 years agost/vdpau: use linear layout for output surfaces
Christian König [Thu, 14 Jan 2016 12:40:25 +0000 (13:40 +0100)]
st/vdpau: use linear layout for output surfaces

Works around a bug in radeonsi and tiling is actually
not very beneficial in this use case.

Signed-off-by: Christian König <christian.koenig@amd.com>
Reviewed-by: Leo Liu <leo.liu@amd.com>
8 years agoradeonsi: ignore PIPE_BIND_LINEAR in si_is_format_supported v2
Christian König [Thu, 14 Jan 2016 12:38:10 +0000 (13:38 +0100)]
radeonsi: ignore PIPE_BIND_LINEAR in si_is_format_supported v2

Linear layout should work for all not compressed or depth/stencil formats.

v2: restrict it a bit more

Signed-off-by: Christian König <christian.koenig@amd.com>
Reviewed-by: Marek Olšák <marek.olsak@amd.com>
8 years agost/mesa: enable OES_texture_buffer when all components available
Ilia Mirkin [Tue, 29 Mar 2016 00:59:13 +0000 (20:59 -0400)]
st/mesa: enable OES_texture_buffer when all components available

OES_texture_buffer combines bits from a number of desktop extensions.
When they're all available, turn it on.

Signed-off-by: Ilia Mirkin <imirkin@alum.mit.edu>
Reviewed-by: Marek Olšák <marek.olsak@amd.com>
8 years agoglapi/glx: Mark the indirect swapped dispatch functions _X_COLD
Adam Jackson [Thu, 24 Mar 2016 17:57:58 +0000 (13:57 -0400)]
glapi/glx: Mark the indirect swapped dispatch functions _X_COLD

A modest size savings:

   text    data     bss     dec     hex filename
 264143   15608     232  279983   445af libglx.so.before
 254303   15608     232  270143   41f3f libglx.so.after

Reviewed-by: Ian Romanick <ian.d.romanick@intel.com>
Signed-off-by: Adam Jackson <ajax@redhat.com>
8 years agoglapi/glx: Sync some additional error checking from xserver
Adam Jackson [Thu, 24 Mar 2016 17:57:58 +0000 (13:57 -0400)]
glapi/glx: Sync some additional error checking from xserver

Reviewed-by: Ian Romanick <ian.d.romanick@intel.com>
Signed-off-by: Adam Jackson <ajax@redhat.com>
8 years agoglsl: raise warning when using uninitialized variables
Alejandro Piñeiro [Tue, 23 Feb 2016 10:48:52 +0000 (11:48 +0100)]
glsl: raise warning when using uninitialized variables

v2:
 * Take into account out varyings too (Timothy Arceri)
 * Fix style (Timothy Arceri)
 * Use a new ast_expression variable, instead of an
   ast_expression::hir new parameter (Timothy Arceri)

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

Reviewed-by: Timothy Arceri <timothy.arceri@collabora.com>
8 years agoglsl: add is_lhs bool on ast_expression
Alejandro Piñeiro [Thu, 25 Feb 2016 10:11:54 +0000 (11:11 +0100)]
glsl: add is_lhs bool on ast_expression

Useful to know if a expression is the recipient of an assignment
or not, that would be used to (for example) raise warnings of
"use of uninitialized variable" without getting a false positive
when assigning first a variable.

By default the value is false, and it is assigned to true on
the following cases:
 * The lhs assignments subexpression
 * At ast_array_index, on the array itself.
 * While handling the method on an array, to avoid the warning
   calling array.length
 * When computed the cached test expression at test_to_hir, to
   avoid a duplicate warning on the test expression of a switch.

set_is_lhs setter is added, because in some cases (like ast_field_selection)
the value need to be propagated on the expression tree. To avoid doing the
propatagion if not needed, it skips if no primary_expression.identifier is
available.

v2: use a new bool on ast_expression, instead of a new parameter
    on ast_expression::hir (Timothy Arceri)

v3: fix style and some typos on comments, initialize is_lhs default value
    on constructor, to avoid a c++11 feature (Ian Romanick)

v4: some tweaks on comments (Timothy Arceri)

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

Reviewed-by: Timothy Arceri <timothy.arceri@collabora.com>
8 years agonir: Add a helper for getting the current block from a cursor
Jason Ekstrand [Fri, 25 Mar 2016 21:16:47 +0000 (14:16 -0700)]
nir: Add a helper for getting the current block from a cursor

Reviewed-by: Rob Clark <robdclark@gmail.com>
8 years agonir/lower_out_to_temp: Add an "entrypoint" parameter
Jason Ekstrand [Fri, 25 Mar 2016 21:11:19 +0000 (14:11 -0700)]
nir/lower_out_to_temp: Add an "entrypoint" parameter

Previously, the pass assumed that the entrypoint would be whatever function
happened to have the name "main".  We really shouldn't trust in the
function names.

Reviewed-by: Rob Clark <robdclark@gmail.com>
8 years agonir/lower_out_to_temp: Steal the output's constant initializer
Jason Ekstrand [Fri, 25 Mar 2016 21:17:18 +0000 (14:17 -0700)]
nir/lower_out_to_temp: Steal the output's constant initializer

Reviewed-by: Rob Clark <robdclark@gmail.com>
8 years agonir: Add a helper for getting the unique function in a shader
Jason Ekstrand [Fri, 25 Mar 2016 21:07:41 +0000 (14:07 -0700)]
nir: Add a helper for getting the unique function in a shader

Reviewed-by: Rob Clark <robdclark@gmail.com>
8 years agonir/sweep: Sweep function parameters
Jason Ekstrand [Fri, 25 Mar 2016 18:10:30 +0000 (11:10 -0700)]
nir/sweep: Sweep function parameters

They are no longer in the list of local variables so we need to explicitly
sweep them.

Reviewed-by: Rob Clark <robdclark@gmail.com>
8 years agonir/builder: Add a helper for creating undefs
Jason Ekstrand [Fri, 25 Mar 2016 17:43:46 +0000 (10:43 -0700)]
nir/builder: Add a helper for creating undefs

Reviewed-by: Rob Clark <robdclark@gmail.com>
8 years agonir/builder: Add a helper for storing to variable derefs
Jason Ekstrand [Fri, 25 Mar 2016 17:35:03 +0000 (10:35 -0700)]
nir/builder: Add a helper for storing to variable derefs

Reviewed-by: Rob Clark <robdclark@gmail.com>
8 years agonir/builder: Add a helper for building fdot instructions
Jason Ekstrand [Fri, 25 Mar 2016 17:34:17 +0000 (10:34 -0700)]
nir/builder: Add a helper for building fdot instructions

Reviewed-by: Rob Clark <robdclark@gmail.com>
8 years agonir: Add a variable_foreach_safe helper
Jason Ekstrand [Fri, 25 Mar 2016 17:18:35 +0000 (10:18 -0700)]
nir: Add a variable_foreach_safe helper

Reviewed-by: Rob Clark <robdclark@gmail.com>
8 years agonir/Makefile: Fix alphabetization
Jason Ekstrand [Fri, 25 Mar 2016 17:08:50 +0000 (10:08 -0700)]
nir/Makefile: Fix alphabetization

Reviewed-by: Rob Clark <robdclark@gmail.com>
8 years agomesa: add OES_texture_buffer and EXT_texture_buffer support
Ilia Mirkin [Sat, 27 Feb 2016 21:16:28 +0000 (16:16 -0500)]
mesa: add OES_texture_buffer and EXT_texture_buffer support

Allow ES 3.1 contexts to access the texture buffer functionality.

Signed-off-by: Ilia Mirkin <imirkin@alum.mit.edu>
Reviewed-by: Brian Paul <brianp@vmware.com>
Reviewed-by: Ian Romanick <ian.d.romanick@intel.com>
8 years agoglsl: add OES_texture_buffer and EXT_texture_buffer support
Ilia Mirkin [Sat, 27 Feb 2016 21:13:50 +0000 (16:13 -0500)]
glsl: add OES_texture_buffer and EXT_texture_buffer support

Expose the samplerBuffer/imageBuffer types, and allow the various
functions to operate on them.

Signed-off-by: Ilia Mirkin <imirkin@alum.mit.edu>
Reviewed-by: Brian Paul <brianp@vmware.com>
Reviewed-by: Ian Romanick <ian.d.romanick@intel.com>
8 years agomesa: add OES_texture_buffer and EXT_texture_buffer extension to table
Ilia Mirkin [Sat, 27 Feb 2016 21:06:42 +0000 (16:06 -0500)]
mesa: add OES_texture_buffer and EXT_texture_buffer extension to table

We need to add a new bit since the GL ES exts require functionality from
a combination of texture buffer extensions as well as images (for
imageBuffer) support. Additionally, not all GPUs support all the texture
buffer functionality (e.g. rgb32 isn't supported by nv50).

Signed-off-by: Ilia Mirkin <imirkin@alum.mit.edu>
Reviewed-by: Brian Paul <brianp@vmware.com>
Reviewed-by: Ian Romanick <ian.d.romanick@intel.com>
8 years agomesa: properly return GetTexLevelParameter queries for buffer textures
Ilia Mirkin [Sat, 27 Feb 2016 21:04:51 +0000 (16:04 -0500)]
mesa: properly return GetTexLevelParameter queries for buffer textures

This fixes all failures with dEQP tests in this area. While
ARB_texture_buffer_object explicitly says that GetTexLevelParameter & co
should not be supported, GL 3.1 reverses this decision and allows all of
these queries there.

Conversely, there is no text that forbids the buffer-specific queries
from being used with non-buffer images.

Signed-off-by: Ilia Mirkin <imirkin@alum.mit.edu>
Reviewed-by: Brian Paul <brianp@vmware.com>
8 years agoglsl: Delete initialized field from uniform storage test.
Kenneth Graunke [Mon, 28 Mar 2016 23:57:19 +0000 (16:57 -0700)]
glsl: Delete initialized field from uniform storage test.

Timothy deleted this field.  Fixes "make check".

Signed-off-by: Kenneth Graunke <kenneth@whitecape.org>
Reviewed-by: Timothy Arceri <timothy.arceri@collabora.com>
8 years agomesa: remove initialized field from uniform storage
Timothy Arceri [Sun, 27 Mar 2016 03:51:02 +0000 (14:51 +1100)]
mesa: remove initialized field from uniform storage

The only place this was used was in a gallium debug function that
had to be manually enabled.

Reviewed-by: Edward O'Callaghan <eocallaghan@alterapraxis.com>
Reviewed-by: Brian Paul <brianp@vmware.com>
8 years agonvc0: use a different offset for buffers and surfaces
Samuel Pitoiset [Mon, 28 Mar 2016 10:43:01 +0000 (12:43 +0200)]
nvc0: use a different offset for buffers and surfaces

To not overwrite buffers and surfaces information, we need to use
a different offset in the driver constant buffer. Currently, OP_SUQ
is only supported for buffers but this will be slightly updated for
images support.

Signed-off-by: Samuel Pitoiset <samuel.pitoiset@gmail.com>
Acked-by: Ilia Mirkin <imirkin@alum.mit.edu>
8 years agoi965: Set address rounding bits for GL_NEAREST filtering as well.
Kenneth Graunke [Tue, 8 Mar 2016 07:54:53 +0000 (23:54 -0800)]
i965: Set address rounding bits for GL_NEAREST filtering as well.

Yuanhan Liu decided these were useful for linear filtering in
commit 76669381 (circa 2011).  Prior to that, we never set them;
it seems he tried to preserve that behavior for nearest filtering.

It turns out they're useful for nearest filtering, too: setting
these fixes the following dEQP-GLES3 tests:

functional.fbo.blit.rect.nearest_consistency_mag
functional.fbo.blit.rect.nearest_consistency_mag_reverse_src_x
functional.fbo.blit.rect.nearest_consistency_mag_reverse_src_y
functional.fbo.blit.rect.nearest_consistency_mag_reverse_dst_x
functional.fbo.blit.rect.nearest_consistency_mag_reverse_dst_y
functional.fbo.blit.rect.nearest_consistency_mag_reverse_src_dst_x
functional.fbo.blit.rect.nearest_consistency_mag_reverse_src_dst_y
functional.fbo.blit.rect.nearest_consistency_min
functional.fbo.blit.rect.nearest_consistency_min_reverse_src_x
functional.fbo.blit.rect.nearest_consistency_min_reverse_src_y
functional.fbo.blit.rect.nearest_consistency_min_reverse_dst_x
functional.fbo.blit.rect.nearest_consistency_min_reverse_dst_y
functional.fbo.blit.rect.nearest_consistency_min_reverse_src_dst_x
functional.fbo.blit.rect.nearest_consistency_min_reverse_src_dst_y
functional.fbo.blit.rect.nearest_consistency_out_of_bounds_mag
functional.fbo.blit.rect.nearest_consistency_out_of_bounds_mag_reverse_src_x
functional.fbo.blit.rect.nearest_consistency_out_of_bounds_mag_reverse_src_y
functional.fbo.blit.rect.nearest_consistency_out_of_bounds_mag_reverse_dst_x
functional.fbo.blit.rect.nearest_consistency_out_of_bounds_mag_reverse_dst_y
functional.fbo.blit.rect.nearest_consistency_out_of_bounds_mag_reverse_src_dst_x
functional.fbo.blit.rect.nearest_consistency_out_of_bounds_mag_reverse_src_dst_y
functional.fbo.blit.rect.nearest_consistency_out_of_bounds_min
functional.fbo.blit.rect.nearest_consistency_out_of_bounds_min_reverse_src_x
functional.fbo.blit.rect.nearest_consistency_out_of_bounds_min_reverse_src_y
functional.fbo.blit.rect.nearest_consistency_out_of_bounds_min_reverse_dst_x
functional.fbo.blit.rect.nearest_consistency_out_of_bounds_min_reverse_dst_y
functional.fbo.blit.rect.nearest_consistency_out_of_bounds_min_reverse_src_dst_x
functional.fbo.blit.rect.nearest_consistency_out_of_bounds_min_reverse_src_dst_y

Apparently, BLORP has always set these bits unconditionally.

However, setting them unconditionally appears to regress tests using
texture projection, 3D samplers, integer formats, and vertex shaders,
all in combination, such as:

functional.shaders.texture_functions.textureprojlod.isampler3d_vertex

Setting them on Gen4-5 appears to regress Piglit's
tests/spec/arb_sampler_objects/framebufferblit.

Honestly, it looks like the real problem here is a lack of precision.
I'm just hacking around problems here (as embarassing as it is).

Signed-off-by: Kenneth Graunke <kenneth@whitecape.org>
Reviewed-by: Jordan Justen <jordan.l.justen@intel.com>
8 years agoi965: Always use BRW_TEXCOORDMODE_CUBE when seamless filtering.
Kenneth Graunke [Wed, 23 Mar 2016 18:56:39 +0000 (11:56 -0700)]
i965: Always use BRW_TEXCOORDMODE_CUBE when seamless filtering.

When using seamless cube map mode and NEAREST filtering, we explicitly
overrode the wrap modes to CLAMP_TO_EDGE.  This was to implement the
following spec text:

   "If NEAREST filtering is done within a miplevel, always apply apply
    wrap mode CLAMP_TO_EDGE."

However, textureGather() ignores the sampler's filtering mode, and
instead returns the four pixels that would be blended by LINEAR
filtering.  This implies that we should do proper seamless filtering,
and include pixels from adjacent cube faces.

It turns out that we can simply delete the NEAREST -> CLAMP_TO_EDGE
overrides.  Normal cube map sampling works by first selecting the
face, and then nearest filtering fetches the closest texel.  If the
nearest texel was on a different face, then that face would have been
chosen.  So it should always be within the face anyway, which
effectively performs CLAMP_TO_EDGE.

Fixes 86 dEQP-GLES31.texture.gather.basic.cube.* tests.

Signed-off-by: Kenneth Graunke <kenneth@whitecape.org>
Suggested-by: Ian Romanick <idr@freedesktop.org>
Reviewed-by: Jason Ekstrand <jason@jlekstrand.net>
8 years agoi965: Fix brw_render_cache_set_check_flush's PIPE_CONTROLs.
Kenneth Graunke [Fri, 25 Mar 2016 22:33:35 +0000 (15:33 -0700)]
i965: Fix brw_render_cache_set_check_flush's PIPE_CONTROLs.

Our driver uses the brw_render_cache mechanism to track buffers we've
rendered to and are about to sample from.

Previously, we did a single PIPE_CONTROL with the following bits set:
- Render Target Flush
- Depth Cache Flush
- Texture Cache Invalidate
- VF Cache Invalidate
- Instruction Cache Invalidate
- CS Stall

This combined both "top of pipe" invalidations and "bottom of pipe"
flushes, which isn't how the hardware is intended to be programmed.

The "top of pipe" invalidations may happen right away, without any
guarantees that rendering using those caches has completed.  That
rendering may continue altering the caches.  The "bottom of pipe"
flushes do wait for the rendering to complete.  The CS stall also
prevents further work from happening until data is flushed out.

What we wanted to do was wait for rendering complete, flush the new
data out of the render and depth caches, wait, then invalidate any
stale data in read-only caches.  We can accomplish this by doing the
"bottom of pipe" flushes with a CS stall, then the "top of pipe"
flushes as a second PIPE_CONTROL.  The flushes will wait until the
rendering is complete, and the CS stall will prevent the second
PIPE_CONTROL with the invalidations from executing until the first
is done.

Fixes dEQP-GLES3.functional.texture.specification.teximage2d_pbo
subtests on Braswell and Skylake.  These tests hit the meta PBO
texture upload path, which binds the PBO as a texture and samples
from it, while rendering to the destination texture.  The tests
then sample from the texture.

For now, we leave Gen4-5 alone.  It probably needs work too, but
apparently it hasn't even been setting the (G45+) TC invalidation
bit at all...

v2: Add Sandybridge post-sync non-zero workaround, for safety.

Cc: mesa-stable@lists.freedesktop.org
Suggested-by: Francisco Jerez <currojerez@riseup.net>
Signed-off-by: Kenneth Graunke <kenneth@whitecape.org>
Reviewed-by: Jason Ekstrand <jason@jlekstrand.net>
Reviewed-by: Francisco Jerez <currojerez@riseup.net>
8 years agoi965: Whack UAV bit when FS discards and there are no color writes.
Kenneth Graunke [Thu, 24 Mar 2016 23:21:35 +0000 (16:21 -0700)]
i965: Whack UAV bit when FS discards and there are no color writes.

dEQP-GLES31.functional.fbo.no_attachments.* draws a quad with no
framebuffer attachments, using a shader that discards based on
gl_FragCoord.  It uses occlusion queries to inspect whether pixels
are rendered or not.

Unfortunately, the hardware is not dispatching any pixel shaders,
so discards never happen, and the full quad of pixels increments
PS_DEPTH_COUNT, making the occlusion query results bogus.

To understand why, we have to delve into the WM_INT internal
signalling mechanism's formulas.

The "WM_INT::Pixel Shader Kill Pixel" signal is defined as:

    3DSTATE_WM::ForceKillPixel == ON ||
    (3DSTATE_WM::ForceKillPixel != Off &&
     !WM_INT::WM_HZ_OP &&
     3DSTATE_WM::EDSC_Mode != PREPS &&
     (WM_INT::Depth Write Enable || WM_INT::Stencil Write Enable) &&
     ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
     (3DSTATE_PS_EXTRA::PixelShaderKillsPixels ||
      3DSTATE_PS_EXTRA:: oMask Present to RenderTarget ||
      3DSTATE_PS_BLEND::AlphaToCoverageEnable ||
      3DSTATE_PS_BLEND::AlphaTestEnable ||
      3DSTATE_WM_CHROMAKEY::ChromaKeyKillEnable))

Because there is no depth or stencil buffer, writes to those buffers
are disabled.  So the highlighted condition is false, making the whole
"Kill Pixel" condition false.  This then feeds into the following
"WM_INT::ThreadDispatchEnable" condition:

    3DSTATE_WM::ForceThreadDispatch != OFF &&
    !WM_INT::WM_HZ_OP &&
    3DSTATE_PS_EXTRA::PixelShaderValid &&
    (3DSTATE_PS_EXTRA::PixelShaderHasUAV ||
     WM_INT::Pixel Shader Kill Pixel ||
     WM_INT::RTIndependentRasterizationEnable ||
     (!3DSTATE_PS_EXTRA::PixelShaderDoesNotWriteRT &&
      3DSTATE_PS_BLEND::HasWriteableRT) ||
     (WM_INT::Pixel Shader Computed Depth Mode != PSCDEPTH_OFF &&
      (WM_INT::Depth Test Enable || WM_INT::Depth Write Enable)) ||
     (3DSTATE_PS_EXTRA::Computed Stencil && WM_INT::Stencil Test Enable) ||
     (3DSTATE_WM::EDSC_Mode == 1 && (WM_INT::Depth Test Enable ||
                                     WM_INT::Depth Write Enable ||
                                     WM_INT::Stencil Test Enable)))

Given that there's no depth/stencil testing, no writeable render target,
and the hardware thinks kill pixel doesn't happen, all of these
conditions are false.  We have to whack some bit to make PS invocations
happen.  There are many options.

Curro suggested using the UAV bit.  There's some precedence in doing
that - we set it for fragment shaders that do SSBO/image/atomic writes
when no color buffer writes are enabled.  We can simply include discard
here too.

Fixes 64 dEQP-GLES31.functional.fbo.no_attachments.* tests.

v2: Add a comment suggested and written by Jason Ekstrand.

Signed-off-by: Kenneth Graunke <kenneth@whitecape.org>
Reviewed-by: Francisco Jerez <currojerez@riseup.net>
Reviewed-by: Jason Ekstrand <jason@jlekstrand.net>
8 years agovc4: Remove unused include from vc4_nir_lower_txf_ms.c
Rhys Kidd [Sat, 19 Mar 2016 22:37:57 +0000 (18:37 -0400)]
vc4: Remove unused include from vc4_nir_lower_txf_ms.c

Found with grep and inspection. Test compiled on RPi hw.
Assists any future effort to remove TGSI as an intermediate stage.

Signed-off-by: Rhys Kidd <rhyskidd@gmail.com>
Signed-off-by: Eric Anholt <eric@anholt.net>
8 years agoglapi/glx: Treat xserver generated targets as .PHONY
Adam Jackson [Thu, 24 Mar 2016 17:57:57 +0000 (13:57 -0400)]
glapi/glx: Treat xserver generated targets as .PHONY

Meaning, always rebuild them when asked instead of bothering to look at
timestamps (and then wondering why nothing happened when you said make).

Reviewed-by: Ian Romanick <ian.d.romanick@intel.com>
Signed-off-by: Adam Jackson <ajax@redhat.com>
8 years agoglapi/glx: Thunk non-ABI calls through GetProcAddress
Adam Jackson [Thu, 24 Mar 2016 17:57:57 +0000 (13:57 -0400)]
glapi/glx: Thunk non-ABI calls through GetProcAddress

Reviewed-by: Ian Romanick <ian.d.romanick@intel.com>
Signed-off-by: Adam Jackson <ajax@redhat.com>
8 years agoglapi/glx: Emit direct GL calls instead of dispatch lookup
Adam Jackson [Thu, 24 Mar 2016 17:57:57 +0000 (13:57 -0400)]
glapi/glx: Emit direct GL calls instead of dispatch lookup

Reviewed-by: Ian Romanick <ian.d.romanick@intel.com>
Signed-off-by: Adam Jackson <ajax@redhat.com>
8 years agoglx: Unbreak generating some of the xorg glx headers
Adam Jackson [Thu, 24 Mar 2016 17:57:57 +0000 (13:57 -0400)]
glx: Unbreak generating some of the xorg glx headers

Broken by:

    commit 9ace0b542241c77ae82a0835ac8a09e2a7510eaf
    Author: Dylan Baker <baker.dylan.c@gmail.com>
    Date:   Wed May 20 15:49:11 2015 -0700

glapi: glX_proto_size.py: use argparse instead of getopt

Which changed most, but not all, callers to use --header-tag instead of
-h.

Reviewed-by: Dylan Baker <baker.dylan.c@gmail.com>
Signed-off-by: Adam Jackson <ajax@redhat.com>
8 years agomesa/st: Fix NULL access if no fragment shader is bound
Bas Nieuwenhuizen [Mon, 28 Mar 2016 15:01:49 +0000 (17:01 +0200)]
mesa/st: Fix NULL access if no fragment shader is bound

Signed-off-by: Bas Nieuwenhuizen <bas@basnieuwenhuizen.nl>
Signed-off-by: Marek Olšák <marek.olsak@amd.com>
8 years agofreedreno/ir3: fix for load_front_face intrinsic
Rob Clark [Mon, 21 Mar 2016 23:55:37 +0000 (19:55 -0400)]
freedreno/ir3: fix for load_front_face intrinsic

Seems like trying to widen in the same instruction as the add.s does a
non-sign-extending widen.

Signed-off-by: Rob Clark <robclark@freedesktop.org>
8 years agofreedreno/ir3: fix compiler warn
Rob Clark [Sat, 6 Feb 2016 14:09:52 +0000 (09:09 -0500)]
freedreno/ir3: fix compiler warn

Signed-off-by: Rob Clark <robclark@freedesktop.org>
8 years agonvc0: make sure to disable fetches from previously-set VBOs when blitting
Ilia Mirkin [Mon, 28 Mar 2016 04:52:00 +0000 (00:52 -0400)]
nvc0: make sure to disable fetches from previously-set VBOs when blitting

We disable the vertex attributes, but also disable the VBO fetch details
as well, just in case. Not known to fix anything.

Signed-off-by: Ilia Mirkin <imirkin@alum.mit.edu>
8 years agonvc0: disable primitive restart and index bias during blits
Ilia Mirkin [Sun, 27 Mar 2016 02:32:43 +0000 (22:32 -0400)]
nvc0: disable primitive restart and index bias during blits

Back in the dawn of time, we used to do immediate uploads for the vertex
data, and all was well. However Maxwell dropped support for immediate
vertex data, so we started feeding in a VBO (in all cases). But we
forgot to disable some things that apply in such cases, specifically
primitive restart and index bias. The latter was causing WoW and other
Blizzard games trouble as they use a pattern where they draw with a base
vertex (aka index bias), followed by texture uploads (aka blits,
internally).

Bugzilla: https://bugs.freedesktop.org/show_bug.cgi?id=91526
Cc: "11.1 11.2" <mesa-stable@lists.freedesktop.org>
Signed-off-by: Ilia Mirkin <imirkin@alum.mit.edu>
Tested-by: Karol Herbst <nouveau@karolherbst.de>
8 years agonvc0/ir: fix picking of coordinates from tex instruction for textureGrad
Ilia Mirkin [Sun, 20 Mar 2016 21:26:13 +0000 (17:26 -0400)]
nvc0/ir: fix picking of coordinates from tex instruction for textureGrad

On Fermi, there's an argument in front of the coords that combines array
and indirect handle, while on Kepler the array and the indirect handle
are separate (and in front of the coords). We were previously only
accounting for the array bit of it, if there were an indirect access it
wouldn't be counted in the formula.

Signed-off-by: Ilia Mirkin <imirkin@alum.mit.edu>
Cc: "11.1 11.2" <mesa-stable@lists.freedesktop.org>
8 years agonv50/ir: saturate depth writes
Ilia Mirkin [Sun, 20 Mar 2016 17:11:01 +0000 (13:11 -0400)]
nv50/ir: saturate depth writes

Apparently there's no post-FS clamping logic, so we have to do this by
hand. The depth will never be outside of the 0..1 range, even on
floating point zeta buffers, so this should be safe.

Fixes dEQP-GLES3.functional.fbo.depth.*clamp.* which tests writing
invalid values on various zeta buffer formats.

Signed-off-by: Ilia Mirkin <imirkin@alum.mit.edu>
8 years agogallium/util: fix up inaccurate behavior of util_framebuffer_state_equal (v2)
Marek Olšák [Sun, 27 Mar 2016 17:11:09 +0000 (19:11 +0200)]
gallium/util: fix up inaccurate behavior of util_framebuffer_state_equal (v2)

v2: move the nr_cbufs check above the loop

Reviewed-by: Ilia Mirkin <imirkin@alum.mit.edu> (v1)