video: driver: always caliberate gop size
[1] Irrespective of layer encoding type P or B, always caliberate gop size to have gop size multiple of sub gop size. [2] Do not cap enh layer count value to max 1 value when cvp is disabled. Change-Id: I10f602202ce007707c0fee76d9f847db70798754 Signed-off-by: Akshata Sahukar <asahukar@codeaurora.org>
This commit is contained in:

committed by
Gerrit - the friendly Code Review server

parent
a71714eae3
commit
b35579ad54
@@ -736,7 +736,7 @@ static struct msm_platform_inst_capability instance_data_waipio[] = {
|
|||||||
HFI_PROP_LAYER_COUNT,
|
HFI_PROP_LAYER_COUNT,
|
||||||
CAP_FLAG_OUTPUT_PORT | CAP_FLAG_INPUT_PORT |
|
CAP_FLAG_OUTPUT_PORT | CAP_FLAG_INPUT_PORT |
|
||||||
CAP_FLAG_DYNAMIC_ALLOWED,
|
CAP_FLAG_DYNAMIC_ALLOWED,
|
||||||
{BITRATE_MODE, META_EVA_STATS},
|
{BITRATE_MODE},
|
||||||
{GOP_SIZE, B_FRAME, BIT_RATE},
|
{GOP_SIZE, B_FRAME, BIT_RATE},
|
||||||
msm_vidc_adjust_layer_count, msm_vidc_set_layer_count_and_type},
|
msm_vidc_adjust_layer_count, msm_vidc_set_layer_count_and_type},
|
||||||
|
|
||||||
@@ -746,7 +746,7 @@ static struct msm_platform_inst_capability instance_data_waipio[] = {
|
|||||||
HFI_PROP_LAYER_COUNT,
|
HFI_PROP_LAYER_COUNT,
|
||||||
CAP_FLAG_OUTPUT_PORT | CAP_FLAG_INPUT_PORT |
|
CAP_FLAG_OUTPUT_PORT | CAP_FLAG_INPUT_PORT |
|
||||||
CAP_FLAG_DYNAMIC_ALLOWED,
|
CAP_FLAG_DYNAMIC_ALLOWED,
|
||||||
{BITRATE_MODE, META_EVA_STATS},
|
{BITRATE_MODE},
|
||||||
{GOP_SIZE, B_FRAME, BIT_RATE},
|
{GOP_SIZE, B_FRAME, BIT_RATE},
|
||||||
msm_vidc_adjust_layer_count, msm_vidc_set_layer_count_and_type},
|
msm_vidc_adjust_layer_count, msm_vidc_set_layer_count_and_type},
|
||||||
|
|
||||||
@@ -1307,10 +1307,7 @@ static struct msm_platform_inst_capability instance_data_waipio[] = {
|
|||||||
V4L2_MPEG_MSM_VIDC_DISABLE, V4L2_MPEG_MSM_VIDC_ENABLE,
|
V4L2_MPEG_MSM_VIDC_DISABLE, V4L2_MPEG_MSM_VIDC_ENABLE,
|
||||||
1, V4L2_MPEG_MSM_VIDC_DISABLE,
|
1, V4L2_MPEG_MSM_VIDC_DISABLE,
|
||||||
V4L2_CID_MPEG_VIDC_METADATA_EVA_STATS,
|
V4L2_CID_MPEG_VIDC_METADATA_EVA_STATS,
|
||||||
HFI_PROP_EVA_STAT_INFO,
|
HFI_PROP_EVA_STAT_INFO},
|
||||||
CAP_FLAG_ROOT,
|
|
||||||
{0},
|
|
||||||
{ENH_LAYER_COUNT}},
|
|
||||||
|
|
||||||
{META_BUF_TAG, DEC | ENC, CODECS_ALL,
|
{META_BUF_TAG, DEC | ENC, CODECS_ALL,
|
||||||
V4L2_MPEG_MSM_VIDC_DISABLE, V4L2_MPEG_MSM_VIDC_ENABLE,
|
V4L2_MPEG_MSM_VIDC_DISABLE, V4L2_MPEG_MSM_VIDC_ENABLE,
|
||||||
|
@@ -1316,14 +1316,6 @@ static int msm_vidc_adjust_static_layer_count_and_type(struct msm_vidc_inst *ins
|
|||||||
goto exit;
|
goto exit;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (!inst->capabilities->cap[META_EVA_STATS].value &&
|
|
||||||
hb_requested && (layer_count > 1)) {
|
|
||||||
layer_count = 1;
|
|
||||||
i_vpr_h(inst,
|
|
||||||
"%s: cvp disable supports only one enh layer HB\n",
|
|
||||||
__func__);
|
|
||||||
}
|
|
||||||
|
|
||||||
/* decide hfi layer type */
|
/* decide hfi layer type */
|
||||||
if (hb_requested) {
|
if (hb_requested) {
|
||||||
inst->hfi_layer_type = HFI_HIER_B;
|
inst->hfi_layer_type = HFI_HIER_B;
|
||||||
@@ -1376,9 +1368,7 @@ int msm_vidc_adjust_layer_count(void *instance, struct v4l2_ctrl *ctrl)
|
|||||||
capability->cap[ENH_LAYER_COUNT].value;
|
capability->cap[ENH_LAYER_COUNT].value;
|
||||||
|
|
||||||
if (!is_parent_available(inst, ENH_LAYER_COUNT,
|
if (!is_parent_available(inst, ENH_LAYER_COUNT,
|
||||||
BITRATE_MODE, __func__) ||
|
BITRATE_MODE, __func__))
|
||||||
!is_parent_available(inst, ENH_LAYER_COUNT,
|
|
||||||
META_EVA_STATS, __func__))
|
|
||||||
return -EINVAL;
|
return -EINVAL;
|
||||||
|
|
||||||
if (!inst->vb2q[OUTPUT_PORT].streaming) {
|
if (!inst->vb2q[OUTPUT_PORT].streaming) {
|
||||||
@@ -1404,17 +1394,12 @@ exit:
|
|||||||
return rc;
|
return rc;
|
||||||
}
|
}
|
||||||
|
|
||||||
/*
|
|
||||||
* 1. GOP calibration is only done for HP layer encoding type.
|
|
||||||
* 2. Dynamic GOP size should not exceed static GOP size
|
|
||||||
* 3. For HB case, or when layer encoding is not enabled,
|
|
||||||
* client set GOP size is directly set to FW.
|
|
||||||
*/
|
|
||||||
int msm_vidc_adjust_gop_size(void *instance, struct v4l2_ctrl *ctrl)
|
int msm_vidc_adjust_gop_size(void *instance, struct v4l2_ctrl *ctrl)
|
||||||
{
|
{
|
||||||
struct msm_vidc_inst_capability *capability;
|
struct msm_vidc_inst_capability *capability;
|
||||||
struct msm_vidc_inst *inst = (struct msm_vidc_inst *)instance;
|
struct msm_vidc_inst *inst = (struct msm_vidc_inst *)instance;
|
||||||
s32 adjusted_value, enh_layer_count = -1;
|
s32 adjusted_value, enh_layer_count = -1;
|
||||||
|
u32 min_gop_size, num_subgops;
|
||||||
|
|
||||||
if (!inst || !inst->capabilities) {
|
if (!inst || !inst->capabilities) {
|
||||||
d_vpr_e("%s: invalid params\n", __func__);
|
d_vpr_e("%s: invalid params\n", __func__);
|
||||||
@@ -1431,25 +1416,19 @@ int msm_vidc_adjust_gop_size(void *instance, struct v4l2_ctrl *ctrl)
|
|||||||
if (!enh_layer_count)
|
if (!enh_layer_count)
|
||||||
goto exit;
|
goto exit;
|
||||||
|
|
||||||
/* calibrate GOP size */
|
/*
|
||||||
if (inst->hfi_layer_type == HFI_HIER_P_SLIDING_WINDOW ||
|
* Layer encoding needs GOP size to be multiple of subgop size
|
||||||
inst->hfi_layer_type == HFI_HIER_P_HYBRID_LTR) {
|
* And subgop size is 2 ^ number of enhancement layers.
|
||||||
/*
|
*/
|
||||||
* Layer encoding needs GOP size to be multiple of subgop size
|
|
||||||
* And subgop size is 2 ^ number of enhancement layers.
|
|
||||||
*/
|
|
||||||
u32 min_gop_size;
|
|
||||||
u32 num_subgops;
|
|
||||||
|
|
||||||
/* v4l2 layer count is the number of enhancement layers */
|
/* v4l2 layer count is the number of enhancement layers */
|
||||||
min_gop_size = 1 << enh_layer_count;
|
min_gop_size = 1 << enh_layer_count;
|
||||||
num_subgops = (adjusted_value + (min_gop_size >> 1)) /
|
num_subgops = (adjusted_value + (min_gop_size >> 1)) /
|
||||||
min_gop_size;
|
min_gop_size;
|
||||||
if (num_subgops)
|
if (num_subgops)
|
||||||
adjusted_value = num_subgops * min_gop_size;
|
adjusted_value = num_subgops * min_gop_size;
|
||||||
else
|
else
|
||||||
adjusted_value = min_gop_size;
|
adjusted_value = min_gop_size;
|
||||||
}
|
|
||||||
|
|
||||||
exit:
|
exit:
|
||||||
msm_vidc_update_cap_value(inst, GOP_SIZE, adjusted_value, __func__);
|
msm_vidc_update_cap_value(inst, GOP_SIZE, adjusted_value, __func__);
|
||||||
|
Reference in New Issue
Block a user