From: Thomas Zimmermann <tzimmermann@suse.de>
To: "Christian König" <christian.koenig@amd.com>,
alexander.deucher@amd.com, airlied@linux.ie, daniel@ffwll.ch,
linux@armlinux.org.uk, maarten.lankhorst@linux.intel.com,
mripard@kernel.org, l.stach@pengutronix.de,
christian.gmeiner@gmail.com, inki.dae@samsung.com,
jy0922.shim@samsung.com, sw0312.kim@samsung.com,
kyungmin.park@samsung.com, kgene@kernel.org, krzk@kernel.org,
patrik.r.jakobsson@gmail.com, jani.nikula@linux.intel.com,
joonas.lahtinen@linux.intel.com, rodrigo.vivi@intel.com,
chunkuang.hu@kernel.org, p.zabel@pengutronix.de,
matthias.bgg@gmail.com, robdclark@gmail.com, sean@poorly.run,
bskeggs@redhat.com, tomi.valkeinen@ti.com, eric@anholt.net,
hjc@rock-chips.com, heiko@sntech.de, thierry.reding@gmail.com,
jonathanh@nvidia.com, rodrigosiqueiramelo@gmail.com,
hamohammed.sa@gmail.com, oleksandr_andrushchenko@epam.com,
hyun.kwon@xilinx.com, laurent.pinchart@ideasonboard.com,
michal.simek@xilinx.com, sumit.semwal@linaro.org,
evan.quan@amd.com, Hawking.Zhang@amd.com, tianci.yin@amd.com,
marek.olsak@amd.com, hdegoede@redhat.com,
andrey.grodzovsky@amd.com, Felix.Kuehling@amd.com,
xinhui.pan@amd.com, aaron.liu@amd.com, nirmoy.das@amd.com,
chris@chris-wilson.co.uk, matthew.auld@intel.com,
abdiel.janulgue@linux.intel.com, tvrtko.ursulin@linux.intel.com,
andi.shyti@intel.com, sam@ravnborg.org, miaoqinglang@huawei.com,
emil.velikov@collabora.com
Cc: amd-gfx@lists.freedesktop.org, dri-devel@lists.freedesktop.org,
etnaviv@lists.freedesktop.org,
linux-arm-kernel@lists.infradead.org,
linux-samsung-soc@vger.kernel.org,
intel-gfx@lists.freedesktop.org,
linux-mediatek@lists.infradead.org,
linux-arm-msm@vger.kernel.org, freedreno@lists.freedesktop.org,
nouveau@lists.freedesktop.org,
linux-rockchip@lists.infradead.org, linux-tegra@vger.kernel.org,
xen-devel@lists.xenproject.org
Subject: Re: [PATCH 01/20] drm/amdgpu: Introduce GEM object functions
Date: Mon, 14 Sep 2020 17:05:49 +0200 [thread overview]
Message-ID: <c445493b-9914-63f2-1cf2-c3c1de14e3e5@suse.de> (raw)
In-Reply-To: <5c1b3cab-1898-46df-2c5c-23ab6cbfbb7a@amd.com>
[-- Attachment #1.1: Type: text/plain, Size: 4089 bytes --]
Hi
Am 13.08.20 um 12:22 schrieb Christian König:
> 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@suse.de>
>> ---
>> 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().
I'm trying to understand what amdgpu does. What about all the places
where amdgpu calls amdgpu_bo_create() internally? Wouldn't these miss
the free callback for the GEM object?
Best regards
Thomas
>
> 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;
>
--
Thomas Zimmermann
Graphics Driver Developer
SUSE Software Solutions Germany GmbH
Maxfeldstr. 5, 90409 Nürnberg, Germany
(HRB 36809, AG Nürnberg)
Geschäftsführer: Felix Imendörffer
[-- Attachment #2: OpenPGP digital signature --]
[-- Type: application/pgp-signature, Size: 516 bytes --]
next prev parent reply other threads:[~2020-09-14 15:06 UTC|newest]
Thread overview: 35+ messages / expand[flat|nested] mbox.gz Atom feed top
2020-08-13 8:36 [PATCH 00/20] Convert all remaining drivers to GEM object functions Thomas Zimmermann
2020-08-13 8:36 ` [PATCH 01/20] drm/amdgpu: Introduce " Thomas Zimmermann
2020-08-13 10:22 ` Christian König
2020-09-14 15:05 ` Thomas Zimmermann [this message]
2020-08-13 8:36 ` [PATCH 02/20] drm/armada: " Thomas Zimmermann
2020-08-13 8:36 ` [PATCH 03/20] drm/etnaviv: " Thomas Zimmermann
2020-08-13 8:36 ` [PATCH 04/20] drm/exynos: " Thomas Zimmermann
2020-08-13 8:36 ` [PATCH 05/20] drm/gma500: " Thomas Zimmermann
2020-08-13 8:36 ` [PATCH 06/20] drm/i915: " Thomas Zimmermann
2020-08-13 9:08 ` Jani Nikula
2020-08-13 9:13 ` Thomas Zimmermann
2020-08-13 8:36 ` [PATCH 07/20] drm/mediatek: " Thomas Zimmermann
2020-08-13 8:36 ` [PATCH 08/20] drm/msm: Introduce GEM object funcs Thomas Zimmermann
2020-08-13 8:36 ` [PATCH 09/20] drm/nouveau: Introduce GEM object functions Thomas Zimmermann
2020-08-13 8:36 ` [PATCH 10/20] drm/omapdrm: " Thomas Zimmermann
2020-08-13 13:38 ` Laurent Pinchart
2020-08-19 10:43 ` Tomi Valkeinen
2020-08-13 8:36 ` [PATCH 11/20] drm/pl111: " Thomas Zimmermann
2020-08-13 8:36 ` [PATCH 12/20] drm/radeon: " Thomas Zimmermann
2020-08-13 10:24 ` Christian König
2020-08-13 10:41 ` Thomas Zimmermann
2020-08-13 10:47 ` Christian König
2020-08-13 8:36 ` [PATCH 13/20] drm/rockchip: Convert to drm_gem_object_funcs Thomas Zimmermann
2020-08-13 8:36 ` [PATCH 14/20] drm/tegra: Introduce GEM object functions Thomas Zimmermann
2020-08-13 8:36 ` [PATCH 15/20] drm/vc4: " Thomas Zimmermann
2020-08-13 8:36 ` [PATCH 16/20] drm/vgem: " Thomas Zimmermann
2020-08-13 8:36 ` [PATCH 17/20] drm/vkms: " Thomas Zimmermann
2020-08-13 8:36 ` [PATCH 18/20] drm/xen: " Thomas Zimmermann
[not found] ` <1fe5f918-2445-d2e6-a501-881e70929404@epam.com>
2020-09-15 8:56 ` Thomas Zimmermann
2020-08-13 8:36 ` [PATCH 19/20] drm/xlnx: Initialize DRM driver instance with CMA helper macro Thomas Zimmermann
2020-08-13 13:36 ` Laurent Pinchart
2020-08-13 13:57 ` Thomas Zimmermann
2020-08-13 8:36 ` [PATCH 20/20] drm: Remove obsolete GEM and PRIME callbacks from struct drm_driver Thomas Zimmermann
2020-08-13 10:16 ` Sam Ravnborg
2020-08-13 10:33 ` Thomas Zimmermann
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=c445493b-9914-63f2-1cf2-c3c1de14e3e5@suse.de \
--to=tzimmermann@suse.de \
--cc=Felix.Kuehling@amd.com \
--cc=Hawking.Zhang@amd.com \
--cc=aaron.liu@amd.com \
--cc=abdiel.janulgue@linux.intel.com \
--cc=airlied@linux.ie \
--cc=alexander.deucher@amd.com \
--cc=amd-gfx@lists.freedesktop.org \
--cc=andi.shyti@intel.com \
--cc=andrey.grodzovsky@amd.com \
--cc=bskeggs@redhat.com \
--cc=chris@chris-wilson.co.uk \
--cc=christian.gmeiner@gmail.com \
--cc=christian.koenig@amd.com \
--cc=chunkuang.hu@kernel.org \
--cc=daniel@ffwll.ch \
--cc=dri-devel@lists.freedesktop.org \
--cc=emil.velikov@collabora.com \
--cc=eric@anholt.net \
--cc=etnaviv@lists.freedesktop.org \
--cc=evan.quan@amd.com \
--cc=freedreno@lists.freedesktop.org \
--cc=hamohammed.sa@gmail.com \
--cc=hdegoede@redhat.com \
--cc=heiko@sntech.de \
--cc=hjc@rock-chips.com \
--cc=hyun.kwon@xilinx.com \
--cc=inki.dae@samsung.com \
--cc=intel-gfx@lists.freedesktop.org \
--cc=jani.nikula@linux.intel.com \
--cc=jonathanh@nvidia.com \
--cc=joonas.lahtinen@linux.intel.com \
--cc=jy0922.shim@samsung.com \
--cc=kgene@kernel.org \
--cc=krzk@kernel.org \
--cc=kyungmin.park@samsung.com \
--cc=l.stach@pengutronix.de \
--cc=laurent.pinchart@ideasonboard.com \
--cc=linux-arm-kernel@lists.infradead.org \
--cc=linux-arm-msm@vger.kernel.org \
--cc=linux-mediatek@lists.infradead.org \
--cc=linux-rockchip@lists.infradead.org \
--cc=linux-samsung-soc@vger.kernel.org \
--cc=linux-tegra@vger.kernel.org \
--cc=linux@armlinux.org.uk \
--cc=maarten.lankhorst@linux.intel.com \
--cc=marek.olsak@amd.com \
--cc=matthew.auld@intel.com \
--cc=matthias.bgg@gmail.com \
--cc=miaoqinglang@huawei.com \
--cc=michal.simek@xilinx.com \
--cc=mripard@kernel.org \
--cc=nirmoy.das@amd.com \
--cc=nouveau@lists.freedesktop.org \
--cc=oleksandr_andrushchenko@epam.com \
--cc=p.zabel@pengutronix.de \
--cc=patrik.r.jakobsson@gmail.com \
--cc=robdclark@gmail.com \
--cc=rodrigo.vivi@intel.com \
--cc=rodrigosiqueiramelo@gmail.com \
--cc=sam@ravnborg.org \
--cc=sean@poorly.run \
--cc=sumit.semwal@linaro.org \
--cc=sw0312.kim@samsung.com \
--cc=thierry.reding@gmail.com \
--cc=tianci.yin@amd.com \
--cc=tomi.valkeinen@ti.com \
--cc=tvrtko.ursulin@linux.intel.com \
--cc=xen-devel@lists.xenproject.org \
--cc=xinhui.pan@amd.com \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox