sys-kernel/linux-headers: move non-upstream VP9 headers to their own file

These controls are not in mainline and we will introduce the actual
upstream controls once they are stabilized. In order to prepare for
this, move the old controls to their own file, which we include from
v4l2-controls.h to make sure client behavior is not disturbed.

Also remove vp9-specific pointer unions and control type enums, which
are not upstream and not used by Chromium.

BUG=b:161415741
TEST=emerge-kukui linux-headers

Change-Id: I9ef370da352e9dc4e5584856665b94f1de0f554c
Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/overlays/chromiumos-overlay/+/2425788
Reviewed-by: Fritz Koenig <frkoenig@chromium.org>
Tested-by: Alexandre Courbot <acourbot@chromium.org>
Commit-Queue: Alexandre Courbot <acourbot@chromium.org>
diff --git a/sys-kernel/linux-headers/files/0004-CHROMIUM-v4l-Add-VP9-low-level-decoder-API-controls.patch b/sys-kernel/linux-headers/files/0004-CHROMIUM-v4l-Add-VP9-low-level-decoder-API-controls.patch
index c804ad1..87dcfc6 100644
--- a/sys-kernel/linux-headers/files/0004-CHROMIUM-v4l-Add-VP9-low-level-decoder-API-controls.patch
+++ b/sys-kernel/linux-headers/files/0004-CHROMIUM-v4l-Add-VP9-low-level-decoder-API-controls.patch
@@ -1,4 +1,4 @@
-From 2ee7da4dbe934f60eccf880e5b59ac9c82a23b1c Mon Sep 17 00:00:00 2001
+From 0036cca83011affbe91ec5434ced5041be3e5d4a Mon Sep 17 00:00:00 2001
 From: Pawel Osciak <posciak@chromium.org>
 Date: Mon, 11 Jul 2016 18:25:17 +0900
 Subject: [PATCH] CHROMIUM: v4l: Add VP9 low-level decoder API controls.
@@ -8,30 +8,38 @@
 [fbuergisser@chromium.org: original patch modified as h264 headers were moved
  to other header files which cause a failure when applying the original patch.
  Keeping part of the original patch for context.]
----
- include/uapi/linux/v4l2-controls.h | 147 +++++++++++++++++++++++++++++
- include/uapi/linux/videodev2.h     |   7 ++
- 2 files changed, 154 insertions(+)
 
-diff --git a/include/uapi/linux/v4l2-controls.h b/include/uapi/linux/v4l2-controls.h
-index a692623e0236..3e7bb32fd3e8 100644
---- a/include/uapi/linux/v4l2-controls.h
-+++ b/include/uapi/linux/v4l2-controls.h
-@@ -589,6 +589,10 @@ enum v4l2_vp8_golden_frame_sel {
- #define V4L2_CID_MPEG_VIDEO_VPX_P_FRAME_QP		(V4L2_CID_MPEG_BASE+510)
- #define V4L2_CID_MPEG_VIDEO_VPX_PROFILE			(V4L2_CID_MPEG_BASE+511)
- 
+[acourbot@chromium.org: moved controls to a "legacy" VP9 files as we
+will merge the upstream ones.]
+---
+ include/uapi/linux/media/vp9-ctrls-legacy.h | 162 ++++++++++++++++++++
+ include/uapi/linux/videodev2.h              |   2 +
+ 2 files changed, 164 insertions(+)
+ create mode 100644 include/uapi/linux/media/vp9-ctrls-legacy.h
+
+diff --git a/include/uapi/linux/media/vp9-ctrls-legacy.h b/include/uapi/linux/media/vp9-ctrls-legacy.h
+new file mode 100644
+index 0000000..411fca7
+--- /dev/null
++++ b/include/uapi/linux/media/vp9-ctrls-legacy.h
+@@ -0,0 +1,162 @@
++/* SPDX-License-Identifier: GPL-2.0 */
++/*
++ * These are the VP9 state controls for use with stateless VP9
++ * codec drivers.
++ *
++ * These headers are legacy VP9 headers and specific to Chromium only.
++ * Chromium needs to support pre v4.19 headers but will be removed in the
++ * future when Chromium will support only v4.19 and onward.
++ */
++
++#ifndef __LINUX_MEDIA_VP9_CTRLS_LEGACY_H_
++#define __LINUX_MEDIA_VP9_CTRLS_LEGACY_H_
++
 +#define V4L2_CID_MPEG_VIDEO_VP9_FRAME_HDR		(V4L2_CID_MPEG_BASE+591)
 +#define V4L2_CID_MPEG_VIDEO_VP9_DECODE_PARAM		(V4L2_CID_MPEG_BASE+592)
 +#define V4L2_CID_MPEG_VIDEO_VP9_ENTROPY			(V4L2_CID_MPEG_BASE+593)
 +
- /*  MPEG-class control IDs specific to the CX2341x driver as defined by V4L2 */
- #define V4L2_CID_MPEG_CX2341X_BASE 				(V4L2_CTRL_CLASS_MPEG | 0x1000)
- #define V4L2_CID_MPEG_CX2341X_VIDEO_SPATIAL_FILTER_MODE 	(V4L2_CID_MPEG_CX2341X_BASE+0)
-@@ -970,6 +974,149 @@ enum v4l2_deemphasis {
- #define V4L2_CID_RF_TUNER_PLL_LOCK			(V4L2_CID_RF_TUNER_CLASS_BASE + 91)
- 
- 
 +#define V4L2_VP9_SGMNT_PARAM_FLAG_ENABLED		0x01
 +#define V4L2_VP9_SGMNT_PARAM_FLAG_UPDATE_MAP		0x02
 +#define V4L2_VP9_SGMNT_PARAM_FLAG_TEMPORAL_UPDATE	0x04
@@ -175,14 +183,22 @@
 +	struct v4l2_vp9_entropy_ctx current_entropy_ctx;
 +};
 +
- /*  Detection-class control IDs defined by V4L2 */
- #define V4L2_CID_DETECT_CLASS_BASE		(V4L2_CTRL_CLASS_DETECT | 0x900)
- #define V4L2_CID_DETECT_CLASS			(V4L2_CTRL_CLASS_DETECT | 1)
++
++#endif /* __LINUX_MEDIA_VP9_CTRLS_LEGACY_H_ */
+\ No newline at end of file
 diff --git a/include/uapi/linux/videodev2.h b/include/uapi/linux/videodev2.h
-index 41e080891916..17332b06ef77 100644
+index 41e0808..2d8f794 100644
 --- a/include/uapi/linux/videodev2.h
 +++ b/include/uapi/linux/videodev2.h
-@@ -639,6 +639,7 @@ struct v4l2_pix_format {
+@@ -67,6 +67,7 @@
+ #include <linux/v4l2-controls.h>
+ #include <linux/media/h264-ctrls-legacy.h>
+ #include <linux/media/vp8-ctrls-legacy.h>
++#include <linux/media/vp9-ctrls-legacy.h>
+ 
+ /*
+  * Common stuff for both V4L1 and V4L2
+@@ -639,6 +640,7 @@ struct v4l2_pix_format {
  #define V4L2_PIX_FMT_VP8      v4l2_fourcc('V', 'P', '8', '0') /* VP8 */
  #define V4L2_PIX_FMT_VP8_FRAME v4l2_fourcc('V', 'P', '8', 'F') /* VP8 parsed frames */
  #define V4L2_PIX_FMT_VP9      v4l2_fourcc('V', 'P', '9', '0') /* VP9 */
@@ -190,26 +206,6 @@
  
  /*  Vendor-specific formats   */
  #define V4L2_PIX_FMT_CPIA1    v4l2_fourcc('C', 'P', 'I', 'A') /* cpia1 YUV */
-@@ -1576,6 +1577,9 @@ struct v4l2_ext_control {
- 		__u8 __user *p_u8;
- 		__u16 __user *p_u16;
- 		__u32 __user *p_u32;
-+		struct v4l2_ctrl_vp9_frame_hdr __user *p_vp9_frame_hdr;
-+		struct v4l2_ctrl_vp9_decode_param __user *p_vp9_decode_param;
-+		struct v4l2_ctrl_vp9_entropy __user *p_vp9_entropy;
- 		void __user *ptr;
- 	};
- } __attribute__ ((packed));
-@@ -1620,6 +1624,9 @@ enum v4l2_ctrl_type {
- 	V4L2_CTRL_TYPE_U8	     = 0x0100,
- 	V4L2_CTRL_TYPE_U16	     = 0x0101,
- 	V4L2_CTRL_TYPE_U32	     = 0x0102,
-+	V4L2_CTRL_TYPE_VP9_FRAME_HDR    = 0x109,
-+	V4L2_CTRL_TYPE_VP9_DECODE_PARAM = 0x110,
-+	V4L2_CTRL_TYPE_VP9_ENTROPY      = 0x111,
- 
- 	V4L2_CTRL_TYPE_PRIVATE	     = 0xffff,
- };
 -- 
-2.22.0.709.g102302147b-goog
+2.26.2
 
diff --git a/sys-kernel/linux-headers/linux-headers-4.14-r27.ebuild b/sys-kernel/linux-headers/linux-headers-4.14-r28.ebuild
similarity index 100%
rename from sys-kernel/linux-headers/linux-headers-4.14-r27.ebuild
rename to sys-kernel/linux-headers/linux-headers-4.14-r28.ebuild