[1/2] drm/radeon: restore the fbdev mode in lastclose
diff mbox

Message ID 1443820371-1322-1-git-send-email-alexander.deucher@amd.com
State New
Headers show

Commit Message

Alex Deucher Oct. 2, 2015, 9:12 p.m. UTC
restore the fbdev state if a drm app like X is killed.

Signed-off-by: Alex Deucher <alexander.deucher@amd.com>
---
 drivers/gpu/drm/radeon/radeon_fb.c   | 16 ++++++++++++++++
 drivers/gpu/drm/radeon/radeon_kms.c  |  5 ++++-
 drivers/gpu/drm/radeon/radeon_mode.h |  1 +
 3 files changed, 21 insertions(+), 1 deletion(-)

Comments

Michel Dänzer Oct. 5, 2015, 6:30 a.m. UTC | #1
On 03.10.2015 06:12, Alex Deucher wrote:
> restore the fbdev state if a drm app like X is killed.
> 
> Signed-off-by: Alex Deucher <alexander.deucher@amd.com>

This patch is

Tested-by: Michel Dänzer <michel.daenzer@amd.com>

Both patches are

Reviewed-by: Michel Dänzer <michel.daenzer@amd.com>
Christian König Oct. 5, 2015, 12:39 p.m. UTC | #2
On 05.10.2015 08:30, Michel Dänzer wrote:
> On 03.10.2015 06:12, Alex Deucher wrote:
>> restore the fbdev state if a drm app like X is killed.
>>
>> Signed-off-by: Alex Deucher <alexander.deucher@amd.com>
> This patch is
>
> Tested-by: Michel Dänzer <michel.daenzer@amd.com>
>
> Both patches are
>
> Reviewed-by: Michel Dänzer <michel.daenzer@amd.com>
>
>

For both Reviewed-by: Christian König <christian.koenig@amd.com>

Patch
diff mbox

diff --git a/drivers/gpu/drm/radeon/radeon_fb.c b/drivers/gpu/drm/radeon/radeon_fb.c
index 1aa657f..26da2f4 100644
--- a/drivers/gpu/drm/radeon/radeon_fb.c
+++ b/drivers/gpu/drm/radeon/radeon_fb.c
@@ -397,3 +397,19 @@  void radeon_fb_remove_connector(struct radeon_device *rdev, struct drm_connector
 {
 	drm_fb_helper_remove_one_connector(&rdev->mode_info.rfbdev->helper, connector);
 }
+
+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/drivers/gpu/drm/radeon/radeon_kms.c b/drivers/gpu/drm/radeon/radeon_kms.c
index 4a119c2..0e932bf 100644
--- a/drivers/gpu/drm/radeon/radeon_kms.c
+++ b/drivers/gpu/drm/radeon/radeon_kms.c
@@ -598,7 +598,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
  *
@@ -606,6 +606,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);
 	vga_switcheroo_process_delayed_switch();
 }
 
diff --git a/drivers/gpu/drm/radeon/radeon_mode.h b/drivers/gpu/drm/radeon/radeon_mode.h
index aecc3e3..457b026 100644
--- a/drivers/gpu/drm/radeon/radeon_mode.h
+++ b/drivers/gpu/drm/radeon/radeon_mode.h
@@ -980,6 +980,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);