diff options
author | Guennadi Liakhovetski <g.liakhovetski@gmx.de> | 2018-08-03 07:37:08 -0400 |
---|---|---|
committer | Mauro Carvalho Chehab <mchehab+samsung@kernel.org> | 2018-09-11 08:48:01 -0400 |
commit | 6ea0d588d35b55e6df8e9ac12b95c34a669c39d4 (patch) | |
tree | 1ece7661fc0bb3a688e1269fc69f42860775d7f2 | |
parent | 3a03284dd4e7a9923acda7d73ec418378d3af6cc (diff) |
media: uvcvideo: Add a D4M camera description
D4M is a mobile model from the D4XX family of Intel RealSense cameras.
This patch adds a descriptor for it, which enables reading per-frame
metadata from it.
Signed-off-by: Guennadi Liakhovetski <guennadi.liakhovetski@intel.com>
[laurent.pinchart@ideasonboard.com Small clarifications to the documentation]
Signed-off-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com>
Signed-off-by: Mauro Carvalho Chehab <mchehab+samsung@kernel.org>
-rw-r--r-- | Documentation/media/uapi/v4l/meta-formats.rst | 1 | ||||
-rw-r--r-- | Documentation/media/uapi/v4l/pixfmt-meta-d4xx.rst | 210 | ||||
-rw-r--r-- | drivers/media/usb/uvc/uvc_driver.c | 11 | ||||
-rw-r--r-- | include/uapi/linux/videodev2.h | 1 |
4 files changed, 223 insertions, 0 deletions
diff --git a/Documentation/media/uapi/v4l/meta-formats.rst b/Documentation/media/uapi/v4l/meta-formats.rst index 0c4e1ecf5879..cf971d5ad9ea 100644 --- a/Documentation/media/uapi/v4l/meta-formats.rst +++ b/Documentation/media/uapi/v4l/meta-formats.rst | |||
@@ -12,6 +12,7 @@ These formats are used for the :ref:`metadata` interface only. | |||
12 | .. toctree:: | 12 | .. toctree:: |
13 | :maxdepth: 1 | 13 | :maxdepth: 1 |
14 | 14 | ||
15 | pixfmt-meta-d4xx | ||
15 | pixfmt-meta-uvc | 16 | pixfmt-meta-uvc |
16 | pixfmt-meta-vsp1-hgo | 17 | pixfmt-meta-vsp1-hgo |
17 | pixfmt-meta-vsp1-hgt | 18 | pixfmt-meta-vsp1-hgt |
diff --git a/Documentation/media/uapi/v4l/pixfmt-meta-d4xx.rst b/Documentation/media/uapi/v4l/pixfmt-meta-d4xx.rst new file mode 100644 index 000000000000..63bf1a2c9116 --- /dev/null +++ b/Documentation/media/uapi/v4l/pixfmt-meta-d4xx.rst | |||
@@ -0,0 +1,210 @@ | |||
1 | .. -*- coding: utf-8; mode: rst -*- | ||
2 | |||
3 | .. _v4l2-meta-fmt-d4xx: | ||
4 | |||
5 | ******************************* | ||
6 | V4L2_META_FMT_D4XX ('D4XX') | ||
7 | ******************************* | ||
8 | |||
9 | Intel D4xx UVC Cameras Metadata | ||
10 | |||
11 | |||
12 | Description | ||
13 | =========== | ||
14 | |||
15 | Intel D4xx (D435 and other) cameras include per-frame metadata in their UVC | ||
16 | payload headers, following the Microsoft(R) UVC extension proposal [1_]. That | ||
17 | means, that the private D4XX metadata, following the standard UVC header, is | ||
18 | organised in blocks. D4XX cameras implement several standard block types, | ||
19 | proposed by Microsoft, and several proprietary ones. Supported standard metadata | ||
20 | types are MetadataId_CaptureStats (ID 3), MetadataId_CameraExtrinsics (ID 4), | ||
21 | and MetadataId_CameraIntrinsics (ID 5). For their description see [1_]. This | ||
22 | document describes proprietary metadata types, used by D4xx cameras. | ||
23 | |||
24 | V4L2_META_FMT_D4XX buffers follow the metadata buffer layout of | ||
25 | V4L2_META_FMT_UVC with the only difference, that it also includes proprietary | ||
26 | payload header data. D4xx cameras use bulk transfers and only send one payload | ||
27 | per frame, therefore their headers cannot be larger than 255 bytes. | ||
28 | |||
29 | Below are proprietary Microsoft style metadata types, used by D4xx cameras, | ||
30 | where all fields are in little endian order: | ||
31 | |||
32 | .. flat-table:: D4xx metadata | ||
33 | :widths: 1 4 | ||
34 | :header-rows: 1 | ||
35 | :stub-columns: 0 | ||
36 | |||
37 | * - Field | ||
38 | - Description | ||
39 | * - :cspan:`1` *Depth Control* | ||
40 | * - __u32 ID | ||
41 | - 0x80000000 | ||
42 | * - __u32 Size | ||
43 | - Size in bytes (currently 56) | ||
44 | * - __u32 Version | ||
45 | - Version of this structure. The documentation herein corresponds to | ||
46 | version xxx. The version number will be incremented when new fields are | ||
47 | added. | ||
48 | * - __u32 Flags | ||
49 | - A bitmask of flags: see [2_] below | ||
50 | * - __u32 Gain | ||
51 | - Gain value in internal units, same as the V4L2_CID_GAIN control, used to | ||
52 | capture the frame | ||
53 | * - __u32 Exposure | ||
54 | - Exposure time (in microseconds) used to capture the frame | ||
55 | * - __u32 Laser power | ||
56 | - Power of the laser LED 0-360, used for depth measurement | ||
57 | * - __u32 AE mode | ||
58 | - 0: manual; 1: automatic exposure | ||
59 | * - __u32 Exposure priority | ||
60 | - Exposure priority value: 0 - constant frame rate | ||
61 | * - __u32 AE ROI left | ||
62 | - Left border of the AE Region of Interest (all ROI values are in pixels | ||
63 | and lie between 0 and maximum width or height respectively) | ||
64 | * - __u32 AE ROI right | ||
65 | - Right border of the AE Region of Interest | ||
66 | * - __u32 AE ROI top | ||
67 | - Top border of the AE Region of Interest | ||
68 | * - __u32 AE ROI bottom | ||
69 | - Bottom border of the AE Region of Interest | ||
70 | * - __u32 Preset | ||
71 | - Preset selector value, default: 0, unless changed by the user | ||
72 | * - __u32 Laser mode | ||
73 | - 0: off, 1: on | ||
74 | * - :cspan:`1` *Capture Timing* | ||
75 | * - __u32 ID | ||
76 | - 0x80000001 | ||
77 | * - __u32 Size | ||
78 | - Size in bytes (currently 40) | ||
79 | * - __u32 Version | ||
80 | - Version of this structure. The documentation herein corresponds to | ||
81 | version xxx. The version number will be incremented when new fields are | ||
82 | added. | ||
83 | * - __u32 Flags | ||
84 | - A bitmask of flags: see [3_] below | ||
85 | * - __u32 Frame counter | ||
86 | - Monotonically increasing counter | ||
87 | * - __u32 Optical time | ||
88 | - Time in microseconds from the beginning of a frame till its middle | ||
89 | * - __u32 Readout time | ||
90 | - Time, used to read out a frame in microseconds | ||
91 | * - __u32 Exposure time | ||
92 | - Frame exposure time in microseconds | ||
93 | * - __u32 Frame interval | ||
94 | - In microseconds = 1000000 / framerate | ||
95 | * - __u32 Pipe latency | ||
96 | - Time in microseconds from start of frame to data in USB buffer | ||
97 | * - :cspan:`1` *Configuration* | ||
98 | * - __u32 ID | ||
99 | - 0x80000002 | ||
100 | * - __u32 Size | ||
101 | - Size in bytes (currently 40) | ||
102 | * - __u32 Version | ||
103 | - Version of this structure. The documentation herein corresponds to | ||
104 | version xxx. The version number will be incremented when new fields are | ||
105 | added. | ||
106 | * - __u32 Flags | ||
107 | - A bitmask of flags: see [4_] below | ||
108 | * - __u8 Hardware type | ||
109 | - Camera hardware version [5_] | ||
110 | * - __u8 SKU ID | ||
111 | - Camera hardware configuration [6_] | ||
112 | * - __u32 Cookie | ||
113 | - Internal synchronisation | ||
114 | * - __u16 Format | ||
115 | - Image format code [7_] | ||
116 | * - __u16 Width | ||
117 | - Width in pixels | ||
118 | * - __u16 Height | ||
119 | - Height in pixels | ||
120 | * - __u16 Framerate | ||
121 | - Requested frame rate per second | ||
122 | * - __u16 Trigger | ||
123 | - Byte 0: bit 0: depth and RGB are synchronised, bit 1: external trigger | ||
124 | |||
125 | .. _1: | ||
126 | |||
127 | [1] https://docs.microsoft.com/en-us/windows-hardware/drivers/stream/uvc-extensions-1-5 | ||
128 | |||
129 | .. _2: | ||
130 | |||
131 | [2] Depth Control flags specify which fields are valid: :: | ||
132 | |||
133 | 0x00000001 Gain | ||
134 | 0x00000002 Exposure | ||
135 | 0x00000004 Laser power | ||
136 | 0x00000008 AE mode | ||
137 | 0x00000010 Exposure priority | ||
138 | 0x00000020 AE ROI | ||
139 | 0x00000040 Preset | ||
140 | |||
141 | .. _3: | ||
142 | |||
143 | [3] Capture Timing flags specify which fields are valid: :: | ||
144 | |||
145 | 0x00000001 Frame counter | ||
146 | 0x00000002 Optical time | ||
147 | 0x00000004 Readout time | ||
148 | 0x00000008 Exposure time | ||
149 | 0x00000010 Frame interval | ||
150 | 0x00000020 Pipe latency | ||
151 | |||
152 | .. _4: | ||
153 | |||
154 | [4] Configuration flags specify which fields are valid: :: | ||
155 | |||
156 | 0x00000001 Hardware type | ||
157 | 0x00000002 SKU ID | ||
158 | 0x00000004 Cookie | ||
159 | 0x00000008 Format | ||
160 | 0x00000010 Width | ||
161 | 0x00000020 Height | ||
162 | 0x00000040 Framerate | ||
163 | 0x00000080 Trigger | ||
164 | 0x00000100 Cal count | ||
165 | |||
166 | .. _5: | ||
167 | |||
168 | [5] Camera model: :: | ||
169 | |||
170 | 0 DS5 | ||
171 | 1 IVCAM2 | ||
172 | |||
173 | .. _6: | ||
174 | |||
175 | [6] 8-bit camera hardware configuration bitfield: :: | ||
176 | |||
177 | [1:0] depthCamera | ||
178 | 00: no depth | ||
179 | 01: standard depth | ||
180 | 10: wide depth | ||
181 | 11: reserved | ||
182 | [2] depthIsActive - has a laser projector | ||
183 | [3] RGB presence | ||
184 | [4] Inertial Measurement Unit (IMU) presence | ||
185 | [5] projectorType | ||
186 | 0: HPTG | ||
187 | 1: Princeton | ||
188 | [6] 0: a projector, 1: an LED | ||
189 | [7] reserved | ||
190 | |||
191 | .. _7: | ||
192 | |||
193 | [7] Image format codes per video streaming interface: | ||
194 | |||
195 | Depth: :: | ||
196 | |||
197 | 1 Z16 | ||
198 | 2 Z | ||
199 | |||
200 | Left sensor: :: | ||
201 | |||
202 | 1 Y8 | ||
203 | 2 UYVY | ||
204 | 3 R8L8 | ||
205 | 4 Calibration | ||
206 | 5 W10 | ||
207 | |||
208 | Fish Eye sensor: :: | ||
209 | |||
210 | 1 RAW8 | ||
diff --git a/drivers/media/usb/uvc/uvc_driver.c b/drivers/media/usb/uvc/uvc_driver.c index 9bc6027d04d0..b1114ec37a55 100644 --- a/drivers/media/usb/uvc/uvc_driver.c +++ b/drivers/media/usb/uvc/uvc_driver.c | |||
@@ -2339,6 +2339,8 @@ static const struct uvc_device_info uvc_quirk_force_y8 = { | |||
2339 | }; | 2339 | }; |
2340 | 2340 | ||
2341 | #define UVC_INFO_QUIRK(q) (kernel_ulong_t)&(struct uvc_device_info){.quirks = q} | 2341 | #define UVC_INFO_QUIRK(q) (kernel_ulong_t)&(struct uvc_device_info){.quirks = q} |
2342 | #define UVC_INFO_META(m) (kernel_ulong_t)&(struct uvc_device_info) \ | ||
2343 | {.meta_format = m} | ||
2342 | 2344 | ||
2343 | /* | 2345 | /* |
2344 | * The Logitech cameras listed below have their interface class set to | 2346 | * The Logitech cameras listed below have their interface class set to |
@@ -2812,6 +2814,15 @@ static const struct usb_device_id uvc_ids[] = { | |||
2812 | .bInterfaceSubClass = 1, | 2814 | .bInterfaceSubClass = 1, |
2813 | .bInterfaceProtocol = 0, | 2815 | .bInterfaceProtocol = 0, |
2814 | .driver_info = (kernel_ulong_t)&uvc_quirk_force_y8 }, | 2816 | .driver_info = (kernel_ulong_t)&uvc_quirk_force_y8 }, |
2817 | /* Intel RealSense D4M */ | ||
2818 | { .match_flags = USB_DEVICE_ID_MATCH_DEVICE | ||
2819 | | USB_DEVICE_ID_MATCH_INT_INFO, | ||
2820 | .idVendor = 0x8086, | ||
2821 | .idProduct = 0x0b03, | ||
2822 | .bInterfaceClass = USB_CLASS_VIDEO, | ||
2823 | .bInterfaceSubClass = 1, | ||
2824 | .bInterfaceProtocol = 0, | ||
2825 | .driver_info = UVC_INFO_META(V4L2_META_FMT_D4XX) }, | ||
2815 | /* Generic USB Video Class */ | 2826 | /* Generic USB Video Class */ |
2816 | { USB_INTERFACE_INFO(USB_CLASS_VIDEO, 1, UVC_PC_PROTOCOL_UNDEFINED) }, | 2827 | { USB_INTERFACE_INFO(USB_CLASS_VIDEO, 1, UVC_PC_PROTOCOL_UNDEFINED) }, |
2817 | { USB_INTERFACE_INFO(USB_CLASS_VIDEO, 1, UVC_PC_PROTOCOL_15) }, | 2828 | { USB_INTERFACE_INFO(USB_CLASS_VIDEO, 1, UVC_PC_PROTOCOL_15) }, |
diff --git a/include/uapi/linux/videodev2.h b/include/uapi/linux/videodev2.h index 622f0479d668..184e4dbe8f9c 100644 --- a/include/uapi/linux/videodev2.h +++ b/include/uapi/linux/videodev2.h | |||
@@ -703,6 +703,7 @@ struct v4l2_pix_format { | |||
703 | #define V4L2_META_FMT_VSP1_HGO v4l2_fourcc('V', 'S', 'P', 'H') /* R-Car VSP1 1-D Histogram */ | 703 | #define V4L2_META_FMT_VSP1_HGO v4l2_fourcc('V', 'S', 'P', 'H') /* R-Car VSP1 1-D Histogram */ |
704 | #define V4L2_META_FMT_VSP1_HGT v4l2_fourcc('V', 'S', 'P', 'T') /* R-Car VSP1 2-D Histogram */ | 704 | #define V4L2_META_FMT_VSP1_HGT v4l2_fourcc('V', 'S', 'P', 'T') /* R-Car VSP1 2-D Histogram */ |
705 | #define V4L2_META_FMT_UVC v4l2_fourcc('U', 'V', 'C', 'H') /* UVC Payload Header metadata */ | 705 | #define V4L2_META_FMT_UVC v4l2_fourcc('U', 'V', 'C', 'H') /* UVC Payload Header metadata */ |
706 | #define V4L2_META_FMT_D4XX v4l2_fourcc('D', '4', 'X', 'X') /* D4XX Payload Header metadata */ | ||
706 | 707 | ||
707 | /* priv field value to indicates that subsequent fields are valid. */ | 708 | /* priv field value to indicates that subsequent fields are valid. */ |
708 | #define V4L2_PIX_FMT_PRIV_MAGIC 0xfeedcafe | 709 | #define V4L2_PIX_FMT_PRIV_MAGIC 0xfeedcafe |