Rob Clark [Tue, 5 Dec 2017 14:53:56 +0000 (09:53 -0500)]
mesa/st: move cloning of NIR shader for compute
Since in the NIR case, driver takes ownership of the NIR shader, we need
to clone what is passed to the driver. Normally this is done as part of
creating the shader variant (where is clone is anyways needed). But
compute shaders have no variants, so we were cloning earlier.
The problem is that after the NIR linking optimizations, we ended up
cloning *before* all the lowering passes where done.
So move this into st_get_cp_variant(), to make compute shaders work more
like other shader stages.
Signed-off-by: Rob Clark <robdclark@gmail.com>
Reviewed-by: Marek Olšák <marek.olsak@amd.com>
Dave Airlie [Fri, 3 Nov 2017 01:33:44 +0000 (11:33 +1000)]
r600: refactor and export some shader selector code for compute
This just moves some code around to make it easier to add compute.
Signed-off-by: Dave Airlie <airlied@redhat.com>
Dave Airlie [Fri, 3 Nov 2017 01:27:23 +0000 (11:27 +1000)]
r600: add compute support to compressed resource handling.
This just adds support for decompressing compute resources.
Signed-off-by: Dave Airlie <airlied@redhat.com>
Dave Airlie [Fri, 3 Nov 2017 01:23:55 +0000 (11:23 +1000)]
r600: update max threads per block for evergreen compute
Signed-off-by: Dave Airlie <airlied@redhat.com>
Dave Airlie [Fri, 3 Nov 2017 01:14:28 +0000 (11:14 +1000)]
r600/shader: add local memory support to shader assembler.
This is needed for compute shaders.
v1.1: make work for vectors, fix missing lds ops.
Signed-off-by: Dave Airlie <airlied@redhat.com>
Dave Airlie [Fri, 3 Nov 2017 01:11:15 +0000 (11:11 +1000)]
r600/cs: add support for compute to image/buffers/atomics state
This just adds the compute paths to state handling for the
main objects
Signed-off-by: Dave Airlie <airlied@redhat.com>
Dave Airlie [Fri, 3 Nov 2017 02:23:26 +0000 (12:23 +1000)]
r600: handle compute null key shader state
Signed-off-by: Dave Airlie <airlied@redhat.com>
Dave Airlie [Mon, 27 Nov 2017 06:54:00 +0000 (06:54 +0000)]
r600: add some missing cayman register defines
These are just taken from the kernel, and were seen in some fglrx dumps.
Signed-off-by: Dave Airlie <airlied@redhat.com>
Dave Airlie [Thu, 23 Nov 2017 04:05:05 +0000 (14:05 +1000)]
r600: don't set EOP on pop or loop end
This appears to bad, compute shaders hang without it.
Signed-off-by: Dave Airlie <airlied@redhat.com>
Dave Airlie [Tue, 5 Dec 2017 08:41:35 +0000 (08:41 +0000)]
r600/ssbo: refactor out buffer coord calcs and use for atomic path.
The atomic rat path has a bug in the ssbo path, refactor out the
address calcs from the load/store paths and reuse to fix the bug
in the buffer rat atomic path.
Signed-off-by: Dave Airlie <airlied@redhat.com>
Dave Airlie [Tue, 5 Dec 2017 08:38:26 +0000 (08:38 +0000)]
r600/ssbo: fix multi-dword buffer loads.
This fixes loading from different channels.
Signed-off-by: Dave Airlie <airlied@redhat.com>
Dave Airlie [Tue, 5 Dec 2017 08:35:24 +0000 (08:35 +0000)]
r600/ssbo: use r32ui format for ssbo resources.
This works best for returning the correct values and sizes in
tests.
Signed-off-by: Dave Airlie <airlied@redhat.com>
Dave Airlie [Tue, 5 Dec 2017 08:34:26 +0000 (08:34 +0000)]
r600: refactor out the immediate setup code.
This just refactors the same code out of the images/buffers paths.
Signed-off-by: Dave Airlie <airlied@redhat.com>
Dave Airlie [Tue, 5 Dec 2017 08:28:13 +0000 (08:28 +0000)]
r600/shader: fix ssbo atomic operations formats.
Don't try and use the image format for ssbo, just 32-bit uint.
Signed-off-by: Dave Airlie <airlied@redhat.com>
Dave Airlie [Tue, 5 Dec 2017 08:27:38 +0000 (08:27 +0000)]
r600/shader: fix thread id loading.
This just changes how thread id loading is done, it makes
smaller shaders if we don't use thread id gprs.
Signed-off-by: Dave Airlie <airlied@redhat.com>
Rob Herring [Tue, 5 Dec 2017 00:35:48 +0000 (18:35 -0600)]
Android: enable noreturn and returns_nonnull attributes
Commit
94ca8e04adf6 ("spirv: Add vtn_fail and vtn_assert helpers") broke
Android builds which have -Werror enabled with the following errors:
external/mesa3d/src/compiler/spirv/spirv_to_nir.c:272:1: error: control may reach end of non-void function [-Werror,-Wreturn-type]
external/mesa3d/src/compiler/spirv/spirv_to_nir.c:810:1: error: control may reach end of non-void function [-Werror,-Wreturn-type]
...
The problem is the noreturn attribute is not enabled and we to define
HAVE_FUNC_ATTRIBUTE_NORETURN.
Auditing src/util/macros.h, we're also missing
HAVE_FUNC_ATTRIBUTE_RETURNS_NONNULL and HAVE_FUNC_ATTRIBUTE_WARN_UNUSED_RESULT,
so add them too.
Fixes: 94ca8e04adf6 ("spirv: Add vtn_fail and vtn_assert helpers")
Cc: Jason Ekstrand <jason.ekstrand@intel.com>
Reviewed-by: Jason Ekstrand <jason@jlekstrand.net>
Reviewed-by: Emil Velikov <emil.velikov@collabora.com>
Signed-off-by: Rob Herring <robh@kernel.org>
Marek Olšák [Fri, 1 Dec 2017 02:05:18 +0000 (03:05 +0100)]
gallium/u_upload_mgr: allow drivers to specify pipe_resource::flags
Reviewed-by: Nicolai Hähnle <nicolai.haehnle@amd.com>
Marek Olšák [Fri, 1 Dec 2017 01:07:05 +0000 (02:07 +0100)]
winsys/amdgpu: add RADEON_FLAG_READ_ONLY
Reviewed-by: Nicolai Hähnle <nicolai.haehnle@amd.com>
Marek Olšák [Thu, 30 Nov 2017 23:14:51 +0000 (00:14 +0100)]
gallium/radeon: remove RADEON_HEAP_VRAM_GTT
Only winsyses can set VRAM|GTT. Drivers shouldn't if they want to use
winsys allocators.
Reviewed-by: Nicolai Hähnle <nicolai.haehnle@amd.com>
Marek Olšák [Thu, 30 Nov 2017 23:06:34 +0000 (00:06 +0100)]
gallium/radeon: move setting VRAM|GTT into winsyses
The combined VRAM|GTT heap will be removed.
Reviewed-by: Nicolai Hähnle <nicolai.haehnle@amd.com>
Marek Olšák [Thu, 30 Nov 2017 21:46:39 +0000 (22:46 +0100)]
radeonsi: flush the context after resource_copy_region for buffer exports
Cc: 17.2 17.3 <mesa-stable@lists.freedesktop.org>
Reviewed-by: Nicolai Hähnle <nicolai.haehnle@amd.com>
Mauro Rossi [Sat, 2 Dec 2017 12:36:57 +0000 (13:36 +0100)]
Android: gallium/radeon: fix libmesa_amd_common dependency
libmesa_amd_common static dependency is added in Android build
to avoid the following building errors:
In file included from external/mesa/src/gallium/drivers/radeon/r600_buffer_common.c:24:
In file included from external/mesa/src/gallium/drivers/radeonsi/si_pipe.h:26:
external/mesa/src/gallium/drivers/radeonsi/si_shader.h:138:10: fatal error: 'ac_binary.h' file not found
^~~~~~~~~~~~~
1 error generated.
...
In file included from external/mesa/src/gallium/drivers/radeon/r600_gpu_load.c:34:
In file included from external/mesa/src/gallium/drivers/radeonsi/si_pipe.h:26:
external/mesa/src/gallium/drivers/radeonsi/si_shader.h:138:10: fatal error: 'ac_binary.h' file not found
^~~~~~~~~~~~~
1 error generated.
Fixes: 950221f923 ("radeonsi: remove r600_common_screen")
Reviewed-by: Marek Olšák <marek.olsak@amd.com>
Reviewed-by: Emil Velikov <emil.velikov@collabora.com>
Dave Airlie [Fri, 3 Nov 2017 02:23:01 +0000 (12:23 +1000)]
st/mesa: handle compute atomics
Just reuse the cs atomics bit and emit the hw atomic state.
Reviewed-by: Nicolai Hähnle <nicolai.haehnle@amd.com>
Signed-off-by: Dave Airlie <airlied@redhat.com>
Dave Airlie [Fri, 1 Dec 2017 04:06:19 +0000 (04:06 +0000)]
r600/atomic: add cayman version of atomic save/restore from GDS (v2)
On Cayman we don't use the append/consume counters (fglrx doesn't)
and they don't seem to work well with compute shaders.
This just uses GDS instead to do the atomic operations.
v1.1: remove unused line.
v2: use EOS on cayman, it appears to work.
Acked-by: Nicolai Hähnle <nicolai.haehnle@amd.com>
Signed-off-by: Dave Airlie <airlied@redhat.com>
Dave Airlie [Fri, 1 Dec 2017 04:02:33 +0000 (04:02 +0000)]
r600/atomic: refactor out evergreen atomic setup/save code.
For cayman we want to use different code paths.
Signed-off-by: Dave Airlie <airlied@redhat.com>
Timothy Arceri [Thu, 23 Nov 2017 00:29:59 +0000 (11:29 +1100)]
radeonsi: pass llvm type directly to buffer_load()
Reviewed-by: Nicolai Hähnle <nicolai.haehnle@amd.com>
Dylan Baker [Tue, 14 Nov 2017 01:58:51 +0000 (17:58 -0800)]
meson: build gallium nine state_tracker
v2: - set d3d_drivers_path instead of dri_drivers_path
- Fix nine guard to check for all relavent gallium drivers
- Link with libswdri and libswkmsdri when necessary
- Fix pkg-config generation
- Add missing comma
Signed-off-by: Dylan Baker <dylanx.c.baker@intel.com>
Reviewed-by: Eric Engestrom <eric.engestrom@imgtec.com>
Dylan Baker [Tue, 31 Oct 2017 00:40:30 +0000 (17:40 -0700)]
meson: build gallium xa state tracker
Signed-off-by: Dylan Baker <dylanx.c.baker@intel.com>
Reviewed-by: Eric Engestrom <eric.engestrom@imgtec.com>
Dylan Baker [Mon, 30 Oct 2017 22:49:37 +0000 (15:49 -0700)]
meson: build gallium va state tracker
Signed-off-by: Dylan Baker <dylanx.c.baker@intel.com>
Reviewed-by: Eric Engestrom <eric.engestrom@imgtec.com>
Dylan Baker [Mon, 30 Oct 2017 22:23:06 +0000 (15:23 -0700)]
meson: build gallium omx state tracker
Signed-off-by: Dylan Baker <dylanx.c.baker@intel.com>
Reviewed-by: Eric Engestrom <eric.engestrom@imgtec.com>
Dylan Baker [Mon, 30 Oct 2017 21:32:30 +0000 (14:32 -0700)]
meson: build gallium xvmc state tracker
Signed-off-by: Dylan Baker <dylanx.c.baker@intel.com>
Reviewed-by: Eric Engestrom <eric.engestrom@imgtec.com>
Dylan Baker [Mon, 30 Oct 2017 21:04:21 +0000 (14:04 -0700)]
meson: build gallium vdpau state tracker
Signed-off-by: Dylan Baker <dylanx.c.baker@intel.com>
Reviewed-by: Eric Engestrom <eric.engestrom@imgtec.com>
Dylan Baker [Tue, 31 Oct 2017 22:12:20 +0000 (15:12 -0700)]
meson: drop gallium-media argument
This argument is the wrong approach for handling gallium media state
trackers, since it doesn't allow for an auto option. Instead we'll use
tristates, which do allow for auto.
This option has never been wired to anything anyway.
Signed-off-by: Dylan Baker <dylanx.c.baker@intel.com>
Reviewed-by: Eric Engestrom <eric.engestrom@imgtec.com>
Dylan Baker [Fri, 10 Nov 2017 01:52:31 +0000 (17:52 -0800)]
meson: extend install_megadrivers script to handle symmlinking
Which is required for the gallium media state trackers.
v2: - Make symlinks local instead of absolute
Signed-off-by: Dylan Baker <dylanx.c.baker@intel.com>
Reviewed-by: Eric Engestrom <eric.engestrom@imgtec.com>
Dylan Baker [Wed, 29 Nov 2017 17:46:25 +0000 (09:46 -0800)]
meson: Add osmesa.sym script as a link dependency (gallium-osmesa)
v2: - Add this patch
Signed-off-by: Dylan Baker <dylanx.c.baker@intel.com>
Reviewed-by: Eric Engestrom <eric.engestrom@imgtec.com>
Dylan Baker [Wed, 15 Nov 2017 22:00:19 +0000 (14:00 -0800)]
meson: use driver_deps for gallium osmesa
v2: - Put driver_swrast in the correct field (dependencies)
- Remove unused osmesa_deps
Signed-off-by: Dylan Baker <dylanx.c.baker@intel.com>
Acked-by: Eric Engestrom <eric.engestrom@imgtec.com>
Dylan Baker [Wed, 15 Nov 2017 18:50:11 +0000 (10:50 -0800)]
meson: Use driver dependencies for libgl-xlib target
v2: - put driver_swrast in the right field
- add dep_threads (dep_llvm requires threads, so it masked this
previously)
Signed-off-by: Dylan Baker <dylanx.c.baker@intel.com>
Acked-by: Eric Engestrom <eric.engestrom@imgtec.com>
Dylan Baker [Wed, 15 Nov 2017 18:45:29 +0000 (10:45 -0800)]
meson: use the driver dependencies for the gallium dri target
Signed-off-by: Dylan Baker <dylanx.c.baker@intel.com>
Reviewed-by: Eric Engestrom <eric.engestrom@imgtec.com>
Dylan Baker [Wed, 15 Nov 2017 18:43:20 +0000 (10:43 -0800)]
meson: define driver dependencies
This allow us to encapsulate the compiler and linkage requirements of
each driver in a reusable way. The result will be that each target that
needs a specific driver can simply add `driver_<name>` to its
dependencies line and the necessary libraries and compiler args will be
added. This will allow for a lot of code de-duplication between gallium
targets.
Signed-off-by: Dylan Baker <dylanx.c.baker@intel.com>
Reviewed-by: Eric Engestrom <eric.engestrom@imgtec.com>
Dylan Baker [Wed, 15 Nov 2017 18:41:42 +0000 (10:41 -0800)]
meson: sort gallium drivers after winsys
This is a requirement of the next patch. Since meson does not have
forward declarations, and we're going to define the driver dependencies
in the drivers folder they need to be after the winsys so that the
winsys libs are defined first.
Signed-off-by: Dylan Baker <dylanx.c.baker@intel.com>
Reviewed-by: Eric Engestrom <eric.engestrom@imgtec.com>
Dylan Baker [Tue, 28 Nov 2017 22:30:27 +0000 (14:30 -0800)]
meson: Combine gallium target subdirs
So that state trackers, targets, and special winsys requirements are all
in a single if statement. This is a cosmetic only cleanup with no
functional changes.
Signed-off-by: Dylan Baker <dylanx.c.baker@intel.com>
Reviewed-by: Eric Engestrom <eric.engestrom@imgtec.com>
Nanley Chery [Fri, 1 Dec 2017 22:18:21 +0000 (14:18 -0800)]
i965/cnl: Avoid fast-clearing sRGB render buffers
Gen10 doesn't automatically decode the clear color of sRGB buffers. To
get correct rendering, avoid fast-clearing such buffers for now.
The driver now passes the following piglit tests:
* spec@arb_framebuffer_srgb@msaa-fast-clear
* spec@ext_texture_srgb@multisample-fast-clear gl_ext_texture_srgb
Suggested-by: Kenneth Graunke <kenneth@whitecape.org>
Suggested-by: Jason Ekstrand <jason@jlekstrand.net>
Signed-off-by: Nanley Chery <nanley.g.chery@intel.com>
Reviewed-by: Jason Ekstrand <jason@jlekstrand.net>
Dylan Baker [Fri, 1 Dec 2017 22:54:31 +0000 (14:54 -0800)]
meson: Fix overlinkage of dri3 loader
This was covering for underinkage elsewhere. With that fixed these can
be removed.
v2: - sort dependencies
Signed-off-by: Dylan Baker <dylanx.c.baker@intel.com>
Reviewed-by: Jon Turney <jon.turney@dronecode.org.uk> (v1)
Reviewed-by: Eric Engestrom <eric.engestrom@imgtec.com> (v1)
Reviewed-by: Emil Velikov <emil.velikov@collabora.com>
Dylan Baker [Fri, 1 Dec 2017 22:51:11 +0000 (14:51 -0800)]
meson: fix underlinkage without dri3
There are some case where the dri3 loader is covering for underlinkage
for GLX and EGL, provide the linkage that they actually need.
v2: - remove dep_xcb_dri3 from glx. This was an oversight in v1 and is
not needed.
Signed-off-by: Dylan Baker <dylanx.c.baker@intel.com>
Reviewed-by: Jon Turney <jon.turney@dronecode.org.uk> (v1)
Reviewed-by: Eric Engestrom <eric.engestrom@imgtec.com> (v1)
Reviewed-by: Emil Velikov <emil.velikov@collabora.com>
Dylan Baker [Fri, 1 Dec 2017 22:46:42 +0000 (14:46 -0800)]
meson: Reformat glx code to match more common style
Generally in our meson build large arrays are formated in the form:
[
..., ..., ..., $
...,
]
So use that form
Signed-off-by: Dylan Baker <dylanx.c.baker@intel.com>
Reviewed-by: Emil Velikov <emil.velikov@collabora.com>
Reviewed-by: Jon Turney <jon.turney@dronecode.org.uk>
Reviewed-by: Eric Engestrom <eric.engestrom@imgtec.com>
Samuel Pitoiset [Mon, 4 Dec 2017 14:32:58 +0000 (15:32 +0100)]
radv: fix a crash in radv_can_dump_shader()
module can be NULL, oops.
Signed-off-by: Samuel Pitoiset <samuel.pitoiset@gmail.com>
Reviewed-by: Bas Nieuwenhuizen <bas@basnieuwenhuizen.nl>
Chad Versace [Wed, 29 Nov 2017 18:56:26 +0000 (10:56 -0800)]
intel/isl: Declare private array as static const
It's array isl_drm.c:modifier_info[] .
Reviewed-by: Kenneth Graunke <kenneth@whitecape.org>
Reviewed-by: Jason Ekstrand <jason@jlekstrand.net>
Reviewed-by: Tapani Pälli <tapani.palli@intel.com>
Dylan Baker [Fri, 1 Dec 2017 22:01:40 +0000 (14:01 -0800)]
meson: Install dri.pc file when building gallium dri drivers
Currently this pkg-config file is only installed if a classic dri driver
is built. This is wrong, it should be installed if any dri driver is
installed, which includes the gallium dri target.
Reported-by: Marc Dietrich <marvin24@gmx.de>
Signed-off-by: Dylan Baker <dylanx.c.baker@intel.com>
Reviewed-by: Eric Engestrom <eric.engestrom@imgtec.com>
Reviewed-by: Emil Velikov <emil.velikov@collabora.com>
Lionel Landwerlin [Mon, 4 Dec 2017 15:22:12 +0000 (15:22 +0000)]
anv: query CS timestamp frequency from the kernel
The reference value in gen_device_info isn't going to be acurate on
Gen10+. We should query it from the kernel, which reads a couple of
register to compute the actual value.
Signed-off-by: Lionel Landwerlin <lionel.g.landwerlin@intel.com>
Reviewed-by: Rafael Antognolli <rafael.antognolli@intel.com>
Lionel Landwerlin [Mon, 6 Nov 2017 11:11:42 +0000 (11:11 +0000)]
i965: read CS timestamp frequency from the kernel on Gen10+
We cannot figure this value out of the PCI-id anymore. Let's read it
from the kernel (which computes this from a few registers).
When running on a (upcoming) 4.16-rc1+ kernel, this will fixes piglit
tests on CNL :
spec@arb_timer_query@query gl_timestamp
spec@arb_timer_query@timestamp-get
spec@ext_timer_query@time-elapsed
Signed-off-by: Lionel Landwerlin <lionel.g.landwerlin@intel.com>
Reviewed-by: Rafael Antognolli <rafael.antognolli@intel.com>
Lionel Landwerlin [Mon, 4 Dec 2017 15:12:40 +0000 (15:12 +0000)]
drm-uapi: Update drm/i915 headers from drm-next
Taken from drm-next
ca797d29cd63e7b71b4eea29aff3b1cefd1ecb59
Signed-off-by: Lionel Landwerlin <lionel.g.landwerlin@intel.com>
Reviewed-by: Rafael Antognolli <rafael.antognolli@intel.com>
Jason Ekstrand [Fri, 17 Nov 2017 01:15:27 +0000 (17:15 -0800)]
radv: Implement VK_KHR_get_surface_capabilities2
The WSI core code does all the hard work. Just add the wrappers and
turn it on.
Reviewed-by: Dave Airlie <airlied@redhat.com>
Reviewed-by: Chad Versace <chadversary@chromium.org>
Jason Ekstrand [Thu, 16 Nov 2017 20:49:27 +0000 (12:49 -0800)]
vulkan/wsi: Initialize individual WSI interfaces in wsi_device_init
Now that we have anv_device_init/finish functions, there's no reason to
have the individual driver do any more work than that.
Reviewed-by: Dave Airlie <airlied@redhat.com>
Reviewed-by: Chad Versace <chadversary@chromium.org>
Jason Ekstrand [Thu, 16 Nov 2017 20:38:26 +0000 (12:38 -0800)]
vulkan/wsi: Drop some unneeded cruft from the API
This drops the unneeded callbacks struct as well as the queue_get_family
callback we were using before we'd pulled QueuePresent inside.
Reviewed-by: Dave Airlie <airlied@redhat.com>
Reviewed-by: Chad Versace <chadversary@chromium.org>
Jason Ekstrand [Thu, 16 Nov 2017 20:26:26 +0000 (12:26 -0800)]
vulkan/wsi: Add wrappers for all of the surface queries
This lets us move wsi_interface to wsi_common_private.h
Reviewed-by: Dave Airlie <airlied@redhat.com>
Reviewed-by: Chad Versace <chadversary@chromium.org>
Jason Ekstrand [Thu, 16 Nov 2017 20:05:35 +0000 (12:05 -0800)]
vulkan/wsi: Drop the can_handle_different_gpu parameter from get_support
Both anv and radv can handle prime now.
Reviewed-by: Dave Airlie <airlied@redhat.com>
Reviewed-by: Chad Versace <chadversary@chromium.org>
Jason Ekstrand [Thu, 16 Nov 2017 18:46:26 +0000 (10:46 -0800)]
vulkan/wsi: Move wsi_swapchain to wsi_common_private.h
The drivers no longer poke at this directly.
Reviewed-by: Dave Airlie <airlied@redhat.com>
Reviewed-by: Chad Versace <chadversary@chromium.org>
Jason Ekstrand [Thu, 16 Nov 2017 18:44:41 +0000 (10:44 -0800)]
vulkan/wsi: Add a helper for AcquireNextImage
Unfortunately, due to the fact that AcquireNextImage does not take a
queue, the ANV trick for triggering the fence won't work in general. We
leave dealing with the fence up to the caller for now.
Reviewed-by: Dave Airlie <airlied@redhat.com>
Reviewed-by: Chad Versace <chadversary@chromium.org>
Dave Airlie [Thu, 16 Nov 2017 02:02:04 +0000 (12:02 +1000)]
vulkan/wsi: move swapchain create/destroy to common code
v2 (Jason Ekstrand):
- Rebase
- Alter the names of the helpers to better match the vulkan entrypoints
- Use the helpers in anv
Reviewed-by: Dave Airlie <airlied@redhat.com>
Reviewed-by: Chad Versace <chadversary@chromium.org>
Jason Ekstrand [Thu, 16 Nov 2017 17:30:16 +0000 (09:30 -0800)]
vulkan/wsi: Move prime blitting into queue_present
This lets us save a QueueSubmit and it also makes prime a lot less
X11-specific. Also, it means we can only wait on the semaphores once
instead of on every blit.
Reviewed-by: Dave Airlie <airlied@redhat.com>
Jason Ekstrand [Thu, 16 Nov 2017 17:56:37 +0000 (09:56 -0800)]
vulkan/wsi: Move get_images into common code
This moves bits out of all four corners (anv, radv, x11, wayland) and
into the wsi common code. We also switch to using an outarray to ensure
we get our return code right.
Reviewed-by: Dave Airlie <airlied@redhat.com>
Reviewed-by: Chad Versace <chadversary@chromium.org>
Jason Ekstrand [Thu, 16 Nov 2017 19:56:00 +0000 (11:56 -0800)]
anv/wsi: Enable prime support
Now that we're using the same common code as radv, we get prime support
for free. Just enable it.
Reviewed-by: Dave Airlie <airlied@redhat.com>
Reviewed-by: Chad Versace <chadversary@chromium.org>
Jason Ekstrand [Thu, 16 Nov 2017 17:46:50 +0000 (09:46 -0800)]
anv/wsi: Use the common QueuePresent code
Reviewed-by: Dave Airlie <airlied@redhat.com>
Reviewed-by: Chad Versace <chadversary@chromium.org>
Jason Ekstrand [Thu, 16 Nov 2017 17:18:48 +0000 (09:18 -0800)]
vulkan/wsi: Set a proper pWaitDstStageMask on the dummy submit
Neither mesa driver really cares, but we should set it none the less for
the sake of correctness.
Reviewed-by: Dave Airlie <airlied@redhat.com>
Reviewed-by: Chad Versace <chadversary@chromium.org>
Jason Ekstrand [Thu, 16 Nov 2017 17:07:58 +0000 (09:07 -0800)]
vulkan/wsi: Only wait on semaphores on the first swapchain
Reviewed-by: Dave Airlie <airlied@redhat.com>
Reviewed-by: Chad Versace <chadversary@chromium.org>
Jason Ekstrand [Thu, 16 Nov 2017 16:59:21 +0000 (08:59 -0800)]
vulkan/wsi: Refactor result handling in queue_present
Reviewed-by: Dave Airlie <airlied@redhat.com>
Reviewed-by: Chad Versace <chadversary@chromium.org>
Dave Airlie [Thu, 16 Nov 2017 01:52:39 +0000 (11:52 +1000)]
radv/wsi: Move the guts of QueuePresent to wsi common
v2 (Jason Ekstrand):
- Better comit message
- Rebase
- Re-indent to follow wsi_common style
- Drop the unneeded _swapchain from the newly added helper
- Make the clone more true to the original (as per the rebase)
Reviewed-by: Dave Airlie <airlied@redhat.com>
Reviewed-by: Chad Versace <chadversary@chromium.org>
Jason Ekstrand [Thu, 16 Nov 2017 17:39:50 +0000 (09:39 -0800)]
vulkan/wsi: Add a WSI_FROM_HANDLE macro
Reviewed-by: Dave Airlie <airlied@redhat.com>
Reviewed-by: Chad Versace <chadversary@chromium.org>
Dave Airlie [Thu, 16 Nov 2017 01:03:22 +0000 (11:03 +1000)]
radv/wsi: drop allocate memory special case
Just check if image has scanout flag set
v2 (Jason Ekstrand):
- Rebase
- Also drop the now unused radv_mem_flag_bits enum
Reviewed-by: Dave Airlie <airlied@redhat.com>
Reviewed-by: Chad Versace <chadversary@chromium.org>
Jason Ekstrand [Thu, 16 Nov 2017 06:30:20 +0000 (22:30 -0800)]
vulkan/wsi: Do image creation in common code
This uses the mock extension created in a previous commit to tell the
driver that the image it's just been asked to create is, in fact, a
window system image with whatever assumptions that implies. There was a
lot of redundant code between the two drivers to do basically exactly
the same thing.
Reviewed-by: Dave Airlie <airlied@redhat.com>
Reviewed-by: Chad Versace <chadversary@chromium.org>
Jason Ekstrand [Thu, 16 Nov 2017 03:04:10 +0000 (19:04 -0800)]
vulkan/wsi: Implement prime in a completely generic way
Reviewed-by: Dave Airlie <airlied@redhat.com>
Reviewed-by: Chad Versace <chadversary@chromium.org>
Jason Ekstrand [Sat, 18 Nov 2017 23:30:34 +0000 (15:30 -0800)]
radv: Move wsi initialization later in physical_device_init
We need it to happen after memory type setup so that we can query memory
types in wsi_device_init.
Reviewed-by: Dave Airlie <airlied@redhat.com>
Reviewed-by: Chad Versace <chadversary@chromium.org>
Jason Ekstrand [Thu, 16 Nov 2017 16:27:01 +0000 (08:27 -0800)]
radv/image: Implement the wsi "extension"
Reviewed-by: Dave Airlie <airlied@redhat.com>
Reviewed-by: Chad Versace <chadversary@chromium.org>
Jason Ekstrand [Thu, 16 Nov 2017 06:11:46 +0000 (22:11 -0800)]
anv/image: Implement the wsi "extension"
Reviewed-by: Dave Airlie <airlied@redhat.com>
Reviewed-by: Chad Versace <chadversary@chromium.org>
Jason Ekstrand [Tue, 28 Nov 2017 16:49:29 +0000 (08:49 -0800)]
anv: Require a dedicated allocation for modified images
This lets us set the BO tiling when we allocate the memory. This is
required for GL to work properly.
Reviewed-by: Dave Airlie <airlied@redhat.com>
Reviewed-by: Chad Versace <chadversary@chromium.org>
Jason Ekstrand [Tue, 28 Nov 2017 17:28:12 +0000 (09:28 -0800)]
anv/image: Add a drm_format_mod field
At the moment, this is always initialized to DRM_FORMAT_MOD_INVALID.
Reviewed-by: Dave Airlie <airlied@redhat.com>
Reviewed-by: Chad Versace <chadversary@chromium.org>
Jason Ekstrand [Tue, 28 Nov 2017 02:43:43 +0000 (18:43 -0800)]
radv: Implement VK_EXT_external_memory_dma_buf
Reviewed-by: Dave Airlie <airlied@redhat.com>
Reviewed-by: Chad Versace <chadversary@chromium.org>
Jason Ekstrand [Tue, 28 Nov 2017 02:33:44 +0000 (18:33 -0800)]
anv: Implement VK_EXT_external_memory_dma_buf
This is a modified version of the patch originally sent by Chad Versace.
The primary difference is that this version claims that OPQAUE_FD and
DMA_BUF are compatible handle types.
Reviewed-by: Dave Airlie <airlied@redhat.com>
Reviewed-by: Chad Versace <chadversary@chromium.org>
Jason Ekstrand [Thu, 16 Nov 2017 06:11:23 +0000 (22:11 -0800)]
vulkan/wsi: Add a mock image creation extension
Reviewed-by: Dave Airlie <airlied@redhat.com>
Reviewed-by: Chad Versace <chadversary@chromium.org>
Jason Ekstrand [Thu, 16 Nov 2017 04:08:53 +0000 (20:08 -0800)]
vulkan/wsi: Add wsi_swapchain_init/finish functions
Reviewed-by: Dave Airlie <airlied@redhat.com>
Reviewed-by: Chad Versace <chadversary@chromium.org>
Jason Ekstrand [Thu, 16 Nov 2017 02:50:44 +0000 (18:50 -0800)]
vulkan/wsi: Add a wsi_device_init function
This gives the opportunity to collect some function pointers if we'd
like which will be very useful in future.
Reviewed-by: Dave Airlie <airlied@redhat.com>
Reviewed-by: Chad Versace <chadversary@chromium.org>
Jason Ekstrand [Thu, 16 Nov 2017 03:59:01 +0000 (19:59 -0800)]
vulkan/wsi/x11: Handle the geometry check earlier in create_swapchain
This fixes a potential leak if allocating the swapchain fails. Since
geometry checking and bit-depth fetching is self-contained, it makes
sense to just do it first so we can delete the geometry reply.
Reviewed-by: Dave Airlie <airlied@redhat.com>
Reviewed-by: Chad Versace <chadversary@chromium.org>
Daniel Stone [Thu, 20 Jul 2017 10:51:48 +0000 (11:51 +0100)]
vulkan/wsi: Add a wsi_image structure
This is used to hold information about the allocated image, rather than
an ever-growing function argument list.
v2 (Jason Ekstrand):
- Rename wsi_image_base to wsi_image
Signed-off-by: Daniel Stone <daniels@collabora.com>
Reviewed-by: Jason Ekstrand <jason@jlekstrand.net>
Reviewed-by: Dave Airlie <airlied@redhat.com>
Reviewed-by: Chad Versace <chadversary@chromium.org>
Dave Airlie [Wed, 15 Nov 2017 22:46:41 +0000 (08:46 +1000)]
vulkan/wsi: use function ptr definitions from the spec.
This just seems cleaner, and we may expand this in future.
Signed-off-by: Dave Airlie <airlied@redhat.com>
Reviewed-by: Jason Ekstrand <jason@jlekstrand.net>
Kenneth Graunke [Tue, 31 Oct 2017 16:57:54 +0000 (09:57 -0700)]
i965: Emit CS stall before MEDIA_VFE_STATE.
This fixes hangs on GFXBench 5's Aztec Ruins benchmark.
Unfortunately, it regresses OglCSCloth performance by about 10%. There
are some ideas for fixing that.
The Vulkan driver already emits this stall.
Reviewed-by: Matt Turner <mattst88@gmail.com>
Kenneth Graunke [Tue, 31 Oct 2017 17:02:02 +0000 (10:02 -0700)]
i965: Move PIPE_CONTROL defines and prototypes to brw_pipe_control.h.
We need to be able to emit PIPE_CONTROLs from genX_state_upload.c,
which can't safely include brw_defines.h because it conflicts with
genxml. Move all the PIPE_CONTROL related stuff together into a
separate header.
Reviewed-by: Matt Turner <mattst88@gmail.com>
Jason Ekstrand [Tue, 5 Sep 2017 22:46:58 +0000 (15:46 -0700)]
spirv: Replace unreachable with vtn_fail
Reviewed-by: Tapani Pälli <tapani.palli@intel.com>
Reviewed-by: Ian Romanick <idr@freedesktop.org>
Jason Ekstrand [Thu, 17 Aug 2017 00:38:13 +0000 (17:38 -0700)]
spirv: Replace assert with vtn_assert
Reviewed-by: Tapani Pälli <tapani.palli@intel.com>
Reviewed-by: Ian Romanick <idr@freedesktop.org>
Jason Ekstrand [Wed, 16 Aug 2017 23:15:23 +0000 (16:15 -0700)]
spirv: Add vtn_fail and vtn_assert helpers
These helpers are much nicer than just using assert because they don't
kill your process. Instead, it longjmps back to spirv_to_nir(), cleans
up all the temporary memory, and nicely returns NULL. While crashing is
completely OK in the Vulkan world, it's not considered to be quite so
nice in GL. This should help us to make SPIR-V parsing much more
robust. The one downside here is that vtn_assert is not compiled out in
release builds like assert() is so it isn't free.
Reviewed-by: Tapani Pälli <tapani.palli@intel.com>
Reviewed-by: Ian Romanick <idr@freedesktop.org>
Jason Ekstrand [Thu, 17 Aug 2017 00:16:45 +0000 (17:16 -0700)]
util: Add a NORETURN macro
Reviewed-by: Tapani Pälli <tapani.palli@intel.com>
Reviewed-by: Ian Romanick <idr@freedesktop.org>
Jason Ekstrand [Wed, 16 Aug 2017 23:38:56 +0000 (16:38 -0700)]
spirv: Do something useful with OpSource
We may as well log the source language and file name.
Reviewed-by: Tapani Pälli <tapani.palli@intel.com>
Reviewed-by: Ian Romanick <idr@freedesktop.org>
Jason Ekstrand [Wed, 16 Aug 2017 23:04:08 +0000 (16:04 -0700)]
spirv: Rework logging
This commit reworks the way that logging works in SPIR-V to provide
richer and more detailed logging infrastructure. This commit contains
several improvements over the old mechanism:
1) Log messages are now more detailed. They contain the SPIR-V byte
offset as well as source language information from OpSource and
OpLine.
2) There is now a logging callback mechanism so that errors can get
propagated to the client through debug callbak extensions.
Reviewed-by: Tapani Pälli <tapani.palli@intel.com>
Reviewed-by: Ian Romanick <idr@freedesktop.org>
Jason Ekstrand [Wed, 16 Aug 2017 23:10:23 +0000 (16:10 -0700)]
spirv: Re-arrange vtn_builder initialization
This simply moves allocating the vtn_builder and initializing it to the
very beginning before we even parse the header.
Reviewed-by: Tapani Pälli <tapani.palli@intel.com>
Reviewed-by: Ian Romanick <idr@freedesktop.org>
Jason Ekstrand [Wed, 16 Aug 2017 15:43:08 +0000 (08:43 -0700)]
spirv: Parent the nir_shader to the builder while building
Reviewed-by: Tapani Pälli <tapani.palli@intel.com>
Reviewed-by: Ian Romanick <idr@freedesktop.org>
Rob Clark [Mon, 4 Dec 2017 16:01:52 +0000 (11:01 -0500)]
freedreno: mark stencil buffer valid too in case of z32x24s8
The separate stencil buffer was not also getting marked as valid if
written by a draw/clear, resulting in gmem2mem getting skipped. Move
this into fd_batch_resource_used() which also handles the separate
stencil case.
Also fix restore_buffers typo.
Fixes: 4ab6ab80365 freedreno: avoid mem2gmem for invalidated buffers
Signed-off-by: Rob Clark <robdclark@gmail.com>
Rob Clark [Mon, 4 Dec 2017 14:02:07 +0000 (09:02 -0500)]
freedreno: remove use of u_transfer
Freedreno doesn't treat buffers and images differently, so it's use was
kind of pointless.
Signed-off-by: Rob Clark <robdclark@gmail.com>
Eric Engestrom [Mon, 4 Dec 2017 13:40:54 +0000 (08:40 -0500)]
freedreno: add -Wno-packed-bitfield-compat for meson build
Otherwise huge amount of spam from instr-a2xx.h.. gcc has no way to know
that freedreno was never built with such an old gcc version to care
about the bugs in old gcc ;-)
Reported-by: Rob Clark <robdclark@gmail.com>
Signed-off-by: Eric Engestrom <eric.engestrom@imgtec.com>
[added commit message]
Signed-off-by: Rob Clark <robdclark@gmail.com>
Samuel Iglesias Gonsálvez [Thu, 9 Nov 2017 10:15:03 +0000 (11:15 +0100)]
glsl: don't run intrastage array validation when the interface type is not an array
We validate that the interface block array type's definition matches.
However, previously, the function could be called if an non-array
interface block has different type definitions -for example, when the
precision qualifier differs in a GLSL ES shader, we would create two
different types-, and it would return invalid as both definitions are
non-arrays.
We fix this by specifying that at least one definition should be an
array to call the validation.
Signed-off-by: Samuel Iglesias Gonsálvez <siglesias@igalia.com>
Reviewed-by: Nicolai Hähnle <nicolai.haehnle@amd.com>
Samuel Iglesias Gonsálvez [Thu, 9 Nov 2017 08:58:25 +0000 (09:58 +0100)]
glsl/es: precision qualifier doesn't need to match in UBOs
They might mismatch due to the two shaders using different GLSL
versions, and that's ok in desktop GL. In ES, precision qualifiers
don't need to match.
Signed-off-by: Samuel Iglesias Gonsálvez <siglesias@igalia.com>
Reviewed-by: Nicolai Hähnle <nicolai.haehnle@amd.com>
Pierre Moreau [Sun, 3 Dec 2017 20:28:57 +0000 (21:28 +0100)]
nvc0/ir: Properly lower 64-bit shifts when the shift value is >32
Fixes: 61d7676df77 "nvc0/ir: add support for 64-bit shift lowering on SM20/SM30"
Fixes fs-shift-scalar-by-scalar.shader_test from piglit for the current
set-up:
uniform int64_t ival -0x7dfcfefbdf6536ff # bit pattern: 0x82030104209ac901
uniform uint64_t uval 0x1400000085010203
uniform int shl 36
uniform int shr 36
uniform int64_t iexpected_shl 0x09ac901000000000
uniform int64_t iexpected_shr -0x7dfcff0 # bit pattern: 0xfffffffff8203010
uniform uint64_t uexpected_shl 0x5010203000000000
uniform uint64_t uexpected_shr 0x0000000001400000
draw rect ortho 12 0 4 4
Signed-off-by: Pierre Moreau <pierre.morrow@free.fr>
Reviewed-by: Ilia Mirkin <imirkin@alum.mit.edu>