platform/upstream/mesa.git
8 years agogallium/radeon: small cleanups in r600_texture_transfer_map
Marek Olšák [Thu, 12 May 2016 11:26:24 +0000 (13:26 +0200)]
gallium/radeon: small cleanups in r600_texture_transfer_map

Reviewed-by: Nicolai Hähnle <nicolai.haehnle@amd.com>
8 years agogallium/radeon: don't set PB_USAGE in winsyses
Marek Olšák [Thu, 12 May 2016 11:13:42 +0000 (13:13 +0200)]
gallium/radeon: don't set PB_USAGE in winsyses

There is no point.

Reviewed-by: Nicolai Hähnle <nicolai.haehnle@amd.com>
8 years agogallium/radeon: handle VRAM_GTT placements as having slow CPU reads
Marek Olšák [Thu, 12 May 2016 11:05:19 +0000 (13:05 +0200)]
gallium/radeon: handle VRAM_GTT placements as having slow CPU reads

not sure if we should include GTT WC too

Reviewed-by: Nicolai Hähnle <nicolai.haehnle@amd.com>
8 years agogallium/radeon: ignore PIPE_TRANSFER_MAP_DIRECTLY
Marek Olšák [Thu, 12 May 2016 10:55:41 +0000 (12:55 +0200)]
gallium/radeon: ignore PIPE_TRANSFER_MAP_DIRECTLY

Only st/xa is using this, which is irrelevant to us.

Reviewed-by: Nicolai Hähnle <nicolai.haehnle@amd.com>
8 years agoradeonsi: add a workaround for a bug in LLVM <= 3.8
Marek Olšák [Tue, 17 May 2016 21:10:24 +0000 (23:10 +0200)]
radeonsi: add a workaround for a bug in LLVM <= 3.8

This is not directly applicable to stable and needs to be backported.

Reviewed-by: Nicolai Hähnle <nicolai.haehnle@amd.com>
8 years agoi965/fs: Silence warnings related to use of uninitialized values
Eduardo Lima Mitev [Tue, 17 May 2016 10:21:02 +0000 (12:21 +0200)]
i965/fs: Silence warnings related to use of uninitialized values

brw_fs.cpp: In function ‘const unsigned int* brw_compile_fs(const [...]
brw_fs.cpp:6093:64: warning: ‘simd16_grf_start’ may be used uninitialized [...]
       prog_data->base.dispatch_grf_start_reg = simd16_grf_start;

brw_fs.cpp:5996:29: note: ‘simd16_grf_start’ was declared here
    uint8_t simd8_grf_start, simd16_grf_start;

brw_fs.cpp:6094:52: warning: ‘simd16_grf_used’ may be used uninitialized [...]
       prog_data->reg_blocks_0 = brw_register_blocks(simd16_grf_used);

brw_fs.cpp:5997:29: note: ‘simd16_grf_used’ was declared here
    unsigned simd8_grf_used, simd16_grf_used;

(and more)

Reviewed-by: Anuj Phogat <anuj.phogat@gmail.com>
8 years agovc4: Size transfer temporary mappings appropriately for full maps of 3D.
Eric Anholt [Wed, 18 May 2016 19:29:02 +0000 (12:29 -0700)]
vc4: Size transfer temporary mappings appropriately for full maps of 3D.

We don't really support reading/writing of 3D textures since the hardware
doesn't do 3D, but we do need to make sure that a pipe_transfer for them
has enough space to store the image.  This was previously not a problem
because the state tracker only mapped a slice at a time until
fb9fe352ea41c7e3633ba2c483c59b73c529845b.  Fixes glean glsl1 tests, which
all have setup of a 3D texture at the start.

8 years agoanv/device: Fix viewportBoundsRange
Nanley Chery [Tue, 17 May 2016 22:28:01 +0000 (15:28 -0700)]
anv/device: Fix viewportBoundsRange

Align with the spec requirement that the range must be at least
[−2 × maxViewportDimensions, 2 × maxViewportDimensions − 1]. Our
hardware supports this.

Fixes dEQP-VK.api.info.device.properties

Bugzilla: https://bugs.freedesktop.org/show_bug.cgi?id=94896
Signed-off-by: Nanley Chery <nanley.g.chery@intel.com>
Reviewed-by: Anuj Phogat <anuj.phogat@gmail.com>
8 years agoglsl/linker: attempt to match anonymous structures at link
Dave Airlie [Tue, 17 May 2016 00:31:29 +0000 (10:31 +1000)]
glsl/linker: attempt to match anonymous structures at link

This is my attempt at fixing at least one of the UE4 bugs with GL4.3.

If we are doing intrastage matching and hit anonymous structs, then
we should do a record comparison instead of using the names.

Bugzilla: https://bugs.freedesktop.org/show_bug.cgi?id=95005
Reviewed-by: Ian Romanick <ian.d.romanick@intel.com>
Signed-off-by: Dave Airlie <airlied@redhat.com>
8 years agoanv/batch_chain: free pointers for error cases
Mark Janes [Wed, 18 May 2016 21:28:38 +0000 (14:28 -0700)]
anv/batch_chain: free pointers for error cases

Trivial fix to improperly handled cleanup during
VK_ERROR_OUT_OF_HOST_MEMORY.

Identified by Coverity: CID 1358908 and 1358909
Reviewed-by: Jason Ekstrand <jason@jlekstrand.net>
8 years agost/nine: Minor change to support musl libc
Wang He [Tue, 10 May 2016 05:40:30 +0000 (13:40 +0800)]
st/nine: Minor change to support musl libc

A few changes to support musl libc as well.

In particular fpu_control.h is glibc specific.
fenv.h doesn't enable to do exactly what we want either,
so instead use assembly directly.

Signed-off-by: Wang He <xw897002528@gmail.com>
Reviewed-by: Axel Davy <axel.davy@ens.fr>
8 years agost/nine: Enable D3DPMISCCAPS_PERSTAGECONSTANT
Patrick Rudolph [Fri, 29 Apr 2016 06:50:16 +0000 (08:50 +0200)]
st/nine: Enable D3DPMISCCAPS_PERSTAGECONSTANT

Nine already supports the feature.
There are no failing WINE tests for per stage constants.
Enabling D3DPMISCCAPS_PERSTAGECONSTANT as it fixes
https://github.com/iXit/Mesa-3D/issues/205

Signed-off-by: Patrick Rudolph <siro@das-labor.org>
Reviewed-by: Axel Davy <axel.davy@ens.fr>
8 years agost/nine: Turn on thread_submit by default when on different device
Axel Davy [Sat, 7 May 2016 09:33:24 +0000 (11:33 +0200)]
st/nine: Turn on thread_submit by default when on different device

The last remaining issues with thread_submit have been resolved,
thus turn it when on a different device (the case where is is
beneficial).

Signed-off-by: Axel Davy <axel.davy@ens.fr>
8 years agost/nine: Fix usage of rasterizer multisample bit.
Axel Davy [Sun, 3 Apr 2016 11:04:39 +0000 (13:04 +0200)]
st/nine: Fix usage of rasterizer multisample bit.

pipe_rasterizer multisample bit should be enabled only when really
wanting to do multisampling, thus we should disable when not having
msaa render target.
This fixes some depth calculation precision issues on radeon.
Also disable it when depth and stencil tests are disabled, since in that
case multisampling is same as not multisampled.

Signed-off-by: Axel Davy <axel.davy@ens.fr>
8 years agost/nine: ATOC has effect only with ALPHATESTENABLE
Axel Davy [Sun, 3 Apr 2016 08:52:22 +0000 (10:52 +0200)]
st/nine: ATOC has effect only with ALPHATESTENABLE

ATOC extension does something only when alpha test is enabled.
Use a second bit to encode the difference with ATIATOC.

Signed-off-by: Axel Davy <axel.davy@ens.fr>
8 years agost/nine: Add debug string for ATOC
Axel Davy [Sat, 7 May 2016 09:20:47 +0000 (11:20 +0200)]
st/nine: Add debug string for ATOC

We were missing a debug string for this format.

Signed-off-by: Axel Davy <axel.davy@ens.fr>
8 years agost/nine: Add asserts for output/input packing
Axel Davy [Sat, 19 Mar 2016 18:27:34 +0000 (19:27 +0100)]
st/nine: Add asserts for output/input packing

Nine doesn't support vs output/ps input packing.
We haven't found any application requiring that,
and implementing it properly is complex.

Add asserts for now.

Signed-off-by: Axel Davy <axel.davy@ens.fr>
8 years agost/nine: Use correct PIPE_HANDLE_USAGE flag for frontbuffer copy
Axel Davy [Mon, 14 Mar 2016 20:29:53 +0000 (21:29 +0100)]
st/nine: Use correct PIPE_HANDLE_USAGE flag for frontbuffer copy

When taking screenshots we do a copy from the frontbuffer
to an allocated buffer (which we then copy to a ram buffer).

Signed-off-by: Axel Davy <axel.davy@ens.fr>
8 years agost/nine: Fix output shift calculation
Axel Davy [Sat, 12 Mar 2016 11:24:51 +0000 (12:24 +0100)]
st/nine: Fix output shift calculation

We were getting it wrong for negative values.

Signed-off-by: Axel Davy <axel.davy@ens.fr>
8 years agost/nine: Fix CheckDeviceFormat advertising for surfaces
Axel Davy [Fri, 11 Mar 2016 22:30:05 +0000 (23:30 +0100)]
st/nine: Fix CheckDeviceFormat advertising for surfaces

Signed-off-by: Axel Davy <axel.davy@ens.fr>
8 years agost/nine: Improve buffer placement
Axel Davy [Fri, 11 Mar 2016 22:03:56 +0000 (23:03 +0100)]
st/nine: Improve buffer placement

Signed-off-by: Axel Davy <axel.davy@ens.fr>
8 years agost/nine: Fix buffer bind flags
Axel Davy [Fri, 11 Mar 2016 21:22:10 +0000 (22:22 +0100)]
st/nine: Fix buffer bind flags

Signed-off-by: Axel Davy <axel.davy@ens.fr>
8 years agost/nine: Fix buffer locking flags handling
Axel Davy [Fri, 11 Mar 2016 21:17:25 +0000 (22:17 +0100)]
st/nine: Fix buffer locking flags handling

Our behaviour was not entirely similar to what
the docs and our tests describe.

Drop d3dlock_buffer_to_pipe_transfer_usage.

Signed-off-by: Axel Davy <axel.davy@ens.fr>
8 years agost/nine: Improve logging
Patrick Rudolph [Wed, 9 Mar 2016 14:15:46 +0000 (15:15 +0100)]
st/nine: Improve logging

Add missing DBG calls in dtors.

Signed-off-by: Patrick Rudolph <siro@das-labor.org>
Reviewed-by: Axel Davy <axel.davy@ens.fr>
8 years agost/nine: Use WINE thread for threadpool
Patrick Rudolph [Mon, 22 Feb 2016 18:49:19 +0000 (19:49 +0100)]
st/nine: Use WINE thread for threadpool

Use present interface 1.2 function ID3DPresent_CreateThread
to create the thread for threadpool.
Creating the thread with WINE prevents some rarely occuring crashes.

Signed-off-by: Patrick Rudolph <siro@das-labor.org>
Reviewed-by: Axel Davy <axel.davy@ens.fr>
8 years agost/nine: Don't present if window is occluded
Patrick Rudolph [Wed, 10 Feb 2016 18:41:12 +0000 (19:41 +0100)]
st/nine: Don't present if window is occluded

The problem is that if one d3d present call fails,
because of our occlusion check in present method,
the next presentation call will send the same pixmap to the Xserver again,
without waiting it is released, which is wrong.

Move the present call after occlusion check to return and prevent
Xpixmaps errors.

Signed-off-by: Patrick Rudolph <siro@das-labor.org>
Reviewed-by: Axel Davy <axel.davy@ens.fr>
8 years agost/nine: Use new function to query for resolution mismatch
Patrick Rudolph [Wed, 10 Feb 2016 18:30:20 +0000 (19:30 +0100)]
st/nine: Use new function to query for resolution mismatch

Any third party app might change the current screen resolution.
Poll for resolution mismatch to force a device reset.
Required for non ex devices only.

Signed-off-by: Patrick Rudolph <siro@das-labor.org>
Reviewed-by: Axel Davy <axel.davy@ens.fr>
8 years agost/nine: Implement IPresent version 1.2
Patrick Rudolph [Sat, 27 Feb 2016 08:58:19 +0000 (09:58 +0100)]
st/nine: Implement IPresent version 1.2

Implement presentation interface version 1.2:
* ID3DPresent_ResolutionMismatch
    Poll for resolution mismatch.
    A third party app might have changed resolution,
    which requires a device reset.
* ID3DPresent_CreateThread
    Create a thread in WINE to allow nine to use Windows API
    functions. Required for multi-threaded presentation.
    In single-threaded presentation mode the calling thread is
    already known to WINE.
* ID3DPresent_WaitForThread
    Wait for a wine thread to terminate.

Signed-off-by: Patrick Rudolph <siro@das-labor.org>
Reviewed-by: Axel Davy <axel.davy@ens.fr>
8 years agost/nine: Implement BumpEnvMap for ff
Axel Davy [Mon, 7 Mar 2016 22:36:44 +0000 (23:36 +0100)]
st/nine: Implement BumpEnvMap for ff

Signed-off-by: Axel Davy <axel.davy@ens.fr>
8 years agost/nine: Format conversion for volumes in UpdateTexture
Axel Davy [Mon, 7 Mar 2016 22:03:25 +0000 (23:03 +0100)]
st/nine: Format conversion for volumes in UpdateTexture

We were doing the conversion for surfaces, but not yet
volumes. Now that volumes can do conversion, use it.

Signed-off-by: Axel Davy <axel.davy@ens.fr>
8 years agost/nine: Remove one useless function output
Axel Davy [Mon, 7 Mar 2016 22:01:02 +0000 (23:01 +0100)]
st/nine: Remove one useless function output

Signed-off-by: Axel Davy <axel.davy@ens.fr>
8 years agost/nine: Add support for X8L8V8U8
Axel Davy [Mon, 7 Mar 2016 21:30:05 +0000 (22:30 +0100)]
st/nine: Add support for X8L8V8U8

X8L8V8U8 support should be common. Some more recent cards
do support this format, but not L6V5U5.

Add fallback for this format to have it alwaus supported.

L6V5U5 conversion rule apparently differs a bit from the normal
spec, and thus the gallium equivalent format leads to slightly
wrong colors. Since some recent cards do not support it, do not
support it either.

Signed-off-by: Axel Davy <axel.davy@ens.fr>
8 years agost/nine: Add format fallback with conversion to volumes
Axel Davy [Mon, 7 Mar 2016 21:18:16 +0000 (22:18 +0100)]
st/nine: Add format fallback with conversion to volumes

Signed-off-by: Axel Davy <axel.davy@ens.fr>
8 years agost/nine: Add format fallback with conversion to surfaces
Axel Davy [Mon, 7 Mar 2016 20:55:30 +0000 (21:55 +0100)]
st/nine: Add format fallback with conversion to surfaces

Signed-off-by: Axel Davy <axel.davy@ens.fr>
8 years agogallium/util: Implement util_format_translate_3d
Axel Davy [Mon, 7 Mar 2016 20:35:59 +0000 (21:35 +0100)]
gallium/util: Implement util_format_translate_3d

This is the equivalent of util_format_translate, but for volumes.

Signed-off-by: Axel Davy <axel.davy@ens.fr>
8 years agost/nine: Fix Pointsize in programmable shader
Axel Davy [Sun, 6 Mar 2016 14:54:50 +0000 (15:54 +0100)]
st/nine: Fix Pointsize in programmable shader

Signed-off-by: Axel Davy <axel.davy@ens.fr>
8 years agost/nine: Fix ff pointscale computation
Axel Davy [Sun, 6 Mar 2016 14:14:30 +0000 (15:14 +0100)]
st/nine: Fix ff pointscale computation

Signed-off-by: Axel Davy <axel.davy@ens.fr>
8 years agost/nine: Fix header of GetIndices
Axel Davy [Sat, 5 Mar 2016 18:06:29 +0000 (19:06 +0100)]
st/nine: Fix header of GetIndices

There is a mistake in the online documentation,
the function only has 2 arguments.

Signed-off-by: Axel Davy <axel.davy@ens.fr>
8 years agost/nine: Increase minor d3dadapter9drm ABI
Axel Davy [Sat, 5 Mar 2016 11:17:06 +0000 (12:17 +0100)]
st/nine: Increase minor d3dadapter9drm ABI

Version 0.1 allows to assume that the second
element of the IDirect3D* structures will
be a pointer to the internal nine vtable.

This is useful if the gallium nine user wants
to wrap some interfaces.

Signed-off-by: Axel Davy <axel.davy@ens.fr>
8 years agost/nine: Fix leak after ctor failures
Axel Davy [Fri, 12 Feb 2016 18:08:42 +0000 (19:08 +0100)]
st/nine: Fix leak after ctor failures

Previously ctor failures would not unreference
the device.

Signed-off-by: Axel Davy <axel.davy@ens.fr>
8 years agost/nine: Add ColorFill test for compressed textures
Axel Davy [Tue, 9 Feb 2016 22:51:39 +0000 (23:51 +0100)]
st/nine: Add ColorFill test for compressed textures

ColorFill should contain alignment checks
for compressed textures.

Signed-off-by: Axel Davy <axel.davy@ens.fr>
8 years agost/nine: PositionT and Tessfactor are forbidden as PS input
Axel Davy [Tue, 9 Feb 2016 22:33:51 +0000 (23:33 +0100)]
st/nine: PositionT and Tessfactor are forbidden as PS input

According to wine tests, they are forbidden as PS input,
which makes sense.

Signed-off-by: Axel Davy <axel.davy@ens.fr>
8 years agost/nine: Fix some shader failures not triggering error
Axel Davy [Tue, 9 Feb 2016 22:15:21 +0000 (23:15 +0100)]
st/nine: Fix some shader failures not triggering error

Some failures during shader translation would not
raise errors before this patch.

Signed-off-by: Axel Davy <axel.davy@ens.fr>
8 years agost/nine: Forbid POSITION0 for PS3.0
Axel Davy [Sun, 21 Feb 2016 15:38:23 +0000 (16:38 +0100)]
st/nine: Forbid POSITION0 for PS3.0

POSITION0 input is forbidden for PS3.0 apparently.

Signed-off-by: Axel Davy <axel.davy@ens.fr>
8 years agost/nine: Rework UpdateTexture Checks
Axel Davy [Tue, 9 Feb 2016 21:35:27 +0000 (22:35 +0100)]
st/nine: Rework UpdateTexture Checks

Our code did match the user documentation of the function
quite well (except for format check).

However the DDI documentation and wine tests show that
documentation was not correct. Thus adapt our code to
fit the best possible to the -real- spec.

Signed-off-by: Axel Davy <axel.davy@ens.fr>
8 years agost/nine: Use bufs instead of Flags for Clear
Axel Davy [Tue, 9 Feb 2016 07:20:34 +0000 (08:20 +0100)]
st/nine: Use bufs instead of Flags for Clear

bufs doesn't contain depthstencil if
there is z buffer mismatch. This is the behaviour
we want.

Signed-off-by: Axel Davy <axel.davy@ens.fr>
8 years agod3dadapter9: Add ddebug, rbug and trace support
Axel Davy [Sun, 10 Apr 2016 21:55:19 +0000 (23:55 +0200)]
d3dadapter9: Add ddebug, rbug and trace support

Add support for ddebug, rbug and trace

Signed-off-by: Axel Davy <axel.davy@ens.fr>
8 years agoradeon: Change AA sample locations for EG+
Axel Davy [Sun, 3 Apr 2016 20:36:01 +0000 (22:36 +0200)]
radeon: Change AA sample locations for EG+

This sets the AA location to the d3d11
spec.
EG/NI 8X MSAA is left as is. Not sure
why it was set different to Cayman, so
lets it as is.

Signed-off-by: Axel Davy <axel.davy@ens.fr>
Reviewed-by: Marek Olšák <marek.olsak@amd.com>
8 years agoradeonsi: Mixed colorbuffer formats are unsupported
Axel Davy [Mon, 7 Mar 2016 21:26:22 +0000 (22:26 +0100)]
radeonsi: Mixed colorbuffer formats are unsupported

Besides depth/stencil, the hardware doesn't support
mixed formats.

The GL state tracker doesn't make use of them.

Signed-off-by: Axel Davy <axel.davy@ens.fr>
Reviewed-by: Marek Olšák <marek.olsak@amd.com>
8 years agoradeonsi: Change default behaviour for undefined COLOR0
Axel Davy [Sat, 19 Mar 2016 18:57:00 +0000 (19:57 +0100)]
radeonsi: Change default behaviour for undefined COLOR0

d3d 9 needs COLOR0 to be 1.0 on all channels when
undefined. 0.0 for the others is fine.
GL behaviour is undefined.

Signed-off-by: Axel Davy <axel.davy@ens.fr>
Reviewed-by: Marek Olšák <marek.olsak@amd.com>
8 years agor600g: Change default behaviour for undefined COLOR0
Axel Davy [Sun, 3 Apr 2016 19:47:11 +0000 (21:47 +0200)]
r600g: Change default behaviour for undefined COLOR0

d3d 9 needs COLOR0 to be 1.0 on all channels when
undefined. 0.0 for the others is fine.
GL behaviour is undefined.

Signed-off-by: Axel Davy <axel.davy@ens.fr>
Reviewed-by: Marek Olšák <marek.olsak@amd.com>
8 years agor600: Change default behaviour for undefined COLOR0
Axel Davy [Sat, 19 Mar 2016 18:55:24 +0000 (19:55 +0100)]
r600: Change default behaviour for undefined COLOR0

d3d 9 needs COLOR0 to be 1.0 on all channels when
undefined. 0.0 for the others is fine.
GL behaviour is undefined.

Signed-off-by: Axel Davy <axel.davy@ens.fr>
Reviewed-by: Marek Olšák <marek.olsak@amd.com>
8 years agost/nine: Clean up WINAPI definition
Christian Schmidbauer [Fri, 29 Apr 2016 19:53:30 +0000 (20:53 +0100)]
st/nine: Clean up WINAPI definition

As Emil pointed out, only gcc, clang and MSVC compatibility is required.
Hence the check for GNUC can be skipped, as __i386__ and __x86_64__ are
only defined for gcc/clang, not for MSVC.

Remove the #undef which has been there for historic reasons, when wine
dlls for nine have been built inside mesa. Instead use #ifndef in order
to avoid redefining WINAPI from MSVC's headers.

Reviewed-by: Emil Velikov <emil.velikov@collabora.com>
Acked-by: Axel Davy <axel.davy@ens.fr>
8 years agosvga: add another debug_printf() in svga_screen_create()
Brian Paul [Wed, 18 May 2016 19:01:03 +0000 (13:01 -0600)]
svga: add another debug_printf() in svga_screen_create()

Signed-off-by: Brian Paul <brianp@vmware.com>
8 years agospirv: add switch case for nir_texop_txf_ms_mcs in vtn_handle_texture()
Brian Paul [Wed, 18 May 2016 01:28:37 +0000 (19:28 -0600)]
spirv: add switch case for nir_texop_txf_ms_mcs in vtn_handle_texture()

Mark it as unreachable.  Silences a compiler warning:

spirv/spirv_to_nir.c:1397:4: warning: enumeration value
'nir_texop_txf_ms_mcs' not handled in switch [-Wswitch]
    switch (instr->op) {
    ^

Reviewed-by: Jason Ekstrand <jason.ekstrand@intel.com>
8 years agoRevert "i965/urb: fixes division by zero"
Matt Turner [Wed, 18 May 2016 19:48:20 +0000 (12:48 -0700)]
Revert "i965/urb: fixes division by zero"

This reverts commit 2a8aa1e3deb99a1ae16d942318da648c1327ece5.

8 years agoi965/urb: fixes division by zero
Ardinartsev Nikita [Mon, 16 May 2016 23:27:22 +0000 (02:27 +0300)]
i965/urb: fixes division by zero

Fixes regression introduced by af5ca43f2676bff7499f93277f908b681cb821d0

Reviewed-by: Matt Turner <mattst88@gmail.com>
Bugzilla: https://bugs.freedesktop.org/show_bug.cgi?id=95419

8 years agomesa: fclose() filename on error.
Matt Turner [Mon, 16 May 2016 22:31:00 +0000 (15:31 -0700)]
mesa: fclose() filename on error.

Pretty useless, as it's in debugging code. Found by Coverity (CID
1257016).

8 years agoi965/fs: Assert that nir_op_extract_*'s src1 is a constant.
Matt Turner [Mon, 16 May 2016 22:22:59 +0000 (15:22 -0700)]
i965/fs: Assert that nir_op_extract_*'s src1 is a constant.

8 years agoglsl: Check that layout is non-null before dereferencing.
Matt Turner [Mon, 16 May 2016 21:49:38 +0000 (14:49 -0700)]
glsl: Check that layout is non-null before dereferencing.

layout should only be null for structs, but it's checked everywhere else
and confuses Coverity (CID 1358495).

Reviewed-by: Timothy Arceri <timothy.arceri@collabora.com>
8 years agoegl/dri2: Don't check return result of mtx_unlock().
Matt Turner [Mon, 16 May 2016 21:43:26 +0000 (14:43 -0700)]
egl/dri2: Don't check return result of mtx_unlock().

Coverity (CID 1358496) warns that the cleanup code doesn't unlock the
mutex (which is arguably kind of stupid, since the only case that can
happen is when mtx_unlock() failed!). But, mtx_unlock() isn't going to
fail -- the mutex was locked by this thread just a few lines above it.

8 years agospirv: Properly size the src[] array.
Matt Turner [Mon, 16 May 2016 19:48:00 +0000 (12:48 -0700)]
spirv: Properly size the src[] array.

Operations like nir_op_bitfield_insert have four arguments, and Coverity
isn't privy to the fact that 4-argument operations aren't possible here,
so it thinks this can lead to memory corruption. Just increase the size
of the array to quell any fears.

8 years agoisl: Mark default cases in switch unreachable.
Matt Turner [Mon, 16 May 2016 18:12:24 +0000 (11:12 -0700)]
isl: Mark default cases in switch unreachable.

To silence -Wmaybe-uninitialized warnings.

8 years agoglsl/linker: Ensure the first stage of an SSO pipeline has input locs assigned
Ian Romanick [Tue, 17 May 2016 20:49:11 +0000 (13:49 -0700)]
glsl/linker: Ensure the first stage of an SSO pipeline has input locs assigned

Previously an SSO pipeline containing only a tessellation control shader
and a tessellation evaluation shader would not get locations assigned
for the TCS inputs.  This would lead to assertion failures in some
piglit tests, such as arb_program_interface_query-resource-query.

That piglit test still fails on some tessellation related subtests.
Specifically, these subtests fail:

'GL_PROGRAM_INPUT(tcs) active resources' expected 2 but got 3
'GL_PROGRAM_INPUT(tcs) max length name' expected 12 but got 16
'GL_PROGRAM_INPUT(tcs,tes) active resources' expected 2 but got 3
'GL_PROGRAM_INPUT(tcs,tes) max length name' expected 12 but got 16
'GL_PROGRAM_OUTPUT(tcs) active resources' expected 15 but got 3
'GL_PROGRAM_OUTPUT(tcs) max length name' expected 23 but got 12

Signed-off-by: Ian Romanick <ian.d.romanick@intel.com>
Reviewed-by: Timothy Arceri <timothy.arceri@collabora.com>
Cc: mesa-stable@lists.freedesktop.org
8 years agoglsl/linker: Don't include interface name for built-in blocks
Ian Romanick [Tue, 17 May 2016 20:30:46 +0000 (13:30 -0700)]
glsl/linker: Don't include interface name for built-in blocks

Commit 11096ec introduced a regression in some piglit tests (e.g.,
arb_program_interface_query-resource-query).  I did not notice this
regression because other (unrelated) problems caused failed assertions
in those same tests on my system... so they crashed before getting to
the new failure.

v2: Use is_gl_identifier.  Suggested by Tim.

Signed-off-by: Ian Romanick <ian.d.romanick@intel.com>
Reviewed-by: Timothy Arceri <timothy.arceri@collabora.com>
Cc: mesa-stable@lists.freedesktop.org
8 years agoglsl: Assert that inputs have a location assigned
Ian Romanick [Tue, 17 May 2016 01:01:10 +0000 (18:01 -0700)]
glsl: Assert that inputs have a location assigned

This catches a problem previously undetected until deep in the backend.

Signed-off-by: Ian Romanick <ian.d.romanick@intel.com>
Reviewed-by: Timothy Arceri <timothy.arceri@collabora.com>
8 years agoglsl/linker: Fix trivial typos in comments
Ian Romanick [Tue, 17 May 2016 22:01:19 +0000 (15:01 -0700)]
glsl/linker: Fix trivial typos in comments

Signed-off-by: Ian Romanick <ian.d.romanick@intel.com>
Reviewed-by: Timothy Arceri <timothy.arceri@collabora.com>
8 years agoglsl/linker: Fix some formatting to match current coding conventions
Ian Romanick [Tue, 17 May 2016 00:58:55 +0000 (17:58 -0700)]
glsl/linker: Fix some formatting to match current coding conventions

Signed-off-by: Ian Romanick <ian.d.romanick@intel.com>
Reviewed-by: Timothy Arceri <timothy.arceri@collabora.com>
8 years agoglsl/linker: Silence unused parameter warning
Ian Romanick [Mon, 16 May 2016 19:48:06 +0000 (12:48 -0700)]
glsl/linker: Silence unused parameter warning

The use of the parameter was removed in d6b92028.

glsl/link_varyings.cpp:1390:39: warning: unused parameter ‘separate_shader’ [-Wunused-parameter]
                                   bool separate_shader)
                                       ^

Signed-off-by: Ian Romanick <ian.d.romanick@intel.com>
Reviewed-by: Timothy Arceri <timothy.arceri@collabora.com>
8 years agoglsl/linker: Silence unused parameter warning
Ian Romanick [Tue, 17 May 2016 20:54:09 +0000 (13:54 -0700)]
glsl/linker: Silence unused parameter warning

The parameter appears to have been unused since the function was added
in commit 12ba6cfb.  Remove it.

glsl/linker.cpp:2886:60: warning: unused parameter ‘prog’ [-Wunused-parameter]
 match_explicit_outputs_to_inputs(struct gl_shader_program *prog,
                                                            ^

Signed-off-by: Ian Romanick <ian.d.romanick@intel.com>
Reviewed-by: Timothy Arceri <timothy.arceri@collabora.com>
8 years agoi965: Silence unused parameter warnings
Ian Romanick [Fri, 13 May 2016 00:44:46 +0000 (17:44 -0700)]
i965: Silence unused parameter warnings

The only place that actually used the type parameter was the GS visitor,
and it was always passed glsl_type::int.  Just remove the parameter.

brw_vec4_vs_visitor.cpp:38:61: warning: unused parameter ‘type’ [-Wunused-parameter]
                                            const glsl_type *type)
                                                             ^

Signed-off-by: Ian Romanick <ian.d.romanick@intel.com>
Reviewed-by: Timothy Arceri <timothy.arceri@collabora.com>
8 years agomesa: Don't advertise GLES 3.1 without compute support
Daniel Scharrer [Tue, 19 Apr 2016 14:57:06 +0000 (16:57 +0200)]
mesa: Don't advertise GLES 3.1 without compute support

The MaxComputeWorkGroupInvocations constant is used in
compute_version_es2() instead of extensions->ARB_compute_shader
as ES has lower requirements than desktop GL.

Both i965 and gallium set this constant before enabling compute support.

Signed-off-by: Daniel Scharrer <daniel@constexpr.org>
Signed-off-by: Marek Olšák <marek.olsak@amd.com>
8 years agomesa/st: don't leak name
Rob Clark [Wed, 18 May 2016 13:19:00 +0000 (09:19 -0400)]
mesa/st: don't leak name

Pointed out by coverity.

Signed-off-by: Rob Clark <robclark@freedesktop.org>
8 years agosvga: null out all sampler views if start=num=0
Brian Paul [Fri, 6 May 2016 15:46:29 +0000 (09:46 -0600)]
svga: null out all sampler views if start=num=0

Because the CSO module handles sampler views for fragment shaders
differently than vertex/geom shaders, VS/GS shader sampler views
aren't explicitly unbound like for FS sampler vers.  This code
checks for the case of start=num=0 and nulls out the sampler views.
Fixes a assert regression in piglit's arb_texture_multisample-
sample-position test.

Reviewed-by: Charmaine Lee <charmainel@vmware.com>
8 years agost/mesa: remove unused st_context::default_texture
Brian Paul [Tue, 10 May 2016 19:01:26 +0000 (13:01 -0600)]
st/mesa: remove unused st_context::default_texture

The code which used this was removed quite a while ago.

Reviewed-by: Ilia Mirkin <imirkin@alum.mit.edu>
Reviewed-by: Sinclair Yeh <syeh@vmware.com>
Reviewed-by: Charmaine Lee <charmainel@vmware.com>
8 years agocso: remove / add some comments
Brian Paul [Fri, 6 May 2016 15:20:23 +0000 (09:20 -0600)]
cso: remove / add some comments

Signed-off-by: Brian Paul <brianp@vmware.com>
8 years agovc4: Add support for vertex color clamping in the rasterizer.
Eric Anholt [Tue, 17 May 2016 19:57:44 +0000 (12:57 -0700)]
vc4: Add support for vertex color clamping in the rasterizer.

This gets us precompile of vertex shaders at the state tracker level as
well.

8 years agovc4: Move tgsi_to_nir to precompile time.
Eric Anholt [Tue, 17 May 2016 19:46:27 +0000 (12:46 -0700)]
vc4: Move tgsi_to_nir to precompile time.

Now we have an immutable nir shader in our shader's CSO that we can clone
and lower/optimize.

8 years agovc4: Mark the driver as supporting fragment color clamping in rast.
Eric Anholt [Tue, 17 May 2016 19:15:54 +0000 (12:15 -0700)]
vc4: Mark the driver as supporting fragment color clamping in rast.

We always clamp fragment colors, since they're always 8-bit unorm, so
there's no need to have us compile separate shaders based on
GL_ARB_color_buffer_float.  This gives us precompilation of fragment
programs to the vc4_shader_state_create() level.

8 years agovc4: Enable sharing shaders across contexts.
Eric Anholt [Tue, 17 May 2016 19:24:06 +0000 (12:24 -0700)]
vc4: Enable sharing shaders across contexts.

This allows the same pipe_shader_state to be referenced from multiple
contexts.  Since our pipe_shader_state is treated as immutable (other than
the variant number) within the driver, this is no problem.

8 years agovc4: Switch to using nir_load_front_face.
Eric Anholt [Tue, 17 May 2016 22:30:59 +0000 (15:30 -0700)]
vc4: Switch to using nir_load_front_face.

This will be generated by glsl_to_nir, and it turns out that this is a
more code-efficient path than the floating point math, anyway.

No change on shader-db, but drops an instruction in piglit's
glsl-fs-frontfacing.

8 years agovc4: Drop the dead export_linkage array.
Eric Anholt [Tue, 17 May 2016 19:35:44 +0000 (12:35 -0700)]
vc4: Drop the dead export_linkage array.

This came from deriving from freedreno.

8 years agovc4: Fix a -Wformat-security warning.
Eric Anholt [Tue, 17 May 2016 21:06:39 +0000 (14:06 -0700)]
vc4: Fix a -Wformat-security warning.

This is apparently enabled as an error in Android builds, and the compiler
can't tell that the return value is safe.

8 years agoradeonsi: add new polaris11 pci ids
Alex Deucher [Tue, 17 May 2016 21:10:50 +0000 (17:10 -0400)]
radeonsi: add new polaris11 pci ids

Reviewed-by: Nicolai Hähnle <nicolai.haehnle@amd.com>
Signed-off-by: Alex Deucher <alexander.deucher@amd.com>
8 years agoradeonsi: add new polaris10 pci ids
Alex Deucher [Tue, 17 May 2016 21:06:26 +0000 (17:06 -0400)]
radeonsi: add new polaris10 pci ids

Reviewed-by: Nicolai Hähnle <nicolai.haehnle@amd.com>
Signed-off-by: Alex Deucher <alexander.deucher@amd.com>
8 years agoi965: Make brw_reg_from_fs_reg() halve exec_size when compressed.
Kenneth Graunke [Fri, 13 May 2016 06:04:10 +0000 (23:04 -0700)]
i965: Make brw_reg_from_fs_reg() halve exec_size when compressed.

In a5d7e144eaf43fee37e6ff9e2de194407087632b, Connor generalized the
exec_size halving code to handle more cases.  As part of this, he made
it not halve anything if the region accessed falls completely in a
single register.

Unfortunately, it started producing some invalid regions:

-add(16)  g6<1>F  g10<8,8,1>UW    -g1<0,1,0>F    { align1 compr };
-add(16)  g8<1>F  g12<8,8,1>UW    -g1.1<0,1,0>F  { align1 compr };
+add(16)  g6<1>F  g10<16,16,1>UW  -g1<0,1,0>F    { align1 compr };
+add(16)  g8<1>F  g12<16,16,1>UW  -g1.1<0,1,0>F  { align1 compr };

Here, the UW source region completely fits within a register.  However,
we have to use instruction compression because the destination region
spans two registers.  <16,16,1> is invalid because it's compressed.

To handle this, skip the "everything fits in one register" case and
fall through to the exec_size halving case when compressed.

Fixes hundreds of Piglit regressions on GM965.

Bugzilla: https://bugs.freedesktop.org/show_bug.cgi?id=95370
Signed-off-by: Kenneth Graunke <kenneth@whitecape.org>
Reviewed-by: Matt Turner <mattst88@gmail.com>
8 years agoi965: Move compression decisions before brw_reg_from_fs_reg().
Kenneth Graunke [Mon, 16 May 2016 22:09:17 +0000 (15:09 -0700)]
i965: Move compression decisions before brw_reg_from_fs_reg().

brw_reg_from_fs_reg() needs to know whether the instruction will be
compressed or not.

Bugzilla: https://bugs.freedesktop.org/show_bug.cgi?id=95370
Signed-off-by: Kenneth Graunke <kenneth@whitecape.org>
Reviewed-by: Matt Turner <mattst88@gmail.com>
8 years agoi965: Enable ES 3.2 sample shading extensions.
Kenneth Graunke [Mon, 4 Apr 2016 06:03:34 +0000 (23:03 -0700)]
i965: Enable ES 3.2 sample shading extensions.

This enables:
- GL_OES_sample_shading
- GL_OES_sample_variables
- GL_OES_shader_multisample_interpolation

On Gen8, we pass all the CTS tests, and all but 4 of the dEQP-GLES31
tests (dealing with 1x/2x MSAA at half rate sampling).  We believe
those 4 dEQP-GLES31 tests are incorrect.

Signed-off-by: Kenneth Graunke <kenneth@whitecape.org>
Reviewed-by: Jason Ekstrand <jason@jlekstrand.net>
Reviewed-by: Ian Romanick <ian.d.romanick@intel.com>
8 years agoanv: Fix warning: unused variable ‘cs_prog_data’
Jordan Justen [Tue, 17 May 2016 21:06:39 +0000 (14:06 -0700)]
anv: Fix warning: unused variable ‘cs_prog_data’

This was introduced in 8a80af282091e692da7bf4e412918ba2362dfb4f.

Reported-by: Jason Ekstrand <jason@jlekstrand.net>
Signed-off-by: Jordan Justen <jordan.l.justen@intel.com>
8 years agoandroid: fix building error in libmesa_st_mesa
Mauro Rossi [Tue, 17 May 2016 20:48:36 +0000 (22:48 +0200)]
android: fix building error in libmesa_st_mesa

Fixes the following building error due to libmesa_nir dependency:

In file included from external/mesa/src/mesa/state_tracker/st_glsl_to_nir.cpp:44:0:
external/mesa/src/compiler/nir/nir.h:42:25: fatal error: nir_opcodes.h: No such file or directory
 #include "nir_opcodes.h"
                         ^
compilation terminated.
build/core/binary.mk:706: recipe for target 'out/target/product/x86/obj/STATIC_LIBRARIES/libmesa_st_mesa_intermediates/state_tracker/st_glsl_to_nir.o' failed
make: *** [out/target/product/x86/obj/STATIC_LIBRARIES/libmesa_st_mesa_intermediates/state_tracker/st_glsl_to_nir.o] Error 1
make: *** Waiting for unfinished jobs....

Reviewed-by: Rob Herring <robh@kernel.org>
Signed-off-by: Rob Clark <robclark@freedesktop.org>
8 years agoradeonsi: force level zero on image instructions in non-fragment shaders (v2)
Nicolai Hähnle [Thu, 12 May 2016 17:44:44 +0000 (12:44 -0500)]
radeonsi: force level zero on image instructions in non-fragment shaders (v2)

Section 8.9 (Texture Functions) of the OpenGL Shading Language 4.5
specification:

   However, automatic level of detail is computed only for fragment shaders.
   Other shaders operate as though the base level of detail were computed as
   zero.

and Section 8.9.3 (Texture Gather Functions):

   When performing a texture gather operation, the minification and
   magnification filters are ignored, and the rules for LINEAR filtering in
   the OpenGL Specification are applied to the base level of the texture
   image to identify the four texels i_0 j_1, i_1 j_1, i_1 j_0, and i_0 j_0.

Of course, explicit LOD or derivative variants work in all shader types.

This fixes several GL4x-CTS.texture_gather.* tests.

v2: TG4 is always level zero (thanks, Ilia)
Reviewed-by: Marek Olšák <marek.olsak@amd.com>
8 years agoradeonsi: emit TXQ in separate functions
Nicolai Hähnle [Thu, 12 May 2016 16:52:36 +0000 (11:52 -0500)]
radeonsi: emit TXQ in separate functions

TXQ is sufficiently different that having in it in the same code path as
texture sampling/fetching opcodes doesn't make much sense.

v2: guard against NULL pointer dereferences

Reviewed-by: Marek Olšák <marek.olsak@amd.com> (v1)
8 years agowinsys/amdgpu: cleanup error handling in amdgpu_ctx_create
Nicolai Hähnle [Fri, 6 May 2016 03:08:39 +0000 (22:08 -0500)]
winsys/amdgpu: cleanup error handling in amdgpu_ctx_create

Reviewed-by: Marek Olšák <marek.olsak@amd.com>
8 years agowinsys/amdgpu: avoid ioctl call when fence_wait is called without timeout
Nicolai Hähnle [Thu, 5 May 2016 21:35:09 +0000 (16:35 -0500)]
winsys/amdgpu: avoid ioctl call when fence_wait is called without timeout

When user fences are used, we don't need the kernel for polling.

Reviewed-by: Marek Olšák <marek.olsak@amd.com>
8 years agogallium/radeon: add radeon_emitted to check for non-trivial IBs
Nicolai Hähnle [Fri, 6 May 2016 22:02:30 +0000 (17:02 -0500)]
gallium/radeon: add radeon_emitted to check for non-trivial IBs

Reviewed-by: Marek Olšák <marek.olsak@amd.com>
8 years agogallium/radeon: use radeon_emit_array
Nicolai Hähnle [Fri, 6 May 2016 22:07:10 +0000 (17:07 -0500)]
gallium/radeon: use radeon_emit_array

Reviewed-by: Marek Olšák <marek.olsak@amd.com>
8 years agogallium/radeon: use radeon_emit
Nicolai Hähnle [Fri, 6 May 2016 21:42:03 +0000 (16:42 -0500)]
gallium/radeon: use radeon_emit

Mostly generated using a sed-script, with manual fix-up for multi-line
statements.

Reviewed-by: Marek Olšák <marek.olsak@amd.com>
8 years agost/mesa: fix reversed copyimage canonical format
Nicolai Hähnle [Fri, 13 May 2016 05:12:37 +0000 (00:12 -0500)]
st/mesa: fix reversed copyimage canonical format

The format_desc swizzle describes where in the array each color channel
comes from - but the existing code was written as if each entry in the
swizzle described the meaning of an array element.

Fixes piglit's arb_copy_image-format-swizzle.

Cc: "11.1 11.2" <mesa-stable@lists.freedesktop.org>
Reviewed-by: Marek Olšák <marek.olsak@amd.com>
8 years agoRevert "HACK: Don't re-configure L3$ in render stages pre-BDW"
Jordan Justen [Thu, 12 May 2016 01:03:15 +0000 (18:03 -0700)]
Revert "HACK: Don't re-configure L3$ in render stages pre-BDW"

This reverts commit 41af9b2e517dd0c17e519490ca915b96f6898390.

Bugzilla: https://bugs.freedesktop.org/show_bug.cgi?id=94468
Reviewed-by: Jason Ekstrand <jason@jlekstrand.net>
8 years agoanv: Port L3 cache programming from i965
Jordan Justen [Sat, 2 Apr 2016 08:34:40 +0000 (01:34 -0700)]
anv: Port L3 cache programming from i965

Signed-off-by: Jordan Justen <jordan.l.justen@intel.com>
Acked-by: Jason Ekstrand <jason@jlekstrand.net>