pipeline: raspberrypi: Remove enum BuffferMask from the mojom interface
The BufferMask enum provides a way of identifying which stream a frame buffer belongs to. This enum is defined in the raspberrypi.mojom interface file. However, the IPA does not need these enum definitions to mmap buffers that it uses. Move this enum out of the raspberrypi.mojom interface file and put it into the RPi namespace visible only to the pipeline handler. This removes the need to include the auto-generated IPA interface header in the RPi::Stream definition. Signed-off-by: Naushir Patuck <naush@raspberrypi.com> Reviewed-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com> Reviewed-by: David Plowman <david.plowman@raspberrypi.com> Signed-off-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com>
This commit is contained in:
parent
1bcb7539df
commit
a857a150e1
5 changed files with 25 additions and 28 deletions
|
@ -8,14 +8,6 @@ module ipa.RPi;
|
||||||
|
|
||||||
import "include/libcamera/ipa/core.mojom";
|
import "include/libcamera/ipa/core.mojom";
|
||||||
|
|
||||||
enum BufferMask {
|
|
||||||
MaskID = 0x00ffff,
|
|
||||||
MaskStats = 0x010000,
|
|
||||||
MaskEmbeddedData = 0x020000,
|
|
||||||
MaskBayerData = 0x040000,
|
|
||||||
MaskExternalBuffer = 0x100000,
|
|
||||||
};
|
|
||||||
|
|
||||||
/* Size of the LS grid allocation. */
|
/* Size of the LS grid allocation. */
|
||||||
const uint32 MaxLsGridSize = 0x8000;
|
const uint32 MaxLsGridSize = 0x8000;
|
||||||
|
|
||||||
|
|
|
@ -515,7 +515,7 @@ void IPARPi::signalStatReady(uint32_t bufferId)
|
||||||
|
|
||||||
reportMetadata();
|
reportMetadata();
|
||||||
|
|
||||||
statsMetadataComplete.emit(bufferId & MaskID, libcameraMetadata_);
|
statsMetadataComplete.emit(bufferId, libcameraMetadata_);
|
||||||
}
|
}
|
||||||
|
|
||||||
void IPARPi::signalQueueRequest(const ControlList &controls)
|
void IPARPi::signalQueueRequest(const ControlList &controls)
|
||||||
|
@ -534,7 +534,7 @@ void IPARPi::signalIspPrepare(const ISPConfig &data)
|
||||||
frameCount_++;
|
frameCount_++;
|
||||||
|
|
||||||
/* Ready to push the input buffer into the ISP. */
|
/* Ready to push the input buffer into the ISP. */
|
||||||
runIsp.emit(data.bayerBufferId & MaskID);
|
runIsp.emit(data.bayerBufferId);
|
||||||
}
|
}
|
||||||
|
|
||||||
void IPARPi::reportMetadata()
|
void IPARPi::reportMetadata()
|
||||||
|
@ -1001,7 +1001,7 @@ void IPARPi::queueRequest(const ControlList &controls)
|
||||||
|
|
||||||
void IPARPi::returnEmbeddedBuffer(unsigned int bufferId)
|
void IPARPi::returnEmbeddedBuffer(unsigned int bufferId)
|
||||||
{
|
{
|
||||||
embeddedComplete.emit(bufferId & MaskID);
|
embeddedComplete.emit(bufferId);
|
||||||
}
|
}
|
||||||
|
|
||||||
void IPARPi::prepareISP(const ISPConfig &data)
|
void IPARPi::prepareISP(const ISPConfig &data)
|
||||||
|
|
|
@ -1484,10 +1484,10 @@ int PipelineHandlerRPi::prepareBuffers(Camera *camera)
|
||||||
* Pass the stats and embedded data buffers to the IPA. No other
|
* Pass the stats and embedded data buffers to the IPA. No other
|
||||||
* buffers need to be passed.
|
* buffers need to be passed.
|
||||||
*/
|
*/
|
||||||
mapBuffers(camera, data->isp_[Isp::Stats].getBuffers(), ipa::RPi::MaskStats);
|
mapBuffers(camera, data->isp_[Isp::Stats].getBuffers(), RPi::MaskStats);
|
||||||
if (data->sensorMetadata_)
|
if (data->sensorMetadata_)
|
||||||
mapBuffers(camera, data->unicam_[Unicam::Embedded].getBuffers(),
|
mapBuffers(camera, data->unicam_[Unicam::Embedded].getBuffers(),
|
||||||
ipa::RPi::MaskEmbeddedData);
|
RPi::MaskEmbeddedData);
|
||||||
|
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
@ -1727,7 +1727,7 @@ void RPiCameraData::statsMetadataComplete(uint32_t bufferId, const ControlList &
|
||||||
if (!isRunning())
|
if (!isRunning())
|
||||||
return;
|
return;
|
||||||
|
|
||||||
FrameBuffer *buffer = isp_[Isp::Stats].getBuffers().at(bufferId);
|
FrameBuffer *buffer = isp_[Isp::Stats].getBuffers().at(bufferId & RPi::MaskID);
|
||||||
|
|
||||||
handleStreamBuffer(buffer, &isp_[Isp::Stats]);
|
handleStreamBuffer(buffer, &isp_[Isp::Stats]);
|
||||||
|
|
||||||
|
@ -1763,9 +1763,9 @@ void RPiCameraData::runIsp(uint32_t bufferId)
|
||||||
if (!isRunning())
|
if (!isRunning())
|
||||||
return;
|
return;
|
||||||
|
|
||||||
FrameBuffer *buffer = unicam_[Unicam::Image].getBuffers().at(bufferId);
|
FrameBuffer *buffer = unicam_[Unicam::Image].getBuffers().at(bufferId & RPi::MaskID);
|
||||||
|
|
||||||
LOG(RPI, Debug) << "Input re-queue to ISP, buffer id " << bufferId
|
LOG(RPI, Debug) << "Input re-queue to ISP, buffer id " << (bufferId & RPi::MaskID)
|
||||||
<< ", timestamp: " << buffer->metadata().timestamp;
|
<< ", timestamp: " << buffer->metadata().timestamp;
|
||||||
|
|
||||||
isp_[Isp::Input].queueBuffer(buffer);
|
isp_[Isp::Input].queueBuffer(buffer);
|
||||||
|
@ -1778,7 +1778,7 @@ void RPiCameraData::embeddedComplete(uint32_t bufferId)
|
||||||
if (!isRunning())
|
if (!isRunning())
|
||||||
return;
|
return;
|
||||||
|
|
||||||
FrameBuffer *buffer = unicam_[Unicam::Embedded].getBuffers().at(bufferId);
|
FrameBuffer *buffer = unicam_[Unicam::Embedded].getBuffers().at(bufferId & RPi::MaskID);
|
||||||
handleStreamBuffer(buffer, &unicam_[Unicam::Embedded]);
|
handleStreamBuffer(buffer, &unicam_[Unicam::Embedded]);
|
||||||
handleState();
|
handleState();
|
||||||
}
|
}
|
||||||
|
@ -1931,7 +1931,7 @@ void RPiCameraData::ispOutputDequeue(FrameBuffer *buffer)
|
||||||
* application until after the IPA signals so.
|
* application until after the IPA signals so.
|
||||||
*/
|
*/
|
||||||
if (stream == &isp_[Isp::Stats]) {
|
if (stream == &isp_[Isp::Stats]) {
|
||||||
ipa_->signalStatReady(ipa::RPi::MaskStats | static_cast<unsigned int>(index));
|
ipa_->signalStatReady(RPi::MaskStats | static_cast<unsigned int>(index));
|
||||||
} else {
|
} else {
|
||||||
/* Any other ISP output can be handed back to the application now. */
|
/* Any other ISP output can be handed back to the application now. */
|
||||||
handleStreamBuffer(buffer, stream);
|
handleStreamBuffer(buffer, stream);
|
||||||
|
@ -2006,7 +2006,7 @@ void RPiCameraData::handleExternalBuffer(FrameBuffer *buffer, RPi::Stream *strea
|
||||||
{
|
{
|
||||||
unsigned int id = stream->getBufferId(buffer);
|
unsigned int id = stream->getBufferId(buffer);
|
||||||
|
|
||||||
if (!(id & ipa::RPi::MaskExternalBuffer))
|
if (!(id & RPi::MaskExternalBuffer))
|
||||||
return;
|
return;
|
||||||
|
|
||||||
/* Stop the Stream object from tracking the buffer. */
|
/* Stop the Stream object from tracking the buffer. */
|
||||||
|
@ -2174,13 +2174,13 @@ void RPiCameraData::tryRunPipeline()
|
||||||
<< " Bayer buffer id: " << bayerId;
|
<< " Bayer buffer id: " << bayerId;
|
||||||
|
|
||||||
ipa::RPi::ISPConfig ispPrepare;
|
ipa::RPi::ISPConfig ispPrepare;
|
||||||
ispPrepare.bayerBufferId = ipa::RPi::MaskBayerData | bayerId;
|
ispPrepare.bayerBufferId = RPi::MaskBayerData | bayerId;
|
||||||
ispPrepare.controls = std::move(bayerFrame.controls);
|
ispPrepare.controls = std::move(bayerFrame.controls);
|
||||||
|
|
||||||
if (embeddedBuffer) {
|
if (embeddedBuffer) {
|
||||||
unsigned int embeddedId = unicam_[Unicam::Embedded].getBufferId(embeddedBuffer);
|
unsigned int embeddedId = unicam_[Unicam::Embedded].getBufferId(embeddedBuffer);
|
||||||
|
|
||||||
ispPrepare.embeddedBufferId = ipa::RPi::MaskEmbeddedData | embeddedId;
|
ispPrepare.embeddedBufferId = RPi::MaskEmbeddedData | embeddedId;
|
||||||
ispPrepare.embeddedBufferPresent = true;
|
ispPrepare.embeddedBufferPresent = true;
|
||||||
|
|
||||||
LOG(RPI, Debug) << "Signalling signalIspPrepare:"
|
LOG(RPI, Debug) << "Signalling signalIspPrepare:"
|
||||||
|
|
|
@ -8,8 +8,6 @@
|
||||||
|
|
||||||
#include <libcamera/base/log.h>
|
#include <libcamera/base/log.h>
|
||||||
|
|
||||||
#include <libcamera/ipa/raspberrypi_ipa_interface.h>
|
|
||||||
|
|
||||||
namespace libcamera {
|
namespace libcamera {
|
||||||
|
|
||||||
LOG_DEFINE_CATEGORY(RPISTREAM)
|
LOG_DEFINE_CATEGORY(RPISTREAM)
|
||||||
|
@ -74,7 +72,7 @@ int Stream::getBufferId(FrameBuffer *buffer) const
|
||||||
|
|
||||||
void Stream::setExternalBuffer(FrameBuffer *buffer)
|
void Stream::setExternalBuffer(FrameBuffer *buffer)
|
||||||
{
|
{
|
||||||
bufferMap_.emplace(ipa::RPi::MaskExternalBuffer | id_.get(), buffer);
|
bufferMap_.emplace(BufferMask::MaskExternalBuffer | id_.get(), buffer);
|
||||||
}
|
}
|
||||||
|
|
||||||
void Stream::removeExternalBuffer(FrameBuffer *buffer)
|
void Stream::removeExternalBuffer(FrameBuffer *buffer)
|
||||||
|
@ -82,7 +80,7 @@ void Stream::removeExternalBuffer(FrameBuffer *buffer)
|
||||||
int id = getBufferId(buffer);
|
int id = getBufferId(buffer);
|
||||||
|
|
||||||
/* Ensure we have this buffer in the stream, and it is marked external. */
|
/* Ensure we have this buffer in the stream, and it is marked external. */
|
||||||
ASSERT(id != -1 && (id & ipa::RPi::MaskExternalBuffer));
|
ASSERT(id != -1 && (id & BufferMask::MaskExternalBuffer));
|
||||||
bufferMap_.erase(id);
|
bufferMap_.erase(id);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -12,7 +12,6 @@
|
||||||
#include <unordered_map>
|
#include <unordered_map>
|
||||||
#include <vector>
|
#include <vector>
|
||||||
|
|
||||||
#include <libcamera/ipa/raspberrypi_ipa_interface.h>
|
|
||||||
#include <libcamera/stream.h>
|
#include <libcamera/stream.h>
|
||||||
|
|
||||||
#include "libcamera/internal/v4l2_videodevice.h"
|
#include "libcamera/internal/v4l2_videodevice.h"
|
||||||
|
@ -23,6 +22,14 @@ namespace RPi {
|
||||||
|
|
||||||
using BufferMap = std::unordered_map<unsigned int, FrameBuffer *>;
|
using BufferMap = std::unordered_map<unsigned int, FrameBuffer *>;
|
||||||
|
|
||||||
|
enum BufferMask {
|
||||||
|
MaskID = 0x00ffff,
|
||||||
|
MaskStats = 0x010000,
|
||||||
|
MaskEmbeddedData = 0x020000,
|
||||||
|
MaskBayerData = 0x040000,
|
||||||
|
MaskExternalBuffer = 0x100000,
|
||||||
|
};
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* Device stream abstraction for either an internal or external stream.
|
* Device stream abstraction for either an internal or external stream.
|
||||||
* Used for both Unicam and the ISP.
|
* Used for both Unicam and the ISP.
|
||||||
|
@ -31,13 +38,13 @@ class Stream : public libcamera::Stream
|
||||||
{
|
{
|
||||||
public:
|
public:
|
||||||
Stream()
|
Stream()
|
||||||
: id_(ipa::RPi::MaskID)
|
: id_(BufferMask::MaskID)
|
||||||
{
|
{
|
||||||
}
|
}
|
||||||
|
|
||||||
Stream(const char *name, MediaEntity *dev, bool importOnly = false)
|
Stream(const char *name, MediaEntity *dev, bool importOnly = false)
|
||||||
: external_(false), importOnly_(importOnly), name_(name),
|
: external_(false), importOnly_(importOnly), name_(name),
|
||||||
dev_(std::make_unique<V4L2VideoDevice>(dev)), id_(ipa::RPi::MaskID)
|
dev_(std::make_unique<V4L2VideoDevice>(dev)), id_(BufferMask::MaskID)
|
||||||
{
|
{
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue