[PATCH 3/7] drm/lima: switch to using drm_exec
Christian König
ckoenig.leichtzumerken at gmail.com
Wed Jul 12 12:47:00 UTC 2023
Just a straightforward conversion without any optimization.
Only compile tested for now.
Signed-off-by: Christian König <christian.koenig at amd.com>
Cc: Qiang Yu <yuq825 at gmail.com>
Cc: lima at lists.freedesktop.org
---
drivers/gpu/drm/lima/Kconfig | 1 +
drivers/gpu/drm/lima/lima_gem.c | 17 +++++++++--------
2 files changed, 10 insertions(+), 8 deletions(-)
diff --git a/drivers/gpu/drm/lima/Kconfig b/drivers/gpu/drm/lima/Kconfig
index fa1d4f5df31e..1d2871d9ddd2 100644
--- a/drivers/gpu/drm/lima/Kconfig
+++ b/drivers/gpu/drm/lima/Kconfig
@@ -9,6 +9,7 @@ config DRM_LIMA
depends on COMMON_CLK
depends on OF
select DRM_SCHED
+ select DRM_EXEC
select DRM_GEM_SHMEM_HELPER
select PM_DEVFREQ
select DEVFREQ_GOV_SIMPLE_ONDEMAND
diff --git a/drivers/gpu/drm/lima/lima_gem.c b/drivers/gpu/drm/lima/lima_gem.c
index 4f9736e5f929..d4688d19465b 100644
--- a/drivers/gpu/drm/lima/lima_gem.c
+++ b/drivers/gpu/drm/lima/lima_gem.c
@@ -8,6 +8,7 @@
#include <linux/shmem_fs.h>
#include <linux/dma-mapping.h>
+#include <drm/drm_exec.h>
#include <drm/drm_file.h>
#include <drm/drm_syncobj.h>
#include <drm/drm_utils.h>
@@ -292,7 +293,7 @@ static int lima_gem_add_deps(struct drm_file *file, struct lima_submit *submit)
int lima_gem_submit(struct drm_file *file, struct lima_submit *submit)
{
int i, err = 0;
- struct ww_acquire_ctx ctx;
+ struct drm_exec exec;
struct lima_drm_priv *priv = to_lima_drm_priv(file);
struct lima_vm *vm = priv->vm;
struct drm_syncobj *out_sync = NULL;
@@ -329,8 +330,11 @@ int lima_gem_submit(struct drm_file *file, struct lima_submit *submit)
bos[i] = bo;
}
- err = drm_gem_lock_reservations((struct drm_gem_object **)bos,
- submit->nr_bos, &ctx);
+ drm_exec_init(&exec, DRM_EXEC_INTERRUPTIBLE_WAIT);
+ drm_exec_until_all_locked(&exec)
+ err = drm_exec_prepare_array(&exec,
+ (struct drm_gem_object **)bos,
+ submit->nr_bos, 0);
if (err)
goto err_out0;
@@ -360,9 +364,7 @@ int lima_gem_submit(struct drm_file *file, struct lima_submit *submit)
submit->bos[i].flags & LIMA_SUBMIT_BO_WRITE ?
DMA_RESV_USAGE_WRITE : DMA_RESV_USAGE_READ);
}
-
- drm_gem_unlock_reservations((struct drm_gem_object **)bos,
- submit->nr_bos, &ctx);
+ drm_exec_fini(&exec);
for (i = 0; i < submit->nr_bos; i++)
drm_gem_object_put(&bos[i]->base.base);
@@ -379,8 +381,7 @@ int lima_gem_submit(struct drm_file *file, struct lima_submit *submit)
err_out2:
lima_sched_task_fini(submit->task);
err_out1:
- drm_gem_unlock_reservations((struct drm_gem_object **)bos,
- submit->nr_bos, &ctx);
+ drm_exec_fini(&exec);
err_out0:
for (i = 0; i < submit->nr_bos; i++) {
if (!bos[i])
--
2.34.1
More information about the dri-devel
mailing list