{"id":19543,"url":"https://patchwork.libcamera.org/api/1.1/patches/19543/?format=json","web_url":"https://patchwork.libcamera.org/patch/19543/","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":"<20240226153854.99471-1-jacopo.mondi@ideasonboard.com>","date":"2024-02-26T15:38:50","name":"[RFC] drm/fourcc: Add RPI modifiers","commit_ref":null,"pull_url":null,"state":"accepted","archived":false,"hash":"65400c2e33370dbcfb729f04bd3151e9fb0cdb61","submitter":{"id":143,"url":"https://patchwork.libcamera.org/api/1.1/people/143/?format=json","name":"Jacopo Mondi","email":"jacopo.mondi@ideasonboard.com"},"delegate":null,"mbox":"https://patchwork.libcamera.org/patch/19543/mbox/","series":[{"id":4183,"url":"https://patchwork.libcamera.org/api/1.1/series/4183/?format=json","web_url":"https://patchwork.libcamera.org/project/libcamera/list/?series=4183","date":"2024-02-26T15:38:50","name":"[RFC] drm/fourcc: Add RPI modifiers","version":1,"mbox":"https://patchwork.libcamera.org/series/4183/mbox/"}],"comments":"https://patchwork.libcamera.org/api/patches/19543/comments/","check":"pending","checks":"https://patchwork.libcamera.org/api/patches/19543/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 0B0CFBD80A\n\tfor <parsemail@patchwork.libcamera.org>;\n\tMon, 26 Feb 2024 15:39:18 +0000 (UTC)","from lancelot.ideasonboard.com (localhost [IPv6:::1])\n\tby lancelot.ideasonboard.com (Postfix) with ESMTP id 357FD6285F;\n\tMon, 26 Feb 2024 16:39:17 +0100 (CET)","from perceval.ideasonboard.com (perceval.ideasonboard.com\n\t[IPv6:2001:4b98:dc2:55:216:3eff:fef7:d647])\n\tby lancelot.ideasonboard.com (Postfix) with ESMTPS id 9326161C98\n\tfor <libcamera-devel@lists.libcamera.org>;\n\tMon, 26 Feb 2024 16:39:15 +0100 (CET)","from localhost.localdomain (93-61-96-190.ip145.fastwebnet.it\n\t[93.61.96.190])\n\tby perceval.ideasonboard.com (Postfix) with ESMTPSA id 40DB8673;\n\tMon, 26 Feb 2024 16:39:03 +0100 (CET)"],"Authentication-Results":"lancelot.ideasonboard.com;\n\tdkim=fail reason=\"signature verification failed\" (1024-bit key;\n\tunprotected) header.d=ideasonboard.com header.i=@ideasonboard.com\n\theader.b=\"FDtchzjr\"; dkim-atps=neutral","DKIM-Signature":"v=1; a=rsa-sha256; c=relaxed/simple; d=ideasonboard.com;\n\ts=mail; t=1708961943;\n\tbh=it1/wFCrtpA8WF6VMSYJ7atoGY0tvgQDb2l4BKHt8i0=;\n\th=From:To:Cc:Subject:Date:From;\n\tb=FDtchzjr3p1v5ic0ucCN23wDZyA8Teqa6rxs9VHeMmaSuOUtx74fm+giVSHqH795i\n\tFzOJmaF/cEPJ4A1GurI2oBgYNmHYhcr0tSyhiPNEx1Ez3Kh93muN8a5EDPey3cgHAO\n\tF+9OPx1MsXqNNwqOgBe/XSZFVsW+DWba12hx3+qk=","From":"Jacopo Mondi <jacopo.mondi@ideasonboard.com>","To":"David Airlie <airlied@gmail.com>, Daniel Vetter <daniel@ffwll.ch>,\n\tMaarten Lankhorst <maarten.lankhorst@linux.intel.com>,\n\tMaxime Ripard <mripard@kernel.org>,\n\tThomas Zimmermann <tzimmermann@suse.de>,\n\tNaushir Patuck <naush@raspberrypi.com>,\n\tLaurent Pinchart <laurent.pinchart@ideasonboard.com>","Subject":"[RFC] drm/fourcc: Add RPI modifiers","Date":"Mon, 26 Feb 2024 16:38:50 +0100","Message-ID":"<20240226153854.99471-1-jacopo.mondi@ideasonboard.com>","X-Mailer":"git-send-email 2.43.0","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>","Cc":"Jacopo Mondi <jacopo.mondi@ideasonboard.com>,\n\tlibcamera-devel@lists.libcamera.org, dri-devel@lists.freedesktop.org","Errors-To":"libcamera-devel-bounces@lists.libcamera.org","Sender":"\"libcamera-devel\" <libcamera-devel-bounces@lists.libcamera.org>"},"content":"Add modifiers for the Raspberry Pi PiSP compressed formats.\n\nThe compressed formats are documented at:\nDocumentation/userspace-api/media/v4l/pixfmt-pisp-comp-rggb.rst\n\nand in the PiSP datasheet:\nhttps://datasheets.raspberrypi.com/camera/raspberry-pi-image-signal-processor-specification.pdf\n\nSigned-off-by: Jacopo Mondi <jacopo.mondi@ideasonboard.com>\n---\n\nBackground:\n-----------\n\nThe Raspberry Pi PiSP camera subsystem is on its way to upstream through the\nVideo4Linux2 subsystem:\nhttps://patchwork.linuxtv.org/project/linux-media/list/?series=12310\n\nThe PiSP camera system is composed by a \"Front End\" and a \"Back End\".\nThe FrontEnd part is a MIPI CSI-2 receiver that store frames to memory and\nproduce statistics, and the BackEnd is a memory-to-memory ISP that converts\nimages in a format usable by application.\n\nThe \"FrontEnd\" is capable of encoding RAW Bayer images as received by the\nimage sensor in a 'compressed' format defined by Raspberry Pi and fully\ndocumented in the PiSP manual:\nhttps://datasheets.raspberrypi.com/camera/raspberry-pi-image-signal-processor-specification.pdf\n\nThe compression scheme is documented in the in-review patch series for the BE\nsupport at:\nhttps://patchwork.linuxtv.org/project/linux-media/patch/20240223163012.300763-7-jacopo.mondi@ideasonboard.com/\n\nThe \"BackEnd\" is capable of consuming images in the compressed format and\noptionally user application might want to inspect those images for debugging\npurposes.\n\nWhy a DRM modifier\n------------------\n\nThe PiSP support is entirely implemented in libcamera, with the support of an\nhw-specific library called 'libpisp'.\n\nlibcamera uses the fourcc codes defined by DRM to define its formats:\nhttps://git.libcamera.org/libcamera/libcamera.git/tree/src/libcamera/formats.yaml\n\nAnd to define a new libcamera format for the Raspberry Pi compressed ones we\nneed to associate the above proposed modifiers with a RAW Bayer format\nidentifier.\n\nIn example:\n\n  - RGGB16_PISP_COMP1:\n      fourcc: DRM_FORMAT_SRGGB16\n      mod: PISP_FORMAT_MOD_COMPRESS_MODE1\n  - GRBG16_PISP_COMP1:\n      fourcc: DRM_FORMAT_SGRBG16\n      mod: PISP_FORMAT_MOD_COMPRESS_MODE1\n  - GBRG16_PISP_COMP1:\n      fourcc: DRM_FORMAT_SGBRG16\n      mod: PISP_FORMAT_MOD_COMPRESS_MODE1\n  - BGGR16_PISP_COMP1:\n      fourcc: DRM_FORMAT_SBGGR16\n      mod: PISP_FORMAT_MOD_COMPRESS_MODE1\n  - MONO_PISP_COMP1:\n      fourcc: DRM_FORMAT_R16\n      mod: PISP_FORMAT_MOD_COMPRESS_MODE1\n\nSee\nhttps://patchwork.libcamera.org/patch/19503/\n\nWould if be acceptable for DRM to include the above proposed modifiers for the\npurpose of defining the above presented libcamera formats ? There will be no\ngraphic format associated with these modifiers as their purpose it not\ndisplaying images but rather exchange them between the components of the\ncamera subsystem (and possibly be inspected by specialized test applications).\n\n---\n include/uapi/drm/drm_fourcc.h | 5 +++++\n 1 file changed, 5 insertions(+)\n\n--\n2.43.0","diff":"diff --git a/include/uapi/drm/drm_fourcc.h b/include/uapi/drm/drm_fourcc.h\nindex 00db00083175..09b182a959ad 100644\n--- a/include/uapi/drm/drm_fourcc.h\n+++ b/include/uapi/drm/drm_fourcc.h\n@@ -425,6 +425,7 @@ extern \"C\" {\n #define DRM_FORMAT_MOD_VENDOR_ARM     0x08\n #define DRM_FORMAT_MOD_VENDOR_ALLWINNER 0x09\n #define DRM_FORMAT_MOD_VENDOR_AMLOGIC 0x0a\n+#define DRM_FORMAT_MOD_VENDOR_RPI 0x0b\n\n /* add more to the end as needed */\n\n@@ -1568,6 +1569,10 @@ drm_fourcc_canonicalize_nvidia_format_mod(__u64 modifier)\n #define AMD_FMT_MOD_CLEAR(field) \\\n \t(~((__u64)AMD_FMT_MOD_##field##_MASK << AMD_FMT_MOD_##field##_SHIFT))\n\n+/* RPI (Raspberry Pi) modifiers */\n+#define PISP_FORMAT_MOD_COMPRESS_MODE1 fourcc_mod_code(RPI, 1)\n+#define PISP_FORMAT_MOD_COMPRESS_MODE2 fourcc_mod_code(RPI, 2)\n+\n #if defined(__cplusplus)\n }\n #endif\n","prefixes":["RFC"]}