Linux kernel mirror (for testing) git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
kernel os linux

drm/prime: Make DRIVER_PRIME a no-op

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

+1 -8
+1 -8
drivers/gpu/drm/drm_prime.c
··· 47 47 * between applications, they can't be guessed like the globally unique GEM 48 48 * names. 49 49 * 50 - * Drivers that support the PRIME API must set the DRIVER_PRIME bit in the 51 - * &drm_driver.driver_features field, and implement the 50 + * Drivers that support the PRIME API implement the 52 51 * &drm_driver.prime_handle_to_fd and &drm_driver.prime_fd_to_handle operations. 53 52 * GEM based drivers must use drm_gem_prime_handle_to_fd() and 54 53 * drm_gem_prime_fd_to_handle() to implement these. For GEM based drivers the ··· 362 363 { 363 364 struct drm_prime_handle *args = data; 364 365 365 - if (!drm_core_check_feature(dev, DRIVER_PRIME)) 366 - return -EOPNOTSUPP; 367 - 368 366 if (!dev->driver->prime_fd_to_handle) 369 367 return -ENOSYS; 370 368 ··· 509 513 struct drm_file *file_priv) 510 514 { 511 515 struct drm_prime_handle *args = data; 512 - 513 - if (!drm_core_check_feature(dev, DRIVER_PRIME)) 514 - return -EOPNOTSUPP; 515 516 516 517 if (!dev->driver->prime_handle_to_fd) 517 518 return -ENOSYS;