@@ -8978,6 +8978,7 @@ void amdgpu_dm_connector_init_helper(struct amdgpu_display_manager *dm,
89788978 aconnector -> audio_inst = -1 ;
89798979 aconnector -> pack_sdp_v1_3 = false;
89808980 aconnector -> as_type = ADAPTIVE_SYNC_TYPE_NONE ;
8981+ aconnector -> hdmi_allm_capable = false;
89818982 memset (& aconnector -> vsdb_info , 0 , sizeof (aconnector -> vsdb_info ));
89828983 mutex_init (& aconnector -> hpd_lock );
89838984 mutex_init (& aconnector -> handle_mst_msg_ready );
@@ -9175,6 +9176,10 @@ int amdgpu_dm_initialize_hdmi_connector(struct amdgpu_dm_connector *aconnector)
91759176 struct drm_device * ddev = aconnector -> base .dev ;
91769177 struct device * hdmi_dev = ddev -> dev ;
91779178
9179+ /* ALLM */
9180+ drm_connector_attach_allm_capable_property (& aconnector -> base );
9181+ drm_connector_attach_allm_mode_property (& aconnector -> base );
9182+
91789183 if (amdgpu_dc_debug_mask & DC_DISABLE_HDMI_CEC ) {
91799184 drm_info (ddev , "HDMI-CEC feature masked\n" );
91809185 return - EINVAL ;
@@ -10865,6 +10870,31 @@ static int amdgpu_dm_atomic_setup_commit(struct drm_atomic_state *state)
1086510870 return 0 ;
1086610871}
1086710872
10873+ static void update_allm_state_on_crtc_stream (struct dm_crtc_state * new_crtc_state ,
10874+ const struct drm_connector_state * new_conn )
10875+ {
10876+ struct mod_freesync_config * config = & new_crtc_state -> freesync_config ;
10877+ struct dc_stream_state * new_stream = new_crtc_state -> stream ;
10878+ bool allm_active = false;
10879+
10880+ switch (new_conn -> allm_mode ) {
10881+ case DRM_ALLM_MODE_ENABLED_DYNAMIC :
10882+ allm_active = config -> state == VRR_STATE_ACTIVE_VARIABLE ||
10883+ new_stream -> content_type == DISPLAY_CONTENT_TYPE_GAME ;
10884+ break ;
10885+
10886+ case DRM_ALLM_MODE_ENABLED_FORCED :
10887+ allm_active = true;
10888+ break ;
10889+
10890+ case DRM_ALLM_MODE_DISABLED :
10891+ default :
10892+ allm_active = false;
10893+ }
10894+
10895+ new_stream -> hdmi_allm_active = allm_active ;
10896+ }
10897+
1086810898/**
1086910899 * amdgpu_dm_atomic_commit_tail() - AMDgpu DM's commit tail implementation.
1087010900 * @state: The atomic state to commit
@@ -10907,12 +10937,14 @@ static void amdgpu_dm_atomic_commit_tail(struct drm_atomic_state *state)
1090710937 for_each_oldnew_connector_in_state (state , connector , old_con_state , new_con_state , i ) {
1090810938 struct dm_connector_state * dm_new_con_state = to_dm_connector_state (new_con_state );
1090910939 struct dm_connector_state * dm_old_con_state = to_dm_connector_state (old_con_state );
10940+ struct amdgpu_dm_connector * dm_conn = to_amdgpu_dm_connector (connector );
1091010941 struct amdgpu_crtc * acrtc = to_amdgpu_crtc (dm_new_con_state -> base .crtc );
1091110942 struct dc_surface_update * dummy_updates ;
1091210943 struct dc_stream_update stream_update ;
1091310944 struct dc_info_packet hdr_packet ;
1091410945 struct dc_stream_status * status = NULL ;
1091510946 bool abm_changed , hdr_changed , scaling_changed , output_color_space_changed = false;
10947+ bool allm_changed = false;
1091610948
1091710949 memset (& stream_update , 0 , sizeof (stream_update ));
1091810950
@@ -10942,7 +10974,11 @@ static void amdgpu_dm_atomic_commit_tail(struct drm_atomic_state *state)
1094210974 hdr_changed =
1094310975 !drm_connector_atomic_hdr_metadata_equal (old_con_state , new_con_state );
1094410976
10945- if (!scaling_changed && !abm_changed && !hdr_changed && !output_color_space_changed )
10977+ allm_changed = dm_conn -> hdmi_allm_capable &&
10978+ (new_con_state -> allm_mode != old_con_state -> allm_mode );
10979+
10980+ if (!scaling_changed && !abm_changed && !hdr_changed &&
10981+ !output_color_space_changed && !allm_changed )
1094610982 continue ;
1094710983
1094810984 stream_update .stream = dm_new_crtc_state -> stream ;
@@ -10972,6 +11008,17 @@ static void amdgpu_dm_atomic_commit_tail(struct drm_atomic_state *state)
1097211008 stream_update .hdr_static_metadata = & hdr_packet ;
1097311009 }
1097411010
11011+ if (allm_changed ) {
11012+ update_allm_state_on_crtc_stream (dm_new_crtc_state , new_con_state );
11013+ mod_build_hf_vsif_infopacket (dm_new_crtc_state -> stream ,
11014+ & dm_new_crtc_state -> stream -> hfvsif_infopacket );
11015+
11016+ stream_update .hdmi_allm_active =
11017+ & dm_new_crtc_state -> stream -> hdmi_allm_active ;
11018+ stream_update .hfvsif_infopacket =
11019+ & dm_new_crtc_state -> stream -> hfvsif_infopacket ;
11020+ }
11021+
1097511022 status = dc_stream_get_status (dm_new_crtc_state -> stream );
1097611023
1097711024 if (WARN_ON (!status ))
@@ -13487,6 +13534,11 @@ void amdgpu_dm_update_freesync_caps(struct drm_connector *connector,
1348713534
1348813535 if (connector -> passive_vrr_capable_property )
1348913536 drm_connector_set_passive_vrr_capable_property (connector , freesync_on_desktop );
13537+
13538+ amdgpu_dm_connector -> hdmi_allm_capable = connector -> display_info .hdmi .allm ;
13539+ if (connector -> allm_capable_property )
13540+ drm_connector_set_allm_capable_property (
13541+ connector , connector -> display_info .hdmi .allm );
1349013542}
1349113543
1349213544void amdgpu_dm_trigger_timing_sync (struct drm_device * dev )
0 commit comments