xref: /openbsd/sys/dev/pci/drm/include/linux/fb.h (revision 09467b48)
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 
13 struct fb_cmap;
14 struct fb_fillrect;
15 struct fb_copyarea;
16 struct fb_image;
17 struct fb_info;
18 
19 struct apertures_struct;
20 
21 struct fb_var_screeninfo {
22 	int pixclock;
23 	uint32_t width;
24 	uint32_t height;
25 };
26 
27 struct fb_ops {
28 	int (*fb_set_par)(struct fb_info *);
29 };
30 
31 struct fb_info {
32 	struct fb_var_screeninfo var;
33 	const struct fb_ops *fbops;
34 	char *screen_buffer;
35 	void *par;
36 	int fbcon_rotate_hint;
37 	bool skip_vt_switch;
38 	int flags;
39 };
40 
41 #define KHZ2PICOS(a)	(1000000000UL/(a))
42 
43 #define FB_BLANK_UNBLANK	0
44 #define FB_BLANK_NORMAL		1
45 #define FB_BLANK_HSYNC_SUSPEND	2
46 #define FB_BLANK_VSYNC_SUSPEND	3
47 #define FB_BLANK_POWERDOWN	4
48 
49 #define FBINFO_STATE_RUNNING	0
50 #define FBINFO_STATE_SUSPENDED	1
51 
52 #define FBINFO_HIDE_SMEM_START	0
53 
54 #define FB_ROTATE_UR		0
55 #define FB_ROTATE_CW		1
56 #define FB_ROTATE_UD		2
57 #define FB_ROTATE_CCW		3
58 
59 static inline struct fb_info *
60 framebuffer_alloc(size_t size, void *dev)
61 {
62 	return kzalloc(sizeof(struct fb_info) + size, GFP_KERNEL);
63 }
64 
65 static inline void
66 fb_set_suspend(struct fb_info *fbi, int s)
67 {
68 }
69 
70 static inline void
71 framebuffer_release(struct fb_info *fbi)
72 {
73 	kfree(fbi);
74 }
75 
76 static inline int
77 fb_get_options(const char *name, char **opt)
78 {
79 	return 0;
80 }
81 
82 static inline int
83 register_framebuffer(struct fb_info *fbi)
84 {
85 	if (fbi->fbops && fbi->fbops->fb_set_par)
86 		fbi->fbops->fb_set_par(fbi);
87 	return 0;
88 }
89 
90 static inline void
91 unregister_framebuffer(struct fb_info *fbi)
92 {
93 }
94 
95 #endif
96