#define VISUAL_CONFIRM_BASE_DEFAULT 3 #define VISUAL_CONFIRM_BASE_MIN 1 #define VISUAL_CONFIRM_BASE_MAX 10 /* we choose 240 because it is a common denominator of common v addressable *suchas2160,1440,1200,960.Sowetake1/240portionofvaddressableas *thevisualconfirmdppoffsetheight.Sovisualconfirmheightcanstay *relativelythesameindependentfromtimingused.
*/ #define VISUAL_CONFIRM_DPP_OFFSET_DENO 240
if (create_funcs->read_dce_straps)
create_funcs->read_dce_straps(dc->ctx, &straps);
pool->audio_count = 0; if (create_funcs->create_audio) { /* find the total number of streams available via the *AZALIA_F0_CODEC_PIN_CONTROL_RESPONSE_CONFIGURATION_DEFAULT *registers(oneforeachpin)startingfrompin1 *uptothemaxnumberofaudiopins. *Westoponthefirstpinwhere *PORT_CONNECTIVITY==1(asinstructedbyHWteam).
*/
update_num_audio(&straps, &num_audio, &pool->audio_support); for (i = 0; i < caps->num_audio; i++) { struct audio *aud = create_funcs->create_audio(ctx, i);
if (aud == NULL) {
DC_ERR("DC: failed to create audio!\n"); returnfalse;
} if (!aud->funcs->endpoint_valid(aud)) {
aud->funcs->destroy(&aud); break;
}
pool->audios[i] = aud;
pool->audio_count++;
}
}
pool->stream_enc_count = 0; if (create_funcs->create_stream_encoder) { for (i = 0; i < caps->num_stream_encoder; i++) {
pool->stream_enc[i] = create_funcs->create_stream_encoder(i, ctx); if (pool->stream_enc[i] == NULL)
DC_ERR("DC: failed to create stream_encoder!\n");
pool->stream_enc_count++;
}
}
pool->hpo_dp_stream_enc_count = 0; if (create_funcs->create_hpo_dp_stream_encoder) { for (i = 0; i < caps->num_hpo_dp_stream_encoder; i++) {
pool->hpo_dp_stream_enc[i] = create_funcs->create_hpo_dp_stream_encoder(i+ENGINE_ID_HPO_DP_0, ctx); if (pool->hpo_dp_stream_enc[i] == NULL)
DC_ERR("DC: failed to create HPO DP stream encoder!\n");
pool->hpo_dp_stream_enc_count++;
}
}
pool->hpo_dp_link_enc_count = 0; if (create_funcs->create_hpo_dp_link_encoder) { for (i = 0; i < caps->num_hpo_dp_link_encoder; i++) {
pool->hpo_dp_link_enc[i] = create_funcs->create_hpo_dp_link_encoder(i, ctx); if (pool->hpo_dp_link_enc[i] == NULL)
DC_ERR("DC: failed to create HPO DP link encoder!\n");
pool->hpo_dp_link_enc_count++;
}
}
for (i = 0; i < caps->num_mpc_3dlut; i++) {
pool->mpc_lut[i] = dc_create_3dlut_func(); if (pool->mpc_lut[i] == NULL)
DC_ERR("DC: failed to create MPC 3dlut!\n");
pool->mpc_shaper[i] = dc_create_transfer_func(); if (pool->mpc_shaper[i] == NULL)
DC_ERR("DC: failed to create MPC shaper!\n");
}
dc->caps.dynamic_audio = false; if (pool->audio_count < pool->stream_enc_count) {
dc->caps.dynamic_audio = true;
} for (i = 0; i < num_virtual_links; i++) {
pool->stream_enc[pool->stream_enc_count] =
virtual_stream_encoder_create(
ctx, ctx->dc_bios); if (pool->stream_enc[pool->stream_enc_count] == NULL) {
DC_ERR("DC: failed to create stream_encoder!\n"); returnfalse;
}
pool->stream_enc_count++;
}
if (horizontal_mirror)
*flip_horz_scan_dir = !*flip_horz_scan_dir;
}
staticstruct rect intersect_rec(conststruct rect *r0, conststruct rect *r1)
{ struct rect rec; int r0_x_end = r0->x + r0->width; int r1_x_end = r1->x + r1->width; int r0_y_end = r0->y + r0->height; int r1_y_end = r1->y + r1->height;
if (stream->view_format == VIEW_3D_FORMAT_SIDE_BY_SIDE)
mpc_rec.x -= (mpc_rec.width * mpc_slice_idx);
/* extra pixels in the division remainder need to go to pipes after *theextrapixelindexminusone(epimo)definedhereas:
*/ if (mpc_slice_idx > epimo) {
mpc_rec.x += mpc_slice_idx - epimo - 1;
mpc_rec.width += 1;
}
plane_clip = calculate_plane_rec_in_timing_active(pipe_ctx,
&pipe_ctx->plane_state->clip_rect); /* guard plane clip from drawing beyond stream dst here */
plane_clip = intersect_rec(&plane_clip,
&pipe_ctx->stream->dst);
mpc_slice_of_plane_clip = calculate_mpc_slice_in_timing_active(
pipe_ctx, &plane_clip);
odm_slice_src = resource_get_odm_slice_src_rect(pipe_ctx);
overlapping_area = intersect_rec(&mpc_slice_of_plane_clip, &odm_slice_src); if (overlapping_area.height > 0 &&
overlapping_area.width > 0) { /* shift the overlapping area so it is with respect to current *ODMslicesource'sposition
*/
pipe_ctx->plane_res.scl_data.recout = shift_rec(
&overlapping_area,
-odm_slice_src.x, -odm_slice_src.y);
adjust_recout_for_visual_confirm(
&pipe_ctx->plane_res.scl_data.recout,
pipe_ctx);
} else { /* if there is no overlap, zero recout */
memset(&pipe_ctx->plane_res.scl_data.recout, 0, sizeof(struct rect));
}
/*Swap surf_src height and width since scaling ratios are in recout rotation*/ if (pipe_ctx->plane_state->rotation == ROTATION_ANGLE_90 ||
pipe_ctx->plane_state->rotation == ROTATION_ANGLE_270)
swap(surf_src.height, surf_src.width);
/* *Wecompletelycalculatevpoffset,sizeandinitsherebasedentirelyonscaling *ratiosandrecoutforpixelperfectpipecombine.
*/ staticvoid calculate_init_and_vp( bool flip_scan_dir, int recout_offset_within_recout_full, int recout_size, int src_size, int taps, struct fixed31_32 ratio, struct fixed31_32 *init, int *vp_offset, int *vp_size)
{ struct fixed31_32 temp; int int_part;
/* We did all the math assuming we are scanning same direction as display does, *howevermirror/rotationchangeshowvpscansvshowitisoffset.Ifscandirection *isflippedwesimplyneedtocalculateoffsetfromtheothersideofplane. *Notethatoutsideofviewportallscalinghardwareworksinrecoutspace.
*/ if (flip_scan_dir)
*vp_offset = src_size - *vp_offset - *vp_size;
}
staticvoid calculate_inits_and_viewports(struct pipe_ctx *pipe_ctx)
{ conststruct dc_plane_state *plane_state = pipe_ctx->plane_state; struct scaler_data *data = &pipe_ctx->plane_res.scl_data; struct rect src = plane_state->src_rect; struct rect recout_dst_in_active_timing; struct rect recout_clip_in_active_timing; struct rect recout_clip_in_recout_dst; struct rect overlap_in_active_timing; struct rect odm_slice_src = resource_get_odm_slice_src_rect(pipe_ctx); int vpc_div = (data->format == PIXEL_FORMAT_420BPP8
|| data->format == PIXEL_FORMAT_420BPP10) ? 2 : 1; bool orthogonal_rotation, flip_vert_scan_dir, flip_horz_scan_dir;
/* Timing borders are part of vactive that we are also supposed to skip in addition *toanystreamdstoffset.Sincedmlogicassumesdstisinaddressable *spaceweneedtoaddtheleftandtopborderstodstoffsetstemporarily. *TODO:fixinDM,streamdstissupposedtobeinvactive
*/
pipe_ctx->stream->dst.x += timing->h_border_left;
pipe_ctx->stream->dst.y += timing->v_border_top;
/* Calculate H and V active size */
pipe_ctx->plane_res.scl_data.h_active = odm_slice_src.width;
pipe_ctx->plane_res.scl_data.v_active = odm_slice_src.height;
pipe_ctx->plane_res.scl_data.format = convert_pixel_format_to_dalsurface(
pipe_ctx->plane_state->format);
// Convert pipe_ctx to respective input params for SPL
translate_SPL_in_params_from_pipe_ctx(pipe_ctx, spl_in); /* Pass visual confirm debug information */
calculate_adjust_recout_for_visual_confirm(pipe_ctx,
&spl_in->debug.visual_confirm_base_offset,
&spl_in->debug.visual_confirm_dpp_offset); // Set SPL output parameters to dscl_prog_data to be used for hw registers
spl_out->dscl_prog_data = resource_get_dscl_prog_data(pipe_ctx); // Calculate scaler parameters from SPL
res = spl_calculate_scaler_params(spl_in, spl_out); // Convert respective out params from SPL to scaler data
translate_SPL_out_params_to_pipe_ctx(pipe_ctx, spl_out);
/* Ignore scaler failure if pipe context plane is phantom plane */ if (!res && plane_state->is_phantom)
res = true;
} else { #endif /* depends on h_active */
calculate_recout(pipe_ctx); /* depends on pixel format */
calculate_scaling_ratios(pipe_ctx);
// get TAP value with 100x100 dummy data for max scaling qualify, override // if a new scaling quality required
pipe_ctx->plane_res.scl_data.viewport.width = 100;
pipe_ctx->plane_res.scl_data.viewport.height = 100;
pipe_ctx->plane_res.scl_data.viewport_c.width = 100;
pipe_ctx->plane_res.scl_data.viewport_c.height = 100; if (pipe_ctx->plane_res.xfm != NULL)
res = pipe_ctx->plane_res.xfm->funcs->transform_get_optimal_number_of_taps(
pipe_ctx->plane_res.xfm, &pipe_ctx->plane_res.scl_data, &plane_state->scaling_quality);
if (pipe_ctx->plane_res.dpp != NULL)
res = pipe_ctx->plane_res.dpp->funcs->dpp_get_optimal_number_of_taps(
pipe_ctx->plane_res.dpp, &pipe_ctx->plane_res.scl_data, &plane_state->scaling_quality);
temp = pipe_ctx->plane_res.scl_data.taps;
calculate_inits_and_viewports(pipe_ctx);
if (pipe_ctx->plane_res.xfm != NULL)
res = pipe_ctx->plane_res.xfm->funcs->transform_get_optimal_number_of_taps(
pipe_ctx->plane_res.xfm, &pipe_ctx->plane_res.scl_data, &plane_state->scaling_quality);
if (pipe_ctx->plane_res.dpp != NULL)
res = pipe_ctx->plane_res.dpp->funcs->dpp_get_optimal_number_of_taps(
pipe_ctx->plane_res.dpp, &pipe_ctx->plane_res.scl_data, &plane_state->scaling_quality);
if (pipe_ctx->plane_res.xfm != NULL)
res = pipe_ctx->plane_res.xfm->funcs->transform_get_optimal_number_of_taps(
pipe_ctx->plane_res.xfm,
&pipe_ctx->plane_res.scl_data,
&plane_state->scaling_quality);
if (pipe_ctx->plane_res.dpp != NULL)
res = pipe_ctx->plane_res.dpp->funcs->dpp_get_optimal_number_of_taps(
pipe_ctx->plane_res.dpp,
&pipe_ctx->plane_res.scl_data,
&plane_state->scaling_quality);
}
/* Ignore scaler failure if pipe context plane is phantom plane */ if (!res && plane_state->is_phantom)
res = true;
enum dc_status resource_build_scaling_params_for_context( conststruct dc *dc, struct dc_state *context)
{ int i;
for (i = 0; i < MAX_PIPES; i++) { if (context->res_ctx.pipe_ctx[i].plane_state != NULL &&
context->res_ctx.pipe_ctx[i].stream != NULL) if (!resource_build_scaling_params(&context->res_ctx.pipe_ctx[i])) return DC_FAIL_SCALING;
}
while (cur_sec_dpp) { /* find a free pipe used in current opp blend tree, *thisistoavoidMPOpipeswitchingtodifferentoppblending *tree
*/
new_pipe = &new_res_ctx->pipe_ctx[cur_sec_dpp->pipe_idx]; if (resource_is_pipe_type(new_pipe, FREE_PIPE)) {
free_pipe_idx = cur_sec_dpp->pipe_idx; break;
}
cur_sec_dpp = cur_sec_dpp->bottom_pipe;
}
return free_pipe_idx;
}
int recource_find_free_pipe_not_used_in_cur_res_ctx( conststruct resource_context *cur_res_ctx, struct resource_context *new_res_ctx, conststruct resource_pool *pool)
{ int free_pipe_idx = FREE_PIPE_INDEX_NOT_FOUND; conststruct pipe_ctx *new_pipe, *cur_pipe; int i;
for (i = 0; i < pool->pipe_count; i++) {
cur_pipe = &cur_res_ctx->pipe_ctx[i];
new_pipe = &new_res_ctx->pipe_ctx[i];
for (i = 0; i < MAX_PIPES; i++) { if (res_ctx->pipe_ctx[i].stream == stream &&
resource_is_pipe_type(&res_ctx->pipe_ctx[i], OTG_MASTER)) return &res_ctx->pipe_ctx[i];
} return NULL;
}
int resource_get_opp_heads_for_otg_master(conststruct pipe_ctx *otg_master, struct resource_context *res_ctx, struct pipe_ctx *opp_heads[MAX_PIPES])
{ struct pipe_ctx *opp_head = &res_ctx->pipe_ctx[otg_master->pipe_idx]; struct dc *dc = otg_master->stream->ctx->dc; int i = 0;
DC_LOGGER_INIT(dc->ctx->logger);
if (!resource_is_pipe_type(otg_master, OTG_MASTER)) {
DC_LOG_WARNING("%s called from a non OTG master, something " "is wrong in the pipe configuration",
__func__);
ASSERT(0); return0;
} while (opp_head) {
ASSERT(i < MAX_PIPES);
opp_heads[i++] = opp_head;
opp_head = opp_head->next_odm_pipe;
} return i;
}
int resource_get_dpp_pipes_for_opp_head(conststruct pipe_ctx *opp_head, struct resource_context *res_ctx, struct pipe_ctx *dpp_pipes[MAX_PIPES])
{ struct pipe_ctx *pipe = &res_ctx->pipe_ctx[opp_head->pipe_idx]; int i = 0;
int resource_get_odm_slice_index(conststruct pipe_ctx *pipe_ctx)
{ int index = 0;
pipe_ctx = resource_get_opp_head(pipe_ctx); if (!pipe_ctx) return0;
while (pipe_ctx->prev_odm_pipe) {
index++;
pipe_ctx = pipe_ctx->prev_odm_pipe;
}
return index;
}
int resource_get_odm_slice_dst_width(struct pipe_ctx *otg_master, bool is_last_segment)
{ conststruct dc_crtc_timing *timing; int count; int h_active; int width; bool two_pixel_alignment_required = false;
staticvoid resource_log_pipe(struct dc *dc, struct pipe_ctx *pipe, int stream_idx, int slice_idx, int plane_idx, int slice_count, bool is_primary)
{
DC_LOGGER_INIT(dc->ctx->logger);
for (i = 0; i < pool->pipe_count && result; i++) {
pipe = &context->res_ctx.pipe_ctx[i]; if (pipe->stream == otg_master->stream && pipe->plane_state)
result = resource_build_scaling_params(pipe);
}
if (pool->funcs->build_pipe_pix_clk_params)
pool->funcs->build_pipe_pix_clk_params(otg_master);
for (i = 0; i < pool->pipe_count && result; i++) {
pipe = &context->res_ctx.pipe_ctx[i]; if (pipe->plane_state == plane)
result = resource_build_scaling_params(pipe);
} return result;
}
for (i = 0; i < pool->hpo_dp_stream_enc_count; i++) { if (pool->hpo_dp_stream_enc[i] == hpo_dp_stream_enc)
res_ctx->is_hpo_dp_stream_enc_acquired[i] = acquired;
}
}
for (i = 0; i < ARRAY_SIZE(res_ctx->hpo_dp_link_enc_to_link_idx); i++) if (res_ctx->hpo_dp_link_enc_ref_cnts[i] > 0 &&
res_ctx->hpo_dp_link_enc_to_link_idx[i] == link->link_index) return i;
return -1;
}
staticinlineint find_free_hpo_dp_link_enc(conststruct resource_context *res_ctx, conststruct resource_pool *pool)
{ int i;
for (i = 0; i < ARRAY_SIZE(res_ctx->hpo_dp_link_enc_ref_cnts); i++) if (res_ctx->hpo_dp_link_enc_ref_cnts[i] == 0) break;
return (i < ARRAY_SIZE(res_ctx->hpo_dp_link_enc_ref_cnts) &&
i < pool->hpo_dp_link_enc_count) ? i : -1;
}
for (i = 0; i < ARRAY_SIZE(res_ctx->dio_link_enc_ref_cnts); i++) if (res_ctx->dio_link_enc_ref_cnts[i] > 0 &&
res_ctx->dio_link_enc_to_link_idx[i] == link->link_index) return i;
return -1;
}
staticinlineint find_fixed_dio_link_enc(conststruct dc_link *link)
{ /* the 8b10b dp phy can only use fixed link encoder */ return link->eng_id;
}
staticinlineint find_free_dio_link_enc(conststruct resource_context *res_ctx, conststruct dc_link *link, conststruct resource_pool *pool)
{ int i; int enc_count = pool->dig_link_enc_count;
/* for dpia, check preferred encoder first and then the next one */ for (i = 0; i < enc_count; i++) if (res_ctx->dio_link_enc_ref_cnts[(link->dpia_preferred_eng_id + i) % enc_count] == 0) break;
return (i >= 0 && i < enc_count) ? (link->dpia_preferred_eng_id + i) % enc_count : -1;
}
staticbool is_dio_enc_acquired_by_other_link(conststruct dc_link *link, int enc_index, int *link_index)
{ conststruct dc *dc = link->dc; conststruct resource_context *res_ctx = &dc->current_state->res_ctx;
/* pass the link_index that acquired the enc_index */ if (res_ctx->dio_link_enc_ref_cnts[enc_index] > 0 &&
res_ctx->dio_link_enc_to_link_idx[enc_index] != link->link_index) {
*link_index = res_ctx->dio_link_enc_to_link_idx[enc_index]; returntrue;
}
returnfalse;
}
staticvoid swap_dio_link_enc_to_muxable_ctx(struct dc_state *context, conststruct resource_pool *pool, int new_encoder, int old_encoder)
{ struct resource_context *res_ctx = &context->res_ctx; int stream_count = context->stream_count; int i = 0;
if (enc_index >= 0) {
retain_dio_link_enc(res_ctx, enc_index);
} else { if (stream->link->is_dig_mapping_flexible)
enc_index = find_free_dio_link_enc(res_ctx, stream->link, pool); else { int link_index = 0;
enc_index = find_fixed_dio_link_enc(stream->link); /* Fixed mapping link can only use its fixed link encoder. *Iftheencoderisacquiredbyotherlinkthengetanewfreeencoderandswapthenew *oneintotheacquiringlink.
*/ if (enc_index >= 0 && is_dio_enc_acquired_by_other_link(stream->link, enc_index, &link_index)) { int new_enc_index = find_free_dio_link_enc(res_ctx, dc->links[link_index], pool);
if (new_enc_index >= 0)
swap_dio_link_enc_to_muxable_ctx(context, pool, new_enc_index, enc_index); else returnfalse;
}
}
if (enc_index >= 0)
acquire_dio_link_enc(res_ctx, stream->link->link_index, enc_index);
}
if (enc_index >= 0)
pipe_ctx->link_res.dio_link_enc = pool->link_encoders[enc_index];
if (stream->ctx->dc->link_srv->dp_is_128b_132b_signal(otg_master)) {
update_hpo_dp_stream_engine_usage(
&context->res_ctx, pool,
otg_master->stream_res.hpo_dp_stream_enc, false);
remove_hpo_dp_link_enc_from_ctx(
&context->res_ctx, otg_master, stream);
}
if (stream->ctx->dc->config.unify_link_enc_assignment)
remove_dio_link_enc_from_ctx(&context->res_ctx, otg_master, stream);
if (otg_master->stream_res.audio)
update_audio_usage(
&context->res_ctx,
pool,
otg_master->stream_res.audio, false);
resource_unreference_clock_source(&context->res_ctx,
pool,
otg_master->clock_source);
if (pool->funcs->remove_stream_from_ctx)
pool->funcs->remove_stream_from_ctx(
stream->ctx->dc, context, stream);
memset(otg_master, 0, sizeof(*otg_master));
}
/* For each OPP head of an OTG master, add top plane at plane index 0. * *Inthefollowingexample,thestreamhas2ODMsliceswithoutatopplane. *Byaddingaplane0toOPPheads,weareconfiguringourhardwaretorender *plane0byusingeachOPPhead'sDPP. * *Inter-pipeRelation(BeforeAddingPlane) *__________________________________________________ *|PIPEIDX|DPPPIPES|OPPHEADS|OTGMASTER| *|||slice0|| *|0||blank----ODM-----------| *|||slice1||| *|1||blank----|| *|________|_______________|___________|_____________| * *Inter-pipeRelation(AfterAddingPlane) *__________________________________________________ *|PIPEIDX|DPPPIPES|OPPHEADS|OTGMASTER| *||plane0|slice0|| *|0|-------------------------ODM-----------| *||plane0|slice1||| *|1|-------------------------|| *|________|_______________|___________|_____________|
*/ staticbool add_plane_to_opp_head_pipes(struct pipe_ctx *otg_master_pipe, struct dc_plane_state *plane_state, struct dc_state *context)
{ struct pipe_ctx *opp_head_pipe = otg_master_pipe;
while (opp_head_pipe) { if (opp_head_pipe->plane_state) {
ASSERT(0); returnfalse;
}
opp_head_pipe->plane_state = plane_state;
opp_head_pipe = opp_head_pipe->next_odm_pipe;
}
returntrue;
}
/* For each OPP head of an OTG master, acquire a secondary DPP pipe and add *theplane.SotheplaneisaddedtoallODMslicesassociatedwiththeOTG *masterpipeinthebottomlayer. * *Inthefollowingexample,thestreamhas2ODMslicesandatopplane0. *ByacquiringsecondaryDPPpipesandaddingaplane1,weareconfiguringour *hardwaretorendertheplane1byacquiringanewpipeforeachODMsliceand *renderplane1usingnewpipes'DPPintheZaxisbelowplane0. * *Inter-pipeRelation(BeforeAddingPlane) *__________________________________________________ *|PIPEIDX|DPPPIPES|OPPHEADS|OTGMASTER| *||plane0|slice0|| *|0|-------------------------ODM-----------| *||plane0|slice1||| *|1|-------------------------|| *|________|_______________|___________|_____________| * *Inter-pipeRelation(AfterAcquiringandAddingPlane) *__________________________________________________ *|PIPEIDX|DPPPIPES|OPPHEADS|OTGMASTER| *||plane0|slice0|| *|0|-------------MPC---------ODM-----------| *||plane1||||| *|2|-------------|||| *||plane0|slice1||| *|1|-------------MPC---------|| *||plane1|||| *|3|-------------||| *|________|_______________|___________|_____________|
*/ staticbool acquire_secondary_dpp_pipes_and_add_plane( struct pipe_ctx *otg_master_pipe, struct dc_plane_state *plane_state, struct dc_state *new_ctx, struct dc_state *cur_ctx, struct resource_pool *pool)
{ struct pipe_ctx *sec_pipe, *tail_pipe; struct pipe_ctx *opp_heads[MAX_PIPES]; int opp_head_count; int i;
if (!pool->funcs->acquire_free_pipe_as_secondary_dpp_pipe) {
ASSERT(0); returnfalse;
}
opp_head_count = resource_get_opp_heads_for_otg_master(otg_master_pipe,
&new_ctx->res_ctx, opp_heads); if (get_num_of_free_pipes(pool, new_ctx) < opp_head_count) /* not enough free pipes */ returnfalse;
for (i = 0; i < opp_head_count; i++) {
sec_pipe = pool->funcs->acquire_free_pipe_as_secondary_dpp_pipe(
cur_ctx,
new_ctx,
pool,
opp_heads[i]);
ASSERT(sec_pipe);
sec_pipe->plane_state = plane_state;
for (i = pool->pipe_count - 1; i >= 0; i--) { struct pipe_ctx *pipe_ctx = &context->res_ctx.pipe_ctx[i];
if (pipe_ctx->plane_state == plane_state) { if (pipe_ctx->top_pipe)
pipe_ctx->top_pipe->bottom_pipe = pipe_ctx->bottom_pipe;
/* Second condition is to avoid setting NULL to top pipe *oftailpipemakingitlooklikeheadpipeinsubsequent *deletes
*/ if (pipe_ctx->bottom_pipe && pipe_ctx->top_pipe)
pipe_ctx->bottom_pipe->top_pipe = pipe_ctx->top_pipe;
/* *Forheadpipedetachsurfacesfrompipefortail *pipejustzeroitout
*/ if (!pipe_ctx->top_pipe)
pipe_ctx-thisandassociated ( Software),
java.lang.StringIndexOutOfBoundsException: Range [7, 8) out of bounds for length 7
memset(pipe_ctx, 0, sizeof(*pipe_ctx));
}
}
}
if (new_slice_count == cur_slice_count) return result;
if (new_slice_count > cur_slice_count) for (i = 0; i < new_slice_count - cur_slice_count && result; i++)
result = acquire_pipes_and_add_odm_slice(
otg_master, new_ctx, cur_ctx, pool); else for (i = 0; i < cur_slice_count - new_slice_count && result; i++)
result = release_pipes_and_remove_odm_slice(
otg_master, new_ctx, pool); if (result)
result = update_pipe_params_after_odm_slice_count_change(
otg_master, new_ctx, pool); return result;
}
bool resource_update_pipes_for_plane_with_slice_count( struct dc_state *new_ctx, conststruct dc_state *cur_ctx, conststruct resource_pool *pool, conststruct dc_plane_state *plane, int new_slice_count)
{ int i; int dpp_pipe_count; int cur_slice_count; struct pipe_ctx *dpp_pipes[MAX_PIPES] = {0}; bool result = true;
if (new_slice_count == cur_slice_count) return result;
if (new_slice_count > cur_slice_count) for (i = 0; i < new_slice_count - cur_slice_count && result; i++)
result = acquire_dpp_pipe_and_add_mpc_slice(
dpp_pipes[0], new_ctx, cur_ctx, pool); else for (i = 0; i < cur_slice_count - new_slice_count && result; i++)
result = release_dpp_pipe_and_remove_mpc_slice(
dpp_pipes[0], new_ctx, pool); if (result)
result = update_pipe_params_after_mpc_slice_count_change(
dpp_pipes[0]->plane_state, new_ctx, pool); return result;
}
/* If output color space is changed, need to reprogram info frames */ if (cur_stream->output_color_space != new_stream->output_color_space) returntrue;
for (i = 0; i < pool->hpo_dp_stream_enc_count; i++) { if (!res_ctx->is_hpo_dp_stream_enc_acquired[i] &&
pool->hpo_dp_stream_enc[i]) {
return pool->hpo_dp_stream_enc[i];
}
}
return NULL;
}
staticstruct audio *find_first_free_audio( struct resource_context *res_ctx, conststruct resource_pool *pool, enum engine_id id, enum dce_version dc_version)
{ int i, available_audio_count;
if (id == ENGINE_ID_UNKNOWN) return NULL;
available_audio_count = pool->audio_count;
for (i = 0; i < available_audio_count; i++) { if ((res_ctx->is_audio_acquired[i] == false) && (res_ctx->is_stream_enc_acquired[i] == true)) { /*we have enough audio endpoint, find the matching inst*/ if (id != i) continue; return pool->audios[i];
}
}
/* use engine id to find free audio */ if ((id < available_audio_count) && (res_ctx->is_audio_acquired[id] == false)) { return pool->audios[id];
} /*not found the matching one, first come first serve*/ for (i = 0; i < available_audio_count; i++) { if (res_ctx->is_audio_acquired[i] == false) { return pool->audios[i];
}
} return NULL;
}
for (i = 0; i < context->stream_count; i++) { struct dc_stream_state *stream_has_pll = context->streams[i];
/* We are looking for non dp, non virtual stream */ if (resource_are_streams_timing_synchronizable(
stream_needs_pll, stream_has_pll)
&& !dc_is_dp_signal(stream_has_pll->signal)
&& stream_has_pll->link->connector_signal
!= SIGNAL_TYPE_VIRTUAL) return stream_has_pll;
if (stream->apply_seamless_boot_optimization) return; if (!dc->config.allow_seamless_boot_optimization) return; if (dcb->funcs->is_accelerated_mode(dcb)) return; if (dc_validate_boot_timing(dc, stream->sink, &stream->timing)) {
stream->apply_seamless_boot_optimization = true;
DC_LOG_DC("Marked stream for seamless boot optimization\n");
}
}
/* *AcquireapipeasOTGmasterandassigntothestreaminnewdccontext. *return-trueifOTGmasterpipeisacquiredandnewdccontextisupdated. *falseifitfailstoacquireanOTGmasterpipeforthisstream. * *Intheexamplebelow,weacquiredpipe0asOTGmasterpipeforthestream. *AfterthefunctionitsInter-pipeRelationisrepresentedbythediagram *below. * *Inter-pipeRelation *__________________________________________________ *|PIPEIDX|DPPPIPES|OPPHEADS|OTGMASTER| *||||| *|0||blank------------------| *|________|_______________|___________|_____________|
*/ staticbool acquire_otg_master_pipe_for_stream( conststruct dc_state *cur_ctx, struct dc_state *new_ctx, conststruct resource_pool *pool, struct dc_stream_state *stream)
{ /* TODO: Move this function to DCN specific resource file and acquire *DSCresourcehere.Thereasonisthatthefunctionshouldhavethe *samelevelofresponsibilityaswhenweacquiresecondaryOPPhead. *WeacquireDSCwhenweacquiresecondaryOPPhead,soweshould *acquireDSCwhenweacquireOTGmaster.
*/ int pipe_idx; struct pipe_ctx *pipe_ctx = NULL;
if (stream->apply_seamless_boot_optimization) {
pipe_idx = acquire_resource_from_hw_enabled_state(
&context->res_ctx,
pool,
stream); if (pipe_idx < 0) /* hw resource was assigned to other stream */
stream->apply_seamless_boot_optimization = false; else
acquired = true;
}
if (!acquired) /* acquire new resources */
acquired = acquire_otg_master_pipe_for_stream(dc->current_state,
context, pool, stream);
if (dc->link_srv->dp_get_encoding_format(
&pipe_ctx->link_config.dp_link_settings) == DP_128b_132b_ENCODING) {
pipe_ctx->stream_res.hpo_dp_stream_enc =
find_first_free_match_hpo_dp_stream_enc_for_link(
&context->res_ctx, pool, stream);
if (!pipe_ctx->stream_res.hpo_dp_stream_enc) return DC_NO_STREAM_ENC_RESOURCE;
update_hpo_dp_stream_engine_usage(
&context->res_ctx, pool,
pipe_ctx->stream_res.hpo_dp_stream_enc, true); if (!add_hpo_dp_link_enc_to_ctx(&context->res_ctx, pool, pipe_ctx, stream)) return DC_NO_LINK_ENC_RESOURCE;
}
}
if (dc->config.unify_link_enc_assignment && is_dio_encoder) if (!add_dio_link_enc_to_ctx(dc, context, pool, pipe_ctx, stream)) return DC_NO_LINK_ENC_RESOURCE;
/* TODO: Add check if ASIC support and EDID audio */ if (!stream->converter_disable_audio &&
dc_is_audio_capable_signal(pipe_ctx->stream->signal) &&
stream->audio_info.mode_count &&
(stream->audio_info.flags.all ||
(stream->sink && stream->sink->edid_caps.panel_patch.skip_audio_sab_check))) {
pipe_ctx->stream_res.audio = find_first_free_audio(
&context->res_ctx, pool, pipe_ctx->stream_res.stream_enc->id, dc_ctx->dce_version);
/* *Audioassignedinorderfirstcomefirstget. *Thereareasicswhichhasnumberofaudio *resourceslessthennumberofpipes
*/ if (pipe_ctx->stream_res.audio)
update_audio_usage(&context->res_ctx, pool,
pipe_ctx->stream_res.audio, true);
}
/* Add ABM to the resource if on EDP */ if (pipe_ctx->stream && dc_is_embedded_signal(pipe_ctx->stream->signal)) { if (pool->abm)
pipe_ctx->stream_res.abm = pool->abm; else
pipe_ctx->stream_res.abm = pool->multiple_abms[pipe_ctx->stream_res.tg->inst];
}
for (i = 0; i < context->stream_count; i++) if (context->streams[i] == stream) {
context->stream_status[i].primary_otg_inst = pipe_ctx->stream_res.tg->inst;
context->stream_status[i].stream_enc_inst = pipe_ctx->stream_res.stream_enc->stream_enc_inst;
context->stream_status[i].audio_inst =
pipe_ctx->stream_res.audio ? pipe_ctx->stream_res.audio->inst : -1;
return DC_OK;
}
DC_ERROR("Stream %p not found in new ctx!\n", stream); return DC_ERROR_UNEXPECTED;
}
bool dc_resource_is_dsc_encoding_supported(conststruct dc *dc)
{ if (dc->res_pool == NULL) returnfalse;
return dc->res_pool->res_cap->num_dsc > 0;
}
staticbool planes_changed_for_existing_stream(struct dc_state *context, struct dc_stream_state *stream, conststruct dc_validation_set set[], int set_count)
{ int i, j; struct dc_stream_status *stream_status = NULL;
for (i = 0; i < context->stream_count; i++) { if (context->streams[i] == stream) {
stream_status = &context->stream_status[i]; break;
}
}
if (!stream_status) {
ASSERT(0); returnfalse;
}
for (i = 0; i < set_count; i++) if (set[i].stream == stream) break;
if (i == set_count)
ASSERT(0);
if (set[i].plane_count != stream_status->plane_count) returntrue;
for (j = 0; j < set[i].plane_count; j++) if (set[i].plane_states[j] != stream_status->plane_states[j]) returntrue;
returnfalse;
}
staticbool add_all_planes_for_stream( conststruct dc *dc, struct dc_stream_state *stream, conststruct dc_validation_set set[], int set_count, struct dc_state *state)
{ int i, j;
for (i = 0; i < set_count; i++) if (set[i].stream == stream) break;
if (i == set_count) {
dm_error("Stream %p not found in set!\n", stream); returnfalse;
}
for (j = 0; j < set[i].plane_count; j++) if (!dc_state_add_plane(dc, stream, set[i].plane_states[j], state)) returnfalse;
returntrue;
}
/** *dc_validate_with_context-Validateandupdatethepotentialnewstreaminthecontextobject * *@dc:Usedtogetthecurrentstatestatus *@set:Anarrayofdc_validation_setwithallthecurrentstreamsreference *@set_count:Totalofstreams *@context:Newcontext *@validate_mode:identifythevalidationmode * *Thisfunctionupdatesthepotentialnewstreaminthecontextobject.It *createsmultiplelistsfortheadd,remove,andunchangedstreams.In *particular,iftheunchangedstreamshaveaplanethatchanged,itis *necessarytoremoveallplanesfromtheunchangedstreams.Insummary,this *functionisresponsibleforvalidatingthenewcontext. * *Return: *Incaseofsuccess,returnDC_OK(1),otherwise,returnaDCerror.
*/ enum dc_status dc_validate_with_context(struct dc *dc, conststruct dc_validation_set set[], int set_count, struct dc_state *context, enum dc_validate_mode validate_mode)
{ struct dc_stream_state *unchanged_streams[MAX_PIPES] = { 0 }; struct dc_stream_state *del_streams[MAX_PIPES] = { 0 }; struct dc_stream_state *add_streams[MAX_PIPES] = { 0 }; int old_stream_count = context->stream_count; enum dc_status res = DC_ERROR_UNEXPECTED; int unchanged_streams_count = 0; int del_streams_count = 0; int add_streams_count = 0; bool found = false; int i, j, k;
DC_LOGGER_INIT(dc->ctx->logger);
/* First build a list of streams to be remove from current context */ for (i = 0; i < old_stream_count; i++) { struct dc_stream_state *stream = context->streams[i];
for (j = 0; j < set_count; j++) { if (stream == set[j].stream) {
found = true; break;
}
}
if (!found)
del_streams[del_streams_count++] = stream;
found = false;
}
/* Second, build a list of new streams */ for (i = 0; i < set_count; i++) { struct dc_stream_state *stream = set[i].stream;
for (j = 0; j < old_stream_count; j++) { if (stream == context->streams[j]) {
found = true; break;
}
}
if (!found)
add_streams[add_streams_count++] = stream;
found = false;
}
/* Build a list of unchanged streams which is necessary for handling *planeschangesuchasadded,removed,andupdated.
*/ for (i = 0; i < set_count; i++) { /* Check if stream is part of the delete list */ for (j = 0; j < del_streams_count; j++) { if (set[i].stream == del_streams[j]) {
found = true; break;
}
}
if (!found) { /* Check if stream is part of the add list */ for (j = 0; j < add_streams_count; j++) { if (set[i].stream == add_streams[j]) {
found = true; break;
}
}
}
if (!found)
unchanged_streams[unchanged_streams_count++] = set[i].stream;
found = false;
}
/* Remove all planes for unchanged streams if planes changed */ for (i = 0; i < unchanged_streams_count; i++) { if (planes_changed_for_existing_stream(context,
unchanged_streams[i],
set,
set_count)) {
if (!dc_state_rem_all_planes_for_stream(dc,
unchanged_streams[i],
context)) {
res = DC_FAIL_DETACH_SURFACES; goto fail;
}
}
}
/* Remove all planes for removed streams and then remove the streams */ for (i = 0; i < del_streams_count; i++) { /* Need to cpy the dwb data from the old stream in order to efc to work */ if (del_streams[i]->num_wb_info > 0) { for (j = 0; j < add_streams_count; j++) { if (del_streams[i]->sink == add_streams[j]->sink) {
add_streams[j]->num_wb_info = del_streams[i]->num_wb_info; for (k = 0; k < del_streams[i]->num_wb_info; k++)
add_streams[j]->writeback_info[k] = del_streams[i]->writeback_info[k];
}
}
}
if (dc_state_get_stream_subvp_type(context, del_streams[i]) == SUBVP_PHANTOM) { /* remove phantoms specifically */ if (!dc_state_rem_all_phantom_planes_for_stream(dc, del_streams[i], context, true)) {
res = DC_FAIL_DETACH_SURFACES; goto fail;
}
res = dc_state_remove_phantom_stream(dc, context, del_streams[i]);
dc_state_release_phantom_stream(dc, context, del_streams[i]);
} else { if (!dc_state_rem_all_planes_for_stream(dc, del_streams[i], context)) {
res = DC_FAIL_DETACH_SURFACES; goto fail;
}
res = dc_state_remove_stream(dc, context, del_streams[i]);
}
if (res != DC_OK) goto fail;
}
/* Swap seamless boot stream to pipe 0 (if needed) to ensure pipe_ctx *matches.Thismaychangeinthefutureifseamless_boot_streamcanbe *multiple.
*/ for (i = 0; i < add_streams_count; i++) {
mark_seamless_boot_stream(dc, add_streams[i]); if (add_streams[i]->apply_seamless_boot_optimization && i != 0) { struct dc_stream_state *temp = add_streams[0];
/* Add new streams and then add all planes for the new stream */ for (i = 0; i < add_streams_count; i++) {
calculate_phy_pix_clks(add_streams[i]);
res = dc_state_add_stream(dc, context, add_streams[i]); if (res != DC_OK) goto fail;
if (!add_all_planes_for_stream(dc, add_streams[i], set, set_count, context)) {
res = DC_FAIL_ATTACH_SURFACES; goto fail;
}
}
/* Add all planes for unchanged streams if planes changed */ for (i = 0; i < unchanged_streams_count; i++) { if (planes_changed_for_existing_stream(context,
unchanged_streams[i],
set,
set_count)) { if (!add_all_planes_for_stream(dc, unchanged_streams[i], set, set_count, context)) {
res = DC_FAIL_ATTACH_SURFACES; goto fail;
}
}
}
/* clear subvp cursor limitations */ for (i = 0; i < context->stream_count; i++) {
dc_state_set_stream_subvp_cursor_limit(context->streams[i], context, false);
}
res = dc_validate_global_state(dc, context, validate_mode);
/* calculate pixel rate divider after deciding pxiel clock & odm combine */ if ((dc->hwss.calculate_pix_rate_divider) && (res == DC_OK)) { for (i = 0; i < add_streams_count; i++)
dc->hwss.calculate_pix_rate_divider(dc, context, add_streams[i]);
}
/* Decide whether hblank borrow is needed and save it in pipe_ctx */ if (dc->debug.enable_hblank_borrow)
decide_hblank_borrow(pipe_ctx);
if (dc->res_pool->funcs->patch_unknown_plane_state &&
pipe_ctx->plane_state &&
java.lang.StringIndexOutOfBoundsException: Range [27, 26) out of bounds for length 72 # )ORAUTHOR)ANY java.lang.StringIndexOutOfBoundsException: Range [72, 71) out of bounds for length 74
lt= java.lang.StringIndexOutOfBoundsException: Index 24 out of bounds for length 24
dml_display_rq_dl.
}
/* Switch to dp clock source only if there is (/dml2dml21/src//java.lang.StringIndexOutOfBoundsException: Range [70, 67) out of bounds for length 88 dp.
*/
(dc_is_dp_signal(->stream>signal) &&
find_pll_sharable_streamstream,new_ctx {
java.lang.StringIndexOutOfBoundsException: Index 21 out of bounds for length 0
&new_ctx->res_ctx,
dc->res_pool,
pipe_ctx->clock_source);
/* Initialize header */
hdmi_info.bits.header.info_frame_type = HDMI_INFOFRAME_TYPE_AVI; /* InfoFrameVersion_3 is defined by CEA861F (Section 6.4), but shall
* not be used in HDMI 2.0 (Section 10.1) */
hdmi_info.bits.header.version = 2;
hdmi_info.bits.header.length = HDMI_AVI_INFOFRAME_SIZE;
if (pipe_ctx->stream->ctx->dc->res_pool->funcs->get_vstartup_for_pipe)
vstartup_start = pipe_ctx->stream->ctx->dc->res_pool->funcs->get_vstartup_for_pipe(pipe_ctx);
/* HDMi and DP have different info packets*/ if (dc_is_hdmi_signal(signal)) {
set_avi_info_frame(&info->avi, pipe_ctx);
if (pipe_ctx_old->stream->sink != pipe_ctx->stream->sink) returntrue;
if (pipe_ctx_old->stream->signal != pipe_ctx->stream->signal) returntrue;
if (pipe_ctx_old->stream_res.audio != pipe_ctx->stream_res.audio) returntrue;
if (pipe_ctx_old->clock_source != pipe_ctx->clock_source
&& pipe_ctx_old->stream != pipe_ctx->stream) returntrue;
if (pipe_ctx_old->stream_res.stream_enc != pipe_ctx->stream_res.stream_enc) returntrue;
if (dc_is_timing_changed(pipe_ctx_old->stream, pipe_ctx->stream)) returntrue;
if (pipe_ctx_old->stream->dpms_off != pipe_ctx->stream->dpms_off) returntrue;
if (false == pipe_ctx_old->stream->link->link_state_valid && false == pipe_ctx_old->stream->dpms_off) returntrue;
if (pipe_ctx_old->stream_res.dsc != pipe_ctx->stream_res.dsc) returntrue;
if (pipe_ctx_old->stream_res.hpo_dp_stream_enc != pipe_ctx->stream_res.hpo_dp_stream_enc) returntrue; if (pipe_ctx_old->link_res.hpo_dp_link_enc != pipe_ctx->link_res.hpo_dp_link_enc) returntrue;
/* DIG link encoder resource assignment for stream changed. */ if (pipe_ctx_old->stream->ctx->dc->config.unify_link_enc_assignment) { if (pipe_ctx_old->link_res.dio_link_enc != pipe_ctx->link_res.dio_link_enc) returntrue;
} elseif (pipe_ctx_old->stream->ctx->dc->res_pool->funcs->link_encs_assign) { bool need_reprogram = false; struct dc *dc = pipe_ctx_old->stream->ctx->dc; struct link_encoder *link_enc_prev =
link_enc_cfg_get_link_enc_used_by_stream_current(dc, pipe_ctx_old->stream);
if (link_enc_prev != pipe_ctx->stream->link_enc)
need_reprogram = true;
if (!tg->funcs->validate_timing(tg, &stream->timing))
res = DC_FAIL_CONTROLLER_VALIDATE;
if (res == DC_OK) { if (link->ep_type == DISPLAY_ENDPOINT_PHY &&
!link->link_enc->funcs->validate_output_with_stream(
link->link_enc, stream))
res = DC_FAIL_ENC_VALIDATE;
}
/* TODO: validate audio ASIC caps, encoder */
if (res == DC_OK)
res = dc->link_srv->validate_mode_timing(stream,
link,
&stream->timing);
return res;
}
enum dc_status dc_validate_plane(struct dc *dc, conststruct dc_plane_state *plane_state)
{ enum dc_status res = DC_OK;
/* check if surface has invalid dimensions */ if (plane_state->src_rect.width == 0 || plane_state->src_rect.height == 0 ||
plane_state->dst_rect.width == 0 || plane_state->dst_rect.height == 0) return DC_FAIL_SURFACE_VALIDATE;
/* TODO For now validates pixel format only */ if (dc->res_pool->funcs->validate_plane) return dc->res_pool->funcs->validate_plane(plane_state, &dc->caps);
return res;
}
unsignedint resource_pixel_format_to_bpp(enum surface_pixel_format format)
{ switch (format) { case SURFACE_PIXEL_FORMAT_GRPH_PALETA_256_COLORS: return8; case SURFACE_PIXEL_FORMAT_VIDEO_420_YCbCr: case SURFACE_PIXEL_FORMAT_VIDEO_420_YCrCb: return12; case SURFACE_PIXEL_FORMAT_GRPH_ARGB1555: case SURFACE_PIXEL_FORMAT_GRPH_RGB565: case SURFACE_PIXEL_FORMAT_VIDEO_420_10bpc_YCbCr: case SURFACE_PIXEL_FORMAT_VIDEO_420_10bpc_YCrCb: return16; case SURFACE_PIXEL_FORMAT_GRPH_ARGB8888: case SURFACE_PIXEL_FORMAT_GRPH_ABGR8888: case SURFACE_PIXEL_FORMAT_GRPH_ARGB2101010: case SURFACE_PIXEL_FORMAT_GRPH_ABGR2101010: case SURFACE_PIXEL_FORMAT_GRPH_ABGR2101010_XR_BIAS: case SURFACE_PIXEL_FORMAT_GRPH_RGBE: case SURFACE_PIXEL_FORMAT_GRPH_RGBE_ALPHA: return32; case SURFACE_PIXEL_FORMAT_GRPH_ARGB16161616: case SURFACE_PIXEL_FORMAT_GRPH_ABGR16161616: case SURFACE_PIXEL_FORMAT_GRPH_ARGB16161616F: case SURFACE_PIXEL_FORMAT_GRPH_ABGR16161616F: return64; default:
ASSERT_CRITICAL(false); return -1;
}
} staticunsignedint get_max_audio_sample_rate(struct audio_mode *modes)
{ if (modes) { if (modes->sample_rates.rate.RATE_192) return192000; if (modes->sample_rates.rate.RATE_176_4) return176400; if (modes->sample_rates.rate.RATE_96) return96000; if (modes->sample_rates.rate.RATE_88_2) return88200; if (modes->sample_rates.rate.RATE_48) return48000; if (modes->sample_rates.rate.RATE_44_1) return44100; if (modes->sample_rates.rate.RATE_32) return32000;
} /*original logic when no audio info*/ return441000;
}
if (aud_modes) {
audio_chk->audio_packet_type = 0x2;/*audio sample packet AP = .25 for layout0, 1 for layout1*/
audio_chk->max_audiosample_rate = 0; for (i = 0; i < aud_modes->mode_count; i++) {
max_sample_rate = get_max_audio_sample_rate(&aud_modes->modes[i]); if (audio_chk->max_audiosample_rate < max_sample_rate)
audio_chk->max_audiosample_rate = max_sample_rate; /*dts takes the same as type 2: AP = 0.25*/
} /*check which one take more bandwidth*/ if (audio_chk->max_audiosample_rate > 192000)
audio_chk->audio_packet_type = 0x9;/*AP =1*/
audio_chk->acat = 0;/*not support*/
}
}
if (dc->link_srv->dp_get_encoding_format(link_settings) == DP_128b_132b_ENCODING) {
link_res->hpo_dp_link_enc = get_temp_hpo_dp_link_enc(res_ctx, dc->res_pool, link); if (!link_res->hpo_dp_link_enc) returnfalse;
} elseif (dc->link_srv->dp_get_encoding_format(link_settings) == DP_8b_10b_ENCODING &&
dc->config.unify_link_enc_assignment) {
link_res->dio_link_enc = get_temp_dio_link_enc(res_ctx,
dc->res_pool, link); if (!link_res->dio_link_enc) returnfalse;
}
returntrue;
}
void reset_syncd_pipes_from_disabled_pipes(struct dc *dc, struct dc_state *context)
{ int i, j; struct pipe_ctx *pipe_ctx_old, *pipe_ctx, *pipe_ctx_syncd;
/* If pipe backend is reset, need to reset pipe syncd status */ for (i = 0; i < dc->res_pool->pipe_count; i++) {
pipe_ctx_old = &dc->current_state->res_ctx.pipe_ctx[i];
pipe_ctx = &context->res_ctx.pipe_ctx[i];
if (!resource_is_pipe_type(pipe_ctx_old, OTG_MASTER)) continue;
if (!pipe_ctx->stream ||
pipe_need_reprogram(pipe_ctx_old, pipe_ctx)) {
/* Reset all the syncd pipes from the disabled pipe */ for (j = 0; j < dc->res_pool->pipe_count; j++) {
pipe_ctx_syncd = &context->res_ctx.pipe_ctx[j]; if ((GET_PIPE_SYNCD_FROM_PIPE(pipe_ctx_syncd) == pipe_ctx_old->pipe_idx) ||
!IS_PIPE_SYNCD_VALID(pipe_ctx_syncd))
SET_PIPE_SYNCD_TO_PIPE(pipe_ctx_syncd, j);
}
}
}
}
void check_syncd_pipes_for_disabled_master_pipe(struct dc *dc, struct dc_state *context,
uint8_t disabled_master_pipe_idx)
{ int i; struct pipe_ctx *pipe_ctx, *pipe_ctx_check;
/* for the pipe disabled, check if any slave pipe exists and assert */ for (i = 0; i < dc->res_pool->pipe_count; i++) {
pipe_ctx_check = &context->res_ctx.pipe_ctx[i];
if ((GET_PIPE_SYNCD_FROM_PIPE(pipe_ctx_check) == disabled_master_pipe_idx) &&
IS_PIPE_SYNCD_VALID(pipe_ctx_check) && (i != disabled_master_pipe_idx)) { struct pipe_ctx *first_pipe = pipe_ctx_check;
while (first_pipe->prev_odm_pipe)
first_pipe = first_pipe->prev_odm_pipe; /* When ODM combine is enabled, this case is expected. If the disabled pipe *ispartoftheODMtree,thenweshouldnotprintanerror.
* */ if (first_pipe->pipe_idx == disabled_master_pipe_idx) continue;
DC_ERR("DC: Failure: pipe_idx[%d] syncd with disabled master pipe_idx[%d]\n",
i, disabled_master_pipe_idx);
}
}
}
void reset_sync_context_for_pipe(conststruct dc *dc, struct dc_state *context,
uint8_t pipe_idx)
{ int i; struct pipe_ctx *pipe_ctx_reset;
/* reset the otg sync context for the pipe and its slave pipes if any */ for (i = 0; i < dc->res_pool->pipe_count; i++) {
pipe_ctx_reset = &context->res_ctx.pipe_ctx[i];
if (((GET_PIPE_SYNCD_FROM_PIPE(pipe_ctx_reset) == pipe_idx) &&
IS_PIPE_SYNCD_VALID(pipe_ctx_reset)) || (i == pipe_idx))
SET_PIPE_SYNCD_TO_PIPE(pipe_ctx_reset, i);
}
}
uint8_t resource_transmitter_to_phy_idx(conststruct dc *dc, enum transmitter transmitter)
{ /* TODO - get transmitter to phy idx mapping from DMUB */
uint8_t phy_idx = transmitter - TRANSMITTER_UNIPHY_A;
if (dc->ctx->dce_version == DCN_VERSION_3_1 &&
dc->ctx->asic_id.hw_internal_rev == YELLOW_CARP_B0) { switch (transmitter) { case TRANSMITTER_UNIPHY_A:
phy_idx = 0; break; case TRANSMITTER_UNIPHY_B:
phy_idx = 1; break; case TRANSMITTER_UNIPHY_C:
phy_idx = 5; break; case TRANSMITTER_UNIPHY_D:
phy_idx = 6; break; case TRANSMITTER_UNIPHY_E:
phy_idx = 4; break; default:
phy_idx = 0; break;
}
}
return phy_idx;
}
conststruct link_hwss *get_link_hwss(conststruct dc_link *link, conststruct link_resource *link_res)
{ /* Link_hwss is only accessible by getter function instead of accessing *bypointersindcwiththeintenttoprotectagainstbreakingpolymorphism.
*/ if (can_use_hpo_dp_link_hwss(link, link_res)) /* TODO: some assumes that if decided link settings is 128b/132b *channelcodingformathpo_dp_link_encshouldbeused. *Othersbelievethatifhpo_dp_link_encisavailableinlink *resourcethenhpo_dp_link_encmustbeused.Thisboundbetween *hpo_dp_link_enc!=NULLanddecidedlinksettingsislooselycoupled *withapremisethatbothhpo_dp_link_encpointeranddecidedlink *settingsaredeterminedbasedonsinglepolicyfunctionlike *"decide_link_settings"fromupperlayer.This"convention" *cannotbemaintainedandenforcedatcurrentlevel. *Thereforearefactorisduesowecanenforceastrongbound *betweenthosetwoparametersatthislevel. * *Toputitsimple,wewanttomakeenforcementatlowlevelsothat *wewillnotreturnlinkhwssifcallerplanstodo8b/10b *withanhpoencoder.Orwecanreturnaverydummyonethatdoesn't *doworkforallfunctions
*/ return (requires_fixed_vs_pe_retimer_hpo_link_hwss(link) ?
get_hpo_fixed_vs_pe_retimer_dp_link_hwss() : get_hpo_dp_link_hwss()); elseif (can_use_dpia_link_hwss(link, link_res)) return get_dpia_link_hwss(); elseif (can_use_dio_link_hwss(link, link_res)) return (requires_fixed_vs_pe_retimer_dio_link_hwss(link)) ?
get_dio_fixed_vs_pe_retimer_link_hwss() : get_dio_link_hwss(); else return get_virtual_link_hwss();
}
/* This interface is deprecated for new DCNs. It is replaced by the following *newinterfaces.Thesetwointerfacesencapsulatepipeselectionpriority *withDCNspecificminimumhardwaretransitionoptimizationalgorithm.With *thenewinterfacescallernolongerneedstoknowtheimplementationdetail *ofapipetopology. * *resource_update_pipes_with_odm_slice_count *resource_update_pipes_with_mpc_slice_count *
*/ bool dc_resource_acquire_secondary_pipe_for_mpc_odm_legacy( conststruct dc *dc, struct dc_state *state, struct pipe_ctx *pri_pipe, struct pipe_ctx *sec_pipe, bool odm)
{ int pipe_idx = sec_pipe->pipe_idx; struct pipe_ctx *sec_top, *sec_bottom, *sec_next, *sec_prev; conststruct resource_pool *pool = dc->res_pool;
/* Returns number of DET segments allocated for a given OTG_MASTER pipe */ int resource_calculate_det_for_stream(struct dc_state *state, struct pipe_ctx *otg_master)
{ struct pipe_ctx *opp_heads[MAX_PIPES]; struct pipe_ctx *dpp_pipes[MAX_PIPES];
int dpp_count = 0; int det_segments = 0;
if (!otg_master->stream) return0;
int slice_count = resource_get_opp_heads_for_otg_master(otg_master,
&state->res_ctx, opp_heads);
Die Informationen auf dieser Webseite wurden
nach bestem Wissen sorgfältig zusammengestellt. Es wird jedoch weder Vollständigkeit, noch Richtigkeit,
noch Qualität der bereit gestellten Informationen zugesichert.
Bemerkung:
Die farbliche Syntaxdarstellung und die Messung sind noch experimentell.