OSDN Git Service

drm/amdgpu/dc: Simplify drm_crtc_state::active checks
authorMichel Dänzer <mdaenzer@redhat.com>
Wed, 22 Jul 2020 12:38:13 +0000 (14:38 +0200)
committerAlex Deucher <alexander.deucher@amd.com>
Wed, 22 Jul 2020 22:43:31 +0000 (18:43 -0400)
drm_atomic_crtc_check enforces that ::active can only be true if
::enable is as well.

Reviewed-by: Daniel Vetter <daniel.vetter@ffwll.ch>
Reviewed-by: Nicholas Kazlauskas <nicholas.kazlauskas@amd.com>
Signed-off-by: Michel Dänzer <mdaenzer@redhat.com>
Signed-off-by: Alex Deucher <alexander.deucher@amd.com>
drivers/gpu/drm/amd/display/amdgpu_dm/amdgpu_dm.c

index 4588664..03a60c7 100644 (file)
@@ -3430,21 +3430,12 @@ static bool modeset_required(struct drm_crtc_state *crtc_state,
                             struct dc_stream_state *new_stream,
                             struct dc_stream_state *old_stream)
 {
-       if (!drm_atomic_crtc_needs_modeset(crtc_state))
-               return false;
-
-       if (!crtc_state->enable)
-               return false;
-
-       return crtc_state->active;
+       return crtc_state->active && drm_atomic_crtc_needs_modeset(crtc_state);
 }
 
 static bool modereset_required(struct drm_crtc_state *crtc_state)
 {
-       if (!drm_atomic_crtc_needs_modeset(crtc_state))
-               return false;
-
-       return !crtc_state->enable || !crtc_state->active;
+       return !crtc_state->active && drm_atomic_crtc_needs_modeset(crtc_state);
 }
 
 static void amdgpu_dm_encoder_destroy(struct drm_encoder *encoder)
@@ -8034,8 +8025,7 @@ skip_modeset:
         * We want to do dc stream updates that do not require a
         * full modeset below.
         */
-       if (!(enable && aconnector && new_crtc_state->enable &&
-             new_crtc_state->active))
+       if (!(enable && aconnector && new_crtc_state->active))
                return 0;
        /*
         * Given above conditions, the dc state cannot be NULL because: