starboard/testing: Use PBufferSurface for FakeGraphicsContextProvider. #5042
+33
−36
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
FakeGraphicsContextProvider is used by NPLB tests to create a, well, Fake graphics scaffolding. However, in
InitializeEGL()
, it creates a real EGLSurface (i.e. connected to the actual screen), which of course is unnecessary (because we want a Fake). This CL changes the code to create an off-screen pixel buffer surface (PBufferSurface).It also takes the chance to modernize the code: introduces constexpr, for-range loop, and std::vector (to avoid malloc-free).
I wanted to do this a while back to address nplb flakes: locally I saw
eglCreateWindowSurface()
failing to allocate the needed EGLSurface, and I thought it could be due to too many back-to-back EGL construct-initialize-destruct cycles. However, the flake was still there so I decided to not touch the code. But #4987, #5038 have made this change necessary.This was tested locally on my gLinux box running:
xvfb-run ./out/linux-x64x11_devel/nplb --v=3 --gtest_filter=*SbPlayer*
- 567 seconds, 2920 tests, 8 passed, 2192 skipped.Then I run all the tests, just to be sure:
xvfb-run ./out/linux-x64x11_devel/nplb --v=3
In a Linux CI run, for the curious among us:
Bug: b/384819454