summaryrefslogtreecommitdiffstats
path: root/gpu/command_buffer/service/gpu_scheduler_linux.cc
diff options
context:
space:
mode:
authorapatrick@chromium.org <apatrick@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98>2011-04-14 23:16:22 +0000
committerapatrick@chromium.org <apatrick@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98>2011-04-14 23:16:22 +0000
commit09ddb91f6a81adebe023e461387c6510471e6778 (patch)
tree2abb8507621721af69610222aace5e7818885c08 /gpu/command_buffer/service/gpu_scheduler_linux.cc
parent6cf19311fbe08c5c8c674a50fd834ae818b549c0 (diff)
downloadchromium_src-09ddb91f6a81adebe023e461387c6510471e6778.zip
chromium_src-09ddb91f6a81adebe023e461387c6510471e6778.tar.gz
chromium_src-09ddb91f6a81adebe023e461387c6510471e6778.tar.bz2
Landing issue 6828049 on behalf of KushalP.
http://codereview.chromium.org/6826049/ Original message: Renaming GPUProcessor to GpuScheduler TEST=try BUG=76585 Review URL: http://codereview.chromium.org/6853027 git-svn-id: svn://svn.chromium.org/chrome/trunk/src@81667 0039d316-1c4b-4281-b951-d872f2087c98
Diffstat (limited to 'gpu/command_buffer/service/gpu_scheduler_linux.cc')
-rw-r--r--gpu/command_buffer/service/gpu_scheduler_linux.cc67
1 files changed, 67 insertions, 0 deletions
diff --git a/gpu/command_buffer/service/gpu_scheduler_linux.cc b/gpu/command_buffer/service/gpu_scheduler_linux.cc
new file mode 100644
index 0000000..48ed470
--- /dev/null
+++ b/gpu/command_buffer/service/gpu_scheduler_linux.cc
@@ -0,0 +1,67 @@
+// Copyright (c) 2011 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 "gpu/command_buffer/service/gpu_scheduler.h"
+#include "ui/gfx/gl/gl_context.h"
+
+using ::base::SharedMemory;
+
+namespace gpu {
+
+bool GpuScheduler::Initialize(
+ gfx::PluginWindowHandle window,
+ const gfx::Size& size,
+ const gles2::DisallowedExtensions& disallowed_extensions,
+ const char* allowed_extensions,
+ const std::vector<int32>& attribs,
+ GpuScheduler* parent,
+ uint32 parent_texture_id) {
+ // Get the parent decoder and the GLContext to share IDs with, if any.
+ gles2::GLES2Decoder* parent_decoder = NULL;
+ gfx::GLContext* parent_context = NULL;
+ void* parent_handle = NULL;
+ if (parent) {
+ parent_decoder = parent->decoder_.get();
+ DCHECK(parent_decoder);
+
+ parent_context = parent_decoder->GetGLContext();
+ DCHECK(parent_context);
+ }
+
+ // Create either a view or pbuffer based GLContext.
+ scoped_ptr<gfx::GLContext> context;
+ if (window) {
+ DCHECK(!parent_handle);
+
+ // TODO(apatrick): support multisampling.
+ context.reset(gfx::GLContext::CreateViewGLContext(window, false));
+ } else {
+ context.reset(gfx::GLContext::CreateOffscreenGLContext(parent_context));
+ }
+
+ if (!context.get()) {
+ LOG(ERROR) << "GpuScheduler::Initialize failed";
+ return false;
+ }
+
+ return InitializeCommon(context.release(),
+ size,
+ disallowed_extensions,
+ allowed_extensions,
+ attribs,
+ parent_decoder,
+ parent_texture_id);
+}
+
+void GpuScheduler::Destroy() {
+ DestroyCommon();
+}
+
+void GpuScheduler::WillSwapBuffers() {
+ if (wrapped_swap_buffers_callback_.get()) {
+ wrapped_swap_buffers_callback_->Run();
+ }
+}
+
+} // namespace gpu