Commit Graph

99 Commits (3c20893daa0a56b91869d806ae0d3a8d5d8b4cba)

Author SHA1 Message Date
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
Marek Olšák 4b39a8e7cf amdgpu: implement amdgpu_cs_query_reset_state
v2: also return the number of hangs

Reviewed-by: Christian König <christian.koenig@amd.com>
Reviewed-by: Jammy Zhou <Jammy.Zhou@amd.com>
2015-08-05 13:47:49 -04:00
monk.liu d3e7195066 amdgpu: fix vamgr_free_va logic
va+size will overflow if va equals to AMDGPU_INVALID_VA_ADDRESS, just
return when hit that condition

Signed-off-by: monk.liu <monk.liu@amd.com>
Reviewed-by: Jammy Zhou <jammy.zhou@amd.com>
2015-08-05 13:47:49 -04:00
monk.liu 9066acf109 amdgpu: fix code alignment
Signed-off-by: monk.liu <monk.liu@amd.com>
2015-08-05 13:47:49 -04:00
Jammy Zhou 241cf6d105 amdgpu: validate the upper limit of virtual address v2
Only 8GB virtual address space is used by default now

v2: use -ENOSPC for the error case

Signed-off-by: Jammy Zhou <Jammy.Zhou@amd.com>
2015-08-05 13:47:49 -04:00
Jammy Zhou db126d1d8a amdgpu: reuse the kernel IB flags v2
v2: remove 'CE' from the preamble flag

Signed-off-by: Jammy Zhou <Jammy.Zhou@amd.com>
Reviewed-by: Christian König <christian.koenig@amd.com>
2015-08-05 13:47:49 -04:00
Jammy Zhou d9c431dd02 amdgpu: add ctx_id for wait_cs
Signed-off-by: Jammy Zhou <Jammy.Zhou@amd.com>
Reviewed-by: Christian König <christian.koenig@amd.com>
Reviewed-by: David Zhou <david1.zhou@amd.com>
2015-08-05 13:47:49 -04:00
Jack Xiao 7454779f9b amdgpu: fix round down/up page size error
Signed-off-by: Jack Xiao <Jack.Xiao@amd.com>
Reviewed-by: Monk Liu monk.liu@amd.com
Reviewed-by: Jammy Zhou <Jammy.Zhou@amd.com>
2015-08-05 13:47:49 -04:00
Jammy Zhou 14070057d8 amdgpu: fix 32-on-64 support (v2)
0xffffffff was appended to the higher 32bit with (intptr_t) when use
32bit libdrm_amdgpu.so with 64bit kernel, and it caused segmentation
fault for 32bit application.

v2: switch to uintptr_t

Signed-off-by: Jammy Zhou <Jammy.Zhou@amd.com>
Reviewed-by: Michel Dänzer <michel.daenzer@amd.com>
2015-08-05 13:47:49 -04:00
Jammy Zhou 639c7de955 amdgpu: remove active_rb_pipes from amdgpu_gpu_info
The active RB pipes can be retrieved from enabled_rb_pipes_mask,
for which each bit indicates one active pipe if it is '1'.

Signed-off-by: Jammy Zhou <Jammy.Zhou@amd.com>
Reviewed-by: Christian König <christian.koenig@amd.com>
2015-08-05 13:47:49 -04:00
monk.liu 3b50db9d9f amdgpu: fix segfault when resources are NULL
Signed-off-by: monk.liu <monk.liu@amd.com>
Reviewed-by: Christian König <christian.koenig@amd.com>
Reviewed-by: Jammy Zhou <Jammy.Zhou@amd.com>
2015-08-05 13:47:49 -04:00
Christian König c68d58aa14 amdgpu: compare the primary device names instead
Instead of taking a look at the device major/minor we
just compare the primary device name to figure out if
two fds are pointing to the same device.

Reviewed-by: Alex Deucher <alexander.deucher@amd.com>
Signed-off-by: Christian König <christian.koenig@amd.com>
2015-08-05 13:47:49 -04:00
Christian König 6dc2eaf2cc amdgpu: add public bo list interface v3
v2: cleanup comments and function parameter
v3: rebased on internal branch

Signed-off-by: Christian König <christian.koenig@amd.com>
Reviewed-by: Jammy Zhou <Jammy.Zhou@amd.com>
Reviewed-by: Alex Deucher <alexander.deucher@amd.com>
Signed-off-by: Alex Deucher <alexander.deucher@amd.com>
2015-08-05 13:47:49 -04:00
Christian König 9c2afffedb amdgpu: cleanup public interface v2
Remove the mostly unused device parameter, for the few cases
where we really need it keep a copy in the context structure.

v2: rebased on internal branch

Signed-off-by: Christian König <christian.koenig@amd.com>
Reviewed-by: Jammy Zhou <Jammy.Zhou@amd.com>
Reviewed-by: Alex Deucher <alexander.deucher@amd.com>
Signed-off-by: Alex Deucher <alexander.deucher@amd.com>
2015-08-05 13:47:49 -04:00
monk.liu 9c3bec246e amdgpu: do not call BO_LIST ioctl when no resource referred
Signed-off-by: monk.liu <monk.liu@amd.com>
Reviewed-by: Christian König <christian.koenig@amd.com>
Signed-off-by: Alex Deucher <alexander.deucher@amd.com>
2015-08-05 13:47:49 -04:00
monk.liu 83d9369583 amdgpu: fix an error of bo_list handler
original method is just totally wrong, it loses the bo_list handler at
all after command stream accomplished

Signed-off-by: Monk.Liu <monk.liu@amd.com>
Reviewed-by: Christian König <christian.koenig@amd.com>
Signed-off-by: Alex Deucher <alexander.deucher@amd.com>
2015-08-05 13:47:49 -04:00
monk.liu cc01c3cb5a amdgpu: add missing mutex lock/unlock pair
Signed-off-by: monk.liu <monk.liu@amd.com>
Reviewed-by: Christian König <christian.koenig@amd.com>
Signed-off-by: Alex Deucher <alexander.deucher@amd.com>
2015-08-05 13:47:48 -04:00
monk.liu 2f2c8ac0f4 amdgpu: support non-page-aligned userptr
Signed-off-by: monk.liu <monk.liu@amd.com>
Reviewed-by: Christian König <christian.koenig@amd.com>
Signed-off-by: Alex Deucher <alexander.deucher@amd.com>
2015-08-05 13:47:48 -04:00
Alex Deucher 0936139536 drm: add libdrm_amdgpu (v7)
This is the new ioctl wrapper used by the new admgpu driver.
It's primarily used by xf86-video-amdgpu and mesa.

v2: fix amdgpu_drm.h install
v3: Integrate some of the sugestions from Emil:
    clean up Makefile.am, configure.ac
    capitalize header guards
    fix _FILE_OFFSET_BITS with config.h
    use drm_mmap/drm_munmap
    Remove unused ARRAY_SIZE macro
    use shared list implementation
    use shared math implementation
    use drmGetNodeTypeFromFd helper
v4: remove unused tiling defines
v5: include amdgpu.h in Makefile.am
v6: update amdgpu_drm.h
v7: libdrm.h -> libdrm_macros.h

Signed-off-by: Alex Deucher <alexander.deucher@amd.com>
2015-08-05 13:47:48 -04:00