{"id":11966,"url":"https://patchwork.libcamera.org/api/1.1/patches/11966/?format=json","web_url":"https://patchwork.libcamera.org/patch/11966/","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":"<20210416134347.2881373-1-hiroh@chromium.org>","date":"2021-04-16T13:43:46","name":"[libcamera-devel,v4,1/2] android: CameraBuffer: Add a static function to check a buffer validness","commit_ref":null,"pull_url":null,"state":"rejected","archived":false,"hash":"470aa4df5d4aa97d0ad2066681b2cd0673f30ee4","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/11966/mbox/","series":[{"id":1940,"url":"https://patchwork.libcamera.org/api/1.1/series/1940/?format=json","web_url":"https://patchwork.libcamera.org/project/libcamera/list/?series=1940","date":"2021-04-16T13:43:46","name":"[libcamera-devel,v4,1/2] android: CameraBuffer: Add a static function to check a buffer validness","version":4,"mbox":"https://patchwork.libcamera.org/series/1940/mbox/"}],"comments":"https://patchwork.libcamera.org/api/patches/11966/comments/","check":"pending","checks":"https://patchwork.libcamera.org/api/patches/11966/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 2DF23BD236\n\tfor <parsemail@patchwork.libcamera.org>;\n\tFri, 16 Apr 2021 13:43:56 +0000 (UTC)","from lancelot.ideasonboard.com (localhost [IPv6:::1])\n\tby lancelot.ideasonboard.com (Postfix) with ESMTP id DE3296880C;\n\tFri, 16 Apr 2021 15:43:55 +0200 (CEST)","from mail-pl1-x632.google.com (mail-pl1-x632.google.com\n\t[IPv6:2607:f8b0:4864:20::632])\n\tby lancelot.ideasonboard.com (Postfix) with ESMTPS id D445668806\n\tfor <libcamera-devel@lists.libcamera.org>;\n\tFri, 16 Apr 2021 15:43:54 +0200 (CEST)","by mail-pl1-x632.google.com with SMTP id d8so13991620plh.11\n\tfor <libcamera-devel@lists.libcamera.org>;\n\tFri, 16 Apr 2021 06:43:54 -0700 (PDT)","from hiroh2.tok.corp.google.com\n\t([2401:fa00:8f:2:8518:74e8:412c:f22f])\n\tby smtp.gmail.com with ESMTPSA id\n\tms9sm6175606pjb.32.2021.04.16.06.43.51\n\t(version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256);\n\tFri, 16 Apr 2021 06:43:52 -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=\"dsQDxwTT\"; dkim-atps=neutral","DKIM-Signature":"v=1; a=rsa-sha256; c=relaxed/relaxed; d=chromium.org;\n\ts=google; h=from:to:cc:subject:date:message-id:mime-version\n\t:content-transfer-encoding;\n\tbh=IgHqUHcFx00U6vCUcgwUA1DSzfEZYqfcl1XNPvqalnk=;\n\tb=dsQDxwTTsWELeIR4om3ue+CyKchzrCCuWSCsBDPzaDswc/+SyznmkhX9mfvlcN05oy\n\tBWKcUTZ42/rh9IHOe4gA7dq5aCfiwIjlGdvGhox7mm1ee97qei9ACB2nyHy8tUwPMti+\n\ts1NXh4Y7BZlZTwwN6bYqDpgfAWJo4/4MGbW0U=","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:mime-version\n\t:content-transfer-encoding;\n\tbh=IgHqUHcFx00U6vCUcgwUA1DSzfEZYqfcl1XNPvqalnk=;\n\tb=R+8m0mzpM1lTcUgv1aSpMtXvNvSmTTQbLPR/5Abd5k6h4XnebJh+bW4dyc1rtCAW8d\n\tdUFNJ76VQPF4RpW471AvGSplqFy1nY1wJGJWXyZYVo+B9T+rAKPsouzH32gb2haBuUgF\n\ttlTVj/0IuciLlLZ9b90yjms8lLl1OTSww53XBmVmjJwDaCppzNLzBGcwXN1m1bMfHefd\n\tyyQId1DGGfNsTCVf+qitSqsIpN+hCZAPM25RfW1mLrsV20iBKsYSmEyJ3ek2Q6dCoJeh\n\tVj0w7ipDIx7BQ6eEcSW6v01hlsInjhZQzv8M8qokgMEAYHxKf9pqs4Xu/23B6nTP4Pf7\n\tcFZg==","X-Gm-Message-State":"AOAM531wA40SZ4w7P00qab3V1X7C2ssuCZv11jbsWZHBUZJ4GEJmScxP\n\tDa+lqrGvzQV+w+j/x2aq4KQIV9bpox37tQ==","X-Google-Smtp-Source":"ABdhPJw1w8AO3cWhiUOB4tcubSP07Z09wO6n68nSs2sDnEC33BAkOGcaW2XBFes0Tyx1iH3YJvZ4Aw==","X-Received":"by 2002:a17:90a:7566:: with SMTP id\n\tq93mr9676034pjk.103.1618580632974; \n\tFri, 16 Apr 2021 06:43:52 -0700 (PDT)","From":"Hirokazu Honda <hiroh@chromium.org>","To":"libcamera-devel@lists.libcamera.org","Date":"Fri, 16 Apr 2021 22:43:46 +0900","Message-Id":"<20210416134347.2881373-1-hiroh@chromium.org>","X-Mailer":"git-send-email 2.31.1.368.gbe11c130af-goog","MIME-Version":"1.0","Subject":"[libcamera-devel] [PATCH v4 1/2] android: CameraBuffer: Add a\n\tstatic function to check a buffer validness","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>","Content-Type":"text/plain; charset=\"us-ascii\"","Content-Transfer-Encoding":"7bit","Errors-To":"libcamera-devel-bounces@lists.libcamera.org","Sender":"\"libcamera-devel\" <libcamera-devel-bounces@lists.libcamera.org>"},"content":"This adds a static function to CameraBuffer class that checks if\na buffer_handle is valid with a platform dependent framework.\nFor example, the function validates a buffer using\ncros::CameraBufferManager on ChromeOS.\n\nSigned-off-by: Hirokazu Honda <hiroh@chromium.org>\nReviewed-by: Jacopo Mondi <jacopo@jmondi.org>\n---\n src/android/camera_buffer.h              | 6 ++++++\n src/android/mm/cros_camera_buffer.cpp    | 8 ++++++++\n src/android/mm/generic_camera_buffer.cpp | 9 +++++++++\n 3 files changed, 23 insertions(+)","diff":"diff --git a/src/android/camera_buffer.h b/src/android/camera_buffer.h\nindex 7e8970b4..21785a7e 100644\n--- a/src/android/camera_buffer.h\n+++ b/src/android/camera_buffer.h\n@@ -20,6 +20,8 @@ public:\n \tCameraBuffer(buffer_handle_t camera3Buffer, int flags);\n \t~CameraBuffer();\n \n+\tstatic bool isValidBuffer(buffer_handle_t camera3Buffer);\n+\n \tbool isValid() const;\n \n \tunsigned int numPlanes() const;\n@@ -38,6 +40,10 @@ CameraBuffer::CameraBuffer(buffer_handle_t camera3Buffer, int flags)\t\\\n CameraBuffer::~CameraBuffer()\t\t\t\t\t\t\\\n {\t\t\t\t\t\t\t\t\t\\\n }\t\t\t\t\t\t\t\t\t\\\n+bool CameraBuffer::isValidBuffer(buffer_handle_t buffer)\t\t\\\n+{\t\t\t\t\t\t\t\t\t\\\n+\treturn Private::isValidBuffer(buffer);\t\t\t\t\\\n+}\t\t\t\t\t\t\t\t\t\\\n bool CameraBuffer::isValid() const\t\t\t\t\t\\\n {\t\t\t\t\t\t\t\t\t\\\n \tconst Private *const d = LIBCAMERA_D_PTR();\t\t\t\\\ndiff --git a/src/android/mm/cros_camera_buffer.cpp b/src/android/mm/cros_camera_buffer.cpp\nindex 1a4fd5d1..f06e8511 100644\n--- a/src/android/mm/cros_camera_buffer.cpp\n+++ b/src/android/mm/cros_camera_buffer.cpp\n@@ -24,6 +24,8 @@ public:\n \t\tbuffer_handle_t camera3Buffer, int flags);\n \t~Private();\n \n+\tstatic bool isValidBuffer(buffer_handle_t camera3Buffer);\n+\n \tbool isValid() const { return valid_; }\n \n \tunsigned int numPlanes() const;\n@@ -133,4 +135,10 @@ size_t CameraBuffer::Private::jpegBufferSize(size_t maxJpegBufferSize) const\n \treturn bufferManager_->GetPlaneSize(handle_, 0);\n }\n \n+/* static */\n+bool CameraBuffer::Private::isValidBuffer(buffer_handle_t camera3Buffer)\n+{\n+\treturn cros::CameraBufferManager::IsValidBuffer(camera3Buffer);\n+}\n+\n PUBLIC_CAMERA_BUFFER_IMPLEMENTATION\ndiff --git a/src/android/mm/generic_camera_buffer.cpp b/src/android/mm/generic_camera_buffer.cpp\nindex 929e078a..07a07372 100644\n--- a/src/android/mm/generic_camera_buffer.cpp\n+++ b/src/android/mm/generic_camera_buffer.cpp\n@@ -24,6 +24,8 @@ public:\n \t\tbuffer_handle_t camera3Buffer, int flags);\n \t~Private();\n \n+\tstatic bool isValidBuffer(buffer_handle_t camera3Buffer);\n+\n \tunsigned int numPlanes() const;\n \n \tSpan<uint8_t> plane(unsigned int plane);\n@@ -85,4 +87,11 @@ size_t CameraBuffer::Private::jpegBufferSize(size_t maxJpegBufferSize) const\n \t\t\t\t      maxJpegBufferSize);\n }\n \n+/* static */\n+bool CameraBuffer::Private::isValidBuffer(\n+\t[[maybe_unused]] buffer_handle_t camera3Buffer)\n+{\n+\treturn true;\n+}\n+\n PUBLIC_CAMERA_BUFFER_IMPLEMENTATION\n","prefixes":["libcamera-devel","v4","1/2"]}