Skip to contentSkip to conversation

drm/exynos: only run atomic_check() if crtc is active

PATCH In review Gustavo Padovan 4 participants 6 messages Nov 12, 2015 – Nov 20, 2015

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

PATCH 1/1 drm/exynos: only run atomic_check() if crtc is active

From: Gustavo Padovan <[email protected]>

Fixes an regression added by 3ae2436 (drm/exynos/mixer: replace direct cross-driver call with drm mode). The whole atomic update was failing if the hdmi display is not present/active. Add a test to only run atomic_check() if the CRTC is active.

---
 drivers/gpu/drm/exynos/exynos_drm_crtc.c | 3 +++
 1 file changed, 3 insertions(+)
drivers/gpu/drm/exynos/exynos_drm_crtc.c +3 -0
index b3ba27f..1d3ca0a 100644
@@ -55,6 +55,9 @@ static int exynos_crtc_atomic_check(struct drm_crtc *crtc,
 {
 	struct exynos_drm_crtc *exynos_crtc = to_exynos_crtc(crtc);
 
+	if (!state->active)
+		return 0;
+
 	if (exynos_crtc->ops->atomic_check)
 		return exynos_crtc->ops->atomic_check(exynos_crtc, state);
 
Signature · 6 lines
2.1.0

_______________________________________________
dri-devel mailing list
[email protected]
http://lists.freedesktop.org/mailman/listinfo/dri-devel
#1 lore raw
Quoted 17 lines · Gustavo Padovan

From: Gustavo Padovan <[email protected]>

Fixes an regression added by 3ae2436 (drm/exynos/mixer: replace direct cross-driver call with drm mode). The whole atomic update was failing if the hdmi display is not present/active. Add a test to only run atomic_check() if the CRTC is active.

---
 drivers/gpu/drm/exynos/exynos_drm_crtc.c | 3 +++
 1 file changed, 3 insertions(+)
drivers/gpu/drm/exynos/exynos_drm_crtc.c +0 -0
index b3ba27f..1d3ca0a 100644

drivers/gpu/drm/exynos/exynos_drm_crtc.c static int exynos_crtc_atomic_check(struct drm_crtc *crtc, · line 63

Quoted 9 lines
drivers/gpu/drm/exynos/exynos_drm_crtc.c +3 -0
@@ -55,6 +55,9 @@ static int exynos_crtc_atomic_check(struct drm_crtc *crtc,
 {
 	struct exynos_drm_crtc *exynos_crtc = to_exynos_crtc(crtc);
 
+	if (!state->active)
+		return 0;
+
 	if (exynos_crtc->ops->atomic_check)
 		return exynos_crtc->ops->atomic_check(exynos_crtc, state);
 

This looks like something that the core should be doing.

Thierry

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

#2 lore raw
Quoted 21 lines · Thierry Reding
Quoted 20 lines · Gustavo Padovan

From: Gustavo Padovan <[email protected]>

Fixes an regression added by 3ae2436 (drm/exynos/mixer: replace direct cross-driver call with drm mode). The whole atomic update was failing if the hdmi display is not present/active. Add a test to only run atomic_check() if the CRTC is active.

---
 drivers/gpu/drm/exynos/exynos_drm_crtc.c | 3 +++
 1 file changed, 3 insertions(+)
drivers/gpu/drm/exynos/exynos_drm_crtc.c +0 -0
index b3ba27f..1d3ca0a 100644
@@ -55,6 +55,9 @@ static int exynos_crtc_atomic_check(struct drm_crtc *crtc,
 {
 	struct exynos_drm_crtc *exynos_crtc = to_exynos_crtc(crtc);
 
Quoted 8 lines

drivers/gpu/drm/exynos/exynos_drm_crtc.c static int exynos_crtc_atomic_check(struct drm_crtc *crtc, · line 63

Quoted 6 lines
drivers/gpu/drm/exynos/exynos_drm_crtc.c +3 -0
+	if (!state->active)
+		return 0;
+
 	if (exynos_crtc->ops->atomic_check)
 		return exynos_crtc->ops->atomic_check(exynos_crtc, state);
 

This looks like something that the core should be doing.

Nah, this is a bug in exynos atomic_check code. Drivers _must_ check state irrespective of state->active - if they forgoe any checking when active = false then legacy DPMS On might spuriuosly fail, which will upset userspace. There shouldn't be any exceptions to this rule.

Cheers, Daniel

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

Hi Daniel,

Quoted 31 lines · Daniel Vetter
Quoted 21 lines · Thierry Reding
Quoted 20 lines · Gustavo Padovan

From: Gustavo Padovan <[email protected]>

Fixes an regression added by 3ae2436 (drm/exynos/mixer: replace direct cross-driver call with drm mode). The whole atomic update was failing if the hdmi display is not present/active. Add a test to only run atomic_check() if the CRTC is active.

---
 drivers/gpu/drm/exynos/exynos_drm_crtc.c | 3 +++
 1 file changed, 3 insertions(+)
drivers/gpu/drm/exynos/exynos_drm_crtc.c +0 -0
index b3ba27f..1d3ca0a 100644
@@ -55,6 +55,9 @@ static int exynos_crtc_atomic_check(struct drm_crtc *crtc,
 {
 	struct exynos_drm_crtc *exynos_crtc = to_exynos_crtc(crtc);
 
Quoted 8 lines

drivers/gpu/drm/exynos/exynos_drm_crtc.c static int exynos_crtc_atomic_check(struct drm_crtc *crtc, · line 63

Quoted 6 lines
drivers/gpu/drm/exynos/exynos_drm_crtc.c +3 -0
+	if (!state->active)
+		return 0;
+
 	if (exynos_crtc->ops->atomic_check)
 		return exynos_crtc->ops->atomic_check(exynos_crtc, state);
 

This looks like something that the core should be doing.

Quoted 7 lines

Nah, this is a bug in exynos atomic_check code. Drivers _must_ check state irrespective of state->active - if they forgoe any checking when active = false then legacy DPMS On might spuriuosly fail, which will upset userspace. There shouldn't be any exceptions to this rule.

Cheers, Daniel

What about the situation when we have two display pipelines with separate crtcs:
- one for panel, fimd->dsi->panel,
- one for hdmi, mixer->hdmi->TV.

Since TV is not connected mixer state have mode initially filled with zeros and active field set to 0. How should we handle situation if userspace tries to enable dpms on HDMI connector?
How should we handle situation userspace tries to start panel pipeline? In this case atomic_check for mixer is called also, but since it will not be used and its state will not be changed it should not return error, am I right?

Regards
Andrzej

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

#4 lore raw
Quoted 47 lines · Andrzej Hajda

Hi Daniel,

Quoted 31 lines · Daniel Vetter
Quoted 21 lines · Thierry Reding
Quoted 20 lines · Gustavo Padovan

From: Gustavo Padovan <[email protected]>

Fixes an regression added by 3ae2436 (drm/exynos/mixer: replace direct cross-driver call with drm mode). The whole atomic update was failing if the hdmi display is not present/active. Add a test to only run atomic_check() if the CRTC is active.

---
 drivers/gpu/drm/exynos/exynos_drm_crtc.c | 3 +++
 1 file changed, 3 insertions(+)
drivers/gpu/drm/exynos/exynos_drm_crtc.c +0 -0
index b3ba27f..1d3ca0a 100644
@@ -55,6 +55,9 @@ static int exynos_crtc_atomic_check(struct drm_crtc *crtc,
 {
 	struct exynos_drm_crtc *exynos_crtc = to_exynos_crtc(crtc);
 
Quoted 8 lines

drivers/gpu/drm/exynos/exynos_drm_crtc.c static int exynos_crtc_atomic_check(struct drm_crtc *crtc, · line 63

Quoted 6 lines
drivers/gpu/drm/exynos/exynos_drm_crtc.c +3 -0
+	if (!state->active)
+		return 0;
+
 	if (exynos_crtc->ops->atomic_check)
 		return exynos_crtc->ops->atomic_check(exynos_crtc, state);
 

This looks like something that the core should be doing.

Quoted 7 lines

Nah, this is a bug in exynos atomic_check code. Drivers _must_ check state irrespective of state->active - if they forgoe any checking when active = false then legacy DPMS On might spuriuosly fail, which will upset userspace. There shouldn't be any exceptions to this rule.

Cheers, Daniel

What about the situation when we have two display pipelines with separate crtcs:
- one for panel, fimd->dsi->panel,
- one for hdmi, mixer->hdmi->TV.

Quoted 7 lines

Since TV is not connected mixer state have mode initially filled with zeros and active field set to 0. How should we handle situation if userspace tries to enable dpms on HDMI connector?
How should we handle situation userspace tries to start panel pipeline? In this case atomic_check for mixer is called also, but since it will not be used and its state will not be changed it should not return error, am I right?

Check crtc_state->enable, skip if false. That's the "is this pipeline configured" knob. For plane/connector it's state->crtc, but with the same role.

I guess we could check that in the helpers, but we need to be careful to still call ->atomic_check for the disabling transition, in case userspace is asking for a vblank-synced flip that disables a plane but somehow that's not possible. I somewhat prefer to handle that all in drivers though.
-Daniel

Signature · 3 lines
Daniel Vetter
Software Engineer, Intel Corporation
http://blog.ffwll.ch
#5 lore raw

On 11/17/2015 05:12 PM, Daniel Vetter wrote:

(...)

Quoted 5 lines

Check crtc_state->enable, skip if false. That's the "is this pipeline configured" knob. For plane/connector it's state->crtc, but with the same role.

Quoted 7 lines

I guess we could check that in the helpers, but we need to be careful to still call ->atomic_check for the disabling transition, in case userspace is asking for a vblank-synced flip that disables a plane but somehow that's not possible. I somewhat prefer to handle that all in drivers though.
-Daniel

Thanks for the explanation, Gustavo will you update your patch?

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