Linux Kernel  3.7.1
 All Data Structures Namespaces Files Functions Variables Typedefs Enumerations Enumerator Macros Groups Pages
omap_voutdef.h
Go to the documentation of this file.
1 /*
2  * omap_voutdef.h
3  *
4  * Copyright (C) 2010 Texas Instruments.
5  *
6  * This file is licensed under the terms of the GNU General Public License
7  * version 2. This program is licensed "as is" without any warranty of any
8  * kind, whether express or implied.
9  */
10 
11 #ifndef OMAP_VOUTDEF_H
12 #define OMAP_VOUTDEF_H
13 
14 #include <video/omapdss.h>
15 #include <plat/vrfb.h>
16 
17 #define YUYV_BPP 2
18 #define RGB565_BPP 2
19 #define RGB24_BPP 3
20 #define RGB32_BPP 4
21 #define TILE_SIZE 32
22 #define YUYV_VRFB_BPP 2
23 #define RGB_VRFB_BPP 1
24 #define MAX_CID 3
25 #define MAC_VRFB_CTXS 4
26 #define MAX_VOUT_DEV 2
27 #define MAX_OVLS 3
28 #define MAX_DISPLAYS 10
29 #define MAX_MANAGERS 3
30 
31 #define QQVGA_WIDTH 160
32 #define QQVGA_HEIGHT 120
33 
34 /* Max Resolution supported by the driver */
35 #define VID_MAX_WIDTH 1280 /* Largest width */
36 #define VID_MAX_HEIGHT 720 /* Largest height */
37 
38 /* Mimimum requirement is 2x2 for DSS */
39 #define VID_MIN_WIDTH 2
40 #define VID_MIN_HEIGHT 2
41 
42 /* 2048 x 2048 is max res supported by OMAP display controller */
43 #define MAX_PIXELS_PER_LINE 2048
44 
45 #define VRFB_TX_TIMEOUT 1000
46 #define VRFB_NUM_BUFS 4
47 
48 /* Max buffer size tobe allocated during init */
49 #define OMAP_VOUT_MAX_BUF_SIZE (VID_MAX_WIDTH*VID_MAX_HEIGHT*4)
50 
54 };
55 
56 /* Enum for Rotation
57  * DSS understands rotation in 0, 1, 2, 3 context
58  * while V4L2 driver understands it as 0, 90, 180, 270
59  */
65 };
66 
67 /* Enum for choosing rotation type for vout
68  * DSS2 doesn't understand no rotation as an
69  * option while V4L2 driver doesn't support
70  * rotation in the case where VRFB is not built in
71  * the kernel
72  */
76 };
77 
78 /*
79  * This structure is used to store the DMA transfer parameters
80  * for VRFB hidden buffer
81  */
82 struct vid_vrfb_dma {
83  int dev_id;
84  int dma_ch;
86  int tx_status;
88 };
89 
91  int id;
95 };
96 
98  struct mutex mtx;
99 
100  int state;
101 
104 
111 };
112 
113 /* per-device data structure */
115 
117  struct video_device *vfd;
119  int vid;
120  int opened;
121 
122  /* we don't allow to change image fmt/size once buffer has
123  * been allocated
124  */
126  /* allow to reuse previously allocated buffer which is big enough */
128  /* keep buffer info across opens */
132 
133  /* we don't allow to request new buffer when old buffers are
134  * still mmaped
135  */
137 
138  spinlock_t vbq_lock; /* spinlock for videobuf queues */
139  unsigned long field_count; /* field counter for videobuf_buffer */
140 
141  /* non-NULL means streaming is in progress. */
142  bool streaming;
143 
145  struct v4l2_rect crop;
146  struct v4l2_window win;
148 
149  /* Lock to protect the shared data structures in ioctl */
150  struct mutex lock;
151 
152  /* V4L2 control structure for different control id */
155  bool mirror;
157  /* V4L2 control structure for different control id */
158 
159  int bpp; /* bytes per pixel */
160  int vrfb_bpp; /* bytes per pixel with respect to VRFB */
161 
167  unsigned int smsshado_size;
168  unsigned char pos;
169 
177  void *isr_handle;
178 
179  /* Buffer queue variables */
184 
185 };
186 
187 /*
188  * Return true if rotation is 90 or 270
189  */
190 static inline int is_rotation_90_or_270(const struct omap_vout_device *vout)
191 {
192  return (vout->rotation == dss_rotation_90_degree ||
194 }
195 
196 /*
197  * Return true if rotation is enabled
198  */
199 static inline int is_rotation_enabled(const struct omap_vout_device *vout)
200 {
201  return vout->rotation || vout->mirror;
202 }
203 
204 /*
205  * Reverse the rotation degree if mirroring is enabled
206  */
207 static inline int calc_rotation(const struct omap_vout_device *vout)
208 {
209  if (!vout->mirror)
210  return vout->rotation;
211 
212  switch (vout->rotation) {
216  return dss_rotation_90_degree;
218  return dss_rotation_0_degree;
219  default:
221  }
222 }
223 
224 void omap_vout_free_buffers(struct omap_vout_device *vout);
225 #endif /* ifndef OMAP_VOUTDEF_H */