Commit c4c182b5 authored by Harry Wentland's avatar Harry Wentland Committed by Alex Deucher

drm/amd/display: Use drm_connector in create_validate_stream_for_sink

[WHAT]
Again, we need to use this function for writeback connectors,
which are not of type amdgpu_dm_connector. Use the common base
drm_connector instead.
Reviewed-by: default avatarAlex Hung <alex.hung@amd.com>
Signed-off-by: default avatarHarry Wentland <harry.wentland@amd.com>
Signed-off-by: default avatarAlex Hung <alex.hung@amd.com>
Signed-off-by: default avatarAlex Deucher <alexander.deucher@amd.com>
parent b44fe932
...@@ -6692,18 +6692,21 @@ static enum dc_status dm_validate_stream_and_context(struct dc *dc, ...@@ -6692,18 +6692,21 @@ 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 amdgpu_dm_connector *aconnector, create_validate_stream_for_sink(struct drm_connector *connector,
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 drm_connector *connector = &aconnector->base; struct amdgpu_dm_connector *aconnector = NULL;
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,
...@@ -6714,10 +6717,14 @@ create_validate_stream_for_sink(struct amdgpu_dm_connector *aconnector, ...@@ -6714,10 +6717,14 @@ create_validate_stream_for_sink(struct amdgpu_dm_connector *aconnector,
} }
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) if (dc_result == DC_OK && connector->connector_type != DRM_MODE_CONNECTOR_WRITEBACK)
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 +6746,7 @@ create_validate_stream_for_sink(struct amdgpu_dm_connector *aconnector, ...@@ -6739,7 +6746,7 @@ create_validate_stream_for_sink(struct amdgpu_dm_connector *aconnector,
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(aconnector, drm_mode, stream = create_validate_stream_for_sink(connector, drm_mode,
dm_state, old_stream); dm_state, old_stream);
aconnector->force_yuv420_output = false; aconnector->force_yuv420_output = false;
} }
...@@ -6754,6 +6761,9 @@ enum drm_mode_status amdgpu_dm_connector_mode_valid(struct drm_connector *connec ...@@ -6754,6 +6761,9 @@ 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) ||
...@@ -6778,7 +6788,7 @@ enum drm_mode_status amdgpu_dm_connector_mode_valid(struct drm_connector *connec ...@@ -6778,7 +6788,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(aconnector, mode, stream = create_validate_stream_for_sink(connector, mode,
to_dm_connector_state(connector->state), to_dm_connector_state(connector->state),
NULL); NULL);
if (stream) { if (stream) {
...@@ -9480,7 +9490,7 @@ static int dm_update_crtc_state(struct amdgpu_display_manager *dm, ...@@ -9480,7 +9490,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(aconnector, new_stream = create_validate_stream_for_sink(connector,
&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);
......
...@@ -826,7 +826,7 @@ int amdgpu_dm_process_dmub_set_config_sync(struct dc_context *ctx, unsigned int ...@@ -826,7 +826,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 amdgpu_dm_connector *aconnector, create_validate_stream_for_sink(struct drm_connector *connector,
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,7 +1501,6 @@ int pre_validate_dsc(struct drm_atomic_state *state, ...@@ -1501,7 +1501,6 @@ 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;
...@@ -1509,15 +1508,14 @@ int pre_validate_dsc(struct drm_atomic_state *state, ...@@ -1509,15 +1508,14 @@ 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,
&aconnector->base); connector);
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(aconnector, create_validate_stream_for_sink(connector,
&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