{"id":13592,"url":"https://patchwork.libcamera.org/api/1.1/patches/13592/?format=json","web_url":"https://patchwork.libcamera.org/patch/13592/","project":{"id":1,"url":"https://patchwork.libcamera.org/api/1.1/projects/1/?format=json","name":"libcamera","link_name":"libcamera","list_id":"libcamera_core","list_email":"libcamera-devel@lists.libcamera.org","web_url":"","scm_url":"","webscm_url":""},"msgid":"<20210901080302.68525-3-hiroh@chromium.org>","date":"2021-09-01T08:03:02","name":"[libcamera-devel,v4,3/3] android: camera_device: Configure one stream for identical stream requests","commit_ref":null,"pull_url":null,"state":"accepted","archived":false,"hash":"9296ab7415c13f4353e3257323f2641e251ca13f","submitter":{"id":63,"url":"https://patchwork.libcamera.org/api/1.1/people/63/?format=json","name":"Hirokazu Honda","email":"hiroh@chromium.org"},"delegate":null,"mbox":"https://patchwork.libcamera.org/patch/13592/mbox/","series":[{"id":2432,"url":"https://patchwork.libcamera.org/api/1.1/series/2432/?format=json","web_url":"https://patchwork.libcamera.org/project/libcamera/list/?series=2432","date":"2021-09-01T08:03:00","name":"[libcamera-devel,v4,1/3] android: camera_stream: Create post processor in configure()","version":4,"mbox":"https://patchwork.libcamera.org/series/2432/mbox/"}],"comments":"https://patchwork.libcamera.org/api/patches/13592/comments/","check":"pending","checks":"https://patchwork.libcamera.org/api/patches/13592/checks/","tags":{},"headers":{"Return-Path":"<libcamera-devel-bounces@lists.libcamera.org>","X-Original-To":"parsemail@patchwork.libcamera.org","Delivered-To":"parsemail@patchwork.libcamera.org","Received":["from lancelot.ideasonboard.com (lancelot.ideasonboard.com\n\t[92.243.16.209])\n\tby patchwork.libcamera.org (Postfix) with ESMTPS id 7300FBD87D\n\tfor <parsemail@patchwork.libcamera.org>;\n\tWed,  1 Sep 2021 08:03:16 +0000 (UTC)","from lancelot.ideasonboard.com (localhost [IPv6:::1])\n\tby lancelot.ideasonboard.com (Postfix) with ESMTP id 3AF5869168;\n\tWed,  1 Sep 2021 10:03:16 +0200 (CEST)","from mail-pj1-x1029.google.com (mail-pj1-x1029.google.com\n\t[IPv6:2607:f8b0:4864:20::1029])\n\tby lancelot.ideasonboard.com (Postfix) with ESMTPS id CD42D6916E\n\tfor <libcamera-devel@lists.libcamera.org>;\n\tWed,  1 Sep 2021 10:03:13 +0200 (CEST)","by mail-pj1-x1029.google.com with SMTP id\n\tot2-20020a17090b3b4200b0019127f8ed87so3600629pjb.1\n\tfor <libcamera-devel@lists.libcamera.org>;\n\tWed, 01 Sep 2021 01:03:13 -0700 (PDT)","from hiroh2.tok.corp.google.com\n\t([2401:fa00:8f:203:af31:7c67:f02a:bccc])\n\tby smtp.gmail.com with ESMTPSA id\n\tn15sm20487092pff.149.2021.09.01.01.03.10\n\t(version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256);\n\tWed, 01 Sep 2021 01:03:11 -0700 (PDT)"],"Authentication-Results":"lancelot.ideasonboard.com;\n\tdkim=fail reason=\"signature verification failed\" (1024-bit key;\n\tunprotected) header.d=chromium.org header.i=@chromium.org\n\theader.b=\"OdvJp5TU\"; dkim-atps=neutral","DKIM-Signature":"v=1; a=rsa-sha256; c=relaxed/relaxed; d=chromium.org;\n\ts=google; \n\th=from:to:cc:subject:date:message-id:in-reply-to:references\n\t:mime-version:content-transfer-encoding;\n\tbh=163iNKmkPLmRLJvUl/VhxyT4wAkZR03NjKv/9xsqY4Q=;\n\tb=OdvJp5TUrHc9jPH6XLhy1Tr14SkUwOg1O3eR1ZBVG4iRxrqcXrjUz27YPgN+9X27BL\n\tqTvKuebMzHDqFEnzk3/B4Fbc81QPUGLRVUVDU1VInYs83wE0NQ1rWBByMkzeZWUDMhIJ\n\tEM9u66cYqAfzT1zHQ+1KjBhDwQD7RE5pK4iNU=","X-Google-DKIM-Signature":"v=1; a=rsa-sha256; c=relaxed/relaxed;\n\td=1e100.net; s=20161025;\n\th=x-gm-message-state:from:to:cc:subject:date:message-id:in-reply-to\n\t:references:mime-version:content-transfer-encoding;\n\tbh=163iNKmkPLmRLJvUl/VhxyT4wAkZR03NjKv/9xsqY4Q=;\n\tb=uLe6v2U9K0AMgOxDtQd5jy5H1Z5z3W84IEzmG1et0Ez0DMYaDR6gsjV0AUEihKdTGn\n\tyjmQ14BYVTPPEeHQHwhaNhjlyNsIMxuk4u2fb/dtwAzZILFlRkDKMJmokGdKAYvCsVQE\n\t5KGnQ9SPCOeSeLG6leeJbPSXRv4Iuls1kpKLh/oZR4pqzePybXrw0FEOtToi/jGnvL7y\n\t1nacEE/VQsTt5me3O2WP3eeD64h7TMmxXU+1BSC+Mi8JTt0ET+pQFKB3troxoBtCtk4E\n\tnmVCAddsIFm4qTYpnr3ksmEJTRypw1FRfQ8cpuZW4GeziyzB6fFhgG75pcYudKi1bHau\n\tLy6Q==","X-Gm-Message-State":"AOAM532SbfvWYYh7ljllkoLx+KsxwqX5JpW8gvK3oV3uLbP39j3p7kG/\n\t2fZ8o49AlowRTEme0Zeew0e+MGdJn34Log==","X-Google-Smtp-Source":"ABdhPJxxjhitWOmpCbB6sbCdY/qaN/SgurZrFxHGdrC5GfKlUbFtAVq7rscL+HzWV3OyCbxY3LBNyg==","X-Received":"by 2002:a17:90a:aa17:: with SMTP id\n\tk23mr10386473pjq.47.1630483392169; \n\tWed, 01 Sep 2021 01:03:12 -0700 (PDT)","From":"Hirokazu Honda <hiroh@chromium.org>","To":"libcamera-devel@lists.libcamera.org","Date":"Wed,  1 Sep 2021 17:03:02 +0900","Message-Id":"<20210901080302.68525-3-hiroh@chromium.org>","X-Mailer":"git-send-email 2.33.0.259.gc128427fd7-goog","In-Reply-To":"<20210901080302.68525-1-hiroh@chromium.org>","References":"<20210901080302.68525-1-hiroh@chromium.org>","MIME-Version":"1.0","Content-Transfer-Encoding":"8bit","Subject":"[libcamera-devel] [PATCH v4 3/3] android: camera_device: Configure\n\tone stream for identical stream requests","X-BeenThere":"libcamera-devel@lists.libcamera.org","X-Mailman-Version":"2.1.29","Precedence":"list","List-Id":"<libcamera-devel.lists.libcamera.org>","List-Unsubscribe":"<https://lists.libcamera.org/options/libcamera-devel>,\n\t<mailto:libcamera-devel-request@lists.libcamera.org?subject=unsubscribe>","List-Archive":"<https://lists.libcamera.org/pipermail/libcamera-devel/>","List-Post":"<mailto:libcamera-devel@lists.libcamera.org>","List-Help":"<mailto:libcamera-devel-request@lists.libcamera.org?subject=help>","List-Subscribe":"<https://lists.libcamera.org/listinfo/libcamera-devel>,\n\t<mailto:libcamera-devel-request@lists.libcamera.org?subject=subscribe>","Errors-To":"libcamera-devel-bounces@lists.libcamera.org","Sender":"\"libcamera-devel\" <libcamera-devel-bounces@lists.libcamera.org>"},"content":"An Android HAL client may request identical stream requests. It is\nredundant that a native camera device produces a separate stream for\neach of the identical requests.\nConfigure camera one stream configuration for the identical stream\nrequests.\n\nSigned-off-by: Hirokazu Honda <hiroh@chromium.org>\nReviewed-by: Jacopo Mondi <jacopo@jmondi.org>\n---\n src/android/camera_device.cpp | 28 +++++++++++++++++++++++++++-\n 1 file changed, 27 insertions(+), 1 deletion(-)","diff":"diff --git a/src/android/camera_device.cpp b/src/android/camera_device.cpp\nindex 324b997f..51d5370e 100644\n--- a/src/android/camera_device.cpp\n+++ b/src/android/camera_device.cpp\n@@ -618,12 +618,38 @@ int CameraDevice::configureStreams(camera3_stream_configuration_t *stream_list)\n \t\t\tcontinue;\n \t\t}\n \n+\t\t/*\n+\t\t * Always add GRALLOC_USAGE_HW_CAMERA_WRITE to the usage on\n+\t\t * ChromeOS because cros::CameraBufferManager imports the stream\n+\t\t * buffer with the usage.\n+\t\t */\n+#if defined(OS_CHROMEOS)\n+\t\tstream->usage |= GRALLOC_USAGE_HW_CAMERA_WRITE;\n+#endif\n+\n+\t\t/*\n+\t\t * If a CameraStream with the same size and format of the\n+\t\t * current stream has already been requested, associate the two.\n+\t\t */\n+\t\tauto iter = std::find_if(\n+\t\t\tstreamConfigs.begin(), streamConfigs.end(),\n+\t\t\t[size, format](const Camera3StreamConfig &streamConfig) {\n+\t\t\t\treturn streamConfig.config.size == size &&\n+\t\t\t\t       streamConfig.config.pixelFormat == format;\n+\t\t\t});\n+\t\tif (iter != streamConfigs.end()) {\n+\t\t\t/* Add usage to copy the buffer in streams[0] to stream. */\n+\t\t\titer->streams[0].stream->usage |= GRALLOC_USAGE_SW_READ_OFTEN;\n+\t\t\tstream->usage |= GRALLOC_USAGE_SW_WRITE_OFTEN;\n+\t\t\titer->streams.push_back({ stream, CameraStream::Type::Mapped });\n+\t\t\tcontinue;\n+\t\t}\n+\n \t\tCamera3StreamConfig streamConfig;\n \t\tstreamConfig.streams = { { stream, CameraStream::Type::Direct } };\n \t\tstreamConfig.config.size = size;\n \t\tstreamConfig.config.pixelFormat = format;\n \t\tstreamConfigs.push_back(std::move(streamConfig));\n-\n \t\t/* This stream will be produced by hardware. */\n \t\tstream->usage |= GRALLOC_USAGE_HW_CAMERA_WRITE;\n \t}\n","prefixes":["libcamera-devel","v4","3/3"]}