From patchwork Sun Apr 23 20:39:28 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Umang Jain X-Patchwork-Id: 18543 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 E2904BE173 for ; Sun, 23 Apr 2023 20:39:44 +0000 (UTC) Received: from lancelot.ideasonboard.com (localhost [IPv6:::1]) by lancelot.ideasonboard.com (Postfix) with ESMTP id 0F5A9627DB; Sun, 23 Apr 2023 22:39:44 +0200 (CEST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=libcamera.org; s=mail; t=1682282384; bh=6qGEjyz0TMxHxRiAWnrlq4axvtAaEGygnNT46V5u+L0=; h=To:Date:Subject:List-Id:List-Unsubscribe:List-Archive:List-Post: List-Help:List-Subscribe:From:Reply-To:From; b=Vilc6iGnFxIvVlxupMNu1NWFeCA7I4f2HeIuRkLtqy1qPlZ3HCTgWqGhpyujBjDyW 434mOU/UdFuozp93eZuRLXtQQFMbMDslo3Eab74d59U3P3nnoqLpW8hUeyZKYvOKsw ElH9h21MHiYk22D7gRyLaWKkLtu67Y3J9naWT0iNkLiEVdgOIWQWR729duq441sd2v UT8Pa2dPhbFg8tBv+PywNAQqVYH8EzMWyC60qzXe1rqrnFcJWyMs7PgFtSh8SNr343 Ax+Bytgw9a+XuOr7JmEViOQxN8AteY4fFRDKD6uWNZgYYAMsT5i5muYCt6pCX3SE95 BJ0ZLyQW0t3kg== Received: from perceval.ideasonboard.com (perceval.ideasonboard.com [213.167.242.64]) by lancelot.ideasonboard.com (Postfix) with ESMTPS id 86134627CD for ; Sun, 23 Apr 2023 22:39:39 +0200 (CEST) Authentication-Results: lancelot.ideasonboard.com; dkim=pass (1024-bit key; unprotected) header.d=ideasonboard.com header.i=@ideasonboard.com header.b="p2pNMTtt"; dkim-atps=neutral Received: from umang.jainideasonboard.com (unknown [IPv6:2401:4900:1f3f:df01:2ad:735a:b54c:741d]) by perceval.ideasonboard.com (Postfix) with ESMTPSA id 0AEE48B8; Sun, 23 Apr 2023 22:39:28 +0200 (CEST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=ideasonboard.com; s=mail; t=1682282369; bh=6qGEjyz0TMxHxRiAWnrlq4axvtAaEGygnNT46V5u+L0=; h=From:To:Cc:Subject:Date:From; b=p2pNMTttcuGwRAl6y7A+ji+oz66rqZtQAf/bo3lk5whkpd0XrprhjlPOr83OarMfv siO3KO0GUN3bVALOY69B0M9tCueSSkKZje8Qc3Xv5iQnEPmE0pKCC7rzwvkpagHUNx gX0CaRqarsWhA9DkS5I9byPnSu2PJdmgLMLZdpyA= To: libcamera-devel@lists.libcamera.org Date: Mon, 24 Apr 2023 02:09:28 +0530 Message-Id: <20230423203931.108022-1-umang.jain@ideasonboard.com> X-Mailer: git-send-email 2.39.1 MIME-Version: 1.0 Subject: [libcamera-devel] [PATCH 0/3] apps: cam: kms: Introduce requests tracking queue 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: Umang Jain via libcamera-devel From: Umang Jain Reply-To: Umang Jain Errors-To: libcamera-devel-bounces@lists.libcamera.org Sender: "libcamera-devel" This series got formed while I was trying to stress test the KMSSink with start() -> stop() -> configure() -> start() -> stop() ... cycles (without re-allocating). Mainly, I faced a use-after-free segmentation fault happening on stop(). It was due the fact a DRM request completes asynchronous but current KMSSink::stop() will free that DRM request(stored in queued_ member) on stop() - which isn't right. A queue is introduced to store requests but mark pending requests as 'expired' on stop() (3/3) Patch (1/3) and Patch (2/3) are drive by fixes. Umang Jain (3): apps: cam: kms_sink: Do not process requests after stop() apps: cam: kms_sink: Drop unique_ptr<> from DRM::AtomicRequest apps: cam: kms_sink: Introduce a requests tracking queue src/apps/cam/kms_sink.cpp | 90 +++++++++++++++++++++------------------ src/apps/cam/kms_sink.h | 11 +++-- 2 files changed, 56 insertions(+), 45 deletions(-)