android: Stub GraphicBufferAllocator for build tests
If we want to keep building libcamera on traditional Linux systems with:
-Dandroid=enabled -Dandroid_platform=generic
We should stub GraphicBufferAllocator, which is not available.
It's only available when building with the VNDK or when building within the
AOSP tree.
Also remove some deprecated methods and inclusions which are not needed for
the stub class.
Note: the imported headers from Android generate the -Wextra-semi warning.
To avoid patching the files, a pragma has been added before inclusion.
Signed-off-by: Mattijs Korpershoek <mkorpershoek@baylibre.com>
This commit is contained in:
committed by
Konsta
parent
f2744d760e
commit
8691ade614
@@ -0,0 +1,53 @@
|
||||
/* SPDX-License-Identifier: Apache-2.0 */
|
||||
/*
|
||||
* Copyright (C) 2023, Ideas on Board
|
||||
* Copyright (C) 2023, BayLibre
|
||||
*
|
||||
* graphic_buffer_allocator_stub.cpp - Android GraphicBufferAllocator
|
||||
* stub for compile-testing
|
||||
*/
|
||||
|
||||
#pragma GCC diagnostic push
|
||||
#pragma GCC diagnostic ignored "-Wextra-semi"
|
||||
#include <ui/GraphicBufferAllocator.h>
|
||||
#pragma GCC diagnostic pop
|
||||
|
||||
namespace android {
|
||||
|
||||
ANDROID_SINGLETON_STATIC_INSTANCE(GraphicBufferAllocator)
|
||||
|
||||
GraphicBufferAllocator::GraphicBufferAllocator()
|
||||
{
|
||||
}
|
||||
GraphicBufferAllocator::~GraphicBufferAllocator()
|
||||
{
|
||||
}
|
||||
|
||||
uint64_t GraphicBufferAllocator::getTotalSize() const
|
||||
{
|
||||
return 0;
|
||||
}
|
||||
|
||||
#pragma GCC diagnostic push
|
||||
#pragma GCC diagnostic ignored "-Wunused-parameter"
|
||||
status_t GraphicBufferAllocator::allocate(uint32_t width,
|
||||
uint32_t height,
|
||||
PixelFormat format,
|
||||
uint32_t layerCount,
|
||||
uint64_t usage,
|
||||
buffer_handle_t *handle,
|
||||
uint32_t *stride,
|
||||
std::string requestorName)
|
||||
{
|
||||
*handle = nullptr;
|
||||
*stride = 0;
|
||||
return INVALID_OPERATION;
|
||||
}
|
||||
|
||||
status_t GraphicBufferAllocator::free(buffer_handle_t handle)
|
||||
{
|
||||
return INVALID_OPERATION;
|
||||
}
|
||||
#pragma GCC diagnostic pop
|
||||
|
||||
} // namespace android
|
||||
@@ -12,6 +12,13 @@ if platform == 'generic'
|
||||
else
|
||||
android_hal_sources += files(['libhardware_stub.c'])
|
||||
endif
|
||||
|
||||
libui = dependency('libui', required : false)
|
||||
if libui.found()
|
||||
android_deps += [libui]
|
||||
else
|
||||
android_hal_sources += files(['graphic_buffer_allocator_stub.cpp'])
|
||||
endif
|
||||
elif platform == 'cros'
|
||||
android_hal_sources += files(['cros_camera_buffer.cpp',
|
||||
'cros_frame_buffer_allocator.cpp'])
|
||||
|
||||
Reference in New Issue
Block a user