Message ID | 20211018132923.476242-7-umang.jain@ideasonboard.com |
---|---|
State | Superseded |
Delegated to: | Umang Jain |
Headers | show |
Series |
|
Related | show |
Hi Laurent, On Mon, Oct 18, 2021 at 06:59:18PM +0530, Umang Jain wrote: > From: Laurent Pinchart <laurent.pinchart@ideasonboard.com> > > Now that we have a proper structure to model a stream buffer, pass it to > CameraStream::process() instead of the camera3_stream_buffer_t. This > will allow accessing other members of StreamBuffer in subsequent > commits. > > Signed-off-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com> Reviewed-by: Jacopo Mondi <jacopo@jmondi.org> Thanks j > --- > src/android/camera_device.cpp | 2 +- > src/android/camera_stream.cpp | 14 +++++++------- > src/android/camera_stream.h | 5 +++-- > 3 files changed, 11 insertions(+), 10 deletions(-) > > diff --git a/src/android/camera_device.cpp b/src/android/camera_device.cpp > index 59557358..cd9e9fe2 100644 > --- a/src/android/camera_device.cpp > +++ b/src/android/camera_device.cpp > @@ -1175,7 +1175,7 @@ void CameraDevice::requestComplete(Request *request) > continue; > } > > - int ret = cameraStream->process(*src, buffer.buffer, descriptor); > + int ret = cameraStream->process(*src, buffer, descriptor); > > /* > * Return the FrameBuffer to the CameraStream now that we're > diff --git a/src/android/camera_stream.cpp b/src/android/camera_stream.cpp > index 8f47e4d8..f3cc77e7 100644 > --- a/src/android/camera_stream.cpp > +++ b/src/android/camera_stream.cpp > @@ -143,15 +143,15 @@ int CameraStream::waitFence(int fence) > } > > int CameraStream::process(const FrameBuffer &source, > - camera3_stream_buffer_t &camera3Dest, > + Camera3RequestDescriptor::StreamBuffer &dest, > Camera3RequestDescriptor *request) > { > /* Handle waiting on fences on the destination buffer. */ > - int fence = camera3Dest.acquire_fence; > + int fence = dest.buffer.acquire_fence; > if (fence != -1) { > int ret = waitFence(fence); > ::close(fence); > - camera3Dest.acquire_fence = -1; > + dest.buffer.acquire_fence = -1; > if (ret < 0) { > LOG(HAL, Error) << "Failed waiting for fence: " > << fence << ": " << strerror(-ret); > @@ -167,14 +167,14 @@ int CameraStream::process(const FrameBuffer &source, > * separate thread. > */ > const StreamConfiguration &output = configuration(); > - CameraBuffer dest(*camera3Dest.buffer, output.pixelFormat, output.size, > - PROT_READ | PROT_WRITE); > - if (!dest.isValid()) { > + CameraBuffer destBuffer(*dest.buffer.buffer, output.pixelFormat, > + output.size, PROT_READ | PROT_WRITE); > + if (!destBuffer.isValid()) { > LOG(HAL, Error) << "Failed to create destination buffer"; > return -EINVAL; > } > > - return postProcessor_->process(source, &dest, request); > + return postProcessor_->process(source, &destBuffer, request); > } > > FrameBuffer *CameraStream::getBuffer() > diff --git a/src/android/camera_stream.h b/src/android/camera_stream.h > index 405b232d..197bd995 100644 > --- a/src/android/camera_stream.h > +++ b/src/android/camera_stream.h > @@ -19,7 +19,8 @@ > #include <libcamera/geometry.h> > #include <libcamera/pixel_format.h> > > -class Camera3RequestDescriptor; > +#include "camera_request.h" > + > class CameraDevice; > class PostProcessor; > > @@ -119,7 +120,7 @@ public: > > int configure(); > int process(const libcamera::FrameBuffer &source, > - camera3_stream_buffer_t &camera3Buffer, > + Camera3RequestDescriptor::StreamBuffer &dest, > Camera3RequestDescriptor *request); > libcamera::FrameBuffer *getBuffer(); > void putBuffer(libcamera::FrameBuffer *buffer); > -- > 2.31.0 >
Hi Umang, On Mon, Oct 18, 2021 at 06:59:18PM +0530, Umang Jain wrote: > From: Laurent Pinchart <laurent.pinchart@ideasonboard.com> > > Now that we have a proper structure to model a stream buffer, pass it to > CameraStream::process() instead of the camera3_stream_buffer_t. This > will allow accessing other members of StreamBuffer in subsequent > commits. > > Signed-off-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com> Reviewed-by: Jacopo Mondi <jacopo@jmondi.org> Thanks j > --- > src/android/camera_device.cpp | 2 +- > src/android/camera_stream.cpp | 14 +++++++------- > src/android/camera_stream.h | 5 +++-- > 3 files changed, 11 insertions(+), 10 deletions(-) > > diff --git a/src/android/camera_device.cpp b/src/android/camera_device.cpp > index 59557358..cd9e9fe2 100644 > --- a/src/android/camera_device.cpp > +++ b/src/android/camera_device.cpp > @@ -1175,7 +1175,7 @@ void CameraDevice::requestComplete(Request *request) > continue; > } > > - int ret = cameraStream->process(*src, buffer.buffer, descriptor); > + int ret = cameraStream->process(*src, buffer, descriptor); > > /* > * Return the FrameBuffer to the CameraStream now that we're > diff --git a/src/android/camera_stream.cpp b/src/android/camera_stream.cpp > index 8f47e4d8..f3cc77e7 100644 > --- a/src/android/camera_stream.cpp > +++ b/src/android/camera_stream.cpp > @@ -143,15 +143,15 @@ int CameraStream::waitFence(int fence) > } > > int CameraStream::process(const FrameBuffer &source, > - camera3_stream_buffer_t &camera3Dest, > + Camera3RequestDescriptor::StreamBuffer &dest, > Camera3RequestDescriptor *request) > { > /* Handle waiting on fences on the destination buffer. */ > - int fence = camera3Dest.acquire_fence; > + int fence = dest.buffer.acquire_fence; > if (fence != -1) { > int ret = waitFence(fence); > ::close(fence); > - camera3Dest.acquire_fence = -1; > + dest.buffer.acquire_fence = -1; > if (ret < 0) { > LOG(HAL, Error) << "Failed waiting for fence: " > << fence << ": " << strerror(-ret); > @@ -167,14 +167,14 @@ int CameraStream::process(const FrameBuffer &source, > * separate thread. > */ > const StreamConfiguration &output = configuration(); > - CameraBuffer dest(*camera3Dest.buffer, output.pixelFormat, output.size, > - PROT_READ | PROT_WRITE); > - if (!dest.isValid()) { > + CameraBuffer destBuffer(*dest.buffer.buffer, output.pixelFormat, > + output.size, PROT_READ | PROT_WRITE); > + if (!destBuffer.isValid()) { > LOG(HAL, Error) << "Failed to create destination buffer"; > return -EINVAL; > } > > - return postProcessor_->process(source, &dest, request); > + return postProcessor_->process(source, &destBuffer, request); > } > > FrameBuffer *CameraStream::getBuffer() > diff --git a/src/android/camera_stream.h b/src/android/camera_stream.h > index 405b232d..197bd995 100644 > --- a/src/android/camera_stream.h > +++ b/src/android/camera_stream.h > @@ -19,7 +19,8 @@ > #include <libcamera/geometry.h> > #include <libcamera/pixel_format.h> > > -class Camera3RequestDescriptor; > +#include "camera_request.h" > + > class CameraDevice; > class PostProcessor; > > @@ -119,7 +120,7 @@ public: > > int configure(); > int process(const libcamera::FrameBuffer &source, > - camera3_stream_buffer_t &camera3Buffer, > + Camera3RequestDescriptor::StreamBuffer &dest, > Camera3RequestDescriptor *request); > libcamera::FrameBuffer *getBuffer(); > void putBuffer(libcamera::FrameBuffer *buffer); > -- > 2.31.0 >
Hi Umang and Laurent, thank you for the patch. On Tue, Oct 19, 2021 at 1:26 AM Jacopo Mondi <jacopo@jmondi.org> wrote: > > Hi Laurent, > > On Mon, Oct 18, 2021 at 06:59:18PM +0530, Umang Jain wrote: > > From: Laurent Pinchart <laurent.pinchart@ideasonboard.com> > > > > Now that we have a proper structure to model a stream buffer, pass it to > > CameraStream::process() instead of the camera3_stream_buffer_t. This > > will allow accessing other members of StreamBuffer in subsequent > > commits. > > > > Signed-off-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com> > > Reviewed-by: Jacopo Mondi <jacopo@jmondi.org> > Reviewed-by: Hirokazu Honda <hiroh@chromium.org> > Thanks > j > > --- > > src/android/camera_device.cpp | 2 +- > > src/android/camera_stream.cpp | 14 +++++++------- > > src/android/camera_stream.h | 5 +++-- > > 3 files changed, 11 insertions(+), 10 deletions(-) > > > > diff --git a/src/android/camera_device.cpp b/src/android/camera_device.cpp > > index 59557358..cd9e9fe2 100644 > > --- a/src/android/camera_device.cpp > > +++ b/src/android/camera_device.cpp > > @@ -1175,7 +1175,7 @@ void CameraDevice::requestComplete(Request *request) > > continue; > > } > > > > - int ret = cameraStream->process(*src, buffer.buffer, descriptor); > > + int ret = cameraStream->process(*src, buffer, descriptor); > > > > /* > > * Return the FrameBuffer to the CameraStream now that we're > > diff --git a/src/android/camera_stream.cpp b/src/android/camera_stream.cpp > > index 8f47e4d8..f3cc77e7 100644 > > --- a/src/android/camera_stream.cpp > > +++ b/src/android/camera_stream.cpp > > @@ -143,15 +143,15 @@ int CameraStream::waitFence(int fence) > > } > > > > int CameraStream::process(const FrameBuffer &source, > > - camera3_stream_buffer_t &camera3Dest, > > + Camera3RequestDescriptor::StreamBuffer &dest, > > Camera3RequestDescriptor *request) > > { > > /* Handle waiting on fences on the destination buffer. */ > > - int fence = camera3Dest.acquire_fence; > > + int fence = dest.buffer.acquire_fence; > > if (fence != -1) { > > int ret = waitFence(fence); > > ::close(fence); > > - camera3Dest.acquire_fence = -1; > > + dest.buffer.acquire_fence = -1; > > if (ret < 0) { > > LOG(HAL, Error) << "Failed waiting for fence: " > > << fence << ": " << strerror(-ret); > > @@ -167,14 +167,14 @@ int CameraStream::process(const FrameBuffer &source, > > * separate thread. > > */ > > const StreamConfiguration &output = configuration(); > > - CameraBuffer dest(*camera3Dest.buffer, output.pixelFormat, output.size, > > - PROT_READ | PROT_WRITE); > > - if (!dest.isValid()) { > > + CameraBuffer destBuffer(*dest.buffer.buffer, output.pixelFormat, > > + output.size, PROT_READ | PROT_WRITE); > > + if (!destBuffer.isValid()) { > > LOG(HAL, Error) << "Failed to create destination buffer"; > > return -EINVAL; > > } > > > > - return postProcessor_->process(source, &dest, request); > > + return postProcessor_->process(source, &destBuffer, request); > > } > > > > FrameBuffer *CameraStream::getBuffer() > > diff --git a/src/android/camera_stream.h b/src/android/camera_stream.h > > index 405b232d..197bd995 100644 > > --- a/src/android/camera_stream.h > > +++ b/src/android/camera_stream.h > > @@ -19,7 +19,8 @@ > > #include <libcamera/geometry.h> > > #include <libcamera/pixel_format.h> > > > > -class Camera3RequestDescriptor; > > +#include "camera_request.h" > > + > > class CameraDevice; > > class PostProcessor; > > > > @@ -119,7 +120,7 @@ public: > > > > int configure(); > > int process(const libcamera::FrameBuffer &source, > > - camera3_stream_buffer_t &camera3Buffer, > > + Camera3RequestDescriptor::StreamBuffer &dest, > > Camera3RequestDescriptor *request); > > libcamera::FrameBuffer *getBuffer(); > > void putBuffer(libcamera::FrameBuffer *buffer); > > -- > > 2.31.0 > >
diff --git a/src/android/camera_device.cpp b/src/android/camera_device.cpp index 59557358..cd9e9fe2 100644 --- a/src/android/camera_device.cpp +++ b/src/android/camera_device.cpp @@ -1175,7 +1175,7 @@ void CameraDevice::requestComplete(Request *request) continue; } - int ret = cameraStream->process(*src, buffer.buffer, descriptor); + int ret = cameraStream->process(*src, buffer, descriptor); /* * Return the FrameBuffer to the CameraStream now that we're diff --git a/src/android/camera_stream.cpp b/src/android/camera_stream.cpp index 8f47e4d8..f3cc77e7 100644 --- a/src/android/camera_stream.cpp +++ b/src/android/camera_stream.cpp @@ -143,15 +143,15 @@ int CameraStream::waitFence(int fence) } int CameraStream::process(const FrameBuffer &source, - camera3_stream_buffer_t &camera3Dest, + Camera3RequestDescriptor::StreamBuffer &dest, Camera3RequestDescriptor *request) { /* Handle waiting on fences on the destination buffer. */ - int fence = camera3Dest.acquire_fence; + int fence = dest.buffer.acquire_fence; if (fence != -1) { int ret = waitFence(fence); ::close(fence); - camera3Dest.acquire_fence = -1; + dest.buffer.acquire_fence = -1; if (ret < 0) { LOG(HAL, Error) << "Failed waiting for fence: " << fence << ": " << strerror(-ret); @@ -167,14 +167,14 @@ int CameraStream::process(const FrameBuffer &source, * separate thread. */ const StreamConfiguration &output = configuration(); - CameraBuffer dest(*camera3Dest.buffer, output.pixelFormat, output.size, - PROT_READ | PROT_WRITE); - if (!dest.isValid()) { + CameraBuffer destBuffer(*dest.buffer.buffer, output.pixelFormat, + output.size, PROT_READ | PROT_WRITE); + if (!destBuffer.isValid()) { LOG(HAL, Error) << "Failed to create destination buffer"; return -EINVAL; } - return postProcessor_->process(source, &dest, request); + return postProcessor_->process(source, &destBuffer, request); } FrameBuffer *CameraStream::getBuffer() diff --git a/src/android/camera_stream.h b/src/android/camera_stream.h index 405b232d..197bd995 100644 --- a/src/android/camera_stream.h +++ b/src/android/camera_stream.h @@ -19,7 +19,8 @@ #include <libcamera/geometry.h> #include <libcamera/pixel_format.h> -class Camera3RequestDescriptor; +#include "camera_request.h" + class CameraDevice; class PostProcessor; @@ -119,7 +120,7 @@ public: int configure(); int process(const libcamera::FrameBuffer &source, - camera3_stream_buffer_t &camera3Buffer, + Camera3RequestDescriptor::StreamBuffer &dest, Camera3RequestDescriptor *request); libcamera::FrameBuffer *getBuffer(); void putBuffer(libcamera::FrameBuffer *buffer);