From: Daniel Vetter <daniel@ffwll.ch>
To: Rodrigo Vivi <rodrigo.vivi@intel.com>
Cc: intel-gfx@lists.freedesktop.org, dri-devel@lists.freedesktop.org
Subject: Re: [PATCH 2/4] fbdev: Introduce fb_dirty operation.
Date: Tue, 30 Jun 2015 09:07:43 +0200 [thread overview]
Message-ID: <20150630070743.GH30960@phenom.ffwll.local> (raw)
In-Reply-To: <1435610686-2249-2-git-send-email-rodrigo.vivi@intel.com>
On Mon, Jun 29, 2015 at 01:44:44PM -0700, Rodrigo Vivi wrote:
> There are cases we need to mark dirty/damaged areas, specially with
> operations that touches frontbuffer directly. To cover these cases
> this patch introduces the optional fb_dirty operation.
>
> Signed-off-by: Rodrigo Vivi <rodrigo.vivi@intel.com>
The problem is that drm ->dirty() hook must be called from process context,
and iirc some of these callbacks can be called from softirq context (for
cursor updates).
Since this is a special drm requirement I think it'd be better to
implement this in the drm fbdev emulation (by wrapping the various cfb_*
functions). We'd also need to do the actual ->dirty() call in an async
worker. And that needs to check whether fbdev is still in charge or
whether the work item raced with a kms client.
For the async worker you can look into qxl_fb.c. Essentially you could
copy all these functions into drm_fb_helper.c, give them suitable prefixes
and in qxl_fb_work instead of calling qxl_fb_dirty_flush directly we'd
call ->dirty() on the fbdev fb through the generic vfunc hook.
That one is already implement and hooked up as
qxl_framebuffer_surface_dirty. We don't even need to grab any locks in the
worker since the normal DIRTYFB ioctl is also lockless.
-Daniel
> ---
> drivers/video/fbdev/core/cfbcopyarea.c | 3 +++
> drivers/video/fbdev/core/cfbfillrect.c | 3 +++
> drivers/video/fbdev/core/cfbimgblt.c | 4 ++++
> drivers/video/fbdev/core/syscopyarea.c | 3 +++
> drivers/video/fbdev/core/sysfillrect.c | 3 +++
> drivers/video/fbdev/core/sysimgblt.c | 4 ++++
> include/linux/fb.h | 3 +++
> 7 files changed, 23 insertions(+)
>
> diff --git a/drivers/video/fbdev/core/cfbcopyarea.c b/drivers/video/fbdev/core/cfbcopyarea.c
> index 6d4bfee..2e5b69f 100644
> --- a/drivers/video/fbdev/core/cfbcopyarea.c
> +++ b/drivers/video/fbdev/core/cfbcopyarea.c
> @@ -427,6 +427,9 @@ void cfb_copyarea(struct fb_info *p, const struct fb_copyarea *area)
> src_idx += bits_per_line;
> }
> }
> +
> + if (p->fbops->fb_dirty)
> + p->fbops->fb_dirty(p, dx, dy, width, height);
> }
>
> EXPORT_SYMBOL(cfb_copyarea);
> diff --git a/drivers/video/fbdev/core/cfbfillrect.c b/drivers/video/fbdev/core/cfbfillrect.c
> index ba9f58b..c8732d5 100644
> --- a/drivers/video/fbdev/core/cfbfillrect.c
> +++ b/drivers/video/fbdev/core/cfbfillrect.c
> @@ -362,6 +362,9 @@ void cfb_fillrect(struct fb_info *p, const struct fb_fillrect *rect)
> dst_idx += p->fix.line_length*8;
> }
> }
> +
> + if (p->fbops->fb_dirty)
> + p->fbops->fb_dirty(p, rect->dx, rect->dy, width, height);
> }
>
> EXPORT_SYMBOL(cfb_fillrect);
> diff --git a/drivers/video/fbdev/core/cfbimgblt.c b/drivers/video/fbdev/core/cfbimgblt.c
> index a2bb276..09c2dbe 100644
> --- a/drivers/video/fbdev/core/cfbimgblt.c
> +++ b/drivers/video/fbdev/core/cfbimgblt.c
> @@ -267,6 +267,7 @@ void cfb_imageblit(struct fb_info *p, const struct fb_image *image)
> u32 fgcolor, bgcolor, start_index, bitstart, pitch_index = 0;
> u32 bpl = sizeof(u32), bpp = p->var.bits_per_pixel;
> u32 width = image->width;
> + u32 height = image->height;
> u32 dx = image->dx, dy = image->dy;
> u8 __iomem *dst1;
>
> @@ -303,6 +304,9 @@ void cfb_imageblit(struct fb_info *p, const struct fb_image *image)
> start_index, pitch_index);
> } else
> color_imageblit(image, p, dst1, start_index, pitch_index);
> +
> + if (p->fbops->fb_dirty)
> + p->fbops->fb_dirty(p, dx, dy, width, height);
> }
>
> EXPORT_SYMBOL(cfb_imageblit);
> diff --git a/drivers/video/fbdev/core/syscopyarea.c b/drivers/video/fbdev/core/syscopyarea.c
> index c1eda31..3f74683 100644
> --- a/drivers/video/fbdev/core/syscopyarea.c
> +++ b/drivers/video/fbdev/core/syscopyarea.c
> @@ -360,6 +360,9 @@ void sys_copyarea(struct fb_info *p, const struct fb_copyarea *area)
> src_idx += bits_per_line;
> }
> }
> +
> + if (p->fbops->fb_dirty)
> + p->fbops->fb_dirty(p, dx, dy, width, height);
> }
>
> EXPORT_SYMBOL(sys_copyarea);
> diff --git a/drivers/video/fbdev/core/sysfillrect.c b/drivers/video/fbdev/core/sysfillrect.c
> index 33ee3d3..f2c3efa 100644
> --- a/drivers/video/fbdev/core/sysfillrect.c
> +++ b/drivers/video/fbdev/core/sysfillrect.c
> @@ -326,6 +326,9 @@ void sys_fillrect(struct fb_info *p, const struct fb_fillrect *rect)
> dst_idx += p->fix.line_length*8;
> }
> }
> +
> + if (p->fbops->fb_dirty)
> + p->fbops->fb_dirty(p, rect->dx, rect->dy, width, height);
> }
>
> EXPORT_SYMBOL(sys_fillrect);
> diff --git a/drivers/video/fbdev/core/sysimgblt.c b/drivers/video/fbdev/core/sysimgblt.c
> index a4d05b1..d690fb5 100644
> --- a/drivers/video/fbdev/core/sysimgblt.c
> +++ b/drivers/video/fbdev/core/sysimgblt.c
> @@ -243,6 +243,7 @@ void sys_imageblit(struct fb_info *p, const struct fb_image *image)
> u32 bpl = sizeof(u32), bpp = p->var.bits_per_pixel;
> u32 width = image->width;
> u32 dx = image->dx, dy = image->dy;
> + u32 height = image->height;
> void *dst1;
>
> if (p->state != FBINFO_STATE_RUNNING)
> @@ -278,6 +279,9 @@ void sys_imageblit(struct fb_info *p, const struct fb_image *image)
> start_index, pitch_index);
> } else
> color_imageblit(image, p, dst1, start_index, pitch_index);
> +
> + if (p->fbops->fb_dirty)
> + p->fbops->fb_dirty(p, dx, dy, width, height);
> }
>
> EXPORT_SYMBOL(sys_imageblit);
> diff --git a/include/linux/fb.h b/include/linux/fb.h
> index 043f328..e17e4b7 100644
> --- a/include/linux/fb.h
> +++ b/include/linux/fb.h
> @@ -284,6 +284,9 @@ struct fb_ops {
> /* wait for blit idle, optional */
> int (*fb_sync)(struct fb_info *info);
>
> + /* Mark rect as dirty (optional) */
> + void (*fb_dirty)(struct fb_info *info, u32 x1, u32 y1, u32 x2, u32 y2);
> +
> /* perform fb specific ioctl (optional) */
> int (*fb_ioctl)(struct fb_info *info, unsigned int cmd,
> unsigned long arg);
> --
> 2.1.0
>
> _______________________________________________
> Intel-gfx mailing list
> Intel-gfx@lists.freedesktop.org
> http://lists.freedesktop.org/mailman/listinfo/intel-gfx
--
Daniel Vetter
Software Engineer, Intel Corporation
http://blog.ffwll.ch
_______________________________________________
Intel-gfx mailing list
Intel-gfx@lists.freedesktop.org
http://lists.freedesktop.org/mailman/listinfo/intel-gfx
next prev parent reply other threads:[~2015-06-30 7:05 UTC|newest]
Thread overview: 11+ messages / expand[flat|nested] mbox.gz Atom feed top
2015-06-29 20:44 [PATCH 1/4] drm/i915: Make fb user dirty operation to invalidate frontbuffer Rodrigo Vivi
2015-06-29 20:44 ` [PATCH 2/4] fbdev: Introduce fb_dirty operation Rodrigo Vivi
2015-06-30 7:07 ` Daniel Vetter [this message]
2015-06-29 20:44 ` [PATCH 3/4] drm/udl: Use fb_dirty ops to simplify damage calls Rodrigo Vivi
2015-06-29 20:44 ` [PATCH 4/4] drm/i915: fbdev dirty calls fb user dirty to invalidate frontbuffer Rodrigo Vivi
2015-06-30 7:11 ` [Intel-gfx] " Daniel Vetter
2015-06-30 22:44 ` Rodrigo Vivi
2015-07-01 10:31 ` shuang.he
2015-06-29 21:36 ` [PATCH] " Rodrigo Vivi
2015-06-30 6:55 ` [Intel-gfx] [PATCH 1/4] drm/i915: Make fb user dirty operation " Daniel Vetter
2015-06-30 22:41 ` Rodrigo Vivi
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=20150630070743.GH30960@phenom.ffwll.local \
--to=daniel@ffwll.ch \
--cc=dri-devel@lists.freedesktop.org \
--cc=intel-gfx@lists.freedesktop.org \
--cc=rodrigo.vivi@intel.com \
/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 a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox