[libcamera-devel,v5,0/4] Async Post Processor
mbox series

Message ID 20211020104212.121743-1-umang.jain@ideasonboard.com
Headers show
Series
  • Async Post Processor
Related show

Message

Umang Jain Oct. 20, 2021, 10:42 a.m. UTC
This is v5 for Async Post Processor based on top of recent HAL
refactoring "android: Overhaul request completion handling"

This series primarily introduces a Thread worker class along
with a queue, in which request for post-process of streams
are queued and processed ansychronously. All the context information
is carried inside Camera3RequestDescriptor.

Patch 1/4 and 2/4 introduces a notification mechanism to know
that a post-processing request has been finished. These run
synchronously.

3/4 introduces the asynchronous-nity along with post-processor's
queue. 

4/4 prevents a small window of race while setting the descriptor
status_ (since status can be set from 2 threads now, main thread vs
post_processor's thread)

No CTS regressions seen on nautilus with this series.

Some open questions/discussions:
- As flush/stop scenarios are kept out of scope of this series,
  however, I have kept flush() implementation for PostProcessorWorker
  class in this series. It isn't called but makes the patch complete to
  me.

- streamsProcessMutex_ currently guards only post-processing bits
  while it comes to descriptor->buffers_. Should we access-control
  all calls to descriptor->buffers_ with streamProcessMutex_ (I don't
  think so) but there might be a race I haven't considered.

- As seen by 2/4, CameraStream::process returns a value to fail-check.
  PostProcessor::process() doesn't (rather it notifies via signal
  mechanism). There might be a case where multiple streams require
  post-processor, 1 one them gets queued sucessfully, other one fails,
  returning error value from CameraStream::process(). How would we
  handle this situation. There is \todo: mark in 3/4 regarding this.

Laurent Pinchart (1):
  android: camera_device: Protect descriptor status_ with lock

Umang Jain (3):
  android: Notify post processing completion via a signal
  android: post_processor: Drop return value for process()
  android: post_processor: Make post processing async

 src/android/camera_device.cpp            | 143 +++++++++++++++++------
 src/android/camera_device.h              |  12 +-
 src/android/camera_request.h             |   8 ++
 src/android/camera_stream.cpp            | 122 +++++++++++++++++--
 src/android/camera_stream.h              |  38 +++++-
 src/android/jpeg/post_processor_jpeg.cpp |  14 +--
 src/android/jpeg/post_processor_jpeg.h   |   6 +-
 src/android/post_processor.h             |  15 ++-
 src/android/yuv/post_processor_yuv.cpp   |  20 ++--
 src/android/yuv/post_processor_yuv.h     |   6 +-
 10 files changed, 312 insertions(+), 72 deletions(-)