video: driver: fixes for streamoff/streamon

Changes to fix streamon/streamoff functionality.

Change-Id: Ibefa04c5812e0f5a42c578e72eea7650e37c18b0
Signed-off-by: Akshata Sahukar <asahukar@quicinc.com>
This commit is contained in:
Akshata Sahukar
2020-10-08 14:32:12 -07:00
کامیت شده توسط Gerrit - the friendly Code Review server
والد 78857beace
کامیت 2bbf35063f
17فایلهای تغییر یافته به همراه704 افزوده شده و 462 حذف شده

مشاهده پرونده

@@ -62,8 +62,16 @@ u32 get_hfi_port_from_buffer_type(struct msm_vidc_inst *inst,
switch(buffer_type) {
case MSM_VIDC_BUF_INPUT:
case MSM_VIDC_BUF_INPUT_META:
case MSM_VIDC_BUF_BIN:
case MSM_VIDC_BUF_COMV:
case MSM_VIDC_BUF_NON_COMV:
case MSM_VIDC_BUF_LINE:
case MSM_VIDC_BUF_DPB:
hfi_port = HFI_PORT_BITSTREAM;
break;
case MSM_VIDC_BUF_PERSIST:
hfi_port = HFI_PORT_BITSTREAM | HFI_PORT_RAW;
break;
case MSM_VIDC_BUF_OUTPUT:
case MSM_VIDC_BUF_OUTPUT_META:
hfi_port = HFI_PORT_RAW;
@@ -77,8 +85,16 @@ u32 get_hfi_port_from_buffer_type(struct msm_vidc_inst *inst,
switch (buffer_type) {
case MSM_VIDC_BUF_INPUT:
case MSM_VIDC_BUF_INPUT_META:
case MSM_VIDC_BUF_BIN:
case MSM_VIDC_BUF_COMV:
case MSM_VIDC_BUF_NON_COMV:
case MSM_VIDC_BUF_LINE:
case MSM_VIDC_BUF_DPB:
hfi_port = HFI_PORT_RAW;
break;
case MSM_VIDC_BUF_PERSIST:
hfi_port = HFI_PORT_BITSTREAM | HFI_PORT_RAW;
break;
case MSM_VIDC_BUF_OUTPUT:
case MSM_VIDC_BUF_OUTPUT_META:
hfi_port = HFI_PORT_BITSTREAM;
@@ -113,16 +129,18 @@ u32 get_hfi_buffer_type(enum msm_vidc_domain_type domain,
case MSM_VIDC_BUF_INPUT_META:
case MSM_VIDC_BUF_OUTPUT_META:
return HFI_BUFFER_METADATA;
case MSM_VIDC_BUF_SCRATCH:
return HFI_BUFFER_SCRATCH;
case MSM_VIDC_BUF_SCRATCH_1:
return HFI_BUFFER_SCRATCH_1;
case MSM_VIDC_BUF_SCRATCH_2:
return HFI_BUFFER_SCRATCH_2;
case MSM_VIDC_BUF_BIN:
return HFI_BUFFER_BIN;
case MSM_VIDC_BUF_COMV:
return HFI_BUFFER_COMV;
case MSM_VIDC_BUF_NON_COMV:
return HFI_BUFFER_NON_COMV;
case MSM_VIDC_BUF_LINE:
return HFI_BUFFER_LINE;
case MSM_VIDC_BUF_DPB:
return HFI_BUFFER_DPB;
case MSM_VIDC_BUF_PERSIST:
return HFI_BUFFER_PERSIST;
case MSM_VIDC_BUF_PERSIST_1:
return HFI_BUFFER_PERSIST_1;
default:
d_vpr_e("invalid buffer type %d\n",
buffer_type);

مشاهده پرونده

@@ -33,7 +33,7 @@ u32 msm_vdec_subscribe_for_properties[] = {
};
u32 msm_vdec_subscribe_for_metadata[] = {
HFI_PROP_TAG_NOT_PROPAGATED_TO_OUTPUT,
HFI_PROP_BUFFER_TAG,
};
u32 msm_vdec_deliver_as_metadata[] = {
@@ -496,30 +496,44 @@ static int msm_vdec_get_input_internal_buffers(struct msm_vidc_inst *inst)
}
core = inst->core;
inst->buffers.scratch.size = call_session_op(core, buffer_size,
inst, MSM_VIDC_BUF_SCRATCH);
inst->buffers.scratch_1.size = call_session_op(core, buffer_size,
inst, MSM_VIDC_BUF_SCRATCH_1);
inst->buffers.persist_1.size = call_session_op(core, buffer_size,
inst, MSM_VIDC_BUF_PERSIST_1);
inst->buffers.bin.size = call_session_op(core, buffer_size,
inst, MSM_VIDC_BUF_BIN);
inst->buffers.comv.size = call_session_op(core, buffer_size,
inst, MSM_VIDC_BUF_COMV);
inst->buffers.non_comv.size = call_session_op(core, buffer_size,
inst, MSM_VIDC_BUF_NON_COMV);
inst->buffers.line.size = call_session_op(core, buffer_size,
inst, MSM_VIDC_BUF_LINE);
inst->buffers.persist.size = call_session_op(core, buffer_size,
inst, MSM_VIDC_BUF_PERSIST);
inst->buffers.scratch.min_count = call_session_op(core, min_count,
inst, MSM_VIDC_BUF_SCRATCH);
inst->buffers.scratch_1.min_count = call_session_op(core, min_count,
inst, MSM_VIDC_BUF_SCRATCH_1);
inst->buffers.persist_1.min_count = call_session_op(core, min_count,
inst, MSM_VIDC_BUF_PERSIST_1);
inst->buffers.bin.min_count = call_session_op(core, min_count,
inst, MSM_VIDC_BUF_BIN);
inst->buffers.comv.min_count = call_session_op(core, min_count,
inst, MSM_VIDC_BUF_COMV);
inst->buffers.non_comv.min_count = call_session_op(core, min_count,
inst, MSM_VIDC_BUF_NON_COMV);
inst->buffers.line.min_count = call_session_op(core, min_count,
inst, MSM_VIDC_BUF_LINE);
inst->buffers.persist.min_count = call_session_op(core, min_count,
inst, MSM_VIDC_BUF_PERSIST);
s_vpr_h(inst->sid, "internal buffer: min size\n");
s_vpr_h(inst->sid, "scratch buffer: %d %d\n",
inst->buffers.scratch.min_count,
inst->buffers.scratch.size);
s_vpr_h(inst->sid, "scratch1 buffer: %d %d\n",
inst->buffers.scratch_1.min_count,
inst->buffers.scratch_1.size);
s_vpr_h(inst->sid, "persist1 buffer: %d %d\n",
inst->buffers.persist_1.min_count,
inst->buffers.persist_1.size);
s_vpr_h(inst->sid, "bin buffer: %d %d\n",
inst->buffers.bin.min_count,
inst->buffers.bin.size);
s_vpr_h(inst->sid, "comv buffer: %d %d\n",
inst->buffers.comv.min_count,
inst->buffers.comv.size);
s_vpr_h(inst->sid, "non_comv buffer: %d %d\n",
inst->buffers.non_comv.min_count,
inst->buffers.non_comv.size);
s_vpr_h(inst->sid, "line buffer: %d %d\n",
inst->buffers.line.min_count,
inst->buffers.line.size);
s_vpr_h(inst->sid, "persist buffer: %d %d\n",
inst->buffers.persist.min_count,
inst->buffers.persist.size);
return rc;
}
@@ -534,13 +548,19 @@ static int msm_vdec_create_input_internal_buffers(struct msm_vidc_inst *inst)
return -EINVAL;
}
rc = msm_vidc_create_internal_buffers(inst, MSM_VIDC_BUF_SCRATCH);
rc = msm_vidc_create_internal_buffers(inst, MSM_VIDC_BUF_BIN);
if (rc)
return rc;
rc = msm_vidc_create_internal_buffers(inst, MSM_VIDC_BUF_SCRATCH_1);
rc = msm_vidc_create_internal_buffers(inst, MSM_VIDC_BUF_COMV);
if (rc)
return rc;
rc = msm_vidc_create_internal_buffers(inst, MSM_VIDC_BUF_PERSIST_1);
rc = msm_vidc_create_internal_buffers(inst, MSM_VIDC_BUF_NON_COMV);
if (rc)
return rc;
rc = msm_vidc_create_internal_buffers(inst, MSM_VIDC_BUF_LINE);
if (rc)
return rc;
rc = msm_vidc_create_internal_buffers(inst, MSM_VIDC_BUF_PERSIST);
if (rc)
return rc;
@@ -557,18 +577,25 @@ static int msm_vdec_queue_input_internal_buffers(struct msm_vidc_inst *inst)
return -EINVAL;
}
rc = msm_vidc_queue_internal_buffers(inst, MSM_VIDC_BUF_SCRATCH);
rc = msm_vidc_queue_internal_buffers(inst, MSM_VIDC_BUF_BIN);
if (rc)
return rc;
rc = msm_vidc_queue_internal_buffers(inst, MSM_VIDC_BUF_SCRATCH_1);
rc = msm_vidc_queue_internal_buffers(inst, MSM_VIDC_BUF_COMV);
if (rc)
return rc;
rc = msm_vidc_queue_internal_buffers(inst, MSM_VIDC_BUF_PERSIST_1);
rc = msm_vidc_queue_internal_buffers(inst, MSM_VIDC_BUF_NON_COMV);
if (rc)
return rc;
rc = msm_vidc_queue_internal_buffers(inst, MSM_VIDC_BUF_LINE);
if (rc)
return rc;
rc = msm_vidc_queue_internal_buffers(inst, MSM_VIDC_BUF_PERSIST);
if (rc)
return rc;
return 0;
}
/*
static int msm_vdec_release_input_internal_buffers(struct msm_vidc_inst *inst)
{
@@ -614,24 +641,13 @@ static int msm_vdec_port_settings_subscription(struct msm_vidc_inst *inst,
i++)
payload[i + 1] = msm_vdec_subscribe_for_port_settings_change[i];
rc = hfi_create_header(inst->packet, inst->packet_size,
inst->session_id,
core->header_id++);
if (rc)
return rc;
rc = hfi_create_packet(inst->packet, inst->packet_size,
HFI_CMD_SUBSCRIBE_MODE,
(HFI_HOST_FLAGS_RESPONSE_REQUIRED |
HFI_HOST_FLAGS_INTR_REQUIRED),
HFI_PAYLOAD_U32_ARRAY,
get_hfi_port(inst, port),
core->packet_id++,
&payload[0],
(ARRAY_SIZE(msm_vdec_subscribe_for_port_settings_change) + 1) *
sizeof(u32));
if (rc)
return rc;
rc = venus_hfi_session_command(inst,
HFI_CMD_SUBSCRIBE_MODE,
port,
HFI_PAYLOAD_U32_ARRAY,
&payload[0],
(ARRAY_SIZE(msm_vdec_subscribe_for_port_settings_change) + 1) *
sizeof(u32));
return rc;
}
@@ -655,24 +671,13 @@ static int msm_vdec_property_subscription(struct msm_vidc_inst *inst,
for (i = 0; i < ARRAY_SIZE(msm_vdec_subscribe_for_properties); i++)
payload[i + 1] = msm_vdec_subscribe_for_properties[i];
rc = hfi_create_header(inst->packet, inst->packet_size,
inst->session_id,
core->header_id++);
if (rc)
return rc;
rc = hfi_create_packet(inst->packet, inst->packet_size,
rc = venus_hfi_session_command(inst,
HFI_CMD_SUBSCRIBE_MODE,
(HFI_HOST_FLAGS_RESPONSE_REQUIRED |
HFI_HOST_FLAGS_INTR_REQUIRED),
port,
HFI_PAYLOAD_U32_ARRAY,
get_hfi_port(inst, port),
core->packet_id++,
&payload[0],
(ARRAY_SIZE(msm_vdec_subscribe_for_properties) + 1) *
sizeof(u32));
if (rc)
return rc;
return rc;
}
@@ -696,24 +701,13 @@ static int msm_vdec_metadata_subscription(struct msm_vidc_inst *inst,
for (i = 0; i < ARRAY_SIZE(msm_vdec_subscribe_for_metadata); i++)
payload[i + 1] = msm_vdec_subscribe_for_metadata[i];
rc = hfi_create_header(inst->packet, inst->packet_size,
inst->session_id,
core->header_id++);
if (rc)
return rc;
rc = hfi_create_packet(inst->packet, inst->packet_size,
rc = venus_hfi_session_command(inst,
HFI_CMD_SUBSCRIBE_MODE,
(HFI_HOST_FLAGS_RESPONSE_REQUIRED |
HFI_HOST_FLAGS_INTR_REQUIRED),
port,
HFI_PAYLOAD_U32_ARRAY,
get_hfi_port(inst, port),
core->packet_id++,
&payload[0],
(ARRAY_SIZE(msm_vdec_subscribe_for_metadata) + 1) *
sizeof(u32));
if (rc)
return rc;
return rc;
}
@@ -737,53 +731,13 @@ static int msm_vdec_metadata_delivery(struct msm_vidc_inst *inst,
for (i = 0; i < ARRAY_SIZE(msm_vdec_deliver_as_metadata); i++)
payload[i + 1] = msm_vdec_deliver_as_metadata[i];
rc = hfi_create_header(inst->packet, inst->packet_size,
inst->session_id,
core->header_id++);
if (rc)
return rc;
rc = hfi_create_packet(inst->packet, inst->packet_size,
HFI_CMD_DELIVERY_MODE,
(HFI_HOST_FLAGS_RESPONSE_REQUIRED |
HFI_HOST_FLAGS_INTR_REQUIRED),
HFI_PAYLOAD_U32_ARRAY,
get_hfi_port(inst, port),
core->packet_id++,
&payload[0],
(ARRAY_SIZE(msm_vdec_deliver_as_metadata) + 1) * sizeof(u32));
if (rc)
return rc;
return rc;
}
static int msm_vdec_subscription(struct msm_vidc_inst *inst,
enum msm_vidc_port_type port)
{
int rc = 0;
rc = msm_vdec_port_settings_subscription(inst, port);
if (rc)
return rc;
rc = msm_vdec_property_subscription(inst, port);
if (rc)
return rc;
rc = msm_vdec_metadata_subscription(inst, port);
if (rc)
return rc;
return rc;
}
static int msm_vdec_deliveries(struct msm_vidc_inst *inst,
enum msm_vidc_port_type port)
{
int rc = 0;
rc = msm_vdec_metadata_delivery(inst, port);
if (rc)
return rc;
rc = venus_hfi_session_command(inst,
HFI_CMD_DELIVERY_MODE,
port,
HFI_PAYLOAD_U32_ARRAY,
&payload[0],
(ARRAY_SIZE(msm_vdec_deliver_as_metadata) + 1) *
sizeof(u32));
return rc;
}
@@ -796,9 +750,12 @@ int msm_vdec_stop_input(struct msm_vidc_inst *inst)
d_vpr_e("%s: invalid params\n", __func__);
return -EINVAL;
}
d_vpr_h("%s()\n", __func__);
return rc;
rc = msm_vidc_session_stop(inst, INPUT_PORT);
if (rc)
return rc;
return 0;
}
int msm_vdec_start_input(struct msm_vidc_inst *inst)
@@ -848,13 +805,17 @@ int msm_vdec_start_input(struct msm_vidc_inst *inst)
if (rc)
goto error;
rc = msm_vdec_subscription(inst, INPUT_PORT);
rc = msm_vdec_port_settings_subscription(inst, INPUT_PORT);
if (rc)
goto error;
return rc;
rc = msm_vdec_deliveries(inst, INPUT_PORT);
rc = msm_vdec_property_subscription(inst, INPUT_PORT);
if (rc)
goto error;
return rc;
rc = msm_vdec_metadata_delivery(inst, INPUT_PORT);
if (rc)
return rc;
rc = venus_hfi_start(inst, INPUT_PORT);
if (rc)
@@ -873,13 +834,16 @@ int msm_vdec_stop_output(struct msm_vidc_inst *inst)
{
int rc = 0;
d_vpr_h("%s()\n", __func__);
if (!inst || !inst->core) {
d_vpr_e("%s: invalid params\n", __func__);
return -EINVAL;
}
return rc;
rc = msm_vidc_session_stop(inst, OUTPUT_PORT);
if (rc)
return rc;
return 0;
}
int msm_vdec_start_output(struct msm_vidc_inst *inst)
@@ -896,13 +860,13 @@ int msm_vdec_start_output(struct msm_vidc_inst *inst)
if (rc)
goto error;
rc = msm_vdec_subscription(inst, OUTPUT_PORT);
rc = msm_vdec_port_settings_subscription(inst, OUTPUT_PORT);
if (rc)
goto error;
return rc;
rc = msm_vdec_deliveries(inst, OUTPUT_PORT);
rc = msm_vdec_metadata_subscription(inst, OUTPUT_PORT);
if (rc)
goto error;
return rc;
rc = venus_hfi_start(inst, OUTPUT_PORT);
if (rc)

مشاهده پرونده

@@ -444,7 +444,7 @@ int msm_vidc_streamon(void *instance, enum v4l2_buf_type type)
{
int rc = 0;
struct msm_vidc_inst *inst = instance;
enum msm_vidc_inst_state new_state = 0;
enum msm_vidc_inst_state new_state = MSM_VIDC_ERROR;
int port;
if (!inst) {
@@ -523,7 +523,7 @@ int msm_vidc_streamoff(void *instance, enum v4l2_buf_type type)
{
int rc = 0;
struct msm_vidc_inst *inst = instance;
enum msm_vidc_inst_state new_state = 0;
enum msm_vidc_inst_state new_state = MSM_VIDC_ERROR;
int port;
if (!inst) {
@@ -759,25 +759,28 @@ void *msm_vidc_open(void *vidc_core, u32 session_type)
INIT_LIST_HEAD(&inst->buffers.input_meta.list);
INIT_LIST_HEAD(&inst->buffers.output.list);
INIT_LIST_HEAD(&inst->buffers.output_meta.list);
INIT_LIST_HEAD(&inst->buffers.scratch.list);
INIT_LIST_HEAD(&inst->buffers.scratch_1.list);
INIT_LIST_HEAD(&inst->buffers.scratch_2.list);
INIT_LIST_HEAD(&inst->buffers.bin.list);
INIT_LIST_HEAD(&inst->buffers.comv.list);
INIT_LIST_HEAD(&inst->buffers.non_comv.list);
INIT_LIST_HEAD(&inst->buffers.line.list);
INIT_LIST_HEAD(&inst->buffers.dpb.list);
INIT_LIST_HEAD(&inst->buffers.persist.list);
INIT_LIST_HEAD(&inst->buffers.persist_1.list);
INIT_LIST_HEAD(&inst->allocations.scratch.list);
INIT_LIST_HEAD(&inst->allocations.scratch_1.list);
INIT_LIST_HEAD(&inst->allocations.scratch_2.list);
INIT_LIST_HEAD(&inst->allocations.bin.list);
INIT_LIST_HEAD(&inst->allocations.comv.list);
INIT_LIST_HEAD(&inst->allocations.non_comv.list);
INIT_LIST_HEAD(&inst->allocations.line.list);
INIT_LIST_HEAD(&inst->allocations.dpb.list);
INIT_LIST_HEAD(&inst->allocations.persist.list);
INIT_LIST_HEAD(&inst->allocations.persist_1.list);
INIT_LIST_HEAD(&inst->mappings.input.list);
INIT_LIST_HEAD(&inst->mappings.input_meta.list);
INIT_LIST_HEAD(&inst->mappings.output.list);
INIT_LIST_HEAD(&inst->mappings.output_meta.list);
INIT_LIST_HEAD(&inst->mappings.scratch.list);
INIT_LIST_HEAD(&inst->mappings.scratch_1.list);
INIT_LIST_HEAD(&inst->mappings.scratch_2.list);
INIT_LIST_HEAD(&inst->mappings.bin.list);
INIT_LIST_HEAD(&inst->mappings.comv.list);
INIT_LIST_HEAD(&inst->mappings.non_comv.list);
INIT_LIST_HEAD(&inst->mappings.line.list);
INIT_LIST_HEAD(&inst->mappings.dpb.list);
INIT_LIST_HEAD(&inst->mappings.persist.list);
INIT_LIST_HEAD(&inst->mappings.persist_1.list);
INIT_LIST_HEAD(&inst->children.list);
INIT_LIST_HEAD(&inst->firmware.list);
inst->domain = session_type;

مشاهده پرونده

@@ -296,22 +296,18 @@ u32 msm_vidc_get_buffer_region(struct msm_vidc_inst *inst,
case MSM_VIDC_BUF_OUTPUT_META:
region = MSM_VIDC_NON_SECURE;
break;
case MSM_VIDC_BUF_SCRATCH:
case MSM_VIDC_BUF_BIN:
region = MSM_VIDC_SECURE_BITSTREAM;
break;
case MSM_VIDC_BUF_SCRATCH_1:
case MSM_VIDC_BUF_COMV:
case MSM_VIDC_BUF_NON_COMV:
case MSM_VIDC_BUF_LINE:
region = MSM_VIDC_SECURE_NONPIXEL;
break;
case MSM_VIDC_BUF_SCRATCH_2:
case MSM_VIDC_BUF_DPB:
region = MSM_VIDC_SECURE_PIXEL;
break;
case MSM_VIDC_BUF_PERSIST:
if (is_encode_session(inst))
region = MSM_VIDC_SECURE_NONPIXEL;
else
region = MSM_VIDC_SECURE_BITSTREAM;
break;
case MSM_VIDC_BUF_PERSIST_1:
region = MSM_VIDC_SECURE_NONPIXEL;
break;
default:
@@ -334,16 +330,18 @@ struct msm_vidc_buffers *msm_vidc_get_buffers(
return &inst->buffers.output;
case MSM_VIDC_BUF_OUTPUT_META:
return &inst->buffers.output_meta;
case MSM_VIDC_BUF_SCRATCH:
return &inst->buffers.scratch;
case MSM_VIDC_BUF_SCRATCH_1:
return &inst->buffers.scratch_1;
case MSM_VIDC_BUF_SCRATCH_2:
return &inst->buffers.scratch_2;
case MSM_VIDC_BUF_BIN:
return &inst->buffers.bin;
case MSM_VIDC_BUF_COMV:
return &inst->buffers.comv;
case MSM_VIDC_BUF_NON_COMV:
return &inst->buffers.non_comv;
case MSM_VIDC_BUF_LINE:
return &inst->buffers.line;
case MSM_VIDC_BUF_DPB:
return &inst->buffers.dpb;
case MSM_VIDC_BUF_PERSIST:
return &inst->buffers.persist;
case MSM_VIDC_BUF_PERSIST_1:
return &inst->buffers.persist_1;
default:
s_vpr_e(inst->sid, "%s: invalid driver buffer type %d\n",
func, buffer_type);
@@ -364,16 +362,18 @@ struct msm_vidc_mappings *msm_vidc_get_mappings(
return &inst->mappings.output;
case MSM_VIDC_BUF_OUTPUT_META:
return &inst->mappings.output_meta;
case MSM_VIDC_BUF_SCRATCH:
return &inst->mappings.scratch;
case MSM_VIDC_BUF_SCRATCH_1:
return &inst->mappings.scratch_1;
case MSM_VIDC_BUF_SCRATCH_2:
return &inst->mappings.scratch_2;
case MSM_VIDC_BUF_BIN:
return &inst->mappings.bin;
case MSM_VIDC_BUF_COMV:
return &inst->mappings.comv;
case MSM_VIDC_BUF_NON_COMV:
return &inst->mappings.non_comv;
case MSM_VIDC_BUF_LINE:
return &inst->mappings.line;
case MSM_VIDC_BUF_DPB:
return &inst->mappings.dpb;
case MSM_VIDC_BUF_PERSIST:
return &inst->mappings.persist;
case MSM_VIDC_BUF_PERSIST_1:
return &inst->mappings.persist_1;
default:
s_vpr_e(inst->sid, "%s: invalid driver buffer type %d\n",
func, buffer_type);
@@ -386,16 +386,18 @@ struct msm_vidc_allocations *msm_vidc_get_allocations(
const char *func)
{
switch (buffer_type) {
case MSM_VIDC_BUF_SCRATCH:
return &inst->allocations.scratch;
case MSM_VIDC_BUF_SCRATCH_1:
return &inst->allocations.scratch_1;
case MSM_VIDC_BUF_SCRATCH_2:
return &inst->allocations.scratch_2;
case MSM_VIDC_BUF_BIN:
return &inst->allocations.bin;
case MSM_VIDC_BUF_COMV:
return &inst->allocations.comv;
case MSM_VIDC_BUF_NON_COMV:
return &inst->allocations.non_comv;
case MSM_VIDC_BUF_LINE:
return &inst->allocations.line;
case MSM_VIDC_BUF_DPB:
return &inst->allocations.dpb;
case MSM_VIDC_BUF_PERSIST:
return &inst->allocations.persist;
case MSM_VIDC_BUF_PERSIST_1:
return &inst->allocations.persist_1;
default:
s_vpr_e(inst->sid, "%s: invalid driver buffer type %d\n",
func, buffer_type);
@@ -410,6 +412,7 @@ int msm_vidc_change_inst_state(struct msm_vidc_inst *inst,
d_vpr_e("%s: invalid params\n", __func__);
return -EINVAL;
}
if (!request_state) {
s_vpr_e(inst->sid, "%s: invalid request state\n", func);
return -EINVAL;
@@ -541,6 +544,8 @@ int msm_vidc_put_driver_buf(struct msm_vidc_inst *inst,
if (rc)
return rc;
msm_vidc_memory_put_dmabuf(buf->dmabuf);
/* delete the buffer from buffers->list */
list_del(&buf->list);
kfree(buf);
@@ -628,7 +633,6 @@ struct msm_vidc_buffer *msm_vidc_get_driver_buf(struct msm_vidc_inst *inst,
dmabuf = msm_vidc_memory_get_dmabuf(vb2->planes[0].m.fd);
if (!dmabuf)
return NULL;
msm_vidc_memory_put_dmabuf(dmabuf);
/* check if it is an existing buffer */
list_for_each_entry(buf, &buffers->list, list) {
@@ -679,6 +683,7 @@ struct msm_vidc_buffer *msm_vidc_get_driver_buf(struct msm_vidc_inst *inst,
return buf;
error:
msm_vidc_memory_put_dmabuf(dmabuf);
if (!found)
kfree(buf);
return NULL;
@@ -1171,6 +1176,54 @@ int msm_vidc_session_set_codec(struct msm_vidc_inst *inst)
return 0;
}
int msm_vidc_session_stop(struct msm_vidc_inst *inst,
enum msm_vidc_port_type port)
{
int rc = 0;
struct msm_vidc_core *core;
enum signal_session_response signal_type;
if (!inst || !inst->core) {
d_vpr_e("%s: invalid params\n", __func__);
return -EINVAL;
}
if (port == INPUT_PORT) {
signal_type = SIGNAL_CMD_STOP_INPUT;
} else if (port == OUTPUT_PORT) {
signal_type = SIGNAL_CMD_STOP_OUTPUT;
} else {
s_vpr_e(inst->sid, "%s: invalid port: %d\n", __func__, port);
return -EINVAL;
}
rc = venus_hfi_stop(inst, port);
if (rc)
return rc;
core = inst->core;
mutex_unlock(&inst->lock);
s_vpr_h(inst->sid, "%s: wait on port: %d for time: %d ms\n",
__func__, port, core->capabilities[HW_RESPONSE_TIMEOUT].value);
rc = wait_for_completion_timeout(
&inst->completions[signal_type],
msecs_to_jiffies(
core->capabilities[HW_RESPONSE_TIMEOUT].value));
mutex_lock(&inst->lock);
if (!rc) {
s_vpr_e(inst->sid, "%s: session stop timed out for port: %d\n",
__func__, port);
//msm_comm_kill_session(inst);
rc = -EIO;
} else {
rc = 0;
s_vpr_h(inst->sid, "%s: stop successful on port: %d\n",
__func__, port);
}
return rc;
}
int msm_vidc_session_close(struct msm_vidc_inst *inst)
{
int rc = 0;
@@ -1186,6 +1239,8 @@ int msm_vidc_session_close(struct msm_vidc_inst *inst)
return rc;
core = inst->core;
s_vpr_h(inst->sid, "%s: wait on close for time: %d ms\n",
__func__, core->capabilities[HW_RESPONSE_TIMEOUT].value);
rc = wait_for_completion_timeout(
&inst->completions[SIGNAL_CMD_CLOSE],
msecs_to_jiffies(
@@ -1196,6 +1251,7 @@ int msm_vidc_session_close(struct msm_vidc_inst *inst)
rc = -EIO;
} else {
rc = 0;
s_vpr_h(inst->sid, "%s: close successful\n", __func__);
}
return rc;

مشاهده پرونده

@@ -9,7 +9,6 @@
#include <linux/of.h>
#include <linux/of_platform.h>
#include <linux/interrupt.h>
#include <linux/irqreturn.h>
#include "msm_vidc_internal.h"
#include "msm_vidc_debug.h"
@@ -21,18 +20,6 @@
#define BASE_DEVICE_NUMBER 32
static irqreturn_t msm_vidc_isr(int irq, void *data)
{
struct msm_vidc_core *core = data;
d_vpr_e("%s()\n", __func__);
disable_irq_nosync(irq);
queue_work(core->device_workq, &core->device_work);
return IRQ_HANDLED;
}
static int msm_vidc_init_irq(struct msm_vidc_core *core)
{
int rc = 0;
@@ -54,7 +41,7 @@ static int msm_vidc_init_irq(struct msm_vidc_core *core)
goto exit;
}
rc = request_irq(dt->irq, msm_vidc_isr, IRQF_TRIGGER_HIGH,
rc = request_irq(dt->irq, venus_hfi_isr, IRQF_TRIGGER_HIGH,
"msm_vidc", core);
if (unlikely(rc)) {
d_vpr_e("%s: request_irq failed\n", __func__);

مشاهده پرونده

@@ -188,6 +188,49 @@ int msm_vidc_start_streaming(struct vb2_queue *q, unsigned int count)
void msm_vidc_stop_streaming(struct vb2_queue *q)
{
int rc = 0;
struct msm_vidc_inst *inst;
if (!q || !q->drv_priv) {
d_vpr_e("%s: invalid input, q = %pK\n", q);
return;
}
inst = q->drv_priv;
if (!inst || !inst->core) {
d_vpr_e("%s: invalid params\n", __func__);
return;
}
if (q->type == INPUT_META_PLANE || q->type == OUTPUT_META_PLANE) {
s_vpr_h(inst->sid, "%s: nothing to stop on meta port %d\n",
__func__, q->type);
return;
}
if (!is_decode_session(inst) && !is_encode_session(inst)) {
s_vpr_e(inst->sid, "%s: invalid session %d\n",
__func__, inst->domain);
return;
}
s_vpr_h(inst->sid, "Streamoff: %d\n", q->type);
if (q->type == INPUT_MPLANE) {
if (is_decode_session(inst))
rc = msm_vdec_stop_input(inst);
//else if (is_encode_session(inst))
// rc = msm_venc_start_input(inst);
} else if (q->type == OUTPUT_MPLANE) {
if (is_decode_session(inst))
rc = msm_vdec_stop_output(inst);
//else if (is_encode_session(inst))
// rc = msm_venc_start_output(inst);
} else {
s_vpr_e(inst->sid, "%s: invalid type %d\n", __func__, q->type);
}
if (rc)
s_vpr_e(inst->sid, "%s: stop failed for qtype: %d\n",
__func__, q->type);
return;
}
void msm_vidc_buf_queue(struct vb2_buffer *vb2)

مشاهده پرونده

@@ -594,8 +594,8 @@ static int __write_queue(struct msm_vidc_iface_q_info *qinfo, u8 *packet,
}
// TODO: handle writing packet
d_vpr_e("skip writing packet\n");
return 0;
//d_vpr_e("skip writing packet\n");
//return 0;
packet_size_in_words = (*(u32 *)packet) >> 2;
if (!packet_size_in_words || packet_size_in_words >
@@ -915,18 +915,36 @@ dbg_error_null:
return rc;
}
/*TODO:darshana needs discussion*/
static void __flush_debug_queue(struct msm_vidc_core *core, u8 *header)
// TODO: revisit once firmware updated to latest interface headers
struct hfi_packet_header {
u32 size;
u32 packet_type;
};
struct hfi_msg_sys_debug_packet {
u32 size;
u32 packet_type;
u32 msg_type;
u32 msg_size;
u32 time_stamp_hi;
u32 time_stamp_lo;
u8 rg_msg_data[1];
};
static void __flush_debug_queue(struct msm_vidc_core *core, u8 *packet)
{
bool local_packet = false;
enum vidc_msg_prio log_level = msm_vidc_debug;
struct hfi_packet *pkt;
u32 payload = 0;
if (!header) {
header = kzalloc(VIDC_IFACEQ_VAR_HUGE_PKT_SIZE, GFP_KERNEL);
if (!header) {
d_vpr_e("%s: Fail to allocate mem\n", __func__);
if (!core) {
d_vpr_e("%s: invalid params\n", __func__);
return;
}
if (!packet) {
packet = kzalloc(VIDC_IFACEQ_VAR_HUGE_PKT_SIZE, GFP_KERNEL);
if (!packet) {
d_vpr_e("%s: fail to allocate\n", __func__);
return;
}
@@ -950,20 +968,21 @@ static void __flush_debug_queue(struct msm_vidc_core *core, u8 *header)
} \
})
while (!__iface_dbgq_read(core, header)) {
struct hfi_header *hdr =
(struct hfi_header *) header;
while (!__iface_dbgq_read(core, packet)) {
struct hfi_packet_header *pkt =
(struct hfi_packet_header *) packet;
if (validate_packet((u8 *)pkt, core->response_packet,
core->packet_size, __func__))
return;
if (pkt->size < sizeof(struct hfi_packet_header)) {
d_vpr_e("Invalid pkt size - %s\n", __func__);
continue;
}
if (1) {
struct hfi_msg_sys_debug_packet *pkt =
(struct hfi_msg_sys_debug_packet *) packet;
pkt = (struct hfi_packet *)(hdr + sizeof(struct hfi_header));
if (pkt->type == HFI_PROP_DEBUG_LOG_LEVEL) {
SKIP_INVALID_PKT(pkt->size,
sizeof(u32), sizeof(*pkt));
payload = (u32) *((u8 *)pkt + sizeof(struct hfi_packet));
pkt->msg_size, sizeof(*pkt));
/*
* All fw messages starts with new line character. This
@@ -972,14 +991,14 @@ static void __flush_debug_queue(struct msm_vidc_core *core, u8 *header)
* from the message fixes this to print it in a single
* line.
*/
//pkt->rg_msg_data[sizeof(u32)-1] = '\0';
dprintk_firmware(log_level, "%s", &payload);
pkt->rg_msg_data[pkt->msg_size-1] = '\0';
dprintk_firmware(log_level, "%s", &pkt->rg_msg_data[1]);
}
}
#undef SKIP_INVALID_PKT
if (local_packet)
kfree(header);
kfree(packet);
}
static int __sys_set_debug(struct msm_vidc_core *core, u32 debug)
@@ -2318,6 +2337,18 @@ static int __response_handler(struct msm_vidc_core *core)
return rc;
}
irqreturn_t venus_hfi_isr(int irq, void *data)
{
struct msm_vidc_core *core = data;
d_vpr_e("%s()\n", __func__);
disable_irq_nosync(irq);
queue_work(core->device_workq, &core->device_work);
return IRQ_HANDLED;
}
void venus_hfi_work_handler(struct work_struct *work)
{
struct msm_vidc_core *core;
@@ -2561,7 +2592,7 @@ int venus_hfi_session_set_codec(struct msm_vidc_inst *inst)
HFI_PROP_CODEC,
HFI_HOST_FLAGS_NONE,
HFI_PORT_NONE,
HFI_PAYLOAD_U32,
HFI_PAYLOAD_U32_ENUM,
&codec,
sizeof(u32));
if (rc)
@@ -2702,6 +2733,49 @@ int venus_hfi_stop(struct msm_vidc_inst *inst, enum msm_vidc_port_type port)
return rc;
}
int venus_hfi_session_command(struct msm_vidc_inst *inst,
u32 cmd, enum msm_vidc_port_type port, u32 payload_type,
void *payload, u32 payload_size)
{
int rc = 0;
struct msm_vidc_core *core;
if (!inst || !inst->packet || !inst->core) {
d_vpr_e("%s: invalid params\n", __func__);
return -EINVAL;
}
core = inst->core;
rc = hfi_create_header(inst->packet, inst->packet_size,
inst->session_id,
core->header_id++);
if (rc)
return rc;
rc = hfi_create_packet(inst->packet, inst->packet_size,
cmd,
(HFI_HOST_FLAGS_RESPONSE_REQUIRED |
HFI_HOST_FLAGS_INTR_REQUIRED),
payload_type,
get_hfi_port(inst, port),
core->packet_id++,
payload,
payload_size);
if (rc)
goto err_cmd;
s_vpr_h(inst->sid, "Command packet 0x%x created\n", cmd);
__iface_cmdq_write(inst->core, inst->packet);
return rc;
err_cmd:
s_vpr_e(inst->sid, "%s: create packet failed for cmd: %d\n",
__func__, cmd);
return rc;
}
int venus_hfi_queue_buffer(struct msm_vidc_inst *inst,
struct msm_vidc_buffer *buffer, struct msm_vidc_buffer *metabuf)
{

مشاهده پرونده

@@ -34,7 +34,13 @@ bool is_valid_hfi_buffer_type(struct msm_vidc_inst *inst,
if (buffer_type != HFI_BUFFER_BITSTREAM &&
buffer_type != HFI_BUFFER_RAW &&
buffer_type != HFI_BUFFER_METADATA) {
buffer_type != HFI_BUFFER_METADATA &&
buffer_type != HFI_BUFFER_BIN &&
buffer_type != HFI_BUFFER_COMV &&
buffer_type != HFI_BUFFER_NON_COMV &&
buffer_type != HFI_BUFFER_LINE &&
buffer_type != HFI_BUFFER_DPB &&
buffer_type != HFI_BUFFER_PERSIST) {
s_vpr_e(inst->sid, "%s: invalid buffer type %#x\n",
func, buffer_type);
return false;
@@ -185,6 +191,8 @@ static int handle_session_start(struct msm_vidc_inst *inst,
static int handle_session_stop(struct msm_vidc_inst *inst,
struct hfi_packet *pkt)
{
int signal_type = -1;
if (pkt->flags & HFI_FW_FLAGS_SESSION_ERROR) {
s_vpr_e(inst->sid, "%s: received session error\n", __func__);
msm_vidc_change_inst_state(inst, MSM_VIDC_ERROR, __func__);
@@ -193,7 +201,34 @@ static int handle_session_stop(struct msm_vidc_inst *inst,
if (pkt->flags & HFI_FW_FLAGS_SUCCESS)
s_vpr_h(inst->sid, "%s: successful for port %d\n",
__func__, pkt->port);
signal_session_msg_receipt(inst, SIGNAL_CMD_STOP);
if (is_encode_session(inst)) {
if (pkt->port == HFI_PORT_RAW) {
signal_type = SIGNAL_CMD_STOP_INPUT;
} else if (pkt->port == HFI_PORT_BITSTREAM) {
signal_type = SIGNAL_CMD_STOP_OUTPUT;
} else {
s_vpr_e(inst->sid, "%s: invalid port: %d\n",
__func__, pkt->port);
return -EINVAL;
}
} else if (is_decode_session(inst)) {
if (pkt->port == HFI_PORT_RAW) {
signal_type = SIGNAL_CMD_STOP_OUTPUT;
} else if (pkt->port == HFI_PORT_BITSTREAM) {
signal_type = SIGNAL_CMD_STOP_INPUT;
} else {
s_vpr_e(inst->sid, "%s: invalid port: %d\n",
__func__, pkt->port);
return -EINVAL;
}
} else {
s_vpr_e(inst->sid, "%s: invalid session\n", __func__);
return -EINVAL;
}
if (signal_type != -1)
signal_session_msg_receipt(inst, signal_type);
return 0;
}
@@ -441,6 +476,32 @@ static int handle_port_settings_change(struct msm_vidc_inst *inst,
return 0;
}
static int handle_session_subscribe_mode(struct msm_vidc_inst *inst,
struct hfi_packet *pkt)
{
if (pkt->flags & HFI_FW_FLAGS_SESSION_ERROR) {
s_vpr_e(inst->sid, "%s: received session error\n", __func__);
msm_vidc_change_inst_state(inst, MSM_VIDC_ERROR, __func__);
}
if (pkt->flags & HFI_FW_FLAGS_SUCCESS)
s_vpr_h(inst->sid, "%s: successful\n", __func__);
return 0;
}
static int handle_session_delivery_mode(struct msm_vidc_inst *inst,
struct hfi_packet *pkt)
{
if (pkt->flags & HFI_FW_FLAGS_SESSION_ERROR) {
s_vpr_e(inst->sid, "%s: received session error\n", __func__);
msm_vidc_change_inst_state(inst, MSM_VIDC_ERROR, __func__);
}
if (pkt->flags & HFI_FW_FLAGS_SUCCESS)
s_vpr_h(inst->sid, "%s: successful\n", __func__);
return 0;
}
static int handle_session_command(struct msm_vidc_inst *inst,
struct hfi_packet *pkt)
{
@@ -459,6 +520,10 @@ static int handle_session_command(struct msm_vidc_inst *inst,
return handle_session_buffer(inst, pkt);
case HFI_CMD_SETTINGS_CHANGE:
return handle_port_settings_change(inst, pkt);
case HFI_CMD_SUBSCRIBE_MODE:
return handle_session_subscribe_mode(inst, pkt);
case HFI_CMD_DELIVERY_MODE:
return handle_session_delivery_mode(inst, pkt);
default:
s_vpr_e(inst->sid, "%s: Unsupported command type: %#x\n",
__func__, pkt->type);
@@ -531,39 +596,47 @@ static int handle_system_response(struct msm_vidc_core *core,
struct hfi_header *hdr)
{
int rc = 0;
struct hfi_packet *pkt;
struct hfi_packet *packet;
u8 *pkt;
int i;
pkt = (struct hfi_packet *)((u8 *)hdr + sizeof(struct hfi_header));
pkt = (u8 *)((u8 *)hdr + sizeof(struct hfi_header));
for (i = 0; i < hdr->num_packets; i++) {
if (validate_packet((u8 *)pkt, core->response_packet,
core->packet_size, __func__))
return -EINVAL;
if (pkt->type == HFI_CMD_INIT) {
rc = handle_system_init(core, pkt);
} else if (pkt->type > HFI_SYSTEM_ERROR_BEGIN &&
pkt->type < HFI_SYSTEM_ERROR_END) {
rc = handle_system_error(core, pkt);
} else if (pkt->type > HFI_PROP_BEGIN &&
pkt->type < HFI_PROP_CODEC) {
rc = handle_system_property(core, pkt);
core->packet_size, __func__)) {
rc = -EINVAL;
goto exit;
}
packet = (struct hfi_packet *)pkt;
if (packet->type == HFI_CMD_INIT) {
rc = handle_system_init(core, packet);
} else if (packet->type > HFI_SYSTEM_ERROR_BEGIN &&
packet->type < HFI_SYSTEM_ERROR_END) {
rc = handle_system_error(core, packet);
} else if (packet->type > HFI_PROP_BEGIN &&
packet->type < HFI_PROP_CODEC) {
rc = handle_system_property(core, packet);
} else {
d_vpr_e("%s: Unknown packet type: %#x\n",
__func__, pkt->type);
return -EINVAL;
__func__, packet->type);
rc = -EINVAL;
goto exit;
}
pkt += pkt->size;
pkt += packet->size;
}
exit:
return rc;
}
static int handle_session_response(struct msm_vidc_core *core,
struct hfi_header *hdr)
{
struct hfi_packet *pkt;
int rc = 0;
struct msm_vidc_inst *inst;
int i, rc = 0;
struct hfi_packet *packet;
u8 *pkt;
int i;
inst = get_inst(core, hdr->session_id);
if (!inst) {
@@ -572,29 +645,31 @@ static int handle_session_response(struct msm_vidc_core *core,
}
mutex_lock(&inst->lock);
pkt = (struct hfi_packet *)((u8 *)hdr + sizeof(struct hfi_header));
pkt = (u8 *)((u8 *)hdr + sizeof(struct hfi_header));
for (i = 0; i < hdr->num_packets; i++) {
if (validate_packet((u8 *)pkt, core->response_packet,
if (validate_packet(pkt, core->response_packet,
core->packet_size, __func__)) {
rc = -EINVAL;
goto exit;
}
if (pkt->type < HFI_CMD_END && pkt->type > HFI_CMD_BEGIN) {
rc = handle_session_command(inst, pkt);
} else if (pkt->type > HFI_PROP_BEGIN &&
pkt->type < HFI_PROP_END) {
rc = handle_session_property(inst, pkt);
} else if (pkt->type > HFI_SESSION_ERROR_BEGIN &&
pkt->type < HFI_SESSION_ERROR_END) {
rc = handle_session_error(inst, pkt);
packet = (struct hfi_packet *)pkt;
if (packet->type < HFI_CMD_END &&
packet->type > HFI_CMD_BEGIN) {
rc = handle_session_command(inst, packet);
} else if (packet->type > HFI_PROP_BEGIN &&
packet->type < HFI_PROP_END) {
rc = handle_session_property(inst, packet);
} else if (packet->type > HFI_SESSION_ERROR_BEGIN &&
packet->type < HFI_SESSION_ERROR_END) {
rc = handle_session_error(inst, packet);
} else {
s_vpr_e(inst->sid, "%s: Unknown packet type: %#x\n",
__func__, pkt->type);
__func__, packet->type);
rc = -EINVAL;
goto exit;
}
pkt += pkt->size;
pkt += packet->size;
}
exit:
mutex_unlock(&inst->lock);