Commit 520a8718 authored by Ilija Hadzic's avatar Ilija Hadzic Committed by Alex Deucher

drm/radeon/kms: add crtc_disable function for legacy crtc

To plug the VRAM memory leak (see previous patch for
details) we must unpin the frame buffer when disabling the
CRTC. This warrants the addition of disable function for legacy
CRTC, which puts the CRTC in DPMS-OFF state and unpins the
frame buffer if there is one associated with the CRTC.
Signed-off-by: default avatarIlija Hadzic <ihadzic@research.bell-labs.com>
Signed-off-by: default avatarAlex Deucher <alexander.deucher@amd.com>
parent 75b871e2
...@@ -1056,6 +1056,26 @@ static void radeon_crtc_commit(struct drm_crtc *crtc) ...@@ -1056,6 +1056,26 @@ static void radeon_crtc_commit(struct drm_crtc *crtc)
} }
} }
static void radeon_crtc_disable(struct drm_crtc *crtc)
{
radeon_crtc_dpms(crtc, DRM_MODE_DPMS_OFF);
if (crtc->fb) {
int r;
struct radeon_framebuffer *radeon_fb;
struct radeon_bo *rbo;
radeon_fb = to_radeon_framebuffer(crtc->fb);
rbo = gem_to_radeon_bo(radeon_fb->obj);
r = radeon_bo_reserve(rbo, false);
if (unlikely(r))
DRM_ERROR("failed to reserve rbo before unpin\n");
else {
radeon_bo_unpin(rbo);
radeon_bo_unreserve(rbo);
}
}
}
static const struct drm_crtc_helper_funcs legacy_helper_funcs = { static const struct drm_crtc_helper_funcs legacy_helper_funcs = {
.dpms = radeon_crtc_dpms, .dpms = radeon_crtc_dpms,
.mode_fixup = radeon_crtc_mode_fixup, .mode_fixup = radeon_crtc_mode_fixup,
...@@ -1065,6 +1085,7 @@ static const struct drm_crtc_helper_funcs legacy_helper_funcs = { ...@@ -1065,6 +1085,7 @@ static const struct drm_crtc_helper_funcs legacy_helper_funcs = {
.prepare = radeon_crtc_prepare, .prepare = radeon_crtc_prepare,
.commit = radeon_crtc_commit, .commit = radeon_crtc_commit,
.load_lut = radeon_crtc_load_lut, .load_lut = radeon_crtc_load_lut,
.disable = radeon_crtc_disable
}; };
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment