File: fbdisplay.h

package info (click to toggle)
softgun 0.16-2.1
  • links: PTS
  • area: main
  • in suites: lenny, squeeze
  • size: 3,964 kB
  • ctags: 15,365
  • sloc: ansic: 89,221; makefile: 173
file content (78 lines) | stat: -rw-r--r-- 2,138 bytes parent folder | download
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
#ifndef __FBDISPLAY
#define	__FBDISPLAY

typedef struct FbUpdateRequest {
	unsigned int offset;	/* Start address relative to framebuffer start */
	unsigned int count;	/* bytes submitted in fbdata */
	uint8_t *fbdata;
} FbUpdateRequest;

typedef struct FbFormat {
	int red_bits;
	int green_bits;
	int blue_bits;
	int red_shift;
	int green_shift;
	int blue_shift;
	int bits_per_pixel; /* This is the layout in memory 	      */
	int depth;	    /* This is the number of really used bits */
} FbFormat;


typedef struct FbCtrlMsg {
	int msg;
} FbCtrlMsg;

/* 
 * -----------------------------------------------------------------------------------
 * The framebuffer display class. Every Framebuffer display needs to implement this 
 * An example for an FbDisplay is the RFBServer
 * -----------------------------------------------------------------------------------
 */
typedef struct FbDisplay {
	void *owner;
	void (*setFbFormat)(struct FbDisplay *,FbFormat *);	
	int (*fbUpdateRequest)(struct FbDisplay *,FbUpdateRequest *);
	int (*fbCtrlMsg)(struct FbDisplay *,FbCtrlMsg *);
} FbDisplay;

/*
 * --------------------------------------------------------------------
 * FB_Display constructor needs to be called with information about 
 * the display resulution, the depth of each color.
 * The LCD controller emulator has to set the information about
 * the storage format in memory 
 * --------------------------------------------------------------------
 */

static inline int 
FbDisplay_UpdateRequest(FbDisplay *disp,FbUpdateRequest *req) 
{
	if(disp && disp->fbUpdateRequest) {
		return disp->fbUpdateRequest(disp,req);
	} else {
		fprintf(stderr,"Display does not handle updates\n");
		return -1;
	}
}
static inline void 
FbDisplay_SetFbFormat(FbDisplay *disp,FbFormat *fbf) 
{
	if(disp && disp->setFbFormat) {
		return disp->setFbFormat(disp,fbf);
	} else {
		fprintf(stderr,"Display does not take framebuffer info\n");
		return;
	}
}

static inline int
FbDisplay_ControlMessage(FbDisplay *disp,FbCtrlMsg *msg) 
{
	if(disp && disp->fbCtrlMsg) {
		return disp->fbCtrlMsg(disp,msg);
	} else {
		return -1;
	}
}
#endif /* __FBSIDPLAY */