mesa.git
8 years agoglx: fix crash with bad fbconfig
Daniel Czarnowski [Wed, 10 Feb 2016 17:36:05 +0000 (09:36 -0800)]
glx: fix crash with bad fbconfig

GLX documentation states:
glXCreateNewContext can generate the following errors: (...)
GLXBadFBConfig if config is not a valid GLXFBConfig

Function checks if the given config is a valid config and sets proper
error code.

Fixes currently crashing glx-fbconfig-bad Piglit test.

v2: coding style cleanups (Emil, Topi)
    use DefaultScreen macro (Emil)

Signed-off-by: Matt Roper <matthew.d.roper@intel.com>
Signed-off-by: Tapani Pälli <tapani.palli@intel.com>
Reviewed-by: Emil Velikov <emil.velikov@collabora.com>
Cc: "11.2" <mesa-stable@lists.freedesktop.org>
8 years agost/vdpau: implement luma keying
Nayan Deshmukh [Wed, 8 Jun 2016 09:36:25 +0000 (15:06 +0530)]
st/vdpau: implement luma keying

Signed-off-by: Nayan Deshmukh <nayan26deshmukh@gmail.com>
Reviewed-by: Christian König <christian.koenig@amd.com>
8 years agovl: Apply luma key filter before CSC conversion
Nayan Deshmukh [Wed, 8 Jun 2016 09:22:48 +0000 (14:52 +0530)]
vl: Apply luma key filter before CSC conversion

    Apply the luma key filter to the YCbCr values during the CSC conversion
    in video buffer shader. The initial values of max and min luma are set
    to opposite values to disable the filter initially and will be set when
    enabling it.

    Add extra parmeters min and max luma for the luma key filter in
    vl_compositor_set_csc_matrix in va, xvmc. Setting them
    to opposite value 1.f and 0.f respectively won't effect the CSC
    conversion

    v2: -Squash 1,2 and 3 into one patch to avoid breaking build of
        other components. (Christian)
        -use ureg_swizzle. (Christian)
        -change name of the variables. (Christian)

    v3: -Squash all patches in one to avoid breaking of build. (Emil)
        -wrap functions properly. (Emil)
        -use 0.0f and 1.0f instead of 0.f and 1.f respectively. (Emil)

    v4: -Divide it in two patches one which introduces the functionality
 and assigs dummy values to the changed functions and second which
 implements the lumakey filter. (Christian)
-use ureg_scalar instead ureg_swizzle. (Christian)

Signed-off-by: Nayan Deshmukh <nayan26deshmukh@gmail.com>
Reviewed-by: Christian König <christian.koenig@amd.com>
8 years agoi965: Emit surface states for extra planes prior to gen8
Jason Ekstrand [Thu, 9 Jun 2016 02:56:46 +0000 (19:56 -0700)]
i965: Emit surface states for extra planes prior to gen8

When Kristian implemented GL_TEXTURE_EXTERNAL_OES, he hooked it up for gen8
but not for gen7 or earlier.  It all works, we just need to emit the states
for the extra planes.

Signed-off-by: Jason Ekstrand <jason@jlekstrand.net>
Reviewed-by: Kristian Høgsberg <krh@bitplanet.net>
Cc: "12.0" <mesa-stable@lists.freedesktop.org>
8 years agovirgl: fix checking fences
Marc-André Lureau [Tue, 7 Jun 2016 12:54:34 +0000 (14:54 +0200)]
virgl: fix checking fences

When calling virgl_fence_wait() with timeout=0,
virgl_{drm,vtest}_resource_is_busy() is called. However, it returns TRUE
for a busy resource, whereace virgl_fence_wait() should return TRUE for
a completed (non-busy) resource.

This fixes running supertuxkart in a VM (I could not reproduce locally
with vtest though there is a similar fix)

Signed-off-by: Marc-André Lureau <marcandre.lureau@redhat.com>
Cc: "11.1 11.2 12.0" <mesa-stable@lists.freedesktop.org>
Signed-off-by: Dave Airlie <airlied@redhat.com>
8 years agoglsl/types: rename is_dual_slot_double to is_dual_slot_64bit.
Dave Airlie [Wed, 8 Jun 2016 21:50:43 +0000 (07:50 +1000)]
glsl/types: rename is_dual_slot_double to is_dual_slot_64bit.

In the future int64 support will have the same requirements.

Reviewed-by: Ilia Mirkin <imirkin@alum.mit.edu>
Signed-off-by: Dave Airlie <airlied@redhat.com>
8 years agost/glsl_to_tgsi: move to checking 64-bitness instead of double
Dave Airlie [Wed, 8 Jun 2016 20:57:35 +0000 (06:57 +1000)]
st/glsl_to_tgsi: move to checking 64-bitness instead of double

This uses the new types interfaces to check for 64-bit types,
as futureproofing against int64 support.

Reviewed-by: Ilia Mirkin <imirkin@alum.mit.edu>
Signed-off-by: Dave Airlie <airlied@redhat.com>
8 years agost/glsl_to_tgsi: use enum glsl_base_type instead of unsigned
Dave Airlie [Wed, 8 Jun 2016 20:48:33 +0000 (06:48 +1000)]
st/glsl_to_tgsi: use enum glsl_base_type instead of unsigned

This is just some better type safety that I noticed while working
on 64-bit integer support.

Reviewed-by: Ilia Mirkin <imirkin@alum.mit.edu>
Signed-off-by: Dave Airlie <airlied@redhat.com>
8 years agomesa: use new 64-bit checks instead of explicit double checks.
Dave Airlie [Wed, 8 Jun 2016 21:07:42 +0000 (07:07 +1000)]
mesa: use new 64-bit checks instead of explicit double checks.

This just moves to the new interfaces in advance of int64.

Reviewed-by: Ilia Mirkin <imirkin@alum.mit.edu>
Signed-off-by: Dave Airlie <airlied@redhat.com>
8 years agoglsl/link_varyings: switch to 64bit check instead of double.
Dave Airlie [Wed, 8 Jun 2016 21:02:36 +0000 (07:02 +1000)]
glsl/link_varyings: switch to 64bit check instead of double.

This is prep work for int64 support.

Reviewed-by: Ilia Mirkin <imirkin@alum.mit.edu>
Signed-off-by: Dave Airlie <airlied@redhat.com>
8 years agoglsl: use new interfaces for 64-bit checks.
Dave Airlie [Wed, 8 Jun 2016 21:02:07 +0000 (07:02 +1000)]
glsl: use new interfaces for 64-bit checks.

This is just prep work for int64 support, changing
places where 64-bit matters no doubles.

Reviewed-by: Ilia Mirkin <imirkin@alum.mit.edu>
Signed-off-by: Dave Airlie <airlied@redhat.com>
8 years agocompiler: use 64bit check for sizing instead of double check.
Dave Airlie [Wed, 8 Jun 2016 21:07:06 +0000 (07:07 +1000)]
compiler: use 64bit check for sizing instead of double check.

This just moves code to the new check in advance of int64 support.

Reviewed-by: Ilia Mirkin <imirkin@alum.mit.edu>
Signed-off-by: Dave Airlie <airlied@redhat.com>
8 years agocompiler/types: add 64-bitness queries.
Dave Airlie [Wed, 8 Jun 2016 20:52:15 +0000 (06:52 +1000)]
compiler/types: add 64-bitness queries.

This adds an inline and type query for if a type is 64-bit.

Fow now this is equivalent to double, but int64 will change
this.

Reviewed-by: Ilia Mirkin <imirkin@alum.mit.edu>
Signed-off-by: Dave Airlie <airlied@redhat.com>
8 years agoglapi/glx: Add overflow checks to the client-side indirect code
Adam Jackson [Tue, 24 May 2016 19:45:11 +0000 (15:45 -0400)]
glapi/glx: Add overflow checks to the client-side indirect code

Coverity complains that the computed sizes can lead to negative lengths
passed to memcpy. If that happens we've been handed invalid arguments
anyway, so just bomb out.

The funky "0%s" is because the size string for the variable-length part
of the request is of the form "+ safe_pad() ...", and a unary + would
coerce the result to always be positive, defeating the overflow check.

Signed-off-by: Adam Jackson <ajax@redhat.com>
Reviewed-by: Matt Turner <mattst88@gmail.com>
8 years agoradeonsi: improve the computation and comment of scratch_waves
Marek Olšák [Wed, 8 Jun 2016 12:34:11 +0000 (14:34 +0200)]
radeonsi: improve the computation and comment of scratch_waves

2% isn't much. If you think the number should be decreased, please speak up.

Reviewed-by: Nicolai Hähnle <nicolai.haehnle@amd.com>
8 years agoradeonsi: print the number of spilled VGPRs
Marek Olšák [Wed, 8 Jun 2016 11:51:04 +0000 (13:51 +0200)]
radeonsi: print the number of spilled VGPRs

Reviewed-by: Nicolai Hähnle <nicolai.haehnle@amd.com>
8 years agogallium/radeon: remove dead code creating LLVMTargetMachine
Marek Olšák [Tue, 7 Jun 2016 22:42:01 +0000 (00:42 +0200)]
gallium/radeon: remove dead code creating LLVMTargetMachine

This was for some old unsupported LLVM version.
Only si_create_context creates the target machine now.
r600g doesn't use this function.

Reviewed-by: Nicolai Hähnle <nicolai.haehnle@amd.com>
8 years agoradeonsi: don't enable scratch just for SGPR spills
Marek Olšák [Tue, 7 Jun 2016 22:14:58 +0000 (00:14 +0200)]
radeonsi: don't enable scratch just for SGPR spills

Diff from shader-db:
  Scratch: 3221504 -> 17408 (-99.46 %) bytes per wave

v2: add "break;"

Reviewed-by: Nicolai Hähnle <nicolai.haehnle@amd.com>
8 years agost/mesa: try not to compile compute shader on the first use
Marek Olšák [Tue, 7 Jun 2016 21:03:38 +0000 (23:03 +0200)]
st/mesa: try not to compile compute shader on the first use

Reviewed-by: Ilia Mirkin <imirkin@alum.mit.edu>
8 years agoRevert "radeonsi: allow direct hw MSAA resolve for scanout surfaces"
Marek Olšák [Wed, 8 Jun 2016 16:52:25 +0000 (18:52 +0200)]
Revert "radeonsi: allow direct hw MSAA resolve for scanout surfaces"

This reverts commit ffd54d1936fcd07424265b780e1d049222a01e94.

No, it doesn't work. The test case is "glxgears -samples 2".

8 years agost/mesa: directly compute level=0 texture size in st_finalize_texture
Nicolai Hähnle [Tue, 7 Jun 2016 20:40:49 +0000 (22:40 +0200)]
st/mesa: directly compute level=0 texture size in st_finalize_texture

The width0/height0/depth0 on stObj may not have been set at this point.
Observed in a trace that set up levels 2..9 of a 2d texture, and set the base
level to 2, with height 1. This made the guess logic always bail.

Originally investigated by Ilia Mirkin, this patch gets rid of the somewhat
redundant storage of width0/height0/depth0 and makes sure we always compute
pipe texture sizes that are compatible with the base level image of the
GL texture.

Fixes the gl-1.2-texture-base-level piglit test provided by Brian Paul.

v2:
- try to re-use an existing pipe texture when possible
- handle a corner case where the base level is not level 0 and it is of
  size 1x1x1

v3:
- ptHeight = ptWidth in cube map 1x1 case (suggested by Brian)

Cc: "12.0" <mesa-stable@lists.freedesktop.org>
Reviewed-by: Brian Paul <brianp@vmware.com>
8 years agoglsl: stop allocating memory for SSBOs and builtins
Timothy Arceri [Thu, 2 Jun 2016 05:32:14 +0000 (15:32 +1000)]
glsl: stop allocating memory for SSBOs and builtins

This just stops counting and assigning a storage location for
these uniforms, the count is only used to create the uniform storage.

These uniform types don't use this storage.

Reviewed-by: Dave Airlie <airlied@redhat.com>
8 years agost/mesa: use buffer usage history to set dirty flags for revalidation
Ilia Mirkin [Sat, 4 Jun 2016 17:26:46 +0000 (13:26 -0400)]
st/mesa: use buffer usage history to set dirty flags for revalidation

We were previously unconditionally doing this for arrays and ubo's, and
ignoring texture/storage/atomic buffers. Instead use the usage history
to determine which atoms need to be revalidated.

Signed-off-by: Ilia Mirkin <imirkin@alum.mit.edu>
Reviewed-by: Nicolai Hähnle <nicolai.haehnle@amd.com>
Cc: "12.0" <mesa-stable@lists.freedesktop.org>
8 years agoi965: Integrate precise trig into configuration infrastructure
Gurchetan Singh [Wed, 11 May 2016 20:32:09 +0000 (13:32 -0700)]
i965: Integrate precise trig into configuration infrastructure

With this change, to enable precise SIN and COS instructions
on Intel hardware, one can put

<option name="precise_trig" value="true"/>

in the proper drirc file.

V2: Make option name more generic

Reviewed-by: Kenneth Graunke <kenneth@whitecape.org>
Reviewed-by: Stephane Marchesin <stephane.marchesin@gmail.com>
8 years agoradeonsi: re-enable PBO ReadPixels acceleration
Marek Olšák [Tue, 7 Jun 2016 19:34:31 +0000 (21:34 +0200)]
radeonsi: re-enable PBO ReadPixels acceleration

disabled by 4f1cccf570112f93265a4cace504eb763fa8f73e

Reviewed-by: Nicolai Hähnle <nicolai.haehnle@amd.com>
8 years agoradeonsi: allow MSAA resolving into a texture that has DCC enabled
Marek Olšák [Mon, 6 Jun 2016 00:01:36 +0000 (02:01 +0200)]
radeonsi: allow MSAA resolving into a texture that has DCC enabled

Since DCC is enabled almost everywhere now, it's important not to disable
this fast path.

Reviewed-by: Nicolai Hähnle <nicolai.haehnle@amd.com>
Reviewed-by: Bas Nieuwenhuizen <bas@basnieuwenhuizen.nl>
8 years agogallium/radeon: move DCC clearing into a separate function
Marek Olšák [Sun, 5 Jun 2016 23:54:20 +0000 (01:54 +0200)]
gallium/radeon: move DCC clearing into a separate function

Reviewed-by: Nicolai Hähnle <nicolai.haehnle@amd.com>
Reviewed-by: Bas Nieuwenhuizen <bas@basnieuwenhuizen.nl>
8 years agoradeonsi: allow direct hw MSAA resolve for scanout surfaces
Marek Olšák [Sun, 5 Jun 2016 15:43:43 +0000 (17:43 +0200)]
radeonsi: allow direct hw MSAA resolve for scanout surfaces

No idea why this was disabled, but it works fine.

Reviewed-by: Nicolai Hähnle <nicolai.haehnle@amd.com>
Reviewed-by: Bas Nieuwenhuizen <bas@basnieuwenhuizen.nl>
8 years agoradeonsi: don't allocate DCC for the temporary MSAA resolve surface
Marek Olšák [Sun, 5 Jun 2016 23:42:46 +0000 (01:42 +0200)]
radeonsi: don't allocate DCC for the temporary MSAA resolve surface

Allocating it has no effect, but it adds overhead (useless DCC clear).

Reviewed-by: Nicolai Hähnle <nicolai.haehnle@amd.com>
Reviewed-by: Bas Nieuwenhuizen <bas@basnieuwenhuizen.nl>
8 years agoradeonsi: don't enable DCC in the sampler if first_level doesn't have it
Marek Olšák [Mon, 6 Jun 2016 15:33:42 +0000 (17:33 +0200)]
radeonsi: don't enable DCC in the sampler if first_level doesn't have it

If first_level > 0 and DCC is disabled for that level, let's skip DCC
reads entirely.

Reviewed-by: Nicolai Hähnle <nicolai.haehnle@amd.com>
Reviewed-by: Bas Nieuwenhuizen <bas@basnieuwenhuizen.nl>
8 years agowinsys/amdgpu: enable DCC for mipmapped textures
Marek Olšák [Fri, 3 Jun 2016 18:48:01 +0000 (20:48 +0200)]
winsys/amdgpu: enable DCC for mipmapped textures

Also add dcc_fast_clear_size for clearing only the necessary subset
of DCC. For no AA, it's equal to the size of the whole DCC level.

Reviewed-by: Nicolai Hähnle <nicolai.haehnle@amd.com>
Reviewed-by: Bas Nieuwenhuizen <bas@basnieuwenhuizen.nl>
8 years agogallium/radeon: don't disable DCC because of SDMA
Marek Olšák [Sun, 5 Jun 2016 13:45:30 +0000 (15:45 +0200)]
gallium/radeon: don't disable DCC because of SDMA

We want to keep DCC enabled to save bandwidth. It was a bad idea to disable
it here.

Reviewed-by: Nicolai Hähnle <nicolai.haehnle@amd.com>
Reviewed-by: Bas Nieuwenhuizen <bas@basnieuwenhuizen.nl>
8 years agoradeonsi: don't flag renderbuffer feedback loop if DCC has just been disabled
Marek Olšák [Fri, 3 Jun 2016 18:51:47 +0000 (20:51 +0200)]
radeonsi: don't flag renderbuffer feedback loop if DCC has just been disabled

Reviewed-by: Nicolai Hähnle <nicolai.haehnle@amd.com>
Reviewed-by: Bas Nieuwenhuizen <bas@basnieuwenhuizen.nl>
8 years agoradeonsi: add per-level dcc_enabled flags
Marek Olšák [Fri, 3 Jun 2016 18:40:30 +0000 (20:40 +0200)]
radeonsi: add per-level dcc_enabled flags

Reviewed-by: Nicolai Hähnle <nicolai.haehnle@amd.com>
Reviewed-by: Bas Nieuwenhuizen <bas@basnieuwenhuizen.nl>
8 years agoradeonsi: compute DCC register parameters in si_emit_framebuffer_state
Marek Olšák [Fri, 3 Jun 2016 17:56:38 +0000 (19:56 +0200)]
radeonsi: compute DCC register parameters in si_emit_framebuffer_state

This will get more complicated with mipmapped DCC or when DCC is enabled
after allocation.

Reviewed-by: Nicolai Hähnle <nicolai.haehnle@amd.com>
Reviewed-by: Bas Nieuwenhuizen <bas@basnieuwenhuizen.nl>
8 years agogallium/radeon: add an assertion checking the validity of PIPE_BIND_SCANOUT
Marek Olšák [Mon, 6 Jun 2016 09:28:16 +0000 (11:28 +0200)]
gallium/radeon: add an assertion checking the validity of PIPE_BIND_SCANOUT

Reviewed-by: Nicolai Hähnle <nicolai.haehnle@amd.com>
Reviewed-by: Bas Nieuwenhuizen <bas@basnieuwenhuizen.nl>
8 years agogallium/radeon: don't allocate DCC for non-renderable texture formats
Marek Olšák [Sun, 5 Jun 2016 23:29:14 +0000 (01:29 +0200)]
gallium/radeon: don't allocate DCC for non-renderable texture formats

R9G9B9E5 is the only uncompressed one hopefully.

This fixes incorrect rendering not discovered (due to a lack of tests)
until DCC mipmapping was enabled.

Cc: 11.1 11.2 12.0 <mesa-stable@lists.freedesktop.org>
Reviewed-by: Nicolai Hähnle <nicolai.haehnle@amd.com>
Reviewed-by: Bas Nieuwenhuizen <bas@basnieuwenhuizen.nl>
8 years agoradeonsi: enable WQM in PS prolog when needed
Nicolai Hähnle [Wed, 1 Jun 2016 11:24:19 +0000 (13:24 +0200)]
radeonsi: enable WQM in PS prolog when needed

WQM is needed when the PS prolog computes a VGPR that is consumed by a shader
with (implicit or explicit) derivatives.

Depends on http://reviews.llvm.org/D20839 / LLVM r272063 for this to be
effective (otherwise it's just a no-op).

Bugzilla: https://bugs.freedesktop.org/show_bug.cgi?id=95130
Cc: 12.0 <mesa-dev@lists.freedesktop.org>
Reviewed-by: Marek Olšák <marek.olsak@amd.com>
8 years agotgsi/scan: add uses_derivatives (v2)
Nicolai Hähnle [Wed, 1 Jun 2016 11:17:29 +0000 (13:17 +0200)]
tgsi/scan: add uses_derivatives (v2)

v2:
- TG4 does not calculate derivatives (Ilia)
- also handle SAMPLE* instructions (Roland)

Cc: 12.0 <mesa-stable@lists.freedesktop.org>
Reviewed-by: Marek Olšák <marek.olsak@amd.com> (v1)
Reviewed-by: Brian Paul <brianp@vmware.com> (v1)
Reviewed-by: Ilia Mirkin <imirkin@alum.mit.edu>
Reviewed-by: Roland Scheidegger <sroland@vmware.com>
8 years agodocs/devinfo: Expound on helpful extension tips
Nanley Chery [Fri, 3 Jun 2016 17:59:18 +0000 (10:59 -0700)]
docs/devinfo: Expound on helpful extension tips

Signed-off-by: Nanley Chery <nanley.g.chery@intel.com>
Reviewed-by: Ian Romanick <ian.d.romanick@intel.com>
8 years agodocs/devinfo: Update bullet in stale extension guide
Nanley Chery [Fri, 3 Jun 2016 17:58:05 +0000 (10:58 -0700)]
docs/devinfo: Update bullet in stale extension guide

Signed-off-by: Nanley Chery <nanley.g.chery@intel.com>
Reviewed-by: Ian Romanick <ian.d.romanick@intel.com>
8 years agodocs/devinfo: Add closing paragraph tag
Nanley Chery [Fri, 3 Jun 2016 17:56:46 +0000 (10:56 -0700)]
docs/devinfo: Add closing paragraph tag

Signed-off-by: Nanley Chery <nanley.g.chery@intel.com>
Reviewed-by: Ian Romanick <ian.d.romanick@intel.com>
8 years agoswr: fix provoking vertex
Tim Rowley [Wed, 1 Jun 2016 14:56:26 +0000 (09:56 -0500)]
swr: fix provoking vertex

Use rasterizer provoking vertex API.

Fix rasterizer provoking vertex for tristrips and quad list/strips.

v2: make provoking vertex tables static const

Reviewed-by: Bruce Cherniak <bruce.cherniak@intel.com>
8 years agost/mesa: revalidate image atoms when a texture is updated
Ilia Mirkin [Sat, 4 Jun 2016 17:25:35 +0000 (13:25 -0400)]
st/mesa: revalidate image atoms when a texture is updated

A texture may be redefined with _NEW_TEXTURE, which might have been
bound to a shader image slot. We have to revalidate the image atoms to
pick up on the new resource.

Signed-off-by: Ilia Mirkin <imirkin@alum.mit.edu>
Reviewed-by: Nicolai Hähnle <nicolai.haehnle@amd.com>
Cc: "12.0" <mesa-stable@lists.freedesktop.org>
8 years agogk104/ir: fix conditions for adding a texbar
Ilia Mirkin [Tue, 7 Jun 2016 01:25:05 +0000 (21:25 -0400)]
gk104/ir: fix conditions for adding a texbar

Sometimes a register source can actually be double- or even quad-wide.
We must make sure that the inserted texbars take that width into
account.

Based on an earlier patch by Samuel Pitoiset.

Signed-off-by: Ilia Mirkin <imirkin@alum.mit.edu>
Reviewed-by: Samuel Pitoiset <samuel.pitoiset@gmail.com>
Cc: "12.0 11.2" <mesa-stable@lists.freedesktop.org>
8 years agoradeonsi: keep track of dirty descriptor sets
Nicolai Hähnle [Fri, 3 Jun 2016 15:40:12 +0000 (17:40 +0200)]
radeonsi: keep track of dirty descriptor sets

Reduces CPU load for draw calls that change none or few of the descriptors.

Reviewed-by: Bas Nieuwenhuizen <bas@basnieuwenhuizen.nl>
Reviewed-by: Marek Olšák <marek.olsak@amd.com>
8 years agoradeonsi: move si_descriptors into a per-context array
Nicolai Hähnle [Fri, 3 Jun 2016 13:56:39 +0000 (15:56 +0200)]
radeonsi: move si_descriptors into a per-context array

Reviewed-by: Bas Nieuwenhuizen <bas@basnieuwenhuizen.nl>
Reviewed-by: Marek Olšák <marek.olsak@amd.com>
8 years agoradeonsi: pass shader stage to si_disable_shader_image
Nicolai Hähnle [Fri, 3 Jun 2016 13:36:45 +0000 (15:36 +0200)]
radeonsi: pass shader stage to si_disable_shader_image

Reviewed-by: Bas Nieuwenhuizen <bas@basnieuwenhuizen.nl>
Reviewed-by: Marek Olšák <marek.olsak@amd.com>
8 years agoradeonsi: access descriptor sets via local variables
Nicolai Hähnle [Fri, 3 Jun 2016 13:14:39 +0000 (15:14 +0200)]
radeonsi: access descriptor sets via local variables

This will simplify moving them to a per-context array.

Reviewed-by: Bas Nieuwenhuizen <bas@basnieuwenhuizen.nl>
Reviewed-by: Marek Olšák <marek.olsak@amd.com>
8 years agoradeonsi: add si_set_rw_buffer to be used for internal descriptors
Nicolai Hähnle [Fri, 3 Jun 2016 13:27:09 +0000 (15:27 +0200)]
radeonsi: add si_set_rw_buffer to be used for internal descriptors

So that callers outside of si_descriptors.c need to worry less about the
details of descriptor handling.

Reviewed-by: Bas Nieuwenhuizen <bas@basnieuwenhuizen.nl>
Reviewed-by: Marek Olšák <marek.olsak@amd.com>
8 years agoradeonsi: pass shader stage to si_set_shader_image
Nicolai Hähnle [Fri, 3 Jun 2016 13:04:40 +0000 (15:04 +0200)]
radeonsi: pass shader stage to si_set_shader_image

Reviewed-by: Bas Nieuwenhuizen <bas@basnieuwenhuizen.nl>
Reviewed-by: Marek Olšák <marek.olsak@amd.com>
8 years agoradeonsi: pass shader stage to si_set_sampler_view
Nicolai Hähnle [Fri, 3 Jun 2016 13:03:59 +0000 (15:03 +0200)]
radeonsi: pass shader stage to si_set_sampler_view

Reviewed-by: Bas Nieuwenhuizen <bas@basnieuwenhuizen.nl>
Reviewed-by: Marek Olšák <marek.olsak@amd.com>
8 years agoradeonsi: move descriptor set begin_new_cs handling into a separate function
Nicolai Hähnle [Fri, 3 Jun 2016 12:50:42 +0000 (14:50 +0200)]
radeonsi: move descriptor set begin_new_cs handling into a separate function

Reviewed-by: Bas Nieuwenhuizen <bas@basnieuwenhuizen.nl>
Reviewed-by: Marek Olšák <marek.olsak@amd.com>
8 years agoradeonsi: move enabled_mask out of si_descriptors
Nicolai Hähnle [Fri, 3 Jun 2016 12:47:10 +0000 (14:47 +0200)]
radeonsi: move enabled_mask out of si_descriptors

This mask is irrelevant for the generic descriptor set handling, and having it
outside simplifies subsequent changes slightly.

Reviewed-by: Bas Nieuwenhuizen <bas@basnieuwenhuizen.nl>
Reviewed-by: Marek Olšák <marek.olsak@amd.com>
8 years agoanv/entrypoints: Stop using the C preprocessor
Jason Ekstrand [Mon, 6 Jun 2016 21:29:19 +0000 (14:29 -0700)]
anv/entrypoints: Stop using the C preprocessor

Now that we emit guards for everything, we can just generate the files and
trust build flags to keep us safe.  This should also fix the tarball
problems.

Reviewed-by: Emil Velikov <emil.velikov@collabora.com>
8 years agoanv/entrypoints: Emit #if guards for all platforms
Jason Ekstrand [Mon, 6 Jun 2016 21:29:18 +0000 (14:29 -0700)]
anv/entrypoints: Emit #if guards for all platforms

Reviewed-by: Emil Velikov <emil.velikov@collabora.com>
8 years agoplatform_android: prevent deadlock in droid_swap_buffers
Haixia Shi [Thu, 2 Jun 2016 19:48:23 +0000 (12:48 -0700)]
platform_android: prevent deadlock in droid_swap_buffers

To avoid blocking other EGL calls, release the display mutex before
we enqueue buffer to android frameworks and re-acquire the mutex
upon return.

v2: moved lock/unlock inside droid_window_enqueue_buffer().

TEST=verify pinch zoom in Photos app no longer causes hangs

Signed-off-by: Haixia Shi <hshi@chromium.org>
Reviewed-by: Emil Velikov <emil.velikov@collabora.com>
8 years agomesa: automake: distclean git_sha1.h when building OOT
Emil Velikov [Mon, 6 Jun 2016 18:39:40 +0000 (19:39 +0100)]
mesa: automake: distclean git_sha1.h when building OOT

In the case of out-of-tree (OOT) builds, in particular when building
from tarball, we'll end up with the file in both srcdir and builddir.

We want the former to remain intact (since we need it on rebuild) while
the latter should be removed otherwise `make distclean' gets angry at
us.

Ideally there'll be a solution that feels a bit less of a hack. Until
then this does the job exactly as expected.

Cc: <mesa-stable@lists.freedesktop.org>
Signed-off-by: Emil Velikov <emil.velikov@collabora.com>
8 years agomesa: automake: ensure that git_sha1.h.tmp has the right attributes
Emil Velikov [Mon, 6 Jun 2016 16:31:05 +0000 (17:31 +0100)]
mesa: automake: ensure that git_sha1.h.tmp has the right attributes

... when copied from git_sha1.h.

As the latter file can we lacking the write attribute, one should set it
explicitly. Otherwise we'll get a warning/failure at cleanup stage.

Cc: <mesa-stable@lists.freedesktop.org>
Signed-off-by: Emil Velikov <emil.velikov@collabora.com>
8 years agomesa: automake: add directory prefix for git_sha1.h
Emil Velikov [Mon, 6 Jun 2016 15:50:14 +0000 (16:50 +0100)]
mesa: automake: add directory prefix for git_sha1.h

Otherwise the build will assume that we've talking about builddir, which
is not the case in the else statement.

Here the file is already generated and is part of the tarball.

Cc: <mesa-stable@lists.freedesktop.org>
Signed-off-by: Emil Velikov <emil.velikov@collabora.com>
8 years agoegl: android: don't add the image loader extension for !render_node
Emil Velikov [Sat, 4 Jun 2016 00:09:14 +0000 (01:09 +0100)]
egl: android: don't add the image loader extension for !render_node

With earlier commit we introduced support for render_node devices, which
was couples with the use of the image loader extension.

As the work was inspired by egl/wayland we (erroneously) added the
extension for the !render_node path as well.

That works for wayland, as the implementations of the DRI2 and IMAGE
loader extensions converge behind the scenes. As that is not yet
the case for Android we shouldn't expose the extension.

Fixes: 34ddef39cef ("egl: android: add dma-buf fd support")
Cc: <mesa-stable@lists.freedesktop.org>
Reported-by: Mauro Rossi <issor.oruam@gmail.com>
Tested-by: Mauro Rossi <issor.oruam@gmail.com>
Acked-by: Rob Herring <robh@kernel.org>
Signed-off-by: Emil Velikov <emil.l.velikov@gmail.com>
8 years agogallium/radeon: add support for sharing textures with DCC between processes
Marek Olšák [Thu, 2 Jun 2016 21:36:43 +0000 (23:36 +0200)]
gallium/radeon: add support for sharing textures with DCC between processes

v2: use a function for calculating WORD1 of bo metadata

Reviewed-by: Nicolai Hähnle <nicolai.haehnle@amd.com>
8 years agogallium/radeon: don't discard DCC if an external user can write to it
Marek Olšák [Thu, 2 Jun 2016 21:30:01 +0000 (23:30 +0200)]
gallium/radeon: don't discard DCC if an external user can write to it

We don't import textures with DCC now, but soon we will.

v2: if we can't disable DCC for image writes, at least decompress DCC
    at bind time

Reviewed-by: Nicolai Hähnle <nicolai.haehnle@amd.com>
8 years agoi915: fix typo CAP.
Dave Airlie [Tue, 7 Jun 2016 08:30:54 +0000 (18:30 +1000)]
i915: fix typo CAP.

Signed-off-by: Dave Airlie <airlied@redhat.com>
8 years agoglsl: initialise pointer to NULL
Jakob Sinclair [Fri, 3 Jun 2016 23:09:52 +0000 (01:09 +0200)]
glsl: initialise pointer to NULL

Could cause issues if you tried to read from an uninitialised pointer.
This just initalises the pointer to null to avoid that being a problem.
Discovered by Coverity.

CID: 1343616

Signed-off-by: Jakob Sinclair <sinclair.jakob@openmailbox.org>
Reviewed-by: Iago Toral Quiroga <itoral@igalia.com>
8 years agoi965/gen8: fix cull distance emission for tessellation shaders.
Dave Airlie [Tue, 7 Jun 2016 00:27:44 +0000 (10:27 +1000)]
i965/gen8: fix cull distance emission for tessellation shaders.

This fixes some cases of:
GL45-CTS.cull_distance.functional
on Skylake.

Reviewed-by: Chris Forbes <chrisforbes@google.com>
Cc: "12.0" <mesa-stable@lists.freedesktop.org>
Signed-off-by: Dave Airlie <airlied@redhat.com>
8 years agonvc0: add support for VOTE tgsi opcodes
Ilia Mirkin [Sun, 29 May 2016 16:42:49 +0000 (12:42 -0400)]
nvc0: add support for VOTE tgsi opcodes

Signed-off-by: Ilia Mirkin <imirkin@alum.mit.edu>
Reviewed-by: Samuel Pitoiset <samuel.pitoiset@gmail.com>
8 years agost/mesa: expose GL_ARB_shader_group_vote when supported by backend
Ilia Mirkin [Sun, 29 May 2016 15:43:05 +0000 (11:43 -0400)]
st/mesa: expose GL_ARB_shader_group_vote when supported by backend

Signed-off-by: Ilia Mirkin <imirkin@alum.mit.edu>
Reviewed-by: Dave Airlie <airlied@redhat.com>
8 years agogallium: add PIPE_CAP_TGSI_VOTE for when the VOTE ops are allowed
Ilia Mirkin [Sun, 29 May 2016 15:39:52 +0000 (11:39 -0400)]
gallium: add PIPE_CAP_TGSI_VOTE for when the VOTE ops are allowed

Signed-off-by: Ilia Mirkin <imirkin@alum.mit.edu>
Reviewed-by: Dave Airlie <airlied@redhat.com>
8 years agogallium: add VOTE_* opcodes to implement GL_ARB_shader_group_vote
Ilia Mirkin [Sun, 29 May 2016 15:01:05 +0000 (11:01 -0400)]
gallium: add VOTE_* opcodes to implement GL_ARB_shader_group_vote

Signed-off-by: Ilia Mirkin <imirkin@alum.mit.edu>
Reviewed-by: Dave Airlie <airlied@redhat.com>
8 years agomesa: hook up core bits of GL_ARB_shader_group_vote
Ilia Mirkin [Sun, 29 May 2016 14:49:03 +0000 (10:49 -0400)]
mesa: hook up core bits of GL_ARB_shader_group_vote

Signed-off-by: Ilia Mirkin <imirkin@alum.mit.edu>
Reviewed-by: Ian Romanick <ian.d.romanick@intel.com>
Reviewed-by: Dave Airlie <airlied@redhat.com>
8 years agoglsl: Make opt_copy_propagation_elements actually propagate into loops.
Kenneth Graunke [Sat, 30 Apr 2016 05:06:37 +0000 (22:06 -0700)]
glsl: Make opt_copy_propagation_elements actually propagate into loops.

We've had a FINISHME here since Eric originally wrote the code in 2011.
This patch implements his suggested approach, which makes us actually
able to copy propagate into the loops, at the unfortunate cost of making
this pass even more expensive.

The shader-db statistics are basically a wash:

   No change in instruction counts.

   total cycles in shared programs: 78685980 -> 78680730 (-0.01%)
   cycles in affected programs: 2102646 -> 2097396 (-0.25%)
   helped: 48
   HURT: 83

I figured if we're going to do this for one copy propagation pass,
we may as well do it in both.

Signed-off-by: Kenneth Graunke <kenneth@whitecape.org>
Reviewed-by: Matt Turner <mattst88@gmail.com>
8 years agoglsl: Make opt_copy_propagation actually propagate into loops.
Kenneth Graunke [Sat, 30 Apr 2016 05:06:37 +0000 (22:06 -0700)]
glsl: Make opt_copy_propagation actually propagate into loops.

We've had a FINISHME here since Eric originally wrote the code in 2010.
This patch implements his suggested approach, which makes us actually
able to copy propagate into the loops, at the unfortunate cost of making
this pass even more expensive.

The shader-db statistics are not terribly impressive:

   total instructions in shared programs: 9008589 -> 9008613 (0.00%)
   instructions in affected programs: 4293 -> 4317 (0.56%)
   helped: 0
   HURT: 10

   total cycles in shared programs: 78550978 -> 78575760 (0.03%)
   cycles in affected programs: 655426 -> 680208 (3.78%)
   helped: 75
   HURT: 88

   GAINED: 2

Most of the "regressions" appear to be us successfully copy propagating
uniforms, which i965 is loading as pull constants instead of push, so we
occasionally have two pulls instead of one.  That doesn't seem like this
pass's job - it's propagating correctly, and we should be smarter about
pull loads in the backend.

This patch is also useful for a couple of reasons:

1. It can clean up copies created by varying packing (previously, we
   couldn't if the uses were inside a loop).

   This fixes a bug when interpolateAt*() is used on a packed varying
   inside a loop: glsl_to_nir struggles to see through the extra copy
   and mistakenly believed the variable was not an input.

2. It will help propagate uniform array access created by
   lower_const_array_to_uniforms().

Signed-off-by: Kenneth Graunke <kenneth@whitecape.org>
Reviewed-by: Matt Turner <mattst88@gmail.com>
8 years agonv50/ir: use round toward 0 when converting doubles to integers
Samuel Pitoiset [Mon, 6 Jun 2016 19:12:15 +0000 (21:12 +0200)]
nv50/ir: use round toward 0 when converting doubles to integers

Like floats, we should use the round toward 0 mode instead of the
nearest one (which is the default) for doubles to integers.

This fixes all arb_gpu_shader_fp64 piglits which convert doubles to
integers (16 tests).

Signed-off-by: Samuel Pitoiset <samuel.pitoiset@gmail.com>
Reviewed-by: Ilia Mirkin <imirkin@alum.mit.edu>
Cc: "11.2 12.0" <mesa-stable@lists.freedesktop.org>
8 years agogallium/radeon: don't re-set BO metadata after CMASK deallocation
Marek Olšák [Thu, 2 Jun 2016 21:24:20 +0000 (23:24 +0200)]
gallium/radeon: don't re-set BO metadata after CMASK deallocation

CMASK has no effect on metadata, because it's not sharable.

Reviewed-by: Nicolai Hähnle <nicolai.haehnle@amd.com>
8 years agost/mesa: change SQRT lowering to fix the game Risen
Marek Olšák [Mon, 30 May 2016 15:43:26 +0000 (17:43 +0200)]
st/mesa: change SQRT lowering to fix the game Risen

Bugzilla: https://bugs.freedesktop.org/show_bug.cgi?id=94627
(against nouveau)

Acked-by: Ilia Mirkin <imirkin@alum.mit.edu>
8 years agoradeonsi: add a performance tweak for 4 SE parts
Marek Olšák [Fri, 3 Jun 2016 14:20:17 +0000 (16:20 +0200)]
radeonsi: add a performance tweak for 4 SE parts

Ported from Vulkan.

Reviewed-by: Nicolai Hähnle <nicolai.haehnle@amd.com>
8 years agoradeonsi: simplify PRIMGROUP_SIZE computation for tessellation
Marek Olšák [Fri, 3 Jun 2016 14:44:00 +0000 (16:44 +0200)]
radeonsi: simplify PRIMGROUP_SIZE computation for tessellation

Ported from Vulkan.

v2: keep the comment

Reviewed-by: Nicolai Hähnle <nicolai.haehnle@amd.com>
8 years agor600g: use hw MSAA resolve for non-trivial resolves
Marek Olšák [Sun, 5 Jun 2016 14:42:26 +0000 (16:42 +0200)]
r600g: use hw MSAA resolve for non-trivial resolves

This improves MSAA resolve performance.

Reviewed-by: Nicolai Hähnle <nicolai.haehnle@amd.com>
8 years agoradeonsi: use hw MSAA resolve for non-trivial resolves
Marek Olšák [Sun, 5 Jun 2016 14:42:26 +0000 (16:42 +0200)]
radeonsi: use hw MSAA resolve for non-trivial resolves

This improves MSAA resolve performance.

Reviewed-by: Nicolai Hähnle <nicolai.haehnle@amd.com>
8 years agomesa/program_resource: return -1 for index if no location.
Dave Airlie [Mon, 23 May 2016 20:41:21 +0000 (06:41 +1000)]
mesa/program_resource: return -1 for index if no location.

The GL4.5 spec quote seems clear on this:
"The value -1 will be returned by either command if an error occurs,
if name does not identify an active variable on programInterface,
or if name identifies an active variable that does not have a valid
location assigned, as described above."

This fixes:
GL45-CTS.program_interface_query.output-built-in

[airlied: use _mesa_program_resource_location_index as
suggested by Eduardo]
Reviewed-by: Eduardo Lima Mitev <elima@igalia.com>
Cc: "12.0" <mesa-stable@lists.freedesktop.org>
Signed-off-by: Dave Airlie <airlied@redhat.com>
8 years agoradeonsi: set descriptor dirty mask on shader buffer unbind
Nicolai Hähnle [Fri, 3 Jun 2016 13:17:25 +0000 (15:17 +0200)]
radeonsi: set descriptor dirty mask on shader buffer unbind

Found randomly while skimming the code. This might have caused VM faults in
robustness tests.

Cc: 12.0 <mesa-stable@lists.freedesktop.org>
Reviewed-by: Marek Olšák <marek.olsak@amd.com>
8 years agost/mesa: fix resource leak in try_pbo_readpixels
Nicolai Hähnle [Thu, 2 Jun 2016 20:48:52 +0000 (22:48 +0200)]
st/mesa: fix resource leak in try_pbo_readpixels

Found by inspection after seeing
https://bugs.freedesktop.org/show_bug.cgi?id=96343

Reviewed-by: Marek Olšák <marek.olsak@amd.com>
8 years agotgsi: fix mixed data type comparison in tgsi_point_sprite.c
Charmaine Lee [Fri, 3 Jun 2016 21:26:23 +0000 (14:26 -0700)]
tgsi: fix mixed data type comparison in tgsi_point_sprite.c

Cast the unsigned semantic index to integer datatype before comparing
to max_generic, otherwise, max_generic which is initialized to -1
will be converted to unsigned int before the comparison, causing a wrong
semantic index to be assigned to a shader output.

Fixes the assert running TurboCAD_gl.trace. (VMware bug 1667265)

Also tested with glretrace, mesa demos pointblast, spriteblast and pointcoord.

v2: use the original max_generic variable but add the (int) cast
    to the semantic index, as suggested by Brian.

Reviewed-by: Brian Paul <brianp@vmware.com>
8 years agosvga: print shader linkage info when tgsi debug bit is on
Charmaine Lee [Fri, 3 Jun 2016 21:24:19 +0000 (14:24 -0700)]
svga: print shader linkage info when tgsi debug bit is on

When TGSI debug flag is enabled, print the shader linkage info as well.

Tested with mesa demos with SVGA_DEBUG=tgsi

Reviewed-by: Brian Paul <brianp@vmware.com>
8 years agost/mesa: check shader image format support before using PBO download
Ilia Mirkin [Sun, 5 Jun 2016 22:56:12 +0000 (18:56 -0400)]
st/mesa: check shader image format support before using PBO download

ARB_shader_image_load_store only requires a very fixed list of formats
to be supported, while textures may be in all kinds of formats, like
BGRA which are presently not supported on at least Kepler.

Signed-off-by: Ilia Mirkin <imirkin@alum.mit.edu>
Tested-by: Samuel Pitoiset <samuel.pitoiset@gmail.com>
Reviewed-by: Nicolai Hähnle <nicolai.haehnle@amd.com>
Reviewed-by: Marek Olšák <marek.olsak@amd.com>
8 years agotgsi: use truncf in micro_trunc
Lars Hamre [Thu, 26 May 2016 22:30:24 +0000 (18:30 -0400)]
tgsi: use truncf in micro_trunc

Switches to using truncf in micro_trunc.

Fixes the following piglit tests (for softpipe):

/spec/glsl-1.30/execution/built-in-functions/...
fs-trunc-float
fs-trunc-vec2
fs-trunc-vec3
fs-trunc-vec4
vs-trunc-float
vs-trunc-vec2
vs-trunc-vec3
vs-trunc-vec4

/spec/glsl-1.50/execution/built-in-functions/...
gs-trunc-float
gs-trunc-vec2
gs-trunc-vec3
gs-trunc-vec4

Signed-off-by: Lars Hamre <chemecse@gmail.com>
Reviewed-by: Roland Scheidegger <sroland@vmware.com>
8 years agoi965/gs/scalar: Fix load input for doubles
Samuel Iglesias Gonsálvez [Fri, 27 May 2016 09:59:48 +0000 (11:59 +0200)]
i965/gs/scalar: Fix load input for doubles

Signed-off-by: Samuel Iglesias Gonsálvez <siglesias@igalia.com>
Reviewed-by: Timothy Arceri <timothy.arceri@collabora.com>
Cc: "12.0" <mesa-stable@lists.freedesktop.org>
8 years agoi965/fs: fix offset when loading double vector input varyings
Samuel Iglesias Gonsálvez [Thu, 26 May 2016 05:56:37 +0000 (07:56 +0200)]
i965/fs: fix offset when loading double vector input varyings

When we are not packing a double input varying, we might need to
read its data in a non-aligned to 64-bit offset, so we read
the wrong data. This is happening when using explicit locations
in varyings because Mesa disables packing varying for that case.

const_index is in 32-bit size units but offset() is multiplying
it by destination type size units. When operating with double
input varyings, const_index value could be not aligned to 64 bits.
To fix it, we load the double vector as if it was a float based vector
with twice the number of components.

Signed-off-by: Samuel Iglesias Gonsálvez <siglesias@igalia.com>
Reviewed-by: Timothy Arceri <timothy.arceri@collabora.com>
Cc: "12.0" <mesa-stable@lists.freedesktop.org>
8 years agoi965/fs: fix FS_OPCODE_CINTERP for unpacked double input varyings
Samuel Iglesias Gonsálvez [Thu, 26 May 2016 05:56:38 +0000 (07:56 +0200)]
i965/fs: fix FS_OPCODE_CINTERP for unpacked double input varyings

Data starts at suboffet 3 in 32-bit units (12 bytes), so it is not
64-bit aligned and the current implementation fails to read the data
properly. Instead, when there is is a double input varying, read it as
vector of floats with twice the number of components.

Signed-off-by: Samuel Iglesias Gonsálvez <siglesias@igalia.com>
Reviewed-by: Timothy Arceri <timothy.arceri@collabora.com>
Cc: "12.0" <mesa-stable@lists.freedesktop.org>
8 years agoglsl: geom shader max_vertices layout must match.
Dave Airlie [Fri, 3 Jun 2016 00:45:07 +0000 (10:45 +1000)]
glsl: geom shader max_vertices layout must match.

From GLSL 4.5 spec, "4.4.2.3 Geometry Outputs".
"all geometry shader output vertex count declarations in a
program must declare the same count."

Fixes:
GL45-CTS.geometry_shader.output.conflicted_output_vertices_max

Reviewed-by: Alejandro Piñeiro <apinheiro@igalia.com>
Cc: "11.2 12.0" <mesa-stable@lists.freedesktop.org>
Signed-off-by: Dave Airlie <airlied@redhat.com>
8 years agoanv/pipeline: Add support for caching the push constant map
Jason Ekstrand [Sat, 4 Jun 2016 22:10:22 +0000 (15:10 -0700)]
anv/pipeline: Add support for caching the push constant map

Signed-off-by: Jason Ekstrand <jason@jlekstrand.net>
Reviewed-by: Kristian Høgsberg <krh@bitplanet.net>
8 years agoglsl: use enum glsl_interface_packing in more places. (v2)
Dave Airlie [Wed, 11 May 2016 00:49:19 +0000 (10:49 +1000)]
glsl: use enum glsl_interface_packing in more places. (v2)

Although the glsl_types.h stores this in a bitfield,
we should hide that from everyone else. Hide the cast
in an accessor method and use the enum everywhere.

This makes things a bit nicer in gdb, and improves type
safety.

v2: fix a few pieces of interface I missed that caused some
piglit regressions.

Signed-off-by: Dave Airlie <airlied@redhat.com>
Reviewed-by: Ilia Mirkin <imirkin@alum.mit.edu>
8 years agoi965: don't use NumLayers for 3D textures.
Dave Airlie [Fri, 3 Jun 2016 01:36:38 +0000 (11:36 +1000)]
i965: don't use NumLayers for 3D textures.

For 3D textures we shouldn't be using NumLayers, we need
to get it from the depth.

This fixes:
GL45-CTS.geometry_shader.layered_framebuffer.clear_call_support

Reviewed-by: Eduardo Lima Mitev <elima@igalia.com>
Cc: "12.0" <mesa-stable@lists.freedesktop.org>
Signed-off-by: Dave Airlie <airlied@redhat.com>
8 years agoglsl: for anonymous struct matching use without_array() (v3)
Dave Airlie [Mon, 6 Jun 2016 00:33:51 +0000 (10:33 +1000)]
glsl: for anonymous struct matching use without_array() (v3)

With tessellation shaders we can have cases where we have
arrays of anon structs, so make sure we match using without_array().

Fixes:
GL45-CTS.tessellation_shader.tessellation_control_to_tessellation_evaluation.gl_in

v2:
test lengths match as well (Ilia)
v3:
descend array lengths to check for matches as well (Ilia)

Reviewed-by: Ilia Mirkin <imirkin@alum.mit.edu>
Cc: "12.0" <mesa-stable@lists.freedesktop.org>
Signed-off-by: Dave Airlie <airlied@redhat.com>
8 years agoglsl/ast: don't crash when func_name is NULL
Dave Airlie [Tue, 3 May 2016 04:39:06 +0000 (14:39 +1000)]
glsl/ast: don't crash when func_name is NULL

This fixes a crash in
GL43-CTS.shader_subroutine.subroutines_not_allowed_as_variables_constructors_and_argument_or_return_types

If we can't find the func_name in one of these paths,
we have emitted an earlier error so just return here.

Reviewed-by: Timothy Arceri <timothy.arceri@collabora.com>
Cc: "11.2 12.0" <mesa-stable@lists.freedesktop.org>
Signed-off-by: Dave Airlie <airlied@redhat.com>
8 years agoglsl: handle ast_aggregate in has_sequence_subexpression. (v2)
Dave Airlie [Tue, 3 May 2016 07:16:27 +0000 (17:16 +1000)]
glsl: handle ast_aggregate in has_sequence_subexpression. (v2)

GL43-CTS.compute_shader.work-group-size does
uniform uint g_uniform[gl_WorkGroupSize.z + 20] = { 1,2,3,4,5,6,7,8,9,10,11,12,13,14,15,16,17,18,19,20,21,22,23,24 };

The initializer triggers the GLSL 4.30/GLES3 tests
for constant sequence subexpressions, so it doesn't
happen unless you are using those, so just return
false as this path is now reachable.

v2: update commit msg with diagnosis
Acked-by: Timothy Arceri <timothy.arceri@collabora.com>
Cc: "11.2 12.0" <mesa-stable@lists.freedesktop.org>
Signed-off-by: Dave Airlie <airlied@redhat.com>
8 years agomesa: Try to unbreak the MSVC build.
Kenneth Graunke [Sun, 5 Jun 2016 23:31:11 +0000 (16:31 -0700)]
mesa: Try to unbreak the MSVC build.

PATH_MAX is apparently not a thing on Windows.  Borrow the hack from
pipe_loader.c to try and make this work.

Signed-off-by: Kenneth Graunke <kenneth@whitecape.org>
8 years agomesa: Add MESA_SHADER_CAPTURE_PATH for writing .shader_test files.
Kenneth Graunke [Sun, 7 Sep 2014 03:26:51 +0000 (20:26 -0700)]
mesa: Add MESA_SHADER_CAPTURE_PATH for writing .shader_test files.

This writes linked shader programs to .shader_test files to
$MESA_SHADER_CAPTURE_PATH in the format used by shader-db
(http://cgit.freedesktop.org/mesa/shader-db).

It supports both GLSL shaders and ARB programs.  All stages that
are linked together are written in a single .shader_test file.

This eliminates the need for shader-db's split-to-files.py, as Mesa
produces the desired format directly.  It's much more reliable than
parsing stdout/stderr, as those may contain extraneous messages, or
simply be closed by the application and unavailable.

We have many similar features already, but this is a bit different:
- MESA_GLSL=dump writes to stdout, not files.
- MESA_GLSL=log writes each stage to separate files (rather than
  all linked shaders in one file), at draw time (not link time),
  with uniform data and state flag info.
- Tapani's shader replacement mechanism (MESA_SHADER_DUMP_PATH and
  MESA_SHADER_READ_PATH) also uses separate files per shader stage,
  but allows reading in files to replace an app's shader code.

v2:  Dump ARB programs too, not just GLSL.
v3:  Don't dump bogus 0.shader_test file.
v4:  Add "GL_ARB_separate_shader_objects" to the [require] block.
v5:  Print "GLSL 4.00" instead of "GLSL 4.0" in the [require] block.
v6:  Don't hardcode /tmp/mesa.
v7:  Fix memoization of getenv().
v8:  Also print "SSO ENABLED" (suggested by Timothy).
v9:  Also handle ES shaders (suggested by Ilia).
v10: Guard against MESA_SHADER_CAPTURE_PATH being too long; add
     _mesa_warning calls on error handling (suggested by Ben).
v11: Fix crash when variable is unset introduced in v10.

Signed-off-by: Kenneth Graunke <kenneth@whitecape.org>
Reviewed-by: Matt Turner <mattst88@gmail.com>
8 years agonv50,nvc0: fix BGR10_A2UI vertex format
Ilia Mirkin [Sun, 5 Jun 2016 19:00:36 +0000 (15:00 -0400)]
nv50,nvc0: fix BGR10_A2UI vertex format

This is mostly academic as this is not reachable from GL, which only has
the packed RGB10_A2UI vertex format.

Signed-off-by: Ilia Mirkin <imirkin@alum.mit.edu>
Cc: "12.0" <mesa-stable@lists.freedesktop.org>