[libcamera-devel] [PATCH v3 0/4] android: switch over to modern gralloc API via libui
Laurent Pinchart
laurent.pinchart at ideasonboard.com
Sun Sep 24 17:42:01 CEST 2023
Hi Mattijs,
Thank you for the series.
On Sat, Sep 23, 2023 at 06:23:30PM +0200, Mattijs Korpershoek via libcamera-devel wrote:
> 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.
What are the pros and cons of using libui compared to direct usage of
android.hardware.graphics.allocator ?
> 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>
> ---
> Changes in v3:
> - Fixed patch 3 missing whitespace (Jacopo)
> - Added libui meson import build in patch 3 (more consistent) (Jacopo)
> - Removed member reference to GraphicBufferAllocator in patch 4 (Jacopo)
> - Link to v2: https://lists.libcamera.org/pipermail/libcamera-devel/2023-September/038942.html
>
> Changes in v2:
> - Dropped additional ; in graphic_buffer_allocator_stub.cpp. (Kieran)
> - Surrounded problematic includes with #pragma to avoid clang compile
> errors related to -Wextra-semi. (Kieran)
> - Link to v1: https://lists.libcamera.org/pipermail/libcamera-devel/2023-September/038927.html
>
> Tested on linux with:
> CC=clang CXX=clang++ meson setup build -Dandroid=enabled -Dandroid_platform=generic
> ninja -C build
> And clang version clang++ (clang 16.0.6 "clang version 16.0.6 (Fedora 16.0.6-2.fc38)")
>
> ---
> 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 | 68 +++----
> src/android/mm/graphic_buffer_allocator_stub.cpp | 54 +++++
> src/android/mm/libhardware_stub.c | 17 --
> src/android/mm/meson.build | 11 +-
> 12 files changed, 835 insertions(+), 69 deletions(-)
> ---
> base-commit: 1d616141420d1f51e5999d758e3e0cc721a46290
> change-id: 20230824-gralloc-api-v4-e3388fd364c6
--
Regards,
Laurent Pinchart
More information about the libcamera-devel
mailing list