drm: Try to document legacy DPMS uapi a bit better
Subsystems (2)
PATCH 1/1 drm: Try to document legacy DPMS uapi a bit better
Laurent asked for this.
--- drivers/gpu/drm/drm_connector.c | 19 +++++++++++++++++++ 1 file changed, 19 insertions(+)
drivers/gpu/drm/drm_connector.c +19 -0
@@ -720,6 +720,25 @@ DRM_ENUM_NAME_FN(drm_get_tv_subconnector_name,* callback. For atomic drivers the remapping to the "ACTIVE" property is * implemented in the DRM core. This is the only standard connector * property that userspace can change. +* +* WARNING: +* +* For userspace also running on legacy drivers the "DPMS" semantics are a +* lot more complicated. First, userspace cannot rely on the "DPMS" value +* returned by the GETCONNECTOR actually reflecting reality, because many +* drivers fail to update it. For atomic drivers this is taken care of in +* drm_atomic_helper_update_legacy_modeset_state(). +* +* The second issue is that the DPMS state is only relevant when the +* connector is connected to a CRTC. In atomic the DRM core enforces that +* "ACTIVE" is off in such a case, no such checks exists for "DPMS". +* Finally, when enabling an output using the legacy SETCONFIG ioctl then +* "DPMS" is forced to ON. But see above, that might not be reflected in +* the software value. +* +* Summarizing: Only set "DPMS" when the connector is known to be enabled, +* assume that a successful SETCONFIG call also set "DPMS" to on, and never +* read back the value of "DPMS" because it can be incorrect. * PATH: * Connector path property to identify how this sink is physically * connected. Used by DP MST. This should be set by calling
Signature · 6 lines
2.13.3 _______________________________________________ dri-devel mailing list [email protected] https://lists.freedesktop.org/mailman/listinfo/dri-devel
Hi Daniel,
Thank you for the patch.
Quoted 1 line · On Tuesday 15 Aug 2017 16:55:19 Daniel Vetter wrote:
Laurent asked for this.
While this is true, I'm not sure it makes a proper commit message :-)
Quoted 11 lines
Cc Laurent Pinchart <[email protected]>Signed-off-by Daniel Vetter <[email protected]>--- drivers/gpu/drm/drm_connector.c | 19 +++++++++++++++++++ 1 file changed, 19 insertions(+)(quoted diff) +0
-0
b/drivers/gpu/drm/drm_connector.cindexba9f36cef68c..b458eb488128100644
drivers/gpu/drm/drm_connector.c DRM_ENUM_NAME_FN(drm_get_tv_subconnector_name, · line 727
Quoted 8 lines
drivers/gpu/drm/drm_connector.c +5
-0@@ -720,6 +720,25 @@ DRM_ENUM_NAME_FN(drm_get_tv_subconnector_name,* callback. For atomic drivers the remapping to the "ACTIVE" property is * implemented in the DRM core. This is the only standard connector * property that userspace can change. +* +* WARNING: +* +* For userspace also running on legacy drivers the "DPMS" semantics are +* a lot more complicated.
What is "userspace also running on legacy drivers" ? Is that userspace that is atomic-aware and have different codes paths for atomic and non-atomic drivers, or userspace that uses the legacy API regardless of the driver ? I assume you mean the latter, in which case I would write it as "userspace using the legacy non-atomic API with atomic drivers".
Quoted 4 lines
First, userspace cannot rely on the "DPMS"
+ * value returned by the GETCONNECTOR actually reflecting reality,
+ * because many drivers fail to update it. For atomic drivers this is
+ * taken care of indrm_atomic_helper_update_legacy_modeset_state().
Are you talking about atomic drivers not using drm_atomic_helper_update_legacy_modeset_state() (directly or indirectly through the atomic commit helpers) ? Are there many of those ? They should be fixed, I don't think we should consider this as the normal behaviour. I'd rather explain how the connector DPMS interacts with the connector CRTC_ID and the CRTC ACTIVE properties when the drivers get it right, and then possibly add a warning that some drivers don't implement it correctly.
I think "reflecting reality" is also vague. What do you mean by reality ? The fact the the DPMS property should reflect whether the connector is linked to an active CRTC (as explained in the existing DPMS property documentation) ?
Quoted 3 lines
+ * The second issue is that the DPMS state is only relevant when the
+ * connector is connected to a CRTC. In atomic the DRM core enforces that
+ * "ACTIVE" is off in such a case, no such checks exists for "DPMS".
What is "such a case" ? A connector not connected to a CRTC ?
Quoted 8 lines
+ * Finally, when enabling an output using the legacy SETCONFIG ioctl then
+ * "DPMS" is forced to ON. But see above, that might not be reflected in
+ * the software value.
+ *
+ * Summarizing: Only set "DPMS" when the connector is known to be
+ * enabled, assume that a successful SETCONFIG call also set "DPMS" to
+ * on, and never read back the value of "DPMS" because it can be
+ * incorrect.
The need to summarize two paragraphs in a third one indicates to me that the documentation is confusing.
Quoted 3 lines
* PATH:
* Connector path property to identify how this sink is physically
* connected. Used by DP MST. This should be set by calling
Signature · 8 lines
Regards, Laurent Pinchart _______________________________________________ dri-devel mailing list [email protected] https://lists.freedesktop.org/mailman/listinfo/dri-devel
Quoted 26 lines · Laurent Pinchart
Hi Daniel,
Thank you for the patch.
Quoted 1 line · On Tuesday 15 Aug 2017 16:55:19 Daniel Vetter wrote:
Laurent asked for this.
While this is true, I'm not sure it makes a proper commit message :-)
Quoted 17 lines
Cc Laurent Pinchart <[email protected]>Signed-off-by Daniel Vetter <[email protected]>--- drivers/gpu/drm/drm_connector.c | 19 +++++++++++++++++++ 1 file changed, 19 insertions(+)(quoted diff) +0
-0
b/drivers/gpu/drm/drm_connector.cindexba9f36cef68c..b458eb488128100644drivers/gpu/drm/drm_connector.c +3
-0@@ -720,6 +720,25 @@ DRM_ENUM_NAME_FN(drm_get_tv_subconnector_name,* callback. For atomic drivers the remapping to the "ACTIVE" property is * implemented in the DRM core. This is the only standard connector * property that userspace can change. +* +* WARNING: +*
Quoted 8 lines
drivers/gpu/drm/drm_connector.c DRM_ENUM_NAME_FN(drm_get_tv_subconnector_name, · line 727
Quoted 2 lines
drivers/gpu/drm/drm_connector.c +2
-0+* For userspace also running on legacy drivers the "DPMS" semantics are +* a lot more complicated. What is "userspace also running on legacy drivers" ? Is that userspace that is atomic-aware and have different codes paths for atomic and non-atomic drivers, or userspace that uses the legacy API regardless of the driver ? I assume you mean the latter, in which case I would write it as "userspace using the legacy non-atomic API with atomic drivers".
Legacy DPMS on atomic drivers has well-defined semantics. Legacy DPMS on legacy drivers is much worse, which is what this WARNING describes. The intro para only defines how DPMS works for atomic drivers.
I'm not exactly sure how I can make this clearer, please give a proposal. I thought it's pretty obvious that this is all about legacy drivers, but somehow you read the entire thing as applying to atomic drivers.
Quoted 5 lines
Quoted 4 lines
First, userspace cannot rely on the "DPMS"
+ * value returned by the GETCONNECTOR actually reflecting reality, + * because many drivers fail to update it. For atomic drivers this is + * taken care of in drm_atomic_helper_update_legacy_modeset_state().
Quoted 7 lines
Are you talking about atomic drivers not using
drm_atomic_helper_update_legacy_modeset_state()(directly or indirectly through the atomic commit helpers) ? Are there many of those ? They should be fixed, I don't think we should consider this as the normal behaviour. I'd rather explain how the connector DPMS interacts with the connectorCRTC_IDand the CRTC ACTIVE properties when the drivers get it right, and then possibly add a warning that some drivers don't implement it correctly.
Again this is about legacy drivers.
Quoted 3 lines
I think "reflecting reality" is also vague. What do you mean by reality ? The fact the the DPMS property should reflect whether the connector is linked to an active CRTC (as explained in the existing DPMS property documentation) ?
The reality of the non-atomic drivers we still ship. Where is the "existing DPMS property documentation" btw? This here should be everything, and it makes it clear DPMS is not very well linked to anything.
Quoted 5 lines
Quoted 3 lines
+ * The second issue is that the DPMS state is only relevant when the + * connector is connected to a CRTC. In atomic the DRM core enforces that + * "ACTIVE" is off in such a case, no such checks exists for "DPMS".What is "such a case" ? A connector not connected to a CRTC ?
Yes. I guess I can hammer this home by repetition :-)
Quoted 11 lines
Quoted 8 lines
+ * Finally, when enabling an output using the legacy SETCONFIG ioctl then + * "DPMS" is forced to ON. But see above, that might not be reflected in + * the software value. + * + * Summarizing: Only set "DPMS" when the connector is known to be + * enabled, assume that a successful SETCONFIG call also set "DPMS" to + * on, and never read back the value of "DPMS" because it can be + * incorrect.The need to summarize two paragraphs in a third one indicates to me that the documentation is confusing.
The idea is to give userspace writers guidelines what they should do with DPMS. Should I make clearer what the audience of that summary is, or is there no value in that?
-Daniel
Quoted 10 lines
Quoted 4 lines
* PATH:
* Connector path property to identify how this sink is physically
* connected. Used by DP MST. This should be set by calling--
Regards,Laurent Pinchart
Signature · 7 lines
Daniel Vetter Software Engineer, Intel Corporation +41 (0) 79 365 57 48 - http://blog.ffwll.ch _______________________________________________ dri-devel mailing list [email protected] https://lists.freedesktop.org/mailman/listinfo/dri-devel
Quoted 16 lines · Daniel Vetter
Laurent asked for this.
Cc Laurent Pinchart <[email protected]>Signed-off-by Daniel Vetter <[email protected]>--- drivers/gpu/drm/drm_connector.c | 19 +++++++++++++++++++ 1 file changed, 19 insertions(+)drivers/gpu/drm/drm_connector.c +0
-0@@ -720,6 +720,25 @@ DRM_ENUM_NAME_FN(drm_get_tv_subconnector_name,* callback. For atomic drivers the remapping to the "ACTIVE" property is * implemented in the DRM core. This is the only standard connector * property that userspace can change.
drivers/gpu/drm/drm_connector.c DRM_ENUM_NAME_FN(drm_get_tv_subconnector_name, · line 732
Quoted 10 lines
drivers/gpu/drm/drm_connector.c +10
-0+* +* WARNING: +* +* For userspace also running on legacy drivers the "DPMS" semantics are a +* lot more complicated. First, userspace cannot rely on the "DPMS" value +* returned by the GETCONNECTOR actually reflecting reality, because many +* drivers fail to update it. For atomic drivers this is taken care of in +* drm_atomic_helper_update_legacy_modeset_state(). +* +* The second issue is that the DPMS state is only relevant when the
s/relevant/defined/ maybe?
drivers/gpu/drm/drm_connector.c DRM_ENUM_NAME_FN(drm_get_tv_subconnector_name, · line 734
Quoted 2 lines
drivers/gpu/drm/drm_connector.c +2
-0+* connector is connected to a CRTC. In atomic the DRM core enforces that +* "ACTIVE" is off in such a case, no such checks exists for "DPMS".
Maybe another newline here?
drivers/gpu/drm/drm_connector.c DRM_ENUM_NAME_FN(drm_get_tv_subconnector_name, · line 737
Quoted 3 lines
drivers/gpu/drm/drm_connector.c +3
-0+* Finally, when enabling an output using the legacy SETCONFIG ioctl then +* "DPMS" is forced to ON. But see above, that might not be reflected in +* the software value.
Maybe add " on legacy drivers"?
drivers/gpu/drm/drm_connector.c DRM_ENUM_NAME_FN(drm_get_tv_subconnector_name, · line 740
Quoted 3 lines
drivers/gpu/drm/drm_connector.c +3
-0+* +* Summarizing: Only set "DPMS" when the connector is known to be enabled, +* assume that a successful SETCONFIG call also set "DPMS" to on, and never
"also sets"
drivers/gpu/drm/drm_connector.c DRM_ENUM_NAME_FN(drm_get_tv_subconnector_name, · line 741
Quoted 1 line
drivers/gpu/drm/drm_connector.c +1
-0+* read back the value of "DPMS" because it can be incorrect.
With whatever set of my suggestions you like,
_______________________________________________
dri-devel mailing list
[email protected]
https://lists.freedesktop.org/mailman/listinfo/dri-devel