mirror of
https://git.kernel.org/pub/scm/linux/kernel/git/herbert/cryptodev-2.6.git
synced 2026-04-23 05:56:14 -04:00
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: Harry 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: Christian König <christian.koenig@amd.com>
Build-tested-by: Nathan Chancellor <nathan@kernel.org>
Reviewed-by: Leo Li <sunpeng.li@amd.com>
Signed-off-by: Alex Deucher <alexander.deucher@amd.com>
This commit is contained in:
committed by
Alex Deucher
parent
4768349e88
commit
757af27b9f
@@ -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,
|
||||
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_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;
|
||||
|
||||
if (rq_param.yuv420) {
|
||||
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),
|
||||
if (rq_param->yuv420) {
|
||||
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_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_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);
|
||||
|
||||
// FIXME: take the max between luma, chroma chunk size?
|
||||
// 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;
|
||||
} else {
|
||||
rq_regs->drq_expansion_mode = 2;
|
||||
@@ -143,9 +143,9 @@ static void extract_rq_regs(struct display_mode_lib *mode_lib,
|
||||
rq_regs->mrq_expansion_mode = 1;
|
||||
rq_regs->crq_expansion_mode = 1;
|
||||
|
||||
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 (rq_param->yuv420) {
|
||||
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 / 64.0); // half to chroma
|
||||
} else {
|
||||
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,
|
||||
|
||||
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)
|
||||
const display_pipe_source_params_st *pipe_src_param)
|
||||
{
|
||||
unsigned int total_swath_bytes = 0;
|
||||
unsigned int swath_bytes_l = 0;
|
||||
@@ -167,8 +167,8 @@ static void handle_det_buf_split(struct display_mode_lib *mode_lib,
|
||||
unsigned int full_swath_bytes_packed_c = 0;
|
||||
bool req128_l = false;
|
||||
bool req128_c = false;
|
||||
bool surf_linear = (pipe_src_param.sw_mode == dm_sw_linear);
|
||||
bool surf_vert = (pipe_src_param.source_scan == dm_vert);
|
||||
bool surf_linear = (pipe_src_param->sw_mode == dm_sw_linear);
|
||||
bool surf_vert = (pipe_src_param->source_scan == dm_vert);
|
||||
unsigned int log2_swath_height_l = 0;
|
||||
unsigned int log2_swath_height_c = 0;
|
||||
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,
|
||||
}
|
||||
|
||||
// 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);
|
||||
}
|
||||
|
||||
@@ -883,7 +883,7 @@ void dml30_rq_dlg_get_rq_reg(struct display_mode_lib *mode_lib,
|
||||
|
||||
memset(rq_regs, 0, sizeof(*rq_regs));
|
||||
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);
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user