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

Side by Side Diff: gpu/command_buffer/client/gl_in_process_context.cc

Issue 23234003: Support stream textures with the synchronous compositor (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: this time for real Created 7 years, 4 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
OLDNEW
1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. 1 // Copyright (c) 2012 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 #include "gpu/command_buffer/client/gl_in_process_context.h" 5 #include "gpu/command_buffer/client/gl_in_process_context.h"
6 6
7 #include <set> 7 #include <set>
8 #include <utility> 8 #include <utility>
9 #include <vector> 9 #include <vector>
10 10
(...skipping 14 matching lines...) Expand all
25 #include "gpu/command_buffer/client/gles2_implementation.h" 25 #include "gpu/command_buffer/client/gles2_implementation.h"
26 #include "gpu/command_buffer/client/gpu_memory_buffer_factory.h" 26 #include "gpu/command_buffer/client/gpu_memory_buffer_factory.h"
27 #include "gpu/command_buffer/client/image_factory.h" 27 #include "gpu/command_buffer/client/image_factory.h"
28 #include "gpu/command_buffer/client/transfer_buffer.h" 28 #include "gpu/command_buffer/client/transfer_buffer.h"
29 #include "gpu/command_buffer/common/command_buffer.h" 29 #include "gpu/command_buffer/common/command_buffer.h"
30 #include "gpu/command_buffer/common/constants.h" 30 #include "gpu/command_buffer/common/constants.h"
31 #include "gpu/command_buffer/service/in_process_command_buffer.h" 31 #include "gpu/command_buffer/service/in_process_command_buffer.h"
32 #include "ui/gfx/size.h" 32 #include "ui/gfx/size.h"
33 #include "ui/gl/gl_image.h" 33 #include "ui/gl/gl_image.h"
34 34
35 #if defined(OS_ANDROID)
36 #include "ui/gl/android/surface_texture_bridge.h"
37 #endif
38
35 namespace gpu { 39 namespace gpu {
36 40
37 namespace { 41 namespace {
38 42
39 const int32 kCommandBufferSize = 1024 * 1024; 43 const int32 kCommandBufferSize = 1024 * 1024;
40 // TODO(kbr): make the transfer buffer size configurable via context 44 // TODO(kbr): make the transfer buffer size configurable via context
41 // creation attributes. 45 // creation attributes.
42 const size_t kStartTransferBufferSize = 4 * 1024 * 1024; 46 const size_t kStartTransferBufferSize = 4 * 1024 * 1024;
43 const size_t kMinTransferBufferSize = 1 * 256 * 1024; 47 const size_t kMinTransferBufferSize = 1 * 256 * 1024;
44 const size_t kMaxTransferBufferSize = 16 * 1024 * 1024; 48 const size_t kMaxTransferBufferSize = 16 * 1024 * 1024;
(...skipping 24 matching lines...) Expand all
69 virtual void SignalQuery(unsigned query, const base::Closure& callback) 73 virtual void SignalQuery(unsigned query, const base::Closure& callback)
70 OVERRIDE; 74 OVERRIDE;
71 virtual gles2::GLES2Implementation* GetImplementation() OVERRIDE; 75 virtual gles2::GLES2Implementation* GetImplementation() OVERRIDE;
72 76
73 // ImageFactory implementation: 77 // ImageFactory implementation:
74 virtual scoped_ptr<gfx::GpuMemoryBuffer> CreateGpuMemoryBuffer( 78 virtual scoped_ptr<gfx::GpuMemoryBuffer> CreateGpuMemoryBuffer(
75 int width, int height, GLenum internalformat, 79 int width, int height, GLenum internalformat,
76 unsigned* image_id) OVERRIDE; 80 unsigned* image_id) OVERRIDE;
77 virtual void DeleteGpuMemoryBuffer(unsigned image_id) OVERRIDE; 81 virtual void DeleteGpuMemoryBuffer(unsigned image_id) OVERRIDE;
78 82
83 #if defined(OS_ANDROID)
84 virtual scoped_refptr<gfx::SurfaceTextureBridge> GetSurfaceTexture(
85 uint32 stream_id) OVERRIDE;
86 #endif
87
79 private: 88 private:
80 void Destroy(); 89 void Destroy();
81 void PollQueryCallbacks(); 90 void PollQueryCallbacks();
82 void CallQueryCallback(size_t index); 91 void CallQueryCallback(size_t index);
83 void OnContextLost(); 92 void OnContextLost();
84 void OnSignalSyncPoint(const base::Closure& callback); 93 void OnSignalSyncPoint(const base::Closure& callback);
85 94
86 scoped_ptr<gles2::GLES2CmdHelper> gles2_helper_; 95 scoped_ptr<gles2::GLES2CmdHelper> gles2_helper_;
87 scoped_ptr<TransferBuffer> transfer_buffer_; 96 scoped_ptr<TransferBuffer> transfer_buffer_;
88 scoped_ptr<gles2::GLES2Implementation> gles2_implementation_; 97 scoped_ptr<gles2::GLES2Implementation> gles2_implementation_;
(...skipping 265 matching lines...) Expand 10 before | Expand all | Expand 10 after
354 void GLInProcessContextImpl::SignalQuery( 363 void GLInProcessContextImpl::SignalQuery(
355 unsigned query, 364 unsigned query,
356 const base::Closure& callback) { 365 const base::Closure& callback) {
357 query_callbacks_.push_back(std::make_pair(query, callback)); 366 query_callbacks_.push_back(std::make_pair(query, callback));
358 // If size > 1, there is already a poll callback pending. 367 // If size > 1, there is already a poll callback pending.
359 if (query_callbacks_.size() == 1) { 368 if (query_callbacks_.size() == 1) {
360 PollQueryCallbacks(); 369 PollQueryCallbacks();
361 } 370 }
362 } 371 }
363 372
373 #if defined(OS_ANDROID)
374 scoped_refptr<gfx::SurfaceTextureBridge>
375 GLInProcessContextImpl::GetSurfaceTexture(uint32 stream_id) {
376 return command_buffer_->GetSurfaceTexture(stream_id);
377 }
378 #endif
379
364 } // anonymous namespace 380 } // anonymous namespace
365 381
366 GLInProcessContextAttribs::GLInProcessContextAttribs() 382 GLInProcessContextAttribs::GLInProcessContextAttribs()
367 : alpha_size(-1), 383 : alpha_size(-1),
368 blue_size(-1), 384 blue_size(-1),
369 green_size(-1), 385 green_size(-1),
370 red_size(-1), 386 red_size(-1),
371 depth_size(-1), 387 depth_size(-1),
372 stencil_size(-1), 388 stencil_size(-1),
373 samples(-1), 389 samples(-1),
(...skipping 48 matching lines...) Expand 10 before | Expand all | Expand 10 after
422 } 438 }
423 439
424 // static 440 // static
425 void GLInProcessContext::SetGpuMemoryBufferFactory( 441 void GLInProcessContext::SetGpuMemoryBufferFactory(
426 GpuMemoryBufferFactory* factory) { 442 GpuMemoryBufferFactory* factory) {
427 DCHECK_EQ(0u, SharedContextCount()); 443 DCHECK_EQ(0u, SharedContextCount());
428 g_gpu_memory_buffer_factory = factory; 444 g_gpu_memory_buffer_factory = factory;
429 } 445 }
430 446
431 } // namespace gpu 447 } // namespace gpu
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698