From patchwork Fri Jun 18 20:02:46 2021 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Vedant Paranjape X-Patchwork-Id: 12654 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 36796C3218 for ; Fri, 18 Jun 2021 20:03:30 +0000 (UTC) Received: from lancelot.ideasonboard.com (localhost [IPv6:::1]) by lancelot.ideasonboard.com (Postfix) with ESMTP id E8ED36050D; Fri, 18 Jun 2021 22:03:29 +0200 (CEST) Authentication-Results: lancelot.ideasonboard.com; dkim=fail reason="signature verification failed" (2048-bit key; unprotected) header.d=gmail.com header.i=@gmail.com header.b="cr4YNKN7"; dkim-atps=neutral Received: from mail-pj1-x102e.google.com (mail-pj1-x102e.google.com [IPv6:2607:f8b0:4864:20::102e]) by lancelot.ideasonboard.com (Postfix) with ESMTPS id 98D5160298 for ; Fri, 18 Jun 2021 22:03:28 +0200 (CEST) Received: by mail-pj1-x102e.google.com with SMTP id s17-20020a17090a8811b029016e89654f93so8780421pjn.1 for ; Fri, 18 Jun 2021 13:03:28 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=from:to:cc:subject:date:message-id:in-reply-to:references :mime-version:content-transfer-encoding; bh=jMXUnHJF/T3oXW8IoawsxQf4vG5HSd7BBkl+wnS0QOs=; b=cr4YNKN7jDMrABugXk3t5/JvRyPXX0vu5ZwMK7wm3kWghT/izj5f/0+hOjgisAapxR imoii+C3LmjhwQ3bF/eM89JBkptSCPpY1AtHSC7qgPh0CnEB0zK7RxDRgL2BzgiPV4a+ 2F2Gfqym5f/RYdYDQ/n8bqYR4RRGTJbQe4tdjabl23UVQn78veJtYGyLBttyvfGrNy/z 68go668iruUT1NK3m6V32duWyVHbNkhNbvh2m0PzhhF8WiKbHEqbvyOkmstqkcDsQvIp 0uB9UAFtg8nzsQO8VEO25uSbr+1v3V0oOSqzLRbLlkbv+kT25cVUsomUiznXBPqHi2ri RZmA== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:from:to:cc:subject:date:message-id:in-reply-to :references:mime-version:content-transfer-encoding; bh=jMXUnHJF/T3oXW8IoawsxQf4vG5HSd7BBkl+wnS0QOs=; b=iHA2syx0y/Xc6XlPcfyBYdC8JbC68ygMDmzP9MaYe286IHCicRJ7u0o/Muozkq5gkG tRozVY4v/Umswacli5SKZIxGHgwMYQXDhmsds7zyFg/rMJbkFWuINeFrCY21ULb87510 GoVDfr8tAK5et40KqDnhFyHpUrS7ZMNg9ZNCtpttJ29pBHWcVUCqtMwONgfC8Sxdd5Yj Pn8Sbj/qA2U/BcVt/8De2YVxvgpd1hERgR12OBIcJY3n8haXYmz8dU+z+ARh/nAwAdJV a7TaPjy7wPTkycqruINmMQfrZgopxtDAka1WCyqLgkQoVBc+9Ld9+SvvAE+iyYW7crQ7 wHQQ== X-Gm-Message-State: AOAM5318cJdkBwIs6QqbFj0yBNci2yOzZCXrCFKaRxy6pUqhwztfaHm4 xAsULhkeRFBX5CYJOi/lvPxEuSD5aEr5QA== X-Google-Smtp-Source: ABdhPJydhLDCYPswrlhBYcx7mgnepSQuwFlsQMRyEu3FCrx7ati0CCYiXdNIrq16f01j4wOuRJwMbQ== X-Received: by 2002:a17:90a:6281:: with SMTP id d1mr10189140pjj.140.1624046607114; Fri, 18 Jun 2021 13:03:27 -0700 (PDT) Received: from localhost.localdomain ([1.186.76.76]) by smtp.googlemail.com with ESMTPSA id a11sm8852972pfl.168.2021.06.18.13.03.25 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Fri, 18 Jun 2021 13:03:26 -0700 (PDT) From: Vedant Paranjape To: libcamera-devel@lists.libcamera.org Date: Sat, 19 Jun 2021 01:32:46 +0530 Message-Id: <20210618200247.624987-2-vedantparanjape160201@gmail.com> X-Mailer: git-send-email 2.25.1 In-Reply-To: <20210618200247.624987-1-vedantparanjape160201@gmail.com> References: <20210618200247.624987-1-vedantparanjape160201@gmail.com> MIME-Version: 1.0 Subject: [libcamera-devel] [PATCH 1/2] libcamera: Fix V4L2 pixel format mapping for XRGB32 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: , Cc: Vedant Paranjape Errors-To: libcamera-devel-bounces@lists.libcamera.org Sender: "libcamera-devel" Fixed the mismatch of V4L2 and Libcamera pixelformats. Matched V4L2_PIX_FMT_XRGB32 with formats::BGRX8888. Additionally, fixes mapping of V4L2_PIX_FMT_RGBX32 to formats::XBGR8888 in formats.cpp Signed-off-by: Vedant Paranjape --- src/libcamera/formats.cpp | 12 +++++++++++- src/libcamera/v4l2_pixelformat.cpp | 2 +- 2 files changed, 12 insertions(+), 2 deletions(-) diff --git a/src/libcamera/formats.cpp b/src/libcamera/formats.cpp index 55822f4c..e41bfc05 100644 --- a/src/libcamera/formats.cpp +++ b/src/libcamera/formats.cpp @@ -198,13 +198,23 @@ const std::map pixelFormatInfo{ { formats::XBGR8888, { .name = "XBGR8888", .format = formats::XBGR8888, - .v4l2Format = V4L2PixelFormat(V4L2_PIX_FMT_XRGB32), + .v4l2Format = V4L2PixelFormat(V4L2_PIX_FMT_RGBX32), .bitsPerPixel = 32, .colourEncoding = PixelFormatInfo::ColourEncodingRGB, .packed = false, .pixelsPerGroup = 1, .planes = {{ { 4, 1 }, { 0, 0 }, { 0, 0 } }}, } }, + { formats::BGRX8888, { + .name = "BGRX8888", + .format = formats::BGRX8888, + .v4l2Format = V4L2PixelFormat(V4L2_PIX_FMT_XRGB32), + .bitsPerPixel = 32, + .colourEncoding = PixelFormatInfo::ColourEncodingRGB, + .packed = false, + .pixelsPerGroup = 1, + .planes = {{ { 4, 1 }, { 0, 0 }, { 0, 0 } }}, + } }, { formats::ABGR8888, { .name = "ABGR8888", .format = formats::ABGR8888, diff --git a/src/libcamera/v4l2_pixelformat.cpp b/src/libcamera/v4l2_pixelformat.cpp index 166d93cf..950cbda4 100644 --- a/src/libcamera/v4l2_pixelformat.cpp +++ b/src/libcamera/v4l2_pixelformat.cpp @@ -51,7 +51,7 @@ const std::map vpf2pf{ { V4L2PixelFormat(V4L2_PIX_FMT_RGB24), formats::BGR888 }, { V4L2PixelFormat(V4L2_PIX_FMT_BGR24), formats::RGB888 }, { V4L2PixelFormat(V4L2_PIX_FMT_XBGR32), formats::XRGB8888 }, - { V4L2PixelFormat(V4L2_PIX_FMT_XRGB32), formats::XBGR8888 }, + { V4L2PixelFormat(V4L2_PIX_FMT_XRGB32), formats::BGRX8888 }, { V4L2PixelFormat(V4L2_PIX_FMT_RGBA32), formats::ABGR8888 }, { V4L2PixelFormat(V4L2_PIX_FMT_ABGR32), formats::ARGB8888 }, { V4L2PixelFormat(V4L2_PIX_FMT_ARGB32), formats::BGRA8888 },