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

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: android clang 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 12 matching lines...) Expand all
23 #include "base/memory/weak_ptr.h" 23 #include "base/memory/weak_ptr.h"
24 #include "base/message_loop/message_loop.h" 24 #include "base/message_loop/message_loop.h"
25 #include "gpu/command_buffer/client/gles2_implementation.h" 25 #include "gpu/command_buffer/client/gles2_implementation.h"
26 #include "gpu/command_buffer/client/transfer_buffer.h" 26 #include "gpu/command_buffer/client/transfer_buffer.h"
27 #include "gpu/command_buffer/common/command_buffer.h" 27 #include "gpu/command_buffer/common/command_buffer.h"
28 #include "gpu/command_buffer/common/constants.h" 28 #include "gpu/command_buffer/common/constants.h"
29 #include "gpu/command_buffer/service/in_process_command_buffer.h" 29 #include "gpu/command_buffer/service/in_process_command_buffer.h"
30 #include "ui/gfx/size.h" 30 #include "ui/gfx/size.h"
31 #include "ui/gl/gl_image.h" 31 #include "ui/gl/gl_image.h"
32 32
33 #if defined(OS_ANDROID)
34 #include "ui/gl/android/surface_texture_bridge.h"
35 #endif
36
33 namespace gpu { 37 namespace gpu {
34 38
35 namespace { 39 namespace {
36 40
37 const int32 kCommandBufferSize = 1024 * 1024; 41 const int32 kCommandBufferSize = 1024 * 1024;
38 // TODO(kbr): make the transfer buffer size configurable via context 42 // TODO(kbr): make the transfer buffer size configurable via context
39 // creation attributes. 43 // creation attributes.
40 const size_t kStartTransferBufferSize = 4 * 1024 * 1024; 44 const size_t kStartTransferBufferSize = 4 * 1024 * 1024;
41 const size_t kMinTransferBufferSize = 1 * 256 * 1024; 45 const size_t kMinTransferBufferSize = 1 * 256 * 1024;
42 const size_t kMaxTransferBufferSize = 16 * 1024 * 1024; 46 const size_t kMaxTransferBufferSize = 16 * 1024 * 1024;
(...skipping 15 matching lines...) Expand all
58 gfx::GpuPreference gpu_preference); 62 gfx::GpuPreference gpu_preference);
59 63
60 // GLInProcessContext implementation: 64 // GLInProcessContext implementation:
61 virtual void SetContextLostCallback(const base::Closure& callback) OVERRIDE; 65 virtual void SetContextLostCallback(const base::Closure& callback) OVERRIDE;
62 virtual void SignalSyncPoint(unsigned sync_point, 66 virtual void SignalSyncPoint(unsigned sync_point,
63 const base::Closure& callback) OVERRIDE; 67 const base::Closure& callback) OVERRIDE;
64 virtual void SignalQuery(unsigned query, const base::Closure& callback) 68 virtual void SignalQuery(unsigned query, const base::Closure& callback)
65 OVERRIDE; 69 OVERRIDE;
66 virtual gles2::GLES2Implementation* GetImplementation() OVERRIDE; 70 virtual gles2::GLES2Implementation* GetImplementation() OVERRIDE;
67 71
72 #if defined(OS_ANDROID)
73 virtual scoped_refptr<gfx::SurfaceTextureBridge> GetSurfaceTexture(
74 uint32 stream_id) OVERRIDE;
75 #endif
76
68 private: 77 private:
69 void Destroy(); 78 void Destroy();
70 void PollQueryCallbacks(); 79 void PollQueryCallbacks();
71 void CallQueryCallback(size_t index); 80 void CallQueryCallback(size_t index);
72 void OnContextLost(); 81 void OnContextLost();
73 void OnSignalSyncPoint(const base::Closure& callback); 82 void OnSignalSyncPoint(const base::Closure& callback);
74 83
75 scoped_ptr<gles2::GLES2CmdHelper> gles2_helper_; 84 scoped_ptr<gles2::GLES2CmdHelper> gles2_helper_;
76 scoped_ptr<TransferBuffer> transfer_buffer_; 85 scoped_ptr<TransferBuffer> transfer_buffer_;
77 scoped_ptr<gles2::GLES2Implementation> gles2_implementation_; 86 scoped_ptr<gles2::GLES2Implementation> gles2_implementation_;
(...skipping 248 matching lines...) Expand 10 before | Expand all | Expand 10 after
326 void GLInProcessContextImpl::SignalQuery( 335 void GLInProcessContextImpl::SignalQuery(
327 unsigned query, 336 unsigned query,
328 const base::Closure& callback) { 337 const base::Closure& callback) {
329 query_callbacks_.push_back(std::make_pair(query, callback)); 338 query_callbacks_.push_back(std::make_pair(query, callback));
330 // If size > 1, there is already a poll callback pending. 339 // If size > 1, there is already a poll callback pending.
331 if (query_callbacks_.size() == 1) { 340 if (query_callbacks_.size() == 1) {
332 PollQueryCallbacks(); 341 PollQueryCallbacks();
333 } 342 }
334 } 343 }
335 344
345 #if defined(OS_ANDROID)
346 scoped_refptr<gfx::SurfaceTextureBridge>
347 GLInProcessContextImpl::GetSurfaceTexture(uint32 stream_id) {
348 return command_buffer_->GetSurfaceTexture(stream_id);
349 }
350 #endif
351
336 } // anonymous namespace 352 } // anonymous namespace
337 353
338 GLInProcessContextAttribs::GLInProcessContextAttribs() 354 GLInProcessContextAttribs::GLInProcessContextAttribs()
339 : alpha_size(-1), 355 : alpha_size(-1),
340 blue_size(-1), 356 blue_size(-1),
341 green_size(-1), 357 green_size(-1),
342 red_size(-1), 358 red_size(-1),
343 depth_size(-1), 359 depth_size(-1),
344 stencil_size(-1), 360 stencil_size(-1),
345 samples(-1), 361 samples(-1),
(...skipping 41 matching lines...) Expand 10 before | Expand all | Expand 10 after
387 surface->GetSize(), 403 surface->GetSize(),
388 allowed_extensions, 404 allowed_extensions,
389 attribs, 405 attribs,
390 gpu_preference)) 406 gpu_preference))
391 return NULL; 407 return NULL;
392 408
393 return context.release(); 409 return context.release();
394 } 410 }
395 411
396 } // namespace gpu 412 } // namespace gpu
OLDNEW
« no previous file with comments | « gpu/command_buffer/client/gl_in_process_context.h ('k') | gpu/command_buffer/service/in_process_command_buffer.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698