aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/video/console
diff options
context:
space:
mode:
authorAntonino A. Daplas <adaplas@gmail.com>2007-05-08 03:39:37 -0400
committerLinus Torvalds <torvalds@woody.linux-foundation.org>2007-05-08 14:15:32 -0400
commit38a3dc51852d8350b156ea909c5aa8767d71b005 (patch)
tree933e9a4b7b0a0d871aaccd7d44e9224ea6c4a0b5 /drivers/video/console
parente15de77e74d429f14641ebe7a29ccd8aa6656f3c (diff)
fbdev: fbcon: check if mode can handle new screen
Check if the mode can properly display the screen. This will be needed by drivers where the capability is not constant with each mode. The function fb_set_var() will query fbcon the requirement, then it will query the driver (via a new hook fb_get_caps()) its capability. If the driver's capability cannot handle fbcon's requirement, then fb_set_var() will fail. For example, if a particular driver supports 2 modes where: mode1 = can only display 8x16 bitmaps mode2 = can display any bitmap then if current mode = mode2 and current font = 12x22 fbset <mode1> /* mode1 cannot handle 12x22 */ fbset will fail Signed-off-by: Antonino Daplas <adaplas@gmail.com> Signed-off-by: Andrew Morton <akpm@linux-foundation.org> Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
Diffstat (limited to 'drivers/video/console')
-rw-r--r--drivers/video/console/fbcon.c42
1 files changed, 42 insertions, 0 deletions
diff --git a/drivers/video/console/fbcon.c b/drivers/video/console/fbcon.c
index 6fc3501581d6..34899bd7c9f3 100644
--- a/drivers/video/console/fbcon.c
+++ b/drivers/video/console/fbcon.c
@@ -3043,6 +3043,43 @@ static void fbcon_new_modelist(struct fb_info *info)
3043 } 3043 }
3044} 3044}
3045 3045
3046static void fbcon_get_requirement(struct fb_info *info,
3047 struct fb_blit_caps *caps)
3048{
3049 struct vc_data *vc;
3050 struct display *p;
3051 int charcnt;
3052
3053 if (caps->flags) {
3054 int i;
3055
3056 for (i = first_fb_vc; i <= last_fb_vc; i++) {
3057 vc = vc_cons[i].d;
3058 if (vc && vc->vc_mode == KD_TEXT) {
3059 p = &fb_display[i];
3060 caps->x |= 1 << (vc->vc_font.width - 1);
3061 caps->y |= 1 << (vc->vc_font.height - 1);
3062 charcnt = (p->userfont) ?
3063 FNTCHARCNT(p->fontdata) : 256;
3064 if (caps->len < charcnt)
3065 caps->len = charcnt;
3066 }
3067 }
3068 } else {
3069 vc = vc_cons[fg_console].d;
3070
3071 if (vc && vc->vc_mode == KD_TEXT) {
3072 p = &fb_display[fg_console];
3073 caps->x |= 1 << (vc->vc_font.width - 1);
3074 caps->y |= 1 << (vc->vc_font.height - 1);
3075 charcnt = (p->userfont) ?
3076 FNTCHARCNT(p->fontdata) : 256;
3077 if (caps->len < charcnt)
3078 caps->len = charcnt;
3079 }
3080 }
3081}
3082
3046static int fbcon_event_notify(struct notifier_block *self, 3083static int fbcon_event_notify(struct notifier_block *self,
3047 unsigned long action, void *data) 3084 unsigned long action, void *data)
3048{ 3085{
@@ -3050,6 +3087,7 @@ static int fbcon_event_notify(struct notifier_block *self,
3050 struct fb_info *info = event->info; 3087 struct fb_info *info = event->info;
3051 struct fb_videomode *mode; 3088 struct fb_videomode *mode;
3052 struct fb_con2fbmap *con2fb; 3089 struct fb_con2fbmap *con2fb;
3090 struct fb_blit_caps *caps;
3053 int ret = 0; 3091 int ret = 0;
3054 3092
3055 /* 3093 /*
@@ -3098,6 +3136,10 @@ static int fbcon_event_notify(struct notifier_block *self,
3098 case FB_EVENT_NEW_MODELIST: 3136 case FB_EVENT_NEW_MODELIST:
3099 fbcon_new_modelist(info); 3137 fbcon_new_modelist(info);
3100 break; 3138 break;
3139 case FB_EVENT_GET_REQ:
3140 caps = event->data;
3141 fbcon_get_requirement(info, caps);
3142 break;
3101 } 3143 }
3102 3144
3103done: 3145done: