Commit e4bd165f authored by Alex Hung's avatar Alex Hung Committed by Alex Deucher

Revert "drm/amd/display: Use drm_connector in create_stream_for_sink"

This reverts commit 5d918018.

[WHY & HOW]
The writeback series cause a regression in thunderbolt display.
Signed-off-by: default avatarAlex Hung <alex.hung@amd.com>
Reviewed-by: default avatarHarry Wentland <harry.wentland@amd.com>
Signed-off-by: default avatarAlex Deucher <alexander.deucher@amd.com>
parent 710d9cae
......@@ -5552,7 +5552,6 @@ static void fill_stream_properties_from_drm_display_mode(
&& stream->signal == SIGNAL_TYPE_HDMI_TYPE_A)
timing_out->pixel_encoding = PIXEL_ENCODING_YCBCR420;
else if (drm_mode_is_420_also(info, mode_in)
&& aconnector
&& aconnector->force_yuv420_output)
timing_out->pixel_encoding = PIXEL_ENCODING_YCBCR420;
else if ((connector->display_info.color_formats & DRM_COLOR_FORMAT_YCBCR444)
......@@ -5588,7 +5587,7 @@ static void fill_stream_properties_from_drm_display_mode(
timing_out->hdmi_vic = hv_frame.vic;
}
if (aconnector && is_freesync_video_mode(mode_in, aconnector)) {
if (is_freesync_video_mode(mode_in, aconnector)) {
timing_out->h_addressable = mode_in->hdisplay;
timing_out->h_total = mode_in->htotal;
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,
}
static struct dc_stream_state *
create_stream_for_sink(struct drm_connector *connector,
create_stream_for_sink(struct amdgpu_dm_connector *aconnector,
const struct drm_display_mode *drm_mode,
const struct dm_connector_state *dm_state,
const struct dc_stream_state *old_stream,
int requested_bpc)
{
struct amdgpu_dm_connector *aconnector = NULL;
struct drm_display_mode *preferred_mode = NULL;
struct drm_connector *drm_connector;
const struct drm_connector_state *con_state = &dm_state->base;
struct dc_stream_state *stream = NULL;
struct drm_display_mode mode;
......@@ -6091,22 +6090,20 @@ create_stream_for_sink(struct drm_connector *connector,
drm_mode_init(&mode, drm_mode);
memset(&saved_mode, 0, sizeof(saved_mode));
if (connector == NULL) {
DRM_ERROR("connector is NULL!\n");
if (aconnector == NULL) {
DRM_ERROR("aconnector is NULL!\n");
return stream;
}
if (connector->connector_type != DRM_MODE_CONNECTOR_WRITEBACK) {
aconnector = NULL;
aconnector = to_amdgpu_dm_connector(connector);
if (!aconnector->dc_sink) {
sink = create_fake_sink(aconnector);
if (!sink)
return stream;
} else {
sink = aconnector->dc_sink;
dc_sink_retain(sink);
}
drm_connector = &aconnector->base;
if (!aconnector->dc_sink) {
sink = create_fake_sink(aconnector);
if (!sink)
return stream;
} else {
sink = aconnector->dc_sink;
dc_sink_retain(sink);
}
stream = dc_create_stream_for_sink(sink);
......@@ -6116,13 +6113,12 @@ create_stream_for_sink(struct drm_connector *connector,
goto finish;
}
/* We leave this NULL for writeback connectors */
stream->dm_stream_context = aconnector;
stream->timing.flags.LTE_340MCSC_SCRAMBLE =
connector->display_info.hdmi.scdc.scrambling.low_rates;
drm_connector->display_info.hdmi.scdc.scrambling.low_rates;
list_for_each_entry(preferred_mode, &connector->modes, head) {
list_for_each_entry(preferred_mode, &aconnector->base.modes, head) {
/* Search for preferred mode */
if (preferred_mode->type & DRM_MODE_TYPE_PREFERRED) {
native_mode_found = true;
......@@ -6131,7 +6127,7 @@ create_stream_for_sink(struct drm_connector *connector,
}
if (!native_mode_found)
preferred_mode = list_first_entry_or_null(
&connector->modes,
&aconnector->base.modes,
struct drm_display_mode,
head);
......@@ -6145,7 +6141,7 @@ create_stream_for_sink(struct drm_connector *connector,
* and the modelist may not be filled in time.
*/
DRM_DEBUG_DRIVER("No preferred mode found\n");
} else if (aconnector) {
} else {
recalculate_timing = is_freesync_video_mode(&mode, aconnector);
if (recalculate_timing) {
freesync_mode = get_highest_refresh_rate_mode(aconnector, false);
......@@ -6168,17 +6164,13 @@ create_stream_for_sink(struct drm_connector *connector,
*/
if (!scale || mode_refresh != preferred_refresh)
fill_stream_properties_from_drm_display_mode(
stream, &mode, connector, con_state, NULL,
stream, &mode, &aconnector->base, con_state, NULL,
requested_bpc);
else
fill_stream_properties_from_drm_display_mode(
stream, &mode, connector, con_state, old_stream,
stream, &mode, &aconnector->base, con_state, old_stream,
requested_bpc);
/* The rest isn't needed for writeback connectors */
if (!aconnector)
goto finish;
if (aconnector->timing_changed) {
drm_dbg(aconnector->base.dev,
"overriding timing for automated test, bpc %d, changing to %d\n",
......@@ -6196,7 +6188,7 @@ create_stream_for_sink(struct drm_connector *connector,
fill_audio_info(
&stream->audio_info,
connector,
drm_connector,
sink);
update_stream_signal(stream, sink);
......@@ -6659,7 +6651,7 @@ create_validate_stream_for_sink(struct amdgpu_dm_connector *aconnector,
enum dc_status dc_result = DC_OK;
do {
stream = create_stream_for_sink(connector, drm_mode,
stream = create_stream_for_sink(aconnector, drm_mode,
dm_state, old_stream,
requested_bpc);
if (stream == NULL) {
......@@ -9412,16 +9404,15 @@ static int dm_update_crtc_state(struct amdgpu_display_manager *dm,
dm_new_crtc_state = to_dm_crtc_state(new_crtc_state);
acrtc = to_amdgpu_crtc(crtc);
connector = amdgpu_dm_find_first_crtc_matching_connector(state, crtc);
if (connector && connector->connector_type != DRM_MODE_CONNECTOR_WRITEBACK)
aconnector = to_amdgpu_dm_connector(connector);
aconnector = to_amdgpu_dm_connector(connector);
/* TODO This hack should go away */
if (connector && enable) {
if (aconnector && enable) {
/* Make sure fake sink is created in plug-in scenario */
drm_new_conn_state = drm_atomic_get_new_connector_state(state,
connector);
&aconnector->base);
drm_old_conn_state = drm_atomic_get_old_connector_state(state,
connector);
&aconnector->base);
if (IS_ERR(drm_new_conn_state)) {
ret = PTR_ERR_OR_ZERO(drm_new_conn_state);
......@@ -9568,7 +9559,7 @@ static int dm_update_crtc_state(struct amdgpu_display_manager *dm,
* added MST connectors not found in existing crtc_state in the chained mode
* TODO: need to dig out the root cause of that
*/
if (!connector)
if (!aconnector)
goto skip_modeset;
if (modereset_required(new_crtc_state))
......@@ -9611,7 +9602,7 @@ static int dm_update_crtc_state(struct amdgpu_display_manager *dm,
* We want to do dc stream updates that do not require a
* full modeset below.
*/
if (!(enable && connector && new_crtc_state->active))
if (!(enable && aconnector && new_crtc_state->active))
return 0;
/*
* Given above conditions, the dc state cannot be NULL because:
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment