AMD-GFX Archive on lore.kernel.org
 help / color / mirror / Atom feed
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,
	tvrtko.ursulin@linux.intel.com, andi.shyti@intel.com,
	sam@ravnborg.org, miaoqinglang@huawei.com,
	emil.velikov@collabora.com
Cc: linux-samsung-soc@vger.kernel.org, linux-arm-msm@vger.kernel.org,
	intel-gfx@lists.freedesktop.org, etnaviv@lists.freedesktop.org,
	dri-devel@lists.freedesktop.org,
	linux-rockchip@lists.infradead.org,
	linux-mediatek@lists.infradead.org,
	amd-gfx@lists.freedesktop.org, nouveau@lists.freedesktop.org,
	linux-tegra@vger.kernel.org, xen-devel@lists.xenproject.org,
	freedreno@lists.freedesktop.org,
	linux-arm-kernel@lists.infradead.org
Subject: Re: [PATCH v2 01/21] drm/amdgpu: Introduce GEM object functions
Date: Thu, 17 Sep 2020 09:40:28 +0200	[thread overview]
Message-ID: <41eebda8-bf90-7b5c-8af2-e96b8fd0cea2@suse.de> (raw)
In-Reply-To: <835ba167-3576-1af6-5421-552075588796@amd.com>


[-- Attachment #1.1.1: Type: text/plain, Size: 7102 bytes --]

Hi

Am 15.09.20 um 17:05 schrieb Christian König:
> Am 15.09.20 um 16:59 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.
>>
>> v2:
>>     * move object-function instance to amdgpu_gem.c (Christian)
>>     * set callbacks in amdgpu_gem_object_create() (Christian)
>>
>> Signed-off-by: Thomas Zimmermann <tzimmermann@suse.de>
>> ---
>>   drivers/gpu/drm/amd/amdgpu/amdgpu_drv.c    |  6 ------
>>   drivers/gpu/drm/amd/amdgpu/amdgpu_gem.c    | 23 +++++++++++++++++-----
>>   drivers/gpu/drm/amd/amdgpu/amdgpu_gem.h    |  5 -----
>>   drivers/gpu/drm/amd/amdgpu/amdgpu_object.c |  1 +
>>   4 files changed, 19 insertions(+), 16 deletions(-)
>>
>> diff --git a/drivers/gpu/drm/amd/amdgpu/amdgpu_drv.c
>> b/drivers/gpu/drm/amd/amdgpu/amdgpu_drv.c
>> index 6edde2b9e402..840ca8f9c1e1 100644
>> --- a/drivers/gpu/drm/amd/amdgpu/amdgpu_drv.c
>> +++ b/drivers/gpu/drm/amd/amdgpu/amdgpu_drv.c
>> @@ -1505,19 +1505,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_gem.c
>> b/drivers/gpu/drm/amd/amdgpu/amdgpu_gem.c
>> index aa7f230c71bf..aeecd5dc3ce4 100644
>> --- a/drivers/gpu/drm/amd/amdgpu/amdgpu_gem.c
>> +++ b/drivers/gpu/drm/amd/amdgpu/amdgpu_gem.c
>> @@ -36,9 +36,12 @@
>>     #include "amdgpu.h"
>>   #include "amdgpu_display.h"
>> +#include "amdgpu_dma_buf.h"
>>   #include "amdgpu_xgmi.h"
>>   -void amdgpu_gem_object_free(struct drm_gem_object *gobj)
>> +static const struct drm_gem_object_funcs amdgpu_gem_object_funcs;
>> +
>> +static void amdgpu_gem_object_free(struct drm_gem_object *gobj)
>>   {
>>       struct amdgpu_bo *robj = gem_to_amdgpu_bo(gobj);
>>   @@ -87,6 +90,7 @@ int amdgpu_gem_object_create(struct amdgpu_device
>> *adev, unsigned long size,
>>           return r;
>>       }
>>       *obj = &bo->tbo.base;
>> +    (*obj)->funcs = &amdgpu_gem_object_funcs;
>>         return 0;
>>   }
>> @@ -119,8 +123,8 @@ void amdgpu_gem_force_release(struct amdgpu_device
>> *adev)
>>    * Call from drm_gem_handle_create which appear in both new and open
>> ioctl
>>    * case.
>>    */
>> -int amdgpu_gem_object_open(struct drm_gem_object *obj,
>> -               struct drm_file *file_priv)
>> +static int amdgpu_gem_object_open(struct drm_gem_object *obj,
>> +                  struct drm_file *file_priv)
>>   {
>>       struct amdgpu_bo *abo = gem_to_amdgpu_bo(obj);
>>       struct amdgpu_device *adev = amdgpu_ttm_adev(abo->tbo.bdev);
>> @@ -152,8 +156,8 @@ int amdgpu_gem_object_open(struct drm_gem_object
>> *obj,
>>       return 0;
>>   }
>>   -void amdgpu_gem_object_close(struct drm_gem_object *obj,
>> -                 struct drm_file *file_priv)
>> +static void amdgpu_gem_object_close(struct drm_gem_object *obj,
>> +                    struct drm_file *file_priv)
>>   {
>>       struct amdgpu_bo *bo = gem_to_amdgpu_bo(obj);
>>       struct amdgpu_device *adev = amdgpu_ttm_adev(bo->tbo.bdev);
>> @@ -211,6 +215,15 @@ void amdgpu_gem_object_close(struct
>> drm_gem_object *obj,
>>       ttm_eu_backoff_reservation(&ticket, &list);
>>   }
>>   +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,
>> +};
>> +
>>   /*
>>    * GEM ioctls.
>>    */
>> diff --git a/drivers/gpu/drm/amd/amdgpu/amdgpu_gem.h
>> b/drivers/gpu/drm/amd/amdgpu/amdgpu_gem.h
>> index e0f025dd1b14..637bf51dbf06 100644
>> --- a/drivers/gpu/drm/amd/amdgpu/amdgpu_gem.h
>> +++ b/drivers/gpu/drm/amd/amdgpu/amdgpu_gem.h
>> @@ -33,11 +33,6 @@
>>   #define AMDGPU_GEM_DOMAIN_MAX        0x3
>>   #define gem_to_amdgpu_bo(gobj) container_of((gobj), struct
>> amdgpu_bo, tbo.base)
>>   -void amdgpu_gem_object_free(struct drm_gem_object *obj);
>> -int amdgpu_gem_object_open(struct drm_gem_object *obj,
>> -                struct drm_file *file_priv);
>> -void amdgpu_gem_object_close(struct drm_gem_object *obj,
>> -                struct drm_file *file_priv);
>>   unsigned long amdgpu_gem_timeout(uint64_t timeout_ns);
>>     /*
>> diff --git a/drivers/gpu/drm/amd/amdgpu/amdgpu_object.c
>> b/drivers/gpu/drm/amd/amdgpu/amdgpu_object.c
>> index ac043baac05d..c4e82a8fa53f 100644
>> --- a/drivers/gpu/drm/amd/amdgpu/amdgpu_object.c
>> +++ b/drivers/gpu/drm/amd/amdgpu/amdgpu_object.c
>> @@ -561,6 +561,7 @@ static int amdgpu_bo_do_create(struct
>> amdgpu_device *adev,
>>       bo = kzalloc(sizeof(struct amdgpu_bo), GFP_KERNEL);
>>       if (bo == NULL)
>>           return -ENOMEM;
>> +
> 
> The newline is not unrelated.
> 
> Apart from that the patch is Reviewed-by: Christian König
> <christian.koenig@amd.com>.
> 
> But I think we need some smoke testing of it.

I gave it a try on the HW/drivers that I listed in the cover letter.
Appears to be working there. There was a bug reported by CI that will be
fixed in the next iteration.

Best regards
Thomas

> 
> Christian.
> 
>>       drm_gem_private_object_init(adev_to_drm(adev), &bo->tbo.base,
>> size);
>>       INIT_LIST_HEAD(&bo->shadow_list);
>>       bo->vm_bo = NULL;
> 
> _______________________________________________
> dri-devel mailing list
> dri-devel@lists.freedesktop.org
> https://lists.freedesktop.org/mailman/listinfo/dri-devel

-- 
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 #1.2: OpenPGP digital signature --]
[-- Type: application/pgp-signature, Size: 516 bytes --]

[-- Attachment #2: Type: text/plain, Size: 154 bytes --]

_______________________________________________
amd-gfx mailing list
amd-gfx@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/amd-gfx

  reply	other threads:[~2020-09-17  7:40 UTC|newest]

Thread overview: 46+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2020-09-15 14:59 [PATCH v2 00/21] Convert all remaining drivers to GEM object functions Thomas Zimmermann
2020-09-15 14:59 ` [PATCH v2 01/21] drm/amdgpu: Introduce " Thomas Zimmermann
2020-09-15 15:05   ` Christian König
2020-09-17  7:40     ` Thomas Zimmermann [this message]
2020-09-15 14:59 ` [PATCH v2 02/21] drm/armada: " Thomas Zimmermann
2020-09-15 15:07   ` Russell King - ARM Linux admin
2020-09-15 14:59 ` [PATCH v2 03/21] drm/etnaviv: " Thomas Zimmermann
2020-09-16 11:21   ` Daniel Vetter
2020-09-15 14:59 ` [PATCH v2 04/21] drm/exynos: " Thomas Zimmermann
2020-09-16 10:03   ` Daniel Vetter
2020-09-16 10:36     ` Thomas Zimmermann
2020-09-16 11:24       ` Daniel Vetter
2020-09-15 14:59 ` [PATCH v2 05/21] drm/gma500: " Thomas Zimmermann
2020-09-16 11:31   ` Daniel Vetter
2020-09-15 14:59 ` [PATCH v2 06/21] drm/i915: " Thomas Zimmermann
2020-09-15 16:14   ` Tvrtko Ursulin
2020-09-15 14:59 ` [PATCH v2 07/21] drm/mediatek: " Thomas Zimmermann
2020-09-16 11:35   ` Daniel Vetter
2020-09-15 14:59 ` [PATCH v2 08/21] drm/msm: Introduce GEM object funcs Thomas Zimmermann
2020-09-16 12:01   ` Daniel Vetter
2020-09-15 14:59 ` [PATCH v2 09/21] drm/nouveau: Introduce GEM object functions Thomas Zimmermann
2020-09-16 12:04   ` Daniel Vetter
2020-09-15 14:59 ` [PATCH v2 10/21] drm/omapdrm: " Thomas Zimmermann
2020-09-15 14:59 ` [PATCH v2 11/21] drm/pl111: " Thomas Zimmermann
2020-09-15 14:59 ` [PATCH v2 12/21] drm/radeon: " Thomas Zimmermann
2020-09-15 15:08   ` Christian König
2020-09-15 14:59 ` [PATCH v2 13/21] drm/rockchip: Convert to drm_gem_object_funcs Thomas Zimmermann
2020-09-16 12:07   ` Daniel Vetter
2020-09-15 14:59 ` [PATCH v2 14/21] drm/tegra: Introduce GEM object functions Thomas Zimmermann
2020-09-17 10:56   ` Thierry Reding
2020-09-15 14:59 ` [PATCH v2 15/21] drm/vc4: " Thomas Zimmermann
2020-09-15 14:59 ` [PATCH v2 16/21] drm/vgem: " Thomas Zimmermann
2020-09-17 14:01   ` Melissa Wen
2020-09-15 14:59 ` [PATCH v2 17/21] drm/virtgpu: Set PRIME export function in struct drm_gem_object_funcs Thomas Zimmermann
2020-09-16 12:09   ` Daniel Vetter
2020-09-15 14:59 ` [PATCH v2 18/21] drm/vkms: Introduce GEM object functions Thomas Zimmermann
2020-09-17 11:31   ` Melissa Wen
2020-09-15 14:59 ` [PATCH v2 19/21] drm/xen: " Thomas Zimmermann
2020-09-15 14:59 ` [PATCH v2 20/21] drm/xlnx: Initialize DRM driver instance with CMA helper macro Thomas Zimmermann
2020-09-15 15:53   ` Laurent Pinchart
2020-09-15 18:39     ` Hyun Kwon
2020-09-15 14:59 ` [PATCH v2 21/21] drm: Remove obsolete GEM and PRIME callbacks from struct drm_driver Thomas Zimmermann
2020-09-16 12:12   ` Daniel Vetter
2020-09-16 17:55   ` Thomas Zimmermann
2020-09-15 15:25 ` [PATCH v2 00/21] Convert all remaining drivers to GEM object functions Christian König
2020-09-17  7:05   ` 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=41eebda8-bf90-7b5c-8af2-e96b8fd0cea2@suse.de \
    --to=tzimmermann@suse.de \
    --cc=Felix.Kuehling@amd.com \
    --cc=Hawking.Zhang@amd.com \
    --cc=aaron.liu@amd.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