src/common/android_util.cpp


Log

Author Commit Date CI Message
Geoff Lang 74b7ec03 2023-09-08T14:26:18 GL: Don't use system info for Android SDK queries. It can be queried directly from the system property without fully gathering system info. System info often uses Vulkan which is known to be unstable on some older devices. Bug: chromium:1479277 Change-Id: Ic6ee1d0182b047b0a3210dd1067f6b7250e3da02 Reviewed-on: https://chromium-review.googlesource.com/c/angle/angle/+/4851775 Commit-Queue: Geoff Lang <geofflang@chromium.org> Reviewed-by: Yuxin Hu <yuxinhu@google.com>
Jason Macnak 2256c548 2022-12-15T20:44:38 Map AHARDWAREBUFFER_FORMAT_R8_UNORM to GL_R8 Bug: b/259551816 Test: cvd start --gpu_mode=guest_swiftshader Test: atest librenderengine_test Change-Id: I32a7b83494426e291cc93fe2b5f245eab6a54b0a Reviewed-on: https://chromium-review.googlesource.com/c/angle/angle/+/4112149 Commit-Queue: Jason Macnak <natsu@google.com> Reviewed-by: Shahbaz Youssefi <syoussefi@chromium.org> Reviewed-by: Ian Elliott <ianelliott@google.com>
Jason Macnak 6fdac95a 2022-12-15T20:36:01 Mirror Android AHB formats in ANGLE owned enum The existing code seems to try to keep all AHB formats defined in android_util.cpp (potentially in an attempt to simplify format conversions?). However, trying to avoid redefinition errors when conditionally re-defining the AHB formats across builds/branches is difficult. IIUC, there are two levels at play when building for Android: 1) "target level": the level of the phone/device you are building for. 2) "build level": the level of the repository/checkout you are building from. The "target level" (__ANDROID_API__) cannot be used to guard the definitions in android_util.cpp because it is possible to build for an older device in a newer branch. For example, suppose AHARDWAREBUFFER_FORMAT_X was introduced in Android T. If ANGLE tried to redefine AHARDWAREBUFFER_FORMAT_X in android_util.cpp with the guard "if __ANDROID_API__ < T", re-definition errors would still occur when building for Android S devices ( __ANDROID_API__ set to S) from inside of an Android T branch because the format would still be defined in android/hardware_buffer.h. A failure of this type can be seen in aosp/2308065 which tried to guard AHARDWAREBUFFER_FORMAT_R8_UNORM with "if __ANDROID_API__ < 33". Additionally, Android sets __ANDROID_API__ to 10000 before releases are cut and it is supposed to be fixed at release time. However, this has been observed to not be fixed on some less maintained side branches. Detecting the "build level" seems to be quite difficult. When building from outside of Android, this is the NDK level which can be detected using __ANDROID_NDK__ and __NDK_MAJOR__. When building from inside of Android, this is the latest level available on your specific branch. I believe this can only be found by incrementally checking for the existence of the various __ANDROID_API_R__, __ANDROID_API_S__, etc defines. This alternative can be seen in https://crrev.com/c/4039066. However, this is very difficult to find and read. Instead, let's just define ANGLE's own enum which mirrors the Android enums which can be used without having to worry about the current build system or release/branch. Bug: b/259551816 Test: cvd start --gpu_mode=guest_swiftshader Test: atest librenderengine_test Test: ANGLE presubmit Test: Android presubmit on aosp/master (aosp/2360445) Test: Android presubmit on aosp/android13-gsi (aosp/2360447) Test: Android presubmit on aosp/android11-gsi (aosp/2360520) Change-Id: I62f12cb0e1cc4b3b24aab7b85f39360a2cd2e438 Reviewed-on: https://chromium-review.googlesource.com/c/angle/angle/+/4112148 Commit-Queue: Jason Macnak <natsu@google.com> Reviewed-by: Ian Elliott <ianelliott@google.com> Reviewed-by: Shahbaz Youssefi <syoussefi@chromium.org>
Jonah Ryan-Davis 95cfa687 2022-11-18T15:26:36 Revert "Map AHARDWAREBUFFER_FORMAT_R8_UNORM to GL_R8" This reverts commit dcf3ab1228428b2f9d1449852e2359bad70e2dfe. Reason for revert: Causing AOSP roll build failures: https://android-review.git.corp.google.com/c/platform/external/angle/+/2308065?tab=checks Original change's description: > Map AHARDWAREBUFFER_FORMAT_R8_UNORM to GL_R8 > > Bug: b/259551816 > Test: cvd start --gpu_mode=guest_swiftshader > Test: atest librenderengine_test > Change-Id: I874278fe50dd1b501c11c484c55ed91e67a7013b > Reviewed-on: https://chromium-review.googlesource.com/c/angle/angle/+/4034130 > Reviewed-by: Shahbaz Youssefi <syoussefi@chromium.org> > Commit-Queue: Shahbaz Youssefi <syoussefi@chromium.org> Bug: b/259551816 Change-Id: Iac19db493ecda89bc49d05cc34f5b51818e39737 No-Presubmit: true No-Tree-Checks: true No-Try: true Reviewed-on: https://chromium-review.googlesource.com/c/angle/angle/+/4035110 Reviewed-by: Shahbaz Youssefi <syoussefi@chromium.org> Bot-Commit: Rubber Stamper <rubber-stamper@appspot.gserviceaccount.com> Commit-Queue: Jonah Ryan-Davis <jonahr@google.com>
Jason Macnak dcf3ab12 2022-11-17T09:52:36 Map AHARDWAREBUFFER_FORMAT_R8_UNORM to GL_R8 Bug: b/259551816 Test: cvd start --gpu_mode=guest_swiftshader Test: atest librenderengine_test Change-Id: I874278fe50dd1b501c11c484c55ed91e67a7013b Reviewed-on: https://chromium-review.googlesource.com/c/angle/angle/+/4034130 Reviewed-by: Shahbaz Youssefi <syoussefi@chromium.org> Commit-Queue: Shahbaz Youssefi <syoussefi@chromium.org>
Amirali Abdolrashidi f62405c5 2022-10-31T18:47:52 Add utilities to get the Android backtrace * Added getBacktraceInfo(), which returns the backtrace information from the ANGLE code, including the addresses and the symbols if possible * Returns the data in an instance of the new class BacktraceInfo. * In order to access this function, backtrace_utils.h has been included in vk_utils.h * New GN flag to make use of this feature: * angle_enable_unwind_backtrace_support * Current only available on Android (debug mode) * If the flag is disabled, getBacktraceInfo() returns an empty object. * Added functions in util/ (per platform) to print the BacktraceInfo data. * Example of usage: angle::printBacktraceInfo(angle::getBacktraceInfo()); * Minor edit: Moved cstdint from android_util.cpp to its header. Bug: b/258475923 Change-Id: I6115462a1a2845d40c7cafc14ce52df09ecdcf34 Reviewed-on: https://chromium-review.googlesource.com/c/angle/angle/+/3995843 Reviewed-by: Shahbaz Youssefi <syoussefi@chromium.org> Reviewed-by: Charlie Lao <cclao@google.com> Commit-Queue: Amirali Abdolrashidi <abdolrashidi@google.com>
Shahbaz Youssefi baf5356c 2022-08-31T23:18:12 Map RGBX AHB back to GL_RGB8 for OpenGL In df9468565c0ffcdcbcfd522de9a12c8f535b5717, AHARDWAREBUFFER_FORMAT_R8G8B8X8_UNORM was mapped to GL_RGBX8_ANGLE for the sake of the Vulkan backend. This was erroneous for the OpenGL backend, which should continue to use GL_RGB8. Since c8b0caf1f440231de511ece71f447636e019c9df, this mapping is no longer used by the Vulkan backend. This change reverts the mapping back to GL_RGB8 to fix the OpenGL backend. Bug: b/238460927 Bug: chromium:1356252 Change-Id: If9e97f0c589925c150b0056485996c1f4f6e39be Reviewed-on: https://chromium-review.googlesource.com/c/angle/angle/+/3863377 Auto-Submit: Shahbaz Youssefi <syoussefi@chromium.org> Commit-Queue: Lingfeng Yang <lfy@google.com> Reviewed-by: Yiwei Zhang <zzyiwei@chromium.org> Reviewed-by: Lingfeng Yang <lfy@google.com>
Yiwei Zhang df946856 2022-08-22T20:36:52 Map RGBX AHB to GL_RGBX8_ANGLE and fix the load function AHARDWAREBUFFER_FORMAT_R8G8B8X8_UNORM was false mapped to GL_RGB8, which will write back to the backing exteranl storage with 3 channel layout. Angle actually has ANGLE_rgbx_internal_format to fix the mapping with GL_RGBX8_ANGLE. However, the load function must align with GL_RGB8 if the actual storage is 4 channel. This change also fixes that to use LoadToNative3To4<GLubyte, 0xFF>. Bug: b/238460927 Test: CtsNativeHardwareTestCases#SingleLayer_ColorTest_*_R8G8B8X8_* Test: ImageTestES3.RGBXAHB* pass without VVL error Change-Id: Ic5db4cb4adba252949d64e560ff32e492a045912 Reviewed-on: https://chromium-review.googlesource.com/c/angle/angle/+/3846413 Commit-Queue: Shahbaz Youssefi <syoussefi@chromium.org> Reviewed-by: Shahbaz Youssefi <syoussefi@chromium.org> Reviewed-by: Lingfeng Yang <lfy@google.com>
Yiwei Zhang 8f9e15cc 2022-07-26T00:22:38 Vulkan: avoid excessive log for FORMAT_IMPLEMENTATION_DEFINED This is a widely used format for camera stack. The current logging is too verbose when there's camera-gpu interop. Bug: b/240097793 Test: no more WARN logs for camera gpu usage Change-Id: Ie841182f1f67212cc1c479c5a9109d4bd1190e87 Reviewed-on: https://chromium-review.googlesource.com/c/angle/angle/+/3786931 Auto-Submit: Yiwei Zhang <zzyiwei@chromium.org> Reviewed-by: Shahbaz Youssefi <syoussefi@chromium.org> Commit-Queue: Lingfeng Yang <lfy@google.com> Reviewed-by: Lingfeng Yang <lfy@google.com>
Peng Huang e3701f90 2022-07-19T15:19:50 Remove WARN() in getPixelFormatInfo() This WARN() cause log flood on Android while playing youtube videos in Chrome. Bug: angleproject:7509 Change-Id: I42e046d5b0908ef7d3ca0704c27236198026a637 Reviewed-on: https://chromium-review.googlesource.com/c/angle/angle/+/3773873 Auto-Submit: Peng Huang <penghuang@chromium.org> Commit-Queue: Geoff Lang <geofflang@chromium.org> Reviewed-by: Geoff Lang <geofflang@chromium.org>
Tim Van Patten fd014271 2021-12-16T20:44:42 Vulkan: Match chromaFilter to min/mag for YUV AHBs From the VVL: VUID-VkSamplerCreateInfo-minFilter VkCreateSampler: VK_FORMAT_FEATURE_SAMPLED_IMAGE_YCBCR_CONVERSION_SEPARATE_RECONSTRUCTION_FILTER_BIT specifies that the format can have different chroma, min, and mag filters. However, VK_FORMAT_FEATURE_SAMPLED_IMAGE_YCBCR_CONVERSION_SEPARATE_RECONSTRUCTION_FILTER_BIT is not supported for VkSamplerYcbcrConversionCreateInfo.format = VK_FORMAT_UNDEFINED so chromaFilter needs to be equal to minFilter/magFilter. We don't know what the min/mag filters are when the AHB is imported, so we need to update the YcbcrConversionDesc with the current min/mag filter value before creating the VkSamplerYcbcrConversion when the ImageView is created. Additionally, if the min/mag filters are updated later, TextureVk::syncState() needs to recreate the ImageViews to ensure the chromaFilter matches the new min/magFilters. Test: atest android.media.cts.DecodeAccuracyTest#testGLViewDecodeAccuracy[0] Test: ImageTestES3.SourceYUVAHBTargetExternalYUVSampleLinearFiltering Bug: b/210526871 Change-Id: I95dbd9738f6e3fd0870e484518eee105e995f93a Reviewed-on: https://chromium-review.googlesource.com/c/angle/angle/+/3346394 Reviewed-by: Shahbaz Youssefi <syoussefi@chromium.org> Reviewed-by: Jamie Madill <jmadill@chromium.org> Commit-Queue: Tim Van Patten <timvp@google.com>
Jeff Vigil 6136620b 2021-03-25T15:43:06 Reland "EGL: GLES: Implement GL_EXT_protected_textures" This is a reland of 6210a9b34a721df2c84cf69170ad9bf7ba40e4aa This removes changes in gl backend. Original change's description: > EGL: GLES: Implement GL_EXT_protected_textures > > Implement EGL_EXT_protected_content Images > Add protected member to Images and Textures > Add error when creating objects if not supported or > does't match native buffer > When creating siblings pass protected state > Add extension caps > Add Validation > Add GetTexParameter and SetTextparameter > Add protected to Texture and state > Expand tests for images and textures > > Test: angle_end2end_test --gtest_filter=EGLProtectedContentTest > > Bug: angleproject:3965 > Change-Id: I35a89b4e80bba6d9b6831c68e71630eef304dacb > Reviewed-on: https://chromium-review.googlesource.com/c/angle/angle/+/2802852 > Commit-Queue: Mohan Maiya <m.maiya@samsung.com> > Reviewed-by: Geoff Lang <geofflang@chromium.org> > Reviewed-by: Jamie Madill <jmadill@chromium.org> > Reviewed-by: Shahbaz Youssefi <syoussefi@chromium.org> Test: angle_end2end_test --gtest_filter=EGLProtectedContentTest Bug: angleproject:3965 Change-Id: Id36d697c53afc0f0dadf92bda4565f9157f4fc2a Reviewed-on: https://chromium-review.googlesource.com/c/angle/angle/+/3076825 Commit-Queue: Brandon Schade <b.schade@samsung.com> Reviewed-by: Ian Elliott <ianelliott@google.com> Reviewed-by: Jamie Madill <jmadill@chromium.org>
Peter Kasting d4d6c23c 2021-07-31T11:41:29 Fix a recently-introduced case of -Wunreachable-code-aggressive. Also enable this and -Wunused-but-set-variable to avoid regressing them. Bug: chromium:1066980 Change-Id: I1fd7a57c2bf14513d657b69b70e35ad727c75ffd Reviewed-on: https://chromium-review.googlesource.com/c/angle/angle/+/3065355 Reviewed-by: Shahbaz Youssefi <syoussefi@chromium.org> Commit-Queue: Shahbaz Youssefi <syoussefi@chromium.org>
Jamie Madill c408926f 2021-07-22T12:00:59 Revert "EGL: GLES: Implement GL_EXT_protected_textures" This reverts commit 6210a9b34a721df2c84cf69170ad9bf7ba40e4aa. Reason for revert: Suspected for breaking ANGLE->Chrome roller. Bug: angleproject:6204 Original change's description: > EGL: GLES: Implement GL_EXT_protected_textures > > Implement EGL_EXT_protected_content Images > Add protected member to Images and Textures > Add error when creating objects if not supported or > does't match native buffer > When creating siblings pass protected state > Add extension caps > Add Validation > Add GetTexParameter and SetTextparameter > Add protected to Texture and state > Expand tests for images and textures > > Test: angle_end2end_test --gtest_filter=EGLProtectedContentTest > > Bug: angleproject:3965 > Change-Id: I35a89b4e80bba6d9b6831c68e71630eef304dacb > Reviewed-on: https://chromium-review.googlesource.com/c/angle/angle/+/2802852 > Commit-Queue: Mohan Maiya <m.maiya@samsung.com> > Reviewed-by: Geoff Lang <geofflang@chromium.org> > Reviewed-by: Jamie Madill <jmadill@chromium.org> > Reviewed-by: Shahbaz Youssefi <syoussefi@chromium.org> Bug: angleproject:3965 Change-Id: Ia3ef260a17097b474189ccad5b235a9db99ee00b Reviewed-on: https://chromium-review.googlesource.com/c/angle/angle/+/3043889 Reviewed-by: Jamie Madill <jmadill@chromium.org> Commit-Queue: Jamie Madill <jmadill@chromium.org> Bot-Commit: Rubber Stamper <rubber-stamper@appspot.gserviceaccount.com>
Jeff Vigil 6210a9b3 2021-03-25T15:43:06 EGL: GLES: Implement GL_EXT_protected_textures Implement EGL_EXT_protected_content Images Add protected member to Images and Textures Add error when creating objects if not supported or does't match native buffer When creating siblings pass protected state Add extension caps Add Validation Add GetTexParameter and SetTextparameter Add protected to Texture and state Expand tests for images and textures Test: angle_end2end_test --gtest_filter=EGLProtectedContentTest Bug: angleproject:3965 Change-Id: I35a89b4e80bba6d9b6831c68e71630eef304dacb Reviewed-on: https://chromium-review.googlesource.com/c/angle/angle/+/2802852 Commit-Queue: Mohan Maiya <m.maiya@samsung.com> Reviewed-by: Geoff Lang <geofflang@chromium.org> Reviewed-by: Jamie Madill <jmadill@chromium.org> Reviewed-by: Shahbaz Youssefi <syoussefi@chromium.org>
Mohan Maiya f197ebac 2020-11-16T15:16:56 Vulkan: Add EXT_external_buffer support Addition of buffer support for external memory Also adds new end2end tests for these usecases * SubData update * map/unmap buffer * dispatch compute with external buffer Bug: angleproject:5073 Test: ExternalBufferTestES31.*Vulkan Change-Id: Ib3cccaca77b76830effe49d3731782552e7424ec Reviewed-on: https://chromium-review.googlesource.com/c/angle/angle/+/2525105 Commit-Queue: Mohan Maiya <m.maiya@samsung.com> Reviewed-by: Jamie Madill <jmadill@chromium.org> Reviewed-by: Shahbaz Youssefi <syoussefi@chromium.org>
Geoff Lang 5b419533 2020-11-03T13:33:44 GL: Implement EXT_YUV_target Add test coverage of YUV format sampling as RGB or directly as YUV and rendering as YUV using layout(yuv). Initializing YUV AHardwareBuffers requires Android API 29 so ANGLE must be compiled with: android32_ndk_api_level = 29 android64_ndk_api_level = 29 The following tests can still run with Android API 26 because they don't need to initialize the buffer: ImageTestES3.ClearYUVAHB ImageTestES3.YUVValidation Bug: angleproject:4852 Bug: b/172649538 Change-Id: I4fe9afb2a68fb827dc5a5732b213b5eb60d585ac Reviewed-on: https://chromium-review.googlesource.com/c/angle/angle/+/2517562 Commit-Queue: Geoff Lang <geofflang@chromium.org> Reviewed-by: Jamie Madill <jmadill@chromium.org> Reviewed-by: Shahbaz Youssefi <syoussefi@chromium.org>
Mohan Maiya c99c22bb 2020-09-15T16:53:26 EGL: Add support for EGL_ANDROID_create_native_client_buffer This EGL extension will add support for creating EGLClientBuffer backed by an Android window buffer (struct ANativeWindowBuffer) which can be later used to create an EGLImage. Bug: angleproject:5018 Tests: angle_end2end_tests --gtest_filter=ImageTest.SourceNativeClientBufferTarget* Change-Id: If78ed7b80ad09629b8c5f5b5a0eb07a548e82e6e Reviewed-on: https://chromium-review.googlesource.com/c/angle/angle/+/2404320 Reviewed-by: Courtney Goeltzenleuchter <courtneygo@google.com> Reviewed-by: Geoff Lang <geofflang@chromium.org> Commit-Queue: Mohan Maiya <m.maiya@samsung.com>
Jamie Madill dfddb983 2020-08-27T17:14:08 Fix warnings that show up in Skia with MSVC. Bug: skia:7647 Change-Id: I6951dcfc1eacd0426dfa7f8142780a5065fae1b0 Reviewed-on: https://chromium-review.googlesource.com/c/angle/angle/+/2380715 Reviewed-by: Jamie Madill <jmadill@chromium.org> Commit-Queue: Jamie Madill <jmadill@chromium.org>
Mohan Maiya a3cf06ac 2020-03-12T13:15:48 EGL: populate EGL_NATIVE_VISUAL_ID values for Android When generating the default EGL configs, populate EGL_NATIVE_VISUAL_ID with AHARDWAREBUFFER formats. Bug: angleproject:4469 Change-Id: Ifde9df0497cbd4e01219ab6067acd8d97f8460e4 Reviewed-on: https://chromium-review.googlesource.com/c/angle/angle/+/2101577 Reviewed-by: Courtney Goeltzenleuchter <courtneygo@google.com> Reviewed-by: Geoff Lang <geofflang@chromium.org> Commit-Queue: Mohan Maiya <m.maiya@samsung.com>
Geoff Lang 14f472f2 2019-09-20T11:33:18 GL: Treat unknown AHardwareBuffer formats as RGBA8. When Android's AImageReader encounters YUV formats, it converts the hardware buffer's internal format to vendor-specific formats. Since these sample as RGB using samplerExternal, simply validate them as if they are RGB8. BUG=angleproject:3929 Change-Id: I991512c8a584b08a978aacf67ab153ada7e4fd76 Reviewed-on: https://chromium-review.googlesource.com/c/angle/angle/+/1816300 Reviewed-by: Jonah Ryan-Davis <jonahr@google.com> Commit-Queue: Geoff Lang <geofflang@chromium.org>
Geoff Lang 3fd0b2db 2018-09-20T15:59:54 Implement EGL_ANDROID_get_native_client_buffer. BUG=angleproject:2508 Change-Id: I21e6251cd1341c1f85f1ba16ba08f5876a8ff8de Reviewed-on: https://chromium-review.googlesource.com/c/angle/angle/+/1238885 Commit-Queue: Geoff Lang <geofflang@chromium.org> Reviewed-by: Geoff Lang <geofflang@chromium.org>
Geoff Lang 009696c5 2019-01-31T14:47:07 Vulkan: Support EGL_ANDROID_image_native_buffer on Android. BUG=angleproject:2668 BUG=angleproject:3121 Change-Id: I0dfb2ec0737ebd963b0fadb78cf720a90874f00b Reviewed-on: https://chromium-review.googlesource.com/c/1452264 Commit-Queue: Geoff Lang <geofflang@chromium.org> Reviewed-by: Shahbaz Youssefi <syoussefi@chromium.org>