Merge "video: driver: driver fixes required for latest firmware" into video-kernel-waipio.lnx.1.0

Šī revīzija ir iekļauta:
Linux Build Service Account
2020-12-08 17:29:52 -08:00
revīziju iesūtīja Gerrit - the friendly Code Review server
revīzija aa09897cad
9 mainīti faili ar 90 papildinājumiem un 79 dzēšanām

Parādīt failu

@@ -21,5 +21,7 @@ int msm_vdec_inst_init(struct msm_vidc_inst *inst);
int msm_vdec_input_port_settings_change(struct msm_vidc_inst *inst);
int msm_vdec_output_port_settings_change(struct msm_vidc_inst *inst);
int msm_vdec_process_cmd(struct msm_vidc_inst *inst, u32 cmd);
int msm_vdec_subscribe_port_settings_change(struct msm_vidc_inst *inst,
enum msm_vidc_port_type port);
#endif // _MSM_VDEC_H_

Parādīt failu

@@ -118,7 +118,7 @@ struct msm_vidc_inst {
struct list_head input_ts;
struct list_head enc_input_crs;
struct list_head decode_bitrate_data;
bool codec_set;
bool once_per_session_set;
struct dentry *debugfs_root;
struct msm_vidc_debug debug;
struct msm_vidc_inst_capability *capabilities;

Parādīt failu

@@ -131,6 +131,7 @@ enum msm_vidc_buffer_type {
MSM_VIDC_BUF_LINE,
MSM_VIDC_BUF_DPB,
MSM_VIDC_BUF_PERSIST,
MSM_VIDC_BUF_VPSS,
};
/* always match with v4l2 flags V4L2_BUF_FLAG_* */

Parādīt failu

@@ -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;

Parādīt failu

@@ -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;
}

Parādīt failu

@@ -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;
}
}
}
/*

Parādīt failu

@@ -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;
}

Parādīt failu

@@ -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);