Skip to content

Commit

Permalink
---
Browse files Browse the repository at this point in the history
yaml
---
r: 13475
b: refs/heads/master
c: a812c94
h: refs/heads/master
i:
  13473: 4a63933
  13471: 0b31cc2
v: v3
  • Loading branch information
Antonino A. Daplas authored and Linus Torvalds committed Nov 9, 2005
1 parent fce1ecd commit eb9f221
Show file tree
Hide file tree
Showing 5 changed files with 169 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: ed8c0e99f27451a9b980adf0de318d60e6de811f
refs/heads/master: a812c94b94e3db76d1af68208fb3edef69070401
72 changes: 72 additions & 0 deletions trunk/drivers/video/console/fbcon.c
Original file line number Diff line number Diff line change
Expand Up @@ -193,6 +193,8 @@ static void fbcon_preset_disp(struct fb_info *info, struct fb_var_screeninfo *va
int unit);
static void fbcon_redraw_move(struct vc_data *vc, struct display *p,
int line, int count, int dy);
static void fbcon_modechanged(struct fb_info *info);
static void fbcon_set_all_vcs(struct fb_info *info);

#ifdef CONFIG_MAC
/*
Expand All @@ -218,15 +220,77 @@ static inline void fbcon_set_rotation(struct fb_info *info, struct display *p)
else
ops->rotate = 0;
}

static void fbcon_rotate(struct fb_info *info, u32 rotate)
{
struct fbcon_ops *ops= info->fbcon_par;
struct fb_info *fb_info;

if (!ops || ops->currcon == -1)
return;

fb_info = registered_fb[con2fb_map[ops->currcon]];

if (info == fb_info) {
struct display *p = &fb_display[ops->currcon];

if (rotate < 4)
p->con_rotate = rotate;
else
p->con_rotate = 0;

fbcon_modechanged(info);
}
}

static void fbcon_rotate_all(struct fb_info *info, u32 rotate)
{
struct fbcon_ops *ops = info->fbcon_par;
struct vc_data *vc;
struct display *p;
int i;

if (!ops || ops->currcon < 0 || rotate > 3)
return;

for (i = 0; i < MAX_NR_CONSOLES; i++) {
vc = vc_cons[i].d;
if (!vc || vc->vc_mode != KD_TEXT ||
registered_fb[con2fb_map[i]] != info)
continue;

p = &fb_display[vc->vc_num];
p->con_rotate = rotate;
}

fbcon_set_all_vcs(info);
}
#else
static inline void fbcon_set_rotation(struct fb_info *info, struct display *p)
{
struct fbcon_ops *ops = info->fbcon_par;

ops->rotate = FB_ROTATE_UR;
}

static void fbcon_rotate(struct fb_info *info, u32 rotate)
{
return;
}

static void fbcon_rotate_all(struct fb_info *info, u32 rotate)
{
return;
}
#endif /* CONFIG_FRAMEBUFFER_CONSOLE_ROTATION */

static int fbcon_get_rotate(struct fb_info *info)
{
struct fbcon_ops *ops = info->fbcon_par;

return (ops) ? ops->rotate : 0;
}

static inline int fbcon_is_inactive(struct vc_data *vc, struct fb_info *info)
{
struct fbcon_ops *ops = info->fbcon_par;
Expand Down Expand Up @@ -2864,6 +2928,14 @@ static int fbcon_event_notify(struct notifier_block *self,
case FB_EVENT_NEW_MODELIST:
fbcon_new_modelist(info);
break;
case FB_EVENT_SET_CON_ROTATE:
fbcon_rotate(info, *(int *)event->data);
break;
case FB_EVENT_GET_CON_ROTATE:
ret = fbcon_get_rotate(info);
break;
case FB_EVENT_SET_CON_ROTATE_ALL:
fbcon_rotate_all(info, *(int *)event->data);
}

return ret;
Expand Down
22 changes: 22 additions & 0 deletions trunk/drivers/video/fbmem.c
Original file line number Diff line number Diff line change
Expand Up @@ -1319,6 +1319,28 @@ int fb_new_modelist(struct fb_info *info)
return err;
}

/**
* fb_con_duit - user<->fbcon passthrough
* @info: struct fb_info
* @event: notification event to be passed to fbcon
* @data: private data
*
* DESCRIPTION
* This function is an fbcon-user event passing channel
* which bypasses fbdev. This is hopefully temporary
* until a user interface for fbcon is created
*/
int fb_con_duit(struct fb_info *info, int event, void *data)
{
struct fb_event evnt;

evnt.info = info;
evnt.data = data;

return notifier_call_chain(&fb_notifier_list, event, &evnt);
}
EXPORT_SYMBOL(fb_con_duit);

static char *video_options[FB_MAX];
static int ofonly;

Expand Down
67 changes: 67 additions & 0 deletions trunk/drivers/video/fbsysfs.c
Original file line number Diff line number Diff line change
Expand Up @@ -213,6 +213,70 @@ static ssize_t show_bpp(struct class_device *class_device, char *buf)
return snprintf(buf, PAGE_SIZE, "%d\n", fb_info->var.bits_per_pixel);
}

static ssize_t store_rotate(struct class_device *class_device, const char *buf,
size_t count)
{
struct fb_info *fb_info = class_get_devdata(class_device);
struct fb_var_screeninfo var;
char **last = NULL;
int err;

var = fb_info->var;
var.rotate = simple_strtoul(buf, last, 0);

if ((err = activate(fb_info, &var)))
return err;

return count;
}


static ssize_t show_rotate(struct class_device *class_device, char *buf)
{
struct fb_info *fb_info = class_get_devdata(class_device);

return snprintf(buf, PAGE_SIZE, "%d\n", fb_info->var.rotate);
}

static ssize_t store_con_rotate(struct class_device *class_device,
const char *buf, size_t count)
{
struct fb_info *fb_info = class_get_devdata(class_device);
int rotate;
char **last = NULL;

acquire_console_sem();
rotate = simple_strtoul(buf, last, 0);
fb_con_duit(fb_info, FB_EVENT_SET_CON_ROTATE, &rotate);
release_console_sem();
return count;
}

static ssize_t store_con_rotate_all(struct class_device *class_device,
const char *buf, size_t count)
{
struct fb_info *fb_info = class_get_devdata(class_device);
int rotate;
char **last = NULL;

acquire_console_sem();
rotate = simple_strtoul(buf, last, 0);
fb_con_duit(fb_info, FB_EVENT_SET_CON_ROTATE_ALL, &rotate);
release_console_sem();
return count;
}

static ssize_t show_con_rotate(struct class_device *class_device, char *buf)
{
struct fb_info *fb_info = class_get_devdata(class_device);
int rotate;

acquire_console_sem();
rotate = fb_con_duit(fb_info, FB_EVENT_GET_CON_ROTATE, NULL);
release_console_sem();
return snprintf(buf, PAGE_SIZE, "%d\n", rotate);
}

static ssize_t store_virtual(struct class_device *class_device,
const char * buf, size_t count)
{
Expand Down Expand Up @@ -440,6 +504,9 @@ static struct class_device_attribute class_device_attrs[] = {
__ATTR(virtual_size, S_IRUGO|S_IWUSR, show_virtual, store_virtual),
__ATTR(name, S_IRUGO, show_name, NULL),
__ATTR(stride, S_IRUGO, show_stride, NULL),
__ATTR(rotate, S_IRUGO|S_IWUSR, show_rotate, store_rotate),
__ATTR(con_rotate, S_IRUGO|S_IWUSR, show_con_rotate, store_con_rotate),
__ATTR(con_rotate_all, S_IWUSR, NULL, store_con_rotate_all),
};

int fb_init_class_device(struct fb_info *fb_info)
Expand Down
7 changes: 7 additions & 0 deletions trunk/include/linux/fb.h
Original file line number Diff line number Diff line change
Expand Up @@ -508,6 +508,12 @@ struct fb_cursor_user {
/* The resolution of the passed in fb_info about to change and
all vc's should be changed */
#define FB_EVENT_MODE_CHANGE_ALL 0x0A
/* CONSOLE-SPECIFIC: set console rotation */
#define FB_EVENT_SET_CON_ROTATE 0x0B
/* CONSOLE-SPECIFIC: get console rotation */
#define FB_EVENT_GET_CON_ROTATE 0x0C
/* CONSOLE-SPECIFIC: rotate all consoles */
#define FB_EVENT_SET_CON_ROTATE_ALL 0x0D

struct fb_event {
struct fb_info *info;
Expand Down Expand Up @@ -836,6 +842,7 @@ extern int fb_get_color_depth(struct fb_var_screeninfo *var,
struct fb_fix_screeninfo *fix);
extern int fb_get_options(char *name, char **option);
extern int fb_new_modelist(struct fb_info *info);
extern int fb_con_duit(struct fb_info *info, int event, void *data);

extern struct fb_info *registered_fb[FB_MAX];
extern int num_registered_fb;
Expand Down

0 comments on commit eb9f221

Please sign in to comment.