Thank you for your contribution! Sashiko AI review found 1 potential
issue to consider:
- [Medium] drm/fbdev-dma: unaddressed v2 review on
  drm_fbdev_dma_shadowed_fb_blank()
--

commit 7dc07a1feeaa7bfcabe7b06bf9f13b3b3f41fd0e
Author: Angelo Compagnucci <[email protected]>

drm/fbdev-dma: Copy the shadow buffer on unblank

This commit adds a custom .fb_blank callback for shadowed fbdev-dma
framebuffers that copies the shadow buffer into the GEM DMA buffer on
FB_BLANK_UNBLANK before calling drm_fb_helper_blank().

> diff --git a/drivers/gpu/drm/drm_fbdev_dma.c b/drivers/gpu/drm/drm_fbdev_dma.c
> index 452f844003504..3effc5c05d9ce 100644
> --- a/drivers/gpu/drm/drm_fbdev_dma.c
> +++ b/drivers/gpu/drm/drm_fbdev_dma.c

[ ... ]

> @@ -196,6 +187,45 @@ 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.
> +      *
> +      * The copy takes a mutex, so skip it during an oops, where the
> +      * console is unblanked in atomic context. drm_fb_helper_blank()
> +      * does nothing then.
> +      */
> +     if (blank == FB_BLANK_UNBLANK && !oops_in_progress)
> +             drm_fbdev_dma_damage_blit(fb_helper, &clip);
> +
> +     return drm_fb_helper_blank(blank, info);
> +}

[Severity: Medium]
As reported by Thomas Zimmermann on v2 [1], does this comment and the
commit message accurately describe how unblanking and damage flushing
interact here?

In v2, Thomas Zimmermann noted in response to the v1 -> v2 changelog entry
that some hardware and drivers require the CRTC to be enabled before
display data can be transferred (as in drm_atomic_helper_commit_tail_rpm()),
and asked what problem this change is trying to solve.

In addition, on MIPI DBI drivers such as ili9341,
drm_fb_helper_blank(FB_BLANK_UNBLANK) -> drm_fb_helper_dpms() ->
drm_client_modeset_commit_atomic() enables the CRTC and immediately
commits the active planes with full-frame damage, which transfers the GEM
DMA buffer to the panel during drm_fb_helper_blank() itself rather than
waiting for the damage worker. If FB_BLANK_UNBLANK is called while
deferred I/O work is still pending, drm_fbdev_dma_shadowed_fb_blank()
copies the shadow buffer and the modeset flushes the full frame to the
panel, and then drm_fb_helper_damage_work() runs afterward and copies and
flushes the damaged area a second time.

[1] https://lore.kernel.org/r/[email protected]

-- 
Sashiko AI review ยท 
https://sashiko.dev/#/patchset/[email protected]?part=1

Reply via email to