Commit Graph

9687 Commits

Author SHA1 Message Date
Dave Airlie f5daaba0fd radv: make use of shared vector helper.
This removes the vector code from radv in favour of sharing
code with anv.

Acked-by: Jason Ekstrand <jason@jlekstrand.net>
Signed-off-by: Dave Airlie <airlied@redhat.com>
2016-10-19 09:05:25 +10:00
Gustaw Smolarczyk 36cb5508e8 radv/winsys: Fail early on overgrown cs.
When !use_ib_bos, we can't easily chain ibs one to another. If the
required cs size grows over 1Mi - 8 dwords just fail the cs so that we
won't assert-fail in radv_amdgpu_winsys_cs_submit later on.

Reviewed-by: Bas Nieuwenhuizen <bas@basnieuwenhuizen.nl>
2016-10-16 12:38:53 +02:00
Emil Velikov 3fd0cafc1c radv: move AMDGPU_LIBS later in the link chain
At the moment (albeit unlikely) one could get link-time issues, since
libdrm_amdgpu.so is before it's users in the link chain.

Signed-off-by: Emil Velikov <emil.velikov@collabora.com>
Reviewed-by: Dave Airlie <airlied@redhat.com>
Reviewed-by: Edward O'Callaghan <funfunctor@folklore1984.net>
Acked-by: Bas Nieuwenhuizen <bas@basnieuwenhuizen.nl>
2016-10-14 11:09:00 +01:00
Emil Velikov a8a5f0a025 radv: correct variable name VISIBILITY_{, C}FLAGS
The letter C was missing, thus in turn all the internal symbols were
exported.

As a result we hide ~150 symbols and cut ~36K from libvulkan_radeon.so.

Signed-off-by: Emil Velikov <emil.velikov@collabora.com>
Reviewed-by: Dave Airlie <airlied@redhat.com>
Acked-by: Bas Nieuwenhuizen <bas@basnieuwenhuizen.nl>
2016-10-14 11:09:00 +01:00
Emil Velikov 753a9c989f amd/addrlib: hide private symbols via VISIBILITY_CXXFLAGS
Private/internal symbols should not be exported. Using the CXXFLAGS cuts
~300 exported symbols and ~23K from libvulkan_radeon.so.

Signed-off-by: Emil Velikov <emil.velikov@collabora.com>
Acked-by: Bas Nieuwenhuizen <bas@basnieuwenhuizen.nl>
Reviewed-by: Marek Olšák <marek.olsak@amd.com>
2016-10-14 11:09:00 +01:00
Dave Airlie 47a7d86fe9 radv: fix the wayland wsi busy bit
Signed-off-by: Dave Airlie <airlied@redhat.com>
2016-10-14 05:10:02 +10:00
Tom Stellard 5c66d46d6a radv: Use new image load/store intrinsic signatures v2
These were changed in LLVM r284024.

v2:
  - Only use float types for vdata of llvm.amdgcn.image.store.  LLVM doesn't
    support integer types for this intrinsic.

Signed-off-by: Dave Airlie <airlied@redhat.com>
2016-10-14 04:48:11 +10:00
Tom Stellard 30e63fb0e4 radv: Fix incorrect comment
Signed-off-by: Dave Airlie <airlied@redhat.com>
2016-10-14 04:48:11 +10:00
Dave Airlie 060e6f468a radv: fix identity swizzle handling
The identity swizzle should operate exactly
like an .r = R, .g = G, .b = B, .a = A swizzle.

This fixes a bunch of the 16-bit BGRA blit tests
dEQP-VK.api.copy_and_blit.blit_image.all_formats.b4g4r4a4*

Signed-off-by: Dave Airlie <airlied@redhat.com>
2016-10-14 04:45:57 +10:00
Dave Airlie 8bdac874e6 radv/wsi: fix app that acquire multiple images up front
dota2 does multiple acquires followed by multiple queues,
this bug manifested itself as a hang in the xshmfence code
randomly when dota2 was doing it's menus. It also occured
when running dota2 under phoronix-test-suite.

The fix is once the image is acquired to mark it busy then
so nobody else can acquire. We have to trust vulkan apps
that they will eventually submit it.

Acked-by: Edward O'Callaghan <funfunctor@folklore1984.net>
Signed-off-by: Dave Airlie <airlied@redhat.com>
2016-10-14 04:45:11 +10:00
Nicolas Koch 35e2bfa6d9 radv: Return correct result in EnumeratePhysicalDevices
If pPhysicalDevices is too small for all physical devices,
the driver must return VK_INCOMPLETE. Since only a single
physical device is supported, this is only the case when
pPhysicalDeviceCount == 0 && pPhysicalDevices != NULL.

Signed-off-by: Dave Airlie <airlied@redhat.com>
2016-10-13 09:11:13 +10:00
Emil Velikov 3c419a941a radv: add all headers to the sources list
Otherwise they'll be missing from the tarball and the build will fail.

Signed-off-by: Emil Velikov <emil.velikov@collabora.com>
2016-10-12 18:55:20 +01:00
Edward O'Callaghan cfbf956dfd radv: trivial case stmt style fixups
Relocate a 'default:' to the end of a case stmt and fix an
indent issue.

Signed-off-by: Edward O'Callaghan <funfunctor@folklore1984.net>
Reviewed-by: Thomas Helland <thomashelland90@gmail.com>
2016-10-12 20:12:43 +11:00
Gustaw Smolarczyk c3f3c6b0e8 radv/winsys: Fix radv_amdgpu_cs_grow min_size argument. (v2)
It's supposed to be how much at least we want to grow the cs, not the
minimum size of the cs after growth.

v2: Unbreak use_ib_bos.
    Don't mask the ib_size when !use_ib_bos, since it's not needed.

Reviewed-by: Bas Nieuwenhuizen <bas@basnieuwenhuizen.nl>
Signed-off-by: Dave Airlie <airlied@redhat.com>
2016-10-12 09:06:30 +10:00
Grigori Goronzy a22b5f28fb radv: fix strict aliasing violation
Signed-off-by: Dave Airlie <airlied@redhat.com>
2016-10-12 09:00:22 +10:00
Grigori Goronzy 0b539abcf4 radv: fix uninitialized variables
This gets rid of "may be used uninitialized" compiler warnings.

Signed-off-by: Dave Airlie <airlied@redhat.com>
2016-10-12 09:00:22 +10:00
Grigori Goronzy 7ca44f8a33 radv: add missing unreachable
Signed-off-by: Dave Airlie <airlied@redhat.com>
2016-10-12 09:00:22 +10:00
Dave Airlie 8cc9f89d26 radv: remove the validation layer and some related bits.
As pointed out by Emil this isn't used in anv anymore,
and it was totally unused in radv anyways.

Signed-off-by: Dave Airlie <airlied@redhat.com>
2016-10-12 08:57:09 +10:00
Dave Airlie 014ec78fb2 radv: drop entrypoint split out.
radv really doesn't need different dispatch per gen yet,
there really isn't that many differences yet.

Signed-off-by: Dave Airlie <airlied@redhat.com>
2016-10-12 08:56:41 +10:00
Dave Airlie 12301c5418 radv: drop the RADV_CALL macro.
This is leftover from anv, and we really never needed it.

Signed-off-by: Dave Airlie <airlied@redhat.com>
2016-10-12 08:56:41 +10:00
Dave Airlie fc28f89157 radv: check driver name before calling amdgpu.
This checks the kernel driver name is amdgpu before calling
libdrm_amdgpu.

This avoids the following error:
amdgpu_device_initialize: DRM version is 1.6.0 but this driver is only compatible with 3.x.x

when run on a machine with i915 graphics as well as amdgpu.

Signed-off-by: Dave Airlie <airlied@redhat.com>
2016-10-12 08:56:41 +10:00
Dave Airlie 6215b47648 radv: fix memory leak from physical device if wsi fails
Inspired by patch from Edward O'Callaghan <funfunctor@folklore1984.net>
which didn't do it right.

Signed-off-by: Dave Airlie <airlied@redhat.com>
2016-10-12 08:53:44 +10:00
Edward O'Callaghan e0641c61ca radv/winsys: Fix mem leak at failed do_winsys_init() call site
Probably unlikely however ensure we don't leak a heap allocation
on the fail path.

V.2:
 also fix missing 'amdgpu_device_deinitialize()' calls (Emil Velikov).

Signed-off-by: Edward O'Callaghan <funfunctor@folklore1984.net>
Reviewed-by: Emil Velikov <emil.velikov@collabora.com>
Signed-off-by: Dave Airlie <airlied@redhat.com>
2016-10-12 08:46:10 +10:00
Edward O'Callaghan 4a0db58f14 radv/winsys: Trivial style and readability fixups
Drop/add a few newlines where appropriate and drop a couple of
unnessary braces.

Signed-off-by: Edward O'Callaghan <funfunctor@folklore1984.net>
Signed-off-by: Dave Airlie <airlied@redhat.com>
2016-10-12 08:24:50 +10:00
Emil Velikov 0b54c022a8 radv: automake: move libamdgpu_addrlib.la to VULKAN_LIB_DEPS
The static library is analogous to the intel ISL, which is required for
both hardware and (to be added) testing library.

Signed-off-by: Emil Velikov <emil.velikov@collabora.com>
2016-10-11 13:51:09 +01:00
Emil Velikov 4882476eca radv: automake: remove unused variables
Signed-off-by: Emil Velikov <emil.velikov@collabora.com>
2016-10-11 13:51:08 +01:00
Emil Velikov e2cb253346 radv: automake: include the python scripts/formats table in the tarball
Signed-off-by: Emil Velikov <emil.velikov@collabora.com>
2016-10-11 13:51:06 +01:00
Edward O'Callaghan ba43768a1e radv: Use proper header guards over 'pragma once' directives
Signed-off-by: Edward O'Callaghan <funfunctor@folklore1984.net>
Reviewed-by: Eric Engestrom <eric.engestrom@imgtec.com>
2016-10-10 16:10:56 +11:00
Dave Airlie 85a47f647e radv: drop all uint for unsigned.
Signed-off-by: Dave Airlie <airlied@redhat.com>
2016-10-07 12:09:13 +10:00
Gustaw Smolarczyk 24815bd7b3 radv: Skip already signalled fences.
If the user created a fence with VK_FENCE_CREATE_SIGNALED_BIT set, we
shouldn't fail to wait for a fence if it was not submitted since that is
not necessary.
Reviewed-by: Bas Nieuwenhuizen <bas@basnieuwenhuizen.nl>

Signed-off-by: Dave Airlie <airlied@redhat.com>
2016-10-07 09:24:09 +10:00
Dave Airlie f4e499ec79 radv: add initial non-conformant radv vulkan driver
This squashes all the radv development up until now into
one for merging.

History can be found:
https://github.com/airlied/mesa/tree/semi-interesting

This requires llvm 3.9 and is in no way considered
a conformant vulkan implementation. It can run a number
of vulkan applications, and supports all GPUs using
the amdgpu kernel driver.

Thanks to Intel for providing anv and spirv->nir,
and Emil Velikov for reviewing build integration.

Parts of this are:
Reviewed-by: Nicolai Hähnle <nicolai.haehnle@amd.com>
Acked-by: Edward O'Callaghan <funfunctor@folklore1984.net>

Authors: Bas Nieuwenhuizen and Dave Airlie
Signed-off-by: Dave Airlie <airlied@redhat.com>
2016-10-07 09:16:09 +10:00
Emil Velikov 03350c9708 amd: add amd_kernel_code_t.h to the sources list
Otherwise it won't be picked in the tarball and the build will fail.

Fixes: 91ec6e5664 ("radeonsi/compute: Use the HSA abi for non-TGSI
compute shaders v3")
Signed-off-by: Emil Velikov <emil.velikov@collabora.com>
2016-10-06 16:17:51 +01:00
Tom Stellard 91ec6e5664 radeonsi/compute: Use the HSA abi for non-TGSI compute shaders v3
This patch switches non-TGSI compute shaders over to using the HSA
ABI described here:

https://github.com/RadeonOpenCompute/ROCm-Docs/blob/master/AMDGPU-ABI.md

The HSA ABI provides a much cleaner interface for compute shaders and allows
us to share more code in the compiler with the HSA stack.

The main changes in this patch are:
  - We now pass the scratch buffer resource into the shader via user sgprs
    rather than using relocations.
  - Grid/Block sizes are now passed to the shader via the dispatch packet
    rather than at the beginning of the kernel arguments.

Typically for HSA, the CP firmware will create the dispatch packet and set
up the user sgprs automatically.  However, in Mesa we let the driver do
this work.  The main reason for this is that I haven't researched how to
get the CP to do all these things, and I'm not sure if it is supported
for all GPUs.

v2:
  - Add comments explaining why we are setting certain bits of the scratch
    resource descriptor.

v3:
  - Use amdgcn-mesa-mesa3d triple instead of amdgcn--mesa3d.

Reviewed-by: Nicolai Hähnle <nicolai.haehnle@amd.com>
2016-09-16 23:07:10 +00:00
Mauro Rossi 6b9d7e69ee android: add support for libmesa_amdgpu_addrlib
Android porting of the following commits:

f1f1ba3 "radeonsi: move sid.h/r600d_common.h to a common place."
69fca64 "amd/addrlib: move addrlib from amdgpu winsys to common code"

This patch fixes android building errors

Reviewed-by: Dave Airlie <airlied@redhat.com>
2016-09-13 10:06:04 +10:00
Dave Airlie 69fca64259 amd/addrlib: move addrlib from amdgpu winsys to common code
Acked-by: Marek Olšák <marek.olsak@amd.com>
Reviewed-by: Nicolai Hähnle <nicolai.haehnle@amd.com>
2016-09-06 10:06:33 +10:00
Dave Airlie a86be7b6ad radeon: move radeon_family/chip_class defintions to common
This just moves these to a common header file.

Acked-by: Marek Olšák <marek.olsak@amd.com>
Reviewed-by: Nicolai Hähnle <nicolai.haehnle@amd.com>
2016-09-06 10:06:04 +10:00
Dave Airlie f1f1ba3781 radeonsi: move sid.h/r600d_common.h to a common place.
Step one to merging radv would be to move some files around.

This only adds the include path to r600/radeonsi, because later
we want to avoid having to add it to the generic target paths.

Acked-by: Marek Olšák <marek.olsak@amd.com>
Reviewed-by: Nicolai Hähnle <nicolai.haehnle@amd.com>
2016-09-06 10:05:13 +10:00