Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

starboard/testing: Use PBufferSurface for FakeGraphicsContextProvider. #5042

Conversation

yell0wd0g
Copy link
Contributor

@yell0wd0g yell0wd0g commented Mar 7, 2025

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

[==========] 3522 tests from 178 test suites ran. (640050 ms total)
[  PASSED  ] 591 tests.
[  SKIPPED ] 2925 tests, listed below:
.....
[  FAILED  ] 6 tests, listed below:
[  FAILED  ] SbAudioSinkTest.UpdateStatusCalled
[  FAILED  ] MultiplePlayerTest.SunnyDay
[  FAILED  ] SbMediaSetAudioWriteDurationTests/SbMediaSetAudioWriteDurationTest.WriteLimitedInput/0, where GetParam() = "beneath_the_canopy_aac_stereo.dmp"
[  FAILED  ] SbMediaSetAudioWriteDurationTests/SbMediaSetAudioWriteDurationTest.WriteContinuedLimitedInput/0, where GetParam() = "beneath_the_canopy_aac_stereo.dmp"
[  FAILED  ] VerticalVideoTests/VerticalVideoTest.WriteSamples/audio_silence_aac_stereo_dmp_video_vertical_1080p_30_fps_137_avc_dmp_output_decode_to_texture_key_system_null, where GetParam() = 40-byte object <B4-D3 4E-E3 F0-55 00-00 02-D4 4E-E3 F0-55 00-00 00-00 00-00 AB-AB AB-AB 57-16 51-E3 F0-55 00-00 57-16 51-E3 F0-55 00-00>
[  FAILED  ] VerticalVideoTests/VerticalVideoTest.WriteSamples/audio_silence_aac_stereo_dmp_video_vertical_1080p_30_fps_137_avc_dmp_output_punch_out_key_system_null, where GetParam() = 40-byte object <B4-D3 4E-E3 F0-55 00-00 02-D4 4E-E3 F0-55 00-00 01-00 00-00 AB-AB AB-AB 57-16 51-E3 F0-55 00-00 57-16 51-E3 F0-55 00-00>

In a Linux CI run, for the curious among us:

2025-03-10T16:15:30.7580398Z [----------] Global test environment tear-down
2025-03-10T16:15:30.7580522Z [==========] 3514 tests from 174 test suites ran. (171417 ms total)
2025-03-10T16:15:30.7580608Z [  PASSED  ] 589 tests.
2025-03-10T16:15:30.7580699Z [  SKIPPED ] 2925 tests, listed below:

Bug: b/384819454

@yell0wd0g yell0wd0g force-pushed the EXP_use_pbuffer_for_FakeGraphicsContextProvider branch from 7374b55 to da939f7 Compare March 7, 2025 22:53
@yell0wd0g yell0wd0g force-pushed the EXP_use_pbuffer_for_FakeGraphicsContextProvider branch from da939f7 to 1b7a6fe Compare March 7, 2025 23:09
@yell0wd0g yell0wd0g marked this pull request as ready for review March 8, 2025 00:30
@yell0wd0g yell0wd0g requested review from xiaomings and sherryzy March 8, 2025 00:30
@yell0wd0g
Copy link
Contributor Author

@xiaomings and @sherryzy PTAL. Bots are still not running but changes work locally.

Copy link
Contributor

@sherryzy sherryzy left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The code LGTM.

Looking at your summary, there are more than 2000 SbPlayer tests, only 8 of them are run. Do you know why? Also for the 6 failed tests, are they related to your change or no?

@yell0wd0g
Copy link
Contributor Author

The code LGTM.

Looking at your summary, there are more than 2000 SbPlayer tests, only 8 of them are run. Do you know why?

They do some internal feature detection and decide to GTEST_SKIP() - some examples are protected content (not supported on Linux Cobalt yet) or hardware decoding (also not supported on Linux IIRC).

Also for the 6 failed tests, are they related to your change or no?

They are failing on ToT too -- note that I run nplb "vanilla" and that's why I see them failing, on CI they are suppressed using the cobalt/testing/filters/linux-x64x11/nplb_filter.json file.

@yell0wd0g yell0wd0g force-pushed the EXP_use_pbuffer_for_FakeGraphicsContextProvider branch from 4665e26 to 70eae24 Compare March 11, 2025 02:48
@yell0wd0g yell0wd0g enabled auto-merge (squash) March 11, 2025 02:51
@yell0wd0g yell0wd0g merged commit c04416c into youtube:main Mar 11, 2025
140 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants