Commit 60e034f2 authored by Alex Hung's avatar Alex Hung Committed by Alex Deucher

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

This reverts commit c4c182b5.

After this was commit PCON and USB4 issues were observed. A new fix will
be submitted instead.
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 625e5f38
...@@ -6685,21 +6685,18 @@ static enum dc_status dm_validate_stream_and_context(struct dc *dc, ...@@ -6685,21 +6685,18 @@ static enum dc_status dm_validate_stream_and_context(struct dc *dc,
} }
struct dc_stream_state * struct dc_stream_state *
create_validate_stream_for_sink(struct drm_connector *connector, create_validate_stream_for_sink(struct amdgpu_dm_connector *aconnector,
const struct drm_display_mode *drm_mode, const struct drm_display_mode *drm_mode,
const struct dm_connector_state *dm_state, const struct dm_connector_state *dm_state,
const struct dc_stream_state *old_stream) const struct dc_stream_state *old_stream)
{ {
struct amdgpu_dm_connector *aconnector = NULL; struct drm_connector *connector = &aconnector->base;
struct amdgpu_device *adev = drm_to_adev(connector->dev); struct amdgpu_device *adev = drm_to_adev(connector->dev);
struct dc_stream_state *stream; struct dc_stream_state *stream;
const struct drm_connector_state *drm_state = dm_state ? &dm_state->base : NULL; const struct drm_connector_state *drm_state = dm_state ? &dm_state->base : NULL;
int requested_bpc = drm_state ? drm_state->max_requested_bpc : 8; int requested_bpc = drm_state ? drm_state->max_requested_bpc : 8;
enum dc_status dc_result = DC_OK; enum dc_status dc_result = DC_OK;
if (connector->connector_type == DRM_MODE_CONNECTOR_WRITEBACK)
aconnector = to_amdgpu_dm_connector(connector);
do { do {
stream = create_stream_for_sink(connector, drm_mode, stream = create_stream_for_sink(connector, drm_mode,
dm_state, old_stream, dm_state, old_stream,
...@@ -6710,14 +6707,10 @@ create_validate_stream_for_sink(struct drm_connector *connector, ...@@ -6710,14 +6707,10 @@ create_validate_stream_for_sink(struct drm_connector *connector,
} }
dc_result = dc_validate_stream(adev->dm.dc, stream); dc_result = dc_validate_stream(adev->dm.dc, stream);
if (!aconnector) /* writeback connector */
return stream;
if (dc_result == DC_OK && stream->signal == SIGNAL_TYPE_DISPLAY_PORT_MST) if (dc_result == DC_OK && stream->signal == SIGNAL_TYPE_DISPLAY_PORT_MST)
dc_result = dm_dp_mst_is_port_support_mode(aconnector, stream); dc_result = dm_dp_mst_is_port_support_mode(aconnector, stream);
if (dc_result == DC_OK && connector->connector_type != DRM_MODE_CONNECTOR_WRITEBACK) if (dc_result == DC_OK)
dc_result = dm_validate_stream_and_context(adev->dm.dc, stream); dc_result = dm_validate_stream_and_context(adev->dm.dc, stream);
if (dc_result != DC_OK) { if (dc_result != DC_OK) {
...@@ -6739,7 +6732,7 @@ create_validate_stream_for_sink(struct drm_connector *connector, ...@@ -6739,7 +6732,7 @@ create_validate_stream_for_sink(struct drm_connector *connector,
DRM_DEBUG_KMS("Retry forcing YCbCr420 encoding\n"); DRM_DEBUG_KMS("Retry forcing YCbCr420 encoding\n");
aconnector->force_yuv420_output = true; aconnector->force_yuv420_output = true;
stream = create_validate_stream_for_sink(connector, drm_mode, stream = create_validate_stream_for_sink(aconnector, drm_mode,
dm_state, old_stream); dm_state, old_stream);
aconnector->force_yuv420_output = false; aconnector->force_yuv420_output = false;
} }
...@@ -6754,9 +6747,6 @@ enum drm_mode_status amdgpu_dm_connector_mode_valid(struct drm_connector *connec ...@@ -6754,9 +6747,6 @@ enum drm_mode_status amdgpu_dm_connector_mode_valid(struct drm_connector *connec
struct dc_sink *dc_sink; struct dc_sink *dc_sink;
/* TODO: Unhardcode stream count */ /* TODO: Unhardcode stream count */
struct dc_stream_state *stream; struct dc_stream_state *stream;
/* we always have an amdgpu_dm_connector here since we got
* here via the amdgpu_dm_connector_helper_funcs
*/
struct amdgpu_dm_connector *aconnector = to_amdgpu_dm_connector(connector); struct amdgpu_dm_connector *aconnector = to_amdgpu_dm_connector(connector);
if ((mode->flags & DRM_MODE_FLAG_INTERLACE) || if ((mode->flags & DRM_MODE_FLAG_INTERLACE) ||
...@@ -6781,7 +6771,7 @@ enum drm_mode_status amdgpu_dm_connector_mode_valid(struct drm_connector *connec ...@@ -6781,7 +6771,7 @@ enum drm_mode_status amdgpu_dm_connector_mode_valid(struct drm_connector *connec
drm_mode_set_crtcinfo(mode, 0); drm_mode_set_crtcinfo(mode, 0);
stream = create_validate_stream_for_sink(connector, mode, stream = create_validate_stream_for_sink(aconnector, mode,
to_dm_connector_state(connector->state), to_dm_connector_state(connector->state),
NULL); NULL);
if (stream) { if (stream) {
...@@ -9641,7 +9631,7 @@ static int dm_update_crtc_state(struct amdgpu_display_manager *dm, ...@@ -9641,7 +9631,7 @@ static int dm_update_crtc_state(struct amdgpu_display_manager *dm,
if (!drm_atomic_crtc_needs_modeset(new_crtc_state)) if (!drm_atomic_crtc_needs_modeset(new_crtc_state))
goto skip_modeset; goto skip_modeset;
new_stream = create_validate_stream_for_sink(connector, new_stream = create_validate_stream_for_sink(aconnector,
&new_crtc_state->mode, &new_crtc_state->mode,
dm_new_conn_state, dm_new_conn_state,
dm_old_crtc_state->stream); dm_old_crtc_state->stream);
......
...@@ -834,7 +834,7 @@ int amdgpu_dm_process_dmub_set_config_sync(struct dc_context *ctx, unsigned int ...@@ -834,7 +834,7 @@ int amdgpu_dm_process_dmub_set_config_sync(struct dc_context *ctx, unsigned int
struct set_config_cmd_payload *payload, enum set_config_status *operation_result); struct set_config_cmd_payload *payload, enum set_config_status *operation_result);
struct dc_stream_state * struct dc_stream_state *
create_validate_stream_for_sink(struct drm_connector *connector, create_validate_stream_for_sink(struct amdgpu_dm_connector *aconnector,
const struct drm_display_mode *drm_mode, const struct drm_display_mode *drm_mode,
const struct dm_connector_state *dm_state, const struct dm_connector_state *dm_state,
const struct dc_stream_state *old_stream); const struct dc_stream_state *old_stream);
......
...@@ -1501,6 +1501,7 @@ int pre_validate_dsc(struct drm_atomic_state *state, ...@@ -1501,6 +1501,7 @@ int pre_validate_dsc(struct drm_atomic_state *state,
if (ind >= 0) { if (ind >= 0) {
struct drm_connector *connector; struct drm_connector *connector;
struct amdgpu_dm_connector *aconnector;
struct drm_connector_state *drm_new_conn_state; struct drm_connector_state *drm_new_conn_state;
struct dm_connector_state *dm_new_conn_state; struct dm_connector_state *dm_new_conn_state;
struct dm_crtc_state *dm_old_crtc_state; struct dm_crtc_state *dm_old_crtc_state;
...@@ -1508,14 +1509,15 @@ int pre_validate_dsc(struct drm_atomic_state *state, ...@@ -1508,14 +1509,15 @@ int pre_validate_dsc(struct drm_atomic_state *state,
connector = connector =
amdgpu_dm_find_first_crtc_matching_connector(state, amdgpu_dm_find_first_crtc_matching_connector(state,
state->crtcs[ind].ptr); state->crtcs[ind].ptr);
aconnector = to_amdgpu_dm_connector(connector);
drm_new_conn_state = drm_new_conn_state =
drm_atomic_get_new_connector_state(state, drm_atomic_get_new_connector_state(state,
connector); &aconnector->base);
dm_new_conn_state = to_dm_connector_state(drm_new_conn_state); dm_new_conn_state = to_dm_connector_state(drm_new_conn_state);
dm_old_crtc_state = to_dm_crtc_state(state->crtcs[ind].old_state); dm_old_crtc_state = to_dm_crtc_state(state->crtcs[ind].old_state);
local_dc_state->streams[i] = local_dc_state->streams[i] =
create_validate_stream_for_sink(connector, create_validate_stream_for_sink(aconnector,
&state->crtcs[ind].new_state->mode, &state->crtcs[ind].new_state->mode,
dm_new_conn_state, dm_new_conn_state,
dm_old_crtc_state->stream); dm_old_crtc_state->stream);
......
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