{"id":19977,"url":"https://patchwork.libcamera.org/api/1.1/patches/19977/?format=json","web_url":"https://patchwork.libcamera.org/patch/19977/","project":{"id":1,"url":"https://patchwork.libcamera.org/api/1.1/projects/1/?format=json","name":"libcamera","link_name":"libcamera","list_id":"libcamera_core","list_email":"libcamera-devel@lists.libcamera.org","web_url":"","scm_url":"","webscm_url":""},"msgid":"<20240502080925.31730-2-naush@raspberrypi.com>","date":"2024-05-02T08:09:21","name":"[v1,1/5] libcamera: formats: Add RGB48 formats","commit_ref":null,"pull_url":null,"state":"superseded","archived":false,"hash":"75d6c86cb763e1b3ef232b4e83e82df103188c5f","submitter":{"id":34,"url":"https://patchwork.libcamera.org/api/1.1/people/34/?format=json","name":"Naushir Patuck","email":"naush@raspberrypi.com"},"delegate":null,"mbox":"https://patchwork.libcamera.org/patch/19977/mbox/","series":[{"id":4283,"url":"https://patchwork.libcamera.org/api/1.1/series/4283/?format=json","web_url":"https://patchwork.libcamera.org/project/libcamera/list/?series=4283","date":"2024-05-02T08:09:20","name":"Pre Raspberry Pi 5 support changes","version":1,"mbox":"https://patchwork.libcamera.org/series/4283/mbox/"}],"comments":"https://patchwork.libcamera.org/api/patches/19977/comments/","check":"pending","checks":"https://patchwork.libcamera.org/api/patches/19977/checks/","tags":{},"headers":{"Return-Path":"<libcamera-devel-bounces@lists.libcamera.org>","X-Original-To":"parsemail@patchwork.libcamera.org","Delivered-To":"parsemail@patchwork.libcamera.org","Received":["from lancelot.ideasonboard.com (lancelot.ideasonboard.com\n\t[92.243.16.209])\n\tby patchwork.libcamera.org (Postfix) with ESMTPS id 73814C328F\n\tfor <parsemail@patchwork.libcamera.org>;\n\tThu,  2 May 2024 08:09:41 +0000 (UTC)","from lancelot.ideasonboard.com (localhost [IPv6:::1])\n\tby lancelot.ideasonboard.com (Postfix) with ESMTP id 8F18663418;\n\tThu,  2 May 2024 10:09:38 +0200 (CEST)","from mail-lj1-x233.google.com (mail-lj1-x233.google.com\n\t[IPv6:2a00:1450:4864:20::233])\n\tby lancelot.ideasonboard.com (Postfix) with ESMTPS id 10D316340B\n\tfor <libcamera-devel@lists.libcamera.org>;\n\tThu,  2 May 2024 10:09:35 +0200 (CEST)","by mail-lj1-x233.google.com with SMTP id\n\t38308e7fff4ca-2dd7e56009cso98780051fa.3\n\tfor <libcamera-devel@lists.libcamera.org>;\n\tThu, 02 May 2024 01:09:35 -0700 (PDT)","from localhost.localdomain ([188.39.149.98])\n\tby smtp.gmail.com with ESMTPSA id\n\tp12-20020a05600c1d8c00b0041bcb898984sm1049970wms.31.2024.05.02.01.09.33\n\t(version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256);\n\tThu, 02 May 2024 01:09:33 -0700 (PDT)"],"Authentication-Results":"lancelot.ideasonboard.com; dkim=pass (2048-bit key;\n\tunprotected) header.d=raspberrypi.com header.i=@raspberrypi.com\n\theader.b=\"P6lj9Y6k\"; dkim-atps=neutral","DKIM-Signature":"v=1; a=rsa-sha256; c=relaxed/relaxed;\n\td=raspberrypi.com; s=google; t=1714637374; x=1715242174;\n\tdarn=lists.libcamera.org; \n\th=content-transfer-encoding:mime-version:references:in-reply-to\n\t:message-id:date:subject:cc:to:from:from:to:cc:subject:date\n\t:message-id:reply-to;\n\tbh=d4TDHiBB6Rh+xnd2xbxCQ+sH6nTZDPAAOhH8KoklCv8=;\n\tb=P6lj9Y6kXaARvBeQ23B4arz5ePhYhRKE3eZ1uyw4zvukxbf7Qkcf2T+H/ysyHtWp9m\n\tbetPzizut8Q/GhBOWiZXsh368dmRvE/vafn3QstImWiqbfxx24tER+QxDXisNWXhh+LU\n\t/d/I62nTuo2+/0jh6XjJ2jS4cS1dypFjwMiAdedzI6ZIu9YqTfWHQBqLX/ZIXhQNFIKv\n\tIWWQl+OWI+sddeKrUW117aJldSUJetVLFhAzcMPbf9EBuU546njm/rcrhjKMB8w4XpAw\n\tgIa1F52BoocRSrxqmzgWn6WLCrX/rKEKbDLpDI7COjqJ39va7HIxmkLUXAZF9ey8LLr6\n\tmCaQ==","X-Google-DKIM-Signature":"v=1; a=rsa-sha256; c=relaxed/relaxed;\n\td=1e100.net; s=20230601; t=1714637374; x=1715242174;\n\th=content-transfer-encoding:mime-version:references:in-reply-to\n\t:message-id:date:subject:cc:to:from:x-gm-message-state:from:to:cc\n\t:subject:date:message-id:reply-to;\n\tbh=d4TDHiBB6Rh+xnd2xbxCQ+sH6nTZDPAAOhH8KoklCv8=;\n\tb=ld6uptmT+xWmKaXlQZ/65rYnhQ1snPQ4fxBYMXMDQfW2Hq4NqVQfE3k9ftQzV8Nrvw\n\tmM+PNJ5C/lOOSQaXd1n7/XSNxX391iV5BaRz+0ux/zIxAvS2IXN9pLxcPnXRlFs/nl7m\n\taz4pOWO1PQsWQROWqWIzoRpTfQIsaTpm8ujqELNLg/3jPz8VBAqRZdMKQmGuJtmy1LFT\n\tQ4HZ25QNyBGScmMqB7Mzs24HSchgXeyF9deYZDawhf5VrpaqbBTwcghHCF/+F+vN83Ck\n\t6WterTJdUBh0Hgktvk9l9xFrlDbmILy+g78SkTIv6MCgwGAoou1JaCs0d+0wo+QUPxpL\n\tRK0g==","X-Gm-Message-State":"AOJu0Yyqg5paxN7M9FNx7sl9hnyRumX4DD+6DKLp7MmVqNhHx7OV9L6i\n\tre0Ascv70+equ5zedQiQXY0a5qTMCs95ClD8zQf76UzM9vTT+vlp3UcOM/yY187O0sWQv0s01St\n\to","X-Google-Smtp-Source":"AGHT+IHamrPP0OAoxGpGuzQS+yl2c4+zswiBCe9W40MPQRFbC4VPbnWCz3LvK7CT86GYAks7hC8e4A==","X-Received":"by 2002:a2e:80d4:0:b0:2df:e705:7b4 with SMTP id\n\tr20-20020a2e80d4000000b002dfe70507b4mr750538ljg.10.1714637373913; \n\tThu, 02 May 2024 01:09:33 -0700 (PDT)","From":"Naushir Patuck <naush@raspberrypi.com>","To":"libcamera-devel@lists.libcamera.org","Cc":"Naushir Patuck <naush@raspberrypi.com>","Subject":"[PATCH v1 1/5] libcamera: formats: Add RGB48 formats","Date":"Thu,  2 May 2024 09:09:21 +0100","Message-Id":"<20240502080925.31730-2-naush@raspberrypi.com>","X-Mailer":"git-send-email 2.34.1","In-Reply-To":"<20240502080925.31730-1-naush@raspberrypi.com>","References":"<20240502080925.31730-1-naush@raspberrypi.com>","MIME-Version":"1.0","Content-Transfer-Encoding":"8bit","X-BeenThere":"libcamera-devel@lists.libcamera.org","X-Mailman-Version":"2.1.29","Precedence":"list","List-Id":"<libcamera-devel.lists.libcamera.org>","List-Unsubscribe":"<https://lists.libcamera.org/options/libcamera-devel>,\n\t<mailto:libcamera-devel-request@lists.libcamera.org?subject=unsubscribe>","List-Archive":"<https://lists.libcamera.org/pipermail/libcamera-devel/>","List-Post":"<mailto:libcamera-devel@lists.libcamera.org>","List-Help":"<mailto:libcamera-devel-request@lists.libcamera.org?subject=help>","List-Subscribe":"<https://lists.libcamera.org/listinfo/libcamera-devel>,\n\t<mailto:libcamera-devel-request@lists.libcamera.org?subject=subscribe>","Errors-To":"libcamera-devel-bounces@lists.libcamera.org","Sender":"\"libcamera-devel\" <libcamera-devel-bounces@lists.libcamera.org>"},"content":"Add support for 16-bps (48-bpp) RGB output formats. These new formats\nare define for the RGB and BGR ordering.\n\nSigned-off-by: Naushir Patuck <naush@raspberrypi.com>\n---\n include/linux/drm_fourcc.h         |  4 ++++\n include/linux/videodev2.h          |  4 ++++\n src/libcamera/formats.cpp          | 20 ++++++++++++++++++++\n src/libcamera/formats.yaml         |  5 +++++\n src/libcamera/v4l2_pixelformat.cpp |  4 ++++\n 5 files changed, 37 insertions(+)","diff":"diff --git a/include/linux/drm_fourcc.h b/include/linux/drm_fourcc.h\nindex d6c83d9c49f4..4ee421b95730 100644\n--- a/include/linux/drm_fourcc.h\n+++ b/include/linux/drm_fourcc.h\n@@ -210,6 +210,10 @@ extern \"C\" {\n #define DRM_FORMAT_RGBA1010102\tfourcc_code('R', 'A', '3', '0') /* [31:0] R:G:B:A 10:10:10:2 little endian */\n #define DRM_FORMAT_BGRA1010102\tfourcc_code('B', 'A', '3', '0') /* [31:0] B:G:R:A 10:10:10:2 little endian */\n \n+/* 48 bpp RGB */\n+#define DRM_FORMAT_RGB161616\tfourcc_code('R', 'G', '4', '8') /* [48:0] R:G:B 16:16:16 little endian */\n+#define DRM_FORMAT_BGR161616\tfourcc_code('B', 'G', '4', '8') /* [48:0] R:G:B 16:16:16 little endian */\n+\n /* 64 bpp RGB */\n #define DRM_FORMAT_XRGB16161616\tfourcc_code('X', 'R', '4', '8') /* [63:0] x:R:G:B 16:16:16:16 little endian */\n #define DRM_FORMAT_XBGR16161616\tfourcc_code('X', 'B', '4', '8') /* [63:0] x:B:G:R 16:16:16:16 little endian */\ndiff --git a/include/linux/videodev2.h b/include/linux/videodev2.h\nindex 7e556911c9e1..ba48d2c89726 100644\n--- a/include/linux/videodev2.h\n+++ b/include/linux/videodev2.h\n@@ -557,6 +557,10 @@ struct v4l2_pix_format {\n #define V4L2_PIX_FMT_BGR48_12    v4l2_fourcc('B', '3', '1', '2') /* 48  BGR 12-bit per component */\n #define V4L2_PIX_FMT_ABGR64_12   v4l2_fourcc('B', '4', '1', '2') /* 64  BGRA 12-bit per component */\n \n+/* RGB formats (6 bytes per pixel) */\n+#define V4L2_PIX_FMT_BGR48 v4l2_fourcc('B', 'G', 'R', '6') /* 16  BGR-16-16-16 */\n+#define V4L2_PIX_FMT_RGB48 v4l2_fourcc('R', 'G', 'B', '6') /* 16  RGB-16-16-16 */\n+\n /* Grey formats */\n #define V4L2_PIX_FMT_GREY    v4l2_fourcc('G', 'R', 'E', 'Y') /*  8  Greyscale     */\n #define V4L2_PIX_FMT_Y4      v4l2_fourcc('Y', '0', '4', ' ') /*  4  Greyscale     */\ndiff --git a/src/libcamera/formats.cpp b/src/libcamera/formats.cpp\nindex 955c3fba8b8d..21a7719e84c4 100644\n--- a/src/libcamera/formats.cpp\n+++ b/src/libcamera/formats.cpp\n@@ -270,6 +270,26 @@ const std::map<PixelFormat, PixelFormatInfo> pixelFormatInfo{\n \t\t.pixelsPerGroup = 1,\n \t\t.planes = {{ { 4, 1 }, { 0, 0 }, { 0, 0 } }},\n \t} },\n+\t{ formats::BGR161616, {\n+\t\t.name = \"BGR161616\",\n+\t\t.format = formats::BGR161616,\n+\t\t.v4l2Formats = { V4L2PixelFormat(V4L2_PIX_FMT_RGB48), },\n+\t\t.bitsPerPixel = 48,\n+\t\t.colourEncoding = PixelFormatInfo::ColourEncodingRGB,\n+\t\t.packed = false,\n+\t\t.pixelsPerGroup = 1,\n+\t\t.planes = {{ { 3, 1 }, { 0, 0 }, { 0, 0 } }},\n+\t} },\n+\t{ formats::RGB161616, {\n+\t\t.name = \"RGB161616\",\n+\t\t.format = formats::RGB161616,\n+\t\t.v4l2Formats = { V4L2PixelFormat(V4L2_PIX_FMT_BGR48), },\n+\t\t.bitsPerPixel = 48,\n+\t\t.colourEncoding = PixelFormatInfo::ColourEncodingRGB,\n+\t\t.packed = false,\n+\t\t.pixelsPerGroup = 1,\n+\t\t.planes = {{ { 3, 1 }, { 0, 0 }, { 0, 0 } }},\n+\t} },\n \n \t/* YUV packed formats. */\n \t{ formats::YUYV, {\ndiff --git a/src/libcamera/formats.yaml b/src/libcamera/formats.yaml\nindex d8a379923b56..bde2cc803b98 100644\n--- a/src/libcamera/formats.yaml\n+++ b/src/libcamera/formats.yaml\n@@ -43,6 +43,11 @@ formats:\n   - BGRA8888:\n       fourcc: DRM_FORMAT_BGRA8888\n \n+  - RGB161616:\n+      fourcc: DRM_FORMAT_RGB161616\n+  - BGR161616:\n+      fourcc: DRM_FORMAT_BGR161616\n+\n   - YUYV:\n       fourcc: DRM_FORMAT_YUYV\n   - YVYU:\ndiff --git a/src/libcamera/v4l2_pixelformat.cpp b/src/libcamera/v4l2_pixelformat.cpp\nindex 731dc10f1d73..efb6f2940235 100644\n--- a/src/libcamera/v4l2_pixelformat.cpp\n+++ b/src/libcamera/v4l2_pixelformat.cpp\n@@ -71,6 +71,10 @@ const std::map<V4L2PixelFormat, V4L2PixelFormat::Info> vpf2pf{\n \t\t{ formats::BGRA8888, \"32-bit ARGB 8-8-8-8\" } },\n \t{ V4L2PixelFormat(V4L2_PIX_FMT_BGRA32),\n \t\t{ formats::RGBA8888, \"32-bit ABGR 8-8-8-8\" } },\n+\t{ V4L2PixelFormat(V4L2_PIX_FMT_RGB48),\n+\t\t{ formats::BGR161616, \"48-bit RGB 16-16-16\" } },\n+\t{ V4L2PixelFormat(V4L2_PIX_FMT_BGR48),\n+\t\t{ formats::RGB161616, \"48-bit BGR 16-16-16\" } },\n \n \t/* YUV packed formats. */\n \t{ V4L2PixelFormat(V4L2_PIX_FMT_YUYV),\n","prefixes":["v1","1/5"]}