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:
Mattijs Korpershoek
2023-09-23 18:23:33 +02:00
committed by Konsta
parent f2744d760e
commit 8691ade614
3 changed files with 60 additions and 30 deletions

View File

@@ -29,15 +29,10 @@
#include <ui/PixelFormat.h>
#include <utils/Errors.h>
#include <utils/KeyedVector.h>
#include <utils/Mutex.h>
#include <utils/Singleton.h>
namespace android {
class GrallocAllocator;
class GraphicBufferMapper;
class GraphicBufferAllocator : public Singleton<GraphicBufferAllocator>
{
public:
@@ -52,25 +47,6 @@ public:
uint64_t usage, buffer_handle_t* handle, uint32_t* stride,
std::string requestorName);
/**
* Allocates and does NOT import a gralloc buffer. Buffers cannot be used until they have
* been imported. This function is for advanced use cases only.
*
* The raw native handle must be freed by calling native_handle_close() followed by
* native_handle_delete().
*/
status_t allocateRawHandle(uint32_t w, uint32_t h, PixelFormat format, uint32_t layerCount,
uint64_t usage, buffer_handle_t* handle, uint32_t* stride,
std::string requestorName);
/**
* DEPRECATED: GraphicBufferAllocator does not use the graphicBufferId.
*/
status_t allocate(uint32_t w, uint32_t h, PixelFormat format,
uint32_t layerCount, uint64_t usage,
buffer_handle_t* handle, uint32_t* stride, uint64_t graphicBufferId,
std::string requestorName);
status_t free(buffer_handle_t handle);
uint64_t getTotalSize() const;
@@ -94,15 +70,9 @@ protected:
uint64_t usage, buffer_handle_t* handle, uint32_t* stride,
std::string requestorName, bool importBuffer);
static Mutex sLock;
static KeyedVector<buffer_handle_t, alloc_rec_t> sAllocList;
friend class Singleton<GraphicBufferAllocator>;
GraphicBufferAllocator();
~GraphicBufferAllocator();
GraphicBufferMapper& mMapper;
std::unique_ptr<const GrallocAllocator> mAllocator;
};
// ---------------------------------------------------------------------------