drivers/video/fbdev/core/fbcon.c | 9 ++++++--- 1 file changed, 6 insertions(+), 3 deletions(-)
From: Lu Yao <yaolu@kylinos.cn>
Don't need to do suspend/resume for fbcon in graphic mode.
Doing this may cause error, eg:
At the beginning, starting the Xorg with single screen and then an
external screen was plugged in. After logging out in Xorg, fbdev
info may using screen which is connected later on for info always
using first connected connector in list in func 'drm_setup_crtcs_fb'.
Then, S3 executed, fbcon found that the information did not match
and do atomic to switch fb. However, Xorg will not re-bind the crtc
fb but continues doing ioctl. At this time, the fb is incorrect.
Signed-off-by: Lu Yao <yaolu@kylinos.cn>
---
drivers/video/fbdev/core/fbcon.c | 9 ++++++---
1 file changed, 6 insertions(+), 3 deletions(-)
diff --git a/drivers/video/fbdev/core/fbcon.c b/drivers/video/fbdev/core/fbcon.c
index b0e3e765360d..450e690d0bd2 100644
--- a/drivers/video/fbdev/core/fbcon.c
+++ b/drivers/video/fbdev/core/fbcon.c
@@ -2602,8 +2602,9 @@ void fbcon_suspended(struct fb_info *info)
return;
vc = vc_cons[par->currcon].d;
- /* Clear cursor, restore saved data */
- fbcon_cursor(vc, false);
+ /* Don't need to clear cursor and restore saved data in graphic mode */
+ if (vc->vc_mode != KD_GRAPHICS)
+ fbcon_cursor(vc, false);
}
void fbcon_resumed(struct fb_info *info)
@@ -2615,7 +2616,9 @@ void fbcon_resumed(struct fb_info *info)
return;
vc = vc_cons[par->currcon].d;
- update_screen(vc);
+ /* Graphics mode is managed by userspace */
+ if (vc->vc_mode != KD_GRAPHICS)
+ update_screen(vc);
}
static void fbcon_modechanged(struct fb_info *info)
--
2.25.1
Hello Lu, On 4/30/26 08:01, yaolu@kylinos.cn wrote: > From: Lu Yao <yaolu@kylinos.cn> > > Don't need to do suspend/resume for fbcon in graphic mode. > > Doing this may cause error, eg: > At the beginning, starting the Xorg with single screen and then an > external screen was plugged in. After logging out in Xorg, fbdev > info may using screen which is connected later on for info always > using first connected connector in list in func 'drm_setup_crtcs_fb'. > Then, S3 executed, fbcon found that the information did not match > and do atomic to switch fb. However, Xorg will not re-bind the crtc > fb but continues doing ioctl. At this time, the fb is incorrect. Do you still have the possibility to test this issue? > Signed-off-by: Lu Yao <yaolu@kylinos.cn> > --- > drivers/video/fbdev/core/fbcon.c | 9 ++++++--- > 1 file changed, 6 insertions(+), 3 deletions(-) > > diff --git a/drivers/video/fbdev/core/fbcon.c b/drivers/video/fbdev/core/fbcon.c > index b0e3e765360d..450e690d0bd2 100644 > --- a/drivers/video/fbdev/core/fbcon.c > +++ b/drivers/video/fbdev/core/fbcon.c > @@ -2602,8 +2602,9 @@ void fbcon_suspended(struct fb_info *info) > return; > vc = vc_cons[par->currcon].d; > > - /* Clear cursor, restore saved data */ > - fbcon_cursor(vc, false); > + /* Don't need to clear cursor and restore saved data in graphic mode */ > + if (vc->vc_mode != KD_GRAPHICS) > + fbcon_cursor(vc, false); I think checking for "== KD_TEXT" is probably better. And, maybe using con_is_visible(vc). So: + if (con_is_visible(vc) && (vc->vc_mode == KD_TEXT)) + fbcon_cursor(vc, false); > void fbcon_resumed(struct fb_info *info) > @@ -2615,7 +2616,9 @@ void fbcon_resumed(struct fb_info *info) > return; > vc = vc_cons[par->currcon].d; > > - update_screen(vc); > + /* Graphics mode is managed by userspace */ > + if (vc->vc_mode != KD_GRAPHICS) here the same check as above... ? Helge
On 2026/5/19 16:10, Helge Deller wrote: Hello Helge, > Hello Lu, > > On 4/30/26 08:01, yaolu@kylinos.cn wrote: >> From: Lu Yao <yaolu@kylinos.cn> >> >> Don't need to do suspend/resume for fbcon in graphic mode. > > Do you still have the possibility to test this issue? > Yes, I still can test this issue.Do you have any other items to test? > >> Signed-off-by: Lu Yao <yaolu@kylinos.cn> >> --- >> drivers/video/fbdev/core/fbcon.c | 9 ++++++--- >> 1 file changed, 6 insertions(+), 3 deletions(-) >> >> diff --git a/drivers/video/fbdev/core/fbcon.c b/drivers/video/fbdev/core/fbcon.c >> index b0e3e765360d..450e690d0bd2 100644 >> --- a/drivers/video/fbdev/core/fbcon.c >> +++ b/drivers/video/fbdev/core/fbcon.c >> @@ -2602,8 +2602,9 @@ void fbcon_suspended(struct fb_info *info) >> return; >> vc = vc_cons[par->currcon].d; >> - /* Clear cursor, restore saved data */ >> - fbcon_cursor(vc, false); >> + /* Don't need to clear cursor and restore saved data in graphic mode */ >> + if (vc->vc_mode != KD_GRAPHICS) >> + fbcon_cursor(vc, false); > > I think checking for "== KD_TEXT" is probably better. > And, maybe using con_is_visible(vc). > So: > > + if (con_is_visible(vc) && (vc->vc_mode == KD_TEXT)) > + fbcon_cursor(vc, false); > It seems more reasonable. I'll submit a new patch soon. > > Helge Lu Yao
From: Lu Yao <yaolu@kylinos.cn>
Don't need to do suspend/resume for fbcon in graphic mode.
Doing this may cause error, eg:
At the beginning, starting the Xorg with single screen and then an
external screen was plugged in. After logging out in Xorg, fbdev
info may using screen which is connected later on for info always
using first connected connector in list in func 'drm_setup_crtcs_fb'.
Then, S3 executed, fbcon found that the information did not match
and do atomic to switch fb. However, Xorg will not re-bind the crtc
fb but continues doing ioctl. At this time, the fb is incorrect.
Signed-off-by: Lu Yao <yaolu@kylinos.cn>
---
v1->v2: change to '==KD_TEXT' rather than '!=KD_GRAPHICS' and add
visible judgement suggested by Helge.
Link: https://lore.kernel.org/all/67a1f756-996c-404b-8eff-f705ff151ed3@gmx.de
drivers/video/fbdev/core/fbcon.c | 9 ++++++---
1 file changed, 6 insertions(+), 3 deletions(-)
diff --git a/drivers/video/fbdev/core/fbcon.c b/drivers/video/fbdev/core/fbcon.c
index b0e3e765360d..ab460ba9264c 100644
--- a/drivers/video/fbdev/core/fbcon.c
+++ b/drivers/video/fbdev/core/fbcon.c
@@ -2602,8 +2602,9 @@ void fbcon_suspended(struct fb_info *info)
return;
vc = vc_cons[par->currcon].d;
- /* Clear cursor, restore saved data */
- fbcon_cursor(vc, false);
+ /* Only in TEXT mode and visible, need to clear cursor, restore saved data */
+ if ((vc->vc_mode == KD_TEXT) && con_is_visible(vc))
+ fbcon_cursor(vc, false);
}
void fbcon_resumed(struct fb_info *info)
@@ -2615,7 +2616,9 @@ void fbcon_resumed(struct fb_info *info)
return;
vc = vc_cons[par->currcon].d;
- update_screen(vc);
+ /* Graphics mode is managed by userspace */
+ if ((vc->vc_mode == KD_TEXT) && con_is_visible(vc))
+ update_screen(vc);
}
static void fbcon_modechanged(struct fb_info *info)
--
2.25.1
© 2016 - 2026 Red Hat, Inc.