Message ID | 1436769731-4816-2-git-send-email-architt@codeaurora.org (mailing list archive) |
---|---|
State | Not Applicable, archived |
Delegated to: | Andy Gross |
Headers | show |
On Mon, Jul 13, 2015 at 12:12:06PM +0530, Archit Taneja wrote: > Legacy fbdev emulation support via DRM is achieved through KMS FB helpers. > Most modesetting drivers enable provide fbdev emulation by default by > selecting KMS FB helpers. A few provide a separate Kconfig option for the > user to enable or disbale fbdev emulation. > > Enabling fbdev emulation is finally a distro-level decision. Having a top > level Kconfig option for fbdev emulation helps by providing a uniform way > to enable/disable fbdev emulation for any modesetting driver. It also lets > us remove unnecessary driver specific Kconfig options that causes bloat. > > With a top level Kconfig in place, we can stub out the fb helper functions > when not needed without breaking functionality. Having stub functions also > prevents drivers to require wrapping fb helper function calls with #ifdefs. > > DRM_FBDEV_EMULATION defaults to y since many drivers enable fbdev > emulation by default and majority of distributions expect the fbdev > interface in the kernel. > > Signed-off-by: Archit Taneja <architt@codeaurora.org> > --- > drivers/gpu/drm/Kconfig | 12 +++ > drivers/gpu/drm/Makefile | 2 +- > include/drm/drm_fb_helper.h | 192 ++++++++++++++++++++++++++++++++++++++++++++ > 3 files changed, 205 insertions(+), 1 deletion(-) > > diff --git a/drivers/gpu/drm/Kconfig b/drivers/gpu/drm/Kconfig > index e373f8a..8fd670b 100644 > --- a/drivers/gpu/drm/Kconfig > +++ b/drivers/gpu/drm/Kconfig > @@ -47,6 +47,18 @@ config DRM_KMS_FB_HELPER > help > FBDEV helpers for KMS drivers. > > +config DRM_FBDEV_EMULATION > + bool "Enable legacy fbdev support for your modesetting driver" > + depends on DRM > + select DRM_KMS_HELPER > + select DRM_KMS_FB_HELPER > + default y > + help > + Choose this option if you have a need for the legacy fbdev > + support. Note that this support also provide the linux console > + support on top of your modesetting driver. You'd need this if > + you're looking for console support too. Maybe add an "If unsure say Y." here. > + > config DRM_LOAD_EDID_FIRMWARE > bool "Allow to specify an EDID data set instead of probing for it" > depends on DRM_KMS_HELPER > diff --git a/drivers/gpu/drm/Makefile b/drivers/gpu/drm/Makefile > index 5713d05..8858510 100644 > --- a/drivers/gpu/drm/Makefile > +++ b/drivers/gpu/drm/Makefile > @@ -23,7 +23,7 @@ drm-$(CONFIG_OF) += drm_of.o > drm_kms_helper-y := drm_crtc_helper.o drm_dp_helper.o drm_probe_helper.o \ > drm_plane_helper.o drm_dp_mst_topology.o drm_atomic_helper.o > drm_kms_helper-$(CONFIG_DRM_LOAD_EDID_FIRMWARE) += drm_edid_load.o > -drm_kms_helper-$(CONFIG_DRM_KMS_FB_HELPER) += drm_fb_helper.o > +drm_kms_helper-$(CONFIG_DRM_FBDEV_EMULATION) += drm_fb_helper.o > drm_kms_helper-$(CONFIG_DRM_KMS_CMA_HELPER) += drm_fb_cma_helper.o > > obj-$(CONFIG_DRM_KMS_HELPER) += drm_kms_helper.o > diff --git a/include/drm/drm_fb_helper.h b/include/drm/drm_fb_helper.h > index cc19e88..8f972da 100644 > --- a/include/drm/drm_fb_helper.h > +++ b/include/drm/drm_fb_helper.h > @@ -122,6 +122,7 @@ struct drm_fb_helper { > bool delayed_hotplug; > }; > > +#ifdef CONFIG_DRM_FBDEV_EMULATION > void drm_fb_helper_prepare(struct drm_device *dev, struct drm_fb_helper *helper, > const struct drm_fb_helper_funcs *funcs); > int drm_fb_helper_init(struct drm_device *dev, > @@ -188,4 +189,195 @@ drm_pick_cmdline_mode(struct drm_fb_helper_connector *fb_helper_conn, > int drm_fb_helper_add_one_connector(struct drm_fb_helper *fb_helper, struct drm_connector *connector); > int drm_fb_helper_remove_one_connector(struct drm_fb_helper *fb_helper, > struct drm_connector *connector); > +#else > +static inline void drm_fb_helper_prepare(struct drm_device *dev, > + struct drm_fb_helper *helper, > + const struct drm_fb_helper_funcs *funcs) > +{ > +} > + > +static inline int drm_fb_helper_init(struct drm_device *dev, > + struct drm_fb_helper *helper, int crtc_count, > + int max_conn) > +{ > + return 0; > +} > + > +static inline void drm_fb_helper_fini(struct drm_fb_helper *helper) > +{ > +} > + > +static inline int drm_fb_helper_blank(int blank, struct fb_info *info) > +{ > + return 0; > +} > + > +static inline int drm_fb_helper_pan_display(struct fb_var_screeninfo *var, > + struct fb_info *info) > +{ > + return 0; > +} > + > +static inline int drm_fb_helper_set_par(struct fb_info *info) > +{ > + return 0; > +} > + > +static inline int drm_fb_helper_check_var(struct fb_var_screeninfo *var, > + struct fb_info *info) > +{ > + return 0; > +} > + > +static inline bool > +drm_fb_helper_restore_fbdev_mode_unlocked(struct drm_fb_helper *fb_helper) > +{ > + return true; > +} > + > +static inline struct fb_info * > +drm_fb_helper_alloc_fbi(struct drm_fb_helper *fb_helper) > +{ > + return NULL; > +} > + > +static inline void drm_fb_helper_unregister_fbi(struct drm_fb_helper *fb_helper) > +{ > +} > +static inline void drm_fb_helper_release_fbi(struct drm_fb_helper *fb_helper) > +{ > +} > + > +static inline void drm_fb_helper_fill_var(struct fb_info *info, > + struct drm_fb_helper *fb_helper, > + uint32_t fb_width, uint32_t fb_height) > +{ > +} > + > +static inline void drm_fb_helper_fill_fix(struct fb_info *info, uint32_t pitch, > + uint32_t depth) > +{ > +} > + > +static inline int drm_fb_helper_setcmap(struct fb_cmap *cmap, > + struct fb_info *info) > +{ > + return 0; > +} > + > +static inline void drm_fb_helper_unlink_fbi(struct drm_fb_helper *fb_helper) > +{ > +} > + > +static inline ssize_t drm_fb_helper_sys_read(struct fb_info *info, > + char __user *buf, size_t count, > + loff_t *ppos) > +{ > + return -ENODEV; > +} > + > +static inline ssize_t drm_fb_helper_sys_write(struct fb_info *info, > + const char __user *buf, size_t count, > + loff_t *ppos) > +{ > + return -ENODEV; > +} > + > +static inline void drm_fb_helper_sys_fillrect(struct fb_info *info, > + const struct fb_fillrect *rect) > +{ > +} > + > +static inline void drm_fb_helper_sys_copyarea(struct fb_info *info, > + const struct fb_copyarea *area) > +{ > +} > + > +static inline void drm_fb_helper_sys_imageblit(struct fb_info *info, > + const struct fb_image *image) > +{ > +} > + > +static inline void drm_fb_helper_cfb_fillrect(struct fb_info *info, > + const struct fb_fillrect *rect) > +{ > +} > + > +static inline void drm_fb_helper_cfb_copyarea(struct fb_info *info, > + const struct fb_copyarea *area) > +{ > +} > + > +static inline void drm_fb_helper_cfb_imageblit(struct fb_info *info, > + const struct fb_image *image) > +{ > +} > + > +static inline void drm_fb_helper_set_suspend(struct drm_fb_helper *fb_helper, > + int state) > +{ > +} > + > +static inline int > +drm_fb_helper_remove_conflicting_framebuffers(struct apertures_struct *a, > + const char *name, bool primary) > +{ > + return 0; > +} The above dummy functions don't exist yet - is this part of a more extensive patch series to introduce those as drm fb helpers too? Should probably be dropped for now. -Daniel > + > +static inline int drm_fb_helper_hotplug_event(struct drm_fb_helper *fb_helper) > +{ > + return 0; > +} > + > +static inline int drm_fb_helper_initial_config(struct drm_fb_helper *fb_helper, > + int bpp_sel) > +{ > + return 0; > +} > + > +static inline int > +drm_fb_helper_single_add_all_connectors(struct drm_fb_helper *fb_helper) > +{ > + return 0; > +} > + > +static inline int drm_fb_helper_debug_enter(struct fb_info *info) > +{ > + return 0; > +} > + > +static inline int drm_fb_helper_debug_leave(struct fb_info *info) > +{ > + return 0; > +} > + > +static inline struct drm_display_mode * > +drm_has_preferred_mode(struct drm_fb_helper_connector *fb_connector, > + int width, int height) > +{ > + return NULL; > +} > + > +static inline struct drm_display_mode * > +drm_pick_cmdline_mode(struct drm_fb_helper_connector *fb_helper_conn, > + int width, int height) > +{ > + return NULL; > +} > + > +static inline int > +drm_fb_helper_add_one_connector(struct drm_fb_helper *fb_helper, > + struct drm_connector *connector) > +{ > + return 0; > +} > + > +static inline int > +drm_fb_helper_remove_one_connector(struct drm_fb_helper *fb_helper, > + struct drm_connector *connector) > +{ > + return 0; > +} > +#endif > #endif > -- > The Qualcomm Innovation Center, Inc. is a member of the Code Aurora Forum, > hosted by The Linux Foundation >
diff --git a/drivers/gpu/drm/Kconfig b/drivers/gpu/drm/Kconfig index e373f8a..8fd670b 100644 --- a/drivers/gpu/drm/Kconfig +++ b/drivers/gpu/drm/Kconfig @@ -47,6 +47,18 @@ config DRM_KMS_FB_HELPER help FBDEV helpers for KMS drivers. +config DRM_FBDEV_EMULATION + bool "Enable legacy fbdev support for your modesetting driver" + depends on DRM + select DRM_KMS_HELPER + select DRM_KMS_FB_HELPER + default y + help + Choose this option if you have a need for the legacy fbdev + support. Note that this support also provide the linux console + support on top of your modesetting driver. You'd need this if + you're looking for console support too. + config DRM_LOAD_EDID_FIRMWARE bool "Allow to specify an EDID data set instead of probing for it" depends on DRM_KMS_HELPER diff --git a/drivers/gpu/drm/Makefile b/drivers/gpu/drm/Makefile index 5713d05..8858510 100644 --- a/drivers/gpu/drm/Makefile +++ b/drivers/gpu/drm/Makefile @@ -23,7 +23,7 @@ drm-$(CONFIG_OF) += drm_of.o drm_kms_helper-y := drm_crtc_helper.o drm_dp_helper.o drm_probe_helper.o \ drm_plane_helper.o drm_dp_mst_topology.o drm_atomic_helper.o drm_kms_helper-$(CONFIG_DRM_LOAD_EDID_FIRMWARE) += drm_edid_load.o -drm_kms_helper-$(CONFIG_DRM_KMS_FB_HELPER) += drm_fb_helper.o +drm_kms_helper-$(CONFIG_DRM_FBDEV_EMULATION) += drm_fb_helper.o drm_kms_helper-$(CONFIG_DRM_KMS_CMA_HELPER) += drm_fb_cma_helper.o obj-$(CONFIG_DRM_KMS_HELPER) += drm_kms_helper.o diff --git a/include/drm/drm_fb_helper.h b/include/drm/drm_fb_helper.h index cc19e88..8f972da 100644 --- a/include/drm/drm_fb_helper.h +++ b/include/drm/drm_fb_helper.h @@ -122,6 +122,7 @@ struct drm_fb_helper { bool delayed_hotplug; }; +#ifdef CONFIG_DRM_FBDEV_EMULATION void drm_fb_helper_prepare(struct drm_device *dev, struct drm_fb_helper *helper, const struct drm_fb_helper_funcs *funcs); int drm_fb_helper_init(struct drm_device *dev, @@ -188,4 +189,195 @@ drm_pick_cmdline_mode(struct drm_fb_helper_connector *fb_helper_conn, int drm_fb_helper_add_one_connector(struct drm_fb_helper *fb_helper, struct drm_connector *connector); int drm_fb_helper_remove_one_connector(struct drm_fb_helper *fb_helper, struct drm_connector *connector); +#else +static inline void drm_fb_helper_prepare(struct drm_device *dev, + struct drm_fb_helper *helper, + const struct drm_fb_helper_funcs *funcs) +{ +} + +static inline int drm_fb_helper_init(struct drm_device *dev, + struct drm_fb_helper *helper, int crtc_count, + int max_conn) +{ + return 0; +} + +static inline void drm_fb_helper_fini(struct drm_fb_helper *helper) +{ +} + +static inline int drm_fb_helper_blank(int blank, struct fb_info *info) +{ + return 0; +} + +static inline int drm_fb_helper_pan_display(struct fb_var_screeninfo *var, + struct fb_info *info) +{ + return 0; +} + +static inline int drm_fb_helper_set_par(struct fb_info *info) +{ + return 0; +} + +static inline int drm_fb_helper_check_var(struct fb_var_screeninfo *var, + struct fb_info *info) +{ + return 0; +} + +static inline bool +drm_fb_helper_restore_fbdev_mode_unlocked(struct drm_fb_helper *fb_helper) +{ + return true; +} + +static inline struct fb_info * +drm_fb_helper_alloc_fbi(struct drm_fb_helper *fb_helper) +{ + return NULL; +} + +static inline void drm_fb_helper_unregister_fbi(struct drm_fb_helper *fb_helper) +{ +} +static inline void drm_fb_helper_release_fbi(struct drm_fb_helper *fb_helper) +{ +} + +static inline void drm_fb_helper_fill_var(struct fb_info *info, + struct drm_fb_helper *fb_helper, + uint32_t fb_width, uint32_t fb_height) +{ +} + +static inline void drm_fb_helper_fill_fix(struct fb_info *info, uint32_t pitch, + uint32_t depth) +{ +} + +static inline int drm_fb_helper_setcmap(struct fb_cmap *cmap, + struct fb_info *info) +{ + return 0; +} + +static inline void drm_fb_helper_unlink_fbi(struct drm_fb_helper *fb_helper) +{ +} + +static inline ssize_t drm_fb_helper_sys_read(struct fb_info *info, + char __user *buf, size_t count, + loff_t *ppos) +{ + return -ENODEV; +} + +static inline ssize_t drm_fb_helper_sys_write(struct fb_info *info, + const char __user *buf, size_t count, + loff_t *ppos) +{ + return -ENODEV; +} + +static inline void drm_fb_helper_sys_fillrect(struct fb_info *info, + const struct fb_fillrect *rect) +{ +} + +static inline void drm_fb_helper_sys_copyarea(struct fb_info *info, + const struct fb_copyarea *area) +{ +} + +static inline void drm_fb_helper_sys_imageblit(struct fb_info *info, + const struct fb_image *image) +{ +} + +static inline void drm_fb_helper_cfb_fillrect(struct fb_info *info, + const struct fb_fillrect *rect) +{ +} + +static inline void drm_fb_helper_cfb_copyarea(struct fb_info *info, + const struct fb_copyarea *area) +{ +} + +static inline void drm_fb_helper_cfb_imageblit(struct fb_info *info, + const struct fb_image *image) +{ +} + +static inline void drm_fb_helper_set_suspend(struct drm_fb_helper *fb_helper, + int state) +{ +} + +static inline int +drm_fb_helper_remove_conflicting_framebuffers(struct apertures_struct *a, + const char *name, bool primary) +{ + return 0; +} + +static inline int drm_fb_helper_hotplug_event(struct drm_fb_helper *fb_helper) +{ + return 0; +} + +static inline int drm_fb_helper_initial_config(struct drm_fb_helper *fb_helper, + int bpp_sel) +{ + return 0; +} + +static inline int +drm_fb_helper_single_add_all_connectors(struct drm_fb_helper *fb_helper) +{ + return 0; +} + +static inline int drm_fb_helper_debug_enter(struct fb_info *info) +{ + return 0; +} + +static inline int drm_fb_helper_debug_leave(struct fb_info *info) +{ + return 0; +} + +static inline struct drm_display_mode * +drm_has_preferred_mode(struct drm_fb_helper_connector *fb_connector, + int width, int height) +{ + return NULL; +} + +static inline struct drm_display_mode * +drm_pick_cmdline_mode(struct drm_fb_helper_connector *fb_helper_conn, + int width, int height) +{ + return NULL; +} + +static inline int +drm_fb_helper_add_one_connector(struct drm_fb_helper *fb_helper, + struct drm_connector *connector) +{ + return 0; +} + +static inline int +drm_fb_helper_remove_one_connector(struct drm_fb_helper *fb_helper, + struct drm_connector *connector) +{ + return 0; +} +#endif #endif
Legacy fbdev emulation support via DRM is achieved through KMS FB helpers. Most modesetting drivers enable provide fbdev emulation by default by selecting KMS FB helpers. A few provide a separate Kconfig option for the user to enable or disbale fbdev emulation. Enabling fbdev emulation is finally a distro-level decision. Having a top level Kconfig option for fbdev emulation helps by providing a uniform way to enable/disable fbdev emulation for any modesetting driver. It also lets us remove unnecessary driver specific Kconfig options that causes bloat. With a top level Kconfig in place, we can stub out the fb helper functions when not needed without breaking functionality. Having stub functions also prevents drivers to require wrapping fb helper function calls with #ifdefs. DRM_FBDEV_EMULATION defaults to y since many drivers enable fbdev emulation by default and majority of distributions expect the fbdev interface in the kernel. Signed-off-by: Archit Taneja <architt@codeaurora.org> --- drivers/gpu/drm/Kconfig | 12 +++ drivers/gpu/drm/Makefile | 2 +- include/drm/drm_fb_helper.h | 192 ++++++++++++++++++++++++++++++++++++++++++++ 3 files changed, 205 insertions(+), 1 deletion(-)