From patchwork Thu Nov 10 14:45:50 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: David Plowman X-Patchwork-Id: 17765 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 29822BE08B for ; Thu, 10 Nov 2022 14:46:05 +0000 (UTC) Received: from lancelot.ideasonboard.com (localhost [IPv6:::1]) by lancelot.ideasonboard.com (Postfix) with ESMTP id 681FB6307B; Thu, 10 Nov 2022 15:46:04 +0100 (CET) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=libcamera.org; s=mail; t=1668091564; bh=9OADKeLw8HgOVztOydaxFZr1tytD7RiIREmYjiHS/3I=; h=To:Date:Subject:List-Id:List-Unsubscribe:List-Archive:List-Post: List-Help:List-Subscribe:From:Reply-To:From; b=UBW0lqTj89tL6gWuSOZhMQRY8Di/tWsVAanB9QqK+MNVPRQzo7TKdgB9xbrx1feGB JLWzJEt5kjqP+RoOIAOah+2LuMp/2kLMC2WgzbpzyFaZjH+1t/QpvIVpWEWZyfBNSe ttOYKTFUyH2pctATmCS24O+Yrxx4ZhekiacEXUS74utPTP5k8DDefT8sm+4yEiGV1P yWqCC/X7ZVTlCbQp7mtAem41BykZ79JZuvftFp3n3gQ3VUoWdhwbVsQsxeZEHVW/jL qS8PACmoDYPeHyvLhSeqjz4OUYpbHLtYBFDfElBXup9XtGOej/EOFAkQHYL1w8vL65 3nvOEzCwb54VQ== Received: from mail-wr1-x434.google.com (mail-wr1-x434.google.com [IPv6:2a00:1450:4864:20::434]) by lancelot.ideasonboard.com (Postfix) with ESMTPS id CD0EE63075 for ; Thu, 10 Nov 2022 15:46:02 +0100 (CET) Authentication-Results: lancelot.ideasonboard.com; dkim=pass (2048-bit key; unprotected) header.d=raspberrypi.com header.i=@raspberrypi.com header.b="h2R1cHko"; dkim-atps=neutral Received: by mail-wr1-x434.google.com with SMTP id l14so2593579wrw.2 for ; Thu, 10 Nov 2022 06:46:02 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=raspberrypi.com; s=google; h=content-transfer-encoding:mime-version:message-id:date:subject:cc :to:from:from:to:cc:subject:date:message-id:reply-to; bh=nCYPiN1hqy5W681pPKC8EMTYkD8WMWkbLFten5TNAUo=; b=h2R1cHkoJR1yC6PSYUsh+bWqiGgmOaDRc2CiNUWE/gojnZWmd40wJAQxlj0CJENdse e310LLbrJkpK/5gp1x7z7qH1P0ytVqDIVQc6pNmNmXbLIyiF4b1gMqUKIVBAy3lMjHuz J4R/JNnxgKUvghRi8yBaeh9IXT/mz5C9A32Pa6B0CfJb3ZVC6U29q+SjA6JFqf2gdPDS u1Z73yaUEIzc2KATj2T911ocP+SPx6dXnZTC1xDhL8mezPdA4Snqb58J0BUDVcyrOLRY BxwvwFwNizho1kiAxr1SdTWuzt8McKWjbKs1oQbcAaJs/DOWU5RDTFcIqD6rKBNE4j90 h8wg== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=content-transfer-encoding:mime-version:message-id:date:subject:cc :to:from:x-gm-message-state:from:to:cc:subject:date:message-id :reply-to; bh=nCYPiN1hqy5W681pPKC8EMTYkD8WMWkbLFten5TNAUo=; b=qVvKDwGDRlkTssqomw59kEiEvlLiHS9qlmoW/N79Dp9to/6S1JwR0UoLNCMdvCWCNC JXcm9Q2xwxz/1bEtefcwrkhPKrvDA6ZoNdmpyStozM/kyVaQozaEbF3VAvOcZhaop/s1 kfFM4lXeP/S76js+BgmqEA7iY/P5WE8cyGRDPEQ8aHaVNA3gm3yUWppCJbAuaWwGP+cq nutd9QUE8IlQl155GgTQWe3AwUmrIWlsdCOxB/jN1OpHBlZcKeYNkyI/0RgqeBuQL2/v 2zwlc5cRy4e5xEXHSbD1s+MVStyPDXK5c2Vet9wefoy6+9rlydQJvJRSsITP7JCTR4hm d2Cw== X-Gm-Message-State: ACrzQf0jkSjDAuLf248GeUJ7Bo70ngh4JoOwKhleuOuifFjpazW1qIUz l8izFBJlLv704rbvCRmwarljJetj4pd3Yg== X-Google-Smtp-Source: AMsMyM5MF80yN/XGPAReaPZ8BK4+JIiQYJkUhWWpqrkyGk8ReX6OzHmwiLk4PHzjtmEVRuDOf9o0Jw== X-Received: by 2002:adf:f6c9:0:b0:236:547f:698a with SMTP id y9-20020adff6c9000000b00236547f698amr40149147wrp.180.1668091561974; Thu, 10 Nov 2022 06:46:01 -0800 (PST) Received: from pi4-davidp.pitowers.org ([2a00:1098:3142:14:e4a2:3070:eea4:e434]) by smtp.gmail.com with ESMTPSA id u24-20020a7bc058000000b003b476cabf1csm5249759wmc.26.2022.11.10.06.46.00 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Thu, 10 Nov 2022 06:46:01 -0800 (PST) To: libcamera-devel@lists.libcamera.org Date: Thu, 10 Nov 2022 14:45:50 +0000 Message-Id: <20221110144556.7858-1-david.plowman@raspberrypi.com> X-Mailer: git-send-email 2.30.2 MIME-Version: 1.0 Subject: [libcamera-devel] [PATCH 0/6] Resolve invalid attempts to set sensor flip controls 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-Patchwork-Original-From: David Plowman via libcamera-devel From: David Plowman Reply-To: David Plowman Errors-To: libcamera-devel-bounces@lists.libcamera.org Sender: "libcamera-devel" Hi everyone Here's a first proper attempt to submit some patches for what was previously an "RFC". The first two patches are the original ones that I posted, with some tidy-ups from Jacopo: 1. Add a BayerFormat::toMbusCode method. 2. Don't clear the sensor flip bits, instead query them and transform Bayer formats to their "native" order. Now there are some extra patches to restore pipeline handlers to their previous behaviours. I've avoided adding or fixing any functionality in them even where I had suspected there were some things that needed addressing - those should all be subsequent pieces of work. So we have: 3. I've added a V4L2Device::setTransform method. I think we're expecting to push a bit more work to pipeline handlers so this function is intended to help them. You can call it in a "try" mode which tells you what transform (h/v flips) you will get but without applying them. I expect validate() methods might call this. And you can call it in a "do" mode which I would expect configure() methods might use. I haven't checked for things like the controls being read-only, or having only one value or strange stuff like that... should I? 4. Fix the uvcvideo PH. 5. Fix the simple PH. Jacopo remarked previously that raw formats are a theoretical possibility here, but given that it has no particular handling of them currently, then the changes here make no difference in that respect. So adding that would be a job for another patch. 6. Fix the rkisp1 PH. I haven't touched the Raspberry Pi PH because I think it's fine. There is possibly a small job of tidying it to use the new setTransform method, but that's one for another time. I haven't touched the IPU3 PH because I believe it to set the flips correctly. I remarked previously that I suspected it wasn't transforming Bayer orders appropriately but again, the changes here make no difference there so that would be a fix for another patch too. I hope that all makes sense. Do folks agree with this as a way forward? Thoughts welcome! Thanks David David Plowman (6): libcamera: bayer_format: Add toMbusCode method libcamera: camera_sensor: Do not clear camera flips when listing formats libcamera: v4l2_device: Add setTransform method to set a device's flip controls libcamera: pipeline: uvcvideo: Set device's flip controls correctly libcamera: pipeline: simple: Set device's flip controls correctly libcamera: pipeline: rkisp1: Set device's flip controls correctly include/libcamera/internal/bayer_format.h | 1 + include/libcamera/internal/v4l2_device.h | 3 ++ src/libcamera/bayer_format.cpp | 11 +++++ src/libcamera/camera_sensor.cpp | 49 ++++++++++++++++---- src/libcamera/pipeline/rkisp1/rkisp1.cpp | 3 ++ src/libcamera/pipeline/simple/simple.cpp | 3 ++ src/libcamera/pipeline/uvcvideo/uvcvideo.cpp | 3 ++ src/libcamera/v4l2_device.cpp | 37 +++++++++++++++ 8 files changed, 100 insertions(+), 10 deletions(-)