From: Daniel Vetter <daniel@ffwll.ch>
To: Thomas Zimmermann <tzimmermann@suse.de>
Cc: javierm@redhat.com, dri-devel@lists.freedesktop.org
Subject: Re: [PATCH 3/5] drm/fb-helper: Perform damage handling in deferred-I/O helper
Date: Fri, 11 Nov 2022 10:23:23 +0100 [thread overview]
Message-ID: <Y24UixFlqjEFkTZ/@phenom.ffwll.local> (raw)
In-Reply-To: <20221110135519.30029-4-tzimmermann@suse.de>
On Thu, Nov 10, 2022 at 02:55:17PM +0100, Thomas Zimmermann wrote:
> Call fb_dirty directly from drm_fb_helper_deferred_io() to avoid the
> latency of running the damage worker.
>
> The deferred-I/O helper drm_fb_helper_deferred_io() runs in a worker
> thread at regular intervals as part of writing to mmaped framebuffer
> memory. It used to schedule the fbdev damage worker to flush the
> framebuffer. Changing this to flushing the framebuffer directly avoids
> the latency introduced by the damage worker.
>
> Signed-off-by: Thomas Zimmermann <tzimmermann@suse.de>
> ---
> drivers/gpu/drm/drm_fb_helper.c | 32 ++++++++++++++++++++------------
> 1 file changed, 20 insertions(+), 12 deletions(-)
>
> diff --git a/drivers/gpu/drm/drm_fb_helper.c b/drivers/gpu/drm/drm_fb_helper.c
> index be8ecb5e50b56..ebc44ed1bf4a2 100644
> --- a/drivers/gpu/drm/drm_fb_helper.c
> +++ b/drivers/gpu/drm/drm_fb_helper.c
> @@ -644,10 +644,14 @@ static void drm_fb_helper_memory_range_to_clip(struct fb_info *info, off_t off,
> void drm_fb_helper_deferred_io(struct fb_info *info, struct list_head *pagereflist)
> {
> struct drm_fb_helper *helper = info->par;
> + struct drm_device *dev = helper->dev;
> unsigned long start, end, min_off, max_off;
> struct fb_deferred_io_pageref *pageref;
> struct drm_rect damage_area;
>
> + if (drm_WARN_ON(dev, !helper->funcs->fb_dirty))
> + return;
> +
> min_off = ULONG_MAX;
> max_off = 0;
> list_for_each_entry(pageref, pagereflist, list) {
> @@ -656,22 +660,26 @@ void drm_fb_helper_deferred_io(struct fb_info *info, struct list_head *pagerefli
> min_off = min(min_off, start);
> max_off = max(max_off, end);
> }
> - if (min_off >= max_off)
> - return;
>
> - if (helper->funcs->fb_dirty) {
The replacement of this if() with the drm_WARN_ON above looks like it's a
leftover from 93e81e38e197 ("drm/fb_helper: Minimize damage-helper
overhead"), which hasn't pulled the ->fb_dirty check all the way out
fully. It confused me quite a bit until I stitched the story together.
I think splitting this out would be best, but minimally explain this in
the commit message. Either way
Reviewed-by: Daniel Vetter <daniel.vetter@ffwll.ch>
> - /*
> - * As we can only track pages, we might reach beyond the end
> - * of the screen and account for non-existing scanlines. Hence,
> - * keep the covered memory area within the screen buffer.
> - */
> - max_off = min(max_off, info->screen_size);
> + /*
> + * As we can only track pages, we might reach beyond the end
> + * of the screen and account for non-existing scanlines. Hence,
> + * keep the covered memory area within the screen buffer.
> + */
> + max_off = min(max_off, info->screen_size);
>
> + if (min_off < max_off) {
> drm_fb_helper_memory_range_to_clip(info, min_off, max_off - min_off, &damage_area);
> - drm_fb_helper_damage(helper, damage_area.x1, damage_area.y1,
> - drm_rect_width(&damage_area),
> - drm_rect_height(&damage_area));
> + drm_fb_helper_add_damage_clip(helper, damage_area.x1, damage_area.y1,
> + drm_rect_width(&damage_area),
> + drm_rect_height(&damage_area));
> }
> +
> + /*
> + * Flushes all dirty pages from mmap's pageref list and the
> + * areas that have been written by struct fb_ops callbacks.
> + */
> + drm_fb_helper_fb_dirty(helper);
> }
> EXPORT_SYMBOL(drm_fb_helper_deferred_io);
>
> --
> 2.38.0
>
--
Daniel Vetter
Software Engineer, Intel Corporation
http://blog.ffwll.ch
next prev parent reply other threads:[~2022-11-11 9:23 UTC|newest]
Thread overview: 15+ messages / expand[flat|nested] mbox.gz Atom feed top
2022-11-10 13:55 [PATCH 0/5] drm/fb-helper: Remove damage worker Thomas Zimmermann
2022-11-10 13:55 ` [PATCH 1/5] drm/fb-helper: Set damage-clip area in helper Thomas Zimmermann
2022-11-11 9:15 ` Daniel Vetter
2022-11-10 13:55 ` [PATCH 2/5] drm/fb-helper: Move dirty-fb update into helper function Thomas Zimmermann
2022-11-11 9:18 ` Daniel Vetter
2022-11-10 13:55 ` [PATCH 3/5] drm/fb-helper: Perform damage handling in deferred-I/O helper Thomas Zimmermann
2022-11-11 9:23 ` Daniel Vetter [this message]
2022-11-10 13:55 ` [PATCH 4/5] drm/fb-helper: Schedule deferred-I/O worker after writing to framebuffer Thomas Zimmermann
2022-11-10 14:28 ` Daniel Vetter
2022-11-11 9:28 ` Daniel Vetter
2022-11-15 10:05 ` Thomas Zimmermann
2022-11-16 9:21 ` Daniel Vetter
2022-11-10 13:55 ` [PATCH 5/5] drm/fb-helper: Remove damage worker Thomas Zimmermann
2022-11-11 9:42 ` Daniel Vetter
2022-11-15 11:30 ` Thomas Zimmermann
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=Y24UixFlqjEFkTZ/@phenom.ffwll.local \
--to=daniel@ffwll.ch \
--cc=dri-devel@lists.freedesktop.org \
--cc=javierm@redhat.com \
--cc=tzimmermann@suse.de \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.