Commit d2753a25 authored by Michael Spang's avatar Michael Spang Committed by Commit Bot

ozone: scenic: Enable SwiftShader

Parts of chromium still depend on a GLES implementation, even when vulkan
is in use. To avoid crashes related to those components, enable
swiftshader temporarily.

Bug: 861853, 897208
Test: run_content_shell --ozone-platform=scenic --disable-gpu --enable-vulkan

Change-Id: I87453e066de39f188a8db28079d80f058fcc4e1c
Reviewed-on: https://chromium-review.googlesource.com/c/1343240
Commit-Queue: Michael Spang <spang@chromium.org>
Reviewed-by: default avatarSergey Ulanov <sergeyu@chromium.org>
Cr-Commit-Position: refs/heads/master@{#609461}
parent 320deaef
...@@ -11,6 +11,9 @@ ...@@ -11,6 +11,9 @@
#include "ui/gfx/native_pixmap.h" #include "ui/gfx/native_pixmap.h"
#include "ui/gfx/skia_util.h" #include "ui/gfx/skia_util.h"
#include "ui/gfx/vsync_provider.h" #include "ui/gfx/vsync_provider.h"
#include "ui/gl/gl_surface_egl.h"
#include "ui/ozone/common/egl_util.h"
#include "ui/ozone/common/gl_ozone_egl.h"
#include "ui/ozone/platform/scenic/scenic_window.h" #include "ui/ozone/platform/scenic/scenic_window.h"
#include "ui/ozone/platform/scenic/scenic_window_canvas.h" #include "ui/ozone/platform/scenic/scenic_window_canvas.h"
#include "ui/ozone/platform/scenic/scenic_window_manager.h" #include "ui/ozone/platform/scenic/scenic_window_manager.h"
...@@ -23,6 +26,37 @@ namespace ui { ...@@ -23,6 +26,37 @@ namespace ui {
namespace { namespace {
class GLOzoneEGLScenic : public GLOzoneEGL {
public:
GLOzoneEGLScenic() = default;
~GLOzoneEGLScenic() override = default;
// GLOzone:
scoped_refptr<gl::GLSurface> CreateViewGLSurface(
gfx::AcceleratedWidget window) override {
NOTIMPLEMENTED();
return nullptr;
}
scoped_refptr<gl::GLSurface> CreateOffscreenGLSurface(
const gfx::Size& size) override {
return gl::InitializeGLSurface(
base::MakeRefCounted<gl::PbufferGLSurfaceEGL>(size));
}
EGLNativeDisplayType GetNativeDisplay() override {
return EGL_DEFAULT_DISPLAY;
}
protected:
bool LoadGLES2Bindings(gl::GLImplementation implementation) override {
return LoadDefaultEGLGLES2Bindings(implementation);
}
private:
DISALLOW_COPY_AND_ASSIGN(GLOzoneEGLScenic);
};
// TODO(crbug.com/852011): Implement this class - currently it's just a stub. // TODO(crbug.com/852011): Implement this class - currently it's just a stub.
class ScenicPixmap : public gfx::NativePixmap { class ScenicPixmap : public gfx::NativePixmap {
public: public:
...@@ -69,18 +103,24 @@ class ScenicPixmap : public gfx::NativePixmap { ...@@ -69,18 +103,24 @@ class ScenicPixmap : public gfx::NativePixmap {
} // namespace } // namespace
ScenicSurfaceFactory::ScenicSurfaceFactory(ScenicWindowManager* window_manager) ScenicSurfaceFactory::ScenicSurfaceFactory(ScenicWindowManager* window_manager)
: window_manager_(window_manager) {} : window_manager_(window_manager),
egl_implementation_(std::make_unique<GLOzoneEGLScenic>()) {}
ScenicSurfaceFactory::~ScenicSurfaceFactory() = default; ScenicSurfaceFactory::~ScenicSurfaceFactory() = default;
std::vector<gl::GLImplementation> std::vector<gl::GLImplementation>
ScenicSurfaceFactory::GetAllowedGLImplementations() { ScenicSurfaceFactory::GetAllowedGLImplementations() {
return std::vector<gl::GLImplementation>{}; // TODO(spang): Remove this after crbug.com/897208 is fixed.
return std::vector<gl::GLImplementation>{gl::kGLImplementationSwiftShaderGL};
} }
GLOzone* ScenicSurfaceFactory::GetGLOzone(gl::GLImplementation implementation) { GLOzone* ScenicSurfaceFactory::GetGLOzone(gl::GLImplementation implementation) {
NOTREACHED(); switch (implementation) {
return nullptr; case gl::kGLImplementationSwiftShaderGL:
return egl_implementation_.get();
default:
return nullptr;
}
} }
std::unique_ptr<SurfaceOzoneCanvas> ScenicSurfaceFactory::CreateCanvasForWidget( std::unique_ptr<SurfaceOzoneCanvas> ScenicSurfaceFactory::CreateCanvasForWidget(
......
...@@ -41,6 +41,7 @@ class ScenicSurfaceFactory : public SurfaceFactoryOzone { ...@@ -41,6 +41,7 @@ class ScenicSurfaceFactory : public SurfaceFactoryOzone {
private: private:
ScenicWindowManager* const window_manager_; ScenicWindowManager* const window_manager_;
std::unique_ptr<GLOzone> egl_implementation_;
DISALLOW_COPY_AND_ASSIGN(ScenicSurfaceFactory); DISALLOW_COPY_AND_ASSIGN(ScenicSurfaceFactory);
}; };
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment