summaryrefslogtreecommitdiff
path: root/drivers/video/fbdev/msm/mdss_mdp_debug.h
blob: 9a72577432cae32f3c8f2cd89962c149ac573fd4 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
/*
 * Copyright (c) 2014-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
 * only version 2 as published by the Free Software Foundation.
 *
 * This program is distributed in the hope that it will be useful,
 * but WITHOUT ANY WARRANTY; without even the implied warranty of
 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
 * GNU General Public License for more details.
 *
 */

#ifndef MDSS_MDP_DEBUG_H
#define MDSS_MDP_DEBUG_H

#include <linux/msm_mdp.h>
#include <linux/stringify.h>

#include "mdss.h"
#include "mdss_mdp.h"

#define MDP_DANGER_SAFE_BIT_OFFSET	0
#define VIG_DANGER_SAFE_BIT_OFFSET	4
#define RGB_DANGER_SAFE_BIT_OFFSET	12
#define DMA_DANGER_SAFE_BIT_OFFSET	20
#define CURSOR_DANGER_SAFE_BIT_OFFSET	24

#define DANGER_SAFE_STATUS(X, Y) (((X) & (BIT(Y) | BIT((Y)+1))) >> (Y))

static inline const char *mdss_mdp_pipetype2str(u32 ptype)
{
	static const char const *strings[] = {
#define PIPE_TYPE(t) [MDSS_MDP_PIPE_TYPE_ ## t] = __stringify(t)
		PIPE_TYPE(VIG),
		PIPE_TYPE(RGB),
		PIPE_TYPE(DMA),
		PIPE_TYPE(CURSOR),
#undef PIPE_TYPE
	};

	if (ptype >= ARRAY_SIZE(strings) || !strings[ptype])
		return "UNKOWN";

	return strings[ptype];
}

static inline const char *mdss_mdp_format2str(u32 format)
{
	static const char const *strings[] = {
#define FORMAT_NAME(f) [MDP_ ## f] = __stringify(f)
		FORMAT_NAME(RGB_565),
		FORMAT_NAME(BGR_565),
		FORMAT_NAME(RGB_888),
		FORMAT_NAME(BGR_888),
		FORMAT_NAME(RGBX_8888),
		FORMAT_NAME(RGBA_8888),
		FORMAT_NAME(ARGB_8888),
		FORMAT_NAME(XRGB_8888),
		FORMAT_NAME(BGRA_8888),
		FORMAT_NAME(BGRX_8888),
		FORMAT_NAME(Y_CBCR_H2V2_VENUS),
		FORMAT_NAME(Y_CBCR_H2V2),
		FORMAT_NAME(Y_CRCB_H2V2),
		FORMAT_NAME(Y_CB_CR_H2V2),
		FORMAT_NAME(Y_CR_CB_H2V2),
		FORMAT_NAME(Y_CR_CB_GH2V2),
		FORMAT_NAME(YCBYCR_H2V1),
		FORMAT_NAME(YCRYCB_H2V1),
		FORMAT_NAME(RGBA_8888_UBWC),
		FORMAT_NAME(RGBX_8888_UBWC),
		FORMAT_NAME(RGB_565_UBWC),
		FORMAT_NAME(Y_CBCR_H2V2_UBWC)
#undef FORMAT_NAME
	};

	if (format >= ARRAY_SIZE(strings) || !strings[format])
		return "UNKOWN";

	return strings[format];
}
void mdss_mdp_dump(struct mdss_data_type *mdata);
void mdss_mdp_hw_rev_debug_caps_init(struct mdss_data_type *mdata);


#ifdef CONFIG_DEBUG_FS
int mdss_mdp_debugfs_init(struct mdss_data_type *mdata);
#else
static inline int mdss_mdp_debugfs_init(struct mdss_data_type *mdata)
{
	return 0;
}
#endif

#endif /* MDSS_MDP_DEBUG_H */