Skip to contentSkip to conversation

drm/atomic-helper: Do not call ->mode_fixup for CRTC which will be disabled

PATCH In review Liu Ying 2 participants 3 messages May 27, 2016 – May 30, 2016

Subsystems (2)
lore
Share & tools
lore

Liu Ying

author
#0 lore raw

PATCH 1/1 drm/atomic-helper: Do not call ->mode_fixup for CRTC which will be disabled

When a CRTC is going to be disabled, it's state may contain a display mode with zeroed content. This could be reproduced by HDMI cable hotplug out operation with legacy fbdev support in dual display cases. It would confuse driver's CRTC callback ->mode_fixup and make the total state be rejected. So, let's don't call the callback for the CRTC.

---
 drivers/gpu/drm/drm_atomic_helper.c | 3 +++
 1 file changed, 3 insertions(+)
drivers/gpu/drm/drm_atomic_helper.c +3 -0
index ddfa0d1..939df90 100644
@@ -414,6 +414,9 @@ mode_fixup(struct drm_atomic_state *state)
 	for_each_crtc_in_state(state, crtc, crtc_state, i) {
 		const struct drm_crtc_helper_funcs *funcs;
 
+		if (!crtc_state->enable)
+			continue;
+
 		if (!crtc_state->mode_changed &&
 		    !crtc_state->connectors_changed)
 			continue;
Signature · 6 lines
2.7.4

_______________________________________________
dri-devel mailing list
[email protected]
https://lists.freedesktop.org/mailman/listinfo/dri-devel
#1 lore raw
Quoted 7 lines · Liu Ying

When a CRTC is going to be disabled, it's state may contain a display mode with zeroed content. This could be reproduced by HDMI cable hotplug out operation with legacy fbdev support in dual display cases. It would confuse driver's CRTC callback ->mode_fixup and make the total state be rejected. So, let's don't call the callback for the CRTC.

Indeed this matches behaviour for encoder/bridge mode_fixup functions. Patch merged to drm-misc.

A doc patch for the kernel doc of all the mode_fixup (and the encoder's atomic_check) that this is only called when enabling a mode would be awesome.
-Daniel

Quoted 25 lines
---
 drivers/gpu/drm/drm_atomic_helper.c | 3 +++
 1 file changed, 3 insertions(+)
drivers/gpu/drm/drm_atomic_helper.c +3 -0
index ddfa0d1..939df90 100644
@@ -414,6 +414,9 @@ mode_fixup(struct drm_atomic_state *state)
 	for_each_crtc_in_state(state, crtc, crtc_state, i) {
 		const struct drm_crtc_helper_funcs *funcs;
 
+		if (!crtc_state->enable)
+			continue;
+
 		if (!crtc_state->mode_changed &&
 		    !crtc_state->connectors_changed)
 			continue;
Signature · 6 lines
2.7.4

_______________________________________________
dri-devel mailing list
[email protected]
https://lists.freedesktop.org/mailman/listinfo/dri-devel
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
author
#2 lore raw
Quoted 7 lines · Daniel Vetter
Quoted 6 lines · Liu Ying

When a CRTC is going to be disabled, it's state may contain a display mode with zeroed content. This could be reproduced by HDMI cable hotplug out operation with legacy fbdev support in dual display cases. It would confuse driver's CRTC callback ->mode_fixup and make the total state be rejected. So, let's don't call the callback for the CRTC.

Quoted 8 lines
Quoted 1 line

Indeed this matches behaviour for encoder/bridge mode_fixup functions. Patch merged to drm-misc.

A doc patch for the kernel doc of all the mode_fixup (and the encoder's atomic_check) that this is only called when enabling a mode would be awesome.

I'll write one.

Regards,
Liu Ying

Quoted 23 lines

-Daniel

Quoted 21 lines
---
 drivers/gpu/drm/drm_atomic_helper.c | 3 +++
 1 file changed, 3 insertions(+)
drivers/gpu/drm/drm_atomic_helper.c +3 -1
index ddfa0d1..939df90 100644
@@ -414,6 +414,9 @@ mode_fixup(struct drm_atomic_state *state)
      for_each_crtc_in_state(state, crtc, crtc_state, i) {
              const struct drm_crtc_helper_funcs *funcs;
 
+             if (!crtc_state->enable)
+                     continue;
+
              if (!crtc_state->mode_changed &&
                  !crtc_state->connectors_changed)
                      continue;
--

2.7.4

Quoted 9 lines
Quoted 4 lines

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

--
Daniel Vetter
Software Engineer, Intel Corporation
http://blog.ffwll.ch

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