From patchwork Tue Apr 22 21:58:54 2025 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Bryan O'Donoghue X-Patchwork-Id: 23214 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 1D2B4C327D for ; Tue, 22 Apr 2025 21:59:29 +0000 (UTC) Received: from lancelot.ideasonboard.com (localhost [IPv6:::1]) by lancelot.ideasonboard.com (Postfix) with ESMTP id CD0A868AD0; Tue, 22 Apr 2025 23:59:26 +0200 (CEST) Authentication-Results: lancelot.ideasonboard.com; dkim=pass (2048-bit key; unprotected) header.d=linaro.org header.i=@linaro.org header.b="Sx8+ob8N"; dkim-atps=neutral Received: from mail-wm1-x333.google.com (mail-wm1-x333.google.com [IPv6:2a00:1450:4864:20::333]) by lancelot.ideasonboard.com (Postfix) with ESMTPS id 4CEF3617E3 for ; Tue, 22 Apr 2025 23:59:24 +0200 (CEST) Received: by mail-wm1-x333.google.com with SMTP id 5b1f17b1804b1-43ed8d32a95so49910485e9.3 for ; Tue, 22 Apr 2025 14:59:24 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; t=1745359164; x=1745963964; darn=lists.libcamera.org; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:from:to:cc:subject:date :message-id:reply-to; bh=O/XNpCvNvuFewDwxBLgujn8Rp4YOl/7WSgH2ZliwlXs=; b=Sx8+ob8NQgRClu5pLeJom2KzwKkMMcCz5k++jeaY5EomBDmE30PST3nMNZ1+pdixU9 vnbDe83KE0fh5dCw7yMqkYaN2HoVuAkrvH8Rv78hdM1iwgIhm2UlxU2yrJ5u3OUvQl8K gQ9FlamD662PY/F6TxYwv8Q27mCf9yWxhWKPm9JDrhp6naIhadqBwcKKjo3vewEOKYQC RPwUSvj6HnxUlXPtSohfZf7lY40bLjoqg0Kcsx4DOGYeAPys8yM0HskXeIy6FixZl2RJ rc7QV6wqodYRlbzNs+ibVp5+JZ+a8caR8RgVTOEubHXjJrC38xyTx8OQKiZ1fBbmLEfa soTw== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1745359164; x=1745963964; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:x-gm-message-state:from:to:cc :subject:date:message-id:reply-to; bh=O/XNpCvNvuFewDwxBLgujn8Rp4YOl/7WSgH2ZliwlXs=; b=Su9uxptAhVaOoZ2dbGU1By5I+ygZzO4+dKHP7NbKrWSRRjPpc1YSMpize6RZiiht5x IwX3aK4J7+qmm1K7i/Qn4j7mvvw073IBaBiQ3B38U7WVBUQRfEZbNHp0zRnWEI8csQJU i1e05Wun8gADEiaPHR5VeEh+ZR76YwczyrhisvryKq2qYzJB36r81RTawnDuCI+diC4S XFbfpmm22t9hURJhtZEOc64EUJKI2BJ1ciMg573VxQReQvwn/fVX1SpLozr+hUZeoByC 1r+hCPqEY6p420a9TcJa+Sx9kq6sVDqaJ+GT0ZPm8kC2R0Y89E0qoMRcHK3zdzATGQgm QcEA== X-Gm-Message-State: AOJu0Ywn6UzYNpaUy9l9ZzCta2UjrxFv6HiYvqxIjXOOMpBa53VyIqym GVHlCMNAqm4KOA4JbxymyhKx4LSbTeCXNABN6ma7UgJOp31o9kiMiJ/KNtyy66u9wGOH80Zwe+L Bu8Q= X-Gm-Gg: ASbGncuTlGT+t0/isf//jcs4iE6gSrW3SxPWRaQb3mBJQu0hFp3bgn9sCGAkK49CZOK bc5HgmPuhEdKxln7zBwdMEFEJmpSbBoEXual7qKNCzHgy2Y4/f4XllpKVm4zUA6oRQOlI7tP8zi LPp7FwXlRIx5eL1n1THSXdr6n7iod8Cz/itg9px7vDlswMqTxJ2BVeZ8m174mj0dYfPrk9fPAZT BZjEBoTTiwAgXLw993BVWBLR2K20TFAxRMh4krK0HbuztzGQ5bQY1aZF+cdNloB+p8fc/w6E46t 3TEaxbIecS/fY0/DCwhONXgOFUD5FCRthgqpBBg/Rs556U+pkHNkCcYfWH0T27P12AEtRSV9tDJ HpMcOO3PgigvBU5TGCRk2 X-Google-Smtp-Source: AGHT+IFpsn55n5+XS9RfN/BqshkJPEi0St5FZzLqzC+GWhguxB4E8cy+924yWUP9RXCbc5v+2F/s6g== X-Received: by 2002:a05:600c:3b0d:b0:43d:7413:cb3e with SMTP id 5b1f17b1804b1-4406ab7f548mr133478695e9.1.1745359163662; Tue, 22 Apr 2025 14:59:23 -0700 (PDT) Received: from inspiron14p-linux.ht.home (188-141-3-146.dynamic.upc.ie. [188.141.3.146]) by smtp.gmail.com with ESMTPSA id 5b1f17b1804b1-44092d2eccesm2726615e9.20.2025.04.22.14.59.22 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Tue, 22 Apr 2025 14:59:23 -0700 (PDT) From: Bryan O'Donoghue To: libcamera-devel@lists.libcamera.org Cc: hdegoede@redhat.com, mzamazal@redhat.com, bryan.odonoghue@linaro.org, bod.linux@nxsw.ie Subject: [PATCH 01/27] libcamera: MappedFrameBuffer: Add tracking of mmap file descriptors to MappedFrameBuffer Date: Tue, 22 Apr 2025 22:58:54 +0100 Message-ID: <20250422215920.4297-2-bryan.odonoghue@linaro.org> X-Mailer: git-send-email 2.49.0 In-Reply-To: <20250422215920.4297-1-bryan.odonoghue@linaro.org> References: <20250422215920.4297-1-bryan.odonoghue@linaro.org> MIME-Version: 1.0 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: , Errors-To: libcamera-devel-bounces@lists.libcamera.org Sender: "libcamera-devel" In order to import via eglCreateImageKHR via an file descriptor we need to have access to the file descriptor associated with the plane. Extend MappedFrameBuffer to track the file descriptor giving an accessor method in-line with the existing planes_ accessor. Signed-off-by: Bryan O'Donoghue --- include/libcamera/internal/mapped_framebuffer.h | 2 ++ src/libcamera/mapped_framebuffer.cpp | 1 + 2 files changed, 3 insertions(+) diff --git a/include/libcamera/internal/mapped_framebuffer.h b/include/libcamera/internal/mapped_framebuffer.h index 6aaabf50..cb81243e 100644 --- a/include/libcamera/internal/mapped_framebuffer.h +++ b/include/libcamera/internal/mapped_framebuffer.h @@ -31,6 +31,7 @@ public: bool isValid() const { return error_ == 0; } int error() const { return error_; } const std::vector &planes() const { return planes_; } + const std::vector &fds() const { return fds_; } protected: MappedBuffer(); @@ -38,6 +39,7 @@ protected: int error_; std::vector planes_; std::vector maps_; + std::vector fds_; private: LIBCAMERA_DISABLE_COPY(MappedBuffer) diff --git a/src/libcamera/mapped_framebuffer.cpp b/src/libcamera/mapped_framebuffer.cpp index f54bbf21..82ab132c 100644 --- a/src/libcamera/mapped_framebuffer.cpp +++ b/src/libcamera/mapped_framebuffer.cpp @@ -237,6 +237,7 @@ MappedFrameBuffer::MappedFrameBuffer(const FrameBuffer *buffer, MapFlags flags) } planes_.emplace_back(info.address + plane.offset, plane.length); + fds_.emplace_back(fd); } }