Loading Documentation/devicetree/bindings/media/video/msm-vidc.txt +3 −0 Original line number Diff line number Diff line Loading @@ -125,6 +125,9 @@ Optional properties: internal cmd queue = 0x800 - qcom,pm-qos-latency-us = The latency used to vote for QOS power manager. This value is typically max(latencies of every cluster at all power levels) + 1 - qcom,max-secure-instances = An int containing max number of concurrent secure instances supported, accounting for venus and system wide limitations like memory, performance etc. [Second level nodes] Context Banks Loading arch/arm/boot/dts/qcom/msm8996-vidc.dtsi +1 −0 Original line number Diff line number Diff line Loading @@ -36,6 +36,7 @@ qcom,imem-size = <524288>; /* 512 kB */ qcom,never-unload-fw; qcom,sw-power-collapse; qcom,max-secure-instances = <5>; qcom,load-freq-tbl = /* Encoders */ <972000 490000000 0x55555555>, /* 4k UHD @ 30 */ Loading drivers/media/platform/msm/vidc/hfi_response_handler.c +13 −0 Original line number Diff line number Diff line Loading @@ -546,6 +546,7 @@ static int hfi_fill_codec_info(u8 *data_ptr, u32 codecs = 0, codec_count = 0, size = 0; struct msm_vidc_capability *capability; u32 prop_id = *((u32 *)data_ptr); u8 *orig_data_ptr = data_ptr; if (prop_id == HFI_PROPERTY_PARAM_CODEC_SUPPORTED) { struct hfi_codec_supported *prop; Loading Loading @@ -586,6 +587,18 @@ static int hfi_fill_codec_info(u8 *data_ptr, } } sys_init_done->codec_count = codec_count; prop_id = *((u32 *)(orig_data_ptr + size)); if (prop_id == HFI_PROPERTY_PARAM_MAX_SESSIONS_SUPPORTED) { struct hfi_max_sessions_supported *prop = (struct hfi_max_sessions_supported *) (orig_data_ptr + size + sizeof(u32)); sys_init_done->max_sessions_supported = prop->max_sessions; size += sizeof(struct hfi_max_sessions_supported) + sizeof(u32); dprintk(VIDC_DBG, "max_sessions_supported %d\n", prop->max_sessions); } return size; } Loading drivers/media/platform/msm/vidc/msm_vidc.c +32 −1 Original line number Diff line number Diff line Loading @@ -1099,6 +1099,30 @@ int msm_vidc_dqevent(void *inst, struct v4l2_event *event) } EXPORT_SYMBOL(msm_vidc_dqevent); static bool msm_vidc_check_for_inst_overload(struct msm_vidc_core *core) { u32 instance_count = 0; u32 secure_instance_count = 0; struct msm_vidc_inst *inst = NULL; bool overload = false; mutex_lock(&core->lock); list_for_each_entry(inst, &core->instances, list) { instance_count++; /* This flag is not updated yet for the current instance */ if (inst->flags & VIDC_SECURE) secure_instance_count++; } mutex_unlock(&core->lock); /* Instance count includes current instance as well. */ if ((instance_count > core->resources.max_inst_count) || (secure_instance_count > core->resources.max_secure_inst_count)) overload = true; return overload; } void *msm_vidc_open(int core_id, int session_type) { struct msm_vidc_inst *inst = NULL; Loading Loading @@ -1190,12 +1214,19 @@ void *msm_vidc_open(int core_id, int session_type) list_add_tail(&inst->list, &core->instances); mutex_unlock(&core->lock); rc = msm_comm_try_state(inst, MSM_VIDC_CORE_INIT); rc = msm_comm_try_state(inst, MSM_VIDC_CORE_INIT_DONE); if (rc) { dprintk(VIDC_ERR, "Failed to move video instance to init state\n"); goto fail_init; } if (msm_vidc_check_for_inst_overload(core)) { dprintk(VIDC_ERR, "Instance count reached Max limit, rejecting session"); goto fail_init; } inst->debugfs_root = msm_vidc_debugfs_init_inst(inst, core->debugfs_root); Loading drivers/media/platform/msm/vidc/msm_vidc_common.c +12 −0 Original line number Diff line number Diff line Loading @@ -47,6 +47,8 @@ #define V4L2_EVENT_SEQ_BITDEPTH_CHANGED_INSUFFICIENT \ V4L2_EVENT_MSM_VIDC_PORT_SETTINGS_BITDEPTH_CHANGED_INSUFFICIENT #define MAX_SUPPORTED_INSTANCES 16 struct getprop_buf { struct list_head list; void *data; Loading Loading @@ -628,6 +630,16 @@ static void handle_sys_init_done(enum hal_command_response cmd, void *data) core->enc_codec_supported = sys_init_msg->enc_codec_supported; core->dec_codec_supported = sys_init_msg->dec_codec_supported; /* This should come from sys_init_done */ core->resources.max_inst_count = sys_init_msg->max_sessions_supported ? : MAX_SUPPORTED_INSTANCES; core->resources.max_secure_inst_count = core->resources.max_secure_inst_count ? : core->resources.max_inst_count; if (core->id == MSM_VIDC_CORE_VENUS && (core->dec_codec_supported & HAL_VIDEO_CODEC_H264)) core->dec_codec_supported |= Loading Loading
Documentation/devicetree/bindings/media/video/msm-vidc.txt +3 −0 Original line number Diff line number Diff line Loading @@ -125,6 +125,9 @@ Optional properties: internal cmd queue = 0x800 - qcom,pm-qos-latency-us = The latency used to vote for QOS power manager. This value is typically max(latencies of every cluster at all power levels) + 1 - qcom,max-secure-instances = An int containing max number of concurrent secure instances supported, accounting for venus and system wide limitations like memory, performance etc. [Second level nodes] Context Banks Loading
arch/arm/boot/dts/qcom/msm8996-vidc.dtsi +1 −0 Original line number Diff line number Diff line Loading @@ -36,6 +36,7 @@ qcom,imem-size = <524288>; /* 512 kB */ qcom,never-unload-fw; qcom,sw-power-collapse; qcom,max-secure-instances = <5>; qcom,load-freq-tbl = /* Encoders */ <972000 490000000 0x55555555>, /* 4k UHD @ 30 */ Loading
drivers/media/platform/msm/vidc/hfi_response_handler.c +13 −0 Original line number Diff line number Diff line Loading @@ -546,6 +546,7 @@ static int hfi_fill_codec_info(u8 *data_ptr, u32 codecs = 0, codec_count = 0, size = 0; struct msm_vidc_capability *capability; u32 prop_id = *((u32 *)data_ptr); u8 *orig_data_ptr = data_ptr; if (prop_id == HFI_PROPERTY_PARAM_CODEC_SUPPORTED) { struct hfi_codec_supported *prop; Loading Loading @@ -586,6 +587,18 @@ static int hfi_fill_codec_info(u8 *data_ptr, } } sys_init_done->codec_count = codec_count; prop_id = *((u32 *)(orig_data_ptr + size)); if (prop_id == HFI_PROPERTY_PARAM_MAX_SESSIONS_SUPPORTED) { struct hfi_max_sessions_supported *prop = (struct hfi_max_sessions_supported *) (orig_data_ptr + size + sizeof(u32)); sys_init_done->max_sessions_supported = prop->max_sessions; size += sizeof(struct hfi_max_sessions_supported) + sizeof(u32); dprintk(VIDC_DBG, "max_sessions_supported %d\n", prop->max_sessions); } return size; } Loading
drivers/media/platform/msm/vidc/msm_vidc.c +32 −1 Original line number Diff line number Diff line Loading @@ -1099,6 +1099,30 @@ int msm_vidc_dqevent(void *inst, struct v4l2_event *event) } EXPORT_SYMBOL(msm_vidc_dqevent); static bool msm_vidc_check_for_inst_overload(struct msm_vidc_core *core) { u32 instance_count = 0; u32 secure_instance_count = 0; struct msm_vidc_inst *inst = NULL; bool overload = false; mutex_lock(&core->lock); list_for_each_entry(inst, &core->instances, list) { instance_count++; /* This flag is not updated yet for the current instance */ if (inst->flags & VIDC_SECURE) secure_instance_count++; } mutex_unlock(&core->lock); /* Instance count includes current instance as well. */ if ((instance_count > core->resources.max_inst_count) || (secure_instance_count > core->resources.max_secure_inst_count)) overload = true; return overload; } void *msm_vidc_open(int core_id, int session_type) { struct msm_vidc_inst *inst = NULL; Loading Loading @@ -1190,12 +1214,19 @@ void *msm_vidc_open(int core_id, int session_type) list_add_tail(&inst->list, &core->instances); mutex_unlock(&core->lock); rc = msm_comm_try_state(inst, MSM_VIDC_CORE_INIT); rc = msm_comm_try_state(inst, MSM_VIDC_CORE_INIT_DONE); if (rc) { dprintk(VIDC_ERR, "Failed to move video instance to init state\n"); goto fail_init; } if (msm_vidc_check_for_inst_overload(core)) { dprintk(VIDC_ERR, "Instance count reached Max limit, rejecting session"); goto fail_init; } inst->debugfs_root = msm_vidc_debugfs_init_inst(inst, core->debugfs_root); Loading
drivers/media/platform/msm/vidc/msm_vidc_common.c +12 −0 Original line number Diff line number Diff line Loading @@ -47,6 +47,8 @@ #define V4L2_EVENT_SEQ_BITDEPTH_CHANGED_INSUFFICIENT \ V4L2_EVENT_MSM_VIDC_PORT_SETTINGS_BITDEPTH_CHANGED_INSUFFICIENT #define MAX_SUPPORTED_INSTANCES 16 struct getprop_buf { struct list_head list; void *data; Loading Loading @@ -628,6 +630,16 @@ static void handle_sys_init_done(enum hal_command_response cmd, void *data) core->enc_codec_supported = sys_init_msg->enc_codec_supported; core->dec_codec_supported = sys_init_msg->dec_codec_supported; /* This should come from sys_init_done */ core->resources.max_inst_count = sys_init_msg->max_sessions_supported ? : MAX_SUPPORTED_INSTANCES; core->resources.max_secure_inst_count = core->resources.max_secure_inst_count ? : core->resources.max_inst_count; if (core->id == MSM_VIDC_CORE_VENUS && (core->dec_codec_supported & HAL_VIDEO_CODEC_H264)) core->dec_codec_supported |= Loading