video: driver: driver fixes required for latest firmware
Update debug packet structure to use waipio related debug packet structure. Also add HFI_INFORMATION_END cmd packets handling in reverse thread. Change-Id: Idbd421d8ada0e8c9d33df54e6f3708b1079c8b47 Signed-off-by: Akshata Sahukar <asahukar@codeaurora.org>
Šī revīzija ir iekļauta:

revīziju iesūtīja
Darshana Patil

vecāks
bff6f56a28
revīzija
e970285cda
@@ -736,16 +736,20 @@ static int msm_vdec_get_input_internal_buffers(struct msm_vidc_inst *inst)
|
||||
}
|
||||
core = inst->core;
|
||||
|
||||
/*
|
||||
* TODO: Remove the hack of sending bigger buffer sizes
|
||||
* once internal buffer calculations are finalised
|
||||
*/
|
||||
inst->buffers.bin.size = call_session_op(core, buffer_size,
|
||||
inst, MSM_VIDC_BUF_BIN);
|
||||
inst, MSM_VIDC_BUF_BIN) + 100000000;
|
||||
inst->buffers.comv.size = call_session_op(core, buffer_size,
|
||||
inst, MSM_VIDC_BUF_COMV);
|
||||
inst, MSM_VIDC_BUF_COMV) + 100000000;
|
||||
inst->buffers.non_comv.size = call_session_op(core, buffer_size,
|
||||
inst, MSM_VIDC_BUF_NON_COMV);
|
||||
inst, MSM_VIDC_BUF_NON_COMV) + 100000000;
|
||||
inst->buffers.line.size = call_session_op(core, buffer_size,
|
||||
inst, MSM_VIDC_BUF_LINE);
|
||||
inst, MSM_VIDC_BUF_LINE) + 100000000;
|
||||
inst->buffers.persist.size = call_session_op(core, buffer_size,
|
||||
inst, MSM_VIDC_BUF_PERSIST);
|
||||
inst, MSM_VIDC_BUF_PERSIST) + 100000000;
|
||||
|
||||
inst->buffers.bin.min_count = call_session_op(core, min_count,
|
||||
inst, MSM_VIDC_BUF_BIN);
|
||||
@@ -866,7 +870,7 @@ static int msm_vdec_release_input_internal_buffers(struct msm_vidc_inst *inst)
|
||||
return 0;
|
||||
}
|
||||
|
||||
static int msm_vdec_subscribe_port_settings_change(struct msm_vidc_inst *inst,
|
||||
int msm_vdec_subscribe_port_settings_change(struct msm_vidc_inst *inst,
|
||||
enum msm_vidc_port_type port)
|
||||
{
|
||||
int rc = 0;
|
||||
@@ -1212,10 +1216,6 @@ int msm_vdec_start_input(struct msm_vidc_inst *inst)
|
||||
if (rc)
|
||||
goto error;
|
||||
|
||||
rc = msm_vdec_subscribe_port_settings_change(inst, INPUT_PORT);
|
||||
if (rc)
|
||||
return rc;
|
||||
|
||||
rc = msm_vdec_subscribe_property(inst, INPUT_PORT);
|
||||
if (rc)
|
||||
return rc;
|
||||
@@ -1267,10 +1267,6 @@ int msm_vdec_start_output(struct msm_vidc_inst *inst)
|
||||
if (rc)
|
||||
goto error;
|
||||
|
||||
rc = msm_vdec_subscribe_port_settings_change(inst, OUTPUT_PORT);
|
||||
if (rc)
|
||||
return rc;
|
||||
|
||||
rc = msm_vdec_subscribe_metadata(inst, OUTPUT_PORT);
|
||||
if (rc)
|
||||
return rc;
|
||||
|
@@ -1253,14 +1253,10 @@ int msm_vidc_session_set_codec(struct msm_vidc_inst *inst)
|
||||
return -EINVAL;
|
||||
}
|
||||
|
||||
if (inst->codec_set)
|
||||
return 0;
|
||||
|
||||
rc = venus_hfi_session_set_codec(inst);
|
||||
if (rc)
|
||||
return rc;
|
||||
|
||||
inst->codec_set = true;
|
||||
return 0;
|
||||
}
|
||||
|
||||
|
@@ -164,10 +164,24 @@ int msm_vidc_start_streaming(struct vb2_queue *q, unsigned int count)
|
||||
}
|
||||
s_vpr_h(inst->sid, "Streamon: %d\n", q->type);
|
||||
|
||||
if (!inst->codec_set) {
|
||||
if (!inst->once_per_session_set) {
|
||||
inst->once_per_session_set = true;
|
||||
rc = msm_vidc_session_set_codec(inst);
|
||||
if (rc)
|
||||
return -EINVAL;
|
||||
return rc;
|
||||
if (is_decode_session(inst)) {
|
||||
if (q->type == INPUT_MPLANE) {
|
||||
rc = msm_vdec_subscribe_port_settings_change(
|
||||
inst, INPUT_PORT);
|
||||
if (rc)
|
||||
return rc;
|
||||
} else if (q->type == OUTPUT_MPLANE) {
|
||||
rc = msm_vdec_subscribe_port_settings_change(
|
||||
inst, OUTPUT_PORT);
|
||||
if (rc)
|
||||
return rc;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
/*
|
||||
|
@@ -921,24 +921,11 @@ dbg_error_null:
|
||||
return rc;
|
||||
}
|
||||
|
||||
// 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)
|
||||
static void __flush_debug_queue(struct msm_vidc_core *core,
|
||||
u8 *packet, u32 packet_size)
|
||||
{
|
||||
u8 *log;
|
||||
struct hfi_debug_header *pkt;
|
||||
bool local_packet = false;
|
||||
enum vidc_msg_prio log_level = msm_vidc_debug;
|
||||
|
||||
@@ -947,12 +934,13 @@ static void __flush_debug_queue(struct msm_vidc_core *core, u8 *packet)
|
||||
return;
|
||||
}
|
||||
|
||||
if (!packet) {
|
||||
if (!packet || !packet_size) {
|
||||
packet = kzalloc(VIDC_IFACEQ_VAR_HUGE_PKT_SIZE, GFP_KERNEL);
|
||||
if (!packet) {
|
||||
d_vpr_e("%s: fail to allocate\n", __func__);
|
||||
return;
|
||||
}
|
||||
packet_size = VIDC_IFACEQ_VAR_HUGE_PKT_SIZE;
|
||||
|
||||
local_packet = true;
|
||||
|
||||
@@ -963,45 +951,31 @@ static void __flush_debug_queue(struct msm_vidc_core *core, u8 *packet)
|
||||
log_level |= FW_PRINTK;
|
||||
}
|
||||
|
||||
#define SKIP_INVALID_PKT(pkt_size, payload_size, pkt_hdr_size) { \
|
||||
if (pkt_size < pkt_hdr_size || \
|
||||
payload_size < MIN_PAYLOAD_SIZE || \
|
||||
payload_size > \
|
||||
(pkt_size - pkt_hdr_size + sizeof(u8))) { \
|
||||
d_vpr_e("%s: invalid msg size - %d\n", \
|
||||
__func__, payload_size); \
|
||||
continue; \
|
||||
} \
|
||||
}
|
||||
|
||||
while (!__iface_dbgq_read(core, packet)) {
|
||||
struct hfi_packet_header *pkt =
|
||||
(struct hfi_packet_header *) packet;
|
||||
pkt = (struct hfi_debug_header *) packet;
|
||||
|
||||
if (pkt->size < sizeof(struct hfi_packet_header)) {
|
||||
d_vpr_e("Invalid pkt size - %s\n", __func__);
|
||||
if (pkt->size < sizeof(struct hfi_debug_header)) {
|
||||
d_vpr_e("%s: invalid pkt size %d\n",
|
||||
__func__, pkt->size);
|
||||
continue;
|
||||
}
|
||||
if (pkt->size > packet_size) {
|
||||
d_vpr_e("%s: pkt size[%d] > packet_size[%d]\n",
|
||||
__func__, pkt->size, packet_size);
|
||||
continue;
|
||||
}
|
||||
|
||||
if (1) {
|
||||
struct hfi_msg_sys_debug_packet *pkt =
|
||||
(struct hfi_msg_sys_debug_packet *) packet;
|
||||
|
||||
SKIP_INVALID_PKT(pkt->size,
|
||||
pkt->msg_size, sizeof(*pkt));
|
||||
|
||||
/*
|
||||
* All fw messages starts with new line character. This
|
||||
* causes dprintk to print this message in two lines
|
||||
* in the kernel log. Ignoring the first character
|
||||
* from the message fixes this to print it in a single
|
||||
* line.
|
||||
*/
|
||||
pkt->rg_msg_data[pkt->msg_size-1] = '\0';
|
||||
dprintk_firmware(log_level, "%s", &pkt->rg_msg_data[1]);
|
||||
}
|
||||
packet[packet_size - 1] = '\0';
|
||||
/*
|
||||
* All fw messages starts with new line character. This
|
||||
* causes dprintk to print this message in two lines
|
||||
* in the kernel log. Ignoring the first character
|
||||
* from the message fixes this to print it in a single
|
||||
* line.
|
||||
*/
|
||||
log = (u8 *)packet + sizeof(struct hfi_debug_header) + 1;
|
||||
dprintk_firmware(log_level, "%s", log);
|
||||
}
|
||||
#undef SKIP_INVALID_PKT
|
||||
|
||||
if (local_packet)
|
||||
kfree(packet);
|
||||
@@ -1104,7 +1078,7 @@ static int __power_collapse(struct msm_vidc_core *core, bool force)
|
||||
if (rc)
|
||||
goto skip_power_off;
|
||||
|
||||
__flush_debug_queue(core, core->packet);
|
||||
__flush_debug_queue(core, core->packet, core->packet_size);
|
||||
|
||||
rc = __suspend(core);
|
||||
if (rc)
|
||||
@@ -2439,7 +2413,7 @@ static int __response_handler(struct msm_vidc_core *core)
|
||||
}
|
||||
|
||||
__schedule_power_collapse_work(core);
|
||||
__flush_debug_queue(core, core->response_packet);
|
||||
__flush_debug_queue(core, core->response_packet, core->packet_size);
|
||||
|
||||
return rc;
|
||||
}
|
||||
|
@@ -130,6 +130,30 @@ int validate_packet(u8 *response_pkt, u8 *core_resp_pkt,
|
||||
return 0;
|
||||
}
|
||||
|
||||
static int handle_session_info(struct msm_vidc_inst *inst,
|
||||
struct hfi_packet *pkt)
|
||||
{
|
||||
|
||||
int rc = 0;
|
||||
char *info;
|
||||
|
||||
switch (pkt->type) {
|
||||
case HFI_INFO_UNSUPPORTED:
|
||||
info = "unsupported";
|
||||
break;
|
||||
case HFI_INFO_DATA_CORRUPT:
|
||||
info = "data corrupt";
|
||||
break;
|
||||
default:
|
||||
info = "unknown";
|
||||
break;
|
||||
}
|
||||
|
||||
s_vpr_e(inst->sid, "session info (%#x): %s\n", pkt->type, info);
|
||||
|
||||
return rc;
|
||||
}
|
||||
|
||||
static int handle_session_error(struct msm_vidc_inst *inst,
|
||||
struct hfi_packet *pkt)
|
||||
{
|
||||
@@ -633,7 +657,8 @@ static int handle_session_buffer(struct msm_vidc_inst *inst,
|
||||
buffer = (struct hfi_buffer *)((u8 *)pkt + sizeof(struct hfi_packet));
|
||||
buf_type = buffer->type;
|
||||
if (!is_valid_hfi_buffer_type(inst, buf_type, __func__)) {
|
||||
msm_vidc_change_inst_state(inst, MSM_VIDC_ERROR, __func__);
|
||||
/* TODO */
|
||||
//msm_vidc_change_inst_state(inst, MSM_VIDC_ERROR, __func__);
|
||||
return 0;
|
||||
}
|
||||
|
||||
@@ -915,9 +940,9 @@ static int handle_session_response(struct msm_vidc_core *core,
|
||||
goto exit;
|
||||
}
|
||||
packet = (struct hfi_packet *)pkt;
|
||||
if (packet->type < HFI_CMD_END &&
|
||||
packet->type > HFI_CMD_BEGIN) {
|
||||
if (inst->hfi_cmd_type || inst->hfi_port) {
|
||||
if (packet->type > HFI_CMD_BEGIN &&
|
||||
packet->type < HFI_CMD_END) {
|
||||
if (inst->hfi_cmd_type == HFI_CMD_SETTINGS_CHANGE) {
|
||||
s_vpr_e(inst->sid,
|
||||
"%s: invalid cmd %d, port %d \n",
|
||||
__func__, inst->hfi_cmd_type,
|
||||
@@ -933,6 +958,9 @@ static int handle_session_response(struct msm_vidc_core *core,
|
||||
} else if (packet->type > HFI_SESSION_ERROR_BEGIN &&
|
||||
packet->type < HFI_SESSION_ERROR_END) {
|
||||
rc = handle_session_error(inst, packet);
|
||||
} else if (packet->type > HFI_INFORMATION_BEGIN &&
|
||||
packet->type < HFI_INFORMATION_END) {
|
||||
rc = handle_session_info(inst, packet);
|
||||
} else {
|
||||
s_vpr_e(inst->sid, "%s: Unknown packet type: %#x\n",
|
||||
__func__, packet->type);
|
||||
|
Atsaukties uz šo jaunā problēmā
Block a user