AMD-GFX Archive on lore.kernel.org
 help / color / Atom feed
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,
	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, laurentiu.palcu@oss.nxp.com,
	shawnguo@kernel.org, s.hauer@pengutronix.de,
	kernel@pengutronix.de, festevam@gmail.com, linux-imx@nxp.com
Cc: linux-samsung-soc@vger.kernel.org,
	Tvrtko Ursulin <tvrtko.ursulin@intel.com>,
	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,
	Thomas Zimmermann <tzimmermann@suse.de>,
	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: [PATCH v3 06/22] drm/i915: Introduce GEM object functions
Date: Wed, 23 Sep 2020 12:21:43 +0200
Message-ID: <20200923102159.24084-7-tzimmermann@suse.de> (raw)
In-Reply-To: <20200923102159.24084-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 i915.

v2:
	* move object-function instance to i915_gem_object.c (Jani)

Signed-off-by: Thomas Zimmermann <tzimmermann@suse.de>
Reviewed-by: Tvrtko Ursulin <tvrtko.ursulin@intel.com>
---
 drivers/gpu/drm/i915/gem/i915_gem_object.c    | 21 ++++++++++++++++---
 drivers/gpu/drm/i915/gem/i915_gem_object.h    |  3 ---
 drivers/gpu/drm/i915/i915_drv.c               |  4 ----
 .../gpu/drm/i915/selftests/mock_gem_device.c  |  3 ---
 4 files changed, 18 insertions(+), 13 deletions(-)

diff --git a/drivers/gpu/drm/i915/gem/i915_gem_object.c b/drivers/gpu/drm/i915/gem/i915_gem_object.c
index c8421fd9d2dc..3389ac972d16 100644
--- a/drivers/gpu/drm/i915/gem/i915_gem_object.c
+++ b/drivers/gpu/drm/i915/gem/i915_gem_object.c
@@ -39,9 +39,18 @@ static struct i915_global_object {
 	struct kmem_cache *slab_objects;
 } global;
 
+static const struct drm_gem_object_funcs i915_gem_object_funcs;
+
 struct drm_i915_gem_object *i915_gem_object_alloc(void)
 {
-	return kmem_cache_zalloc(global.slab_objects, GFP_KERNEL);
+	struct drm_i915_gem_object *obj;
+
+	obj = kmem_cache_zalloc(global.slab_objects, GFP_KERNEL);
+	if (!obj)
+		return NULL;
+	obj->base.funcs = &i915_gem_object_funcs;
+
+	return obj;
 }
 
 void i915_gem_object_free(struct drm_i915_gem_object *obj)
@@ -101,7 +110,7 @@ void i915_gem_object_set_cache_coherency(struct drm_i915_gem_object *obj,
 		!(obj->cache_coherent & I915_BO_CACHE_COHERENT_FOR_WRITE);
 }
 
-void i915_gem_close_object(struct drm_gem_object *gem, struct drm_file *file)
+static void i915_gem_close_object(struct drm_gem_object *gem, struct drm_file *file)
 {
 	struct drm_i915_gem_object *obj = to_intel_bo(gem);
 	struct drm_i915_file_private *fpriv = file->driver_priv;
@@ -264,7 +273,7 @@ static void __i915_gem_free_work(struct work_struct *work)
 	i915_gem_flush_free_objects(i915);
 }
 
-void i915_gem_free_object(struct drm_gem_object *gem_obj)
+static void i915_gem_free_object(struct drm_gem_object *gem_obj)
 {
 	struct drm_i915_gem_object *obj = to_intel_bo(gem_obj);
 	struct drm_i915_private *i915 = to_i915(obj->base.dev);
@@ -403,6 +412,12 @@ int __init i915_global_objects_init(void)
 	return 0;
 }
 
+static const struct drm_gem_object_funcs i915_gem_object_funcs = {
+	.free = i915_gem_free_object,
+	.close = i915_gem_close_object,
+	.export = i915_gem_prime_export,
+};
+
 #if IS_ENABLED(CONFIG_DRM_I915_SELFTEST)
 #include "selftests/huge_gem_object.c"
 #include "selftests/huge_pages.c"
diff --git a/drivers/gpu/drm/i915/gem/i915_gem_object.h b/drivers/gpu/drm/i915/gem/i915_gem_object.h
index d46db8d8f38e..eaf3d4147be0 100644
--- a/drivers/gpu/drm/i915/gem/i915_gem_object.h
+++ b/drivers/gpu/drm/i915/gem/i915_gem_object.h
@@ -38,9 +38,6 @@ void __i915_gem_object_release_shmem(struct drm_i915_gem_object *obj,
 
 int i915_gem_object_attach_phys(struct drm_i915_gem_object *obj, int align);
 
-void i915_gem_close_object(struct drm_gem_object *gem, struct drm_file *file);
-void i915_gem_free_object(struct drm_gem_object *obj);
-
 void i915_gem_flush_free_objects(struct drm_i915_private *i915);
 
 struct sg_table *
diff --git a/drivers/gpu/drm/i915/i915_drv.c b/drivers/gpu/drm/i915/i915_drv.c
index acc32066cec3..45e719c79183 100644
--- a/drivers/gpu/drm/i915/i915_drv.c
+++ b/drivers/gpu/drm/i915/i915_drv.c
@@ -1750,12 +1750,8 @@ static struct drm_driver driver = {
 	.lastclose = i915_driver_lastclose,
 	.postclose = i915_driver_postclose,
 
-	.gem_close_object = i915_gem_close_object,
-	.gem_free_object_unlocked = i915_gem_free_object,
-
 	.prime_handle_to_fd = drm_gem_prime_handle_to_fd,
 	.prime_fd_to_handle = drm_gem_prime_fd_to_handle,
-	.gem_prime_export = i915_gem_prime_export,
 	.gem_prime_import = i915_gem_prime_import,
 
 	.dumb_create = i915_gem_dumb_create,
diff --git a/drivers/gpu/drm/i915/selftests/mock_gem_device.c b/drivers/gpu/drm/i915/selftests/mock_gem_device.c
index 397c313a8b69..79664046c622 100644
--- a/drivers/gpu/drm/i915/selftests/mock_gem_device.c
+++ b/drivers/gpu/drm/i915/selftests/mock_gem_device.c
@@ -87,9 +87,6 @@ static struct drm_driver mock_driver = {
 	.name = "mock",
 	.driver_features = DRIVER_GEM,
 	.release = mock_device_release,
-
-	.gem_close_object = i915_gem_close_object,
-	.gem_free_object_unlocked = i915_gem_free_object,
 };
 
 static void release_dev(struct device *dev)
-- 
2.28.0

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

  parent reply index

Thread overview: 27+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2020-09-23 10:21 [PATCH v3 00/22] Convert all remaining drivers to " Thomas Zimmermann
2020-09-23 10:21 ` [PATCH v3 01/22] drm/amdgpu: Introduce " Thomas Zimmermann
2020-09-23 10:21 ` [PATCH v3 02/22] drm/armada: " Thomas Zimmermann
2020-09-23 10:21 ` [PATCH v3 03/22] drm/etnaviv: " Thomas Zimmermann
2020-09-23 12:27   ` Lucas Stach
2020-09-23 10:21 ` [PATCH v3 04/22] drm/exynos: " Thomas Zimmermann
2020-09-23 10:21 ` [PATCH v3 05/22] drm/gma500: " Thomas Zimmermann
2020-09-23 10:21 ` Thomas Zimmermann [this message]
2020-09-23 10:21 ` [PATCH v3 07/22] drm/imx/dcss: Initialize DRM driver instance with CMA helper macro Thomas Zimmermann
2020-09-23 11:18   ` Laurentiu Palcu
2020-09-23 10:21 ` [PATCH v3 08/22] drm/mediatek: Introduce GEM object functions Thomas Zimmermann
2020-09-23 10:21 ` [PATCH v3 09/22] drm/msm: Introduce GEM object funcs Thomas Zimmermann
2020-09-23 10:21 ` [PATCH v3 10/22] drm/nouveau: Introduce GEM object functions Thomas Zimmermann
2020-09-23 10:21 ` [PATCH v3 11/22] drm/omapdrm: " Thomas Zimmermann
2020-09-23 10:21 ` [PATCH v3 12/22] drm/pl111: " Thomas Zimmermann
2020-09-23 10:21 ` [PATCH v3 13/22] drm/radeon: " Thomas Zimmermann
2020-09-23 10:21 ` [PATCH v3 14/22] drm/rockchip: Convert to drm_gem_object_funcs Thomas Zimmermann
2020-09-23 10:21 ` [PATCH v3 15/22] drm/tegra: Introduce GEM object functions Thomas Zimmermann
2020-09-23 10:21 ` [PATCH v3 16/22] drm/vc4: " Thomas Zimmermann
2020-09-23 10:21 ` [PATCH v3 17/22] drm/vgem: " Thomas Zimmermann
2020-09-23 10:21 ` [PATCH v3 18/22] drm/virtgpu: Set PRIME export function in struct drm_gem_object_funcs Thomas Zimmermann
2020-09-23 10:21 ` [PATCH v3 19/22] drm/vkms: Introduce GEM object functions Thomas Zimmermann
2020-09-23 10:21 ` [PATCH v3 20/22] drm/xen: " Thomas Zimmermann
2020-09-23 10:21 ` [PATCH v3 21/22] drm/xlnx: Initialize DRM driver instance with CMA helper macro Thomas Zimmermann
2020-09-23 10:21 ` [PATCH v3 22/22] drm: Remove obsolete GEM and PRIME callbacks from struct drm_driver Thomas Zimmermann
2020-09-23 14:33 ` [PATCH v3 00/22] Convert all remaining drivers to GEM object functions Christian König
2020-09-25  8:40   ` 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=20200923102159.24084-7-tzimmermann@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=festevam@gmail.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=kernel@pengutronix.de \
    --cc=kgene@kernel.org \
    --cc=krzk@kernel.org \
    --cc=kyungmin.park@samsung.com \
    --cc=l.stach@pengutronix.de \
    --cc=laurent.pinchart@ideasonboard.com \
    --cc=laurentiu.palcu@oss.nxp.com \
    --cc=linux-arm-kernel@lists.infradead.org \
    --cc=linux-arm-msm@vger.kernel.org \
    --cc=linux-imx@nxp.com \
    --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=s.hauer@pengutronix.de \
    --cc=sam@ravnborg.org \
    --cc=sean@poorly.run \
    --cc=shawnguo@kernel.org \
    --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@intel.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

AMD-GFX Archive on lore.kernel.org

Archives are clonable:
	git clone --mirror https://lore.kernel.org/amd-gfx/0 amd-gfx/git/0.git

	# If you have public-inbox 1.1+ installed, you may
	# initialize and index your mirror using the following commands:
	public-inbox-init -V2 amd-gfx amd-gfx/ https://lore.kernel.org/amd-gfx \
		amd-gfx@lists.freedesktop.org
	public-inbox-index amd-gfx

Example config snippet for mirrors

Newsgroup available over NNTP:
	nntp://nntp.lore.kernel.org/org.freedesktop.lists.amd-gfx


AGPL code for this site: git clone https://public-inbox.org/public-inbox.git