Hi
Am 13.11.26 um 12:07 schrieb Angelo Compagnucci:
With a shadow buffer, what userspace draws in fbdev reaches the
framebuffer memory only when the damage worker runs. Turning the display
on shows the framebuffer memory as it is. So a program that draws its
first picture and then unblanks, such as a boot splash, shows an older
picture for a moment.
Seen on an ILI9341 panel (tinydrm ili9341): enabling the pipe sends the
whole framebuffer memory to the panel, still black, and the splash only
replaces it once the damage worker runs.
Nothing can be flushed to a display that is off. But the copy from the
shadow buffer into the framebuffer memory does not need the display. On
unblank, copy the whole shadow buffer into the framebuffer memory before
turning the display on. The damage worker still flushes the damage once
the display is on.
Signed-off-by: Angelo Compagnucci <[email protected]>
---
Changes v1 -> v2:
- Do not flush the damage before unblanking: nothing can reach a
display that is off. Instead, in fbdev-dma, copy the whole shadow
buffer into the framebuffer memory on unblank, which needs no
display [Thomas Zimmermann]
That's not really the issue. There's hardware/drivers where we need the
CRTC to be switched on before we can transfer display data. Search
drm_atomic_helper_commit_tail_rpm() [1] for that. IDK how much of a
problem this is in practice. Flushing buffers on such a system might
give actual errors instead of just some temporary display noise.
What exactly are you trying to achieve?
[1]
https://elixir.bootlin.com/linux/v7.3.1/source/drivers/gpu/drm/drm_atomic_helper.c#L2009
Best regards
Thomas
- The fbdev helpers are unchanged, so the title changed too; v1 was
"drm/fb-helper: flush damage before unblanking"
drivers/gpu/drm/drm_fbdev_dma.c | 44 ++++++++++++++++++++++++++-------
1 file changed, 35 insertions(+), 9 deletions(-)
diff --git a/drivers/gpu/drm/drm_fbdev_dma.c b/drivers/gpu/drm/drm_fbdev_dma.c
index 452f84400350..cc8813538bd9 100644
--- a/drivers/gpu/drm/drm_fbdev_dma.c
+++ b/drivers/gpu/drm/drm_fbdev_dma.c
@@ -93,15 +93,6 @@ static void drm_fbdev_dma_shadowed_fb_destroy(struct fb_info
*info)
drm_client_release(&fb_helper->client);
}
-static const struct fb_ops drm_fbdev_dma_shadowed_fb_ops = {
- .owner = THIS_MODULE,
- .fb_open = drm_fbdev_dma_fb_open,
- .fb_release = drm_fbdev_dma_fb_release,
- FB_DEFAULT_DEFERRED_OPS(drm_fbdev_dma_shadowed),
- DRM_FB_HELPER_DEFAULT_OPS,
- .fb_destroy = drm_fbdev_dma_shadowed_fb_destroy,
-};
-
/*
* struct drm_fb_helper
*/
@@ -196,6 +187,41 @@ static const struct drm_fb_helper_funcs
drm_fbdev_dma_helper_funcs = {
* struct drm_fb_helper
*/
+static int drm_fbdev_dma_shadowed_fb_blank(int blank, struct fb_info *info)
+{
+ struct drm_fb_helper *fb_helper = info->par;
+ struct drm_clip_rect clip = {
+ .x2 = fb_helper->fb->width,
+ .y2 = fb_helper->fb->height,
+ };
+
+ /*
+ * Turning the display on shows the framebuffer memory. Copy the
+ * shadow buffer into it first, so it holds what was drawn. This
+ * does not need the display; the damage worker still flushes the
+ * damage once the display is on.
+ */
+ if (blank == FB_BLANK_UNBLANK)
+ drm_fbdev_dma_damage_blit(fb_helper, &clip);
+
+ return drm_fb_helper_blank(blank, info);
+}
+
+static const struct fb_ops drm_fbdev_dma_shadowed_fb_ops = {
+ .owner = THIS_MODULE,
+ .fb_open = drm_fbdev_dma_fb_open,
+ .fb_release = drm_fbdev_dma_fb_release,
+ FB_DEFAULT_DEFERRED_OPS(drm_fbdev_dma_shadowed),
+ /* DRM_FB_HELPER_DEFAULT_OPS, with a blank that copies the shadow */
+ .fb_check_var = drm_fb_helper_check_var,
+ .fb_set_par = drm_fb_helper_set_par,
+ .fb_setcmap = drm_fb_helper_setcmap,
+ .fb_blank = drm_fbdev_dma_shadowed_fb_blank,
+ .fb_pan_display = drm_fb_helper_pan_display,
+ .fb_ioctl = drm_fb_helper_ioctl,
+ .fb_destroy = drm_fbdev_dma_shadowed_fb_destroy,
+};
+
static int drm_fbdev_dma_driver_fbdev_probe_tail(struct drm_fb_helper
*fb_helper,
struct
drm_fb_helper_surface_size *sizes)
{
--
--
Thomas Zimmermann
Graphics Driver Developer
SUSE Software Solutions Germany GmbH
Frankenstr. 146, 90461 Nürnberg, Germany, www.suse.com
GF: Stefan Gaiser, Jochen Jaser, Abhinav Puri, (HRB 36809, AG Nürnberg)