Hello,

I have an i.MX6 (i.e. etnaviv) device here with a legacy qt4 application
that I cannot discuss away (sorry!) that needs framebuffer emulation.
For this machine I wrote a program that is started as pid1, shows a
splash screen using drm, forks to keep the drm device open, and execs
/sbin/init in the parent.

Then the application initializes /dev/fb0 and kills the splash process,
resulting in closing the drm device and the display falls back to show
the content of /dev/fb0.

This fallback however comes with a short flicker because in the kernel
first the drm device is completely closed (by the call of

        drm_close_helper(filp);

in drm_release()) and only then the framebuffer takes over (by
drm_lastclose(dev) -> drm_client_dev_restore(dev) also in
drm_release()).

The flickering goes away for me here with the following change:

        diff --git a/drivers/gpu/drm/drm_file.c b/drivers/gpu/drm/drm_file.c
        index ea34bc991858..567983c1d137 100644
        --- a/drivers/gpu/drm/drm_file.c
        +++ b/drivers/gpu/drm/drm_file.c
        @@ -440,11 +440,11 @@ int drm_release(struct inode *inode, struct file 
*filp)
         
                DRM_DEBUG("open_count = %d\n", dev->open_count);
         
        -       drm_close_helper(filp);
        -
                if (!--dev->open_count)
                        drm_lastclose(dev);
         
        +       drm_close_helper(filp);
        +
                mutex_unlock(&drm_global_mutex);
         
                drm_minor_release(minor);

. I wonder if that could be done in general, or if this only works
because my setup is special (so for example the etnaviv driver doesn't
have a lastclose callback and also DRIVER_LEGACY isn't complicating
things for me).

If I'm not mistaken the fbdev emulation is the only driver implementing
a restore handler, so here are not so many options that must be cared
for and tested.

What do you think?

Best regards
Uwe

-- 
Pengutronix e.K.                           | Uwe Kleine-König            |
Industrial Linux Solutions                 | https://www.pengutronix.de/ |
_______________________________________________
dri-devel mailing list
dri-devel@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/dri-devel

Reply via email to