mesa.git
8 years agowinsys/radeon: move variables from radeon_bomgr to radeon_drm_winsys
Marek Olšák [Sun, 6 Dec 2015 21:32:33 +0000 (22:32 +0100)]
winsys/radeon: move variables from radeon_bomgr to radeon_drm_winsys

radeon_bomgr is going away.

Reviewed-by: Nicolai Hähnle <nicolai.haehnle@amd.com>
Reviewed-by: Edward O'Callaghan <eocallaghan@alterapraxis.com>
Reviewed-by: Michel Dänzer <michel.daenzer@amd.com>
8 years agowinsys/radeon: remove redundant radeon_bomgr::va
Marek Olšák [Sun, 6 Dec 2015 21:10:04 +0000 (22:10 +0100)]
winsys/radeon: remove redundant radeon_bomgr::va

Reviewed-by: Nicolai Hähnle <nicolai.haehnle@amd.com>
Reviewed-by: Edward O'Callaghan <eocallaghan@alterapraxis.com>
Reviewed-by: Michel Dänzer <michel.daenzer@amd.com>
8 years agowinsys/amdgpu: don't use the "rws" abbreviation for amdgpu_winsys
Marek Olšák [Sun, 6 Dec 2015 21:19:38 +0000 (22:19 +0100)]
winsys/amdgpu: don't use the "rws" abbreviation for amdgpu_winsys

Reviewed-by: Nicolai Hähnle <nicolai.haehnle@amd.com>
Reviewed-by: Edward O'Callaghan <eocallaghan@alterapraxis.com>
Reviewed-by: Michel Dänzer <michel.daenzer@amd.com>
8 years agowinsys/amdgpu: use pb_cache instead of pb_cache_manager
Marek Olšák [Sun, 6 Dec 2015 19:57:05 +0000 (20:57 +0100)]
winsys/amdgpu: use pb_cache instead of pb_cache_manager

This is a prerequisite for the removal of radeon_winsys_cs_handle.

Reviewed-by: Nicolai Hähnle <nicolai.haehnle@amd.com>
Reviewed-by: Edward O'Callaghan <eocallaghan@alterapraxis.com>
Reviewed-by: Michel Dänzer <michel.daenzer@amd.com>
8 years agogallium/pb_bufmgr_cache: use the new pb_cache module
Marek Olšák [Sun, 6 Dec 2015 23:23:06 +0000 (00:23 +0100)]
gallium/pb_bufmgr_cache: use the new pb_cache module

Reviewed-by: Nicolai Hähnle <nicolai.haehnle@amd.com>
Reviewed-by: Edward O'Callaghan <eocallaghan@alterapraxis.com>
Acked-by: Michel Dänzer <michel.daenzer@amd.com>
8 years agogallium/pb_cache: add a copy of cache bufmgr independent of pb_manager
Marek Olšák [Sun, 6 Dec 2015 18:38:26 +0000 (19:38 +0100)]
gallium/pb_cache: add a copy of cache bufmgr independent of pb_manager

This simplified (basically duplicated) version of pb_cache_manager will
allow removing some ugly hacks from radeon and amdgpu winsyses and
flatten simplify their design.

The difference is that winsyses must manually add buffers to the cache
in "destroy" functions and the cache doesn't know about the buffers before
that. The integration is therefore trivial and the impact on the winsys
design is negligible.

Reviewed-by: Nicolai Hähnle <nicolai.haehnle@amd.com>
Reviewed-by: Edward O'Callaghan <eocallaghan@alterapraxis.com>
Acked-by: Michel Dänzer <michel.daenzer@amd.com>
8 years agoradeonsi: implement fast stencil clear
Marek Olšák [Thu, 10 Dec 2015 00:37:39 +0000 (01:37 +0100)]
radeonsi: implement fast stencil clear

Reviewed-by: Alex Deucher <alexander.deucher@amd.com>
8 years agoradeonsi: re-enable Hyper-Z for stencil
Marek Olšák [Tue, 8 Dec 2015 16:33:55 +0000 (17:33 +0100)]
radeonsi: re-enable Hyper-Z for stencil

Reviewed-by: Alex Deucher <alexander.deucher@amd.com>
8 years agor600g: remove a Hyper-Z workaround that's likely not needed anymore
Marek Olšák [Thu, 10 Dec 2015 00:46:17 +0000 (01:46 +0100)]
r600g: remove a Hyper-Z workaround that's likely not needed anymore

FORCE_OFF == 0, no need to set that

Reviewed-by: Alex Deucher <alexander.deucher@amd.com>
8 years agor600g: re-enable Hyper-Z for stencil on Evergreen & Cayman
Marek Olšák [Thu, 10 Dec 2015 00:40:14 +0000 (01:40 +0100)]
r600g: re-enable Hyper-Z for stencil on Evergreen & Cayman

Reviewed-by: Alex Deucher <alexander.deucher@amd.com>
8 years agogallium/radeon: fix Hyper-Z hangs by programming PA_SC_MODE_CNTL_1 correctly
Marek Olšák [Wed, 9 Dec 2015 19:26:21 +0000 (20:26 +0100)]
gallium/radeon: fix Hyper-Z hangs by programming PA_SC_MODE_CNTL_1 correctly

This is the recommended setting according to hw people and it makes Hyper-Z
stable. Just the two magic states.

This fixes Evergreen, Cayman, SI, CI, VI (using the Cayman code).

Cc: 11.0 11.1 <mesa-stable@lists.freedesktop.org>
Reviewed-by: Alex Deucher <alexander.deucher@amd.com>
8 years agoradeonsi: don't use the CP DMA workaround on Fiji and newer
Marek Olšák [Fri, 4 Dec 2015 20:24:46 +0000 (21:24 +0100)]
radeonsi: don't use the CP DMA workaround on Fiji and newer

Reviewed-by: Alex Deucher <alexander.deucher@amd.com>
8 years agoradeonsi: apply the streamout workaround to Fiji as well
Marek Olšák [Fri, 4 Dec 2015 20:24:21 +0000 (21:24 +0100)]
radeonsi: apply the streamout workaround to Fiji as well

Cc: 11.0 11.1 <mesa-stable@lists.freedesktop.org>
Reviewed-by: Alex Deucher <alexander.deucher@amd.com>
8 years agoradeonsi: also print hexadecimal values for register fields in the IB parser
Marek Olšák [Wed, 9 Dec 2015 22:39:45 +0000 (23:39 +0100)]
radeonsi: also print hexadecimal values for register fields in the IB parser

Reviewed-by: Michel Dänzer <michel.daenzer@amd.com
Reviewed-by: Edward O'Callaghan <eocallaghan@alterapraxis.com>
8 years agoradeonsi: implement RB+ for Stoney (v2)
Marek Olšák [Tue, 1 Dec 2015 13:56:54 +0000 (14:56 +0100)]
radeonsi: implement RB+ for Stoney (v2)

v2: fix dual source blending

Reviewed-by: Alex Deucher <alexander.deucher@amd.com>
8 years agoradeonsi: don't call of u_prims_for_vertices for patches and rectangles
Marek Olšák [Wed, 9 Dec 2015 21:14:32 +0000 (22:14 +0100)]
radeonsi: don't call of u_prims_for_vertices for patches and rectangles

Both caused a crash due to a division by zero in that function.
This is an alternative fix.

Cc: 11.0 11.1 <mesa-stable@lists.freedesktop.org>
Reviewed-by: Michel Dänzer <michel.daenzer@amd.com>
Reviewed-by: Edward O'Callaghan <eocallaghan@alterapraxis.com>
8 years agoradeonsi: use tgsi_shader_info::colors_written
Marek Olšák [Thu, 10 Dec 2015 12:16:58 +0000 (13:16 +0100)]
radeonsi: use tgsi_shader_info::colors_written

Reviewed-by: Alex Deucher <alexander.deucher@amd.com>
8 years agor600g: write all MRTs only if there is exactly one output (fixes a hang)
Marek Olšák [Thu, 10 Dec 2015 12:19:45 +0000 (13:19 +0100)]
r600g: write all MRTs only if there is exactly one output (fixes a hang)

This fixes a hang in
piglit/arb_blend_func_extended-fbo-extended-blend-pattern_gles2 on REDWOOD.

Cc: 11.0 11.1 <mesa-stable@lists.freedesktop.org>
Reviewed-by: Alex Deucher <alexander.deucher@amd.com>
8 years agotgsi/scan: add flag colors_written
Marek Olšák [Thu, 10 Dec 2015 12:15:50 +0000 (13:15 +0100)]
tgsi/scan: add flag colors_written

This is a prerequisite for the following r600g fix.

Cc: 11.0 11.1 <mesa-stable@lists.freedesktop.org>
Reviewed-by: Alex Deucher <alexander.deucher@amd.com>
8 years agoRevert "radeonsi: disable DCC on Stoney"
Marek Olšák [Fri, 11 Dec 2015 14:08:00 +0000 (15:08 +0100)]
Revert "radeonsi: disable DCC on Stoney"

This reverts commit 32f05fadbbdf2a3fb60055e610bbbdcd82dd3ce5.

It turned out the problem with Stoney was caused by incorrect handling of
a non-power-two VRAM size in the kernel driver.
This is an optional BIOS setting and can be worked around by choosing
a different VRAM size in the BIOS.

Cc: 11.1 <mesa-stable@lists.freedesktop.org>
8 years agonir: silence uninitialized warning
Timothy Arceri [Fri, 11 Dec 2015 00:07:14 +0000 (11:07 +1100)]
nir: silence uninitialized warning

Reviewed-by: Rob Clark <robdclark@gmail.com>
8 years agomesa/shader: return correct attribute location for double matrix arrays
Dave Airlie [Thu, 10 Dec 2015 01:44:34 +0000 (11:44 +1000)]
mesa/shader: return correct attribute location for double matrix arrays

If we have a dmat2[4], then dmat2[0] is at 17, dmat2[1] at 19,
dmat2[2] at 21 etc. The old code was returning 17,18,19.

I think this code is also wrong for float matricies as well.

There is now a piglit for the float case.

This partly fixes:
GL41-CTS.vertex_attrib_64bit.limits_test

[airlied: update with Tapani suggestion to clean it up].

Cc: "11.0 11.1" <mesa-stable@lists.freedesktop.org>
Reviewed-by: Timothy Arceri <timothy.arceri@collabora.com>
Reviewed-by: Tapani Pälli <tapani.palli@intel.com>
Signed-off-by: Dave Airlie <airlied@redhat.com>
8 years agodraw: fix clipping with linear interpolated values and gl_ClipVertex
Roland Scheidegger [Fri, 11 Dec 2015 01:21:17 +0000 (02:21 +0100)]
draw: fix clipping with linear interpolated values and gl_ClipVertex

Discovered this when working on other clip code, apparently didn't work
correctly - the combination of linear interpolated values and using
gl_ClipVertex produced wrong values (failing all such combinations
in piglits glsl-1.30 interpolation tests, named
interpolation-noperspective-XXX-vertex).
Use the pre-clip-pos values when determining the interpolation factor to
fix this.
Noone really understands this code well, but everybody agrees this looks
sane... This fixes all those failing tests (10 in total) both with
the llvm and non-llvm draw paths, with no piglit regressions.

Reviewed-by: Brian Paul <brianp@vmware.com>
Reviewed-by: Dave Airlie <airlied@redhat.com>
8 years agor600: add missing return value check.
Dave Airlie [Thu, 10 Dec 2015 23:36:36 +0000 (09:36 +1000)]
r600: add missing return value check.

Pointed out by coverity scan.

Signed-off-by: Dave Airlie <airlied@redhat.com>
8 years agonir: Get rid of *_indirect variants of input/output load/store intrinsics
Jason Ekstrand [Wed, 25 Nov 2015 22:14:05 +0000 (14:14 -0800)]
nir: Get rid of *_indirect variants of input/output load/store intrinsics

There is some special-casing needed in a competent back-end.  However, they
can do their special-casing easily enough based on whether or not the
offset is a constant.  In the mean time, having the *_indirect variants
adds special cases a number of places where they don't need to be and, in
general, only complicates things.  To complicate matters, NIR had no way to
convdert an indirect load/store to a direct one in the case that the
indirect was a constant so we would still not really get what the back-ends
wanted.  The best solution seems to be to get rid of the *_indirect
variants entirely.

This commit is a bunch of different changes squashed together:

 - nir: Get rid of *_indirect variants of input/output load/store intrinsics
 - nir/glsl: Stop handling UBO/SSBO load/stores differently depending on indirect
 - nir/lower_io: Get rid of load/store_foo_indirect
 - i965/fs: Get rid of load/store_foo_indirect
 - i965/vec4: Get rid of load/store_foo_indirect
 - tgsi_to_nir: Get rid of load/store_foo_indirect
 - ir3/nir: Use the new unified io intrinsics
 - vc4: Do all uniform loads with byte offsets
 - vc4/nir: Use the new unified io intrinsics
 - vc4: Fix load_user_clip_plane crash
 - vc4: add missing src for store outputs
 - vc4: Fix state uniforms
 - nir/lower_clip: Update to the new load/store intrinsics
 - nir/lower_two_sided_color: Update to the new load intrinsic

NIR and i965 changes are

Reviewed-by: Kenneth Graunke <kenneth@whitecape.org>
NIR indirect declarations and vc4 changes are

Reviewed-by: Eric Anholt <eric@anholt.net>
ir3 changes are

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

Acked-by: Rob Clark <robdclark@gmail.com>
8 years agoi965/fs_nir: Refactor store_output, load_input, and load_uniform
Jason Ekstrand [Tue, 8 Dec 2015 06:41:50 +0000 (22:41 -0800)]
i965/fs_nir: Refactor store_output, load_input, and load_uniform

There was way too much incrementing of things going on.  Instead, let's
just start everything off at the right base location, and then increment in
the loop.

Reviewed-by: Kenneth Graunke <kenneth@whitecape.org>
8 years agogallium/util: return correct number of bound vertex buffers
Patrick Rudolph [Thu, 10 Dec 2015 18:50:38 +0000 (19:50 +0100)]
gallium/util: return correct number of bound vertex buffers

In case a state tracker unbinds every slot by a seperate
pipe->set_vertex_buffers() call, starting from slot zero, the number
of bound buffers would not reach zero at all.
The current algorithm does not account for pre-existing holes in the
buffer list.

Unbinding all buffers at once or starting at the top-most slot results
in correct behaviour.

Calculating the correct number of bound buffers fixes a NULL pointer
dereference in nvc0_validate_vertex_buffers_shared().

Bugzilla: https://bugs.freedesktop.org/show_bug.cgi?id=93004
Signed-off-by: Patrick Rudolph <siro@das-labor.org>
Reviewed-by: Marek Olšák <marek.olsak@amd.com>
Reviewed-by: Ilia Mirkin <imirkin@alum.mit.edu>
Cc: "11.0 11.1" <mesa-stable@lists.freedesktop.org>
8 years agoblit: Don't take into account the Mesa format when checking MSRT blit
Neil Roberts [Thu, 19 Nov 2015 14:29:19 +0000 (15:29 +0100)]
blit: Don't take into account the Mesa format when checking MSRT blit

According to the GLES3 spec, blitting between multisample FBOs with
different internal formats should not be allowed. The
compatible_resolve_formats function implements this check. Previously
it had a shortcut where if the Mesa formats of the two renderbuffers
were the same then it would assume the blit is ok. However some
drivers map different internal formats to the same Mesa format, for
example it might implement both GL_RGB and GL_RGBA textures with
MESA_FORMAT_R8G8B8A_UNORM. The function is used to generate a GL error
according to what the GL spec requires so the blit should not be
allowed in that case. This patch just removes the shortcut so that it
only ever looks at the internal format.

Note that I posted a related patch to disable this check altogether
for desktop GL. However this function is still used on GLES3 because
there are conformance tests that require this behaviour so this patch
is still useful.

Cc: Marek Olšák <maraeo@gmail.com>
Reviewed-by: Marek Olšák <marek.olsak@amd.com>
8 years agoi965: Check base format to determine whether to use tiled memcpy
Neil Roberts [Thu, 19 Nov 2015 14:06:08 +0000 (15:06 +0100)]
i965: Check base format to determine whether to use tiled memcpy

The tiled memcpy doesn't work for copying from RGBX to RGBA because it
doesn't override the alpha component to 1.0. Commit 2cebaac479d4 added
a check to disable it for RGBX formats by looking at the TexFormat.
However a lot of the rest of the code base is written with the
assumption that an RGBA texture can be used internally to implement a
GL_RGB texture. If that is done then this check breaks. This patch
makes it instead check the base format of the texture which I think
more directly matches the intention.

Reviewed-by: Jason Ekstrand <jason.ekstrand@intel.com>
8 years agoi965/gen8: Allow rendering to B8G8R8X8
Neil Roberts [Thu, 19 Nov 2015 13:02:59 +0000 (14:02 +0100)]
i965/gen8: Allow rendering to B8G8R8X8

Since Gen8 this is allowed as a rendering target so we don't need to
override it to B8G8R8A8. This is helpful on Gen9+ where using this
override causes fast clears not to work.

Reviewed-by: Anuj Phogat <anuj.phogat@gmail.com>
Reviewed-by: Ben Widawsky <benjamin.widawsky@intel.com>
8 years agoi965/gen9: Allow fast clear for MSRT formats matching render
Neil Roberts [Wed, 18 Nov 2015 17:14:33 +0000 (18:14 +0100)]
i965/gen9: Allow fast clear for MSRT formats matching render

Previously fast clear was disallowed on Gen9 for MSRTs with the claim
that some formats don't work but we didn't understand why. On further
investigation it seems the formats that don't work are the ones where
the render surface format is being overriden to a different format
than the one used for texturing. The one used for texturing is not
actually a renderable format. It arguably makes sense that the sampler
hardware doesn't handle the fast color correctly in these cases
because it shouldn't be possible to end up with a fast cleared surface
that is non-renderable.

This patch changes the limitation to prevent fast clear for surfaces
where the format for rendering is overriden.

Reviewed-by: Ben Widawsky <benjamin.widawsky@intel.com>
8 years agoi965/gen9/fast-clear: Handle linear→SRGB conversion
Neil Roberts [Tue, 24 Nov 2015 15:15:20 +0000 (16:15 +0100)]
i965/gen9/fast-clear: Handle linear→SRGB conversion

If GL_FRAMEBUFFER_SRGB is enabled when writing to an SRGB-capable
framebuffer then the color will be converted from linear to SRGB
before being written. There is no chance for the hardware to do this
itself because it can't modify the clear color that is programmed in
the surface state so it seems pretty clear that the driver should be
handling this itself.

Note that this wasn't a problem before Gen9 because previously we were
only able to do fast clears to 0 or 1 and those values are the same in
linear and SRGB space.

Reviewed-by: Topi Pohjolainen <topi.pohjolainen@intel.com>
8 years agodocs: Add ARB_compute_shader to 11.2.0 release notes
Jordan Justen [Sun, 27 Sep 2015 06:50:55 +0000 (23:50 -0700)]
docs: Add ARB_compute_shader to 11.2.0 release notes

Signed-off-by: Jordan Justen <jordan.l.justen@intel.com>
Reviewed-by: Iago Toral Quiroga <itoral@igalia.com>
Reviewed-by: Kristian Høgsberg <krh@bitplanet.net>
8 years agodocs: Mark ARB_compute_shader as done for i965
Jordan Justen [Sun, 27 Sep 2015 06:49:52 +0000 (23:49 -0700)]
docs: Mark ARB_compute_shader as done for i965

Signed-off-by: Jordan Justen <jordan.l.justen@intel.com>
Reviewed-by: Iago Toral Quiroga <itoral@igalia.com>
Reviewed-by: Kristian Høgsberg <krh@bitplanet.net>
8 years agoi965: Enable ARB_compute_shader extension on supported hardware
Jordan Justen [Wed, 2 Sep 2015 22:47:33 +0000 (15:47 -0700)]
i965: Enable ARB_compute_shader extension on supported hardware

Enable ARB_compute_shader on gen7+, on hardware that supports the
OpenGL 4.3 requirements of a local group size of 1024.

With SIMD16 support, this is limited to Ivy Bridge and Haswell.

Broadwell will work with a local group size up to 896 on SIMD16
meaning programs that use this size or lower should run when setting
MESA_EXTENSION_OVERRIDE=GL_ARB_compute_shader.

Signed-off-by: Jordan Justen <jordan.l.justen@intel.com>
Reviewed-by: Iago Toral Quiroga <itoral@igalia.com>
Reviewed-by: Kristian Høgsberg <krh@bitplanet.net>
8 years agoi965/nir: Implement shared variable atomic operations
Jordan Justen [Sat, 10 Oct 2015 20:01:03 +0000 (13:01 -0700)]
i965/nir: Implement shared variable atomic operations

v3:
 * Update based on latest SSBO code (Iago)

Signed-off-by: Jordan Justen <jordan.l.justen@intel.com>
Reviewed-by: Iago Toral Quiroga <itoral@igalia.com>
Reviewed-by: Kristian Høgsberg <krh@bitplanet.net>
8 years agonir: Add nir intrinsics for shared variable atomic operations
Jordan Justen [Sat, 10 Oct 2015 19:25:39 +0000 (12:25 -0700)]
nir: Add nir intrinsics for shared variable atomic operations

v3:
 * Update min/max based on latest SSBO code (Iago)

Signed-off-by: Jordan Justen <jordan.l.justen@intel.com>
Reviewed-by: Iago Toral Quiroga <itoral@igalia.com>
Reviewed-by: Kristian Høgsberg <krh@bitplanet.net>
8 years agoglsl: Disable several optimizations on shared variables
Jordan Justen [Sat, 10 Oct 2015 18:30:33 +0000 (11:30 -0700)]
glsl: Disable several optimizations on shared variables

Shared variables can be accessed by other threads within the same
local workgroup. This prevents us from performing certain
optimizations with shared variables.

Signed-off-by: Jordan Justen <jordan.l.justen@intel.com>
Reviewed-by: Iago Toral Quiroga <itoral@igalia.com>
Reviewed-by: Kristian Høgsberg <krh@bitplanet.net>
8 years agoglsl: Buffer atomics are supported for compute shaders
Jordan Justen [Sat, 10 Oct 2015 16:36:22 +0000 (09:36 -0700)]
glsl: Buffer atomics are supported for compute shaders

Signed-off-by: Jordan Justen <jordan.l.justen@intel.com>
Reviewed-by: Iago Toral Quiroga <itoral@igalia.com>
Reviewed-by: Kristian Høgsberg <krh@bitplanet.net>
8 years agoglsl: Translate atomic intrinsic functions on shared variables
Jordan Justen [Sat, 10 Oct 2015 14:55:42 +0000 (07:55 -0700)]
glsl: Translate atomic intrinsic functions on shared variables

When an intrinsic atomic operation is used on a shared variable, we
translate it to a new 'shared variable' specific intrinsic function
call.

For example, a call to __intrinsic_atomic_add when used on a shared
variable will be translated to a call to
__intrinsic_atomic_add_shared.

v3:
 * Fix stale comments copied from SSBOs (Iago)

Signed-off-by: Jordan Justen <jordan.l.justen@intel.com>
Reviewed-by: Iago Toral Quiroga <itoral@igalia.com>
Reviewed-by: Kristian Høgsberg <krh@bitplanet.net>
8 years agoglsl: Check for SSBO variable in check_for_ssbo_store
Jordan Justen [Tue, 17 Nov 2015 18:55:26 +0000 (10:55 -0800)]
glsl: Check for SSBO variable in check_for_ssbo_store

The compiler probably already blocks this earlier on, but we should be
checking for an SSBO here.

Signed-off-by: Jordan Justen <jordan.l.justen@intel.com>
Reviewed-by: Iago Toral Quiroga <itoral@igalia.com>
Reviewed-by: Kristian Høgsberg <krh@bitplanet.net>
8 years agoglsl: Check for SSBO variable in SSBO atomic lowering
Jordan Justen [Sat, 10 Oct 2015 00:43:53 +0000 (17:43 -0700)]
glsl: Check for SSBO variable in SSBO atomic lowering

When an atomic function is called, we need to check to see if it is
for an SSBO variable before lowering it to the SSBO specific intrinsic
function.

v2:
 * is_in_buffer_block => is_in_shader_storage_block (Iago)

Signed-off-by: Jordan Justen <jordan.l.justen@intel.com>
Reviewed-by: Iago Toral Quiroga <itoral@igalia.com>
Reviewed-by: Kristian Høgsberg <krh@bitplanet.net>
8 years agoglsl: Replace atomic_ssbo and ssbo_atomic with atomic
Jordan Justen [Fri, 9 Oct 2015 22:55:34 +0000 (15:55 -0700)]
glsl: Replace atomic_ssbo and ssbo_atomic with atomic

The atomic functions can also be used with shared variables in compute
shaders.

When lowering the intrinsic in lower_ubo_reference, we still create an
SSBO specific intrinsic since SSBO accesses can be indirectly
addressed, whereas all compute shader shared variable live in a single
shared variable area.

v2:
 * Also remove the _internal suffix from ssbo atomic intrinsic names (Iago)

Signed-off-by: Jordan Justen <jordan.l.justen@intel.com>
Reviewed-by: Iago Toral Quiroga <itoral@igalia.com>
Reviewed-by: Kristian Høgsberg <krh@bitplanet.net>
8 years agoglsl: Allow atomic functions to be used with shared variables
Jordan Justen [Fri, 9 Oct 2015 22:32:33 +0000 (15:32 -0700)]
glsl: Allow atomic functions to be used with shared variables

Signed-off-by: Jordan Justen <jordan.l.justen@intel.com>
Reviewed-by: Timothy Arceri <timothy.arceri@collabora.com>
Reviewed-by: Iago Toral Quiroga <itoral@igalia.com>
Reviewed-by: Kristian Høgsberg <krh@bitplanet.net>
8 years agoi965: Lower shared variable references to intrinsic calls
Jordan Justen [Tue, 28 Jul 2015 21:55:00 +0000 (14:55 -0700)]
i965: Lower shared variable references to intrinsic calls

Signed-off-by: Jordan Justen <jordan.l.justen@intel.com>
Reviewed-by: Iago Toral Quiroga <itoral@igalia.com>
Reviewed-by: Kristian Høgsberg <krh@bitplanet.net>
8 years agoi965: Enable shared local memory for CS shared variables
Jordan Justen [Tue, 28 Jul 2015 22:30:30 +0000 (15:30 -0700)]
i965: Enable shared local memory for CS shared variables

v3:
 * Check shared variable size at link time

Signed-off-by: Jordan Justen <jordan.l.justen@intel.com>
Reviewed-by: Iago Toral Quiroga <itoral@igalia.com>
Reviewed-by: Kristian Høgsberg <krh@bitplanet.net>
8 years agoi965/fs: Handle nir shared variable store intrinsic
Jordan Justen [Tue, 28 Jul 2015 22:25:46 +0000 (15:25 -0700)]
i965/fs: Handle nir shared variable store intrinsic

v4:
 * Apply similar optimization for shared variable stores as
   0cb7d7b4b7c32246d4c4225a1d17d7ff79a7526d. This was causing a
   OpenGLES 3.1 CTS failure, but
   867c436ca841b4196b4dde4786f5086c76b20dd7 fixes that.

Signed-off-by: Jordan Justen <jordan.l.justen@intel.com>
Reviewed-by: Iago Toral Quiroga <itoral@igalia.com>
Reviewed-by: Kristian Høgsberg <krh@bitplanet.net>
8 years agoi965/fs: Handle nir shared variable load intrinsic
Jordan Justen [Tue, 28 Jul 2015 22:24:13 +0000 (15:24 -0700)]
i965/fs: Handle nir shared variable load intrinsic

v3:
 * Remove extra #includes (Iago)
 * Use recently added GEN7_BTI_SLM instead of BRW_SLM_SURFACE_INDEX (curro)

Signed-off-by: Jordan Justen <jordan.l.justen@intel.com>
Reviewed-by: Iago Toral Quiroga <itoral@igalia.com>
Reviewed-by: Kristian Høgsberg <krh@bitplanet.net>
8 years agoi965: Disable vector splitting on shared variables
Jordan Justen [Fri, 16 Oct 2015 17:45:05 +0000 (10:45 -0700)]
i965: Disable vector splitting on shared variables

Signed-off-by: Jordan Justen <jordan.l.justen@intel.com>
Reviewed-by: Iago Toral Quiroga <itoral@igalia.com>
Reviewed-by: Kristian Høgsberg <krh@bitplanet.net>
8 years agonir: Translate glsl shared var store intrinsic to nir intrinsic
Jordan Justen [Tue, 28 Jul 2015 22:17:34 +0000 (15:17 -0700)]
nir: Translate glsl shared var store intrinsic to nir intrinsic

Signed-off-by: Jordan Justen <jordan.l.justen@intel.com>
Reviewed-by: Iago Toral Quiroga <itoral@igalia.com>
Reviewed-by: Kristian Høgsberg <krh@bitplanet.net>
8 years agonir: Translate glsl shared var load intrinsic to nir intrinsic
Jordan Justen [Tue, 28 Jul 2015 22:11:37 +0000 (15:11 -0700)]
nir: Translate glsl shared var load intrinsic to nir intrinsic

Signed-off-by: Jordan Justen <jordan.l.justen@intel.com>
Reviewed-by: Iago Toral Quiroga <itoral@igalia.com>
Reviewed-by: Kristian Høgsberg <krh@bitplanet.net>
8 years agoglsl: Add lowering pass for shared variable references
Jordan Justen [Tue, 28 Jul 2015 21:45:56 +0000 (14:45 -0700)]
glsl: Add lowering pass for shared variable references

In this lowering pass, shared variables are decomposed into intrinsic
calls.

v2:
 * Send mem_ctx as a parameter (Iago)

v3:
 * Shared variables don't have an associated interface block (Iago)
 * Always use 430 packing (Iago)
 * Comment / whitespace cleanup (Iago)

Signed-off-by: Jordan Justen <jordan.l.justen@intel.com>
Reviewed-by: Iago Toral Quiroga <itoral@igalia.com>
Reviewed-by: Kristian Høgsberg <krh@bitplanet.net>
8 years agoglsl: Don't assert on shared variable matrices with 'inherited' layout
Iago Toral Quiroga [Tue, 1 Dec 2015 00:43:09 +0000 (16:43 -0800)]
glsl: Don't assert on shared variable matrices with 'inherited' layout

We use column-major for shared variable matrices.

Reviewed-by: Jordan Justen <jordan.l.justen@intel.com>
Reviewed-by: Kristian Høgsberg <krh@bitplanet.net>
8 years agoglsl: Don't lower_variable_index_to_cond_assign for shared variables
Jordan Justen [Tue, 21 Jul 2015 21:04:11 +0000 (14:04 -0700)]
glsl: Don't lower_variable_index_to_cond_assign for shared variables

Signed-off-by: Jordan Justen <jordan.l.justen@intel.com>
Reviewed-by: Iago Toral Quiroga <itoral@igalia.com>
Reviewed-by: Kristian Høgsberg <krh@bitplanet.net>
8 years agoglsl: Remove mem_ctx as member variable in lower_ubo_reference_visitor
Jordan Justen [Tue, 17 Nov 2015 02:10:32 +0000 (18:10 -0800)]
glsl: Remove mem_ctx as member variable in lower_ubo_reference_visitor

Signed-off-by: Jordan Justen <jordan.l.justen@intel.com>
Reviewed-by: Iago Toral Quiroga <itoral@igalia.com>
Reviewed-by: Kristian Høgsberg <krh@bitplanet.net>
8 years agoglsl ubo/ssbo: Move common code into lower_buffer_access::setup_buffer_access
Jordan Justen [Tue, 17 Nov 2015 02:09:27 +0000 (18:09 -0800)]
glsl ubo/ssbo: Move common code into lower_buffer_access::setup_buffer_access

This code will also be usable by the pass to lower shared variables.

Note, that *const_offset is adjusted by setup_buffer_access so it must
be initialized before calling setup_buffer_access.

v2:
 * Add comment for lower_buffer_access::setup_buffer_access

Signed-off-by: Jordan Justen <jordan.l.justen@intel.com>
Reviewed-by: Iago Toral Quiroga <itoral@igalia.com>
Reviewed-by: Kristian Høgsberg <krh@bitplanet.net>
8 years agoglsl ubo/ssbo: Move is_dereferenced_thing_row_major into lower_buffer_access
Jordan Justen [Fri, 13 Nov 2015 20:08:26 +0000 (12:08 -0800)]
glsl ubo/ssbo: Move is_dereferenced_thing_row_major into lower_buffer_access

Signed-off-by: Jordan Justen <jordan.l.justen@intel.com>
Reviewed-by: Iago Toral Quiroga <itoral@igalia.com>
Reviewed-by: Kristian Høgsberg <krh@bitplanet.net>
8 years agoglsl ubo/ssbo: Add lower_buffer_access class
Jordan Justen [Fri, 13 Nov 2015 07:43:04 +0000 (23:43 -0800)]
glsl ubo/ssbo: Add lower_buffer_access class

This class has code that will be shared by lower_ubo_reference and
lower_shared_reference. (lower_shared_reference will be used to
support compute shader shared variables.)

v2:
 * Add lower_buffer_access.h to makefile (Emil)
 * Remove static is_dereferenced_thing_row_major from
   lower_buffer_access.cpp. This will become a lower_buffer_access
   method in the next commit.
 * Pass mem_ctx as parameter rather than using a member variable (Iago)

Signed-off-by: Jordan Justen <jordan.l.justen@intel.com>
Reviewed-by: Iago Toral Quiroga <itoral@igalia.com>
Reviewed-by: Kristian Høgsberg <krh@bitplanet.net>
8 years agoglsl ubo/ssbo: Split buffer access to insert_buffer_access
Jordan Justen [Fri, 13 Nov 2015 18:47:06 +0000 (10:47 -0800)]
glsl ubo/ssbo: Split buffer access to insert_buffer_access

This allows the code in emit_access to be generic enough to also be
for lowering shared variables.

Signed-off-by: Jordan Justen <jordan.l.justen@intel.com>
Reviewed-by: Iago Toral Quiroga <itoral@igalia.com>
Reviewed-by: Kristian Høgsberg <krh@bitplanet.net>
8 years agoglsl ubo/ssbo: Use enum to track current buffer access type
Jordan Justen [Fri, 13 Nov 2015 09:49:43 +0000 (01:49 -0800)]
glsl ubo/ssbo: Use enum to track current buffer access type

v2:
 * Rename ssbo_get_array_length to ssbo_unsized_array_length_access (Iago)
 * Use always use this-> when referencing buffer_access_type (Iago)

Signed-off-by: Jordan Justen <jordan.l.justen@intel.com>
Reviewed-by: Iago Toral Quiroga <itoral@igalia.com>
Reviewed-by: Kristian Høgsberg <krh@bitplanet.net>
8 years agoglsl: do not loose always_active_io when packing varyings
Tapani Pälli [Wed, 9 Dec 2015 07:48:57 +0000 (09:48 +0200)]
glsl: do not loose always_active_io when packing varyings

Otherwise packed and inactive varyings get optimized away. This needs
to be prevented when using separate shader objects where interface
needs to be preserved.

Signed-off-by: Tapani Pälli <tapani.palli@intel.com>
Reviewed-by: Timothy Arceri <timothy.arceri@collabora.com>
8 years agomesa: invalidate pipeline status after glUseProgramStages
Tapani Pälli [Tue, 8 Dec 2015 17:02:14 +0000 (19:02 +0200)]
mesa: invalidate pipeline status after glUseProgramStages

This will cause validation to run during next draw, this is done
because possible changes in used stages and programs can cause
invalid pipeline state.

This fixes a subtest in following CTS test:
ES31-CTS.sepshaderobjs.StateInteraction

Signed-off-by: Tapani Pälli <tapani.palli@intel.com>
Reviewed-by: Timothy Arceri <timothy.arceri@collabora.com>
8 years agomesa/varray: set double arrays to non-normalised.
Dave Airlie [Thu, 10 Dec 2015 00:36:42 +0000 (10:36 +1000)]
mesa/varray: set double arrays to non-normalised.

Doesn't have any effect in practice I don't think, but
CTS reads back using GetVertexAttrib.

This fixes: GL41-CTS.vertex_attrib_64bit.get_vertex_attrib

Cc: "11.0 11.1" <mesa-stable@lists.freedesktop.org>
Reviewed-by: Ian Romanick <ian.d.romanick@intel.com>
Signed-off-by: Dave Airlie <airlied@redhat.com>
8 years agoclover: Fix build against LLVM 3.8 SVN >= r255078
Michel Dänzer [Wed, 9 Dec 2015 06:46:46 +0000 (15:46 +0900)]
clover: Fix build against LLVM 3.8 SVN >= r255078

Reviewed-by: Francisco Jerez <currojerez@riseup.net>
8 years agomesa: fix ID usage for buffer warnings
Brian Paul [Wed, 9 Dec 2015 23:00:55 +0000 (16:00 -0700)]
mesa: fix ID usage for buffer warnings

We need a different ID pointer for each call site.

Reviewed-by: Ilia Mirkin <imirkin@alum.mit.edu>
8 years agodocs: remove stray <ul> tag from 11.0.5.html file to fix indentation
Brian Paul [Wed, 9 Dec 2015 22:14:02 +0000 (15:14 -0700)]
docs: remove stray <ul> tag from 11.0.5.html file to fix indentation

8 years agofreedreno: little clean up in fd_create_surface
Serge Martin [Sun, 6 Dec 2015 14:32:17 +0000 (15:32 +0100)]
freedreno: little clean up in fd_create_surface

in order to avoid returing invalid adress if CALLOC_STRUCT return NULL.

Signed-off-by: Rob Clark <robclark@freedesktop.org>
8 years agofreedreno: change to goto fail
Serge Martin [Sun, 6 Dec 2015 14:32:16 +0000 (15:32 +0100)]
freedreno: change to goto fail

in fd_resource_transfer_map, like the others error cases

Signed-off-by: Rob Clark <robclark@freedesktop.org>
8 years agofreedreno: fix bind_sampler_states when hwcso is NULL
Serge Martin [Sun, 6 Dec 2015 14:32:15 +0000 (15:32 +0100)]
freedreno: fix bind_sampler_states when hwcso is NULL

src/gallium/tests/trivial/compute.c expects samplers to be cleaned
when the samplers list is NULL.
Like in radeon, the function behave like when the number of samplers
parameter is set to 0.

[small s/hwsco/hwcso/ typo fix]
Signed-off-by: Rob Clark <robclark@freedesktop.org>
8 years agogallium/util: Make u_prims_for_vertices() safe
Edward O'Callaghan [Wed, 9 Dec 2015 09:07:57 +0000 (20:07 +1100)]
gallium/util: Make u_prims_for_vertices() safe

Let us avoid trapping in hardware from a SIGFPE and instead
assert on a zero divisor.

Hint: This can occur if a PIPE_PRIM_? is not handled in
      u_prim_vertex_count() that results in ' info ' not
      being initialized in the expected manner.

Further, we also fix a possibly NULL pointer dereference
from ' info ' being NULL from a u_prim_vertex_count() call.

Signed-off-by: Edward O'Callaghan <eocallaghan@alterapraxis.com>
Signed-off-by: Marek Olšák <marek.olsak@amd.com>
8 years agodocs: add news item for mesa-demos 8.3.0 release
Andreas Boll [Wed, 9 Dec 2015 21:44:52 +0000 (22:44 +0100)]
docs: add news item for mesa-demos 8.3.0 release

Signed-off-by: Andreas Boll <andreas.boll.dev@gmail.com>
8 years agonv50,nvc0: fix use-after-free when vertex buffers are unbound
Patrick Rudolph [Sun, 6 Dec 2015 09:11:59 +0000 (10:11 +0100)]
nv50,nvc0: fix use-after-free when vertex buffers are unbound

Always reset the vertex bufctx to make sure there's no pointer to
an already freed pipe_resource left after unbinding buffers.
Fixes use after free crash in nvc0_bufctx_fence().

Bugzilla: https://bugs.freedesktop.org/show_bug.cgi?id=93004
Signed-off-by: Patrick Rudolph <siro@das-labor.org>
[imirkin: simplify nvc0 fix, apply to nv50]
Signed-off-by: Ilia Mirkin <imirkin@alum.mit.edu>
Cc: "11.0 11.1" <mesa-stable@lists.freedesktop.org>
8 years agomesa: Fix a typo in a comment
Andreas Boll [Wed, 9 Dec 2015 16:25:40 +0000 (17:25 +0100)]
mesa: Fix a typo in a comment

s/suports/supports/

Signed-off-by: Andreas Boll <andreas.boll.dev@gmail.com>
Reviewed-by: Brian Paul <brianp@vmware.com>
8 years agoglx: Fix a typo in a comment
Andreas Boll [Wed, 9 Dec 2015 16:25:15 +0000 (17:25 +0100)]
glx: Fix a typo in a comment

s/suports/supports/

Signed-off-by: Andreas Boll <andreas.boll.dev@gmail.com>
Reviewed-by: Brian Paul <brianp@vmware.com>
8 years agost/osmesa: Fix a typo in a comment
Andreas Boll [Wed, 9 Dec 2015 16:12:45 +0000 (17:12 +0100)]
st/osmesa: Fix a typo in a comment

s/suport/support/

Signed-off-by: Andreas Boll <andreas.boll.dev@gmail.com>
Reviewed-by: Brian Paul <brianp@vmware.com>
8 years agometa: Fix a typo in a print message
Andreas Boll [Wed, 9 Dec 2015 16:11:29 +0000 (17:11 +0100)]
meta: Fix a typo in a print message

s/Unkown/Unknown/

Signed-off-by: Andreas Boll <andreas.boll.dev@gmail.com>
Reviewed-by: Brian Paul <brianp@vmware.com>
8 years agomesa: Fix typos in print messages
Andreas Boll [Wed, 9 Dec 2015 16:10:33 +0000 (17:10 +0100)]
mesa: Fix typos in print messages

s/inconsistant/inconsistent/
s/occurences/occurrences/

Signed-off-by: Andreas Boll <andreas.boll.dev@gmail.com>
Reviewed-by: Brian Paul <brianp@vmware.com>
8 years agoglsl: Fix a typo in a comment
Andreas Boll [Wed, 9 Dec 2015 16:09:25 +0000 (17:09 +0100)]
glsl: Fix a typo in a comment

s/suports/supports/

Signed-off-by: Andreas Boll <andreas.boll.dev@gmail.com>
Reviewed-by: Brian Paul <brianp@vmware.com>
8 years agosvga: initialize pipe_driver_query_info entries with a macro
Brian Paul [Tue, 8 Dec 2015 16:30:32 +0000 (09:30 -0700)]
svga: initialize pipe_driver_query_info entries with a macro

To be safe, set all the fields in case the enums ordering/values
ever change.

Reviewed-by: Charmaine Lee <charmainel@vmware.com>
8 years agomesa: detect inefficient buffer use and report through debug output
Brian Paul [Tue, 8 Dec 2015 01:38:03 +0000 (18:38 -0700)]
mesa: detect inefficient buffer use and report through debug output

When a buffer is created with GL_STATIC_DRAW, its contents should not
be changed frequently.  But that's exactly what one application I'm
debugging does.  This patch adds code to try to detect inefficient
buffer use in a couple places.  The GL_ARB_debug_output mechanism is
used to report the issue.

NVIDIA's driver detects these sort of things too.

Other types of inefficient buffer use could also be detected in the
future.

Reviewed-by: José Fonseca <jfonseca@vmware.com>
8 years agodocs: add news item and link release notes for 11.0.7
Emil Velikov [Wed, 9 Dec 2015 16:12:32 +0000 (16:12 +0000)]
docs: add news item and link release notes for 11.0.7

Signed-off-by: Emil Velikov <emil.velikov@collabora.com>
8 years agodocs: add sha256 checksums for 11.0.7
Emil Velikov [Wed, 9 Dec 2015 16:09:37 +0000 (16:09 +0000)]
docs: add sha256 checksums for 11.0.7

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

8 years agodocs: add release notes for 11.0.7
Emil Velikov [Wed, 9 Dec 2015 15:19:30 +0000 (15:19 +0000)]
docs: add release notes for 11.0.7

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

8 years agoi965: Resolve color and flush for all active shader images in intel_update_state().
Francisco Jerez [Fri, 4 Sep 2015 12:30:41 +0000 (15:30 +0300)]
i965: Resolve color and flush for all active shader images in intel_update_state().

Fixes arb_shader_image_load_store/execution/load-from-cleared-image.shader_test.

Couldn't reproduce any significant FPS regression in CPU-bound
benchmarks from the Finnish benchmarking system on neither VLV nor BSW
after 30 runs with 95% confidence level.

Bugzilla: https://bugs.freedesktop.org/show_bug.cgi?id=92849
Cc: Chris Wilson <chris@chris-wilson.co.uk>
Cc: Jason Ekstrand <jason.ekstrand@intel.com>
Cc: "11.0 11.1" <mesa-stable@lists.freedesktop.org>
Tested-by: Jordan Justen <jordan.l.justen@intel.com>
Reviewed-by: Kristian Høgsberg <krh@bitplanet.net>
8 years agoi965: Document inconsistent units the URB size is represented in.
Francisco Jerez [Wed, 25 Nov 2015 12:51:16 +0000 (14:51 +0200)]
i965: Document inconsistent units the URB size is represented in.

Every other gen the representation of the URB size was changed and
previous ones weren't updated.  I'd be willing to write a series
normalizing this to be KB on all generations if anybody else cares.

8 years agoi965: Hook up L3 partitioning state atom.
Francisco Jerez [Tue, 8 Dec 2015 16:53:57 +0000 (18:53 +0200)]
i965: Hook up L3 partitioning state atom.

Reviewed-by: Samuel Iglesias Gonsálvez <siglesias@igalia.com>
Reviewed-by: Kristian Høgsberg <krh@bitplanet.net>
8 years agoi965: Work around L3 state leaks during context switches.
Francisco Jerez [Thu, 3 Sep 2015 15:23:19 +0000 (18:23 +0300)]
i965: Work around L3 state leaks during context switches.

This is going to require some rather intrusive kernel changes to fix
properly, in the meantime (and forever on at least pre-v4.1 kernels)
we'll have to restore the hardware defaults at the end of every batch
in which the L3 configuration was changed to avoid interfering with
the DDX and GL clients that use an older non-L3-aware version of Mesa.

Reviewed-by: Samuel Iglesias Gonsálvez <siglesias@igalia.com>
Reviewed-by: Kristian Høgsberg <krh@bitplanet.net>
v2: Optimize look-up of the default configuration by assuming it's the
    first entry of the L3 config array in order to avoid an FPS
    regression in GpuTest Triangle and SynMark OglBatch2-7 on most
    affected platforms.

Reviewed-by: Jordan Justen <jordan.l.justen@intel.com>
8 years agoi965: Add debug flag to print out the new L3 state during transitions.
Francisco Jerez [Sat, 5 Sep 2015 12:05:48 +0000 (15:05 +0300)]
i965: Add debug flag to print out the new L3 state during transitions.

Reviewed-by: Jordan Justen <jordan.l.justen@intel.com>
Reviewed-by: Samuel Iglesias Gonsálvez <siglesias@igalia.com>
Reviewed-by: Kenneth Graunke <kenneth@whitecape.org>
Reviewed-by: Kristian Høgsberg <krh@bitplanet.net>
8 years agoi965: Implement L3 state atom.
Francisco Jerez [Tue, 8 Dec 2015 16:53:22 +0000 (18:53 +0200)]
i965: Implement L3 state atom.

The L3 state atom calculates the target L3 partition weights when the
program bound to some shader stage is modified, and in case they are
far enough from the current partitioning it makes sure that the L3
state is re-emitted.

v2: Fix for inconsistent units the context URB size is expressed in.
    Clamp URB size to 1008 KB on SKL due to FF hardware limitation.

Reviewed-by: Samuel Iglesias Gonsálvez <siglesias@igalia.com>
Acked-by: Kenneth Graunke <kenneth@whitecape.org>
Reviewed-by: Kristian Høgsberg <krh@bitplanet.net>
8 years agoi965: Calculate appropriate L3 partition weights for the current pipeline state.
Francisco Jerez [Thu, 3 Sep 2015 15:15:19 +0000 (18:15 +0300)]
i965: Calculate appropriate L3 partition weights for the current pipeline state.

This calculates a rather conservative partitioning of the L3 cache
based on the shaders currently bound to the pipeline and whether they
use SLM, atomics, images or scratch space.  The result is intended to
be fine-tuned later on based on other pipeline state.

Note that the L3 partitioning calculated for VLV in the non-SLM non-DC
case differs from the hardware defaults in that it doesn't include a
DC partition and has twice as much RO cache space -- This is an
intentional functional change that improves performance in several
bandwidth-bound benchmarks on VLV (5% significance): SynMark
OglTexFilterAniso by 14.18%, SynMark OglTexFilterTri by 7.15%, Unigine
Heaven by 4.91%, SynMark OglShMapPcf by 2.15%, GpuTest Fur by 1.83%,
SynMark OglDrvRes by 1.80%, SynMark OglVsTangent by 1.71%, and a few
other benchmarks from the Finnish system by less than 1%.

Reviewed-by: Samuel Iglesias Gonsálvez <siglesias@igalia.com>
Reviewed-by: Kristian Høgsberg <krh@bitplanet.net>
8 years agoi965: Implement selection of the closest L3 configuration based on a vector of weights.
Francisco Jerez [Thu, 3 Sep 2015 15:10:24 +0000 (18:10 +0300)]
i965: Implement selection of the closest L3 configuration based on a vector of weights.

The input of the L3 set-up code is a vector giving the approximate
desired relative size of each partition.  This implements logic to
compare the input vector against the table of validated configurations
for the device and pick the closest compatible one.

Reviewed-by: Samuel Iglesias Gonsálvez <siglesias@igalia.com>
Reviewed-by: Kristian Høgsberg <krh@bitplanet.net>
8 years agoi965: Define and use REG_MASK macro to make masked MMIO writes slightly more readable.
Francisco Jerez [Thu, 26 Nov 2015 14:42:43 +0000 (16:42 +0200)]
i965: Define and use REG_MASK macro to make masked MMIO writes slightly more readable.

Reviewed-by: Samuel Iglesias Gonsálvez <siglesias@igalia.com>
Reviewed-by: Kenneth Graunke <kenneth@whitecape.org>
Reviewed-by: Kristian Høgsberg <krh@bitplanet.net>
8 years agoi965/hsw: Enable L3 atomics.
Francisco Jerez [Thu, 3 Sep 2015 15:08:59 +0000 (18:08 +0300)]
i965/hsw: Enable L3 atomics.

Improves performance of the arb_shader_image_load_store-atomicity
piglit test by over 25x (which isn't a real benchmark it's just heavy
on atomics -- the improvement in a microbenchmark I wrote a while ago
seemed to be even greater).  The drawback is one needs to be
extra-careful not to hang the GPU (in fact the whole system).  A DC
partition must have been allocated on L3, the "convert L3 cycle for DC
to UC" bit may not be set, the MOCS L3 cacheability bit must be set
for all surfaces accessed using DC atomics, and the SCRATCH1 and
ROW_CHICKEN3 bits must be kept in sync.

A fairly recent kernel is required for the command parser to allow
writes to these registers.

Reviewed-by: Samuel Iglesias Gonsálvez <siglesias@igalia.com>
Acked-by: Kenneth Graunke <kenneth@whitecape.org>
Reviewed-by: Kristian Høgsberg <krh@bitplanet.net>
8 years agoi965: Implement programming of the L3 configuration.
Francisco Jerez [Thu, 3 Sep 2015 15:07:44 +0000 (18:07 +0300)]
i965: Implement programming of the L3 configuration.

Reviewed-by: Samuel Iglesias Gonsálvez <siglesias@igalia.com>
Acked-by: Kenneth Graunke <kenneth@whitecape.org>
Reviewed-by: Kristian Høgsberg <krh@bitplanet.net>
8 years agoi965: Import tables enumerating the set of validated L3 configurations.
Francisco Jerez [Tue, 8 Dec 2015 16:52:56 +0000 (18:52 +0200)]
i965: Import tables enumerating the set of validated L3 configurations.

It should be possible to use additional L3 configurations other than
the ones listed in the tables of validated allocations ("BSpec »
3D-Media-GPGPU Engine » L3 Cache and URB [IVB+] » L3 Cache and URB [*]
» L3 Allocation and Programming"), but it seems sensible for now to
hard-code the tables in order to stick to the hardware docs.  Instead
of setting up the arbitrary L3 partitioning given as input, the
closest validated L3 configuration will be looked up in these tables
and used to program the hardware.

The included tables should work for Gen7-9.  Note that the quantities
are specified in ways rather than in KB, this is because the L3
control registers expect the value in ways, and because by doing that
we can re-use a single table for all GT variants of the same
generation (and in the case of IVB/HSW and CHV/SKL across different
generations) which generally have different L3 way sizes but allow the
same combinations of way allocations.

v2: Use slice count from the devinfo structure instead of the gt
    number to implement get_l3_way_size().

Reviewed-by: Samuel Iglesias Gonsálvez <siglesias@igalia.com>
Acked-by: Kenneth Graunke <kenneth@whitecape.org>
Reviewed-by: Kristian Høgsberg <krh@bitplanet.net>
8 years agoi965: Add slice count to the brw_device_info structure.
Francisco Jerez [Wed, 25 Nov 2015 13:15:20 +0000 (15:15 +0200)]
i965: Add slice count to the brw_device_info structure.

Reviewed-by: Samuel Iglesias Gonsálvez <siglesias@igalia.com>
Reviewed-by: Kristian Høgsberg <krh@bitplanet.net>
8 years agoi965/gen8: Don't add workaround bits to PIPE_CONTROL stalls if DC flush is set.
Francisco Jerez [Thu, 3 Sep 2015 14:19:10 +0000 (17:19 +0300)]
i965/gen8: Don't add workaround bits to PIPE_CONTROL stalls if DC flush is set.

According to the hardware docs a DC flush is sufficient to make
CS_STALL happy, there's no need to add STALL_AT_SCOREBOARD whenever
it's present.

Reviewed-by: Kenneth Graunke <kenneth@whitecape.org>
Reviewed-by: Kristian Høgsberg <krh@bitplanet.net>
8 years agoi965: Define state flag to signal that the URB size has been altered.
Francisco Jerez [Thu, 3 Sep 2015 14:15:57 +0000 (17:15 +0300)]
i965: Define state flag to signal that the URB size has been altered.

This will make sure that we recalculate the URB layout anytime the URB
size is modified by the L3 partitioning code.

Reviewed-by: Jordan Justen <jordan.l.justen@intel.com>
Reviewed-by: Kristian Høgsberg <krh@bitplanet.net>
8 years agoi965: Keep track of whether LRI is allowed in the context struct.
Francisco Jerez [Thu, 3 Sep 2015 14:08:16 +0000 (17:08 +0300)]
i965: Keep track of whether LRI is allowed in the context struct.

This stores the result of can_do_pipelined_register_writes() in the
context struct so we can find out later whether LRI can be used to
program the L3 configuration.

v2:
 * Split change of gen check in can_do_pipelined_register_writes (jljusten)

Reviewed-by: Jordan Justen <jordan.l.justen@intel.com>
Reviewed-by: Kristian Høgsberg <krh@bitplanet.net>
8 years agoi965: Adjust gen check in can_do_pipelined_register_writes
Francisco Jerez [Thu, 3 Sep 2015 14:08:16 +0000 (17:08 +0300)]
i965: Adjust gen check in can_do_pipelined_register_writes

Allow for pipelined register writes for gen < 7.

v2:
 * Split from another patch and adjust comment (jljusten)

Reviewed-by: Jordan Justen <jordan.l.justen@intel.com>
Reviewed-by: Kristian Høgsberg <krh@bitplanet.net>