Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Enable patches for kernel 5.11. #9727

Merged
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
5 changes: 4 additions & 1 deletion scripts/patch-utils.sh
Original file line number Diff line number Diff line change
Expand Up @@ -109,9 +109,12 @@ function choose_kernel_branch {
"5.8") # kernel 5.8
echo hwe-5.8
;;
"5.11") # kernel 5.11
echo hwe-5.11
;;
*)
#error message shall be redirected to stderr to be printed properly
echo -e "\e[31mUnsupported kernel version $1 . The Focal patches are maintained for Ubuntu LTS with kernel 5.4 only\e[0m" >&2
echo -e "\e[31mUnsupported kernel version $1 . The Focal patches are maintained for Ubuntu LTS with kernel 5.4, 5.8, 5.11 only\e[0m" >&2
exit 1
;;
esac
Expand Down
154 changes: 154 additions & 0 deletions scripts/realsense-camera-formats-focal-hwe-5.11.patch
Original file line number Diff line number Diff line change
@@ -0,0 +1,154 @@
From f8b9d58e03e42f45e4b5d85c18e70bfa6b08ec94 Mon Sep 17 00:00:00 2001
From: Kevin <kevindehecker@hotmail.com>
Date: Sat, 4 Sep 2021 00:41:14 +0200
Subject: [PATCH] Streaming formats for Ubuntu 20.04. Kernel 5.11


diff --git a/drivers/media/usb/uvc/uvc_driver.c b/drivers/media/usb/uvc/uvc_driver.c
index 282f3d2388cc..85765f82b430 100644
--- a/drivers/media/usb/uvc/uvc_driver.c
+++ b/drivers/media/usb/uvc/uvc_driver.c
@@ -219,6 +219,58 @@ static struct uvc_format_desc uvc_fmts[] = {
.guid = UVC_GUID_FORMAT_HEVC,
.fcc = V4L2_PIX_FMT_HEVC,
},
+ {
+ .name = "Depth data 16-bit (D16)",
+ .guid = UVC_GUID_FORMAT_D16,
+ .fcc = V4L2_PIX_FMT_Z16,
+ },
+ {
+ .name = "Packed raw data 10-bit",
+ .guid = UVC_GUID_FORMAT_W10,
+ .fcc = V4L2_PIX_FMT_W10,
+ },
+ {
+ .name = "Confidence data (C )",
+ .guid = UVC_GUID_FORMAT_CONFIDENCE_MAP,
+ .fcc = V4L2_PIX_FMT_CONFIDENCE_MAP,
+ },
+ /* FishEye 8-bit monochrome */
+ {
+ .name = "Raw data 8-bit (RAW8)",
+ .guid = UVC_GUID_FORMAT_RAW8,
+ .fcc = V4L2_PIX_FMT_GREY,
+ },
+ /* Legacy formats for backward-compatibility*/
+ {
+ .name = "Raw data 16-bit (RW16)",
+ .guid = UVC_GUID_FORMAT_RW16,
+ .fcc = V4L2_PIX_FMT_RW16,
+ },
+ {
+ .name = "16-bit Bayer BGBG/GRGR",
+ .guid = UVC_GUID_FORMAT_BAYER16,
+ .fcc = V4L2_PIX_FMT_SBGGR16,
+ },
+ {
+ .name = "Z16 Huffman Compression",
+ .guid = UVC_GUID_FORMAT_Z16H,
+ .fcc = V4L2_PIX_FMT_Z16H,
+ },
+ {
+ .name = "Frame Grabber (FG )",
+ .guid = UVC_GUID_FORMAT_FG,
+ .fcc = V4L2_PIX_FMT_FG,
+ },
+ {
+ .name = "SR300 Depth/Confidence (INZC)",
+ .guid = UVC_GUID_FORMAT_INZC,
+ .fcc = V4L2_PIX_FMT_INZC,
+ },
+ {
+ .name = "Relative IR (PAIR)",
+ .guid = UVC_GUID_FORMAT_PAIR,
+ .fcc = V4L2_PIX_FMT_PAIR,
+ },
};

/* ------------------------------------------------------------------------
diff --git a/drivers/media/usb/uvc/uvcvideo.h b/drivers/media/usb/uvc/uvcvideo.h
index a3dfacf069c4..e837e1a6d7d1 100644
--- a/drivers/media/usb/uvc/uvcvideo.h
+++ b/drivers/media/usb/uvc/uvcvideo.h
@@ -164,11 +164,41 @@
#define UVC_GUID_FORMAT_KSMEDIA_L8_IR \
{0x32, 0x00, 0x00, 0x00, 0x02, 0x00, 0x10, 0x00, \
0x80, 0x00, 0x00, 0xaa, 0x00, 0x38, 0x9b, 0x71}
-
#define UVC_GUID_FORMAT_HEVC \
{ 'H', 'E', 'V', 'C', 0x00, 0x00, 0x10, 0x00, \
0x80, 0x00, 0x00, 0xaa, 0x00, 0x38, 0x9b, 0x71}

+#define UVC_GUID_FORMAT_D16 \
+ { 'P', 0x00, 0x00, 0x00, 0x00, 0x00, 0x10, 0x00, \
+ 0x80, 0x00, 0x00, 0xaa, 0x00, 0x38, 0x9b, 0x71}
+#define UVC_GUID_FORMAT_W10 \
+ { 'W', '1', '0', ' ', 0x00, 0x00, 0x10, 0x00, \
+ 0x80, 0x00, 0x00, 0xaa, 0x00, 0x38, 0x9b, 0x71}
+#define UVC_GUID_FORMAT_RAW8 \
+ { 'R', 'A', 'W', '8', 0x66, 0x1a, 0x42, 0xa2, \
+ 0x90, 0x65, 0xd0, 0x18, 0x14, 0xa8, 0xef, 0x8a}
+#define UVC_GUID_FORMAT_CONFIDENCE_MAP \
+ { 'C', ' ', ' ', ' ', 0x00, 0x00, 0x10, 0x00, \
+ 0x80, 0x00, 0x00, 0xaa, 0x00, 0x38, 0x9b, 0x71}
+ /* Legacy formats */
+#define UVC_GUID_FORMAT_RW16 \
+ { 'R', 'W', '1', '6', 0x00, 0x00, 0x10, 0x00, \
+ 0x80, 0x00, 0x00, 0xaa, 0x00, 0x38, 0x9b, 0x71}
+#define UVC_GUID_FORMAT_BAYER16 \
+ { 'R', 'W', '1', '6', 0x66, 0x1a, 0x42, 0xa2, \
+ 0x90, 0x65, 0xd0, 0x18, 0x14, 0xa8, 0xef, 0x8a}
+#define UVC_GUID_FORMAT_Z16H \
+ { 'Z', '1', '6', 'H', 0x00, 0x00, 0x10, 0x00, \
+ 0x80, 0x00, 0x00, 0xaa, 0x00, 0x38, 0x9b, 0x71}
+#define UVC_GUID_FORMAT_FG \
+ { 'F', 'G', ' ', ' ', 0x00, 0x00, 0x10, 0x00, \
+ 0x80, 0x00, 0x00, 0xaa, 0x00, 0x38, 0x9b, 0x71}
+#define UVC_GUID_FORMAT_INZC \
+ { 'I', 'N', 'Z', 'C', 0x02, 0xb6, 0x0f, 0x48, \
+ 0x97, 0x8c, 0xe4, 0xe8, 0x8a, 0xe8, 0x9b, 0x89}
+#define UVC_GUID_FORMAT_PAIR \
+ { 'P', 'A', 'I', 'R', 0x36, 0x85, 0x41, 0x48, \
+ 0xb6, 0xbf, 0x8f, 0xc6, 0xff, 0xb0, 0x83, 0xa8}

/* ------------------------------------------------------------------------
* Driver specific constants.
diff --git a/drivers/media/v4l2-core/v4l2-ioctl.c b/drivers/media/v4l2-core/v4l2-ioctl.c
index 9906b41004e9..4fd8957556b1 100644
--- a/drivers/media/v4l2-core/v4l2-ioctl.c
+++ b/drivers/media/v4l2-core/v4l2-ioctl.c
@@ -1405,6 +1405,14 @@ static void v4l_fill_fmtdesc(struct v4l2_fmtdesc *fmt)
case V4L2_META_FMT_VIVID: descr = "Vivid Metadata"; break;
case V4L2_META_FMT_RK_ISP1_PARAMS: descr = "Rockchip ISP1 3A Parameters"; break;
case V4L2_META_FMT_RK_ISP1_STAT_3A: descr = "Rockchip ISP1 3A Statistics"; break;
+ /* Librealsense formats*/
+ case V4L2_PIX_FMT_RW16: descr = "16-bit Raw data"; break;
+ case V4L2_PIX_FMT_W10: descr = "10-bit packed 8888[2222]"; break;
+ case V4L2_PIX_FMT_CONFIDENCE_MAP: descr = "Packed [44] confidence data"; break;
+ case V4L2_PIX_FMT_FG: descr = "Frame Grabber (FG )"; break;
+ case V4L2_PIX_FMT_INZC: descr = "Planar Depth/Confidence (INZC)"; break;
+ case V4L2_PIX_FMT_PAIR: descr = "Relative IR (PAIR)"; break;
+ case V4L2_PIX_FMT_Z16H: descr = "Z16 Huffman Compression"; break;

default:
/* Compressed formats */
diff --git a/include/uapi/linux/videodev2.h b/include/uapi/linux/videodev2.h
index 79dbde3bcf8d..47d8945e5ac2 100644
--- a/include/uapi/linux/videodev2.h
+++ b/include/uapi/linux/videodev2.h
@@ -735,6 +735,14 @@ struct v4l2_pix_format {
#define V4L2_PIX_FMT_SUNXI_TILED_NV12 v4l2_fourcc('S', 'T', '1', '2') /* Sunxi Tiled NV12 Format */
#define V4L2_PIX_FMT_CNF4 v4l2_fourcc('C', 'N', 'F', '4') /* Intel 4-bit packed depth confidence information */
#define V4L2_PIX_FMT_HI240 v4l2_fourcc('H', 'I', '2', '4') /* BTTV 8-bit dithered RGB */
+#define V4L2_PIX_FMT_RW16 v4l2_fourcc('R', 'W', '1', '6') /* Raw data 16-bit */
+#define V4L2_PIX_FMT_W10 v4l2_fourcc('W', '1', '0', ' ') /* Packed raw data 10-bit */
+#define V4L2_PIX_FMT_CONFIDENCE_MAP v4l2_fourcc('C', ' ', ' ', ' ') /* Two pixels in one byte */
+/* Librealsense development*/
+#define V4L2_PIX_FMT_FG v4l2_fourcc('F', 'G', ' ', ' ') /* Frame Grabber */
+#define V4L2_PIX_FMT_INZC v4l2_fourcc('I', 'N', 'Z', 'C') /* Planar Depth/Confidence */
+#define V4L2_PIX_FMT_PAIR v4l2_fourcc('P', 'A', 'I', 'R') /* Relative IR */
+#define V4L2_PIX_FMT_Z16H v4l2_fourcc('Z', '1', '6', 'H') /* Depth Z16 custom Huffman Code compression*/

/* 10bit raw bayer packed, 32 bytes for every 25 pixels, last LSB 6 bits unused */
#define V4L2_PIX_FMT_IPU3_SBGGR10 v4l2_fourcc('i', 'p', '3', 'b') /* IPU3 packed 10-bit BGGR bayer */