@@ -3128,9 +3128,12 @@ void amdgpu_dm_update_connector_after_detect(
31283128 aconnector -> edid );
31293129 }
31303130
3131- aconnector -> timing_requested = kzalloc (sizeof (struct dc_crtc_timing ), GFP_KERNEL );
3132- if (!aconnector -> timing_requested )
3133- dm_error ("%s: failed to create aconnector->requested_timing\n" , __func__ );
3131+ if (!aconnector -> timing_requested ) {
3132+ aconnector -> timing_requested =
3133+ kzalloc (sizeof (struct dc_crtc_timing ), GFP_KERNEL );
3134+ if (!aconnector -> timing_requested )
3135+ dm_error ("failed to create aconnector->requested_timing\n" );
3136+ }
31343137
31353138 drm_connector_update_edid_property (connector , aconnector -> edid );
31363139 amdgpu_dm_update_freesync_caps (connector , aconnector -> edid );
@@ -7898,6 +7901,13 @@ static void amdgpu_dm_commit_cursors(struct drm_atomic_state *state)
78987901 amdgpu_dm_plane_handle_cursor_update (plane , old_plane_state );
78997902}
79007903
7904+ static inline uint32_t get_mem_type (struct drm_framebuffer * fb )
7905+ {
7906+ struct amdgpu_bo * abo = gem_to_amdgpu_bo (fb -> obj [0 ]);
7907+
7908+ return abo -> tbo .resource ? abo -> tbo .resource -> mem_type : 0 ;
7909+ }
7910+
79017911static void amdgpu_dm_commit_planes (struct drm_atomic_state * state ,
79027912 struct dc_state * dc_state ,
79037913 struct drm_device * dev ,
@@ -7972,6 +7982,8 @@ static void amdgpu_dm_commit_planes(struct drm_atomic_state *state,
79727982 continue ;
79737983
79747984 dc_plane = dm_new_plane_state -> dc_state ;
7985+ if (!dc_plane )
7986+ continue ;
79757987
79767988 bundle -> surface_updates [planes_count ].surface = dc_plane ;
79777989 if (new_pcrtc_state -> color_mgmt_changed ) {
@@ -8038,11 +8050,13 @@ static void amdgpu_dm_commit_planes(struct drm_atomic_state *state,
80388050
80398051 /*
80408052 * Only allow immediate flips for fast updates that don't
8041- * change FB pitch, DCC state, rotation or mirroing.
8053+ * change memory domain, FB pitch, DCC state, rotation or
8054+ * mirroring.
80428055 */
80438056 bundle -> flip_addrs [planes_count ].flip_immediate =
80448057 crtc -> state -> async_flip &&
8045- acrtc_state -> update_type == UPDATE_TYPE_FAST ;
8058+ acrtc_state -> update_type == UPDATE_TYPE_FAST &&
8059+ get_mem_type (old_plane_state -> fb ) == get_mem_type (fb );
80468060
80478061 timestamp_ns = ktime_get_ns ();
80488062 bundle -> flip_addrs [planes_count ].flip_timestamp_in_us = div_u64 (timestamp_ns , 1000 );
@@ -8554,6 +8568,9 @@ static void amdgpu_dm_atomic_commit_tail(struct drm_atomic_state *state)
85548568 struct amdgpu_crtc * acrtc = to_amdgpu_crtc (dm_new_con_state -> base .crtc );
85558569 struct amdgpu_dm_connector * aconnector = to_amdgpu_dm_connector (connector );
85568570
8571+ if (!adev -> dm .hdcp_workqueue )
8572+ continue ;
8573+
85578574 pr_debug ("[HDCP_DM] -------------- i : %x ----------\n" , i );
85588575
85598576 if (!connector )
@@ -8602,6 +8619,9 @@ static void amdgpu_dm_atomic_commit_tail(struct drm_atomic_state *state)
86028619 struct amdgpu_crtc * acrtc = to_amdgpu_crtc (dm_new_con_state -> base .crtc );
86038620 struct amdgpu_dm_connector * aconnector = to_amdgpu_dm_connector (connector );
86048621
8622+ if (!adev -> dm .hdcp_workqueue )
8623+ continue ;
8624+
86058625 new_crtc_state = NULL ;
86068626 old_crtc_state = NULL ;
86078627
@@ -9620,8 +9640,9 @@ static int dm_update_plane_state(struct dc *dc,
96209640 return - EINVAL ;
96219641 }
96229642
9643+ if (dm_old_plane_state -> dc_state )
9644+ dc_plane_state_release (dm_old_plane_state -> dc_state );
96239645
9624- dc_plane_state_release (dm_old_plane_state -> dc_state );
96259646 dm_new_plane_state -> dc_state = NULL ;
96269647
96279648 * lock_and_validation_needed = true;
@@ -10158,6 +10179,7 @@ static int amdgpu_dm_atomic_check(struct drm_device *dev,
1015810179 ret = compute_mst_dsc_configs_for_state (state , dm_state -> context , vars );
1015910180 if (ret ) {
1016010181 DRM_DEBUG_DRIVER ("compute_mst_dsc_configs_for_state() failed\n" );
10182+ ret = - EINVAL ;
1016110183 goto fail ;
1016210184 }
1016310185
0 commit comments