From patchwork Thu Feb 28 16:29:03 2019 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Laurent Pinchart X-Patchwork-Id: 653 Return-Path: Received: from perceval.ideasonboard.com (perceval.ideasonboard.com [213.167.242.64]) by lancelot.ideasonboard.com (Postfix) with ESMTPS id DBD3F610B6 for ; Thu, 28 Feb 2019 17:29:24 +0100 (CET) Received: from pendragon.bb.dnainternet.fi (81-175-216-236.bb.dnainternet.fi [81.175.216.236]) by perceval.ideasonboard.com (Postfix) with ESMTPSA id 5AE1A49 for ; Thu, 28 Feb 2019 17:29:24 +0100 (CET) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=ideasonboard.com; s=mail; t=1551371364; bh=AMfALyUqK9uDDBKHwqYdYp8mvRrOGhtSgDsuClHl3AA=; h=From:To:Subject:Date:From; b=TQTLQxge9AlgTc0JkLH1fCFG/OhxE5Ktb3IFKo+Hn7SEvw0LAtQOGbteLBtNergjw cMBclYhBsTTqzrMSWC5zYoltH/m4WSBWDYiMReKjM0nVbHoSbMTqDUkQM0/sA1C4JN sYS0u6aYL92uHFWwLOcmNOwnSAnC5L8NZ6ZjhIzM= From: Laurent Pinchart To: libcamera-devel@lists.libcamera.org Date: Thu, 28 Feb 2019 18:29:03 +0200 Message-Id: <20190228162913.6508-1-laurent.pinchart@ideasonboard.com> X-Mailer: git-send-email 2.19.2 MIME-Version: 1.0 Subject: [libcamera-devel] [PATCH 00/10] Rework request completion handling X-BeenThere: libcamera-devel@lists.libcamera.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Thu, 28 Feb 2019 16:29:25 -0000 Hello, This patch series reworks request completion handling to make it explicitly handled by pipeline handlers. The main reason for this is to guarantee that requests will complete in the order they're queued, while giving an option to pipeline handlers to delay request completion until all metadata is available. Patch 01/10 fixes a double release of media devices in pipeline handlers. Patches 02/10 to 06/10 make pipeline-specific camera data mandatory in pipeline handlers in order to simplify the API and store more information in the base CameraData class. Patches 07/10 and 08/10 then add buffer and request completion status support, and patch 09/10 performs the bulk of the request completion handling rework. Finally patch 10/10 prevents requeuing requests when the stream stops in the cam application. This series fixes leak of allocated requests that are not freed at stream stop time, leaving only two memory leaks in the cam application that are due to libudev. Laurent Pinchart (10): libcamera: pipeline: Fix double release of media devices libcamera: pipeline: uvcvideo: Create UVCCameraData libcamera: pipeline: vimc: Create VimcCameraData libcamera: pipeline_handler: Pass a non-const Camera to methods libcamera: pipeline_handler: Store pipe and camera in CameraData libcamera: pipeline_handler: Make pipeline-specific data mandatory libcamera: buffer: Add buffer completion status libcamera: request: Add request completion status libcamera: Handle request completion explicitly in pipeline handlers cam: Don't requeue requests when stopping stream include/libcamera/buffer.h | 15 +- include/libcamera/camera.h | 3 + include/libcamera/request.h | 16 ++- src/cam/main.cpp | 3 + src/libcamera/buffer.cpp | 40 +++++- src/libcamera/camera.cpp | 21 +++ src/libcamera/include/pipeline_handler.h | 25 +++- src/libcamera/pipeline/ipu3/ipu3.cpp | 70 +++++---- src/libcamera/pipeline/uvcvideo.cpp | 105 ++++++++++---- src/libcamera/pipeline/vimc.cpp | 102 ++++++++++---- src/libcamera/pipeline_handler.cpp | 172 ++++++++++++++++++----- src/libcamera/request.cpp | 66 ++++++--- src/libcamera/v4l2_device.cpp | 5 +- 13 files changed, 483 insertions(+), 160 deletions(-)