Donate to e Foundation | Murena handsets with /e/OS | Own a part of Murena! Learn more

Commit 319ea3e6 authored by qctecmdr's avatar qctecmdr Committed by Gerrit - the friendly Code Review server
Browse files

Merge "msm:vidc: move inline functions into header file"

parents f1ff3c1c c63a85c1
Loading
Loading
Loading
Loading
+2 −43
Original line number Diff line number Diff line
// SPDX-License-Identifier: GPL-2.0-only
/*
 * Copyright (c) 2012-2019, The Linux Foundation. All rights reserved.
 * Copyright (c) 2012-2020, The Linux Foundation. All rights reserved.
 */

#define CREATE_TRACE_POINTS
@@ -31,7 +31,7 @@ int msm_vidc_err_recovery_disable = !1;
	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;
@@ -621,17 +621,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;
@@ -701,33 +690,3 @@ 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
 * 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;
}
+51 −11
Original line number Diff line number Diff line
/* SPDX-License-Identifier: GPL-2.0-only */
/*
 * Copyright (c) 2012-2019, The Linux Foundation. All rights reserved.
 * Copyright (c) 2012-2020, The Linux Foundation. All rights reserved.
 */

#ifndef __MSM_VIDC_DEBUG__
@@ -69,6 +69,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;
@@ -78,13 +85,7 @@ extern bool msm_vidc_syscache_disable;
extern bool msm_vidc_lossless_encode;
extern bool msm_vidc_cvp_usage;
extern int msm_vidc_err_recovery_disable;

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 { \
@@ -176,9 +177,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)
{
@@ -201,6 +199,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)
{