@@ -5552,7 +5552,6 @@ static void fill_stream_properties_from_drm_display_mode(
55525552 && stream -> signal == SIGNAL_TYPE_HDMI_TYPE_A )
55535553 timing_out -> pixel_encoding = PIXEL_ENCODING_YCBCR420 ;
55545554 else if (drm_mode_is_420_also (info , mode_in )
5555- && aconnector
55565555 && aconnector -> force_yuv420_output )
55575556 timing_out -> pixel_encoding = PIXEL_ENCODING_YCBCR420 ;
55585557 else if ((connector -> display_info .color_formats & DRM_COLOR_FORMAT_YCBCR444 )
@@ -5588,7 +5587,7 @@ static void fill_stream_properties_from_drm_display_mode(
55885587 timing_out -> hdmi_vic = hv_frame .vic ;
55895588 }
55905589
5591- if (aconnector && is_freesync_video_mode (mode_in , aconnector )) {
5590+ if (is_freesync_video_mode (mode_in , aconnector )) {
55925591 timing_out -> h_addressable = mode_in -> hdisplay ;
55935592 timing_out -> h_total = mode_in -> htotal ;
55945593 timing_out -> h_sync_width = mode_in -> hsync_end - mode_in -> hsync_start ;
@@ -6065,14 +6064,14 @@ static void apply_dsc_policy_for_stream(struct amdgpu_dm_connector *aconnector,
60656064}
60666065
60676066static struct dc_stream_state *
6068- create_stream_for_sink (struct drm_connector * connector ,
6067+ create_stream_for_sink (struct amdgpu_dm_connector * aconnector ,
60696068 const struct drm_display_mode * drm_mode ,
60706069 const struct dm_connector_state * dm_state ,
60716070 const struct dc_stream_state * old_stream ,
60726071 int requested_bpc )
60736072{
6074- struct amdgpu_dm_connector * aconnector = NULL ;
60756073 struct drm_display_mode * preferred_mode = NULL ;
6074+ struct drm_connector * drm_connector ;
60766075 const struct drm_connector_state * con_state = & dm_state -> base ;
60776076 struct dc_stream_state * stream = NULL ;
60786077 struct drm_display_mode mode ;
@@ -6091,22 +6090,20 @@ create_stream_for_sink(struct drm_connector *connector,
60916090 drm_mode_init (& mode , drm_mode );
60926091 memset (& saved_mode , 0 , sizeof (saved_mode ));
60936092
6094- if (connector == NULL ) {
6095- DRM_ERROR ("connector is NULL!\n" );
6093+ if (aconnector == NULL ) {
6094+ DRM_ERROR ("aconnector is NULL!\n" );
60966095 return stream ;
60976096 }
60986097
6099- if (connector -> connector_type != DRM_MODE_CONNECTOR_WRITEBACK ) {
6100- aconnector = NULL ;
6101- aconnector = to_amdgpu_dm_connector (connector );
6102- if (!aconnector -> dc_sink ) {
6103- sink = create_fake_sink (aconnector );
6104- if (!sink )
6105- return stream ;
6106- } else {
6107- sink = aconnector -> dc_sink ;
6108- dc_sink_retain (sink );
6109- }
6098+ drm_connector = & aconnector -> base ;
6099+
6100+ if (!aconnector -> dc_sink ) {
6101+ sink = create_fake_sink (aconnector );
6102+ if (!sink )
6103+ return stream ;
6104+ } else {
6105+ sink = aconnector -> dc_sink ;
6106+ dc_sink_retain (sink );
61106107 }
61116108
61126109 stream = dc_create_stream_for_sink (sink );
@@ -6116,13 +6113,12 @@ create_stream_for_sink(struct drm_connector *connector,
61166113 goto finish ;
61176114 }
61186115
6119- /* We leave this NULL for writeback connectors */
61206116 stream -> dm_stream_context = aconnector ;
61216117
61226118 stream -> timing .flags .LTE_340MCSC_SCRAMBLE =
6123- connector -> display_info .hdmi .scdc .scrambling .low_rates ;
6119+ drm_connector -> display_info .hdmi .scdc .scrambling .low_rates ;
61246120
6125- list_for_each_entry (preferred_mode , & connector -> modes , head ) {
6121+ list_for_each_entry (preferred_mode , & aconnector -> base . modes , head ) {
61266122 /* Search for preferred mode */
61276123 if (preferred_mode -> type & DRM_MODE_TYPE_PREFERRED ) {
61286124 native_mode_found = true;
@@ -6131,7 +6127,7 @@ create_stream_for_sink(struct drm_connector *connector,
61316127 }
61326128 if (!native_mode_found )
61336129 preferred_mode = list_first_entry_or_null (
6134- & connector -> modes ,
6130+ & aconnector -> base . modes ,
61356131 struct drm_display_mode ,
61366132 head );
61376133
@@ -6145,7 +6141,7 @@ create_stream_for_sink(struct drm_connector *connector,
61456141 * and the modelist may not be filled in time.
61466142 */
61476143 DRM_DEBUG_DRIVER ("No preferred mode found\n" );
6148- } else if ( aconnector ) {
6144+ } else {
61496145 recalculate_timing = is_freesync_video_mode (& mode , aconnector );
61506146 if (recalculate_timing ) {
61516147 freesync_mode = get_highest_refresh_rate_mode (aconnector , false);
@@ -6168,17 +6164,13 @@ create_stream_for_sink(struct drm_connector *connector,
61686164 */
61696165 if (!scale || mode_refresh != preferred_refresh )
61706166 fill_stream_properties_from_drm_display_mode (
6171- stream , & mode , connector , con_state , NULL ,
6167+ stream , & mode , & aconnector -> base , con_state , NULL ,
61726168 requested_bpc );
61736169 else
61746170 fill_stream_properties_from_drm_display_mode (
6175- stream , & mode , connector , con_state , old_stream ,
6171+ stream , & mode , & aconnector -> base , con_state , old_stream ,
61766172 requested_bpc );
61776173
6178- /* The rest isn't needed for writeback connectors */
6179- if (!aconnector )
6180- goto finish ;
6181-
61826174 if (aconnector -> timing_changed ) {
61836175 drm_dbg (aconnector -> base .dev ,
61846176 "overriding timing for automated test, bpc %d, changing to %d\n" ,
@@ -6196,7 +6188,7 @@ create_stream_for_sink(struct drm_connector *connector,
61966188
61976189 fill_audio_info (
61986190 & stream -> audio_info ,
6199- connector ,
6191+ drm_connector ,
62006192 sink );
62016193
62026194 update_stream_signal (stream , sink );
@@ -6659,7 +6651,7 @@ create_validate_stream_for_sink(struct amdgpu_dm_connector *aconnector,
66596651 enum dc_status dc_result = DC_OK ;
66606652
66616653 do {
6662- stream = create_stream_for_sink (connector , drm_mode ,
6654+ stream = create_stream_for_sink (aconnector , drm_mode ,
66636655 dm_state , old_stream ,
66646656 requested_bpc );
66656657 if (stream == NULL ) {
@@ -9412,16 +9404,15 @@ static int dm_update_crtc_state(struct amdgpu_display_manager *dm,
94129404 dm_new_crtc_state = to_dm_crtc_state (new_crtc_state );
94139405 acrtc = to_amdgpu_crtc (crtc );
94149406 connector = amdgpu_dm_find_first_crtc_matching_connector (state , crtc );
9415- if (connector && connector -> connector_type != DRM_MODE_CONNECTOR_WRITEBACK )
9416- aconnector = to_amdgpu_dm_connector (connector );
9407+ aconnector = to_amdgpu_dm_connector (connector );
94179408
94189409 /* TODO This hack should go away */
9419- if (connector && enable ) {
9410+ if (aconnector && enable ) {
94209411 /* Make sure fake sink is created in plug-in scenario */
94219412 drm_new_conn_state = drm_atomic_get_new_connector_state (state ,
9422- connector );
9413+ & aconnector -> base );
94239414 drm_old_conn_state = drm_atomic_get_old_connector_state (state ,
9424- connector );
9415+ & aconnector -> base );
94259416
94269417 if (IS_ERR (drm_new_conn_state )) {
94279418 ret = PTR_ERR_OR_ZERO (drm_new_conn_state );
@@ -9568,7 +9559,7 @@ static int dm_update_crtc_state(struct amdgpu_display_manager *dm,
95689559 * added MST connectors not found in existing crtc_state in the chained mode
95699560 * TODO: need to dig out the root cause of that
95709561 */
9571- if (!connector )
9562+ if (!aconnector )
95729563 goto skip_modeset ;
95739564
95749565 if (modereset_required (new_crtc_state ))
@@ -9611,7 +9602,7 @@ static int dm_update_crtc_state(struct amdgpu_display_manager *dm,
96119602 * We want to do dc stream updates that do not require a
96129603 * full modeset below.
96139604 */
9614- if (!(enable && connector && new_crtc_state -> active ))
9605+ if (!(enable && aconnector && new_crtc_state -> active ))
96159606 return 0 ;
96169607 /*
96179608 * Given above conditions, the dc state cannot be NULL because:
0 commit comments