Skip to contentSkip to conversation

fbdev: Add fb_read/fb_write functions for framebuffers in system RAM

PATCH In review Antonino A. Daplas 1 participant 1 message Apr 25, 2007 Framebuffer layer

lore
Share & tools
lore
#0 lore raw

PATCH 22/41 fbdev: Add fb_read/fb_write functions for framebuffers in system RAM

The functions fb_read() and fb_write in fbmem.c assume that the framebuffer is in IO memory. However, we have 3 drivers (hecubafb, arcfb, and vfb) where the framebuffer is allocated from system RAM (via vmalloc). Using __raw_read/__raw_write (fb_readl/fb_writel) for these drivers is illegal, especially in other platforms.

Create file read and write methods for these types of drivers. These are named fb_sys_read() and fb_sys_write().

---

 drivers/video/Kconfig       |    5 ++
 drivers/video/Makefile      |    1 
 drivers/video/fb_sys_fops.c |  104 +++++++++++++++++++++++++++++++++++++++++++
 include/linux/fb.h          |    4 ++
 4 files changed, 114 insertions(+), 0 deletions(-)
drivers/video/Kconfig +5 -0
index 60e3ceb..5b6350d 100644
@@ -122,6 +122,11 @@ config FB_SYS_IMAGEBLIT
 	  blitting. This is used by drivers that don't provide their own
 	  (accelerated) version and the framebuffer is in system RAM.
 
+config FB_SYS_FOPS
+       tristate
+       depends on FB
+       default n
+
 config FB_DEFERRED_IO
 	bool
 	depends on FB
drivers/video/Makefile +1 -0
index a245cc7..fb0f3ab 100644
@@ -21,6 +21,7 @@ obj-$(CONFIG_FB_CFB_IMAGEBLIT) += cfbimg
 obj-$(CONFIG_FB_SYS_FILLRECT)  += sysfillrect.o
 obj-$(CONFIG_FB_SYS_COPYAREA)  += syscopyarea.o
 obj-$(CONFIG_FB_SYS_IMAGEBLIT) += sysimgblt.o
+obj-$(CONFIG_FB_SYS_FOPS)      += fb_sys_fops.o
 obj-$(CONFIG_FB_SVGALIB)       += svgalib.o
 obj-$(CONFIG_FB_MACMODES)      += macmodes.o
 obj-$(CONFIG_FB_DDC)           += fb_ddc.o
drivers/video/fb_sys_fops.c new file +104 -0

104 lines not on this page · raw message

include/linux/fb.h +4 -0
index acb6ddb..70d154a 100644
@@ -903,6 +903,10 @@ extern void cfb_imageblit(struct fb_info
 extern void sys_fillrect(struct fb_info *info, const struct fb_fillrect *rect);
 extern void sys_copyarea(struct fb_info *info, const struct fb_copyarea *area);
 extern void sys_imageblit(struct fb_info *info, const struct fb_image *image);
+extern ssize_t fb_sys_read(struct fb_info *info, char __user *buf,
+			   size_t count, loff_t *ppos);
+extern ssize_t fb_sys_write(struct fb_info *info, const char __user *buf,
+			    size_t count, loff_t *ppos);
 
 /* drivers/video/fbmem.c */
 extern int register_framebuffer(struct fb_info *fb_info);

-------------------------------------------------------------------------
This SF.net email is sponsored by DB2 Express
Download DB2 Express C - the FREE version of DB2 express and take control of your XML. No limits. Just data. Click to get it now.
http://sourceforge.net/powerbar/db2/