From: Thomas Zimmermann <tzimmermann@suse.de>
To: alexander.deucher@amd.com, christian.koenig@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, olek
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,
Thomas Zimmermann <tzimmermann@suse.de>
Subject: [PATCH 03/20] drm/etnaviv: Introduce GEM object functions
Date: Thu, 13 Aug 2020 10:36:27 +0200 [thread overview]
Message-ID: <20200813083644.31711-4-tzimmermann@suse.de> (raw)
In-Reply-To: <20200813083644.31711-1-tzimmermann@suse.de>
GEM object functions deprecate several similar callback interfaces in
struct drm_driver. This patch replaces the per-driver callbacks with
per-instance callbacks in etnaviv. The only exception is gem_prime_mmap,
which is non-trivial to convert.
Signed-off-by: Thomas Zimmermann <tzimmermann@suse.de>
---
drivers/gpu/drm/etnaviv/etnaviv_drv.c | 13 -------------
drivers/gpu/drm/etnaviv/etnaviv_drv.h | 1 -
drivers/gpu/drm/etnaviv/etnaviv_gem.c | 19 ++++++++++++++++++-
3 files changed, 18 insertions(+), 15 deletions(-)
diff --git a/drivers/gpu/drm/etnaviv/etnaviv_drv.c b/drivers/gpu/drm/etnaviv/etnaviv_drv.c
index a9a3afaef9a1..aa270b79e585 100644
--- a/drivers/gpu/drm/etnaviv/etnaviv_drv.c
+++ b/drivers/gpu/drm/etnaviv/etnaviv_drv.c
@@ -468,12 +468,6 @@ static const struct drm_ioctl_desc etnaviv_ioctls[] = {
ETNA_IOCTL(PM_QUERY_SIG, pm_query_sig, DRM_RENDER_ALLOW),
};
-static const struct vm_operations_struct vm_ops = {
- .fault = etnaviv_gem_fault,
- .open = drm_gem_vm_open,
- .close = drm_gem_vm_close,
-};
-
static const struct file_operations fops = {
.owner = THIS_MODULE,
.open = drm_open,
@@ -490,16 +484,9 @@ static struct drm_driver etnaviv_drm_driver = {
.driver_features = DRIVER_GEM | DRIVER_RENDER,
.open = etnaviv_open,
.postclose = etnaviv_postclose,
- .gem_free_object_unlocked = etnaviv_gem_free_object,
- .gem_vm_ops = &vm_ops,
.prime_handle_to_fd = drm_gem_prime_handle_to_fd,
.prime_fd_to_handle = drm_gem_prime_fd_to_handle,
- .gem_prime_pin = etnaviv_gem_prime_pin,
- .gem_prime_unpin = etnaviv_gem_prime_unpin,
- .gem_prime_get_sg_table = etnaviv_gem_prime_get_sg_table,
.gem_prime_import_sg_table = etnaviv_gem_prime_import_sg_table,
- .gem_prime_vmap = etnaviv_gem_prime_vmap,
- .gem_prime_vunmap = etnaviv_gem_prime_vunmap,
.gem_prime_mmap = etnaviv_gem_prime_mmap,
#ifdef CONFIG_DEBUG_FS
.debugfs_init = etnaviv_debugfs_init,
diff --git a/drivers/gpu/drm/etnaviv/etnaviv_drv.h b/drivers/gpu/drm/etnaviv/etnaviv_drv.h
index 4d8dc9236e5f..914f0867ff71 100644
--- a/drivers/gpu/drm/etnaviv/etnaviv_drv.h
+++ b/drivers/gpu/drm/etnaviv/etnaviv_drv.h
@@ -49,7 +49,6 @@ int etnaviv_ioctl_gem_submit(struct drm_device *dev, void *data,
struct drm_file *file);
int etnaviv_gem_mmap(struct file *filp, struct vm_area_struct *vma);
-vm_fault_t etnaviv_gem_fault(struct vm_fault *vmf);
int etnaviv_gem_mmap_offset(struct drm_gem_object *obj, u64 *offset);
struct sg_table *etnaviv_gem_prime_get_sg_table(struct drm_gem_object *obj);
void *etnaviv_gem_prime_vmap(struct drm_gem_object *obj);
diff --git a/drivers/gpu/drm/etnaviv/etnaviv_gem.c b/drivers/gpu/drm/etnaviv/etnaviv_gem.c
index f06e19e7be04..66de9f299c76 100644
--- a/drivers/gpu/drm/etnaviv/etnaviv_gem.c
+++ b/drivers/gpu/drm/etnaviv/etnaviv_gem.c
@@ -170,7 +170,7 @@ int etnaviv_gem_mmap(struct file *filp, struct vm_area_struct *vma)
return obj->ops->mmap(obj, vma);
}
-vm_fault_t etnaviv_gem_fault(struct vm_fault *vmf)
+static vm_fault_t etnaviv_gem_fault(struct vm_fault *vmf)
{
struct vm_area_struct *vma = vmf->vma;
struct drm_gem_object *obj = vma->vm_private_data;
@@ -560,6 +560,22 @@ void etnaviv_gem_obj_add(struct drm_device *dev, struct drm_gem_object *obj)
mutex_unlock(&priv->gem_lock);
}
+static const struct vm_operations_struct vm_ops = {
+ .fault = etnaviv_gem_fault,
+ .open = drm_gem_vm_open,
+ .close = drm_gem_vm_close,
+};
+
+static const struct drm_gem_object_funcs etnaviv_gem_object_funcs = {
+ .free = etnaviv_gem_free_object,
+ .pin = etnaviv_gem_prime_pin,
+ .unpin = etnaviv_gem_prime_unpin,
+ .get_sg_table = etnaviv_gem_prime_get_sg_table,
+ .vmap = etnaviv_gem_prime_vmap,
+ .vunmap = etnaviv_gem_prime_vunmap,
+ .vm_ops = &vm_ops,
+};
+
static int etnaviv_gem_new_impl(struct drm_device *dev, u32 size, u32 flags,
const struct etnaviv_gem_ops *ops, struct drm_gem_object **obj)
{
@@ -594,6 +610,7 @@ static int etnaviv_gem_new_impl(struct drm_device *dev, u32 size, u32 flags,
INIT_LIST_HEAD(&etnaviv_obj->vram_list);
*obj = &etnaviv_obj->base;
+ (*obj)->funcs = &etnaviv_gem_object_funcs;
return 0;
}
--
2.28.0
next prev parent reply other threads:[~2020-08-13 8:36 UTC|newest]
Thread overview: 37+ 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 ` Thomas Zimmermann [this message]
2020-08-13 8:36 ` [PATCH 06/20] drm/i915: Introduce " Thomas Zimmermann
[not found] ` <20200813083644.31711-7-tzimmermann-l3A5Bk7waGM@public.gmane.org>
2020-08-13 9:08 ` Jani Nikula
[not found] ` <877du2j4lf.fsf-ral2JQCrhuEAvxtiuMwx3w@public.gmane.org>
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 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 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
2020-08-13 11:19 ` Oleksandr Andrushchenko
[not found] ` <1fe5f918-2445-d2e6-a501-881e70929404-uRwfk40T5oI@public.gmane.org>
2020-09-15 8:56 ` Thomas Zimmermann
[not found] ` <20200813083644.31711-1-tzimmermann-l3A5Bk7waGM@public.gmane.org>
2020-08-13 8:36 ` [PATCH 01/20] drm/amdgpu: " Thomas Zimmermann
[not found] ` <20200813083644.31711-2-tzimmermann-l3A5Bk7waGM@public.gmane.org>
2020-08-13 10:22 ` Christian König
[not found] ` <5c1b3cab-1898-46df-2c5c-23ab6cbfbb7a-5C7GfCeVMHo@public.gmane.org>
2020-09-14 15:05 ` Thomas Zimmermann
[not found] ` <c445493b-9914-63f2-1cf2-c3c1de14e3e5-l3A5Bk7waGM@public.gmane.org>
2020-09-14 17:51 ` Christian König
2020-08-13 8:36 ` [PATCH 02/20] drm/armada: " 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 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 12/20] drm/radeon: " Thomas Zimmermann
[not found] ` <20200813083644.31711-13-tzimmermann-l3A5Bk7waGM@public.gmane.org>
2020-08-13 10:24 ` Christian König
[not found] ` <fb070238-b6ca-8e31-e559-51eda489915e-5C7GfCeVMHo@public.gmane.org>
2020-08-13 10:41 ` Thomas Zimmermann
[not found] ` <5372b2ef-b7cf-f4e9-9199-6dee5bf6696f-l3A5Bk7waGM@public.gmane.org>
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 19/20] drm/xlnx: Initialize DRM driver instance with CMA helper macro Thomas Zimmermann
[not found] ` <20200813083644.31711-20-tzimmermann-l3A5Bk7waGM@public.gmane.org>
2020-08-13 13:36 ` Laurent Pinchart
[not found] ` <20200813133605.GJ6057-N3hz7ZxfLydczECFQUw77jytWr6r+dGw0E9HWUfgJXw@public.gmane.org>
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
[not found] ` <20200813083644.31711-21-tzimmermann-l3A5Bk7waGM@public.gmane.org>
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=20200813083644.31711-4-tzimmermann@suse.de \
--to=tzimmermann@suse.de \
--cc=airlied@linux.ie \
--cc=alexander.deucher@amd.com \
--cc=amd-gfx@lists.freedesktop.org \
--cc=bskeggs@redhat.com \
--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=eric@anholt.net \
--cc=etnaviv@lists.freedesktop.org \
--cc=freedreno@lists.freedesktop.org \
--cc=hamohammed.sa@gmail.com \
--cc=heiko@sntech.de \
--cc=hjc@rock-chips.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=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=matthias.bgg@gmail.com \
--cc=mripard@kernel.org \
--cc=nouveau@lists.freedesktop.org \
--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=sean@poorly.run \
--cc=sw0312.kim@samsung.com \
--cc=thierry.reding@gmail.com \
--cc=tomi.valkeinen@ti.com \
--cc=xen-devel@lists.xenproject.org \
/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