diff options
author | Dave Airlie <airlied@redhat.com> | 2017-10-08 21:00:16 -0400 |
---|---|---|
committer | Dave Airlie <airlied@redhat.com> | 2017-10-08 21:00:16 -0400 |
commit | bb7a9c8d712f37385a706a594d6edf6e6d2669d0 (patch) | |
tree | 701a317ca8ecc2bedc40577b657dcdda3e7428c5 /drivers/gpu/drm/amd/amdgpu/amdgpu_cs.c | |
parent | 15438ab06515b093d61e2f35bb27d21e5e7f966e (diff) | |
parent | d3f04c98ead2b89887e1e3c09b26e4917bacdd9e (diff) |
Merge branch 'drm-next-4.15' of git://people.freedesktop.org/~agd5f/linux into drm-next
More new stuff for 4.15. Highlights:
- Add clock query interface for raven
- Add new FENCE_TO_HANDLE ioctl
- UVD video encode ring support on polaris
- transparent huge page DMA support
- deadlock fixes
- compute pipe lru tweaks
- powerplay cleanups and regression fixes
- fix duplicate symbol issue with radeon and amdgpu
- misc bug fixes
* 'drm-next-4.15' of git://people.freedesktop.org/~agd5f/linux: (72 commits)
drm/radeon/dp: make radeon_dp_get_dp_link_config static
drm/radeon: move ci_send_msg_to_smc to where it's used
drm/amd/sched: fix deadlock caused by unsignaled fences of deleted jobs
drm/amd/sched: NULL out the s_fence field after run_job
drm/amd/sched: move adding finish callback to amd_sched_job_begin
drm/amd/sched: fix an outdated comment
drm/amd/sched: rename amd_sched_entity_pop_job
drm/amdgpu: minor coding style fix
drm/ttm: add transparent huge page support for DMA allocations v2
drm/ttm: add support for different pool sizes
drm/ttm: remove unsued options from ttm_mem_global_alloc_page
drm/amdgpu: add uvd enc irq
drm/amdgpu: add uvd enc ib test
drm/amdgpu: add uvd enc ring test
drm/amdgpu: add uvd enc vm functions (v2)
drm/amdgpu: add uvd enc into run queue
drm/amdgpu: add uvd enc rings
drm/amdgpu: add new uvd enc ring methods
drm/amdgpu: add uvd enc command in header
drm/amdgpu: add uvd enc registers in header
...
Diffstat (limited to 'drivers/gpu/drm/amd/amdgpu/amdgpu_cs.c')
-rw-r--r-- | drivers/gpu/drm/amd/amdgpu/amdgpu_cs.c | 61 |
1 files changed, 61 insertions, 0 deletions
diff --git a/drivers/gpu/drm/amd/amdgpu/amdgpu_cs.c b/drivers/gpu/drm/amd/amdgpu/amdgpu_cs.c index c6a214f1e991..ab83dfcabb41 100644 --- a/drivers/gpu/drm/amd/amdgpu/amdgpu_cs.c +++ b/drivers/gpu/drm/amd/amdgpu/amdgpu_cs.c | |||
@@ -25,6 +25,7 @@ | |||
25 | * Jerome Glisse <glisse@freedesktop.org> | 25 | * Jerome Glisse <glisse@freedesktop.org> |
26 | */ | 26 | */ |
27 | #include <linux/pagemap.h> | 27 | #include <linux/pagemap.h> |
28 | #include <linux/sync_file.h> | ||
28 | #include <drm/drmP.h> | 29 | #include <drm/drmP.h> |
29 | #include <drm/amdgpu_drm.h> | 30 | #include <drm/amdgpu_drm.h> |
30 | #include <drm/drm_syncobj.h> | 31 | #include <drm/drm_syncobj.h> |
@@ -1330,6 +1331,66 @@ static struct dma_fence *amdgpu_cs_get_fence(struct amdgpu_device *adev, | |||
1330 | return fence; | 1331 | return fence; |
1331 | } | 1332 | } |
1332 | 1333 | ||
1334 | int amdgpu_cs_fence_to_handle_ioctl(struct drm_device *dev, void *data, | ||
1335 | struct drm_file *filp) | ||
1336 | { | ||
1337 | struct amdgpu_device *adev = dev->dev_private; | ||
1338 | struct amdgpu_fpriv *fpriv = filp->driver_priv; | ||
1339 | union drm_amdgpu_fence_to_handle *info = data; | ||
1340 | struct dma_fence *fence; | ||
1341 | struct drm_syncobj *syncobj; | ||
1342 | struct sync_file *sync_file; | ||
1343 | int fd, r; | ||
1344 | |||
1345 | if (amdgpu_kms_vram_lost(adev, fpriv)) | ||
1346 | return -ENODEV; | ||
1347 | |||
1348 | fence = amdgpu_cs_get_fence(adev, filp, &info->in.fence); | ||
1349 | if (IS_ERR(fence)) | ||
1350 | return PTR_ERR(fence); | ||
1351 | |||
1352 | switch (info->in.what) { | ||
1353 | case AMDGPU_FENCE_TO_HANDLE_GET_SYNCOBJ: | ||
1354 | r = drm_syncobj_create(&syncobj, 0, fence); | ||
1355 | dma_fence_put(fence); | ||
1356 | if (r) | ||
1357 | return r; | ||
1358 | r = drm_syncobj_get_handle(filp, syncobj, &info->out.handle); | ||
1359 | drm_syncobj_put(syncobj); | ||
1360 | return r; | ||
1361 | |||
1362 | case AMDGPU_FENCE_TO_HANDLE_GET_SYNCOBJ_FD: | ||
1363 | r = drm_syncobj_create(&syncobj, 0, fence); | ||
1364 | dma_fence_put(fence); | ||
1365 | if (r) | ||
1366 | return r; | ||
1367 | r = drm_syncobj_get_fd(syncobj, (int*)&info->out.handle); | ||
1368 | drm_syncobj_put(syncobj); | ||
1369 | return r; | ||
1370 | |||
1371 | case AMDGPU_FENCE_TO_HANDLE_GET_SYNC_FILE_FD: | ||
1372 | fd = get_unused_fd_flags(O_CLOEXEC); | ||
1373 | if (fd < 0) { | ||
1374 | dma_fence_put(fence); | ||
1375 | return fd; | ||
1376 | } | ||
1377 | |||
1378 | sync_file = sync_file_create(fence); | ||
1379 | dma_fence_put(fence); | ||
1380 | if (!sync_file) { | ||
1381 | put_unused_fd(fd); | ||
1382 | return -ENOMEM; | ||
1383 | } | ||
1384 | |||
1385 | fd_install(fd, sync_file->file); | ||
1386 | info->out.handle = fd; | ||
1387 | return 0; | ||
1388 | |||
1389 | default: | ||
1390 | return -EINVAL; | ||
1391 | } | ||
1392 | } | ||
1393 | |||
1333 | /** | 1394 | /** |
1334 | * amdgpu_cs_wait_all_fence - wait on all fences to signal | 1395 | * amdgpu_cs_wait_all_fence - wait on all fences to signal |
1335 | * | 1396 | * |