drm/doc: use cross-references for macros
Subsystems (3)
PATCH 1/4 drm/doc: use cross-references for macros
These will show up as monospace, and will get linkified as soon as we document the macro they point to.
--- Documentation/gpu/drm-uapi.rst | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-)
Documentation/gpu/drm-uapi.rst +4 -4
@@ -450,12 +450,12 @@ VBlank event handling The DRM core exposes two vertical blank related ioctls: -DRM_IOCTL_WAIT_VBLANK +:c:macro:`DRM_IOCTL_WAIT_VBLANK` This takes a struct drm_wait_vblank structure as its argument, and it is used to block or request a signal when a specified vblank event occurs. -DRM_IOCTL_MODESET_CTL +:c:macro:`DRM_IOCTL_MODESET_CTL` This was only used for user-mode-settind drivers around modesetting changes to allow the kernel to update the vblank interrupt after mode setting, since on many devices the vertical blank counter is
@@ -478,8 +478,8 @@ The index is used in cases where a densely packed identifier for a CRTC is needed, for instance a bitmask of CRTC's. The member possible_crtcs of struct drm_mode_get_plane is an example. -DRM_IOCTL_MODE_GETRESOURCES populates a structure with an array of CRTC ID's, -and the CRTC index is its position in this array. +:c:macro:`DRM_IOCTL_MODE_GETRESOURCES` populates a structure with an array of +CRTC ID's, and the CRTC index is its position in this array. .. kernel-doc:: include/uapi/drm/drm.h :internal:
Signature · 1 line
2.41.0
PATCH 2/4 drm/doc: document interactions between PAGE_FLIP_EVENT and atomic
Explain which CRTCs get an event, and uAPI requirements.
--- include/uapi/drm/drm_mode.h | 4 ++++ 1 file changed, 4 insertions(+)
include/uapi/drm/drm_mode.h +4 -0
@@ -946,6 +946,10 @@ struct hdr_output_metadata {* Request that the kernel sends back a vblank event (see * struct drm_event_vblank) with the &DRM_EVENT_FLIP_COMPLETE type when the * page-flip is done. +* +* When used with the atomic uAPI, vblank events will be sent for every CRTC +* included in the commit. At least one CRTC must be included, and all included +* CRTCs must be turned on. */ #define DRM_MODE_PAGE_FLIP_EVENT 0x01/**
Signature · 1 line
2.41.0
Re: [PATCH 2/4] drm/doc: document interactions between PAGE_FLIP_EVENT and atomic
Quoted 14 lines · On Wed, 12 Jul 2023 13:57:28 +0000 Simon Ser <[email protected]> wrote:
Explain which CRTCs get an event, and uAPI requirements.
Signed-off-by Simon Ser <[email protected]>Cc Pekka Paalanen <[email protected]>Cc Daniel Vetter <[email protected]>--- include/uapi/drm/drm_mode.h | 4 ++++ 1 file changed, 4 insertions(+)include/uapi/drm/drm_mode.h +0
-0
include/uapi/drm/drm_mode.h struct hdr_output_metadata { · line 955
Quoted 10 lines
include/uapi/drm/drm_mode.h +4
-0@@ -946,6 +946,10 @@ struct hdr_output_metadata {* Request that the kernel sends back a vblank event (see * struct drm_event_vblank) with the &DRM_EVENT_FLIP_COMPLETE type when the * page-flip is done. +* +* When used with the atomic uAPI, vblank events will be sent for every CRTC +* included in the commit. At least one CRTC must be included, and all included +* CRTCs must be turned on. */ #define DRM_MODE_PAGE_FLIP_EVENT 0x01/**
What about interactions with DRM_CAP_CRTC_IN_VBLANK_EVENT?
Is there one event per CRTC even without the cap? And in that case userspace cannot see which CRTC an event is for, but it must wait for the correct number of events to be sure each one completed? Which is horribly fragile, so maybe we should recommend to not even try without the cap?
FWIW, Weston does not use atomic without the cap, so I can't peek there.
What does "including a CRTC in a commit" mean? I think a CRTC is included if the commit touches any plane on the CRTC, but there is no need to touch any CRTC property to have the CRTC included, right? Touching connector properties pulls in the CRTC as well?
Thanks,
pq
RFC PATCH 3/4 drm/doc: document PAGE_FLIP_EVENT | PAGE_FLIP_ASYNC
In reply to Simon SerExplain what the event looks like when both flags are specified.
---
Driver developers: please confirm or deny this documentation. I'm just guessing here.
include/uapi/drm/drm_mode.h | 3 +++ 1 file changed, 3 insertions(+)
include/uapi/drm/drm_mode.h +3 -0
@@ -950,6 +950,9 @@ struct hdr_output_metadata {* When used with the atomic uAPI, vblank events will be sent for every CRTC * included in the commit. At least one CRTC must be included, and all included * CRTCs must be turned on. +* +* When used with &DRM_MODE_PAGE_FLIP_ASYNC, the page-flip event will have the +* same timings and sequence number as the previous effective page-flip. */ #define DRM_MODE_PAGE_FLIP_EVENT 0x01/**
Signature · 1 line
2.41.0
Re: [RFC PATCH 3/4] drm/doc: document PAGE_FLIP_EVENT | PAGE_FLIP_ASYNC
Quoted 21 lines · On Wed, 12 Jul 2023 13:57:32 +0000 Simon Ser <[email protected]> wrote:
Explain what the event looks like when both flags are specified.
Signed-off-by Simon Ser <[email protected]>Cc Pekka Paalanen <[email protected]>Cc Daniel Vetter <[email protected]>Cc Ville Syrjälä <[email protected]>Cc Lyude Paul <[email protected]>Cc Christian König <[email protected]>---
Driver developers: please confirm or deny this documentation. I'm just guessing here.
include/uapi/drm/drm_mode.h | 3 +++ 1 file changed, 3 insertions(+)include/uapi/drm/drm_mode.h +0
-0
include/uapi/drm/drm_mode.h struct hdr_output_metadata { · line 958
Quoted 9 lines
include/uapi/drm/drm_mode.h +3
-0@@ -950,6 +950,9 @@ struct hdr_output_metadata {* When used with the atomic uAPI, vblank events will be sent for every CRTC * included in the commit. At least one CRTC must be included, and all included * CRTCs must be turned on. +* +* When used with &DRM_MODE_PAGE_FLIP_ASYNC, the page-flip event will have the +* same timings and sequence number as the previous effective page-flip. */ #define DRM_MODE_PAGE_FLIP_EVENT 0x01/**
This wording would mean that if you do a continuous stream of async flips indefinitely, the timestamp and sequence number would never change at all. I think "the previous effective page-flip" needs different words.
Hmm, no. I'm misunderstanding "effective" here. But all the flips are effective, right? All will be programmed into hardware.
Thanks,
pq
PATCH 4/4 drm/doc: document front-buffer rendering
In reply to Simon SerExplain how to perform front-buffer rendering.
--- drivers/gpu/drm/drm_blend.c | 3 +++ 1 file changed, 3 insertions(+)
drivers/gpu/drm/drm_blend.c +3 -0
@@ -75,6 +75,9 @@* the currently visible vertical area of the &drm_crtc. * FB_ID: * Mode object ID of the &drm_framebuffer this plane should scan out. +* +* To perform front-buffer rendering, user-space should set FB_ID to the +* previous framebuffer in atomic commits. * CRTC_ID: * Mode object ID of the &drm_crtc this plane should be connected to. *
Signature · 1 line
2.41.0
Re: [PATCH 4/4] drm/doc: document front-buffer rendering
Quoted 14 lines · On Wed, 12 Jul 2023 13:57:34 +0000 Simon Ser <[email protected]> wrote:
Explain how to perform front-buffer rendering.
Signed-off-by Simon Ser <[email protected]>Cc Pekka Paalanen <[email protected]>Cc Daniel Vetter <[email protected]>--- drivers/gpu/drm/drm_blend.c | 3 +++ 1 file changed, 3 insertions(+)drivers/gpu/drm/drm_blend.c +0
-0
drivers/gpu/drm/drm_blend.c line 83
Quoted 9 lines
drivers/gpu/drm/drm_blend.c +3
-0@@ -75,6 +75,9 @@* the currently visible vertical area of the &drm_crtc. * FB_ID: * Mode object ID of the &drm_framebuffer this plane should scan out. +* +* To perform front-buffer rendering, user-space should set FB_ID to the +* previous framebuffer in atomic commits. * CRTC_ID: * Mode object ID of the &drm_crtc this plane should be connected to. *
It's unclear to me what "previous framebuffer" means, although I know what you want to say. How about:
When a KMS client is front-buffer rendering, it should set FB_ID to the same front-buffer FB on each atomic commit. This implies to the driver that it needs to re-read the same FB again. Otherwise drivers who do not employ continuously repeated scanout cycles might not update the screen.
Btw. is it enough to set only FB_DAMAGE_CLIPS and not touch FB_ID?
Thanks,
pq
Re: [PATCH 4/4] drm/doc: document front-buffer rendering
Quoted 6 lines · Pekka Paalanen
Quoted 5 lines
+ * To perform front-buffer rendering, user-space should set
FB_IDto the
+ * previous framebuffer in atomic commits.
*CRTC_ID:
* Mode object ID of the&drm_crtcthis plane should be connected to. *
Quoted 8 lines
It's unclear to me what "previous framebuffer" means, although I know what you want to say. How about:
When a KMS client is front-buffer rendering, it should set
FB_IDto the same front-buffer FB on each atomic commit. This implies to the driver that it needs to re-read the same FB again. Otherwise drivers who do not employ continuously repeated scanout cycles might not update the screen.
Thanks for the suggestion! Looks good to me, will send in v2.
Quoted 1 line
Btw. is it enough to set only
FB_DAMAGE_CLIPSand not touchFB_ID?
Hm, I must admit I have no idea.
Quoted 30 lines · On Wed, 12 Jul 2023 13:57:26 +0000 Simon Ser <[email protected]> wrote:
These will show up as monospace, and will get linkified as soon as we document the macro they point to.
Signed-off-by Simon Ser <[email protected]>Cc Pekka Paalanen <[email protected]>Cc Daniel Vetter <[email protected]>--- Documentation/gpu/drm-uapi.rst | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-)Documentation/gpu/drm-uapi.rst +2
-2@@ -450,12 +450,12 @@ VBlank event handling The DRM core exposes two vertical blank related ioctls: -DRM_IOCTL_WAIT_VBLANK +:c:macro:`DRM_IOCTL_WAIT_VBLANK` This takes a struct drm_wait_vblank structure as its argument, and it is used to block or request a signal when a specified vblank event occurs. -DRM_IOCTL_MODESET_CTL +:c:macro:`DRM_IOCTL_MODESET_CTL` This was only used for user-mode-settind drivers around modesetting changes to allow the kernel to update the vblank interrupt after mode setting, since on many devices the vertical blank counter is
Documentation/gpu/drm-uapi.rst The index is used in cases where a densely packed identifier for a CRTC is · line 485
Quoted 10 lines
Documentation/gpu/drm-uapi.rst +2
-2@@ -478,8 +478,8 @@ The index is used in cases where a densely packed identifier for a CRTC is needed, for instance a bitmask of CRTC's. The member possible_crtcs of struct drm_mode_get_plane is an example. -DRM_IOCTL_MODE_GETRESOURCES populates a structure with an array of CRTC ID's, -and the CRTC index is its position in this array. +:c:macro:`DRM_IOCTL_MODE_GETRESOURCES` populates a structure with an array of +CRTC ID's, and the CRTC index is its position in this array. .. kernel-doc:: include/uapi/drm/drm.h :internal:
An excellent idea, and the syntax doesn't look obviously incorrect to me, so
Thanks
pq