public inbox for linux-kernel@vger.kernel.org
 help / color / mirror / Atom feed
* [PATCH 1/3] drm/file: Rehabilitate the firstopen hook for non-legacy drivers
@ 2019-03-15 16:25 Paul Kocialkowski
  2019-03-15 16:25 ` [PATCH 2/3] drm/vc4: Allocate/liberate the binner BO at firstopen/lastclose Paul Kocialkowski
  2019-03-15 16:25 ` [PATCH 3/3] drm/vc4: Don't liberate the binner BO at runtime suspend Paul Kocialkowski
  0 siblings, 2 replies; 5+ messages in thread
From: Paul Kocialkowski @ 2019-03-15 16:25 UTC (permalink / raw)
  To: dri-devel, linux-kernel
  Cc: Maarten Lankhorst, Maxime Ripard, Sean Paul, David Airlie,
	Daniel Vetter, Eric Anholt, Thomas Petazzoni, Eben Upton,
	Paul Kocialkowski

The firstopen DRM driver hook was initially used to perform hardware
initialization, which is now considered legacy. Only a single user of
firstopen remains at this point (savage).

In some specific cases, non-legacy drivers may also need to implement
these hooks. For instance on VC4, we need to allocate a 16 MiB buffer
for the GPU. Because it's not required for fbcon, it's a waste to
allocate it before userspace starts using the DRM device.

Using firstopen and lastclose for this allocation seems like the best
fit, so re-habilitate the hook to allow it to be called for non-legacy
drivers.

Signed-off-by: Paul Kocialkowski <paul.kocialkowski@bootlin.com>
---
 drivers/gpu/drm/drm_file.c | 3 +--
 include/drm/drm_drv.h      | 2 +-
 2 files changed, 2 insertions(+), 3 deletions(-)

diff --git a/drivers/gpu/drm/drm_file.c b/drivers/gpu/drm/drm_file.c
index b1838a41ad43..c011b5cbfb6b 100644
--- a/drivers/gpu/drm/drm_file.c
+++ b/drivers/gpu/drm/drm_file.c
@@ -266,8 +266,7 @@ static int drm_setup(struct drm_device * dev)
 {
 	int ret;
 
-	if (dev->driver->firstopen &&
-	    drm_core_check_feature(dev, DRIVER_LEGACY)) {
+	if (dev->driver->firstopen) {
 		ret = dev->driver->firstopen(dev);
 		if (ret != 0)
 			return ret;
diff --git a/include/drm/drm_drv.h b/include/drm/drm_drv.h
index ca46a45a9cce..aa14607e54d4 100644
--- a/include/drm/drm_drv.h
+++ b/include/drm/drm_drv.h
@@ -236,7 +236,7 @@ struct drm_driver {
 	 * to set/unset the VT into raw mode.
 	 *
 	 * Legacy drivers initialize the hardware in the @firstopen callback,
-	 * which isn't even called for modern drivers.
+	 * modern drivers can use it for other purposes only.
 	 */
 	void (*lastclose) (struct drm_device *);
 
-- 
2.21.0


^ permalink raw reply related	[flat|nested] 5+ messages in thread

end of thread, other threads:[~2019-03-20 15:17 UTC | newest]

Thread overview: 5+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2019-03-15 16:25 [PATCH 1/3] drm/file: Rehabilitate the firstopen hook for non-legacy drivers Paul Kocialkowski
2019-03-15 16:25 ` [PATCH 2/3] drm/vc4: Allocate/liberate the binner BO at firstopen/lastclose Paul Kocialkowski
2019-03-15 16:25 ` [PATCH 3/3] drm/vc4: Don't liberate the binner BO at runtime suspend Paul Kocialkowski
2019-03-16 18:58   ` Eric Anholt
2019-03-20 15:17     ` Paul Kocialkowski

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox