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

Ozone: Only use Starboard platform #5038

Open
wants to merge 2 commits into
base: main
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
8 changes: 7 additions & 1 deletion cobalt/build/configs/linux-x64x11/args.gn
Original file line number Diff line number Diff line change
Expand Up @@ -2,9 +2,11 @@ import("//cobalt/build/configs/chromium_linux-x64x11/args.gn")
import("//cobalt/build/configs/common.gn")

use_ozone = true
ozone_auto_platforms = false
ozone_platform = "starboard"

# Vulkan is a new rendering (and presentation, and more) API intended to replace
# E/GL(ES). Partners are only required to support upto GLES 2.0 : https://developers.google.com/youtube/cobalt/docs/reference/starboard/modules/16/gles#gles_version
# E/GL(ES). Partners are only required to support up to GLES 2.0 : https://developers.google.com/youtube/cobalt/docs/reference/starboard/modules/16/gles#gles_version
# Disable Vulkan until we formally decide to support it.
enable_vulkan = false

Expand All @@ -19,6 +21,10 @@ enable_nacl = false
# Overriding the flag from //ui/gl/features.gni
use_static_angle = true

# Angle supports multiple backends. If Vulkan is engaged (for tests, SwAngle),
# then we don't want to have a real display.
angle_use_vulkan_null_display = true

# Disable udev
use_udev = false

Expand Down
46 changes: 23 additions & 23 deletions starboard/testing/fake_graphics_context_provider.cc
Original file line number Diff line number Diff line change
Expand Up @@ -44,6 +44,7 @@
#define EGL_CONTEXT_CLIENT_VERSION SB_EGL_CONTEXT_CLIENT_VERSION
#define EGL_DEFAULT_DISPLAY SB_EGL_DEFAULT_DISPLAY
#define EGL_GREEN_SIZE SB_EGL_GREEN_SIZE
#define EGL_HEIGHT SB_EGL_HEIGHT
#define EGL_NONE SB_EGL_NONE
#define EGL_NO_CONTEXT SB_EGL_NO_CONTEXT
#define EGL_NO_DISPLAY SB_EGL_NO_DISPLAY
Expand All @@ -54,6 +55,7 @@
#define EGL_RENDERABLE_TYPE SB_EGL_RENDERABLE_TYPE
#define EGL_SUCCESS SB_EGL_SUCCESS
#define EGL_SURFACE_TYPE SB_EGL_SURFACE_TYPE
#define EGL_WIDTH SB_EGL_WIDTH
#define EGL_WINDOW_BIT SB_EGL_WINDOW_BIT

#define EGL_CALL(x) \
Expand All @@ -73,24 +75,6 @@
namespace starboard {
namespace testing {

namespace {

EGLint const kAttributeList[] = {EGL_RED_SIZE,
8,
EGL_GREEN_SIZE,
8,
EGL_BLUE_SIZE,
8,
EGL_ALPHA_SIZE,
8,
EGL_SURFACE_TYPE,
EGL_WINDOW_BIT | EGL_PBUFFER_BIT,
EGL_RENDERABLE_TYPE,
EGL_OPENGL_ES2_BIT,
EGL_NONE};

} // namespace

FakeGraphicsContextProvider::FakeGraphicsContextProvider()
: display_(EGL_NO_DISPLAY),
surface_(EGL_NO_SURFACE),
Expand Down Expand Up @@ -192,6 +176,20 @@ void FakeGraphicsContextProvider::InitializeEGL() {
// from configs that do allow that. To handle that, we have to attempt
// eglCreateWindowSurface() until we find a config that succeeds.

constexpr EGLint kAttributeList[] = {EGL_RED_SIZE,
8,
EGL_GREEN_SIZE,
8,
EGL_BLUE_SIZE,
8,
EGL_ALPHA_SIZE,
8,
EGL_SURFACE_TYPE,
EGL_WINDOW_BIT | EGL_PBUFFER_BIT,
EGL_RENDERABLE_TYPE,
EGL_OPENGL_ES2_BIT,
EGL_NONE};

// First, query how many configs match the given attribute list.
EGLint num_configs = 0;
EGL_CALL(eglChooseConfig(display_, kAttributeList, NULL, 0, &num_configs));
Expand All @@ -203,16 +201,18 @@ void FakeGraphicsContextProvider::InitializeEGL() {
EGL_CALL(eglChooseConfig(display_, kAttributeList, configs, num_configs,
&num_configs));

EGLNativeWindowType native_window =
(EGLNativeWindowType)SbWindowGetPlatformHandle(window_);
//EGLNativeWindowType native_window =
// (EGLNativeWindowType)SbWindowGetPlatformHandle(window_);
EGLConfig config = EGLConfig();

// Find the first config that successfully allow a window surface to be
// created.
// Find the first config that successfully allow a pBuffer surface (i.e. an
// offscreen EGLsurface) to be created.
for (int config_number = 0; config_number < num_configs; ++config_number) {
config = configs[config_number];
constexpr EGLint kPBufferAttribs[] = {EGL_WIDTH, 1920, EGL_HEIGHT, 1080,
EGL_NONE};
surface_ = EGL_CALL_SIMPLE(
eglCreateWindowSurface(display_, config, native_window, NULL));
eglCreatePbufferSurface(display_, config, kPBufferAttribs));
if (EGL_SUCCESS == EGL_CALL_SIMPLE(eglGetError())) {
break;
}
Expand Down
2 changes: 0 additions & 2 deletions ui/ozone/platform/starboard/ozone_platform_starboard.cc
Original file line number Diff line number Diff line change
Expand Up @@ -173,8 +173,6 @@ OzonePlatform* CreateOzonePlatformStarboard() {
CHECK_EQ(cmd->GetSwitchValueASCII(switches::kUseGL),
gl::kGLImplementationANGLEName)
<< " Unsupported " << switches::kUseGL << " implementation";
} else {
cmd->AppendSwitchASCII(switches::kUseGL, gl::kGLImplementationANGLEName);
}

return new OzonePlatformStarboard();
Expand Down
Loading