[PATCH 03/16] drm: review locking for drm_fb_helper_restore_fbdev_mode
Rob Clark
robdclark at gmail.com
Mon Feb 11 14:10:01 PST 2013
On Thu, Jan 24, 2013 at 10:20 AM, Daniel Vetter <daniel.vetter at ffwll.ch> wrote:
> ... it's required. Fix up exynos and the cma helper, and add a
> corresponding WARN_ON to drm_fb_helper_restore_fbdev_mode.
>
> Note that tegra calls the fbdev cma helper restore function also from
> it's driver-load callback. Which is a bit against current practice,
> since usually the call is only from ->lastclose, and initial setup is
> done by drm_fb_helper_initial_config.
>
> Also add the relevant drm DocBook entry.
>
> Signed-off-by: Daniel Vetter <daniel.vetter at ffwll.ch>
With the actual addition of the promised WARN_ON,
Reviewed-by: Rob Clark <robdclark at gmail.com>
> ---
> drivers/gpu/drm/drm_fb_cma_helper.c | 2 ++
> drivers/gpu/drm/drm_fb_helper.c | 8 ++++++++
> drivers/gpu/drm/exynos/exynos_drm_fbdev.c | 2 ++
> 3 files changed, 12 insertions(+)
>
> diff --git a/drivers/gpu/drm/drm_fb_cma_helper.c b/drivers/gpu/drm/drm_fb_cma_helper.c
> index 3742bc9..1b6ba2d 100644
> --- a/drivers/gpu/drm/drm_fb_cma_helper.c
> +++ b/drivers/gpu/drm/drm_fb_cma_helper.c
> @@ -389,8 +389,10 @@ EXPORT_SYMBOL_GPL(drm_fbdev_cma_fini);
> */
> void drm_fbdev_cma_restore_mode(struct drm_fbdev_cma *fbdev_cma)
> {
> + drm_modeset_lock_all(dev);
> if (fbdev_cma)
> drm_fb_helper_restore_fbdev_mode(&fbdev_cma->fb_helper);
> + drm_modeset_unlock_all(dev);
> }
> EXPORT_SYMBOL_GPL(drm_fbdev_cma_restore_mode);
>
> diff --git a/drivers/gpu/drm/drm_fb_helper.c b/drivers/gpu/drm/drm_fb_helper.c
> index 0c6e25e..0439cb0 100644
> --- a/drivers/gpu/drm/drm_fb_helper.c
> +++ b/drivers/gpu/drm/drm_fb_helper.c
> @@ -239,6 +239,14 @@ int drm_fb_helper_debug_leave(struct fb_info *info)
> }
> EXPORT_SYMBOL(drm_fb_helper_debug_leave);
>
> +/**
> + * drm_fb_helper_restore_fbdev_mode - restore fbdev configuration
> + * @fb_helper: fbcon to restore
> + *
> + * This should be called from driver's drm->lastclose callback when implementing
> + * an fbcon on top of kms using this helper. This ensures that the user isn't
> + * greeted with a black screen when e.g. X dies.
> + */
> bool drm_fb_helper_restore_fbdev_mode(struct drm_fb_helper *fb_helper)
> {
> bool error = false;
> diff --git a/drivers/gpu/drm/exynos/exynos_drm_fbdev.c b/drivers/gpu/drm/exynos/exynos_drm_fbdev.c
> index 90d335c..086d0f7 100644
> --- a/drivers/gpu/drm/exynos/exynos_drm_fbdev.c
> +++ b/drivers/gpu/drm/exynos/exynos_drm_fbdev.c
> @@ -376,5 +376,7 @@ void exynos_drm_fbdev_restore_mode(struct drm_device *dev)
> if (!private || !private->fb_helper)
> return;
>
> + drm_modeset_lock_all(dev);
> drm_fb_helper_restore_fbdev_mode(private->fb_helper);
> + drm_modeset_unlock_all(dev);
> }
> --
> 1.7.10.4
>
> _______________________________________________
> dri-devel mailing list
> dri-devel at lists.freedesktop.org
> http://lists.freedesktop.org/mailman/listinfo/dri-devel
More information about the dri-devel
mailing list