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 prototype: #4311

Draft
wants to merge 1 commit into
base: main
Choose a base branch
from
Draft
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
3 changes: 3 additions & 0 deletions base/logging.cc
Original file line number Diff line number Diff line change
Expand Up @@ -995,6 +995,9 @@ void LogMessage::Init(const char* file, int line) {
stream_ << base::GetUniqueIdForProcess() << ':';
if (g_log_thread_id)
stream_ << base::PlatformThread::CurrentId() << ':';

stream_ << base::PlatformThread::GetName() << ':';

if (g_log_timestamp) {
#if BUILDFLAG(IS_WIN)
SYSTEMTIME local_time;
Expand Down
3 changes: 3 additions & 0 deletions base/metrics/histogram_base.cc
Original file line number Diff line number Diff line change
Expand Up @@ -90,9 +90,12 @@ HistogramBase::HistogramBase(const char* name)
HistogramBase::~HistogramBase() = default;

void HistogramBase::CheckName(const StringPiece& name) const {
// hack
#if 0
DCHECK_EQ(StringPiece(histogram_name()), name)
<< "Provided histogram name doesn't match instance name. Are you using a "
"dynamic string in a macro?";
#endif
}

void HistogramBase::SetFlags(int32_t flags) {
Expand Down
7 changes: 7 additions & 0 deletions build/config/clang/BUILD.gn
Original file line number Diff line number Diff line change
Expand Up @@ -54,6 +54,13 @@ config("find_bad_constructs") {
"-plugin-arg-find-bad-constructs",
"-Xclang",
"raw-ptr-exclude-path=base/containers/span.h",

# Hack
"-Xclang",
"-plugin-arg-find-bad-constructs",
"-Xclang",
"raw-ptr-exclude-path=/",

]
}
}
Expand Down
6 changes: 3 additions & 3 deletions build/config/ozone_extra.gni
Original file line number Diff line number Diff line change
Expand Up @@ -5,13 +5,13 @@
# This list contains the name of external platforms that are passed to the
# --ozone-platform command line argument or used for the ozone_platform build
# config. For example ozone_external_platforms = [ "foo1", "foo2", ... ]
ozone_external_platforms = []
ozone_external_platforms = [ "starboard" ]

# This list contains dependencies for external platforms. Typically, the Ozone
# implementations are placed into ui/ozone/platform/ and so this will look
# something like:
# ozone_external_platform_deps = [ "platform/foo1", "platform/foo_2", ... ]
ozone_external_platform_deps = []
ozone_external_platform_deps = [ "platform/starboard" ]

# If a platform has unit tests, the corresponding source_set can be listed here
# so that they get included into ozone_unittests.
Expand All @@ -25,7 +25,7 @@ ozone_external_platform_integration_test_deps = []
# If a platform has test support files for ui, the corresponding source_set can
# be listed here so that they get included into ui_test_support.
# ozone_external_platform_ui_test_support_deps = [ "platform/foo1:ui_test_support", ... ]
ozone_external_platform_ui_test_support_deps = []
ozone_external_platform_ui_test_support_deps = ["platform/starboard:test_support"]

# If a platform has a test support for interactive_ui_tests, the corresponding
# source_set can be listed here so that they can included into
Expand Down
4 changes: 4 additions & 0 deletions cobalt/build/configs/linux-cobalt-x64x11/args.gn
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,10 @@ enable_nacl = false
use_dawn = false
skia_use_dawn = false

# Disable v8 snapshot tool
# See b/375241133 for error generated.
use_v8_context_snapshot = false

# enable_vulkan=false

use_ozone = true
Expand Down
8 changes: 7 additions & 1 deletion components/viz/host/host_gpu_memory_buffer_manager.cc
Original file line number Diff line number Diff line change
Expand Up @@ -475,9 +475,15 @@ void HostGpuMemoryBufferManager::OnGpuMemoryBufferAllocated(
bool HostGpuMemoryBufferManager::CreateBufferUsesGpuService(
gfx::BufferFormat format,
gfx::BufferUsage usage) {
return gpu_memory_buffer_support_->GetNativeGpuMemoryBufferType() !=
// hack for gpu memory allocation
return false;
#if 0
bool res = gpu_memory_buffer_support_->GetNativeGpuMemoryBufferType() !=
gfx::EMPTY_BUFFER &&
IsNativeGpuMemoryBufferConfiguration(format, usage);

return res;
#endif
Comment on lines +480 to +486
Copy link
Contributor

Choose a reason for hiding this comment

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

This is probably needed/happening because we are taking
the IS_LINUX path in [1] - we should add an IS_STARBOARD
entry there (//gpu is a low level folder, like //base
or //media, so can know about "starboard").

[1] https://source.chromium.org/chromium/chromium/src/+/main:gpu/ipc/common/gpu_memory_buffer_support.cc;l=52-64?q=GetNativeGpuMemoryBufferType&ss=chromium

}

} // namespace viz
4 changes: 4 additions & 0 deletions content/browser/gpu/gpu_data_manager_impl_private.cc
Original file line number Diff line number Diff line change
Expand Up @@ -555,6 +555,10 @@ void GpuDataManagerImplPrivate::InitializeGpuModes() {
#endif // BUILDFLAG(IS_FUCHSIA)
}

// hack
fallback_modes_.clear();
fallback_modes_.push_back(gpu::GpuMode::HARDWARE_GL);

Comment on lines +558 to +561
Copy link
Contributor

Choose a reason for hiding this comment

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

This might be needed because of l.553 -- we should be taking
the #else in l.551 (to be confirmed), and we end up using
vulkan for some reason. There is a build flag to enable/disable
vulkan [1] and this is probably enabled because it thinks we
are on Linux [2] (and we should force disable it for is_starboard).

[1] https://source.corp.google.com/h/lbshell-internal/cobalt_src/+/main:content/browser/gpu/gpu_data_manager_impl_private.cc;l=402-416?q=vulkanallowed&ss=h%2Flbshell-internal%2Fcobalt_src%2F%2B%2Frefs%2Fheads%2Fmain&start=1
[2] https://source.corp.google.com/h/lbshell-internal/cobalt_src/+/main:gpu/vulkan/features.gni;l=11?q=vulkan%20file:%5C.gni&ss=h%2Flbshell-internal%2Fcobalt_src%2F%2B%2Frefs%2Fheads%2Fmain

Copy link
Contributor

Choose a reason for hiding this comment

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

Maybe #4361 will help removing this delta.

FallBackToNextGpuMode();
}

Expand Down
8 changes: 5 additions & 3 deletions content/common/user_agent.cc
Original file line number Diff line number Diff line change
Expand Up @@ -34,7 +34,8 @@ namespace content {
namespace {

const char kFrozenUserAgentTemplate[] =
"Mozilla/5.0 (%s) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/%s.0.0.0 "
//"Mozilla/5.0 (%s) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/%s.0.0.0 "
"Mozilla/5.0 (%s) Cobalt/26.lts.1.234567-qa (unlike Gecko) v8/8.8.278.8-jit gles Starboard/17, %s"
#if BUILDFLAG(IS_ANDROID) || BUILDFLAG(IS_IOS)
"%s"
#endif
Expand Down Expand Up @@ -406,8 +407,9 @@ std::string BuildUserAgentFromOSAndProduct(const std::string& os_info,
// compatible with Safari, we hope!!
std::string user_agent;
base::StringAppendF(&user_agent,
"Mozilla/5.0 (%s) AppleWebKit/537.36 (KHTML, like Gecko) "
"%s Safari/537.36",
//"Mozilla/5.0 (%s) AppleWebKit/537.36 (KHTML, like Gecko) "
//"%s Safari/537.36",
"Mozilla/5.0 (%s) Cobalt/26.lts.1.234567-qa (unlike Gecko) v8/8.8.278.8-jit gles Starboard/17, %s",
os_info.c_str(), product.c_str());
return user_agent;
}
Expand Down
5 changes: 3 additions & 2 deletions content/shell/browser/shell.cc
Original file line number Diff line number Diff line change
Expand Up @@ -56,8 +56,9 @@ base::OnceClosure& GetMainMessageLoopQuitClosure() {
return *closure;
}

constexpr int kDefaultTestWindowWidthDip = 800;
constexpr int kDefaultTestWindowHeightDip = 600;
//hack
constexpr int kDefaultTestWindowWidthDip = 1280;
constexpr int kDefaultTestWindowHeightDip = 720;

// Owning pointer. We can not use unique_ptr as a global. That introduces a
// static constructor/destructor.
Expand Down
13 changes: 13 additions & 0 deletions gpu/config/gpu_control_list.cc
Original file line number Diff line number Diff line change
Expand Up @@ -120,6 +120,8 @@ bool ProcessANGLEGLRenderer(const std::string& gl_renderer,
std::string* vendor,
std::string* renderer,
std::string* version) {
// Hack for broken parsing
#if 0
constexpr char kANGLEPrefix[] = "ANGLE (";
if (!base::StartsWith(gl_renderer, kANGLEPrefix))
return false;
Expand Down Expand Up @@ -150,6 +152,17 @@ bool ProcessANGLEGLRenderer(const std::string& gl_renderer,
if (version)
*version = segments[2];

#endif
// ANGLE (Mesa, llvmpipe (LLVM 17.0.6, 256 bits), OpenGL 4.5 core)
if (vendor) {
*vendor = "Mesa";
}
if (renderer) {
*renderer = "llvmpipe (LLVM 17.0.6, 256 bits)";
}
if (version) {
*version = "OpenGL 4.5 core";
}
return true;
}

Expand Down
3 changes: 3 additions & 0 deletions gpu/config/gpu_util.cc
Original file line number Diff line number Diff line change
Expand Up @@ -284,13 +284,16 @@ GpuFeatureStatus GetAcceleratedVideoEncodeFeatureStatus(

GpuFeatureStatus GetGLFeatureStatus(const std::set<int>& blocklisted_features,
bool use_swift_shader) {
// hack to turn off the SwiftShader
#if 0
if (use_swift_shader) {
// This is for testing only. Chrome should exercise the GPU accelerated
// path on top of SwiftShader driver.
return kGpuFeatureStatusEnabled;
}
if (blocklisted_features.count(GPU_FEATURE_TYPE_ACCELERATED_GL))
return kGpuFeatureStatusBlocklisted;
#endif
return kGpuFeatureStatusEnabled;
}

Expand Down
3 changes: 2 additions & 1 deletion ui/gl/gl_context_egl.cc
Original file line number Diff line number Diff line change
Expand Up @@ -270,7 +270,8 @@ bool GLContextEGL::Initialize(GLSurface* compatible_surface,
context_attributes.push_back(
attribs.global_semaphore_share_group ? EGL_TRUE : EGL_FALSE);
} else {
DCHECK(!attribs.global_semaphore_share_group);
// Hack
// DCHECK(!attribs.global_semaphore_share_group);
}

if (gl_display_->ext->b_EGL_ANGLE_create_context_client_arrays) {
Expand Down
1 change: 1 addition & 0 deletions ui/ozone/BUILD.gn
Original file line number Diff line number Diff line change
Expand Up @@ -253,6 +253,7 @@ component("ozone") {
public_deps = [
":buildflags",
":platform",
"//starboard($starboard_toolchain)"
]
}

Expand Down
68 changes: 68 additions & 0 deletions ui/ozone/platform/starboard/BUILD.gn
Original file line number Diff line number Diff line change
@@ -0,0 +1,68 @@
# Copyright 2024 The Chromium Authors
# Use of this source code is governed by a BSD-style license that can be
# found in the LICENSE file.

import("//build/config/ozone.gni")

visibility = [
"//ui/ozone/*",
]

source_set("starboard") {
public_configs = [
]
sources = [
"client_native_pixmap_factory_starboard.cc",
"client_native_pixmap_factory_starboard.h",
"gl_ozone_egl_starboard.cc",
"gl_ozone_egl_starboard.h",
"gl_surface_starboard.cc",
"gl_surface_starboard.h",
"overlay_manager_starboard.cc",
"overlay_manager_starboard.h",
"ozone_platform_starboard.cc",
"ozone_platform_starboard.h",
"platform_screen_starboard.cc",
"platform_screen_starboard.h",
"platform_window_starboard.cc",
"platform_window_starboard.h",
"surface_factory_starboard.cc",
"surface_factory_starboard.h",
"starboard_platform_event_source.h",
"starboard_platform_event_source.cc",
]

defines = [
"OZONE_IMPLEMENTATION",
]

deps = [
"//base",
"//starboard($starboard_toolchain)",
"//ui/base/cursor",
"//ui/base/ime",
"//ui/events/ozone",
"//ui/events/ozone/evdev",
"//ui/events/ozone/layout",
"//ui/gfx",
"//ui/gfx/geometry",
"//ui/ozone:ozone_base",
"//ui/ozone/common",
"//ui/platform_window",
"//ui/platform_window/stub",
]
}

source_set("test_support") {
testonly = true

sources = [
"starboard_ozone_ui_controls_test_helper.cc",
"starboard_ozone_ui_controls_test_helper.h",
]

deps = [
"//ui/aura:aura",
"//ui/base/x:test_support",
]
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,17 @@
// Copyright 2024 The Chromium Authors
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.

#include "ui/ozone/platform/starboard/client_native_pixmap_factory_starboard.h"

#include "base/logging.h"
#include "ui/ozone/common/stub_client_native_pixmap_factory.h"

namespace ui {

gfx::ClientNativePixmapFactory* CreateClientNativePixmapFactoryStarboard() {
LOG(INFO) << "CreateClientNativePixmapFactoryStarboard";
return CreateStubClientNativePixmapFactory();
}

} // namespace ui
Original file line number Diff line number Diff line change
@@ -0,0 +1,18 @@
// Copyright 2024 The Chromium Authors
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.

#ifndef UI_OZONE_PLATFORM_STARBOARD_CLIENT_NATIVE_PIXMAP_FACTORY_STARBOARD_H_
#define UI_OZONE_PLATFORM_STARBOARD_CLIENT_NATIVE_PIXMAP_FACTORY_STARBOARD_H_

namespace gfx {
class ClientNativePixmapFactory;
}

namespace ui {

gfx::ClientNativePixmapFactory* CreateClientNativePixmapFactoryStarboard();

} // namespace ui

#endif // UI_OZONE_PLATFORM_STARBOARD_CLIENT_NATIVE_PIXMAP_FACTORY_STARBOARD_H_
Loading