qcam: viewfinder: Make the viewfinder hold a reference to a buffer
The viewfinder is currently expected to render frames to the screen synchronously in the display() function, or at least to copy data so that the buffer can be queued in a new request when the function returns. This prevents optimisations when the capture format is identical to the display format. Make the viewfinder take ownership of the buffer, and notify of its release through a signal. The release is currently still synchronous, this will be addressed in a subsequent patch. Rename the ViewFinder::display() function to render() to better describe its purpose, as it's meant to start the rendering and not display the frame synchronously. Signed-off-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com> Reviewed-by: Kieran Bingham <kieran.bingham@ideasonboard.com>
This commit is contained in:
@@ -25,8 +25,7 @@ ViewFinder::~ViewFinder()
|
||||
delete image_;
|
||||
}
|
||||
|
||||
void ViewFinder::display(const libcamera::FrameBuffer *buffer,
|
||||
MappedBuffer *map)
|
||||
void ViewFinder::render(libcamera::FrameBuffer *buffer, MappedBuffer *map)
|
||||
{
|
||||
if (buffer->planes().size() != 1) {
|
||||
qWarning() << "Multi-planar buffers are not supported";
|
||||
@@ -44,6 +43,8 @@ void ViewFinder::display(const libcamera::FrameBuffer *buffer,
|
||||
converter_.convert(static_cast<unsigned char *>(map->memory),
|
||||
buffer->metadata().planes[0].bytesused, image_);
|
||||
update();
|
||||
|
||||
renderComplete(buffer);
|
||||
}
|
||||
|
||||
QImage ViewFinder::getCurrentImage()
|
||||
|
||||
Reference in New Issue
Block a user