diff --git a/msm/vidc/msm_vidc_debug.c b/msm/vidc/msm_vidc_debug.c index cd69a2ae161a..18a78bf6e69b 100644 --- a/msm/vidc/msm_vidc_debug.c +++ b/msm/vidc/msm_vidc_debug.c @@ -31,7 +31,7 @@ int msm_vidc_vpp_delay; atomic_read(&__binfo->ref_count) >= 2 ? "video driver" : "firmware";\ }) -static struct log_cookie ctxt[MAX_SUPPORTED_INSTANCES]; +struct log_cookie ctxt[MAX_SUPPORTED_INSTANCES]; struct core_inst_pair { struct msm_vidc_core *core; @@ -626,17 +626,6 @@ int get_sid(u32 *sid, u32 session_type) return (i == MAX_SUPPORTED_INSTANCES); } -void put_sid(u32 sid) -{ - if (!sid || sid > MAX_SUPPORTED_INSTANCES) { - d_vpr_e("%s: invalid sid %#x\n", - __func__, sid); - return; - } - if (ctxt[sid-1].used) - ctxt[sid-1].used = 0; -} - inline void update_log_ctxt(u32 sid, u32 session_type, u32 fourcc) { const char *codec; @@ -697,36 +686,6 @@ inline void update_log_ctxt(u32 sid, u32 session_type, u32 fourcc) ctxt[sid-1].name[5] = '\0'; } -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 - */ -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; -} - /* Mock all the missing parts for successful compilation starts here */ void do_gettimeofday(struct timeval *__ddl_tv) { diff --git a/msm/vidc/msm_vidc_debug.h b/msm/vidc/msm_vidc_debug.h index 7b523eddb55f..8dfaee14cd98 100644 --- a/msm/vidc/msm_vidc_debug.h +++ b/msm/vidc/msm_vidc_debug.h @@ -92,6 +92,13 @@ enum vidc_err_recovery_disable { VIDC_DISABLE_NON_NOC_ERR_RECOV = 0x0002 }; +struct log_cookie { + u32 used; + u32 session_type; + u32 codec_type; + char name[20]; +}; + extern int msm_vidc_debug; extern int msm_vidc_fw_debug_mode; extern bool msm_vidc_fw_coverage; @@ -102,13 +109,7 @@ extern bool msm_vidc_lossless_encode; extern bool msm_vidc_cvp_usage; extern int msm_vidc_err_recovery_disable; extern int msm_vidc_vpp_delay; - -struct log_cookie { - u32 used; - u32 session_type; - u32 codec_type; - char name[20]; -}; +extern struct log_cookie ctxt[MAX_SUPPORTED_INSTANCES]; #define dprintk(__level, sid, __fmt, ...) \ do { \ @@ -200,9 +201,6 @@ 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); -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) { @@ -225,6 +223,48 @@ static inline char *get_debug_level_str(int level) } } +/** + * 0xx -> allow prints for all sessions + * 1xx -> allow only encoder prints + * 2xx -> allow only decoder prints + * 4xx -> allow only cvp prints + */ +static 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; +} + +static inline char *get_codec_name(u32 sid) +{ + if (!sid || sid > MAX_SUPPORTED_INSTANCES) + return "....."; + + return ctxt[sid-1].name; +} + +static inline void put_sid(u32 sid) +{ + if (!sid || sid > MAX_SUPPORTED_INSTANCES) { + d_vpr_e("%s: invalid sid %#x\n", + __func__, sid); + return; + } + if (ctxt[sid-1].used) + ctxt[sid-1].used = 0; +} + static inline void tic(struct msm_vidc_inst *i, enum profiling_points p, char *b) {