From patchwork Tue Mar 28 09:55:31 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Harvey Yang X-Patchwork-Id: 18485 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 7E493C0F2A for ; Tue, 28 Mar 2023 09:55:41 +0000 (UTC) Received: from lancelot.ideasonboard.com (localhost [IPv6:::1]) by lancelot.ideasonboard.com (Postfix) with ESMTP id 7B24962744; Tue, 28 Mar 2023 11:55:40 +0200 (CEST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=libcamera.org; s=mail; t=1679997340; bh=dWZy1QzNnKEGzsMgUtjF1fj3XmL8AzersFqKrME4ZyA=; h=To:Date:Subject:List-Id:List-Unsubscribe:List-Archive:List-Post: List-Help:List-Subscribe:From:Reply-To:Cc:From; b=mMvgHvynwGjozfp6KS6NdA1YfARcYQRKzSjDacJZSok2PPqQXJzZSfsMKX7heO5bF DAM4DSrh9rkcIZAuDatfikFwxt+IlOMOvcKyXfMv2v4MynXCyvh4TYSqm3RNq/VOc7 bolvVERI0szSzQrZZ2Qqzi9kXcyUjOn6WljTviqb0UcLL9ZC9+OJPvGKDXt1c1HC4U BpYVpCyJoCwQ+ypPlysTEU0KyNKoY8u9+8DPwgujkSr7/inODf0qU3bkT2aSc16qtG +7cxCvjUJZfgMO8OLsElLWnCykLKU2F4QvE7/sHVhVFjLqReTaOQMgKhYyL/gIUVCU oGriS4X38YiSQ== Received: from mail-pj1-x1032.google.com (mail-pj1-x1032.google.com [IPv6:2607:f8b0:4864:20::1032]) by lancelot.ideasonboard.com (Postfix) with ESMTPS id E209A626E2 for ; Tue, 28 Mar 2023 11:55:38 +0200 (CEST) Authentication-Results: lancelot.ideasonboard.com; dkim=pass (1024-bit key; unprotected) header.d=chromium.org header.i=@chromium.org header.b="dPDeBS8c"; dkim-atps=neutral Received: by mail-pj1-x1032.google.com with SMTP id gp15-20020a17090adf0f00b0023d1bbd9f9eso14609506pjb.0 for ; Tue, 28 Mar 2023 02:55:38 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=chromium.org; s=google; t=1679997337; h=content-transfer-encoding:mime-version:message-id:date:subject:cc :to:from:from:to:cc:subject:date:message-id:reply-to; bh=JxjpvmCEvNsogn7qVqi7DrB5hRP7I81eTCnegLWe9gc=; b=dPDeBS8c8cqfmfxVwXz7yK1XkPnMPu/NqyQUlqE7GH5QkxUVu54E3TVC79HoLSECI4 lwsZ14gFgIH6+SdJLn1uTkkojg7SAK5GqNRKVDFURTrnJvU8+YdzdIAfi17H10sJzhTW 4gshjKKPVb5pt4/8eAMBYSf93/aMbvhuo3/ls= X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; t=1679997337; 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=JxjpvmCEvNsogn7qVqi7DrB5hRP7I81eTCnegLWe9gc=; b=NY7gHohMl03T3la6v0dpR73Qh+LIUlkAlfhEO8oB6wMtc/pz7o1ySmqgDQ5ingiLvQ DyXpaNzRvAYuhEEzK9LB3yB/1V2eyxTELj9U1Et/NTPju565KYJfWSd/iQFv43/6CxiZ o7Vg5wWcWSpv4zMjz8UzdXiWpyONEt4/s40V65MuJRfvyIDfdPV7lf2rUMK2/xm5cvop mE+hVxk5NV3MoReBKh6A2GTyUsJpBiu1hUnkJqPMf+MF7xsPgHA0U8gw0CBhB8LTkq5R MXgo8dzZhHUih5lHK3NCfjoNjwto28e6KsAFlX2f8PGp9O2By3EWZd2L1FZoE8dNa8cb xBJQ== X-Gm-Message-State: AO0yUKXNqeF47CCe7vRelSk4MI6U+Ur+f9Gze+AfNuWdsh+rvf5n4eQ6 pGjWIoYpJLOw4LcQoN+7o6mJugpy0IaXHgMDIsL44g== X-Google-Smtp-Source: AK7set92JCaa9O/ERl8pUuKTWxGheQcTEwvWy67Pag17/Nk+luNN6v9LdbymQdPVcGmRpJzqOhs2DA== X-Received: by 2002:a05:6a20:c50f:b0:dd:bf6a:4609 with SMTP id gm15-20020a056a20c50f00b000ddbf6a4609mr13505677pzb.49.1679997337250; Tue, 28 Mar 2023 02:55:37 -0700 (PDT) Received: from harveyyang.localdomain (1-163-26-93.dynamic-ip.hinet.net. [1.163.26.93]) by smtp.gmail.com with ESMTPSA id v21-20020aa78515000000b006259beddb63sm20241488pfn.44.2023.03.28.02.55.36 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Tue, 28 Mar 2023 02:55:36 -0700 (PDT) X-Google-Original-From: Harvey Yang To: libcamera-devel@lists.libcamera.org Date: Tue, 28 Mar 2023 17:55:31 +0800 Message-Id: <20230328095534.3584-1-harveyycyang@gmail.com> X-Mailer: git-send-email 2.40.0 MIME-Version: 1.0 Subject: [libcamera-devel] [PATCH v4 0/3] Add HeapAllocator 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: Harvey Yang via libcamera-devel From: Harvey Yang Reply-To: Harvey Yang Cc: Harvey Yang Errors-To: libcamera-devel-bounces@lists.libcamera.org Sender: "libcamera-devel" Hi all, The series of patches added HeapAllocator, which uses DmaHeap (moved from Raspberry Pi pipeline handler) and UdmaHeap to allocate heap buffers. I've updated and tested it on my virtual pipeline handler. HeapAllocator creates buffer as a direct multiple of the page size, and create planes according to the stream configuration. I think the patch is ready to be reviewed. Please take a look, thanks! BR, Harvey Cheng-Hao Yang (3): libcamera: Move DmaHeap to HeapAllocator as a base class libcamera: Add UdmaHeap if DmaHeap is not valid libcamera: Add exportFrameBuffers in HeapAllocator include/libcamera/dma_heap.h | 20 +++ include/libcamera/heap.h | 27 ++++ include/libcamera/heap_allocator.h | 41 ++++++ include/libcamera/meson.build | 4 + include/libcamera/udma_heap.h | 20 +++ .../dma_heaps.cpp => dma_heap.cpp} | 35 +++--- src/libcamera/heap_allocator.cpp | 102 +++++++++++++++ src/libcamera/meson.build | 3 + .../pipeline/raspberrypi/dma_heaps.h | 32 ----- .../pipeline/raspberrypi/meson.build | 1 - .../pipeline/raspberrypi/raspberrypi.cpp | 10 +- src/libcamera/udma_heap.cpp | 117 ++++++++++++++++++ 12 files changed, 355 insertions(+), 57 deletions(-) create mode 100644 include/libcamera/dma_heap.h create mode 100644 include/libcamera/heap.h create mode 100644 include/libcamera/heap_allocator.h create mode 100644 include/libcamera/udma_heap.h rename src/libcamera/{pipeline/raspberrypi/dma_heaps.cpp => dma_heap.cpp} (69%) create mode 100644 src/libcamera/heap_allocator.cpp delete mode 100644 src/libcamera/pipeline/raspberrypi/dma_heaps.h create mode 100644 src/libcamera/udma_heap.cpp