summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--src/libcamera/pipeline/rkisp1/rkisp1.cpp78
1 files changed, 24 insertions, 54 deletions
diff --git a/src/libcamera/pipeline/rkisp1/rkisp1.cpp b/src/libcamera/pipeline/rkisp1/rkisp1.cpp
index 116d205b..ab555cf2 100644
--- a/src/libcamera/pipeline/rkisp1/rkisp1.cpp
+++ b/src/libcamera/pipeline/rkisp1/rkisp1.cpp
@@ -41,7 +41,6 @@ namespace libcamera {
LOG_DEFINE_CATEGORY(RkISP1)
class PipelineHandlerRkISP1;
-class RkISP1ActionQueueBuffers;
class RkISP1CameraData;
enum RkISP1ActionType {
@@ -197,7 +196,6 @@ private:
PipelineHandler::cameraData(camera));
}
- friend RkISP1ActionQueueBuffers;
friend RkISP1CameraData;
friend RkISP1Frames;
@@ -208,6 +206,7 @@ private:
void bufferReady(FrameBuffer *buffer);
void paramReady(FrameBuffer *buffer);
void statReady(FrameBuffer *buffer);
+ void frameStart(uint32_t sequence);
int allocateBuffers(Camera *camera);
int freeBuffers(Camera *camera);
@@ -342,53 +341,6 @@ RkISP1FrameInfo *RkISP1Frames::find(Request *request)
return nullptr;
}
-class RkISP1ActionQueueBuffers : public FrameAction
-{
-public:
- RkISP1ActionQueueBuffers(unsigned int frame, RkISP1CameraData *data,
- PipelineHandlerRkISP1 *pipe)
- : FrameAction(frame, QueueBuffers), data_(data), pipe_(pipe)
- {
- }
-
-protected:
- void run() override
- {
- RkISP1FrameInfo *info = data_->frameInfo_.find(frame());
- if (!info)
- LOG(RkISP1, Fatal) << "Frame not known";
-
- /*
- * \todo: If parameters are not filled a better method to handle
- * the situation than queuing a buffer with unknown content
- * should be used.
- *
- * It seems excessive to keep an internal zeroed scratch
- * parameters buffer around as this should not happen unless the
- * devices is under too much load. Perhaps failing the request
- * and returning it to the application with an error code is
- * better than queue it to hardware?
- */
- if (!info->paramFilled)
- LOG(RkISP1, Error)
- << "Parameters not ready on time for frame "
- << frame();
-
- pipe_->param_->queueBuffer(info->paramBuffer);
- pipe_->stat_->queueBuffer(info->statBuffer);
-
- if (info->mainPathBuffer)
- pipe_->mainPath_.queueBuffer(info->mainPathBuffer);
-
- if (info->selfPathBuffer)
- pipe_->selfPath_.queueBuffer(info->selfPathBuffer);
- }
-
-private:
- RkISP1CameraData *data_;
- PipelineHandlerRkISP1 *pipe_;
-};
-
int RkISP1CameraData::loadIPA()
{
ipa_ = IPAManager::createIPA(pipe_, 1, 1);
@@ -945,9 +897,14 @@ int PipelineHandlerRkISP1::queueRequestDevice(Camera *camera, Request *request)
op.controls = { request->controls() };
data->ipa_->processEvent(op);
- data->timeline_.scheduleAction(std::make_unique<RkISP1ActionQueueBuffers>(data->frame_,
- data,
- this));
+ param_->queueBuffer(info->paramBuffer);
+ stat_->queueBuffer(info->statBuffer);
+
+ if (info->mainPathBuffer)
+ mainPath_.queueBuffer(info->mainPathBuffer);
+
+ if (info->selfPathBuffer)
+ selfPath_.queueBuffer(info->selfPathBuffer);
data->frame_++;
@@ -1097,6 +1054,7 @@ bool PipelineHandlerRkISP1::match(DeviceEnumerator *enumerator)
mainPath_.bufferReady().connect(this, &PipelineHandlerRkISP1::bufferReady);
selfPath_.bufferReady().connect(this, &PipelineHandlerRkISP1::bufferReady);
stat_->bufferReady.connect(this, &PipelineHandlerRkISP1::statReady);
+ isp_->frameStart.connect(this, &PipelineHandlerRkISP1::frameStart);
param_->bufferReady.connect(this, &PipelineHandlerRkISP1::paramReady);
/*
@@ -1175,8 +1133,6 @@ void PipelineHandlerRkISP1::statReady(FrameBuffer *buffer)
if (!info)
return;
- data->timeline_.bufferReady(buffer);
-
if (data->frame_ <= buffer->metadata().sequence)
data->frame_ = buffer->metadata().sequence + 1;
@@ -1186,6 +1142,20 @@ void PipelineHandlerRkISP1::statReady(FrameBuffer *buffer)
data->ipa_->processEvent(op);
}
+void PipelineHandlerRkISP1::frameStart(uint32_t sequence)
+{
+ if (!activeCamera_)
+ return;
+
+ RkISP1CameraData *data = cameraData(activeCamera_);
+
+ RkISP1FrameInfo *info = data->frameInfo_.find(sequence);
+ if (!info || !info->paramFilled)
+ LOG(RkISP1, Info)
+ << "Parameters not ready on time for frame "
+ << sequence;
+}
+
REGISTER_PIPELINE_HANDLER(PipelineHandlerRkISP1)
} /* namespace libcamera */
='#n262'>262 263 264 265 266 267 268 269 270 271 272 273 274 275 276 277 278 279 280 281 282 283 284 285 286 287 288 289 290 291 292 293 294 295 296 297 298 299 300 301 302 303 304 305 306 307 308 309 310 311 312 313 314 315 316 317 318 319 320 321 322 323 324 325 326 327 328 329 330 331 332 333 334 335 336 337 338 339 340 341 342 343 344 345 346 347 348 349 350 351 352 353 354 355 356 357 358 359 360 361 362 363 364 365 366 367 368 369 370 371 372 373 374 375 376 377 378 379 380 381 382 383 384 385 386 387 388 389 390 391 392 393 394 395 396 397 398 399 400 401 402 403 404 405 406 407 408 409 410 411 412