mesa.git
7 years agost/glsl_to_tgsi: implement shader_group_vote and shader_ballot intrinsics
Nicolai Hähnle [Wed, 19 Apr 2017 08:08:49 +0000 (10:08 +0200)]
st/glsl_to_tgsi: implement shader_group_vote and shader_ballot intrinsics

Reviewed-by: Timothy Arceri <tarceri@itsqueeze.com>
Reviewed-by: Marek Olšák <marek.olsak@amd.com>
7 years agoglsl: add intrinsics for ARB_shader_group_vote and ARB_shader_ballot
Nicolai Hähnle [Wed, 19 Apr 2017 08:08:25 +0000 (10:08 +0200)]
glsl: add intrinsics for ARB_shader_group_vote and ARB_shader_ballot

These operations are currently implemented as IR expressions. However,
they cannot be transformed and moved in the way that other IR
expressions can because they have non-trivial interactions with
control-flow.

Reviewed-by: Timothy Arceri <tarceri@itsqueeze.com>
Reviewed-by: Marek Olšák <marek.olsak@amd.com>
7 years agoglsl: reject image qualifiers with non-image types inside uniform blocks
Samuel Pitoiset [Wed, 26 Apr 2017 16:50:16 +0000 (18:50 +0200)]
glsl: reject image qualifiers with non-image types inside uniform blocks

Fixes the following ARB_shader_image_load_store tests:

format-layout-with-non-image-type.frag
memory-qualifier-with-non-image-type.frag

Signed-off-by: Samuel Pitoiset <samuel.pitoiset@gmail.com>
Reviewed-by: Timothy Arceri <tarceri@itsqueeze.com>
7 years agoglsl: introduce validate_image_qualifier_for_type() helper
Samuel Pitoiset [Wed, 26 Apr 2017 16:50:15 +0000 (18:50 +0200)]
glsl: introduce validate_image_qualifier_for_type() helper

Signed-off-by: Samuel Pitoiset <samuel.pitoiset@gmail.com>
Reviewed-by: Timothy Arceri <tarceri@itsqueeze.com>
7 years agoglsl: fix error when using format qualifiers with non-image types
Samuel Pitoiset [Wed, 26 Apr 2017 16:50:14 +0000 (18:50 +0200)]
glsl: fix error when using format qualifiers with non-image types

Signed-off-by: Samuel Pitoiset <samuel.pitoiset@gmail.com>
Reviewed-by: Timothy Arceri <tarceri@itsqueeze.com>
7 years agoutil/disk_cache: remove percentage based max cache limit
Timothy Arceri [Fri, 28 Apr 2017 03:05:52 +0000 (13:05 +1000)]
util/disk_cache: remove percentage based max cache limit

The more I think about it the more this seems like a bad idea.
When we were deleting old cache dirs this wasn't so bad as it
was unlikely we would ever hit the actual limit before things
were cleaned up. Now that we only start cleaning up old cache
items once the limit is reached the a percentage based max
cache limit is more risky.

For the inital release of shader cache I think its better to
stick to a more conservative cache limit, at least until we
have some way of cleaning up the cache more aggressively.

Cc: "17.1" <mesa-stable@lists.freedesktop.org>
Reviewed-by: Michel Dänzer <michel.daenzer@amd.com>
7 years agoanv: Move queues, events, and semaphores to their own file
Jason Ekstrand [Thu, 16 Feb 2017 00:48:47 +0000 (16:48 -0800)]
anv: Move queues, events, and semaphores to their own file

Things are about to get more complicated, especially as far as
semaphores are concerned.

Reviewed-by: Chad Versace <chadversary@chromium.org>
7 years agoanv: Implement VK_KHX_external_memory_fd
Jason Ekstrand [Tue, 28 Feb 2017 18:58:40 +0000 (10:58 -0800)]
anv: Implement VK_KHX_external_memory_fd

This commit just exposes the memory handle type.  There's interesting we
need to do here for images.  So long as the user doesn't set any crazy
environment variables such as INTEL_DEBUG=nohiz, all of the compression
formats etc. should "just work" at least for opaque handle types.

v2 (chadv):
  - Rebase.
  - Fix vkGetPhysicalDeviceImageFormatProperties2KHR when
    handleType == 0.
  - Move handleType-independency comments out of handleType-switch, in
    vkGetPhysicalDeviceExternalBufferPropertiesKHX.  Reduces diff in
    future dma_buf patches.

Co-authored-with: Chad Versace <chadversary@chromium.org>
Reviewed-by: Chad Versace <chadversary@chromium.org>
7 years agoanv: Use the BO cache for DeviceMemory allocations
Jason Ekstrand [Tue, 14 Mar 2017 00:20:15 +0000 (17:20 -0700)]
anv: Use the BO cache for DeviceMemory allocations

Reviewed-by: Chad Versace <chadversary@chromium.org>
7 years agoanv/allocator: Add a BO cache
Jason Ekstrand [Mon, 13 Mar 2017 23:18:54 +0000 (16:18 -0700)]
anv/allocator: Add a BO cache

This cache allows us to easily ensure that we have a unique anv_bo for
each gem handle.  We'll need this in order to support multiple-import of
memory objects and semaphores.

v2 (Jason Ekstrand):
 - Reject BO imports if the size doesn't match the prime fd size as
   reported by lseek().

Reviewed-by: Chad Versace <chadversary@chromium.org>
7 years agoanv: Implement VK_KHX_external_memory
Jason Ekstrand [Wed, 15 Feb 2017 02:57:22 +0000 (18:57 -0800)]
anv: Implement VK_KHX_external_memory

This is the trivial implementation that just exposes the extension
string but exposes zero external handle types.

Reviewed-by: Chad Versace <chadversary@chromium.org>
7 years agoanv: Implement VK_KHX_external_memory_capabilities
Chad Versace [Tue, 28 Feb 2017 18:58:31 +0000 (10:58 -0800)]
anv: Implement VK_KHX_external_memory_capabilities

This is a complete but trivial implementation. It's trivial becasue We
support no external memory capabilities yet.  Most of the real work in
this commit is in reworking the UUIDs advertised by the driver.

v2 (chadv):
  - Fix chain traversal in vkGetPhysicalDeviceImageFormatProperties2KHR.
    Extract VkPhysicalDeviceExternalImageFormatInfoKHX from the chain of
    input structs, not the chain of output structs.
  - In vkGetPhysicalDeviceImageFormatProperties2KHR, iterate over the
    input chain and the output chain separately. Reduces diff in future
    dma_buf patches.

Co-authored-with: Jason Ekstrand <jason@jlekstrand.net>
Reviewed-by: Chad Versace <chadversary@chromium.org>
Reviewed-by: Jason Ekstrand <jason@jlekstrand.net>
7 years agoanv/physical_device: Rename uuid to pipeline_cache_uuid
Jason Ekstrand [Mon, 27 Feb 2017 17:36:20 +0000 (09:36 -0800)]
anv/physical_device: Rename uuid to pipeline_cache_uuid

We're about to have more UUIDs for different things so this one really
needs to be properly labeled.

Reviewed-by: Chad Versace <chadversary@chromium.org>
7 years agoanv: Refactor device_get_cache_uuid into physical_device_init_uuids
Jason Ekstrand [Mon, 27 Feb 2017 17:34:53 +0000 (09:34 -0800)]
anv: Refactor device_get_cache_uuid into physical_device_init_uuids

Reviewed-by: Chad Versace <chadversary@chromium.org>
7 years agoanv: Set EXEC_OBJECT_ASYNC when available
Jason Ekstrand [Thu, 13 Apr 2017 23:30:19 +0000 (16:30 -0700)]
anv: Set EXEC_OBJECT_ASYNC when available

Reviewed-by: Chad Versace <chadversary@chromium.org>
7 years agoanv/cmd_buffer: Use the device allocator for QueueSubmit
Jason Ekstrand [Tue, 28 Feb 2017 01:31:05 +0000 (17:31 -0800)]
anv/cmd_buffer: Use the device allocator for QueueSubmit

The command is really operating on a Queue not a command buffer and the
nearest object to that with an allocator is VkDevice.

Reviewed-by: Chad Versace <chadversary@chromium.org>
Cc: "17.0 17.1" <mesa-dev@lists.freedesktop.org>
7 years agomesa: remove wip framebuffer code
Timothy Arceri [Thu, 27 Apr 2017 11:07:11 +0000 (21:07 +1000)]
mesa: remove wip framebuffer code

This was added in 34b3b40af97d back in 2006. Seems it wasn't
needed.

Reviewed-by: Samuel Pitoiset <samuel.pitoiset@gmail.com>
7 years agoglsl: set vector_elements to 1 for samplers
Samuel Pitoiset [Wed, 26 Apr 2017 11:49:13 +0000 (13:49 +0200)]
glsl: set vector_elements to 1 for samplers

I don't see any reasons why vector_elements is 1 for images and
0 for samplers. This increases consistency and allows to clean
up some code a bit.

This will also help for ARB_bindless_texture.

No piglit regressions with RadeonSI.

Signed-off-by: Samuel Pitoiset <samuel.pitoiset@gmail.com>
Reviewed-by: Timothy Arceri <tarceri@itsqueeze.com>
Reviewed-by: Nicolai Hähnle <nicolai.haehnle@amd.com>
7 years agoclover: Fix build since clang r301442
Jan Vesely [Thu, 27 Apr 2017 16:11:37 +0000 (12:11 -0400)]
clover: Fix build since clang r301442

v2: rename default_ik -> ik_opencl

Signed-off-by: Jan Vesely <jan.vesely@rutgers.edu>
Reviewed-by: Francisco Jerez <currojerez@riseup.net>
7 years agodisk_cache: use block size rather than file size
Timothy Arceri [Thu, 27 Apr 2017 01:15:30 +0000 (11:15 +1000)]
disk_cache: use block size rather than file size

The majority of cache files are less than 1kb this resulted in us
greatly miscalculating the amount of disk space used by the cache.

Using the number of blocks allocated to the file is more
conservative and less likely to cause issues.

This change will result in cache sizes being miscalculated further
until old items added with the previous calculation have all been
removed. However I don't see anyway around that, the previous
patch should help limit that problem.

Cc: "17.1" <mesa-stable@lists.freedesktop.org>
Reviewed-and-Tested-by: Michel Dänzer <michel.daenzer@amd.com>
7 years agodisk_cache: reduce default cache size to 5% of filesystem
Timothy Arceri [Thu, 27 Apr 2017 01:15:29 +0000 (11:15 +1000)]
disk_cache: reduce default cache size to 5% of filesystem

Modern disks are extremely large and are only going to get bigger.
Usage has shown frequent Mesa upgrades can result in the cache
growing very fast i.e. wasting a lot of disk space unnecessarily.

5% seems like a more reasonable default.

Cc: "17.1" <mesa-stable@lists.freedesktop.org>
Acked-by: Michel Dänzer <michel.daenzer@amd.com>
7 years agoradeon/ac: remove assert causing regression
Dave Airlie [Thu, 27 Apr 2017 10:35:56 +0000 (11:35 +0100)]
radeon/ac: remove assert causing regression

This assert wasn't in the original radeonsi code but I added
it without totally understanding the original code, it caused
some regressions in variable-indexing tessellation shaders.

Fixes: e2659176 radeonsi/ac: move vertex export remove to common code.
Reported-by: Michel Dänzer <michel.daenzer@amd.com>
Signed-off-by: Dave Airlie <airlied@redhat.com>
7 years agoradeon/ac: fix build on llvm 3.8.1
Dave Airlie [Thu, 27 Apr 2017 10:20:25 +0000 (11:20 +0100)]
radeon/ac: fix build on llvm 3.8.1

Add missing include to fix build.

Signed-off-by: Dave Airlie <airlied@redhat.com>
7 years agonvc0: Enable compute support for Pascal
Boyan Ding [Sun, 23 Apr 2017 15:19:23 +0000 (23:19 +0800)]
nvc0: Enable compute support for Pascal

Signed-off-by: Boyan Ding <boyan.j.ding@gmail.com>
Reviewed-by: Ilia Mirkin <imirkin@alum.mit.edu>
Reviewed-by: Samuel Pitoiset <samuel.pitoiset@gmail.com>
7 years agonvc0: Add new launch descriptor format for GP100
Boyan Ding [Wed, 26 Apr 2017 13:21:58 +0000 (21:21 +0800)]
nvc0: Add new launch descriptor format for GP100

v2:
Also handle the the new format in indirect dispatch
Use compute class check instead of chipset check

Signed-off-by: Boyan Ding <boyan.j.ding@gmail.com>
Reviewed-by: Ilia Mirkin <imirkin@alum.mit.edu>
Reviewed-by: Samuel Pitoiset <samuel.pitoiset@gmail.com>
7 years agonvc0: Fix index of unk fields in nve4_cp_launch_desc
Boyan Ding [Sun, 23 Apr 2017 15:19:21 +0000 (23:19 +0800)]
nvc0: Fix index of unk fields in nve4_cp_launch_desc

Signed-off-by: Boyan Ding <boyan.j.ding@gmail.com>
Reviewed-by: Ilia Mirkin <imirkin@alum.mit.edu>
Reviewed-by: Samuel Pitoiset <samuel.pitoiset@gmail.com>
7 years agonouveau: Fix indentation of maxwell compute class definitions
Boyan Ding [Sun, 23 Apr 2017 15:19:20 +0000 (23:19 +0800)]
nouveau: Fix indentation of maxwell compute class definitions

Signed-off-by: Boyan Ding <boyan.j.ding@gmail.com>
Reviewed-by: Ilia Mirkin <imirkin@alum.mit.edu>
Reviewed-by: Samuel Pitoiset <samuel.pitoiset@gmail.com>
7 years agoanv: Don't place scratch buffers above the 32-bit boundary
Jason Ekstrand [Sat, 22 Apr 2017 22:51:01 +0000 (15:51 -0700)]
anv: Don't place scratch buffers above the 32-bit boundary

This fixes rendering corruptions in DOOM.  Hopefully, it will also make
Jenkins a bit more stable as we've been seeing some random failures and
GPU hangs ever since turning on 48bit.

Bugzilla: https://bugs.freedesktop.org/show_bug.cgi?id=100620
Fixes: 651ec926fc1 "anv: Add support for 48-bit addresses"
Tested-by: Grazvydas Ignotas <notasas@gmail.com>
Reviewed-by: Kenneth Graunke <kenneth@whitecape.org>
Cc: "17.1" <mesa-stable@lists.freedesktop.org>
7 years agoradv/ac: eliminate unused vertex shader outputs. (v2)
Dave Airlie [Fri, 21 Apr 2017 02:38:05 +0000 (03:38 +0100)]
radv/ac: eliminate unused vertex shader outputs. (v2)

This is ported from radeonsi, and I can see at least one
Talos shader drops an export due to this, and saves some
VGPR usage.

v2: use shared code.

Reviewed-by: Bas Nieuwenhuizen <bas@basnieuwenhuizen.nl>
Signed-off-by: Dave Airlie <airlied@redhat.com>
7 years agoradeonsi/ac: move vertex export remove to common code.
Dave Airlie [Tue, 25 Apr 2017 22:33:29 +0000 (23:33 +0100)]
radeonsi/ac: move vertex export remove to common code.

This code can be shared by radv, we bump the max to
VARYING_SLOT_MAX here, but that shouldn't have too
much fallout.

Reviewed-by: Marek Olšák <marek.olsak@amd.com>
Reviewed-by: Nicolai Hähnle <nicolai.haehnle@amd.com>
Reviewed-by: Bas Nieuwenhuizen <bas@basnieuwenhuizen.nl>
Signed-off-by: Dave Airlie <airlied@redhat.com>
7 years agoradv: fix regression in descriptor set freeing.
Dave Airlie [Wed, 26 Apr 2017 23:31:29 +0000 (09:31 +1000)]
radv: fix regression in descriptor set freeing.

Since the host pool changes,

Fixes:
dEQP-VK.api.descriptor_pool.out_of_pool_memory

Fixes: 126d5ad "radv: Use host memory pool for non-freeable descriptors."
Reviewed-by: Bas Nieuwenhuizen <bas@basnieuwenhuizen.nl>
Signed-off-by: Dave Airlie <airlied@redhat.com>
7 years agoglsl: remove duplicate validation
Timothy Arceri [Wed, 26 Apr 2017 03:56:45 +0000 (13:56 +1000)]
glsl: remove duplicate validation

Varying types have already been validated in
apply_type_qualifier_to_variable() by this point.

Reviewed-by: Alejandro Piñeiro <apinheiro@igalia.com>
Reviewed-by: Samuel Pitoiset <samuel.pitoiset@gmail.com>
7 years agoglsl: use without_array() rather than get_scalar_type()
Timothy Arceri [Wed, 26 Apr 2017 03:56:44 +0000 (13:56 +1000)]
glsl: use without_array() rather than get_scalar_type()

Here get_scalar_type() was just being use to remove the array
after that we converted it back to base_type anyway so just
use the without_array() helper.

Reviewed-by: Alejandro Piñeiro <apinheiro@igalia.com>
7 years agosvga: fix vertex buffer binding issue
Brian Paul [Tue, 25 Apr 2017 14:02:28 +0000 (08:02 -0600)]
svga: fix vertex buffer binding issue

When we ran Viewperf11's Maya-03 test 3 we saw warnings about flushing
the command buffer with mapped buffers.  This happened when transitioning
from hardware rendering to a 'draw' fallback path.

The problem is the util_set_vertex_buffers_count() function doesn't do
exactly what we want in svga_hwtnl_vertex_buffers().  In a case such as
dst_count=2, dst={bufA, bufB}, count=1 and src={bufC}, when the function
returns we'll have dst_count=2 and dst={bufC, bufB}.  What we really want
is dst_count=1 and dst={bufC, NULL}.  As it was, we were telling the svga
device that there were two vertex buffers when in fact we really only
needed one for the subsequent drawing command.

In this particular case, we first did hardware drawing with {bufA, bufB}
then we transitioned to the 'draw' module, consuming vertex data from
bufA and bufB and writing the new vertex data to bufC.  bufA and bufB are
mapped for reading when we flush the command buffer but should not be
referenced by the command buffer.  The above change fixes that.

No Piglit regressions.  Also tested with Viewperf, Google Earth, Heaven,
etc.

VMware bug 1842059

Reviewed-by: Charmaine Lee <charmainel@vmware.com>
7 years agogallium/util: reduce util_snprintf() calls in debug_flush_might_flush_cb()
Brian Paul [Mon, 24 Apr 2017 18:58:22 +0000 (12:58 -0600)]
gallium/util: reduce util_snprintf() calls in debug_flush_might_flush_cb()

We only need to construct the debug message if the mapped_sync flag is set.
This should make the function faster since the flag is usually false.

Reviewed-by: Charmaine Lee <charmainel@vmware.com>
7 years agogallium/util: add some comments in u_debug_flush.c
Brian Paul [Mon, 24 Apr 2017 18:57:14 +0000 (12:57 -0600)]
gallium/util: add some comments in u_debug_flush.c

Trivial.

Reviewed-by: Charmaine Lee <charmainel@vmware.com>
7 years agosvga: Removed the unused label 'done' in svga_validate_surface_view()
Charmaine Lee [Thu, 20 Apr 2017 18:40:00 +0000 (11:40 -0700)]
svga: Removed the unused label 'done' in svga_validate_surface_view()

Trivial fix

7 years agosvga: use the winsys interface to invalidate surface
Charmaine Lee [Thu, 20 Apr 2017 01:34:36 +0000 (18:34 -0700)]
svga: use the winsys interface to invalidate surface

Instead of directly sending the InvalidateGBSurface command,
this patch uses the invalidate_surface interface.

Fixes Linux VM piglit failures including
   ext_texture_array-gen-mipmap, fbo-generatemipmap-array S3TC_DXT1

Reviewed-by: Brian Paul <brianp@vmware.com>
7 years agosvga: fix format for screen target
Charmaine Lee [Tue, 18 Apr 2017 22:55:59 +0000 (15:55 -0700)]
svga: fix format for screen target

This patch revises the fix in commit 606f13afa31c9f041a68eb22cc32112ce813f944
to properly translate the surface format for screen target.
Instead of changing the svga format for PIPE_FORMAT_B5G6R5_UNORM
to SVGA3D_R5G6B5 for all texture surfaces, this patch only restricts
SVGA3D_R5G6B5 for screen target surfaces. This avoids rendering
failures when specify a non-vgpu10 format in a vgpu10 context with
software renderer.

Fixes piglit failures spec@!opengl 1.1@draw-pixels,
                      spec@!opengl 1.1@teximage-colors gl_r3_g3_b2
                      spec@!opengl 1.1@texwrap formats

Tested Xorg with 16bits depth.
Also tested with MTT piglit, MTT glretrace.

Reviewed-by: Brian Paul <brianp@vmware.com>
7 years agosvga: cache the backing surface handle in the texture object
Charmaine Lee [Tue, 25 Apr 2017 20:32:59 +0000 (14:32 -0600)]
svga: cache the backing surface handle in the texture object

CinebenchR15 not only binds the same texture for rendering and sampling,
it actually changes the framebuffer buffer attachment very often, causing
a lot of backed surface view to be created and a lot of surface copies
to be done. This patch caches the backed surface handle
in the texture resource and allows the backed surface view to
reuse the backed surface handle.  With this patch, the number of
backed surface view reduces from 1312 to 3. Unfortunately, this
does not eliminate all the surface copies. There are still surface
copies involved when we switch from original to backed surface handle
for rendering.

Tested with CinebenchR15, NobelClinicianViewer, Turbine, Lightsmark2008,
            MTT glretrace, MTT piglit.

Reviewed-by: Brian Paul <brianp@vmware.com>
7 years agosvga: Update the backing resource only if needed
Charmaine Lee [Tue, 25 Apr 2017 20:31:04 +0000 (14:31 -0600)]
svga: Update the backing resource only if needed

This patch adds a timestamp in svga_surface structure to keep track
of when the backing surface is last sync with the original resource.
This helps to avoid unnecessary surface copy from the original
resource to the backing surface if the original resource has not
since been modified.

This reduces the amount of surface copy with CinebenchR15.

Tested with CinebenchR15, mtt glretrace.

Reviewed-by: Brian Paul <brianp@vmware.com>
7 years agosvga: Set the surface dirty bit for the right surface view
Charmaine Lee [Thu, 13 Apr 2017 22:12:25 +0000 (15:12 -0700)]
svga: Set the surface dirty bit for the right surface view

For VGPU10, we will render to a backed surface view when
the same resource is used for rendering and sampling.
In this case, we will mark the dirty bit for the backed surface view.

Reviewed-by: Brian Paul <brianp@vmware.com>
7 years agosvga: Move rendertarget view related fields to hw_clear state
Charmaine Lee [Tue, 25 Apr 2017 20:27:51 +0000 (14:27 -0600)]
svga: Move rendertarget view related fields to hw_clear state

This patch moves the rendertarget view related fields from
svga_hw_draw_state to svga_hw_clear_state where all the hw
framebuffer related state resides.

Reviewed-by: Brian Paul <brianp@vmware.com>
7 years agosvga: Move setting the rendered_to flags to framebuffer emit time
Charmaine Lee [Wed, 12 Apr 2017 23:21:51 +0000 (16:21 -0700)]
svga: Move setting the rendered_to flags to framebuffer emit time

Instead of setting the rendered_to flags at set time, this patch
moves the setting of the flags to framebuffer emit time.

Reviewed-by: Brian Paul <brianp@vmware.com>
7 years agosvga: add const qualifiers on svga_check_sampler_view_resource_collision()
Brian Paul [Mon, 10 Apr 2017 21:02:05 +0000 (15:02 -0600)]
svga: add const qualifiers on svga_check_sampler_view_resource_collision()

We don't change any of the argument objects.

Reviewed-by: Charmaine Lee <charmainel@vmware.com>
7 years agosvga: improve surface view debug messages
Brian Paul [Mon, 10 Apr 2017 19:51:48 +0000 (13:51 -0600)]
svga: improve surface view debug messages

The old ones were somewhat cryptic.

Reviewed-by: Charmaine Lee <charmainel@vmware.com>
7 years agosvga: add DEBUG_SAMPLERS
Brian Paul [Mon, 10 Apr 2017 19:48:21 +0000 (13:48 -0600)]
svga: add DEBUG_SAMPLERS

The debug output in svga_create_sampler_state() was controlled by
DEBUG_VIEWS but that's not consistent with the other debug output for
sampler views.  Create/use a new debug flag just for this.

Reviewed-by: Charmaine Lee <charmainel@vmware.com>
7 years agosvga: fail screen creation if HW version is too old
Brian Paul [Thu, 6 Apr 2017 20:55:53 +0000 (14:55 -0600)]
svga: fail screen creation if HW version is too old

Tested by verifying 3D acceleration works with HWv8 but not earlier.
For HWv7 and older we get the GDI Generic renderer.

Reviewed-by: Neha Bhende<bhenden@vmware.com>
Reviewed-by: Charmaine Lee <charmainel@vmware.com>
7 years agowinsys/svga: fix error path when kernel is not able to create surface
Deepak Rawat [Mon, 3 Apr 2017 15:12:43 +0000 (08:12 -0700)]
winsys/svga: fix error path when kernel is not able to create surface

If for some reason kernel is not able to create surface,
when no buffer was provided the function
vmw_svga_winsys_surface_create should return NULL.

This patch fixes the issue where the code was not following the
clean up path in case of error, which used to cause SIGSEGV.

Reviewed-by: Sinclair Yeh <syeh@vmware.com>
7 years agodraw: whitespace fixes in draw_pipe_vbuf.c
Brian Paul [Tue, 25 Apr 2017 00:51:05 +0000 (18:51 -0600)]
draw: whitespace fixes in draw_pipe_vbuf.c

Remove trailing whitespace, fix formatting, etc.  Trivial.

7 years agost/mesa: minor clean-ups in st_update_renderbuffer_surface()
Brian Paul [Fri, 21 Apr 2017 19:46:28 +0000 (13:46 -0600)]
st/mesa: minor clean-ups in st_update_renderbuffer_surface()

Remove unneeded parens.  Add const qualifiers.  Move var decls closer
to where they're used.

Reviewed-by: Marek Olšák <marek.olsak@amd.com>
Reviewed-by: Neha Bhende<bhenden@vmware.com>
7 years agonv50,nvc0: disable the TGSI merge registers pass
Samuel Pitoiset [Mon, 24 Apr 2017 22:31:49 +0000 (00:31 +0200)]
nv50,nvc0: disable the TGSI merge registers pass

shader-db results on GK106 (Thanks Karol):

total instructions in shared programs : 3931608 -> 3929463 (-0.05%)
total gprs used in shared programs    : 481255 -> 479014 (-0.47%)
total local used in shared programs   : 27481 -> 27381 (-0.36%)
total bytes used in shared programs   : 36031256 -> 36011120 (-0.06%)

                local        gpr       inst      bytes
    helped          14        1471        1309        1309
      hurt           1          88         384         384

Signed-off-by: Samuel Pitoiset <samuel.pitoiset@gmail.com>
Acked-by: Ilia Mirkin <imirkin@alum.mit.edu>
7 years agoradeonsi: disable the TGSI merge registers pass
Samuel Pitoiset [Mon, 24 Apr 2017 22:31:48 +0000 (00:31 +0200)]
radeonsi: disable the TGSI merge registers pass

47109 shaders in 29632 tests
Totals:
SGPRS: 1917364 -> 1916620 (-0.04 %)
VGPRS: 1165802 -> 1165202 (-0.05 %)
Spilled SGPRs: 1880 -> 1843 (-1.97 %)
Spilled VGPRs: 70 -> 65 (-7.14 %)
Private memory VGPRs: 1184 -> 1184 (0.00 %)
Scratch size: 1312 -> 1308 (-0.30 %) dwords per thread
Code Size: 60211356 -> 60192268 (-0.03 %) bytes
LDS: 1077 -> 1077 (0.00 %) blocks
Max Waves: 428597 -> 428674 (0.02 %)
Wait states: 0 -> 0 (0.00 %)

Totals from affected shaders:
SGPRS: 238173 -> 237429 (-0.31 %)
VGPRS: 149556 -> 148956 (-0.40 %)
Spilled SGPRs: 1263 -> 1226 (-2.93 %)
Spilled VGPRs: 25 -> 20 (-20.00 %)
Private memory VGPRs: 0 -> 0 (0.00 %)
Scratch size: 20 -> 16 (-20.00 %) dwords per thread
Code Size: 10457904 -> 10438816 (-0.18 %) bytes
LDS: 50 -> 50 (0.00 %) blocks
Max Waves: 41283 -> 41360 (0.19 %)
Wait states: 0 -> 0 (0.00 %)

Signed-off-by: Samuel Pitoiset <samuel.pitoiset@gmail.com>
Reviewed-by: Nicolai Hähnle <nicolai.haehnle@amd.com>
Reviewed-by: Marek Olšák <marek.olsak@amd.com>
7 years agost/glsl_to_tgsi: disable the merge registers pass conditionally
Samuel Pitoiset [Mon, 24 Apr 2017 22:31:47 +0000 (00:31 +0200)]
st/glsl_to_tgsi: disable the merge registers pass conditionally

The main goal of this pass to merge temporary registers in order
to reduce the total number of registers and also to produce
optimal TGSI code.

In fact, compilers seem to be confused when temporary variables
are already merged, maybe because it's done too early in the
process.

Skipping the pass, reduce both the register pressure and the code
size, at least for Nouveau and RadeonSI because they have a real
backend compiler.

Found by luck while fixing an issue in the TGSI dead code elimination
pass which affects tex instructions with bindless samplers.

Signed-off-by: Samuel Pitoiset <samuel.pitoiset@gmail.com>
Reviewed-by: Nicolai Hähnle <nicolai.haehnle@amd.com>
Reviewed-by: Marek Olšák <marek.olsak@amd.com>
7 years agogallium: add PIPE_SHADER_CAP_TGSI_SKIP_MERGE_REGISTERS
Samuel Pitoiset [Mon, 24 Apr 2017 22:31:46 +0000 (00:31 +0200)]
gallium: add PIPE_SHADER_CAP_TGSI_SKIP_MERGE_REGISTERS

Signed-off-by: Samuel Pitoiset <samuel.pitoiset@gmail.com>
Reviewed-by: Nicolai Hähnle <nicolai.haehnle@amd.com>
Reviewed-by: Marek Olšák <marek.olsak@amd.com>
7 years agoradeonsi: use unsynchronized transfers for shader binary uploads
Samuel Pitoiset [Tue, 25 Apr 2017 22:36:12 +0000 (00:36 +0200)]
radeonsi: use unsynchronized transfers for shader binary uploads

Because the buffer is new, it can't be referenced by any CS.

This can save few CPU cycles by skipping the whole
PIPE_TRANSFER_UNSYNCHRONIZED if in amdgpu_bo_map().

Signed-off-by: Samuel Pitoiset <samuel.pitoiset@gmail.com>
Reviewed-by: Nicolai Hähnle <nicolai.haehnle@amd.com>
Reviewed-by: Marek Olšák <marek.olsak@amd.com>
7 years agoradeonsi: turn si_shader_key::mono into a non-union
Marek Olšák [Tue, 14 Feb 2017 21:23:04 +0000 (22:23 +0100)]
radeonsi: turn si_shader_key::mono into a non-union

A merged LS-HS shader needs both fix_fetch and inputs_to_copy
for compilation.

Reviewed-by: Nicolai Hähnle <nicolai.haehnle@amd.com>
7 years agoradeonsi: adjust ESGS ring buffer size computation on VI
Marek Olšák [Sat, 22 Apr 2017 12:47:03 +0000 (14:47 +0200)]
radeonsi: adjust ESGS ring buffer size computation on VI

Cc: 17.0 17.1 <mesa-stable@lists.freedesktop.org>
Reviewed-by: Nicolai Hähnle <nicolai.haehnle@amd.com>
7 years agoradeonsi/gfx9: don't set deprecated field PARTIAL_ES_WAVE_ON
Marek Olšák [Sun, 23 Apr 2017 18:29:04 +0000 (20:29 +0200)]
radeonsi/gfx9: don't set deprecated field PARTIAL_ES_WAVE_ON

Cc: 17.1 <mesa-stable@lists.freedesktop.org>
Reviewed-by: Nicolai Hähnle <nicolai.haehnle@amd.com>
7 years agoradeonsi/gfx9: set MAX_PRIMGRP_IN_WAVE in the correct register
Marek Olšák [Sun, 23 Apr 2017 18:14:42 +0000 (20:14 +0200)]
radeonsi/gfx9: set MAX_PRIMGRP_IN_WAVE in the correct register

Cc: 17.1 <mesa-stable@lists.freedesktop.org>
Reviewed-by: Nicolai Hähnle <nicolai.haehnle@amd.com>
7 years agoradeonsi/gfx9: add a workaround for viewing a slice of 3D as a 2D image
Marek Olšák [Sun, 23 Apr 2017 22:01:06 +0000 (00:01 +0200)]
radeonsi/gfx9: add a workaround for viewing a slice of 3D as a 2D image

Cc: 17.1 <mesa-stable@lists.freedesktop.org>
Reviewed-by: Nicolai Hähnle <nicolai.haehnle@amd.com>
7 years agoradeonsi/gfx9: fix 1D array shader images
Marek Olšák [Sun, 23 Apr 2017 21:29:20 +0000 (23:29 +0200)]
radeonsi/gfx9: fix 1D array shader images

Cc: 17.1 <mesa-stable@lists.freedesktop.org>
Reviewed-by: Nicolai Hähnle <nicolai.haehnle@amd.com>
7 years agoradeonsi/gfx9: fix most things wrong with shader images
Marek Olšák [Sun, 23 Apr 2017 21:06:38 +0000 (23:06 +0200)]
radeonsi/gfx9: fix most things wrong with shader images

There are 2 major hw changes:
- The address must always point to the address of level 0. GFX9 tiling
  modes don't allow binding to a non-0 level.
- 3D must always be bound as 3D, because 2D and 3D use entirely different
  tiling modes, and the texture target determines which set of modes is
  used.

Cc: 17.1 <mesa-stable@lists.freedesktop.org>
Reviewed-by: Nicolai Hähnle <nicolai.haehnle@amd.com>
7 years agoradeonsi/gfx9: fix texture buffer objects and image buffers with IDXEN==0
Marek Olšák [Sun, 23 Apr 2017 19:32:22 +0000 (21:32 +0200)]
radeonsi/gfx9: fix texture buffer objects and image buffers with IDXEN==0

Cc: 17.1 <mesa-stable@lists.freedesktop.org>
Reviewed-by: Nicolai Hähnle <nicolai.haehnle@amd.com>
7 years agoconfigure: print LDFLAGS alongside CFLAGS & co.
Eric Engestrom [Tue, 25 Apr 2017 20:15:55 +0000 (21:15 +0100)]
configure: print LDFLAGS alongside CFLAGS & co.

Signed-off-by: Eric Engestrom <eric@engestrom.ch>
Reviewed-by: Nicolai Hähnle <nicolai.haehnle@amd.com>
7 years agomesa: tidy up left over APPLE_vertex_array_object semantics
Timothy Arceri [Sat, 22 Apr 2017 07:30:27 +0000 (17:30 +1000)]
mesa: tidy up left over APPLE_vertex_array_object semantics

Reviewed-by: Nicolai Hähnle <nicolai.haehnle@amd.com>
7 years agomesa: inline bind_vertex_array() helper
Timothy Arceri [Sat, 22 Apr 2017 07:10:09 +0000 (17:10 +1000)]
mesa: inline bind_vertex_array() helper

The previous commit removed the only other user of this function.

Reviewed-by: Nicolai Hähnle <nicolai.haehnle@amd.com>
7 years agomesa: drop APPLE_vertex_array_object support
Timothy Arceri [Sat, 22 Apr 2017 07:01:15 +0000 (17:01 +1000)]
mesa: drop APPLE_vertex_array_object support

Shared context support for VAOs was dropped in 0b2750620b65.

From the ARB_vertex_array_object spec:

   "This extension differs from GL_APPLE_vertex_array_object
   in that client memory cannot be accessed through a
   non-zero vertex array object.  It also differs in that
   vertex array objects are explicitly not sharable between
   contexts."

Nobody should be using this extension over
ARB_vertex_array_object anymore so just drop it rather than
adding locking back just for VAOs created from these
functions.

For reference the Nvidia blob doesn't expose this extension.

Reviewed-by: Nicolai Hähnle <nicolai.haehnle@amd.com>
7 years agoradv: Enable userspace fence checking.
Bas Nieuwenhuizen [Tue, 25 Apr 2017 22:04:46 +0000 (00:04 +0200)]
radv: Enable userspace fence checking.

v2: - Added some error handling.
    - memset the buffer to 0.

v3: Added assert for buffer size.

Signed-off-by: Bas Nieuwenhuizen <basni@google.com>
Reviewed-by: Dave Airlie <airlied@redhat.com>
7 years agoi965: Remove unused variable 'options'
Matt Turner [Tue, 25 Apr 2017 17:13:57 +0000 (10:13 -0700)]
i965: Remove unused variable 'options'

Should have been removed in commit ad55b1a7701a

7 years agoglsl: Initialize current_var
Matt Turner [Tue, 25 Apr 2017 17:12:03 +0000 (10:12 -0700)]
glsl: Initialize current_var

CID: 1324644 (Uninitialized pointer field)

7 years agoradv/ac: setup mrt exports then export them in one go. (v2)
Dave Airlie [Sun, 23 Apr 2017 18:52:34 +0000 (19:52 +0100)]
radv/ac: setup mrt exports then export them in one go. (v2)

Noticed while looking at Sascha Willems deferred shaders.

This is a bit of an llvm workaround, llvm was producing this:
        v_cvt_pkrtz_f16_f32_e64 v4, v7, v8                       ; D2960004 00021107
        v_cvt_pkrtz_f16_f32_e64 v6, v9, 1.0                      ; D2960006 0001E509
        s_waitcnt vmcnt(0)                                       ; BF8C0F70
        exp mrt0 v4, v4, v6, v6 compr                            ; C400040F 00000604
        s_waitcnt expcnt(0)                                      ; BF8C0F0F
        v_cvt_pkrtz_f16_f32_e64 v4, v12, v5                      ; D2960004 00020B0C
        v_cvt_pkrtz_f16_f32_e64 v5, v14, 1.0                     ; D2960005 0001E50E
        exp mrt1 v4, v4, v5, v5 compr                            ; C400041F 00000504
        s_waitcnt expcnt(0)                                      ; BF8C0F0F
        v_cvt_pkrtz_f16_f32_e64 v0, v0, v1                       ; D2960000 00020300
        v_cvt_pkrtz_f16_f32_e64 v1, v2, v3                       ; D2960001 00020702
        exp mrt2 v0, v0, v1, v1 done compr vm                    ; C4001C2F 00000100

After this change:
        v_cvt_pkrtz_f16_f32_e64 v4, v7, v8                       ; D2960004 00021107
        s_waitcnt vmcnt(0)                                       ; BF8C0F70
        v_cvt_pkrtz_f16_f32_e64 v0, v0, v1                       ; D2960000 00020300
        v_cvt_pkrtz_f16_f32_e64 v6, v9, 1.0                      ; D2960006 0001E509
        v_cvt_pkrtz_f16_f32_e64 v5, v12, v5                      ; D2960005 00020B0C
        v_cvt_pkrtz_f16_f32_e64 v7, v14, 1.0                     ; D2960007 0001E50E
        exp mrt0 v4, v4, v6, v6 compr                            ; C400040F 00000604
        v_cvt_pkrtz_f16_f32_e64 v1, v2, v3                       ; D2960001 00020702
        exp mrt1 v5, v5, v7, v7 compr                            ; C400041F 00000705
        exp mrt2 v0, v0, v1, v1 done compr vm                    ; C4001C2F 00000100

No waitcnt for exports are emitted.

v2: fixup index->mrt mapping (Bas).

Reviewed-by: Bas Nieuwenhuizen <bas@basnieuwenhuizen.nl>
Signed-off-by: Dave Airlie <airlied@redhat.com>
7 years agoradv/ac: overhaul vs output/ps input routing
Dave Airlie [Fri, 21 Apr 2017 02:17:23 +0000 (03:17 +0100)]
radv/ac: overhaul vs output/ps input routing

In order to cleanly eliminate exports rewrite the
code first to mirror how radeonsi works for now.

Reviewed-by: Bas Nieuwenhuizen <bas@basnieuwenhuizen.nl>
Signed-off-by: Dave Airlie <airlied@redhat.com>
7 years agoradv/ac: move point coord after layer/viewport.
Dave Airlie [Fri, 21 Apr 2017 02:02:46 +0000 (03:02 +0100)]
radv/ac: move point coord after layer/viewport.

These need to be ordered as per shader enum ordering, I'll
rewrite this soon, but this is a bug fix.

Reviewed-by: Bas Nieuwenhuizen <bas@basnieuwenhuizen.nl>
Signed-off-by: Dave Airlie <airlied@redhat.com>
7 years agogallium: remove u_caps.c/h interface
Samuel Pitoiset [Mon, 24 Apr 2017 23:10:50 +0000 (01:10 +0200)]
gallium: remove u_caps.c/h interface

No longer used.

Signed-off-by: Samuel Pitoiset <samuel.pitoiset@gmail.com>
Reviewed-by: Nicolai Hähnle <nicolai.haehnle@amd.com>
7 years agoddebug: implement get_query_result_resource
Marek Olšák [Sun, 16 Apr 2017 20:04:57 +0000 (22:04 +0200)]
ddebug: implement get_query_result_resource

Reviewed-by: Nicolai Hähnle <nicolai.haehnle@amd.com>
7 years agotrace: don't trace resource_destroy
Marek Olšák [Sun, 16 Apr 2017 18:09:03 +0000 (20:09 +0200)]
trace: don't trace resource_destroy

due to the lack of pipe_resource wrapping, we can get this call from inside
of driver calls, which would try to lock an already-locked mutex.

Reviewed-by: Nicolai Hähnle <nicolai.haehnle@amd.com>
7 years agogallium/util: add debugging helpers printing pipeline statistics
Marek Olšák [Sat, 22 Apr 2017 21:44:46 +0000 (23:44 +0200)]
gallium/util: add debugging helpers printing pipeline statistics

typically useful for hw bring-up

Reviewed-by: Nicolai Hähnle <nicolai.haehnle@amd.com>
7 years agoAndroid: fix r300g only build
Rob Herring [Mon, 24 Apr 2017 16:46:58 +0000 (11:46 -0500)]
Android: fix r300g only build

If r300g is the only radeon driver built, the Android build fails to
build:

ninja: error:
'out/target/product/linaro_x86_64/obj/STATIC_LIBRARIES/libmesa_pipe_radeon_intermediates/export_includes',
needed by
'out/target/product/linaro_x86_64/obj/SHARED_LIBRARIES/gallium_dri_intermediates/import_includes',
missing and no known rule to make it

This is because the path to build libmesa_pipe_radeon was only getting
added for r600g and radeonsi, but the library dependency was added for
all radeon drivers. As libmesa_pipe_radeon is not needed for r300g, drop
the library dependency.

Cc: Mauro Rossi <issor.oruam@gmail.com>
Signed-off-by: Rob Herring <robh@kernel.org>
Acked-by: Emil Velikov <emil.velikov@collabora.com>
7 years agomesa: use locked version of HashWalk for xfb objects
Timothy Arceri [Mon, 24 Apr 2017 05:59:24 +0000 (15:59 +1000)]
mesa: use locked version of HashWalk for xfb objects

From Chapter 5 'Shared Objects and Multiple Contexts' of
the OpenGL 4.5 spec:

   "Objects which contain references to other objects include
   framebuffer, program pipeline, query, transform feedback,
   and vertex array objects.   Such objects are called container
   objects and are not shared"

Reviewed-by: Nicolai Hähnle <nicolai.haehnle@amd.com>
7 years agomesa: create locked version of HashWalk
Timothy Arceri [Mon, 24 Apr 2017 05:59:23 +0000 (15:59 +1000)]
mesa: create locked version of HashWalk

Reviewed-by: Nicolai Hähnle <nicolai.haehnle@amd.com>
7 years agogenxml: Fix gen_pack_header.py crash when field type is invalid.
Rafael Antognolli [Fri, 21 Apr 2017 22:11:17 +0000 (15:11 -0700)]
genxml: Fix gen_pack_header.py crash when field type is invalid.

Just return earlier in that case. Also set prefix to an empty string, so
we don't get to use it undefined.

Signed-off-by: Rafael Antognolli <rafael.antognolli@intel.com>
Reviewed-by: Kenneth Graunke <kenneth@whitecape.org>
7 years agogenxml: Make BLEND_STATE command support variable length array.
Rafael Antognolli [Thu, 30 Mar 2017 18:33:05 +0000 (11:33 -0700)]
genxml: Make BLEND_STATE command support variable length array.

We need to emit BLEND_STATE, which size is 1 + 2 * nr_draw_buffers
dwords (on gen8+), but the BLEND_STATE struct length is always 17. By
marking it size 1, which is actually the size of the struct minus the
BLEND_STATE_ENTRY's, we can emit a BLEND_STATE of variable number of
entries.

For gen6 and gen7 we set length to 0, since it only contains
BLEND_STATE_ENTRY's, and no other data.

With this change, we also change the code for blorp and anv to emit only
the needed BLEND_STATE_ENTRY's, instead of always emitting 16 dwords on
gen6-7 and 17 dwords on gen8+.

v2:
   - Use designated initializers on blorp and remove 0 from
   initialization (Jason)
   - Default entries to disabled on Vulkan (Jason)
   - Rebase code.

Signed-off-by: Rafael Antognolli <rafael.antognolli@intel.com>
Reviewed-by: Kenneth Graunke <kenneth@whitecape.org>
7 years agogenxml: Fix python crash when no dwords are found.
Rafael Antognolli [Fri, 31 Mar 2017 16:57:22 +0000 (09:57 -0700)]
genxml: Fix python crash when no dwords are found.

If the 'dwords' dict is empty, max(dwords.keys()) throws an exception.
This case could happen when we have an instruction that is only an array
of other structs, with variable length.

v2:
   - Add another clause for empty dwords and make it work with python 3
   (Dylan)
   - Set the length to 0 if dwords is empty, and do not declare dw

Signed-off-by: Rafael Antognolli <rafael.antognolli@intel.com>
Reviewed-by: Dylan Baker <dylan@pnwbakers.com>
Reviewed-by: Kenneth Graunke <kenneth@whitecape.org>
7 years agogenxml: Remove unused parameter.
Rafael Antognolli [Fri, 14 Apr 2017 15:36:45 +0000 (08:36 -0700)]
genxml: Remove unused parameter.

'start' parameter from Group.emit_pack_function() is useless.

Signed-off-by: Rafael Antognolli <rafael.antognolli@intel.com>
Reviewed-by: Kenneth Graunke <kenneth@whitecape.org>
7 years agointel/aubinator: Correctly read variable length structs.
Rafael Antognolli [Tue, 18 Apr 2017 16:41:40 +0000 (09:41 -0700)]
intel/aubinator: Correctly read variable length structs.

Before this commit, when a group with count="0" is found, only one field
is added to the struct representing the instruction. This causes only
one entry to be printed by aubinator, for variable length groups.

With this commit we "detect" that there's a variable length group
(count="0") and store the offset of the last entry added to the struct
when reading the xml. When finally reading the aubdump file, we check
the size of the group and whether we have variable number of elements,
and in that case, reuse the last field to add the remaining elements.

Signed-off-by: Rafael Antognolli <rafael.antognolli@intel.com>
Tested-by: Jason Ekstrand <jason@jlekstrand.net>
Acked-by: Kenneth Graunke <kenneth@whitecape.org>
7 years agoisl/format: Update the R16G16B16X16_FLOAT entry
Nanley Chery [Mon, 6 Mar 2017 22:55:34 +0000 (14:55 -0800)]
isl/format: Update the R16G16B16X16_FLOAT entry

The section of the PRM mentioned in the code comment above this table
says that this format supports the render target write message. Internal
documentation says that this format also supports alpha blending. As a
side effect, this allows CCS_D buffers to be created for images with
this format.

Reviewed-by: Jason Ekstrand <jason@jlekstrand.net>
Signed-off-by: Nanley Chery <nanley.g.chery@intel.com>
7 years agoanv/pass: Delete anv_pass::subpass_attachments
Nanley Chery [Mon, 10 Apr 2017 18:47:10 +0000 (11:47 -0700)]
anv/pass: Delete anv_pass::subpass_attachments

This field has no users.

Reviewed-by: Jason Ekstrand <jason@jlekstrand.net>
Signed-off-by: Nanley Chery <nanley.g.chery@intel.com>
7 years agointel/fs: Take into account amount of data read in spilling cost heuristic.
Francisco Jerez [Thu, 20 Apr 2017 18:42:27 +0000 (11:42 -0700)]
intel/fs: Take into account amount of data read in spilling cost heuristic.

Until now the spilling cost calculation was neglecting the amount of
data read from the register during the spilling cost calculation.
This caused it to make suboptimal decisions in some cases leading to
higher memory bandwidth usage than necessary.

Improves Unigine Heaven performance by ~4% on BDW, reversing an
unintended FPS regression from my previous commit
147e71242ce539ff28e282f009c332818c35f5ac with n=12 and statistical
significance 5%.  In addition SynMark2 OglCSDof performance is
improved by an additional ~5% on SKL, and a Kerbal Space Program
apitrace around the Moho planet I can provide on request improves by
~20%.

Cc: <mesa-stable@lists.freedesktop.org>
Reviewed-by: Plamena Manolova <plamena.manolova@intel.com>
Reviewed-by: Jason Ekstrand <jason@jlekstrand.net>
7 years agointel/fs: Use regs_written() in spilling cost heuristic for improved accuracy.
Francisco Jerez [Thu, 20 Apr 2017 18:44:01 +0000 (11:44 -0700)]
intel/fs: Use regs_written() in spilling cost heuristic for improved accuracy.

This is what we use later on to compute the number of registers that
will actually get spilled to memory, so it's more likely to match
reality than the current open-coded approximation.

Cc: <mesa-stable@lists.freedesktop.org>
Reviewed-by: Plamena Manolova <plamena.manolova@intel.com>
Reviewed-by: Jason Ekstrand <jason@jlekstrand.net>
7 years agoi965/vec4: Use reads_accumulator_implicitly(), not MACH checks.
Kenneth Graunke [Sat, 22 Apr 2017 22:02:08 +0000 (15:02 -0700)]
i965/vec4: Use reads_accumulator_implicitly(), not MACH checks.

Curro pointed out that I should not just check for MACH, but use
the reads_accumulator_implicitly() helper, which would also prevent
the same bug with MAC and SADA2 (if we ever decide to use them).

Cc: mesa-stable@lists.freedesktop.org
Reviewed-by: Francisco Jerez <currojerez@riseup.net>
7 years agoandroid: radv/ac: Fix nir.h include
Mauro Rossi [Sat, 22 Apr 2017 10:13:37 +0000 (12:13 +0200)]
android: radv/ac: Fix nir.h include

Fixes following building errors due to missing include paths:

external/mesa/src/amd/common/ac_shader_info.c:23:10: fatal error: 'nir/nir.h' file not found
         ^

external/mesa/src/compiler/nir/nir.h:48:10: fatal error: 'nir_opcodes.h' file not found
         ^

Fixes: 224cf29 "radv/ac: add initial pre-pass for shader info gathering"
Acked-by: Dave Airlie <Airlied@redhat.com>
Acked-by: Emil Velikov <emil.velikov@collabora.com>
7 years agoconfigure.ac: Fix typos.
Vinson Lee [Thu, 20 Apr 2017 21:48:50 +0000 (14:48 -0700)]
configure.ac: Fix typos.

Signed-off-by: Vinson Lee <vlee@freedesktop.org>
Reviewed-by: Alejandro Piñeiro <apinheiro@igalia.com>
Reviewed-by: Emil Velikov <emil.velikov@collabora.com>
Cc: <mesa-stable@lists.freedesktop.org>
7 years agoradv/ac: copy llvm machine feature flags from radeonsi.
Dave Airlie [Sun, 23 Apr 2017 19:21:29 +0000 (20:21 +0100)]
radv/ac: copy llvm machine feature flags from radeonsi.

This just updates this to use the same flags as radeonsi
for consistency.

Reviewed-by: Bas Nieuwenhuizen <bas@basnieuwenhuizen.nl>
Signed-off-by: Dave Airlie <airlied@redhat.com>
7 years agoi965: remove now unused GLSL IR optimisations
Timothy Arceri [Mon, 17 Apr 2017 23:30:47 +0000 (09:30 +1000)]
i965: remove now unused GLSL IR optimisations

These are no longer used since the previous commit.

Acked-by: Elie Tournier <elie.tournier@collabora.com>
Reviewed-by: Kenneth Graunke <kenneth@whitecape.org>
7 years agoi965: remove GLSL IR optimisation loop
Timothy Arceri [Tue, 17 Jan 2017 23:28:22 +0000 (10:28 +1100)]
i965: remove GLSL IR optimisation loop

IVB is running into some spilling issues in piglit with the
loop removed. However those tests are not really reflective
of a real world use case, also fp64 is brand new to IVB
so we leave the spilling issues to be resolved at a later
time.

Run time for shader-db on my machine goes from ~795 seconds to
~665 seconds.

shader-db results BDW:

total instructions in shared programs: 12969459 -> 12968891 (-0.00%)
instructions in affected programs: 1463154 -> 1462586 (-0.04%)
helped: 3622
HURT: 3326

total cycles in shared programs: 246453572 -> 246504318 (0.02%)
cycles in affected programs: 208842622 -> 208893368 (0.02%)
helped: 24029
HURT: 35407

total loops in shared programs: 2931 -> 2931 (0.00%)
loops in affected programs: 0 -> 0
helped: 0
HURT: 0

total spills in shared programs: 14560 -> 14498 (-0.43%)
spills in affected programs: 2270 -> 2208 (-2.73%)
helped: 17
HURT: 2

total fills in shared programs: 19671 -> 19632 (-0.20%)
fills in affected programs: 2060 -> 2021 (-1.89%)
helped: 17
HURT: 2

LOST:   17
GAINED: 40

Most of the hurt shaders are 1-2 instructions, with what looks like a max of 7.

I've looked at the worst cycles regressions and as far as I can tell its just
a scheduling difference.

Acked-by: Elie Tournier <elie.tournier@collabora.com>
Reviewed-by: Kenneth Graunke <kenneth@whitecape.org>
7 years agoglsl: use ARB_enhahnced_layouts for packing where possible
Timothy Arceri [Sun, 31 Jul 2016 12:39:26 +0000 (22:39 +1000)]
glsl: use ARB_enhahnced_layouts for packing where possible

If packing doesn't cross locations we can easily make use of
ARB_enhanced_layouts to do packing rather than using the GLSL IR
lowering pass lower_packed_varyings().

Shader-db Broadwell results:

total instructions in shared programs: 12977822 -> 12977819 (-0.00%)
instructions in affected programs: 1871 -> 1868 (-0.16%)
helped: 4
HURT: 3

total cycles in shared programs: 246567288 -> 246567668 (0.00%)
cycles in affected programs: 1370386 -> 1370766 (0.03%)
helped: 592
HURT: 733

Acked-by: Elie Tournier <elie.tournier@collabora.com>
Reviewed-by: Kenneth Graunke <kenneth@whitecape.org>
7 years agoglsl: disable varying packing for varying used by interpolateAt*
Timothy Arceri [Fri, 14 Apr 2017 06:25:58 +0000 (16:25 +1000)]
glsl: disable varying packing for varying used by interpolateAt*

Currently the NIR backends depend on GLSL IR copy propagation to
fix up the interpolateAt* function params after varying packing
changes the shader input to a global. It's possible copy propagation
might not always do what we need it too, and we also shouldn't
depend on optimisations to do this type of thing for us.

I'm not sure if the same is true for TGSI, but the following
commit should re-enable packing for most cases in a safer way,
so we just disable it everywhere.

No change in shader-db for i965 (BDW)

Acked-by: Elie Tournier <elie.tournier@collabora.com>
Reviewed-by: Kenneth Graunke <kenneth@whitecape.org>
7 years agoglsl_to_nir: skip ir_var_shader_shared variables
Timothy Arceri [Wed, 18 Jan 2017 23:41:57 +0000 (10:41 +1100)]
glsl_to_nir: skip ir_var_shader_shared variables

These should be lowered away in GLSL IR but if we don't get dead
code to clean them up it causes issues in glsl_to_nir.

We wan't to drop as many GLSL IR opts in future as we can so this
makes glsl_to_nir just ignore the vars if it sees them.

In future we will want to just use the nir lowering pass that
Vulkan currently uses.

Acked-by: Elie Tournier <elie.tournier@collabora.com>
Reviewed-by: Kenneth Graunke <kenneth@whitecape.org>
7 years agonir/i965: add before ffma algebraic opts
Timothy Arceri [Fri, 13 Jan 2017 06:25:11 +0000 (17:25 +1100)]
nir/i965: add before ffma algebraic opts

This shuffles constants down in the reverse of what the previous
patch does and applies some simpilifications that may be made
possible from doing so.

Shader-db results BDW:

total instructions in shared programs: 12980814 -> 12977822 (-0.02%)
instructions in affected programs: 281889 -> 278897 (-1.06%)
helped: 1231
HURT: 128

total cycles in shared programs: 246562852 -> 246567288 (0.00%)
cycles in affected programs: 11271524 -> 11275960 (0.04%)
helped: 1630
HURT: 1378

V2: mark float opts as inexact

Reviewed-by: Elie Tournier <elie.tournier@collabora.com>
Reviewed-by: Kenneth Graunke <kenneth@whitecape.org>