@@ -4555,8 +4555,8 @@ static int dm_update_crtcs_state(struct dc *dc,
4555
4555
for_each_oldnew_crtc_in_state (state , crtc , old_crtc_state , new_crtc_state , i ) {
4556
4556
struct amdgpu_crtc * acrtc = NULL ;
4557
4557
struct amdgpu_dm_connector * aconnector = NULL ;
4558
- struct drm_connector_state * new_con_state = NULL ;
4559
- struct dm_connector_state * dm_conn_state = NULL ;
4558
+ struct drm_connector_state * drm_new_conn_state = NULL , * drm_old_conn_state = NULL ;
4559
+ struct dm_connector_state * dm_new_conn_state = NULL , * dm_old_conn_state = NULL ;
4560
4560
struct drm_plane_state * new_plane_state = NULL ;
4561
4561
4562
4562
new_stream = NULL ;
@@ -4577,19 +4577,23 @@ static int dm_update_crtcs_state(struct dc *dc,
4577
4577
/* TODO This hack should go away */
4578
4578
if (aconnector && enable ) {
4579
4579
// Make sure fake sink is created in plug-in scenario
4580
- new_con_state = drm_atomic_get_connector_state (state ,
4580
+ drm_new_conn_state = drm_atomic_get_new_connector_state (state ,
4581
4581
& aconnector -> base );
4582
+ drm_old_conn_state = drm_atomic_get_old_connector_state (state ,
4583
+ & aconnector -> base );
4582
4584
4583
- if (IS_ERR (new_con_state )) {
4584
- ret = PTR_ERR_OR_ZERO (new_con_state );
4585
+
4586
+ if (IS_ERR (drm_new_conn_state )) {
4587
+ ret = PTR_ERR_OR_ZERO (drm_new_conn_state );
4585
4588
break ;
4586
4589
}
4587
4590
4588
- dm_conn_state = to_dm_connector_state (new_con_state );
4591
+ dm_new_conn_state = to_dm_connector_state (drm_new_conn_state );
4592
+ dm_old_conn_state = to_dm_connector_state (drm_old_conn_state );
4589
4593
4590
4594
new_stream = create_stream_for_sink (aconnector ,
4591
4595
& new_crtc_state -> mode ,
4592
- dm_conn_state );
4596
+ dm_new_conn_state );
4593
4597
4594
4598
/*
4595
4599
* we can have no stream on ACTION_SET if a display
@@ -4708,8 +4712,17 @@ static int dm_update_crtcs_state(struct dc *dc,
4708
4712
*/
4709
4713
BUG_ON (dm_new_crtc_state -> stream == NULL );
4710
4714
4711
- /* Color managment settings */
4712
- if (dm_new_crtc_state -> base .color_mgmt_changed ) {
4715
+ /* Scaling or underscan settings */
4716
+ if (is_scaling_state_different (dm_old_conn_state , dm_new_conn_state ))
4717
+ update_stream_scaling_settings (
4718
+ & new_crtc_state -> mode , dm_new_conn_state , dm_new_crtc_state -> stream );
4719
+
4720
+ /*
4721
+ * Color management settings. We also update color properties
4722
+ * when a modeset is needed, to ensure it gets reprogrammed.
4723
+ */
4724
+ if (dm_new_crtc_state -> base .color_mgmt_changed ||
4725
+ drm_atomic_crtc_needs_modeset (new_crtc_state )) {
4713
4726
ret = amdgpu_dm_set_regamma_lut (dm_new_crtc_state );
4714
4727
if (ret )
4715
4728
goto fail ;
0 commit comments