blob: 0b3bcb3c85347545430fe491df49943871351810 (
plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
|
/*
* Linux fbdev driver for Twin
*
* Copyright 2006 Benjamin Herrenschmidt <benh@kernel.crashing.org>
*
* This Library is free software; you can redistribute it and/or
* modify it under the terms of the GNU Library General Public License as
* published by the Free Software Foundation; either version 2 of the
* License, or (at your option) any later version.
*
* This Library is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
* Library General Public License for more details.
*
* You should have received a copy of the GNU Library General Public
* License along with the Twin Library; see the file COPYING. If not,
* write to the Free Software Foundation, Inc., 59 Temple Place - Suite 330,
* Boston, MA 02111-1307, USA.
*/
#ifndef _TWIN_FBDEV_H_
#define _TWIN_FBDEV_H_
#include "twin.h"
#include <termios.h>
#include <linux/fb.h>
typedef struct _twin_fbdev {
twin_screen_t *screen; /* twin screen */
int vt_no; /* my VT */
int vt_prev; /* previous VT */
int vt_fd; /* my tty fd */
int vt_active; /* vt is currently active */
int vt_swsig;
struct termios old_tio; /* old termios */
int old_kbmode;
int active; /* screen is active and useable */
int fb_fd; /* my fbdev fd */
int last_btn; /* last button state */
/* fbdev setup */
struct fb_var_screeninfo fb_var;
struct fb_fix_screeninfo fb_fix;
unsigned short cmap[3][256];
char *fb_base;
size_t fb_len;
char *fb_ptr;
} twin_fbdev_t;
/**
* twin_fbdev_create - create the fbdev backend
* @wanted_vt: which VT do you want ? pass -1 for auto-choose
* @switch_sig: signal for use internally for vt switch
*
* The new VT is not activated automatically. You can call
* twin_fbdev_activate() to do that. That way, you can setup your
* environment completely before you do the VT switch for smoother
* transitions.
*
* The fbdev is left to it's default settings. You can call functions
* to change them though they will only be applied if the fbdev is
* frontmost or when it is activated.
*
* Note that this implementation only supports 32bpp argb though it
* shouldn't be too hard to change that.
*
* Regarding the signal passed in switch_sig, it's the responsibility
* of the caller to make sure it's not blocked.
*/
twin_fbdev_t *twin_fbdev_create(int wanted_vt, int switch_sig);
/**
* twin_fbdev_destroy - distroy the fbdev backend
* @tf: backend pointed returned by twin_fbdev_create
*/
void twin_fbdev_destroy(twin_fbdev_t *tf);
/**
* twin_fbdev_activate - activate the fbdev
* @tf: backemd pointer
*
* This triggers a console switch to the VT allocated to the
* twin screen. It returns false if the activation failed
* due to unsupported framebuffer settings or the VT switch
* was refused.
*/
twin_bool_t twin_fbdev_activate(twin_fbdev_t *tf);
#endif /* _TWIN_FBDEV_H_ */
|