int num_modes;
/* The 'old' sink - before an HPD.
* The 'current' sink is in dc_link->sink. */
- const struct dc_sink *dc_sink;
+ struct dc_sink *dc_sink;
struct dc_link *dc_link;
- const struct dc_sink *dc_em_sink;
+ struct dc_sink *dc_em_sink;
const struct dc_stream *stream;
void *con_priv;
bool dac_load_detect;
{
struct drm_connector *connector = &aconnector->base;
struct drm_device *dev = connector->dev;
- const struct dc_sink *sink;
+ struct dc_sink *sink;
/* MST handled by drm_mst framework */
if (aconnector->mst_mgr.mst_state == true)
struct drm_display_mode *mode)
{
int result = MODE_ERROR;
- const struct dc_sink *dc_sink;
+ struct dc_sink *dc_sink;
struct amdgpu_device *adev = connector->dev->dev_private;
struct dc_validation_set val_set = { 0 };
/* TODO: Unhardcode stream count */
struct drm_display_mode *mode, struct dc_validation_set *val_set)
{
int result = MODE_ERROR;
- const struct dc_sink *dc_sink =
+ struct dc_sink *dc_sink =
to_amdgpu_connector(connector)->dc_sink;
/* TODO: Unhardcode stream count */
struct dc_stream *stream;
program_timing_sync(core_dc, context);
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++) {
const struct dc_surface *surface =
}
}
-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;
struct audio_support *aud_support = &link->dc->res_pool->audio_support;
enum dc_edid_status edid_status;
struct dc_context *dc_ctx = link->ctx;
- struct dc_sink *dc_sink;
- struct core_sink *sink = NULL;
+ struct dc_sink *sink;
enum dc_connection_type new_connection_type = dc_connection_none;
if (link->connector_signal == SIGNAL_TYPE_VIRTUAL)
sink_init_data.link = link;
sink_init_data.sink_signal = sink_caps.signal;
- dc_sink = dc_sink_create(&sink_init_data);
- if (!dc_sink) {
+ sink = dc_sink_create(&sink_init_data);
+ if (!sink) {
DC_ERROR("Failed to create sink!\n");
return false;
}
- dc_sink->dongle_max_pix_clk = sink_caps.max_hdmi_pixel_clock;
- dc_sink->converter_disable_audio = converter_disable_audio;
+ sink->dongle_max_pix_clk = sink_caps.max_hdmi_pixel_clock;
+ sink->converter_disable_audio = converter_disable_audio;
- sink = DC_SINK_TO_CORE(dc_sink);
- link->local_sink = &sink->public;
+ link->local_sink = sink;
edid_status = dm_helpers_read_local_edid(
link->ctx,
link,
- &sink->public);
+ sink);
switch (edid_status) {
case EDID_BAD_CHECKSUM:
}
/* HDMI-DVI Dongle */
- if (dc_sink->sink_signal == SIGNAL_TYPE_HDMI_TYPE_A &&
- !dc_sink->edid_caps.edid_hdmi)
- dc_sink->sink_signal = SIGNAL_TYPE_DVI_SINGLE_LINK;
+ if (sink->sink_signal == SIGNAL_TYPE_HDMI_TYPE_A &&
+ !sink->edid_caps.edid_hdmi)
+ sink->sink_signal = SIGNAL_TYPE_DVI_SINGLE_LINK;
/* 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,
- &sink->public.dc_edid.raw_edid[i * EDID_BLOCK_SIZE],
+ &sink->dc_edid.raw_edid[i * 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,
"speaker_flag = %d, "
"audio_mode_count = %d\n",
__func__,
- sink->public.edid_caps.manufacturer_id,
- sink->public.edid_caps.product_id,
- sink->public.edid_caps.serial_number,
- sink->public.edid_caps.manufacture_week,
- sink->public.edid_caps.manufacture_year,
- sink->public.edid_caps.display_name,
- sink->public.edid_caps.speaker_flags,
- sink->public.edid_caps.audio_mode_count);
-
- for (i = 0; i < sink->public.edid_caps.audio_mode_count; i++) {
+ sink->edid_caps.manufacturer_id,
+ sink->edid_caps.product_id,
+ sink->edid_caps.serial_number,
+ sink->edid_caps.manufacture_week,
+ sink->edid_caps.manufacture_year,
+ sink->edid_caps.display_name,
+ sink->edid_caps.speaker_flags,
+ sink->edid_caps.audio_mode_count);
+
+ for (i = 0; i < sink->edid_caps.audio_mode_count; i++) {
dm_logger_write(link->ctx->logger, LOG_DETECTION_EDID_PARSER,
"%s: mode number = %d, "
"format_code = %d, "
"sample_size = %d\n",
__func__,
i,
- sink->public.edid_caps.audio_modes[i].format_code,
- sink->public.edid_caps.audio_modes[i].channel_count,
- sink->public.edid_caps.audio_modes[i].sample_rate,
- sink->public.edid_caps.audio_modes[i].sample_size);
+ sink->edid_caps.audio_modes[i].format_code,
+ sink->edid_caps.audio_modes[i].channel_count,
+ sink->edid_caps.audio_modes[i].sample_rate,
+ sink->edid_caps.audio_modes[i].sample_size);
}
} else {
}
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 ?
"Disconnected":"Connected"));
struct dc_link *link,
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
* topology change such as lower quality cable for DP or different dongle
pipe_ctx->stream_enc);
/* 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) &&
stream->public.audio_info.mode_count) {
pipe_ctx->audio = find_first_free_audio(
* Private functions
******************************************************************************/
-static void destruct(struct core_sink *sink)
+static void destruct(struct dc_sink *sink)
{
- if (sink->public.dc_container_id) {
- dm_free(sink->public.dc_container_id);
- sink->public.dc_container_id = NULL;
+ if (sink->dc_container_id) {
+ dm_free(sink->dc_container_id);
+ 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;
if (!link)
return false;
- sink->public.sink_signal = init_params->sink_signal;
+ sink->sink_signal = init_params->sink_signal;
sink->link = link;
sink->ctx = link->ctx;
- sink->public.dongle_max_pix_clk = init_params->dongle_max_pix_clk;
- sink->public.converter_disable_audio = init_params->converter_disable_audio;
- sink->public.dc_container_id = NULL;
+ sink->dongle_max_pix_clk = init_params->dongle_max_pix_clk;
+ sink->converter_disable_audio = init_params->converter_disable_audio;
+ sink->dc_container_id = NULL;
return true;
}
* 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);
++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);
--sink->ref_count;
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)
goto alloc_fail;
++sink->ref_count;
- return &sink->public;
+ return sink;
construct_fail:
dm_free(sink);
******************************************************************************/
static bool construct(struct core_stream *stream,
- const struct dc_sink *dc_sink_data)
+ struct dc_sink *dc_sink_data)
{
uint32_t i = 0;
- stream->sink = DC_SINK_TO_CORE(dc_sink_data);
+ stream->sink = dc_sink_data;
stream->ctx = stream->sink->ctx;
stream->public.sink = dc_sink_data;
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) {
dc_transfer_func_release(
stream->public.out_transfer_func);
}
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;
if (sink == NULL)
if (NULL == stream)
goto alloc_fail;
- if (false == construct(&stream->protected, dc_sink))
+ if (false == construct(&stream->protected, sink))
goto construct_fail;
stream->ref_count++;
dm_logger_write(dm_logger,
log_type,
"\tsink name: %s, serial: %d\n",
- core_stream->sink->public.edid_caps.display_name,
- core_stream->sink->public.edid_caps.serial_number);
+ core_stream->sink->edid_caps.display_name,
+ core_stream->sink->edid_caps.serial_number);
dm_logger_write(dm_logger,
log_type,
"\tlink: %d\n",
/**
* 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_release(const struct dc_stream *dc_stream);
* The currently active signal type (HDMI, DP-SST, DP-MST) is also reported.
*/
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;
- const struct dc_sink *local_sink;
+ struct dc_sink *local_sink;
unsigned int link_index;
enum dc_connection_type type;
enum signal_type connector_signal;
void dc_link_remove_remote_sink(
struct dc_link *link,
- const struct dc_sink *sink);
+ struct dc_sink *sink);
/* Used by diagnostics for virtual link at the moment */
void dc_link_set_sink(struct dc_link *link, struct dc_sink *sink);
void *priv;
struct stereo_3d_features features_3d[TIMING_3D_FORMAT_MAX];
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_release(const struct dc_sink *sink);
+void dc_sink_retain(struct dc_sink *sink);
+void dc_sink_release(struct dc_sink *sink);
const struct audio **dc_get_audios(struct dc *dc);
* encoder block
* note: video bios clears all FMT setting here. */
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.controller_id = pipe_ctx->pipe_idx + 1;
/* field internal to DC */
struct dc_context *ctx;
- const struct core_sink *sink;
+ struct dc_sink *sink;
/* used by DCP and FMT */
struct bit_depth_reduction_params bit_depth_params;
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 *****************/
struct link_init_data {
const struct core_dc *dc;