xref: /openbsd/sys/dev/pci/drm/include/linux/fb.h (revision 5dea098c)
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_fix_screeninfo {
35 	paddr_t	smem_start;
36 	psize_t smem_len;
37 };
38 
39 struct fb_info {
40 	struct fb_var_screeninfo var;
41 	struct fb_fix_screeninfo fix;
42 	const struct fb_ops *fbops;
43 	char *screen_buffer;
44 	char *screen_base;
45 	bus_size_t screen_size;
46 	void *par;
47 	int fbcon_rotate_hint;
48 	bool skip_vt_switch;
49 	int flags;
50 };
51 
52 #define KHZ2PICOS(a)	(1000000000UL/(a))
53 
54 #define FB_BLANK_UNBLANK	0
55 #define FB_BLANK_NORMAL		1
56 #define FB_BLANK_HSYNC_SUSPEND	2
57 #define FB_BLANK_VSYNC_SUSPEND	3
58 #define FB_BLANK_POWERDOWN	4
59 
60 #define FBINFO_STATE_RUNNING	0
61 #define FBINFO_STATE_SUSPENDED	1
62 
63 #define FBINFO_DEFAULT		0
64 #define FBINFO_VIRTFB		1
65 #define FBINFO_READS_FAST	2
66 
67 #define FBINFO_HIDE_SMEM_START	0
68 
69 #define FB_ROTATE_UR		0
70 #define FB_ROTATE_CW		1
71 #define FB_ROTATE_UD		2
72 #define FB_ROTATE_CCW		3
73 
74 #define FB_GEN_DEFAULT_DEFERRED_IOMEM_OPS(a, b, c)
75 
76 static inline struct fb_info *
77 framebuffer_alloc(size_t size, void *dev)
78 {
79 	return kzalloc(sizeof(struct fb_info) + size, GFP_KERNEL);
80 }
81 
82 static inline void
83 fb_set_suspend(struct fb_info *fbi, int s)
84 {
85 }
86 
87 static inline void
88 framebuffer_release(struct fb_info *fbi)
89 {
90 	kfree(fbi);
91 }
92 
93 static inline int
94 fb_get_options(const char *name, char **opt)
95 {
96 	return 0;
97 }
98 
99 static inline int
100 register_framebuffer(struct fb_info *fbi)
101 {
102 	if (fbi->fbops && fbi->fbops->fb_set_par)
103 		fbi->fbops->fb_set_par(fbi);
104 	return 0;
105 }
106 
107 static inline void
108 unregister_framebuffer(struct fb_info *fbi)
109 {
110 }
111 
112 #endif
113