/* SPDX-License-Identifier: GPL-2.0-or-later */ /* * Copyright (C) 2021, Ideas on Board Oy * * kms_sink.h - KMS Sink */ #pragma once #include #include #include #include #include #include #include #include #include "drm.h" #include "frame_sink.h" class KMSSink : public FrameSink { public: KMSSink(const std::string &connectorName); void mapBuffer(libcamera::FrameBuffer *buffer) override; int configure(const libcamera::CameraConfiguration &config) override; int start() override; int stop() override; bool processRequest(libcamera::Request *request) override; private: class Request { public: Request(DRM::AtomicRequest *drmRequest, libcamera::Request *camRequest) : drmRequest_(drmRequest), camRequest_(camRequest) { } std::unique_ptr drmRequest_; libcamera::Request *camRequest_; }; int configurePipeline(const libcamera::PixelFormat &format); void requestComplete(DRM::AtomicRequest *request); DRM::Device dev_; const DRM::Connector *connector_; const DRM::Crtc *crtc_; const DRM::Plane *plane_; const DRM::Mode *mode_; libcamera::PixelFormat format_; libcamera::Size size_; unsigned int stride_; std::map> buffers_; std::mutex lock_; std::unique_ptr pending_; std::unique_ptr queued_; std::unique_ptr active_; }; camera/libcamera.git/tree/test/v4l2_videodevice/request_buffers.cpp?h=v0.0.3&id=1a1cf4a2c13a04f23593419ce93e97f9a5bb22d1'>treecommitdiff
blob: fb577147eff88883df93a4839780e1d538b040b2 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
/* SPDX-License-Identifier: GPL-2.0-or-later */
/*
 * Copyright (C) 2019, Google Inc.
 *
 * libcamera V4L2 API tests
 */

#include "v4l2_videodevice_test.h"

class RequestBuffersTest : public V4L2VideoDeviceTest
{
public:
	RequestBuffersTest()
		: V4L2VideoDeviceTest("vimc", "Raw Capture 0") {}

protected:
	int run()
	{
		const unsigned int bufferCount = 8;

		int ret = capture_->allocateBuffers(bufferCount, &buffers_);
		if (ret != bufferCount)
			return TestFail;

		return TestPass;
	}
};

TEST_REGISTER(RequestBuffersTest)