1 /* SPDX-License-Identifier: GPL-2.0 */
2 /*
3  * Broadcom BCM2835 V4L2 driver
4  *
5  * Copyright © 2013 Raspberry Pi (Trading) Ltd.
6  *
7  * Authors: Vincent Sanders @ Collabora
8  *          Dave Stevenson @ Broadcom
9  *		(now dave.stevenson@raspberrypi.org)
10  *          Simon Mellor @ Broadcom
11  *          Luke Diamand @ Broadcom
12  *
13  * MMAL structures
14  *
15  */
16 #ifndef MMAL_COMMON_H
17 #define MMAL_COMMON_H
18 
19 #define MMAL_FOURCC(a, b, c, d) ((a) | (b << 8) | (c << 16) | (d << 24))
20 #define MMAL_MAGIC MMAL_FOURCC('m', 'm', 'a', 'l')
21 
22 /** Special value signalling that time is not known */
23 #define MMAL_TIME_UNKNOWN BIT_ULL(63)
24 
25 struct mmal_msg_context;
26 
27 /* mapping between v4l and mmal video modes */
28 struct mmal_fmt {
29 	u32 fourcc;          /* v4l2 format id */
30 	int flags;           /* v4l2 flags field */
31 	u32 mmal;
32 	int depth;
33 	u32 mmal_component;  /* MMAL component index to be used to encode */
34 	u32 ybbp;            /* depth of first Y plane for planar formats */
35 	bool remove_padding;   /* Does the GPU have to remove padding,
36 				* or can we do hide padding via bytesperline.
37 				*/
38 };
39 
40 /* buffer for one video frame */
41 struct mmal_buffer {
42 	/* v4l buffer data -- must be first */
43 	struct vb2_v4l2_buffer vb;
44 
45 	/* list of buffers available */
46 	struct list_head list;
47 
48 	void *buffer; /* buffer pointer */
49 	unsigned long buffer_size; /* size of allocated buffer */
50 
51 	struct mmal_msg_context *msg_context;
52 
53 	unsigned long length;
54 	u32 mmal_flags;
55 	s64 dts;
56 	s64 pts;
57 };
58 
59 /* */
60 struct mmal_colourfx {
61 	s32 enable;
62 	u32 u;
63 	u32 v;
64 };
65 #endif
66