From patchwork Sun Jan 31 18:43:52 2021 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Patchwork-Submitter: Laurent Pinchart X-Patchwork-Id: 11078 X-Patchwork-Delegate: laurent.pinchart@ideasonboard.com Return-Path: X-Original-To: parsemail@patchwork.libcamera.org Delivered-To: parsemail@patchwork.libcamera.org Received: from lancelot.ideasonboard.com (lancelot.ideasonboard.com [92.243.16.209]) by patchwork.libcamera.org (Postfix) with ESMTPS id A8D81C33BB for ; Sun, 31 Jan 2021 18:44:19 +0000 (UTC) Received: from lancelot.ideasonboard.com (localhost [IPv6:::1]) by lancelot.ideasonboard.com (Postfix) with ESMTP id 78728683E2; Sun, 31 Jan 2021 19:44:19 +0100 (CET) Authentication-Results: lancelot.ideasonboard.com; dkim=fail reason="signature verification failed" (1024-bit key; unprotected) header.d=ideasonboard.com header.i=@ideasonboard.com header.b="T4RsSQZ9"; dkim-atps=neutral Received: from perceval.ideasonboard.com (perceval.ideasonboard.com [IPv6:2001:4b98:dc2:55:216:3eff:fef7:d647]) by lancelot.ideasonboard.com (Postfix) with ESMTPS id A6624683D4 for ; Sun, 31 Jan 2021 19:44:16 +0100 (CET) Received: from pendragon.lan (62-78-145-57.bb.dnainternet.fi [62.78.145.57]) by perceval.ideasonboard.com (Postfix) with ESMTPSA id 44565813 for ; Sun, 31 Jan 2021 19:44:16 +0100 (CET) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=ideasonboard.com; s=mail; t=1612118656; bh=sWpBZbJgyDjawkzl3wtsHOH5nxPIOt34YwkjRbcOAME=; h=From:To:Subject:Date:In-Reply-To:References:From; b=T4RsSQZ9Ci9tJbNEhcXn4IgoicC9nciLuaZDAYthTkVR543IBUuAyoPcbfkHILX15 7EZEU0uluV7zhaYuQOClXJSUfrWb7nauB8Ay3OJXYoklwJmL34jIkCnl6r4hKROoNc UUAFl1i60IN1pOEimqysGx8OXq9r8/U6o8hNmOsE= From: Laurent Pinchart To: libcamera-devel@lists.libcamera.org Date: Sun, 31 Jan 2021 20:43:52 +0200 Message-Id: <20210131184352.10635-3-laurent.pinchart@ideasonboard.com> X-Mailer: git-send-email 2.28.0 In-Reply-To: <20210131184352.10635-1-laurent.pinchart@ideasonboard.com> References: <20210131184352.10635-1-laurent.pinchart@ideasonboard.com> MIME-Version: 1.0 Subject: [libcamera-devel] [PATCH 2/2] libcamera: formats: Add RGB565_BE format X-BeenThere: libcamera-devel@lists.libcamera.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: libcamera-devel-bounces@lists.libcamera.org Sender: "libcamera-devel" This new format corresponds to the V4L2 V4L2_PIX_FMT_RGB565X format, and is the big-endian version of the DRM_FORMAT_RGB565 format. Signed-off-by: Laurent Pinchart Reviewed-by: Niklas Söderlund --- src/libcamera/formats.cpp | 10 ++++++++++ src/libcamera/formats.yaml | 3 +++ src/libcamera/v4l2_pixelformat.cpp | 1 + 3 files changed, 14 insertions(+) diff --git a/src/libcamera/formats.cpp b/src/libcamera/formats.cpp index 14940bee3724..4f70e47e0c97 100644 --- a/src/libcamera/formats.cpp +++ b/src/libcamera/formats.cpp @@ -155,6 +155,16 @@ const std::map pixelFormatInfo{ .pixelsPerGroup = 1, .planes = {{ { 3, 1 }, { 0, 0 }, { 0, 0 } }}, } }, + { formats::RGB565_BE, { + .name = "RGB565_BE", + .format = formats::RGB565_BE, + .v4l2Format = V4L2PixelFormat(V4L2_PIX_FMT_RGB565X), + .bitsPerPixel = 16, + .colourEncoding = PixelFormatInfo::ColourEncodingRGB, + .packed = false, + .pixelsPerGroup = 1, + .planes = {{ { 3, 1 }, { 0, 0 }, { 0, 0 } }}, + } }, { formats::BGR888, { .name = "BGR888", .format = formats::BGR888, diff --git a/src/libcamera/formats.yaml b/src/libcamera/formats.yaml index de4254df9334..c3adef54ca0f 100644 --- a/src/libcamera/formats.yaml +++ b/src/libcamera/formats.yaml @@ -10,6 +10,9 @@ formats: - RGB565: fourcc: DRM_FORMAT_RGB565 + - RGB565_BE: + fourcc: DRM_FORMAT_RGB565 + big_endian: true - RGB888: fourcc: DRM_FORMAT_RGB888 diff --git a/src/libcamera/v4l2_pixelformat.cpp b/src/libcamera/v4l2_pixelformat.cpp index 2665d5a7af08..abb1824c5673 100644 --- a/src/libcamera/v4l2_pixelformat.cpp +++ b/src/libcamera/v4l2_pixelformat.cpp @@ -47,6 +47,7 @@ namespace { const std::map vpf2pf{ /* RGB formats. */ { V4L2PixelFormat(V4L2_PIX_FMT_RGB565), formats::RGB565 }, + { V4L2PixelFormat(V4L2_PIX_FMT_RGB565X), formats::RGB565_BE }, { V4L2PixelFormat(V4L2_PIX_FMT_RGB24), formats::BGR888 }, { V4L2PixelFormat(V4L2_PIX_FMT_BGR24), formats::RGB888 }, { V4L2PixelFormat(V4L2_PIX_FMT_XBGR32), formats::XRGB8888 },