Merge "msm: vidc: amend video driver and firmware logging"

This commit is contained in:
qctecmdr 2019-05-18 18:42:51 -07:00 • committed by Gerrit - the friendly Code Review server
commit 225d4355de
3 changed files with 43 additions and 41 deletions

View file

@ -2094,7 +2094,7 @@ static int venus_hfi_core_init(void *device)
if (rc || __iface_cmdq_write(dev, &version_pkt))
dprintk(VIDC_WARN, "Failed to send image version pkt to f/w\n");
__sys_set_debug(device, msm_vidc_fw_debug);
__sys_set_debug(device, (msm_vidc_debug & FW_LOGMASK) >> FW_LOGSHIFT);
__enable_subcaches(device);
__set_subcaches(device);
@ -2291,7 +2291,8 @@ err_set_prop:
static void __set_default_sys_properties(struct venus_hfi_device *device)
{
if (__sys_set_debug(device, msm_vidc_fw_debug))
if (__sys_set_debug(device,
(msm_vidc_debug & FW_LOGMASK) >> FW_LOGSHIFT))
dprintk(VIDC_WARN, "Setting fw_debug msg ON failed\n");
if (__sys_set_power_control(device, true))
dprintk(VIDC_WARN, "Setting h/w power collapse ON failed\n");
@ -3238,7 +3239,7 @@ static void __process_sys_error(struct venus_hfi_device *device)
static void __flush_debug_queue(struct venus_hfi_device *device, u8 *packet)
{
bool local_packet = false;
enum vidc_msg_prio log_level = VIDC_FW;
enum vidc_msg_prio log_level = msm_vidc_debug;
if (!device) {
dprintk(VIDC_ERR, "%s: Invalid params\n", __func__);
@ -3256,11 +3257,10 @@ static void __flush_debug_queue(struct venus_hfi_device *device, u8 *packet)
local_packet = true;
/*
* Local packek is used when something FATAL occurred.
* It is good to print these logs by default.
* Local packek is used when error occurred.
* It is good to print these logs to printk as well.
*/
log_level = VIDC_ERR;
log_level |= VIDC_PRINTK;
}
while (!__iface_dbgq_read(device, packet)) {
@ -4594,7 +4594,7 @@ static inline int __resume(struct venus_hfi_device *device)
device->res->pm_qos_latency_us);
}
__sys_set_debug(device, msm_vidc_fw_debug);
__sys_set_debug(device, (msm_vidc_debug & FW_LOGMASK) >> FW_LOGSHIFT);
__enable_subcaches(device);
__set_subcaches(device);

View file

@ -9,18 +9,14 @@
#include "vidc_hfi_api.h"
#include <linux/of_fdt.h>
int msm_vidc_debug = VIDC_ERR | VIDC_WARN;
int msm_vidc_debug = VIDC_ERR | VIDC_WARN | VIDC_PRINTK |
FW_HIGH | FW_ERROR | FW_FATAL | FW_FTRACE;
EXPORT_SYMBOL(msm_vidc_debug);
int msm_vidc_debug_out = VIDC_OUT_PRINTK;
EXPORT_SYMBOL(msm_vidc_debug_out);
bool msm_vidc_lossless_encode = !true;
EXPORT_SYMBOL(msm_vidc_lossless_encode);
int msm_vidc_fw_debug = HFI_DEBUG_MSG_HIGH |
HFI_DEBUG_MSG_ERROR | HFI_DEBUG_MSG_FATAL;
int msm_vidc_fw_debug_mode = 1;
int msm_vidc_fw_debug_mode = HFI_DEBUG_MODE_QUEUE;
bool msm_vidc_fw_coverage = !true;
bool msm_vidc_thermal_mitigation_disabled = !true;
int msm_vidc_clock_voting = !1;
@ -179,10 +175,8 @@ struct dentry *msm_vidc_debugfs_init_drv(void)
ok =
__debugfs_create(x32, "debug_level", &msm_vidc_debug) &&
__debugfs_create(x32, "fw_level", &msm_vidc_fw_debug) &&
__debugfs_create(u32, "fw_debug_mode", &msm_vidc_fw_debug_mode) &&
__debugfs_create(bool, "fw_coverage", &msm_vidc_fw_coverage) &&
__debugfs_create(u32, "debug_output", &msm_vidc_debug_out) &&
__debugfs_create(bool, "disable_thermal_mitigation",
&msm_vidc_thermal_mitigation_disabled) &&
__debugfs_create(u32, "core_clock_voting",

View file

@ -32,18 +32,25 @@
*/
enum vidc_msg_prio {
VIDC_ERR = 0x0001,
VIDC_WARN = 0x0002,
VIDC_INFO = 0x0004,
VIDC_DBG = 0x0008,
VIDC_PROF = 0x0010,
VIDC_PKT = 0x0020,
VIDC_FW = 0x1000,
};
enum vidc_msg_out {
VIDC_OUT_PRINTK = 0,
VIDC_ERR = 0x00000001,
VIDC_WARN = 0x00000002,
VIDC_INFO = 0x00000004,
VIDC_DBG = 0x00000008,
VIDC_PROF = 0x00000010,
VIDC_PKT = 0x00000020,
VIDC_PRINTK = 0x00001000,
VIDC_FTRACE = 0x00002000,
FW_LOW = 0x00010000,
FW_MEDIUM = 0x00020000,
FW_HIGH = 0x00040000,
FW_ERROR = 0x00080000,
FW_FATAL = 0x00100000,
FW_PERF = 0x00200000,
FW_PRINTK = 0x10000000,
FW_FTRACE = 0x20000000,
};
#define FW_LOGSHIFT 16
#define FW_LOGMASK 0x0FFF0000
enum msm_vidc_debugfs_event {
MSM_VIDC_DEBUGFS_EVENT_ETB,
@ -53,8 +60,6 @@ enum msm_vidc_debugfs_event {
};
extern int msm_vidc_debug;
extern int msm_vidc_debug_out;
extern int msm_vidc_fw_debug;
extern int msm_vidc_fw_debug_mode;
extern bool msm_vidc_fw_coverage;
extern bool msm_vidc_thermal_mitigation_disabled;
@ -66,9 +71,19 @@ extern bool msm_vidc_cvp_usage;
#define dprintk(__level, __fmt, ...) \
do { \
if (msm_vidc_debug & __level) { \
if (msm_vidc_debug_out == VIDC_OUT_PRINTK) { \
if (msm_vidc_debug & VIDC_FTRACE) { \
char trace_logbuf[MAX_TRACER_LOG_LENGTH]; \
int log_length = snprintf(trace_logbuf, \
MAX_TRACER_LOG_LENGTH, \
VIDC_DBG_TAG __fmt, \
get_debug_level_str(__level), \
##__VA_ARGS__); \
trace_msm_vidc_printf(trace_logbuf, \
log_length); \
} \
if (msm_vidc_debug & VIDC_PRINTK) { \
pr_info(VIDC_DBG_TAG __fmt, \
get_debug_level_str(__level), \
get_debug_level_str(__level), \
##__VA_ARGS__); \
} \
} \
@ -76,13 +91,8 @@ extern bool msm_vidc_cvp_usage;
#define dprintk_ratelimit(__level, __fmt, arg...) \
do { \
if (msm_vidc_debug & __level) { \
if (msm_vidc_debug_out == VIDC_OUT_PRINTK && \
msm_vidc_check_ratelimit()) { \
pr_info(VIDC_DBG_TAG __fmt, \
get_debug_level_str(__level), \
## arg); \
} \
if (msm_vidc_check_ratelimit()) { \
dprintk(__level, __fmt, arg); \
} \
} while (0)
@ -118,8 +128,6 @@ static inline char *get_debug_level_str(int level)
return "prof";
case VIDC_PKT:
return "pkt";
case VIDC_FW:
return "fw";
default:
return "???";
}