From patchwork Tue Jan 3 11:33:11 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: David Plowman X-Patchwork-Id: 18082 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 6D659C322E for ; Tue, 3 Jan 2023 11:33:19 +0000 (UTC) Received: from lancelot.ideasonboard.com (localhost [IPv6:::1]) by lancelot.ideasonboard.com (Postfix) with ESMTP id E9948625E2; Tue, 3 Jan 2023 12:33:18 +0100 (CET) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=libcamera.org; s=mail; t=1672745598; bh=+8UWCMaeZqIN4x0+69ttf4oxG+ZZqAjR7GthkkHxa+Y=; h=To:Date:Subject:List-Id:List-Unsubscribe:List-Archive:List-Post: List-Help:List-Subscribe:From:Reply-To:From; b=jDCkf5guTZrV/lT+e71/+1IlnY8j1ybkjhsXtYge+51QHoZK+GLgSmrnfpIMUkUfh x5pFtGinBfXBnBBT9p5jcvamISdiUdg0AF1Rgo1Xny0YdEJ9xnZALvkVfqauz7Fl1r Fqhl3wnWJvc3y1wvYrCga1c0lrmbxfIn3neCuS5/anHAcVVQqjNw8xFfNmVjb1fkvh Pn7zIe2S1ZZmCTwiHGmJPX4Hj7POmuayiWloHz9HMBXJQHnlYJ1XGg2ZF+4A/dRpAL kXQEREY4UCtQjhckVtPhOpPGcnan3RM8nqbD6jladsEEep5NSO7Y5QB9GOZy7uSNPY DqEXcXJojv75A== Received: from mail-wm1-x329.google.com (mail-wm1-x329.google.com [IPv6:2a00:1450:4864:20::329]) by lancelot.ideasonboard.com (Postfix) with ESMTPS id 1323061F0F for ; Tue, 3 Jan 2023 12:33:17 +0100 (CET) Authentication-Results: lancelot.ideasonboard.com; dkim=pass (2048-bit key; unprotected) header.d=raspberrypi.com header.i=@raspberrypi.com header.b="MSJmRRI+"; dkim-atps=neutral Received: by mail-wm1-x329.google.com with SMTP id p1-20020a05600c1d8100b003d8c9b191e0so22847387wms.4 for ; Tue, 03 Jan 2023 03:33:17 -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=dAEXDEqR8P/0noTEFm+AaIqvm0q6iUjHdzt3CYurMM4=; b=MSJmRRI+xVzVLB2wJs9K1FPm8oNa0Kmi+6tOeids7L5RmPaDeZZkgw5TaATWAS++Nr NgNDodYepot6U91IeijJWH6NBjX/sxuFO1gR2C18F6cKfhK1k2gm2E2lw4G/7HKKKoLd 48rlqfRnc6GpfOO5q3v9Rs75MljHKcfcavrLn4pw6FtXSX8zOpJiEvBrF/lIKLFaJu9u DDn7UflnC4Op1XlLamaI3Xh25Z2IYDmH4GeeHucVIzOwUwnFORSVYWV8nBOKtYZMxlf7 7ccmrohCiD3sytqaU7CnYwRnPxQEECpGBBlsYtLqUKqV25SouFXJ74+2iK09dvDGIh2X OhdQ== 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=dAEXDEqR8P/0noTEFm+AaIqvm0q6iUjHdzt3CYurMM4=; b=26OnERSVJigi1blENhmi48hPqIQ6gnl3MQrH0JQb38J/GnpX5TUt6AAIWw8B0/Bcz+ gLsnu9Xvao6SF5qVCpCiW8b3UJGTx5Wa6gp6sF48OP1WQ3FAWpeu6qBZhtT/U/s0Wbf5 aWsJZgV5B8H9gRrI5JdFcQ4xOxUmM4kSO6ttXOeuVpeMcO0MPRTt/wJQ0GnUq9NAEQOJ hnikqyR2sMC2lUd64OtRi1aHEQ1zXA8tIg3TaW8+WIKUTXN8Ua7BM3QIZA0RmBQszr1Z 43jihv+hISSquqng4h08bnmTDjLjPRJleaX5lWb3gZwEB9F2t2Xv3sBKwpEfYcs+5sp3 ZCZw== X-Gm-Message-State: AFqh2krIkxBpXf1+Mj8Kw3Xoz1LUU0xYTRMp3HfYWn2yPScZw27UCEui Uwf8stnsfuChGsNe0lvvZ/7FDB3oK0kR4qEm X-Google-Smtp-Source: AMrXdXvrr8CR1ybI5G9U42jrchJpcIXmsQev73/2B9kBBIzMmWKOZP6a+TWI18RFmhGUMnZJbw49hg== X-Received: by 2002:a05:600c:687:b0:3cf:e7c8:494 with SMTP id a7-20020a05600c068700b003cfe7c80494mr31121776wmn.29.1672745596450; Tue, 03 Jan 2023 03:33:16 -0800 (PST) Received: from pi4-davidp.pitowers.org ([2a00:1098:3142:14:e4a2:3070:eea4:e434]) by smtp.gmail.com with ESMTPSA id h10-20020a5d4fca000000b00281eab50380sm24325767wrw.117.2023.01.03.03.33.15 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Tue, 03 Jan 2023 03:33:16 -0800 (PST) To: libcamera-devel@lists.libcamera.org Date: Tue, 3 Jan 2023 11:33:11 +0000 Message-Id: <20230103113313.5423-1-david.plowman@raspberrypi.com> X-Mailer: git-send-email 2.30.2 MIME-Version: 1.0 Subject: [libcamera-devel] [PATCH v2 0/2] Fix colour spaces on Raspberry Pi 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 This is an alternative (and I think better, in many respects) version of my previous attempt to fix the broken colour spaces on the Raspberry Pi. I've side-stepped the issue of what to do about the base class version of validateColorSpaces and implemented a specific version for the Pi instead. There are just 2 commits now: The first commit is the same as before, I've fixed the "obvious" bug in CameraConfiguration::validateColorSpaces because it is just wrong. The other adjustments to that method (the 2nd patch in the previous version) have been dropped. The Pi is going to use a custom version (the remaining patch described below), so it's really up to the rkisp1 whether this function is still useful, or should be changed. I'm unconvinced that the idea of "sharing a colour space" makes much sense seeing as you can no longer do it when you have both YUV and RGB streams, so the whole thing seems more trouble that it's worth. Arguably, this flag and the associated functionality should perhaps be removed? I'd be interested to hear opinions on that. The final patch here implements a custom validateColorSpaces for the Pi. Creating a custom method makes it easier to understand the constraints we have and how I want this to work. We still have to be a bit careful to pass the right values to the device, and to interpret correctly what gets returned, depending on whether it was a YUV or RGB stream. Hope that makes sense! Thanks David David Plowman (2): libcamera: camera: fix validateColorSpaces to choose the correct "main" colour space pipeline: raspberrypi: Fix handling of colour spaces src/libcamera/camera.cpp | 6 +- .../pipeline/raspberrypi/raspberrypi.cpp | 99 ++++++++++++++++++- 2 files changed, 102 insertions(+), 3 deletions(-)