diff options
author | leandrogracia@chromium.org <leandrogracia@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98> | 2011-07-21 15:27:49 +0000 |
---|---|---|
committer | leandrogracia@chromium.org <leandrogracia@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98> | 2011-07-21 15:27:49 +0000 |
commit | 0fb8e4229c1eb3fb943713da997d46ff7fdd033e (patch) | |
tree | 5b1657f1c77a0a2b2a66bd5ffc205c3641a4f31c | |
parent | a749a946d9eaeff53419a1a65bf59021ba1acf51 (diff) | |
download | chromium_src-0fb8e4229c1eb3fb943713da997d46ff7fdd033e.zip chromium_src-0fb8e4229c1eb3fb943713da997d46ff7fdd033e.tar.gz chromium_src-0fb8e4229c1eb3fb943713da997d46ff7fdd033e.tar.bz2 |
Revert 93393 - Crashed Linux Touch build: http://build.chromium.org/p/chromium/builders/Linux%20Touch/builds/2649/steps/compile/logs/stdio
Allow creating a gpu channel that uses software rendering
Where supported (on ANGLE with EGL_ANGLE_software_display), allow for the creation of gpu channels that use software rendering instead of hardware rendering.
BUG=
TEST=trybots, other later tests
Review URL: http://codereview.chromium.org/7383004
TBR=jbauman@chromium.org
Review URL: http://codereview.chromium.org/7468030
git-svn-id: svn://svn.chromium.org/chrome/trunk/src@93399 0039d316-1c4b-4281-b951-d872f2087c98
30 files changed, 59 insertions, 187 deletions
diff --git a/content/common/gpu/gpu_channel.cc b/content/common/gpu/gpu_channel.cc index e83320d..e69d197 100644 --- a/content/common/gpu/gpu_channel.cc +++ b/content/common/gpu/gpu_channel.cc @@ -27,15 +27,13 @@ GpuChannel::GpuChannel(GpuChannelManager* gpu_channel_manager, GpuWatchdog* watchdog, - int renderer_id, - bool software) + int renderer_id) : gpu_channel_manager_(gpu_channel_manager), renderer_id_(renderer_id), renderer_process_(base::kNullProcessHandle), renderer_pid_(base::kNullProcessId), share_group_(new gfx::GLShareGroup), - watchdog_(watchdog), - software_(software) { + watchdog_(watchdog) { DCHECK(gpu_channel_manager); DCHECK(renderer_id); const CommandLine* command_line = CommandLine::ForCurrentProcess(); @@ -166,7 +164,7 @@ void GpuChannel::CreateViewCommandBuffer( this, window, gfx::Size(), disallowed_extensions_, init_params.allowed_extensions, init_params.attribs, *route_id, renderer_id_, render_view_id, - watchdog_, software_)); + watchdog_)); router_.AddRoute(*route_id, stub.get()); stubs_.AddWithID(stub.release(), *route_id); #endif // ENABLE_GPU @@ -276,8 +274,7 @@ void GpuChannel::OnCreateOffscreenCommandBuffer( init_params.allowed_extensions, init_params.attribs, *route_id, - 0, 0, watchdog_, - software_)); + 0, 0, watchdog_)); router_.AddRoute(*route_id, stub.get()); stubs_.AddWithID(stub.release(), *route_id); TRACE_EVENT1("gpu", "GpuChannel::OnCreateOffscreenCommandBuffer", @@ -309,7 +306,7 @@ void GpuChannel::OnCreateOffscreenSurface(const gfx::Size& size, #if defined(ENABLE_GPU) scoped_refptr<gfx::GLSurface> surface( - gfx::GLSurface::CreateOffscreenGLSurface(software_, size)); + gfx::GLSurface::CreateOffscreenGLSurface(size)); if (!surface.get()) return; diff --git a/content/common/gpu/gpu_channel.h b/content/common/gpu/gpu_channel.h index 2b5ad1f..7344496 100644 --- a/content/common/gpu/gpu_channel.h +++ b/content/common/gpu/gpu_channel.h @@ -48,8 +48,7 @@ class GpuChannel : public IPC::Channel::Listener, // Takes ownership of the renderer process handle. GpuChannel(GpuChannelManager* gpu_channel_manager, GpuWatchdog* watchdog, - int renderer_id, - bool software); + int renderer_id); virtual ~GpuChannel(); bool Init(base::MessageLoopProxy* io_message_loop, @@ -188,7 +187,6 @@ class GpuChannel : public IPC::Channel::Listener, bool log_messages_; // True if we should log sent and received messages. gpu::gles2::DisallowedExtensions disallowed_extensions_; GpuWatchdog* watchdog_; - bool software_; DISALLOW_COPY_AND_ASSIGN(GpuChannel); }; diff --git a/content/common/gpu/gpu_channel_manager.cc b/content/common/gpu/gpu_channel_manager.cc index c2ef865..a0b520c 100644 --- a/content/common/gpu/gpu_channel_manager.cc +++ b/content/common/gpu/gpu_channel_manager.cc @@ -71,7 +71,7 @@ void GpuChannelManager::OnEstablishChannel(int renderer_id) { GpuChannelMap::const_iterator iter = gpu_channels_.find(renderer_id); if (iter == gpu_channels_.end()) - channel = new GpuChannel(this, watchdog_, renderer_id, false); + channel = new GpuChannel(this, watchdog_, renderer_id); else channel = iter->second; diff --git a/content/common/gpu/gpu_command_buffer_stub.cc b/content/common/gpu/gpu_command_buffer_stub.cc index 6de811d..8034372 100644 --- a/content/common/gpu/gpu_command_buffer_stub.cc +++ b/content/common/gpu/gpu_command_buffer_stub.cc @@ -36,8 +36,7 @@ GpuCommandBufferStub::GpuCommandBufferStub( int32 route_id, int32 renderer_id, int32 render_view_id, - GpuWatchdog* watchdog, - bool software) + GpuWatchdog* watchdog) : channel_(channel), handle_(handle), initial_size_(size), @@ -45,7 +44,6 @@ GpuCommandBufferStub::GpuCommandBufferStub( allowed_extensions_(allowed_extensions), requested_attribs_(attribs), route_id_(route_id), - software_(software), last_flush_count_(0), renderer_id_(renderer_id), render_view_id_(render_view_id), @@ -150,7 +148,6 @@ void GpuCommandBufferStub::OnInitialize( if (scheduler_->Initialize( handle_, initial_size_, - software_, disallowed_extensions_, allowed_extensions_.c_str(), requested_attribs_, diff --git a/content/common/gpu/gpu_command_buffer_stub.h b/content/common/gpu/gpu_command_buffer_stub.h index 902ec9b..6766d87 100644 --- a/content/common/gpu/gpu_command_buffer_stub.h +++ b/content/common/gpu/gpu_command_buffer_stub.h @@ -41,8 +41,7 @@ class GpuCommandBufferStub int32 route_id, int32 renderer_id, int32 render_view_id, - GpuWatchdog* watchdog, - bool software); + GpuWatchdog* watchdog); virtual ~GpuCommandBufferStub(); @@ -156,7 +155,6 @@ class GpuCommandBufferStub std::string allowed_extensions_; std::vector<int32> requested_attribs_; int32 route_id_; - bool software_; uint32 last_flush_count_; // The following two fields are used on Mac OS X to identify the window diff --git a/content/gpu/gpu_info_collector.cc b/content/gpu/gpu_info_collector.cc index cd0918c..93cd767 100644 --- a/content/gpu/gpu_info_collector.cc +++ b/content/gpu/gpu_info_collector.cc @@ -20,7 +20,7 @@ namespace { scoped_refptr<gfx::GLSurface> InitializeGLSurface() { scoped_refptr<gfx::GLSurface> surface( - gfx::GLSurface::CreateOffscreenGLSurface(false, gfx::Size(1, 1))); + gfx::GLSurface::CreateOffscreenGLSurface(gfx::Size(1, 1))); if (!surface.get()) { LOG(ERROR) << "gfx::GLContext::CreateOffscreenGLSurface failed"; return NULL; diff --git a/content/gpu/gpu_info_collector_win.cc b/content/gpu/gpu_info_collector_win.cc index dfae814..4e32805 100644 --- a/content/gpu/gpu_info_collector_win.cc +++ b/content/gpu/gpu_info_collector_win.cc @@ -72,7 +72,7 @@ bool CollectGraphicsInfo(GPUInfo* gpu_info) { // Need to handle the case when running on top of real EGL/GLES2 drivers. egl::Display* display = static_cast<egl::Display*>( - gfx::GLSurfaceEGL::GetHardwareDisplay()); + gfx::GLSurfaceEGL::GetDisplay()); if (!display) { LOG(ERROR) << "gfx::BaseEGLContext::GetDisplay() failed"; return false; diff --git a/gpu/command_buffer/client/gles2_demo.cc b/gpu/command_buffer/client/gles2_demo.cc index f981b1b..c9595df 100644 --- a/gpu/command_buffer/client/gles2_demo.cc +++ b/gpu/command_buffer/client/gles2_demo.cc @@ -61,7 +61,6 @@ bool GLES2Demo::Setup(void* hwnd, int32 size) { NULL); if (!gpu_scheduler->Initialize(reinterpret_cast<HWND>(hwnd), gfx::Size(), - false, gpu::gles2::DisallowedExtensions(), NULL, std::vector<int32>(), diff --git a/gpu/command_buffer/service/gpu_scheduler.h b/gpu/command_buffer/service/gpu_scheduler.h index d34e67f..eedae30 100644 --- a/gpu/command_buffer/service/gpu_scheduler.h +++ b/gpu/command_buffer/service/gpu_scheduler.h @@ -63,7 +63,6 @@ class GpuScheduler : public CommandBufferEngine { // Perform platform specific and common initialization. bool Initialize(gfx::PluginWindowHandle hwnd, const gfx::Size& size, - bool software, const gles2::DisallowedExtensions& disallowed_extensions, const char* allowed_extensions, const std::vector<int32>& attribs, diff --git a/gpu/command_buffer/service/gpu_scheduler_linux.cc b/gpu/command_buffer/service/gpu_scheduler_linux.cc index fcbbd65..1c6c8e9 100644 --- a/gpu/command_buffer/service/gpu_scheduler_linux.cc +++ b/gpu/command_buffer/service/gpu_scheduler_linux.cc @@ -21,7 +21,6 @@ namespace gpu { bool GpuScheduler::Initialize( gfx::PluginWindowHandle window, const gfx::Size& size, - bool software, const gles2::DisallowedExtensions& disallowed_extensions, const char* allowed_extensions, const std::vector<int32>& attribs, @@ -29,13 +28,12 @@ bool GpuScheduler::Initialize( // Create either a view or pbuffer based GLSurface. scoped_refptr<gfx::GLSurface> surface; #if defined(TOUCH_UI) - surface = gfx::GLSurface::CreateOffscreenGLSurface(software, gfx::Size(1, 1)); + surface = gfx::GLSurface::CreateOffscreenGLSurface(gfx::Size(1, 1)); #else if (window) - surface = gfx::GLSurface::CreateViewGLSurface(software, window); + surface = gfx::GLSurface::CreateViewGLSurface(window); else - surface = gfx::GLSurface::CreateOffscreenGLSurface(software, - gfx::Size(1, 1)); + surface = gfx::GLSurface::CreateOffscreenGLSurface(gfx::Size(1, 1)); #endif if (!surface.get()) { diff --git a/gpu/command_buffer/service/gpu_scheduler_mac.cc b/gpu/command_buffer/service/gpu_scheduler_mac.cc index cfa0d5c..2835088 100644 --- a/gpu/command_buffer/service/gpu_scheduler_mac.cc +++ b/gpu/command_buffer/service/gpu_scheduler_mac.cc @@ -14,13 +14,12 @@ namespace gpu { bool GpuScheduler::Initialize( gfx::PluginWindowHandle window, const gfx::Size& size, - bool software, const gles2::DisallowedExtensions& disallowed_extensions, const char* allowed_extensions, const std::vector<int32>& attribs, gfx::GLShareGroup* share_group) { scoped_refptr<gfx::GLSurface> surface( - gfx::GLSurface::CreateOffscreenGLSurface(software, gfx::Size(1, 1))); + gfx::GLSurface::CreateOffscreenGLSurface(gfx::Size(1, 1))); if (!surface.get()) { LOG(ERROR) << "CreateOffscreenGLSurface failed.\n"; Destroy(); diff --git a/gpu/command_buffer/service/gpu_scheduler_win.cc b/gpu/command_buffer/service/gpu_scheduler_win.cc index 84f2b83..20e5382 100644 --- a/gpu/command_buffer/service/gpu_scheduler_win.cc +++ b/gpu/command_buffer/service/gpu_scheduler_win.cc @@ -16,7 +16,6 @@ namespace gpu { bool GpuScheduler::Initialize( gfx::PluginWindowHandle window, const gfx::Size& size, - bool software, const gles2::DisallowedExtensions& disallowed_extensions, const char* allowed_extensions, const std::vector<int32>& attribs, @@ -24,10 +23,9 @@ bool GpuScheduler::Initialize( // Create either a view or pbuffer based GLSurface. scoped_refptr<gfx::GLSurface> surface; if (window) { - surface = gfx::GLSurface::CreateViewGLSurface(software, window); + surface = gfx::GLSurface::CreateViewGLSurface(window); } else { - surface = gfx::GLSurface::CreateOffscreenGLSurface(software, - gfx::Size(1, 1)); + surface = gfx::GLSurface::CreateOffscreenGLSurface(gfx::Size(1, 1)); } if (!surface.get()) { diff --git a/gpu/demos/framework/window.cc b/gpu/demos/framework/window.cc index f609a55..30ba86c 100644 --- a/gpu/demos/framework/window.cc +++ b/gpu/demos/framework/window.cc @@ -61,7 +61,7 @@ bool Window::CreateRenderContext(gfx::PluginWindowHandle hwnd) { GpuScheduler* gpu_scheduler( new GpuScheduler(command_buffer.get(), NULL, NULL)); - if (!gpu_scheduler->Initialize(hwnd, gfx::Size(), false, + if (!gpu_scheduler->Initialize(hwnd, gfx::Size(), gpu::gles2::DisallowedExtensions(), NULL, std::vector<int32>(), NULL)) { diff --git a/gpu/gles2_conform_support/egl/display.cc b/gpu/gles2_conform_support/egl/display.cc index 63604b9..cfadf0f 100644 --- a/gpu/gles2_conform_support/egl/display.cc +++ b/gpu/gles2_conform_support/egl/display.cc @@ -111,7 +111,7 @@ EGLSurface Display::CreateWindowSurface(EGLConfig config, scoped_ptr<GpuScheduler> gpu_scheduler( new GpuScheduler(command_buffer_.get(), NULL, NULL)); if (!gpu_scheduler->Initialize( - win, gfx::Size(), false, gpu::gles2::DisallowedExtensions(), NULL, + win, gfx::Size(), gpu::gles2::DisallowedExtensions(), NULL, attribs, NULL)) return EGL_NO_SURFACE; diff --git a/media/tools/shader_bench/shader_bench.cc b/media/tools/shader_bench/shader_bench.cc index fd4adc5..88905e9 100644 --- a/media/tools/shader_bench/shader_bench.cc +++ b/media/tools/shader_bench/shader_bench.cc @@ -132,7 +132,7 @@ int main(int argc, char** argv) { gfx::GLSurface::InitializeOneOff(); scoped_ptr<media::Window> window(new media::Window(width, height)); gfx::GLSurface* surface = - gfx::GLSurface::CreateViewGLSurface(false, window->PluginWindow()); + gfx::GLSurface::CreateViewGLSurface(window->PluginWindow()); gfx::GLContext* context = gfx::GLContext::CreateGLContext(NULL, surface); context->MakeCurrent(surface); // This sets D3DPRESENT_INTERVAL_IMMEDIATE on Windows. diff --git a/ui/gfx/compositor/compositor_gl.cc b/ui/gfx/compositor/compositor_gl.cc index 881c697..27b49b9 100644 --- a/ui/gfx/compositor/compositor_gl.cc +++ b/ui/gfx/compositor/compositor_gl.cc @@ -380,7 +380,7 @@ CompositorGL::CompositorGL(gfx::AcceleratedWidget widget, const gfx::Size& size) : size_(size), started_(false) { - gl_surface_ = gfx::GLSurface::CreateViewGLSurface(false, widget); + gl_surface_ = gfx::GLSurface::CreateViewGLSurface(widget); gl_context_ = SharedResources::GetInstance()-> CreateContext(gl_surface_.get()); gl_context_->MakeCurrent(gl_surface_.get()); diff --git a/ui/gfx/gl/gl.gyp b/ui/gfx/gl/gl.gyp index 5771682..f7c7879 100644 --- a/ui/gfx/gl/gl.gyp +++ b/ui/gfx/gl/gl.gyp @@ -20,7 +20,6 @@ 'gl_binding_output_dir': '<(SHARED_INTERMEDIATE_DIR)/ui/gfx/gl', }, 'include_dirs': [ - '<(DEPTH)/third_party/swiftshader/include', '<(DEPTH)/third_party/mesa/MesaLib/include', '<(gl_binding_output_dir)', ], diff --git a/ui/gfx/gl/gl_context_egl.cc b/ui/gfx/gl/gl_context_egl.cc index f18d59f..63f63e9 100644 --- a/ui/gfx/gl/gl_context_egl.cc +++ b/ui/gfx/gl/gl_context_egl.cc @@ -24,7 +24,7 @@ extern "C" { namespace gfx { std::string GLContextEGL::GetExtensions() { - const char* extensions = eglQueryString(display_, + const char* extensions = eglQueryString(GLSurfaceEGL::GetDisplay(), EGL_EXTENSIONS); if (!extensions) return GLContext::GetExtensions(); @@ -51,13 +51,9 @@ bool GLContextEGL::Initialize(GLSurface* compatible_surface) { EGL_NONE }; - GLSurfaceEGL* egl_surface = static_cast<GLSurfaceEGL*>(compatible_surface); - display_ = egl_surface->GetDisplay(); - config_ = egl_surface->GetConfig(); - context_ = eglCreateContext( - display_, - config_, + GLSurfaceEGL::GetDisplay(), + GLSurfaceEGL::GetConfig(), share_group() ? share_group()->GetHandle() : NULL, kContextAttributes); if (!context_) { @@ -72,7 +68,7 @@ bool GLContextEGL::Initialize(GLSurface* compatible_surface) { void GLContextEGL::Destroy() { if (context_) { - if (!eglDestroyContext(display_, context_)) { + if (!eglDestroyContext(GLSurfaceEGL::GetDisplay(), context_)) { LOG(ERROR) << "eglDestroyContext failed with error " << GetLastEGLErrorString(); } @@ -86,7 +82,7 @@ bool GLContextEGL::MakeCurrent(GLSurface* surface) { if (IsCurrent(surface)) return true; - if (!eglMakeCurrent(display_, + if (!eglMakeCurrent(GLSurfaceEGL::GetDisplay(), surface->GetHandle(), surface->GetHandle(), context_)) { @@ -102,7 +98,7 @@ void GLContextEGL::ReleaseCurrent(GLSurface* surface) { if (!IsCurrent(surface)) return; - eglMakeCurrent(display_, + eglMakeCurrent(GLSurfaceEGL::GetDisplay(), EGL_NO_SURFACE, EGL_NO_SURFACE, EGL_NO_CONTEXT); @@ -127,7 +123,7 @@ void* GLContextEGL::GetHandle() { void GLContextEGL::SetSwapInterval(int interval) { DCHECK(IsCurrent(NULL)); - if (!eglSwapInterval(display_, interval)) { + if (!eglSwapInterval(GLSurfaceEGL::GetDisplay(), interval)) { LOG(ERROR) << "eglSwapInterval failed with error " << GetLastEGLErrorString(); } diff --git a/ui/gfx/gl/gl_context_egl.h b/ui/gfx/gl/gl_context_egl.h index 5a86f28..f1a8193 100644 --- a/ui/gfx/gl/gl_context_egl.h +++ b/ui/gfx/gl/gl_context_egl.h @@ -11,8 +11,6 @@ #include "ui/gfx/gl/gl_context.h" typedef void* EGLContext; -typedef void* EGLDisplay; -typedef void* EGLConfig; namespace gfx { @@ -36,8 +34,6 @@ class GLContextEGL : public GLContext { private: EGLContext context_; - EGLDisplay display_; - EGLConfig config_; DISALLOW_COPY_AND_ASSIGN(GLContextEGL); }; diff --git a/ui/gfx/gl/gl_implementation_win.cc b/ui/gfx/gl/gl_implementation_win.cc index 4d6fff7..9061bb3 100644 --- a/ui/gfx/gl/gl_implementation_win.cc +++ b/ui/gfx/gl/gl_implementation_win.cc @@ -12,10 +12,6 @@ #include "ui/gfx/gl/gl_bindings.h" #include "ui/gfx/gl/gl_implementation.h" -#if defined(ENABLE_SWIFTSHADER) -#include "software_renderer_d3d9.h" -#endif - namespace gfx { namespace { @@ -76,13 +72,6 @@ bool InitializeGLBindings(GLImplementation implementation) { if (!PathService::Get(base::DIR_MODULE, &module_path)) return false; -#if defined(ENABLE_SWIFTSHADER) - base::NativeLibrary swiftshader_library = base::LoadNativeLibrary( - module_path.Append(L"swiftshader_d3d9.dll"), NULL); - - SetupSoftwareRenderer(); -#endif - // Load libglesv2.dll before libegl.dll because the latter is dependent on // the former and if there is another version of libglesv2.dll in the dll // search path, it will get loaded. diff --git a/ui/gfx/gl/gl_surface.h b/ui/gfx/gl/gl_surface.h index 7a89d5b..513f37d 100644 --- a/ui/gfx/gl/gl_surface.h +++ b/ui/gfx/gl/gl_surface.h @@ -50,13 +50,11 @@ class GLSurface : public base::RefCounted<GLSurface> { #if !defined(OS_MACOSX) // Create a GL surface that renders directly to a view. static scoped_refptr<GLSurface> CreateViewGLSurface( - bool software, gfx::PluginWindowHandle window); #endif // Create a GL surface used for offscreen rendering. static scoped_refptr<GLSurface> CreateOffscreenGLSurface( - bool software, const gfx::Size& size); protected: diff --git a/ui/gfx/gl/gl_surface_egl.cc b/ui/gfx/gl/gl_surface_egl.cc index bf509bd..603cff4 100644 --- a/ui/gfx/gl/gl_surface_egl.cc +++ b/ui/gfx/gl/gl_surface_egl.cc @@ -8,7 +8,6 @@ #include "base/logging.h" #include "base/memory/scoped_ptr.h" #include "third_party/angle/include/EGL/egl.h" -#include "third_party/angle/include/EGL/eglext.h" #include "ui/gfx/gl/egl_util.h" // This header must come after the above third-party include, as @@ -27,9 +26,6 @@ namespace { EGLConfig g_config; EGLDisplay g_display; EGLNativeDisplayType g_native_display; -EGLConfig g_software_config; -EGLDisplay g_software_display; -EGLNativeDisplayType g_software_native_display; } GLSurfaceEGL::GLSurfaceEGL() { @@ -89,84 +85,39 @@ bool GLSurfaceEGL::InitializeOneOff() { return false; } + scoped_array<EGLConfig> configs(new EGLConfig[num_configs]); if (!eglChooseConfig(g_display, kConfigAttribs, - &g_config, - 1, + configs.get(), + num_configs, &num_configs)) { LOG(ERROR) << "eglChooseConfig failed with error " << GetLastEGLErrorString(); return false; } - initialized = true; - -#if defined(USE_X11) - return true; -#else - g_software_native_display = EGL_SOFTWARE_DISPLAY_ANGLE; -#endif - g_software_display = eglGetDisplay(g_software_native_display); - if (!g_software_display) { - return true; - } - - if (!eglInitialize(g_software_display, NULL, NULL)) { - return true; - } - - if (!eglChooseConfig(g_software_display, - kConfigAttribs, - NULL, - 0, - &num_configs)) { - g_software_display = NULL; - return true; - } - - if (num_configs == 0) { - g_software_display = NULL; - return true; - } - - if (!eglChooseConfig(g_software_display, - kConfigAttribs, - &g_software_config, - 1, - &num_configs)) { - g_software_display = NULL; - return false; - } + g_config = configs[0]; + initialized = true; return true; } EGLDisplay GLSurfaceEGL::GetDisplay() { - return software_ ? g_software_display : g_display; -} - -EGLConfig GLSurfaceEGL::GetConfig() { - return software_ ? g_software_config : g_config; -} - -EGLDisplay GLSurfaceEGL::GetHardwareDisplay() { return g_display; } -EGLDisplay GLSurfaceEGL::GetSoftwareDisplay() { - return g_software_display; +EGLConfig GLSurfaceEGL::GetConfig() { + return g_config; } EGLNativeDisplayType GLSurfaceEGL::GetNativeDisplay() { return g_native_display; } -NativeViewGLSurfaceEGL::NativeViewGLSurfaceEGL(bool software, - gfx::PluginWindowHandle window) +NativeViewGLSurfaceEGL::NativeViewGLSurfaceEGL(gfx::PluginWindowHandle window) : window_(window), surface_(NULL) { - software_ = software; } NativeViewGLSurfaceEGL::~NativeViewGLSurfaceEGL() { @@ -176,14 +127,9 @@ NativeViewGLSurfaceEGL::~NativeViewGLSurfaceEGL() { bool NativeViewGLSurfaceEGL::Initialize() { DCHECK(!surface_); - if (!GetDisplay()) { - LOG(ERROR) << "Trying to create surface with invalid display."; - return false; - } - // Create a surface for the native window. - surface_ = eglCreateWindowSurface(GetDisplay(), - GetConfig(), + surface_ = eglCreateWindowSurface(g_display, + g_config, window_, NULL); @@ -199,7 +145,7 @@ bool NativeViewGLSurfaceEGL::Initialize() { void NativeViewGLSurfaceEGL::Destroy() { if (surface_) { - if (!eglDestroySurface(GetDisplay(), surface_)) { + if (!eglDestroySurface(g_display, surface_)) { LOG(ERROR) << "eglDestroySurface failed with error " << GetLastEGLErrorString(); } @@ -212,7 +158,7 @@ bool NativeViewGLSurfaceEGL::IsOffscreen() { } bool NativeViewGLSurfaceEGL::SwapBuffers() { - if (!eglSwapBuffers(GetDisplay(), surface_)) { + if (!eglSwapBuffers(g_display, surface_)) { VLOG(1) << "eglSwapBuffers failed with error " << GetLastEGLErrorString(); return false; @@ -224,8 +170,8 @@ bool NativeViewGLSurfaceEGL::SwapBuffers() { gfx::Size NativeViewGLSurfaceEGL::GetSize() { EGLint width; EGLint height; - if (!eglQuerySurface(GetDisplay(), surface_, EGL_WIDTH, &width) || - !eglQuerySurface(GetDisplay(), surface_, EGL_HEIGHT, &height)) { + if (!eglQuerySurface(g_display, surface_, EGL_WIDTH, &width) || + !eglQuerySurface(g_display, surface_, EGL_HEIGHT, &height)) { NOTREACHED() << "eglQuerySurface failed with error " << GetLastEGLErrorString(); return gfx::Size(); @@ -238,10 +184,9 @@ EGLSurface NativeViewGLSurfaceEGL::GetHandle() { return surface_; } -PbufferGLSurfaceEGL::PbufferGLSurfaceEGL(bool software, const gfx::Size& size) +PbufferGLSurfaceEGL::PbufferGLSurfaceEGL(const gfx::Size& size) : size_(size), surface_(NULL) { - software_ = software; } PbufferGLSurfaceEGL::~PbufferGLSurfaceEGL() { @@ -251,19 +196,14 @@ PbufferGLSurfaceEGL::~PbufferGLSurfaceEGL() { bool PbufferGLSurfaceEGL::Initialize() { DCHECK(!surface_); - if (!GetDisplay()) { - LOG(ERROR) << "Trying to create surface with invalid display."; - return false; - } - const EGLint pbuffer_attribs[] = { EGL_WIDTH, size_.width(), EGL_HEIGHT, size_.height(), EGL_NONE }; - surface_ = eglCreatePbufferSurface(GetDisplay(), - GetConfig(), + surface_ = eglCreatePbufferSurface(g_display, + g_config, pbuffer_attribs); if (!surface_) { LOG(ERROR) << "eglCreatePbufferSurface failed with error " @@ -277,7 +217,7 @@ bool PbufferGLSurfaceEGL::Initialize() { void PbufferGLSurfaceEGL::Destroy() { if (surface_) { - if (!eglDestroySurface(GetDisplay(), surface_)) { + if (!eglDestroySurface(g_display, surface_)) { LOG(ERROR) << "eglDestroySurface failed with error " << GetLastEGLErrorString(); } diff --git a/ui/gfx/gl/gl_surface_egl.h b/ui/gfx/gl/gl_surface_egl.h index 19e7f4f..2bf8f82 100644 --- a/ui/gfx/gl/gl_surface_egl.h +++ b/ui/gfx/gl/gl_surface_egl.h @@ -33,15 +33,10 @@ class GLSurfaceEGL : public GLSurface { virtual ~GLSurfaceEGL(); static bool InitializeOneOff(); - EGLDisplay GetDisplay(); - EGLConfig GetConfig(); - static EGLDisplay GetHardwareDisplay(); - static EGLDisplay GetSoftwareDisplay(); + static EGLDisplay GetDisplay(); + static EGLConfig GetConfig(); static EGLNativeDisplayType GetNativeDisplay(); -protected: - bool software_; - private: DISALLOW_COPY_AND_ASSIGN(GLSurfaceEGL); }; @@ -49,8 +44,7 @@ protected: // Encapsulates an EGL surface bound to a view. class NativeViewGLSurfaceEGL : public GLSurfaceEGL { public: - explicit NativeViewGLSurfaceEGL(bool software, - gfx::PluginWindowHandle window); + explicit NativeViewGLSurfaceEGL(gfx::PluginWindowHandle window); virtual ~NativeViewGLSurfaceEGL(); // Implement GLSurface. @@ -71,7 +65,7 @@ class NativeViewGLSurfaceEGL : public GLSurfaceEGL { // Encapsulates a pbuffer EGL surface. class PbufferGLSurfaceEGL : public GLSurfaceEGL { public: - explicit PbufferGLSurfaceEGL(bool software, const gfx::Size& size); + explicit PbufferGLSurfaceEGL(const gfx::Size& size); virtual ~PbufferGLSurfaceEGL(); // Implement GLSurface. diff --git a/ui/gfx/gl/gl_surface_linux.cc b/ui/gfx/gl/gl_surface_linux.cc index 968ca618..fe96989 100644 --- a/ui/gfx/gl/gl_surface_linux.cc +++ b/ui/gfx/gl/gl_surface_linux.cc @@ -244,11 +244,7 @@ bool NativeViewGLSurfaceOSMesa::UpdateSize() { } scoped_refptr<GLSurface> GLSurface::CreateViewGLSurface( - bool software, gfx::PluginWindowHandle window) { - if (software) - return NULL; - switch (GetGLImplementation()) { case kGLImplementationOSMesaGL: { scoped_refptr<GLSurface> surface( @@ -260,7 +256,7 @@ scoped_refptr<GLSurface> GLSurface::CreateViewGLSurface( } case kGLImplementationEGLGLES2: { scoped_refptr<GLSurface> surface(new NativeViewGLSurfaceEGL( - false, window)); + window)); if (!surface->Initialize()) return NULL; @@ -283,11 +279,7 @@ scoped_refptr<GLSurface> GLSurface::CreateViewGLSurface( } scoped_refptr<GLSurface> GLSurface::CreateOffscreenGLSurface( - bool software, const gfx::Size& size) { - if (software) - return NULL; - switch (GetGLImplementation()) { case kGLImplementationOSMesaGL: { scoped_refptr<GLSurface> surface(new GLSurfaceOSMesa(OSMESA_RGBA, @@ -298,7 +290,7 @@ scoped_refptr<GLSurface> GLSurface::CreateOffscreenGLSurface( return surface; } case kGLImplementationEGLGLES2: { - scoped_refptr<GLSurface> surface(new PbufferGLSurfaceEGL(false, size)); + scoped_refptr<GLSurface> surface(new PbufferGLSurfaceEGL(size)); if (!surface->Initialize()) return NULL; diff --git a/ui/gfx/gl/gl_surface_mac.cc b/ui/gfx/gl/gl_surface_mac.cc index 440db41..2367679 100644 --- a/ui/gfx/gl/gl_surface_mac.cc +++ b/ui/gfx/gl/gl_surface_mac.cc @@ -79,11 +79,7 @@ scoped_refptr<GLSurface> GLSurface::CreateViewGLSurface( #endif scoped_refptr<GLSurface> GLSurface::CreateOffscreenGLSurface( - bool software, const gfx::Size& size) { - if (software) - return NULL; - switch (GetGLImplementation()) { case kGLImplementationOSMesaGL: { scoped_refptr<GLSurface> surface(new GLSurfaceOSMesa(OSMESA_RGBA, diff --git a/ui/gfx/gl/gl_surface_win.cc b/ui/gfx/gl/gl_surface_win.cc index 77810af..6b3ea8c 100644 --- a/ui/gfx/gl/gl_surface_win.cc +++ b/ui/gfx/gl/gl_surface_win.cc @@ -168,7 +168,6 @@ void NativeViewGLSurfaceOSMesa::UpdateSize() { } scoped_refptr<GLSurface> GLSurface::CreateViewGLSurface( - bool software, gfx::PluginWindowHandle window) { switch (GetGLImplementation()) { case kGLImplementationOSMesaGL: { @@ -180,7 +179,7 @@ scoped_refptr<GLSurface> GLSurface::CreateViewGLSurface( return surface; } case kGLImplementationEGLGLES2: { - scoped_refptr<GLSurface> surface(new NativeViewGLSurfaceEGL(software, + scoped_refptr<GLSurface> surface(new NativeViewGLSurfaceEGL( window)); if (!surface->Initialize()) return NULL; @@ -188,8 +187,6 @@ scoped_refptr<GLSurface> GLSurface::CreateViewGLSurface( return surface; } case kGLImplementationDesktopGL: { - if (software) - return NULL; scoped_refptr<GLSurface> surface(new NativeViewGLSurfaceWGL( window)); if (!surface->Initialize()) @@ -206,7 +203,6 @@ scoped_refptr<GLSurface> GLSurface::CreateViewGLSurface( } scoped_refptr<GLSurface> GLSurface::CreateOffscreenGLSurface( - bool software, const gfx::Size& size) { switch (GetGLImplementation()) { case kGLImplementationOSMesaGL: { @@ -218,15 +214,13 @@ scoped_refptr<GLSurface> GLSurface::CreateOffscreenGLSurface( return surface; } case kGLImplementationEGLGLES2: { - scoped_refptr<GLSurface> surface(new PbufferGLSurfaceEGL(software, size)); + scoped_refptr<GLSurface> surface(new PbufferGLSurfaceEGL(size)); if (!surface->Initialize()) return NULL; return surface; } case kGLImplementationDesktopGL: { - if (software) - return NULL; scoped_refptr<GLSurface> surface(new PbufferGLSurfaceWGL(size)); if (!surface->Initialize()) return NULL; diff --git a/ui/gfx/surface/accelerated_surface_linux.cc b/ui/gfx/surface/accelerated_surface_linux.cc index a74ac5c..9a42c68 100644 --- a/ui/gfx/surface/accelerated_surface_linux.cc +++ b/ui/gfx/surface/accelerated_surface_linux.cc @@ -14,7 +14,7 @@ AcceleratedSurface::AcceleratedSurface(const gfx::Size& size) : size_(size) { Display* dpy = gfx::GLSurfaceEGL::GetNativeDisplay(); - EGLDisplay edpy = gfx::GLSurfaceEGL::GetHardwareDisplay(); + EGLDisplay edpy = gfx::GLSurfaceEGL::GetDisplay(); XID window = XDefaultRootWindow(dpy); XWindowAttributes gwa; @@ -42,6 +42,6 @@ AcceleratedSurface::AcceleratedSurface(const gfx::Size& size) AcceleratedSurface::~AcceleratedSurface() { glDeleteTextures(1, &texture_); - eglDestroyImageKHR(gfx::GLSurfaceEGL::GetHardwareDisplay(), image_); + eglDestroyImageKHR(gfx::GLSurfaceEGL::GetDisplay(), image_); XFreePixmap(gfx::GLSurfaceEGL::GetNativeDisplay(), pixmap_); } diff --git a/ui/gfx/surface/accelerated_surface_mac.cc b/ui/gfx/surface/accelerated_surface_mac.cc index cbbee4b..e3e74cb 100644 --- a/ui/gfx/surface/accelerated_surface_mac.cc +++ b/ui/gfx/surface/accelerated_surface_mac.cc @@ -36,8 +36,7 @@ bool AcceleratedSurface::Initialize(gfx::GLContext* share_context, if (gfx::GetGLImplementation() != gfx::kGLImplementationDesktopGL) return false; - gl_surface_ = gfx::GLSurface::CreateOffscreenGLSurface( - false, gfx::Size(1, 1)); + gl_surface_ = gfx::GLSurface::CreateOffscreenGLSurface(gfx::Size(1, 1)); if (!gl_surface_.get()) { Destroy(); return false; diff --git a/webkit/gpu/webgraphicscontext3d_in_process_command_buffer_impl.cc b/webkit/gpu/webgraphicscontext3d_in_process_command_buffer_impl.cc index a45e78c..0b623cc 100644 --- a/webkit/gpu/webgraphicscontext3d_in_process_command_buffer_impl.cc +++ b/webkit/gpu/webgraphicscontext3d_in_process_command_buffer_impl.cc @@ -586,7 +586,6 @@ bool GLInProcessContext::Initialize(bool onscreen, } else { if (!gpu_scheduler_->Initialize(render_surface, gfx::Size(), - false, ::gpu::gles2::DisallowedExtensions(), allowed_extensions, attribs, @@ -598,7 +597,6 @@ bool GLInProcessContext::Initialize(bool onscreen, } else { if (!gpu_scheduler_->Initialize(render_surface, size, - false, ::gpu::gles2::DisallowedExtensions(), allowed_extensions, attribs, diff --git a/webkit/gpu/webgraphicscontext3d_in_process_impl.cc b/webkit/gpu/webgraphicscontext3d_in_process_impl.cc index cc6f69a..e7d5757 100644 --- a/webkit/gpu/webgraphicscontext3d_in_process_impl.cc +++ b/webkit/gpu/webgraphicscontext3d_in_process_impl.cc @@ -135,8 +135,7 @@ bool WebGraphicsContext3DInProcessImpl::initialize( // and from there to the window, and WebViewImpl::paint already // correctly handles the case where the compositor is active but // the output needs to go to a WebCanvas. - gl_surface_ = gfx::GLSurface::CreateOffscreenGLSurface(false, - gfx::Size(1, 1)); + gl_surface_ = gfx::GLSurface::CreateOffscreenGLSurface(gfx::Size(1, 1)); if (!gl_surface_.get()) { if (!is_gles2_) return false; @@ -150,8 +149,7 @@ bool WebGraphicsContext3DInProcessImpl::initialize( // necessary. webView->mainFrame()->collectGarbage(); - gl_surface_ = gfx::GLSurface::CreateOffscreenGLSurface(false, - gfx::Size(1, 1)); + gl_surface_ = gfx::GLSurface::CreateOffscreenGLSurface(gfx::Size(1, 1)); if (!gl_surface_.get()) return false; } |