From patchwork Thu Jun 30 10:16:57 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Jean-Michel Hautbois X-Patchwork-Id: 16453 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 123B5BE173 for ; Thu, 30 Jun 2022 10:17:12 +0000 (UTC) Received: from lancelot.ideasonboard.com (localhost [IPv6:::1]) by lancelot.ideasonboard.com (Postfix) with ESMTP id 3C40265656; Thu, 30 Jun 2022 12:17:09 +0200 (CEST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=libcamera.org; s=mail; t=1656584229; bh=LS/YPMJMKYnX2roVk64fSHNqcm+dJKV20Ux3u0ysvLw=; h=To:Date:Subject:List-Id:List-Unsubscribe:List-Archive:List-Post: List-Help:List-Subscribe:From:Reply-To:From; b=vDuemYBfev0hnYdipkCs2KmEQsKQ9SGT6rS8P7lxr4X1sP6yBvPE4WYanIzGP47JK aL9oO6wFaTMGYtvCr0VcpWsjWNuZE8StYcXNxUYojZAIPESnCLtWg7XAcdHmPa0AJF 7C1fetmvRXxiq5eQ1CJHCg7/qEV43glkCIjOfVzxy0+MQiFfIsxf/c8I9+MMSyPsa4 rqFbC9dAoslOwHulxb216UmRKTDUljCMHSBzUTGu2UycKDOwtqvpMB//pBwhND1qfC UDfZN6sOZNuUytkuBSJ5rpSu/Oxk6lA1FZO7fRI3SZSX/sgBQ/i2bg0scWLusmQfHq EeyE1fr2AYQhA== Received: from perceval.ideasonboard.com (perceval.ideasonboard.com [213.167.242.64]) by lancelot.ideasonboard.com (Postfix) with ESMTPS id B3D836559A for ; Thu, 30 Jun 2022 12:17:06 +0200 (CEST) Authentication-Results: lancelot.ideasonboard.com; dkim=pass (1024-bit key; unprotected) header.d=ideasonboard.com header.i=@ideasonboard.com header.b="YnZh7X1Z"; dkim-atps=neutral Received: from tatooine.ideasonboard.com (unknown [IPv6:2a01:e0a:169:7140:4fb3:9c17:e136:8792]) by perceval.ideasonboard.com (Postfix) with ESMTPSA id 36D5B45F; Thu, 30 Jun 2022 12:17:06 +0200 (CEST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=ideasonboard.com; s=mail; t=1656584226; bh=LS/YPMJMKYnX2roVk64fSHNqcm+dJKV20Ux3u0ysvLw=; h=From:To:Cc:Subject:Date:From; b=YnZh7X1ZCyzS8RlGlRepgWjJ35mlf4gP7+UZz3iTaGAdGDsgBCa8dhJaFmo6+LeST fu3HgMWdhUuIawt/QSqZzXNjEv3nLPRjt8EztHZ2t1vzpOzKMEBzOcySAofLCTLVl/ 6mAgUrDJE30f8UM+ZUqFNkOaUrnZufe8nALQa6v4= To: libcamera-devel@lists.libcamera.org Date: Thu, 30 Jun 2022 12:16:57 +0200 Message-Id: <20220630101702.45781-1-jeanmichel.hautbois@ideasonboard.com> X-Mailer: git-send-email 2.34.1 MIME-Version: 1.0 Subject: [libcamera-devel] [PATCH 0/5] Add a params buffer dump tool for IPU3 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: Jean-Michel Hautbois via libcamera-devel From: Jean-Michel Hautbois Reply-To: Jean-Michel Hautbois Errors-To: libcamera-devel-bounces@lists.libcamera.org Sender: "libcamera-devel" Hello ! This patch series is a branch I had for long locally and I want to share. The params buffer on IPU3 is big, and quite difficult to read without having the documentation on another screen :-). To simplify the debug, I wrote a very simple C tool which takes the parameters buffer dumped in a binary form and parses it in a human readable form. I have a patch, not part of the series, to dump the parameter buffer [1]. It is a dumb one, as for every buffer it overwrites the file. It might be interesting to keep all the buffers through time later, if we want to see the changes during time. Or call it only when requested (but there is no way to pass this internal buffer to the userspace). I hope this tool can help, it does not contain all the structures of the parameters buffer, but the model is there, and can be upgraded ;-). Thanks ! JM [1] For reference: Jean-Michel Hautbois (5): utils: ipu3: Introduce a parameters dump tool utils: ipu3: Display only if it is modified by userspace utils: ipu3: Display BNR configuration utils: ipu3: display green disparity params utils: ipu3: dump lens shading params utils/ipu3/ipu3-dump-params.c | 222 ++++++++++++++++++++++++++++++++++ utils/ipu3/meson.build | 5 + 2 files changed, 227 insertions(+) create mode 100644 utils/ipu3/ipu3-dump-params.c diff --git a/src/libcamera/pipeline/ipu3/ipu3.cpp b/src/libcamera/pipeline/ipu3/ipu3.cpp index 6c5617cd..651069c6 100644 --- a/src/libcamera/pipeline/ipu3/ipu3.cpp +++ b/src/libcamera/pipeline/ipu3/ipu3.cpp @@ -6,9 +6,12 @@ */ #include +#include #include #include #include +#include +#include #include #include @@ -61,6 +64,7 @@ public: void queuePendingRequests(); void cancelPendingRequests(); void frameStart(uint32_t sequence); + void dumpBuffer(FrameBuffer *paramBuffer); CIO2Device cio2_; ImgUDevice *imgu_; @@ -1288,6 +1292,7 @@ void IPU3CameraData::queueFrameAction(unsigned int id, } imgu_->param_->queueBuffer(info->paramBuffer); + dumpBuffer(info->paramBuffer); imgu_->stat_->queueBuffer(info->statBuffer); imgu_->input_->queueBuffer(info->rawBuffer); @@ -1313,6 +1318,24 @@ void IPU3CameraData::queueFrameAction(unsigned int id, } } +void IPU3CameraData::dumpBuffer(FrameBuffer *buffer) +{ + for (const FrameBuffer::Plane &plane : buffer->planes()) { + void *address = mmap(nullptr, plane.length, PROT_WRITE, + MAP_SHARED, plane.fd.get(), 0); + if (address == MAP_FAILED) { + LOG(IPU3, Error) << "Failed to mmap plane"; + break; + } + + int out_fd = open("/tmp/IPU3_params.bin", + O_WRONLY | O_TRUNC | O_CREAT, 0644); + write(out_fd, address, plane.length); + close(out_fd); + munmap(address, plane.length); + } +} + /* ----------------------------------------------------------------------------- * Buffer Ready slots */>