[PATCH v2 4/8] drm/fb-helper: Add .last_close and .output_poll_changed helpers
Daniel Vetter
daniel at ffwll.ch
Tue Oct 17 12:40:27 UTC 2017
On Sun, Oct 15, 2017 at 06:30:38PM +0200, Noralf Trønnes wrote:
> This adds helpers for the drm_driver->last_close and the
> drm_mode_config_funcs->output_poll_changed callbacks.
>
> Signed-off-by: Noralf Trønnes <noralf at tronnes.org>
Definitely want a todo entry to roll these out to all drivers, but maybe
do a separate follow-up patch to add them all in one go ...
On this:
Reviewed-by: Daniel Vetter <daniel.vetter at ffwll.ch>
> ---
> drivers/gpu/drm/drm_fb_helper.c | 32 ++++++++++++++++++++++++++++++++
> include/drm/drm_fb_helper.h | 10 ++++++++++
> 2 files changed, 42 insertions(+)
>
> diff --git a/drivers/gpu/drm/drm_fb_helper.c b/drivers/gpu/drm/drm_fb_helper.c
> index 166535da9a9b..897be5304135 100644
> --- a/drivers/gpu/drm/drm_fb_helper.c
> +++ b/drivers/gpu/drm/drm_fb_helper.c
> @@ -226,6 +226,38 @@ void drm_fb_helper_simple_fini(struct drm_device *dev)
> }
> EXPORT_SYMBOL_GPL(drm_fb_helper_simple_fini);
>
> +/**
> + * drm_fb_helper_lastclose - DRM driver lastclose helper for fbdev emulation
> + * @dev: DRM device
> + *
> + * This function can be used as the &drm_driver->lastclose callback for drivers
> + * that only need to call drm_fb_helper_restore_fbdev_mode_unlocked().
> + *
> + * Note: &drm_device->fbdev needs to be set.
> + */
> +void drm_fb_helper_lastclose(struct drm_device *dev)
> +{
> + drm_fb_helper_restore_fbdev_mode_unlocked(dev->fbdev);
> +}
> +EXPORT_SYMBOL(drm_fb_helper_lastclose);
> +
> +/**
> + * drm_fb_helper_output_poll_changed - DRM mode config \.output_poll_changed
> + * helper for fbdev emulation
> + * @dev: DRM device
> + *
> + * This function can be used as the
> + * &drm_mode_config_funcs.output_poll_changed callback for drivers that only
> + * need to call drm_fb_helper_hotplug_event().
> + *
> + * Note: &drm_device->fbdev needs to be set.
> + */
> +void drm_fb_helper_output_poll_changed(struct drm_device *dev)
> +{
> + drm_fb_helper_hotplug_event(dev->fbdev);
> +}
> +EXPORT_SYMBOL(drm_fb_helper_output_poll_changed);
> +
> #define drm_fb_helper_for_each_connector(fbh, i__) \
> for (({ lockdep_assert_held(&(fbh)->lock); }), \
> i__ = 0; i__ < (fbh)->connector_count; i__++)
> diff --git a/include/drm/drm_fb_helper.h b/include/drm/drm_fb_helper.h
> index 6503f4c3e3ef..2558425e29e5 100644
> --- a/include/drm/drm_fb_helper.h
> +++ b/include/drm/drm_fb_helper.h
> @@ -246,6 +246,8 @@ int drm_fb_helper_simple_init(struct drm_device *dev,
> const struct drm_fb_helper_funcs *funcs,
> unsigned int bpp, int max_conn);
> void drm_fb_helper_simple_fini(struct drm_device *dev);
> +void drm_fb_helper_lastclose(struct drm_device *dev);
> +void drm_fb_helper_output_poll_changed(struct drm_device *dev);
> 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,
> @@ -328,6 +330,14 @@ static inline void drm_fb_helper_simple_fini(struct drm_device *dev)
> {
> }
>
> +static inline void drm_fb_helper_lastclose(struct drm_device *dev)
> +{
> +}
> +
> +static inline void drm_fb_helper_output_poll_changed(struct drm_device *dev)
> +{
> +}
> +
> static inline void drm_fb_helper_prepare(struct drm_device *dev,
> struct drm_fb_helper *helper,
> const struct drm_fb_helper_funcs *funcs)
> --
> 2.14.2
>
--
Daniel Vetter
Software Engineer, Intel Corporation
http://blog.ffwll.ch
More information about the dri-devel
mailing list