From: Magnus Damm <magnus.damm@gmail.com>
To: linux-fbdev-devel@lists.sourceforge.net
Cc: aliguori@us.ibm.com, adaplas@gmail.com, linux-sh@vger.kernel.org,
armbru@redhat.com, lethal@linux-sh.org,
Magnus Damm <magnus.damm@gmail.com>,
jayakumar.lkml@gmail.com
Subject: [PATCH 04/05] video: deferred io sys helpers - metronome V2
Date: Wed, 24 Dec 2008 17:30:18 +0900 [thread overview]
Message-ID: <20081224083018.1848.67243.sendpatchset@rx1.opensource.se> (raw)
In-Reply-To: <20081224082946.1848.46644.sendpatchset@rx1.opensource.se>
From: Magnus Damm <damm@igel.co.jp>
Change the metronome driver to use the new shared sys helpers. This
allows us to remove some duplicated code. The use of the new shared
sys helpers will change the behavior of this driver from syncing all
fillrect/copyarea/imageblit/write operations directly to using the
deferred io delay.
Signed-off-by: Magnus Damm <damm@igel.co.jp>
---
Changes since V1:
- added dirty area update comment
drivers/video/Kconfig | 4 -
drivers/video/metronomefb.c | 109 +++++++++----------------------------------
2 files changed, 24 insertions(+), 89 deletions(-)
--- 0004/drivers/video/Kconfig
+++ work/drivers/video/Kconfig 2008-12-24 16:33:39.000000000 +0900
@@ -2071,10 +2071,6 @@ config XEN_FBDEV_FRONTEND
config FB_METRONOME
tristate "E-Ink Metronome/8track controller support"
depends on FB
- select FB_SYS_FILLRECT
- select FB_SYS_COPYAREA
- select FB_SYS_IMAGEBLIT
- select FB_SYS_FOPS
select FB_DEFERRED_IO
help
This driver implements support for the E-Ink Metronome
--- 0001/drivers/video/metronomefb.c
+++ work/drivers/video/metronomefb.c 2008-12-24 16:41:55.000000000 +0900
@@ -445,7 +445,6 @@ static void metronomefb_dpy_update(struc
cksum = calc_img_cksum((u16 *) par->metromem_img, fbsize/2);
*((u16 *)(par->metromem_img) + fbsize/2) = cksum;
- metronome_display_cmd(par);
}
static u16 metronomefb_dpy_update_page(struct metronomefb_par *par, int index)
@@ -472,97 +471,37 @@ static void metronomefb_dpy_deferred_io(
struct fb_deferred_io *fbdefio = info->fbdefio;
struct metronomefb_par *par = info->par;
- /* walk the written page list and swizzle the data */
- list_for_each_entry(cur, &fbdefio->pagelist, lru) {
- cksum = metronomefb_dpy_update_page(par,
- (cur->index << PAGE_SHIFT));
- par->metromem_img_csum -= par->csum_table[cur->index];
- par->csum_table[cur->index] = cksum;
- par->metromem_img_csum += cksum;
+ /* force full screen update if dx is set or walk page list.
+ *
+ * normally, we need to update the dirty area pointed out by dx and
+ * plus all dirty pages. in this driver any dirty area pointed out
+ * by dx results in a full screen update. and since the entire screen
+ * is updated in that case we can skip walking the page list.
+ */
+ if (fbdefio->dx != -1) {
+ /* update the entire screen */
+ metronomefb_dpy_update(par);
+ } else {
+ /* walk the written page list and swizzle the data */
+ list_for_each_entry(cur, &fbdefio->pagelist, lru) {
+ cksum = metronomefb_dpy_update_page(par,
+ (cur->index << PAGE_SHIFT));
+ par->metromem_img_csum -= par->csum_table[cur->index];
+ par->csum_table[cur->index] = cksum;
+ par->metromem_img_csum += cksum;
+ }
}
metronome_display_cmd(par);
}
-static void metronomefb_fillrect(struct fb_info *info,
- const struct fb_fillrect *rect)
-{
- struct metronomefb_par *par = info->par;
-
- sys_fillrect(info, rect);
- metronomefb_dpy_update(par);
-}
-
-static void metronomefb_copyarea(struct fb_info *info,
- const struct fb_copyarea *area)
-{
- struct metronomefb_par *par = info->par;
-
- sys_copyarea(info, area);
- metronomefb_dpy_update(par);
-}
-
-static void metronomefb_imageblit(struct fb_info *info,
- const struct fb_image *image)
-{
- struct metronomefb_par *par = info->par;
-
- sys_imageblit(info, image);
- metronomefb_dpy_update(par);
-}
-
-/*
- * this is the slow path from userspace. they can seek and write to
- * the fb. it is based on fb_sys_write
- */
-static ssize_t metronomefb_write(struct fb_info *info, const char __user *buf,
- size_t count, loff_t *ppos)
-{
- struct metronomefb_par *par = info->par;
- unsigned long p = *ppos;
- void *dst;
- int err = 0;
- unsigned long total_size;
-
- if (info->state != FBINFO_STATE_RUNNING)
- return -EPERM;
-
- total_size = info->fix.smem_len;
-
- if (p > total_size)
- return -EFBIG;
-
- if (count > total_size) {
- err = -EFBIG;
- count = total_size;
- }
-
- if (count + p > total_size) {
- if (!err)
- err = -ENOSPC;
-
- count = total_size - p;
- }
-
- dst = (void __force *)(info->screen_base + p);
-
- if (copy_from_user(dst, buf, count))
- err = -EFAULT;
-
- if (!err)
- *ppos += count;
-
- metronomefb_dpy_update(par);
-
- return (err) ? err : count;
-}
-
static struct fb_ops metronomefb_ops = {
.owner = THIS_MODULE,
- .fb_write = metronomefb_write,
- .fb_fillrect = metronomefb_fillrect,
- .fb_copyarea = metronomefb_copyarea,
- .fb_imageblit = metronomefb_imageblit,
+ .fb_read = fb_deferred_io_read,
+ .fb_write = fb_deferred_io_write,
+ .fb_fillrect = fb_deferred_io_fillrect,
+ .fb_copyarea = fb_deferred_io_copyarea,
+ .fb_imageblit = fb_deferred_io_imageblit,
};
static struct fb_deferred_io metronomefb_defio = {
next prev parent reply other threads:[~2008-12-24 8:30 UTC|newest]
Thread overview: 7+ messages / expand[flat|nested] mbox.gz Atom feed top
2008-12-24 8:29 [PATCH 00/05] video: deferred io sys helpers V2 Magnus Damm
2008-12-24 8:29 ` [PATCH 01/05] video: deferred io sys helpers - core V2 Magnus Damm
2008-12-25 19:03 ` Jaya Kumar
2008-12-24 8:30 ` [PATCH 02/05] video: deferred io sys helpers - sh_mobile_lcdcfb V2 Magnus Damm
2008-12-24 8:30 ` [PATCH 03/05] video: deferred io sys helpers - hecuba / n411 V2 Magnus Damm
2008-12-24 8:30 ` Magnus Damm [this message]
2008-12-24 8:30 ` [PATCH 05/05] video: deferred io sys helpers - xen V2 Magnus Damm
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=20081224083018.1848.67243.sendpatchset@rx1.opensource.se \
--to=magnus.damm@gmail.com \
--cc=adaplas@gmail.com \
--cc=aliguori@us.ibm.com \
--cc=armbru@redhat.com \
--cc=jayakumar.lkml@gmail.com \
--cc=lethal@linux-sh.org \
--cc=linux-fbdev-devel@lists.sourceforge.net \
--cc=linux-sh@vger.kernel.org \
/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;
as well as URLs for NNTP newsgroup(s).