Re: [PATCH] drm: Fix fbcon blank on QEMU graphics drivers

From: Takashi Iwai
Date: Tue Apr 20 2021 - 12:41:05 EST


On Fri, 16 Apr 2021 20:30:05 +0200,
Daniel Vetter wrote:
>
> On Fri, Apr 16, 2021 at 2:53 PM Takashi Iwai <tiwai@xxxxxxx> wrote:
> >
> > Currently the DRM fbcon helper for console blank,
> > drm_fb_helper_blank(), simply calls drm_fb_helper_dpms() and always
> > returns zero, supposing the driver dealing with DPMS or atomic
> > crtc->active flip to handle blanking the screen. It works on most of
> > devices, but broken on most of KVM/QEMU graphics: bochs, qxl and
> > cirrus drivers just ignore crtc->active state change as blanking (or
> > cirrus ignoring DPMS). In practice, when you run like
> > % setterm --blank force
> > on a VT console, the screen freezes without actually blanking.
> >
> > A simple fix for this problem would be not to rely on DPMS but let
> > fbcon performs the generic blank code. This can be achieved just by
> > returning an error from drm_fb_helper_blank().
> >
> > In this patch, we add a flag, no_dpms_blank, to drm_fb_helper for
> > indicating that the driver doesn't handle blank via DPMS or
> > crtc->active flip. When this flag is set, drm_fb_helper_blank()
> > simply returns an error, so that fbcon falls back to its generic blank
> > handler. The flag is set to both bochs and qxl drivers in this patch,
> > while cirrus is left untouched as it's declared as to-be-deprecated.
> >
> > Link: https://lore.kernel.org/dri-devel/20170726205636.19144-1-tiwai@xxxxxxx/
> > BugLink: https://bugzilla.suse.com/show_bug.cgi?id=1095700
> > Signed-off-by: Takashi Iwai <tiwai@xxxxxxx>
>
> Uh we're supposed to fix these drivers to actually blank (scan out
> black, worst case), not paper over it in higher levels. Atomic kms is
> meant to be a somewhat useful abstraction. So now fbcon blanks, but
> your desktop still just freezes.
>
> > ---
> >
> > Here I whip a dead horse again, revisiting the long-standing issue
> > stated in the previous patch set in 2017:
> > https://lore.kernel.org/dri-devel/20170726205636.19144-1-tiwai@xxxxxxx/
> >
> > I thought to refresh the previous patch set at first, but it seems
> > invalid for the atomic modeset case. And for the atomic, it's even
> > more difficult to propagate the return from the bottom to up.
> > So I ended up with this approach as it's much simpler.
>
> Yeah that's because atomic assume you can at least blank your screen to black.

OK, then there is no other way than fixing those drivers to deal with
the blanking...

I cooked up an experimental patch for bochs, and will submit later.


thanks,

Takashi