aboutsummaryrefslogtreecommitdiffstats
path: root/include/uapi/linux/dvb
diff options
context:
space:
mode:
authorSatendra Singh Thakur <satendra.t@samsung.com>2017-12-18 22:35:53 -0500
committerMauro Carvalho Chehab <mchehab@s-opensource.com>2017-12-28 10:59:02 -0500
commit57868acc369ab73ec8f6b43a0c6749077376b189 (patch)
treecf25db8fec2cd28e22317434608db69a1e6886a1 /include/uapi/linux/dvb
parent9eb124fe796cbadd454c8f946d7051f4c3f4a251 (diff)
media: videobuf2: Add new uAPI for DVB streaming I/O
Adds a new uAPI for DVB to use streaming I/O which is implemented based on videobuf2, using those new ioctls: - DMX_REQBUFS: Request kernel to allocate buffers which count and size are dedicated by user. - DMX_QUERYBUF: Get the buffer information like a memory offset which will mmap() and be shared with user-space. - DMX_EXPBUF: Just for testing whether buffer-exporting success or not. - DMX_QBUF: Pass the buffer to kernel-space. - DMX_DQBUF: Get back the buffer which may contain TS data. Originally developed by: Junghak Sung <jh1009.sung@samsung.com>, as seen at: https://patchwork.linuxtv.org/patch/31613/ https://patchwork.kernel.org/patch/7334301/ The original patch was written before merging VB2-core functionalities upstream. When such series was added, several adjustments were made, fixing some issues with V4L2, causing the original patch to be non-trivially rebased. After rebased, a few bugs in the patch were fixed. The patch was also enhanced it and polling functionality got added. The main changes over the original patch are: dvb_vb2_fill_buffer(): - Set the size of the outgoing buffer after while loop using vb2_set_plane_payload; - Added NULL check for source buffer as per normal convention of demux driver, this is called twice, first time with valid buffer second time with NULL pointer, if its not handled, it will result in crash - Restricted spinlock for only list_* operations dvb_vb2_init(): - Restricted q->io_modes to only VB2_MMAP as its the only supported mode dvb_vb2_release(): - Replaced the && in if condiion with &, because otherwise it was always getting satisfied. dvb_vb2_stream_off(): - Added list_del code for enqueud buffers upon stream off dvb_vb2_poll(): - Added this new function in order to support polling dvb_demux_poll() and dvb_dvr_poll() - dvb_vb2_poll() is now called from these functions - Ported this patch and latest videobuf2 to lower kernel versions and tested auto scan. Co-developed-by: Junghak Sung <jh1009.sung@samsung.com> [mchehab@s-opensource.com: checkpatch fixes] Signed-off-by: Junghak Sung <jh1009.sung@samsung.com> Signed-off-by: Geunyoung Kim <nenggun.kim@samsung.com> Acked-by: Seung-Woo Kim <sw0312.kim@samsung.com> Acked-by: Inki Dae <inki.dae@samsung.com> Signed-off-by: Satendra Singh Thakur <satendra.t@samsung.com> Signed-off-by: Mauro Carvalho Chehab <mchehab@s-opensource.com>
Diffstat (limited to 'include/uapi/linux/dvb')
-rw-r--r--include/uapi/linux/dvb/dmx.h66
1 files changed, 65 insertions, 1 deletions
diff --git a/include/uapi/linux/dvb/dmx.h b/include/uapi/linux/dvb/dmx.h
index c10f1324b4ca..e212aa18ad78 100644
--- a/include/uapi/linux/dvb/dmx.h
+++ b/include/uapi/linux/dvb/dmx.h
@@ -211,6 +211,64 @@ struct dmx_stc {
211 __u64 stc; 211 __u64 stc;
212}; 212};
213 213
214/**
215 * struct dmx_buffer - dmx buffer info
216 *
217 * @index: id number of the buffer
218 * @bytesused: number of bytes occupied by data in the buffer (payload);
219 * @offset: for buffers with memory == DMX_MEMORY_MMAP;
220 * offset from the start of the device memory for this plane,
221 * (or a "cookie" that should be passed to mmap() as offset)
222 * @length: size in bytes of the buffer
223 *
224 * Contains data exchanged by application and driver using one of the streaming
225 * I/O methods.
226 */
227struct dmx_buffer {
228 __u32 index;
229 __u32 bytesused;
230 __u32 offset;
231 __u32 length;
232 __u32 reserved[4];
233};
234
235/**
236 * struct dmx_requestbuffers - request dmx buffer information
237 *
238 * @count: number of requested buffers,
239 * @size: size in bytes of the requested buffer
240 *
241 * Contains data used for requesting a dmx buffer.
242 * All reserved fields must be set to zero.
243 */
244struct dmx_requestbuffers {
245 __u32 count;
246 __u32 size;
247 __u32 reserved[2];
248};
249
250/**
251 * struct dmx_exportbuffer - export of dmx buffer as DMABUF file descriptor
252 *
253 * @index: id number of the buffer
254 * @flags: flags for newly created file, currently only O_CLOEXEC is
255 * supported, refer to manual of open syscall for more details
256 * @fd: file descriptor associated with DMABUF (set by driver)
257 *
258 * Contains data used for exporting a dmx buffer as DMABUF file descriptor.
259 * The buffer is identified by a 'cookie' returned by DMX_QUERYBUF
260 * (identical to the cookie used to mmap() the buffer to userspace). All
261 * reserved fields must be set to zero. The field reserved0 is expected to
262 * become a structure 'type' allowing an alternative layout of the structure
263 * content. Therefore this field should not be used for any other extensions.
264 */
265struct dmx_exportbuffer {
266 __u32 index;
267 __u32 flags;
268 __s32 fd;
269 __u32 reserved[5];
270};
271
214#define DMX_START _IO('o', 41) 272#define DMX_START _IO('o', 41)
215#define DMX_STOP _IO('o', 42) 273#define DMX_STOP _IO('o', 42)
216#define DMX_SET_FILTER _IOW('o', 43, struct dmx_sct_filter_params) 274#define DMX_SET_FILTER _IOW('o', 43, struct dmx_sct_filter_params)
@@ -231,4 +289,10 @@ typedef struct dmx_filter dmx_filter_t;
231 289
232#endif 290#endif
233 291
234#endif /* _UAPI_DVBDMX_H_ */ 292#define DMX_REQBUFS _IOWR('o', 60, struct dmx_requestbuffers)
293#define DMX_QUERYBUF _IOWR('o', 61, struct dmx_buffer)
294#define DMX_EXPBUF _IOWR('o', 62, struct dmx_exportbuffer)
295#define DMX_QBUF _IOWR('o', 63, struct dmx_buffer)
296#define DMX_DQBUF _IOWR('o', 64, struct dmx_buffer)
297
298#endif /* _DVBDMX_H_ */