Skip to contentSkip to conversation

drm/doc: document that PRIME import/export is always supported

PATCH In review Simon Ser 3 participants 5 messages Jul 12, 2023 – Jul 13, 2023

Subsystems (2)
lore
Share & tools
lore

Simon Ser

author
#0 lore raw

PATCH 1/1 drm/doc: document that PRIME import/export is always supported

Since commit 6b85aa68d9d5 ("drm: Enable PRIME import/export for all drivers"), import/export is always supported. Document this so that user-space knows what to expect.

Cc Thomas Zimmermann <[email protected]>
Cc Alex Deucher <[email protected]>
Cc Jeffrey Hugo <[email protected]>
Cc Daniel Vetter <[email protected]>
---
 include/uapi/drm/drm.h | 7 +++++++
 1 file changed, 7 insertions(+)
include/uapi/drm/drm.h +7 -0
index a87bbbbca2d4..56c194df527e 100644
@@ -673,6 +673,9 @@ struct drm_gem_open {
  * Bitfield of supported PRIME sharing capabilities. See &DRM_PRIME_CAP_IMPORT
  * and &DRM_PRIME_CAP_EXPORT.
  *
+ * Starting from kernel version 6.6, both &DRM_PRIME_CAP_IMPORT and
+ * &DRM_PRIME_CAP_EXPORT are always advertised.
+ *
  * PRIME buffers are exposed as dma-buf file descriptors. See
  * Documentation/gpu/drm-mm.rst, section "PRIME Buffer Sharing".
  */
@@ -682,6 +685,8 @@ struct drm_gem_open {
  *
  * If this bit is set in &DRM_CAP_PRIME, the driver supports importing PRIME
  * buffers via the &DRM_IOCTL_PRIME_FD_TO_HANDLE ioctl.
+ *
+ * Starting from kernel version 6.6, this bit is always set in &DRM_CAP_PRIME.
  */
 #define  DRM_PRIME_CAP_IMPORT		0x1
 /**
@@ -689,6 +694,8 @@ struct drm_gem_open {
  *
  * If this bit is set in &DRM_CAP_PRIME, the driver supports exporting PRIME
  * buffers via the &DRM_IOCTL_PRIME_HANDLE_TO_FD ioctl.
+ *
+ * Starting from kernel version 6.6, this bit is always set in &DRM_CAP_PRIME.
  */
 #define  DRM_PRIME_CAP_EXPORT		0x2
 /**
Signature · 1 line
2.41.0
Reviewed-by on v1 1/1
#1 lore raw
Quoted 9 lines · Simon Ser

Since commit 6b85aa68d9d5 ("drm: Enable PRIME import/export for all drivers"), import/export is always supported. Document this so that user-space knows what to expect.

Cc Thomas Zimmermann <[email protected]>
Cc Alex Deucher <[email protected]>
Cc Jeffrey Hugo <[email protected]>
Cc Daniel Vetter <[email protected]>

Seems reasonable to me.

#2 lore raw
In reply to Simon Ser

Hi

Am 12.07.23 um 20:32 schrieb Simon Ser:

Quoted 18 lines

Since commit 6b85aa68d9d5 ("drm: Enable PRIME import/export for all drivers"), import/export is always supported. Document this so that user-space knows what to expect.

Cc Thomas Zimmermann <[email protected]>
Cc Alex Deucher <[email protected]>
Cc Jeffrey Hugo <[email protected]>
Cc Daniel Vetter <[email protected]>
---
  include/uapi/drm/drm.h | 7 +++++++
  1 file changed, 7 insertions(+)
include/uapi/drm/drm.h +0 -0
index a87bbbbca2d4..56c194df527e 100644

include/uapi/drm/drm.h struct drm_gem_open { · line 678

Quoted 6 lines
include/uapi/drm/drm.h +3 -0
@@ -673,6 +673,9 @@ struct drm_gem_open {
   * Bitfield of supported PRIME sharing capabilities. See &DRM_PRIME_CAP_IMPORT
   * and &DRM_PRIME_CAP_EXPORT.
   *
+ * Starting from kernel version 6.6, both &DRM_PRIME_CAP_IMPORT and
+ * &DRM_PRIME_CAP_EXPORT are always advertised.
+ *

When people port these changes into their trees the version becomes meaningless. There are so many "enterprise kernels" that combine whole subsystems from different upstream releases.

That makes me wonder if such documentation makes sense. We want to avoid a situation where userspace does

if (v6.6)
do()
else if (test_flags())
do()

Best regards
Thomas

Quoted 21 lines
include/uapi/drm/drm.h +4 -0
   * PRIME buffers are exposed as dma-buf file descriptors. See
   * Documentation/gpu/drm-mm.rst, section "PRIME Buffer Sharing".
   */
@@ -682,6 +685,8 @@ struct drm_gem_open {
   *
   * If this bit is set in &DRM_CAP_PRIME, the driver supports importing PRIME
   * buffers via the &DRM_IOCTL_PRIME_FD_TO_HANDLE ioctl.
+ *
+ * Starting from kernel version 6.6, this bit is always set in &DRM_CAP_PRIME.
   */
  #define  DRM_PRIME_CAP_IMPORT		0x1
  /**
@@ -689,6 +694,8 @@ struct drm_gem_open {
   *
   * If this bit is set in &DRM_CAP_PRIME, the driver supports exporting PRIME
   * buffers via the &DRM_IOCTL_PRIME_HANDLE_TO_FD ioctl.
+ *
+ * Starting from kernel version 6.6, this bit is always set in &DRM_CAP_PRIME.
   */
  #define  DRM_PRIME_CAP_EXPORT		0x2
  /**
Signature · 6 lines
Thomas Zimmermann
Graphics Driver Developer
SUSE Software Solutions Germany GmbH
Frankenstrasse 146, 90461 Nuernberg, Germany
GF: Ivo Totev, Andrew Myers, Andrew McDonald, Boudien Moerman
HRB 36809 (AG Nuernberg)
author
#3 lore raw
Quoted 8 lines · Thomas Zimmermann
Quoted 3 lines

+ * Starting from kernel version 6.6, both &DRM_PRIME_CAP_IMPORT and
+ * &DRM_PRIME_CAP_EXPORT are always advertised.
+ *

When people port these changes into their trees the version becomes meaningless. There are so many "enterprise kernels" that combine whole subsystems from different upstream releases.

Quoted 7 lines

That makes me wonder if such documentation makes sense. We want to avoid a situation where userspace does

if (v6.6)
do()
else if (test_flags())
do()

Daniel Vetter asked for specific kernel versions in b603e810f740 ("drm/uapi: document kernel capabilities"). It allows user-space to figure out how widespread a cap is.

#4 lore raw

Am 13.07.23 um 09:17 schrieb Simon Ser:

Quoted 13 lines · Thomas Zimmermann
Quoted 12 lines
Quoted 4 lines

+ * Starting from kernel version 6.6, both &DRM_PRIME_CAP_IMPORT and
+ * &DRM_PRIME_CAP_EXPORT are always advertised.
+ *

When people port these changes into their trees the version becomes meaningless. There are so many "enterprise kernels" that combine whole subsystems from different upstream releases.

That makes me wonder if such documentation makes sense. We want to avoid a situation where userspace does

Quoted 8 lines
Quoted 4 lines

if (v6.6)
do()
else if (test_flags())
do()

Daniel Vetter asked for specific kernel versions in b603e810f740 ("drm/uapi: document kernel capabilities"). It allows user-space to figure out how widespread a cap is.

Well, OK then... :)

Signature · 6 lines
Thomas Zimmermann
Graphics Driver Developer
SUSE Software Solutions Germany GmbH
Frankenstrasse 146, 90461 Nuernberg, Germany
GF: Ivo Totev, Andrew Myers, Andrew McDonald, Boudien Moerman
HRB 36809 (AG Nuernberg)