xref: /openbmc/linux/include/drm/drm_fb_helper.h (revision 6a4fef21)
1785b93efSDave Airlie /*
2785b93efSDave Airlie  * Copyright (c) 2006-2009 Red Hat Inc.
3785b93efSDave Airlie  * Copyright (c) 2006-2008 Intel Corporation
4785b93efSDave Airlie  * Copyright (c) 2007 Dave Airlie <airlied@linux.ie>
5785b93efSDave Airlie  *
6785b93efSDave Airlie  * DRM framebuffer helper functions
7785b93efSDave Airlie  *
8785b93efSDave Airlie  * Permission to use, copy, modify, distribute, and sell this software and its
9785b93efSDave Airlie  * documentation for any purpose is hereby granted without fee, provided that
10785b93efSDave Airlie  * the above copyright notice appear in all copies and that both that copyright
11785b93efSDave Airlie  * notice and this permission notice appear in supporting documentation, and
12785b93efSDave Airlie  * that the name of the copyright holders not be used in advertising or
13785b93efSDave Airlie  * publicity pertaining to distribution of the software without specific,
14785b93efSDave Airlie  * written prior permission.  The copyright holders make no representations
15785b93efSDave Airlie  * about the suitability of this software for any purpose.  It is provided "as
16785b93efSDave Airlie  * is" without express or implied warranty.
17785b93efSDave Airlie  *
18785b93efSDave Airlie  * THE COPYRIGHT HOLDERS DISCLAIM ALL WARRANTIES WITH REGARD TO THIS SOFTWARE,
19785b93efSDave Airlie  * INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS, IN NO
20785b93efSDave Airlie  * EVENT SHALL THE COPYRIGHT HOLDERS BE LIABLE FOR ANY SPECIAL, INDIRECT OR
21785b93efSDave Airlie  * CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE,
22785b93efSDave Airlie  * DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER
23785b93efSDave Airlie  * TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE
24785b93efSDave Airlie  * OF THIS SOFTWARE.
25785b93efSDave Airlie  *
26785b93efSDave Airlie  * Authors:
27785b93efSDave Airlie  *      Dave Airlie <airlied@linux.ie>
28785b93efSDave Airlie  *      Jesse Barnes <jesse.barnes@intel.com>
29785b93efSDave Airlie  */
30785b93efSDave Airlie #ifndef DRM_FB_HELPER_H
31785b93efSDave Airlie #define DRM_FB_HELPER_H
32785b93efSDave Airlie 
33f231af49SThomas Zimmermann struct drm_clip_rect;
344abe3520SDave Airlie struct drm_fb_helper;
354abe3520SDave Airlie 
3673289afeSVille Syrjälä #include <linux/fb.h>
377e8c9ef5SThomas Zimmermann 
387e8c9ef5SThomas Zimmermann #include <drm/drm_client.h>
391a7aba7fSJesse Barnes 
40b7b5ee59SRob Clark /**
41b7b5ee59SRob Clark  * struct drm_fb_helper_surface_size - describes fbdev size and scanout surface size
42b7b5ee59SRob Clark  * @fb_width: fbdev width
43b7b5ee59SRob Clark  * @fb_height: fbdev height
44b7b5ee59SRob Clark  * @surface_width: scanout buffer width
45b7b5ee59SRob Clark  * @surface_height: scanout buffer height
46b7b5ee59SRob Clark  * @surface_bpp: scanout buffer bpp
47b7b5ee59SRob Clark  * @surface_depth: scanout buffer depth
48b7b5ee59SRob Clark  *
49b7b5ee59SRob Clark  * Note that the scanout surface width/height may be larger than the fbdev
50b7b5ee59SRob Clark  * width/height.  In case of multiple displays, the scanout surface is sized
51b7b5ee59SRob Clark  * according to the largest width/height (so it is large enough for all CRTCs
52b7b5ee59SRob Clark  * to scanout).  But the fbdev width/height is sized to the minimum width/
53b7b5ee59SRob Clark  * height of all the displays.  This ensures that fbcon fits on the smallest
54ec8bf194SDaniel Vetter  * of the attached displays. fb_width/fb_height is used by
55ec8bf194SDaniel Vetter  * drm_fb_helper_fill_info() to fill out the &fb_info.var structure.
56b7b5ee59SRob Clark  */
5738651674SDave Airlie struct drm_fb_helper_surface_size {
5838651674SDave Airlie 	u32 fb_width;
5938651674SDave Airlie 	u32 fb_height;
6038651674SDave Airlie 	u32 surface_width;
6138651674SDave Airlie 	u32 surface_height;
6238651674SDave Airlie 	u32 surface_bpp;
6338651674SDave Airlie 	u32 surface_depth;
6438651674SDave Airlie };
6538651674SDave Airlie 
66207fd329SDaniel Vetter /**
67207fd329SDaniel Vetter  * struct drm_fb_helper_funcs - driver callbacks for the fbdev emulation library
68207fd329SDaniel Vetter  *
69207fd329SDaniel Vetter  * Driver callbacks used by the fbdev emulation helper library.
70207fd329SDaniel Vetter  */
714abe3520SDave Airlie struct drm_fb_helper_funcs {
72264d6970SDaniel Vetter 	/**
73264d6970SDaniel Vetter 	 * @fb_probe:
74264d6970SDaniel Vetter 	 *
75264d6970SDaniel Vetter 	 * Driver callback to allocate and initialize the fbdev info structure.
76264d6970SDaniel Vetter 	 * Furthermore it also needs to allocate the DRM framebuffer used to
77264d6970SDaniel Vetter 	 * back the fbdev.
78264d6970SDaniel Vetter 	 *
79264d6970SDaniel Vetter 	 * This callback is mandatory.
80264d6970SDaniel Vetter 	 *
81264d6970SDaniel Vetter 	 * RETURNS:
82264d6970SDaniel Vetter 	 *
83264d6970SDaniel Vetter 	 * The driver should return 0 on success and a negative error code on
84264d6970SDaniel Vetter 	 * failure.
85264d6970SDaniel Vetter 	 */
864abe3520SDave Airlie 	int (*fb_probe)(struct drm_fb_helper *helper,
874abe3520SDave Airlie 			struct drm_fb_helper_surface_size *sizes);
88f231af49SThomas Zimmermann 
89f231af49SThomas Zimmermann 	/**
90f231af49SThomas Zimmermann 	 * @fb_dirty:
91f231af49SThomas Zimmermann 	 *
92f231af49SThomas Zimmermann 	 * Driver callback to update the framebuffer memory. If set, fbdev
93f231af49SThomas Zimmermann 	 * emulation will invoke this callback in regular intervals after
94f231af49SThomas Zimmermann 	 * the framebuffer has been written.
95f231af49SThomas Zimmermann 	 *
96f231af49SThomas Zimmermann 	 * This callback is optional.
97f231af49SThomas Zimmermann 	 *
98f231af49SThomas Zimmermann 	 * Returns:
99f231af49SThomas Zimmermann 	 * 0 on success, or an error code otherwise.
100f231af49SThomas Zimmermann 	 */
101f231af49SThomas Zimmermann 	int (*fb_dirty)(struct drm_fb_helper *helper, struct drm_clip_rect *clip);
1024abe3520SDave Airlie };
1034abe3520SDave Airlie 
1049685cd9dSRob Clark /**
105264d6970SDaniel Vetter  * struct drm_fb_helper - main structure to emulate fbdev on top of KMS
1069685cd9dSRob Clark  * @fb: Scanout framebuffer object
1079685cd9dSRob Clark  * @dev: DRM device
1089685cd9dSRob Clark  * @funcs: driver callbacks for fb helper
1099877d8f6SThomas Zimmermann  * @info: emulated fbdev device info struct
1109685cd9dSRob Clark  * @pseudo_palette: fake palette of 16 colors
1119622349eSThomas Zimmermann  * @damage_clip: clip rectangle used with deferred_io to accumulate damage to
112eaa434deSNoralf Trønnes  *                the screen buffer
1139622349eSThomas Zimmermann  * @damage_lock: spinlock protecting @damage_clip
1147aa3d63eSThomas Zimmermann  * @damage_work: worker used to flush the framebuffer
115cfe63423SNoralf Trønnes  * @resume_work: worker used during resume if the console lock is already taken
116264d6970SDaniel Vetter  *
117264d6970SDaniel Vetter  * This is the main structure used by the fbdev helpers. Drivers supporting
118264d6970SDaniel Vetter  * fbdev emulation should embedded this into their overall driver structure.
119ea0dd85aSDaniel Vetter  * Drivers must also fill out a &struct drm_fb_helper_funcs with a few
120264d6970SDaniel Vetter  * operations.
1219685cd9dSRob Clark  */
122785b93efSDave Airlie struct drm_fb_helper {
123d536540fSNoralf Trønnes 	/**
124d536540fSNoralf Trønnes 	 * @client:
125d536540fSNoralf Trønnes 	 *
126d536540fSNoralf Trønnes 	 * DRM client used by the generic fbdev emulation.
127d536540fSNoralf Trønnes 	 */
128d536540fSNoralf Trønnes 	struct drm_client_dev client;
129d536540fSNoralf Trønnes 
130d536540fSNoralf Trønnes 	/**
131d536540fSNoralf Trønnes 	 * @buffer:
132d536540fSNoralf Trønnes 	 *
133d536540fSNoralf Trønnes 	 * Framebuffer used by the generic fbdev emulation.
134d536540fSNoralf Trønnes 	 */
135d536540fSNoralf Trønnes 	struct drm_client_buffer *buffer;
136d536540fSNoralf Trønnes 
137785b93efSDave Airlie 	struct drm_framebuffer *fb;
138785b93efSDave Airlie 	struct drm_device *dev;
1393a493879SThierry Reding 	const struct drm_fb_helper_funcs *funcs;
1409877d8f6SThomas Zimmermann 	struct fb_info *info;
14138651674SDave Airlie 	u32 pseudo_palette[17];
1429622349eSThomas Zimmermann 	struct drm_clip_rect damage_clip;
1439622349eSThomas Zimmermann 	spinlock_t damage_lock;
1447aa3d63eSThomas Zimmermann 	struct work_struct damage_work;
145cfe63423SNoralf Trønnes 	struct work_struct resume_work;
146264d6970SDaniel Vetter 
147264d6970SDaniel Vetter 	/**
148e9827d8eSThierry Reding 	 * @lock:
149e9827d8eSThierry Reding 	 *
150e9827d8eSThierry Reding 	 * Top-level FBDEV helper lock. This protects all internal data
151e9827d8eSThierry Reding 	 * structures and lists, such as @connector_info and @crtc_info.
152e9827d8eSThierry Reding 	 *
153e9827d8eSThierry Reding 	 * FIXME: fbdev emulation locking is a mess and long term we want to
154e9827d8eSThierry Reding 	 * protect all helper internal state with this lock as well as reduce
155e9827d8eSThierry Reding 	 * core KMS locking as much as possible.
156e9827d8eSThierry Reding 	 */
157e9827d8eSThierry Reding 	struct mutex lock;
158e9827d8eSThierry Reding 
159e9827d8eSThierry Reding 	/**
160264d6970SDaniel Vetter 	 * @kernel_fb_list:
161264d6970SDaniel Vetter 	 *
162264d6970SDaniel Vetter 	 * Entry on the global kernel_fb_helper_list, used for kgdb entry/exit.
163264d6970SDaniel Vetter 	 */
164785b93efSDave Airlie 	struct list_head kernel_fb_list;
1658be48d92SDave Airlie 
166264d6970SDaniel Vetter 	/**
167264d6970SDaniel Vetter 	 * @delayed_hotplug:
168264d6970SDaniel Vetter 	 *
169264d6970SDaniel Vetter 	 * A hotplug was received while fbdev wasn't in control of the DRM
170264d6970SDaniel Vetter 	 * device, i.e. another KMS master was active. The output configuration
171264d6970SDaniel Vetter 	 * needs to be reprobe when fbdev is in control again.
172264d6970SDaniel Vetter 	 */
1734abe3520SDave Airlie 	bool delayed_hotplug;
174ca91a275SDaniel Vetter 
175ca91a275SDaniel Vetter 	/**
176ca91a275SDaniel Vetter 	 * @deferred_setup:
177ca91a275SDaniel Vetter 	 *
178ca91a275SDaniel Vetter 	 * If no outputs are connected (disconnected or unknown) the FB helper
179ca91a275SDaniel Vetter 	 * code will defer setup until at least one of the outputs shows up.
180ca91a275SDaniel Vetter 	 * This field keeps track of the status so that setup can be retried
181ca91a275SDaniel Vetter 	 * at every hotplug event until it succeeds eventually.
182ca91a275SDaniel Vetter 	 *
183ca91a275SDaniel Vetter 	 * Protected by @lock.
184ca91a275SDaniel Vetter 	 */
185ca91a275SDaniel Vetter 	bool deferred_setup;
186ca91a275SDaniel Vetter 
187ca91a275SDaniel Vetter 	/**
188ca91a275SDaniel Vetter 	 * @preferred_bpp:
189ca91a275SDaniel Vetter 	 *
190ca91a275SDaniel Vetter 	 * Temporary storage for the driver's preferred BPP setting passed to
191ca91a275SDaniel Vetter 	 * FB helper initialization. This needs to be tracked so that deferred
192ca91a275SDaniel Vetter 	 * FB helper setup can pass this on.
193ca91a275SDaniel Vetter 	 *
194ca91a275SDaniel Vetter 	 * See also: @deferred_setup
195ca91a275SDaniel Vetter 	 */
196ca91a275SDaniel Vetter 	int preferred_bpp;
197e7c5c29aSThomas Zimmermann 
198260cd59aSThomas Zimmermann 	/**
199260cd59aSThomas Zimmermann 	 * @hint_leak_smem_start:
200260cd59aSThomas Zimmermann 	 *
201260cd59aSThomas Zimmermann 	 * Hint to the fbdev emulation to store the framebuffer's physical
202260cd59aSThomas Zimmermann 	 * address in struct &fb_info.fix.smem_start. If the hint is unset,
203260cd59aSThomas Zimmermann 	 * the smem_start field should always be cleared to zero.
204260cd59aSThomas Zimmermann 	 */
205e7c5c29aSThomas Zimmermann 	bool hint_leak_smem_start;
206d6591da5SJavier Martinez Canillas 
207d6591da5SJavier Martinez Canillas #ifdef CONFIG_FB_DEFERRED_IO
208d6591da5SJavier Martinez Canillas 	/**
209d6591da5SJavier Martinez Canillas 	 * @fbdefio:
210d6591da5SJavier Martinez Canillas 	 *
211d6591da5SJavier Martinez Canillas 	 * Temporary storage for the driver's FB deferred I/O handler. If the
212d6591da5SJavier Martinez Canillas 	 * driver uses the DRM fbdev emulation layer, this is set by the core
213d6591da5SJavier Martinez Canillas 	 * to a generic deferred I/O handler if a driver is preferring to use
214d6591da5SJavier Martinez Canillas 	 * a shadow buffer.
215d6591da5SJavier Martinez Canillas 	 */
216d6591da5SJavier Martinez Canillas 	struct fb_deferred_io fbdefio;
217d6591da5SJavier Martinez Canillas #endif
218785b93efSDave Airlie };
219785b93efSDave Airlie 
220d536540fSNoralf Trønnes static inline struct drm_fb_helper *
221d536540fSNoralf Trønnes drm_fb_helper_from_client(struct drm_client_dev *client)
222d536540fSNoralf Trønnes {
223d536540fSNoralf Trønnes 	return container_of(client, struct drm_fb_helper, client);
224d536540fSNoralf Trønnes }
225d536540fSNoralf Trønnes 
22674064893SStefan Christ /**
22721bf75ecSStefan Christ  * define DRM_FB_HELPER_DEFAULT_OPS - helper define for drm drivers
22874064893SStefan Christ  *
22974064893SStefan Christ  * Helper define to register default implementations of drm_fb_helper
23074064893SStefan Christ  * functions. To be used in struct fb_ops of drm drivers.
23174064893SStefan Christ  */
23274064893SStefan Christ #define DRM_FB_HELPER_DEFAULT_OPS \
23374064893SStefan Christ 	.fb_check_var	= drm_fb_helper_check_var, \
23474064893SStefan Christ 	.fb_set_par	= drm_fb_helper_set_par, \
23574064893SStefan Christ 	.fb_setcmap	= drm_fb_helper_setcmap, \
23674064893SStefan Christ 	.fb_blank	= drm_fb_helper_blank, \
2371e008928SStefan Christ 	.fb_pan_display	= drm_fb_helper_pan_display, \
2381e008928SStefan Christ 	.fb_debug_enter = drm_fb_helper_debug_enter, \
2390f3bbe07SMaxime Ripard 	.fb_debug_leave = drm_fb_helper_debug_leave, \
2400f3bbe07SMaxime Ripard 	.fb_ioctl	= drm_fb_helper_ioctl
24174064893SStefan Christ 
242a03fdcb1SArchit Taneja #ifdef CONFIG_DRM_FBDEV_EMULATION
24310a23102SThierry Reding void drm_fb_helper_prepare(struct drm_device *dev, struct drm_fb_helper *helper,
2446c80a93bSThomas Zimmermann 			   unsigned int preferred_bpp,
24510a23102SThierry Reding 			   const struct drm_fb_helper_funcs *funcs);
2464825797cSThomas Zimmermann void drm_fb_helper_unprepare(struct drm_fb_helper *fb_helper);
2472dea2d11SPankaj Bharadiya int drm_fb_helper_init(struct drm_device *dev, struct drm_fb_helper *helper);
2484abe3520SDave Airlie void drm_fb_helper_fini(struct drm_fb_helper *helper);
249785b93efSDave Airlie int drm_fb_helper_blank(int blank, struct fb_info *info);
250785b93efSDave Airlie int drm_fb_helper_pan_display(struct fb_var_screeninfo *var,
251785b93efSDave Airlie 			      struct fb_info *info);
252785b93efSDave Airlie int drm_fb_helper_set_par(struct fb_info *info);
253785b93efSDave Airlie int drm_fb_helper_check_var(struct fb_var_screeninfo *var,
254785b93efSDave Airlie 			    struct fb_info *info);
255785b93efSDave Airlie 
256b7bdf0a8SDaniel Vetter int drm_fb_helper_restore_fbdev_mode_unlocked(struct drm_fb_helper *fb_helper);
257b8017d6cSArchit Taneja 
2587fd50bc3SThomas Zimmermann struct fb_info *drm_fb_helper_alloc_info(struct drm_fb_helper *fb_helper);
259*6a4fef21SThomas Zimmermann void drm_fb_helper_release_info(struct drm_fb_helper *fb_helper);
260afb0ff78SThomas Zimmermann void drm_fb_helper_unregister_info(struct drm_fb_helper *fb_helper);
2613df3116aSDaniel Vetter void drm_fb_helper_fill_info(struct fb_info *info,
2623df3116aSDaniel Vetter 			     struct drm_fb_helper *fb_helper,
2633df3116aSDaniel Vetter 			     struct drm_fb_helper_surface_size *sizes);
2643632ef89SDave Airlie 
265e80eec1bSThomas Zimmermann void drm_fb_helper_deferred_io(struct fb_info *info, struct list_head *pagereflist);
266eaa434deSNoralf Trønnes 
267cbb1a82eSArchit Taneja ssize_t drm_fb_helper_sys_read(struct fb_info *info, char __user *buf,
268cbb1a82eSArchit Taneja 			       size_t count, loff_t *ppos);
269cbb1a82eSArchit Taneja ssize_t drm_fb_helper_sys_write(struct fb_info *info, const char __user *buf,
270cbb1a82eSArchit Taneja 				size_t count, loff_t *ppos);
271cbb1a82eSArchit Taneja 
272742547b7SArchit Taneja void drm_fb_helper_sys_fillrect(struct fb_info *info,
273742547b7SArchit Taneja 				const struct fb_fillrect *rect);
274742547b7SArchit Taneja void drm_fb_helper_sys_copyarea(struct fb_info *info,
275742547b7SArchit Taneja 				const struct fb_copyarea *area);
276742547b7SArchit Taneja void drm_fb_helper_sys_imageblit(struct fb_info *info,
277742547b7SArchit Taneja 				 const struct fb_image *image);
278742547b7SArchit Taneja 
27998378091SThomas Zimmermann ssize_t drm_fb_helper_cfb_read(struct fb_info *info, char __user *buf,
28098378091SThomas Zimmermann 			       size_t count, loff_t *ppos);
28198378091SThomas Zimmermann ssize_t drm_fb_helper_cfb_write(struct fb_info *info, const char __user *buf,
28298378091SThomas Zimmermann 				size_t count, loff_t *ppos);
28398378091SThomas Zimmermann 
284742547b7SArchit Taneja void drm_fb_helper_cfb_fillrect(struct fb_info *info,
285742547b7SArchit Taneja 				const struct fb_fillrect *rect);
286742547b7SArchit Taneja void drm_fb_helper_cfb_copyarea(struct fb_info *info,
287742547b7SArchit Taneja 				const struct fb_copyarea *area);
288742547b7SArchit Taneja void drm_fb_helper_cfb_imageblit(struct fb_info *info,
289742547b7SArchit Taneja 				 const struct fb_image *image);
290742547b7SArchit Taneja 
29128579f37SDaniel Vetter void drm_fb_helper_set_suspend(struct drm_fb_helper *fb_helper, bool suspend);
292cfe63423SNoralf Trønnes void drm_fb_helper_set_suspend_unlocked(struct drm_fb_helper *fb_helper,
29328579f37SDaniel Vetter 					bool suspend);
294fdefa58aSArchit Taneja 
295068143d3SDave Airlie int drm_fb_helper_setcmap(struct fb_cmap *cmap, struct fb_info *info);
296d50ba256SDave Airlie 
2970f3bbe07SMaxime Ripard int drm_fb_helper_ioctl(struct fb_info *info, unsigned int cmd,
2980f3bbe07SMaxime Ripard 			unsigned long arg);
2990f3bbe07SMaxime Ripard 
3007394371dSChris Wilson int drm_fb_helper_hotplug_event(struct drm_fb_helper *fb_helper);
3016c80a93bSThomas Zimmermann int drm_fb_helper_initial_config(struct drm_fb_helper *fb_helper);
3021a7aba7fSJesse Barnes int drm_fb_helper_debug_enter(struct fb_info *info);
3031a7aba7fSJesse Barnes int drm_fb_helper_debug_leave(struct fb_info *info);
304304a4f6aSNoralf Trønnes 
305304a4f6aSNoralf Trønnes void drm_fb_helper_lastclose(struct drm_device *dev);
306304a4f6aSNoralf Trønnes void drm_fb_helper_output_poll_changed(struct drm_device *dev);
307a03fdcb1SArchit Taneja #else
308a03fdcb1SArchit Taneja static inline void drm_fb_helper_prepare(struct drm_device *dev,
309a03fdcb1SArchit Taneja 					 struct drm_fb_helper *helper,
3106c80a93bSThomas Zimmermann 					 unsigned int preferred_bpp,
311a03fdcb1SArchit Taneja 					 const struct drm_fb_helper_funcs *funcs)
312a03fdcb1SArchit Taneja {
313a03fdcb1SArchit Taneja }
314a03fdcb1SArchit Taneja 
3154825797cSThomas Zimmermann static inline void drm_fb_helper_unprepare(struct drm_fb_helper *fb_helper)
3164825797cSThomas Zimmermann {
3174825797cSThomas Zimmermann }
3184825797cSThomas Zimmermann 
319a03fdcb1SArchit Taneja static inline int drm_fb_helper_init(struct drm_device *dev,
3202dea2d11SPankaj Bharadiya 		       struct drm_fb_helper *helper)
321a03fdcb1SArchit Taneja {
322a65eb01fSNoralf Trønnes 	/* So drivers can use it to free the struct */
323a65eb01fSNoralf Trønnes 	helper->dev = dev;
324a65eb01fSNoralf Trønnes 	dev->fb_helper = helper;
325a65eb01fSNoralf Trønnes 
326a03fdcb1SArchit Taneja 	return 0;
327a03fdcb1SArchit Taneja }
328a03fdcb1SArchit Taneja 
329a03fdcb1SArchit Taneja static inline void drm_fb_helper_fini(struct drm_fb_helper *helper)
330a03fdcb1SArchit Taneja {
331a65eb01fSNoralf Trønnes 	if (helper && helper->dev)
332a65eb01fSNoralf Trønnes 		helper->dev->fb_helper = NULL;
333a03fdcb1SArchit Taneja }
334a03fdcb1SArchit Taneja 
335a03fdcb1SArchit Taneja static inline int drm_fb_helper_blank(int blank, struct fb_info *info)
336a03fdcb1SArchit Taneja {
337a03fdcb1SArchit Taneja 	return 0;
338a03fdcb1SArchit Taneja }
339a03fdcb1SArchit Taneja 
340a03fdcb1SArchit Taneja static inline int drm_fb_helper_pan_display(struct fb_var_screeninfo *var,
341a03fdcb1SArchit Taneja 					    struct fb_info *info)
342a03fdcb1SArchit Taneja {
343a03fdcb1SArchit Taneja 	return 0;
344a03fdcb1SArchit Taneja }
345a03fdcb1SArchit Taneja 
346a03fdcb1SArchit Taneja static inline int drm_fb_helper_set_par(struct fb_info *info)
347a03fdcb1SArchit Taneja {
348a03fdcb1SArchit Taneja 	return 0;
349a03fdcb1SArchit Taneja }
350a03fdcb1SArchit Taneja 
351a03fdcb1SArchit Taneja static inline int drm_fb_helper_check_var(struct fb_var_screeninfo *var,
352a03fdcb1SArchit Taneja 					  struct fb_info *info)
353a03fdcb1SArchit Taneja {
354a03fdcb1SArchit Taneja 	return 0;
355a03fdcb1SArchit Taneja }
356a03fdcb1SArchit Taneja 
357b7bdf0a8SDaniel Vetter static inline int
358a03fdcb1SArchit Taneja drm_fb_helper_restore_fbdev_mode_unlocked(struct drm_fb_helper *fb_helper)
359a03fdcb1SArchit Taneja {
360b7bdf0a8SDaniel Vetter 	return 0;
361a03fdcb1SArchit Taneja }
362a03fdcb1SArchit Taneja 
363a03fdcb1SArchit Taneja static inline struct fb_info *
3647fd50bc3SThomas Zimmermann drm_fb_helper_alloc_info(struct drm_fb_helper *fb_helper)
365a03fdcb1SArchit Taneja {
366a03fdcb1SArchit Taneja 	return NULL;
367a03fdcb1SArchit Taneja }
368a03fdcb1SArchit Taneja 
369*6a4fef21SThomas Zimmermann static inline void drm_fb_helper_release_info(struct drm_fb_helper *fb_helper)
370*6a4fef21SThomas Zimmermann {
371*6a4fef21SThomas Zimmermann }
372*6a4fef21SThomas Zimmermann 
373afb0ff78SThomas Zimmermann static inline void drm_fb_helper_unregister_info(struct drm_fb_helper *fb_helper)
374a03fdcb1SArchit Taneja {
375a03fdcb1SArchit Taneja }
376a03fdcb1SArchit Taneja 
377ec8bf194SDaniel Vetter static inline void
378ec8bf194SDaniel Vetter drm_fb_helper_fill_info(struct fb_info *info,
379a03fdcb1SArchit Taneja 			struct drm_fb_helper *fb_helper,
380ec8bf194SDaniel Vetter 			struct drm_fb_helper_surface_size *sizes)
381a03fdcb1SArchit Taneja {
382a03fdcb1SArchit Taneja }
383a03fdcb1SArchit Taneja 
384a03fdcb1SArchit Taneja static inline int drm_fb_helper_setcmap(struct fb_cmap *cmap,
385a03fdcb1SArchit Taneja 					struct fb_info *info)
386a03fdcb1SArchit Taneja {
387a03fdcb1SArchit Taneja 	return 0;
388a03fdcb1SArchit Taneja }
389a03fdcb1SArchit Taneja 
3900f3bbe07SMaxime Ripard static inline int drm_fb_helper_ioctl(struct fb_info *info, unsigned int cmd,
3910f3bbe07SMaxime Ripard 				      unsigned long arg)
3920f3bbe07SMaxime Ripard {
3930f3bbe07SMaxime Ripard 	return 0;
3940f3bbe07SMaxime Ripard }
3950f3bbe07SMaxime Ripard 
396eaa434deSNoralf Trønnes static inline void drm_fb_helper_deferred_io(struct fb_info *info,
397eaa434deSNoralf Trønnes 					     struct list_head *pagelist)
398eaa434deSNoralf Trønnes {
399eaa434deSNoralf Trønnes }
400eaa434deSNoralf Trønnes 
40148c9571cSNoralf Trønnes static inline int drm_fb_helper_defio_init(struct drm_fb_helper *fb_helper)
40248c9571cSNoralf Trønnes {
40348c9571cSNoralf Trønnes 	return -ENODEV;
40448c9571cSNoralf Trønnes }
40548c9571cSNoralf Trønnes 
406a03fdcb1SArchit Taneja static inline ssize_t drm_fb_helper_sys_read(struct fb_info *info,
407a03fdcb1SArchit Taneja 					     char __user *buf, size_t count,
408a03fdcb1SArchit Taneja 					     loff_t *ppos)
409a03fdcb1SArchit Taneja {
410a03fdcb1SArchit Taneja 	return -ENODEV;
411a03fdcb1SArchit Taneja }
412a03fdcb1SArchit Taneja 
413a03fdcb1SArchit Taneja static inline ssize_t drm_fb_helper_sys_write(struct fb_info *info,
414a03fdcb1SArchit Taneja 					      const char __user *buf,
415a03fdcb1SArchit Taneja 					      size_t count, loff_t *ppos)
416a03fdcb1SArchit Taneja {
417a03fdcb1SArchit Taneja 	return -ENODEV;
418a03fdcb1SArchit Taneja }
419a03fdcb1SArchit Taneja 
420a03fdcb1SArchit Taneja static inline void drm_fb_helper_sys_fillrect(struct fb_info *info,
421a03fdcb1SArchit Taneja 					      const struct fb_fillrect *rect)
422a03fdcb1SArchit Taneja {
423a03fdcb1SArchit Taneja }
424a03fdcb1SArchit Taneja 
425a03fdcb1SArchit Taneja static inline void drm_fb_helper_sys_copyarea(struct fb_info *info,
426a03fdcb1SArchit Taneja 					      const struct fb_copyarea *area)
427a03fdcb1SArchit Taneja {
428a03fdcb1SArchit Taneja }
429a03fdcb1SArchit Taneja 
430a03fdcb1SArchit Taneja static inline void drm_fb_helper_sys_imageblit(struct fb_info *info,
431a03fdcb1SArchit Taneja 					       const struct fb_image *image)
432a03fdcb1SArchit Taneja {
433a03fdcb1SArchit Taneja }
434a03fdcb1SArchit Taneja 
43598378091SThomas Zimmermann static inline ssize_t drm_fb_helper_cfb_read(struct fb_info *info, char __user *buf,
43698378091SThomas Zimmermann 					     size_t count, loff_t *ppos)
43798378091SThomas Zimmermann {
43898378091SThomas Zimmermann 	return -ENODEV;
43998378091SThomas Zimmermann }
44098378091SThomas Zimmermann 
44198378091SThomas Zimmermann static inline ssize_t drm_fb_helper_cfb_write(struct fb_info *info, const char __user *buf,
44298378091SThomas Zimmermann 					      size_t count, loff_t *ppos)
44398378091SThomas Zimmermann {
44498378091SThomas Zimmermann 	return -ENODEV;
44598378091SThomas Zimmermann }
44698378091SThomas Zimmermann 
447a03fdcb1SArchit Taneja static inline void drm_fb_helper_cfb_fillrect(struct fb_info *info,
448a03fdcb1SArchit Taneja 					      const struct fb_fillrect *rect)
449a03fdcb1SArchit Taneja {
450a03fdcb1SArchit Taneja }
451a03fdcb1SArchit Taneja 
452a03fdcb1SArchit Taneja static inline void drm_fb_helper_cfb_copyarea(struct fb_info *info,
453a03fdcb1SArchit Taneja 					      const struct fb_copyarea *area)
454a03fdcb1SArchit Taneja {
455a03fdcb1SArchit Taneja }
456a03fdcb1SArchit Taneja 
457a03fdcb1SArchit Taneja static inline void drm_fb_helper_cfb_imageblit(struct fb_info *info,
458a03fdcb1SArchit Taneja 					       const struct fb_image *image)
459a03fdcb1SArchit Taneja {
460a03fdcb1SArchit Taneja }
461a03fdcb1SArchit Taneja 
462a03fdcb1SArchit Taneja static inline void drm_fb_helper_set_suspend(struct drm_fb_helper *fb_helper,
46328579f37SDaniel Vetter 					     bool suspend)
464a03fdcb1SArchit Taneja {
465a03fdcb1SArchit Taneja }
466a03fdcb1SArchit Taneja 
467cfe63423SNoralf Trønnes static inline void
46828579f37SDaniel Vetter drm_fb_helper_set_suspend_unlocked(struct drm_fb_helper *fb_helper, bool suspend)
469cfe63423SNoralf Trønnes {
470cfe63423SNoralf Trønnes }
471cfe63423SNoralf Trønnes 
472a03fdcb1SArchit Taneja static inline int drm_fb_helper_hotplug_event(struct drm_fb_helper *fb_helper)
473a03fdcb1SArchit Taneja {
474a03fdcb1SArchit Taneja 	return 0;
475a03fdcb1SArchit Taneja }
476a03fdcb1SArchit Taneja 
4776c80a93bSThomas Zimmermann static inline int drm_fb_helper_initial_config(struct drm_fb_helper *fb_helper)
478a03fdcb1SArchit Taneja {
479a03fdcb1SArchit Taneja 	return 0;
480a03fdcb1SArchit Taneja }
481a03fdcb1SArchit Taneja 
482a03fdcb1SArchit Taneja static inline int drm_fb_helper_debug_enter(struct fb_info *info)
483a03fdcb1SArchit Taneja {
484a03fdcb1SArchit Taneja 	return 0;
485a03fdcb1SArchit Taneja }
486a03fdcb1SArchit Taneja 
487a03fdcb1SArchit Taneja static inline int drm_fb_helper_debug_leave(struct fb_info *info)
488a03fdcb1SArchit Taneja {
489a03fdcb1SArchit Taneja 	return 0;
490a03fdcb1SArchit Taneja }
491a03fdcb1SArchit Taneja 
492304a4f6aSNoralf Trønnes static inline void drm_fb_helper_lastclose(struct drm_device *dev)
493304a4f6aSNoralf Trønnes {
494304a4f6aSNoralf Trønnes }
495304a4f6aSNoralf Trønnes 
496304a4f6aSNoralf Trønnes static inline void drm_fb_helper_output_poll_changed(struct drm_device *dev)
497304a4f6aSNoralf Trønnes {
498304a4f6aSNoralf Trønnes }
4990a3bfe29SChris Wilson #endif
5000a3bfe29SChris Wilson 
501785b93efSDave Airlie #endif
502