intel-gfx.lists.freedesktop.org archive mirror
 help / color / mirror / Atom feed
From: Daniel Vetter <daniel@ffwll.ch>
To: Thomas Zimmermann <tzimmermann@suse.de>
Cc: hamohammed.sa@gmail.com, airlied@linux.ie,
	nouveau@lists.freedesktop.org, dri-devel@lists.freedesktop.org,
	linux@armlinux.org.uk, matthias.bgg@gmail.com, krzk@kernel.org,
	sam@ravnborg.org, emil.velikov@collabora.com,
	linux-samsung-soc@vger.kernel.org, jy0922.shim@samsung.com,
	oleksandr_andrushchenko@epam.com, michal.simek@xilinx.com,
	miaoqinglang@huawei.com, jonathanh@nvidia.com,
	linux-rockchip@lists.infradead.org, tomi.valkeinen@ti.com,
	bskeggs@redhat.com, xen-devel@lists.xenproject.org,
	marek.olsak@amd.com, matthew.auld@intel.com,
	chunkuang.hu@kernel.org, linux-arm-msm@vger.kernel.org,
	intel-gfx@lists.freedesktop.org, tianci.yin@amd.com,
	etnaviv@lists.freedesktop.org,
	linux-mediatek@lists.infradead.org, linux-tegra@vger.kernel.org,
	evan.quan@amd.com, linux-arm-kernel@lists.infradead.org,
	amd-gfx@lists.freedesktop.org, chris@chris-wilson.co.uk,
	rodrigosiqueiramelo@gmail.com, hyun.kwon@xilinx.com,
	aaron.liu@amd.com, Felix.Kuehling@amd.com, xinhui.pan@amd.com,
	sw0312.kim@samsung.com, hjc@rock-chips.com,
	kyungmin.park@samsung.com, nirmoy.das@amd.com, kgene@kernel.org,
	alexander.deucher@amd.com, Hawking.Zhang@amd.com,
	freedreno@lists.freedesktop.org, christian.koenig@amd.com,
	laurent.pinchart@ideasonboard.com
Subject: Re: [Intel-gfx] [PATCH v2 04/21] drm/exynos: Introduce GEM object functions
Date: Wed, 16 Sep 2020 13:24:24 +0200	[thread overview]
Message-ID: <20200916112424.GH438822@phenom.ffwll.local> (raw)
In-Reply-To: <fb1f5992-1642-5751-5672-486b89442e1c@suse.de>

On Wed, Sep 16, 2020 at 12:36:28PM +0200, Thomas Zimmermann wrote:
> Hi
> 
> Am 16.09.20 um 12:03 schrieb Daniel Vetter:
> > On Tue, Sep 15, 2020 at 04:59:41PM +0200, Thomas Zimmermann wrote:
> >> GEM object functions deprecate several similar callback interfaces in
> >> struct drm_driver. This patch replaces the per-driver callbacks with
> >> per-instance callbacks in exynos. The only exception is gem_prime_mmap,
> >> which is non-trivial to convert.
> >>
> >> Signed-off-by: Thomas Zimmermann <tzimmermann@suse.de>
> >> ---
> >>  drivers/gpu/drm/exynos/exynos_drm_drv.c | 10 ----------
> >>  drivers/gpu/drm/exynos/exynos_drm_gem.c | 15 +++++++++++++++
> >>  2 files changed, 15 insertions(+), 10 deletions(-)
> >>
> >> diff --git a/drivers/gpu/drm/exynos/exynos_drm_drv.c b/drivers/gpu/drm/exynos/exynos_drm_drv.c
> >> index dbd80f1e4c78..fe46680ca208 100644
> >> --- a/drivers/gpu/drm/exynos/exynos_drm_drv.c
> >> +++ b/drivers/gpu/drm/exynos/exynos_drm_drv.c
> >> @@ -75,11 +75,6 @@ static void exynos_drm_postclose(struct drm_device *dev, struct drm_file *file)
> >>  	file->driver_priv = NULL;
> >>  }
> >>  
> >> -static const struct vm_operations_struct exynos_drm_gem_vm_ops = {
> >> -	.open = drm_gem_vm_open,
> >> -	.close = drm_gem_vm_close,
> >> -};
> >> -
> >>  static const struct drm_ioctl_desc exynos_ioctls[] = {
> >>  	DRM_IOCTL_DEF_DRV(EXYNOS_GEM_CREATE, exynos_drm_gem_create_ioctl,
> >>  			DRM_RENDER_ALLOW),
> >> @@ -124,16 +119,11 @@ static struct drm_driver exynos_drm_driver = {
> >>  	.open			= exynos_drm_open,
> >>  	.lastclose		= drm_fb_helper_lastclose,
> >>  	.postclose		= exynos_drm_postclose,
> >> -	.gem_free_object_unlocked = exynos_drm_gem_free_object,
> >> -	.gem_vm_ops		= &exynos_drm_gem_vm_ops,
> >>  	.dumb_create		= exynos_drm_gem_dumb_create,
> >>  	.prime_handle_to_fd	= drm_gem_prime_handle_to_fd,
> >>  	.prime_fd_to_handle	= drm_gem_prime_fd_to_handle,
> >>  	.gem_prime_import	= exynos_drm_gem_prime_import,
> >> -	.gem_prime_get_sg_table	= exynos_drm_gem_prime_get_sg_table,
> >>  	.gem_prime_import_sg_table	= exynos_drm_gem_prime_import_sg_table,
> >> -	.gem_prime_vmap		= exynos_drm_gem_prime_vmap,
> >> -	.gem_prime_vunmap	= exynos_drm_gem_prime_vunmap,
> >>  	.gem_prime_mmap		= exynos_drm_gem_prime_mmap,
> >>  	.ioctls			= exynos_ioctls,
> >>  	.num_ioctls		= ARRAY_SIZE(exynos_ioctls),
> >> diff --git a/drivers/gpu/drm/exynos/exynos_drm_gem.c b/drivers/gpu/drm/exynos/exynos_drm_gem.c
> >> index efa476858db5..69a5cf28b4ae 100644
> >> --- a/drivers/gpu/drm/exynos/exynos_drm_gem.c
> >> +++ b/drivers/gpu/drm/exynos/exynos_drm_gem.c
> >> @@ -129,6 +129,19 @@ void exynos_drm_gem_destroy(struct exynos_drm_gem *exynos_gem)
> >>  	kfree(exynos_gem);
> >>  }
> >>  
> >> +static const struct vm_operations_struct exynos_drm_gem_vm_ops = {
> >> +	.open = drm_gem_vm_open,
> >> +	.close = drm_gem_vm_close,
> >> +};
> > 
> > Hm moving the drm_gem_cma_vm_ops into drm_gem.h or so and maybe calling
> > them drm_gem_simple_ops or so would remove a pile of these. But perhaps a
> > quick follow up series.
> 
> Good idea. Several interfaces use the term 'default' in their name, so
> something like drm_gem_default_vm_ops seems appropriate.

Default sounds like a fine naming choice too.

> BTW is there a reason why we have file operations like
> DEFINE_DRM_GEM_CMA_FOPS() in each module? It seems like this could also
> be provided by the rsp memory-manager library.

It's for the module reference counting of the underlying file. So
file_operations need this.
-Daniel


> 
> Best regards
> Thomas
> 
> > 
> > Reviewed-by: Daniel Vetter <daniel.vetter@ffwll.ch>
> > 
> >> +
> >> +static const struct drm_gem_object_funcs exynos_drm_gem_object_funcs = {
> >> +	.free = exynos_drm_gem_free_object,
> >> +	.get_sg_table = exynos_drm_gem_prime_get_sg_table,
> >> +	.vmap = exynos_drm_gem_prime_vmap,
> >> +	.vunmap	= exynos_drm_gem_prime_vunmap,
> >> +	.vm_ops = &exynos_drm_gem_vm_ops,
> >> +};
> >> +
> >>  static struct exynos_drm_gem *exynos_drm_gem_init(struct drm_device *dev,
> >>  						  unsigned long size)
> >>  {
> >> @@ -143,6 +156,8 @@ static struct exynos_drm_gem *exynos_drm_gem_init(struct drm_device *dev,
> >>  	exynos_gem->size = size;
> >>  	obj = &exynos_gem->base;
> >>  
> >> +	obj->funcs = &exynos_drm_gem_object_funcs;
> >> +
> >>  	ret = drm_gem_object_init(dev, obj, size);
> >>  	if (ret < 0) {
> >>  		DRM_DEV_ERROR(dev->dev, "failed to initialize gem object\n");
> >> -- 
> >> 2.28.0
> >>
> > 
> 
> -- 
> 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
> 




-- 
Daniel Vetter
Software Engineer, Intel Corporation
http://blog.ffwll.ch
_______________________________________________
Intel-gfx mailing list
Intel-gfx@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/intel-gfx

  reply	other threads:[~2020-09-16 11:24 UTC|newest]

Thread overview: 49+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2020-09-15 14:59 [Intel-gfx] [PATCH v2 00/21] Convert all remaining drivers to GEM object functions Thomas Zimmermann
2020-09-15 14:59 ` [Intel-gfx] [PATCH v2 01/21] drm/amdgpu: Introduce " Thomas Zimmermann
2020-09-15 15:05   ` Christian König
2020-09-17  7:40     ` Thomas Zimmermann
2020-09-15 14:59 ` [Intel-gfx] [PATCH v2 02/21] drm/armada: " Thomas Zimmermann
2020-09-15 15:07   ` Russell King - ARM Linux admin
2020-09-15 14:59 ` [Intel-gfx] [PATCH v2 03/21] drm/etnaviv: " Thomas Zimmermann
2020-09-16 11:21   ` Daniel Vetter
2020-09-15 14:59 ` [Intel-gfx] [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 [this message]
2020-09-15 14:59 ` [Intel-gfx] [PATCH v2 05/21] drm/gma500: " Thomas Zimmermann
2020-09-16 11:31   ` Daniel Vetter
2020-09-15 14:59 ` [Intel-gfx] [PATCH v2 06/21] drm/i915: " Thomas Zimmermann
2020-09-15 16:14   ` Tvrtko Ursulin
2020-09-15 14:59 ` [Intel-gfx] [PATCH v2 07/21] drm/mediatek: " Thomas Zimmermann
2020-09-16 11:35   ` Daniel Vetter
2020-09-15 14:59 ` [Intel-gfx] [PATCH v2 08/21] drm/msm: Introduce GEM object funcs Thomas Zimmermann
2020-09-16 12:01   ` Daniel Vetter
2020-09-15 14:59 ` [Intel-gfx] [PATCH v2 09/21] drm/nouveau: Introduce GEM object functions Thomas Zimmermann
2020-09-16 12:04   ` Daniel Vetter
2020-09-15 14:59 ` [Intel-gfx] [PATCH v2 10/21] drm/omapdrm: " Thomas Zimmermann
2020-09-15 14:59 ` [Intel-gfx] [PATCH v2 11/21] drm/pl111: " Thomas Zimmermann
2020-09-15 14:59 ` [Intel-gfx] [PATCH v2 12/21] drm/radeon: " Thomas Zimmermann
2020-09-15 15:08   ` Christian König
2020-09-15 14:59 ` [Intel-gfx] [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 ` [Intel-gfx] [PATCH v2 14/21] drm/tegra: Introduce GEM object functions Thomas Zimmermann
2020-09-17 10:56   ` Thierry Reding
2020-09-15 14:59 ` [Intel-gfx] [PATCH v2 15/21] drm/vc4: " Thomas Zimmermann
2020-09-15 14:59 ` [Intel-gfx] [PATCH v2 16/21] drm/vgem: " Thomas Zimmermann
2020-09-17 14:01   ` Melissa Wen
2020-09-15 14:59 ` [Intel-gfx] [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 ` [Intel-gfx] [PATCH v2 18/21] drm/vkms: Introduce GEM object functions Thomas Zimmermann
2020-09-17 11:31   ` Melissa Wen
2020-09-15 14:59 ` [Intel-gfx] [PATCH v2 19/21] drm/xen: " Thomas Zimmermann
2020-09-15 14:59 ` [Intel-gfx] [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 ` [Intel-gfx] [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 ` [Intel-gfx] [PATCH v2 00/21] Convert all remaining drivers to GEM object functions Christian König
2020-09-17  7:05   ` Thomas Zimmermann
2020-09-15 16:22 ` [Intel-gfx] ✗ Fi.CI.CHECKPATCH: warning for Convert all remaining drivers to GEM object functions (rev2) Patchwork
2020-09-15 16:24 ` [Intel-gfx] ✗ Fi.CI.SPARSE: " Patchwork
2020-09-15 16:39 ` [Intel-gfx] ✗ Fi.CI.BAT: failure " Patchwork

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=20200916112424.GH438822@phenom.ffwll.local \
    --to=daniel@ffwll.ch \
    --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=bskeggs@redhat.com \
    --cc=chris@chris-wilson.co.uk \
    --cc=christian.koenig@amd.com \
    --cc=chunkuang.hu@kernel.org \
    --cc=dri-devel@lists.freedesktop.org \
    --cc=emil.velikov@collabora.com \
    --cc=etnaviv@lists.freedesktop.org \
    --cc=evan.quan@amd.com \
    --cc=freedreno@lists.freedesktop.org \
    --cc=hamohammed.sa@gmail.com \
    --cc=hjc@rock-chips.com \
    --cc=hyun.kwon@xilinx.com \
    --cc=intel-gfx@lists.freedesktop.org \
    --cc=jonathanh@nvidia.com \
    --cc=jy0922.shim@samsung.com \
    --cc=kgene@kernel.org \
    --cc=krzk@kernel.org \
    --cc=kyungmin.park@samsung.com \
    --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=marek.olsak@amd.com \
    --cc=matthew.auld@intel.com \
    --cc=matthias.bgg@gmail.com \
    --cc=miaoqinglang@huawei.com \
    --cc=michal.simek@xilinx.com \
    --cc=nirmoy.das@amd.com \
    --cc=nouveau@lists.freedesktop.org \
    --cc=oleksandr_andrushchenko@epam.com \
    --cc=rodrigosiqueiramelo@gmail.com \
    --cc=sam@ravnborg.org \
    --cc=sw0312.kim@samsung.com \
    --cc=tianci.yin@amd.com \
    --cc=tomi.valkeinen@ti.com \
    --cc=tzimmermann@suse.de \
    --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;
as well as URLs for NNTP newsgroup(s).