summaryrefslogtreecommitdiff
path: root/src/ipa/rkisp1/rkisp1.cpp
AgeCommit message (Expand)Author
2021-08-31libcamera: mapped_framebuffer: Rename maps() to planes()Hirokazu Honda
2021-08-30ipa: rkisp1: Use offset in mapping IPABufferHirokazu Honda
2021-07-22ipa: rkisp1: Add support for V12 isp blocksHeiko Stuebner
2021-07-11libcamera: buffer: Rename buffer.h to framebuffer.hLaurent Pinchart
2021-06-25libcamera/base: Move extended base functionalityKieran Bingham
2021-05-24ipa: ipc: Rename CameraSensorInfo to IPACameraSensorInfoUmang Jain
2021-04-26ipa: rkisp1: Move the IPA to the ipa::rkisp1 namespaceJean-Michel Hautbois
2021-03-27ipa: rkisp1: Do not set controls during configureSebastian Fricke
2021-03-11ipa: rkisp1: Fail on init if hw revision is not RKISP1_V10Dafna Hirschfeld
2021-03-11ipa: rkisp1: Return error from IPA's configure method if it failsDafna Hirschfeld
2021-03-03ipa: rkisp1: Update to kernel header changesLaurent Pinchart
2021-02-16libcamera: IPAInterface: Replace C API with the new C++-only APIPaul Elder
2020-12-08libcamera: ipa: Pass a set of controls and return results from ipa::start()Naushir Patuck
2020-09-29include: linux: Update rkisp1 headerNiklas Söderlund
2020-09-29libcamera: ipa: rkisp1: Include linux/v4l2-controls.hNiklas Söderlund
2020-08-25meson: Remove -Wno-unused-parameterLaurent Pinchart
2020-08-25libcamera: Replace utils::clamp() with std::clamp()Laurent Pinchart
2020-07-17libcamera: ipa_interface: Add support for custom IPA data to configure()Laurent Pinchart
2020-07-01ipa/pipeline: rkisp1: Fix spellingAndrej Shadura
2020-05-16libcamera: Move IPA headers from include/ipa/ to include/libcamera/ipa/Laurent Pinchart
2020-05-16libcamera: Move internal headers to include/libcamera/internal/Laurent Pinchart
2020-04-28libcamera: ipa: Add support for CameraSensorInfoJacopo Mondi
2020-04-28ipa: Pass IPA initialization settings to IPAInterface::init()Laurent Pinchart
2020-04-28ipa: Name IPA modules after their source directoryLaurent Pinchart
2020-04-14libcamera: ipa: Remove IPAModuleInfo license fieldLaurent Pinchart
2020-04-14ipa: Add start() and stop() operationsNiklas Söderlund
2020-01-14libcamera: Switch from utils::make_unique to std::make_uniqueLaurent Pinchart
2020-01-14meson.build: Switch to C++14Laurent Pinchart
2020-01-12ipa: Switch to FrameBuffer interfaceNiklas Söderlund
2019-11-20ipa: Switch to the plain C APIJacopo Mondi
2019-11-20ipa: Pass ControlInfoMap references to IPAInterface::configure()Laurent Pinchart
2019-11-08libcamera: Remove unneeded semicolonsLaurent Pinchart
2019-10-23libcamera: Standardise on C compatibility headersLaurent Pinchart
2019-10-15libcamera: v4l2_controls: Remove V4L2ControlList classLaurent Pinchart
2019-10-15libcamera: controls: Merge ControlInfoMap and V4L2ControlInfoMapLaurent Pinchart
2019-10-15libcamera: v4l2_controls: Replace V4L2ControlInfo with V4L2ControlRangeLaurent Pinchart
2019-10-13libcamera: ipa: Merge controls and v4l2controls in IPAOperationDataLaurent Pinchart
2019-10-13libcamera: v4l2_device: Replace V4L2ControlList with ControlListLaurent Pinchart
2019-10-13libcamera: controls: Support accessing controls by numerical IDLaurent Pinchart
2019-10-13libcamera: controls: Default ControlList validator argument to nullptrLaurent Pinchart
2019-10-11ipa: rkisp1: Avoid unnecessary copyLaurent Pinchart
2019-10-11libcamera: ipa: rkisp1: Add basic control of auto exposureNiklas Söderlund
span class="hl com"> * Copyright (C) 2020, Google Inc. * * file.cpp - File I/O operations tests */ #include <fstream> #include <iostream> #include <stdlib.h> #include <string> #include <string.h> #include <sys/types.h> #include <unistd.h> #include <libcamera/base/file.h> #include "test.h" using namespace std; using namespace libcamera; class FileTest : public Test { protected: int init() { fileName_ = "/tmp/libcamera.test.XXXXXX"; int fd = mkstemp(&fileName_.front()); if (fd == -1) return TestFail; close(fd); unlink(fileName_.c_str()); return TestPass; } int run() { /* Test static functions. */ if (!File::exists("/dev/null")) { cerr << "Valid file not found" << endl; return TestFail; } if (File::exists("/dev/null/invalid")) { cerr << "Invalid file should not exist" << endl; return TestFail; } if (File::exists("/dev")) { cerr << "Directories should not be treated as files" << endl; return TestFail; } /* Test unnamed file. */ File file; if (!file.fileName().empty()) { cerr << "Unnamed file has non-empty file name" << endl; return TestFail; } if (file.exists()) { cerr << "Unnamed file exists" << endl; return TestFail; } if (file.isOpen()) { cerr << "File is open after construction" << endl; return TestFail; } if (file.openMode() != File::NotOpen) { cerr << "File has invalid open mode after construction" << endl; return TestFail; } if (file.size() >= 0) { cerr << "Unnamed file has a size" << endl; return TestFail; } if (file.open(File::ReadWrite)) { cerr << "Opening unnamed file succeeded" << endl; return TestFail; } if (file.error() == 0) { cerr << "Open failure didn't set error" << endl; return TestFail; } /* Test named file referring to an invalid file. */ file.setFileName("/dev/null/invalid"); if (file.fileName() != "/dev/null/invalid") { cerr << "File reports incorrect file name" << endl; return TestFail; } if (file.exists()) { cerr << "Invalid file exists" << endl; return TestFail; } if (file.isOpen()) { cerr << "Invalid file is open after construction" << endl; return TestFail; } if (file.openMode() != File::NotOpen) { cerr << "Invalid file has invalid open mode after construction" << endl; return TestFail; } if (file.size() >= 0) { cerr << "Invalid file has a size" << endl; return TestFail; } if (file.open(File::ReadWrite)) { cerr << "Opening invalid file succeeded" << endl; return TestFail; } /* Test named file referring to a valid file. */ file.setFileName("/dev/null"); if (!file.exists()) { cerr << "Valid file does not exist" << endl; return TestFail; } if (file.isOpen()) { cerr << "Valid file is open after construction" << endl; return TestFail; } if (file.openMode() != File::NotOpen) { cerr << "Valid file has invalid open mode after construction" << endl; return TestFail; } if (file.size() >= 0) { cerr << "Invalid file has a size" << endl; return TestFail; } /* Test open and close. */ if (!file.open(File::ReadWrite)) { cerr << "Opening file failed" << endl; return TestFail; } if (!file.isOpen()) { cerr << "Open file reported as closed" << endl; return TestFail; } if (file.openMode() != File::ReadWrite) { cerr << "Open file has invalid open mode" << endl; return TestFail; } file.close(); if (file.isOpen()) { cerr << "Closed file reported as open" << endl; return TestFail; } if (file.openMode() != File::NotOpen) { cerr << "Closed file has invalid open mode" << endl; return TestFail; } /* Test size(). */ file.setFileName("/proc/self/exe"); if (file.size() >= 0) { cerr << "File has valid size before open" << endl; return TestFail; } file.open(File::ReadOnly); ssize_t size = file.size(); if (size <= 0) { cerr << "File has invalid size after open" << endl; return TestFail; } file.close(); /* Test file creation. */ file.setFileName(fileName_); if (file.exists()) { cerr << "Temporary file already exists" << endl; return TestFail; } if (file.open(File::ReadOnly)) { cerr << "Read-only open succeeded on nonexistent file" << endl; return TestFail; } if (!file.open(File::WriteOnly)) { cerr << "Write-only open failed on nonexistent file" << endl; return TestFail; } if (!file.exists()) { cerr << "Write-only open failed to create file" << endl; return TestFail; } file.close(); /* Test read and write. */ std::array<uint8_t, 256> buffer = { 0 }; strncpy(reinterpret_cast<char *>(buffer.data()), "libcamera", buffer.size()); if (file.read(buffer) >= 0) { cerr << "Read succeeded on closed file" << endl; return TestFail; } if (file.write(buffer) >= 0) { cerr << "Write succeeded on closed file" << endl; return TestFail; } file.open(File::ReadOnly); if (file.write(buffer) >= 0) { cerr << "Write succeeded on read-only file" << endl; return TestFail; } file.close(); file.open(File::ReadWrite); if (file.write({ buffer.data(), 9 }) != 9) { cerr << "Write test failed" << endl; return TestFail; } if (file.read(buffer) != 0) { cerr << "Read at end of file test failed" << endl; return TestFail; } if (file.seek(0) != 0) { cerr << "Seek test failed" << endl; return TestFail; } if (file.read(buffer) != 9) { cerr << "Read test failed" << endl; return TestFail; } if (file.pos() != 9) { cerr << "Position test failed" << endl; return TestFail; } file.close(); /* Test mapping and unmapping. */ file.setFileName("/proc/self/exe"); file.open(File::ReadOnly); Span<uint8_t> data = file.map(); if (data.empty()) { cerr << "Mapping of complete file failed" << endl; return TestFail; } if (data.size() != static_cast<size_t>(size)) { cerr << "Mapping of complete file has invalid size" << endl; return TestFail; } if (!file.unmap(data.data())) { cerr << "Unmapping of complete file failed" << endl; return TestFail; } data = file.map(4096, 8192); if (data.empty()) { cerr << "Mapping of file region failed" << endl; return TestFail; } if (data.size() != 8192) { cerr << "Mapping of file region has invalid size" << endl; return TestFail; } if (!file.unmap(data.data())) { cerr << "Unmapping of file region failed" << endl; return TestFail; } file.close(); /* Test private mapping. */ file.setFileName(fileName_); file.open(File::ReadWrite); data = file.map(0, -1, File::MapPrivate); if (data.empty()) { cerr << "Private mapping failed" << endl; return TestFail; } std::string str{ reinterpret_cast<char *>(data.data()), data.size() }; if (str != "libcamera") { cerr << "Invalid contents of private mapping" << endl; return TestFail; } memcpy(data.data(), "LIBCAMERA", 9); if (!file.unmap(data.data())) { cerr << "Private unmapping failed" << endl; return TestFail; } data = file.map(); str = { reinterpret_cast<char *>(data.data()), data.size() }; if (str != "libcamera") { cerr << "Private mapping changed file contents" << endl; return TestFail; } /* Test shared mapping. */ data = file.map(); if (data.empty()) { cerr << "Shared mapping failed" << endl; return TestFail; } memcpy(data.data(), "LIBCAMERA", 9); if (!file.unmap(data.data())) { cerr << "Shared unmapping failed" << endl; return TestFail; } data = file.map(); str = { reinterpret_cast<char *>(data.data()), data.size() }; if (str != "LIBCAMERA") { cerr << "Shared mapping failed to change file contents" << endl; return TestFail; } return TestPass; } void cleanup() { unlink(fileName_.c_str()); } private: std::string fileName_; }; TEST_REGISTER(FileTest)