amd-gfx.lists.freedesktop.org archive mirror
 help / color / mirror / 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, 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 00/22] Convert all remaining drivers to GEM object functions
Date: Wed, 23 Sep 2020 12:21:37 +0200	[thread overview]
Message-ID: <20200923102159.24084-1-tzimmermann@suse.de> (raw)

The GEM and PRIME related callbacks in struct drm_driver are deprecated in
favor of GEM object functions in struct drm_gem_object_funcs. This patchset
converts the remaining drivers to object functions and removes most of the
obsolete interfaces.

Version 3 of this patchset mostly fixes drm_gem_prime_handle_to_fd and
updates i.MX's dcss driver. The driver was missing from earlier versions
and still needs review.

Patches #1 to #6, #8 to #17 and #19 to #20 convert DRM drivers to GEM object
functions, one by one. Each patch moves existing callbacks from struct
drm_driver to an instance of struct drm_gem_object_funcs, and sets these
funcs when the GEM object is initialized. The expection is .gem_prime_mmap.
There are different ways of how drivers implement the callback, and moving
it to GEM object functions requires a closer review for each.

Patch #18 fixes virtgpu to use GEM object functions where possible. The
driver recently introduced a function for one of the deprecated callbacks.

Patches #7 and #20 convert i.MX's dcss and xlnx to CMA helper macros. There's
no apparent reason why the drivers do the GEM setup on their's own. Using CMA
helper macros adds GEM object functions implicitly.

With most of the GEM and PRIME moved to GEM object functions, related code
in struct drm_driver and in the DRM core/helpers is being removed by patch
#22.

Further testing is welcome. I tested the drivers for which I have HW
available. These are gma500, i915, nouveau, radeon and vc4. The console,
Weston and Xorg apparently work with the patches applied.

v3:
	* restore default call to drm_gem_prime_export() in
	  drm_gem_prime_handle_to_fd()
	* return -ENOSYS if get_sg_table is not set
	* drop all checks for obj->funcs
	* clean up TODO list and documentation
v2:
	* moved code in amdgpu and radeon
	* made several functions static in various drivers
	* updated TODO-list item
	* fix virtgpu

Thomas Zimmermann (22):
  drm/amdgpu: Introduce GEM object functions
  drm/armada: Introduce GEM object functions
  drm/etnaviv: Introduce GEM object functions
  drm/exynos: Introduce GEM object functions
  drm/gma500: Introduce GEM object functions
  drm/i915: Introduce GEM object functions
  drm/imx/dcss: Initialize DRM driver instance with CMA helper macro
  drm/mediatek: Introduce GEM object functions
  drm/msm: Introduce GEM object funcs
  drm/nouveau: Introduce GEM object functions
  drm/omapdrm: Introduce GEM object functions
  drm/pl111: Introduce GEM object functions
  drm/radeon: Introduce GEM object functions
  drm/rockchip: Convert to drm_gem_object_funcs
  drm/tegra: Introduce GEM object functions
  drm/vc4: Introduce GEM object functions
  drm/vgem: Introduce GEM object functions
  drm/virtgpu: Set PRIME export function in struct drm_gem_object_funcs
  drm/vkms: Introduce GEM object functions
  drm/xen: Introduce GEM object functions
  drm/xlnx: Initialize DRM driver instance with CMA helper macro
  drm: Remove obsolete GEM and PRIME callbacks from struct drm_driver

 Documentation/gpu/drm-mm.rst                  |  4 +-
 Documentation/gpu/todo.rst                    |  9 +-
 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/armada/armada_drv.c           |  3 -
 drivers/gpu/drm/armada/armada_gem.c           | 12 ++-
 drivers/gpu/drm/armada/armada_gem.h           |  2 -
 drivers/gpu/drm/drm_gem.c                     | 53 ++++--------
 drivers/gpu/drm/drm_gem_cma_helper.c          |  8 +-
 drivers/gpu/drm/drm_prime.c                   | 14 +--
 drivers/gpu/drm/etnaviv/etnaviv_drv.c         | 13 ---
 drivers/gpu/drm/etnaviv/etnaviv_drv.h         |  1 -
 drivers/gpu/drm/etnaviv/etnaviv_gem.c         | 19 ++++-
 drivers/gpu/drm/exynos/exynos_drm_drv.c       | 10 ---
 drivers/gpu/drm/exynos/exynos_drm_gem.c       | 15 ++++
 drivers/gpu/drm/gma500/framebuffer.c          |  2 +
 drivers/gpu/drm/gma500/gem.c                  | 18 +++-
 drivers/gpu/drm/gma500/gem.h                  |  3 +
 drivers/gpu/drm/gma500/psb_drv.c              |  9 --
 drivers/gpu/drm/gma500/psb_drv.h              |  2 -
 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 -
 drivers/gpu/drm/imx/dcss/dcss-kms.c           | 14 +--
 drivers/gpu/drm/mediatek/mtk_drm_drv.c        |  5 --
 drivers/gpu/drm/mediatek/mtk_drm_gem.c        | 11 +++
 drivers/gpu/drm/msm/msm_drv.c                 | 13 ---
 drivers/gpu/drm/msm/msm_drv.h                 |  1 -
 drivers/gpu/drm/msm/msm_gem.c                 | 19 ++++-
 drivers/gpu/drm/nouveau/nouveau_drm.c         |  9 --
 drivers/gpu/drm/nouveau/nouveau_gem.c         | 13 +++
 drivers/gpu/drm/nouveau/nouveau_gem.h         |  2 +
 drivers/gpu/drm/nouveau/nouveau_prime.c       |  2 +
 drivers/gpu/drm/omapdrm/omap_drv.c            |  9 --
 drivers/gpu/drm/omapdrm/omap_gem.c            | 18 +++-
 drivers/gpu/drm/omapdrm/omap_gem.h            |  2 -
 drivers/gpu/drm/pl111/pl111_drv.c             |  5 +-
 drivers/gpu/drm/radeon/radeon_drv.c           | 23 +----
 drivers/gpu/drm/radeon/radeon_gem.c           | 31 ++++++-
 drivers/gpu/drm/rockchip/rockchip_drm_drv.c   |  5 --
 drivers/gpu/drm/rockchip/rockchip_drm_gem.c   | 12 ++-
 drivers/gpu/drm/tegra/drm.c                   |  4 -
 drivers/gpu/drm/tegra/gem.c                   |  8 ++
 drivers/gpu/drm/vc4/vc4_bo.c                  | 21 ++++-
 drivers/gpu/drm/vc4/vc4_drv.c                 | 12 ---
 drivers/gpu/drm/vc4/vc4_drv.h                 |  1 -
 drivers/gpu/drm/vgem/vgem_drv.c               | 21 +++--
 drivers/gpu/drm/virtio/virtgpu_drv.c          |  1 -
 drivers/gpu/drm/virtio/virtgpu_object.c       |  1 +
 drivers/gpu/drm/vkms/vkms_drv.c               |  8 --
 drivers/gpu/drm/vkms/vkms_gem.c               | 13 +++
 drivers/gpu/drm/xen/xen_drm_front.c           | 44 ++++------
 drivers/gpu/drm/xen/xen_drm_front.h           |  2 +
 drivers/gpu/drm/xen/xen_drm_front_gem.c       | 15 ++++
 drivers/gpu/drm/xlnx/zynqmp_dpsub.c           | 14 +--
 include/drm/drm_drv.h                         | 85 +------------------
 include/drm/drm_gem.h                         |  2 +-
 59 files changed, 333 insertions(+), 375 deletions(-)

--
2.28.0

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

             reply	other threads:[~2020-09-23 10:22 UTC|newest]

Thread overview: 27+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2020-09-23 10:21 Thomas Zimmermann [this message]
2020-09-23 10:21 ` [PATCH v3 01/22] drm/amdgpu: Introduce GEM object functions 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 ` [PATCH v3 06/22] drm/i915: " Thomas Zimmermann
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-1-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@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;
as well as URLs for NNTP newsgroup(s).