14#include <linux/media/v4l2-isp.h>
17#include <libcamera/base/span.h>
38 struct v4l2_isp_params_block_header *header =
39 reinterpret_cast<struct v4l2_isp_params_block_header *
>(
data_.data());
41 header->flags &= ~(V4L2_ISP_PARAMS_FL_BLOCK_ENABLE |
42 V4L2_ISP_PARAMS_FL_BLOCK_DISABLE);
43 header->flags |= enabled ? V4L2_ISP_PARAMS_FL_BLOCK_ENABLE
44 : V4L2_ISP_PARAMS_FL_BLOCK_DISABLE;
49 return reinterpret_cast<const T *
>(
data_.data());
54 return reinterpret_cast<T *
>(
data_.data());
59 return *
reinterpret_cast<const T *
>(
data_.data());
64 return *
reinterpret_cast<T *
>(
data_.data());
71template<
typename Traits>
78 struct v4l2_isp_params_buffer *params =
79 reinterpret_cast<struct v4l2_isp_params_buffer *
>(
data_.data());
80 params->data_size = 0;
81 params->version = version;
83 used_ = offsetof(
struct v4l2_isp_params_buffer, data);
88 template<
typename Traits::
id_type Id>
91 using Details =
typename Traits::template id_to_details<Id>;
93 using Type =
typename Details::type;
94 constexpr auto kernelId = Details::blockType;
96 auto data =
block(Id, kernelId,
sizeof(Type));
101 Span<uint8_t>
block(
typename Traits::id_type type,
102 unsigned int blockType,
size_t blockSize)
109 auto cacheIt =
blocks_.find(type);
111 return cacheIt->second;
120 <<
"Parameters buffer out of space; potential version mismatch between driver and libcamera";
128 struct v4l2_isp_params_block_header *header =
129 reinterpret_cast<struct v4l2_isp_params_block_header *
>(
block.data());
130 header->type = blockType;
131 header->size =
block.size();
135 reinterpret_cast<struct v4l2_isp_params_buffer *
>
147 std::map<typename Traits::id_type, Span<uint8_t>>
blocks_;
Helper class that represents an ISP configuration block.
Definition v4l2_params.h:27
virtual T * operator->()
Access the ISP configuration block casting it to the kernel-defined ISP configuration type.
Definition v4l2_params.h:52
virtual const T & operator*() const
Access the ISP configuration block casting it to the kernel-defined ISP configuration type.
Definition v4l2_params.h:57
virtual const T * operator->() const
Access the ISP configuration block casting it to the kernel-defined ISP configuration type.
Definition v4l2_params.h:47
virtual T & operator*()
Access the ISP configuration block casting it to the kernel-defined ISP configuration type.
Definition v4l2_params.h:62
V4L2ParamsBlock(const Span< uint8_t > data)
Construct a V4L2ParamsBlock with memory represented by data.
Definition v4l2_params.h:29
virtual void setEnabled(bool enabled)
Enable/disable an ISP configuration block.
Definition v4l2_params.h:36
Span< uint8_t > data_
Memory area reserved for the ISP configuration block.
Definition v4l2_params.h:68
Helper class that represent an ISP configuration buffer.
Definition v4l2_params.h:73
size_t bytesused() const
Retrieve the used size of the parameters buffer (in bytes)
Definition v4l2_params.h:86
Span< uint8_t > block(typename Traits::id_type type, unsigned int blockType, size_t blockSize)
Populate an ISP configuration block a returns a reference to its memory.
Definition v4l2_params.h:101
Span< uint8_t > data_
The ISP parameters buffer memory.
Definition v4l2_params.h:144
auto block()
Retrieve the location of an ISP configuration block a return it.
Definition v4l2_params.h:89
V4L2Params(Span< uint8_t > data, unsigned int version)
Construct an instance of V4L2Params.
Definition v4l2_params.h:75
size_t used_
The number of bytes used in the parameters buffer.
Definition v4l2_params.h:145
std::map< typename Traits::id_type, Span< uint8_t > > blocks_
Cache of ISP configuration blocks.
Definition v4l2_params.h:147
#define LOG_DECLARE_CATEGORY(name)
Declare a category of log messages.
Definition log.h:51
#define LOG(category, severity)
Log a message.
Definition log.h:129
Top-level libcamera namespace.
Definition backtrace.h:17