Skip to content

Commit

Permalink
Changes to use IMapper5 stable-c mapper
Browse files Browse the repository at this point in the history
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-124485
Signed-off-by: Jeevaka Prabu Badrappan <jeevaka.badrappan@intel.com>
  • Loading branch information
JeevakaPrabu authored and celadon committed Sep 9, 2024
1 parent 44ed50f commit afddb22
Show file tree
Hide file tree
Showing 6 changed files with 511 additions and 4 deletions.
14 changes: 14 additions & 0 deletions android/Android.mk
Original file line number Diff line number Diff line change
Expand Up @@ -118,6 +118,20 @@ LOCAL_SHARED_LIBRARIES += \
MESON_GEN_PKGCONFIGS += android.hardware.graphics.mapper:4.0
endif

ifeq ($(shell test $(PLATFORM_SDK_VERSION) -ge 35; echo $$?), 0)
LOCAL_SHARED_LIBRARIES += \
libbinder_ndk \
libvndksupport \
android.hardware.graphics.allocator-V2-ndk \

LOCAL_HEADER_LIBRARIES += \
libimapper_stablec \
libimapper_providerutils \
libui_headers

MESON_GEN_PKGCONFIGS += android.hardware.graphics.allocator-V2-ndk
endif

__MY_SHARED_LIBRARIES := $(LOCAL_SHARED_LIBRARIES)

ifeq ($(shell test $(PLATFORM_SDK_VERSION) -ge 30; echo $$?), 0)
Expand Down
6 changes: 5 additions & 1 deletion meson.build
Original file line number Diff line number Diff line change
Expand Up @@ -888,6 +888,7 @@ endif

if with_platform_android
dep_android_mapper4 = null_dep
dep_android_mapper5 = null_dep
if not with_android_stub
dep_android = [
dependency('cutils'),
Expand All @@ -900,9 +901,12 @@ if with_platform_android
if get_option('platform-sdk-version') >= 26
dep_android += dependency('nativewindow')
endif
if get_option('platform-sdk-version') >= 30
if get_option('platform-sdk-version') >= 30 and get_option('platform-sdk-version') <= 34
dep_android_mapper4 = dependency('android.hardware.graphics.mapper', version : '>= 4.0', required : false)
endif
if get_option('platform-sdk-version') >= 35
dep_android_mapper5 = dependency('android.hardware.graphics.allocator-V2-ndk', required : false)
endif
endif
pre_args += [
'-DANDROID',
Expand Down
6 changes: 6 additions & 0 deletions src/util/u_gralloc/meson.build
Original file line number Diff line number Diff line change
Expand Up @@ -22,6 +22,12 @@ if dep_android_mapper4.found()
cpp_args_for_u_gralloc += '-DUSE_IMAPPER4_METADATA_API'
options_for_u_gralloc += 'cpp_std=c++17'
endif
if dep_android_mapper5.found()
files_u_gralloc += files('u_gralloc_imapper5_api.cpp')
c_args_for_u_gralloc += '-DUSE_IMAPPER5_METADATA_API'
cpp_args_for_u_gralloc += '-DUSE_IMAPPER5_METADATA_API'
options_for_u_gralloc += 'cpp_std=c++17'
endif

_libmesa_u_gralloc = static_library(
'_mesa_u_gralloc',
Expand Down
4 changes: 2 additions & 2 deletions src/util/u_gralloc/u_gralloc.c
Original file line number Diff line number Diff line change
Expand Up @@ -25,9 +25,9 @@ static const struct u_grallocs {
} u_grallocs[] = {
/* Prefer the CrOS API as it is significantly faster than IMapper4 */
{.type = U_GRALLOC_TYPE_CROS, .create = u_gralloc_cros_api_create},
#ifdef USE_IMAPPER4_METADATA_API
#if defined(USE_IMAPPER4_METADATA_API) || defined(USE_IMAPPER5_METADATA_API)
{.type = U_GRALLOC_TYPE_GRALLOC4, .create = u_gralloc_imapper_api_create},
#endif /* USE_IMAPPER4_METADATA_API */
#endif /* USE_IMAPPER4_METADATA_API || USE_IMAPPER5_METADATA_API */
{.type = U_GRALLOC_TYPE_LIBDRM, .create = u_gralloc_libdrm_create},
{.type = U_GRALLOC_TYPE_QCOM, .create = u_gralloc_qcom_create},
{.type = U_GRALLOC_TYPE_FALLBACK, .create = u_gralloc_fallback_create},
Expand Down
Loading

0 comments on commit afddb22

Please sign in to comment.