platform/upstream/mesa.git
7 years agoRevert "dri: make use of dri_get_extensions_name(..) helper"
Emil Velikov [Tue, 15 Nov 2016 18:01:20 +0000 (18:01 +0000)]
Revert "dri: make use of dri_get_extensions_name(..) helper"

This reverts commit 1a21d21580965eff751414d140b3c176eeee2eb3.

Pushed the wrong version of the patch.

7 years agoradeonsi: set unsafe fpmath on FP instructions when allowed by R600_DEBUG
Marek Olšák [Sat, 12 Nov 2016 22:10:23 +0000 (23:10 +0100)]
radeonsi: set unsafe fpmath on FP instructions when allowed by R600_DEBUG

Reviewed-by: Nicolai Hähnle <nicolai.haehnle@amd.com>
7 years agogallivm: add lp_create_builder with an unsafe_fpmath option
Marek Olšák [Sat, 12 Nov 2016 22:08:51 +0000 (23:08 +0100)]
gallivm: add lp_create_builder with an unsafe_fpmath option

Reviewed-by: Nicolai Hähnle <nicolai.haehnle@amd.com>
7 years agoradeonsi: fold some shader context initialization to si_llvm_context_init
Marek Olšák [Sat, 12 Nov 2016 21:51:41 +0000 (22:51 +0100)]
radeonsi: fold some shader context initialization to si_llvm_context_init

Reviewed-by: Nicolai Hähnle <nicolai.haehnle@amd.com>
7 years agoloader: fixup driver names if needed
Christian Gmeiner [Wed, 9 Nov 2016 14:50:07 +0000 (15:50 +0100)]
loader: fixup driver names if needed

This makes it possible to 'use' the imx-drm driver. Remeber that it
is not possible to have sysmbol names in C/C++ with a '-' in it.

Changes since v1:
 - move the fix to loader.c

Signed-off-by: Christian Gmeiner <christian.gmeiner@gmail.com>
Reviewed-by: Eric Engestrom <eric.engestrom@imgtec.com> (v1)
Reviewed-by: Emil Velikov <emil.velikov@collabora.com>
7 years agodri: make use of dri_get_extensions_name(..) helper
Christian Gmeiner [Thu, 3 Nov 2016 14:25:21 +0000 (15:25 +0100)]
dri: make use of dri_get_extensions_name(..) helper

Signed-off-by: Christian Gmeiner <christian.gmeiner@gmail.com>
Reviewed-by: Emil Velikov <emil.velikov@collabora.com>
7 years agoloader: add loader_get_extensions_name(..) helper
Christian Gmeiner [Wed, 9 Nov 2016 14:50:05 +0000 (15:50 +0100)]
loader: add loader_get_extensions_name(..) helper

Changes since v1:
 - renamed function to loader_get_extensions_name
 - moved function into loader

Signed-off-by: Christian Gmeiner <christian.gmeiner@gmail.com>
V2: [Emil Velikov]
 - Use local define.

Signed-off-by: Emil Velikov <emil.velikov@collabora.com>
7 years agoegl: Use pkg-config for Android NDK build
Gurchetan Singh [Thu, 10 Nov 2016 20:14:47 +0000 (12:14 -0800)]
egl: Use pkg-config for Android NDK build

It's possible to build Mesa for Android using the traditional
autotools workflow [1]. ChromiumOS fetches Android prebuilts and
puts them in a sysroot. We now want to use pkg-config to specify
the location of system headers and libraries [2].

To enable this, let's add the required pkg-config checks and link
against them.

[1] https://developer.android.com/ndk/guides/standalone_toolchain.html
[2] https://chromium-review.googlesource.com/#/c/403237/

v2: Bundle pkg-config checks together (Emil)
v3: Provide further context on standalone NDK Mesa build (Emil)
Reviewed-by: Emil Velikov <emil.velikov@collabora.com>
7 years agoconfigure.ac: Don't look for pthreads in Android platform
Gurchetan Singh [Thu, 27 Oct 2016 16:06:42 +0000 (09:06 -0700)]
configure.ac: Don't look for pthreads in Android platform

In Android, the pthreads libs are in bionic.  When building
Mesa for Android with the autotools workflow, we shouldn't
set -lpthread or -pthread.

[Emil Velikov]
Other platforms could use a similar fix, although that is left as
separate exercise.

Reviewed-by: Emil Velikov <emil.velikov@collabora.com>
7 years agometa/GetTexSubImage: Account for GL_PACK_SKIP_IMAGES on compressed textures
Eduardo Lima Mitev [Mon, 14 Nov 2016 23:25:14 +0000 (15:25 -0800)]
meta/GetTexSubImage: Account for GL_PACK_SKIP_IMAGES on compressed textures

This option was being ignored when packing compressed 3D and cube textures.

Fixes CTS test (on gen8+):
* GL45-CTS.gtf32.GL3Tests.packed_pixels.packed_pixels_pixelstore

v2: Drop API checks.
v3 (Ken): Just apply the existing code in more cases.

Reviewed-by: Kenneth Graunke <kenneth@whitecape.org>
7 years agoanv/format: handle unsupported formats earlier
Iago Toral Quiroga [Tue, 15 Nov 2016 07:48:46 +0000 (08:48 +0100)]
anv/format: handle unsupported formats earlier

Reviewed-by: Jason Ekstrand <jason@jlekstrand.net>
7 years agomain: return error if asking for GL_TEXTURE_BORDER_COLOR in TEXTURE_2D_MULTISAMPLE...
Samuel Iglesias Gonsálvez [Mon, 7 Nov 2016 10:49:13 +0000 (11:49 +0100)]
main: return error if asking for GL_TEXTURE_BORDER_COLOR in TEXTURE_2D_MULTISAMPLE{_ARRAY} through TexParameter{i,Ii,Iui}v()

OpenGL ES 3.2 says in section 8.10. "TEXTURE PARAMETERS", at the end of
the section:

"An INVALID_ENUM error is generated if target is TEXTURE_2D_-
MULTISAMPLE or TEXTURE_2D_MULTISAMPLE_ARRAY , and pname is any
sampler state from table 21.12."

GL_TEXTURE_BORDER_COLOR is present in that table.

v2:
- Add check to _mesa_texture_parameteriv() (Kenneth)

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

Signed-off-by: Samuel Iglesias Gonsálvez <siglesias@igalia.com>
Reviewed-by: Kenneth Graunke <kenneth@whitecape.org>
7 years agoanv: fix multi level clears with VK_REMAINING_MIP_LEVELS
Lionel Landwerlin [Mon, 14 Nov 2016 17:26:09 +0000 (17:26 +0000)]
anv: fix multi level clears with VK_REMAINING_MIP_LEVELS

A commit from the CTS suite on the 1.0-dev branch started using
VK_REMAINING_MIP_LEVELS, we're not dealing with it properly for clears.

Fixes:
   dEQP-VK.api.image_clearing.clear_color_image.*

Signed-off-by: Lionel Landwerlin <lionel.g.landwerlin@intel.com>
Reviewed-by: Jason Ekstrand <jason@jlekstrand.net>
Cc: "13.0" <mesa-stable@lists.freedesktop.org>
7 years agodir-locals.el: Adds White Space support
Andres Gomez [Wed, 9 Nov 2016 16:32:41 +0000 (18:32 +0200)]
dir-locals.el: Adds White Space support

Trailing white spaces will be now always highlighted, not just in
prog-mode.

Also, the White Space package, which is available since GNU Emacs 22,
is loaded and activated locally in prog-mode.

Additionally, using White Space variables, we set highlighting through
faces on wrong indentation and the maximum length of a coding line.

Notice that:
 - The highlighting for the characters beyond the set length of a
   coding line is not activated by default, only for wrong
   indentations.
 - If the White Space package is not available, errors on loading or
   activation are ignored.
 - If the White Space mode is not activated the set variables would
   not have any effect.

v2: Removed too long lines trail highlighting, as suggested by Ilia
    Mirkin.

Signed-off-by: Andres Gomez <agomez@igalia.com>
Acked-by: Ilia Mirkin <imirkin@alum.mit.edu>
7 years agoanv/format: support VK_FORMAT_R8G8B8_SRGB
Iago Toral Quiroga [Mon, 14 Nov 2016 11:04:28 +0000 (12:04 +0100)]
anv/format: support VK_FORMAT_R8G8B8_SRGB

Fixes dEQP-VK.api.image_clearing.clear_color_image.1d_r8g8b8_srgb

Reviewed-by: Lionel Landwerlin <lionel.g.landwerlin@intel.com>
7 years agoanv/format: handle unsupported formats properly
Iago Toral Quiroga [Mon, 14 Nov 2016 11:36:57 +0000 (12:36 +0100)]
anv/format: handle unsupported formats properly

According to the spec for vkGetPhysicalDeviceImageFormatProperties:

"If format is not a supported image format, or if the combination of format,
 type, tiling, usage, and flags is not supported for images, then
 vkGetPhysicalDeviceImageFormatProperties returns VK_ERROR_FORMAT_NOT_SUPPORTED."

Makes the following Vulkan CTS tests report 'Not Supported' instead of crashing:

dEQP-VK.api.image_clearing.clear_color_image.1d_b8g8r8_unorm
dEQP-VK.api.image_clearing.clear_color_image.1d_b8g8r8_snorm
dEQP-VK.api.image_clearing.clear_color_image.1d_b8g8r8_uscaled
dEQP-VK.api.image_clearing.clear_color_image.1d_b8g8r8_sscaled
dEQP-VK.api.image_clearing.clear_color_image.1d_b8g8r8_uint
dEQP-VK.api.image_clearing.clear_color_image.1d_b8g8r8_sint
dEQP-VK.api.image_clearing.clear_color_image.1d_b8g8r8_srgb
dEQP-VK.api.image_clearing.clear_color_image.1d_b8g8r8a8_unorm
dEQP-VK.api.image_clearing.clear_color_image.1d_b8g8r8a8_snorm
dEQP-VK.api.image_clearing.clear_color_image.1d_b8g8r8a8_uscaled
dEQP-VK.api.image_clearing.clear_color_image.1d_b8g8r8a8_sscaled
dEQP-VK.api.image_clearing.clear_color_image.1d_b8g8r8a8_uint
dEQP-VK.api.image_clearing.clear_color_image.1d_b8g8r8a8_sint
dEQP-VK.api.image_clearing.clear_color_image.1d_b8g8r8a8_srgb
dEQP-VK.api.image_clearing.clear_color_image.1d_r4g4_unorm_pack8
dEQP-VK.api.image_clearing.clear_color_image.1d_r8_srgb
dEQP-VK.api.image_clearing.clear_color_image.1d_r8g8_srgb
dEQP-VK.api.image_clearing.clear_color_image.1d_r8g8b8_srgb
dEQP-VK.api.image_clearing.clear_color_image.1d_b5g5r5a1_unorm_pack16

Reviewed-by: Lionel Landwerlin <lionel.g.landwerlin@intel.com>
7 years agoclover: adapt to new error API since LLVM r286752
Vedran Miletić [Mon, 14 Nov 2016 11:17:42 +0000 (12:17 +0100)]
clover: adapt to new error API since LLVM r286752

Tested-by: Dieter Nützel <Dieter@nuetzel-hh.de>
7 years agoswr: [rasterizer core] remove driverType
Tim Rowley [Thu, 10 Nov 2016 00:24:20 +0000 (18:24 -0600)]
swr: [rasterizer core] remove driverType

Reviewed-by: Bruce Cherniak <bruce.cherniak@intel.com>
7 years agoswr: [rasterizer archrast] move to pass by value
Tim Rowley [Wed, 9 Nov 2016 23:29:00 +0000 (17:29 -0600)]
swr: [rasterizer archrast] move to pass by value

Move to pass by value since most events are very small in size.

We can look at pass by reference but will need to create multiple
versions to handle temp objects.

Reviewed-by: Bruce Cherniak <bruce.cherniak@intel.com>
7 years agoswr: [rasterizer core] add mode for aux buffer in the SWR_SURFACE_STATE
Tim Rowley [Wed, 9 Nov 2016 19:58:37 +0000 (13:58 -0600)]
swr: [rasterizer core] add mode for aux buffer in the SWR_SURFACE_STATE

Reviewed-by: Bruce Cherniak <bruce.cherniak@intel.com>
7 years agoswr: [rasterizer common] don't bleed NOMINMAX definition after <windows.h>
Tim Rowley [Mon, 7 Nov 2016 22:11:45 +0000 (16:11 -0600)]
swr: [rasterizer common] don't bleed NOMINMAX definition after <windows.h>

Reviewed-by: Bruce Cherniak <bruce.cherniak@intel.com>
7 years agoswr: [rasterizer archrast] add events
Tim Rowley [Mon, 7 Nov 2016 21:53:05 +0000 (15:53 -0600)]
swr: [rasterizer archrast] add events

Added events for tracking early/late Depth and stencil events,
TE patch info, GS prim info, and FrontEnd/BackEnd DrawEnd events.

Reviewed-by: Bruce Cherniak <bruce.cherniak@intel.com>
7 years agoswr: [rasterizer core] fix culling issues
Tim Rowley [Mon, 7 Nov 2016 21:23:09 +0000 (15:23 -0600)]
swr: [rasterizer core] fix culling issues

- Do proper culling of wireframe triangles (including non-culling of
  degenerates)
- Fix degenerate culling of CCW front-facing triangles in wireframe and
  conservative rast

Reviewed-by: Bruce Cherniak <bruce.cherniak@intel.com>
7 years agoswr: [rasterizer core/jitter] fix alpha test bug
Tim Rowley [Thu, 3 Nov 2016 18:33:13 +0000 (13:33 -0500)]
swr: [rasterizer core/jitter] fix alpha test bug

Alpha from render target 0 should always be used for alpha test for all
render targets, according to GL and DX9 specs. Previously we were using
alpha from the current render target.

Reviewed-by: Bruce Cherniak <bruce.cherniak@intel.com>
7 years agoswr: [rasterizer core] various code style changes
Tim Rowley [Wed, 2 Nov 2016 21:29:29 +0000 (16:29 -0500)]
swr: [rasterizer core] various code style changes

Reviewed-by: Bruce Cherniak <bruce.cherniak@intel.com>
7 years agoswr: [rasterizer archrast] don't generate empty files
Tim Rowley [Mon, 31 Oct 2016 00:27:07 +0000 (19:27 -0500)]
swr: [rasterizer archrast] don't generate empty files

Don't generate files when no events have been generated outside
the header events.

Reviewed-by: Bruce Cherniak <bruce.cherniak@intel.com>
7 years agoswr: [rasterizer archrast] fix open file handle limit issue
Tim Rowley [Sat, 29 Oct 2016 06:08:09 +0000 (01:08 -0500)]
swr: [rasterizer archrast] fix open file handle limit issue

Buffer events ourselves and then when that's full or we're destroying
the context then write the contents to file. Previously, we're relying
ofstream to buffer for us.

Reviewed-by: Bruce Cherniak <bruce.cherniak@intel.com>
7 years agoswr: [rasterizer archrast] fix double free issue
Tim Rowley [Fri, 28 Oct 2016 22:21:01 +0000 (17:21 -0500)]
swr: [rasterizer archrast] fix double free issue

Reviewed-by: Bruce Cherniak <bruce.cherniak@intel.com>
7 years agoswr: [rasterizer core] separate frontend/backend stats enables
Tim Rowley [Fri, 28 Oct 2016 21:10:12 +0000 (16:10 -0500)]
swr: [rasterizer core] separate frontend/backend stats enables

Reviewed-by: Bruce Cherniak <bruce.cherniak@intel.com>
7 years agoswr: [rasterizer core] 16-wide tile store nearly completed
Tim Rowley [Fri, 28 Oct 2016 20:59:18 +0000 (15:59 -0500)]
swr: [rasterizer core] 16-wide tile store nearly completed

* All format combinations coded
* Fully emulated on AVX2 and AVX
* Known issue: the MSAA sample locations need to be adjusted for 8x2

Set ENABLE_AVX512_SIMD16 and USD_8x2_TILE_BACKEND to 1 in knobs.h to enable

Reviewed-by: Bruce Cherniak <bruce.cherniak@intel.com>
7 years agodocs: add news item and link release notes for 13.0.1
Emil Velikov [Mon, 14 Nov 2016 11:39:01 +0000 (11:39 +0000)]
docs: add news item and link release notes for 13.0.1

Signed-off-by: Emil Velikov <emil.velikov@collabora.com>
7 years agodocs: add sha256 checksums for 13.0.1
Emil Velikov [Mon, 14 Nov 2016 11:37:03 +0000 (11:37 +0000)]
docs: add sha256 checksums for 13.0.1

Signed-off-by: Emil Velikov <emil.velikov@collabora.com>
(cherry picked from commit b47ce6ddb8be51d72d40ea0abc3d77b667c8552f)

7 years agodocs: add release notes for 13.0.1
Emil Velikov [Mon, 14 Nov 2016 10:58:11 +0000 (10:58 +0000)]
docs: add release notes for 13.0.1

Signed-off-by: Emil Velikov <emil.velikov@collabora.com>
(cherry picked from commit f2f487ebbb808010528edd69000694bfe525f87b)

7 years agoi965/vec4: skip registers already marked as no_spill
Juan A. Suarez Romero [Tue, 8 Nov 2016 10:59:44 +0000 (11:59 +0100)]
i965/vec4: skip registers already marked as no_spill

Do not evaluate spill costs for registers that were already marked as
no_spill.

Reviewed-by: Kenneth Graunke <kenneth@whitecape.org>
7 years agoglsl: Don't crash on function names with invalid identifiers.
Kenneth Graunke [Sat, 12 Nov 2016 19:55:30 +0000 (11:55 -0800)]
glsl: Don't crash on function names with invalid identifiers.

Karol Herbst's fuzzing efforts noticed that we would segfault on:

   void bug() {
      2(0);
   }

We just need to bail if the function name isn't an identifier.

Based on a bug fix by Karol Herbst.

Bugzilla: https://bugs.freedesktop.org/show_bug.cgi?id=97422
Signed-off-by: Kenneth Graunke <kenneth@whitecape.org>
Reviewed-by: Timothy Arceri <timothy.arceri@collabora.com>
7 years agoglsl: Fix assert fails when assignment expressions are in array sizes.
Kenneth Graunke [Sat, 12 Nov 2016 19:27:17 +0000 (11:27 -0800)]
glsl: Fix assert fails when assignment expressions are in array sizes.

Karol Herbst's fuzzing efforts discovered that we would hit the
following assert:

   assert(dummy_instructions.is_empty());

when processing an illegal array size expression of

   float[(1=1)?1:1] t;

In do_assignment, we realized we needed an rvalue for (1 = 1), and
generated a temporary variable and assignment from the RHS.  We've
already flagged an error (non-lvalue in assignment), and return a bogus
value as the rvalue.  But process_array_size sees the bogus value, which
happened to be a constant expression, and rightly assumes that
processing a constant expression shouldn't have generated any code.
instructions.

To handle this, make do_assignment not generate any temps or assignments
when it's already raised an error - just return an error value directly.

Bugzilla: https://bugs.freedesktop.org/show_bug.cgi?id=98694
Signed-off-by: Kenneth Graunke <kenneth@whitecape.org>
Reviewed-by: Timothy Arceri <timothy.arceri@collabora.com>
7 years agovc4: Add simulator kernel validation for multithreaded fragment shaders.
Jonas Pfeil [Fri, 11 Nov 2016 01:52:03 +0000 (17:52 -0800)]
vc4: Add simulator kernel validation for multithreaded fragment shaders.

This is Jonas Pfeil's code from the kernel, brought back to Mesa by
anholt.

7 years agovc4: Mark threaded FSes as non-singlethread in the CL.
Eric Anholt [Fri, 11 Nov 2016 01:50:34 +0000 (17:50 -0800)]
vc4: Mark threaded FSes as non-singlethread in the CL.

7 years agovc4: Flag the last thread switch in the program as the last.
Eric Anholt [Fri, 11 Nov 2016 01:28:20 +0000 (17:28 -0800)]
vc4: Flag the last thread switch in the program as the last.

We don't allow the last thread switch to be inside control flow, to be
sure that we hit the last state exactly once.  If the last texturing was
in control flow, fall back to single threaded.

7 years agovc4: Add THRSW nodes after each tex sample setup in multithreaded mode.
Eric Anholt [Fri, 11 Nov 2016 01:16:04 +0000 (17:16 -0800)]
vc4: Add THRSW nodes after each tex sample setup in multithreaded mode.

This is a suboptimal implementation, but Jonas Pfeil found that it was
still a massive performance gain.

7 years agovc4: Add some spec citations about texture fifo management.
Eric Anholt [Fri, 11 Nov 2016 01:04:21 +0000 (17:04 -0800)]
vc4: Add some spec citations about texture fifo management.

7 years agovc4: Use ra14/rb14 as the spilling registers.
Eric Anholt [Fri, 11 Nov 2016 21:26:00 +0000 (13:26 -0800)]
vc4: Use ra14/rb14 as the spilling registers.

This makes the raddr fixups compatible with FS threading.

7 years agovc4: Add support for register allocation for threaded shaders.
Eric Anholt [Thu, 10 Nov 2016 23:10:15 +0000 (15:10 -0800)]
vc4: Add support for register allocation for threaded shaders.

We have two major requirements: Make sure that only the bottom half of the
physical reg space is used, and make sure that none of our values are live
in an accumulator across a switch.

7 years agovc4: Split register class setup for physical files from accumulators.
Eric Anholt [Thu, 10 Nov 2016 22:55:26 +0000 (14:55 -0800)]
vc4: Split register class setup for physical files from accumulators.

7 years agovc4: Use register allocator CLASS_BIT_R0_R3 to clean up CLASS_B.
Eric Anholt [Thu, 10 Nov 2016 22:37:36 +0000 (14:37 -0800)]
vc4: Use register allocator CLASS_BIT_R0_R3 to clean up CLASS_B.

We have had no reason to separate ability to store in an accumulator from
ability to store in B, but with FS threading, we need to be able to force
values to be stored only in the physical regfiles.

7 years agovc4: Add support for QPU scheduling of thread switch instructions.
Eric Anholt [Fri, 11 Nov 2016 02:02:37 +0000 (18:02 -0800)]
vc4: Add support for QPU scheduling of thread switch instructions.

This is vaguely based off of Jonas Pfeil's thread switch support branch.

7 years agovc4: Add a thread switch QIR instruction.
Eric Anholt [Thu, 10 Nov 2016 23:23:19 +0000 (15:23 -0800)]
vc4: Add a thread switch QIR instruction.

This will eventually be generated at the QIR level, so that
vc4_qir_schedule.c can arrange the separation of tex_strb from tex_result
correctly.  It will also be important so that register allocation set the
register classes appropriately for values that are live across the switch.

7 years agovc4: Add a bit of QPU validation for threaded shaders.
Eric Anholt [Fri, 11 Nov 2016 22:15:55 +0000 (14:15 -0800)]
vc4: Add a bit of QPU validation for threaded shaders.

These are both bugs we've run into along the way writing multithreaded FS
support.

7 years agovc4: Fix register class handling of DDX/DDY arguments.
Eric Anholt [Fri, 11 Nov 2016 22:04:42 +0000 (14:04 -0800)]
vc4: Fix register class handling of DDX/DDY arguments.

I had this exactly backwards, but apparently the piglit tests were all
landing in r0-r3 anyway.

Cc: "13.0" <mesa-stable@lists.freedesktop.org>
7 years agoradv/pipeline: Don't dereference NULL dynamic state pointers
Darren Salt [Sun, 16 Oct 2016 19:32:19 +0000 (20:32 +0100)]
radv/pipeline: Don't dereference NULL dynamic state pointers

This is a port of commit a4a59172482d50318a5ae7f99021bcf0125e0f53:

   Add guards to prevent dereferencing NULL dynamic pipeline state. Asserts
   of pCreateInfo members are moved to the earliest points at which they
   should not be NULL.

This fixes a segfault, related to pColorBlendState, seen in Talos Principle
which I've observed after startup is completed and when exiting the menus,
depending on when Vulkan rendering is selected.

v2: moved the NULL check in radv_pipeline_init_blend_state to after the
declarations.
Acked-by: Edward O'Callaghan <funfunctor@folklore1984.net>
Reviewed-by: Bas Nieuwenhuizen <bas@basnieuwenhuizen.nl>
7 years agofreedreno/ir3: fixup ralloc fallout
Rob Clark [Thu, 10 Nov 2016 21:08:39 +0000 (16:08 -0500)]
freedreno/ir3: fixup ralloc fallout

Fixes fallout from acc23b04 ("ralloc: remove memset from ralloc_size").
We were still depending on zero'd allocations in a couple of places.

Signed-off-by: Rob Clark <robdclark@gmail.com>
7 years agoFix races during _mesa_HashWalk().
Steinar H. Gunderson [Sat, 5 Nov 2016 14:28:37 +0000 (15:28 +0100)]
Fix races during _mesa_HashWalk().

There is currently no protection against walking a hash (using
_mesa_HashWalk()) and modifying it at the same time, for instance by inserting
or deleting elements. This leads to segfaults in multithreaded code if e.g.
someone calls glTexImage2D (which may have to walk the list of FBOs) while
another thread is calling glDeleteFramebuffers on another thread with the two
contexts sharing lists.

The reason for this is that _mesa_HashWalk() doesn't actually take the mutex
that normally protects the hash; it takes an entirely different mutex.
Thus, walks are only protected against other walks, and there is also no
outer lock taking this. There is an old comment saying that this is to fix
problems with deadlock if the callback needs to take a mutex; we solve this
by changing the mutex to be recursive.

A demonstration Helgrind hit from a real application:

==13412== Possible data race during write of size 8 at 0x3498C6A8 by thread #1
==13412== Locks held: 2, at addresses 0x1AF09530 0x2B3DF400
==13412==    at 0x1F040C99: _mesa_hash_table_remove (hash_table.c:395)
==13412==    by 0x1EE98174: _mesa_HashRemove_unlocked (hash.c:350)
==13412==    by 0x1EE98174: _mesa_HashRemove (hash.c:365)
==13412==    by 0x1EE2372D: _mesa_DeleteFramebuffers (fbobject.c:2669)
==13412==    by 0x6105AA4: movit::ResourcePool::cleanup_unlinked_fbos(void*) (resource_pool.cpp:473)
==13412==    by 0x610615B: movit::ResourcePool::release_fbo(unsigned int) (resource_pool.cpp:442)
[...]
==13412== This conflicts with a previous read of size 8 by thread #20
==13412== Locks held: 2, at addresses 0x1AF09558 0x1AF73318
==13412==    at 0x1F040CD9: _mesa_hash_table_next_entry (hash_table.c:415)
==13412==    by 0x1EE982A8: _mesa_HashWalk (hash.c:426)
==13412==    by 0x1EED6DFD: _mesa_update_fbo_texture.part.33 (teximage.c:2683)
==13412==    by 0x1EED9410: _mesa_update_fbo_texture (teximage.c:3043)
==13412==    by 0x1EED9410: teximage (teximage.c:3073)
==13412==    by 0x1EEDA28F: _mesa_TexImage2D (teximage.c:3105)
==13412==    by 0x166A68: operator() (mixer.cpp:454)

There are many more interactions than just these two possible.

Cc: 11.2 12.0 13.0 <mesa-stable@lists.freedesktop.org>
Signed-off-by: Steinar H. Gunderson <steinar+mesa@gunderson.no>
Reviewed-by: Timothy Arceri <timothy.arceri@collabora.com>
7 years agoi965: Drop tabs in brw_state.h.
Kenneth Graunke [Sat, 12 Nov 2016 01:12:13 +0000 (17:12 -0800)]
i965: Drop tabs in brw_state.h.

7 years agoac/nir/llvm: Fix setting function attributes for intrinsics
Daniel Scharrer [Fri, 11 Nov 2016 20:36:36 +0000 (21:36 +0100)]
ac/nir/llvm: Fix setting function attributes for intrinsics

This fixes a NULL pointer dereference for intrinsics with more than
one function attribute introduced in commit 2fdaf38.
The fix is ported from the lp_build_intrinsic changes in commit 8bdd52c.

Reviewed-by: Bas Nieuwenhuizen <bas@basnieuwenhuizen.nl>
7 years agoi965: Update a comment: s/brw_state_cache/brw_program_cache/g
Kenneth Graunke [Fri, 11 Nov 2016 21:18:51 +0000 (13:18 -0800)]
i965: Update a comment: s/brw_state_cache/brw_program_cache/g

Tim renamed this recently - stop referring to it by the old name.

Signed-off-by: Kenneth Graunke <kenneth@whitecape.org>
7 years agoclover: fix building since llvm r286566
Laurent Carlier [Fri, 11 Nov 2016 13:00:26 +0000 (14:00 +0100)]
clover: fix building since llvm r286566

pretty trivial fix

7 years agoegl/wayland: fix return value in dri2_wl_swrast_commit_backbuffer
Emil Velikov [Fri, 11 Nov 2016 16:27:59 +0000 (16:27 +0000)]
egl/wayland: fix return value in dri2_wl_swrast_commit_backbuffer

The function returns "void" rather than int. We could rework that, yet
again there will be no benefit since all the callers have no use of it.

Fixes: 9ca6711faa0 ("Revert "wayland: Block for the frame callback in
get_back_bo not dri2_swap_buffers"")
Reviewed-by: Daniel Stone <daniels@collabora.com>
Signed-off-by: Emil Velikov <emil.l.velikov@gmail.com>
7 years agoglsl: define __STDC_FORMAT_MACROS to get PRIx64 macro
Brian Paul [Fri, 11 Nov 2016 16:16:34 +0000 (09:16 -0700)]
glsl: define __STDC_FORMAT_MACROS to get PRIx64 macro

Otherwise, inttypes.h may not define the macro for C++ on MinGW.

Bugzilla: https://bugs.freedesktop.org/show_bug.cgi?id=98681
Reviewed-by: Emil Velikov <emil.velikov@collabora.com>
7 years agomesa: fix comment indentation in bind_buffers_check_offset_and_size()
Brian Paul [Fri, 11 Nov 2016 15:11:40 +0000 (08:11 -0700)]
mesa: fix comment indentation in bind_buffers_check_offset_and_size()

Trivial.

7 years agoglsl: automake: add opt_add_neg_to_sub.h to the sources list
Emil Velikov [Fri, 11 Nov 2016 14:45:02 +0000 (14:45 +0000)]
glsl: automake: add opt_add_neg_to_sub.h to the sources list

Otherwise it'll be missing in the release tarball.

Signed-off-by: Emil Velikov <emil.velikov@collabora.com>
7 years agoi965: update gl_PrimitiveIDIn to be a system variable
Timothy Arceri [Tue, 25 Oct 2016 10:55:17 +0000 (21:55 +1100)]
i965: update gl_PrimitiveIDIn to be a system variable

Now that we have switched to using nir_shader_gather_info() we
can remove the hacks and just use the system variable.

Reviewed-by: Kenneth Graunke <kenneth@whitecape.org>
7 years agoi965: use nir_shader_gather_info() over do_set_program_inouts()
Timothy Arceri [Thu, 27 Oct 2016 01:22:36 +0000 (12:22 +1100)]
i965: use nir_shader_gather_info() over do_set_program_inouts()

This takes us one step closer to being able to drop the GLSL IR
optimisation passes during linking in favour of the NIR passes.

Reviewed-by: Kenneth Graunke <kenneth@whitecape.org>
7 years agoi965: remove remaining tabs in brw_program_cache.c
Timothy Arceri [Fri, 11 Nov 2016 04:08:42 +0000 (15:08 +1100)]
i965: remove remaining tabs in brw_program_cache.c

Acked-by: Kenneth Graunke <kenneth@whitecape.org>
7 years agoi965: rename brw_state_cache_check_size() to brw_program_cache_check_size()
Timothy Arceri [Fri, 11 Nov 2016 04:06:28 +0000 (15:06 +1100)]
i965: rename brw_state_cache_check_size() to brw_program_cache_check_size()

Acked-by: Kenneth Graunke <kenneth@whitecape.org>
7 years agoi965: rename brw_state_cache.c -> brw_program_cache.c
Timothy Arceri [Fri, 11 Nov 2016 04:01:24 +0000 (15:01 +1100)]
i965: rename brw_state_cache.c -> brw_program_cache.c

Acked-by: Kenneth Graunke <kenneth@whitecape.org>
7 years agoi965/gs: Allow primitive id to be a system value
Jason Ekstrand [Fri, 11 Nov 2016 06:36:39 +0000 (22:36 -0800)]
i965/gs: Allow primitive id to be a system value

This allows for gl_PrimitiveId to come in as a system value rather than as
an input.  This is the way it will come in from SPIR-V. We keeps the input
path working for now so we don't break GL.

Reviewed-by: Kenneth Graunke <kenneth@whitecape.org>
Cc: "13.0" <mesa-stable@lists.freedesktop.org>
7 years agovulkan/wsi/x11: Implement FIFO mode.
Jason Ekstrand [Thu, 3 Nov 2016 23:59:08 +0000 (16:59 -0700)]
vulkan/wsi/x11: Implement FIFO mode.

This implements VK_PRESENT_MODE_FIFO_KHR for X11.  Unfortunately, due to
the way the present extension works, we have to manage the queue of
presented images in a separate thread.

Signed-off-by: Jason Ekstrand <jason@jlekstrand.net>
Reviewed-by: Eric Engestrom <eric.engestrom@imgtec.com>
Reviewed-by: Dave Airlie <airlied@redhat.com>
Cc: "13.0" <mesa-stable@lists.freedesktop.org>
7 years agovulkan/wsi: Report the correct min/maxImageCount
Jason Ekstrand [Fri, 4 Nov 2016 22:42:48 +0000 (15:42 -0700)]
vulkan/wsi: Report the correct min/maxImageCount

From the Vulkan spec 1.0.32 section 29.6 docs for vkAcquireNextImageKHR:

   "Let n be the total number of images in the swapchain, m be the value of
   VkSurfaceCapabilitiesKHR::minImageCount, and a be the number of
   presentable images that the application has currently acquired (i.e.
   images acquired with vkAcquireNextImageKHR, but not yet presented with
   vkQueuePresentKHR).  vkAcquireNextImageKHR can always succeed if a ≤ n -
   m at the time vkAcquireNextImageKHR is called. vkAcquireNextImageKHR
   should not be called if a > n - m with a timeout of UINT64_MAX; in such
   a case, vkAcquireNextImageKHR may block indefinitely."

With minImageCount == 2 (as it was previously, the client is allowed to
acquire all but one image withoutblocking.  If we really need 4 images for
mailbox mode + pageflipping, then we need to request a minimum of 4 images
up-front.  This is a bit unfortunate because it means we will always
consume 4 images.  In the future, we may be able to optimize this a bit by
waiting until the server starts to flip and returning OUT_OF_DATE to get
the client to re-allocate with more images or something like that.

Signed-off-by: Jason Ekstrand <jason@jlekstrand.net>
Reviewed-by: Dave Airlie <airlied@redhat.com>
Cc: "13.0" <mesa-stable@lists.freedesktop.org>
7 years agovulkan/wsi: Add a thread-safe queue implementation
Kevin Strasser [Thu, 3 Nov 2016 01:18:44 +0000 (18:18 -0700)]
vulkan/wsi: Add a thread-safe queue implementation

In order to support FIFO mode without blocking the application on calls
to vkQueuePresentKHR it is necessary to enqueue the request and defer
calling the server until the next vblank period. The xcb present api
doesn't offer a way to register a callback, so we will have to spawn a
worker thread that will wait for a request to be added to the queue, call
to the server, and then make the image available for reuse.  This commit
introduces the queue data structure needed to implement this.

Signed-off-by: Jason Ekstrand <jason@jlekstrand.net>
Reviewed-by: Eric Engestrom <eric.engestrom@imgtec.com>
Reviewed-by: Dave Airlie <airlied@redhat.com>
Cc: "13.0" <mesa-stable@lists.freedesktop.org>
7 years agoandroid/i965: add libmesa_i965_compiler static library
Tapani Pälli [Thu, 10 Nov 2016 08:20:26 +0000 (10:20 +0200)]
android/i965: add libmesa_i965_compiler static library

this will be shared between OpenGL and Vulkan drivers

Signed-off-by: Tapani Pälli <tapani.palli@intel.com>
Reviewed-by: Emil Velikov <emil.velikov@collabora.com>
Reviewed-by: Jason Ekstrand <jason@jlekstrand.net>
7 years agoandroid: add SPIRV_FILES to libmesa_nir
Tapani Pälli [Tue, 8 Nov 2016 10:49:18 +0000 (12:49 +0200)]
android: add SPIRV_FILES to libmesa_nir

Signed-off-by: Tapani Pälli <tapani.palli@intel.com>
Reviewed-by: Emil Velikov <emil.velikov@collabora.com>
Reviewed-by: Jason Ekstrand <jason@jlekstrand.net>
7 years agoanv: use STATIC_ASSERT instead of static_assert
Tapani Pälli [Wed, 9 Nov 2016 07:02:39 +0000 (09:02 +0200)]
anv: use STATIC_ASSERT instead of static_assert

fixes following compilation warnings on Android build:

"warning: implicit declaration of function 'static_assert' is invalid in
C99 [-Wimplicit-function-declaration]"

Signed-off-by: Tapani Pälli <tapani.palli@intel.com>
Reviewed-by: Emil Velikov <emil.velikov@collabora.com>
Reviewed-by: Jason Ekstrand <jason@jlekstrand.net>
7 years agoutil: use STATIC_ASSERT instead of static_assert
Tapani Pälli [Wed, 9 Nov 2016 06:58:12 +0000 (08:58 +0200)]
util: use STATIC_ASSERT instead of static_assert

fixes following compilation warnings on Android build:

"warning: implicit declaration of function 'static_assert' is invalid in
C99 [-Wimplicit-function-declaration]"

Signed-off-by: Tapani Pälli <tapani.palli@intel.com>
Reviewed-by: Emil Velikov <emil.velikov@collabora.com>
Reviewed-by: Jason Ekstrand <jason@jlekstrand.net>
7 years agovulkan: import latest public vulkan headers + and fix drivers.
Dave Airlie [Fri, 11 Nov 2016 01:44:10 +0000 (11:44 +1000)]
vulkan: import latest public vulkan headers + and fix drivers.

I just noticed the new vulkan headers changed a prototype,
so I've decided to import them and fix the drivers to use the
new API.

Acked-by: Jason Ekstrand <jason.ekstrand@intel.com>
Signed-off-by: Dave Airlie <airlied@redhat.com>
7 years agodocs: add news item and link release notes for 12.0.4
Emil Velikov [Fri, 11 Nov 2016 01:57:50 +0000 (01:57 +0000)]
docs: add news item and link release notes for 12.0.4

Signed-off-by: Emil Velikov <emil.velikov@collabora.com>
7 years agodocs: add sha256 checksums for 12.0.4
Emil Velikov [Fri, 11 Nov 2016 01:55:08 +0000 (01:55 +0000)]
docs: add sha256 checksums for 12.0.4

Signed-off-by: Emil Velikov <emil.velikov@collabora.com>
(cherry picked from commit 7b9d7257b27c15547ffab8d73d10d8a850af364a)

7 years agodocs: add release notes for 12.0.4
Emil Velikov [Fri, 11 Nov 2016 01:53:32 +0000 (01:53 +0000)]
docs: add release notes for 12.0.4

Signed-off-by: Emil Velikov <emil.velikov@collabora.com>
(cherry picked from commit 3776e97f9d366db8a720e2412ece6a1059999858)

7 years agoglsl: include inttypes.h for PRIx64 macro
Brian Paul [Fri, 11 Nov 2016 00:29:28 +0000 (17:29 -0700)]
glsl: include inttypes.h for PRIx64 macro

To fix MinGW build.

Reviewed-by: Roland Scheidegger <sroland@vmware.com>
7 years agoradv: fix texturesamples to handle single sample case
Dave Airlie [Thu, 10 Nov 2016 00:32:08 +0000 (10:32 +1000)]
radv: fix texturesamples to handle single sample case

We can only read the valid samples if this is an MSAA
texture, which means the type field must be 0x14 or 0x15.

This fixes:
dEQP-VK.glsl.texture_functions.query.texturesamples.*

Cc: "13.0" <mesa-stable@lists.freedesktop.org>
Reviewed-by: Bas Nieuwenhuizen <bas@basnieuwenhuizen.nl>
Signed-off-by: Dave Airlie <airlied@redhat.com>
7 years agoanv/cmd_buffer: Enable a CS stall workaround for Sky Lake gt4
Jason Ekstrand [Thu, 10 Nov 2016 22:09:08 +0000 (14:09 -0800)]
anv/cmd_buffer: Enable a CS stall workaround for Sky Lake gt4

This fixes hangs in Dota2

Reviewed-by: Kenneth Graunke <kenneth@whitecape.org>
Cc: "12.0 13.0" <mesa-stable@lists.freedesktop.org>
7 years agoanv/cmd_buffer: Take a command buffer instead of a batch in two helpers
Jason Ekstrand [Thu, 10 Nov 2016 22:08:43 +0000 (14:08 -0800)]
anv/cmd_buffer: Take a command buffer instead of a batch in two helpers

Reviewed-by: Kenneth Graunke <kenneth@whitecape.org>
Cc: "12.0 13.0" <mesa-stable@lists.freedesktop.org>
7 years agoglsl/standalone: Add the ability to generate ir_builder code
Ian Romanick [Thu, 15 Sep 2016 18:37:32 +0000 (11:37 -0700)]
glsl/standalone: Add the ability to generate ir_builder code

Signed-off-by: Ian Romanick <ian.d.romanick@intel.com>
Reviewed-by: Iago Toral Quiroga <itoral@igalia.com>
7 years agoglsl: Add a C++ code generator that uses ir_builder to rebuild a program
Ian Romanick [Thu, 15 Sep 2016 18:36:16 +0000 (11:36 -0700)]
glsl: Add a C++ code generator that uses ir_builder to rebuild a program

This is only in libstandalone currently because it will only be used in
the stand-alone compiler.

v2: Change the signature of the generated function.  The ir_factory is
created in the generator, and an availability predicate is taken as a
parameter.

Signed-off-by: Ian Romanick <ian.d.romanick@intel.com>
Reviewed-by: Iago Toral Quiroga <itoral@igalia.com>
Reviewed-by: Nicolai Hähnle <nicolai.haehnle@amd.com>
7 years agoglsl: Generate strings that are the enum names without the ir_*op_ prefix
Ian Romanick [Thu, 15 Sep 2016 18:26:28 +0000 (11:26 -0700)]
glsl: Generate strings that are the enum names without the ir_*op_ prefix

For many expressions, this is different from the printable name.  The
printable name for ir_binop_add is "+", but we want "add".  This is
needed for ir_builder_print_visitor.

Signed-off-by: Ian Romanick <ian.d.romanick@intel.com>
Reviewed-by: Iago Toral Quiroga <itoral@igalia.com>
Reviewed-by: Nicolai Hähnle <nicolai.haehnle@amd.com>
7 years agoglsl/standalone: Enable par-linking
Ian Romanick [Thu, 15 Sep 2016 18:24:12 +0000 (11:24 -0700)]
glsl/standalone: Enable par-linking

If the user did not request full linking, link the shader with the
built-in functions, inline them, and eliminate them.  Previous to this
you'd see all these calls to "dot" and "max" in the output.  This
prevented a lot of expected optimizations and cluttered the output.
This gives it some chance of being useful.

v2: Rebase on top of Ken's "built-ins now" work.

v3: Don't do_common_optimizations if par-linking fails.  Update expected
output of warnings tests to prevent 'make check' regressions.

v4: Optimize harder.  Most important, do function inlining.  Otherwise
it's quite impractical for one function in a file to call another
function in the same file.

v5: Add some code simplifications and an assertion suggested by Iago.

Signed-off-by: Ian Romanick <ian.d.romanick@intel.com>
Reviewed-by: Iago Toral Quiroga <itoral@igalia.com>
7 years agoglsl/standalone: Optimize dead variable declarations
Ian Romanick [Thu, 15 Sep 2016 18:18:35 +0000 (11:18 -0700)]
glsl/standalone: Optimize dead variable declarations

We didn't bother with this in the regular compiler because it doesn't
change the generated code.  In the stand-alone compiler, this can
clutter the output with useless variables.  It's especially bad after
functions are inlined but the foo_retval declarations remain.

v2: Use set_foreach.  Suggested by Tapani.

Signed-off-by: Ian Romanick <ian.d.romanick@intel.com>
Reviewed-by: Tapani Pälli <tapani.palli@intel.com>
Reviewed-by: Iago Toral Quiroga <itoral@igalia.com>
7 years agoglsl/standalone: Optimize add-of-neg to subtract
Ian Romanick [Wed, 14 Sep 2016 20:52:42 +0000 (13:52 -0700)]
glsl/standalone: Optimize add-of-neg to subtract

This just makes the output of the standalone compiler a little more
compact.

v2: Fix indexing typo noticed by Iago.  Move the add_neg_to_sub_visitor
to it's own header file.  Add a unit test that exercises the visitor.
Both the neg_a_plus_b and neg_a_plus_neg_b tests reproduced the bug that
Iago discovered.

Signed-off-by: Ian Romanick <ian.d.romanick@intel.com>
Reviewed-by: Nicolai Hähnle <nicolai.haehnle@amd.com>
7 years agoglsl/linker: Allow link_intrastage_shaders when there is no main()
Ian Romanick [Thu, 15 Sep 2016 18:09:34 +0000 (11:09 -0700)]
glsl/linker: Allow link_intrastage_shaders when there is no main()

This enables a sort of par-linking.  The primary use for this feature is
resolving built-in functions in the stand-alone compiler.

Signed-off-by: Ian Romanick <ian.d.romanick@intel.com>
Reviewed-by: Iago Toral Quiroga <itoral@igalia.com>
7 years agonir: update nir_gather_info to only mark used array/matrix elements
Timothy Arceri [Thu, 27 Oct 2016 01:21:52 +0000 (12:21 +1100)]
nir: update nir_gather_info to only mark used array/matrix elements

This is based on the code from the GLSL IR pass however unlike the GLSL IR
pass it also supports arrays of arrays.

As well as implementing the logic from the GLSL IR pass we add some
additional intrinsic cases to catch more system values.

Reviewed-by: Kenneth Graunke <kenneth@whitecape.org>
7 years agomesa/compiler: move MAX_VARYING to shader_enums.h
Kenneth Graunke [Wed, 2 Mar 2016 01:41:02 +0000 (17:41 -0800)]
mesa/compiler: move MAX_VARYING to shader_enums.h

Reviewed-by: Timothy Arceri <timothy.arceri@collabora.com>
7 years agonir: add more helpers to nir_types.cpp
Timothy Arceri [Tue, 25 Oct 2016 06:04:31 +0000 (17:04 +1100)]
nir: add more helpers to nir_types.cpp

These new helpers will be used in nir_gather_info.c in a following patch.

Reviewed-by: Kenneth Graunke <kenneth@whitecape.org>
7 years agonir: Generalize the "is per-vertex variable?" helpers and export them.
Kenneth Graunke [Mon, 26 Sep 2016 05:19:07 +0000 (22:19 -0700)]
nir: Generalize the "is per-vertex variable?" helpers and export them.

I want this function for nir_gather_info(), and realized it's basically
the same as the ones in nir_lower_io().

Signed-off-by: Kenneth Graunke <kenneth@whitecape.org>
Reviewed-by: Timothy Arceri <timothy.arceri@collabora.com>
7 years agonvc0: support MP performance counters on Maxwell
Samuel Pitoiset [Sat, 5 Nov 2016 16:23:33 +0000 (17:23 +0100)]
nvc0: support MP performance counters on Maxwell

This adds some performance counters/metrics for SM50/SM52.

Signed-off-by: Samuel Pitoiset <samuel.pitoiset@gmail.com>
Tested-by: Pierre Moreau <pierre.morrow@free.fr>
7 years agogallium: detect avx512 cpu features
Tim Rowley [Thu, 26 May 2016 20:06:07 +0000 (15:06 -0500)]
gallium: detect avx512 cpu features

v3: fix check for xmm/ymm test
v2: style code, add avx512 to cpu dump

Reviewed-by: Roland Scheidegger <sroland@vmware.com>
7 years agoglsl: Parse 0 as a preprocessor INTCONSTANT
Ian Romanick [Tue, 8 Nov 2016 19:14:49 +0000 (11:14 -0800)]
glsl: Parse 0 as a preprocessor INTCONSTANT

This allows a more reasonable error message for '#version 0' of

    0:1(10): error: GLSL 0.00 is not supported. Supported versions are: 1.10, 1.20, 1.30, 1.00 ES, 3.00 ES, 3.10 ES, and 3.20 ES

instead of

    0:1(10): error: syntax error, unexpected $undefined, expecting INTCONSTANT

Signed-off-by: Ian Romanick <ian.d.romanick@intel.com>
Bugzilla: https://bugs.freedesktop.org/show_bug.cgi?id=97420
Reviewed-by: Nicolai Hähnle <nicolai.haehnle@amd.com>
Cc: mesa-stable@lists.freedesktop.org
Cc: Juan A. Suarez Romero <jasuarez@igalia.com>
Cc: Karol Herbst <karolherbst@gmail.com>
7 years agoglcpp: Handle '#version 0' and other invalid values
Ian Romanick [Tue, 8 Nov 2016 19:06:05 +0000 (11:06 -0800)]
glcpp: Handle '#version 0' and other invalid values

The #version directive can only handle decimal constants.  Enforce that
the value is a decimal constant.

Section 3.3 (Preprocessor) of the GLSL 4.50 spec says:

    The language version a shader is written to is specified by

        #version number profile opt

    where number must be a version of the language, following the same
    convention as __VERSION__ above.

The same section also says:

    __VERSION__ will substitute a decimal integer reflecting the version
    number of the OpenGL shading language.

Use a separate flag to track whether or not the #version line has been
encountered.  Any possible sentinel (0 is currently used) could be
specified in a #version directive.  This would lead to trying to
(internally) redefine __VERSION__.  Since there is no parser location
for this addition, NULL is passed.  This eventually results in a NULL
dereference and a segfault.

Attempts to use -1 as the sentinel would also fail if '#version
4294967295' or '#version 18446744073709551615' were used.  We should
have piglit tests for both of these.

Signed-off-by: Ian Romanick <ian.d.romanick@intel.com>
Bugzilla: https://bugs.freedesktop.org/show_bug.cgi?id=97420
Reviewed-by: Nicolai Hähnle <nicolai.haehnle@amd.com>
Cc: mesa-stable@lists.freedesktop.org
Cc: Juan A. Suarez Romero <jasuarez@igalia.com>
Cc: Karol Herbst <karolherbst@gmail.com>
7 years agolinker: Remove unnecessary overload of program_resource_visitor::visit_field
Ian Romanick [Wed, 9 Nov 2016 20:45:39 +0000 (12:45 -0800)]
linker: Remove unnecessary overload of program_resource_visitor::visit_field

It looks like I added this version as a short-hand for users that didn't
need the fuller version.  I don't think there's any real utility in
that.  I'm not sure what my thinking was there.  Maybe if those users
overloaded the recursion function could just call the compact version to
avoid passing some parameters?  None of the users do that.

Either way, having this extra overload is not useful.  Delete it.

Signed-off-by: Ian Romanick <ian.d.romanick@intel.com>
Reviewed-by: Tapani Pälli <tapani.palli@intel.com>
7 years agoradv: automake: list correct file in the EXTRA_DIST
Emil Velikov [Thu, 10 Nov 2016 18:50:13 +0000 (18:50 +0000)]
radv: automake: list correct file in the EXTRA_DIST

Earlier commit renamed the file radeon_icd.json{,.in} but missed one
reference of the file - in EXTRA_DIST.

Cc: "13.0" <mesa-stable@lists.freedesktop.org>
Fixes: 0f434a68a ("radv: Suffix the radeon_icd file with the host CPU")
Signed-off-by: Emil Velikov <emil.velikov@collabora.com>
7 years agomesa: remove LowerShaderSharedVariables
Marek Olšák [Wed, 9 Nov 2016 12:04:09 +0000 (13:04 +0100)]
mesa: remove LowerShaderSharedVariables

always true for compute shaders

Reviewed-by: Kenneth Graunke <kenneth@whitecape.org>
7 years agoglsl: handle partial swizzles in opt_dead_code_local correctly
Marek Olšák [Mon, 7 Nov 2016 21:56:21 +0000 (22:56 +0100)]
glsl: handle partial swizzles in opt_dead_code_local correctly

Reviewed-by: Kenneth Graunke <kenneth@whitecape.org>