From bff91aad4bd38a9b252b5a64e9373e65d55901ef Mon Sep 17 00:00:00 2001 From: Alex Deucher Date: Mon, 19 Aug 2013 10:47:10 -0400 Subject: [PATCH 1/4] drm/radeon: move watermark setup out of set base callback Some of the watermark registers need to be programmed prior to enabling the display. Doing this in the set base callback means the watermark registers can be updated at arbitray times when the display offset is changed which can lead to display problems. Signed-off-by: Alex Deucher Cc: stable@vger.kernel.org --- drivers/gpu/drm/radeon/atombios_crtc.c | 13 +++++++------ drivers/gpu/drm/radeon/radeon_legacy_crtc.c | 6 +++--- 2 files changed, 10 insertions(+), 9 deletions(-) diff --git a/drivers/gpu/drm/radeon/atombios_crtc.c b/drivers/gpu/drm/radeon/atombios_crtc.c index b9d3b43..dd11e00 100644 --- a/drivers/gpu/drm/radeon/atombios_crtc.c +++ b/drivers/gpu/drm/radeon/atombios_crtc.c @@ -1278,9 +1278,6 @@ static int dce4_crtc_do_set_base(struct drm_crtc *crtc, radeon_bo_unreserve(rbo); } - /* Bytes per pixel may have changed */ - radeon_bandwidth_update(rdev); - return 0; } @@ -1447,9 +1444,6 @@ static int avivo_crtc_do_set_base(struct drm_crtc *crtc, radeon_bo_unreserve(rbo); } - /* Bytes per pixel may have changed */ - radeon_bandwidth_update(rdev); - return 0; } @@ -1897,6 +1891,11 @@ static void atombios_crtc_prepare(struct drm_crtc *crtc) static void atombios_crtc_commit(struct drm_crtc *crtc) { + struct drm_device *dev = crtc->dev; + struct radeon_device *rdev = dev->dev_private; + + /* set up watermarks before enabling the display */ + radeon_bandwidth_update(rdev); atombios_crtc_dpms(crtc, DRM_MODE_DPMS_ON); atombios_lock_crtc(crtc, ATOM_DISABLE); } @@ -1910,6 +1909,8 @@ static void atombios_crtc_disable(struct drm_crtc *crtc) int i; atombios_crtc_dpms(crtc, DRM_MODE_DPMS_OFF); + /* set up watermarks when the display is off */ + radeon_bandwidth_update(rdev); if (ASIC_IS_DCE6(rdev)) atombios_powergate_crtc(crtc, ATOM_ENABLE); diff --git a/drivers/gpu/drm/radeon/radeon_legacy_crtc.c b/drivers/gpu/drm/radeon/radeon_legacy_crtc.c index 7cb178a..dbc5b773 100644 --- a/drivers/gpu/drm/radeon/radeon_legacy_crtc.c +++ b/drivers/gpu/drm/radeon/radeon_legacy_crtc.c @@ -537,9 +537,6 @@ int radeon_crtc_do_set_base(struct drm_crtc *crtc, radeon_bo_unreserve(rbo); } - /* Bytes per pixel may have changed */ - radeon_bandwidth_update(rdev); - return 0; } @@ -1045,8 +1042,11 @@ static void radeon_crtc_prepare(struct drm_crtc *crtc) static void radeon_crtc_commit(struct drm_crtc *crtc) { struct drm_device *dev = crtc->dev; + struct radeon_device *rdev = dev->dev_private; struct drm_crtc *crtci; + /* set up watermarks before enabling the display */ + radeon_bandwidth_update(rdev); /* * Reenable the CRTCs that should be running. */ -- 1.8.3.1