xref: /openbsd-src/sys/dev/pci/drm/include/linux/fb.h (revision 3374c67d44f9b75b98444cbf63020f777792342e)
1 /* Public domain. */
2 
3 #ifndef _LINUX_FB_H
4 #define _LINUX_FB_H
5 
6 #include <sys/types.h>
7 #include <linux/slab.h>
8 #include <linux/notifier.h>
9 #include <linux/backlight.h>
10 #include <linux/kgdb.h>
11 #include <linux/fs.h>
12 #include <linux/i2c.h> /* via uapi/linux/fb.h */
13 
14 struct fb_cmap;
15 struct fb_fillrect;
16 struct fb_copyarea;
17 struct fb_image;
18 struct fb_info;
19 
20 struct apertures_struct;
21 
22 struct fb_var_screeninfo {
23 	int pixclock;
24 	uint32_t xres;
25 	uint32_t yres;
26 	uint32_t width;
27 	uint32_t height;
28 };
29 
30 struct fb_ops {
31 	int (*fb_set_par)(struct fb_info *);
32 };
33 
34 struct fb_info {
35 	struct fb_var_screeninfo var;
36 	const struct fb_ops *fbops;
37 	char *screen_buffer;
38 	char *screen_base;
39 	bus_size_t screen_size;
40 	void *par;
41 	int fbcon_rotate_hint;
42 	bool skip_vt_switch;
43 	int flags;
44 };
45 
46 #define KHZ2PICOS(a)	(1000000000UL/(a))
47 
48 #define FB_BLANK_UNBLANK	0
49 #define FB_BLANK_NORMAL		1
50 #define FB_BLANK_HSYNC_SUSPEND	2
51 #define FB_BLANK_VSYNC_SUSPEND	3
52 #define FB_BLANK_POWERDOWN	4
53 
54 #define FBINFO_STATE_RUNNING	0
55 #define FBINFO_STATE_SUSPENDED	1
56 
57 #define FBINFO_DEFAULT		0
58 #define FBINFO_VIRTFB		1
59 #define FBINFO_READS_FAST	2
60 
61 #define FBINFO_HIDE_SMEM_START	0
62 
63 #define FB_ROTATE_UR		0
64 #define FB_ROTATE_CW		1
65 #define FB_ROTATE_UD		2
66 #define FB_ROTATE_CCW		3
67 
68 static inline struct fb_info *
69 framebuffer_alloc(size_t size, void *dev)
70 {
71 	return kzalloc(sizeof(struct fb_info) + size, GFP_KERNEL);
72 }
73 
74 static inline void
75 fb_set_suspend(struct fb_info *fbi, int s)
76 {
77 }
78 
79 static inline void
80 framebuffer_release(struct fb_info *fbi)
81 {
82 	kfree(fbi);
83 }
84 
85 static inline int
86 fb_get_options(const char *name, char **opt)
87 {
88 	return 0;
89 }
90 
91 static inline int
92 register_framebuffer(struct fb_info *fbi)
93 {
94 	if (fbi->fbops && fbi->fbops->fb_set_par)
95 		fbi->fbops->fb_set_par(fbi);
96 	return 0;
97 }
98 
99 static inline void
100 unregister_framebuffer(struct fb_info *fbi)
101 {
102 }
103 
104 #endif
105