xref: /openbsd/sys/dev/pci/drm/include/linux/fb.h (revision dc88ef37)
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_VIRTFB		0x0001
64 #define FBINFO_READS_FAST	0x0002
65 #define FBINFO_HIDE_SMEM_START	0x0004
66 
67 #define FB_ROTATE_UR		0
68 #define FB_ROTATE_CW		1
69 #define FB_ROTATE_UD		2
70 #define FB_ROTATE_CCW		3
71 
72 #define FB_GEN_DEFAULT_DEFERRED_IOMEM_OPS(a, b, c)
73 
74 static inline struct fb_info *
framebuffer_alloc(size_t size,void * dev)75 framebuffer_alloc(size_t size, void *dev)
76 {
77 	return kzalloc(sizeof(struct fb_info) + size, GFP_KERNEL);
78 }
79 
80 static inline void
fb_set_suspend(struct fb_info * fbi,int s)81 fb_set_suspend(struct fb_info *fbi, int s)
82 {
83 }
84 
85 static inline void
framebuffer_release(struct fb_info * fbi)86 framebuffer_release(struct fb_info *fbi)
87 {
88 	kfree(fbi);
89 }
90 
91 static inline int
fb_get_options(const char * name,char ** opt)92 fb_get_options(const char *name, char **opt)
93 {
94 	return 0;
95 }
96 
97 static inline int
register_framebuffer(struct fb_info * fbi)98 register_framebuffer(struct fb_info *fbi)
99 {
100 	if (fbi->fbops && fbi->fbops->fb_set_par)
101 		fbi->fbops->fb_set_par(fbi);
102 	return 0;
103 }
104 
105 static inline void
unregister_framebuffer(struct fb_info * fbi)106 unregister_framebuffer(struct fb_info *fbi)
107 {
108 }
109 
110 #endif
111