diff options
author | Ilija Hadzic <ilijahadzic@gmail.com> | 2013-11-02 23:00:19 -0400 |
---|---|---|
committer | Alex Deucher <alexander.deucher@amd.com> | 2013-11-08 12:33:36 -0500 |
commit | 75b871e2d831700d8fd63079eebbbc36b6731bdf (patch) | |
tree | fd3bb5b05aa1cca4a6d3d9df94266f5b0a9d6616 | |
parent | 0f57bca922ed2180056aa1f948536236488b4a0d (diff) |
drm/radeon/kms: unpin fb in atombios crtc disable
When drm_helper_disable_unused_functions calls disable
function of the CRTC, it also sets the crtc->fb pointer
to NULL. This can later (when the mode on that CRTC is setup
again from user space) cause ***_do_set_base functions to
"think" that there is no old buffer and skip the unpinning
code. Consequently, the buffer that has been NULL-ified in
drm_helper_disable_unused_functions will never be unpinned
causing a leak in VRAM.
This patch plugs the leak by unpinning the frame buffer
in crtc_disable function.
Signed-off-by: Ilija Hadzic <ihadzic@research.bell-labs.com>
Signed-off-by: Alex Deucher <alexander.deucher@amd.com>
-rw-r--r-- | drivers/gpu/drm/radeon/atombios_crtc.c | 15 |
1 files changed, 15 insertions, 0 deletions
diff --git a/drivers/gpu/drm/radeon/atombios_crtc.c b/drivers/gpu/drm/radeon/atombios_crtc.c index 86d9ee08b13f..4ad156267381 100644 --- a/drivers/gpu/drm/radeon/atombios_crtc.c +++ b/drivers/gpu/drm/radeon/atombios_crtc.c | |||
@@ -1910,6 +1910,21 @@ static void atombios_crtc_disable(struct drm_crtc *crtc) | |||
1910 | int i; | 1910 | int i; |
1911 | 1911 | ||
1912 | atombios_crtc_dpms(crtc, DRM_MODE_DPMS_OFF); | 1912 | atombios_crtc_dpms(crtc, DRM_MODE_DPMS_OFF); |
1913 | if (crtc->fb) { | ||
1914 | int r; | ||
1915 | struct radeon_framebuffer *radeon_fb; | ||
1916 | struct radeon_bo *rbo; | ||
1917 | |||
1918 | radeon_fb = to_radeon_framebuffer(crtc->fb); | ||
1919 | rbo = gem_to_radeon_bo(radeon_fb->obj); | ||
1920 | r = radeon_bo_reserve(rbo, false); | ||
1921 | if (unlikely(r)) | ||
1922 | DRM_ERROR("failed to reserve rbo before unpin\n"); | ||
1923 | else { | ||
1924 | radeon_bo_unpin(rbo); | ||
1925 | radeon_bo_unreserve(rbo); | ||
1926 | } | ||
1927 | } | ||
1913 | /* disable the GRPH */ | 1928 | /* disable the GRPH */ |
1914 | if (ASIC_IS_DCE4(rdev)) | 1929 | if (ASIC_IS_DCE4(rdev)) |
1915 | WREG32(EVERGREEN_GRPH_ENABLE + radeon_crtc->crtc_offset, 0); | 1930 | WREG32(EVERGREEN_GRPH_ENABLE + radeon_crtc->crtc_offset, 0); |