Skip to content
This repository was archived by the owner on Jan 27, 2026. It is now read-only.

Commit a9a5aaf

Browse files
JeevakaPrabuYanfeng-Mi
authored andcommitted
gralloc/imapper5: Changes to use IMapper5 stable-c mapper
As IMapper4 is deprecated from Android15, changes done to use IMapper5 stable-c mapper. Tests done: - Android boot in GVT-d and BM config - adb reboot Tracked-On: OAM-122192 Signed-off-by: Jeevaka Prabu Badrappan <jeevaka.badrappan@intel.com>
1 parent 9f0157f commit a9a5aaf

7 files changed

Lines changed: 518 additions & 10 deletions

File tree

android/Android.mk

Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -106,6 +106,20 @@ LOCAL_SHARED_LIBRARIES += \
106106
MESON_GEN_PKGCONFIGS += android.hardware.graphics.mapper:4.0
107107
endif
108108

109+
ifeq ($(shell test $(PLATFORM_SDK_VERSION) -ge 35; echo $$?), 0)
110+
LOCAL_SHARED_LIBRARIES += \
111+
libbinder_ndk \
112+
libvndksupport \
113+
android.hardware.graphics.allocator-V2-ndk \
114+
115+
LOCAL_HEADER_LIBRARIES += \
116+
libimapper_stablec \
117+
libimapper_providerutils \
118+
libui_headers
119+
120+
MESON_GEN_PKGCONFIGS += android.hardware.graphics.allocator-V2-ndk
121+
endif
122+
109123
__MY_SHARED_LIBRARIES := $(LOCAL_SHARED_LIBRARIES)
110124

111125
ifeq ($(shell test $(PLATFORM_SDK_VERSION) -ge 30; echo $$?), 0)

meson.build

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -879,6 +879,7 @@ endif
879879

880880
if with_platform_android
881881
dep_android_mapper4 = null_dep
882+
dep_android_mapper5 = null_dep
882883
if not with_android_stub
883884
dep_android = [
884885
dependency('cutils'),
@@ -892,9 +893,12 @@ if with_platform_android
892893
if get_option('platform-sdk-version') >= 26
893894
dep_android += dependency('nativewindow')
894895
endif
895-
if get_option('platform-sdk-version') >= 30
896+
if get_option('platform-sdk-version') >= 30 and get_option('platform-sdk-version') <= 34
896897
dep_android_mapper4 = dependency('android.hardware.graphics.mapper', version : '>= 4.0', required : false)
897898
endif
899+
if get_option('platform-sdk-version') >= 35
900+
dep_android_mapper5 = dependency('android.hardware.graphics.allocator-V2-ndk', required : false)
901+
endif
898902
endif
899903
pre_args += '-DANDROID_API_LEVEL=' + get_option('platform-sdk-version').to_string()
900904
if get_option('android-strict')

src/util/u_gralloc/meson.build

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -28,6 +28,12 @@ endif
2828
if with_freedreno_vk or with_gallium_freedreno
2929
c_args_for_u_gralloc += '-DHAS_FREEDRENO'
3030
endif
31+
if dep_android_mapper5.found()
32+
files_u_gralloc += files('u_gralloc_imapper5_api.cpp')
33+
c_args_for_u_gralloc += '-DUSE_IMAPPER5_METADATA_API'
34+
cpp_args_for_u_gralloc += '-DUSE_IMAPPER5_METADATA_API'
35+
options_for_u_gralloc += 'cpp_std=c++17'
36+
endif
3137

3238
_libmesa_u_gralloc = static_library(
3339
'_mesa_u_gralloc',

src/util/u_gralloc/u_gralloc.c

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -25,9 +25,9 @@ static const struct u_grallocs {
2525
} u_grallocs[] = {
2626
/* Prefer the CrOS API as it is significantly faster than IMapper4 */
2727
{.type = U_GRALLOC_TYPE_CROS, .create = u_gralloc_cros_api_create},
28-
#ifdef USE_IMAPPER4_METADATA_API
28+
#if defined(USE_IMAPPER4_METADATA_API) || defined(USE_IMAPPER5_METADATA_API)
2929
{.type = U_GRALLOC_TYPE_GRALLOC4, .create = u_gralloc_imapper_api_create},
30-
#endif /* USE_IMAPPER4_METADATA_API */
30+
#endif /* USE_IMAPPER4_METADATA_API || USE_IMAPPER5_METADATA_API */
3131
{.type = U_GRALLOC_TYPE_LIBDRM, .create = u_gralloc_libdrm_create},
3232
{.type = U_GRALLOC_TYPE_QCOM, .create = u_gralloc_qcom_create},
3333
{.type = U_GRALLOC_TYPE_FALLBACK, .create = u_gralloc_fallback_create},

0 commit comments

Comments
 (0)