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>
This commit is contained in:
Harvey Yang
2023-02-10 00:47:41 +02:00
committed by Laurent Pinchart
parent 4843bfa66d
commit b64fa1363c
9 changed files with 72 additions and 15 deletions
@@ -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
@@ -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