From patchwork Fri Oct 9 11:17:39 2020 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Andrey Konovalov X-Patchwork-Id: 10026 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 D2638BEEE0 for ; Fri, 9 Oct 2020 11:18:10 +0000 (UTC) Received: from lancelot.ideasonboard.com (localhost [IPv6:::1]) by lancelot.ideasonboard.com (Postfix) with ESMTP id 55E8E60359; Fri, 9 Oct 2020 13:18:10 +0200 (CEST) Authentication-Results: lancelot.ideasonboard.com; dkim=fail reason="signature verification failed" (2048-bit key; unprotected) header.d=linaro.org header.i=@linaro.org header.b="VczE4X9d"; dkim-atps=neutral Received: from mail-lj1-x241.google.com (mail-lj1-x241.google.com [IPv6:2a00:1450:4864:20::241]) by lancelot.ideasonboard.com (Postfix) with ESMTPS id D65E660358 for ; Fri, 9 Oct 2020 13:18:08 +0200 (CEST) Received: by mail-lj1-x241.google.com with SMTP id a5so9206817ljj.11 for ; Fri, 09 Oct 2020 04:18:08 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; h=from:to:cc:subject:date:message-id; bh=GSgVdC2R6mUKQ9GnhXcv2ymGxgkiKb3RgBds3bj68to=; b=VczE4X9dPoIAHkkWtWjKFH3Qk148RNTbGZ3k0odo+ae9HFsUDrdF6UflI72NpjlMlt K60UKvNxDgdgGIQHWMt6VqBX/IFvGZCFNy9z0g80fXHT62cyEr610zvgkcjdjT9Nnpop RMeK26NBaeavett9eKRD+Lyp8bUlUvNF+oP9yAYw2uOmPM10UAq4LPCvLuBDGZJ0Xx0Y RP+z5qpi5DzChr24kD0RHmKmcLs6gJhi89pr9WtfrWX31yF8RtmnXkzTCfmXALABlQFN C4h2Wxs+faOfFvx/KnF0s/l73tXXKIDVLS7Pz6Q/s85gZsoxo2lghDU7pENRbfxC4D6O 5vDQ== 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; bh=GSgVdC2R6mUKQ9GnhXcv2ymGxgkiKb3RgBds3bj68to=; b=GB6QG3ytRz11ALBdg9seU5EZdqYN7dnpvZDjw8a6Qa6Kg/XV4Vnn63ruN/aVbfx8uC k7mHu82cf8qc5gqfXBnneqIi2eD8nefQzNEbyuDPRmo6rWaoQVnrFClIDN4QxN4RSmzV 6BBXwfPVnbmvOGe3Bfn9YwdZTbo/YIW4xsDwv3JB6PNwvNSz8qPPDjs4lcDjiCGLejiT 3nwl1xXBozYKYRnCbPVwO3aI9uJwo0lEIsRXQhQCMc6eE5jCEaPmZlJuoeTMxoTna+Vv GF2vsI0/k/wYUHKkYjbbIzGx6mOlMrk6kxwkFXUKbU5yASW7yFczZUGijwYWCj1fYMKX tkLQ== X-Gm-Message-State: AOAM533hSAqWQztFgoH1jpvYDEFQMuTIercpk16ri4z1grFlmtPHSsBn WpFdNL6JEIukrlqH+f49FAacyNRLAAIhdg== X-Google-Smtp-Source: ABdhPJwj9sSBwdY87rA9AM8k5j0ffMN03FVKOguerSvaxqJiuyFCey8/s2CvJAGBW3Xb7ZRfUZiMpg== X-Received: by 2002:a2e:958f:: with SMTP id w15mr5333210ljh.449.1602242287610; Fri, 09 Oct 2020 04:18:07 -0700 (PDT) Received: from localhost.localdomain (37-144-159-139.broadband.corbina.ru. [37.144.159.139]) by smtp.googlemail.com with ESMTPSA id u14sm118581lfg.156.2020.10.09.04.18.06 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Fri, 09 Oct 2020 04:18:06 -0700 (PDT) From: Andrey Konovalov To: libcamera-devel@lists.libcamera.org Date: Fri, 9 Oct 2020 14:17:39 +0300 Message-Id: <20201009111739.10824-1-andrey.konovalov@linaro.org> X-Mailer: git-send-email 2.17.1 Subject: [libcamera-devel] [PATCH v2] libcamera: pipeline: simple: enable mplane devices using contiguous memory 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: , MIME-Version: 1.0 Errors-To: libcamera-devel-bounces@lists.libcamera.org Sender: "libcamera-devel" The current simple pipeline handler refuses to work with capture devices which have V4L2_CAP_VIDEO_CAPTURE_MPLANE flag set in the device capabilities field. This is too restrictive, as devices supporting the multi-planar API can be using contiguous memory for semi-planar and planar formats, and this would just work without any changes to libcamera. Drop the guard against MPLANE devices, and replace it with the check of the number of planes in the format the simple pipeline handler is going to use for capture. This will let MPLANE devices which don't use non-contiguous memory for frame buffers to work with the simple pipeline handler. The following code in SimpleCameraData::init() filters out the pixel formats libcamera doesn't support: PixelFormat pixelFormat = videoFormat.first.toPixelFormat(); if (!pixelFormat) continue; So the check for the number of memory planes this patch adds would not trigger until non-contiguous planar formats becomes supported in libcamera, and video devices using these formats are enabled in the simple pipeline handler. Then this check will remind one to review the simple pipeline handler code. Signed-off-by: Andrey Konovalov Reviewed-by: Kieran Bingham Reviewed-by: Laurent Pinchart --- Changes in v2: - The commit message extended to explain how the simple pipeline handler filters out pixel formats not supported in libcamera. No changes to the code vs v1. src/libcamera/pipeline/simple/simple.cpp | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-) diff --git a/src/libcamera/pipeline/simple/simple.cpp b/src/libcamera/pipeline/simple/simple.cpp index 10223a9b..8dc23623 100644 --- a/src/libcamera/pipeline/simple/simple.cpp +++ b/src/libcamera/pipeline/simple/simple.cpp @@ -592,6 +592,12 @@ int SimplePipelineHandler::configure(Camera *camera, CameraConfiguration *c) if (ret) return ret; + if (captureFormat.planesCount != 1) { + LOG(SimplePipeline, Error) + << "Planar formats using non-contiguous memory not supported"; + return -EINVAL; + } + if (captureFormat.fourcc != videoFormat || captureFormat.size != pipeConfig.captureSize) { LOG(SimplePipeline, Error) @@ -845,12 +851,6 @@ V4L2VideoDevice *SimplePipelineHandler::video(const MediaEntity *entity) if (video->open() < 0) return nullptr; - if (video->caps().isMultiplanar()) { - LOG(SimplePipeline, Error) - << "V4L2 multiplanar devices are not supported"; - return nullptr; - } - video->bufferReady.connect(this, &SimplePipelineHandler::bufferReady); auto element = videos_.emplace(entity, std::move(video));