android: mm: generic: use GRALLOC_HARDWARE_MODULE_ID
PlatformFrameBufferAllocator is an abstraction over gralloc.
Right now hardwareModule_ points towards a CAMERA_HARDWARE_MODULE_ID.
When gralloc_open() is called we observe:
libcamera: DEBUG HAL camera3_hal.cpp:75 Open camera gpu0
libcamera: ERROR Camera camera.cpp:524 Camera in Configured state trying acquire() requiring state Available
01-23 14:14:04.742 370 416 E libcamera: FATAL HAL generic_frame_buffer_allocator.cpp:105 gralloc_open() failed: -87
Which is wrong, gralloc_open() is attempting to re-open the camera HAL,
instead of the gralloc HAL.
Point to a GRALLOC_HARDWARE_MODULE_ID instead so that we can request
buffers from gralloc in android.
Note: this adds new dependencies on android's libhardware [1] and on libdl.
[1] https://android.googlesource.com/platform/hardware/libhardware
Fixes: c58662c577
("android: Introduce PlatformFrameBufferAllocator")
Signed-off-by: Mattijs Korpershoek <mkorpershoek@baylibre.com>
Reviewed-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com>
Reviewed-by: Kieran Bingham <kieran.bingham@ideasonboard.com>
Signed-off-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com>
This commit is contained in:
parent
76e1cb9f71
commit
1450e09a08
2 changed files with 9 additions and 2 deletions
|
@ -5,6 +5,7 @@
|
||||||
* generic_camera_buffer.cpp - Allocate FrameBuffer using gralloc API
|
* generic_camera_buffer.cpp - Allocate FrameBuffer using gralloc API
|
||||||
*/
|
*/
|
||||||
|
|
||||||
|
#include <dlfcn.h>
|
||||||
#include <memory>
|
#include <memory>
|
||||||
#include <vector>
|
#include <vector>
|
||||||
|
|
||||||
|
@ -72,9 +73,10 @@ class PlatformFrameBufferAllocator::Private : public Extensible::Private
|
||||||
public:
|
public:
|
||||||
Private(CameraDevice *const cameraDevice)
|
Private(CameraDevice *const cameraDevice)
|
||||||
: cameraDevice_(cameraDevice),
|
: cameraDevice_(cameraDevice),
|
||||||
hardwareModule_(cameraDevice->camera3Device()->common.module),
|
hardwareModule_(nullptr),
|
||||||
allocDevice_(nullptr)
|
allocDevice_(nullptr)
|
||||||
{
|
{
|
||||||
|
hw_get_module(GRALLOC_HARDWARE_MODULE_ID, &hardwareModule_);
|
||||||
ASSERT(hardwareModule_);
|
ASSERT(hardwareModule_);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -85,7 +87,7 @@ public:
|
||||||
|
|
||||||
private:
|
private:
|
||||||
const CameraDevice *const cameraDevice_;
|
const CameraDevice *const cameraDevice_;
|
||||||
struct hw_module_t *const hardwareModule_;
|
const struct hw_module_t *hardwareModule_;
|
||||||
struct alloc_device_t *allocDevice_;
|
struct alloc_device_t *allocDevice_;
|
||||||
};
|
};
|
||||||
|
|
||||||
|
@ -93,6 +95,7 @@ PlatformFrameBufferAllocator::Private::~Private()
|
||||||
{
|
{
|
||||||
if (allocDevice_)
|
if (allocDevice_)
|
||||||
gralloc_close(allocDevice_);
|
gralloc_close(allocDevice_);
|
||||||
|
dlclose(hardwareModule_->dso);
|
||||||
}
|
}
|
||||||
|
|
||||||
std::unique_ptr<HALFrameBuffer>
|
std::unique_ptr<HALFrameBuffer>
|
||||||
|
|
|
@ -4,6 +4,10 @@ platform = get_option('android_platform')
|
||||||
if platform == 'generic'
|
if platform == 'generic'
|
||||||
android_hal_sources += files(['generic_camera_buffer.cpp',
|
android_hal_sources += files(['generic_camera_buffer.cpp',
|
||||||
'generic_frame_buffer_allocator.cpp'])
|
'generic_frame_buffer_allocator.cpp'])
|
||||||
|
android_deps += [
|
||||||
|
libdl,
|
||||||
|
dependency('libhardware'),
|
||||||
|
]
|
||||||
elif platform == 'cros'
|
elif platform == 'cros'
|
||||||
android_hal_sources += files(['cros_camera_buffer.cpp',
|
android_hal_sources += files(['cros_camera_buffer.cpp',
|
||||||
'cros_frame_buffer_allocator.cpp'])
|
'cros_frame_buffer_allocator.cpp'])
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue