Commit 58124bf8 authored by Jerry (Fangzhi) Zuo's avatar Jerry (Fangzhi) Zuo Committed by Alex Deucher

drm/amd/display: Fix NULL ptr when calculating refresh rate

Calculate preferred refresh rate only when preferred mode exists.
Signed-off-by: default avatarJerry (Fangzhi) Zuo <Jerry.Zuo@amd.com>
Reviewed-by: default avatarBhawanpreet Lakha <Bhawanpreet.Lakha@amd.com>
Signed-off-by: default avatarAlex Deucher <alexander.deucher@amd.com>
parent 8b955e00
...@@ -2848,7 +2848,7 @@ create_stream_for_sink(struct amdgpu_dm_connector *aconnector, ...@@ -2848,7 +2848,7 @@ create_stream_for_sink(struct amdgpu_dm_connector *aconnector,
bool native_mode_found = false; bool native_mode_found = false;
bool scale = dm_state ? (dm_state->scaling != RMX_OFF) : false; bool scale = dm_state ? (dm_state->scaling != RMX_OFF) : false;
int mode_refresh; int mode_refresh;
int preferred_refresh; int preferred_refresh = 0;
struct dc_sink *sink = NULL; struct dc_sink *sink = NULL;
if (aconnector == NULL) { if (aconnector == NULL) {
...@@ -2902,13 +2902,12 @@ create_stream_for_sink(struct amdgpu_dm_connector *aconnector, ...@@ -2902,13 +2902,12 @@ create_stream_for_sink(struct amdgpu_dm_connector *aconnector,
decide_crtc_timing_for_drm_display_mode( decide_crtc_timing_for_drm_display_mode(
&mode, preferred_mode, &mode, preferred_mode,
dm_state ? (dm_state->scaling != RMX_OFF) : false); dm_state ? (dm_state->scaling != RMX_OFF) : false);
preferred_refresh = drm_mode_vrefresh(preferred_mode);
} }
if (!dm_state) if (!dm_state)
drm_mode_set_crtcinfo(&mode, 0); drm_mode_set_crtcinfo(&mode, 0);
preferred_refresh = drm_mode_vrefresh(preferred_mode);
/* /*
* If scaling is enabled and refresh rate didn't change * If scaling is enabled and refresh rate didn't change
* we copy the vic and polarities of the old timings * we copy the vic and polarities of the old timings
......
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