Skip to contentSkip to conversation

drm: Try to document legacy DPMS uapi a bit better

PATCH Applied Daniel Vetter 3 participants 3 messages Sep 20, 2017 – Sep 26, 2017

Subsystems (2)
lore
Share & tools
lore
#0 lore raw

PATCH 1/1 drm: Try to document legacy DPMS uapi a bit better

Due to inconsistency of how various legacy drivers implemented DPMS the DPMS uabi has a lot of quirks. Atomic standardizes this, but drivers using the DPMS support can't rely on that since legacy drivers still exist.

Laurent asked for this.

v2:
Improve commit message and explain that DPMS doesn't really exist for the atomic ioctl (it's "ACTIVE" on the CRTC instead).

Text polish from Eric's review.

Cc Laurent Pinchart <[email protected]>
Cc Daniel Vetter <[email protected]>
Cc Jani Nikula <[email protected]>
Cc Sean Paul <[email protected]>
Cc David Airlie <[email protected]>
Cc Eric Anholt <[email protected]>
---
 drivers/gpu/drm/drm_connector.c | 23 +++++++++++++++++++++++
 1 file changed, 23 insertions(+)
drivers/gpu/drm/drm_connector.c +23 -0
index bb2e60f5feb6..d8ca526ca4ee 100644
@@ -719,6 +719,29 @@ 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.
+ *
+ * 	Note that this property cannot be set through the MODE_ATOMIC ioctl,
+ * 	userspace must use "ACTIVE" on the CRTC instead.
+ *
+ * 	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 well-defined 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 on legacy drivers.
+ *
+ * 	Summarizing: Only set "DPMS" when the connector is known to be enabled,
+ * 	assume that a successful SETCONFIG call also sets "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.9.5

_______________________________________________
dri-devel mailing list
[email protected]
https://lists.freedesktop.org/mailman/listinfo/dri-devel
Reviewed-by on v1 1/1
#1 lore raw
Quoted 13 lines · Daniel Vetter

Due to inconsistency of how various legacy drivers implemented DPMS the DPMS uabi has a lot of quirks. Atomic standardizes this, but drivers using the DPMS support can't rely on that since legacy drivers still exist.

Laurent asked for this.

v2:
Improve commit message and explain that DPMS doesn't really exist for the atomic ioctl (it's "ACTIVE" on the CRTC instead).

Text polish from Eric's review.

Quoted 8 lines
Cc Laurent Pinchart <[email protected]>
Cc Daniel Vetter <[email protected]>
Cc Jani Nikula <[email protected]>
Cc Sean Paul <[email protected]>
Cc David Airlie <[email protected]>
Cc Eric Anholt <[email protected]>

v2 is much better, IMO, thanks.

I'd recommend waiting for Laurent's R-b, but fwiw,

Quoted 39 lines
---
 drivers/gpu/drm/drm_connector.c | 23 +++++++++++++++++++++++
 1 file changed, 23 insertions(+)
drivers/gpu/drm/drm_connector.c +23 -1
index bb2e60f5feb6..d8ca526ca4ee 100644
@@ -719,6 +719,29 @@ 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.
+ *
+ *     Note that this property cannot be set through the MODE_ATOMIC ioctl,
+ *     userspace must use "ACTIVE" on the CRTC instead.
+ *
+ *     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 well-defined 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 on legacy drivers.
+ *
+ *     Summarizing: Only set "DPMS" when the connector is known to be enabled,
+ *     assume that a successful SETCONFIG call also sets "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
--
Quoted 2 lines

2.9.5

_______________________________________________
dri-devel mailing list
[email protected]
https://lists.freedesktop.org/mailman/listinfo/dri-devel

#2 lore raw
Quoted 23 lines · Sean Paul
Quoted 13 lines · Daniel Vetter

Due to inconsistency of how various legacy drivers implemented DPMS the DPMS uabi has a lot of quirks. Atomic standardizes this, but drivers using the DPMS support can't rely on that since legacy drivers still exist.

Laurent asked for this.

v2:
Improve commit message and explain that DPMS doesn't really exist for the atomic ioctl (it's "ACTIVE" on the CRTC instead).

Text polish from Eric's review.

Quoted 8 lines
Cc Laurent Pinchart <[email protected]>
Cc Daniel Vetter <[email protected]>
Cc Jani Nikula <[email protected]>
Cc Sean Paul <[email protected]>
Cc David Airlie <[email protected]>
Cc Eric Anholt <[email protected]>
Quoted 5 lines

v2 is much better, IMO, thanks.

I'd recommend waiting for Laurent's R-b, but fwiw,

Few days waiting, I'll fix it up with a follow-up if Laurent has more things for me to polish.

Applied, thanks for the reviews.
-Daniel

Quoted 42 lines
Quoted 42 lines
---
 drivers/gpu/drm/drm_connector.c | 23 +++++++++++++++++++++++
 1 file changed, 23 insertions(+)
drivers/gpu/drm/drm_connector.c +23 -1
index bb2e60f5feb6..d8ca526ca4ee 100644
@@ -719,6 +719,29 @@ 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.
+ *
+ *     Note that this property cannot be set through the MODE_ATOMIC ioctl,
+ *     userspace must use "ACTIVE" on the CRTC instead.
+ *
+ *     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 well-defined 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 on legacy drivers.
+ *
+ *     Summarizing: Only set "DPMS" when the connector is known to be enabled,
+ *     assume that a successful SETCONFIG call also sets "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
--

2.9.5

Signature · 7 lines
Daniel Vetter
Software Engineer, Intel Corporation
http://blog.ffwll.ch
_______________________________________________
dri-devel mailing list
[email protected]
https://lists.freedesktop.org/mailman/listinfo/dri-devel