summaryrefslogtreecommitdiff
path: root/src/android/mm
diff options
context:
space:
mode:
authorHarvey Yang <chenghaoyang@chromium.org>2023-02-08 03:33:16 +0000
committerLaurent Pinchart <laurent.pinchart@ideasonboard.com>2023-02-10 00:47:41 +0200
commitb64fa1363c289936da145fb8faf474838b514854 (patch)
tree743b5d789b80a344a8dfd09ea98793ea734171eb /src/android/mm
parent4843bfa66dc117e94ce61d2b70b89958a7c9af3d (diff)
android: framebuffer: Add HALFrameBuffer and replace FrameBuffer
HALFrameBuffer is derived from FrameBuffer with access to buffer_handle_t, which is needed for JEA usage. Signed-off-by: Harvey Yang <chenghaoyang@chromium.org> Reviewed-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com> Reviewed-by: Han-Lin Chen <hanlinchen@chromium.org> Signed-off-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com>
Diffstat (limited to 'src/android/mm')
-rw-r--r--src/android/mm/cros_frame_buffer_allocator.cpp9
-rw-r--r--src/android/mm/generic_frame_buffer_allocator.cpp11
2 files changed, 12 insertions, 8 deletions
diff --git a/src/android/mm/cros_frame_buffer_allocator.cpp b/src/android/mm/cros_frame_buffer_allocator.cpp
index 0665c77b..0a5c59f2 100644
--- a/src/android/mm/cros_frame_buffer_allocator.cpp
+++ b/src/android/mm/cros_frame_buffer_allocator.cpp
@@ -16,6 +16,7 @@
#include "../camera_device.h"
#include "../frame_buffer_allocator.h"
+#include "../hal_framebuffer.h"
#include "cros-camera/camera_buffer_manager.h"
using namespace libcamera;
@@ -48,11 +49,11 @@ public:
{
}
- std::unique_ptr<libcamera::FrameBuffer>
+ std::unique_ptr<HALFrameBuffer>
allocate(int halPixelFormat, const libcamera::Size &size, uint32_t usage);
};
-std::unique_ptr<libcamera::FrameBuffer>
+std::unique_ptr<HALFrameBuffer>
PlatformFrameBufferAllocator::Private::allocate(int halPixelFormat,
const libcamera::Size &size,
uint32_t usage)
@@ -81,8 +82,8 @@ PlatformFrameBufferAllocator::Private::allocate(int halPixelFormat,
plane.length = cros::CameraBufferManager::GetPlaneSize(handle, i);
}
- return std::make_unique<FrameBuffer>(
- std::make_unique<CrosFrameBufferData>(std::move(scopedHandle), planes));
+ return std::make_unique<HALFrameBuffer>(
+ std::make_unique<CrosFrameBufferData>(std::move(scopedHandle), planes), handle);
}
PUBLIC_FRAME_BUFFER_ALLOCATOR_IMPLEMENTATION
diff --git a/src/android/mm/generic_frame_buffer_allocator.cpp b/src/android/mm/generic_frame_buffer_allocator.cpp
index 956623df..3750e1bf 100644
--- a/src/android/mm/generic_frame_buffer_allocator.cpp
+++ b/src/android/mm/generic_frame_buffer_allocator.cpp
@@ -20,6 +20,7 @@
#include "../camera_device.h"
#include "../frame_buffer_allocator.h"
+#include "../hal_framebuffer.h"
using namespace libcamera;
@@ -79,7 +80,7 @@ public:
~Private() override;
- std::unique_ptr<libcamera::FrameBuffer>
+ std::unique_ptr<HALFrameBuffer>
allocate(int halPixelFormat, const libcamera::Size &size, uint32_t usage);
private:
@@ -94,7 +95,7 @@ PlatformFrameBufferAllocator::Private::~Private()
gralloc_close(allocDevice_);
}
-std::unique_ptr<libcamera::FrameBuffer>
+std::unique_ptr<HALFrameBuffer>
PlatformFrameBufferAllocator::Private::allocate(int halPixelFormat,
const libcamera::Size &size,
uint32_t usage)
@@ -137,8 +138,10 @@ PlatformFrameBufferAllocator::Private::allocate(int halPixelFormat,
offset += planeSize;
}
- return std::make_unique<FrameBuffer>(
- std::make_unique<GenericFrameBufferData>(allocDevice_, handle, planes));
+ return std::make_unique<HALFrameBuffer>(
+ std::make_unique<GenericFrameBufferData>(
+ allocDevice_, handle, planes),
+ handle);
}
PUBLIC_FRAME_BUFFER_ALLOCATOR_IMPLEMENTATION