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

drm/amd/display: Roll core_sink into dc_sink

Signed-off-by: default avatarHarry Wentland <harry.wentland@amd.com>
Reviewed-by: default avatarTony Cheng <Tony.Cheng@amd.com>
Acked-by: default avatarHarry Wentland <Harry.Wentland@amd.com>
Signed-off-by: default avatarAlex Deucher <alexander.deucher@amd.com>
parent 89899039
...@@ -562,9 +562,9 @@ struct amdgpu_connector { ...@@ -562,9 +562,9 @@ struct amdgpu_connector {
int num_modes; int num_modes;
/* The 'old' sink - before an HPD. /* The 'old' sink - before an HPD.
* The 'current' sink is in dc_link->sink. */ * The 'current' sink is in dc_link->sink. */
const struct dc_sink *dc_sink; struct dc_sink *dc_sink;
struct dc_link *dc_link; struct dc_link *dc_link;
const struct dc_sink *dc_em_sink; struct dc_sink *dc_em_sink;
const struct dc_stream *stream; const struct dc_stream *stream;
void *con_priv; void *con_priv;
bool dac_load_detect; bool dac_load_detect;
......
...@@ -697,7 +697,7 @@ void amdgpu_dm_update_connector_after_detect( ...@@ -697,7 +697,7 @@ void amdgpu_dm_update_connector_after_detect(
{ {
struct drm_connector *connector = &aconnector->base; struct drm_connector *connector = &aconnector->base;
struct drm_device *dev = connector->dev; struct drm_device *dev = connector->dev;
const struct dc_sink *sink; struct dc_sink *sink;
/* MST handled by drm_mst framework */ /* MST handled by drm_mst framework */
if (aconnector->mst_mgr.mst_state == true) if (aconnector->mst_mgr.mst_state == true)
......
...@@ -1266,7 +1266,7 @@ int amdgpu_dm_connector_mode_valid( ...@@ -1266,7 +1266,7 @@ int amdgpu_dm_connector_mode_valid(
struct drm_display_mode *mode) struct drm_display_mode *mode)
{ {
int result = MODE_ERROR; int result = MODE_ERROR;
const struct dc_sink *dc_sink; struct dc_sink *dc_sink;
struct amdgpu_device *adev = connector->dev->dev_private; struct amdgpu_device *adev = connector->dev->dev_private;
struct dc_validation_set val_set = { 0 }; struct dc_validation_set val_set = { 0 };
/* TODO: Unhardcode stream count */ /* TODO: Unhardcode stream count */
...@@ -1535,7 +1535,7 @@ int dm_create_validation_set_for_connector(struct drm_connector *connector, ...@@ -1535,7 +1535,7 @@ int dm_create_validation_set_for_connector(struct drm_connector *connector,
struct drm_display_mode *mode, struct dc_validation_set *val_set) struct drm_display_mode *mode, struct dc_validation_set *val_set)
{ {
int result = MODE_ERROR; int result = MODE_ERROR;
const struct dc_sink *dc_sink = struct dc_sink *dc_sink =
to_amdgpu_connector(connector)->dc_sink; to_amdgpu_connector(connector)->dc_sink;
/* TODO: Unhardcode stream count */ /* TODO: Unhardcode stream count */
struct dc_stream *stream; struct dc_stream *stream;
......
...@@ -939,7 +939,7 @@ static bool dc_commit_context_no_check(struct dc *dc, struct validate_context *c ...@@ -939,7 +939,7 @@ static bool dc_commit_context_no_check(struct dc *dc, struct validate_context *c
program_timing_sync(core_dc, context); program_timing_sync(core_dc, context);
for (i = 0; i < context->stream_count; i++) { for (i = 0; i < context->stream_count; i++) {
const struct core_sink *sink = context->streams[i]->sink; const struct dc_sink *sink = context->streams[i]->sink;
for (j = 0; j < context->stream_status[i].surface_count; j++) { for (j = 0; j < context->stream_status[i].surface_count; j++) {
const struct dc_surface *surface = const struct dc_surface *surface =
...@@ -1984,7 +1984,7 @@ void dc_link_set_sink(struct dc_link *link, struct dc_sink *sink) ...@@ -1984,7 +1984,7 @@ void dc_link_set_sink(struct dc_link *link, struct dc_sink *sink)
} }
} }
void dc_link_remove_remote_sink(struct dc_link *link, const struct dc_sink *sink) void dc_link_remove_remote_sink(struct dc_link *link, struct dc_sink *sink)
{ {
int i; int i;
......
...@@ -541,8 +541,7 @@ bool dc_link_detect(struct dc_link *link, bool boot) ...@@ -541,8 +541,7 @@ bool dc_link_detect(struct dc_link *link, bool boot)
struct audio_support *aud_support = &link->dc->res_pool->audio_support; struct audio_support *aud_support = &link->dc->res_pool->audio_support;
enum dc_edid_status edid_status; enum dc_edid_status edid_status;
struct dc_context *dc_ctx = link->ctx; struct dc_context *dc_ctx = link->ctx;
struct dc_sink *dc_sink; struct dc_sink *sink;
struct core_sink *sink = NULL;
enum dc_connection_type new_connection_type = dc_connection_none; enum dc_connection_type new_connection_type = dc_connection_none;
if (link->connector_signal == SIGNAL_TYPE_VIRTUAL) if (link->connector_signal == SIGNAL_TYPE_VIRTUAL)
...@@ -637,22 +636,21 @@ bool dc_link_detect(struct dc_link *link, bool boot) ...@@ -637,22 +636,21 @@ bool dc_link_detect(struct dc_link *link, bool boot)
sink_init_data.link = link; sink_init_data.link = link;
sink_init_data.sink_signal = sink_caps.signal; sink_init_data.sink_signal = sink_caps.signal;
dc_sink = dc_sink_create(&sink_init_data); sink = dc_sink_create(&sink_init_data);
if (!dc_sink) { if (!sink) {
DC_ERROR("Failed to create sink!\n"); DC_ERROR("Failed to create sink!\n");
return false; return false;
} }
dc_sink->dongle_max_pix_clk = sink_caps.max_hdmi_pixel_clock; sink->dongle_max_pix_clk = sink_caps.max_hdmi_pixel_clock;
dc_sink->converter_disable_audio = converter_disable_audio; sink->converter_disable_audio = converter_disable_audio;
sink = DC_SINK_TO_CORE(dc_sink); link->local_sink = sink;
link->local_sink = &sink->public;
edid_status = dm_helpers_read_local_edid( edid_status = dm_helpers_read_local_edid(
link->ctx, link->ctx,
link, link,
&sink->public); sink);
switch (edid_status) { switch (edid_status) {
case EDID_BAD_CHECKSUM: case EDID_BAD_CHECKSUM:
...@@ -669,16 +667,16 @@ bool dc_link_detect(struct dc_link *link, bool boot) ...@@ -669,16 +667,16 @@ bool dc_link_detect(struct dc_link *link, bool boot)
} }
/* HDMI-DVI Dongle */ /* HDMI-DVI Dongle */
if (dc_sink->sink_signal == SIGNAL_TYPE_HDMI_TYPE_A && if (sink->sink_signal == SIGNAL_TYPE_HDMI_TYPE_A &&
!dc_sink->edid_caps.edid_hdmi) !sink->edid_caps.edid_hdmi)
dc_sink->sink_signal = SIGNAL_TYPE_DVI_SINGLE_LINK; sink->sink_signal = SIGNAL_TYPE_DVI_SINGLE_LINK;
/* Connectivity log: detection */ /* Connectivity log: detection */
for (i = 0; i < sink->public.dc_edid.length / EDID_BLOCK_SIZE; i++) { for (i = 0; i < sink->dc_edid.length / EDID_BLOCK_SIZE; i++) {
CONN_DATA_DETECT(link, CONN_DATA_DETECT(link,
&sink->public.dc_edid.raw_edid[i * EDID_BLOCK_SIZE], &sink->dc_edid.raw_edid[i * EDID_BLOCK_SIZE],
EDID_BLOCK_SIZE, EDID_BLOCK_SIZE,
"%s: [Block %d] ", sink->public.edid_caps.display_name, i); "%s: [Block %d] ", sink->edid_caps.display_name, i);
} }
dm_logger_write(link->ctx->logger, LOG_DETECTION_EDID_PARSER, dm_logger_write(link->ctx->logger, LOG_DETECTION_EDID_PARSER,
...@@ -692,16 +690,16 @@ bool dc_link_detect(struct dc_link *link, bool boot) ...@@ -692,16 +690,16 @@ bool dc_link_detect(struct dc_link *link, bool boot)
"speaker_flag = %d, " "speaker_flag = %d, "
"audio_mode_count = %d\n", "audio_mode_count = %d\n",
__func__, __func__,
sink->public.edid_caps.manufacturer_id, sink->edid_caps.manufacturer_id,
sink->public.edid_caps.product_id, sink->edid_caps.product_id,
sink->public.edid_caps.serial_number, sink->edid_caps.serial_number,
sink->public.edid_caps.manufacture_week, sink->edid_caps.manufacture_week,
sink->public.edid_caps.manufacture_year, sink->edid_caps.manufacture_year,
sink->public.edid_caps.display_name, sink->edid_caps.display_name,
sink->public.edid_caps.speaker_flags, sink->edid_caps.speaker_flags,
sink->public.edid_caps.audio_mode_count); sink->edid_caps.audio_mode_count);
for (i = 0; i < sink->public.edid_caps.audio_mode_count; i++) { for (i = 0; i < sink->edid_caps.audio_mode_count; i++) {
dm_logger_write(link->ctx->logger, LOG_DETECTION_EDID_PARSER, dm_logger_write(link->ctx->logger, LOG_DETECTION_EDID_PARSER,
"%s: mode number = %d, " "%s: mode number = %d, "
"format_code = %d, " "format_code = %d, "
...@@ -710,10 +708,10 @@ bool dc_link_detect(struct dc_link *link, bool boot) ...@@ -710,10 +708,10 @@ bool dc_link_detect(struct dc_link *link, bool boot)
"sample_size = %d\n", "sample_size = %d\n",
__func__, __func__,
i, i,
sink->public.edid_caps.audio_modes[i].format_code, sink->edid_caps.audio_modes[i].format_code,
sink->public.edid_caps.audio_modes[i].channel_count, sink->edid_caps.audio_modes[i].channel_count,
sink->public.edid_caps.audio_modes[i].sample_rate, sink->edid_caps.audio_modes[i].sample_rate,
sink->public.edid_caps.audio_modes[i].sample_size); sink->edid_caps.audio_modes[i].sample_size);
} }
} else { } else {
...@@ -732,7 +730,7 @@ bool dc_link_detect(struct dc_link *link, bool boot) ...@@ -732,7 +730,7 @@ bool dc_link_detect(struct dc_link *link, bool boot)
} }
LINK_INFO("link=%d, dc_sink_in=%p is now %s\n", LINK_INFO("link=%d, dc_sink_in=%p is now %s\n",
link->link_index, &sink->public, link->link_index, sink,
(sink_caps.signal == SIGNAL_TYPE_NONE ? (sink_caps.signal == SIGNAL_TYPE_NONE ?
"Disconnected":"Connected")); "Disconnected":"Connected"));
...@@ -1347,7 +1345,7 @@ enum dc_status dc_link_validate_mode_timing( ...@@ -1347,7 +1345,7 @@ enum dc_status dc_link_validate_mode_timing(
struct dc_link *link, struct dc_link *link,
const struct dc_crtc_timing *timing) const struct dc_crtc_timing *timing)
{ {
uint32_t max_pix_clk = stream->sink->public.dongle_max_pix_clk; uint32_t max_pix_clk = stream->sink->dongle_max_pix_clk;
/* A hack to avoid failing any modes for EDID override feature on /* A hack to avoid failing any modes for EDID override feature on
* topology change such as lower quality cable for DP or different dongle * topology change such as lower quality cable for DP or different dongle
......
...@@ -1528,7 +1528,7 @@ enum dc_status resource_map_pool_resources( ...@@ -1528,7 +1528,7 @@ enum dc_status resource_map_pool_resources(
pipe_ctx->stream_enc); pipe_ctx->stream_enc);
/* TODO: Add check if ASIC support and EDID audio */ /* TODO: Add check if ASIC support and EDID audio */
if (!stream->sink->public.converter_disable_audio && if (!stream->sink->converter_disable_audio &&
dc_is_audio_capable_signal(pipe_ctx->stream->signal) && dc_is_audio_capable_signal(pipe_ctx->stream->signal) &&
stream->public.audio_info.mode_count) { stream->public.audio_info.mode_count) {
pipe_ctx->audio = find_first_free_audio( pipe_ctx->audio = find_first_free_audio(
......
...@@ -31,15 +31,15 @@ ...@@ -31,15 +31,15 @@
* Private functions * Private functions
******************************************************************************/ ******************************************************************************/
static void destruct(struct core_sink *sink) static void destruct(struct dc_sink *sink)
{ {
if (sink->public.dc_container_id) { if (sink->dc_container_id) {
dm_free(sink->public.dc_container_id); dm_free(sink->dc_container_id);
sink->public.dc_container_id = NULL; sink->dc_container_id = NULL;
} }
} }
static bool construct(struct core_sink *sink, const struct dc_sink_init_data *init_params) static bool construct(struct dc_sink *sink, const struct dc_sink_init_data *init_params)
{ {
struct dc_link *link = init_params->link; struct dc_link *link = init_params->link;
...@@ -47,12 +47,12 @@ static bool construct(struct core_sink *sink, const struct dc_sink_init_data *in ...@@ -47,12 +47,12 @@ static bool construct(struct core_sink *sink, const struct dc_sink_init_data *in
if (!link) if (!link)
return false; return false;
sink->public.sink_signal = init_params->sink_signal; sink->sink_signal = init_params->sink_signal;
sink->link = link; sink->link = link;
sink->ctx = link->ctx; sink->ctx = link->ctx;
sink->public.dongle_max_pix_clk = init_params->dongle_max_pix_clk; sink->dongle_max_pix_clk = init_params->dongle_max_pix_clk;
sink->public.converter_disable_audio = init_params->converter_disable_audio; sink->converter_disable_audio = init_params->converter_disable_audio;
sink->public.dc_container_id = NULL; sink->dc_container_id = NULL;
return true; return true;
} }
...@@ -61,18 +61,14 @@ static bool construct(struct core_sink *sink, const struct dc_sink_init_data *in ...@@ -61,18 +61,14 @@ static bool construct(struct core_sink *sink, const struct dc_sink_init_data *in
* Public functions * Public functions
******************************************************************************/ ******************************************************************************/
void dc_sink_retain(const struct dc_sink *dc_sink) void dc_sink_retain(struct dc_sink *sink)
{ {
struct core_sink *sink = DC_SINK_TO_CORE(dc_sink);
ASSERT(sink->ref_count > 0); ASSERT(sink->ref_count > 0);
++sink->ref_count; ++sink->ref_count;
} }
void dc_sink_release(const struct dc_sink *dc_sink) void dc_sink_release(struct dc_sink *sink)
{ {
struct core_sink *sink = DC_SINK_TO_CORE(dc_sink);
ASSERT(sink->ref_count > 0); ASSERT(sink->ref_count > 0);
--sink->ref_count; --sink->ref_count;
...@@ -84,7 +80,7 @@ void dc_sink_release(const struct dc_sink *dc_sink) ...@@ -84,7 +80,7 @@ void dc_sink_release(const struct dc_sink *dc_sink)
struct dc_sink *dc_sink_create(const struct dc_sink_init_data *init_params) struct dc_sink *dc_sink_create(const struct dc_sink_init_data *init_params)
{ {
struct core_sink *sink = dm_alloc(sizeof(*sink)); struct dc_sink *sink = dm_alloc(sizeof(*sink));
if (NULL == sink) if (NULL == sink)
goto alloc_fail; goto alloc_fail;
...@@ -94,7 +90,7 @@ struct dc_sink *dc_sink_create(const struct dc_sink_init_data *init_params) ...@@ -94,7 +90,7 @@ struct dc_sink *dc_sink_create(const struct dc_sink_init_data *init_params)
++sink->ref_count; ++sink->ref_count;
return &sink->public; return sink;
construct_fail: construct_fail:
dm_free(sink); dm_free(sink);
......
...@@ -46,11 +46,11 @@ struct stream { ...@@ -46,11 +46,11 @@ struct stream {
******************************************************************************/ ******************************************************************************/
static bool construct(struct core_stream *stream, static bool construct(struct core_stream *stream,
const struct dc_sink *dc_sink_data) struct dc_sink *dc_sink_data)
{ {
uint32_t i = 0; uint32_t i = 0;
stream->sink = DC_SINK_TO_CORE(dc_sink_data); stream->sink = dc_sink_data;
stream->ctx = stream->sink->ctx; stream->ctx = stream->sink->ctx;
stream->public.sink = dc_sink_data; stream->public.sink = dc_sink_data;
...@@ -97,7 +97,7 @@ static bool construct(struct core_stream *stream, ...@@ -97,7 +97,7 @@ static bool construct(struct core_stream *stream,
static void destruct(struct core_stream *stream) static void destruct(struct core_stream *stream)
{ {
dc_sink_release(&stream->sink->public); dc_sink_release(stream->sink);
if (stream->public.out_transfer_func != NULL) { if (stream->public.out_transfer_func != NULL) {
dc_transfer_func_release( dc_transfer_func_release(
stream->public.out_transfer_func); stream->public.out_transfer_func);
...@@ -130,9 +130,8 @@ void dc_stream_release(const struct dc_stream *public) ...@@ -130,9 +130,8 @@ void dc_stream_release(const struct dc_stream *public)
} }
struct dc_stream *dc_create_stream_for_sink( struct dc_stream *dc_create_stream_for_sink(
const struct dc_sink *dc_sink) struct dc_sink *sink)
{ {
struct core_sink *sink = DC_SINK_TO_CORE(dc_sink);
struct stream *stream; struct stream *stream;
if (sink == NULL) if (sink == NULL)
...@@ -143,7 +142,7 @@ struct dc_stream *dc_create_stream_for_sink( ...@@ -143,7 +142,7 @@ struct dc_stream *dc_create_stream_for_sink(
if (NULL == stream) if (NULL == stream)
goto alloc_fail; goto alloc_fail;
if (false == construct(&stream->protected, dc_sink)) if (false == construct(&stream->protected, sink))
goto construct_fail; goto construct_fail;
stream->ref_count++; stream->ref_count++;
...@@ -350,8 +349,8 @@ void dc_stream_log( ...@@ -350,8 +349,8 @@ void dc_stream_log(
dm_logger_write(dm_logger, dm_logger_write(dm_logger,
log_type, log_type,
"\tsink name: %s, serial: %d\n", "\tsink name: %s, serial: %d\n",
core_stream->sink->public.edid_caps.display_name, core_stream->sink->edid_caps.display_name,
core_stream->sink->public.edid_caps.serial_number); core_stream->sink->edid_caps.serial_number);
dm_logger_write(dm_logger, dm_logger_write(dm_logger,
log_type, log_type,
"\tlink: %d\n", "\tlink: %d\n",
......
...@@ -629,7 +629,7 @@ bool dc_enable_stereo( ...@@ -629,7 +629,7 @@ bool dc_enable_stereo(
/** /**
* Create a new default stream for the requested sink * Create a new default stream for the requested sink
*/ */
struct dc_stream *dc_create_stream_for_sink(const struct dc_sink *dc_sink); struct dc_stream *dc_create_stream_for_sink(struct dc_sink *dc_sink);
void dc_stream_retain(const struct dc_stream *dc_stream); void dc_stream_retain(const struct dc_stream *dc_stream);
void dc_stream_release(const struct dc_stream *dc_stream); void dc_stream_release(const struct dc_stream *dc_stream);
...@@ -712,9 +712,9 @@ struct link_mst_stream_allocation_table { ...@@ -712,9 +712,9 @@ struct link_mst_stream_allocation_table {
* The currently active signal type (HDMI, DP-SST, DP-MST) is also reported. * The currently active signal type (HDMI, DP-SST, DP-MST) is also reported.
*/ */
struct dc_link { struct dc_link {
const struct dc_sink *remote_sinks[MAX_SINKS_PER_LINK]; struct dc_sink *remote_sinks[MAX_SINKS_PER_LINK];
unsigned int sink_count; unsigned int sink_count;
const struct dc_sink *local_sink; struct dc_sink *local_sink;
unsigned int link_index; unsigned int link_index;
enum dc_connection_type type; enum dc_connection_type type;
enum signal_type connector_signal; enum signal_type connector_signal;
...@@ -825,7 +825,7 @@ struct dc_sink *dc_link_add_remote_sink( ...@@ -825,7 +825,7 @@ struct dc_sink *dc_link_add_remote_sink(
void dc_link_remove_remote_sink( void dc_link_remove_remote_sink(
struct dc_link *link, struct dc_link *link,
const struct dc_sink *sink); struct dc_sink *sink);
/* Used by diagnostics for virtual link at the moment */ /* Used by diagnostics for virtual link at the moment */
void dc_link_set_sink(struct dc_link *link, struct dc_sink *sink); void dc_link_set_sink(struct dc_link *link, struct dc_sink *sink);
...@@ -879,10 +879,17 @@ struct dc_sink { ...@@ -879,10 +879,17 @@ struct dc_sink {
void *priv; void *priv;
struct stereo_3d_features features_3d[TIMING_3D_FORMAT_MAX]; struct stereo_3d_features features_3d[TIMING_3D_FORMAT_MAX];
bool converter_disable_audio; bool converter_disable_audio;
/* private to DC core */
struct dc_link *link;
struct dc_context *ctx;
/* private to dc_sink.c */
int ref_count;
}; };
void dc_sink_retain(const struct dc_sink *sink); void dc_sink_retain(struct dc_sink *sink);
void dc_sink_release(const struct dc_sink *sink); void dc_sink_release(struct dc_sink *sink);
const struct audio **dc_get_audios(struct dc *dc); const struct audio **dc_get_audios(struct dc *dc);
......
...@@ -657,7 +657,7 @@ static enum dc_status bios_parser_crtc_source_select( ...@@ -657,7 +657,7 @@ static enum dc_status bios_parser_crtc_source_select(
* encoder block * encoder block
* note: video bios clears all FMT setting here. */ * note: video bios clears all FMT setting here. */
struct bp_crtc_source_select crtc_source_select = {0}; struct bp_crtc_source_select crtc_source_select = {0};
const struct core_sink *sink = pipe_ctx->stream->sink; const struct dc_sink *sink = pipe_ctx->stream->sink;
crtc_source_select.engine_id = pipe_ctx->stream_enc->id; crtc_source_select.engine_id = pipe_ctx->stream_enc->id;
crtc_source_select.controller_id = pipe_ctx->pipe_idx + 1; crtc_source_select.controller_id = pipe_ctx->pipe_idx + 1;
......
...@@ -68,7 +68,7 @@ struct core_stream { ...@@ -68,7 +68,7 @@ struct core_stream {
/* field internal to DC */ /* field internal to DC */
struct dc_context *ctx; struct dc_context *ctx;
const struct core_sink *sink; struct dc_sink *sink;
/* used by DCP and FMT */ /* used by DCP and FMT */
struct bit_depth_reduction_params bit_depth_params; struct bit_depth_reduction_params bit_depth_params;
...@@ -80,25 +80,6 @@ struct core_stream { ...@@ -80,25 +80,6 @@ struct core_stream {
struct dc_stream_status status; struct dc_stream_status status;
}; };
/************ core_sink *****************/
#define DC_SINK_TO_CORE(dc_sink) \
container_of(dc_sink, struct core_sink, public)
struct core_sink {
/** The public, read-only (for DM) area of sink. **/
struct dc_sink public;
/** End-of-public area. **/
/** The 'protected' area - read/write access, for use only inside DC **/
/* not used for now */
struct dc_link *link;
struct dc_context *ctx;
/* private to dc_sink.c */
int ref_count;
};
/************ link *****************/ /************ link *****************/
struct link_init_data { struct link_init_data {
const struct core_dc *dc; const struct core_dc *dc;
......
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