Commit 757af27b authored by Harry Wentland's avatar Harry Wentland Committed by Alex Deucher

drm/amd/display: Fix rest of pass-by-value structs in DML

Passing structs adds a lot of overhead. We don't ever want to pass
anything bigger than primitives by value.

This patch fixes these Coverity IDs:
Addresses-Coverity-ID: 1424031: ("Big parameter passed by value")
Addresses-Coverity-ID: 1424055: ("Big parameter passed by value")
Addresses-Coverity-ID: 1424072: ("Big parameter passed by value")
Addresses-Coverity-ID: 1423779: ("Big parameter passed by value")
Signed-off-by: default avatarHarry Wentland <harry.wentland@amd.com>
Cc: Nick Desaulniers <ndesaulniers@google.com>
Cc: Linus Torvalds <torvalds@linux-foundation.org>
Cc: amd-gfx@lists.freedesktop.org
Cc: Linux Kernel Mailing List <linux-kernel@vger.kernel.org>
Cc: Arnd Bergmann <arnd@kernel.org>
Cc: Leo Li <sunpeng.li@amd.com>
Cc: Alex Deucher <alexander.deucher@amd.com>
Cc: Christian König <christian.koenig@amd.com>
Cc: Xinhui Pan <Xinhui.Pan@amd.com>
Cc: Nathan Chancellor <nathan@kernel.org>
Cc: Guenter Roeck <linux@roeck-us.net>
Cc: llvm@lists.linux.dev
Acked-by: default avatarChristian König <christian.koenig@amd.com>
Build-tested-by: default avatarNathan Chancellor <nathan@kernel.org>
Reviewed-by: default avatarLeo Li <sunpeng.li@amd.com>
Signed-off-by: default avatarAlex Deucher <alexander.deucher@amd.com>
parent 4768349e
...@@ -502,15 +502,15 @@ static void dcn_bw_calc_rq_dlg_ttu( ...@@ -502,15 +502,15 @@ static void dcn_bw_calc_rq_dlg_ttu(
/*todo: soc->sr_enter_plus_exit_time??*/ /*todo: soc->sr_enter_plus_exit_time??*/
dlg_sys_param.t_srx_delay_us = dc->dcn_ip->dcfclk_cstate_latency / v->dcf_clk_deep_sleep; dlg_sys_param.t_srx_delay_us = dc->dcn_ip->dcfclk_cstate_latency / v->dcf_clk_deep_sleep;
dml1_rq_dlg_get_rq_params(dml, &rq_param, input.pipe.src); dml1_rq_dlg_get_rq_params(dml, &rq_param, &input.pipe.src);
dml1_extract_rq_regs(dml, rq_regs, rq_param); dml1_extract_rq_regs(dml, rq_regs, &rq_param);
dml1_rq_dlg_get_dlg_params( dml1_rq_dlg_get_dlg_params(
dml, dml,
dlg_regs, dlg_regs,
ttu_regs, ttu_regs,
rq_param.dlg, &rq_param.dlg,
dlg_sys_param, &dlg_sys_param,
input, &input,
true, true,
true, true,
v->pte_enable == dcn_bw_yes, v->pte_enable == dcn_bw_yes,
......
...@@ -166,30 +166,30 @@ static void extract_rq_sizing_regs( ...@@ -166,30 +166,30 @@ static void extract_rq_sizing_regs(
static void extract_rq_regs( static void extract_rq_regs(
struct display_mode_lib *mode_lib, struct display_mode_lib *mode_lib,
display_rq_regs_st *rq_regs, display_rq_regs_st *rq_regs,
const display_rq_params_st rq_param) const display_rq_params_st *rq_param)
{ {
unsigned int detile_buf_size_in_bytes = mode_lib->ip.det_buffer_size_kbytes * 1024; unsigned int detile_buf_size_in_bytes = mode_lib->ip.det_buffer_size_kbytes * 1024;
unsigned int detile_buf_plane1_addr = 0; unsigned int detile_buf_plane1_addr = 0;
extract_rq_sizing_regs(mode_lib, &(rq_regs->rq_regs_l), &rq_param.sizing.rq_l); extract_rq_sizing_regs(mode_lib, &(rq_regs->rq_regs_l), &rq_param->sizing.rq_l);
rq_regs->rq_regs_l.pte_row_height_linear = dml_floor( rq_regs->rq_regs_l.pte_row_height_linear = dml_floor(
dml_log2(rq_param.dlg.rq_l.dpte_row_height), dml_log2(rq_param->dlg.rq_l.dpte_row_height),
1) - 3; 1) - 3;
if (rq_param.yuv420) { if (rq_param->yuv420) {
extract_rq_sizing_regs(mode_lib, &(rq_regs->rq_regs_c), &rq_param.sizing.rq_c); extract_rq_sizing_regs(mode_lib, &(rq_regs->rq_regs_c), &rq_param->sizing.rq_c);
rq_regs->rq_regs_c.pte_row_height_linear = dml_floor( rq_regs->rq_regs_c.pte_row_height_linear = dml_floor(
dml_log2(rq_param.dlg.rq_c.dpte_row_height), dml_log2(rq_param->dlg.rq_c.dpte_row_height),
1) - 3; 1) - 3;
} }
rq_regs->rq_regs_l.swath_height = dml_log2(rq_param.dlg.rq_l.swath_height); rq_regs->rq_regs_l.swath_height = dml_log2(rq_param->dlg.rq_l.swath_height);
rq_regs->rq_regs_c.swath_height = dml_log2(rq_param.dlg.rq_c.swath_height); rq_regs->rq_regs_c.swath_height = dml_log2(rq_param->dlg.rq_c.swath_height);
// FIXME: take the max between luma, chroma chunk size? // FIXME: take the max between luma, chroma chunk size?
// okay for now, as we are setting chunk_bytes to 8kb anyways // okay for now, as we are setting chunk_bytes to 8kb anyways
if (rq_param.sizing.rq_l.chunk_bytes >= 32 * 1024) { //32kb if (rq_param->sizing.rq_l.chunk_bytes >= 32 * 1024) { //32kb
rq_regs->drq_expansion_mode = 0; rq_regs->drq_expansion_mode = 0;
} else { } else {
rq_regs->drq_expansion_mode = 2; rq_regs->drq_expansion_mode = 2;
...@@ -198,9 +198,9 @@ static void extract_rq_regs( ...@@ -198,9 +198,9 @@ static void extract_rq_regs(
rq_regs->mrq_expansion_mode = 1; rq_regs->mrq_expansion_mode = 1;
rq_regs->crq_expansion_mode = 1; rq_regs->crq_expansion_mode = 1;
if (rq_param.yuv420) { if (rq_param->yuv420) {
if ((double) rq_param.misc.rq_l.stored_swath_bytes if ((double) rq_param->misc.rq_l.stored_swath_bytes
/ (double) rq_param.misc.rq_c.stored_swath_bytes <= 1.5) { / (double) rq_param->misc.rq_c.stored_swath_bytes <= 1.5) {
detile_buf_plane1_addr = (detile_buf_size_in_bytes / 2.0 / 64.0); // half to chroma detile_buf_plane1_addr = (detile_buf_size_in_bytes / 2.0 / 64.0); // half to chroma
} else { } else {
detile_buf_plane1_addr = dml_round_to_multiple( detile_buf_plane1_addr = dml_round_to_multiple(
...@@ -215,7 +215,7 @@ static void extract_rq_regs( ...@@ -215,7 +215,7 @@ static void extract_rq_regs(
static void handle_det_buf_split( static void handle_det_buf_split(
struct display_mode_lib *mode_lib, struct display_mode_lib *mode_lib,
display_rq_params_st *rq_param, display_rq_params_st *rq_param,
const display_pipe_source_params_st pipe_src_param) const display_pipe_source_params_st *pipe_src_param)
{ {
unsigned int total_swath_bytes = 0; unsigned int total_swath_bytes = 0;
unsigned int swath_bytes_l = 0; unsigned int swath_bytes_l = 0;
...@@ -224,8 +224,8 @@ static void handle_det_buf_split( ...@@ -224,8 +224,8 @@ static void handle_det_buf_split(
unsigned int full_swath_bytes_packed_c = 0; unsigned int full_swath_bytes_packed_c = 0;
bool req128_l = false; bool req128_l = false;
bool req128_c = false; bool req128_c = false;
bool surf_linear = (pipe_src_param.sw_mode == dm_sw_linear); bool surf_linear = (pipe_src_param->sw_mode == dm_sw_linear);
bool surf_vert = (pipe_src_param.source_scan == dm_vert); bool surf_vert = (pipe_src_param->source_scan == dm_vert);
unsigned int log2_swath_height_l = 0; unsigned int log2_swath_height_l = 0;
unsigned int log2_swath_height_c = 0; unsigned int log2_swath_height_c = 0;
unsigned int detile_buf_size_in_bytes = mode_lib->ip.det_buffer_size_kbytes * 1024; unsigned int detile_buf_size_in_bytes = mode_lib->ip.det_buffer_size_kbytes * 1024;
...@@ -806,7 +806,7 @@ static void dml_rq_dlg_get_rq_params( ...@@ -806,7 +806,7 @@ static void dml_rq_dlg_get_rq_params(
} }
// calculate how to split the det buffer space between luma and chroma // calculate how to split the det buffer space between luma and chroma
handle_det_buf_split(mode_lib, rq_param, pipe_param->src); handle_det_buf_split(mode_lib, rq_param, &pipe_param->src);
print__rq_params_st(mode_lib, rq_param); print__rq_params_st(mode_lib, rq_param);
} }
...@@ -819,7 +819,7 @@ void dml21_rq_dlg_get_rq_reg( ...@@ -819,7 +819,7 @@ void dml21_rq_dlg_get_rq_reg(
memset(rq_regs, 0, sizeof(*rq_regs)); memset(rq_regs, 0, sizeof(*rq_regs));
dml_rq_dlg_get_rq_params(mode_lib, &rq_param, pipe_param); dml_rq_dlg_get_rq_params(mode_lib, &rq_param, pipe_param);
extract_rq_regs(mode_lib, rq_regs, rq_param); extract_rq_regs(mode_lib, rq_regs, &rq_param);
print__rq_regs_st(mode_lib, rq_regs); print__rq_regs_st(mode_lib, rq_regs);
} }
...@@ -833,8 +833,8 @@ static void dml_rq_dlg_get_dlg_params( ...@@ -833,8 +833,8 @@ static void dml_rq_dlg_get_dlg_params(
const unsigned int pipe_idx, const unsigned int pipe_idx,
display_dlg_regs_st *disp_dlg_regs, display_dlg_regs_st *disp_dlg_regs,
display_ttu_regs_st *disp_ttu_regs, display_ttu_regs_st *disp_ttu_regs,
const display_rq_dlg_params_st rq_dlg_param, const display_rq_dlg_params_st *rq_dlg_param,
const display_dlg_sys_params_st dlg_sys_param, const display_dlg_sys_params_st *dlg_sys_param,
const bool cstate_en, const bool cstate_en,
const bool pstate_en) const bool pstate_en)
{ {
...@@ -981,7 +981,7 @@ static void dml_rq_dlg_get_dlg_params( ...@@ -981,7 +981,7 @@ static void dml_rq_dlg_get_dlg_params(
* (double) ref_freq_to_pix_freq); * (double) ref_freq_to_pix_freq);
ASSERT(disp_dlg_regs->refcyc_h_blank_end < (unsigned int)dml_pow(2, 13)); ASSERT(disp_dlg_regs->refcyc_h_blank_end < (unsigned int)dml_pow(2, 13));
min_dcfclk_mhz = dlg_sys_param.deepsleep_dcfclk_mhz; min_dcfclk_mhz = dlg_sys_param->deepsleep_dcfclk_mhz;
t_calc_us = get_tcalc(mode_lib, e2e_pipe_param, num_pipes); t_calc_us = get_tcalc(mode_lib, e2e_pipe_param, num_pipes);
min_ttu_vblank = get_min_ttu_vblank(mode_lib, e2e_pipe_param, num_pipes, pipe_idx); min_ttu_vblank = get_min_ttu_vblank(mode_lib, e2e_pipe_param, num_pipes, pipe_idx);
...@@ -1042,13 +1042,13 @@ static void dml_rq_dlg_get_dlg_params( ...@@ -1042,13 +1042,13 @@ static void dml_rq_dlg_get_dlg_params(
scl_enable = scl->scl_enable; scl_enable = scl->scl_enable;
line_time_in_us = (htotal / pclk_freq_in_mhz); line_time_in_us = (htotal / pclk_freq_in_mhz);
swath_width_ub_l = rq_dlg_param.rq_l.swath_width_ub; swath_width_ub_l = rq_dlg_param->rq_l.swath_width_ub;
dpte_groups_per_row_ub_l = rq_dlg_param.rq_l.dpte_groups_per_row_ub; dpte_groups_per_row_ub_l = rq_dlg_param->rq_l.dpte_groups_per_row_ub;
swath_width_ub_c = rq_dlg_param.rq_c.swath_width_ub; swath_width_ub_c = rq_dlg_param->rq_c.swath_width_ub;
dpte_groups_per_row_ub_c = rq_dlg_param.rq_c.dpte_groups_per_row_ub; dpte_groups_per_row_ub_c = rq_dlg_param->rq_c.dpte_groups_per_row_ub;
meta_chunks_per_row_ub_l = rq_dlg_param.rq_l.meta_chunks_per_row_ub; meta_chunks_per_row_ub_l = rq_dlg_param->rq_l.meta_chunks_per_row_ub;
meta_chunks_per_row_ub_c = rq_dlg_param.rq_c.meta_chunks_per_row_ub; meta_chunks_per_row_ub_c = rq_dlg_param->rq_c.meta_chunks_per_row_ub;
vupdate_offset = dst->vupdate_offset; vupdate_offset = dst->vupdate_offset;
vupdate_width = dst->vupdate_width; vupdate_width = dst->vupdate_width;
vready_offset = dst->vready_offset; vready_offset = dst->vready_offset;
...@@ -1189,16 +1189,16 @@ static void dml_rq_dlg_get_dlg_params( ...@@ -1189,16 +1189,16 @@ static void dml_rq_dlg_get_dlg_params(
dml_print("DML_DLG: %s: vratio_pre_c=%3.2f\n", __func__, vratio_pre_c); dml_print("DML_DLG: %s: vratio_pre_c=%3.2f\n", __func__, vratio_pre_c);
// Active // Active
req_per_swath_ub_l = rq_dlg_param.rq_l.req_per_swath_ub; req_per_swath_ub_l = rq_dlg_param->rq_l.req_per_swath_ub;
req_per_swath_ub_c = rq_dlg_param.rq_c.req_per_swath_ub; req_per_swath_ub_c = rq_dlg_param->rq_c.req_per_swath_ub;
meta_row_height_l = rq_dlg_param.rq_l.meta_row_height; meta_row_height_l = rq_dlg_param->rq_l.meta_row_height;
meta_row_height_c = rq_dlg_param.rq_c.meta_row_height; meta_row_height_c = rq_dlg_param->rq_c.meta_row_height;
swath_width_pixels_ub_l = 0; swath_width_pixels_ub_l = 0;
swath_width_pixels_ub_c = 0; swath_width_pixels_ub_c = 0;
scaler_rec_in_width_l = 0; scaler_rec_in_width_l = 0;
scaler_rec_in_width_c = 0; scaler_rec_in_width_c = 0;
dpte_row_height_l = rq_dlg_param.rq_l.dpte_row_height; dpte_row_height_l = rq_dlg_param->rq_l.dpte_row_height;
dpte_row_height_c = rq_dlg_param.rq_c.dpte_row_height; dpte_row_height_c = rq_dlg_param->rq_c.dpte_row_height;
if (mode_422) { if (mode_422) {
swath_width_pixels_ub_l = swath_width_ub_l * 2; // *2 for 2 pixel per element swath_width_pixels_ub_l = swath_width_ub_l * 2; // *2 for 2 pixel per element
...@@ -1704,8 +1704,8 @@ void dml21_rq_dlg_get_dlg_reg( ...@@ -1704,8 +1704,8 @@ void dml21_rq_dlg_get_dlg_reg(
pipe_idx, pipe_idx,
dlg_regs, dlg_regs,
ttu_regs, ttu_regs,
rq_param.dlg, &rq_param.dlg,
dlg_sys_param, &dlg_sys_param,
cstate_en, cstate_en,
pstate_en); pstate_en);
dml_print("DML_DLG: Calculation for pipe[%d] end\n", pipe_idx); dml_print("DML_DLG: Calculation for pipe[%d] end\n", pipe_idx);
......
...@@ -113,28 +113,28 @@ static void extract_rq_sizing_regs(struct display_mode_lib *mode_lib, ...@@ -113,28 +113,28 @@ static void extract_rq_sizing_regs(struct display_mode_lib *mode_lib,
static void extract_rq_regs(struct display_mode_lib *mode_lib, static void extract_rq_regs(struct display_mode_lib *mode_lib,
display_rq_regs_st *rq_regs, display_rq_regs_st *rq_regs,
const display_rq_params_st rq_param) const display_rq_params_st *rq_param)
{ {
unsigned int detile_buf_size_in_bytes = mode_lib->ip.det_buffer_size_kbytes * 1024; unsigned int detile_buf_size_in_bytes = mode_lib->ip.det_buffer_size_kbytes * 1024;
unsigned int detile_buf_plane1_addr = 0; unsigned int detile_buf_plane1_addr = 0;
extract_rq_sizing_regs(mode_lib, &(rq_regs->rq_regs_l), &rq_param.sizing.rq_l); extract_rq_sizing_regs(mode_lib, &(rq_regs->rq_regs_l), &rq_param->sizing.rq_l);
rq_regs->rq_regs_l.pte_row_height_linear = dml_floor(dml_log2(rq_param.dlg.rq_l.dpte_row_height), rq_regs->rq_regs_l.pte_row_height_linear = dml_floor(dml_log2(rq_param->dlg.rq_l.dpte_row_height),
1) - 3; 1) - 3;
if (rq_param.yuv420) { if (rq_param->yuv420) {
extract_rq_sizing_regs(mode_lib, &(rq_regs->rq_regs_c), &rq_param.sizing.rq_c); extract_rq_sizing_regs(mode_lib, &(rq_regs->rq_regs_c), &rq_param->sizing.rq_c);
rq_regs->rq_regs_c.pte_row_height_linear = dml_floor(dml_log2(rq_param.dlg.rq_c.dpte_row_height), rq_regs->rq_regs_c.pte_row_height_linear = dml_floor(dml_log2(rq_param->dlg.rq_c.dpte_row_height),
1) - 3; 1) - 3;
} }
rq_regs->rq_regs_l.swath_height = dml_log2(rq_param.dlg.rq_l.swath_height); rq_regs->rq_regs_l.swath_height = dml_log2(rq_param->dlg.rq_l.swath_height);
rq_regs->rq_regs_c.swath_height = dml_log2(rq_param.dlg.rq_c.swath_height); rq_regs->rq_regs_c.swath_height = dml_log2(rq_param->dlg.rq_c.swath_height);
// FIXME: take the max between luma, chroma chunk size? // FIXME: take the max between luma, chroma chunk size?
// okay for now, as we are setting chunk_bytes to 8kb anyways // okay for now, as we are setting chunk_bytes to 8kb anyways
if (rq_param.sizing.rq_l.chunk_bytes >= 32 * 1024 || (rq_param.yuv420 && rq_param.sizing.rq_c.chunk_bytes >= 32 * 1024)) { //32kb if (rq_param->sizing.rq_l.chunk_bytes >= 32 * 1024 || (rq_param->yuv420 && rq_param->sizing.rq_c.chunk_bytes >= 32 * 1024)) { //32kb
rq_regs->drq_expansion_mode = 0; rq_regs->drq_expansion_mode = 0;
} else { } else {
rq_regs->drq_expansion_mode = 2; rq_regs->drq_expansion_mode = 2;
...@@ -143,9 +143,9 @@ static void extract_rq_regs(struct display_mode_lib *mode_lib, ...@@ -143,9 +143,9 @@ static void extract_rq_regs(struct display_mode_lib *mode_lib,
rq_regs->mrq_expansion_mode = 1; rq_regs->mrq_expansion_mode = 1;
rq_regs->crq_expansion_mode = 1; rq_regs->crq_expansion_mode = 1;
if (rq_param.yuv420) { if (rq_param->yuv420) {
if ((double)rq_param.misc.rq_l.stored_swath_bytes if ((double)rq_param->misc.rq_l.stored_swath_bytes
/ (double)rq_param.misc.rq_c.stored_swath_bytes <= 1.5) { / (double)rq_param->misc.rq_c.stored_swath_bytes <= 1.5) {
detile_buf_plane1_addr = (detile_buf_size_in_bytes / 2.0 / 64.0); // half to chroma detile_buf_plane1_addr = (detile_buf_size_in_bytes / 2.0 / 64.0); // half to chroma
} else { } else {
detile_buf_plane1_addr = dml_round_to_multiple((unsigned int)((2.0 * detile_buf_size_in_bytes) / 3.0), detile_buf_plane1_addr = dml_round_to_multiple((unsigned int)((2.0 * detile_buf_size_in_bytes) / 3.0),
...@@ -158,7 +158,7 @@ static void extract_rq_regs(struct display_mode_lib *mode_lib, ...@@ -158,7 +158,7 @@ static void extract_rq_regs(struct display_mode_lib *mode_lib,
static void handle_det_buf_split(struct display_mode_lib *mode_lib, static void handle_det_buf_split(struct display_mode_lib *mode_lib,
display_rq_params_st *rq_param, display_rq_params_st *rq_param,
const display_pipe_source_params_st pipe_src_param) const display_pipe_source_params_st *pipe_src_param)
{ {
unsigned int total_swath_bytes = 0; unsigned int total_swath_bytes = 0;
unsigned int swath_bytes_l = 0; unsigned int swath_bytes_l = 0;
...@@ -167,8 +167,8 @@ static void handle_det_buf_split(struct display_mode_lib *mode_lib, ...@@ -167,8 +167,8 @@ static void handle_det_buf_split(struct display_mode_lib *mode_lib,
unsigned int full_swath_bytes_packed_c = 0; unsigned int full_swath_bytes_packed_c = 0;
bool req128_l = false; bool req128_l = false;
bool req128_c = false; bool req128_c = false;
bool surf_linear = (pipe_src_param.sw_mode == dm_sw_linear); bool surf_linear = (pipe_src_param->sw_mode == dm_sw_linear);
bool surf_vert = (pipe_src_param.source_scan == dm_vert); bool surf_vert = (pipe_src_param->source_scan == dm_vert);
unsigned int log2_swath_height_l = 0; unsigned int log2_swath_height_l = 0;
unsigned int log2_swath_height_c = 0; unsigned int log2_swath_height_c = 0;
unsigned int detile_buf_size_in_bytes = mode_lib->ip.det_buffer_size_kbytes * 1024; unsigned int detile_buf_size_in_bytes = mode_lib->ip.det_buffer_size_kbytes * 1024;
...@@ -871,7 +871,7 @@ static void dml_rq_dlg_get_rq_params(struct display_mode_lib *mode_lib, ...@@ -871,7 +871,7 @@ static void dml_rq_dlg_get_rq_params(struct display_mode_lib *mode_lib,
} }
// calculate how to split the det buffer space between luma and chroma // calculate how to split the det buffer space between luma and chroma
handle_det_buf_split(mode_lib, rq_param, pipe_param->src); handle_det_buf_split(mode_lib, rq_param, &pipe_param->src);
print__rq_params_st(mode_lib, rq_param); print__rq_params_st(mode_lib, rq_param);
} }
...@@ -883,7 +883,7 @@ void dml30_rq_dlg_get_rq_reg(struct display_mode_lib *mode_lib, ...@@ -883,7 +883,7 @@ void dml30_rq_dlg_get_rq_reg(struct display_mode_lib *mode_lib,
memset(rq_regs, 0, sizeof(*rq_regs)); memset(rq_regs, 0, sizeof(*rq_regs));
dml_rq_dlg_get_rq_params(mode_lib, &rq_param, pipe_param); dml_rq_dlg_get_rq_params(mode_lib, &rq_param, pipe_param);
extract_rq_regs(mode_lib, rq_regs, rq_param); extract_rq_regs(mode_lib, rq_regs, &rq_param);
print__rq_regs_st(mode_lib, rq_regs); print__rq_regs_st(mode_lib, rq_regs);
} }
......
...@@ -196,26 +196,26 @@ static void extract_rq_sizing_regs(struct display_mode_lib *mode_lib, display_da ...@@ -196,26 +196,26 @@ static void extract_rq_sizing_regs(struct display_mode_lib *mode_lib, display_da
rq_regs->mpte_group_size = dml_log2(rq_sizing->mpte_group_bytes) - 6; rq_regs->mpte_group_size = dml_log2(rq_sizing->mpte_group_bytes) - 6;
} }
static void extract_rq_regs(struct display_mode_lib *mode_lib, display_rq_regs_st *rq_regs, const display_rq_params_st rq_param) static void extract_rq_regs(struct display_mode_lib *mode_lib, display_rq_regs_st *rq_regs, const display_rq_params_st *rq_param)
{ {
unsigned int detile_buf_size_in_bytes = mode_lib->ip.det_buffer_size_kbytes * 1024; unsigned int detile_buf_size_in_bytes = mode_lib->ip.det_buffer_size_kbytes * 1024;
unsigned int detile_buf_plane1_addr = 0; unsigned int detile_buf_plane1_addr = 0;
extract_rq_sizing_regs(mode_lib, &(rq_regs->rq_regs_l), &rq_param.sizing.rq_l); extract_rq_sizing_regs(mode_lib, &(rq_regs->rq_regs_l), &rq_param->sizing.rq_l);
rq_regs->rq_regs_l.pte_row_height_linear = dml_floor(dml_log2(rq_param.dlg.rq_l.dpte_row_height), 1) - 3; rq_regs->rq_regs_l.pte_row_height_linear = dml_floor(dml_log2(rq_param->dlg.rq_l.dpte_row_height), 1) - 3;
if (rq_param.yuv420) { if (rq_param->yuv420) {
extract_rq_sizing_regs(mode_lib, &(rq_regs->rq_regs_c), &rq_param.sizing.rq_c); extract_rq_sizing_regs(mode_lib, &(rq_regs->rq_regs_c), &rq_param->sizing.rq_c);
rq_regs->rq_regs_c.pte_row_height_linear = dml_floor(dml_log2(rq_param.dlg.rq_c.dpte_row_height), 1) - 3; rq_regs->rq_regs_c.pte_row_height_linear = dml_floor(dml_log2(rq_param->dlg.rq_c.dpte_row_height), 1) - 3;
} }
rq_regs->rq_regs_l.swath_height = dml_log2(rq_param.dlg.rq_l.swath_height); rq_regs->rq_regs_l.swath_height = dml_log2(rq_param->dlg.rq_l.swath_height);
rq_regs->rq_regs_c.swath_height = dml_log2(rq_param.dlg.rq_c.swath_height); rq_regs->rq_regs_c.swath_height = dml_log2(rq_param->dlg.rq_c.swath_height);
// FIXME: take the max between luma, chroma chunk size? // FIXME: take the max between luma, chroma chunk size?
// okay for now, as we are setting chunk_bytes to 8kb anyways // okay for now, as we are setting chunk_bytes to 8kb anyways
if (rq_param.sizing.rq_l.chunk_bytes >= 32 * 1024 || (rq_param.yuv420 && rq_param.sizing.rq_c.chunk_bytes >= 32 * 1024)) { //32kb if (rq_param->sizing.rq_l.chunk_bytes >= 32 * 1024 || (rq_param->yuv420 && rq_param->sizing.rq_c.chunk_bytes >= 32 * 1024)) { //32kb
rq_regs->drq_expansion_mode = 0; rq_regs->drq_expansion_mode = 0;
} else { } else {
rq_regs->drq_expansion_mode = 2; rq_regs->drq_expansion_mode = 2;
...@@ -225,8 +225,8 @@ static void extract_rq_regs(struct display_mode_lib *mode_lib, display_rq_regs_s ...@@ -225,8 +225,8 @@ static void extract_rq_regs(struct display_mode_lib *mode_lib, display_rq_regs_s
rq_regs->crq_expansion_mode = 1; rq_regs->crq_expansion_mode = 1;
// Note: detile_buf_plane1_addr is in unit of 1KB // Note: detile_buf_plane1_addr is in unit of 1KB
if (rq_param.yuv420) { if (rq_param->yuv420) {
if ((double) rq_param.misc.rq_l.stored_swath_bytes / (double) rq_param.misc.rq_c.stored_swath_bytes <= 1.5) { if ((double) rq_param->misc.rq_l.stored_swath_bytes / (double) rq_param->misc.rq_c.stored_swath_bytes <= 1.5) {
detile_buf_plane1_addr = (detile_buf_size_in_bytes / 2.0 / 1024.0); // half to chroma detile_buf_plane1_addr = (detile_buf_size_in_bytes / 2.0 / 1024.0); // half to chroma
#ifdef __DML_RQ_DLG_CALC_DEBUG__ #ifdef __DML_RQ_DLG_CALC_DEBUG__
dml_print("DML_DLG: %s: detile_buf_plane1_addr = %0d (1/2 to chroma)\n", __func__, detile_buf_plane1_addr); dml_print("DML_DLG: %s: detile_buf_plane1_addr = %0d (1/2 to chroma)\n", __func__, detile_buf_plane1_addr);
...@@ -244,14 +244,14 @@ static void extract_rq_regs(struct display_mode_lib *mode_lib, display_rq_regs_s ...@@ -244,14 +244,14 @@ static void extract_rq_regs(struct display_mode_lib *mode_lib, display_rq_regs_s
dml_print("DML_DLG: %s: detile_buf_size_in_bytes = %0d\n", __func__, detile_buf_size_in_bytes); dml_print("DML_DLG: %s: detile_buf_size_in_bytes = %0d\n", __func__, detile_buf_size_in_bytes);
dml_print("DML_DLG: %s: detile_buf_plane1_addr = %0d\n", __func__, detile_buf_plane1_addr); dml_print("DML_DLG: %s: detile_buf_plane1_addr = %0d\n", __func__, detile_buf_plane1_addr);
dml_print("DML_DLG: %s: plane1_base_address = %0d\n", __func__, rq_regs->plane1_base_address); dml_print("DML_DLG: %s: plane1_base_address = %0d\n", __func__, rq_regs->plane1_base_address);
dml_print("DML_DLG: %s: rq_l.stored_swath_bytes = %0d\n", __func__, rq_param.misc.rq_l.stored_swath_bytes); dml_print("DML_DLG: %s: rq_l.stored_swath_bytes = %0d\n", __func__, rq_param->misc.rq_l.stored_swath_bytes);
dml_print("DML_DLG: %s: rq_c.stored_swath_bytes = %0d\n", __func__, rq_param.misc.rq_c.stored_swath_bytes); dml_print("DML_DLG: %s: rq_c.stored_swath_bytes = %0d\n", __func__, rq_param->misc.rq_c.stored_swath_bytes);
dml_print("DML_DLG: %s: rq_l.swath_height = %0d\n", __func__, rq_param.dlg.rq_l.swath_height); dml_print("DML_DLG: %s: rq_l.swath_height = %0d\n", __func__, rq_param->dlg.rq_l.swath_height);
dml_print("DML_DLG: %s: rq_c.swath_height = %0d\n", __func__, rq_param.dlg.rq_c.swath_height); dml_print("DML_DLG: %s: rq_c.swath_height = %0d\n", __func__, rq_param->dlg.rq_c.swath_height);
#endif #endif
} }
static void handle_det_buf_split(struct display_mode_lib *mode_lib, display_rq_params_st *rq_param, const display_pipe_source_params_st pipe_src_param) static void handle_det_buf_split(struct display_mode_lib *mode_lib, display_rq_params_st *rq_param, const display_pipe_source_params_st *pipe_src_param)
{ {
unsigned int total_swath_bytes = 0; unsigned int total_swath_bytes = 0;
unsigned int swath_bytes_l = 0; unsigned int swath_bytes_l = 0;
...@@ -260,8 +260,8 @@ static void handle_det_buf_split(struct display_mode_lib *mode_lib, display_rq_p ...@@ -260,8 +260,8 @@ static void handle_det_buf_split(struct display_mode_lib *mode_lib, display_rq_p
unsigned int full_swath_bytes_packed_c = 0; unsigned int full_swath_bytes_packed_c = 0;
bool req128_l = 0; bool req128_l = 0;
bool req128_c = 0; bool req128_c = 0;
bool surf_linear = (pipe_src_param.sw_mode == dm_sw_linear); bool surf_linear = (pipe_src_param->sw_mode == dm_sw_linear);
bool surf_vert = (pipe_src_param.source_scan == dm_vert); bool surf_vert = (pipe_src_param->source_scan == dm_vert);
unsigned int log2_swath_height_l = 0; unsigned int log2_swath_height_l = 0;
unsigned int log2_swath_height_c = 0; unsigned int log2_swath_height_c = 0;
unsigned int detile_buf_size_in_bytes = mode_lib->ip.det_buffer_size_kbytes * 1024; unsigned int detile_buf_size_in_bytes = mode_lib->ip.det_buffer_size_kbytes * 1024;
...@@ -849,7 +849,7 @@ static void dml_rq_dlg_get_rq_params(struct display_mode_lib *mode_lib, display_ ...@@ -849,7 +849,7 @@ static void dml_rq_dlg_get_rq_params(struct display_mode_lib *mode_lib, display_
} }
// calculate how to split the det buffer space between luma and chroma // calculate how to split the det buffer space between luma and chroma
handle_det_buf_split(mode_lib, rq_param, pipe_param->src); handle_det_buf_split(mode_lib, rq_param, &pipe_param->src);
print__rq_params_st(mode_lib, rq_param); print__rq_params_st(mode_lib, rq_param);
} }
...@@ -859,7 +859,7 @@ void dml31_rq_dlg_get_rq_reg(struct display_mode_lib *mode_lib, display_rq_regs_ ...@@ -859,7 +859,7 @@ void dml31_rq_dlg_get_rq_reg(struct display_mode_lib *mode_lib, display_rq_regs_
memset(rq_regs, 0, sizeof(*rq_regs)); memset(rq_regs, 0, sizeof(*rq_regs));
dml_rq_dlg_get_rq_params(mode_lib, &rq_param, pipe_param); dml_rq_dlg_get_rq_params(mode_lib, &rq_param, pipe_param);
extract_rq_regs(mode_lib, rq_regs, rq_param); extract_rq_regs(mode_lib, rq_regs, &rq_param);
print__rq_regs_st(mode_lib, rq_regs); print__rq_regs_st(mode_lib, rq_regs);
} }
...@@ -943,8 +943,8 @@ static void dml_rq_dlg_get_dlg_params( ...@@ -943,8 +943,8 @@ static void dml_rq_dlg_get_dlg_params(
const unsigned int pipe_idx, const unsigned int pipe_idx,
display_dlg_regs_st *disp_dlg_regs, display_dlg_regs_st *disp_dlg_regs,
display_ttu_regs_st *disp_ttu_regs, display_ttu_regs_st *disp_ttu_regs,
const display_rq_dlg_params_st rq_dlg_param, const display_rq_dlg_params_st *rq_dlg_param,
const display_dlg_sys_params_st dlg_sys_param, const display_dlg_sys_params_st *dlg_sys_param,
const bool cstate_en, const bool cstate_en,
const bool pstate_en, const bool pstate_en,
const bool vm_en, const bool vm_en,
...@@ -1112,13 +1112,13 @@ static void dml_rq_dlg_get_dlg_params( ...@@ -1112,13 +1112,13 @@ static void dml_rq_dlg_get_dlg_params(
vratio_c = scl->vscl_ratio_c; vratio_c = scl->vscl_ratio_c;
scl_enable = scl->scl_enable; scl_enable = scl->scl_enable;
swath_width_ub_l = rq_dlg_param.rq_l.swath_width_ub; swath_width_ub_l = rq_dlg_param->rq_l.swath_width_ub;
dpte_groups_per_row_ub_l = rq_dlg_param.rq_l.dpte_groups_per_row_ub; dpte_groups_per_row_ub_l = rq_dlg_param->rq_l.dpte_groups_per_row_ub;
swath_width_ub_c = rq_dlg_param.rq_c.swath_width_ub; swath_width_ub_c = rq_dlg_param->rq_c.swath_width_ub;
dpte_groups_per_row_ub_c = rq_dlg_param.rq_c.dpte_groups_per_row_ub; dpte_groups_per_row_ub_c = rq_dlg_param->rq_c.dpte_groups_per_row_ub;
meta_chunks_per_row_ub_l = rq_dlg_param.rq_l.meta_chunks_per_row_ub; meta_chunks_per_row_ub_l = rq_dlg_param->rq_l.meta_chunks_per_row_ub;
meta_chunks_per_row_ub_c = rq_dlg_param.rq_c.meta_chunks_per_row_ub; meta_chunks_per_row_ub_c = rq_dlg_param->rq_c.meta_chunks_per_row_ub;
vupdate_offset = dst->vupdate_offset; vupdate_offset = dst->vupdate_offset;
vupdate_width = dst->vupdate_width; vupdate_width = dst->vupdate_width;
vready_offset = dst->vready_offset; vready_offset = dst->vready_offset;
...@@ -1239,16 +1239,16 @@ static void dml_rq_dlg_get_dlg_params( ...@@ -1239,16 +1239,16 @@ static void dml_rq_dlg_get_dlg_params(
dml_print("DML_DLG: %s: vratio_pre_c = %3.2f\n", __func__, vratio_pre_c); dml_print("DML_DLG: %s: vratio_pre_c = %3.2f\n", __func__, vratio_pre_c);
// Active // Active
req_per_swath_ub_l = rq_dlg_param.rq_l.req_per_swath_ub; req_per_swath_ub_l = rq_dlg_param->rq_l.req_per_swath_ub;
req_per_swath_ub_c = rq_dlg_param.rq_c.req_per_swath_ub; req_per_swath_ub_c = rq_dlg_param->rq_c.req_per_swath_ub;
meta_row_height_l = rq_dlg_param.rq_l.meta_row_height; meta_row_height_l = rq_dlg_param->rq_l.meta_row_height;
meta_row_height_c = rq_dlg_param.rq_c.meta_row_height; meta_row_height_c = rq_dlg_param->rq_c.meta_row_height;
swath_width_pixels_ub_l = 0; swath_width_pixels_ub_l = 0;
swath_width_pixels_ub_c = 0; swath_width_pixels_ub_c = 0;
scaler_rec_in_width_l = 0; scaler_rec_in_width_l = 0;
scaler_rec_in_width_c = 0; scaler_rec_in_width_c = 0;
dpte_row_height_l = rq_dlg_param.rq_l.dpte_row_height; dpte_row_height_l = rq_dlg_param->rq_l.dpte_row_height;
dpte_row_height_c = rq_dlg_param.rq_c.dpte_row_height; dpte_row_height_c = rq_dlg_param->rq_c.dpte_row_height;
if (mode_422) { if (mode_422) {
swath_width_pixels_ub_l = swath_width_ub_l * 2; // *2 for 2 pixel per element swath_width_pixels_ub_l = swath_width_ub_l * 2; // *2 for 2 pixel per element
...@@ -1712,8 +1712,8 @@ void dml31_rq_dlg_get_dlg_reg( ...@@ -1712,8 +1712,8 @@ void dml31_rq_dlg_get_dlg_reg(
pipe_idx, pipe_idx,
dlg_regs, dlg_regs,
ttu_regs, ttu_regs,
rq_param.dlg, &rq_param.dlg,
dlg_sys_param, &dlg_sys_param,
cstate_en, cstate_en,
pstate_en, pstate_en,
vm_en, vm_en,
......
...@@ -33,7 +33,7 @@ struct display_mode_lib; ...@@ -33,7 +33,7 @@ struct display_mode_lib;
void dml1_extract_rq_regs( void dml1_extract_rq_regs(
struct display_mode_lib *mode_lib, struct display_mode_lib *mode_lib,
struct _vcs_dpi_display_rq_regs_st *rq_regs, struct _vcs_dpi_display_rq_regs_st *rq_regs,
const struct _vcs_dpi_display_rq_params_st rq_param); const struct _vcs_dpi_display_rq_params_st *rq_param);
/* Function: dml_rq_dlg_get_rq_params /* Function: dml_rq_dlg_get_rq_params
* Calculate requestor related parameters that register definition agnostic * Calculate requestor related parameters that register definition agnostic
* (i.e. this layer does try to separate real values from register definition) * (i.e. this layer does try to separate real values from register definition)
...@@ -45,7 +45,7 @@ void dml1_extract_rq_regs( ...@@ -45,7 +45,7 @@ void dml1_extract_rq_regs(
void dml1_rq_dlg_get_rq_params( void dml1_rq_dlg_get_rq_params(
struct display_mode_lib *mode_lib, struct display_mode_lib *mode_lib,
struct _vcs_dpi_display_rq_params_st *rq_param, struct _vcs_dpi_display_rq_params_st *rq_param,
const struct _vcs_dpi_display_pipe_source_params_st pipe_src_param); const struct _vcs_dpi_display_pipe_source_params_st *pipe_src_param);
/* Function: dml_rq_dlg_get_dlg_params /* Function: dml_rq_dlg_get_dlg_params
...@@ -55,9 +55,9 @@ void dml1_rq_dlg_get_dlg_params( ...@@ -55,9 +55,9 @@ void dml1_rq_dlg_get_dlg_params(
struct display_mode_lib *mode_lib, struct display_mode_lib *mode_lib,
struct _vcs_dpi_display_dlg_regs_st *dlg_regs, struct _vcs_dpi_display_dlg_regs_st *dlg_regs,
struct _vcs_dpi_display_ttu_regs_st *ttu_regs, struct _vcs_dpi_display_ttu_regs_st *ttu_regs,
const struct _vcs_dpi_display_rq_dlg_params_st rq_dlg_param, const struct _vcs_dpi_display_rq_dlg_params_st *rq_dlg_param,
const struct _vcs_dpi_display_dlg_sys_params_st dlg_sys_param, const struct _vcs_dpi_display_dlg_sys_params_st *dlg_sys_param,
const struct _vcs_dpi_display_e2e_pipe_params_st e2e_pipe_param, const struct _vcs_dpi_display_e2e_pipe_params_st *e2e_pipe_param,
const bool cstate_en, const bool cstate_en,
const bool pstate_en, const bool pstate_en,
const bool vm_en, const bool vm_en,
......
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