msm: vidc: Enable dynamic debug level & out for video kernel driver

"level" has an option of FATAL, ERROR, HIGH, MED, LOW.
  >>usage for all levels: adb shell "echo 0xF > /d/vidc/vidc_debug_level"
"out" has an option of printk or trace_printk.
  >>usage for terminal window: adb shell "echo 1 > /d/vidc/vidc_debug_out"

Change-Id: I0ea3ed2999cc80e691ea86667401eff6c1bf88a8
Signed-off-by: wyun@codeaurora.org
This commit is contained in:
wyun 2015-12-15 13:17:39 -05:00 committed by Artem Borisov
parent 1ecc53d36d
commit 53010ac515
6 changed files with 74 additions and 37 deletions

View file

@ -552,9 +552,9 @@ void ddl_set_vidc_timeout(struct ddl_client_context *ddl);
#ifdef DDL_BUF_LOG
void ddl_list_buffers(struct ddl_client_context *ddl);
#endif
#ifdef DDL_MSG_LOG
s8 *ddl_get_state_string(enum ddl_client_state client_state);
#endif
extern unsigned char *vidc_video_codec_fw;
extern u32 vidc_video_codec_fw_size;

View file

@ -1,4 +1,4 @@
/* Copyright (c) 2010-2013, The Linux Foundation. All rights reserved.
/* Copyright (c) 2010-2013, 2015, The Linux Foundation. All rights reserved.
*
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License version 2 and
@ -22,7 +22,6 @@ struct ddl_context *ddl_get_context(void)
return &ddl_context;
}
#ifdef DDL_MSG_LOG
s8 *ddl_get_state_string(enum ddl_client_state client_state)
{
s8 *ptr;
@ -70,7 +69,6 @@ s8 *ddl_get_state_string(enum ddl_client_state client_state)
}
return ptr;
}
#endif
u32 ddl_client_transact(u32 operation,
struct ddl_client_context **pddl_client)

View file

@ -1,4 +1,4 @@
/* Copyright (c) 2010-2013, The Linux Foundation. All rights reserved.
/* Copyright (c) 2010-2013, 2015, The Linux Foundation. All rights reserved.
*
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License version 2 and
@ -408,7 +408,7 @@ static u32 ddl_decoder_seq_done_callback(struct ddl_context *ddl_context,
seq_hdr_info.dec_frm_size);
}
}
DDL_MSG_INFO("profile %u level %u progressive %u",
DDL_MSG_HIGH("profile %u level %u progressive %u",
decoder->profile.profile,
decoder->level.level,
decoder->progressive_only);

View file

@ -1,4 +1,4 @@
/* Copyright (c) 2010-2013, The Linux Foundation. All rights reserved.
/* Copyright (c) 2010-2013, 2015, The Linux Foundation. All rights reserved.
*
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License version 2 and
@ -20,6 +20,9 @@
extern u32 vidc_msg_pmem;
extern u32 vidc_msg_timing;
extern u32 vidc_debug_level;
extern u32 vidc_debug_out;
enum timing_data {
DEC_OP_TIME,
DEC_IP_TIME,
@ -34,19 +37,57 @@ do { \
printk(KERN_DEBUG x); \
} while (0)
#ifdef DDL_MSG_LOG
#define DDL_MSG_LOW(x...) printk(KERN_INFO x)
#define DDL_MSG_MED(x...) printk(KERN_INFO x)
#define DDL_MSG_HIGH(x...) printk(KERN_INFO x)
#else
#define DDL_MSG_LOW(x...)
#define DDL_MSG_MED(x...)
#define DDL_MSG_HIGH(x...)
#endif
/* Enable dynamic debug logging method */
enum vidc_msg_level {
PRIO_FATAL = 0x1,
PRIO_ERROR = PRIO_FATAL,
PRIO_HIGH = 0x2,
PRIO_MED = 0x4,
PRIO_LOW = 0x8
};
#define DDL_MSG_INFO(x...) printk(KERN_INFO x)
#define DDL_MSG_ERROR(x...) printk(KERN_INFO x)
#define DDL_MSG_FATAL(x...) printk(KERN_INFO x)
enum vidc_msg_out {
VIDC_OUT_PRINTK = 1,
VIDC_OUT_FTRACE
};
#define debug_msg_printk(__msg...) \
do { \
if (vidc_debug_out == VIDC_OUT_PRINTK) \
printk(KERN_INFO __msg); \
else if (vidc_debug_out == VIDC_OUT_FTRACE) \
trace_printk(KERN_DEBUG __msg); \
} while (0)
#define DDL_MSG_LOW(x...) \
do { \
if (vidc_debug_level & PRIO_LOW) \
debug_msg_printk(x); \
} while (0)
#define DDL_MSG_MED(x...) \
do { \
if (vidc_debug_level & PRIO_MED) \
debug_msg_printk(x); \
} while (0)
#define DDL_MSG_HIGH(x...) \
do { \
if (vidc_debug_level & PRIO_HIGH) \
debug_msg_printk(x); \
} while (0)
#define DDL_MSG_ERROR(x...) \
do { \
if (vidc_debug_level & PRIO_ERROR) \
debug_msg_printk("\n <ERROR>: " x); \
} while (0)
#define DDL_MSG_FATAL(x...) \
do { \
if (vidc_debug_level & PRIO_FATAL) \
debug_msg_printk("\n <FATAL>: " x); \
} while (0)
#define DDL_ALIGN_SIZE(sz, guard_bytes, align_mask) \
(((u32)(sz) + guard_bytes) & align_mask)

View file

@ -1,4 +1,4 @@
/* Copyright (c) 2010-2013, The Linux Foundation. All rights reserved.
/* Copyright (c) 2010-2013, 2015, The Linux Foundation. All rights reserved.
*
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License version 2 and
@ -65,6 +65,10 @@ static spinlock_t vidc_spin_lock;
u32 vidc_msg_timing, vidc_msg_pmem, vidc_msg_register;
/* define debug level and output target */
u32 vidc_debug_level = PRIO_ERROR;
u32 vidc_debug_out = VIDC_OUT_PRINTK;
#ifdef VIDC_ENABLE_DBGFS
struct dentry *vidc_debugfs_root;
@ -313,6 +317,10 @@ static int __init vidc_init(void)
(u32 *) &vidc_msg_pmem);
vidc_debugfs_file_create(root, "vidc_msg_register",
(u32 *) &vidc_msg_register);
vidc_debugfs_file_create(root, "vidc_debug_out",
(u32 *) &vidc_debug_out);
vidc_debugfs_file_create(root, "vidc_debug_level",
(u32 *) &vidc_debug_level);
}
#endif
return 0;

View file

@ -1,4 +1,4 @@
/* Copyright (c) 2010-2012, The Linux Foundation. All rights reserved.
/* Copyright (c) 2010-2012, 2015, The Linux Foundation. All rights reserved.
*
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License version 2 and
@ -15,22 +15,12 @@
#include <media/msm/vidc_type.h>
#include <media/msm/vcd_api.h>
#if DEBUG
#define VCD_MSG_LOW(xx_fmt...) DDL_MSG_LOW(xx_fmt)
#define VCD_MSG_MED(xx_fmt...) DDL_MSG_MED(xx_fmt)
#define VCD_MSG_HIGH(xx_fmt...) DDL_MSG_HIGH(xx_fmt)
#define VCD_MSG_LOW(xx_fmt...) printk(KERN_INFO "\n\t* " xx_fmt)
#define VCD_MSG_MED(xx_fmt...) printk(KERN_INFO "\n * " xx_fmt)
#define VCD_MSG_HIGH(xx_fmt...) printk(KERN_WARNING "\n" xx_fmt)
#else
#define VCD_MSG_LOW(xx_fmt...)
#define VCD_MSG_MED(xx_fmt...)
#define VCD_MSG_HIGH(xx_fmt...)
#endif
#define VCD_MSG_ERROR(xx_fmt...) printk(KERN_ERR "\n err: " xx_fmt)
#define VCD_MSG_FATAL(xx_fmt...) printk(KERN_ERR "\n<FATAL> " xx_fmt)
#define VCD_MSG_ERROR(xx_fmt...) DDL_MSG_ERROR(xx_fmt)
#define VCD_MSG_FATAL(xx_fmt...) DDL_MSG_FATAL(xx_fmt)
#define VCD_FAILED_RETURN(rc, xx_fmt...) \
do { \