diff options
Diffstat (limited to 'drivers/gpu')
-rw-r--r-- | drivers/gpu/drm/armada/armada_fbdev.c | 4 | ||||
-rw-r--r-- | drivers/gpu/drm/drm_fb_cma_helper.c | 9 | ||||
-rw-r--r-- | drivers/gpu/drm/drm_fb_helper.c | 50 | ||||
-rw-r--r-- | drivers/gpu/drm/exynos/exynos_drm_fbdev.c | 4 | ||||
-rw-r--r-- | drivers/gpu/drm/gma500/psb_drv.c | 4 | ||||
-rw-r--r-- | drivers/gpu/drm/i915/intel_fbdev.c | 6 | ||||
-rw-r--r-- | drivers/gpu/drm/msm/msm_drv.c | 7 | ||||
-rw-r--r-- | drivers/gpu/drm/omapdrm/omap_drv.c | 4 | ||||
-rw-r--r-- | drivers/gpu/drm/tegra/fb.c | 7 |
9 files changed, 47 insertions, 48 deletions
diff --git a/drivers/gpu/drm/armada/armada_fbdev.c b/drivers/gpu/drm/armada/armada_fbdev.c index 948cb14c561e..fd166f532ab9 100644 --- a/drivers/gpu/drm/armada/armada_fbdev.c +++ b/drivers/gpu/drm/armada/armada_fbdev.c | |||
@@ -181,10 +181,8 @@ void armada_fbdev_lastclose(struct drm_device *dev) | |||
181 | { | 181 | { |
182 | struct armada_private *priv = dev->dev_private; | 182 | struct armada_private *priv = dev->dev_private; |
183 | 183 | ||
184 | drm_modeset_lock_all(dev); | ||
185 | if (priv->fbdev) | 184 | if (priv->fbdev) |
186 | drm_fb_helper_restore_fbdev_mode(priv->fbdev); | 185 | drm_fb_helper_restore_fbdev_mode_unlocked(priv->fbdev); |
187 | drm_modeset_unlock_all(dev); | ||
188 | } | 186 | } |
189 | 187 | ||
190 | void armada_fbdev_fini(struct drm_device *dev) | 188 | void armada_fbdev_fini(struct drm_device *dev) |
diff --git a/drivers/gpu/drm/drm_fb_cma_helper.c b/drivers/gpu/drm/drm_fb_cma_helper.c index 61b5a47ad239..f27c883be391 100644 --- a/drivers/gpu/drm/drm_fb_cma_helper.c +++ b/drivers/gpu/drm/drm_fb_cma_helper.c | |||
@@ -429,13 +429,8 @@ EXPORT_SYMBOL_GPL(drm_fbdev_cma_fini); | |||
429 | */ | 429 | */ |
430 | void drm_fbdev_cma_restore_mode(struct drm_fbdev_cma *fbdev_cma) | 430 | void drm_fbdev_cma_restore_mode(struct drm_fbdev_cma *fbdev_cma) |
431 | { | 431 | { |
432 | if (fbdev_cma) { | 432 | if (fbdev_cma) |
433 | struct drm_device *dev = fbdev_cma->fb_helper.dev; | 433 | drm_fb_helper_restore_fbdev_mode_unlocked(&fbdev_cma->fb_helper); |
434 | |||
435 | drm_modeset_lock_all(dev); | ||
436 | drm_fb_helper_restore_fbdev_mode(&fbdev_cma->fb_helper); | ||
437 | drm_modeset_unlock_all(dev); | ||
438 | } | ||
439 | } | 434 | } |
440 | EXPORT_SYMBOL_GPL(drm_fbdev_cma_restore_mode); | 435 | EXPORT_SYMBOL_GPL(drm_fbdev_cma_restore_mode); |
441 | 436 | ||
diff --git a/drivers/gpu/drm/drm_fb_helper.c b/drivers/gpu/drm/drm_fb_helper.c index 43329cee299f..d5d8cea1a679 100644 --- a/drivers/gpu/drm/drm_fb_helper.c +++ b/drivers/gpu/drm/drm_fb_helper.c | |||
@@ -273,15 +273,7 @@ int drm_fb_helper_debug_leave(struct fb_info *info) | |||
273 | } | 273 | } |
274 | EXPORT_SYMBOL(drm_fb_helper_debug_leave); | 274 | EXPORT_SYMBOL(drm_fb_helper_debug_leave); |
275 | 275 | ||
276 | /** | 276 | static bool restore_fbdev_mode(struct drm_fb_helper *fb_helper) |
277 | * drm_fb_helper_restore_fbdev_mode - restore fbdev configuration | ||
278 | * @fb_helper: fbcon to restore | ||
279 | * | ||
280 | * This should be called from driver's drm ->lastclose callback | ||
281 | * when implementing an fbcon on top of kms using this helper. This ensures that | ||
282 | * the user isn't greeted with a black screen when e.g. X dies. | ||
283 | */ | ||
284 | bool drm_fb_helper_restore_fbdev_mode(struct drm_fb_helper *fb_helper) | ||
285 | { | 277 | { |
286 | struct drm_device *dev = fb_helper->dev; | 278 | struct drm_device *dev = fb_helper->dev; |
287 | struct drm_plane *plane; | 279 | struct drm_plane *plane; |
@@ -311,7 +303,40 @@ bool drm_fb_helper_restore_fbdev_mode(struct drm_fb_helper *fb_helper) | |||
311 | } | 303 | } |
312 | return error; | 304 | return error; |
313 | } | 305 | } |
314 | EXPORT_SYMBOL(drm_fb_helper_restore_fbdev_mode); | 306 | /** |
307 | * drm_fb_helper_restore_fbdev_mode - restore fbdev configuration | ||
308 | * @fb_helper: fbcon to restore | ||
309 | * | ||
310 | * This should be called from driver's drm ->lastclose callback | ||
311 | * when implementing an fbcon on top of kms using this helper. This ensures that | ||
312 | * the user isn't greeted with a black screen when e.g. X dies. | ||
313 | * | ||
314 | * Use this variant if you need to bypass locking (panic), or already | ||
315 | * hold all modeset locks. Otherwise use drm_fb_helper_restore_fbdev_mode_unlocked() | ||
316 | */ | ||
317 | static bool drm_fb_helper_restore_fbdev_mode(struct drm_fb_helper *fb_helper) | ||
318 | { | ||
319 | return restore_fbdev_mode(fb_helper); | ||
320 | } | ||
321 | |||
322 | /** | ||
323 | * drm_fb_helper_restore_fbdev_mode_unlocked - restore fbdev configuration | ||
324 | * @fb_helper: fbcon to restore | ||
325 | * | ||
326 | * This should be called from driver's drm ->lastclose callback | ||
327 | * when implementing an fbcon on top of kms using this helper. This ensures that | ||
328 | * the user isn't greeted with a black screen when e.g. X dies. | ||
329 | */ | ||
330 | bool drm_fb_helper_restore_fbdev_mode_unlocked(struct drm_fb_helper *fb_helper) | ||
331 | { | ||
332 | struct drm_device *dev = fb_helper->dev; | ||
333 | bool ret; | ||
334 | drm_modeset_lock_all(dev); | ||
335 | ret = restore_fbdev_mode(fb_helper); | ||
336 | drm_modeset_unlock_all(dev); | ||
337 | return ret; | ||
338 | } | ||
339 | EXPORT_SYMBOL(drm_fb_helper_restore_fbdev_mode_unlocked); | ||
315 | 340 | ||
316 | /* | 341 | /* |
317 | * restore fbcon display for all kms driver's using this helper, used for sysrq | 342 | * restore fbcon display for all kms driver's using this helper, used for sysrq |
@@ -824,7 +849,6 @@ EXPORT_SYMBOL(drm_fb_helper_check_var); | |||
824 | int drm_fb_helper_set_par(struct fb_info *info) | 849 | int drm_fb_helper_set_par(struct fb_info *info) |
825 | { | 850 | { |
826 | struct drm_fb_helper *fb_helper = info->par; | 851 | struct drm_fb_helper *fb_helper = info->par; |
827 | struct drm_device *dev = fb_helper->dev; | ||
828 | struct fb_var_screeninfo *var = &info->var; | 852 | struct fb_var_screeninfo *var = &info->var; |
829 | 853 | ||
830 | if (var->pixclock != 0) { | 854 | if (var->pixclock != 0) { |
@@ -832,9 +856,7 @@ int drm_fb_helper_set_par(struct fb_info *info) | |||
832 | return -EINVAL; | 856 | return -EINVAL; |
833 | } | 857 | } |
834 | 858 | ||
835 | drm_modeset_lock_all(dev); | 859 | drm_fb_helper_restore_fbdev_mode_unlocked(fb_helper); |
836 | drm_fb_helper_restore_fbdev_mode(fb_helper); | ||
837 | drm_modeset_unlock_all(dev); | ||
838 | 860 | ||
839 | if (fb_helper->delayed_hotplug) { | 861 | if (fb_helper->delayed_hotplug) { |
840 | fb_helper->delayed_hotplug = false; | 862 | fb_helper->delayed_hotplug = false; |
diff --git a/drivers/gpu/drm/exynos/exynos_drm_fbdev.c b/drivers/gpu/drm/exynos/exynos_drm_fbdev.c index 14bbaa33b477..d771b467cf0c 100644 --- a/drivers/gpu/drm/exynos/exynos_drm_fbdev.c +++ b/drivers/gpu/drm/exynos/exynos_drm_fbdev.c | |||
@@ -367,7 +367,5 @@ void exynos_drm_fbdev_restore_mode(struct drm_device *dev) | |||
367 | if (!private || !private->fb_helper) | 367 | if (!private || !private->fb_helper) |
368 | return; | 368 | return; |
369 | 369 | ||
370 | drm_modeset_lock_all(dev); | 370 | drm_fb_helper_restore_fbdev_mode_unlocked(private->fb_helper); |
371 | drm_fb_helper_restore_fbdev_mode(private->fb_helper); | ||
372 | drm_modeset_unlock_all(dev); | ||
373 | } | 371 | } |
diff --git a/drivers/gpu/drm/gma500/psb_drv.c b/drivers/gpu/drm/gma500/psb_drv.c index 0a3101a3db19..59ea45e5c97e 100644 --- a/drivers/gpu/drm/gma500/psb_drv.c +++ b/drivers/gpu/drm/gma500/psb_drv.c | |||
@@ -112,11 +112,9 @@ static void psb_driver_lastclose(struct drm_device *dev) | |||
112 | struct drm_psb_private *dev_priv = dev->dev_private; | 112 | struct drm_psb_private *dev_priv = dev->dev_private; |
113 | struct psb_fbdev *fbdev = dev_priv->fbdev; | 113 | struct psb_fbdev *fbdev = dev_priv->fbdev; |
114 | 114 | ||
115 | drm_modeset_lock_all(dev); | 115 | ret = drm_fb_helper_restore_fbdev_mode_unlocked(&fbdev->psb_fb_helper); |
116 | ret = drm_fb_helper_restore_fbdev_mode(&fbdev->psb_fb_helper); | ||
117 | if (ret) | 116 | if (ret) |
118 | DRM_DEBUG("failed to restore crtc mode\n"); | 117 | DRM_DEBUG("failed to restore crtc mode\n"); |
119 | drm_modeset_unlock_all(dev); | ||
120 | 118 | ||
121 | return; | 119 | return; |
122 | } | 120 | } |
diff --git a/drivers/gpu/drm/i915/intel_fbdev.c b/drivers/gpu/drm/i915/intel_fbdev.c index e2d416149f53..6ea2d75464da 100644 --- a/drivers/gpu/drm/i915/intel_fbdev.c +++ b/drivers/gpu/drm/i915/intel_fbdev.c | |||
@@ -687,11 +687,7 @@ void intel_fbdev_restore_mode(struct drm_device *dev) | |||
687 | if (!dev_priv->fbdev) | 687 | if (!dev_priv->fbdev) |
688 | return; | 688 | return; |
689 | 689 | ||
690 | drm_modeset_lock_all(dev); | 690 | ret = drm_fb_helper_restore_fbdev_mode_unlocked(&dev_priv->fbdev->helper); |
691 | |||
692 | ret = drm_fb_helper_restore_fbdev_mode(&dev_priv->fbdev->helper); | ||
693 | if (ret) | 691 | if (ret) |
694 | DRM_DEBUG("failed to restore crtc mode\n"); | 692 | DRM_DEBUG("failed to restore crtc mode\n"); |
695 | |||
696 | drm_modeset_unlock_all(dev); | ||
697 | } | 693 | } |
diff --git a/drivers/gpu/drm/msm/msm_drv.c b/drivers/gpu/drm/msm/msm_drv.c index c071aacf2752..0d2562fb681e 100644 --- a/drivers/gpu/drm/msm/msm_drv.c +++ b/drivers/gpu/drm/msm/msm_drv.c | |||
@@ -386,11 +386,8 @@ static void msm_preclose(struct drm_device *dev, struct drm_file *file) | |||
386 | static void msm_lastclose(struct drm_device *dev) | 386 | static void msm_lastclose(struct drm_device *dev) |
387 | { | 387 | { |
388 | struct msm_drm_private *priv = dev->dev_private; | 388 | struct msm_drm_private *priv = dev->dev_private; |
389 | if (priv->fbdev) { | 389 | if (priv->fbdev) |
390 | drm_modeset_lock_all(dev); | 390 | drm_fb_helper_restore_fbdev_mode_unlocked(priv->fbdev); |
391 | drm_fb_helper_restore_fbdev_mode(priv->fbdev); | ||
392 | drm_modeset_unlock_all(dev); | ||
393 | } | ||
394 | } | 391 | } |
395 | 392 | ||
396 | static irqreturn_t msm_irq(int irq, void *arg) | 393 | static irqreturn_t msm_irq(int irq, void *arg) |
diff --git a/drivers/gpu/drm/omapdrm/omap_drv.c b/drivers/gpu/drm/omapdrm/omap_drv.c index c8270e4b26f3..002b9721e85a 100644 --- a/drivers/gpu/drm/omapdrm/omap_drv.c +++ b/drivers/gpu/drm/omapdrm/omap_drv.c | |||
@@ -588,9 +588,7 @@ static void dev_lastclose(struct drm_device *dev) | |||
588 | } | 588 | } |
589 | } | 589 | } |
590 | 590 | ||
591 | drm_modeset_lock_all(dev); | 591 | ret = drm_fb_helper_restore_fbdev_mode_unlocked(priv->fbdev); |
592 | ret = drm_fb_helper_restore_fbdev_mode(priv->fbdev); | ||
593 | drm_modeset_unlock_all(dev); | ||
594 | if (ret) | 592 | if (ret) |
595 | DBG("failed to restore crtc mode"); | 593 | DBG("failed to restore crtc mode"); |
596 | } | 594 | } |
diff --git a/drivers/gpu/drm/tegra/fb.c b/drivers/gpu/drm/tegra/fb.c index f7fca09d4921..9798a7080322 100644 --- a/drivers/gpu/drm/tegra/fb.c +++ b/drivers/gpu/drm/tegra/fb.c | |||
@@ -346,11 +346,8 @@ static void tegra_fbdev_free(struct tegra_fbdev *fbdev) | |||
346 | 346 | ||
347 | void tegra_fbdev_restore_mode(struct tegra_fbdev *fbdev) | 347 | void tegra_fbdev_restore_mode(struct tegra_fbdev *fbdev) |
348 | { | 348 | { |
349 | if (fbdev) { | 349 | if (fbdev) |
350 | drm_modeset_lock_all(fbdev->base.dev); | 350 | drm_fb_helper_restore_fbdev_mode_unlocked(&fbdev->base); |
351 | drm_fb_helper_restore_fbdev_mode(&fbdev->base); | ||
352 | drm_modeset_unlock_all(fbdev->base.dev); | ||
353 | } | ||
354 | } | 351 | } |
355 | 352 | ||
356 | static void tegra_fb_output_poll_changed(struct drm_device *drm) | 353 | static void tegra_fb_output_poll_changed(struct drm_device *drm) |