Commit 7de96365 authored by Dave Airlie's avatar Dave Airlie
Browse files

Merge tag 'amd-drm-fixes-5.19-2022-07-06' of...

Merge tag 'amd-drm-fixes-5.19-2022-07-06' of https://gitlab.freedesktop.org/agd5f/linux

 into drm-fixes

amd-drm-fixes-5.19-2022-07-06:

amdgpu:
- Hibernation fix

Signed-off-by: default avatarDave Airlie <airlied@redhat.com>
From: Alex Deucher <alexander.deucher@amd.com>
Link: https://patchwork.freedesktop.org/patch/msgid/20220707024421.5773-1-alexander.deucher@amd.com
parents 32346491 3a4b1cc2
Loading
Loading
Loading
Loading
+21 −4
Original line number Diff line number Diff line
@@ -1528,6 +1528,21 @@ bool amdgpu_crtc_get_scanout_position(struct drm_crtc *crtc,
						  stime, etime, mode);
}

static bool
amdgpu_display_robj_is_fb(struct amdgpu_device *adev, struct amdgpu_bo *robj)
{
	struct drm_device *dev = adev_to_drm(adev);
	struct drm_fb_helper *fb_helper = dev->fb_helper;

	if (!fb_helper || !fb_helper->buffer)
		return false;

	if (gem_to_amdgpu_bo(fb_helper->buffer->gem) != robj)
		return false;

	return true;
}

int amdgpu_display_suspend_helper(struct amdgpu_device *adev)
{
	struct drm_device *dev = adev_to_drm(adev);
@@ -1563,12 +1578,14 @@ int amdgpu_display_suspend_helper(struct amdgpu_device *adev)
			continue;
		}
		robj = gem_to_amdgpu_bo(fb->obj[0]);
		if (!amdgpu_display_robj_is_fb(adev, robj)) {
			r = amdgpu_bo_reserve(robj, true);
			if (r == 0) {
				amdgpu_bo_unpin(robj);
				amdgpu_bo_unreserve(robj);
			}
		}
	}
	return 0;
}

+2 −1
Original line number Diff line number Diff line
@@ -496,7 +496,8 @@ static int amdgpu_vkms_sw_init(void *handle)
	adev_to_drm(adev)->mode_config.max_height = YRES_MAX;

	adev_to_drm(adev)->mode_config.preferred_depth = 24;
	adev_to_drm(adev)->mode_config.prefer_shadow = 1;
	/* disable prefer shadow for now due to hibernation issues */
	adev_to_drm(adev)->mode_config.prefer_shadow = 0;

	adev_to_drm(adev)->mode_config.fb_base = adev->gmc.aper_base;

+2 −1
Original line number Diff line number Diff line
@@ -2796,7 +2796,8 @@ static int dce_v10_0_sw_init(void *handle)
	adev_to_drm(adev)->mode_config.max_height = 16384;

	adev_to_drm(adev)->mode_config.preferred_depth = 24;
	adev_to_drm(adev)->mode_config.prefer_shadow = 1;
	/* disable prefer shadow for now due to hibernation issues */
	adev_to_drm(adev)->mode_config.prefer_shadow = 0;

	adev_to_drm(adev)->mode_config.fb_modifiers_not_supported = true;

+2 −1
Original line number Diff line number Diff line
@@ -2914,7 +2914,8 @@ static int dce_v11_0_sw_init(void *handle)
	adev_to_drm(adev)->mode_config.max_height = 16384;

	adev_to_drm(adev)->mode_config.preferred_depth = 24;
	adev_to_drm(adev)->mode_config.prefer_shadow = 1;
	/* disable prefer shadow for now due to hibernation issues */
	adev_to_drm(adev)->mode_config.prefer_shadow = 0;

	adev_to_drm(adev)->mode_config.fb_modifiers_not_supported = true;

+2 −1
Original line number Diff line number Diff line
@@ -2673,7 +2673,8 @@ static int dce_v6_0_sw_init(void *handle)
	adev_to_drm(adev)->mode_config.max_width = 16384;
	adev_to_drm(adev)->mode_config.max_height = 16384;
	adev_to_drm(adev)->mode_config.preferred_depth = 24;
	adev_to_drm(adev)->mode_config.prefer_shadow = 1;
	/* disable prefer shadow for now due to hibernation issues */
	adev_to_drm(adev)->mode_config.prefer_shadow = 0;
	adev_to_drm(adev)->mode_config.fb_modifiers_not_supported = true;
	adev_to_drm(adev)->mode_config.fb_base = adev->gmc.aper_base;

Loading