Skip to content

Commit

Permalink
drm/radeon: restore the fbdev mode in lastclose
Browse files Browse the repository at this point in the history
restore the fbdev state if a drm app like X is killed.

Tested-by: Michel Dänzer <michel.daenzer@amd.com>
Reviewed-by: Michel Dänzer <michel.daenzer@amd.com>
Reviewed-by: Christian König <christian.koenig@amd.com>
Signed-off-by: Alex Deucher <alexander.deucher@amd.com>
  • Loading branch information
Alex Deucher committed Oct 5, 2015
1 parent 2b02ec7 commit 8c70e1c
Showing 3 changed files with 21 additions and 1 deletion.
16 changes: 16 additions & 0 deletions drivers/gpu/drm/radeon/radeon_fb.c
Original file line number Diff line number Diff line change
@@ -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");
}
5 changes: 4 additions & 1 deletion drivers/gpu/drm/radeon/radeon_kms.c
Original file line number Diff line number Diff line change
@@ -598,14 +598,17 @@ 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
*
* Switch vga switcheroo state after last close (all asics).
*/
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();
}

1 change: 1 addition & 0 deletions drivers/gpu/drm/radeon/radeon_mode.h
Original file line number Diff line number Diff line change
@@ -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);

0 comments on commit 8c70e1c

Please sign in to comment.