fbdev,mm: hecuba/E-Ink fbdev driver
Subsystems (3)
PATCH 1/1 fbdev,mm: hecuba/E-Ink fbdev driver
Hi James, Geert, lkml and mm,
This patch adds support for the Hecuba/E-Ink display with deferred IO. The changes from the previous version are to switch to using a mutex and lock_page. I welcome your feedback and advice.
---
drivers/video/Kconfig | 13 + drivers/video/Makefile | 1 drivers/video/hecubafb.c | 590 +++++++++++++++++++++++++++++++++++++++++++++++ mm/rmap.c | 1 4 files changed, 605 insertions(+)
---
drivers/video/Kconfig +13 -0
@@ -540,6 +540,19 @@ config FB_IMAC help This is the frame buffer device driver for the Intel-based Macintosh +config FB_HECUBA + tristate "Hecuba board support" + depends on FB && X86 && MMU + select FB_CFB_FILLRECT + select FB_CFB_COPYAREA + select FB_CFB_IMAGEBLIT + help + This enables support for the Hecuba board. This driver was tested + with an E-Ink 800x600 display and x86 SBCs through a 16 bit GPIO + interface (8 bit data, 4 bit control). If you anticpate using + this driver, say Y or M; otherwise say N. You must specify the + GPIO IO address to be used for setting control and data. + config FB_HGA tristate "Hercules mono graphics support" depends on FB && X86
drivers/video/Makefile +1 -0
@@ -65,6 +65,7 @@ obj-$(CONFIG_FB_SGIVW) += sgivwfb.o obj-$(CONFIG_FB_ACORN) += acornfb.o obj-$(CONFIG_FB_ATARI) += atafb.o obj-$(CONFIG_FB_MAC) += macfb.o +obj-$(CONFIG_FB_HECUBA) += hecubafb.o obj-$(CONFIG_FB_HGA) += hgafb.o obj-$(CONFIG_FB_IGA) += igafb.o obj-$(CONFIG_FB_APOLLO) += dnfb.o
drivers/video/hecubafb.c new file +590 -0
590 lines not on this page · raw message
mm/rmap.c +1 -0
@@ -496,6 +496,7 @@ int page_mkclean(struct page *page)return ret; } +EXPORT_SYMBOL_GPL (page_mkclean);/** * page_set_anon_rmap - setup new anonymous rmap
--
To unsubscribe, send a message with 'unsubscribe linux-mm' in the body to [email protected]. For more info on Linux MM,
see: http://www.linux-mm.org/ .
Don't email: <a href=mailto:"[email protected]"> [email protected] </a>
Quoted 1 line · Jaya Kumar
Hi James, Geert, lkml and mm,
Hi Jaya,
Quoted 3 lines
This patch adds support for the Hecuba/E-Ink display with deferred IO. The changes from the previous version are to switch to using a mutex and
lock_page. I welcome your feedback and advice.
This changelog ought to be a little more extensive; esp. because you're using these fancy new functions ->page_mkwrite() and page_mkclean() in a novel way.
Also, I'd still like to see a way to call msync() on the mmap'ed region to force a flush. I think providing a fb_fsync() method in fbmem.c and a hook down to the driver ought to work.
Also, you now seem to use a fixed 1 second delay, perhaps provide an ioctl or something to customize this?
And, as Andrew suggested last time around, could you perhaps push this fancy new idea into the FB layer so that more drivers can make us of it?
Quoted 5 lines · Peter Zijlstra
Quoted 1 line · Jaya Kumar
Hi James, Geert, lkml and mm,
Hi Jaya,
Quoted 7 lines
Quoted 3 lines
This patch adds support for the Hecuba/E-Ink display with deferred IO. The changes from the previous version are to switch to using a mutex and
lock_page. I welcome your feedback and advice.This changelog ought to be a little more extensive; esp. because you're using these fancy new functions ->page_mkwrite() and
page_mkclean()in a novel way.
Hi Peter,
I had put the comment explaining the usage of mkwrite/mkclean in the .c file. Oh, I see, in the changelog message. Ok, I'll update with a changelog message mentioning mkwrite/mkclean.
Quoted 4 lines
Also, I'd still like to see a way to call
msync()on the mmap'ed region to force a flush. I think providing afb_fsync()method infbmem.cand a hook down to the driver ought to work.
I'm hoping fbdev folk will give feedback if this is okay. James, Geert, what do you think?
Quoted 3 lines
Also, you now seem to use a fixed 1 second delay, perhaps provide an ioctl or something to customize this?
Ok. Will do.
Quoted 3 lines
And, as Andrew suggested last time around, could you perhaps push this fancy new idea into the FB layer so that more drivers can make us of it?
I would like to do that very much. I have some ideas how it could work for devices that support clean partial updates by tracking touched pages. But I wonder if it is too early to try to abstract this out. James, Geert, what do you think?
Thanks,
jaya
--
To unsubscribe, send a message with 'unsubscribe linux-mm' in the body to [email protected]. For more info on Linux MM,
see: http://www.linux-mm.org/ .
Don't email: <a href=mailto:"[email protected]"> [email protected] </a>
Quoted 9 lines · Jaya Kumar
Quoted 2 lines · Peter Zijlstra
And, as Andrew suggested last time around, could you perhaps push this fancy new idea into the FB layer so that more drivers can make us of it?
I would like to do that very much. I have some ideas how it could work for devices that support clean partial updates by tracking touched pages. But I wonder if it is too early to try to abstract this out. James, Geert, what do you think?
This would also provide an interesting hook for setting up chained DMA for the real framebuffer updates when there's more than a couple of pages that have been touched, which would also be nice to have. There's more than a few drivers that could take advantage of that.
--
To unsubscribe, send a message with 'unsubscribe linux-mm' in the body to [email protected]. For more info on Linux MM,
see: http://www.linux-mm.org/ .
Don't email: <a href=mailto:"[email protected]"> [email protected] </a>
Quoted 10 lines · Paul Mundt
Quoted 9 lines · Jaya Kumar
Quoted 2 lines · Peter Zijlstra
And, as Andrew suggested last time around, could you perhaps push this fancy new idea into the FB layer so that more drivers can make us of it?
I would like to do that very much. I have some ideas how it could work for devices that support clean partial updates by tracking touched pages. But I wonder if it is too early to try to abstract this out. James, Geert, what do you think?
Quoted 5 lines
This would also provide an interesting hook for setting up chained DMA for the real framebuffer updates when there's more than a couple of pages that have been touched, which would also be nice to have. There's more than a few drivers that could take advantage of that.
Hi Paul,
I could benefit from knowing which driver and display device you are considering to be applicable.
I was thinking the method used in hecubafb would only be useful to devices with very slow update paths, where "losing" some of the display activity is not an issue since the device would not have been able to update fast enough to show that activity anyway.
What you described with chained DMA sounds different to this. I suppose one could use this technique to coalesce framebuffer IO to get better performance/utilization even for fast display devices. Sounds interesting to try. Did I understand you correctly?
Thanks,
jaya
--
To unsubscribe, send a message with 'unsubscribe linux-mm' in the body to [email protected]. For more info on Linux MM,
see: http://www.linux-mm.org/ .
Don't email: <a href=mailto:"[email protected]"> [email protected] </a>
Quoted 14 lines · Jaya Kumar
Quoted 4 lines · Paul Mundt
This would also provide an interesting hook for setting up chained DMA for the real framebuffer updates when there's more than a couple of pages that have been touched, which would also be nice to have. There's more than a few drivers that could take advantage of that.
I could benefit from knowing which driver and display device you are considering to be applicable.
I was thinking the method used in hecubafb would only be useful to devices with very slow update paths, where "losing" some of the display activity is not an issue since the device would not have been able to update fast enough to show that activity anyway.
Quoted 5 lines
What you described with chained DMA sounds different to this. I suppose one could use this technique to coalesce framebuffer IO to get better performance/utilization even for fast display devices. Sounds interesting to try. Did I understand you correctly?
Yes, that's what I'm interested in trying. In the SH case we can basically make use of the on-chip DMAC for any non-PCI device. Some of these permit scatterlists and chained DMA in hardware, others do not. The general problem is that since we have to go and poke at the dcache prior to kicking off the DMA, it's rarely a win for a small number of pages, memory bursts just end up being faster.
The other issue is that most of the "big" writers are doing so via mmap() anyways, so it's futile to attempt to handle the DMA case in the ->write() path. Your approach seems like it might be an appropriate interface for building something like this on top of.
Given that, this would have to be something that's dealt with at the subsystem level rather than in individual drivers, hence the desire to see something like this more generically visible.
--
To unsubscribe, send a message with 'unsubscribe linux-mm' in the body to [email protected]. For more info on Linux MM,
see: http://www.linux-mm.org/ .
Don't email: <a href=mailto:"[email protected]"> [email protected] </a>
Quoted 4 lines · Paul Mundt
Given that, this would have to be something that's dealt with at the subsystem level rather than in individual drivers, hence the desire to see something like this more generically visible.
Hi Peter, Paul, fbdev folk,
Ok. Here's what I'm thinking for abstracting this:
fbdev drivers would setup fb_mmap with their own_mmap as usual. In own_mmap, they would do what they normally do and setup a vm_ops. They are free to have their own nopage handler but would set the page_mkwrite handler to be fbdev_deferred_io_mkwrite(). fbdev_deferred_io_mkwrite would build up the list of touched pages and pass it to a delayed workqueue which would then mkclean on each page and then pass a copy of that page list down to a driver's callback function. The fbdev driver's callback function can then do the actual IO to the framebuffer or coalesce DMA based on the provided page list.
I would like to add something like the following to struct fb_info:
#ifdef CONFIG_FB_DEFERRED_IO
struct fb_deferred_io *defio;
#endif
to store the mutex (to protect the page list), the touched page list, and the driver's callback function.
I hope this sounds sufficiently generic to meet everyone's (the two of us? :) needs.
Thanks,
jaya
ps: I've added James and Geert to the CC list. I would appreciate any advice on whether this is a suitable approach.
--
To unsubscribe, send a message with 'unsubscribe linux-mm' in the body to [email protected]. For more info on Linux MM,
see: http://www.linux-mm.org/ .
Don't email: <a href=mailto:"[email protected]"> [email protected] </a>
Quoted 6 lines · Jaya Kumar
Quoted 4 lines · Paul Mundt
Given that, this would have to be something that's dealt with at the subsystem level rather than in individual drivers, hence the desire to see something like this more generically visible.
Quoted 8 lines
Hi Peter, Paul, fbdev folk,
Ok. Here's what I'm thinking for abstracting this:
fbdev drivers would setup
fb_mmapwith theirown_mmapas usual. Inown_mmap, they would do what they normally do and setup avm_ops. They are free to have their own nopage handler but would set thepage_mkwritehandler to befbdev_deferred_io_mkwrite().
The vast majority of drivers do not implement ->fb_mmap(), and with proper abstraction, this should be something that's possible as a direct alternative to drivers/video/fbmem.c:fb_mmap() for the people that want it. Of course it's just as easy to do something like the sbuslib.c route and then have drivers set their ->fb_mmap() from that too.
Quoted 6 lines
fbdev_deferred_io_mkwritewould build up the list of touched pages and pass it to a delayed workqueue which would then mkclean on each page and then pass a copy of that page list down to a driver's callback function. The fbdev driver's callback function can then do the actual IO to the framebuffer or coalesce DMA based on the provided page list.
That works for me, though I'd prefer for struct page_list to be done with a scatterlist, then it's trivial to setup from the workqueue context without having to shuffle things around.
--
To unsubscribe, send a message with 'unsubscribe linux-mm' in the body to [email protected]. For more info on Linux MM,
see: http://www.linux-mm.org/ .
Don't email: <a href=mailto:"[email protected]"> [email protected] </a>
Quoted 9 lines · Paul Mundt
Quoted 7 lines · Jaya Kumar
Ok. Here's what I'm thinking for abstracting this:
fbdev drivers would setup
fb_mmapwith theirown_mmapas usual. Inown_mmap, they would do what they normally do and setup avm_ops. They are free to have their own nopage handler but would set thepage_mkwritehandler to befbdev_deferred_io_mkwrite().
Quoted 6 lines
The vast majority of drivers do not implement ->fb_mmap(), and with proper abstraction, this should be something that's possible as a direct alternative to drivers/video/fbmem.c:fb_mmap() for the people that want it. Of course it's just as easy to do something like the
sbuslib.croute and then have drivers set their ->fb_mmap() from that too.
I was thinking about having that fb_mmap replacement too. But then I got worried because that generic implementation of nopage/etc would need to handle whether the driver's fb memory was vmalloced, kmalloced or a mixture if some do that. So I figured let's aim low and just pull in the core part that does the setup and page tracking stuff. I hope that's okay.
Quoted 4 lines
That works for me, though I'd prefer for struct
page_listto be done with a scatterlist, then it's trivial to setup from the workqueue context without having to shuffle things around.
Ok. Will check out when implementing.
Thanks,
jaya
--
To unsubscribe, send a message with 'unsubscribe linux-mm' in the body to [email protected]. For more info on Linux MM,
see: http://www.linux-mm.org/ .
Don't email: <a href=mailto:"[email protected]"> [email protected] </a>
Quoted 8 lines · Jaya Kumar
Quoted 4 lines · Paul Mundt
That works for me, though I'd prefer for struct
page_listto be done with a scatterlist, then it's trivial to setup from the workqueue context without having to shuffle things around.Ok. Will check out when implementing.
Took a quick look. If I used scatterlist, I'd still need to build a list of scatterlist to pass to the driver callback. The alternative being a preallocated array of scatterlist based on the page count of the framebuffer, which seems expensive since scatterlist has page, offset, dma and length.
On a separate note, Peter pointed out that it may be possible to reuse page->lru instead of using a struct page_list. This would enable something like:
in mkwrite:mutex_locklist_add(page->lru, defio->pagelist)mutex_unlock
in deferred handler:mutex_lockfor_each page {lock_page
mkcleanunlock_page
}callback(fb_info, pagelist)for_each page {list_del
}mutex_unlock
The advantage of reusing page->lru is that avoids needing the struct page_list and allocation in mkwrite. Is the above exploitation of ->lru ok with mm folk?
In above, we're iterating over the page list twice. I have to mkclean before calling the callback to avoid the situation where a touched page is missed by the callback. I don't see a way around that part.
Thanks,
jaya
--
To unsubscribe, send a message with 'unsubscribe linux-mm' in the body to [email protected]. For more info on Linux MM,
see: http://www.linux-mm.org/ .
Don't email: <a href=mailto:"[email protected]"> [email protected] </a>
Quoted 20 lines · Jaya Kumar
Quoted 4 lines · Paul Mundt
Given that, this would have to be something that's dealt with at the subsystem level rather than in individual drivers, hence the desire to see something like this more generically visible.
Hi Peter, Paul, fbdev folk,
Ok. Here's what I'm thinking for abstracting this:
fbdev drivers would setup
fb_mmapwith theirown_mmapas usual. Inown_mmap, they would do what they normally do and setup avm_ops. They are free to have their own nopage handler but would set thepage_mkwritehandler to befbdev_deferred_io_mkwrite().fbdev_deferred_io_mkwritewould build up the list of touched pages and pass it to a delayed workqueue which would then mkclean on each page and then pass a copy of that page list down to a driver's callback function. The fbdev driver's callback function can then do the actual IO to the framebuffer or coalesce DMA based on the provided page list.
Quoted 5 lines
I would like to add something like the following to struct
fb_info:#ifdef
CONFIG_FB_DEFERRED_IO
structfb_deferred_io*defio;
#endif
Don't you need a way to specify the maximum deferral time? E.g. a field in fb_info.
Quoted 5 lines
to store the mutex (to protect the page list), the touched page list, and the driver's callback function.
I hope this sounds sufficiently generic to meet everyone's (the two of us? :) needs.
Looks fine!
Gr{oetje,eeting}s,
Geert
--
Geert Uytterhoeven -- There's lots of Linux beyond ia32 -- [email protected]
In personal conversations with technical people, I call myself a hacker. But when I'm talking to journalists I just say "programmer" or something like that.
-- Linus Torvalds
--
To unsubscribe, send a message with 'unsubscribe linux-mm' in the body to [email protected]. For more info on Linux MM,
see: http://www.linux-mm.org/ .
Don't email: <a href=mailto:"[email protected]"> [email protected] </a>
Quoted 3 lines · Geert Uytterhoeven
Don't you need a way to specify the maximum deferral time? E.g. a field in
fb_info.
You are right. I will need that. I could put that into struct fb_deferred_io. So drivers would setup like:
static struct fb_deferred_io hecubafb_defio = {
.delay = HZ,
.deferred_io = hecubafb_dpy_update,
};
where that would be:
struct fb_deferred_io {
unsigned long delay; /* delay between mkwrite and deferred handler */
struct mutex lock; /* mutex that protects the page list */
struct list_head pagelist; /* list of touched pages */
struct delayed_work deferred_work;
void (*deferred_io)(struct fb_info *info, struct list_head
*pagelist); /* callback */
};
and the driver would do:
...info->fbdefio = hecubafb_defio;register_framebuffer...
When the driver calls register_framebuffer and unregister_framebuffer, I can then do the init and destruction of the other members of that struct. Does this sound okay?
Thanks,
jaya
Could you make it work without the framebuffer. There are embedded LCD displays that have internal memory that need data flushed to them.
Quoted 33 lines · Jaya Kumar
Quoted 3 lines · Geert Uytterhoeven
Don't you need a way to specify the maximum deferral time? E.g. a field in
fb_info.You are right. I will need that. I could put that into struct
fb_deferred_io. So drivers would setup like:static struct
fb_deferred_iohecubafb_defio= {
.delay = HZ,
.deferred_io =hecubafb_dpy_update,
};where that would be:
structfb_deferred_io{
unsigned long delay; /* delay between mkwrite and deferred handler
*/
struct mutex lock; /* mutex that protects the page list */
structlist_headpagelist; /* list of touched pages */
structdelayed_workdeferred_work;
void (*deferred_io)(structfb_info*info, structlist_head
*pagelist); /* callback */
};and the driver would do:
...info->fbdefio=hecubafb_defio;register_framebuffer...When the driver calls
register_framebufferandunregister_framebuffer, I can then do the init and destruction of the other members of that struct. Does this sound okay?
Quoted 8 lines
Thanks,
jaya
-
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in the body of a message to [email protected]
More majordomo info at http://vger.kernel.org/majordomo-info.html
Please read the FAQ at http://www.tux.org/lkml/
--
To unsubscribe, send a message with 'unsubscribe linux-mm' in the body to [email protected]. For more info on Linux MM,
see: http://www.linux-mm.org/ .
Don't email: <a href=mailto:"[email protected]"> [email protected] </a>
Quoted 4 lines · James Simmons
Could you make it work without the framebuffer. There are embedded LCD displays that have internal memory that need data flushed to them.
I'm not sure I understand. What the current implementation does is to use host based framebuffer memory. Apps mmap that memory and draw to that. Then after the delay, that framebuffer is written to the device's memory. That's the scenario for hecubafb where the Apollo controller maintains it's own internal framebuffer.
When you say without the framebuffer, if you meant without the host memory, then this method doesn't work. If you mean without the device's internal memory, then yes, I think we can do that, because it would be up to the driver to use the touched pagelist to then perform IO as suitable for its device.
Thanks,
jaya
--
To unsubscribe, send a message with 'unsubscribe linux-mm' in the body to [email protected]. For more info on Linux MM,
see: http://www.linux-mm.org/ .
Don't email: <a href=mailto:"[email protected]"> [email protected] </a>
Re: [Linux-fbdev-devel] [PATCH 2.6.20 1/1] fbdev, mm: hecuba/E-Ink fbdev driver
Quoted 7 lines
I'm not sure I understand. What the current implementation does is to use host based framebuffer memory. Apps mmap that memory and draw to that. Then after the delay, that framebuffer is written to the device's memory. That's the scenario for hecubafb where the Apollo controller maintains it's own internal framebuffer.
Quoted 5 lines
When you say without the framebuffer, if you meant without the host memory, then this method doesn't work. If you mean without the device's internal memory, then yes, I think we can do that, because it would be up to the driver to use the touched pagelist to then perform IO as suitable for its device.
I meant for it to work for non framebuffer devices. I realized that not such a great idea.
Re: [Linux-fbdev-devel] [PATCH 2.6.20 1/1] fbdev, mm: hecuba/E-Ink fbdev driver
In reply to Jaya KumarQuoted 8 lines · Jaya Kumar
Quoted 3 lines · Geert Uytterhoeven
Don't you need a way to specify the maximum deferral time? E.g. a field in
fb_info.You are right. I will need that. I could put that into struct
fb_deferred_io. So drivers would setup like:
Is it also possible to let the drivers do the 'deferred_io' themselves? Say, a driver that would flush the dirty pages on every VBLANK interrupt.
Quoted 15 lines
static struct
fb_deferred_iohecubafb_defio= {
.delay = HZ,
.deferred_io =hecubafb_dpy_update,
};where that would be:
structfb_deferred_io{
unsigned long delay; /* delay between mkwrite and deferred handler */
struct mutex lock; /* mutex that protects the page list */
structlist_headpagelist; /* list of touched pages */
structdelayed_workdeferred_work;
void (*deferred_io)(structfb_info*info, structlist_head
*pagelist); /* callback */
};
Quoted 8 lines
and the driver would do:
...info->fbdefio=hecubafb_defio;register_framebuffer...When the driver calls
register_framebufferandunregister_framebuffer, I can then do the init and destruction of the other members of that struct. Does this sound okay?
It would be better if separate registering functions are created for this functionality (ie deferred_io_register/unregister).
Tony
--
To unsubscribe, send a message with 'unsubscribe linux-mm' in the body to [email protected]. For more info on Linux MM,
see: http://www.linux-mm.org/ .
Don't email: <a href=mailto:"[email protected]"> [email protected] </a>
Re: [Linux-fbdev-devel] [PATCH 2.6.20 1/1] fbdev, mm: hecuba/E-Ink fbdev driver
Quoted 9 lines · Antonino A. Daplas
Quoted 4 lines · Jaya Kumar
You are right. I will need that. I could put that into struct
fb_deferred_io. So drivers would setup like:Is it also possible to let the drivers do the '
deferred_io' themselves? Say, a driver that would flush the dirty pages on every VBLANK interrupt.
Yes, I think so. The deferred_io callback that the driver would get would be to provide them with the dirty pages list. Then, they could use that to handle the on-vblank work.
Quoted 7 lines
Quoted 3 lines
When the driver calls
register_framebufferandunregister_framebuffer, I can then do the init and destruction of the other members of that struct. Does this sound okay?It would be better if separate registering functions are created for this functionality (ie deferred_io_register/unregister).
Ok. Will do it that way.
Thanks,
jaya
--
To unsubscribe, send a message with 'unsubscribe linux-mm' in the body to [email protected]. For more info on Linux MM,
see: http://www.linux-mm.org/ .
Don't email: <a href=mailto:"[email protected]"> [email protected] </a>
Re: [Linux-fbdev-devel] [PATCH 2.6.20 1/1] fbdev, mm: hecuba/E-Ink fbdev driver
In reply to Jaya KumarQuoted 8 lines · Jaya Kumar
Quoted 4 lines · Paul Mundt
Given that, this would have to be something that's dealt with at the subsystem level rather than in individual drivers, hence the desire to see something like this more generically visible.
Hi Peter, Paul, fbdev folk,
Quoted 8 lines
Ok. Here's what I'm thinking for abstracting this:
fbdev drivers would setup
fb_mmapwith theirown_mmapas usual. Inown_mmap, they would do what they normally do and setup avm_ops. They are free to have their own nopage handler but would set thepage_mkwritehandler to befbdev_deferred_io_mkwrite().fbdev_deferred_io_mkwritewould build up the list of touched pages and pass it to a delayed workqueue which would then mkclean on each page
Yes, this functionality is sorely needed by more than a few driver writers.
Quoted 9 lines
and then pass a copy of that page list down to a driver's callback function. The fbdev driver's callback function can then do the actual IO to the framebuffer or coalesce DMA based on the provided page list. I would like to add something like the following to struct
fb_info:#ifdef
CONFIG_FB_DEFERRED_IO
structfb_deferred_io*defio;
#endif
Quoted 5 lines
to store the mutex (to protect the page list), the touched page list, and the driver's callback function.
I hope this sounds sufficiently generic to meet everyone's (the two of us? :) needs.
There's definitely more than two :-). For the past several years, various people have been asking for this functionality. So yes, implementing this in a generic manner will be a big help.
Tony
-------------------------------------------------------------------------
Take Surveys. Earn Cash. Influence the Future of IT
Join SourceForge.net's Techsay panel and you'll get the chance to share your opinions on IT & business topics through brief surveys-and earn cash
http://www.techsay.com/default.php?page=join.php&p=sourceforge&CID=DEVDEV