diff options
-rw-r--r-- | build/common.gypi | 5 | ||||
-rwxr-xr-x | chrome/chrome.gyp | 8 | ||||
-rwxr-xr-x | chrome/chrome_renderer.gypi | 10 | ||||
-rw-r--r-- | chrome/plugin/command_buffer_stub.cc | 8 | ||||
-rw-r--r-- | chrome/plugin/command_buffer_stub.h | 4 | ||||
-rw-r--r-- | chrome/renderer/command_buffer_proxy.cc | 10 | ||||
-rw-r--r-- | gpu/command_buffer/service/gles2_cmd_decoder.cc | 7 | ||||
-rw-r--r-- | gpu/command_buffer/service/gles2_cmd_decoder.h | 8 | ||||
-rw-r--r-- | gpu/command_buffer/service/gpu_processor.cc | 21 | ||||
-rw-r--r-- | gpu/command_buffer/service/gpu_processor_linux.cc | 50 | ||||
-rw-r--r-- | gpu/command_buffer/service/gpu_processor_win.cc | 19 | ||||
-rw-r--r-- | gpu/gpu.gyp | 4 | ||||
-rw-r--r-- | gpu/gpu_plugin/gpu_plugin.cc | 9 | ||||
-rw-r--r-- | third_party/glew/src/glew.c | 4 | ||||
-rw-r--r-- | webkit/webkit.gyp | 8 |
15 files changed, 49 insertions, 126 deletions
diff --git a/build/common.gypi b/build/common.gypi index c3181b3..b05588b 100644 --- a/build/common.gypi +++ b/build/common.gypi @@ -148,6 +148,9 @@ # Whether to add the experimental build define. 'chrome_frame_define%': 0, + # Whether GPU plugin build is enabled. + 'enable_gpu%': 0, + # Whether usage of OpenMAX is enabled. 'enable_openmax%': 0, @@ -346,7 +349,7 @@ }], ], }], - ['OS=="win" or (OS=="linux" and target_arch!="arm")', { + ['OS=="win"', { 'defines': [ 'ENABLE_GPU=1', ], diff --git a/chrome/chrome.gyp b/chrome/chrome.gyp index ffd1ed9..d1ab06c 100755 --- a/chrome/chrome.gyp +++ b/chrome/chrome.gyp @@ -450,6 +450,9 @@ # end up using this module as well. 'conditions': [ ['OS=="win"', { + 'dependencies': [ + '../gpu/gpu.gyp:command_buffer_service', + ], 'defines': [ '__STD_C', '_CRT_SECURE_NO_DEPRECATE', @@ -458,11 +461,6 @@ 'include_dirs': [ 'third_party/wtl/include', ], - }], - ['OS=="win" or (OS=="linux" and target_arch!="arm")', { - 'dependencies': [ - '../gpu/gpu.gyp:command_buffer_service', - ], 'sources': [ 'plugin/command_buffer_stub.cc', 'plugin/command_buffer_stub.h', diff --git a/chrome/chrome_renderer.gypi b/chrome/chrome_renderer.gypi index 40a066a..d9cc809 100755 --- a/chrome/chrome_renderer.gypi +++ b/chrome/chrome_renderer.gypi @@ -165,6 +165,10 @@ 'include_dirs': [ 'third_party/wtl/include', ], + 'sources': [ + 'renderer/command_buffer_proxy.cc', + 'renderer/command_buffer_proxy.h', + ], 'conditions': [ ['win_use_allocator_shim==1', { 'dependencies': [ @@ -176,12 +180,6 @@ }], ], }], - ['OS=="win" or (OS=="linux" and target_arch!="arm")', { - 'sources': [ - 'renderer/command_buffer_proxy.cc', - 'renderer/command_buffer_proxy.h', - ], - }], ], }, ], diff --git a/chrome/plugin/command_buffer_stub.cc b/chrome/plugin/command_buffer_stub.cc index 4a9dd5c..d7dbf9f 100644 --- a/chrome/plugin/command_buffer_stub.cc +++ b/chrome/plugin/command_buffer_stub.cc @@ -11,9 +11,9 @@ using gpu::Buffer; CommandBufferStub::CommandBufferStub(PluginChannel* channel, - gfx::PluginWindowHandle window) + gfx::NativeView view) : channel_(channel), - window_(window) { + view_(view) { route_id_ = channel->GenerateRouteID(); channel->AddRoute(route_id_, this, false); } @@ -54,7 +54,7 @@ void CommandBufferStub::OnInitialize(int32 size, Buffer buffer = command_buffer_->GetRingBuffer(); if (buffer.shared_memory) { processor_ = new gpu::GPUProcessor(command_buffer_.get()); - if (processor_->Initialize(window_)) { + if (processor_->Initialize(view_)) { command_buffer_->SetPutOffsetChangeCallback( NewCallback(processor_.get(), &gpu::GPUProcessor::ProcessCommands)); @@ -93,7 +93,7 @@ void CommandBufferStub::OnGetTransferBuffer( int32 id, base::SharedMemoryHandle* transfer_buffer, size_t* size) { - *transfer_buffer = base::SharedMemoryHandle(); + *transfer_buffer = 0; *size = 0; // Assume service is responsible for duplicating the handle to the calling diff --git a/chrome/plugin/command_buffer_stub.h b/chrome/plugin/command_buffer_stub.h index 4608d0e..c7d765e 100644 --- a/chrome/plugin/command_buffer_stub.h +++ b/chrome/plugin/command_buffer_stub.h @@ -21,7 +21,7 @@ class CommandBufferService; class CommandBufferStub : public IPC::Channel::Listener, public IPC::Message::Sender { public: - CommandBufferStub(PluginChannel* channel, gfx::PluginWindowHandle window); + CommandBufferStub(PluginChannel* channel, gfx::NativeView view); virtual ~CommandBufferStub(); @@ -50,7 +50,7 @@ class CommandBufferStub : public IPC::Channel::Listener, void OnGetErrorStatus(bool* error_status); scoped_refptr<PluginChannel> channel_; - gfx::PluginWindowHandle window_; + gfx::NativeView view_; int route_id_; scoped_ptr<gpu::CommandBufferService> command_buffer_; scoped_refptr<gpu::GPUProcessor> processor_; diff --git a/chrome/renderer/command_buffer_proxy.cc b/chrome/renderer/command_buffer_proxy.cc index 3b68cc2..b78fa84 100644 --- a/chrome/renderer/command_buffer_proxy.cc +++ b/chrome/renderer/command_buffer_proxy.cc @@ -153,20 +153,12 @@ Buffer CommandBufferProxy::GetTransferBuffer(int32 id) { } // Cache the transfer buffer shared memory object client side. -#if defined(OS_WIN) - // TODO(piman): Does Windows needs this version of the constructor ? It - // duplicates the handle, but I'm not sure why it is necessary - it was - // already duped by the CommandBufferStub. base::SharedMemory* shared_memory = new base::SharedMemory(handle, false, base::GetCurrentProcessHandle()); -#else - base::SharedMemory* shared_memory = - new base::SharedMemory(handle, false); -#endif // Map the shared memory on demand. if (!shared_memory->memory()) { - if (!shared_memory->Map(size)) { + if (!shared_memory->Map(shared_memory->max_size())) { delete shared_memory; return Buffer(); } diff --git a/gpu/command_buffer/service/gles2_cmd_decoder.cc b/gpu/command_buffer/service/gles2_cmd_decoder.cc index 8b1fcf5..29d82f9 100644 --- a/gpu/command_buffer/service/gles2_cmd_decoder.cc +++ b/gpu/command_buffer/service/gles2_cmd_decoder.cc @@ -14,9 +14,6 @@ #include "gpu/command_buffer/service/cmd_buffer_engine.h" #include "gpu/command_buffer/service/gl_utils.h" #include "gpu/command_buffer/service/gles2_cmd_validation.h" -#if defined(OS_LINUX) -#include "gpu/command_buffer/service/x_utils.h" -#endif namespace gpu { namespace gles2 { @@ -985,6 +982,7 @@ parse_error::ParseError GLES2DecoderImpl::DoCommand( parse_error::ParseError result = parse_error::kParseNoError; if (debug()) { // TODO(gman): Change output to something useful for NaCl. + const char* f = GetCommandName(command); printf("cmd: %s\n", GetCommandName(command)); } unsigned int command_index = command - kStartPoint - 1; @@ -1219,7 +1217,7 @@ void GLES2DecoderImpl::UpdateProgramInfo(GLuint program) { program, ii, max_len + 1, &length, &size, &type, name_buffer.get()); // TODO(gman): Should we check for error? GLint location = glGetAttribLocation(program, name_buffer.get()); - info->SetAttributeLocation(ii, location); + info->SetAttributeLocation(ii, num_attribs); } } @@ -1759,3 +1757,4 @@ parse_error::ParseError GLES2DecoderImpl::HandleGetActiveAttrib( } // namespace gles2 } // namespace gpu + diff --git a/gpu/command_buffer/service/gles2_cmd_decoder.h b/gpu/command_buffer/service/gles2_cmd_decoder.h index 09d00f4..646fbcc 100644 --- a/gpu/command_buffer/service/gles2_cmd_decoder.h +++ b/gpu/command_buffer/service/gles2_cmd_decoder.h @@ -8,16 +8,14 @@ #define GPU_COMMAND_BUFFER_SERVICE_GLES2_CMD_DECODER_H_ #include <build/build_config.h> -#if defined(OS_WIN) +#if defined(OS_LINUX) +#include "gpu/command_buffer/service/x_utils.h" +#elif defined(OS_WIN) #include <windows.h> #endif #include "gpu/command_buffer/service/common_decoder.h" namespace gpu { -// Forward-declared instead of including x_utils.h, because including glx.h -// causes havok. -class XWindowWrapper; - namespace gles2 { // This class implements the AsyncAPIInterface interface, decoding GLES2 diff --git a/gpu/command_buffer/service/gpu_processor.cc b/gpu/command_buffer/service/gpu_processor.cc index c095341..0968215 100644 --- a/gpu/command_buffer/service/gpu_processor.cc +++ b/gpu/command_buffer/service/gpu_processor.cc @@ -9,25 +9,6 @@ using ::base::SharedMemory; namespace gpu { -GPUProcessor::GPUProcessor(CommandBuffer* command_buffer) - : command_buffer_(command_buffer), - commands_per_update_(100) { - DCHECK(command_buffer); - decoder_.reset(gles2::GLES2Decoder::Create()); - decoder_->set_engine(this); -} - -GPUProcessor::GPUProcessor(CommandBuffer* command_buffer, - gles2::GLES2Decoder* decoder, - CommandParser* parser, - int commands_per_update) - : command_buffer_(command_buffer), - commands_per_update_(commands_per_update) { - DCHECK(command_buffer); - decoder_.reset(decoder); - parser_.reset(parser); -} - GPUProcessor::~GPUProcessor() { } @@ -51,8 +32,6 @@ void GPUProcessor::ProcessCommands() { command_buffer_->SetParseError(parse_error); command_buffer_->RaiseErrorStatus(); return; - case gpu::parse_error::kParseNoError: - break; } ++commands_processed; diff --git a/gpu/command_buffer/service/gpu_processor_linux.cc b/gpu/command_buffer/service/gpu_processor_linux.cc deleted file mode 100644 index 205cceb..0000000 --- a/gpu/command_buffer/service/gpu_processor_linux.cc +++ /dev/null @@ -1,50 +0,0 @@ -// Copyright (c) 2009 The Chromium Authors. All rights reserved. -// Use of this source code is governed by a BSD-style license that can be -// found in the LICENSE file. - -#include <gdk/gdkx.h> -#include "gpu/command_buffer/service/gpu_processor.h" -#include "gpu/command_buffer/service/x_utils.h" - -using ::base::SharedMemory; - -namespace gpu { - -bool GPUProcessor::Initialize(gfx::PluginWindowHandle handle) { - DCHECK(handle); - - // Cannot reinitialize. - if (decoder_->window() != NULL) - return false; - - // Map the ring buffer and create the parser. - Buffer ring_buffer = command_buffer_->GetRingBuffer(); - if (ring_buffer.ptr) { - parser_.reset(new CommandParser(ring_buffer.ptr, - ring_buffer.size, - 0, - ring_buffer.size, - 0, - decoder_.get())); - } else { - parser_.reset(new CommandParser(NULL, 0, 0, 0, 0, - decoder_.get())); - } - - // Initialize GAPI immediately if the window handle is valid. - XWindowWrapper *window = new XWindowWrapper(GDK_DISPLAY(), handle); - decoder_->set_window_wrapper(window); - return decoder_->Initialize(); -} - -void GPUProcessor::Destroy() { - // Destroy GAPI if window handle has not already become invalid. - XWindowWrapper *window = decoder_->window(); - if (window) { - decoder_->Destroy(); - decoder_->set_window_wrapper(NULL); - delete window; - } -} - -} // namespace gpu diff --git a/gpu/command_buffer/service/gpu_processor_win.cc b/gpu/command_buffer/service/gpu_processor_win.cc index bef34d8..6a05845 100644 --- a/gpu/command_buffer/service/gpu_processor_win.cc +++ b/gpu/command_buffer/service/gpu_processor_win.cc @@ -10,6 +10,25 @@ using ::base::SharedMemory; namespace gpu { +GPUProcessor::GPUProcessor(CommandBuffer* command_buffer) + : command_buffer_(command_buffer), + commands_per_update_(100) { + DCHECK(command_buffer); + decoder_.reset(gles2::GLES2Decoder::Create()); + decoder_->set_engine(this); +} + +GPUProcessor::GPUProcessor(CommandBuffer* command_buffer, + gles2::GLES2Decoder* decoder, + CommandParser* parser, + int commands_per_update) + : command_buffer_(command_buffer), + commands_per_update_(commands_per_update) { + DCHECK(command_buffer); + decoder_.reset(decoder); + parser_.reset(parser); +} + bool GPUProcessor::Initialize(gfx::PluginWindowHandle handle) { DCHECK(handle); diff --git a/gpu/gpu.gyp b/gpu/gpu.gyp index ee00088..d056bea 100644 --- a/gpu/gpu.gyp +++ b/gpu/gpu.gyp @@ -250,13 +250,9 @@ ['OS == "linux"', { 'sources': [ - 'command_buffer/service/gpu_processor_linux.cc', 'command_buffer/service/x_utils.cc', 'command_buffer/service/x_utils.h', ], - 'dependencies': [ - '../build/linux/system.gyp:gtk', - ] }, ], ['OS == "win"', diff --git a/gpu/gpu_plugin/gpu_plugin.cc b/gpu/gpu_plugin/gpu_plugin.cc index dc69e61..10df734 100644 --- a/gpu/gpu_plugin/gpu_plugin.cc +++ b/gpu/gpu_plugin/gpu_plugin.cc @@ -38,13 +38,8 @@ int16 NPP_HandleEvent(NPP instance, void* event) { NPError NPP_GetValue(NPP instance, NPPVariable variable, void *value) { if (!instance) return NPERR_INVALID_INSTANCE_ERROR; - switch (variable) { - case NPPVpluginNeedsXEmbed: - *static_cast<NPBool *>(value) = 1; - return NPERR_NO_ERROR; - default: - return NPERR_INVALID_PARAM; - } + + return NPERR_GENERIC_ERROR; } NPError NPP_SetValue(NPP instance, NPNVariable variable, void *value) { diff --git a/third_party/glew/src/glew.c b/third_party/glew/src/glew.c index fb67781..17d2565 100644 --- a/third_party/glew/src/glew.c +++ b/third_party/glew/src/glew.c @@ -9557,7 +9557,7 @@ GLboolean glxewGetExtension (const char* name) /* if (glXQueryExtensionsString == NULL || glXGetCurrentDisplay == NULL) return GL_FALSE; */ /* p = (GLubyte*)glXQueryExtensionsString(glXGetCurrentDisplay(), DefaultScreen(glXGetCurrentDisplay())); */ if (__glewXGetClientString == NULL) { - __glewXGetClientString = (PFNGLXGETCLIENTSTRINGPROC) glewGetProcAddress((const GLubyte *)"glXGetClientString"); + __glewXGetClientString = (PFNGLXGETCLIENTSTRINGPROC) glewGetProcAddress("glXGetClientString"); } if (__glewXGetClientString == NULL) return GL_FALSE; if (glXGetCurrentDisplay == NULL) return GL_FALSE; @@ -9580,7 +9580,7 @@ GLenum glxewContextInit (GLXEW_CONTEXT_ARG_DEF_LIST) int major, minor; static PFNGLXQUERYVERSIONPROC __glewXQueryVersion = NULL; if (__glewXQueryVersion == NULL) { - __glewXQueryVersion = (PFNGLXQUERYVERSIONPROC) glewGetProcAddress((const GLubyte *)"glXQueryVersion"); + __glewXQueryVersion = (PFNGLXQUERYVERSIONPROC) glewGetProcAddress("glXQueryVersion"); } if (__glewXQueryVersion == NULL) return GL_FALSE; /* initialize core GLX 1.2 */ diff --git a/webkit/webkit.gyp b/webkit/webkit.gyp index c95ad3a..cf0ff34 100644 --- a/webkit/webkit.gyp +++ b/webkit/webkit.gyp @@ -428,12 +428,7 @@ ['exclude', r'/gtk_']], }], ['OS!="mac"', { - 'sources/': [['exclude', '_mac\\.(cc|mm)$']], - }], - ['OS=="win" or (OS=="linux" and target_arch!="arm")', { - 'dependencies': [ - '../gpu/gpu.gyp:gpu_plugin', - ], + 'sources/': [['exclude', '_mac\\.(cc|mm)$']] }], ['OS!="win"', { 'sources/': [['exclude', '_win\\.cc$']], @@ -451,6 +446,7 @@ ], 'dependencies': [ '../build/win/system.gyp:cygwin', + '../gpu/gpu.gyp:gpu_plugin', 'default_plugin/default_plugin.gyp:default_plugin', ], 'sources!': [ |