video: driver: Set secure mode in encoder
Enable HFI_PROP_SECURE when secure session is enabled in encoder. Same behaviour as Decoder. Change-Id: I5edfe3d735fda8edea9e491ae17546945b4431a1 Signed-off-by: Chinmay Sawarkar <chinmays@codeaurora.org>
This commit is contained in:
@@ -222,7 +222,7 @@ static struct msm_platform_inst_capability instance_data_waipio[] = {
|
||||
1, V4L2_MPEG_MSM_VIDC_DISABLE,
|
||||
V4L2_CID_MPEG_VIDC_SECURE,
|
||||
HFI_PROP_SECURE,
|
||||
CAP_FLAG_ROOT,
|
||||
CAP_FLAG_NONE,
|
||||
{0},
|
||||
{0},
|
||||
NULL, msm_vidc_set_u32},
|
||||
|
@@ -304,6 +304,7 @@ int msm_vidc_remove_session(struct msm_vidc_inst *inst);
|
||||
int msm_vidc_add_session(struct msm_vidc_inst *inst);
|
||||
int msm_vidc_session_open(struct msm_vidc_inst *inst);
|
||||
int msm_vidc_session_set_codec(struct msm_vidc_inst *inst);
|
||||
int msm_vidc_session_set_secure_mode(struct msm_vidc_inst *inst);
|
||||
int msm_vidc_session_set_default_header(struct msm_vidc_inst *inst);
|
||||
int msm_vidc_session_streamon(struct msm_vidc_inst *inst,
|
||||
enum msm_vidc_port_type port);
|
||||
|
@@ -44,6 +44,7 @@ int venus_hfi_stop(struct msm_vidc_inst *inst, enum msm_vidc_port_type port);
|
||||
int venus_hfi_session_close(struct msm_vidc_inst *inst);
|
||||
int venus_hfi_session_open(struct msm_vidc_inst *inst);
|
||||
int venus_hfi_session_set_codec(struct msm_vidc_inst *inst);
|
||||
int venus_hfi_session_set_secure_mode(struct msm_vidc_inst *inst);
|
||||
int venus_hfi_core_init(struct msm_vidc_core *core);
|
||||
int venus_hfi_core_deinit(struct msm_vidc_core *core);
|
||||
int venus_hfi_noc_error_info(struct msm_vidc_core *core);
|
||||
|
@@ -557,27 +557,6 @@ static int msm_vdec_set_output_order(struct msm_vidc_inst *inst,
|
||||
return rc;
|
||||
}
|
||||
|
||||
static int msm_vdec_set_secure_mode(struct msm_vidc_inst *inst,
|
||||
enum msm_vidc_port_type port)
|
||||
{
|
||||
int rc = 0;
|
||||
u32 secure_mode;
|
||||
|
||||
secure_mode = inst->capabilities->cap[SECURE_MODE].value;
|
||||
i_vpr_h(inst, "%s: secure mode: %d", __func__, secure_mode);
|
||||
rc = venus_hfi_session_property(inst,
|
||||
HFI_PROP_SECURE,
|
||||
HFI_HOST_FLAGS_NONE,
|
||||
HFI_PORT_NONE,
|
||||
HFI_PAYLOAD_U32,
|
||||
&secure_mode,
|
||||
sizeof(u32));
|
||||
if (rc)
|
||||
i_vpr_e(inst, "%s: set property failed\n", __func__);
|
||||
|
||||
return rc;
|
||||
}
|
||||
|
||||
static int msm_vdec_set_rap_frame(struct msm_vidc_inst *inst,
|
||||
enum msm_vidc_port_type port)
|
||||
{
|
||||
@@ -718,10 +697,6 @@ static int msm_vdec_set_input_properties(struct msm_vidc_inst *inst)
|
||||
if (rc)
|
||||
return rc;
|
||||
|
||||
rc = msm_vdec_set_secure_mode(inst, INPUT_PORT);
|
||||
if (rc)
|
||||
return rc;
|
||||
|
||||
rc = msm_vdec_set_thumbnail_mode(inst, INPUT_PORT);
|
||||
if (rc)
|
||||
return rc;
|
||||
|
@@ -3641,6 +3641,22 @@ int msm_vidc_session_set_codec(struct msm_vidc_inst *inst)
|
||||
return 0;
|
||||
}
|
||||
|
||||
int msm_vidc_session_set_secure_mode(struct msm_vidc_inst *inst)
|
||||
{
|
||||
int rc = 0;
|
||||
|
||||
if (!inst) {
|
||||
d_vpr_e("%s: invalid params\n", __func__);
|
||||
return -EINVAL;
|
||||
}
|
||||
|
||||
rc = venus_hfi_session_set_secure_mode(inst);
|
||||
if (rc)
|
||||
return rc;
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
||||
int msm_vidc_session_set_default_header(struct msm_vidc_inst *inst)
|
||||
{
|
||||
int rc = 0;
|
||||
|
@@ -180,6 +180,10 @@ int msm_vidc_start_streaming(struct vb2_queue *q, unsigned int count)
|
||||
if (rc)
|
||||
return rc;
|
||||
|
||||
rc = msm_vidc_session_set_secure_mode(inst);
|
||||
if (rc)
|
||||
return rc;
|
||||
|
||||
if (is_encode_session(inst)) {
|
||||
rc = msm_vidc_alloc_and_queue_session_internal_buffers(inst,
|
||||
MSM_VIDC_BUF_ARP);
|
||||
|
@@ -3069,6 +3069,50 @@ unlock:
|
||||
return rc;
|
||||
}
|
||||
|
||||
int venus_hfi_session_set_secure_mode(struct msm_vidc_inst *inst)
|
||||
{
|
||||
int rc = 0;
|
||||
struct msm_vidc_core *core;
|
||||
u32 secure_mode;
|
||||
|
||||
if (!inst || !inst->core || !inst->packet) {
|
||||
d_vpr_e("%s: invalid params\n", __func__);
|
||||
return -EINVAL;
|
||||
}
|
||||
core = inst->core;
|
||||
core_lock(core, __func__);
|
||||
|
||||
if (!__valdiate_session(core, inst, __func__)) {
|
||||
rc = -EINVAL;
|
||||
goto unlock;
|
||||
}
|
||||
|
||||
rc = hfi_create_header(inst->packet, inst->packet_size,
|
||||
inst->session_id, core->header_id++);
|
||||
if (rc)
|
||||
goto unlock;
|
||||
|
||||
secure_mode = inst->capabilities->cap[SECURE_MODE].value;
|
||||
rc = hfi_create_packet(inst->packet, inst->packet_size,
|
||||
HFI_PROP_SECURE,
|
||||
HFI_HOST_FLAGS_NONE,
|
||||
HFI_PAYLOAD_U32,
|
||||
HFI_PORT_NONE,
|
||||
core->packet_id++,
|
||||
&secure_mode,
|
||||
sizeof(u32));
|
||||
if (rc)
|
||||
goto unlock;
|
||||
|
||||
rc = __iface_cmdq_write(inst->core, inst->packet);
|
||||
if (rc)
|
||||
goto unlock;
|
||||
|
||||
unlock:
|
||||
core_unlock(core, __func__);
|
||||
return rc;
|
||||
}
|
||||
|
||||
int venus_hfi_session_property(struct msm_vidc_inst *inst,
|
||||
u32 pkt_type, u32 flags, u32 port, u32 payload_type,
|
||||
void *payload, u32 payload_size)
|
||||
|
Reference in New Issue
Block a user