summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorSefa Eyeoglu <contact@scrumplex.net>2021-03-16 22:50:06 +0100
committerAlex Deucher <alexander.deucher@amd.com>2021-04-09 16:44:40 -0400
commit7df4ceb60fa9a3c5160cfd5b696657291934a2c9 (patch)
treee998a9d9c5d9d225731755f4e4553081f919268b
parent5af50b0b1c200d31f6798a9ddd18aa706c868306 (diff)
downloadlinux-7df4ceb60fa9a3c5160cfd5b696657291934a2c9.tar.gz
linux-7df4ceb60fa9a3c5160cfd5b696657291934a2c9.tar.bz2
linux-7df4ceb60fa9a3c5160cfd5b696657291934a2c9.zip
drm/amd/display: check fb of primary plane
Sometimes the primary plane might not be initialized (yet), which causes dm_check_crtc_cursor to divide by zero. Apparently a weird state before a S3-suspend causes the aforementioned divide-by-zero error when resuming from S3. This was explained in bug 212293 on Bugzilla. To avoid this divide-by-zero error we check if the primary plane's fb isn't NULL. If it's NULL the src_w and src_h attributes will be 0, which would cause a divide-by-zero. This fixes Bugzilla report 212293 Bug: https://bugzilla.kernel.org/show_bug.cgi?id=212293 Fixes: 12f4849a1cfd69f3 ("drm/amd/display: check cursor scaling") Reviewed-by: Simon Ser <contact@emersion.fr> Reviewed-by: Harry Wentland <harry.wentland@amd.com> Signed-off-by: Sefa Eyeoglu <contact@scrumplex.net> Signed-off-by: Alex Deucher <alexander.deucher@amd.com>
-rw-r--r--drivers/gpu/drm/amd/display/amdgpu_dm/amdgpu_dm.c3
1 files changed, 2 insertions, 1 deletions
diff --git a/drivers/gpu/drm/amd/display/amdgpu_dm/amdgpu_dm.c b/drivers/gpu/drm/amd/display/amdgpu_dm/amdgpu_dm.c
index 01aa9c938b34..5aa985ffaee1 100644
--- a/drivers/gpu/drm/amd/display/amdgpu_dm/amdgpu_dm.c
+++ b/drivers/gpu/drm/amd/display/amdgpu_dm/amdgpu_dm.c
@@ -9765,7 +9765,8 @@ static int dm_check_crtc_cursor(struct drm_atomic_state *state,
new_cursor_state = drm_atomic_get_new_plane_state(state, crtc->cursor);
new_primary_state = drm_atomic_get_new_plane_state(state, crtc->primary);
- if (!new_cursor_state || !new_primary_state || !new_cursor_state->fb) {
+ if (!new_cursor_state || !new_primary_state ||
+ !new_cursor_state->fb || !new_primary_state->fb) {
return 0;
}