From patchwork Mon Feb 24 13:08:55 2020 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Kieran Bingham X-Patchwork-Id: 2873 Return-Path: Received: from perceval.ideasonboard.com (perceval.ideasonboard.com [213.167.242.64]) by lancelot.ideasonboard.com (Postfix) with ESMTPS id 41AE06042F for ; Mon, 24 Feb 2020 14:08:59 +0100 (CET) Received: from localhost.localdomain (cpc89242-aztw30-2-0-cust488.18-1.cable.virginm.net [86.31.129.233]) by perceval.ideasonboard.com (Postfix) with ESMTPSA id A5009E89; Mon, 24 Feb 2020 14:08:58 +0100 (CET) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=ideasonboard.com; s=mail; t=1582549738; bh=OyRp8/m8k38MSR5yuIp69dCJyViPLbE7s/7fHfwHGko=; h=From:To:Cc:Subject:Date:From; b=kCYpWiq4akCB5FxrRi50DtLfTiuTV8jM8cYZuJNHzNY74+EybZc6hKsSDnpAEkz9m b0g+zynRgJYycNrmSXAjkgICgsMWssL25Hy2YHTkodbo0o5vXRnOk4uB2uqYSLVwnT 9JpGqO4Rl/0cmyHPXo2hnnfW27F8EfFQzcXXUTtQ= From: Kieran Bingham To: libcamera devel Date: Mon, 24 Feb 2020 13:08:55 +0000 Message-Id: <20200224130855.4858-1-kieran.bingham@ideasonboard.com> X-Mailer: git-send-email 2.20.1 MIME-Version: 1.0 Subject: [libcamera-devel] [PATCH] qcam: format_convertor: Extend 32 bit ARGB format combinations 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: , X-List-Received-Date: Mon, 24 Feb 2020 13:08:59 -0000 Add further support to the pixel format convertor to allow ARGB, RGBA, and ABGR formats to be displayed in qcam. Blank lines are added between the sections for NV, RGB, YUV, and MJPEG configurations. The implementation of the RGB conversions are highly inefficient, and where possible should be extended to use hardware accellerations such as OpenGL, or in the event that the input format is identical (or compatible) with the output format - a more optimised memcpy should be implemented. Signed-off-by: Kieran Bingham Reviewed-by: Laurent Pinchart --- src/qcam/format_converter.cpp | 25 +++++++++++++++++++++++++ 1 file changed, 25 insertions(+) diff --git a/src/qcam/format_converter.cpp b/src/qcam/format_converter.cpp index 383d48223140..4604143419dd 100644 --- a/src/qcam/format_converter.cpp +++ b/src/qcam/format_converter.cpp @@ -67,6 +67,7 @@ int FormatConverter::configure(unsigned int format, unsigned int width, vertSubSample_ = 1; nvSwap_ = true; break; + case DRM_FORMAT_RGB888: formatFamily_ = RGB; r_pos_ = 2; @@ -81,6 +82,27 @@ int FormatConverter::configure(unsigned int format, unsigned int width, b_pos_ = 2; bpp_ = 3; break; + case DRM_FORMAT_ARGB8888: + formatFamily_ = RGB; + r_pos_ = 2; + g_pos_ = 1; + b_pos_ = 0; + bpp_ = 4; + break; + case DRM_FORMAT_RGBA8888: + formatFamily_ = RGB; + r_pos_ = 3; + g_pos_ = 2; + b_pos_ = 1; + bpp_ = 4; + break; + case DRM_FORMAT_ABGR8888: + formatFamily_ = RGB; + r_pos_ = 0; + g_pos_ = 1; + b_pos_ = 2; + bpp_ = 4; + break; case DRM_FORMAT_BGRA8888: formatFamily_ = RGB; r_pos_ = 1; @@ -88,6 +110,7 @@ int FormatConverter::configure(unsigned int format, unsigned int width, b_pos_ = 3; bpp_ = 4; break; + case DRM_FORMAT_VYUY: formatFamily_ = YUV; y_pos_ = 1; @@ -108,9 +131,11 @@ int FormatConverter::configure(unsigned int format, unsigned int width, y_pos_ = 0; cb_pos_ = 1; break; + case DRM_FORMAT_MJPEG: formatFamily_ = MJPEG; break; + default: return -EINVAL; };