Commit graph

1654 commits

Author SHA1 Message Date
Orion Hodson
7c73c0e00a Add dependency on jni_headers to opengl tests
Preparation for removing implicit include paths for jni.h from soong.

Bug: 152482542
Test: m checkbuild
Change-Id: I7a6c702f93d37d079861dac1d1adad12a6cc4ccf
2020-04-14 11:07:46 +01:00
Tom Cherry
28ac3b9285 Include what you use: <unistd.h>
This was transitively included, but no longer is, so it must be
explicitly included.

Exempt-From-Owner-Approval: Janitorial
Test: build
Change-Id: I9c57174e4dcf5dfddb44498d8faa556531894b1e
2020-04-13 15:19:23 -07:00
Tom Cherry
3387cab883 Include what you use: <fcntl.h>
This was transitively included, but no longer is, so it must be
explicitly included.

Exempt-From-Owner-Approval: Janitorial
Test: build
Change-Id: I369e3bdc049f811acbcea095d90960a16d5ff4e0
2020-04-13 11:09:12 -07:00
Orion Hodson
62d2c9c82c Unbreak gen command and sync with current tree
Fix location of UnsupportedAppUsage.java.

Update templates to match current sources.

Add set-up sanity checks to gen script.

Bug: 151443957
Test: ./gen and observe no source changes
Change-Id: I095ef85ba9b2ef6617c451221a35f3545c3933a3
2020-04-01 08:07:13 +00:00
Treehugger Robot
ba4d743a16 Merge "Remove mips." 2020-03-12 17:20:17 +00:00
Elliott Hughes
2a45d7a6d6 Remove mips.
Test: treehugger
Change-Id: Ifac6515bb84c8da2faf53ef310caec7adff3f234
Merged-In: Ifac6515bb84c8da2faf53ef310caec7adff3f234
2020-03-12 00:21:31 +00:00
Courtney Goeltzenleuchter
9defb444a8 Enable context virtualization only for GL
Only the GL back-end requires context virtualization. So only
require it for that case and not for Vulkan back-end.

Test: dEQP with ANGLE and ANGLE build with args.gn with
angle_enable_gl=false
Bug: 150892231

(cherry picked from commit 559b4339c7)

Change-Id: I443841c2543d0c6446d0f11122bf18dc9acbf428
2020-03-09 13:17:43 -04:00
jorgegil@google.com
09c9da508a Add stubs to libEGL cc_library
(cherry-picked from commit e814151684)

Bug: 144781653
Bug: 147833914
Test: Builds
Change-Id: I73a8e9bac02cc4c6874c140ff55b328334f5d309
Merged-In: I73a8e9bac02cc4c6874c140ff55b328334f5d309
2020-01-17 12:01:06 +00:00
Artur Satayev
6783dfb308 Use new UnsupportedAppUsage annotation.
Bug: 145132366
Test: m && diff unsupportedappusage_index.csv
Change-Id: I17478d80070fff10eb083cfe633093383d5aedad
2019-12-11 14:37:35 +00:00
Lev Rumyantsev
a0a5ed3bdb Merge "Fix for native bridge fallback in egl layers" 2019-11-14 01:07:35 +00:00
Jiyong Park
3ce7973911 Rename # vndk tag to # llndk
The APIs that are tagged with # vndk are actually for LLNDK libraries.
Although LLNDK is part of VNDK, calling those APIs 'vndk' has given
users a wrong perception that the APIs don't need to be kept stable
because that's the norm for most of the VNDK libraries that are not
LLNDK.

In order to eliminate the misunderstanding, rename the tag to 'llndk' so
that people introducing new such API will realize what they are signing
themselves up for.

Exempt-From-Owner-Approval: cherry-pick from internal gerrit

Bug: 143765505
Test: m
Merged-In: I10d40e06b1f1d6d0e190699ab6356b18d53fd2ab
(cherry picked from commit 0a0e26b17b)
Change-Id: I10d40e06b1f1d6d0e190699ab6356b18d53fd2ab
2019-11-13 05:50:06 +00:00
Dmytro Chystiakov
3e4db84c4f Fix for native bridge fallback in egl layers
Add trampoline to support native bridge for egl layers

Test: Run CtsGpuToolsHostTestCases module
Bug: b/144108378

Change-Id: I0f6f155b0f423760949efa79680082c87a4ef2f3
Signed-off-by: Dmytro Chystiakov <dmytro.chystiakov@intel.com>
2019-11-08 13:51:29 -08:00
Cody Northrop
b2306edb48 EGL: Fix repeated extension lookups
When adding support for GLES layers, we refactored
eglGetProcAddress to allow layers to intercept functions
unknown to the Loader. During the cleanup, we broke slot
tracking if an extension were looked up multiple times.
Follow up queries would use an incremented slot that
had not been initialized:

  eglGetProcAddress("foo1") = fptr0:0x77e2c2abd8
  eglGetProcAddress("foo2") = fptr1:0x77e2c2abf4
  eglGetProcAddress("foo3") = fptr2:0x77e2c2ac10
  eglGetProcAddress("foo1") = fptr3:0x77e2c2ac2c <= wrong
  eglGetProcAddress("foo2") = fptr4:0x77e2c2ac2c <= repeated
  eglGetProcAddress("foo3") = fptr5:0x77e2c2ac2c <= repeated

This CL tracks which slot was used for a given extension,
and when it is queried a second time, we look up the
correct slot using extensionSlotMap.

  eglGetProcAddress("foo1") = fptr0:0x77e2c2abd8
  eglGetProcAddress("foo2") = fptr1:0x77e2c2abf4
  eglGetProcAddress("foo3") = fptr2:0x77e2c2ac10
  eglGetProcAddress("foo1") = fptr3:0x77e2c2abd8 <= correct
  eglGetProcAddress("foo2") = fptr4:0x77e2c2abf4 <= correct
  eglGetProcAddress("foo3") = fptr5:0x77e2c2ac10 <= correct

It also refactors the code a bit to be more readable, and
fixes a typo throughout the file.

Bug: 143860847
Test: egl_api_test
Change-Id: If75c1abdb69a4d82253f28a5a80687f546e33ee0
Merged-In: If75c1abdb69a4d82253f28a5a80687f546e33ee0
2019-11-07 09:18:12 -07:00
Nick Desaulniers
0223349047 [frameworks][native][opengl] fix -Wimplicit-int-float-conversion
IEEE754 single precision cannot precisely represent RAND_MAX.

error: implicit conversion from 'int' to 'float' changes value from
2147483647 to 2147483648 [-Werror,-Wimplicit-int-float-conversion]

For purposes of generating random uniforms, this does not matter. Add
explicit casts of RAND_MAX to float to fix.

Bug: 139945549
Test: mm
Change-Id: I3a609b9bbe2e62eeacf5a6853ba625a512e5bcba
Signed-off-by: Nick Desaulniers <ndesaulniers@google.com>
2019-10-09 15:43:12 -07:00
Christopher Ferris
70d8ca784c Move to bionic platform include.
Bug: 141560639

Test: Builds.
Change-Id: Iccc1cc09135399c6f7d4f33a0483762cd28ae43a
Merged-In: Iccc1cc09135399c6f7d4f33a0483762cd28ae43a
(cherry picked from commit ddd1d6b32c)
2019-09-27 14:23:21 -07:00
Peiyong Lin
6537798a9b Update OWNERS file for opengl and vulkan
BUG: N/A
Test: N/A
Change-Id: I814148e3629b028e15cc5b4f8c990c74b95754cb
2019-09-20 00:41:16 +00:00
Treehugger Robot
0b2cf30522 Merge "Remove libhwbinder/libhidltransport deps" 2019-09-10 01:28:28 +00:00
Steven Moreland
7a10a4f543 Remove libhwbinder/libhidltransport deps
Since these were combined into libhidlbase.

Bug: 135686713
Test: build only (libhwbinder/libhidltransport are empty)
Change-Id: Iec1802ce9226570d3a02cc5242f7ca72e1370635
2019-09-09 10:46:17 -07:00
Yiwei Zhang
ca8dce919c opengl: fix a race condition when unloading gl driver
Previously, EGL apis call clearError() at the first place including those core
apis which initialize the driver. Calling clearError() before the driver has
been loaded is basically a no-op.

Later the driver unloading mechanism was added to support Angle and updatable
driver with EGL/GL driver still preloaded in Zygote. However, calling
clearError() on another thread races with the driver unloading process. So this
change moves the clearError() calls after the driver has been successfully
unloaded and reloaded, so that the initial core apis will be protected by the
driver loading lock in the loader.

For those non-core apis, they could still be incorrectly called before calling
any of those core apis on another thread when the driver unloading and reloading
is still on going. Since this scenario is supposed to error out anyway, so the
apps need to use EGL apis correctly by themselves.

Bug: 140072978
Test: CtsAngleDeveloperOptionHostTest
Change-Id: Ica5b19edc0dfb0a0910f56c1442eaff63f76b35a
Merged-In: Ica5b19edc0dfb0a0910f56c1442eaff63f76b35a
2019-09-06 02:52:12 -07:00
Yiwei Zhang
271c313425 Merge "GL: unload system driver if needed" into qt-dev
am: b040601098

Change-Id: Ia29d05f1cce12f2f767d07f109f8ea930572ac61
2019-06-06 16:13:49 -07:00
TreeHugger Robot
b040601098 Merge "GL: unload system driver if needed" into qt-dev 2019-06-06 22:54:21 +00:00
Yiwei Zhang
5e21eb3591 GL: unload system driver if needed
Both ANGLE and Game Driver originally require the GL driver to be not loaded
before the App launches. However, extra memory overhead from loading GL driver
in each process requires us to enable gl driver preloading in Zygote again.

So this CL adds the logic to unload the system driver if the App chooses to use
ANGLE or Game Driver. As long as nobody is using GL api in Zygote to create any
context, the unloading at App launch time should be safe.

eglGetDisplay will always ask the driver for the display handle after this
change, otherwise it will still use the cached display handle even we unload
the system driver and load the ANGLE or Game Driver. This means we no longer
cache it because eglGetDisplay is rarely called and trivial for the driver.

Bug: 134526352
Test: build, flash and boot. Then manually test with ANGLE and Game Driver.
Change-Id: I7c068ce9f630347a5d94823bbe6cfbac0f280e91
2019-06-06 12:47:50 -07:00
Pirama Arumuga Nainar
eee0515cf4 Disable native_coverage for libGLESv2
Bug: http://b/116873221
Bug: http://b/133874658

This is just a work around as we investigate a crash in surfaceflinger
on cuttlefish when coverage is enabled.

Test: surfaceflinger no longer crashes on cuttlefish + coverage builds.
Change-Id: Ib2ee9b159accbe7228d4b2f7661aef9f240d7512
(cherry picked from commit 5d7eb4fb1f)
2019-06-03 11:56:13 -07:00
Pirama Arumuga Nainar
afa5a49c1c Merge "Disable native_coverage for libGLESv2" am: e95742752f
am: b3848a5ed8

Change-Id: I43de2f87b6a728411064d12bc61f46352abf4f5a
2019-05-30 16:57:45 -07:00
Pirama Arumuga Nainar
5d7eb4fb1f Disable native_coverage for libGLESv2
Bug: http://b/116873221
Bug: http://b/133874658

This is just a work around as we investigate a crash in surfaceflinger
on cuttlefish when coverage is enabled.

Test: surfaceflinger no longer crashes on cuttlefish + coverage builds.
Change-Id: Ib2ee9b159accbe7228d4b2f7661aef9f240d7512
2019-05-29 22:51:42 +00:00
Krzysztof Kosiński
39e98d7df9 Merge "Reintroduce EGL mitigations from Android P." into qt-dev
am: 97071fa058

Change-Id: I488241a317f2ff0604e2c99baca810eec57ce166
2019-05-24 19:03:17 -07:00
Krzysztof Kosiński
dbccd22e64 Reintroduce EGL mitigations from Android P.
These mitigations are still necessary for GSI images with P vendor
partitions to pass Q CTS. This is essentially a revert of commit
30c1d90f1c adjusted to match the changes
introduced in the meantime.

Bug: 124411631
Test: Pixel XL boots, CtsVrTestCases passes on Pixel 3 GSI+P
Change-Id: I38bddfddda411337f5ed77b7e4899b922386f331
2019-05-25 00:12:35 +00:00
Stephen Hines
e33e692ae7 Merge "NFC: Clean up code to fix misdiagnosed unitialized variables (r2, g2, b2)." am: babf98b776
am: 29c8a41780

Change-Id: I1a632d74dd1fae1684259e363f54d158be092f2b
2019-05-09 16:16:41 -07:00
Stephen Hines
67923215fe NFC: Clean up code to fix misdiagnosed unitialized variables (r2, g2, b2).
Bug: http://b/131390872
Test: Builds with -Wconditional-uninitialized.
Change-Id: I65dcc0e25e985454dbb7e53532eacfe6b36915cd
2019-05-08 17:29:36 -07:00
Peiyong Lin
0d10b25a5b [GL Loader] Keep supporting wildcards matching in Q.
Keep supporting wildcards matching in Q.

BUG: b/127353494, b/131655000
Test: Verified with taimen
Change-Id: Ib020d665f9a3b927645d6362d0bda84050927d17
2019-05-02 01:37:15 +00:00
Peiyong Lin
3575b9fcf0 [GL Loader] Remove emulation path.
We want to shift the GL loader to load graphics library based on
ro.hardware.egl and ro.board.platform, emulator will switch to set
ro.hardware.egl based on the emulation status. This patch removes the dedicated
graphics driver loading path for emulation.

BUG: 127353494
Test: Build, boot and verify with emulator.
Change-Id: I22ac50b6340e4b1a27e20839fb53819c6337d9a7
2019-04-26 20:17:29 +00:00
Peiyong Lin
9f0c79d730 Honor the property overrides for GLES.
One of the fundamental problems of the GLES loader is that we never take
ro.hardware.egl and ro.board.platform into account while we try to load the
system driver. As a result, if a device specify the naming via these two
properties, it will not work.

Checking these two properties will allow us to remove a bunch of checks as
well, eventually we want emulator and swiftshader to go through this approach
instead of having a bunch of checks.

Another issue, is that the final loading of the system graphics driver will
load from whatever that match the wildcards of libGLES_*.so or [libEGL_*.so,
libGLESv1_CM_*.so, libGLESv2_*.so]. This is bad, for example, on cuttlefish,
there could be multiple system drivers exist at the same time and cuttlefish
can set ro.hardware.egl during boot time, however, when the graphics driver
fails to load, it will silently load other graphics driver via wildcards
matching. We want to make sure that once the loader fails to load the graphics
driver using system properties, the device can't boot.

In this patch, we attempt to load the system graphics driver by appending these
two properties at the end of the graphics driver library names before we start
to load from the exact names of the graphics driver, and remove the wildcards
matching.

BUG: 127353494
Test: Boots locally, verify emulator.
Test: atest CtsAngleIntegrationHostTestCases
Change-Id: Ib38c797fd3ce5a6e84e2cd38e24c9d3ab3da8274
2019-04-22 16:30:45 -07:00
Peiyong Lin
8cd204d6cd [GL Loader] Split loading logic based on API set and driver choices.
Previously, the order of loading the graphics driver is:
1) Try to load libGLES from ANGLE -> Driver apk -> emulation driver -> system;
2) If 1) fails, fall back to load [libEGL, libGLESv1_CM, libGLESv2] from ANGLE
  -> Driver apk -> emulation driver -> system.

However, there might be multiple variants of the same library exist in the
device and they all follow the same naming convention, which makes the driver
loading choice unpredictable. This patch refactors this ordering such that, we
loop over driver choices first, and for each driver choice, we try to see if we
can load either libGLES or [libEGL, libGLESv1_CM, libGLESv2] from it, if fails,
proceed to the next driver choice.

Minor: Code clean up here and there.

BUG: 127353494
Test: Build, verified with Developer Options and emulator
Test: atest CtsAngleIntegrationHostTestCases
Change-Id: I408dc20d8e41f69eac25c943e7c79af559d3d160
2019-04-19 16:16:58 -07:00
Peiyong Lin
e83b8682dc [GL Loader] Extract loader logic to separate function calls.
We want to clean up our loader logic and eventually use properties to control
which driver should be loaded. In this patch, we extract the logic of loading
emulation driver and api initialization out as first step.

BUG: 127353494
Test: Build, flash and boot.
Change-Id: I19ce422488188892dc65ef6fdf853ecd52530eea
2019-04-18 17:23:02 -07:00
Yiwei Zhang
40309963b9 Make a GLESv1 only entries for GLESv1 driver loading
This change creates a separate entry list for initializing gles1 apis
from the driver. With this change, the gl driver loading time for one
particular device reduced from ~180ms to ~40ms.

Bug: b/117526831
Test: dEQP-EGL.* and systrace on multiple devices
Change-Id: Ic2f6f1b8f4cd8f17db64b6e288769e2d6a7859eb
Merged-In: Ic2f6f1b8f4cd8f17db64b6e288769e2d6a7859eb
2019-04-16 19:37:29 -07:00
Orion Hodson
9c5ed187e6 Update stubs to use libnativehelper for java.nio.Buffer access
Bug: 124338141
Test: atest CtsGraphicsTestCases

(cherry picked from commit 13309b3d8f)

Change-Id: I6bb5cbc27dbb00fe944f78bb8095cd3002989547
Merged-In: I5e4978f4523d4f80bc6813740f2ed9cb57c6d9f4
2019-04-11 16:52:50 +01:00
Courtney Goeltzenleuchter
f5b5c41cd9 Make sure GL version string is correct
Test: adb -d shell am start -n com.drawelements.deqp/android.app.NativeActivity -e cmdLine '"deqp --deqp-case=dEQP-EGL.functional.reusable_sync* --deqp-log-filename=/sdcard/dEQP-Log.qpa"'
Bug: 129980957
Change-Id: I1cda21e2e1532030d7e9df318cf02161fd93d1b0
2019-04-10 17:36:19 -06:00
Courtney Goeltzenleuchter
3747f4df15 Do not emulate EGL 1.5 functionality with extensions
Turns out there are some slight differences between extension
functionality and corresponding core EGL 1.5 functions. They
are not exactly the same, unfortunately and am unable to
pass EGL 1.5 dEQP tests using the cooresponding KHR extensions.

Test: adb -d shell am start -n com.drawelements.deqp/android.app.NativeActivity -e cmdLine '"deqp --deqp-case=dEQP-EGL.functional.reusable_sync* --deqp-log-filename=/sdcard/dEQP-Log.qpa"'
Bug: 129980957
Change-Id: I1ddcc3890d90c6c1a8267591182c9865315cd5cd
2019-04-10 07:59:49 -06:00
Courtney Goeltzenleuchter
6052321381 EGLAttrib requires special handling in JNI
EGLAttrib is defined for a C / C++ interface and is
intended to be the size of a pointer. That can change
depending on which abi the code is built for but Java doesn't
have a way of dealing with such types. Java defines EGLAttrib
as a jlong, so need to convert jlong to 32bit when running on
a 32bit device.

Bug: 124382141
Test: atest --all-abi CtsGraphicsTestCases:EGL15Test
Change-Id: I3322651cdc9d9d989b4813bc85f99e4e16fda5a0
2019-04-04 11:03:26 -06:00
Michael Yang
b4c38593f4 EGL: querying client extensions as well for EGL 1.5 extensions
According to the EGL specification, EGL_EXT_client_extensions is
expected in the set of supported client extensions that is queried
without initializing a display.

Bug: 129370892
Test: On EGL 1.4 device
Test: CtsDeqpTestCases:include-filter:dEQP-EGL.*
If device has all the necessary extensions, EGL version will be 1.5

Change-Id: I7138dd2228bd79940c7d2dc4f3c89491e94d8d02
2019-04-03 08:07:47 -06:00
Cody Northrop
18fa296904 Initial readme doc for GLES layers
Bug: 110883880
Test: atest CtsGpuToolsHostTestCases
Test: Connect with GLES layers using GAPID and RenderDoc
Change-Id: I4da291581b732ff767bf18c24508ddb63132344f
2019-03-26 15:10:56 -06:00
Cody Northrop
1baf0d0ae4 Add initial draft of EGL_ANDROID_GLES_layers.txt
This extension is just an indicator of GLES layers support,
does not expose any new tokens or entrypoints.

Bug: 110883880
Test: atest CtsGpuToolsHostTestCases
Test: Connect with GLES layers using GAPID and RenderDoc
Change-Id: I898d7980826ab0fe5afaa0b2dbe7d93f29b3f88f
2019-03-25 07:56:21 -06:00
Cody Northrop
b5b0ce62e7 More verbose debugging for GLES layers
These have been useful while debugging layer implementations.

Bug: 110883880
Test: atest CtsGpuToolsHostTestCases
Test: Connect with GLES layers using GAPID and RenderDoc
Change-Id: I7b797fb8fd8a43c57dd3c2baac2712bf6c839ef2
2019-03-25 07:56:21 -06:00
Cody Northrop
1722f8e61d Advertise EGL_ANDROID_GLES_layers extension
Presence of the extension means libEGL will scan for layers and
enumerate their entrypoints by calling AndroidGLESLayer_Initialize
and AndroidGLESLayer_GetProcAddress.

Since tools must determine layering support before fully loading
libEGL, the following call will return extension strings without
loading vendor drivers:

    eglQueryString(EGL_NO_DISPLAY, EGL_EXTENSIONS);

Bug: 110883880
Test: atest CtsGpuToolsHostTestCases
Test: Connect with GLES layers using GAPID and RenderDoc
Change-Id: Ib79193b3a0ac3dffacd51bc677b81c07ffcced93
2019-03-25 07:56:21 -06:00
Cody Northrop
799fbfee0d Update entrypoint names for GLES layers
Based on developer feedback, these names make the
purpose of the entrypoints more clear for libs used
on multiple platforms.

Bug: 110883880
Test: atest CtsGpuToolsHostTestCases
Test: Connect with GLES layers using GAPID and RenderDoc
Change-Id: I78bad4398de89a9fff7c9dedfd843f8c1c959c27
2019-03-25 07:56:21 -06:00
Sean Callanan
ad9061c6b8 egl: Fallback if a driver doesn't support egl 1.5
Some drivers may claim to support egl 1.5, but don't actually
expose all the APIs necessary for conformance.

Instead of erroring out when attempting to use this functionality,
which can prevent doing anything useful with the driver, proactively
check for the APIs and downgrade to egl 1.4 if they're not present.

Bug: 128446160
Test: dEQP on Marlin
Change-Id: Ief082ff018876ae38bfe86b64a23d29ff2ce0d4b
2019-03-21 10:03:45 -07:00
Orion Hodson
91f564da01 glgen: sync generator with manual changes
Syncs generator to accomodate manual changes to checked-in sources.

Adds note to EGL15.cpp that file is automatically generated.

Bug: 126352534
Bug: 124064285

Test: gen and diff based on generated command lines.
Change-Id: I31909de4c077679dec0323761fb06f388d128a14
2019-02-26 18:07:23 +00:00
Orion Hodson
b8ecc0596b Sync generator script with manual Java changes
Incorporate manual changes to generated Java files back into the
generator.

Bug: 126352534
Bug: 124338141
Test: ./gen and check output has no commands for java files to be run.

Change-Id: Ie5f48d704b1485316718ae19b20016a08e688916
2019-02-26 15:50:59 +00:00
Jiyong Park
bd1ddb28a7 Cut the static deps from libEGL to libnativeloader and libnativebridge
The dependencies are replaced with *_lazy libraries which dynamically
load and links to the real libraries at runtime using dlopen and dlsym.

This allows libEGL to be used by early processes that are executed
before the activation of the runtime APEX where libnativeloader and
libnativebridge are provided.

Bug: 123403798
Test: m
Test: device boots to the UI

Change-Id: Ia54443163e1edcdcd142fcf392d830f1ae4c32bb
2019-02-18 18:47:24 +00:00
Yiwei Zhang
d986181df8 Game Driver: plumb driver choice and loading time to GpuStats
This change plumb the below info from GL and Vulkan loader:
1. Intended driver to use
2. Whether intended driver is loaded
3. Total driver loading time

Bug: 123529932
Test: Build, flash and boot. Verify the GpuService receiver side.
Change-Id: I967d4361bf0e04c02390c7555617575c19ecadd4
2019-02-13 18:12:02 -08:00