1 /* SPDX-License-Identifier: (GPL-2.0+ OR MIT) */
2 /*
3 * Copyright (c) 2021 Rockchip Electronics Co., Ltd.
4 * Author: Sandy Huang <hjc@rock-chips.com>
5 */
6
7 #ifndef ROCKCHIP_DRM_DEBUGFS_H
8 #define ROCKCHIP_DRM_DEBUGFS_H
9
10 /**
11 * struct vop_dump_info - vop dump plane info structure
12 *
13 * Store plane info used to write display data to /data/vop_buf/
14 *
15 */
16 struct vop_dump_info {
17 /* @win_id: vop hard win index */
18 u8 win_id;
19 /* @area_id: vop hard area index inside win */
20 u8 area_id;
21 /* @AFBC_flag: indicate the buffer compress by gpu or not */
22 bool AFBC_flag;
23 /* @yuv_format: indicate yuv format or not */
24 bool yuv_format;
25 /* @pitches: the buffer pitch size */
26 u32 pitches;
27 /* @height: the buffer pitch height */
28 u32 height;
29 /* @info: DRM format info */
30 const struct drm_format_info *format;
31 /* @offset: the buffer offset */
32 unsigned long offset;
33 /* @num_pages: the pages number */
34 unsigned long num_pages;
35 /* @pages: store the buffer all pages */
36 struct page **pages;
37 };
38
39 /**
40 * struct vop_dump_list - store all buffer info per frame
41 *
42 * one frame maybe multiple buffer, all will be stored here.
43 *
44 */
45 struct vop_dump_list {
46 struct list_head entry;
47 struct vop_dump_info dump_info;
48 };
49
50 enum vop_dump_status {
51 DUMP_DISABLE = 0,
52 DUMP_KEEP
53 };
54
55 #if defined(CONFIG_ROCKCHIP_DRM_DEBUG)
56 int rockchip_drm_add_dump_buffer(struct drm_crtc *crtc, struct dentry *root);
57 int rockchip_drm_dump_plane_buffer(struct vop_dump_info *dump_info, int frame_count);
58 int rockchip_drm_debugfs_add_color_bar(struct drm_crtc *crtc, struct dentry *root);
59 #else
60 static inline int
rockchip_drm_add_dump_buffer(struct drm_crtc * crtc,struct dentry * root)61 rockchip_drm_add_dump_buffer(struct drm_crtc *crtc, struct dentry *root)
62 {
63 return 0;
64 }
65
66 static inline int
rockchip_drm_dump_plane_buffer(struct vop_dump_info * dump_info,int frame_count)67 rockchip_drm_dump_plane_buffer(struct vop_dump_info *dump_info, int frame_count)
68 {
69 return 0;
70 }
71
72 static inline int
rockchip_drm_debugfs_add_color_bar(struct drm_crtc * crtc,struct dentry * root)73 rockchip_drm_debugfs_add_color_bar(struct drm_crtc *crtc, struct dentry *root)
74 {
75 return 0;
76 }
77 #endif
78
79 #endif
80