2 * Copyright (C) 2010 Texas Instruments Incorporated - http://www.ti.com/
4 * This file is licensed under the terms of the GNU General Public License
5 * version 2. This program is licensed "as is" without any warranty of any
6 * kind, whether express or implied.
8 * This file specifies the custom ioctl API between a client "consumer"
9 * process and the V4L2-GFX driver. The consumer process should only use
10 * these APIs and will typically/ultimately be a GL application.
12 * There will also be a "producer" process which queues multimedia
13 * content to the driver, however, this will only use standard V4L2 APIs.
16 #ifndef _OMAP_V4L2_GFX_H_
17 #define _OMAP_V4L2_GFX_H_
19 #include <linux/videodev.h>
22 * @see V4L2_GFX_IOC_CONSUMER, struct v4l2_gfx_consumer_params
24 enum v4l2_gfx_consumer_type
{
26 * Wait for the producer process to activate a video stream
28 V4L2_GFX_CONSUMER_WAITSTREAM
,
32 * @see V4L2_GFX_IOC_CONSUMER
34 struct v4l2_gfx_consumer_params
{
36 * @see v4l2_gfx_consumer_type
40 * If the consumer process is waiting the ioctl will block until the
41 * timeout expires or the expected event occurs, see the type field
43 unsigned int timeout_ms
; /* w */
45 * If acquire_timeout_ms > 0 and no streaming activity has been detected
46 * for acquire_timeout_ms milliseconds the V4L2_GFX_IOC_ACQ ioctl will
47 * return with ETIMEOUT
49 unsigned int acquire_timeout_ms
; /* w */
53 * @see V4L2_GFX_IOC_INFO
55 struct v4l2_gfx_info_params
{
58 * Return how many times the device has been opened, this number will
59 * decrement when the device is closed.
61 * One use for this might be to detect if a consumer or producer is
62 * active and in the process of setting up a stream. However this could
63 * be unreliable if the processes are in the process of closing / crashing.
65 * Obviously this value will always be at least one i.e. the process
66 * issuing the ioctl opens the device.
68 unsigned int opencnt
; /* r */
73 * @see V4L2_GFX_IOC_PRODUCER
75 struct v4l2_gfx_producer_params
{
77 * If set mark the producer side as open, if not set mark as closed.
78 * For Android we need this because the mediaserver won't close the
81 #define V4L2_GFX_PRODUCER_MASK_OPEN 0x1
82 unsigned int flags
; /* w */
85 struct v4l2_gfx_buf_params
{
89 * On acquire, when the ioctl returns the bufid field will be filled in
90 * with the next buffer with data available.
92 * On release, the consumer process just specifies the buffer to release
93 * which usually is the last acquired buffer index.
98 * Cropping information
99 * For the acquire ioctl only
101 int crop_top
; /* r */
102 int crop_left
; /* r */
103 int crop_width
; /* r */
104 int crop_height
; /* r */
108 * This ioctl should be issued once by the consumer process before starting
109 * any rendering loop. It allows the process to wait for the producer process
112 * @see struct v4l2_gfx_consumer_params
115 * Returns 0 if successful, or -1 on error, in which case errno indicates
118 #define V4L2_GFX_IOC_CONSUMER _IOWR ('v', BASE_VIDIOCPRIVATE+0, \
119 struct v4l2_gfx_consumer_params)
122 * Acquire the buffer to be rendered and its properties.
124 * @see struct v4l2_gfx_buf_params
127 * Returns 0 if successful, or -1 on error, in which case errno indicates
130 * ETIMEDOUT If acquire_timeout_ms is set via V4L2_GFX_IOC_CONSUMER
131 * this error code can be returned.
132 * ENODEV If the producer side of the stream stops this error will
135 #define V4L2_GFX_IOC_ACQ _IOR ('v', BASE_VIDIOCPRIVATE+1, \
136 struct v4l2_gfx_buf_params)
139 * Release the buffer that was rendered
141 * @see struct v4l2_gfx_buf_params
144 * Returns 0 if successful, or -1 on error, in which case errno indicates
147 * ETIMEDOUT It took longer than 16ms for the app to render the frame
148 * (This will probably go away to avoid render loop stalls)
149 * EINVAL Attempted to release an invalid buffer index.
151 #define V4L2_GFX_IOC_REL _IOW ('v', BASE_VIDIOCPRIVATE+2, \
152 struct v4l2_gfx_buf_params)
155 * Ioctl used to get information about the device
157 * @see struct v4l2_gfx_info_params
160 * Returns 0 if successful, or -1 on error, in which case errno indicates
163 #define V4L2_GFX_IOC_INFO _IOWR ('v', BASE_VIDIOCPRIVATE+3, \
164 struct v4l2_gfx_info_params)
167 * Ioctl used to set producer params
169 * @see struct v4l2_gfx_producer_params
172 * Returns 0 if successful, or -1 on error, in which case errno indicates
175 #define V4L2_GFX_IOC_PRODUCER _IOWR ('v', BASE_VIDIOCPRIVATE+4, \
176 struct v4l2_gfx_producer_params)
177 #endif // _OMAP_V4L2_GFX_H_