From patchwork Fri Nov 11 13:30:23 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: David Plowman X-Patchwork-Id: 17786 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 7439EBE08B for ; Fri, 11 Nov 2022 13:30:32 +0000 (UTC) Received: from lancelot.ideasonboard.com (localhost [IPv6:::1]) by lancelot.ideasonboard.com (Postfix) with ESMTP id AF75163086; Fri, 11 Nov 2022 14:30:31 +0100 (CET) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=libcamera.org; s=mail; t=1668173431; bh=pB1PYREOXgYc2ClQfMHOjKtOb8qDrAz/oPuCK3EDF9w=; h=To:Date:Subject:List-Id:List-Unsubscribe:List-Archive:List-Post: List-Help:List-Subscribe:From:Reply-To:From; b=MLf34uorxydg18tvMwZTlvBSodux0cz1UYour6oeWWMEoVDR3GlA/lRyB3BLxi/P4 ME5Q1Mu+x2R/WkbLqE/+PPbSWSEgmk5SgLp/YgFem1kC98HbyGMPHX95yZLnJY7963 HMpJ2qFC1ZH/qvKyY0YT04IPElOruIvAxp1sEoMhYfEhBNTXRls4g6QyGQIclihajq ukSg7vTFwp2K+xVsI1Jqh/EkLRL/M42gCr/0hi7capNQVrFYFf881N9GwCNE1xbFpL Vfay1A4UGZ8iZYKBIVQbUvylHOPdNYZUI9Ln27Ip4h3h8KlQujq8/T8qtVGg3g5/Y/ 3xt9HPoqjuJoA== Received: from mail-wm1-x329.google.com (mail-wm1-x329.google.com [IPv6:2a00:1450:4864:20::329]) by lancelot.ideasonboard.com (Postfix) with ESMTPS id 7568161F3F for ; Fri, 11 Nov 2022 14:30:29 +0100 (CET) Authentication-Results: lancelot.ideasonboard.com; dkim=pass (2048-bit key; unprotected) header.d=raspberrypi.com header.i=@raspberrypi.com header.b="qVYYLc2q"; dkim-atps=neutral Received: by mail-wm1-x329.google.com with SMTP id j5-20020a05600c410500b003cfa9c0ea76so3156221wmi.3 for ; Fri, 11 Nov 2022 05:30:29 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=raspberrypi.com; s=google; h=content-transfer-encoding:mime-version:message-id:date:subject:cc :to:from:from:to:cc:subject:date:message-id:reply-to; bh=Ekbbt09piBEBte9uDIi8DjUo5H4ys86ukZPWBp/9K8k=; b=qVYYLc2qIBkm2Xd817LOBxINA1wP29cEzkWCxM4WKTbvZHNB3jx9LQ+K1VLoFJiLP1 zsY4uPWs1aLJzHWFOeXpccZTx4goW+sFeROT4jUlyaSUA1xhlaaK79Hl63OsZXWuIdmM 2YTw7sN3NonDLWokMRLdbof4jFCtEsGtbKIjQkTEWR08YX8masxuHSvBQF/J5pMcrEAR BWjasQWuj0zORK/O9ORCy6eQtzW6gkM8e5ZS99nVpd8VX1eXkFxqsJEPbB480SQFbEYX m7HncN8huN+jdYS3Oo6smJ5c3tfR5MyWeULPrt40e0v4AyljdkgPuYG8+KMowDJToDVk Vlew== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; 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=Ekbbt09piBEBte9uDIi8DjUo5H4ys86ukZPWBp/9K8k=; b=SPTzXO6dbxEr7Brlr2sPEiavqUQOmkH9Yi8iWFA9h7bMpPDdvZMV4GsA4i2FdxwqZV e+osaIvQHQ8v7FPBI0eKEhEHSLzBG+ioSBPryb8T6yG3UYFJhS77CUvxvc2wZNVtDRNv EaztzcOQbacVYerVbn9RJLa9JeT5+ij3EH1+uokmukVf42gTSYPcnRo4mKY3BLMbST/s 1pJDptqlSH/QTUMKJoT2iM8Cc/LjK0dH/pdAu6zGna6Rh6dU6+aWcKOLz4VCS7fbkMlI llaH5tAK3umdjonJ8j8FHgtMF6csv1I3HUotnzApiXM+/q2d4XP423weegGvbAVZjBwg MiVg== X-Gm-Message-State: ANoB5pmEHQATPUmXfCFaXJyvt5oq+Tw0nNZ2FXEXtcCfq8jWOWeaDePE eAkfC2rtVgjUDbVPG1ujFvfvlOBPvpL2Zg== X-Google-Smtp-Source: AA0mqf57F3EC2zLXXN/pgk1gODTuHHNy4Lxhhk5J2lpXKUwFg9nnCJpbp0hS2fwhvE6umKTGf0sZRg== X-Received: by 2002:a05:600c:231a:b0:3cf:681a:43e1 with SMTP id 26-20020a05600c231a00b003cf681a43e1mr1203268wmo.126.1668173428538; Fri, 11 Nov 2022 05:30:28 -0800 (PST) Received: from pi4-davidp.lan (plowpeople3.plus.com. [80.229.223.72]) by smtp.gmail.com with ESMTPSA id bk11-20020a0560001d8b00b002416f0f1e96sm1511487wrb.43.2022.11.11.05.30.27 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Fri, 11 Nov 2022 05:30:27 -0800 (PST) To: libcamera-devel@lists.libcamera.org Date: Fri, 11 Nov 2022 13:30:23 +0000 Message-Id: <20221111133025.3102-1-david.plowman@raspberrypi.com> X-Mailer: git-send-email 2.30.2 MIME-Version: 1.0 Subject: [libcamera-devel] [PATCH 0/2] Notify pipeline handlers when a camera is released 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: David Plowman via libcamera-devel From: David Plowman Reply-To: David Plowman Errors-To: libcamera-devel-bounces@lists.libcamera.org Sender: "libcamera-devel" Hi These patches are actually a follow-up to an email I circulated on 7th November, entitled "Problems opening/closing camera in different processes". It address the problem that when a camera is released, our pipeline handler never gets to find out. So we have no way to know that this would be a good moment to free all the buffers we allocated for it. Rather than continue the discussion, I thought I'd submit some code! There are 2 small patches here. The first adds a "releaseDevice" method to the PipelineHandler, that it calls from its "release" method (trying to follow the "xxx calls xxxDevice" pattern that I saw). The second merely implements a "releaseDevice" method for the Pi, which frees any allocated buffers. Thanks! David David Plowman (2): libcamera: Add a PipelineHandler::releaseDevice method libcamera: pipeline: raspberrypi: Free buffers when a camera is released include/libcamera/internal/pipeline_handler.h | 4 +++- src/libcamera/camera.cpp | 2 +- .../pipeline/raspberrypi/raspberrypi.cpp | 8 ++++++++ src/libcamera/pipeline_handler.cpp | 16 +++++++++++++++- 4 files changed, 27 insertions(+), 3 deletions(-)