summaryrefslogtreecommitdiff
path: root/drivers/gpu/drm/drm_syncobj.c
diff options
context:
space:
mode:
authorDaniel Vetter <daniel.vetter@ffwll.ch>2022-06-15 19:12:17 +0200
committerDaniel Vetter <daniel.vetter@ffwll.ch>2022-06-15 19:12:17 +0200
commit0f95ee9a0c579ebed0309657f6918673927189f2 (patch)
treee10c39634b67eaaae5d6330f1f3538b24251439c /drivers/gpu/drm/drm_syncobj.c
parentb13baccc3850ca8b8cccbf8ed9912dbaa0fdf7f3 (diff)
parentdfa687bffc8a4a21ed929c7dececf01b8f1f52ee (diff)
Merge tag 'drm-misc-next-2022-06-08' of git://anongit.freedesktop.org/drm/drm-misc into drm-next
drm-misc-next for 5.20: UAPI Changes: * connector: export bpc limits in debugfs * dma-buf: Print buffer name in debugfs Cross-subsystem Changes: * dma-buf: Improve dma-fence handling; Cleanups * fbdev: Device-unregistering fixes Core Changes: * client: Only use driver-validated modes to avoid blank screen * dp-aux: Make probing more reliable; Small fixes * edit: CEA data-block iterators; Introduce struct drm_edid; Many cleanups * gem: Don't use framebuffer format's non-exising color planes * probe-helper: Use 640x480 as DisplayPort fallback; Refactoring * scheduler: Don't kill jobs in interrupt context Driver Changes: * amdgpu: Use atomic fence helpers in DM; Fix VRAM address calculation; Export CRTC bpc settings via debugfs * bridge: Add TI-DLPC3433; anx7625: Fixes; fy07024di26a30d: Optional GPIO reset; icn6211: Cleanups; ldb: Add reg and reg-name properties to bindings, Kconfig fixes; lt9611: Fix display sensing; lt9611uxc: Fixes; nwl-dsi: Fixes; ps8640: Cleanups; st7735r: Fixes; tc358767: DSI/DPI refactoring and DSI-to-eDP support, Fixes; ti-sn65dsi83: Fixes; * gma500: Cleanup connector I2C handling * hyperv: Unify VRAM allocation of Gen1 and Gen2 * i915: export CRTC bpc settings via debugfs * meson: Support YUV422 output; Refcount fixes * mgag200: Support damage clipping; Support gamma handling; Protect concurrent HW access; Fixes to connector; Store model-specific limits in device-info structure; Cleanups * nouveau: Fixes and Cleanups * panel: Kconfig fixes * panfrost: Valhall support * r128: Fix bit-shift overflow * rockchip: Locking fixes in error path; Minor cleanups * ssd130x: Fix built-in linkage * ttm: Cleanups * udl; Always advertize VGA connector * fbdev/vesa: Support COMPILE_TEST Signed-off-by: Daniel Vetter <daniel.vetter@ffwll.ch> From: Thomas Zimmermann <tzimmermann@suse.de> Link: https://patchwork.freedesktop.org/patch/msgid/YqBtumw05JZDEZE2@linux-uq9g
Diffstat (limited to 'drivers/gpu/drm/drm_syncobj.c')
-rw-r--r--drivers/gpu/drm/drm_syncobj.c57
1 files changed, 7 insertions, 50 deletions
diff --git a/drivers/gpu/drm/drm_syncobj.c b/drivers/gpu/drm/drm_syncobj.c
index 7e48dcd1bee4..bbad9e4696e7 100644
--- a/drivers/gpu/drm/drm_syncobj.c
+++ b/drivers/gpu/drm/drm_syncobj.c
@@ -184,6 +184,7 @@
*/
#include <linux/anon_inodes.h>
+#include <linux/dma-fence-unwrap.h>
#include <linux/file.h>
#include <linux/fs.h>
#include <linux/sched/signal.h>
@@ -853,57 +854,12 @@ drm_syncobj_fd_to_handle_ioctl(struct drm_device *dev, void *data,
&args->handle);
}
-
-/*
- * Try to flatten a dma_fence_chain into a dma_fence_array so that it can be
- * added as timeline fence to a chain again.
- */
-static int drm_syncobj_flatten_chain(struct dma_fence **f)
-{
- struct dma_fence_chain *chain = to_dma_fence_chain(*f);
- struct dma_fence *tmp, **fences;
- struct dma_fence_array *array;
- unsigned int count;
-
- if (!chain)
- return 0;
-
- count = 0;
- dma_fence_chain_for_each(tmp, &chain->base)
- ++count;
-
- fences = kmalloc_array(count, sizeof(*fences), GFP_KERNEL);
- if (!fences)
- return -ENOMEM;
-
- count = 0;
- dma_fence_chain_for_each(tmp, &chain->base)
- fences[count++] = dma_fence_get(tmp);
-
- array = dma_fence_array_create(count, fences,
- dma_fence_context_alloc(1),
- 1, false);
- if (!array)
- goto free_fences;
-
- dma_fence_put(*f);
- *f = &array->base;
- return 0;
-
-free_fences:
- while (count--)
- dma_fence_put(fences[count]);
-
- kfree(fences);
- return -ENOMEM;
-}
-
static int drm_syncobj_transfer_to_timeline(struct drm_file *file_private,
struct drm_syncobj_transfer *args)
{
struct drm_syncobj *timeline_syncobj = NULL;
+ struct dma_fence *fence, *tmp;
struct dma_fence_chain *chain;
- struct dma_fence *fence;
int ret;
timeline_syncobj = drm_syncobj_find(file_private, args->dst_handle);
@@ -912,13 +868,14 @@ static int drm_syncobj_transfer_to_timeline(struct drm_file *file_private,
}
ret = drm_syncobj_find_fence(file_private, args->src_handle,
args->src_point, args->flags,
- &fence);
+ &tmp);
if (ret)
goto err_put_timeline;
- ret = drm_syncobj_flatten_chain(&fence);
- if (ret)
- goto err_free_fence;
+ fence = dma_fence_unwrap_merge(tmp);
+ dma_fence_put(tmp);
+ if (!fence)
+ goto err_put_timeline;
chain = dma_fence_chain_alloc();
if (!chain) {