Loading msm/vidc/hfi_common.c +2 −0 Original line number Diff line number Diff line Loading @@ -3956,6 +3956,7 @@ static int __protect_cp_mem(struct venus_hfi_device *device) memprot.cp_nonpixel_start = 0x0; memprot.cp_nonpixel_size = 0x0; mutex_lock(&device->res->cb_lock); list_for_each_entry(cb, &device->res->context_banks, list) { if (!strcmp(cb->name, "venus_ns")) { desc.args[1] = memprot.cp_size = Loading @@ -3974,6 +3975,7 @@ static int __protect_cp_mem(struct venus_hfi_device *device) memprot.cp_nonpixel_size); } } mutex_unlock(&device->res->cb_lock); desc.arginfo = SCM_ARGS(4); rc = scm_call2(SCM_SIP_FNID(SCM_SVC_MP, Loading msm/vidc/msm_smem.c +2 −0 Original line number Diff line number Diff line Loading @@ -591,6 +591,7 @@ struct context_bank_info *msm_smem_get_context_bank(u32 session_type, buffer_type = HAL_BUFFER_INTERNAL_PERSIST_1; } mutex_lock(&res->cb_lock); list_for_each_entry(cb, &res->context_banks, list) { if (cb->is_secure == is_secure && cb->buffer_type & buffer_type) { Loading @@ -598,6 +599,7 @@ struct context_bank_info *msm_smem_get_context_bank(u32 session_type, break; } } mutex_unlock(&res->cb_lock); if (!match) s_vpr_e(sid, "%s: cb not found for buffer_type %x, is_secure %d\n", Loading msm/vidc/msm_v4l2_vidc.c +2 −0 Original line number Diff line number Diff line Loading @@ -313,6 +313,7 @@ static int msm_vidc_initialize_core(struct platform_device *pdev, INIT_LIST_HEAD(&core->instances); mutex_init(&core->lock); mutex_init(&core->resources.cb_lock); core->state = VIDC_CORE_UNINIT; for (i = SYS_MSG_INDEX(SYS_MSG_START); Loading Loading @@ -697,6 +698,7 @@ static int msm_vidc_remove(struct platform_device *pdev) msm_vidc_free_platform_resources(&core->resources); sysfs_remove_group(&pdev->dev.kobj, &msm_vidc_core_attr_group); dev_set_drvdata(&pdev->dev, NULL); mutex_destroy(&core->resources.cb_lock); mutex_destroy(&core->lock); kfree(core); return rc; Loading msm/vidc/msm_venc.c +9 −5 Original line number Diff line number Diff line Loading @@ -1683,6 +1683,10 @@ int msm_venc_s_ctrl(struct msm_vidc_inst *inst, struct v4l2_ctrl *ctrl) case V4L2_CID_MPEG_VIDC_VIDEO_OPERATING_RATE: if (!is_valid_operating_rate(inst, ctrl->val)) break; inst->flags &= ~VIDC_TURBO; if (ctrl->val == INT_MAX) inst->flags |= VIDC_TURBO; else inst->clk_data.operating_rate = ctrl->val; /* For HEIC image encode, set operating rate to 1 */ if (is_grid_session(inst)) { Loading @@ -1690,9 +1694,6 @@ int msm_venc_s_ctrl(struct msm_vidc_inst *inst, struct v4l2_ctrl *ctrl) __func__); inst->clk_data.operating_rate = 1 << 16; } inst->flags &= ~VIDC_TURBO; if (ctrl->val == INT_MAX) inst->flags |= VIDC_TURBO; if (inst->state < MSM_VIDC_LOAD_RESOURCES) msm_vidc_calculate_buffer_counts(inst); if (inst->state == MSM_VIDC_START_DONE) { Loading Loading @@ -4366,10 +4367,13 @@ int msm_venc_set_extradata(struct msm_vidc_inst *inst) } } if (inst->prop.extradata_ctrls & EXTRADATA_ADVANCED) if (inst->prop.extradata_ctrls & EXTRADATA_ADVANCED) { // Enable Advanced Extradata - LTR Info msm_comm_set_extradata(inst, HFI_PROPERTY_PARAM_VENC_LTR_INFO, 0x1); msm_comm_set_extradata(inst, HFI_PROPERTY_PARAM_VENC_FRAME_QP_EXTRADATA, 0x1); } if (inst->prop.extradata_ctrls & EXTRADATA_ENC_INPUT_ROI) // Enable ROIQP Extradata Loading msm/vidc/msm_vidc_common.c +49 −8 Original line number Diff line number Diff line Loading @@ -3247,6 +3247,7 @@ int msm_comm_update_dpb_bufreqs(struct msm_vidc_inst *inst) fmt = &inst->fmts[OUTPUT_PORT]; /* For DPB buffers, Always use min count */ req->buffer_count_min = req->buffer_count_min_host = req->buffer_count_actual = fmt->count_min; hfi_fmt = msm_comm_convert_color_fmt(inst->clk_data.dpb_fourcc, Loading Loading @@ -5765,26 +5766,29 @@ int msm_comm_check_memory_supported(struct msm_vidc_inst *vidc_inst) struct msm_vidc_format *fmt; struct v4l2_format *f; struct hal_buffer_requirements *req; struct context_bank_info *cb = NULL; u32 i, dpb_cnt = 0, dpb_size = 0, rc = 0; u64 mem_size = 0; u32 inst_mem_size, non_sec_cb_size = 0; u64 total_mem_size = 0, non_sec_mem_size = 0; u32 memory_limit_mbytes; core = vidc_inst->core; mutex_lock(&core->lock); list_for_each_entry(inst, &core->instances, list) { inst_mem_size = 0; /* input port buffers memory size */ fmt = &inst->fmts[INPUT_PORT]; f = &fmt->v4l2_fmt; for (i = 0; i < f->fmt.pix_mp.num_planes; i++) mem_size += f->fmt.pix_mp.plane_fmt[i].sizeimage * inst_mem_size += f->fmt.pix_mp.plane_fmt[i].sizeimage * fmt->count_actual; /* output port buffers memory size */ fmt = &inst->fmts[OUTPUT_PORT]; f = &fmt->v4l2_fmt; for (i = 0; i < f->fmt.pix_mp.num_planes; i++) mem_size += f->fmt.pix_mp.plane_fmt[i].sizeimage * inst_mem_size += f->fmt.pix_mp.plane_fmt[i].sizeimage * fmt->count_actual; /* dpb buffers memory size */ Loading @@ -5801,29 +5805,49 @@ int msm_comm_check_memory_supported(struct msm_vidc_inst *vidc_inst) } dpb_cnt = dpb.buffer_count_actual; dpb_size = dpb.buffer_size; mem_size += dpb_cnt * dpb_size; inst_mem_size += dpb_cnt * dpb_size; } /* internal buffers memory size */ for (i = 0; i < HAL_BUFFER_MAX; i++) { req = &inst->buff_req.buffer[i]; if (is_internal_buffer(req->buffer_type)) mem_size += req->buffer_size * inst_mem_size += req->buffer_size * req->buffer_count_actual; } if (!is_secure_session(inst)) non_sec_mem_size += inst_mem_size; total_mem_size += inst_mem_size; } mutex_unlock(&core->lock); memory_limit_mbytes = msm_comm_get_memory_limit(core); if ((mem_size >> 20) > memory_limit_mbytes) { if ((total_mem_size >> 20) > memory_limit_mbytes) { s_vpr_e(vidc_inst->sid, "%s: video mem overshoot - reached %llu MB, max_limit %llu MB\n", __func__, mem_size >> 20, memory_limit_mbytes); msm_comm_print_mem_usage(core); __func__, total_mem_size >> 20, memory_limit_mbytes); msm_comm_print_insts_info(core); return -EBUSY; } if (!is_secure_session(vidc_inst)) { mutex_lock(&core->resources.cb_lock); list_for_each_entry(cb, &core->resources.context_banks, list) if (!cb->is_secure) non_sec_cb_size = cb->addr_range.size; mutex_unlock(&core->resources.cb_lock); if (non_sec_mem_size > non_sec_cb_size) { s_vpr_e(vidc_inst->sid, "%s: insufficient device addr space, required %llu, available %llu\n", __func__, non_sec_mem_size, non_sec_cb_size); msm_comm_print_insts_info(core); return -EINVAL; } } return 0; } Loading Loading @@ -6342,6 +6366,23 @@ void msm_comm_print_inst_info(struct msm_vidc_inst *inst) mutex_unlock(&inst->cvpbufs.lock); } void msm_comm_print_insts_info(struct msm_vidc_core *core) { struct msm_vidc_inst *inst = NULL; if (!core) { d_vpr_e("%s: invalid params\n", __func__); return; } msm_comm_print_mem_usage(core); mutex_lock(&core->lock); list_for_each_entry(inst, &core->instances, list) msm_comm_print_inst_info(inst); mutex_unlock(&core->lock); } int msm_comm_session_continue(void *instance) { struct msm_vidc_inst *inst = instance; Loading Loading
msm/vidc/hfi_common.c +2 −0 Original line number Diff line number Diff line Loading @@ -3956,6 +3956,7 @@ static int __protect_cp_mem(struct venus_hfi_device *device) memprot.cp_nonpixel_start = 0x0; memprot.cp_nonpixel_size = 0x0; mutex_lock(&device->res->cb_lock); list_for_each_entry(cb, &device->res->context_banks, list) { if (!strcmp(cb->name, "venus_ns")) { desc.args[1] = memprot.cp_size = Loading @@ -3974,6 +3975,7 @@ static int __protect_cp_mem(struct venus_hfi_device *device) memprot.cp_nonpixel_size); } } mutex_unlock(&device->res->cb_lock); desc.arginfo = SCM_ARGS(4); rc = scm_call2(SCM_SIP_FNID(SCM_SVC_MP, Loading
msm/vidc/msm_smem.c +2 −0 Original line number Diff line number Diff line Loading @@ -591,6 +591,7 @@ struct context_bank_info *msm_smem_get_context_bank(u32 session_type, buffer_type = HAL_BUFFER_INTERNAL_PERSIST_1; } mutex_lock(&res->cb_lock); list_for_each_entry(cb, &res->context_banks, list) { if (cb->is_secure == is_secure && cb->buffer_type & buffer_type) { Loading @@ -598,6 +599,7 @@ struct context_bank_info *msm_smem_get_context_bank(u32 session_type, break; } } mutex_unlock(&res->cb_lock); if (!match) s_vpr_e(sid, "%s: cb not found for buffer_type %x, is_secure %d\n", Loading
msm/vidc/msm_v4l2_vidc.c +2 −0 Original line number Diff line number Diff line Loading @@ -313,6 +313,7 @@ static int msm_vidc_initialize_core(struct platform_device *pdev, INIT_LIST_HEAD(&core->instances); mutex_init(&core->lock); mutex_init(&core->resources.cb_lock); core->state = VIDC_CORE_UNINIT; for (i = SYS_MSG_INDEX(SYS_MSG_START); Loading Loading @@ -697,6 +698,7 @@ static int msm_vidc_remove(struct platform_device *pdev) msm_vidc_free_platform_resources(&core->resources); sysfs_remove_group(&pdev->dev.kobj, &msm_vidc_core_attr_group); dev_set_drvdata(&pdev->dev, NULL); mutex_destroy(&core->resources.cb_lock); mutex_destroy(&core->lock); kfree(core); return rc; Loading
msm/vidc/msm_venc.c +9 −5 Original line number Diff line number Diff line Loading @@ -1683,6 +1683,10 @@ int msm_venc_s_ctrl(struct msm_vidc_inst *inst, struct v4l2_ctrl *ctrl) case V4L2_CID_MPEG_VIDC_VIDEO_OPERATING_RATE: if (!is_valid_operating_rate(inst, ctrl->val)) break; inst->flags &= ~VIDC_TURBO; if (ctrl->val == INT_MAX) inst->flags |= VIDC_TURBO; else inst->clk_data.operating_rate = ctrl->val; /* For HEIC image encode, set operating rate to 1 */ if (is_grid_session(inst)) { Loading @@ -1690,9 +1694,6 @@ int msm_venc_s_ctrl(struct msm_vidc_inst *inst, struct v4l2_ctrl *ctrl) __func__); inst->clk_data.operating_rate = 1 << 16; } inst->flags &= ~VIDC_TURBO; if (ctrl->val == INT_MAX) inst->flags |= VIDC_TURBO; if (inst->state < MSM_VIDC_LOAD_RESOURCES) msm_vidc_calculate_buffer_counts(inst); if (inst->state == MSM_VIDC_START_DONE) { Loading Loading @@ -4366,10 +4367,13 @@ int msm_venc_set_extradata(struct msm_vidc_inst *inst) } } if (inst->prop.extradata_ctrls & EXTRADATA_ADVANCED) if (inst->prop.extradata_ctrls & EXTRADATA_ADVANCED) { // Enable Advanced Extradata - LTR Info msm_comm_set_extradata(inst, HFI_PROPERTY_PARAM_VENC_LTR_INFO, 0x1); msm_comm_set_extradata(inst, HFI_PROPERTY_PARAM_VENC_FRAME_QP_EXTRADATA, 0x1); } if (inst->prop.extradata_ctrls & EXTRADATA_ENC_INPUT_ROI) // Enable ROIQP Extradata Loading
msm/vidc/msm_vidc_common.c +49 −8 Original line number Diff line number Diff line Loading @@ -3247,6 +3247,7 @@ int msm_comm_update_dpb_bufreqs(struct msm_vidc_inst *inst) fmt = &inst->fmts[OUTPUT_PORT]; /* For DPB buffers, Always use min count */ req->buffer_count_min = req->buffer_count_min_host = req->buffer_count_actual = fmt->count_min; hfi_fmt = msm_comm_convert_color_fmt(inst->clk_data.dpb_fourcc, Loading Loading @@ -5765,26 +5766,29 @@ int msm_comm_check_memory_supported(struct msm_vidc_inst *vidc_inst) struct msm_vidc_format *fmt; struct v4l2_format *f; struct hal_buffer_requirements *req; struct context_bank_info *cb = NULL; u32 i, dpb_cnt = 0, dpb_size = 0, rc = 0; u64 mem_size = 0; u32 inst_mem_size, non_sec_cb_size = 0; u64 total_mem_size = 0, non_sec_mem_size = 0; u32 memory_limit_mbytes; core = vidc_inst->core; mutex_lock(&core->lock); list_for_each_entry(inst, &core->instances, list) { inst_mem_size = 0; /* input port buffers memory size */ fmt = &inst->fmts[INPUT_PORT]; f = &fmt->v4l2_fmt; for (i = 0; i < f->fmt.pix_mp.num_planes; i++) mem_size += f->fmt.pix_mp.plane_fmt[i].sizeimage * inst_mem_size += f->fmt.pix_mp.plane_fmt[i].sizeimage * fmt->count_actual; /* output port buffers memory size */ fmt = &inst->fmts[OUTPUT_PORT]; f = &fmt->v4l2_fmt; for (i = 0; i < f->fmt.pix_mp.num_planes; i++) mem_size += f->fmt.pix_mp.plane_fmt[i].sizeimage * inst_mem_size += f->fmt.pix_mp.plane_fmt[i].sizeimage * fmt->count_actual; /* dpb buffers memory size */ Loading @@ -5801,29 +5805,49 @@ int msm_comm_check_memory_supported(struct msm_vidc_inst *vidc_inst) } dpb_cnt = dpb.buffer_count_actual; dpb_size = dpb.buffer_size; mem_size += dpb_cnt * dpb_size; inst_mem_size += dpb_cnt * dpb_size; } /* internal buffers memory size */ for (i = 0; i < HAL_BUFFER_MAX; i++) { req = &inst->buff_req.buffer[i]; if (is_internal_buffer(req->buffer_type)) mem_size += req->buffer_size * inst_mem_size += req->buffer_size * req->buffer_count_actual; } if (!is_secure_session(inst)) non_sec_mem_size += inst_mem_size; total_mem_size += inst_mem_size; } mutex_unlock(&core->lock); memory_limit_mbytes = msm_comm_get_memory_limit(core); if ((mem_size >> 20) > memory_limit_mbytes) { if ((total_mem_size >> 20) > memory_limit_mbytes) { s_vpr_e(vidc_inst->sid, "%s: video mem overshoot - reached %llu MB, max_limit %llu MB\n", __func__, mem_size >> 20, memory_limit_mbytes); msm_comm_print_mem_usage(core); __func__, total_mem_size >> 20, memory_limit_mbytes); msm_comm_print_insts_info(core); return -EBUSY; } if (!is_secure_session(vidc_inst)) { mutex_lock(&core->resources.cb_lock); list_for_each_entry(cb, &core->resources.context_banks, list) if (!cb->is_secure) non_sec_cb_size = cb->addr_range.size; mutex_unlock(&core->resources.cb_lock); if (non_sec_mem_size > non_sec_cb_size) { s_vpr_e(vidc_inst->sid, "%s: insufficient device addr space, required %llu, available %llu\n", __func__, non_sec_mem_size, non_sec_cb_size); msm_comm_print_insts_info(core); return -EINVAL; } } return 0; } Loading Loading @@ -6342,6 +6366,23 @@ void msm_comm_print_inst_info(struct msm_vidc_inst *inst) mutex_unlock(&inst->cvpbufs.lock); } void msm_comm_print_insts_info(struct msm_vidc_core *core) { struct msm_vidc_inst *inst = NULL; if (!core) { d_vpr_e("%s: invalid params\n", __func__); return; } msm_comm_print_mem_usage(core); mutex_lock(&core->lock); list_for_each_entry(inst, &core->instances, list) msm_comm_print_inst_info(inst); mutex_unlock(&core->lock); } int msm_comm_session_continue(void *instance) { struct msm_vidc_inst *inst = instance; Loading