Skip to contentSkip to conversation

fbdev: Capture modelist change event

PATCH In review Antonino A. Daplas 1 participant 1 message Mar 6, 2005

Subsystems (2)
lore
Share & tools
lore
#0 lore raw

PATCH 2/10 fbdev: Capture modelist change event

Add capability to change private modelist. It checks if the entries in the new modelist are acceptable, and if not, trimmed from the modelist.

Also added a new event, FB_EVENT_NEW_MODELIST, sent by fbmem, and captured by fbcon to resize all consoles, if need be.

Requires minor changes to new functions, ie, fb_get_color_depth().

---

 drivers/video/console/bitblit.c |    2 -
 drivers/video/console/fbcon.c   |   68 +++++++++++++++++++++++++++++-----------
 drivers/video/fbmem.c           |   43 ++++++++++++++++++++++---
 drivers/video/fbsysfs.c         |   12 ++++++-
 drivers/video/modedb.c          |   42 ++++++++++++++++++++++++
 drivers/video/nvidia/nvidia.c   |    2 -
 include/linux/fb.h              |    7 +++-
 7 files changed, 149 insertions(+), 27 deletions(-)
drivers/video/console/bitblit.c +1 -1
diff -Nru a/drivers/video/console/bitblit.c b/drivers/video/console/bitblit.c
@@ -39,7 +39,7 @@
 {
 	int attribute = 0;
 
-	if (fb_get_color_depth(info) == 1) {
+	if (fb_get_color_depth(&info->var) == 1) {
 		if (attr_underline(c))
 			attribute |= FBCON_ATTRIBUTE_UNDERLINE;
 		if (attr_reverse(c))
drivers/video/console/fbcon.c +50 -18

157 lines not on this page · raw message

drivers/video/fbmem.c +38 -5

73 lines not on this page · raw message

drivers/video/fbsysfs.c +11 -1
diff -Nru a/drivers/video/fbsysfs.c b/drivers/video/fbsysfs.c
@@ -151,13 +151,23 @@
 {
 	struct fb_info *fb_info =
 		(struct fb_info *)class_get_devdata(class_device);
+	LIST_HEAD(old_list);
 	int i = count / sizeof(struct fb_videomode);
+	
 	if (i * sizeof(struct fb_videomode) != count)
 		return -EINVAL;
 
-	fb_destroy_modelist(&fb_info->modelist);
+	acquire_console_sem();
+	list_splice(&fb_info->modelist, &old_list);
 	fb_videomode_to_modelist((struct fb_videomode *)buf, i,
 				 &fb_info->modelist);
+	if (fb_new_modelist(fb_info)) {
+		fb_destroy_modelist(&fb_info->modelist);
+		list_splice(&old_list, &fb_info->modelist);
+	} else 
+		fb_destroy_modelist(&old_list);
+
+	release_console_sem();
 
 	return 0;
 }
drivers/video/modedb.c +42 -0

53 lines not on this page · raw message

drivers/video/nvidia/nvidia.c +1 -1
diff -Nru a/drivers/video/nvidia/nvidia.c b/drivers/video/nvidia/nvidia.c
@@ -657,7 +657,7 @@
 {
 	struct nvidia_par *par = info->par;
 	struct _riva_hw_state *state = &par->ModeReg;
-	int i, depth = fb_get_color_depth(info);
+	int i, depth = fb_get_color_depth(&info->var);
 	int h_display = info->var.xres / 8 - 1;
 	int h_start = (info->var.xres + info->var.right_margin) / 8 - 1;
 	int h_end = (info->var.xres + info->var.right_margin +
include/linux/fb.h +6 -1
diff -Nru a/include/linux/fb.h b/include/linux/fb.h
@@ -493,6 +493,8 @@
 #define FB_EVENT_SET_CONSOLE_MAP        0x07
 /*      A display blank is requested       */
 #define FB_EVENT_BLANK                  0x08
+/*      Private modelist is to be replaced */
+#define FB_EVENT_NEW_MODELIST           0x09
 
 struct fb_event {
 	struct fb_info *info;
@@ -826,8 +828,9 @@
 				u8 *dst, u32 d_pitch, u8 *src, u32 s_pitch,
 				u32 height);
 extern void fb_set_suspend(struct fb_info *info, int state);
-extern int fb_get_color_depth(struct fb_info *info);
+extern int fb_get_color_depth(struct fb_var_screeninfo *var);
 extern int fb_get_options(char *name, char **option);
+extern int fb_new_modelist(struct fb_info *info);
 
 extern struct fb_info *registered_fb[FB_MAX];
 extern int num_registered_fb;
@@ -882,6 +885,8 @@
 					  struct list_head *head);
 extern struct fb_videomode *fb_find_best_mode(struct fb_var_screeninfo *var,
 					      struct list_head *head);
+extern struct fb_videomode *fb_find_nearest_mode(struct fb_var_screeninfo *var,
+						 struct list_head *head);
 extern void fb_destroy_modelist(struct list_head *head);
 extern void fb_videomode_to_modelist(struct fb_videomode *modedb, int num,
 				     struct list_head *head);

-------------------------------------------------------
SF email is sponsored by - The IT Product Guide
Read honest & candid reviews on hundreds of IT Products from real users. Discover which products truly live up to the hype. Start reading now.
http://ads.osdn.com/?ad_id=6595&alloc_id=14396&op=click