Blob Blame History Raw
From ee8375d5dc5bbb50b03bedfb0020d3e1c27ceacb Mon Sep 17 00:00:00 2001
From: Daniel Vetter <daniel.vetter@ffwll.ch>
Date: Fri, 14 Jun 2019 22:35:21 +0200
Subject: drm/prime: Make DRIVER_PRIME a no-op
Git-commit: ee8375d5dc5bbb50b03bedfb0020d3e1c27ceacb
Patch-mainline: v5.4-rc1
References: bsc#1152472

Drivers must fill out the handle_to_fd and fd_to_handle hooks to
enable export/import prime functionality already. The additional
DRIVER_PRIME flag doesn't serve any real purpose, since the overall
flag doesn't even tell you whether import or export or maybe even both
is supported.

Ditch it.

This patch just makes it defunct, subsequent patches will remove it
from all the drivers.

Note this changes the userspace visible errno in some situations from
EOPNOTSUPP to ENOSYS. Userspace already needs to treat both as "no
prime support", so this should break anything.

v2: Improve commit message as suggested by Emil

Reviewed-by: Emil Velikov <emil.velikov@collabora.com>
Reviewed-by: Eric Anholt <eric@anholt.net>
Signed-off-by: Daniel Vetter <daniel.vetter@intel.com>
Link: https://patchwork.freedesktop.org/patch/msgid/20190614203615.12639-6-daniel.vetter@ffwll.ch
Acked-by: Thomas Zimmermann <tzimmermann@suse.de>
---
 drivers/gpu/drm/drm_prime.c | 9 +--------
 1 file changed, 1 insertion(+), 8 deletions(-)

diff --git a/drivers/gpu/drm/drm_prime.c b/drivers/gpu/drm/drm_prime.c
index c269bc03c42a..1f100d5a323f 100644
--- a/drivers/gpu/drm/drm_prime.c
+++ b/drivers/gpu/drm/drm_prime.c
@@ -47,8 +47,7 @@
  * between applications, they can't be guessed like the globally unique GEM
  * names.
  *
- * Drivers that support the PRIME API must set the DRIVER_PRIME bit in the
- * &drm_driver.driver_features field, and implement the
+ * Drivers that support the PRIME API implement the
  * &drm_driver.prime_handle_to_fd and &drm_driver.prime_fd_to_handle operations.
  * GEM based drivers must use drm_gem_prime_handle_to_fd() and
  * drm_gem_prime_fd_to_handle() to implement these. For GEM based drivers the
@@ -363,9 +362,6 @@ int drm_prime_fd_to_handle_ioctl(struct drm_device *dev, void *data,
 {
 	struct drm_prime_handle *args = data;
 
-	if (!drm_core_check_feature(dev, DRIVER_PRIME))
-		return -EOPNOTSUPP;
-
 	if (!dev->driver->prime_fd_to_handle)
 		return -ENOSYS;
 
@@ -514,9 +510,6 @@ int drm_prime_handle_to_fd_ioctl(struct drm_device *dev, void *data,
 {
 	struct drm_prime_handle *args = data;
 
-	if (!drm_core_check_feature(dev, DRIVER_PRIME))
-		return -EOPNOTSUPP;
-
 	if (!dev->driver->prime_handle_to_fd)
 		return -ENOSYS;
 
-- 
2.28.0