Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(56)

Side by Side Diff: webkit/gpu/webgraphicscontext3d_in_process_command_buffer_impl.cc

Issue 7458010: Revert 93066 - Execute all GL commands up to the put offset reported by a each flush.This means g... (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src/
Patch Set: '' Created 9 years, 5 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch | Annotate | Revision Log
« no previous file with comments | « ppapi/proxy/ppb_context_3d_proxy.cc ('k') | no next file » | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 // Copyright (c) 2011 The Chromium Authors. All rights reserved. 1 // Copyright (c) 2011 The Chromium Authors. All rights reserved.
2 // Use of this source code is governed by a BSD-style license that can be 2 // Use of this source code is governed by a BSD-style license that can be
3 // found in the LICENSE file. 3 // found in the LICENSE file.
4 4
5 #if defined(ENABLE_GPU) 5 #if defined(ENABLE_GPU)
6 6
7 #include "webkit/gpu/webgraphicscontext3d_in_process_command_buffer_impl.h" 7 #include "webkit/gpu/webgraphicscontext3d_in_process_command_buffer_impl.h"
8 8
9 #include <GLES2/gl2.h> 9 #include <GLES2/gl2.h>
10 #ifndef GL_GLEXT_PROTOTYPES 10 #ifndef GL_GLEXT_PROTOTYPES
(...skipping 60 matching lines...) Expand 10 before | Expand all | Expand 10 after
71 // Initialize the library. This must have completed before any other 71 // Initialize the library. This must have completed before any other
72 // functions are invoked. 72 // functions are invoked.
73 static bool Initialize(); 73 static bool Initialize();
74 74
75 // Terminate the library. This must be called after any other functions 75 // Terminate the library. This must be called after any other functions
76 // have completed. 76 // have completed.
77 static bool Terminate(); 77 static bool Terminate();
78 78
79 ~GLInProcessContext(); 79 ~GLInProcessContext();
80 80
81 void PumpCommands(); 81 void PumpCommands(bool sync);
82 82
83 // Create a GLInProcessContext that renders directly to a view. The view and 83 // Create a GLInProcessContext that renders directly to a view. The view and
84 // the associated window must not be destroyed until the returned 84 // the associated window must not be destroyed until the returned
85 // GLInProcessContext has been destroyed, otherwise the GPU process might 85 // GLInProcessContext has been destroyed, otherwise the GPU process might
86 // attempt to render to an invalid window handle. 86 // attempt to render to an invalid window handle.
87 // 87 //
88 // NOTE: on Mac OS X, this entry point is only used to set up the 88 // NOTE: on Mac OS X, this entry point is only used to set up the
89 // accelerated compositor's output. On this platform, we actually pass 89 // accelerated compositor's output. On this platform, we actually pass
90 // a gfx::PluginWindowHandle in place of the gfx::NativeViewId, 90 // a gfx::PluginWindowHandle in place of the gfx::NativeViewId,
91 // because the facility to allocate a fake PluginWindowHandle is 91 // because the facility to allocate a fake PluginWindowHandle is
(...skipping 285 matching lines...) Expand 10 before | Expand all | Expand 10 after
377 void GLInProcessContext::ResizeOffscreen(const gfx::Size& size) { 377 void GLInProcessContext::ResizeOffscreen(const gfx::Size& size) {
378 DCHECK(size.width() > 0 && size.height() > 0); 378 DCHECK(size.width() > 0 && size.height() > 0);
379 if (size_ != size) { 379 if (size_ != size) {
380 gpu_scheduler_->ResizeOffscreenFrameBuffer(size); 380 gpu_scheduler_->ResizeOffscreenFrameBuffer(size);
381 // TODO(gman): See if the next line is needed. 381 // TODO(gman): See if the next line is needed.
382 gles2_implementation_->ResizeCHROMIUM(size.width(), size.height()); 382 gles2_implementation_->ResizeCHROMIUM(size.width(), size.height());
383 size_ = size; 383 size_ = size;
384 } 384 }
385 } 385 }
386 386
387 void GLInProcessContext::PumpCommands() { 387 void GLInProcessContext::PumpCommands(bool /* sync */) {
388 ::gpu::CommandBuffer::State state; 388 ::gpu::CommandBuffer::State state;
389 do { 389 do {
390 gpu_scheduler_->PutChanged(); 390 gpu_scheduler_->PutChanged(true);
391 MessageLoop::current()->RunAllPending(); 391 MessageLoop::current()->RunAllPending();
392 state = command_buffer_->GetState(); 392 state = command_buffer_->GetState();
393 } while (state.get_offset != state.put_offset); 393 } while (state.get_offset != state.put_offset);
394 } 394 }
395 395
396 uint32 GLInProcessContext::GetParentTextureId() { 396 uint32 GLInProcessContext::GetParentTextureId() {
397 return parent_texture_id_; 397 return parent_texture_id_;
398 } 398 }
399 399
400 uint32 GLInProcessContext::CreateParentTexture(const gfx::Size& size) { 400 uint32 GLInProcessContext::CreateParentTexture(const gfx::Size& size) {
(...skipping 169 matching lines...) Expand 10 before | Expand all | Expand 10 after
570 attribs.push_back(NONE); 570 attribs.push_back(NONE);
571 attrib_list = NULL; 571 attrib_list = NULL;
572 break; 572 break;
573 } 573 }
574 } 574 }
575 575
576 command_buffer_.reset(new CommandBufferService); 576 command_buffer_.reset(new CommandBufferService);
577 if (!command_buffer_->Initialize(kCommandBufferSize)) 577 if (!command_buffer_->Initialize(kCommandBufferSize))
578 return false; 578 return false;
579 579
580 gpu_scheduler_ = GpuScheduler::Create(command_buffer_.get(), 580 gpu_scheduler_ = new GpuScheduler(command_buffer_.get(), NULL, NULL);
581 NULL,
582 NULL);
583 581
584 if (onscreen) { 582 if (onscreen) {
585 if (render_surface == gfx::kNullPluginWindow) { 583 if (render_surface == gfx::kNullPluginWindow) {
586 LOG(ERROR) << "Invalid surface handle for onscreen context."; 584 LOG(ERROR) << "Invalid surface handle for onscreen context.";
587 command_buffer_.reset(); 585 command_buffer_.reset();
588 } else { 586 } else {
589 if (!gpu_scheduler_->Initialize(render_surface, 587 if (!gpu_scheduler_->Initialize(render_surface,
590 gfx::Size(), 588 gfx::Size(),
591 ::gpu::gles2::DisallowedExtensions(), 589 ::gpu::gles2::DisallowedExtensions(),
592 allowed_extensions, 590 allowed_extensions,
(...skipping 478 matching lines...) Expand 10 before | Expand all | Expand 10 after
1071 if (!context_->GetChildToParentLatch(latch_id)) { 1069 if (!context_->GetChildToParentLatch(latch_id)) {
1072 LOG(ERROR) << "getLatch must only be called on child context"; 1070 LOG(ERROR) << "getLatch must only be called on child context";
1073 synthesizeGLError(GL_INVALID_OPERATION); 1071 synthesizeGLError(GL_INVALID_OPERATION);
1074 *latch_id = ::gpu::kInvalidLatchId; 1072 *latch_id = ::gpu::kInvalidLatchId;
1075 } 1073 }
1076 } 1074 }
1077 1075
1078 void WebGraphicsContext3DInProcessCommandBufferImpl::waitLatchCHROMIUM( 1076 void WebGraphicsContext3DInProcessCommandBufferImpl::waitLatchCHROMIUM(
1079 WGC3Duint latch_id) 1077 WGC3Duint latch_id)
1080 { 1078 {
1079 // TODO(gmam): See if we can comment this in.
1080 // ClearContext();
1081 gl_->WaitLatchCHROMIUM(latch_id);
1081 } 1082 }
1082 1083
1083 void WebGraphicsContext3DInProcessCommandBufferImpl::setLatchCHROMIUM( 1084 void WebGraphicsContext3DInProcessCommandBufferImpl::setLatchCHROMIUM(
1084 WGC3Duint latch_id) 1085 WGC3Duint latch_id)
1085 { 1086 {
1087 // TODO(gmam): See if we can comment this in.
1088 // ClearContext();
1089 gl_->SetLatchCHROMIUM(latch_id);
1090 // required to ensure set command is sent to GPU process
1091 gl_->Flush();
1086 } 1092 }
1087 1093
1088 void WebGraphicsContext3DInProcessCommandBufferImpl:: 1094 void WebGraphicsContext3DInProcessCommandBufferImpl::
1089 rateLimitOffscreenContextCHROMIUM() { 1095 rateLimitOffscreenContextCHROMIUM() {
1090 // TODO(gmam): See if we can comment this in. 1096 // TODO(gmam): See if we can comment this in.
1091 // ClearContext(); 1097 // ClearContext();
1092 gl_->RateLimitOffscreenContextCHROMIUM(); 1098 gl_->RateLimitOffscreenContextCHROMIUM();
1093 } 1099 }
1094 1100
1095 WebKit::WebString WebGraphicsContext3DInProcessCommandBufferImpl:: 1101 WebKit::WebString WebGraphicsContext3DInProcessCommandBufferImpl::
(...skipping 703 matching lines...) Expand 10 before | Expand all | Expand 10 after
1799 if (context_lost_callback_) { 1805 if (context_lost_callback_) {
1800 context_lost_callback_->onContextLost(); 1806 context_lost_callback_->onContextLost();
1801 } 1807 }
1802 } 1808 }
1803 1809
1804 } // namespace gpu 1810 } // namespace gpu
1805 } // namespace webkit 1811 } // namespace webkit
1806 1812
1807 #endif // defined(ENABLE_GPU) 1813 #endif // defined(ENABLE_GPU)
1808 1814
OLDNEW
« no previous file with comments | « ppapi/proxy/ppb_context_3d_proxy.cc ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698