From dc4af4914a13e18285ee1a62baef3f7ac702867c Mon Sep 17 00:00:00 2001 From: Jacopo Mondi Date: Wed, 9 Oct 2024 13:21:10 +0200 Subject: rkisp1: Remove Request from FrameInfo So that we can run without users requests. Signed-off-by: Jacopo Mondi --- src/libcamera/pipeline/rkisp1/rkisp1.cpp | 50 +++++++++++++------------------- 1 file changed, 20 insertions(+), 30 deletions(-) diff --git a/src/libcamera/pipeline/rkisp1/rkisp1.cpp b/src/libcamera/pipeline/rkisp1/rkisp1.cpp index 83ac666c..e0774328 100644 --- a/src/libcamera/pipeline/rkisp1/rkisp1.cpp +++ b/src/libcamera/pipeline/rkisp1/rkisp1.cpp @@ -52,7 +52,6 @@ class RkISP1CameraData; struct RkISP1FrameInfo { unsigned int frame; - Request *request; FrameBuffer *paramBuffer; FrameBuffer *statBuffer; @@ -68,14 +67,12 @@ class RkISP1Frames public: RkISP1Frames(PipelineHandler *pipe); - RkISP1FrameInfo *create(const RkISP1CameraData *data, Request *request, - bool isRaw); + RkISP1FrameInfo *create(const RkISP1CameraData *data, bool isRaw); int destroy(unsigned int frame); void clear(); RkISP1FrameInfo *find(unsigned int frame); RkISP1FrameInfo *find(FrameBuffer *buffer); - RkISP1FrameInfo *find(Request *request); private: PipelineHandlerRkISP1 *pipe_; @@ -215,13 +212,13 @@ RkISP1Frames::RkISP1Frames(PipelineHandler *pipe) { } -RkISP1FrameInfo *RkISP1Frames::create(const RkISP1CameraData *data, Request *request, - bool isRaw) +RkISP1FrameInfo *RkISP1Frames::create(const RkISP1CameraData *data, bool isRaw) { unsigned int frame = data->frame_; FrameBuffer *paramBuffer = nullptr; FrameBuffer *statBuffer = nullptr; + FrameBuffer *mainPathBuffer = nullptr; if (!isRaw) { if (pipe_->availableParamBuffers_.empty()) { @@ -241,16 +238,22 @@ RkISP1FrameInfo *RkISP1Frames::create(const RkISP1CameraData *data, Request *req pipe_->availableStatBuffers_.pop(); } - FrameBuffer *mainPathBuffer = request->findBuffer(&data->mainPathStream_); - FrameBuffer *selfPathBuffer = request->findBuffer(&data->selfPathStream_); + if (pipe_->availableMainPathBuffers_.empty()) { + LOG(RkISP1, Error) << "Main path buffer underrun"; + return nullptr; + } + mainPathBuffer = pipe_->availableMainPathBuffers_.front(); + pipe_->availableMainPathBuffers_.pop(); + + //FrameBuffer *mainPathBuffer = request->findBuffer(&data->mainPathStream_); + //FrameBuffer *selfPathBuffer = request->findBuffer(&data->selfPathStream_); RkISP1FrameInfo *info = new RkISP1FrameInfo; info->frame = frame; - info->request = request; info->paramBuffer = paramBuffer; info->mainPathBuffer = mainPathBuffer; - info->selfPathBuffer = selfPathBuffer; + //info->selfPathBuffer = selfPathBuffer; info->statBuffer = statBuffer; info->paramDequeued = false; info->metadataProcessed = false; @@ -319,20 +322,6 @@ RkISP1FrameInfo *RkISP1Frames::find(FrameBuffer *buffer) return nullptr; } -RkISP1FrameInfo *RkISP1Frames::find(Request *request) -{ - for (auto &itInfo : frameInfo_) { - RkISP1FrameInfo *info = itInfo.second; - - if (info->request == request) - return info; - } - - LOG(RkISP1, Fatal) << "Can't locate info from request"; - - return nullptr; -} - PipelineHandlerRkISP1 *RkISP1CameraData::pipe() { return static_cast(Camera::Private::pipe()); @@ -402,13 +391,14 @@ void RkISP1CameraData::setSensorControls([[maybe_unused]] unsigned int frame, delayedCtrls_->push(sensorControls); } -void RkISP1CameraData::metadataReady(unsigned int frame, const ControlList &metadata) +void RkISP1CameraData::metadataReady(unsigned int frame, + [[maybe_unused]] const ControlList &metadata) { RkISP1FrameInfo *info = frameInfo_.find(frame); if (!info) return; - info->request->metadata().merge(metadata); + //info->request->metadata().merge(metadata); info->metadataProcessed = true; pipe()->tryCompleteRequest(info); @@ -1061,7 +1051,7 @@ int PipelineHandlerRkISP1::queueRequestDevice(Camera *camera, Request *request) { RkISP1CameraData *data = cameraData(camera); - RkISP1FrameInfo *info = data->frameInfo_.create(data, request, isRaw_); + RkISP1FrameInfo *info = data->frameInfo_.create(data, isRaw_); if (!info) return -ENOENT; @@ -1272,9 +1262,9 @@ bool PipelineHandlerRkISP1::match(DeviceEnumerator *enumerator) void PipelineHandlerRkISP1::tryCompleteRequest(RkISP1FrameInfo *info) { RkISP1CameraData *data = cameraData(activeCamera_); - Request *request = info->request; + //Request *request = info->request; - if (request->hasPendingBuffers()) + //if (request->hasPendingBuffers()) return; if (!info->metadataProcessed) @@ -1285,7 +1275,7 @@ void PipelineHandlerRkISP1::tryCompleteRequest(RkISP1FrameInfo *info) data->frameInfo_.destroy(info->frame); - completeRequest(request); + //completeRequest(request); } void PipelineHandlerRkISP1::bufferReady(FrameBuffer *buffer) -- cgit v1.2.1