|
@@ -155,20 +155,19 @@ static bool stream_adjust_vmin_vmax(struct dc *dc,
|
|
|
int vmin, int vmax)
|
|
|
{
|
|
|
/* TODO: Support multiple streams */
|
|
|
- struct dc *core_dc = dc;
|
|
|
struct dc_stream_state *stream = streams[0];
|
|
|
int i = 0;
|
|
|
bool ret = false;
|
|
|
|
|
|
for (i = 0; i < MAX_PIPES; i++) {
|
|
|
- struct pipe_ctx *pipe = &core_dc->current_context->res_ctx.pipe_ctx[i];
|
|
|
+ struct pipe_ctx *pipe = &dc->current_context->res_ctx.pipe_ctx[i];
|
|
|
|
|
|
if (pipe->stream == stream && pipe->stream_res.stream_enc) {
|
|
|
- core_dc->hwss.set_drr(&pipe, 1, vmin, vmax);
|
|
|
+ dc->hwss.set_drr(&pipe, 1, vmin, vmax);
|
|
|
|
|
|
/* build and update the info frame */
|
|
|
resource_build_info_frame(pipe);
|
|
|
- core_dc->hwss.update_info_frame(pipe);
|
|
|
+ dc->hwss.update_info_frame(pipe);
|
|
|
|
|
|
ret = true;
|
|
|
}
|
|
@@ -181,7 +180,6 @@ static bool stream_get_crtc_position(struct dc *dc,
|
|
|
unsigned int *v_pos, unsigned int *nom_v_pos)
|
|
|
{
|
|
|
/* TODO: Support multiple streams */
|
|
|
- struct dc *core_dc = dc;
|
|
|
struct dc_stream_state *stream = streams[0];
|
|
|
int i = 0;
|
|
|
bool ret = false;
|
|
@@ -189,10 +187,10 @@ static bool stream_get_crtc_position(struct dc *dc,
|
|
|
|
|
|
for (i = 0; i < MAX_PIPES; i++) {
|
|
|
struct pipe_ctx *pipe =
|
|
|
- &core_dc->current_context->res_ctx.pipe_ctx[i];
|
|
|
+ &dc->current_context->res_ctx.pipe_ctx[i];
|
|
|
|
|
|
if (pipe->stream == stream && pipe->stream_res.stream_enc) {
|
|
|
- core_dc->hwss.get_position(&pipe, 1, &position);
|
|
|
+ dc->hwss.get_position(&pipe, 1, &position);
|
|
|
|
|
|
*v_pos = position.vertical_count;
|
|
|
*nom_v_pos = position.nominal_vcount;
|
|
@@ -204,15 +202,14 @@ static bool stream_get_crtc_position(struct dc *dc,
|
|
|
|
|
|
static bool set_gamut_remap(struct dc *dc, const struct dc_stream_state *stream)
|
|
|
{
|
|
|
- struct dc *core_dc = dc;
|
|
|
int i = 0;
|
|
|
bool ret = false;
|
|
|
struct pipe_ctx *pipes;
|
|
|
|
|
|
for (i = 0; i < MAX_PIPES; i++) {
|
|
|
- if (core_dc->current_context->res_ctx.pipe_ctx[i].stream == stream) {
|
|
|
- pipes = &core_dc->current_context->res_ctx.pipe_ctx[i];
|
|
|
- core_dc->hwss.program_gamut_remap(pipes);
|
|
|
+ if (dc->current_context->res_ctx.pipe_ctx[i].stream == stream) {
|
|
|
+ pipes = &dc->current_context->res_ctx.pipe_ctx[i];
|
|
|
+ dc->hwss.program_gamut_remap(pipes);
|
|
|
ret = true;
|
|
|
}
|
|
|
}
|
|
@@ -222,17 +219,16 @@ static bool set_gamut_remap(struct dc *dc, const struct dc_stream_state *stream)
|
|
|
|
|
|
static bool program_csc_matrix(struct dc *dc, struct dc_stream_state *stream)
|
|
|
{
|
|
|
- struct dc *core_dc = dc;
|
|
|
int i = 0;
|
|
|
bool ret = false;
|
|
|
struct pipe_ctx *pipes;
|
|
|
|
|
|
for (i = 0; i < MAX_PIPES; i++) {
|
|
|
- if (core_dc->current_context->res_ctx.pipe_ctx[i].stream
|
|
|
+ if (dc->current_context->res_ctx.pipe_ctx[i].stream
|
|
|
== stream) {
|
|
|
|
|
|
- pipes = &core_dc->current_context->res_ctx.pipe_ctx[i];
|
|
|
- core_dc->hwss.program_csc_matrix(pipes,
|
|
|
+ pipes = &dc->current_context->res_ctx.pipe_ctx[i];
|
|
|
+ dc->hwss.program_csc_matrix(pipes,
|
|
|
stream->output_color_space,
|
|
|
stream->csc_color_matrix.matrix);
|
|
|
ret = true;
|
|
@@ -247,7 +243,6 @@ static void set_static_screen_events(struct dc *dc,
|
|
|
int num_streams,
|
|
|
const struct dc_static_screen_events *events)
|
|
|
{
|
|
|
- struct dc *core_dc = dc;
|
|
|
int i = 0;
|
|
|
int j = 0;
|
|
|
struct pipe_ctx *pipes_affected[MAX_PIPES];
|
|
@@ -257,45 +252,44 @@ static void set_static_screen_events(struct dc *dc,
|
|
|
struct dc_stream_state *stream = streams[i];
|
|
|
|
|
|
for (j = 0; j < MAX_PIPES; j++) {
|
|
|
- if (core_dc->current_context->res_ctx.pipe_ctx[j].stream
|
|
|
+ if (dc->current_context->res_ctx.pipe_ctx[j].stream
|
|
|
== stream) {
|
|
|
pipes_affected[num_pipes_affected++] =
|
|
|
- &core_dc->current_context->res_ctx.pipe_ctx[j];
|
|
|
+ &dc->current_context->res_ctx.pipe_ctx[j];
|
|
|
}
|
|
|
}
|
|
|
}
|
|
|
|
|
|
- core_dc->hwss.set_static_screen_control(pipes_affected, num_pipes_affected, events);
|
|
|
+ dc->hwss.set_static_screen_control(pipes_affected, num_pipes_affected, events);
|
|
|
}
|
|
|
|
|
|
static void set_drive_settings(struct dc *dc,
|
|
|
struct link_training_settings *lt_settings,
|
|
|
const struct dc_link *link)
|
|
|
{
|
|
|
- struct dc *core_dc = dc;
|
|
|
+
|
|
|
int i;
|
|
|
|
|
|
- for (i = 0; i < core_dc->link_count; i++) {
|
|
|
- if (core_dc->links[i] == link)
|
|
|
+ for (i = 0; i < dc->link_count; i++) {
|
|
|
+ if (dc->links[i] == link)
|
|
|
break;
|
|
|
}
|
|
|
|
|
|
- if (i >= core_dc->link_count)
|
|
|
+ if (i >= dc->link_count)
|
|
|
ASSERT_CRITICAL(false);
|
|
|
|
|
|
- dc_link_dp_set_drive_settings(core_dc->links[i], lt_settings);
|
|
|
+ dc_link_dp_set_drive_settings(dc->links[i], lt_settings);
|
|
|
}
|
|
|
|
|
|
static void perform_link_training(struct dc *dc,
|
|
|
struct dc_link_settings *link_setting,
|
|
|
bool skip_video_pattern)
|
|
|
{
|
|
|
- struct dc *core_dc = dc;
|
|
|
int i;
|
|
|
|
|
|
- for (i = 0; i < core_dc->link_count; i++)
|
|
|
+ for (i = 0; i < dc->link_count; i++)
|
|
|
dc_link_dp_perform_link_training(
|
|
|
- core_dc->links[i],
|
|
|
+ dc->links[i],
|
|
|
link_setting,
|
|
|
skip_video_pattern);
|
|
|
}
|
|
@@ -371,44 +365,44 @@ void set_dither_option(struct dc_stream_state *stream,
|
|
|
opp_program_bit_depth_reduction(pipes->stream_res.opp, ¶ms);
|
|
|
}
|
|
|
|
|
|
-static void allocate_dc_stream_funcs(struct dc *core_dc)
|
|
|
+static void allocate_dc_stream_funcs(struct dc *dc)
|
|
|
{
|
|
|
- if (core_dc->hwss.set_drr != NULL) {
|
|
|
- core_dc->stream_funcs.adjust_vmin_vmax =
|
|
|
+ if (dc->hwss.set_drr != NULL) {
|
|
|
+ dc->stream_funcs.adjust_vmin_vmax =
|
|
|
stream_adjust_vmin_vmax;
|
|
|
}
|
|
|
|
|
|
- core_dc->stream_funcs.set_static_screen_events =
|
|
|
+ dc->stream_funcs.set_static_screen_events =
|
|
|
set_static_screen_events;
|
|
|
|
|
|
- core_dc->stream_funcs.get_crtc_position =
|
|
|
+ dc->stream_funcs.get_crtc_position =
|
|
|
stream_get_crtc_position;
|
|
|
|
|
|
- core_dc->stream_funcs.set_gamut_remap =
|
|
|
+ dc->stream_funcs.set_gamut_remap =
|
|
|
set_gamut_remap;
|
|
|
|
|
|
- core_dc->stream_funcs.program_csc_matrix =
|
|
|
+ dc->stream_funcs.program_csc_matrix =
|
|
|
program_csc_matrix;
|
|
|
|
|
|
- core_dc->stream_funcs.set_dither_option =
|
|
|
+ dc->stream_funcs.set_dither_option =
|
|
|
set_dither_option;
|
|
|
|
|
|
- core_dc->link_funcs.set_drive_settings =
|
|
|
+ dc->link_funcs.set_drive_settings =
|
|
|
set_drive_settings;
|
|
|
|
|
|
- core_dc->link_funcs.perform_link_training =
|
|
|
+ dc->link_funcs.perform_link_training =
|
|
|
perform_link_training;
|
|
|
|
|
|
- core_dc->link_funcs.set_preferred_link_settings =
|
|
|
+ dc->link_funcs.set_preferred_link_settings =
|
|
|
set_preferred_link_settings;
|
|
|
|
|
|
- core_dc->link_funcs.enable_hpd =
|
|
|
+ dc->link_funcs.enable_hpd =
|
|
|
enable_hpd;
|
|
|
|
|
|
- core_dc->link_funcs.disable_hpd =
|
|
|
+ dc->link_funcs.disable_hpd =
|
|
|
disable_hpd;
|
|
|
|
|
|
- core_dc->link_funcs.set_test_pattern =
|
|
|
+ dc->link_funcs.set_test_pattern =
|
|
|
set_test_pattern;
|
|
|
}
|
|
|
|
|
@@ -622,41 +616,41 @@ void ProgramPixelDurationV(unsigned int pixelClockInKHz )
|
|
|
|
|
|
struct dc *dc_create(const struct dc_init_data *init_params)
|
|
|
{
|
|
|
- struct dc *core_dc = dm_alloc(sizeof(*core_dc));
|
|
|
+ struct dc *dc = dm_alloc(sizeof(*dc));
|
|
|
unsigned int full_pipe_count;
|
|
|
|
|
|
- if (NULL == core_dc)
|
|
|
+ if (NULL == dc)
|
|
|
goto alloc_fail;
|
|
|
|
|
|
- if (false == construct(core_dc, init_params))
|
|
|
+ if (false == construct(dc, init_params))
|
|
|
goto construct_fail;
|
|
|
|
|
|
/*TODO: separate HW and SW initialization*/
|
|
|
- core_dc->hwss.init_hw(core_dc);
|
|
|
+ dc->hwss.init_hw(dc);
|
|
|
|
|
|
- full_pipe_count = core_dc->res_pool->pipe_count;
|
|
|
- if (core_dc->res_pool->underlay_pipe_index != NO_UNDERLAY_PIPE)
|
|
|
+ full_pipe_count = dc->res_pool->pipe_count;
|
|
|
+ if (dc->res_pool->underlay_pipe_index != NO_UNDERLAY_PIPE)
|
|
|
full_pipe_count--;
|
|
|
- core_dc->caps.max_streams = min(
|
|
|
+ dc->caps.max_streams = min(
|
|
|
full_pipe_count,
|
|
|
- core_dc->res_pool->stream_enc_count);
|
|
|
+ dc->res_pool->stream_enc_count);
|
|
|
|
|
|
- core_dc->caps.max_links = core_dc->link_count;
|
|
|
- core_dc->caps.max_audios = core_dc->res_pool->audio_count;
|
|
|
+ dc->caps.max_links = dc->link_count;
|
|
|
+ dc->caps.max_audios = dc->res_pool->audio_count;
|
|
|
|
|
|
- core_dc->config = init_params->flags;
|
|
|
+ dc->config = init_params->flags;
|
|
|
|
|
|
- dm_logger_write(core_dc->ctx->logger, LOG_DC,
|
|
|
+ dm_logger_write(dc->ctx->logger, LOG_DC,
|
|
|
"Display Core initialized\n");
|
|
|
|
|
|
|
|
|
/* TODO: missing feature to be enabled */
|
|
|
- core_dc->debug.disable_dfs_bypass = true;
|
|
|
+ dc->debug.disable_dfs_bypass = true;
|
|
|
|
|
|
- return core_dc;
|
|
|
+ return dc;
|
|
|
|
|
|
construct_fail:
|
|
|
- dm_free(core_dc);
|
|
|
+ dm_free(dc);
|
|
|
|
|
|
alloc_fail:
|
|
|
return NULL;
|
|
@@ -664,9 +658,8 @@ alloc_fail:
|
|
|
|
|
|
void dc_destroy(struct dc **dc)
|
|
|
{
|
|
|
- struct dc *core_dc = *dc;
|
|
|
- destruct(core_dc);
|
|
|
- dm_free(core_dc);
|
|
|
+ destruct(*dc);
|
|
|
+ dm_free(*dc);
|
|
|
*dc = NULL;
|
|
|
}
|
|
|
|
|
@@ -674,7 +667,6 @@ bool dc_validate_guaranteed(
|
|
|
struct dc *dc,
|
|
|
struct dc_stream_state *stream)
|
|
|
{
|
|
|
- struct dc *core_dc = dc;
|
|
|
enum dc_status result = DC_ERROR_UNEXPECTED;
|
|
|
struct validate_context *context;
|
|
|
|
|
@@ -687,14 +679,14 @@ bool dc_validate_guaranteed(
|
|
|
|
|
|
atomic_inc(&context->ref_count);
|
|
|
|
|
|
- result = core_dc->res_pool->funcs->validate_guaranteed(
|
|
|
- core_dc, stream, context);
|
|
|
+ result = dc->res_pool->funcs->validate_guaranteed(
|
|
|
+ dc, stream, context);
|
|
|
|
|
|
dc_release_validate_context(context);
|
|
|
|
|
|
context_alloc_fail:
|
|
|
if (result != DC_OK) {
|
|
|
- dm_logger_write(core_dc->ctx->logger, LOG_WARNING,
|
|
|
+ dm_logger_write(dc->ctx->logger, LOG_WARNING,
|
|
|
"%s:guaranteed validation failed, dc_status:%d\n",
|
|
|
__func__,
|
|
|
result);
|
|
@@ -704,12 +696,12 @@ context_alloc_fail:
|
|
|
}
|
|
|
|
|
|
static void program_timing_sync(
|
|
|
- struct dc *core_dc,
|
|
|
+ struct dc *dc,
|
|
|
struct validate_context *ctx)
|
|
|
{
|
|
|
int i, j;
|
|
|
int group_index = 0;
|
|
|
- int pipe_count = core_dc->res_pool->pipe_count;
|
|
|
+ int pipe_count = dc->res_pool->pipe_count;
|
|
|
struct pipe_ctx *unsynced_pipes[MAX_PIPES] = { NULL };
|
|
|
|
|
|
for (i = 0; i < pipe_count; i++) {
|
|
@@ -770,8 +762,8 @@ static void program_timing_sync(
|
|
|
}
|
|
|
|
|
|
if (group_size > 1) {
|
|
|
- core_dc->hwss.enable_timing_synchronization(
|
|
|
- core_dc, group_index, group_size, pipe_set);
|
|
|
+ dc->hwss.enable_timing_synchronization(
|
|
|
+ dc, group_index, group_size, pipe_set);
|
|
|
group_index++;
|
|
|
}
|
|
|
}
|
|
@@ -803,17 +795,16 @@ bool dc_enable_stereo(
|
|
|
bool ret = true;
|
|
|
int i, j;
|
|
|
struct pipe_ctx *pipe;
|
|
|
- struct dc *core_dc = dc;
|
|
|
|
|
|
for (i = 0; i < MAX_PIPES; i++) {
|
|
|
if (context != NULL)
|
|
|
pipe = &context->res_ctx.pipe_ctx[i];
|
|
|
else
|
|
|
- pipe = &core_dc->current_context->res_ctx.pipe_ctx[i];
|
|
|
+ pipe = &dc->current_context->res_ctx.pipe_ctx[i];
|
|
|
for (j = 0 ; pipe && j < stream_count; j++) {
|
|
|
if (streams[j] && streams[j] == pipe->stream &&
|
|
|
- core_dc->hwss.setup_stereo)
|
|
|
- core_dc->hwss.setup_stereo(pipe, core_dc);
|
|
|
+ dc->hwss.setup_stereo)
|
|
|
+ dc->hwss.setup_stereo(pipe, dc);
|
|
|
}
|
|
|
}
|
|
|
|
|
@@ -827,8 +818,7 @@ bool dc_enable_stereo(
|
|
|
*/
|
|
|
static bool dc_commit_context_no_check(struct dc *dc, struct validate_context *context)
|
|
|
{
|
|
|
- struct dc *core_dc = dc;
|
|
|
- struct dc_bios *dcb = core_dc->ctx->dc_bios;
|
|
|
+ struct dc_bios *dcb = dc->ctx->dc_bios;
|
|
|
enum dc_status result = DC_ERROR_UNEXPECTED;
|
|
|
struct pipe_ctx *pipe;
|
|
|
int i, j, k, l;
|
|
@@ -838,22 +828,22 @@ static bool dc_commit_context_no_check(struct dc *dc, struct validate_context *c
|
|
|
dc_streams[i] = context->streams[i];
|
|
|
|
|
|
if (!dcb->funcs->is_accelerated_mode(dcb))
|
|
|
- core_dc->hwss.enable_accelerated_mode(core_dc);
|
|
|
+ dc->hwss.enable_accelerated_mode(dc);
|
|
|
|
|
|
- for (i = 0; i < core_dc->res_pool->pipe_count; i++) {
|
|
|
+ for (i = 0; i < dc->res_pool->pipe_count; i++) {
|
|
|
pipe = &context->res_ctx.pipe_ctx[i];
|
|
|
- core_dc->hwss.wait_for_mpcc_disconnect(core_dc, core_dc->res_pool, pipe);
|
|
|
+ dc->hwss.wait_for_mpcc_disconnect(dc, dc->res_pool, pipe);
|
|
|
}
|
|
|
- result = core_dc->hwss.apply_ctx_to_hw(core_dc, context);
|
|
|
+ result = dc->hwss.apply_ctx_to_hw(dc, context);
|
|
|
|
|
|
- program_timing_sync(core_dc, context);
|
|
|
+ program_timing_sync(dc, context);
|
|
|
|
|
|
for (i = 0; i < context->stream_count; i++) {
|
|
|
const struct dc_sink *sink = context->streams[i]->sink;
|
|
|
|
|
|
for (j = 0; j < context->stream_status[i].plane_count; j++) {
|
|
|
- core_dc->hwss.apply_ctx_for_surface(
|
|
|
- core_dc, context->streams[i],
|
|
|
+ dc->hwss.apply_ctx_for_surface(
|
|
|
+ dc, context->streams[i],
|
|
|
context->stream_status[i].plane_count,
|
|
|
context);
|
|
|
|
|
@@ -867,8 +857,8 @@ static bool dc_commit_context_no_check(struct dc *dc, struct validate_context *c
|
|
|
for (l = 0 ; pipe && l < context->stream_count; l++) {
|
|
|
if (context->streams[l] &&
|
|
|
context->streams[l] == pipe->stream &&
|
|
|
- core_dc->hwss.setup_stereo)
|
|
|
- core_dc->hwss.setup_stereo(pipe, core_dc);
|
|
|
+ dc->hwss.setup_stereo)
|
|
|
+ dc->hwss.setup_stereo(pipe, dc);
|
|
|
}
|
|
|
}
|
|
|
}
|
|
@@ -883,11 +873,11 @@ static bool dc_commit_context_no_check(struct dc *dc, struct validate_context *c
|
|
|
|
|
|
dc_enable_stereo(dc, context, dc_streams, context->stream_count);
|
|
|
|
|
|
- dc_release_validate_context(core_dc->current_context);
|
|
|
+ dc_release_validate_context(dc->current_context);
|
|
|
|
|
|
- core_dc->current_context = context;
|
|
|
+ dc->current_context = context;
|
|
|
|
|
|
- dc_retain_validate_context(core_dc->current_context);
|
|
|
+ dc_retain_validate_context(dc->current_context);
|
|
|
|
|
|
return (result == DC_OK);
|
|
|
}
|
|
@@ -895,20 +885,19 @@ static bool dc_commit_context_no_check(struct dc *dc, struct validate_context *c
|
|
|
bool dc_commit_context(struct dc *dc, struct validate_context *context)
|
|
|
{
|
|
|
enum dc_status result = DC_ERROR_UNEXPECTED;
|
|
|
- struct dc *core_dc = dc;
|
|
|
int i;
|
|
|
|
|
|
- if (false == context_changed(core_dc, context))
|
|
|
+ if (false == context_changed(dc, context))
|
|
|
return DC_OK;
|
|
|
|
|
|
- dm_logger_write(core_dc->ctx->logger, LOG_DC, "%s: %d streams\n",
|
|
|
+ dm_logger_write(dc->ctx->logger, LOG_DC, "%s: %d streams\n",
|
|
|
__func__, context->stream_count);
|
|
|
|
|
|
for (i = 0; i < context->stream_count; i++) {
|
|
|
struct dc_stream_state *stream = context->streams[i];
|
|
|
|
|
|
dc_stream_log(stream,
|
|
|
- core_dc->ctx->logger,
|
|
|
+ dc->ctx->logger,
|
|
|
LOG_DC);
|
|
|
}
|
|
|
|
|
@@ -921,21 +910,20 @@ bool dc_commit_context(struct dc *dc, struct validate_context *context)
|
|
|
bool dc_post_update_surfaces_to_stream(struct dc *dc)
|
|
|
{
|
|
|
int i;
|
|
|
- struct dc *core_dc = dc;
|
|
|
- struct validate_context *context = core_dc->current_context;
|
|
|
+ struct validate_context *context = dc->current_context;
|
|
|
|
|
|
post_surface_trace(dc);
|
|
|
|
|
|
- for (i = 0; i < core_dc->res_pool->pipe_count; i++)
|
|
|
+ for (i = 0; i < dc->res_pool->pipe_count; i++)
|
|
|
if (context->res_ctx.pipe_ctx[i].stream == NULL
|
|
|
|| context->res_ctx.pipe_ctx[i].plane_state == NULL)
|
|
|
- core_dc->hwss.power_down_front_end(core_dc, i);
|
|
|
+ dc->hwss.power_down_front_end(dc, i);
|
|
|
|
|
|
/* 3rd param should be true, temp w/a for RV*/
|
|
|
#if defined(CONFIG_DRM_AMD_DC_DCN1_0)
|
|
|
- core_dc->hwss.set_bandwidth(core_dc, context, core_dc->ctx->dce_version < DCN_VERSION_1_0);
|
|
|
+ dc->hwss.set_bandwidth(dc, context, dc->ctx->dce_version < DCN_VERSION_1_0);
|
|
|
#else
|
|
|
- core_dc->hwss.set_bandwidth(core_dc, context, true);
|
|
|
+ dc->hwss.set_bandwidth(dc, context, true);
|
|
|
#endif
|
|
|
return true;
|
|
|
}
|
|
@@ -1184,7 +1172,6 @@ enum surface_update_type dc_check_update_surfaces_for_stream(
|
|
|
struct dc_stream_update *stream_update,
|
|
|
const struct dc_stream_status *stream_status)
|
|
|
{
|
|
|
- struct dc *core_dc = dc;
|
|
|
int i;
|
|
|
enum surface_update_type overall_type = UPDATE_TYPE_FAST;
|
|
|
|
|
@@ -1196,7 +1183,7 @@ enum surface_update_type dc_check_update_surfaces_for_stream(
|
|
|
|
|
|
for (i = 0 ; i < surface_count; i++) {
|
|
|
enum surface_update_type type =
|
|
|
- det_surface_update(core_dc, &updates[i], i);
|
|
|
+ det_surface_update(dc, &updates[i], i);
|
|
|
|
|
|
if (type == UPDATE_TYPE_FULL)
|
|
|
return type;
|
|
@@ -1230,12 +1217,11 @@ void dc_update_planes_and_stream(struct dc *dc,
|
|
|
struct dc_stream_state *stream,
|
|
|
struct dc_stream_update *stream_update)
|
|
|
{
|
|
|
- struct dc *core_dc = dc;
|
|
|
struct validate_context *context;
|
|
|
int i, j;
|
|
|
enum surface_update_type update_type;
|
|
|
const struct dc_stream_status *stream_status;
|
|
|
- struct dc_context *dc_ctx = core_dc->ctx;
|
|
|
+ struct dc_context *dc_ctx = dc->ctx;
|
|
|
|
|
|
stream_status = dc_stream_get_status(stream);
|
|
|
|
|
@@ -1249,7 +1235,7 @@ void dc_update_planes_and_stream(struct dc *dc,
|
|
|
ASSERT(0);
|
|
|
}
|
|
|
#endif
|
|
|
- context = core_dc->current_context;
|
|
|
+ context = dc->current_context;
|
|
|
|
|
|
/* update current stream with the new updates */
|
|
|
if (stream_update) {
|
|
@@ -1303,7 +1289,7 @@ void dc_update_planes_and_stream(struct dc *dc,
|
|
|
goto context_alloc_fail;
|
|
|
|
|
|
dc_resource_validate_ctx_copy_construct(
|
|
|
- core_dc->current_context, context);
|
|
|
+ dc->current_context, context);
|
|
|
|
|
|
/*remove old surfaces from context */
|
|
|
if (!dc_rem_all_planes_for_stream(dc, stream, context)) {
|
|
@@ -1365,7 +1351,7 @@ void dc_update_planes_and_stream(struct dc *dc,
|
|
|
}
|
|
|
|
|
|
if (update_type >= UPDATE_TYPE_MED) {
|
|
|
- for (j = 0; j < core_dc->res_pool->pipe_count; j++) {
|
|
|
+ for (j = 0; j < dc->res_pool->pipe_count; j++) {
|
|
|
struct pipe_ctx *pipe_ctx = &context->res_ctx.pipe_ctx[j];
|
|
|
|
|
|
if (pipe_ctx->plane_state != surface)
|
|
@@ -1403,31 +1389,31 @@ void dc_update_planes_and_stream(struct dc *dc,
|
|
|
}
|
|
|
|
|
|
if (update_type == UPDATE_TYPE_FULL) {
|
|
|
- if (!core_dc->res_pool->funcs->validate_bandwidth(core_dc, context)) {
|
|
|
+ if (!dc->res_pool->funcs->validate_bandwidth(dc, context)) {
|
|
|
BREAK_TO_DEBUGGER();
|
|
|
goto fail;
|
|
|
} else {
|
|
|
- core_dc->hwss.set_bandwidth(core_dc, context, false);
|
|
|
+ dc->hwss.set_bandwidth(dc, context, false);
|
|
|
context_clock_trace(dc, context);
|
|
|
}
|
|
|
}
|
|
|
|
|
|
if (update_type > UPDATE_TYPE_FAST) {
|
|
|
- for (j = 0; j < core_dc->res_pool->pipe_count; j++) {
|
|
|
+ for (j = 0; j < dc->res_pool->pipe_count; j++) {
|
|
|
struct pipe_ctx *pipe_ctx = &context->res_ctx.pipe_ctx[j];
|
|
|
|
|
|
- core_dc->hwss.wait_for_mpcc_disconnect(core_dc, core_dc->res_pool, pipe_ctx);
|
|
|
+ dc->hwss.wait_for_mpcc_disconnect(dc, dc->res_pool, pipe_ctx);
|
|
|
}
|
|
|
}
|
|
|
|
|
|
if (surface_count == 0)
|
|
|
- core_dc->hwss.apply_ctx_for_surface(core_dc, stream, surface_count, context);
|
|
|
+ dc->hwss.apply_ctx_for_surface(dc, stream, surface_count, context);
|
|
|
|
|
|
/* Lock pipes for provided surfaces, or all active if full update*/
|
|
|
for (i = 0; i < surface_count; i++) {
|
|
|
struct dc_plane_state *plane_state = srf_updates[i].surface;
|
|
|
|
|
|
- for (j = 0; j < core_dc->res_pool->pipe_count; j++) {
|
|
|
+ for (j = 0; j < dc->res_pool->pipe_count; j++) {
|
|
|
struct pipe_ctx *pipe_ctx = &context->res_ctx.pipe_ctx[j];
|
|
|
|
|
|
if (update_type != UPDATE_TYPE_FULL && pipe_ctx->plane_state != plane_state)
|
|
@@ -1435,8 +1421,8 @@ void dc_update_planes_and_stream(struct dc *dc,
|
|
|
if (!pipe_ctx->plane_state || pipe_ctx->top_pipe)
|
|
|
continue;
|
|
|
|
|
|
- core_dc->hwss.pipe_control_lock(
|
|
|
- core_dc,
|
|
|
+ dc->hwss.pipe_control_lock(
|
|
|
+ dc,
|
|
|
pipe_ctx,
|
|
|
true);
|
|
|
}
|
|
@@ -1445,9 +1431,9 @@ void dc_update_planes_and_stream(struct dc *dc,
|
|
|
}
|
|
|
|
|
|
/* Full fe update*/
|
|
|
- for (j = 0; j < core_dc->res_pool->pipe_count; j++) {
|
|
|
+ for (j = 0; j < dc->res_pool->pipe_count; j++) {
|
|
|
struct pipe_ctx *pipe_ctx = &context->res_ctx.pipe_ctx[j];
|
|
|
- struct pipe_ctx *cur_pipe_ctx = &core_dc->current_context->res_ctx.pipe_ctx[j];
|
|
|
+ struct pipe_ctx *cur_pipe_ctx = &dc->current_context->res_ctx.pipe_ctx[j];
|
|
|
bool is_new_pipe_surface = cur_pipe_ctx->plane_state != pipe_ctx->plane_state;
|
|
|
struct dc_cursor_position position = { 0 };
|
|
|
|
|
@@ -1458,18 +1444,18 @@ void dc_update_planes_and_stream(struct dc *dc,
|
|
|
if (!pipe_ctx->top_pipe && pipe_ctx->stream) {
|
|
|
struct dc_stream_status *stream_status = stream_get_status(context, pipe_ctx->stream);
|
|
|
|
|
|
- core_dc->hwss.apply_ctx_for_surface(
|
|
|
- core_dc, pipe_ctx->stream, stream_status->plane_count, context);
|
|
|
+ dc->hwss.apply_ctx_for_surface(
|
|
|
+ dc, pipe_ctx->stream, stream_status->plane_count, context);
|
|
|
}
|
|
|
|
|
|
/* TODO: this is a hack w/a for switching from mpo to pipe split */
|
|
|
dc_stream_set_cursor_position(pipe_ctx->stream, &position);
|
|
|
|
|
|
if (is_new_pipe_surface) {
|
|
|
- core_dc->hwss.update_plane_addr(core_dc, pipe_ctx);
|
|
|
- core_dc->hwss.set_input_transfer_func(
|
|
|
+ dc->hwss.update_plane_addr(dc, pipe_ctx);
|
|
|
+ dc->hwss.set_input_transfer_func(
|
|
|
pipe_ctx, pipe_ctx->plane_state);
|
|
|
- core_dc->hwss.set_output_transfer_func(
|
|
|
+ dc->hwss.set_output_transfer_func(
|
|
|
pipe_ctx, pipe_ctx->stream);
|
|
|
}
|
|
|
}
|
|
@@ -1482,40 +1468,40 @@ void dc_update_planes_and_stream(struct dc *dc,
|
|
|
struct dc_plane_state *plane_state = srf_updates[i].surface;
|
|
|
|
|
|
if (update_type == UPDATE_TYPE_MED)
|
|
|
- core_dc->hwss.apply_ctx_for_surface(
|
|
|
- core_dc, stream, surface_count, context);
|
|
|
+ dc->hwss.apply_ctx_for_surface(
|
|
|
+ dc, stream, surface_count, context);
|
|
|
|
|
|
- for (j = 0; j < core_dc->res_pool->pipe_count; j++) {
|
|
|
+ for (j = 0; j < dc->res_pool->pipe_count; j++) {
|
|
|
struct pipe_ctx *pipe_ctx = &context->res_ctx.pipe_ctx[j];
|
|
|
|
|
|
if (pipe_ctx->plane_state != plane_state)
|
|
|
continue;
|
|
|
|
|
|
if (srf_updates[i].flip_addr)
|
|
|
- core_dc->hwss.update_plane_addr(core_dc, pipe_ctx);
|
|
|
+ dc->hwss.update_plane_addr(dc, pipe_ctx);
|
|
|
|
|
|
if (update_type == UPDATE_TYPE_FAST)
|
|
|
continue;
|
|
|
|
|
|
if (srf_updates[i].in_transfer_func)
|
|
|
- core_dc->hwss.set_input_transfer_func(
|
|
|
+ dc->hwss.set_input_transfer_func(
|
|
|
pipe_ctx, pipe_ctx->plane_state);
|
|
|
|
|
|
if (stream_update != NULL &&
|
|
|
stream_update->out_transfer_func != NULL) {
|
|
|
- core_dc->hwss.set_output_transfer_func(
|
|
|
+ dc->hwss.set_output_transfer_func(
|
|
|
pipe_ctx, pipe_ctx->stream);
|
|
|
}
|
|
|
|
|
|
if (srf_updates[i].hdr_static_metadata) {
|
|
|
resource_build_info_frame(pipe_ctx);
|
|
|
- core_dc->hwss.update_info_frame(pipe_ctx);
|
|
|
+ dc->hwss.update_info_frame(pipe_ctx);
|
|
|
}
|
|
|
}
|
|
|
}
|
|
|
|
|
|
/* Unlock pipes */
|
|
|
- for (i = core_dc->res_pool->pipe_count - 1; i >= 0; i--) {
|
|
|
+ for (i = dc->res_pool->pipe_count - 1; i >= 0; i--) {
|
|
|
struct pipe_ctx *pipe_ctx = &context->res_ctx.pipe_ctx[i];
|
|
|
|
|
|
for (j = 0; j < surface_count; j++) {
|
|
@@ -1525,8 +1511,8 @@ void dc_update_planes_and_stream(struct dc *dc,
|
|
|
if (!pipe_ctx->plane_state || pipe_ctx->top_pipe)
|
|
|
continue;
|
|
|
|
|
|
- core_dc->hwss.pipe_control_lock(
|
|
|
- core_dc,
|
|
|
+ dc->hwss.pipe_control_lock(
|
|
|
+ dc,
|
|
|
pipe_ctx,
|
|
|
false);
|
|
|
|
|
@@ -1534,7 +1520,7 @@ void dc_update_planes_and_stream(struct dc *dc,
|
|
|
}
|
|
|
}
|
|
|
|
|
|
- if (core_dc->current_context != context) {
|
|
|
+ if (dc->current_context != context) {
|
|
|
|
|
|
/* Since memory free requires elevated IRQL, an interrupt
|
|
|
* request is generated by mem free. If this happens
|
|
@@ -1544,9 +1530,9 @@ void dc_update_planes_and_stream(struct dc *dc,
|
|
|
* then free the old context.
|
|
|
*/
|
|
|
|
|
|
- struct validate_context *old = core_dc->current_context;
|
|
|
+ struct validate_context *old = dc->current_context;
|
|
|
|
|
|
- core_dc->current_context = context;
|
|
|
+ dc->current_context = context;
|
|
|
dc_release_validate_context(old);
|
|
|
|
|
|
}
|
|
@@ -1561,29 +1547,25 @@ context_alloc_fail:
|
|
|
|
|
|
uint8_t dc_get_current_stream_count(struct dc *dc)
|
|
|
{
|
|
|
- struct dc *core_dc = dc;
|
|
|
- return core_dc->current_context->stream_count;
|
|
|
+ return dc->current_context->stream_count;
|
|
|
}
|
|
|
|
|
|
struct dc_stream_state *dc_get_stream_at_index(struct dc *dc, uint8_t i)
|
|
|
{
|
|
|
- struct dc *core_dc = dc;
|
|
|
- if (i < core_dc->current_context->stream_count)
|
|
|
- return core_dc->current_context->streams[i];
|
|
|
+ if (i < dc->current_context->stream_count)
|
|
|
+ return dc->current_context->streams[i];
|
|
|
return NULL;
|
|
|
}
|
|
|
|
|
|
struct dc_link *dc_get_link_at_index(struct dc *dc, uint32_t link_index)
|
|
|
{
|
|
|
- struct dc *core_dc = dc;
|
|
|
- return core_dc->links[link_index];
|
|
|
+ return dc->links[link_index];
|
|
|
}
|
|
|
|
|
|
struct dwbc *dc_get_dwb_at_pipe(struct dc *dc, uint32_t pipe)
|
|
|
{
|
|
|
- struct dc *core_dc = dc;
|
|
|
if ((pipe >= dwb_pipe0) && (pipe < dwb_pipe_max_num)) {
|
|
|
- return core_dc->res_pool->dwbc[(int)pipe];
|
|
|
+ return dc->res_pool->dwbc[(int)pipe];
|
|
|
} else {
|
|
|
return NULL;
|
|
|
}
|
|
@@ -1592,21 +1574,18 @@ struct dwbc *dc_get_dwb_at_pipe(struct dc *dc, uint32_t pipe)
|
|
|
const struct graphics_object_id dc_get_link_id_at_index(
|
|
|
struct dc *dc, uint32_t link_index)
|
|
|
{
|
|
|
- struct dc *core_dc = dc;
|
|
|
- return core_dc->links[link_index]->link_id;
|
|
|
+ return dc->links[link_index]->link_id;
|
|
|
}
|
|
|
|
|
|
enum dc_irq_source dc_get_hpd_irq_source_at_index(
|
|
|
struct dc *dc, uint32_t link_index)
|
|
|
{
|
|
|
- struct dc *core_dc = dc;
|
|
|
- return core_dc->links[link_index]->irq_source_hpd;
|
|
|
+ return dc->links[link_index]->irq_source_hpd;
|
|
|
}
|
|
|
|
|
|
const struct audio **dc_get_audios(struct dc *dc)
|
|
|
{
|
|
|
- struct dc *core_dc = dc;
|
|
|
- return (const struct audio **)core_dc->res_pool->audios;
|
|
|
+ return (const struct audio **)dc->res_pool->audios;
|
|
|
}
|
|
|
|
|
|
enum dc_irq_source dc_interrupt_to_irq_source(
|
|
@@ -1614,41 +1593,36 @@ enum dc_irq_source dc_interrupt_to_irq_source(
|
|
|
uint32_t src_id,
|
|
|
uint32_t ext_id)
|
|
|
{
|
|
|
- struct dc *core_dc = dc;
|
|
|
- return dal_irq_service_to_irq_source(core_dc->res_pool->irqs, src_id, ext_id);
|
|
|
+ return dal_irq_service_to_irq_source(dc->res_pool->irqs, src_id, ext_id);
|
|
|
}
|
|
|
|
|
|
void dc_interrupt_set(struct dc *dc, enum dc_irq_source src, bool enable)
|
|
|
{
|
|
|
- struct dc *core_dc;
|
|
|
|
|
|
if (dc == NULL)
|
|
|
return;
|
|
|
- core_dc = dc;
|
|
|
|
|
|
- dal_irq_service_set(core_dc->res_pool->irqs, src, enable);
|
|
|
+ dal_irq_service_set(dc->res_pool->irqs, src, enable);
|
|
|
}
|
|
|
|
|
|
void dc_interrupt_ack(struct dc *dc, enum dc_irq_source src)
|
|
|
{
|
|
|
- struct dc *core_dc = dc;
|
|
|
- dal_irq_service_ack(core_dc->res_pool->irqs, src);
|
|
|
+ dal_irq_service_ack(dc->res_pool->irqs, src);
|
|
|
}
|
|
|
|
|
|
void dc_set_power_state(
|
|
|
struct dc *dc,
|
|
|
enum dc_acpi_cm_power_state power_state)
|
|
|
{
|
|
|
- struct dc *core_dc = dc;
|
|
|
atomic_t ref_count;
|
|
|
|
|
|
switch (power_state) {
|
|
|
case DC_ACPI_CM_POWER_STATE_D0:
|
|
|
- core_dc->hwss.init_hw(core_dc);
|
|
|
+ dc->hwss.init_hw(dc);
|
|
|
break;
|
|
|
default:
|
|
|
|
|
|
- core_dc->hwss.power_down(core_dc);
|
|
|
+ dc->hwss.power_down(dc);
|
|
|
|
|
|
/* Zero out the current context so that on resume we start with
|
|
|
* clean state, and dc hw programming optimizations will not
|
|
@@ -1656,11 +1630,11 @@ void dc_set_power_state(
|
|
|
*/
|
|
|
|
|
|
/* Preserve refcount */
|
|
|
- ref_count = core_dc->current_context->ref_count;
|
|
|
- dc_resource_validate_ctx_destruct(core_dc->current_context);
|
|
|
- memset(core_dc->current_context, 0,
|
|
|
- sizeof(*core_dc->current_context));
|
|
|
- core_dc->current_context->ref_count = ref_count;
|
|
|
+ ref_count = dc->current_context->ref_count;
|
|
|
+ dc_resource_validate_ctx_destruct(dc->current_context);
|
|
|
+ memset(dc->current_context, 0,
|
|
|
+ sizeof(*dc->current_context));
|
|
|
+ dc->current_context->ref_count = ref_count;
|
|
|
|
|
|
break;
|
|
|
}
|
|
@@ -1669,12 +1643,11 @@ void dc_set_power_state(
|
|
|
|
|
|
void dc_resume(struct dc *dc)
|
|
|
{
|
|
|
- struct dc *core_dc = dc;
|
|
|
|
|
|
uint32_t i;
|
|
|
|
|
|
- for (i = 0; i < core_dc->link_count; i++)
|
|
|
- core_link_resume(core_dc->links[i]);
|
|
|
+ for (i = 0; i < dc->link_count; i++)
|
|
|
+ core_link_resume(dc->links[i]);
|
|
|
}
|
|
|
|
|
|
bool dc_read_aux_dpcd(
|
|
@@ -1684,9 +1657,8 @@ bool dc_read_aux_dpcd(
|
|
|
uint8_t *data,
|
|
|
uint32_t size)
|
|
|
{
|
|
|
- struct dc *core_dc = dc;
|
|
|
|
|
|
- struct dc_link *link = core_dc->links[link_index];
|
|
|
+ struct dc_link *link = dc->links[link_index];
|
|
|
enum ddc_result r = dal_ddc_service_read_dpcd_data(
|
|
|
link->ddc,
|
|
|
false,
|
|
@@ -1704,8 +1676,7 @@ bool dc_write_aux_dpcd(
|
|
|
const uint8_t *data,
|
|
|
uint32_t size)
|
|
|
{
|
|
|
- struct dc *core_dc = dc;
|
|
|
- struct dc_link *link = core_dc->links[link_index];
|
|
|
+ struct dc_link *link = dc->links[link_index];
|
|
|
|
|
|
enum ddc_result r = dal_ddc_service_write_dpcd_data(
|
|
|
link->ddc,
|
|
@@ -1725,9 +1696,8 @@ bool dc_read_aux_i2c(
|
|
|
uint8_t *data,
|
|
|
uint32_t size)
|
|
|
{
|
|
|
- struct dc *core_dc = dc;
|
|
|
|
|
|
- struct dc_link *link = core_dc->links[link_index];
|
|
|
+ struct dc_link *link = dc->links[link_index];
|
|
|
enum ddc_result r = dal_ddc_service_read_dpcd_data(
|
|
|
link->ddc,
|
|
|
true,
|
|
@@ -1746,8 +1716,7 @@ bool dc_write_aux_i2c(
|
|
|
const uint8_t *data,
|
|
|
uint32_t size)
|
|
|
{
|
|
|
- struct dc *core_dc = dc;
|
|
|
- struct dc_link *link = core_dc->links[link_index];
|
|
|
+ struct dc_link *link = dc->links[link_index];
|
|
|
|
|
|
enum ddc_result r = dal_ddc_service_write_dpcd_data(
|
|
|
link->ddc,
|
|
@@ -1768,9 +1737,8 @@ bool dc_query_ddc_data(
|
|
|
uint8_t *read_buf,
|
|
|
uint32_t read_size) {
|
|
|
|
|
|
- struct dc *core_dc = dc;
|
|
|
|
|
|
- struct dc_link *link = core_dc->links[link_index];
|
|
|
+ struct dc_link *link = dc->links[link_index];
|
|
|
|
|
|
bool result = dal_ddc_service_query_ddc_data(
|
|
|
link->ddc,
|
|
@@ -1788,9 +1756,8 @@ bool dc_submit_i2c(
|
|
|
uint32_t link_index,
|
|
|
struct i2c_command *cmd)
|
|
|
{
|
|
|
- struct dc *core_dc = dc;
|
|
|
|
|
|
- struct dc_link *link = core_dc->links[link_index];
|
|
|
+ struct dc_link *link = dc->links[link_index];
|
|
|
struct ddc_service *ddc = link->ddc;
|
|
|
|
|
|
return dal_i2caux_submit_i2c_command(
|
|
@@ -1907,12 +1874,11 @@ void dc_link_remove_remote_sink(struct dc_link *link, struct dc_sink *sink)
|
|
|
bool dc_init_dchub(struct dc *dc, struct dchub_init_data *dh_data)
|
|
|
{
|
|
|
int i;
|
|
|
- struct dc *core_dc = dc;
|
|
|
struct mem_input *mi = NULL;
|
|
|
|
|
|
- for (i = 0; i < core_dc->res_pool->pipe_count; i++) {
|
|
|
- if (core_dc->res_pool->mis[i] != NULL) {
|
|
|
- mi = core_dc->res_pool->mis[i];
|
|
|
+ for (i = 0; i < dc->res_pool->pipe_count; i++) {
|
|
|
+ if (dc->res_pool->mis[i] != NULL) {
|
|
|
+ mi = dc->res_pool->mis[i];
|
|
|
break;
|
|
|
}
|
|
|
}
|
|
@@ -1921,10 +1887,10 @@ bool dc_init_dchub(struct dc *dc, struct dchub_init_data *dh_data)
|
|
|
return false;
|
|
|
}
|
|
|
|
|
|
- if (core_dc->hwss.update_dchub)
|
|
|
- core_dc->hwss.update_dchub(core_dc->hwseq, dh_data);
|
|
|
+ if (dc->hwss.update_dchub)
|
|
|
+ dc->hwss.update_dchub(dc->hwseq, dh_data);
|
|
|
else
|
|
|
- ASSERT(core_dc->hwss.update_dchub);
|
|
|
+ ASSERT(dc->hwss.update_dchub);
|
|
|
|
|
|
|
|
|
return true;
|
|
@@ -1933,9 +1899,8 @@ bool dc_init_dchub(struct dc *dc, struct dchub_init_data *dh_data)
|
|
|
|
|
|
void dc_log_hw_state(struct dc *dc)
|
|
|
{
|
|
|
- struct dc *core_dc = dc;
|
|
|
|
|
|
- if (core_dc->hwss.log_hw_state)
|
|
|
- core_dc->hwss.log_hw_state(core_dc);
|
|
|
+ if (dc->hwss.log_hw_state)
|
|
|
+ dc->hwss.log_hw_state(dc);
|
|
|
}
|
|
|
|