video driver: remove session priority handling
1. Removes depenceny of priority from frame rate and operating rate. 2. Removes changing priority from s_param Change-Id: Iec51173eab5a3d59b841315549d1420df422d37f Signed-off-by: Deepa Guthyappa Madivalara <quic_dmadival@quicinc.com>
This commit is contained in:
@@ -96,7 +96,6 @@ struct msm_vidc_platform_data {
|
||||
u32 instance_data_size;
|
||||
struct msm_vidc_csc_coeff csc_data;
|
||||
struct msm_vidc_ubwc_config_data *ubwc_config;
|
||||
u32 *bus_bw_nrt;
|
||||
struct msm_vidc_efuse_data *efuse_data;
|
||||
unsigned int efuse_data_size;
|
||||
unsigned int sku_version;
|
||||
|
@@ -247,7 +247,7 @@ static struct msm_platform_inst_capability instance_data_kalama[] = {
|
||||
CAP_FLAG_OUTPUT_PORT |
|
||||
CAP_FLAG_INPUT_PORT | CAP_FLAG_DYNAMIC_ALLOWED,
|
||||
{0}, {0},
|
||||
msm_vidc_adjust_frame_rate},
|
||||
msm_vidc_adjust_dec_frame_rate},
|
||||
|
||||
{FRAME_RATE, DEC, VP9,
|
||||
(MINIMUM_FPS << 16), (MAXIMUM_OVERRIDE_VP9_FPS << 16),
|
||||
@@ -257,7 +257,7 @@ static struct msm_platform_inst_capability instance_data_kalama[] = {
|
||||
CAP_FLAG_OUTPUT_PORT |
|
||||
CAP_FLAG_INPUT_PORT | CAP_FLAG_DYNAMIC_ALLOWED,
|
||||
{0}, {0},
|
||||
msm_vidc_adjust_frame_rate},
|
||||
msm_vidc_adjust_dec_frame_rate},
|
||||
|
||||
{OPERATING_RATE, ENC, CODECS_ALL,
|
||||
(MINIMUM_FPS << 16), (MAXIMUM_FPS << 16),
|
||||
@@ -271,7 +271,7 @@ static struct msm_platform_inst_capability instance_data_kalama[] = {
|
||||
CAP_FLAG_OUTPUT_PORT |
|
||||
CAP_FLAG_INPUT_PORT | CAP_FLAG_DYNAMIC_ALLOWED,
|
||||
{0}, {0},
|
||||
msm_vidc_adjust_operating_rate},
|
||||
msm_vidc_adjust_dec_operating_rate},
|
||||
|
||||
{OPERATING_RATE, DEC, VP9,
|
||||
(MINIMUM_FPS << 16), (MAXIMUM_OVERRIDE_VP9_FPS << 16),
|
||||
@@ -281,7 +281,7 @@ static struct msm_platform_inst_capability instance_data_kalama[] = {
|
||||
CAP_FLAG_OUTPUT_PORT |
|
||||
CAP_FLAG_INPUT_PORT | CAP_FLAG_DYNAMIC_ALLOWED,
|
||||
{0}, {0},
|
||||
msm_vidc_adjust_operating_rate},
|
||||
msm_vidc_adjust_dec_operating_rate},
|
||||
|
||||
{INPUT_RATE, ENC|DEC, CODECS_ALL,
|
||||
(MINIMUM_FPS << 16), INT_MAX,
|
||||
@@ -2016,12 +2016,6 @@ static struct msm_vidc_ubwc_config_data ubwc_config_kalama[] = {
|
||||
UBWC_CONFIG(8, 32, 16, 0, 1, 1, 1),
|
||||
};
|
||||
|
||||
/* Default bus bandwidth for non_real time session based on priority */
|
||||
static u32 bus_bw_nrt[] = {
|
||||
15000000,
|
||||
11000000,
|
||||
};
|
||||
|
||||
static const struct msm_vidc_platform_data kalama_data = {
|
||||
.core_data = core_data_kalama,
|
||||
.core_data_size = ARRAY_SIZE(core_data_kalama),
|
||||
@@ -2031,7 +2025,6 @@ static const struct msm_vidc_platform_data kalama_data = {
|
||||
.csc_data.vpe_csc_custom_matrix_coeff = vpe_csc_custom_matrix_coeff,
|
||||
.csc_data.vpe_csc_custom_limit_coeff = vpe_csc_custom_limit_coeff,
|
||||
.ubwc_config = ubwc_config_kalama,
|
||||
.bus_bw_nrt = bus_bw_nrt,
|
||||
};
|
||||
|
||||
int msm_vidc_kalama_check_ddr_type(void)
|
||||
|
@@ -237,7 +237,7 @@ static struct msm_platform_inst_capability instance_data_waipio[] = {
|
||||
CAP_FLAG_OUTPUT_PORT |
|
||||
CAP_FLAG_INPUT_PORT | CAP_FLAG_DYNAMIC_ALLOWED,
|
||||
{0}, {0},
|
||||
msm_vidc_adjust_frame_rate},
|
||||
msm_vidc_adjust_dec_frame_rate},
|
||||
|
||||
{FRAME_RATE, DEC, VP9,
|
||||
(MINIMUM_FPS << 16), (MAXIMUM_OVERRIDE_VP9_FPS << 16),
|
||||
@@ -247,7 +247,7 @@ static struct msm_platform_inst_capability instance_data_waipio[] = {
|
||||
CAP_FLAG_OUTPUT_PORT |
|
||||
CAP_FLAG_INPUT_PORT | CAP_FLAG_DYNAMIC_ALLOWED,
|
||||
{0}, {0},
|
||||
msm_vidc_adjust_frame_rate},
|
||||
msm_vidc_adjust_dec_frame_rate},
|
||||
|
||||
{OPERATING_RATE, ENC, CODECS_ALL,
|
||||
(MINIMUM_FPS << 16), (MAXIMUM_FPS << 16),
|
||||
@@ -261,7 +261,7 @@ static struct msm_platform_inst_capability instance_data_waipio[] = {
|
||||
CAP_FLAG_OUTPUT_PORT |
|
||||
CAP_FLAG_INPUT_PORT | CAP_FLAG_DYNAMIC_ALLOWED,
|
||||
{0}, {0},
|
||||
msm_vidc_adjust_operating_rate},
|
||||
msm_vidc_adjust_dec_operating_rate},
|
||||
|
||||
{OPERATING_RATE, DEC, VP9,
|
||||
(MINIMUM_FPS << 16), (MAXIMUM_OVERRIDE_VP9_FPS << 16),
|
||||
@@ -271,7 +271,7 @@ static struct msm_platform_inst_capability instance_data_waipio[] = {
|
||||
CAP_FLAG_OUTPUT_PORT |
|
||||
CAP_FLAG_INPUT_PORT | CAP_FLAG_DYNAMIC_ALLOWED,
|
||||
{0}, {0},
|
||||
msm_vidc_adjust_operating_rate},
|
||||
msm_vidc_adjust_dec_operating_rate},
|
||||
|
||||
{INPUT_RATE, ENC|DEC, CODECS_ALL,
|
||||
(MINIMUM_FPS << 16), INT_MAX,
|
||||
@@ -1865,12 +1865,6 @@ static struct msm_vidc_ubwc_config_data ubwc_config_waipio[] = {
|
||||
UBWC_CONFIG(8, 32, 16, 0, 1, 1, 1),
|
||||
};
|
||||
|
||||
/* Default bus bandwidth for non_real time session based on priority */
|
||||
static u32 bus_bw_nrt[] = {
|
||||
15000000,
|
||||
11000000,
|
||||
};
|
||||
|
||||
static const struct msm_vidc_platform_data waipio_data = {
|
||||
.core_data = core_data_waipio,
|
||||
.core_data_size = ARRAY_SIZE(core_data_waipio),
|
||||
@@ -1880,7 +1874,6 @@ static const struct msm_vidc_platform_data waipio_data = {
|
||||
.csc_data.vpe_csc_custom_matrix_coeff = vpe_csc_custom_matrix_coeff,
|
||||
.csc_data.vpe_csc_custom_limit_coeff = vpe_csc_custom_limit_coeff,
|
||||
.ubwc_config = ubwc_config_waipio,
|
||||
.bus_bw_nrt = bus_bw_nrt,
|
||||
};
|
||||
|
||||
static int msm_vidc_init_data(struct msm_vidc_core *core)
|
||||
|
@@ -52,8 +52,8 @@ int msm_vidc_prepare_dependency_list(struct msm_vidc_inst *inst);
|
||||
int msm_vidc_adjust_session_priority(void *instance, struct v4l2_ctrl *ctrl);
|
||||
int msm_vidc_adjust_roi_info(void *instance, struct v4l2_ctrl *ctrl);
|
||||
int msm_vidc_adjust_all_intra(void *instance, struct v4l2_ctrl *ctrl);
|
||||
int msm_vidc_adjust_frame_rate(void *instance, struct v4l2_ctrl *ctrl);
|
||||
int msm_vidc_adjust_operating_rate(void *instance, struct v4l2_ctrl *ctrl);
|
||||
int msm_vidc_adjust_dec_frame_rate(void *instance, struct v4l2_ctrl *ctrl);
|
||||
int msm_vidc_adjust_dec_operating_rate(void *instance, struct v4l2_ctrl *ctrl);
|
||||
|
||||
int msm_vidc_set_header_mode(void *instance,
|
||||
enum msm_vidc_inst_capability_type cap_id);
|
||||
@@ -109,8 +109,6 @@ int msm_vidc_set_pipe(void *instance,
|
||||
enum msm_vidc_inst_capability_type cap_id);
|
||||
int msm_vidc_set_csc_custom_matrix(void *instance,
|
||||
enum msm_vidc_inst_capability_type cap_id);
|
||||
int msm_vidc_set_session_priority(void* instance,
|
||||
enum msm_vidc_inst_capability_type cap_id);
|
||||
int msm_vidc_set_ir_period(void *instance,
|
||||
enum msm_vidc_inst_capability_type cap_id);
|
||||
int msm_vidc_set_level(void *instance,
|
||||
|
@@ -161,8 +161,6 @@ struct msm_vidc_inst {
|
||||
struct msm_vidc_inst_capability *capabilities;
|
||||
struct completion completions[MAX_SIGNAL];
|
||||
struct msm_vidc_fence_context fence_context;
|
||||
enum priority_level priority_level;
|
||||
u32 firmware_priority;
|
||||
bool active;
|
||||
u64 last_qbuf_time_ns;
|
||||
bool vb2q_init;
|
||||
|
@@ -150,11 +150,6 @@ enum msm_vidc_codec_type {
|
||||
MSM_VIDC_AV1 = BIT(4),
|
||||
};
|
||||
|
||||
enum priority_level {
|
||||
MSM_VIDC_PRIORITY_HIGH = 0,
|
||||
MSM_VIDC_PRIORITY_LOW = 1,
|
||||
};
|
||||
|
||||
enum msm_vidc_colorformat_type {
|
||||
MSM_VIDC_FMT_NONE = 0,
|
||||
MSM_VIDC_FMT_NV12C = BIT(0),
|
||||
|
@@ -2054,10 +2054,6 @@ int msm_vdec_qbuf(struct msm_vidc_inst *inst, struct vb2_buffer *vb2)
|
||||
}
|
||||
}
|
||||
|
||||
if (inst->firmware_priority != (inst->priority_level +
|
||||
inst->capabilities->cap[PRIORITY].value * 2))
|
||||
msm_vidc_set_session_priority(inst, PRIORITY);
|
||||
|
||||
/* batch decoder output & meta buffer only */
|
||||
if (inst->decode_batch.enable && vb2->type == OUTPUT_MPLANE)
|
||||
rc = msm_vdec_qbuf_batch(inst, vb2);
|
||||
@@ -2566,38 +2562,12 @@ set_default:
|
||||
q16_rate = (u32)input_rate << 16;
|
||||
msm_vidc_update_cap_value(inst, is_frame_rate ? FRAME_RATE : OPERATING_RATE,
|
||||
q16_rate, __func__);
|
||||
if (is_realtime_session(inst) &&
|
||||
((s_parm->type == INPUT_MPLANE && inst->bufq[INPUT_PORT].vb2q->streaming) ||
|
||||
(s_parm->type == OUTPUT_MPLANE && inst->bufq[OUTPUT_PORT].vb2q->streaming))) {
|
||||
rc = msm_vidc_check_core_mbps(inst);
|
||||
if (rc) {
|
||||
i_vpr_e(inst, "%s: unsupported load\n", __func__);
|
||||
goto reset_rate;
|
||||
}
|
||||
rc = input_rate > max_rate;
|
||||
if (rc) {
|
||||
i_vpr_e(inst, "%s: unsupported rate %llu, max %u\n", __func__,
|
||||
input_rate, max_rate);
|
||||
rc = -ENOMEM;
|
||||
goto reset_rate;
|
||||
}
|
||||
}
|
||||
inst->priority_level = MSM_VIDC_PRIORITY_HIGH;
|
||||
|
||||
if (is_frame_rate)
|
||||
capability->cap[FRAME_RATE].flags |= CAP_FLAG_CLIENT_SET;
|
||||
else
|
||||
capability->cap[OPERATING_RATE].flags |= CAP_FLAG_CLIENT_SET;
|
||||
|
||||
return 0;
|
||||
|
||||
reset_rate:
|
||||
if (rc) {
|
||||
i_vpr_e(inst, "%s: setting rate %llu failed, reset to %u\n", __func__,
|
||||
input_rate, default_rate);
|
||||
msm_vidc_update_cap_value(inst, is_frame_rate ? FRAME_RATE : OPERATING_RATE,
|
||||
default_rate << 16, __func__);
|
||||
}
|
||||
exit:
|
||||
return rc;
|
||||
}
|
||||
@@ -2853,8 +2823,6 @@ int msm_vdec_inst_init(struct msm_vidc_inst *inst)
|
||||
inst->buffers.output_meta.actual_count = 0;
|
||||
inst->buffers.output_meta.size = 0;
|
||||
|
||||
inst->priority_level = MSM_VIDC_PRIORITY_LOW;
|
||||
|
||||
rc = msm_vdec_codec_change(inst,
|
||||
inst->fmts[INPUT_PORT].fmt.pix_mp.pixelformat);
|
||||
if (rc)
|
||||
|
@@ -884,10 +884,6 @@ int msm_venc_qbuf(struct msm_vidc_inst *inst, struct vb2_buffer *vb2)
|
||||
return -EINVAL;
|
||||
}
|
||||
|
||||
if (inst->firmware_priority != (inst->priority_level +
|
||||
inst->capabilities->cap[PRIORITY].value * 2))
|
||||
msm_vidc_set_session_priority(inst, PRIORITY);
|
||||
|
||||
rc = msm_vidc_queue_buffer_single(inst, vb2);
|
||||
if (rc)
|
||||
return rc;
|
||||
@@ -1637,7 +1633,6 @@ int msm_venc_s_param(struct msm_vidc_inst *inst,
|
||||
goto reset_rate;
|
||||
}
|
||||
}
|
||||
inst->priority_level = MSM_VIDC_PRIORITY_HIGH;
|
||||
|
||||
if (is_frame_rate)
|
||||
capability->cap[FRAME_RATE].flags |= CAP_FLAG_CLIENT_SET;
|
||||
@@ -1901,8 +1896,6 @@ int msm_venc_inst_init(struct msm_vidc_inst *inst)
|
||||
inst->buffers.input_meta.actual_count = 0;
|
||||
inst->buffers.input_meta.size = 0;
|
||||
|
||||
inst->priority_level = MSM_VIDC_PRIORITY_LOW;
|
||||
|
||||
inst->hfi_rc_type = HFI_RC_VBR_CFR;
|
||||
inst->hfi_layer_type = HFI_HIER_P_SLIDING_WINDOW;
|
||||
|
||||
|
@@ -2709,9 +2709,7 @@ int msm_vidc_adjust_lowlatency_mode(void *instance, struct v4l2_ctrl *ctrl)
|
||||
|
||||
int msm_vidc_adjust_session_priority(void *instance, struct v4l2_ctrl *ctrl)
|
||||
{
|
||||
int rc = 0;
|
||||
int adjusted_value;
|
||||
bool rate_by_client;
|
||||
struct msm_vidc_inst_capability *capability;
|
||||
struct msm_vidc_inst *inst = (struct msm_vidc_inst *)instance;
|
||||
|
||||
@@ -2723,54 +2721,9 @@ int msm_vidc_adjust_session_priority(void *instance, struct v4l2_ctrl *ctrl)
|
||||
adjusted_value = ctrl ? ctrl->val :
|
||||
capability->cap[PRIORITY].value;
|
||||
|
||||
if (capability->cap[FRAME_RATE].flags & CAP_FLAG_CLIENT_SET ||
|
||||
capability->cap[OPERATING_RATE].flags & CAP_FLAG_CLIENT_SET) {
|
||||
rate_by_client = true;
|
||||
inst->priority_level = MSM_VIDC_PRIORITY_HIGH;
|
||||
} else {
|
||||
rate_by_client = false;
|
||||
inst->priority_level = MSM_VIDC_PRIORITY_LOW;
|
||||
}
|
||||
|
||||
/*
|
||||
* For RT, check for resource feasability.
|
||||
* For NRT, sessions with rate set by client takes higher order
|
||||
* among NRT sessions. They are constraint RT or low priority RT.
|
||||
*/
|
||||
if (adjusted_value == 0) {
|
||||
rc = msm_vidc_check_core_mbps(inst);
|
||||
if (rc) {
|
||||
i_vpr_e(inst, "%s: unsupported load\n", __func__);
|
||||
goto exit;
|
||||
}
|
||||
rc = capability->cap[FRAME_RATE].value > capability->cap[FRAME_RATE].max;
|
||||
if (rc) {
|
||||
i_vpr_e(inst, "%s: unsupported FRAME_RATE %u, max %u\n", __func__,
|
||||
capability->cap[FRAME_RATE].value >> 16,
|
||||
capability->cap[FRAME_RATE].max >> 16);
|
||||
rc = -ENOMEM;
|
||||
goto exit;
|
||||
}
|
||||
rc = capability->cap[OPERATING_RATE].value > capability->cap[OPERATING_RATE].max;
|
||||
if (rc) {
|
||||
i_vpr_e(inst, "%s: unsupported OPERATING_RATE %u, max %u\n", __func__,
|
||||
capability->cap[OPERATING_RATE].value >> 16,
|
||||
capability->cap[OPERATING_RATE].max >> 16);
|
||||
rc = -ENOMEM;
|
||||
goto exit;
|
||||
}
|
||||
|
||||
rc = msm_vidc_check_core_mbpf(inst);
|
||||
if (rc) {
|
||||
i_vpr_e(inst, "%s: unsupported load\n", __func__);
|
||||
goto exit;
|
||||
}
|
||||
}
|
||||
|
||||
msm_vidc_update_cap_value(inst, PRIORITY, adjusted_value, __func__);
|
||||
|
||||
exit:
|
||||
return rc;
|
||||
return 0;
|
||||
}
|
||||
|
||||
int msm_vidc_adjust_roi_info(void *instance, struct v4l2_ctrl *ctrl)
|
||||
@@ -2805,69 +2758,52 @@ int msm_vidc_adjust_roi_info(void *instance, struct v4l2_ctrl *ctrl)
|
||||
return 0;
|
||||
}
|
||||
|
||||
int msm_vidc_adjust_frame_rate(void *instance, struct v4l2_ctrl *ctrl)
|
||||
int msm_vidc_adjust_dec_frame_rate(void *instance, struct v4l2_ctrl *ctrl)
|
||||
{
|
||||
int rc = 0;
|
||||
struct msm_vidc_inst_capability *capability;
|
||||
struct msm_vidc_inst *inst = (struct msm_vidc_inst *) instance;
|
||||
u32 adjusted_value;
|
||||
u32 adjusted_value = 0;
|
||||
|
||||
if (!inst || !inst->capabilities) {
|
||||
d_vpr_e("%s: invalid params\n", __func__);
|
||||
return -EINVAL;
|
||||
}
|
||||
|
||||
if (is_encode_session(inst)) {
|
||||
d_vpr_e("%s: adjust framerate invalid for enc\n", __func__);
|
||||
return -EINVAL;
|
||||
}
|
||||
|
||||
capability = inst->capabilities;
|
||||
|
||||
adjusted_value = ctrl ? ctrl->val : capability->cap[FRAME_RATE].value;
|
||||
|
||||
if (is_realtime_session(inst)) {
|
||||
rc = msm_vidc_check_core_mbps(inst);
|
||||
if (rc) {
|
||||
i_vpr_e(inst, "%s: unsupported load\n", __func__);
|
||||
return rc;
|
||||
}
|
||||
}
|
||||
|
||||
inst->priority_level = MSM_VIDC_PRIORITY_HIGH;
|
||||
capability->cap[FRAME_RATE].flags |= CAP_FLAG_CLIENT_SET;
|
||||
|
||||
msm_vidc_update_cap_value(inst, FRAME_RATE, adjusted_value, __func__);
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
||||
int msm_vidc_adjust_operating_rate(void *instance, struct v4l2_ctrl *ctrl)
|
||||
int msm_vidc_adjust_dec_operating_rate(void *instance, struct v4l2_ctrl *ctrl)
|
||||
{
|
||||
int rc = 0;
|
||||
struct msm_vidc_inst_capability *capability;
|
||||
struct msm_vidc_inst *inst = (struct msm_vidc_inst *) instance;
|
||||
u32 adjusted_value;
|
||||
u32 adjusted_value = 0;
|
||||
|
||||
if (!inst || !inst->capabilities) {
|
||||
d_vpr_e("%s: invalid params\n", __func__);
|
||||
return -EINVAL;
|
||||
}
|
||||
|
||||
if (is_encode_session(inst)) {
|
||||
d_vpr_e("%s: adjust operating rate invalid for enc\n", __func__);
|
||||
return -EINVAL;
|
||||
}
|
||||
|
||||
capability = inst->capabilities;
|
||||
|
||||
adjusted_value = ctrl ? ctrl->val : capability->cap[OPERATING_RATE].value;
|
||||
|
||||
if (is_realtime_session(inst)) {
|
||||
rc = msm_vidc_check_core_mbps(inst);
|
||||
if (rc) {
|
||||
i_vpr_e(inst, "%s: unsupported load\n", __func__);
|
||||
return rc;
|
||||
}
|
||||
}
|
||||
|
||||
inst->priority_level = MSM_VIDC_PRIORITY_HIGH;
|
||||
capability->cap[OPERATING_RATE].flags |= CAP_FLAG_CLIENT_SET;
|
||||
|
||||
msm_vidc_update_cap_value(inst, OPERATING_RATE, adjusted_value, __func__);
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
||||
|
||||
int msm_vidc_prepare_dependency_list(struct msm_vidc_inst *inst)
|
||||
{
|
||||
struct list_head root_list, opt_list;
|
||||
@@ -3795,15 +3731,13 @@ int msm_vidc_set_session_priority(void *instance,
|
||||
return -EINVAL;
|
||||
}
|
||||
|
||||
hfi_value = (inst->capabilities->cap[cap_id].value * 2) + inst->priority_level;
|
||||
hfi_value = inst->capabilities->cap[cap_id].value;
|
||||
|
||||
rc = msm_vidc_packetize_control(inst, cap_id, HFI_PAYLOAD_U32,
|
||||
&hfi_value, sizeof(u32), __func__);
|
||||
if (rc)
|
||||
return rc;
|
||||
|
||||
inst->firmware_priority = hfi_value;
|
||||
|
||||
return rc;
|
||||
}
|
||||
|
||||
|
@@ -510,16 +510,16 @@ int msm_vidc_scale_power(struct msm_vidc_inst *inst, bool scale_buses)
|
||||
*/
|
||||
timestamp_rate = msm_vidc_get_timestamp_rate(inst);
|
||||
input_rate = msm_vidc_get_input_rate(inst);
|
||||
if (timestamp_rate > (fps + fps / 8)) {
|
||||
if (timestamp_rate > (fps + fps / 8))
|
||||
fps = timestamp_rate;
|
||||
inst->priority_level = MSM_VIDC_PRIORITY_LOW;
|
||||
}
|
||||
|
||||
if (input_rate > fps) {
|
||||
fps = input_rate;
|
||||
/*
|
||||
* add 6.25% more fps to increase power to make firmware
|
||||
* processing little faster than client queuing rate
|
||||
* add 6.25% more fps for NRT session to increase power to make
|
||||
* firmware processing little faster than client queuing rate
|
||||
*/
|
||||
if (!is_realtime_session(inst))
|
||||
fps = fps + fps / 16;
|
||||
}
|
||||
}
|
||||
|
Reference in New Issue
Block a user