Skip to content

Commit

Permalink
Update nplb tests to match Cobalt's Angle config
Browse files Browse the repository at this point in the history
Change EGL call for getting a display to allow attributes to be set and
passed. Match these attributes to the ones that are set by the Cobalt
binary in ui/gl/gl_display.cc so we're sure that we're testing the
correct behavior.

b/393422551
  • Loading branch information
TyHolc committed Feb 19, 2025
1 parent 80d79ea commit fcc1ad2
Show file tree
Hide file tree
Showing 4 changed files with 25 additions and 2 deletions.
1 change: 1 addition & 0 deletions cobalt/build/configs/linux-x64x11/args.gn
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,7 @@ angle_enable_gl = true
# Disable Vulkan until we formally decide to support it.
enable_vulkan = false
angle_enable_vulkan = false
angle_use_vulkan_display = false

# Overriding flag from //media/media_options.gni.
# Cobalt doesn't use //third_party/ffmpeg.
Expand Down
9 changes: 9 additions & 0 deletions cobalt/docker/unittest/Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -3,9 +3,18 @@ ARG BASE_IMAGE_SHA=sha256:4abf773f2a570e6873259c4e3ba16de6c6268fb571fd46ec80be7c
FROM debian:12@${BASE_IMAGE_SHA}

# Install any necessary dependencies
# TODO: verify which graphics libraries are required and remove the others
# libgles2-mesa-dev \
# mesa-vulkan-drivers \
# libglapi-mesa \
# libegl-mesa0 \
RUN apt-get update && apt-get install -y \
jq \
libasound2 \
libgles2-mesa-dev \
mesa-vulkan-drivers \
libglapi-mesa \
libegl-mesa0 \
libdbus-1-3 \
libgbm-dev \
libnss3 \
Expand Down
2 changes: 1 addition & 1 deletion starboard/shared/egl/system_egl.cc
Original file line number Diff line number Diff line change
Expand Up @@ -99,7 +99,7 @@ const SbEglInterface g_sb_egl_interface = {
nullptr, // eglGetSyncAttrib
nullptr, // eglCreateImage
nullptr, // eglDestroyImage
nullptr, // eglGetPlatformDisplay
&eglGetPlatformDisplay,
nullptr, // eglCreatePlatformWindowSurface
nullptr, // eglCreatePlatformPixmapSurface
nullptr, // eglWaitSync
Expand Down
15 changes: 14 additions & 1 deletion starboard/testing/fake_graphics_context_provider.cc
Original file line number Diff line number Diff line change
Expand Up @@ -35,6 +35,7 @@

#define EGL_CALL_PREFIX SbGetEglInterface()->

#define EGLAttrib SbEglAttrib
#define EGLConfig SbEglConfig
#define EGLint SbEglInt32
#define EGLNativeWindowType SbEglNativeWindowType
Expand All @@ -50,6 +51,11 @@
#define EGL_NO_SURFACE SB_EGL_NO_SURFACE
#define EGL_OPENGL_ES2_BIT SB_EGL_OPENGL_ES2_BIT
#define EGL_PBUFFER_BIT SB_EGL_PBUFFER_BIT
#define EGL_PLATFORM_ANGLE_ANGLE 0x3202
#define EGL_PLATFORM_ANGLE_DEVICE_TYPE_ANGLE 0x3209
#define EGL_PLATFORM_ANGLE_DEVICE_TYPE_EGL_ANGLE 0x348E
#define EGL_PLATFORM_ANGLE_TYPE_ANGLE 0x3203
#define EGL_PLATFORM_ANGLE_TYPE_OPENGLES_ANGLE 0x320E
#define EGL_RED_SIZE SB_EGL_RED_SIZE
#define EGL_RENDERABLE_TYPE SB_EGL_RENDERABLE_TYPE
#define EGL_SUCCESS SB_EGL_SUCCESS
Expand Down Expand Up @@ -89,6 +95,11 @@ EGLint const kAttributeList[] = {EGL_RED_SIZE,
EGL_OPENGL_ES2_BIT,
EGL_NONE};

EGLAttrib const kDisplayAttribList[] = {
EGL_PLATFORM_ANGLE_DEVICE_TYPE_ANGLE,
EGL_PLATFORM_ANGLE_DEVICE_TYPE_EGL_ANGLE, EGL_PLATFORM_ANGLE_TYPE_ANGLE,
EGL_PLATFORM_ANGLE_TYPE_OPENGLES_ANGLE};

} // namespace

FakeGraphicsContextProvider::FakeGraphicsContextProvider()
Expand Down Expand Up @@ -174,7 +185,9 @@ void FakeGraphicsContextProvider::InitializeWindow() {
}

void FakeGraphicsContextProvider::InitializeEGL() {
display_ = EGL_CALL_SIMPLE(eglGetDisplay(EGL_DEFAULT_DISPLAY));
display_ = EGL_CALL_SIMPLE(eglGetPlatformDisplay(
EGL_PLATFORM_ANGLE_ANGLE, reinterpret_cast<void*>(SB_EGL_DEFAULT_DISPLAY),
kDisplayAttribList));
SB_DCHECK(EGL_SUCCESS == EGL_CALL_SIMPLE(eglGetError()));
SB_CHECK(EGL_NO_DISPLAY != display_);

Expand Down

0 comments on commit fcc1ad2

Please sign in to comment.