From patchwork Wed Jun 24 14:52:38 2020 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Paul Elder X-Patchwork-Id: 8402 Return-Path: Received: from perceval.ideasonboard.com (perceval.ideasonboard.com [IPv6:2001:4b98:dc2:55:216:3eff:fef7:d647]) by lancelot.ideasonboard.com (Postfix) with ESMTPS id 7FCDD609B3 for ; Wed, 24 Jun 2020 16:53:25 +0200 (CEST) Authentication-Results: lancelot.ideasonboard.com; dkim=pass (1024-bit key; unprotected) header.d=ideasonboard.com header.i=@ideasonboard.com header.b="mRhdKTve"; dkim-atps=neutral Received: from jade.rasen.tech (unknown [IPv6:2400:4051:61:600:8147:f2a2:a8c6:9087]) by perceval.ideasonboard.com (Postfix) with ESMTPSA id A550D2A8; Wed, 24 Jun 2020 16:53:23 +0200 (CEST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=ideasonboard.com; s=mail; t=1593010405; bh=fjl37sOhCxIzztCUNmlsV53bSzFFBIYNv4n3UqLHj2g=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=mRhdKTveI1gEjg88bDeWeGevig9ovGw7XYGA4vo7dcn0Qm7qdwZoom0GCNSXMhMa8 nJ0Y7LdylzNAPxYeFf0TnQg33FdOMJIVG+6PhIh+RqS+J7y+E5eT4bwzH/GkrmGrWd 9GhIy40oWxgWCr8ScUWkAREN0rCiu/0NA64F3NVs= From: Paul Elder To: libcamera-devel@lists.libcamera.org Date: Wed, 24 Jun 2020 23:52:38 +0900 Message-Id: <20200624145256.48266-5-paul.elder@ideasonboard.com> X-Mailer: git-send-email 2.27.0 In-Reply-To: <20200624145256.48266-1-paul.elder@ideasonboard.com> References: <20200624145256.48266-1-paul.elder@ideasonboard.com> MIME-Version: 1.0 Subject: [libcamera-devel] [PATCH v4 04/22] v4l2: v4l2_camera_proxy: Free old buffers on reqbufs > 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: , X-List-Received-Date: Wed, 24 Jun 2020 14:53:25 -0000 Free buffers, if any were previously allocated, at VIDIOC_REQBUFS with count > 0. Signed-off-by: Paul Elder Reviewed-by: Laurent Pinchart --- Changes in v4: - don't check return value of V4L2CameraProxy::freeBuffers() New in v3 - split from... a conglomerate of v4l2-compliance fixes patch --- src/v4l2/v4l2_camera_proxy.cpp | 3 +++ 1 file changed, 3 insertions(+) diff --git a/src/v4l2/v4l2_camera_proxy.cpp b/src/v4l2/v4l2_camera_proxy.cpp index 240420c..c6959a8 100644 --- a/src/v4l2/v4l2_camera_proxy.cpp +++ b/src/v4l2/v4l2_camera_proxy.cpp @@ -359,6 +359,9 @@ int V4L2CameraProxy::vidioc_reqbufs(V4L2CameraFile *file, struct v4l2_requestbuf return 0; } + if (bufferCount_ > 0) + freeBuffers(); + Size size(curV4L2Format_.fmt.pix.width, curV4L2Format_.fmt.pix.height); int ret = vcam_->configure(&streamConfig_, size, v4l2ToDrm(curV4L2Format_.fmt.pix.pixelformat),