msm: vidc: print session specific logs based on logmask

print logs based on logmask set on debugfs entry
	(/d/msm_vidc/debug_level)
[1] 0xx -> print logs for all session type
[2] 1xx -> print only encoder logs
[3] 2xx -> print only decoder logs
[4] 4xx -> print only cvp logs

Change-Id: I8e01ee9c8b80a50b178ea87bf25d7ef25401f67a
Signed-off-by: Govindaraj Rajagopal <grajagop@codeaurora.org>
This commit is contained in:
Govindaraj Rajagopal 2019-09-04 11:38:34 +05:30
commit bba6fe37af
2 changed files with 37 additions and 6 deletions

View file

@ -600,7 +600,7 @@ int msm_vidc_check_ratelimit(void)
/**
* get_sid() must be called under "&core->lock"
* to avoid race condition in occurring empty slot.
* to avoid race condition at occupying empty slot.
*/
int get_sid(u32 *sid, u32 session_type)
{
@ -633,6 +633,7 @@ inline void update_log_ctxt(u32 sid, u32 session_type, u32 fourcc)
{
const char *codec;
char type;
u32 s_type = 0;
if (!sid || sid > MAX_SUPPORTED_INSTANCES) {
d_vpr_e("%s: invalid sid %#x\n",
@ -676,28 +677,54 @@ inline void update_log_ctxt(u32 sid, u32 session_type, u32 fourcc)
switch (session_type) {
case MSM_VIDC_ENCODER:
type = 'e';
s_type = VIDC_ENCODER;
break;
case MSM_VIDC_DECODER:
type = 'd';
s_type = VIDC_DECODER;
break;
case MSM_VIDC_CVP:
type = 'c';
s_type = VIDC_CVP;
default:
type = '.';
break;
}
ctxt[sid-1].session_type = session_type;
ctxt[sid-1].session_type = s_type;
ctxt[sid-1].codec_type = fourcc;
memcpy(&ctxt[sid-1].name, codec, 4);
ctxt[sid-1].name[4] = type;
ctxt[sid-1].name[5] = '\0';
}
char *get_codec_name(u32 sid)
inline char *get_codec_name(u32 sid)
{
if (!sid || sid > MAX_SUPPORTED_INSTANCES)
return ".....";
return ctxt[sid-1].name;
}
/**
* 0xx -> allow prints for all sessions
* 1xx -> allow only encoder prints
* 2xx -> allow only decoder prints
* 4xx -> allow only cvp prints
*/
inline bool is_print_allowed(u32 sid, u32 level)
{
if (!(msm_vidc_debug & level))
return false;
if (!((msm_vidc_debug >> 8) & 0xF))
return true;
if (!sid || sid > MAX_SUPPORTED_INSTANCES)
return true;
if (ctxt[sid-1].session_type & msm_vidc_debug)
return true;
return false;
}

View file

@ -40,6 +40,9 @@ enum vidc_msg_prio {
VIDC_PERF = 0x00000008,
VIDC_PKT = 0x00000010,
VIDC_BUS = 0x00000020,
VIDC_ENCODER = 0x00000100,
VIDC_DECODER = 0x00000200,
VIDC_CVP = 0x00000400,
VIDC_PRINTK = 0x00001000,
VIDC_FTRACE = 0x00002000,
FW_LOW = 0x00010000,
@ -79,7 +82,7 @@ struct log_cookie {
#define dprintk(__level, sid, __fmt, ...) \
do { \
if (msm_vidc_debug & __level) { \
if (is_print_allowed(sid, __level)) { \
if (msm_vidc_debug & VIDC_FTRACE) { \
char trace_logbuf[MAX_TRACER_LOG_LENGTH]; \
int log_length = snprintf(trace_logbuf, \
@ -167,8 +170,9 @@ void msm_vidc_debugfs_update(struct msm_vidc_inst *inst,
int msm_vidc_check_ratelimit(void);
int get_sid(u32 *sid, u32 session_type);
void update_log_ctxt(u32 sid, u32 session_type, u32 fourcc);
char *get_codec_name(u32 sid);
void put_sid(u32 sid);
inline char *get_codec_name(u32 sid);
inline void put_sid(u32 sid);
inline bool is_print_allowed(u32 sid, u32 level);
static inline char *get_debug_level_str(int level)
{