Merge "video: driver: avoid array copy for freq and bitrate table"

This commit is contained in:
qctecmdr
2023-11-30 20:03:51 -08:00
committed by Gerrit - the friendly Code Review server
3 changed files with 27 additions and 17 deletions

View File

@@ -148,6 +148,9 @@ struct api_calculation_input {
/* used in aurora for depth map decode */ /* used in aurora for depth map decode */
u32 lumaonly_decode; u32 lumaonly_decode;
/* used in freq and bitrate table selection*/
u32 vpu_ver;
}; };
struct corner_voting { struct corner_voting {

View File

@@ -5,6 +5,7 @@
#include "perf_static_model.h" #include "perf_static_model.h"
#include "msm_vidc_debug.h" #include "msm_vidc_debug.h"
#include "msm_vidc_platform.h"
#define ENABLE_FINEBITRATE_SUBUHD60 0 #define ENABLE_FINEBITRATE_SUBUHD60 0
@@ -322,8 +323,8 @@ u32 get_bitrate_entry(u32 pixle_count)
static int calculate_vsp_min_freq(struct api_calculation_input codec_input, static int calculate_vsp_min_freq(struct api_calculation_input codec_input,
struct api_calculation_freq_output *codec_output) struct api_calculation_freq_output *codec_output)
{ {
u32 frequency_table_value[2][6]; u32 (*frequency_table_value)[6];
u32 bitrate_table_2stage_value[5][10]; u32 (*bitrate_table_2stage_value)[10];
/* /*
* VSP calculation * VSP calculation
* different methodology from Lahaina * different methodology from Lahaina
@@ -345,16 +346,12 @@ static int calculate_vsp_min_freq(struct api_calculation_input codec_input,
input_bitrate_fp = ((u32)(codec_input.bitrate_mbps * 100 + 99)) / 100; input_bitrate_fp = ((u32)(codec_input.bitrate_mbps * 100 + 99)) / 100;
if (codec_input.pipe_num == 4) { if (codec_input.vpu_ver == VPU_VERSION_IRIS33) {
memcpy(frequency_table_value, frequency_table_iris33, frequency_table_value = frequency_table_iris33;
sizeof(frequency_table_value)); bitrate_table_2stage_value = bitrate_table_iris33_2stage_fp;
memcpy(bitrate_table_2stage_value, bitrate_table_iris33_2stage_fp, } else if (codec_input.vpu_ver == VPU_VERSION_IRIS33_2P) {
sizeof(bitrate_table_2stage_value)); frequency_table_value = frequency_table_iris33_2p;
} else if (codec_input.pipe_num == 2) { bitrate_table_2stage_value = bitrate_table_iris33_2p_2stage_fp;
memcpy(frequency_table_value, frequency_table_iris33_2p,
sizeof(frequency_table_value));
memcpy(bitrate_table_2stage_value, bitrate_table_iris33_2p_2stage_fp,
sizeof(bitrate_table_2stage_value));
} }
/* 8KUHD60fps with B frame */ /* 8KUHD60fps with B frame */
@@ -438,12 +435,12 @@ static u32 calculate_pipe_penalty(struct api_calculation_input codec_input)
u32 pipe_penalty_codec = 0; u32 pipe_penalty_codec = 0;
u8 avid_commercial_content = 0; u8 avid_commercial_content = 0;
u32 pixel_count = 0; u32 pixel_count = 0;
u32 pipe_penalty_value[3][3]; u32 (*pipe_penalty_value)[3];
if (codec_input.pipe_num == 4) if (codec_input.vpu_ver == VPU_VERSION_IRIS33)
memcpy(pipe_penalty_value, pipe_penalty_iris33, sizeof(pipe_penalty_value)); pipe_penalty_value = pipe_penalty_iris33;
else if (codec_input.pipe_num == 2) else if (codec_input.vpu_ver == VPU_VERSION_IRIS33_2P)
memcpy(pipe_penalty_value, pipe_penalty_iris33_2p, sizeof(pipe_penalty_value)); pipe_penalty_value = pipe_penalty_iris33_2p;
/* decoder */ /* decoder */
if (codec_input.decoder_or_encoder == CODEC_DECODER) { if (codec_input.decoder_or_encoder == CODEC_DECODER) {

View File

@@ -8,6 +8,7 @@
#include "msm_vidc_driver.h" #include "msm_vidc_driver.h"
#include "msm_vidc_inst.h" #include "msm_vidc_inst.h"
#include "msm_vidc_core.h" #include "msm_vidc_core.h"
#include "msm_vidc_platform.h"
#include "msm_vidc_debug.h" #include "msm_vidc_debug.h"
#include "perf_static_model.h" #include "perf_static_model.h"
#include "msm_vidc_power.h" #include "msm_vidc_power.h"
@@ -50,6 +51,7 @@ static int msm_vidc_init_codec_input_freq(struct msm_vidc_inst *inst, u32 data_s
{ {
enum msm_vidc_port_type port; enum msm_vidc_port_type port;
u32 color_fmt, tile_rows_columns = 0; u32 color_fmt, tile_rows_columns = 0;
struct msm_vidc_core *core;
if (is_encode_session(inst)) { if (is_encode_session(inst)) {
codec_input->decoder_or_encoder = CODEC_ENCODER; codec_input->decoder_or_encoder = CODEC_ENCODER;
@@ -157,6 +159,9 @@ static int msm_vidc_init_codec_input_freq(struct msm_vidc_inst *inst, u32 data_s
/* set as sanity mode, this regression mode has no effect on power calculations */ /* set as sanity mode, this regression mode has no effect on power calculations */
codec_input->regression_mode = REGRESSION_MODE_SANITY; codec_input->regression_mode = REGRESSION_MODE_SANITY;
core = inst->core;
codec_input->vpu_ver = core->platform->data.vpu_ver;
return 0; return 0;
} }
@@ -165,6 +170,7 @@ static int msm_vidc_init_codec_input_bus(struct msm_vidc_inst *inst, struct vidc
{ {
u32 complexity_factor_int = 0, complexity_factor_frac = 0, tile_rows_columns = 0; u32 complexity_factor_int = 0, complexity_factor_frac = 0, tile_rows_columns = 0;
bool opb_compression_enabled = false; bool opb_compression_enabled = false;
struct msm_vidc_core *core;
if (!d) if (!d)
return -EINVAL; return -EINVAL;
@@ -321,6 +327,9 @@ static int msm_vidc_init_codec_input_bus(struct msm_vidc_inst *inst, struct vidc
codec_input->av1d_commer_tile_enable = 0; codec_input->av1d_commer_tile_enable = 0;
} }
core = inst->core;
codec_input->vpu_ver = core->platform->data.vpu_ver;
/* Dump all the variables for easier debugging */ /* Dump all the variables for easier debugging */
if (msm_vidc_debug & VIDC_BUS) { if (msm_vidc_debug & VIDC_BUS) {
struct dump dump[] = { struct dump dump[] = {
@@ -354,6 +363,7 @@ static int msm_vidc_init_codec_input_bus(struct msm_vidc_inst *inst, struct vidc
{"lumaonly_decode", "%d", codec_input->lumaonly_decode}, {"lumaonly_decode", "%d", codec_input->lumaonly_decode},
{"av1d_commer_tile_enable", "%d", codec_input->av1d_commer_tile_enable}, {"av1d_commer_tile_enable", "%d", codec_input->av1d_commer_tile_enable},
{"regression_mode", "%d", codec_input->regression_mode}, {"regression_mode", "%d", codec_input->regression_mode},
{"vpu_ver", "%d", codec_input->vpu_ver},
}; };
__dump(dump, ARRAY_SIZE(dump)); __dump(dump, ARRAY_SIZE(dump));
} }