platform/upstream/mesa.git
8 years agoglsl: Don't copy propagate or tree graft precise values.
Kenneth Graunke [Sun, 3 Apr 2016 09:02:12 +0000 (02:02 -0700)]
glsl: Don't copy propagate or tree graft precise values.

This is kind of a hack.  We currently track precise requirements
by decorating ir_variables.  Propagating or grafting the RHS of an
assignment to a precise value into some other expression tree can
lose those decorations.

In the long run, it might be better to replace these ir_variable
decorations with an "exact" decoration on ir_expression nodes,
similar to what NIR does.

In the short run, this is probably good enough.  It preserves
enough information for glsl_to_nir to generate "exact" decorations,
and NIR will then handle optimizing these expressions reasonably.

Fixes ES31-CTS.gpu_shader5.precise_qualifier.

v2: Drop invariant handling, as it shouldn't be necessary (caught
    by Jason Ekstrand).

Signed-off-by: Kenneth Graunke <kenneth@whitecape.org>
Reviewed-by: Jason Ekstrand <jason@jlekstrand.net>
8 years agoi965/tiled_memcpy: Fix rgba8_copy_16_aligned_dst() typo
Kristian Høgsberg Kristensen [Tue, 12 Apr 2016 22:23:17 +0000 (15:23 -0700)]
i965/tiled_memcpy: Fix rgba8_copy_16_aligned_dst() typo

Copy and paste error in commit eafeb8db66dae7619ff3cb039706b990d718cba7:

    i965/tiled_memcpy: Unroll bytes==64 case.

Signed-off-by: Kristian Høgsberg Kristensen <kristian.h.kristensen@intel.com>
Reviewed-by: Matt Turner <mattst88@gmail.com>
8 years agoglsl/linker: Recurse on struct fields when adding shader variables
Kristian Høgsberg Kristensen [Mon, 11 Apr 2016 21:28:18 +0000 (14:28 -0700)]
glsl/linker: Recurse on struct fields when adding shader variables

ARB_program_interface_query requires that we add struct fields
recursively down to basic types.

Fixes 52 struct test cases in dEQP-GLES31.functional.program_interface_query.*

Signed-off-by: Kristian Høgsberg Kristensen <kristian.h.kristensen@intel.com>
Reviewed-by: Kenneth Graunke <kenneth@whitecape.org>
8 years agoglsl/linker: Pass name and type through to create_shader_variable()
Kristian Høgsberg Kristensen [Mon, 11 Apr 2016 20:06:07 +0000 (13:06 -0700)]
glsl/linker: Pass name and type through to create_shader_variable()

No functional change here, but this now lets us recurse throught structs
in add_shader_variable().

Signed-off-by: Kristian Høgsberg Kristensen <kristian.h.kristensen@intel.com>
Reviewed-by: Kenneth Graunke <kenneth@whitecape.org>
8 years agoglsl/linker: Pass absolute location to add_shader_variable()
Kristian Høgsberg Kristensen [Mon, 11 Apr 2016 20:03:12 +0000 (13:03 -0700)]
glsl/linker: Pass absolute location to add_shader_variable()

This lets us pass in the absolution location of a variable instead of
computing it in add_shader_variable() based on variable location and
bias. This is in preparation for recursing into struct variables.

Signed-off-by: Kristian Høgsberg Kristensen <kristian.h.kristensen@intel.com>
Reviewed-by: Kenneth Graunke <kenneth@whitecape.org>
8 years agoglsl/linker: Add add_shader_variable() helper
Kristian Høgsberg Kristensen [Mon, 11 Apr 2016 19:57:41 +0000 (12:57 -0700)]
glsl/linker: Add add_shader_variable() helper

This consolidates the combination of create_shader_variable() and
add_program_resource() into a new helper function. No functional
difference, but we'll expand add_shader_variable() in the next few
commits.

Signed-off-by: Kristian Høgsberg Kristensen <kristian.h.kristensen@intel.com>
Reviewed-by: Kenneth Graunke <kenneth@whitecape.org>
8 years agoi965/tiled_memcpy: Unroll bytes==64 case.
Matt Turner [Mon, 11 Apr 2016 18:59:59 +0000 (11:59 -0700)]
i965/tiled_memcpy: Unroll bytes==64 case.

Reviewed-by: Roland Scheidegger <sroland@vmware.com>
8 years agoi965/tiled_memcpy: Provide SSE2 for RGBA8 <-> BGRA8 swizzle.
Roland Scheidegger [Fri, 29 Jan 2016 02:18:36 +0000 (03:18 +0100)]
i965/tiled_memcpy: Provide SSE2 for RGBA8 <-> BGRA8 swizzle.

The existing code uses SSSE3, and because it isn't compiled in a
separate file compiled with that, it is usually not used (that, of
course, could be fixed...), whereas SSE2 is always present with 64-bit
builds.  This should be pretty much as fast as the pshufb version,
albeit those code paths aren't really used on chips without llc in any
case.

v2: fix andnot argument order, add comments
v3: use pshuflw/hw instead of shifts (suggested by Matt Turner), cut comments
v4: [mattst88] Rebase

Reviewed-by: Matt Turner <mattst88@gmail.com>
8 years agoi965/tiled_memcpy: Move SSSE3 code back into inline functions.
Matt Turner [Mon, 11 Apr 2016 18:47:21 +0000 (11:47 -0700)]
i965/tiled_memcpy: Move SSSE3 code back into inline functions.

This will make adding SSE2 code a lot cleaner.

Reviewed-by: Roland Scheidegger <sroland@vmware.com>
8 years agoi965/tiled_memcpy: Optimize RGBA -> BGRA swizzle.
Matt Turner [Fri, 8 Apr 2016 22:30:30 +0000 (15:30 -0700)]
i965/tiled_memcpy: Optimize RGBA -> BGRA swizzle.

Replaces four byte loads and four byte stores with a load, bswap,
rotate, store; or a movbe, rotate, store.

Reviewed-by: Roland Scheidegger <sroland@vmware.com>
8 years agoradeonsi: fix bounds check in si_create_vertex_elements
Nicolai Hähnle [Tue, 12 Apr 2016 17:23:31 +0000 (12:23 -0500)]
radeonsi: fix bounds check in si_create_vertex_elements

This was triggered by
dEQP-GLES3.functional.vertex_array_objects.all_attributes

Cc: "11.1 11.2" <mesa-stable@lists.freedesktop.org>
Reviewed-by: Bas Nieuwenhuizen <bas@basnieuwenhuizen.nl>
Reviewed-by: Marek Olšák <marek.olsak@amd.com>
8 years agodocs: mark atomic counters and SSBOs as done for radeonsi
Nicolai Hähnle [Mon, 21 Mar 2016 22:31:15 +0000 (17:31 -0500)]
docs: mark atomic counters and SSBOs as done for radeonsi

Reviewed-by: Marek Olšák <marek.olsak@amd.com>
Reviewed-by: Edward O'Callaghan <eocallaghan@alterapraxis.com>
8 years agoradeonsi: enable shader buffer pipe caps
Nicolai Hähnle [Tue, 15 Mar 2016 21:25:42 +0000 (16:25 -0500)]
radeonsi: enable shader buffer pipe caps

Reviewed-by: Marek Olšák <marek.olsak@amd.com>
Reviewed-by: Edward O'Callaghan <eocallaghan@alterapraxis.com>
8 years agoradeonsi: add shader buffer support to TGSI_OPCODE_RESQ
Nicolai Hähnle [Wed, 16 Mar 2016 23:03:19 +0000 (18:03 -0500)]
radeonsi: add shader buffer support to TGSI_OPCODE_RESQ

Reviewed-by: Marek Olšák <marek.olsak@amd.com>
Reviewed-by: Edward O'Callaghan <eocallaghan@alterapraxis.com>
8 years agoradeonsi: add shader buffer support to TGSI_OPCODE_STORE
Nicolai Hähnle [Wed, 16 Mar 2016 22:03:02 +0000 (17:03 -0500)]
radeonsi: add shader buffer support to TGSI_OPCODE_STORE

Reviewed-by: Marek Olšák <marek.olsak@amd.com>
Reviewed-by: Edward O'Callaghan <eocallaghan@alterapraxis.com>
8 years agoradeonsi: add shader buffer support to TGSI_OPCODE_LOAD
Nicolai Hähnle [Wed, 16 Mar 2016 00:11:38 +0000 (19:11 -0500)]
radeonsi: add shader buffer support to TGSI_OPCODE_LOAD

Reviewed-by: Marek Olšák <marek.olsak@amd.com>
Reviewed-by: Edward O'Callaghan <eocallaghan@alterapraxis.com>
8 years agoradeonsi: add shader buffer support to TGSI_OPCODE_ATOM*
Nicolai Hähnle [Wed, 16 Mar 2016 00:02:38 +0000 (19:02 -0500)]
radeonsi: add shader buffer support to TGSI_OPCODE_ATOM*

Reviewed-by: Marek Olšák <marek.olsak@amd.com>
Reviewed-by: Edward O'Callaghan <eocallaghan@alterapraxis.com>
8 years agoradeonsi: add offset parameter to buffer_append_args
Nicolai Hähnle [Wed, 16 Mar 2016 00:00:11 +0000 (19:00 -0500)]
radeonsi: add offset parameter to buffer_append_args

Reviewed-by: Marek Olšák <marek.olsak@amd.com>
Reviewed-by: Edward O'Callaghan <eocallaghan@alterapraxis.com>
8 years agoradeonsi: adjust buffer_append_args to take a 128 bit resource
Nicolai Hähnle [Tue, 15 Mar 2016 23:47:14 +0000 (18:47 -0500)]
radeonsi: adjust buffer_append_args to take a 128 bit resource

Move the buffer resource extraction code out into its own function.

Reviewed-by: Marek Olšák <marek.olsak@amd.com>
Reviewed-by: Edward O'Callaghan <eocallaghan@alterapraxis.com>
8 years agoradeonsi: preload shader buffers in shaders
Nicolai Hähnle [Tue, 15 Mar 2016 23:34:52 +0000 (18:34 -0500)]
radeonsi: preload shader buffers in shaders

Reviewed-by: Marek Olšák <marek.olsak@amd.com>
Reviewed-by: Edward O'Callaghan <eocallaghan@alterapraxis.com>
8 years agoradeonsi: implement set_shader_buffers
Nicolai Hähnle [Tue, 15 Mar 2016 21:30:56 +0000 (16:30 -0500)]
radeonsi: implement set_shader_buffers

Reviewed-by: Marek Olšák <marek.olsak@amd.com>
Reviewed-by: Edward O'Callaghan <eocallaghan@alterapraxis.com>
8 years agoradeonsi: move resetting of constant buffers into a separate function
Nicolai Hähnle [Wed, 16 Mar 2016 22:42:57 +0000 (17:42 -0500)]
radeonsi: move resetting of constant buffers into a separate function

This will be re-used for shader buffers.

Reviewed-by: Marek Olšák <marek.olsak@amd.com>
Reviewed-by: Edward O'Callaghan <eocallaghan@alterapraxis.com>
8 years agodri/i965: fix incorrect rgbFormat in intelCreateBuffer().
Haixia Shi [Thu, 7 Apr 2016 18:05:09 +0000 (11:05 -0700)]
dri/i965: fix incorrect rgbFormat in intelCreateBuffer().

It is incorrect to assume that pixel format is always in BGR byte order.
We need to check bitmask parameters (such as |redMask|) to determine whether
the RGB or BGR byte order is requested.

v2: reformat code to stay within 80 character per line limit.
v3: just fix the byte order problem first and investigate SRGB later.
v4: rebased on top of the GLES3 sRGB workaround fix.
v5: rebased on top of the GLES3 sRGB workaround fix v2.

Signed-off-by: Haixia Shi <hshi@chromium.org>
Reviewed-by: Stéphane Marchesin <marcheu@chromium.org>
Reviewed-by: Kenneth Graunke <kenneth@whitecape.org>
8 years agoglsl: Reject illegal qualifiers on atomic counter uniforms.
Kenneth Graunke [Mon, 11 Apr 2016 05:50:05 +0000 (22:50 -0700)]
glsl: Reject illegal qualifiers on atomic counter uniforms.

This fixes

dEQP-GLES31.functional.uniform_location.negative.atomic_fragment
dEQP-GLES31.functional.uniform_location.negative.atomic_vertex

Both of which have lines like

layout(location = 3, binding = 0, offset = 0) uniform atomic_uint uni0;

The ARB_explicit_uniform_location spec makes a very tangential mention
regarding atomic counters, but location isn't something that makes sense
with them.

Signed-off-by: Ilia Mirkin <imirkin@alum.mit.edu>
Signed-off-by: Kenneth Graunke <kenneth@whitecape.org>
Reviewed-by: Timothy Arceri <timothy.arceri@collabora.com>
8 years agoglsl: Add a method to print error messages for illegal qualifiers.
Kenneth Graunke [Mon, 11 Apr 2016 05:41:46 +0000 (22:41 -0700)]
glsl: Add a method to print error messages for illegal qualifiers.

Suggested by Timothy Arceri a while back on mesa-dev:
https://lists.freedesktop.org/archives/mesa-dev/2016-February/107735.html

Signed-off-by: Kenneth Graunke <kenneth@whitecape.org>
Reviewed-by: Timothy Arceri <timothy.arceri@collabora.com>
Acked-by: Matt Turner <mattst88@gmail.com>
8 years agoxlib: fix memory leak on Display close
John Sheu [Tue, 12 Apr 2016 18:53:00 +0000 (12:53 -0600)]
xlib: fix memory leak on Display close

The XMesaVisual instances freed in the visuals table on display close
are being freed with a free() call, instead of XMesaDestroyVisual(),
causing a memory leak.

Signed-off-by: John Sheu <sheu@google.com>
Reviewed-by: Brian Paul <brianp@vmware.com>
8 years agost/mesa: Replace GLvoid with void
Jakob Sinclair [Tue, 12 Apr 2016 18:48:18 +0000 (20:48 +0200)]
st/mesa: Replace GLvoid with void

GLvoid was used before in OpenGL but it has changed to just using void.
All GLvoids in mesa's state tracker has been changed to void in this patch.

Tested this with piglit and no problems were found. No compiler warnings.

Signed-off-by: Jakob Sinclair <sinclair.jakob@openmailbox.org>
Reviewed-by: Brian Paul <brianp@vmware.com>
8 years agoradeonsi: Mark ARB_robust_buffer_access_behavior as supported.
Bas Nieuwenhuizen [Sun, 3 Apr 2016 19:49:44 +0000 (21:49 +0200)]
radeonsi: Mark ARB_robust_buffer_access_behavior as supported.

Signed-off-by: Bas Nieuwenhuizen <bas@basnieuwenhuizen.nl>
Reviewed-by: Marek Olšák <marek.olsak@amd.com>
8 years agogallium: Add capability for ARB_robust_buffer_access_behavior.
Bas Nieuwenhuizen [Tue, 12 Apr 2016 13:00:31 +0000 (15:00 +0200)]
gallium: Add capability for ARB_robust_buffer_access_behavior.

Signed-off-by: Bas Nieuwenhuizen <bas@basnieuwenhuizen.nl>
Reviewed-by: Marek Olšák <marek.olsak@amd.com>
Reviewed-by: Roland Scheidegger <sroland@vmware.com>
8 years agomesa: Expose the ARB_robust_buffer_access_behavior extension.
Bas Nieuwenhuizen [Tue, 12 Apr 2016 12:57:07 +0000 (14:57 +0200)]
mesa: Expose the ARB_robust_buffer_access_behavior extension.

Signed-off-by: Bas Nieuwenhuizen <bas@basnieuwenhuizen.nl>
Reviewed-by: Marek Olšák <marek.olsak@amd.com>
8 years agomain: rework the compatibility check of visuals in glXMakeCurrent
Miklós Máté [Thu, 24 Mar 2016 00:12:59 +0000 (01:12 +0100)]
main: rework the compatibility check of visuals in glXMakeCurrent

Now it follows the compatibility criteria listed in section 2.1 of
the GLX 1.4 specification.
This is needed for post-process effects in SW:KotOR.

Signed-off-by: Miklós Máté <mtmkls@gmail.com>
Signed-off-by: Marek Olšák <marek.olsak@amd.com>
8 years agoswr: [rasterizer core] warning cleanup
Tim Rowley [Fri, 1 Apr 2016 21:52:34 +0000 (15:52 -0600)]
swr: [rasterizer core] warning cleanup

Acked-by: Brian Paul <brianp@vmware.com>
8 years agoswr: [rasterizer] Put in rudimentary garbage collection for the global arena allocator
Tim Rowley [Thu, 31 Mar 2016 01:24:32 +0000 (19:24 -0600)]
swr: [rasterizer] Put in rudimentary garbage collection for the global arena allocator

- Check for unused blocks every few frames or every 64K draws
- Delete data unused since the last check if total unused data is > 20MB

Doesn't seem to cause a perf degridation

Acked-by: Brian Paul <brianp@vmware.com>
8 years agoswr: [rasterizer core] Put DRAW_CONTEXT on a diet
Tim Rowley [Wed, 30 Mar 2016 21:54:48 +0000 (15:54 -0600)]
swr: [rasterizer core] Put DRAW_CONTEXT on a diet

No need for 256 pointers per DC.

Acked-by: Brian Paul <brianp@vmware.com>
8 years agoswr: [rasterizer core] Add experimental support for hyper-threaded front-end
Tim Rowley [Wed, 30 Mar 2016 20:59:40 +0000 (14:59 -0600)]
swr: [rasterizer core] Add experimental support for hyper-threaded front-end

Acked-by: Brian Paul <brianp@vmware.com>
8 years agoswr: [rasterizer] Avoid segv in thread creation on machines with non-consecutive...
Tim Rowley [Wed, 30 Mar 2016 18:32:41 +0000 (12:32 -0600)]
swr: [rasterizer] Avoid segv in thread creation on machines with non-consecutive NUMA topology.

Acked-by: Brian Paul <brianp@vmware.com>
8 years agoswr: [rasterizer core] Replace all naked OSALIGN macro uses with OSALIGNSIMD / OSALIG...
Tim Rowley [Tue, 29 Mar 2016 17:56:04 +0000 (11:56 -0600)]
swr: [rasterizer core] Replace all naked OSALIGN macro uses with OSALIGNSIMD / OSALIGNLINE

Future proofing

Acked-by: Brian Paul <brianp@vmware.com>
8 years agoswr: [rasterizer] Ensure correct alignment of stack variables used as vectors
Tim Rowley [Tue, 29 Mar 2016 16:58:43 +0000 (10:58 -0600)]
swr: [rasterizer] Ensure correct alignment of stack variables used as vectors

Acked-by: Brian Paul <brianp@vmware.com>
8 years agoswr: [rasterizer core] Quantize depth to depth buffer precision prior to depth test...
Tim Rowley [Fri, 25 Mar 2016 23:24:45 +0000 (17:24 -0600)]
swr: [rasterizer core] Quantize depth to depth buffer precision prior to depth test/write.

Fixes z-fighting issues.

Acked-by: Brian Paul <brianp@vmware.com>
8 years agoswr: [rasterizer common] win32 build fixups
Tim Rowley [Thu, 24 Mar 2016 23:48:57 +0000 (17:48 -0600)]
swr: [rasterizer common] win32 build fixups

Acked-by: Brian Paul <brianp@vmware.com>
8 years agoswr: [rasterizer core] Affinitize thread scratch space to numa node of worker
Tim Rowley [Thu, 24 Mar 2016 22:20:02 +0000 (16:20 -0600)]
swr: [rasterizer core] Affinitize thread scratch space to numa node of worker

Acked-by: Brian Paul <brianp@vmware.com>
8 years agoswr: [rasterizer] Misc fixes identified by static code analysis
Tim Rowley [Thu, 24 Mar 2016 21:52:11 +0000 (15:52 -0600)]
swr: [rasterizer] Misc fixes identified by static code analysis

No perf loss detected

Acked-by: Brian Paul <brianp@vmware.com>
8 years agost/mesa: fix memleak in glDrawPixels cache code
Brian Paul [Tue, 12 Apr 2016 00:54:28 +0000 (18:54 -0600)]
st/mesa: fix memleak in glDrawPixels cache code

If the glDrawPixels size changed, we leaked the previously cached
texture, if there was one.  This patch fixes the reference counting,
adds a refcount assertion check, and better handles potential malloc()
failures.

Tested with a modified version of the drawpix Mesa demo which changed
the image size for each glDrawPixels call.

Cc: "11.2" <mesa-stable@lists.freedesktop.org>
Reviewed-by: José Fonseca <jfonseca@vmware.com>
Reviewed-by: Charmaine Lee <charmainel@vmware.com>
8 years agogallium: Use STATIC_ASSERT whenever possible.
Jose Fonseca [Tue, 12 Apr 2016 06:36:06 +0000 (07:36 +0100)]
gallium: Use STATIC_ASSERT whenever possible.

Reviewed-by: Eric Engestrom <eric.engestrom@imgtec.com>
Reviewed-by: Roland Scheidegger <sroland@vmware.com>
8 years agosoftpipe: Use STATIC_ASSERT whenever possible.
Jose Fonseca [Tue, 12 Apr 2016 06:35:38 +0000 (07:35 +0100)]
softpipe: Use STATIC_ASSERT whenever possible.

Reviewed-by: Eric Engestrom <eric.engestrom@imgtec.com>
Reviewed-by: Roland Scheidegger <sroland@vmware.com>
8 years agosvga: Use STATIC_ASSERT whenever possible.
Jose Fonseca [Tue, 12 Apr 2016 06:35:23 +0000 (07:35 +0100)]
svga: Use STATIC_ASSERT whenever possible.

Reviewed-by: Eric Engestrom <eric.engestrom@imgtec.com>
Reviewed-by: Roland Scheidegger <sroland@vmware.com>
8 years agomesa: Use STATIC_ASSERT whenever possible.
Jose Fonseca [Tue, 12 Apr 2016 06:35:08 +0000 (07:35 +0100)]
mesa: Use STATIC_ASSERT whenever possible.

Reviewed-by: Eric Engestrom <eric.engestrom@imgtec.com>
Reviewed-by: Roland Scheidegger <sroland@vmware.com>
8 years agor600g: use common scissor and viewport code
Marek Olšák [Sun, 10 Apr 2016 02:56:46 +0000 (04:56 +0200)]
r600g: use common scissor and viewport code

It's the same as radeonsi. This adds guard band support to r600g.

Reviewed-by: Edward O'Callaghan <eocallaghan@alterapraxis.com>
Reviewed-by: Grigori Goronzy <greg@chown.ath.cx>
Reviewed-by: Nicolai Hähnle <nicolai.haehnle@amd.com>
8 years agogallium/radeon: add R600/Evergreen/Cayman support to common viewport code
Marek Olšák [Sun, 10 Apr 2016 10:53:12 +0000 (12:53 +0200)]
gallium/radeon: add R600/Evergreen/Cayman support to common viewport code

Reviewed-by: Edward O'Callaghan <eocallaghan@alterapraxis.com>
Reviewed-by: Grigori Goronzy <greg@chown.ath.cx>
Reviewed-by: Nicolai Hähnle <nicolai.haehnle@amd.com>
8 years agoradeonsi: move scissor and viewport states into gallium/radeon
Marek Olšák [Sun, 10 Apr 2016 02:26:50 +0000 (04:26 +0200)]
radeonsi: move scissor and viewport states into gallium/radeon

Reviewed-by: Edward O'Callaghan <eocallaghan@alterapraxis.com>
Reviewed-by: Grigori Goronzy <greg@chown.ath.cx>
Reviewed-by: Nicolai Hähnle <nicolai.haehnle@amd.com>
8 years agoradeonsi: use guard band clipping
Marek Olšák [Sun, 10 Apr 2016 01:38:09 +0000 (03:38 +0200)]
radeonsi: use guard band clipping

Guard band clipping speeds up rasterization for primitives that are
partially off-screen.  This change in particular results in small
framerate improvements in a wide range of games.

Started by Grigori Goronzy <greg@chown.ath.cx>.

Reviewed-by: Edward O'Callaghan <eocallaghan@alterapraxis.com>
Reviewed-by: Grigori Goronzy <greg@chown.ath.cx>
Reviewed-by: Nicolai Hähnle <nicolai.haehnle@amd.com>
8 years agoradeonsi: compute scissor from viewport in set_viewport_states
Marek Olšák [Sun, 10 Apr 2016 01:29:57 +0000 (03:29 +0200)]
radeonsi: compute scissor from viewport in set_viewport_states

and clamp it right before emitting. This is a prerequisite for computing
the guard band.

Reviewed-by: Edward O'Callaghan <eocallaghan@alterapraxis.com>
Reviewed-by: Grigori Goronzy <greg@chown.ath.cx>
Reviewed-by: Nicolai Hähnle <nicolai.haehnle@amd.com>
8 years agogallium/radeon: set GTT WC on tiled textures
Marek Olšák [Mon, 11 Apr 2016 18:24:34 +0000 (20:24 +0200)]
gallium/radeon: set GTT WC on tiled textures

Just for consistency. This should have no effect, because OpenGL textures
always go to VRAM.

Reviewed-by: Alex Deucher <alexander.deucher@amd.com>
Reviewed-by: Edward O'Callaghan <eocallaghan@alterapraxis.com>
8 years agogallium/radeon: relax requirements on VRAM placements on APUs
Marek Olšák [Mon, 11 Apr 2016 17:56:07 +0000 (19:56 +0200)]
gallium/radeon: relax requirements on VRAM placements on APUs

This makes Tonga with vramlimit=128 2x faster in Heaven.

Reviewed-by: Alex Deucher <alexander.deucher@amd.com>
Reviewed-by: Edward O'Callaghan <eocallaghan@alterapraxis.com>
8 years agowinsys/amdgpu: remove hack for low VRAM configuration
Marek Olšák [Mon, 11 Apr 2016 17:26:03 +0000 (19:26 +0200)]
winsys/amdgpu: remove hack for low VRAM configuration

A better solution will be used.

Reviewed-by: Alex Deucher <alexander.deucher@amd.com>
Reviewed-by: Edward O'Callaghan <eocallaghan@alterapraxis.com>
8 years agor600g: disable aniso filtering for non-mipmap textures on EG
Marek Olšák [Thu, 7 Apr 2016 19:18:14 +0000 (21:18 +0200)]
r600g: disable aniso filtering for non-mipmap textures on EG

this is the default behavior of the closed driver when running on VI

Reviewed-by: Nicolai Hähnle <nicolai.haehnle@amd.com>
8 years agor600g: clean up aniso state translation
Marek Olšák [Fri, 8 Apr 2016 00:09:59 +0000 (02:09 +0200)]
r600g: clean up aniso state translation

Reviewed-by: Nicolai Hähnle <nicolai.haehnle@amd.com>
8 years agoradeonsi: disable aniso filtering for non-mipmap textures on SI-CI
Marek Olšák [Thu, 7 Apr 2016 19:37:43 +0000 (21:37 +0200)]
radeonsi: disable aniso filtering for non-mipmap textures on SI-CI

The closed driver does this, but it looks at base_level and last_level
and uses a conditional assignment, which LLVM can't generate on SGPRs.

That led me to invent this solution that abuses the image descriptor.

Reviewed-by: Nicolai Hähnle <nicolai.haehnle@amd.com>
8 years agoradeonsi: clean up aniso state translation
Marek Olšák [Fri, 8 Apr 2016 00:08:23 +0000 (02:08 +0200)]
radeonsi: clean up aniso state translation

Reviewed-by: Nicolai Hähnle <nicolai.haehnle@amd.com>
8 years agoradeonsi: enable some sampler fields to match the closed driver
Marek Olšák [Thu, 7 Apr 2016 15:02:51 +0000 (17:02 +0200)]
radeonsi: enable some sampler fields to match the closed driver

copied from the Vulkan driver

Reviewed-by: Nicolai Hähnle <nicolai.haehnle@amd.com>
8 years agogallium/radeon: fix maximum texture anisotropy setup
Marek Olšák [Thu, 7 Apr 2016 13:34:45 +0000 (15:34 +0200)]
gallium/radeon: fix maximum texture anisotropy setup

We were overdoing it for non-power-of-two values.

Reviewed-by: Nicolai Hähnle <nicolai.haehnle@amd.com>
8 years agogallium/radeon: never choose a linear tiling for DB surfaces
Marek Olšák [Sun, 10 Apr 2016 20:48:48 +0000 (22:48 +0200)]
gallium/radeon: never choose a linear tiling for DB surfaces

Just for consistency. This is actually not a problem, because both addrlib
and radeon check and fix this.

Reviewed-by: Nicolai Hähnle <nicolai.haehnle@amd.com>
8 years agogallium/radeon: removing dead code for sharing stencil buffers
Marek Olšák [Sun, 10 Apr 2016 20:39:54 +0000 (22:39 +0200)]
gallium/radeon: removing dead code for sharing stencil buffers

This is a remnant of the times when the DDX was allocating depth-stencil
buffers for windows. Now, st/dri allocates them and doesn't share them.

Reviewed-by: Nicolai Hähnle <nicolai.haehnle@amd.com>
8 years agoradeonsi: allow clearing buffers >= 4 GB
Marek Olšák [Sun, 10 Apr 2016 15:21:19 +0000 (17:21 +0200)]
radeonsi: allow clearing buffers >= 4 GB

Only CMASK and DCC clears can use this, because only textures can be so
large.

Reviewed-by: Nicolai Hähnle <nicolai.haehnle@amd.com>
8 years agogallium/radeon: allow allocating textures >= 4 GB
Marek Olšák [Sun, 10 Apr 2016 15:14:49 +0000 (17:14 +0200)]
gallium/radeon: allow allocating textures >= 4 GB

Reviewed-by: Nicolai Hähnle <nicolai.haehnle@amd.com>
8 years agowinsys/radeon: fix printing allocation failures
Marek Olšák [Sun, 10 Apr 2016 14:50:17 +0000 (16:50 +0200)]
winsys/radeon: fix printing allocation failures

print as unsigned instead of signed

Reviewed-by: Nicolai Hähnle <nicolai.haehnle@amd.com>
8 years agowinsys/amdgpu: add support for 64-bit buffer sizes
Marek Olšák [Sun, 10 Apr 2016 14:48:55 +0000 (16:48 +0200)]
winsys/amdgpu: add support for 64-bit buffer sizes

v2: fail in radeon_winsys_bo_create if size > 32 bits

Reviewed-by: Nicolai Hähnle <nicolai.haehnle@amd.com>
8 years agopb_buffer: switch pb_buffer::size to 64 bits
Marek Olšák [Sun, 10 Apr 2016 14:37:33 +0000 (16:37 +0200)]
pb_buffer: switch pb_buffer::size to 64 bits

being able to allocate more than 4 GB may be useful

Reviewed-by: Nicolai Hähnle <nicolai.haehnle@amd.com>
8 years agogallium/radeon: remove R600_QUERY_HW_FLAG_TIMER
Marek Olšák [Fri, 8 Apr 2016 19:26:23 +0000 (21:26 +0200)]
gallium/radeon: remove R600_QUERY_HW_FLAG_TIMER

not used anymore

Reviewed-by: Edward O'Callaghan <eocallaghan@alterapraxis.com>
Reviewed-by: Nicolai Hähnle <nicolai.haehnle@amd.com>
8 years agogallium/radeon: merge timer and non-timer query lists
Marek Olšák [Fri, 8 Apr 2016 19:24:19 +0000 (21:24 +0200)]
gallium/radeon: merge timer and non-timer query lists

All of them are paused only between IBs.

Reviewed-by: Edward O'Callaghan <eocallaghan@alterapraxis.com>
Reviewed-by: Nicolai Hähnle <nicolai.haehnle@amd.com>
8 years agor600g: don't manually stop queries for blitter
Marek Olšák [Fri, 8 Apr 2016 19:12:13 +0000 (21:12 +0200)]
r600g: don't manually stop queries for blitter

r600_set_active_query_state does it better.

Reviewed-by: Edward O'Callaghan <eocallaghan@alterapraxis.com>
Reviewed-by: Nicolai Hähnle <nicolai.haehnle@amd.com>
8 years agor600g: add pausing pipeline & streamout queries into set_active_query_state
Marek Olšák [Fri, 8 Apr 2016 19:10:58 +0000 (21:10 +0200)]
r600g: add pausing pipeline & streamout queries into set_active_query_state

Reviewed-by: Edward O'Callaghan <eocallaghan@alterapraxis.com>
Reviewed-by: Nicolai Hähnle <nicolai.haehnle@amd.com>
8 years agor600g: implement set_active_query_state for pausing occlusion queries
Marek Olšák [Fri, 8 Apr 2016 18:41:52 +0000 (20:41 +0200)]
r600g: implement set_active_query_state for pausing occlusion queries

Use ZPASS_INCREMENT_DISABLE everywhere.

Reviewed-by: Edward O'Callaghan <eocallaghan@alterapraxis.com>
Reviewed-by: Nicolai Hähnle <nicolai.haehnle@amd.com>
8 years agor600g: simplify r600_set_occlusion_query_state
Marek Olšák [Fri, 8 Apr 2016 18:23:51 +0000 (20:23 +0200)]
r600g: simplify r600_set_occlusion_query_state

The caller does the same checking.

Reviewed-by: Edward O'Callaghan <eocallaghan@alterapraxis.com>
Reviewed-by: Nicolai Hähnle <nicolai.haehnle@amd.com>
8 years agogallium/radeon: move pipeline stat context flags to common code
Marek Olšák [Fri, 8 Apr 2016 18:29:08 +0000 (20:29 +0200)]
gallium/radeon: move pipeline stat context flags to common code

Reviewed-by: Edward O'Callaghan <eocallaghan@alterapraxis.com>
Reviewed-by: Nicolai Hähnle <nicolai.haehnle@amd.com>
8 years agor600g: fix typo in r600 register definitions
Marek Olšák [Fri, 8 Apr 2016 18:37:06 +0000 (20:37 +0200)]
r600g: fix typo in r600 register definitions

Acked-by: Edward O'Callaghan <eocallaghan@alterapraxis.com>
8 years agogallium/radeon: unify checking streamout enable state
Marek Olšák [Thu, 7 Apr 2016 01:24:06 +0000 (03:24 +0200)]
gallium/radeon: unify checking streamout enable state

Reviewed-by: Edward O'Callaghan <eocallaghan@alterapraxis.com>
Reviewed-by: Nicolai Hähnle <nicolai.haehnle@amd.com>
8 years agoradeonsi: fix mask checking when emitting scissors and viewports
Marek Olšák [Thu, 7 Apr 2016 19:41:34 +0000 (21:41 +0200)]
radeonsi: fix mask checking when emitting scissors and viewports

Reviewed-by: Nicolai Hähnle <nicolai.haehnle@amd.com>
Reviewed-by: Grigori Goronzy <greg@chown.ath.cx>
8 years agoradeonsi: implement and rely on set_active_query_state
Marek Olšák [Thu, 7 Apr 2016 00:59:09 +0000 (02:59 +0200)]
radeonsi: implement and rely on set_active_query_state

Reviewed-by: Edward O'Callaghan <eocallaghan@alterapraxis.com>
Reviewed-by: Nicolai Hähnle <nicolai.haehnle@amd.com>
8 years agogallium: pause queries for all meta ops
Marek Olšák [Thu, 7 Apr 2016 23:43:00 +0000 (01:43 +0200)]
gallium: pause queries for all meta ops

Reviewed-by: Roland Scheidegger <sroland@vmware.com>
Reviewed-by: Nicolai Hähnle <nicolai.haehnle@amd.com>
8 years agogallium: add pipe_context::set_active_query_state for pausing queries
Marek Olšák [Thu, 7 Apr 2016 23:42:00 +0000 (01:42 +0200)]
gallium: add pipe_context::set_active_query_state for pausing queries

Reviewed-by: Roland Scheidegger <sroland@vmware.com>
Reviewed-by: Nicolai Hähnle <nicolai.haehnle@amd.com>
8 years agoradeonsi: Synchronize a streamout write after read hazard.
Bas Nieuwenhuizen [Mon, 11 Apr 2016 13:53:43 +0000 (15:53 +0200)]
radeonsi: Synchronize a streamout write after read hazard.

Signed-off-by: Bas Nieuwenhuizen <bas@basnieuwenhuizen.nl>
Reviewed-by: Nicolai Hähnle <nicolai.haehnle@amd.com>
Reviewed-by: Marek Olšák <marek.olsak@amd.com>
8 years agonv30: Add missing PIPE_SHADER_CAP_INTEGERS to get_shader_param()
Hans de Goede [Mon, 11 Apr 2016 12:07:20 +0000 (14:07 +0200)]
nv30: Add missing PIPE_SHADER_CAP_INTEGERS to get_shader_param()

Add missing PIPE_SHADER_CAP_INTEGERS for frag shaders to
nv30_screen_get_shader_param().

Signed-off-by: Hans de Goede <hdegoede@redhat.com>
Reviewed-by: Samuel Pitoiset <samuel.pitoiset@gmail.com>
8 years agodri/i965: extend GLES3 sRGB workaround to cover all formats
Haixia Shi [Thu, 7 Apr 2016 18:05:08 +0000 (11:05 -0700)]
dri/i965: extend GLES3 sRGB workaround to cover all formats

It is incorrect to assume BGRA byte order for the GLES3 sRGB workaround.

v2: use _mesa_get_srgb_format_linear to handle all formats

Signed-off-by: Haixia Shi <hshi@chromium.org>
Reviewed-by: Stéphane Marchesin <marcheu@chromium.org>
Reviewed-by: Kenneth Graunke <kenneth@whitecape.org>
8 years agoi965: Add autogenerated 'brw_nir_trig_workarounds.c' to gitignore
Eduardo Lima Mitev [Tue, 12 Apr 2016 08:11:35 +0000 (10:11 +0200)]
i965: Add autogenerated 'brw_nir_trig_workarounds.c' to gitignore

Reviewed-by: Kenneth Graunke <kenneth@whitecape.org>
8 years agoglsl: Update hash table comments in constant propagation
Rhys Kidd [Mon, 11 Apr 2016 00:43:25 +0000 (20:43 -0400)]
glsl: Update hash table comments in constant propagation

Signed-off-by: Rhys Kidd <rhyskidd@gmail.com>
Reviewed-by: Kenneth Graunke <kenneth@whitecape.org>
8 years agosoftpipe: add SSBO/shader atomics support.
Dave Airlie [Mon, 11 Apr 2016 03:02:20 +0000 (13:02 +1000)]
softpipe: add SSBO/shader atomics support.

This adds support for the features requires for ARB_shader_storage_buffer_object
and ARB_shader_atomic_counters, ARB_shader_atomic_counter_ops.

[airlied: some cleanups applied]
Reviewed-by: Brian Paul <brianp@vmware.com>
Reviewed-by: Roland Scheidegger <sroland@vmware.com>
Signed-off-by: Dave Airlie <airlied@redhat.com>
8 years agodraw: add support for passing buffers to vs/gs shaders.
Dave Airlie [Mon, 11 Apr 2016 02:59:25 +0000 (12:59 +1000)]
draw: add support for passing buffers to vs/gs shaders.

Like the image code, but for shader buffers this time.

Reviewed-by: Brian Paul <brianp@vmware.com>
Reviewed-by: Roland Scheidegger <sroland@vmware.com>
Signed-off-by: Dave Airlie <airlied@redhat.com>
8 years agotgsi: add support for buffer/atomic operations to tgsi_exec.
Dave Airlie [Mon, 11 Apr 2016 02:54:59 +0000 (12:54 +1000)]
tgsi: add support for buffer/atomic operations to tgsi_exec.

This adds support for doing load/store/atomic operations on
buffer objects.

Reviewed-by: Brian Paul <brianp@vmware.com>
Reviewed-by: Roland Scheidegger <sroland@vmware.com>
Signed-off-by: Dave Airlie <airlied@redhat.com>
8 years agotgsi: set nonhelpermask for vertex shaders
Dave Airlie [Mon, 11 Apr 2016 02:20:38 +0000 (12:20 +1000)]
tgsi: set nonhelpermask for vertex shaders

For atomic operations we really need to avoid executing unnecessary shaders, so for some
tests that just draw a single point we only want one vertex to get processed not 4,

this fixes a number of the atomic counters tests.

Reviewed-by: Brian Paul <brianp@vmware.com>
Reviewed-by: Roland Scheidegger <sroland@vmware.com>
Signed-off-by: Dave Airlie <airlied@redhat.com>
8 years agonir: Fix typo in comment
Ian Romanick [Tue, 12 Apr 2016 01:40:02 +0000 (18:40 -0700)]
nir: Fix typo in comment

Trivial.

Signed-off-by: Ian Romanick <ian.d.romanick@intel.com>
8 years agonir: Merge redudant integer clamping.
Markus Wick [Sat, 9 Apr 2016 01:31:16 +0000 (03:31 +0200)]
nir: Merge redudant integer clamping.

Dolphin uses them a lot. Range tracking would be better in the long term,
but this two lines works fine for now.

Signed-off-by: Markus Wick <markus@selfnet.de>
Reviewed-by: Kenneth Graunke <kenneth@whitecape.org>
Reviewed-by: Jason Ekstrand <jason@jlekstrand.net>
8 years agoi965: Port INTEL_PRECISE_TRIG=1 to NIR.
Kenneth Graunke [Thu, 7 Apr 2016 22:04:35 +0000 (15:04 -0700)]
i965: Port INTEL_PRECISE_TRIG=1 to NIR.

This makes the extra multiply visible to NIR's algebraic optimizations
(for constant reassociation) as well as constant folding.  This means
that when the result of sin/cos are multiplied by an constant, we can
eliminate the extra multiply altogether, reducing the cost of the
workaround.

It also means we only have to implement it one place, rather than in
both backends.

This makes INTEL_PRECISE_TRIG=1 cost nothing on GPUTest/Volplosion,
which has a ton of sin() calls, but always multiplies them by an
immediate constant.  The extra multiply gets folded away.

Signed-off-by: Kenneth Graunke <kenneth@whitecape.org>
Reviewed-by: Eduardo Lima Mitev <elima@igalia.com>
Reviewed-by: Jason Ekstrand <jason@jlekstrand.net>
Reviewed-by: Matt Turner <mattst88@gmail.com>
8 years agoi965: Pass brw_compiler into brw_preprocess_nir() instead of is_scalar.
Kenneth Graunke [Thu, 7 Apr 2016 22:09:56 +0000 (15:09 -0700)]
i965: Pass brw_compiler into brw_preprocess_nir() instead of is_scalar.

I want to be able to read other fields.

Signed-off-by: Kenneth Graunke <kenneth@whitecape.org>
Reviewed-by: Alejandro Piñeiro <apinheiro@igalia.com>
Reviewed-by: Eduardo Lima Mitev <elima@igalia.com>
Reviewed-by: Jason Ekstrand <jason@jlekstrand.net>
Reviewed-by: Matt Turner <mattst88@gmail.com>
8 years agonir: Silence unused "options" warning in algebraic passes.
Kenneth Graunke [Thu, 7 Apr 2016 22:03:39 +0000 (15:03 -0700)]
nir: Silence unused "options" warning in algebraic passes.

Some passes may not refer to options->..., at which point the compiler
will warn about an unused variable.  Just cast to void unconditionally
to shut it up.

Signed-off-by: Kenneth Graunke <kenneth@whitecape.org>
Reviewed-by: Eduardo Lima Mitev <elima@igalia.com>
Reviewed-by: Jason Ekstrand <jason@jlekstrand.net>
Reviewed-by: Matt Turner <mattst88@gmail.com>
8 years agonir: Do basic constant reassociation.
Kenneth Graunke [Thu, 7 Apr 2016 05:34:39 +0000 (22:34 -0700)]
nir: Do basic constant reassociation.

Many shaders contain expression trees of the form:

    const_1 * (value * const_2)

Reorganizing these to

    (const_1 * const_2) * value

will allow constant folding to combine the constants.  Sometimes, these
constants are 2 and 0.5, so we can remove a multiply altogether.  Other
times, it can create more immediate constants, which can actually hurt.

Finding a good balance here is tricky.  While much more could be done,
this simple patch seems to have a lot of positive benefit while having
a low downside.

shader-db results on Broadwell:

total instructions in shared programs: 8963768 -> 8961369 (-0.03%)
instructions in affected programs: 438318 -> 435919 (-0.55%)
helped: 1502
HURT: 245

total cycles in shared programs: 71527354 -> 71421516 (-0.15%)
cycles in affected programs: 11541788 -> 11435950 (-0.92%)
helped: 3445
HURT: 1224

Signed-off-by: Kenneth Graunke <kenneth@whitecape.org>
Reviewed-by: Eduardo Lima Mitev <elima@igalia.com>
Reviewed-by: Jason Ekstrand <jason@jlekstrand.net>
Reviewed-by: Matt Turner <mattst88@gmail.com>
8 years agoradeon/uvd: alignment fix for decode message buffer
Boyuan Zhang [Fri, 8 Apr 2016 15:31:15 +0000 (11:31 -0400)]
radeon/uvd: alignment fix for decode message buffer

Signed-off-by: Boyuan Zhang <boyuan.zhang@amd.com>
Reviewed-by: Christian König <christian.koenig@amd.com>
8 years agost/mesa: replace _mesa_sysval_to_semantic table with function
Brian Paul [Mon, 11 Apr 2016 22:29:02 +0000 (16:29 -0600)]
st/mesa: replace _mesa_sysval_to_semantic table with function

Instead of using an array indexed by SYSTEM_VALUE_x, just use a
switch statement.  This fixes a regression caused by inserting new
SYSTEM_VALUE_ enums but not updating the mapping to TGSI semantics.

v2: fix a few switch statement mistakes for compute-related enums

Reviewed-by: Ilia Mirkin <imirkin@alum.mit.edu>
8 years agonir/lower_system_values: Add support for several computed values
Jason Ekstrand [Fri, 25 Mar 2016 17:54:27 +0000 (10:54 -0700)]
nir/lower_system_values: Add support for several computed values

Reviewed-by: Rob Clark <robdclark@gmail.com>
8 years agoglsl/shader_enums: Add the other two compute builtins
Jason Ekstrand [Fri, 25 Mar 2016 17:51:23 +0000 (10:51 -0700)]
glsl/shader_enums: Add the other two compute builtins

These weren't added before because they are actually calculated values that
are computed from other inputs.  However, in order to handle them in
nir_lower_system_values, it's nice for them to have a cannonical locaiton.

Reviewed-by: Rob Clark <robdclark@gmail.com>