Skip to contentSkip to conversation

drm: Do not allow to set NOFB for active primary plane

PATCH In review Stanislav Lisovskiy 3 participants 4 messages Apr 15, 2019

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

PATCH 1/1 drm: Do not allow to set NOFB for active primary plane

There was an issue reported from end users, confirmed also locally that when user executes xrandr --output <some DP> --rotate left/right, the other eDP screen gets blank after rotation.

Investigation showed that reason was that primary plane was that screen was for some reason disabled, while cursor plane was still enabled.
After some effort it turns out that userspace might wrongly assign NOFB to active primary plane for some reason.

Then this gets detected in drm_atomic_helper_check_plane_state, called from ->plane_check and plane gets deactivated, leaving the screen blank and cursor visible. This can be cured by reboot or xrandr off/on sequence for that crtc.

This patch is proposal to fix the issue by forbiding fb removal from active primary plane. If one needs to remove fb plane must be disabled first.

Not sure if this is correct, however it fixes the issue at least.

Bugzilla: https://bugs.freedesktop.org/show_bug.cgi?id=110375

---
 drivers/gpu/drm/drm_atomic_uapi.c | 9 +++++++++
 1 file changed, 9 insertions(+)
drivers/gpu/drm/drm_atomic_uapi.c +9 -0
index ea797d4c82ee..e2f078b302f3 100644
@@ -229,6 +229,15 @@ drm_atomic_set_fb_for_plane(struct drm_plane_state *plane_state,
 {
 	struct drm_plane *plane = plane_state->plane;
 
+	if (!fb) {
+		if (plane->state->visible && plane->type == DRM_PLANE_TYPE_PRIMARY) {
+			DRM_DEBUG_ATOMIC("Not allowed to set [NOFB] for active"
+					" primary [PLANE:%d:%s] - disable first",
+					plane->base.id, plane->name);
+			return;
+		}
+	}
+
 	if (fb)
 		DRM_DEBUG_ATOMIC("Set [FB:%d] for [PLANE:%d:%s] state %p\n",
 				 fb->base.id, plane->base.id, plane->name,
Signature · 6 lines
2.17.1

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

There was an issue reported from end users, confirmed also locally that when user executes xrandr --output <some DP> --rotate left/right, the other eDP screen gets blank after rotation.

Investigation showed that reason was that primary plane was that screen was for some reason disabled, while cursor plane was still enabled.
After some effort it turns out that userspace might wrongly assign NOFB to active primary plane for some reason.

Then this gets detected in drm_atomic_helper_check_plane_state, called from ->plane_check and plane gets deactivated, leaving the screen blank and cursor visible. This can be cured by reboot or xrandr off/on sequence for that crtc.

Quoted 5 lines

This patch is proposal to fix the issue by forbiding fb removal from active primary plane. If one needs to remove fb plane must be disabled first.

Not sure if this is correct, however it fixes the issue at least.

It is not. Removing the fb (and crtc) is how you disable a plane.

Quoted 12 lines

Bugzilla: https://bugs.freedesktop.org/show_bug.cgi?id=110375

---
 drivers/gpu/drm/drm_atomic_uapi.c | 9 +++++++++
 1 file changed, 9 insertions(+)
drivers/gpu/drm/drm_atomic_uapi.c +0 -0
index ea797d4c82ee..e2f078b302f3 100644

drivers/gpu/drm/drm_atomic_uapi.c drm_atomic_set_fb_for_plane(struct drm_plane_state *plane_state, · line 233

Quoted 5 lines
drivers/gpu/drm/drm_atomic_uapi.c +2 -0
@@ -229,6 +229,15 @@ drm_atomic_set_fb_for_plane(struct drm_plane_state *plane_state,
 {
 	struct drm_plane *plane = plane_state->plane;
 
+	if (!fb) {
+		if (plane->state->visible && plane->type == DRM_PLANE_TYPE_PRIMARY) {a

.visible is not even computed yet when this is called.

Quoted 17 lines
drivers/gpu/drm/drm_atomic_uapi.c +7 -0
+			DRM_DEBUG_ATOMIC("Not allowed to set [NOFB] for active"
+					" primary [PLANE:%d:%s] - disable first",
+					plane->base.id, plane->name);
+			return;
+		}
+	}
+
 	if (fb)
 		DRM_DEBUG_ATOMIC("Set [FB:%d] for [PLANE:%d:%s] state %p\n",
 				 fb->base.id, plane->base.id, plane->name,
Signature · 6 lines
2.17.1

_______________________________________________
dri-devel mailing list
[email protected]
https://lists.freedesktop.org/mailman/listinfo/dri-devel
Signature · 6 lines
Ville Syrjälä
Intel
_______________________________________________
dri-devel mailing list
[email protected]
https://lists.freedesktop.org/mailman/listinfo/dri-devel
#2 lore raw
Quoted 17 lines · Ville Syrjälä
Quoted 16 lines · Stanislav Lisovskiy

There was an issue reported from end users, confirmed also locally that when user executes xrandr --output <some DP> --rotate left/right, the other eDP screen gets blank after rotation.

Investigation showed that reason was that primary plane was that screen was for some reason disabled, while cursor plane was still enabled.
After some effort it turns out that userspace might wrongly assign NOFB to active primary plane for some reason.

Then this gets detected in drm_atomic_helper_check_plane_state, called from ->plane_check and plane gets deactivated, leaving the screen blank and cursor visible. This can be cured by reboot or xrandr off/on sequence for that crtc.

Quoted 7 lines
Quoted 5 lines

This patch is proposal to fix the issue by forbiding fb removal from active primary plane. If one needs to remove fb plane must be disabled first.

Not sure if this is correct, however it fixes the issue at least.

It is not. Removing the fb (and crtc) is how you disable a plane.

Ok, most likely this should be fixed in userspace then. As what I see
is that it removes FB from the primary plane for eDP, once we rotate
the other screen(why?), which is then turned off
in drm_atomic_helper_check_plane_state(!fb check) and then we have this
nice blank screen which you saw. If I prevent it somehow, theneverything works fine, however the origin of a problem seems to be in userspace.

Quoted 18 lines
Quoted 18 lines

Bugzilla: https://bugs.freedesktop.org/show_bug.cgi?id=110375

---
 drivers/gpu/drm/drm_atomic_uapi.c | 9 +++++++++
 1 file changed, 9 insertions(+)
drivers/gpu/drm/drm_atomic_uapi.c +0 -0
index ea797d4c82ee..e2f078b302f3 100644
@@ -229,6 +229,15 @@ drm_atomic_set_fb_for_plane(struct
 drm_plane_state *plane_state,
 {
 	struct drm_plane *plane = plane_state->plane;
 
Quoted 29 lines
Quoted 3 lines
drivers/gpu/drm/drm_atomic_uapi.c +2 -0
+	if (!fb) {
+		if (plane->state->visible && plane->type ==

DRM_PLANE_TYPE_PRIMARY) {a

.visible is not even computed yet when this is called.

Quoted 21 lines
drivers/gpu/drm/drm_atomic_uapi.c +1 -0
+			DRM_DEBUG_ATOMIC("Not allowed to set [NOFB] for

active"

drivers/gpu/drm/drm_atomic_uapi.c +1 -0
+					" primary [PLANE:%d:%s] -

disable first",

drivers/gpu/drm/drm_atomic_uapi.c +5 -0
+					plane->base.id, plane->name);
+			return;
+		}
+	}
+
 	if (fb)
 		DRM_DEBUG_ATOMIC("Set [FB:%d] for [PLANE:%d:%s] state

%p\n",
fb->base.id, plane->base.id, plane-

Quoted 1 line

name,

Signature · 6 lines
2.17.1

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

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

#3 lore raw
Quoted 24 lines · Stanislav
Quoted 23 lines · Ville Syrjälä
Quoted 21 lines · Stanislav Lisovskiy

There was an issue reported from end users, confirmed also locally that when user executes xrandr --output <some DP> --rotate left/right, the other eDP screen gets blank after rotation.

Investigation showed that reason was that primary plane was that screen was for some reason disabled, while cursor plane was still enabled.
After some effort it turns out that userspace might wrongly assign NOFB to active primary plane for some reason.

Then this gets detected in drm_atomic_helper_check_plane_state, called from ->plane_check and plane gets deactivated, leaving the screen blank and cursor visible. This can be cured by reboot or xrandr off/on sequence for that crtc.

This patch is proposal to fix the issue by forbiding fb removal from active primary plane. If one needs to remove fb plane must be disabled first.

Not sure if this is correct, however it fixes the issue at least.

Quoted 7 lines
Quoted 1 line

It is not. Removing the fb (and crtc) is how you disable a plane.

Ok, most likely this should be fixed in userspace then. As what I see
is that it removes FB from the primary plane for eDP, once we rotate
the other screen(why?), which is then turned off
in drm_atomic_helper_check_plane_state(!fb check) and then we have this
nice blank screen which you saw. If I prevent it somehow, theneverything works fine, however the origin of a problem seems to be in userspace.

If it's an RMFB, then the fallback for rejecting this config is to disable the entire CRTC. Which might trigger some hotplug action in userspace somehow, papering over the issue.

But yeah, that's not really how it's supposed to be done, and we need to at least first understand what's going on before applying duct-tape. -Daniel

Quoted 48 lines
Quoted 48 lines
Quoted 21 lines

Bugzilla: https://bugs.freedesktop.org/show_bug.cgi?id=110375

---
 drivers/gpu/drm/drm_atomic_uapi.c | 9 +++++++++
 1 file changed, 9 insertions(+)
drivers/gpu/drm/drm_atomic_uapi.c +2 -0
index ea797d4c82ee..e2f078b302f3 100644
@@ -229,6 +229,15 @@ drm_atomic_set_fb_for_plane(struct
 drm_plane_state *plane_state,
 {
 	struct drm_plane *plane = plane_state->plane;
 
+	if (!fb) {
+		if (plane->state->visible && plane->type ==
Quoted 1 line

DRM_PLANE_TYPE_PRIMARY) {a

.visible is not even computed yet when this is called.

Quoted 21 lines
drivers/gpu/drm/drm_atomic_uapi.c +1 -0
+			DRM_DEBUG_ATOMIC("Not allowed to set [NOFB] for

active"

drivers/gpu/drm/drm_atomic_uapi.c +1 -0
+					" primary [PLANE:%d:%s] -

disable first",

drivers/gpu/drm/drm_atomic_uapi.c +5 -0
+					plane->base.id, plane->name);
+			return;
+		}
+	}
+
 	if (fb)
 		DRM_DEBUG_ATOMIC("Set [FB:%d] for [PLANE:%d:%s] state

%p\n",
fb->base.id, plane->base.id, plane-

Quoted 1 line

name,

Signature · 6 lines
2.17.1

_______________________________________________
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