[libcamera-devel] [PATCH 0/4] android: switch over to modern gralloc API via libui

Mattijs Korpershoek mkorpershoek at baylibre.com
Tue Sep 12 11:36:09 CEST 2023


gralloc.h is a very old API that has been deprecated at least since
Android P (9).

Devices are encouraged to switch over to HIDL interface named
android.hardware.graphics.allocator@<VERSION>, where <VERSION> can be
2.0 ,3.0 or 4.0.

This is mandatory since Android Q (10) [1]

Fortunately, Android provides an abstraction on top of
android.hardware.graphics.allocator which is compatible with each
version.
This abstraction is implemented in libui, which is available in the
VNDK.

Import all necessary headers from AOSP and switch over the
generic_frame_buffer_allocator to use GraphicBufferAllocator.

This series has been build-tested on a linux host and functionally
tested on an AM62x SK EVM with Android 13. (preview and capture).

[1] https://android.googlesource.com/platform/hardware/interfaces/+/refs/heads/main/compatibility_matrices/compatibility_matrix.4.xml#195

Signed-off-by: Mattijs Korpershoek <mkorpershoek at baylibre.com>
---
Mattijs Korpershoek (4):
      android: Import libutils/libui headers from vndk v33
      android: Import GraphicBufferAllocator header from vndk v33
      android: Stub GraphicBufferAllocator for build tests
      android: mm: generic: Use GraphicBufferAllocator instead of gralloc.h

 .../libs/ui/include/ui/GraphicBufferAllocator.h    |  81 ++++++++
 .../native/libs/ui/include/ui/PixelFormat.h        |  75 +++++++
 include/android/meson.build                        |   2 +
 .../system/core/libutils/include/utils/Compat.h    |  94 +++++++++
 .../system/core/libutils/include/utils/Errors.h    |  78 ++++++++
 .../system/core/libutils/include/utils/Mutex.h     | 219 +++++++++++++++++++++
 .../system/core/libutils/include/utils/Singleton.h | 102 ++++++++++
 .../system/core/libutils/include/utils/Timers.h    | 103 ++++++++++
 src/android/mm/generic_frame_buffer_allocator.cpp  |  58 ++----
 src/android/mm/graphic_buffer_allocator_stub.cpp   |  50 +++++
 src/android/mm/libhardware_stub.c                  |  17 --
 src/android/mm/meson.build                         |   9 +-
 12 files changed, 825 insertions(+), 63 deletions(-)
---
base-commit: 58e501c71c47e57f02afde1bd296a037038cd6d5
change-id: 20230824-gralloc-api-v4-e3388fd364c6

Best regards,
-- 
Mattijs Korpershoek <mkorpershoek at baylibre.com>



More information about the libcamera-devel mailing list