From 138b1116cf1965d64993c8378b927aeab22d58b7 Mon Sep 17 00:00:00 2001 From: =?utf8?q?Imre=20Vad=C3=A1sz?= Date: Sat, 19 Nov 2016 21:33:54 +0100 Subject: [PATCH] drm/radeon: restore the fbdev mode in lastclose restore the fbdev state if a drm app like X is killed. Taken-From: Linux git 8c70e1cda04b966b50ddfefafbd0ea376ed8edd5 --- sys/dev/drm/radeon/radeon_fb.c | 16 ++++++++++++++++ sys/dev/drm/radeon/radeon_kms.c | 5 ++++- sys/dev/drm/radeon/radeon_mode.h | 1 + 3 files changed, 21 insertions(+), 1 deletion(-) diff --git a/sys/dev/drm/radeon/radeon_fb.c b/sys/dev/drm/radeon/radeon_fb.c index 10a54971aa..acf440f74b 100644 --- a/sys/dev/drm/radeon/radeon_fb.c +++ b/sys/dev/drm/radeon/radeon_fb.c @@ -375,3 +375,19 @@ bool radeon_fbdev_robj_is_fb(struct radeon_device *rdev, struct radeon_bo *robj) return true; return false; } + +void radeon_fbdev_restore_mode(struct radeon_device *rdev) +{ + struct radeon_fbdev *rfbdev = rdev->mode_info.rfbdev; + struct drm_fb_helper *fb_helper; + int ret; + + if (!rfbdev) + return; + + fb_helper = &rfbdev->helper; + + ret = drm_fb_helper_restore_fbdev_mode_unlocked(fb_helper); + if (ret) + DRM_DEBUG("failed to restore crtc mode\n"); +} diff --git a/sys/dev/drm/radeon/radeon_kms.c b/sys/dev/drm/radeon/radeon_kms.c index b7bc60755e..2041067367 100644 --- a/sys/dev/drm/radeon/radeon_kms.c +++ b/sys/dev/drm/radeon/radeon_kms.c @@ -569,7 +569,7 @@ static int radeon_info_ioctl(struct drm_device *dev, void *data, struct drm_file * Outdated mess for old drm with Xorg being in charge (void function now). */ /** - * radeon_driver_firstopen_kms - drm callback for last close + * radeon_driver_lastclose_kms - drm callback for last close * * @dev: drm dev pointer * @@ -577,6 +577,9 @@ static int radeon_info_ioctl(struct drm_device *dev, void *data, struct drm_file */ void radeon_driver_lastclose_kms(struct drm_device *dev) { + struct radeon_device *rdev = dev->dev_private; + + radeon_fbdev_restore_mode(rdev); #ifdef DUMBBELL_WIP vga_switcheroo_process_delayed_switch(); #endif /* DUMBBELL_WIP */ diff --git a/sys/dev/drm/radeon/radeon_mode.h b/sys/dev/drm/radeon/radeon_mode.h index 25ad1c0d4b..64d9cd34b8 100644 --- a/sys/dev/drm/radeon/radeon_mode.h +++ b/sys/dev/drm/radeon/radeon_mode.h @@ -922,6 +922,7 @@ int radeon_fbdev_init(struct radeon_device *rdev); void radeon_fbdev_fini(struct radeon_device *rdev); void radeon_fbdev_set_suspend(struct radeon_device *rdev, int state); bool radeon_fbdev_robj_is_fb(struct radeon_device *rdev, struct radeon_bo *robj); +void radeon_fbdev_restore_mode(struct radeon_device *rdev); void radeon_fb_output_poll_changed(struct radeon_device *rdev); -- 2.11.4.GIT