Re: [PATCH 2/2] drm: add DRIVER_RENDER_ONLY

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



Hi

Am 11.10.22 um 13:04 schrieb Christian König:
This allows to suppress creating the primary node. Useful for drivers
which don't expose any display functionality, but are render only by
design.

Signed-off-by: Christian König <christian.koenig@xxxxxxx>
---
  drivers/gpu/drm/drm_drv.c   | 10 ++++++----
  drivers/gpu/drm/drm_prime.c |  2 +-
  include/drm/drm_drv.h       |  7 +++++++
  3 files changed, 14 insertions(+), 5 deletions(-)

diff --git a/drivers/gpu/drm/drm_drv.c b/drivers/gpu/drm/drm_drv.c
index d81783f43452..4a525f78a932 100644
--- a/drivers/gpu/drm/drm_drv.c
+++ b/drivers/gpu/drm/drm_drv.c
@@ -634,9 +634,11 @@ static int drm_dev_init(struct drm_device *dev,
  			goto err;
  	}
- ret = drm_minor_alloc(dev, DRM_MINOR_PRIMARY);
-	if (ret)
-		goto err;
+	if (!drm_core_check_feature(dev, DRIVER_RENDER_ONLY)) {
+		ret = drm_minor_alloc(dev, DRM_MINOR_PRIMARY);
+		if (ret)
+			goto err;
+	}
ret = drm_legacy_create_map_hash(dev);
  	if (ret)
@@ -902,7 +904,7 @@ int drm_dev_register(struct drm_device *dev, unsigned long flags)
  		 driver->name, driver->major, driver->minor,
  		 driver->patchlevel, driver->date,
  		 dev->dev ? dev_name(dev->dev) : "virtual device",
-		 dev->primary->index);
+		 (dev->primary ?: dev->render)->index);
goto out_unlock; diff --git a/drivers/gpu/drm/drm_prime.c b/drivers/gpu/drm/drm_prime.c
index a3f180653b8b..4afd3f15b135 100644
--- a/drivers/gpu/drm/drm_prime.c
+++ b/drivers/gpu/drm/drm_prime.c
@@ -740,7 +740,7 @@ int drm_gem_prime_mmap(struct drm_gem_object *obj, struct vm_area_struct *vma)
  	}
/* Used by drm_gem_mmap() to lookup the GEM object */
-	priv->minor = obj->dev->primary;
+	priv->minor = obj->dev->primary ?: obj->dev->render;
  	fil->private_data = priv;
ret = drm_vma_node_allow(&obj->vma_node, priv);
diff --git a/include/drm/drm_drv.h b/include/drm/drm_drv.h
index f6159acb8856..0a1450d47ca2 100644
--- a/include/drm/drm_drv.h
+++ b/include/drm/drm_drv.h
@@ -94,6 +94,13 @@ enum drm_driver_feature {
  	 * synchronization of command submission.
  	 */
  	DRIVER_SYNCOBJ_TIMELINE         = BIT(6),
+	/**
+	 * @DRIVER_RENDER_ONLY
+	 *
+	 * Driver is a render node only driver and don't want to support the
+	 * primary interface.
+	 */
+	DRIVER_RENDER_ONLY		= BIT(7),

Is it really necessary to add a new flag? If a driver sets DRIVER_GEM and omits DRIVER_MODESET wouldn't this have the same meaning?

Best regards
Thomas

/* IMPORTANT: Below are all the legacy flags, add new ones above. */

--
Thomas Zimmermann
Graphics Driver Developer
SUSE Software Solutions Germany GmbH
Maxfeldstr. 5, 90409 Nürnberg, Germany
(HRB 36809, AG Nürnberg)
Geschäftsführer: Ivo Totev

Attachment: OpenPGP_signature
Description: OpenPGP digital signature


[Index of Archives]     [Linux DRI Users]     [Linux Intel Graphics]     [Linux USB Devel]     [Video for Linux]     [Linux Audio Users]     [Yosemite News]     [Linux Kernel]     [Linux SCSI]     [XFree86]     [Linux USB Devel]     [Video for Linux]     [Linux Audio Users]     [Linux Kernel]     [Linux SCSI]     [XFree86]
  Powered by Linux