[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: [PATCH 01/20] drm/amdgpu: Introduce GEM object functions
- To: Thomas Zimmermann <tzimmermann@xxxxxxx>, alexander.deucher@xxxxxxx, airlied@xxxxxxxx, daniel@xxxxxxxx, linux@xxxxxxxxxxxxxxx, maarten.lankhorst@xxxxxxxxxxxxxxx, mripard@xxxxxxxxxx, l.stach@xxxxxxxxxxxxxx, christian.gmeiner@xxxxxxxxx, inki.dae@xxxxxxxxxxx, jy0922.shim@xxxxxxxxxxx, sw0312.kim@xxxxxxxxxxx, kyungmin.park@xxxxxxxxxxx, kgene@xxxxxxxxxx, krzk@xxxxxxxxxx, patrik.r.jakobsson@xxxxxxxxx, jani.nikula@xxxxxxxxxxxxxxx, joonas.lahtinen@xxxxxxxxxxxxxxx, rodrigo.vivi@xxxxxxxxx, chunkuang.hu@xxxxxxxxxx, p.zabel@xxxxxxxxxxxxxx, matthias.bgg@xxxxxxxxx, robdclark@xxxxxxxxx, sean@xxxxxxxxxx, bskeggs@xxxxxxxxxx, tomi.valkeinen@xxxxxx, eric@xxxxxxxxxx, hjc@xxxxxxxxxxxxxx, heiko@xxxxxxxxx, thierry.reding@xxxxxxxxx, jonathanh@xxxxxxxxxx, rodrigosiqueiramelo@xxxxxxxxx, hamohammed.sa@xxxxxxxxx, oleksandr_andrushchenko@xxxxxxxx, hyun.kwon@xxxxxxxxxx, laurent.pinchart@xxxxxxxxxxxxxxxx, michal.simek@xxxxxxxxxx, sumit.semwal@xxxxxxxxxx, evan.quan@xxxxxxx, Hawking.Zhang@xxxxxxx, tianci.yin@xxxxxxx, marek.olsak@xxxxxxx, hdegoede@xxxxxxxxxx, andrey.grodzovsky@xxxxxxx, Felix.Kuehling@xxxxxxx, xinhui.pan@xxxxxxx, aaron.liu@xxxxxxx, nirmoy.das@xxxxxxx, chris@xxxxxxxxxxxxxxxxxx, matthew.auld@xxxxxxxxx, abdiel.janulgue@xxxxxxxxxxxxxxx, tvrtko.ursulin@xxxxxxxxxxxxxxx, andi.shyti@xxxxxxxxx, sam@xxxxxxxxxxxx, miaoqinglang@xxxxxxxxxx, emil.velikov@xxxxxxxxxxxxx
- From: Christian König <christian.koenig@xxxxxxx>
- Date: Thu, 13 Aug 2020 12:22:52 +0200
- Arc-authentication-results: i=1; mx.microsoft.com 1; spf=pass smtp.mailfrom=amd.com; dmarc=pass action=none header.from=amd.com; dkim=pass header.d=amd.com; arc=none
- Arc-message-signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=microsoft.com; s=arcselector9901; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-SenderADCheck; bh=w5d70p1z0+mYwE6LpqD+dNQRMQ7TFTm73C7W2adEQFM=; b=UqVOuXSqVrmfFthib79C/6Zda1TxkEruS7c6T0ggxC+qcb4Rkf+FmRhxbD8cgZTQ+uzfTVHcy3FZ0z3vq4X2mOBIvTE2eepcp3xkPUUi3lnO7BnrjwlpYS6dDAcc+k79ypHejvdIAp/sauO6WW92oUj9QbuJJMpTelUj+rDy6L3K1STfkcwrrrMh3E14n2Bj8QswgYQeB1yAN1MgShncNnf2TveHLosf1Xcoo/9roSw0VbAbsVbDYKxf3ARvPJzcP+zL0+NjGMxcsbclf+2dWsxJw1Ed/H+s2vleT7spogjd+hR3Vcjqpwe5ezwlMPBU2SXUJCSnz+1VzunLgNdm0A==
- Arc-seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=BMpORAcxHMV0FafWYD6eC4FOaae1mauovmog7ytO5vCeawDkjCMa6SHtJ2uNayVq/nU+V7ooeuDoKZ7Pv7zPiQaHFmn9SmOYZIsK7z21udR4s5nNgypOIF3iUC1dxa6TZEgT0umw063u0L0sFahrIsu+5VFc1Q/G0MlxQKzvvHsPpG6zhaRvfRVXlWVN95aE18wvg9v+T4lvnHIEatGiQ5vnjtewze1cP0ff68UyKyv01/PKBZQRibBHpZESBAcjhB+BilFdJ4BpMVelmYENy4THxG2dNG5Ydvtcp13qR/Woz1RwvCzKsTQQ0gBSolYvgTYvYDWiDnRGPYvjz/prHw==
- Authentication-results: lists.xenproject.org; dkim=none (message not signed) header.d=none;lists.xenproject.org; dmarc=none action=none header.from=amd.com;
- Cc: amd-gfx@xxxxxxxxxxxxxxxxxxxxx, dri-devel@xxxxxxxxxxxxxxxxxxxxx, etnaviv@xxxxxxxxxxxxxxxxxxxxx, linux-arm-kernel@xxxxxxxxxxxxxxxxxxx, linux-samsung-soc@xxxxxxxxxxxxxxx, intel-gfx@xxxxxxxxxxxxxxxxxxxxx, linux-mediatek@xxxxxxxxxxxxxxxxxxx, linux-arm-msm@xxxxxxxxxxxxxxx, freedreno@xxxxxxxxxxxxxxxxxxxxx, nouveau@xxxxxxxxxxxxxxxxxxxxx, linux-rockchip@xxxxxxxxxxxxxxxxxxx, linux-tegra@xxxxxxxxxxxxxxx, xen-devel@xxxxxxxxxxxxxxxxxxxx
- Delivery-date: Thu, 13 Aug 2020 10:23:24 +0000
- List-id: Xen developer discussion <xen-devel.lists.xenproject.org>
Am 13.08.20 um 10:36 schrieb Thomas Zimmermann:
GEM object functions deprecate several similar callback interfaces in
struct drm_driver. This patch replaces the per-driver callbacks with
per-instance callbacks in amdgpu. The only exception is gem_prime_mmap,
which is non-trivial to convert.
Signed-off-by: Thomas Zimmermann <tzimmermann@xxxxxxx>
---
drivers/gpu/drm/amd/amdgpu/amdgpu_drv.c | 6 ------
drivers/gpu/drm/amd/amdgpu/amdgpu_object.c | 12 ++++++++++++
2 files changed, 12 insertions(+), 6 deletions(-)
diff --git a/drivers/gpu/drm/amd/amdgpu/amdgpu_drv.c
b/drivers/gpu/drm/amd/amdgpu/amdgpu_drv.c
index 81a79760ca61..51525b8774c9 100644
--- a/drivers/gpu/drm/amd/amdgpu/amdgpu_drv.c
+++ b/drivers/gpu/drm/amd/amdgpu/amdgpu_drv.c
@@ -1468,19 +1468,13 @@ static struct drm_driver kms_driver = {
.lastclose = amdgpu_driver_lastclose_kms,
.irq_handler = amdgpu_irq_handler,
.ioctls = amdgpu_ioctls_kms,
- .gem_free_object_unlocked = amdgpu_gem_object_free,
- .gem_open_object = amdgpu_gem_object_open,
- .gem_close_object = amdgpu_gem_object_close,
.dumb_create = amdgpu_mode_dumb_create,
.dumb_map_offset = amdgpu_mode_dumb_mmap,
.fops = &amdgpu_driver_kms_fops,
.prime_handle_to_fd = drm_gem_prime_handle_to_fd,
.prime_fd_to_handle = drm_gem_prime_fd_to_handle,
- .gem_prime_export = amdgpu_gem_prime_export,
.gem_prime_import = amdgpu_gem_prime_import,
- .gem_prime_vmap = amdgpu_gem_prime_vmap,
- .gem_prime_vunmap = amdgpu_gem_prime_vunmap,
.gem_prime_mmap = amdgpu_gem_prime_mmap,
.name = DRIVER_NAME,
diff --git a/drivers/gpu/drm/amd/amdgpu/amdgpu_object.c
b/drivers/gpu/drm/amd/amdgpu/amdgpu_object.c
index 43f4966331dd..ca2b79f94e99 100644
--- a/drivers/gpu/drm/amd/amdgpu/amdgpu_object.c
+++ b/drivers/gpu/drm/amd/amdgpu/amdgpu_object.c
@@ -36,6 +36,7 @@
#include <drm/amdgpu_drm.h>
#include <drm/drm_cache.h>
#include "amdgpu.h"
+#include "amdgpu_dma_buf.h"
#include "amdgpu_trace.h"
#include "amdgpu_amdkfd.h"
@@ -510,6 +511,15 @@ bool amdgpu_bo_support_uswc(u64 bo_flags)
#endif
}
+static const struct drm_gem_object_funcs amdgpu_gem_object_funcs = {
+ .free = amdgpu_gem_object_free,
+ .open = amdgpu_gem_object_open,
+ .close = amdgpu_gem_object_close,
+ .export = amdgpu_gem_prime_export,
+ .vmap = amdgpu_gem_prime_vmap,
+ .vunmap = amdgpu_gem_prime_vunmap,
+};
+
Wrong file, this belongs into amdgpu_gem.c
static int amdgpu_bo_do_create(struct amdgpu_device *adev,
struct amdgpu_bo_param *bp,
struct amdgpu_bo **bo_ptr)
@@ -552,6 +562,8 @@ static int amdgpu_bo_do_create(struct amdgpu_device *adev,
bo = kzalloc(sizeof(struct amdgpu_bo), GFP_KERNEL);
if (bo == NULL)
return -ENOMEM;
+
+ bo->tbo.base.funcs = &amdgpu_gem_object_funcs;
And this should probably go into amdgpu_gem_object_create().
Apart from that looks like a good idea to me.
Christian.
drm_gem_private_object_init(adev->ddev, &bo->tbo.base, size);
INIT_LIST_HEAD(&bo->shadow_list);
bo->vm_bo = NULL;
|