From patchwork Fri May 22 18:14:35 2020 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Kieran Bingham X-Patchwork-Id: 3852 Return-Path: Received: from perceval.ideasonboard.com (perceval.ideasonboard.com [213.167.242.64]) by lancelot.ideasonboard.com (Postfix) with ESMTPS id 89969603D7 for ; Fri, 22 May 2020 20:14:39 +0200 (CEST) Authentication-Results: lancelot.ideasonboard.com; dkim=pass (1024-bit key; unprotected) header.d=ideasonboard.com header.i=@ideasonboard.com header.b="p3niiwlX"; dkim-atps=neutral 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 0738E24D; Fri, 22 May 2020 20:14:38 +0200 (CEST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=ideasonboard.com; s=mail; t=1590171279; bh=tYsESgxI8qVIvCR/O85S2LNyIP8M9T86/31bAlF9T+0=; h=From:To:Cc:Subject:Date:From; b=p3niiwlXimCnRf9Memg4XtnB1qwKF5TgJX1d8ynwjrkzcGCuFURiq7p56B3W+POPf 0BT8Nu330vViQGAe19jT3qJ1jLAJ72Dw59XjVXcSDJiJafSWnHf4gxHe6ZTNGgAVic 3e1pvROS8gGNFdVeuk2SsXlA8PqDzqeWc0exf9oI= From: Kieran Bingham To: libcamera devel Date: Fri, 22 May 2020 19:14:35 +0100 Message-Id: <20200522181435.3174615-1-kieran.bingham@ideasonboard.com> X-Mailer: git-send-email 2.25.1 MIME-Version: 1.0 Subject: [libcamera-devel] [RFC PATCH] libcamera: pipeline: vimc: Skip unsupported formats 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: Fri, 22 May 2020 18:14:39 -0000 Older kernels do not support all 'reported' formats. Skip them on those kernels. Signed-off-by: Kieran Bingham --- Marking this as RFC, as I don't actually yet know what the correct kernel version is to condition against. Currently, the QCam application can not stream the VIMC Camera for users of QT Version less that 5.14 as that is when the BGR888 format becomes a 'preferred' native format. Users of QT < 5.14 will find that qcam will chose a 'preferred' format which is reported as supported by the kernel, when in fact it isn't. Ensure that those formats are not reported as supported by the vimc pipeline handler on older kernels. src/libcamera/pipeline/vimc/vimc.cpp | 14 ++++++++++++++ 1 file changed, 14 insertions(+) diff --git a/src/libcamera/pipeline/vimc/vimc.cpp b/src/libcamera/pipeline/vimc/vimc.cpp index 68d65bc785b0..78fb0ece21f8 100644 --- a/src/libcamera/pipeline/vimc/vimc.cpp +++ b/src/libcamera/pipeline/vimc/vimc.cpp @@ -171,6 +171,7 @@ CameraConfiguration *PipelineHandlerVimc::generateConfiguration(Camera *camera, const StreamRoles &roles) { CameraConfiguration *config = new VimcCameraConfiguration(); + VimcCameraData *data = cameraData(camera); if (roles.empty()) return config; @@ -178,6 +179,19 @@ CameraConfiguration *PipelineHandlerVimc::generateConfiguration(Camera *camera, std::map> formats; for (const auto &pixelformat : pixelformats) { + /* + * \todo: Update this when the kernel correctly supports other + * reported formats. + */ + if (data->media_->version() <= KERNEL_VERSION(5, 7, 0)) { + if (pixelformat.first != PixelFormat(DRM_FORMAT_BGR888)) { + LOG(VIMC, Info) + << "Skipping unsupported pixel format" + << pixelformat.first.toString(); + continue; + } + } + /* The scaler hardcodes a x3 scale-up ratio. */ std::vector sizes{ SizeRange{ { 48, 48 }, { 4096, 2160 } }