From patchwork Tue Jun 16 13:12:44 2020 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Paul Elder X-Patchwork-Id: 4059 Return-Path: Received: from perceval.ideasonboard.com (perceval.ideasonboard.com [213.167.242.64]) by lancelot.ideasonboard.com (Postfix) with ESMTPS id D291A61F5D for ; Tue, 16 Jun 2020 15:13:28 +0200 (CEST) Authentication-Results: lancelot.ideasonboard.com; dkim=pass (1024-bit key; unprotected) header.d=ideasonboard.com header.i=@ideasonboard.com header.b="tpfahY/N"; dkim-atps=neutral Received: from jade.flets-east.jp (unknown [IPv6:2400:4051:61:600:2807:bdfa:f6a:8e53]) by perceval.ideasonboard.com (Postfix) with ESMTPSA id 65AF6F9; Tue, 16 Jun 2020 15:13:27 +0200 (CEST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=ideasonboard.com; s=mail; t=1592313208; bh=8t2tCJhQDZS3vUQddiGqmGmlZ4XrNCv3BJMlmZi6MAQ=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=tpfahY/NGwey34fkInwNJgiSBQu779KXx4UgkKRH+PpaC9hQ+e5OXZSaroAEkevaU 3MAw055LHigISu22Z8Xm72DPWWbO0JxnYa2F0Q8VX4Gh1gpI+C9bWDywQO16NmBKfx /ed8Szz6VEM2JNSzjkuloEdZB3mzdR6wYvrAsiuE= From: Paul Elder To: libcamera-devel@lists.libcamera.org Date: Tue, 16 Jun 2020 22:12:44 +0900 Message-Id: <20200616131244.70308-16-paul.elder@ideasonboard.com> X-Mailer: git-send-email 2.27.0 In-Reply-To: <20200616131244.70308-1-paul.elder@ideasonboard.com> References: <20200616131244.70308-1-paul.elder@ideasonboard.com> MIME-Version: 1.0 Subject: [libcamera-devel] [PATCH 15/15] v4l2: v4l2_camera_proxy: Fix v4l2-compliance streaming tests 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: Tue, 16 Jun 2020 13:13:29 -0000 Fix v4l2-compliance streaming tests, for reqbufs, qbuf, dqbuf, and streamon. Signed-off-by: Paul Elder --- src/v4l2/v4l2_camera_proxy.cpp | 15 +++++++++++++-- 1 file changed, 13 insertions(+), 2 deletions(-) diff --git a/src/v4l2/v4l2_camera_proxy.cpp b/src/v4l2/v4l2_camera_proxy.cpp index e4d534a..fca728a 100644 --- a/src/v4l2/v4l2_camera_proxy.cpp +++ b/src/v4l2/v4l2_camera_proxy.cpp @@ -232,7 +232,6 @@ void V4L2CameraProxy::updateBuffers() buf.timestamp.tv_usec = fmd.timestamp % 1000000; buf.sequence = fmd.sequence; - buf.flags |= V4L2_BUF_FLAG_DONE; break; case FrameMetadata::FrameError: buf.flags |= V4L2_BUF_FLAG_ERROR; @@ -517,6 +516,9 @@ int V4L2CameraProxy::vidioc_reqbufs(int fd, struct v4l2_requestbuffers *arg) return ret; } + if (!mmaps_.empty()) + return -EBUSY; + unlock(fd); return freeBuffers(); } @@ -616,6 +618,9 @@ int V4L2CameraProxy::vidioc_qbuf(int fd, struct v4l2_buffer *arg) if (arg->index >= bufferCount_) return -EINVAL; + if (buffers_[arg->index].flags & V4L2_BUF_FLAG_QUEUED) + return -EINVAL; + int ret = lock(fd); if (ret < 0) return ret; @@ -629,9 +634,12 @@ int V4L2CameraProxy::vidioc_qbuf(int fd, struct v4l2_buffer *arg) if (ret < 0) return ret; - arg->flags |= V4L2_BUF_FLAG_QUEUED; + arg->flags |= V4L2_BUF_FLAG_QUEUED | V4L2_BUF_FLAG_MAPPED; arg->flags &= ~V4L2_BUF_FLAG_DONE; + buffers_[arg->index].flags |= V4L2_BUF_FLAG_QUEUED | V4L2_BUF_FLAG_MAPPED; + buffers_[arg->index].flags &= ~V4L2_BUF_FLAG_DONE; + return ret; } @@ -694,6 +702,9 @@ int V4L2CameraProxy::vidioc_streamon(int fd, int *arg) if (arg == nullptr) return -EFAULT; + if (bufferCount_ == 0) + return -EINVAL; + if (streaming_) return 0;