Home | History | Annotate | Line # | Download | only in drm
      1  1.14  riastrad /*	$NetBSD: drm_fb_helper.h,v 1.14 2021/12/19 10:46:44 riastradh Exp $	*/
      2   1.7  riastrad 
      3   1.1  riastrad /*
      4   1.1  riastrad  * Copyright (c) 2006-2009 Red Hat Inc.
      5   1.1  riastrad  * Copyright (c) 2006-2008 Intel Corporation
      6   1.1  riastrad  * Copyright (c) 2007 Dave Airlie <airlied (at) linux.ie>
      7   1.1  riastrad  *
      8   1.1  riastrad  * DRM framebuffer helper functions
      9   1.1  riastrad  *
     10   1.1  riastrad  * Permission to use, copy, modify, distribute, and sell this software and its
     11   1.1  riastrad  * documentation for any purpose is hereby granted without fee, provided that
     12   1.1  riastrad  * the above copyright notice appear in all copies and that both that copyright
     13   1.1  riastrad  * notice and this permission notice appear in supporting documentation, and
     14   1.1  riastrad  * that the name of the copyright holders not be used in advertising or
     15   1.1  riastrad  * publicity pertaining to distribution of the software without specific,
     16   1.1  riastrad  * written prior permission.  The copyright holders make no representations
     17   1.1  riastrad  * about the suitability of this software for any purpose.  It is provided "as
     18   1.1  riastrad  * is" without express or implied warranty.
     19   1.1  riastrad  *
     20   1.1  riastrad  * THE COPYRIGHT HOLDERS DISCLAIM ALL WARRANTIES WITH REGARD TO THIS SOFTWARE,
     21   1.1  riastrad  * INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS, IN NO
     22   1.1  riastrad  * EVENT SHALL THE COPYRIGHT HOLDERS BE LIABLE FOR ANY SPECIAL, INDIRECT OR
     23   1.1  riastrad  * CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE,
     24   1.1  riastrad  * DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER
     25   1.1  riastrad  * TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE
     26   1.1  riastrad  * OF THIS SOFTWARE.
     27   1.1  riastrad  *
     28   1.1  riastrad  * Authors:
     29   1.1  riastrad  *      Dave Airlie <airlied (at) linux.ie>
     30   1.1  riastrad  *      Jesse Barnes <jesse.barnes (at) intel.com>
     31   1.1  riastrad  */
     32   1.1  riastrad #ifndef DRM_FB_HELPER_H
     33   1.1  riastrad #define DRM_FB_HELPER_H
     34   1.1  riastrad 
     35  1.10  riastrad struct apertures_struct;
     36   1.1  riastrad struct drm_fb_helper;
     37   1.1  riastrad 
     38   1.9  riastrad #include <drm/drm_client.h>
     39   1.9  riastrad #include <drm/drm_crtc.h>
     40   1.9  riastrad #include <drm/drm_device.h>
     41   1.1  riastrad #include <linux/kgdb.h>
     42   1.9  riastrad #include <linux/vgaarb.h>
     43   1.1  riastrad 
     44   1.4  riastrad #ifdef __NetBSD__
     45   1.5  riastrad #include <sys/device_if.h>
     46   1.4  riastrad #endif
     47   1.4  riastrad 
     48   1.9  riastrad enum mode_set_atomic {
     49   1.9  riastrad 	LEAVE_ATOMIC_MODE_SET,
     50   1.9  riastrad 	ENTER_ATOMIC_MODE_SET,
     51   1.1  riastrad };
     52   1.1  riastrad 
     53   1.7  riastrad /**
     54   1.7  riastrad  * struct drm_fb_helper_surface_size - describes fbdev size and scanout surface size
     55   1.7  riastrad  * @fb_width: fbdev width
     56   1.7  riastrad  * @fb_height: fbdev height
     57   1.7  riastrad  * @surface_width: scanout buffer width
     58   1.7  riastrad  * @surface_height: scanout buffer height
     59   1.7  riastrad  * @surface_bpp: scanout buffer bpp
     60   1.7  riastrad  * @surface_depth: scanout buffer depth
     61   1.7  riastrad  *
     62   1.7  riastrad  * Note that the scanout surface width/height may be larger than the fbdev
     63   1.7  riastrad  * width/height.  In case of multiple displays, the scanout surface is sized
     64   1.7  riastrad  * according to the largest width/height (so it is large enough for all CRTCs
     65   1.7  riastrad  * to scanout).  But the fbdev width/height is sized to the minimum width/
     66   1.7  riastrad  * height of all the displays.  This ensures that fbcon fits on the smallest
     67   1.9  riastrad  * of the attached displays. fb_width/fb_height is used by
     68   1.9  riastrad  * drm_fb_helper_fill_info() to fill out the &fb_info.var structure.
     69   1.7  riastrad  */
     70   1.1  riastrad struct drm_fb_helper_surface_size {
     71   1.1  riastrad 	u32 fb_width;
     72   1.1  riastrad 	u32 fb_height;
     73   1.1  riastrad 	u32 surface_width;
     74   1.1  riastrad 	u32 surface_height;
     75   1.1  riastrad 	u32 surface_bpp;
     76   1.1  riastrad 	u32 surface_depth;
     77   1.1  riastrad };
     78   1.1  riastrad 
     79   1.3  riastrad /**
     80   1.3  riastrad  * struct drm_fb_helper_funcs - driver callbacks for the fbdev emulation library
     81   1.3  riastrad  *
     82   1.3  riastrad  * Driver callbacks used by the fbdev emulation helper library.
     83   1.3  riastrad  */
     84   1.1  riastrad struct drm_fb_helper_funcs {
     85   1.9  riastrad 	/**
     86   1.9  riastrad 	 * @fb_probe:
     87   1.9  riastrad 	 *
     88   1.9  riastrad 	 * Driver callback to allocate and initialize the fbdev info structure.
     89   1.9  riastrad 	 * Furthermore it also needs to allocate the DRM framebuffer used to
     90   1.9  riastrad 	 * back the fbdev.
     91   1.9  riastrad 	 *
     92   1.9  riastrad 	 * This callback is mandatory.
     93   1.9  riastrad 	 *
     94   1.9  riastrad 	 * RETURNS:
     95   1.9  riastrad 	 *
     96   1.9  riastrad 	 * The driver should return 0 on success and a negative error code on
     97   1.9  riastrad 	 * failure.
     98   1.9  riastrad 	 */
     99   1.1  riastrad 	int (*fb_probe)(struct drm_fb_helper *helper,
    100   1.1  riastrad 			struct drm_fb_helper_surface_size *sizes);
    101   1.1  riastrad };
    102   1.1  riastrad 
    103   1.7  riastrad /**
    104   1.9  riastrad  * struct drm_fb_helper - main structure to emulate fbdev on top of KMS
    105   1.9  riastrad  * @fb: Scanout framebuffer object
    106   1.9  riastrad  * @dev: DRM device
    107   1.7  riastrad  * @funcs: driver callbacks for fb helper
    108   1.7  riastrad  * @fbdev: emulated fbdev device info struct
    109   1.7  riastrad  * @pseudo_palette: fake palette of 16 colors
    110   1.9  riastrad  * @dirty_clip: clip rectangle used with deferred_io to accumulate damage to
    111   1.9  riastrad  *              the screen buffer
    112   1.9  riastrad  * @dirty_lock: spinlock protecting @dirty_clip
    113   1.9  riastrad  * @dirty_work: worker used to flush the framebuffer
    114   1.9  riastrad  * @resume_work: worker used during resume if the console lock is already taken
    115   1.9  riastrad  *
    116   1.9  riastrad  * This is the main structure used by the fbdev helpers. Drivers supporting
    117   1.9  riastrad  * fbdev emulation should embedded this into their overall driver structure.
    118   1.9  riastrad  * Drivers must also fill out a &struct drm_fb_helper_funcs with a few
    119   1.9  riastrad  * operations.
    120   1.7  riastrad  */
    121   1.1  riastrad struct drm_fb_helper {
    122   1.9  riastrad 	/**
    123   1.9  riastrad 	 * @client:
    124   1.9  riastrad 	 *
    125   1.9  riastrad 	 * DRM client used by the generic fbdev emulation.
    126   1.9  riastrad 	 */
    127   1.9  riastrad 	struct drm_client_dev client;
    128   1.9  riastrad 
    129   1.9  riastrad 	/**
    130   1.9  riastrad 	 * @buffer:
    131   1.9  riastrad 	 *
    132   1.9  riastrad 	 * Framebuffer used by the generic fbdev emulation.
    133   1.9  riastrad 	 */
    134   1.9  riastrad 	struct drm_client_buffer *buffer;
    135   1.9  riastrad 
    136   1.1  riastrad 	struct drm_framebuffer *fb;
    137   1.1  riastrad 	struct drm_device *dev;
    138   1.7  riastrad 	const struct drm_fb_helper_funcs *funcs;
    139   1.4  riastrad #ifdef __NetBSD__		/* XXX fb info */
    140   1.5  riastrad 	device_t fbdev;
    141   1.4  riastrad #else
    142   1.1  riastrad 	struct fb_info *fbdev;
    143   1.2  riastrad #endif
    144   1.1  riastrad 	u32 pseudo_palette[17];
    145   1.9  riastrad 	struct drm_clip_rect dirty_clip;
    146   1.9  riastrad 	spinlock_t dirty_lock;
    147   1.9  riastrad 	struct work_struct dirty_work;
    148   1.9  riastrad 	struct work_struct resume_work;
    149   1.9  riastrad 
    150   1.9  riastrad 	/**
    151   1.9  riastrad 	 * @lock:
    152   1.9  riastrad 	 *
    153   1.9  riastrad 	 * Top-level FBDEV helper lock. This protects all internal data
    154   1.9  riastrad 	 * structures and lists, such as @connector_info and @crtc_info.
    155   1.9  riastrad 	 *
    156   1.9  riastrad 	 * FIXME: fbdev emulation locking is a mess and long term we want to
    157   1.9  riastrad 	 * protect all helper internal state with this lock as well as reduce
    158   1.9  riastrad 	 * core KMS locking as much as possible.
    159   1.9  riastrad 	 */
    160   1.9  riastrad 	struct mutex lock;
    161   1.9  riastrad 
    162   1.9  riastrad 	/**
    163   1.9  riastrad 	 * @kernel_fb_list:
    164   1.9  riastrad 	 *
    165   1.9  riastrad 	 * Entry on the global kernel_fb_helper_list, used for kgdb entry/exit.
    166   1.9  riastrad 	 */
    167   1.1  riastrad 	struct list_head kernel_fb_list;
    168   1.1  riastrad 
    169   1.9  riastrad 	/**
    170   1.9  riastrad 	 * @delayed_hotplug:
    171   1.9  riastrad 	 *
    172   1.9  riastrad 	 * A hotplug was received while fbdev wasn't in control of the DRM
    173   1.9  riastrad 	 * device, i.e. another KMS master was active. The output configuration
    174   1.9  riastrad 	 * needs to be reprobe when fbdev is in control again.
    175   1.9  riastrad 	 */
    176   1.1  riastrad 	bool delayed_hotplug;
    177   1.7  riastrad 
    178   1.7  riastrad 	/**
    179   1.9  riastrad 	 * @deferred_setup:
    180   1.9  riastrad 	 *
    181   1.9  riastrad 	 * If no outputs are connected (disconnected or unknown) the FB helper
    182   1.9  riastrad 	 * code will defer setup until at least one of the outputs shows up.
    183   1.9  riastrad 	 * This field keeps track of the status so that setup can be retried
    184   1.9  riastrad 	 * at every hotplug event until it succeeds eventually.
    185   1.9  riastrad 	 *
    186   1.9  riastrad 	 * Protected by @lock.
    187   1.9  riastrad 	 */
    188   1.9  riastrad 	bool deferred_setup;
    189   1.9  riastrad 
    190   1.9  riastrad 	/**
    191   1.9  riastrad 	 * @preferred_bpp:
    192   1.9  riastrad 	 *
    193   1.9  riastrad 	 * Temporary storage for the driver's preferred BPP setting passed to
    194   1.9  riastrad 	 * FB helper initialization. This needs to be tracked so that deferred
    195   1.9  riastrad 	 * FB helper setup can pass this on.
    196   1.7  riastrad 	 *
    197   1.9  riastrad 	 * See also: @deferred_setup
    198   1.7  riastrad 	 */
    199   1.9  riastrad 	int preferred_bpp;
    200   1.1  riastrad };
    201   1.1  riastrad 
    202   1.9  riastrad static inline struct drm_fb_helper *
    203   1.9  riastrad drm_fb_helper_from_client(struct drm_client_dev *client)
    204   1.9  riastrad {
    205   1.9  riastrad 	return container_of(client, struct drm_fb_helper, client);
    206   1.9  riastrad }
    207   1.9  riastrad 
    208   1.9  riastrad /**
    209   1.9  riastrad  * define DRM_FB_HELPER_DEFAULT_OPS - helper define for drm drivers
    210   1.9  riastrad  *
    211   1.9  riastrad  * Helper define to register default implementations of drm_fb_helper
    212   1.9  riastrad  * functions. To be used in struct fb_ops of drm drivers.
    213   1.9  riastrad  */
    214   1.9  riastrad #define DRM_FB_HELPER_DEFAULT_OPS \
    215   1.9  riastrad 	.fb_check_var	= drm_fb_helper_check_var, \
    216   1.9  riastrad 	.fb_set_par	= drm_fb_helper_set_par, \
    217   1.9  riastrad 	.fb_setcmap	= drm_fb_helper_setcmap, \
    218   1.9  riastrad 	.fb_blank	= drm_fb_helper_blank, \
    219   1.9  riastrad 	.fb_pan_display	= drm_fb_helper_pan_display, \
    220   1.9  riastrad 	.fb_debug_enter = drm_fb_helper_debug_enter, \
    221   1.9  riastrad 	.fb_debug_leave = drm_fb_helper_debug_leave, \
    222   1.9  riastrad 	.fb_ioctl	= drm_fb_helper_ioctl
    223   1.9  riastrad 
    224   1.7  riastrad #ifdef CONFIG_DRM_FBDEV_EMULATION
    225   1.7  riastrad void drm_fb_helper_prepare(struct drm_device *dev, struct drm_fb_helper *helper,
    226   1.7  riastrad 			   const struct drm_fb_helper_funcs *funcs);
    227   1.1  riastrad int drm_fb_helper_init(struct drm_device *dev,
    228   1.9  riastrad 		       struct drm_fb_helper *helper, int max_conn);
    229   1.1  riastrad void drm_fb_helper_fini(struct drm_fb_helper *helper);
    230   1.8  riastrad #ifndef __NetBSD__		/* XXX fb info */
    231   1.1  riastrad int drm_fb_helper_blank(int blank, struct fb_info *info);
    232   1.1  riastrad int drm_fb_helper_pan_display(struct fb_var_screeninfo *var,
    233   1.1  riastrad 			      struct fb_info *info);
    234   1.1  riastrad int drm_fb_helper_set_par(struct fb_info *info);
    235   1.1  riastrad int drm_fb_helper_check_var(struct fb_var_screeninfo *var,
    236   1.1  riastrad 			    struct fb_info *info);
    237   1.2  riastrad #endif
    238   1.1  riastrad 
    239   1.7  riastrad int drm_fb_helper_restore_fbdev_mode_unlocked(struct drm_fb_helper *fb_helper);
    240   1.8  riastrad 
    241   1.2  riastrad #ifndef __NetBSD__		/* XXX fb info */
    242   1.7  riastrad struct fb_info *drm_fb_helper_alloc_fbi(struct drm_fb_helper *fb_helper);
    243  1.14  riastrad #endif
    244   1.7  riastrad void drm_fb_helper_unregister_fbi(struct drm_fb_helper *fb_helper);
    245  1.14  riastrad #ifndef __NetBSD__		/* XXX fb info */
    246   1.9  riastrad void drm_fb_helper_fill_info(struct fb_info *info,
    247   1.9  riastrad 			     struct drm_fb_helper *fb_helper,
    248   1.9  riastrad 			     struct drm_fb_helper_surface_size *sizes);
    249   1.7  riastrad 
    250   1.9  riastrad void drm_fb_helper_deferred_io(struct fb_info *info,
    251   1.9  riastrad 			       struct list_head *pagelist);
    252   1.7  riastrad 
    253   1.7  riastrad ssize_t drm_fb_helper_sys_read(struct fb_info *info, char __user *buf,
    254   1.7  riastrad 			       size_t count, loff_t *ppos);
    255   1.7  riastrad ssize_t drm_fb_helper_sys_write(struct fb_info *info, const char __user *buf,
    256   1.7  riastrad 				size_t count, loff_t *ppos);
    257   1.7  riastrad 
    258   1.7  riastrad void drm_fb_helper_sys_fillrect(struct fb_info *info,
    259   1.7  riastrad 				const struct fb_fillrect *rect);
    260   1.7  riastrad void drm_fb_helper_sys_copyarea(struct fb_info *info,
    261   1.7  riastrad 				const struct fb_copyarea *area);
    262   1.7  riastrad void drm_fb_helper_sys_imageblit(struct fb_info *info,
    263   1.7  riastrad 				 const struct fb_image *image);
    264   1.7  riastrad 
    265   1.7  riastrad void drm_fb_helper_cfb_fillrect(struct fb_info *info,
    266   1.7  riastrad 				const struct fb_fillrect *rect);
    267   1.7  riastrad void drm_fb_helper_cfb_copyarea(struct fb_info *info,
    268   1.7  riastrad 				const struct fb_copyarea *area);
    269   1.7  riastrad void drm_fb_helper_cfb_imageblit(struct fb_info *info,
    270   1.7  riastrad 				 const struct fb_image *image);
    271   1.2  riastrad #endif
    272   1.1  riastrad 
    273   1.9  riastrad void drm_fb_helper_set_suspend(struct drm_fb_helper *fb_helper, bool suspend);
    274   1.9  riastrad void drm_fb_helper_set_suspend_unlocked(struct drm_fb_helper *fb_helper,
    275   1.9  riastrad 					bool suspend);
    276   1.7  riastrad 
    277   1.2  riastrad #ifndef __NetBSD__		/* XXX fb cmap */
    278   1.1  riastrad int drm_fb_helper_setcmap(struct fb_cmap *cmap, struct fb_info *info);
    279   1.1  riastrad 
    280   1.9  riastrad int drm_fb_helper_ioctl(struct fb_info *info, unsigned int cmd,
    281   1.9  riastrad 			unsigned long arg);
    282  1.11  riastrad #endif
    283   1.9  riastrad 
    284   1.1  riastrad int drm_fb_helper_hotplug_event(struct drm_fb_helper *fb_helper);
    285   1.7  riastrad int drm_fb_helper_initial_config(struct drm_fb_helper *fb_helper, int bpp_sel);
    286  1.13  riastrad int drm_fb_helper_debug_enter_fb(struct drm_fb_helper *);
    287  1.13  riastrad int drm_fb_helper_debug_leave_fb(struct drm_fb_helper *);
    288   1.9  riastrad 
    289   1.9  riastrad void drm_fb_helper_lastclose(struct drm_device *dev);
    290   1.9  riastrad void drm_fb_helper_output_poll_changed(struct drm_device *dev);
    291   1.9  riastrad 
    292   1.9  riastrad int drm_fbdev_generic_setup(struct drm_device *dev, unsigned int preferred_bpp);
    293   1.7  riastrad #else
    294   1.7  riastrad static inline void drm_fb_helper_prepare(struct drm_device *dev,
    295   1.7  riastrad 					struct drm_fb_helper *helper,
    296   1.7  riastrad 					const struct drm_fb_helper_funcs *funcs)
    297   1.7  riastrad {
    298   1.7  riastrad }
    299   1.7  riastrad 
    300   1.7  riastrad static inline int drm_fb_helper_init(struct drm_device *dev,
    301   1.9  riastrad 		       struct drm_fb_helper *helper,
    302   1.7  riastrad 		       int max_conn)
    303   1.7  riastrad {
    304   1.9  riastrad 	/* So drivers can use it to free the struct */
    305   1.9  riastrad 	helper->dev = dev;
    306   1.9  riastrad 	dev->fb_helper = helper;
    307   1.9  riastrad 
    308   1.7  riastrad 	return 0;
    309   1.7  riastrad }
    310   1.7  riastrad 
    311   1.7  riastrad static inline void drm_fb_helper_fini(struct drm_fb_helper *helper)
    312   1.7  riastrad {
    313   1.9  riastrad 	if (helper && helper->dev)
    314   1.9  riastrad 		helper->dev->fb_helper = NULL;
    315   1.7  riastrad }
    316   1.7  riastrad 
    317   1.7  riastrad static inline int drm_fb_helper_blank(int blank, struct fb_info *info)
    318   1.7  riastrad {
    319   1.7  riastrad 	return 0;
    320   1.7  riastrad }
    321   1.7  riastrad 
    322   1.7  riastrad static inline int drm_fb_helper_pan_display(struct fb_var_screeninfo *var,
    323   1.7  riastrad 					    struct fb_info *info)
    324   1.7  riastrad {
    325   1.7  riastrad 	return 0;
    326   1.7  riastrad }
    327   1.7  riastrad 
    328   1.7  riastrad static inline int drm_fb_helper_set_par(struct fb_info *info)
    329   1.7  riastrad {
    330   1.7  riastrad 	return 0;
    331   1.7  riastrad }
    332   1.7  riastrad 
    333   1.7  riastrad static inline int drm_fb_helper_check_var(struct fb_var_screeninfo *var,
    334   1.7  riastrad 					  struct fb_info *info)
    335   1.7  riastrad {
    336   1.7  riastrad 	return 0;
    337   1.7  riastrad }
    338   1.7  riastrad 
    339   1.7  riastrad static inline int
    340   1.7  riastrad drm_fb_helper_restore_fbdev_mode_unlocked(struct drm_fb_helper *fb_helper)
    341   1.7  riastrad {
    342   1.7  riastrad 	return 0;
    343   1.7  riastrad }
    344   1.7  riastrad 
    345   1.7  riastrad static inline struct fb_info *
    346   1.7  riastrad drm_fb_helper_alloc_fbi(struct drm_fb_helper *fb_helper)
    347   1.7  riastrad {
    348   1.7  riastrad 	return NULL;
    349   1.7  riastrad }
    350   1.7  riastrad 
    351   1.7  riastrad static inline void drm_fb_helper_unregister_fbi(struct drm_fb_helper *fb_helper)
    352   1.7  riastrad {
    353   1.7  riastrad }
    354   1.9  riastrad 
    355   1.9  riastrad static inline void
    356   1.9  riastrad drm_fb_helper_fill_info(struct fb_info *info,
    357   1.9  riastrad 			struct drm_fb_helper *fb_helper,
    358   1.9  riastrad 			struct drm_fb_helper_surface_size *sizes)
    359   1.7  riastrad {
    360   1.7  riastrad }
    361   1.7  riastrad 
    362   1.9  riastrad static inline int drm_fb_helper_setcmap(struct fb_cmap *cmap,
    363   1.9  riastrad 					struct fb_info *info)
    364   1.7  riastrad {
    365   1.9  riastrad 	return 0;
    366   1.7  riastrad }
    367   1.7  riastrad 
    368   1.9  riastrad static inline int drm_fb_helper_ioctl(struct fb_info *info, unsigned int cmd,
    369   1.9  riastrad 				      unsigned long arg)
    370   1.7  riastrad {
    371   1.9  riastrad 	return 0;
    372   1.7  riastrad }
    373   1.7  riastrad 
    374   1.9  riastrad static inline void drm_fb_helper_deferred_io(struct fb_info *info,
    375   1.9  riastrad 					     struct list_head *pagelist)
    376   1.7  riastrad {
    377   1.7  riastrad }
    378   1.7  riastrad 
    379   1.9  riastrad static inline int drm_fb_helper_defio_init(struct drm_fb_helper *fb_helper)
    380   1.7  riastrad {
    381   1.9  riastrad 	return -ENODEV;
    382   1.7  riastrad }
    383   1.7  riastrad 
    384   1.7  riastrad static inline ssize_t drm_fb_helper_sys_read(struct fb_info *info,
    385   1.7  riastrad 					     char __user *buf, size_t count,
    386   1.7  riastrad 					     loff_t *ppos)
    387   1.7  riastrad {
    388   1.7  riastrad 	return -ENODEV;
    389   1.7  riastrad }
    390   1.7  riastrad 
    391   1.7  riastrad static inline ssize_t drm_fb_helper_sys_write(struct fb_info *info,
    392   1.7  riastrad 					      const char __user *buf,
    393   1.7  riastrad 					      size_t count, loff_t *ppos)
    394   1.7  riastrad {
    395   1.7  riastrad 	return -ENODEV;
    396   1.7  riastrad }
    397   1.7  riastrad 
    398   1.7  riastrad static inline void drm_fb_helper_sys_fillrect(struct fb_info *info,
    399   1.7  riastrad 					      const struct fb_fillrect *rect)
    400   1.7  riastrad {
    401   1.7  riastrad }
    402   1.7  riastrad 
    403   1.7  riastrad static inline void drm_fb_helper_sys_copyarea(struct fb_info *info,
    404   1.7  riastrad 					      const struct fb_copyarea *area)
    405   1.7  riastrad {
    406   1.7  riastrad }
    407   1.7  riastrad 
    408   1.7  riastrad static inline void drm_fb_helper_sys_imageblit(struct fb_info *info,
    409   1.7  riastrad 					       const struct fb_image *image)
    410   1.7  riastrad {
    411   1.7  riastrad }
    412   1.7  riastrad 
    413   1.7  riastrad static inline void drm_fb_helper_cfb_fillrect(struct fb_info *info,
    414   1.7  riastrad 					      const struct fb_fillrect *rect)
    415   1.7  riastrad {
    416   1.7  riastrad }
    417   1.7  riastrad 
    418   1.7  riastrad static inline void drm_fb_helper_cfb_copyarea(struct fb_info *info,
    419   1.7  riastrad 					      const struct fb_copyarea *area)
    420   1.7  riastrad {
    421   1.7  riastrad }
    422   1.7  riastrad 
    423   1.7  riastrad static inline void drm_fb_helper_cfb_imageblit(struct fb_info *info,
    424   1.7  riastrad 					       const struct fb_image *image)
    425   1.7  riastrad {
    426   1.7  riastrad }
    427   1.7  riastrad 
    428   1.7  riastrad static inline void drm_fb_helper_set_suspend(struct drm_fb_helper *fb_helper,
    429   1.9  riastrad 					     bool suspend)
    430   1.9  riastrad {
    431   1.9  riastrad }
    432   1.9  riastrad 
    433   1.9  riastrad static inline void
    434   1.9  riastrad drm_fb_helper_set_suspend_unlocked(struct drm_fb_helper *fb_helper, bool suspend)
    435   1.7  riastrad {
    436   1.7  riastrad }
    437   1.7  riastrad 
    438   1.7  riastrad static inline int drm_fb_helper_hotplug_event(struct drm_fb_helper *fb_helper)
    439   1.7  riastrad {
    440   1.7  riastrad 	return 0;
    441   1.7  riastrad }
    442   1.7  riastrad 
    443   1.7  riastrad static inline int drm_fb_helper_initial_config(struct drm_fb_helper *fb_helper,
    444   1.7  riastrad 					       int bpp_sel)
    445   1.7  riastrad {
    446   1.7  riastrad 	return 0;
    447   1.7  riastrad }
    448   1.7  riastrad 
    449   1.9  riastrad static inline int drm_fb_helper_debug_enter(struct fb_info *info)
    450   1.7  riastrad {
    451   1.7  riastrad 	return 0;
    452   1.7  riastrad }
    453   1.7  riastrad 
    454   1.9  riastrad static inline int drm_fb_helper_debug_leave(struct fb_info *info)
    455   1.7  riastrad {
    456   1.7  riastrad 	return 0;
    457   1.7  riastrad }
    458   1.7  riastrad 
    459   1.9  riastrad static inline void drm_fb_helper_lastclose(struct drm_device *dev)
    460   1.7  riastrad {
    461   1.7  riastrad }
    462   1.7  riastrad 
    463   1.9  riastrad static inline void drm_fb_helper_output_poll_changed(struct drm_device *dev)
    464   1.7  riastrad {
    465   1.7  riastrad }
    466   1.7  riastrad 
    467   1.9  riastrad static inline int
    468   1.9  riastrad drm_fbdev_generic_setup(struct drm_device *dev, unsigned int preferred_bpp)
    469   1.7  riastrad {
    470   1.9  riastrad 	return 0;
    471   1.9  riastrad }
    472   1.9  riastrad 
    473   1.9  riastrad #endif
    474   1.9  riastrad 
    475   1.9  riastrad /* TODO: There's a todo entry to remove these three */
    476   1.9  riastrad static inline int
    477   1.9  riastrad drm_fb_helper_single_add_all_connectors(struct drm_fb_helper *fb_helper)
    478   1.9  riastrad {
    479   1.9  riastrad 	return 0;
    480   1.7  riastrad }
    481   1.7  riastrad 
    482   1.7  riastrad static inline int
    483   1.7  riastrad drm_fb_helper_add_one_connector(struct drm_fb_helper *fb_helper,
    484   1.7  riastrad 				struct drm_connector *connector)
    485   1.7  riastrad {
    486   1.7  riastrad 	return 0;
    487   1.7  riastrad }
    488   1.7  riastrad 
    489   1.7  riastrad static inline int
    490   1.7  riastrad drm_fb_helper_remove_one_connector(struct drm_fb_helper *fb_helper,
    491   1.7  riastrad 				   struct drm_connector *connector)
    492   1.7  riastrad {
    493   1.7  riastrad 	return 0;
    494   1.7  riastrad }
    495   1.9  riastrad 
    496   1.9  riastrad /**
    497   1.9  riastrad  * drm_fb_helper_remove_conflicting_framebuffers - remove firmware-configured framebuffers
    498   1.9  riastrad  * @a: memory range, users of which are to be removed
    499   1.9  riastrad  * @name: requesting driver name
    500   1.9  riastrad  * @primary: also kick vga16fb if present
    501   1.9  riastrad  *
    502   1.9  riastrad  * This function removes framebuffer devices (initialized by firmware/bootloader)
    503   1.9  riastrad  * which use memory range described by @a. If @a is NULL all such devices are
    504   1.9  riastrad  * removed.
    505   1.9  riastrad  */
    506   1.9  riastrad static inline int
    507   1.9  riastrad drm_fb_helper_remove_conflicting_framebuffers(struct apertures_struct *a,
    508   1.9  riastrad 					      const char *name, bool primary)
    509   1.9  riastrad {
    510   1.9  riastrad #if IS_REACHABLE(CONFIG_FB)
    511   1.9  riastrad 	return remove_conflicting_framebuffers(a, name, primary);
    512   1.9  riastrad #else
    513   1.9  riastrad 	return 0;
    514   1.7  riastrad #endif
    515   1.9  riastrad }
    516   1.9  riastrad 
    517   1.9  riastrad /**
    518   1.9  riastrad  * drm_fb_helper_remove_conflicting_pci_framebuffers - remove firmware-configured framebuffers for PCI devices
    519   1.9  riastrad  * @pdev: PCI device
    520   1.9  riastrad  * @name: requesting driver name
    521   1.9  riastrad  *
    522   1.9  riastrad  * This function removes framebuffer devices (eg. initialized by firmware)
    523   1.9  riastrad  * using memory range configured for any of @pdev's memory bars.
    524   1.9  riastrad  *
    525   1.9  riastrad  * The function assumes that PCI device with shadowed ROM drives a primary
    526   1.9  riastrad  * display and so kicks out vga16fb.
    527   1.9  riastrad  */
    528   1.9  riastrad static inline int
    529   1.9  riastrad drm_fb_helper_remove_conflicting_pci_framebuffers(struct pci_dev *pdev,
    530   1.9  riastrad 						  const char *name)
    531   1.9  riastrad {
    532   1.9  riastrad 	int ret = 0;
    533   1.9  riastrad 
    534   1.9  riastrad 	/*
    535   1.9  riastrad 	 * WARNING: Apparently we must kick fbdev drivers before vgacon,
    536   1.9  riastrad 	 * otherwise the vga fbdev driver falls over.
    537   1.9  riastrad 	 */
    538   1.9  riastrad #if IS_REACHABLE(CONFIG_FB)
    539   1.9  riastrad 	ret = remove_conflicting_pci_framebuffers(pdev, name);
    540   1.9  riastrad #endif
    541   1.9  riastrad 	if (ret == 0)
    542   1.9  riastrad 		ret = vga_remove_vgacon(pdev);
    543   1.9  riastrad 	return ret;
    544   1.9  riastrad }
    545   1.9  riastrad 
    546   1.1  riastrad #endif
    547