1
2
3
4
5 #ifndef VPBE_DISPLAY_H
6 #define VPBE_DISPLAY_H
7
8
9 #include <linux/videodev2.h>
10 #include <media/v4l2-common.h>
11 #include <media/v4l2-fh.h>
12 #include <media/videobuf2-v4l2.h>
13 #include <media/videobuf2-dma-contig.h>
14 #include <media/davinci/vpbe_types.h>
15 #include <media/davinci/vpbe_osd.h>
16 #include <media/davinci/vpbe.h>
17
18 #define VPBE_DISPLAY_MAX_DEVICES 2
19
20 enum vpbe_display_device_id {
21 VPBE_DISPLAY_DEVICE_0,
22 VPBE_DISPLAY_DEVICE_1
23 };
24
25 #define VPBE_DISPLAY_DRV_NAME "vpbe-display"
26
27 #define VPBE_DISPLAY_MAJOR_RELEASE 1
28 #define VPBE_DISPLAY_MINOR_RELEASE 0
29 #define VPBE_DISPLAY_BUILD 1
30 #define VPBE_DISPLAY_VERSION_CODE ((VPBE_DISPLAY_MAJOR_RELEASE << 16) | \
31 (VPBE_DISPLAY_MINOR_RELEASE << 8) | \
32 VPBE_DISPLAY_BUILD)
33
34 #define VPBE_DISPLAY_VALID_FIELD(field) ((V4L2_FIELD_NONE == field) || \
35 (V4L2_FIELD_ANY == field) || (V4L2_FIELD_INTERLACED == field))
36
37
38 #define VPBE_DISPLAY_H_EXP_RATIO_N 9
39 #define VPBE_DISPLAY_H_EXP_RATIO_D 8
40 #define VPBE_DISPLAY_V_EXP_RATIO_N 6
41 #define VPBE_DISPLAY_V_EXP_RATIO_D 5
42
43
44 #define VPBE_DISPLAY_ZOOM_4X 4
45 #define VPBE_DISPLAY_ZOOM_2X 2
46
47
48 struct display_layer_info {
49 int enable;
50
51 enum osd_layer id;
52 struct osd_layer_config config;
53 enum osd_zoom_factor h_zoom;
54 enum osd_zoom_factor v_zoom;
55 enum osd_h_exp_ratio h_exp;
56 enum osd_v_exp_ratio v_exp;
57 };
58
59 struct vpbe_disp_buffer {
60 struct vb2_v4l2_buffer vb;
61 struct list_head list;
62 };
63
64
65 struct vpbe_layer {
66
67 struct vpbe_display *disp_dev;
68
69 struct vpbe_disp_buffer *cur_frm;
70
71 struct vpbe_disp_buffer *next_frm;
72
73
74
75 struct vb2_queue buffer_queue;
76
77 struct list_head dma_queue;
78
79 spinlock_t irqlock;
80
81
82 struct video_device video_dev;
83
84 struct v4l2_pix_format pix_fmt;
85 enum v4l2_field buf_field;
86
87 struct display_layer_info layer_info;
88
89
90
91 unsigned char window_enable;
92
93 unsigned int usrs;
94
95 unsigned int field_id;
96
97 enum vpbe_display_device_id device_id;
98
99 struct mutex opslock;
100 u8 layer_first_int;
101 };
102
103
104 struct vpbe_display {
105
106
107 spinlock_t dma_queue_lock;
108
109 unsigned int cbcr_ofst;
110 struct vpbe_layer *dev[VPBE_DISPLAY_MAX_DEVICES];
111 struct vpbe_device *vpbe_dev;
112 struct osd_state *osd_device;
113 };
114
115 struct buf_config_params {
116 unsigned char min_numbuffers;
117 unsigned char numbuffers[VPBE_DISPLAY_MAX_DEVICES];
118 unsigned int min_bufsize[VPBE_DISPLAY_MAX_DEVICES];
119 unsigned int layer_bufsize[VPBE_DISPLAY_MAX_DEVICES];
120 };
121
122 #endif