Commit Graph

68 Commits (f4d14f147cfc2bdea4f1ffafcfd302ebdfbcef1d)

Author SHA1 Message Date
Emil Velikov f4d14f147c amdgpu/util_hash_table: hide private symbols from global namespace
Signed-off-by: Emil Velikov <emil.l.velikov@gmail.com>
Reviewed-by: Alex Deucher <alexander.deucher@amd.com>
Reviewed-by: Christian König <christian.koenig@amd.com>
Reviewed-by: Jammy Zhou <Jammy.Zhou@amd.com>
2015-08-13 17:43:22 +01:00
Emil Velikov 5f0f6387a6 amdgpu/util_hash: hide private symbols from global namespace
Signed-off-by: Emil Velikov <emil.l.velikov@gmail.com>
Reviewed-by: Alex Deucher <alexander.deucher@amd.com>
Reviewed-by: Christian König <christian.koenig@amd.com>
Reviewed-by: Jammy Zhou <Jammy.Zhou@amd.com>
2015-08-13 17:43:19 +01:00
Michel Dänzer 2978f5c37e amdgpu: Remove unused local variables bo_size/offset from amdgpu_cs_submit
Reviewed-by: Jammy Zhou <Jammy.Zhou@amd.com>
2015-08-05 13:50:38 -04:00
Jammy Zhou d01c361af5 amdgpu: expose the PCI revision ID
The PCI revision ID can be used to differentiate ASICs.

Signed-off-by: Jammy Zhou <Jammy.Zhou@amd.com>
Reviewed-by: Christian König <christian.koenig@amd.com>
2015-08-05 13:50:29 -04:00
Mario Kleiner 7d418f906c libdrm/amdgpu: Use private fd for amdgpu_device and winsys hash table to fix ZaphodHeads. (v2)
The amdgpu_device for a device node needs its own dup'ed fd, instead
of using the original fd passed in for a screen, to make multi-x-screen
ZaphodHeads configurations work on amdgpu.

The original fd's lifetime differs from that of the amdgpu_device, and from the
one stored in the hash. The hash key is the fd, and in order to compare hash
entries we fstat them, so the fd must be around for as long as the amdgpu_device
is.

This patch for libdrm/amdgpu is a translation of the radeon-winsys ZaphodHeads
fix for mesa's radeon-winsys, from mesa commit 28dda47ae4d974e3e032d60e8e0965c8c068c6d8

"winsys/radeon: Use dup fd as key in drm-winsys hash table to fix ZaphodHeads."

Signed-off-by: Mario Kleiner <mario.kleiner.de@gmail.com>
Acked-by: Marek Olšák <marek.olsak@amd.com>
Reviewed-by: Christian König <christian.koenig@amd.com>

v2: Check for valid fd's being >= 0, because fd == 0 is in theory
    a valid, although unlikely, fd and fd == -1 would denote an
    invalid fd. Thanks to William Lewis for pointing this out.

Reported-by: William Lewis <minutemaidpark@hotmail.com>
Signed-off-by: Mario Kleiner <mario.kleiner.de@gmail.com>
2015-08-05 13:47:52 -04:00
Leo Liu d2cbe9ecbe amdgpu: add VCE harvesting instance query
Signed-off-by: Leo Liu <leo.liu@amd.com>
Reviewed-by: Alex Deucher <alexander.deucher@amd.com>
Reviewed-by: Christian König <christian.koenig@amd.com>
2015-08-05 13:47:52 -04:00
Jammy Zhou 8aeffcc1cf amdgpu: add amdgpu_bo_va_op for va map/unmap support v3
The following interfaces are changed accordingly:
- amdgpu_bo_alloc
- amdgpu_create_bo_from_user_mem

v2: update the interfaces
v3: remove virtual_mc_base_address from amdgpu_bo

Signed-off-by: Jammy Zhou <Jammy.Zhou@amd.com>
Reviewed-by: Christian König <christian.koenig@amd.com>
2015-08-05 13:47:52 -04:00
Jammy Zhou 95d0f35daf amdgpu: add flags parameter for amdgpu_va_range_alloc
The flags is added for extensibility to cover some special requirements
in the future, i.e, request VA range in the first 4GB of address space

Signed-off-by: Jammy Zhou <Jammy.Zhou@amd.com>
Reviewed-by: Christian König <christian.koenig@amd.com>
2015-08-05 13:47:52 -04:00
Ken Wang 926c805686 amdgpu : move management of user fence from libdrm to UMD
Signed-off-by: Ken Wang <Qingqing.Wang@amd.com>
Reviewed-by: Christian König <christian.koenig@amd.com>
Reviewed-by: Jammy Zhou <Jammy.Zhou@amd.com>
2015-08-05 13:47:52 -04:00
Michel Dänzer 95ecf91c7b amdgpu: Use drmIoctl in amdgpu_ioctl_wait_cs
This is safe now because the ioctl uses an absolute timeout.

This prevents amdgpu_cs_query_fence_status from returning early e.g.
when a signal is delivered, which in turn caused Mesa winsys code to
assume a BO was idle when it actually wasn't yet.

Reviewed-by: Christian König <christian.koenig@amd.com>
2015-08-05 13:47:52 -04:00
Christian König 5463d2e83a amdgpu: use common fence structure for dependencies as well.
Signed-off-by: Christian König <christian.koenig@amd.com>
Reviewed-by: Marek Olšák <marek.olsak@amd.com>
Reviewed-by: Jammy Zhou <Jammy.Zhou@amd.com>
2015-08-05 13:47:52 -04:00
Jammy Zhou f91b56dc8c amdgpu: improve the amdgpu_cs_query_fence_status interface
make amdgpu_cs_query_fence reusable to support multi-fence query

Signed-off-by: Jammy Zhou <Jammy.Zhou@amd.com>
Reviewed-by: Christian König <christian.koenig@amd.com>
2015-08-05 13:47:52 -04:00
Sabre Shao 12802da74f amdgpu: add va range query interface
amdgpu_va_range_query interface is added so that client can query va
range supported by specific device.

Signed-off-by: Sabre Shao <Sabre.Shao@amd.com>
Reviewed-by: Jammy Zhou <Jammy.Zhou@amd.com>
2015-08-05 13:47:52 -04:00
Sabre Shao 23fab59ba5 amdgpu: add va allocation intefaces
Two new interfaces are added to support client request for
allocate virtual address without physical memory committed to.
The virtual address space can be managed by client itself.

Signed-off-by: Sabre Shao <Sabre.Shao@amd.com>
Signed-off-by: Ken Wang <Qingqing.Wang@amd.com>
Reviewed-by: Jammy Zhou <Jammy.Zhou@amd.com>
2015-08-05 13:47:52 -04:00
Ken Wang 5b01908d1c amdgpu: add base_preferred parameter to amdgpu_vamgr_find_va
base_preferred parameter is added to amdgpu_vamgr_find_va
so UMD can specify preferred va address when allocating.

Signed-off-by: Ken Wang <Qingqing.Wang@amd.com>
Reviewed-by: Jammy Zhou <Jammy.Zhou@amd.com>
2015-08-05 13:47:52 -04:00
Marek Olšák 8097d08ee4 amdgpu: check the user fence only if the IP supports user fences
Reviewed-by: Christian König <christian.koenig@amd.com>
Reviewed-by: Michel Dänzer <michel.daenzer@amd.com>
Reviewed-by: Jammy Zhou <Jammy.Zhou@amd.com>
2015-08-05 13:47:52 -04:00
Marek Olšák 67c994f057 drm/amdgpu: allow passing absolute timeouts to amdgpu_cs_query_fence_status
Useful when Mesa wants to wait for a lot of fences at the same time and
doesn't want to recalculate the relative timeout after every call.

Reviewed-by: Alex Deucher <alexander.deucher@amd.com>
2015-08-05 13:47:52 -04:00
Christian König 28462ebd25 amdgpu: remove reference to AMD specific error codes
We just have never defined any.

Signed-off-by: Christian König <christian.koenig@amd.com>
Reviewed-by: Jammy Zhou <Jammy.Zhou@amd.com>
2015-08-05 13:47:51 -04:00
Christian König 558e1294f2 amdgpu: cleanup public interface style
Fix some style problems, adjust to a common indentation, reorder two
function definitions and remove stale comments.

No intended functional change.

Signed-off-by: Christian König <christian.koenig@amd.com>
Reviewed-by: Jammy Zhou <Jammy.Zhou@amd.com>
2015-08-05 13:47:51 -04:00
Christian König 0f37bc9029 amdgpu: add CS dependencies v2
This allows the driver to specify on which previous CS to wait.

v2: fix spelling in comment

Signed-off-by: Christian König <christian.koenig@amd.com>
Reviewed-by: Alex Deucher <alexander.deucher@amd.com> (v1)
Reviewed-by: Marek Olšák <marek.olsak@amd.com>
2015-08-05 13:47:51 -04:00
Christian König 69827cd1f6 amdgpu: remove pointer arithmetic from command submission
Signed-off-by: Christian König <christian.koenig@amd.com>
Reviewed-by: Alex Deucher <alexander.deucher@amd.com>
Reviewed-by: Marek Olšák <marek.olsak@amd.com>
2015-08-05 13:47:51 -04:00
Jammy Zhou bef8b6097c amdgpu: do NULL check for bo handle in amdgpu_bo_query_info
Signed-off-by: Jammy Zhou <Jammy.Zhou@amd.com>
Reviewed-by: Christian König <christian.koenig@amd.com>
2015-08-05 13:47:51 -04:00
Christian König 933091e1d6 amdgpu: cleanup VA IOCTL handling
Signed-off-by: Christian König <christian.koenig@amd.com>
Reviewed-by: Alex Deucher <alexander.deucher@amd.com>
2015-08-05 13:47:51 -04:00
Christian König 804048ff65 amdgpu: remove flink export workaround v2
Alternative solution to Mareks patch to stop causing trouble with render nodes.

v2: rebased

Signed-off-by: Christian König <christian.koenig@amd.com>
Reviewed-by: Alex Deucher <alexander.deucher@amd.com>
2015-08-05 13:47:51 -04:00
Christian König 9f16c733f1 amdgpu: explicitly unmap GPU mapping on BO destruction
That exercises the IOCTL and stops relying us on implicit unmapping.

Signed-off-by: Christian König <christian.koenig@amd.com>
Reviewed-by: Alex Deucher <alexander.deucher@amd.com>
2015-08-05 13:47:51 -04:00
Jammy Zhou 7bbc1debaf amdgpu: cleanup gds specific alloc/free functions
amdgpu_bo_alloc/free can be used with GDS/OA/QWS domains specified

Signed-off-by: Jammy Zhou <Jammy.Zhou@amd.com>
Reviewed-by: Alex Deucher <alexander.deucher@amd.com>
2015-08-05 13:47:51 -04:00
Jammy Zhou 657245f7a3 amdgpu: add amdgpu_query_gds_info
Signed-off-by: Jammy Zhou <Jammy.Zhou@amd.com>
Reviewed-by: Alex Deucher <alexander.deucher@amd.com>
2015-08-05 13:47:51 -04:00
Marek Olšák 201b09a443 amdgpu: fix double mutex_unlock in amdgpu_bo_import
The handles array is used below, which is followed by another unlock,
so remove the first one.

Reviewed-by: Alex Deucher <alexander.deucher@amd.com>
2015-08-05 13:47:51 -04:00
Marek Olšák 7d7f25c938 amdgpu: fix valgrind warnings
Reviewed-by: Alex Deucher <alexander.deucher@amd.com>
2015-08-05 13:47:51 -04:00
Marek Olšák 34e1250e37 amdgpu: use alloca and malloc in critical codepaths (v2)
And don't clear the memory when it's unnecessary.

v2: use malloc for arrays that can be big

Reviewed-by: Alex Deucher <alexander.deucher@amd.com>
2015-08-05 13:47:51 -04:00
Marek Olšák 908f34e70c amdgpu: allow exporting KMS handles with render nodes
Reviewed-by: Christian König <christian.koenig@amd.com>
2015-08-05 13:47:51 -04:00
Jack Xiao b9ef29d1be amdgpu: add zero timeout check in amdgpu_cs_query_fence_status
Signed-off-by: Jack Xiao <Jack.Xiao@amd.com>
Reviewed-by: Jammy Zhou <Jammy.Zhou@amd.com>
2015-08-05 13:47:51 -04:00
Marek Olšák 76af5c249f amdgpu: remove bo_handle from amdgpu_cs_ib_info, IBs should be in buffer list
Reviewed-by: Christian König <christian.koenig@amd.com>
2015-08-05 13:47:51 -04:00
Marek Olšák 646f5411cf amdgpu: remove amdgpu_ib helpers
Reviewed-by: Jammy Zhou <Jammy.Zhou@amd.com>
Reviewed-by: Christian König <christian.koenig@amd.com>
2015-08-05 13:47:50 -04:00
Marek Olšák 194d5c2ee4 amdgpu: remove amdgpu_ib
Not useful if we're gonna use BO handles directly.

Reviewed-by: Jammy Zhou <Jammy.Zhou@amd.com>
Reviewed-by: Christian König <christian.koenig@amd.com>
2015-08-05 13:47:50 -04:00
Marek Olšák 2a344a8d8a amdgpu: don't use amdgpu_cs_create_ib for allocation of the fence BO
amdgpu_cs_create_ib will go away.

Reviewed-by: Jammy Zhou <Jammy.Zhou@amd.com>
Reviewed-by: Christian König <christian.koenig@amd.com>
2015-08-05 13:47:50 -04:00
Jammy Zhou 40c5336043 amdgpu: get rid of IB pool management v3
v1: by Jammy Zhou
v2: remove bo wait when destroy IB by Jammy Zhou
v3: more cleanups by Marek

Reviewed-by: Jammy Zhou <Jammy.Zhou@amd.com>
Reviewed-by: Christian König <christian.koenig@amd.com>
2015-08-05 13:47:50 -04:00
Ken Wang cdd1edcae0 amdgpu: add ce_ram_size for interface query
Signed-off-by: Ken Wang <Qingqing.Wang@amd.com>
Reviewed-by: Jammy Zhou <Jammy.Zhou@amd.com>
2015-08-05 13:47:50 -04:00
Ken Wang 4bf29413a3 amdgpu: add vram_type and vram_bit_width for interface query
Signed-off-by: Ken Wang <Qingqing.Wang@amd.com>
Reviewed-by: Jammy Zhou <Jammy.Zhou@amd.com>
2015-08-05 13:47:50 -04:00
Ken Wang fc9fc7dd11 amdgpu: add max_memory_clock for interface query
Signed-off-by: Ken Wang <Qingqing.Wang@amd.com>
Reviewed-by: Jammy Zhou <Jammy.Zhou@amd.com>
2015-08-05 13:47:50 -04:00
Christian König 942a5dbe6c amdgpu: stop checking flag masks
The kernel is responsible for parameter checking, not libdrm.

Signed-off-by: Christian König <christian.koenig@amd.com>
Reviewed-by: Alex Deucher <alexander.deucher@amd.com>
Reviewed-by: Monk Liu <monk.liu@amd.com>
2015-08-05 13:47:50 -04:00
Ken Wang 322d02d025 amdgpu: make vamgr global
This is the first sub-patch of va interface task, the va task is
about adding more va management interfaces for UMD, by design, the
vamgr should be per-process rather than per-device.

Signed-off-by: Ken Wang <Qingqing.Wang@amd.com>
Reviewed-by: Christian König <christian.koenig@amd.com>
2015-08-05 13:47:50 -04:00
Jammy Zhou 60e221c925 amdgpu: add IB sharing support v2
A new 'offset' flag is added to the amdgpu_cs_ib_info structure,
which can be used to specify location of PM4 packets to execute
in the IB buffer object

v2: remove the shared IB flag, etc

Signed-off-by: Jammy Zhou <Jammy.Zhou@amd.com>
Reviewed-by: Alex Deucher <alexander.deucher@amd.com>
2015-08-05 13:47:50 -04:00
Christian König 12a23b1964 amdgpu: add helper for VM mapping v2
Less code and also provides the map_size parameter.

v2: Also set offset_in_bo, use *_handle defines.

Signed-off-by: Christian König <christian.koenig@amd.com>
2015-08-05 13:47:50 -04:00
Christian König d5c0b2a172 amdgpu: remove bo_vas hash table v2
Not used any more.

v2: Keep accidental removed lines.

Signed-off-by: Christian König <christian.koenig@amd.com>
2015-08-05 13:47:50 -04:00
Jammy Zhou 7244698ddc amdgpu: add amdgpu_bo_list_update interface v2
v2: some minor improvement

Signed-off-by: Jammy Zhou <Jammy.Zhou@amd.com>
Reviewed-by: Michel Dänzer <michel.daenzer@amd.com>
Reviewed-by: Christian König <christian.koenig@amd.com>
2015-08-05 13:47:50 -04:00
Jammy Zhou 3f1ca0f939 amdgpu: replace alloca with calloc v2
use heap memory instead of stack memory to avoid potential stack overflow
when a large number of resources are used for the bo_list.

v2: some minor improvement

Signed-off-by: Jammy Zhou <Jammy.Zhou@amd.com>
Reviewed-by: Michel Dänzer <michel.daenzer@amd.com>
Reviewed-by: Christian König <christian.koenig@amd.com>
2015-08-05 13:47:49 -04:00
Jammy Zhou 8cf8ac1539 amdgpu: remove unused AMDGPU_IB_RESOURCE_PRIORITY
Signed-off-by: Jammy Zhou <Jammy.Zhou@amd.com>
Reviewed-by: Michel Dänzer <michel.daenzer@amd.com>
Reviewed-by: Christian König <christian.koenig@amd.com>
2015-08-05 13:47:49 -04:00
Jammy Zhou 8a208ee8f9 amdgpu: fix the number of IB size enums
Signed-off-by: Jammy Zhou <Jammy.Zhou@amd.com>
Reviewed-by: Michel Dänzer <michel.daenzer@amd.com>
Reviewed-by: Christian König <christian.koenig@amd.com>
2015-08-05 13:47:49 -04:00
Marek Olšák 2d588797f1 amdgpu: fix a valgrind warning
==10307== Conditional jump or move depends on uninitialised value(s)
==10307==    at 0xB9F4CFA: amdgpu_device_initialize (amdgpu_device.c:193)

Reviewed-by: Jammy Zhou <Jammy.Zhou@amd.com>
Reviewed-by: Alex Deucher <alexander.deucher@amd.com>
2015-08-05 13:47:49 -04:00