Skip to content

Commit

Permalink
---
Browse files Browse the repository at this point in the history
yaml
---
r: 54951
b: refs/heads/master
c: 38a3dc5
h: refs/heads/master
i:
  54949: e335351
  54947: cdcab7e
  54943: e22d4b7
v: v3
  • Loading branch information
Antonino A. Daplas authored and Linus Torvalds committed May 8, 2007
1 parent db83245 commit 1ec9027
Show file tree
Hide file tree
Showing 4 changed files with 88 additions and 1 deletion.
2 changes: 1 addition & 1 deletion [refs]
Original file line number Diff line number Diff line change
@@ -1,2 +1,2 @@
---
refs/heads/master: e15de77e74d429f14641ebe7a29ccd8aa6656f3c
refs/heads/master: 38a3dc51852d8350b156ea909c5aa8767d71b005
42 changes: 42 additions & 0 deletions trunk/drivers/video/console/fbcon.c
Original file line number Diff line number Diff line change
Expand Up @@ -3043,13 +3043,51 @@ static void fbcon_new_modelist(struct fb_info *info)
}
}

static void fbcon_get_requirement(struct fb_info *info,
struct fb_blit_caps *caps)
{
struct vc_data *vc;
struct display *p;
int charcnt;

if (caps->flags) {
int i;

for (i = first_fb_vc; i <= last_fb_vc; i++) {
vc = vc_cons[i].d;
if (vc && vc->vc_mode == KD_TEXT) {
p = &fb_display[i];
caps->x |= 1 << (vc->vc_font.width - 1);
caps->y |= 1 << (vc->vc_font.height - 1);
charcnt = (p->userfont) ?
FNTCHARCNT(p->fontdata) : 256;
if (caps->len < charcnt)
caps->len = charcnt;
}
}
} else {
vc = vc_cons[fg_console].d;

if (vc && vc->vc_mode == KD_TEXT) {
p = &fb_display[fg_console];
caps->x |= 1 << (vc->vc_font.width - 1);
caps->y |= 1 << (vc->vc_font.height - 1);
charcnt = (p->userfont) ?
FNTCHARCNT(p->fontdata) : 256;
if (caps->len < charcnt)
caps->len = charcnt;
}
}
}

static int fbcon_event_notify(struct notifier_block *self,
unsigned long action, void *data)
{
struct fb_event *event = data;
struct fb_info *info = event->info;
struct fb_videomode *mode;
struct fb_con2fbmap *con2fb;
struct fb_blit_caps *caps;
int ret = 0;

/*
Expand Down Expand Up @@ -3098,6 +3136,10 @@ static int fbcon_event_notify(struct notifier_block *self,
case FB_EVENT_NEW_MODELIST:
fbcon_new_modelist(info);
break;
case FB_EVENT_GET_REQ:
caps = event->data;
fbcon_get_requirement(info, caps);
break;
}

done:
Expand Down
33 changes: 33 additions & 0 deletions trunk/drivers/video/fbmem.c
Original file line number Diff line number Diff line change
Expand Up @@ -773,6 +773,29 @@ fb_pan_display(struct fb_info *info, struct fb_var_screeninfo *var)
return 0;
}

static int fb_check_caps(struct fb_info *info, struct fb_var_screeninfo *var,
u32 activate)
{
struct fb_event event;
struct fb_blit_caps caps, fbcaps;
int err = 0;

memset(&caps, 0, sizeof(caps));
memset(&fbcaps, 0, sizeof(fbcaps));
caps.flags = (activate & FB_ACTIVATE_ALL) ? 1 : 0;
event.info = info;
event.data = &caps;
fb_notifier_call_chain(FB_EVENT_GET_REQ, &event);
info->fbops->fb_get_caps(info, &fbcaps, var);

if (((fbcaps.x ^ caps.x) & caps.x) ||
((fbcaps.y ^ caps.y) & caps.y) ||
(fbcaps.len < caps.len))
err = -EINVAL;

return err;
}

int
fb_set_var(struct fb_info *info, struct fb_var_screeninfo *var)
{
Expand Down Expand Up @@ -817,7 +840,15 @@ fb_set_var(struct fb_info *info, struct fb_var_screeninfo *var)
struct fb_videomode mode;
int err = 0;

if (info->fbops->fb_get_caps) {
err = fb_check_caps(info, var, activate);

if (err)
goto done;
}

info->var = *var;

if (info->fbops->fb_set_par)
info->fbops->fb_set_par(info);

Expand All @@ -843,6 +874,8 @@ fb_set_var(struct fb_info *info, struct fb_var_screeninfo *var)
}
}
}

done:
return 0;
}

Expand Down
12 changes: 12 additions & 0 deletions trunk/include/linux/fb.h
Original file line number Diff line number Diff line change
Expand Up @@ -527,12 +527,20 @@ struct fb_cursor_user {
#define FB_EVENT_MODE_CHANGE_ALL 0x0B
/* A software display blank change occured */
#define FB_EVENT_CONBLANK 0x0C
/* Get drawing requirements */
#define FB_EVENT_GET_REQ 0x0D

struct fb_event {
struct fb_info *info;
void *data;
};

struct fb_blit_caps {
u32 x;
u32 y;
u32 len;
u32 flags;
};

extern int fb_register_client(struct notifier_block *nb);
extern int fb_unregister_client(struct notifier_block *nb);
Expand Down Expand Up @@ -652,6 +660,10 @@ struct fb_ops {

/* restore saved state */
void (*fb_restore_state)(struct fb_info *info);

/* get capability given var */
void (*fb_get_caps)(struct fb_info *info, struct fb_blit_caps *caps,
struct fb_var_screeninfo *var);
};

#ifdef CONFIG_FB_TILEBLITTING
Expand Down

0 comments on commit 1ec9027

Please sign in to comment.