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: content/common/gpu/client/context_provider_command_buffer.cc

Issue 2107783003: Pass initial size and GPU preference via context attributes (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: gyp fix Created 4 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
OLDNEW
1 // Copyright (c) 2013 The Chromium Authors. All rights reserved. 1 // Copyright (c) 2013 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 "content/common/gpu/client/context_provider_command_buffer.h" 5 #include "content/common/gpu/client/context_provider_command_buffer.h"
6 6
7 #include <stddef.h> 7 #include <stddef.h>
8 8
9 #include <memory> 9 #include <memory>
10 #include <set> 10 #include <set>
(...skipping 41 matching lines...) Expand 10 before | Expand all | Expand 10 after
52 52
53 ContextProviderCommandBuffer::SharedProviders::SharedProviders() = default; 53 ContextProviderCommandBuffer::SharedProviders::SharedProviders() = default;
54 ContextProviderCommandBuffer::SharedProviders::~SharedProviders() = default; 54 ContextProviderCommandBuffer::SharedProviders::~SharedProviders() = default;
55 55
56 ContextProviderCommandBuffer::ContextProviderCommandBuffer( 56 ContextProviderCommandBuffer::ContextProviderCommandBuffer(
57 scoped_refptr<gpu::GpuChannelHost> channel, 57 scoped_refptr<gpu::GpuChannelHost> channel,
58 int32_t stream_id, 58 int32_t stream_id,
59 gpu::GpuStreamPriority stream_priority, 59 gpu::GpuStreamPriority stream_priority,
60 gpu::SurfaceHandle surface_handle, 60 gpu::SurfaceHandle surface_handle,
61 const GURL& active_url, 61 const GURL& active_url,
62 gl::GpuPreference gpu_preference,
63 bool automatic_flushes, 62 bool automatic_flushes,
64 bool support_locking, 63 bool support_locking,
65 const gpu::SharedMemoryLimits& memory_limits, 64 const gpu::SharedMemoryLimits& memory_limits,
66 const gpu::gles2::ContextCreationAttribHelper& attributes, 65 const gpu::gles2::ContextCreationAttribHelper& attributes,
67 ContextProviderCommandBuffer* shared_context_provider, 66 ContextProviderCommandBuffer* shared_context_provider,
68 command_buffer_metrics::ContextType type) 67 command_buffer_metrics::ContextType type)
69 : stream_id_(stream_id), 68 : stream_id_(stream_id),
70 stream_priority_(stream_priority), 69 stream_priority_(stream_priority),
71 surface_handle_(surface_handle), 70 surface_handle_(surface_handle),
72 active_url_(active_url), 71 active_url_(active_url),
73 gpu_preference_(gpu_preference),
74 automatic_flushes_(automatic_flushes), 72 automatic_flushes_(automatic_flushes),
75 support_locking_(support_locking), 73 support_locking_(support_locking),
76 memory_limits_(memory_limits), 74 memory_limits_(memory_limits),
77 attributes_(attributes), 75 attributes_(attributes),
78 context_type_(type), 76 context_type_(type),
79 shared_providers_(shared_context_provider 77 shared_providers_(shared_context_provider
80 ? shared_context_provider->shared_providers_ 78 ? shared_context_provider->shared_providers_
81 : new SharedProviders), 79 : new SharedProviders),
82 channel_(std::move(channel)) { 80 channel_(std::move(channel)) {
83 DCHECK(main_thread_checker_.CalledOnValidThread()); 81 DCHECK(main_thread_checker_.CalledOnValidThread());
(...skipping 69 matching lines...) Expand 10 before | Expand all | Expand 10 after
153 151
154 DCHECK(attributes_.buffer_preserved); 152 DCHECK(attributes_.buffer_preserved);
155 153
156 // This command buffer is a client-side proxy to the command buffer in the 154 // This command buffer is a client-side proxy to the command buffer in the
157 // GPU process. 155 // GPU process.
158 scoped_refptr<base::SingleThreadTaskRunner> task_runner = 156 scoped_refptr<base::SingleThreadTaskRunner> task_runner =
159 default_task_runner_; 157 default_task_runner_;
160 if (!task_runner) 158 if (!task_runner)
161 task_runner = base::ThreadTaskRunnerHandle::Get(); 159 task_runner = base::ThreadTaskRunnerHandle::Get();
162 command_buffer_ = gpu::CommandBufferProxyImpl::Create( 160 command_buffer_ = gpu::CommandBufferProxyImpl::Create(
163 std::move(channel_), surface_handle_, gfx::Size(), 161 std::move(channel_), surface_handle_, shared_command_buffer, stream_id_,
164 shared_command_buffer, stream_id_, stream_priority_, 162 stream_priority_, attributes_, active_url_, std::move(task_runner));
165 attributes_, active_url_, gpu_preference_,
166 std::move(task_runner));
167 if (!command_buffer_) { 163 if (!command_buffer_) {
168 DLOG(ERROR) << "GpuChannelHost failed to create command buffer."; 164 DLOG(ERROR) << "GpuChannelHost failed to create command buffer.";
169 command_buffer_metrics::UmaRecordContextInitFailed(context_type_); 165 command_buffer_metrics::UmaRecordContextInitFailed(context_type_);
170 return false; 166 return false;
171 } 167 }
172 168
173 // The GLES2 helper writes the command buffer protocol. 169 // The GLES2 helper writes the command buffer protocol.
174 gles2_helper_.reset(new gpu::gles2::GLES2CmdHelper(command_buffer_.get())); 170 gles2_helper_.reset(new gpu::gles2::GLES2CmdHelper(command_buffer_.get()));
175 gles2_helper_->SetAutomaticFlushes(automatic_flushes_); 171 gles2_helper_->SetAutomaticFlushes(automatic_flushes_);
176 if (!gles2_helper_->Initialize(memory_limits_.command_buffer_size)) { 172 if (!gles2_helper_->Initialize(memory_limits_.command_buffer_size)) {
(...skipping 160 matching lines...) Expand 10 before | Expand all | Expand 10 after
337 333
338 void ContextProviderCommandBuffer::SetLostContextCallback( 334 void ContextProviderCommandBuffer::SetLostContextCallback(
339 const LostContextCallback& lost_context_callback) { 335 const LostContextCallback& lost_context_callback) {
340 DCHECK(context_thread_checker_.CalledOnValidThread()); 336 DCHECK(context_thread_checker_.CalledOnValidThread());
341 DCHECK(lost_context_callback_.is_null() || 337 DCHECK(lost_context_callback_.is_null() ||
342 lost_context_callback.is_null()); 338 lost_context_callback.is_null());
343 lost_context_callback_ = lost_context_callback; 339 lost_context_callback_ = lost_context_callback;
344 } 340 }
345 341
346 } // namespace content 342 } // namespace content
OLDNEW
« no previous file with comments | « content/common/gpu/client/context_provider_command_buffer.h ('k') | content/renderer/pepper/pepper_video_encoder_host.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698