Loading drivers/media/platform/msm/vidc/hfi_packetization.c +15 −0 Original line number Diff line number Diff line Loading @@ -1926,6 +1926,21 @@ int create_pkt_cmd_session_set_property( pkt->size += sizeof(struct hfi_hdr10_pq_sei); break; } case HAL_CONFIG_VENC_VBV_HRD_BUF_SIZE: { struct hfi_vbv_hdr_buf_size *hfi; struct hal_vbv_hdr_buf_size *prop = (struct hal_vbv_hdr_buf_size *) pdata; pkt->rg_property_data[0] = HFI_PROPERTY_CONFIG_VENC_VBV_HRD_BUF_SIZE; hfi = (struct hfi_vbv_hdr_buf_size *) &pkt->rg_property_data[1]; hfi->vbv_hdr_buf_size = prop->vbv_hdr_buf_size; pkt->size += sizeof(struct hfi_vbv_hdr_buf_size); break; } /* FOLLOWING PROPERTIES ARE NOT IMPLEMENTED IN CORE YET */ case HAL_CONFIG_BUFFER_REQUIREMENTS: case HAL_CONFIG_PRIORITY: Loading drivers/media/platform/msm/vidc/msm_vidc.c +70 −0 Original line number Diff line number Diff line Loading @@ -905,6 +905,69 @@ static inline int msm_vidc_verify_buffer_counts(struct msm_vidc_inst *inst) return rc; } int msm_vidc_set_internal_config(struct msm_vidc_inst *inst) { int rc = 0; u32 rc_mode; bool set_rc = false; struct hal_vbv_hdr_buf_size hrd_buf_size; struct hal_enable latency; struct hfi_device *hdev; u32 codec; if (!inst || !inst->core || !inst->core->device) { dprintk(VIDC_WARN, "%s: Invalid parameter\n", __func__); return -EINVAL; } if (inst->session_type != MSM_VIDC_ENCODER) return rc; hdev = inst->core->device; codec = inst->fmts[CAPTURE_PORT].fourcc; rc_mode = msm_comm_g_ctrl_for_id(inst, V4L2_CID_MPEG_VIDEO_BITRATE_MODE); latency.enable = msm_comm_g_ctrl_for_id(inst, V4L2_CID_MPEG_VIDC_VIDEO_LOWLATENCY_MODE); if (rc_mode == V4L2_MPEG_VIDEO_BITRATE_MODE_MBR_VFR) { rc_mode = V4L2_MPEG_VIDEO_BITRATE_MODE_MBR; set_rc = true; } else if (rc_mode == V4L2_MPEG_VIDEO_BITRATE_MODE_VBR && latency.enable == V4L2_MPEG_MSM_VIDC_ENABLE && codec != V4L2_PIX_FMT_VP8) { rc_mode = V4L2_MPEG_VIDEO_BITRATE_MODE_CBR; set_rc = true; } if (set_rc) { rc = call_hfi_op(hdev, session_set_property, (void *)inst->session, HAL_PARAM_VENC_RATE_CONTROL, (void *)&rc_mode); } if ((rc_mode == V4L2_MPEG_VIDEO_BITRATE_MODE_CBR || rc_mode == V4L2_MPEG_VIDEO_BITRATE_MODE_CBR_VFR) && (codec != V4L2_PIX_FMT_VP8)) { hrd_buf_size.vbv_hdr_buf_size = 1000; dprintk(VIDC_DBG, "Enable cbr+ hdr_buf_size %d :\n", hrd_buf_size.vbv_hdr_buf_size); rc = call_hfi_op(hdev, session_set_property, (void *)inst->session, HAL_CONFIG_VENC_VBV_HRD_BUF_SIZE, (void *)&hrd_buf_size); latency.enable = V4L2_MPEG_MSM_VIDC_ENABLE; rc = call_hfi_op(hdev, session_set_property, (void *)inst->session, HAL_PARAM_VENC_LOW_LATENCY, (void *)&latency); inst->clk_data.low_latency_mode = latency.enable; } return rc; } static inline int start_streaming(struct msm_vidc_inst *inst) { int rc = 0; Loading @@ -930,6 +993,13 @@ static inline int start_streaming(struct msm_vidc_inst *inst) goto fail_start; } rc = msm_vidc_set_internal_config(inst); if (rc) { dprintk(VIDC_ERR, "Set internal config failed %pK\n", inst); goto fail_start; } /* Decide work route for current session */ rc = msm_vidc_decide_work_route(inst); if (rc) { Loading drivers/media/platform/msm/vidc/vidc_hfi_api.h +5 −0 Original line number Diff line number Diff line Loading @@ -215,6 +215,7 @@ enum hal_property { HAL_PARAM_SECURE, HAL_PARAM_VENC_HDR10_PQ_SEI, HAL_PARAM_VIDEO_WORK_ROUTE, HAL_CONFIG_VENC_VBV_HRD_BUF_SIZE, }; enum hal_domain { Loading Loading @@ -1406,6 +1407,10 @@ struct hal_hdr10_pq_sei { struct msm_vidc_content_light_level_sei_payload cll_sei; }; struct hal_vbv_hdr_buf_size { u32 vbv_hdr_buf_size; }; #define call_hfi_op(q, op, args...) \ (((q) && (q)->op) ? ((q)->op(args)) : 0) Loading drivers/media/platform/msm/vidc/vidc_hfi_helper.h +6 −0 Original line number Diff line number Diff line Loading @@ -350,6 +350,8 @@ struct hfi_buffer_info { (HFI_PROPERTY_CONFIG_VENC_COMMON_START + 0x00A) #define HFI_PROPERTY_CONFIG_VENC_HIER_P_ENH_LAYER \ (HFI_PROPERTY_CONFIG_VENC_COMMON_START + 0x00B) #define HFI_PROPERTY_CONFIG_VENC_VBV_HRD_BUF_SIZE \ (HFI_PROPERTY_CONFIG_VENC_COMMON_START + 0x00D) #define HFI_PROPERTY_CONFIG_VENC_PERF_MODE \ (HFI_PROPERTY_CONFIG_VENC_COMMON_START + 0x00E) #define HFI_PROPERTY_CONFIG_VENC_BASELAYER_PRIORITYID \ Loading Loading @@ -1117,4 +1119,8 @@ struct hfi_hdr10_pq_sei { struct hfi_content_light_level_sei_payload cll_info; }; struct hfi_vbv_hdr_buf_size { u32 vbv_hdr_buf_size; }; #endif Loading
drivers/media/platform/msm/vidc/hfi_packetization.c +15 −0 Original line number Diff line number Diff line Loading @@ -1926,6 +1926,21 @@ int create_pkt_cmd_session_set_property( pkt->size += sizeof(struct hfi_hdr10_pq_sei); break; } case HAL_CONFIG_VENC_VBV_HRD_BUF_SIZE: { struct hfi_vbv_hdr_buf_size *hfi; struct hal_vbv_hdr_buf_size *prop = (struct hal_vbv_hdr_buf_size *) pdata; pkt->rg_property_data[0] = HFI_PROPERTY_CONFIG_VENC_VBV_HRD_BUF_SIZE; hfi = (struct hfi_vbv_hdr_buf_size *) &pkt->rg_property_data[1]; hfi->vbv_hdr_buf_size = prop->vbv_hdr_buf_size; pkt->size += sizeof(struct hfi_vbv_hdr_buf_size); break; } /* FOLLOWING PROPERTIES ARE NOT IMPLEMENTED IN CORE YET */ case HAL_CONFIG_BUFFER_REQUIREMENTS: case HAL_CONFIG_PRIORITY: Loading
drivers/media/platform/msm/vidc/msm_vidc.c +70 −0 Original line number Diff line number Diff line Loading @@ -905,6 +905,69 @@ static inline int msm_vidc_verify_buffer_counts(struct msm_vidc_inst *inst) return rc; } int msm_vidc_set_internal_config(struct msm_vidc_inst *inst) { int rc = 0; u32 rc_mode; bool set_rc = false; struct hal_vbv_hdr_buf_size hrd_buf_size; struct hal_enable latency; struct hfi_device *hdev; u32 codec; if (!inst || !inst->core || !inst->core->device) { dprintk(VIDC_WARN, "%s: Invalid parameter\n", __func__); return -EINVAL; } if (inst->session_type != MSM_VIDC_ENCODER) return rc; hdev = inst->core->device; codec = inst->fmts[CAPTURE_PORT].fourcc; rc_mode = msm_comm_g_ctrl_for_id(inst, V4L2_CID_MPEG_VIDEO_BITRATE_MODE); latency.enable = msm_comm_g_ctrl_for_id(inst, V4L2_CID_MPEG_VIDC_VIDEO_LOWLATENCY_MODE); if (rc_mode == V4L2_MPEG_VIDEO_BITRATE_MODE_MBR_VFR) { rc_mode = V4L2_MPEG_VIDEO_BITRATE_MODE_MBR; set_rc = true; } else if (rc_mode == V4L2_MPEG_VIDEO_BITRATE_MODE_VBR && latency.enable == V4L2_MPEG_MSM_VIDC_ENABLE && codec != V4L2_PIX_FMT_VP8) { rc_mode = V4L2_MPEG_VIDEO_BITRATE_MODE_CBR; set_rc = true; } if (set_rc) { rc = call_hfi_op(hdev, session_set_property, (void *)inst->session, HAL_PARAM_VENC_RATE_CONTROL, (void *)&rc_mode); } if ((rc_mode == V4L2_MPEG_VIDEO_BITRATE_MODE_CBR || rc_mode == V4L2_MPEG_VIDEO_BITRATE_MODE_CBR_VFR) && (codec != V4L2_PIX_FMT_VP8)) { hrd_buf_size.vbv_hdr_buf_size = 1000; dprintk(VIDC_DBG, "Enable cbr+ hdr_buf_size %d :\n", hrd_buf_size.vbv_hdr_buf_size); rc = call_hfi_op(hdev, session_set_property, (void *)inst->session, HAL_CONFIG_VENC_VBV_HRD_BUF_SIZE, (void *)&hrd_buf_size); latency.enable = V4L2_MPEG_MSM_VIDC_ENABLE; rc = call_hfi_op(hdev, session_set_property, (void *)inst->session, HAL_PARAM_VENC_LOW_LATENCY, (void *)&latency); inst->clk_data.low_latency_mode = latency.enable; } return rc; } static inline int start_streaming(struct msm_vidc_inst *inst) { int rc = 0; Loading @@ -930,6 +993,13 @@ static inline int start_streaming(struct msm_vidc_inst *inst) goto fail_start; } rc = msm_vidc_set_internal_config(inst); if (rc) { dprintk(VIDC_ERR, "Set internal config failed %pK\n", inst); goto fail_start; } /* Decide work route for current session */ rc = msm_vidc_decide_work_route(inst); if (rc) { Loading
drivers/media/platform/msm/vidc/vidc_hfi_api.h +5 −0 Original line number Diff line number Diff line Loading @@ -215,6 +215,7 @@ enum hal_property { HAL_PARAM_SECURE, HAL_PARAM_VENC_HDR10_PQ_SEI, HAL_PARAM_VIDEO_WORK_ROUTE, HAL_CONFIG_VENC_VBV_HRD_BUF_SIZE, }; enum hal_domain { Loading Loading @@ -1406,6 +1407,10 @@ struct hal_hdr10_pq_sei { struct msm_vidc_content_light_level_sei_payload cll_sei; }; struct hal_vbv_hdr_buf_size { u32 vbv_hdr_buf_size; }; #define call_hfi_op(q, op, args...) \ (((q) && (q)->op) ? ((q)->op(args)) : 0) Loading
drivers/media/platform/msm/vidc/vidc_hfi_helper.h +6 −0 Original line number Diff line number Diff line Loading @@ -350,6 +350,8 @@ struct hfi_buffer_info { (HFI_PROPERTY_CONFIG_VENC_COMMON_START + 0x00A) #define HFI_PROPERTY_CONFIG_VENC_HIER_P_ENH_LAYER \ (HFI_PROPERTY_CONFIG_VENC_COMMON_START + 0x00B) #define HFI_PROPERTY_CONFIG_VENC_VBV_HRD_BUF_SIZE \ (HFI_PROPERTY_CONFIG_VENC_COMMON_START + 0x00D) #define HFI_PROPERTY_CONFIG_VENC_PERF_MODE \ (HFI_PROPERTY_CONFIG_VENC_COMMON_START + 0x00E) #define HFI_PROPERTY_CONFIG_VENC_BASELAYER_PRIORITYID \ Loading Loading @@ -1117,4 +1119,8 @@ struct hfi_hdr10_pq_sei { struct hfi_content_light_level_sei_payload cll_info; }; struct hfi_vbv_hdr_buf_size { u32 vbv_hdr_buf_size; }; #endif