Patch Detail
Show a patch.
GET /api/patches/19395/?format=api
{ "id": 19395, "url": "https://patchwork.libcamera.org/api/patches/19395/?format=api", "web_url": "https://patchwork.libcamera.org/patch/19395/", "project": { "id": 1, "url": "https://patchwork.libcamera.org/api/projects/1/?format=api", "name": "libcamera", "link_name": "libcamera", "list_id": "libcamera_core", "list_email": "libcamera-devel@lists.libcamera.org", "web_url": "", "scm_url": "", "webscm_url": "" }, "msgid": "<20240113142218.28063-4-hdegoede@redhat.com>", "date": "2024-01-13T14:22:03", "name": "[libcamera-devel,v2,03/18] libcamera: dma_heaps: extend DmaHeap class to support system heap", "commit_ref": null, "pull_url": null, "state": "superseded", "archived": false, "hash": "e8ca4e8c315ccd5cc16d224800b767fe1acd8762", "submitter": { "id": 102, "url": "https://patchwork.libcamera.org/api/people/102/?format=api", "name": "Hans de Goede", "email": "hdegoede@redhat.com" }, "delegate": null, "mbox": "https://patchwork.libcamera.org/patch/19395/mbox/", "series": [ { "id": 4142, "url": "https://patchwork.libcamera.org/api/series/4142/?format=api", "web_url": "https://patchwork.libcamera.org/project/libcamera/list/?series=4142", "date": "2024-01-13T14:22:00", "name": "[libcamera-devel,v2,01/18] libcamera: pipeline: simple: fix size adjustment in validate()", "version": 2, "mbox": "https://patchwork.libcamera.org/series/4142/mbox/" } ], "comments": "https://patchwork.libcamera.org/api/patches/19395/comments/", "check": "pending", "checks": "https://patchwork.libcamera.org/api/patches/19395/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 65693C328C\n\tfor <parsemail@patchwork.libcamera.org>;\n\tSat, 13 Jan 2024 14:22:45 +0000 (UTC)", "from lancelot.ideasonboard.com (localhost [IPv6:::1])\n\tby lancelot.ideasonboard.com (Postfix) with ESMTP id 17F72628B7;\n\tSat, 13 Jan 2024 15:22:45 +0100 (CET)", "from us-smtp-delivery-124.mimecast.com\n\t(us-smtp-delivery-124.mimecast.com [170.10.133.124])\n\tby lancelot.ideasonboard.com (Postfix) with ESMTPS id 1D127628B7\n\tfor <libcamera-devel@lists.libcamera.org>;\n\tSat, 13 Jan 2024 15:22:42 +0100 (CET)", "from mimecast-mx02.redhat.com (mimecast-mx02.redhat.com\n\t[66.187.233.88]) by relay.mimecast.com with ESMTP with STARTTLS\n\t(version=TLSv1.3, cipher=TLS_AES_256_GCM_SHA384) id\n\tus-mta-640-QSHKST5RONi7KCRO2Ec7rw-1; Sat, 13 Jan 2024 09:22:34 -0500", "from smtp.corp.redhat.com\n\t(int-mx01.intmail.prod.int.rdu2.redhat.com [10.11.54.1])\n\t(using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits)\n\tkey-exchange X25519 server-signature RSA-PSS (2048 bits)\n\tserver-digest SHA256) (No client certificate requested)\n\tby mimecast-mx02.redhat.com (Postfix) with ESMTPS id 6714982A6C0;\n\tSat, 13 Jan 2024 14:22:33 +0000 (UTC)", "from localhost.localdomain (unknown [10.39.192.58])\n\tby smtp.corp.redhat.com (Postfix) with ESMTP id 57D823C25;\n\tSat, 13 Jan 2024 14:22:31 +0000 (UTC)" ], "DKIM-Signature": [ "v=1; a=rsa-sha256; c=relaxed/simple; d=libcamera.org;\n\ts=mail; t=1705155765;\n\tbh=qEK+s2Qrke44/RPeyE0f4TZVE7NY+YtoJdoGhkJlTu4=;\n\th=To:Date:In-Reply-To:References:Subject:List-Id:List-Unsubscribe:\n\tList-Archive:List-Post:List-Help:List-Subscribe:From:Reply-To:Cc:\n\tFrom;\n\tb=W5uCtlPTVuYEHPNJZi/Dsf7I4fz/OEZ9rm++tmpL2ylZqaB9jasaRp18oFy4OHvmd\n\tIrn3yGZBTK6jlHVHrGs14m8WWm2THzDS1LqhDXQbedTr2DGgucAixu528wUAKEstFn\n\tkPPxG4UJLnrXwiCSchdHC0SIxwXx1RIyhzzypfb2OUH6aAW21YahCrCbV4/V/I9VY1\n\tZ13QfD18oK13JI67h5mx83TTT2Hi72oh68ycEo/jTEgqFIQNS1S1ubHChH+lYOawKX\n\tmjmEms1TU/qrwqJlXsjBLnnJLSfHsoeAECI0OQ4VAJx/yavsmsRpSuqr8z6gtOmoDc\n\tERGHIbx9ZGLng==", "v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com;\n\ts=mimecast20190719; t=1705155761;\n\th=from:from:reply-to:subject:subject:date:date:message-id:message-id:\n\tto:to:cc:cc:mime-version:mime-version:content-type:content-type:\n\tcontent-transfer-encoding:content-transfer-encoding:\n\tin-reply-to:in-reply-to:references:references;\n\tbh=ZJXgz4PaVpQMdyy9EXG54yJisYoI7RdmKq6n90BOzkk=;\n\tb=S96MsB0uaaWSgSTTB4sjCq5dL64HhrpxiQeSeo6VuE75ItGfCEVWytKXNrZuReudtILfKC\n\tLBkeUJE/GYvJ8h00Pzim03JKQ6+yzHSm2QZT3OJqnJhFg3K4Q2Eo/yeNXitHpuylo7tWrW\n\tZ94YrwRQH/BMtd2TPUI8m8mG5za40mg=" ], "Authentication-Results": "lancelot.ideasonboard.com; dkim=pass (1024-bit key; \n\tunprotected) header.d=redhat.com\n\theader.i=@redhat.com header.b=\"S96MsB0u\"; \n\tdkim-atps=neutral", "X-MC-Unique": "QSHKST5RONi7KCRO2Ec7rw-1", "To": "libcamera-devel@lists.libcamera.org,\n\tAndrey Konovalov <andrey.konovalov.ynk@gmail.com>", "Date": "Sat, 13 Jan 2024 15:22:03 +0100", "Message-ID": "<20240113142218.28063-4-hdegoede@redhat.com>", "In-Reply-To": "<20240113142218.28063-1-hdegoede@redhat.com>", "References": "<20240113142218.28063-1-hdegoede@redhat.com>", "MIME-Version": "1.0", "X-Scanned-By": "MIMEDefang 3.4.1 on 10.11.54.1", "X-Mimecast-Spam-Score": "0", "X-Mimecast-Originator": "redhat.com", "Content-Transfer-Encoding": "8bit", "Content-Type": "text/plain; charset=\"US-ASCII\"; x-default=true", "Subject": "[libcamera-devel] [PATCH v2 03/18] libcamera: dma_heaps: extend\n\tDmaHeap class to support system heap", "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>", "From": "Hans de Goede via libcamera-devel <libcamera-devel@lists.libcamera.org>", "Reply-To": "Hans de Goede <hdegoede@redhat.com>", "Cc": "Maxime Ripard <mripard@redhat.com>, g.martti@gmail.com,\n\tt.langendam@gmail.com, srinivas.kandagatla@linaro.org,\n\tPavel Machek <pavel@ucw.cz>,\n\tBryan O'Donoghue <bryan.odonoghue@linaro.org>, admin@dennisbonke.com", "Errors-To": "libcamera-devel-bounces@lists.libcamera.org", "Sender": "\"libcamera-devel\" <libcamera-devel-bounces@lists.libcamera.org>" }, "content": "From: Andrey Konovalov <andrey.konovalov@linaro.org>\n\nAdd an argument to the constructor to specify dma heaps type(s)\nto use. Can be DmaHeapFlag::Cma and/or DmaHeapFlag::System.\nBy default DmaHeapFlag::Cma is used. If both DmaHeapFlag::Cma and\nDmaHeapFlag::System are set, CMA heap is tried first.\n\nSigned-off-by: Andrey Konovalov <andrey.konovalov@linaro.org>\nSigned-off-by: Hans de Goede <hdegoede@redhat.com>\nTested-by: Bryan O'Donoghue <bryan.odonoghue@linaro.org> # sc8280xp Lenovo x13s\nTested-by: Pavel Machek <pavel@ucw.cz>\n---\n include/libcamera/internal/dma_heaps.h | 12 +++++++-\n src/libcamera/dma_heaps.cpp | 39 +++++++++++++++-----------\n 2 files changed, 34 insertions(+), 17 deletions(-)", "diff": "diff --git a/include/libcamera/internal/dma_heaps.h b/include/libcamera/internal/dma_heaps.h\nindex cff8f140..22aa1007 100644\n--- a/include/libcamera/internal/dma_heaps.h\n+++ b/include/libcamera/internal/dma_heaps.h\n@@ -9,6 +9,7 @@\n \n #include <stddef.h>\n \n+#include <libcamera/base/flags.h>\n #include <libcamera/base/unique_fd.h>\n \n namespace libcamera {\n@@ -16,7 +17,14 @@ namespace libcamera {\n class DmaHeap\n {\n public:\n-\tDmaHeap();\n+\tenum class DmaHeapFlag {\n+\t\tCma = (1 << 0),\n+\t\tSystem = (1 << 1),\n+\t};\n+\n+\tusing DmaHeapFlags = Flags<DmaHeapFlag>;\n+\n+\tDmaHeap(DmaHeapFlags flags = DmaHeapFlag::Cma);\n \t~DmaHeap();\n \tbool isValid() const { return dmaHeapHandle_.isValid(); }\n \tUniqueFD alloc(const char *name, std::size_t size);\n@@ -25,4 +33,6 @@ private:\n \tUniqueFD dmaHeapHandle_;\n };\n \n+LIBCAMERA_FLAGS_ENABLE_OPERATORS(DmaHeap::DmaHeapFlag)\n+\n } /* namespace libcamera */\ndiff --git a/src/libcamera/dma_heaps.cpp b/src/libcamera/dma_heaps.cpp\nindex 7444d9c2..177de31b 100644\n--- a/src/libcamera/dma_heaps.cpp\n+++ b/src/libcamera/dma_heaps.cpp\n@@ -16,6 +16,8 @@\n \n #include \"libcamera/internal/dma_heaps.h\"\n \n+namespace libcamera {\n+\n /*\n * /dev/dma-heap/linux,cma is the dma-heap allocator, which allows dmaheap-cma\n * to only have to worry about importing.\n@@ -23,28 +25,33 @@\n * Annoyingly, should the cma heap size be specified on the kernel command line\n * instead of DT, the heap gets named \"reserved\" instead.\n */\n-static constexpr std::array<const char *, 2> heapNames = {\n-\t\"/dev/dma_heap/linux,cma\",\n-\t\"/dev/dma_heap/reserved\"\n+static constexpr std::array<std::pair<DmaHeap::DmaHeapFlag, const char *>, 3> heapNames = {\n+\t/* CMA heap names first */\n+\tstd::make_pair(DmaHeap::DmaHeapFlag::Cma, \"/dev/dma_heap/linux,cma\"),\n+\tstd::make_pair(DmaHeap::DmaHeapFlag::Cma, \"/dev/dma_heap/reserved\"),\n+\tstd::make_pair(DmaHeap::DmaHeapFlag::System, \"/dev/dma_heap/system\")\n };\n \n-namespace libcamera {\n-\n LOG_DEFINE_CATEGORY(DmaHeap)\n \n-DmaHeap::DmaHeap()\n+DmaHeap::DmaHeap(DmaHeapFlags flags)\n {\n-\tfor (const char *name : heapNames) {\n-\t\tint ret = ::open(name, O_RDWR | O_CLOEXEC, 0);\n-\t\tif (ret < 0) {\n-\t\t\tret = errno;\n-\t\t\tLOG(DmaHeap, Debug) << \"Failed to open \" << name << \": \"\n-\t\t\t\t\t<< strerror(ret);\n-\t\t\tcontinue;\n-\t\t}\n+\tint ret;\n \n-\t\tdmaHeapHandle_ = UniqueFD(ret);\n-\t\tbreak;\n+\tfor (const auto &name : heapNames) {\n+\t\tif (flags & name.first) {\n+\t\t\tret = ::open(name.second, O_RDWR | O_CLOEXEC, 0);\n+\t\t\tif (ret < 0) {\n+\t\t\t\tret = errno;\n+\t\t\t\tLOG(DmaHeap, Debug) << \"Failed to open \" << name.second << \": \"\n+\t\t\t\t\t\t << strerror(ret);\n+\t\t\t\tcontinue;\n+\t\t\t}\n+\n+\t\t\tLOG(DmaHeap, Debug) << \"Using \" << name.second;\n+\t\t\tdmaHeapHandle_ = UniqueFD(ret);\n+\t\t\tbreak;\n+\t\t}\n \t}\n \n \tif (!dmaHeapHandle_.isValid())\n", "prefixes": [ "libcamera-devel", "v2", "03/18" ] }