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

Side by Side Diff: mojo/gles2/command_buffer_client_impl.cc

Issue 1885903002: Revert of Make lost context and error message callbacks on GpuControl go to client (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Created 4 years, 8 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
« no previous file with comments | « mojo/gles2/command_buffer_client_impl.h ('k') | mojo/gles2/gles2_context.h » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 // Copyright 2014 The Chromium Authors. All rights reserved. 1 // Copyright 2014 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 "mojo/gles2/command_buffer_client_impl.h" 5 #include "mojo/gles2/command_buffer_client_impl.h"
6 6
7 #include <stddef.h> 7 #include <stddef.h>
8 #include <stdint.h> 8 #include <stdint.h>
9 9
10 #include <limits> 10 #include <limits>
11 #include <utility> 11 #include <utility>
12 12
13 #include "base/logging.h" 13 #include "base/logging.h"
14 #include "base/process/process_handle.h" 14 #include "base/process/process_handle.h"
15 #include "base/threading/thread_restrictions.h" 15 #include "base/threading/thread_restrictions.h"
16 #include "components/mus/gles2/command_buffer_type_conversions.h" 16 #include "components/mus/gles2/command_buffer_type_conversions.h"
17 #include "components/mus/gles2/mojo_buffer_backing.h" 17 #include "components/mus/gles2/mojo_buffer_backing.h"
18 #include "components/mus/gles2/mojo_gpu_memory_buffer.h" 18 #include "components/mus/gles2/mojo_gpu_memory_buffer.h"
19 #include "gpu/command_buffer/client/gpu_control_client.h"
20 #include "gpu/command_buffer/common/command_buffer_id.h" 19 #include "gpu/command_buffer/common/command_buffer_id.h"
21 #include "gpu/command_buffer/common/gpu_memory_buffer_support.h" 20 #include "gpu/command_buffer/common/gpu_memory_buffer_support.h"
22 #include "gpu/command_buffer/common/sync_token.h" 21 #include "gpu/command_buffer/common/sync_token.h"
23 #include "mojo/platform_handle/platform_handle_functions.h" 22 #include "mojo/platform_handle/platform_handle_functions.h"
24 23
25 namespace gles2 { 24 namespace gles2 {
26 25
27 namespace { 26 namespace {
28 27
29 bool CreateMapAndDupSharedBuffer(size_t size, 28 bool CreateMapAndDupSharedBuffer(size_t size,
(...skipping 25 matching lines...) Expand all
55 *output = input; 54 *output = input;
56 } 55 }
57 56
58 void InitializeCallback(mus::mojom::CommandBufferInitializeResultPtr* output, 57 void InitializeCallback(mus::mojom::CommandBufferInitializeResultPtr* output,
59 mus::mojom::CommandBufferInitializeResultPtr input) { 58 mus::mojom::CommandBufferInitializeResultPtr input) {
60 *output = std::move(input); 59 *output = std::move(input);
61 } 60 }
62 61
63 } // namespace 62 } // namespace
64 63
64 CommandBufferDelegate::~CommandBufferDelegate() {}
65
66 void CommandBufferDelegate::ContextLost() {}
67
65 CommandBufferClientImpl::CommandBufferClientImpl( 68 CommandBufferClientImpl::CommandBufferClientImpl(
69 CommandBufferDelegate* delegate,
66 const std::vector<int32_t>& attribs, 70 const std::vector<int32_t>& attribs,
67 mojo::ScopedMessagePipeHandle command_buffer_handle) 71 mojo::ScopedMessagePipeHandle command_buffer_handle)
68 : gpu_control_client_(nullptr), 72 : delegate_(delegate),
69 destroyed_(false),
70 attribs_(attribs), 73 attribs_(attribs),
71 client_binding_(this), 74 client_binding_(this),
72 command_buffer_id_(), 75 command_buffer_id_(),
73 shared_state_(NULL), 76 shared_state_(NULL),
74 last_put_offset_(-1), 77 last_put_offset_(-1),
75 next_transfer_buffer_id_(0), 78 next_transfer_buffer_id_(0),
76 next_image_id_(0), 79 next_image_id_(0),
77 next_fence_sync_release_(1), 80 next_fence_sync_release_(1),
78 flushed_fence_sync_release_(0) { 81 flushed_fence_sync_release_(0) {
79 command_buffer_.Bind(mojo::InterfacePtrInfo<mus::mojom::CommandBuffer>( 82 command_buffer_.Bind(mojo::InterfacePtrInfo<mus::mojom::CommandBuffer>(
(...skipping 113 matching lines...) Expand 10 before | Expand all | Expand 10 after
193 scoped_ptr<gpu::BufferBacking> backing( 196 scoped_ptr<gpu::BufferBacking> backing(
194 new mus::MojoBufferBacking(std::move(handle), memory, size)); 197 new mus::MojoBufferBacking(std::move(handle), memory, size));
195 scoped_refptr<gpu::Buffer> buffer(new gpu::Buffer(std::move(backing))); 198 scoped_refptr<gpu::Buffer> buffer(new gpu::Buffer(std::move(backing)));
196 return buffer; 199 return buffer;
197 } 200 }
198 201
199 void CommandBufferClientImpl::DestroyTransferBuffer(int32_t id) { 202 void CommandBufferClientImpl::DestroyTransferBuffer(int32_t id) {
200 command_buffer_->DestroyTransferBuffer(id); 203 command_buffer_->DestroyTransferBuffer(id);
201 } 204 }
202 205
203 void CommandBufferClientImpl::SetGpuControlClient(gpu::GpuControlClient* c) {
204 gpu_control_client_ = c;
205 }
206
207 gpu::Capabilities CommandBufferClientImpl::GetCapabilities() { 206 gpu::Capabilities CommandBufferClientImpl::GetCapabilities() {
208 return capabilities_; 207 return capabilities_;
209 } 208 }
210 209
211 int32_t CommandBufferClientImpl::CreateImage(ClientBuffer buffer, 210 int32_t CommandBufferClientImpl::CreateImage(ClientBuffer buffer,
212 size_t width, 211 size_t width,
213 size_t height, 212 size_t height,
214 unsigned internalformat) { 213 unsigned internalformat) {
215 int32_t new_id = ++next_image_id_; 214 int32_t new_id = ++next_image_id_;
216 215
(...skipping 62 matching lines...) Expand 10 before | Expand all | Expand 10 after
279 return CreateImage(buffer->AsClientBuffer(), width, height, internalformat); 278 return CreateImage(buffer->AsClientBuffer(), width, height, internalformat);
280 } 279 }
281 280
282 void CommandBufferClientImpl::SignalQuery(uint32_t query, 281 void CommandBufferClientImpl::SignalQuery(uint32_t query,
283 const base::Closure& callback) { 282 const base::Closure& callback) {
284 // TODO(piman) 283 // TODO(piman)
285 NOTIMPLEMENTED(); 284 NOTIMPLEMENTED();
286 } 285 }
287 286
288 void CommandBufferClientImpl::Destroyed(int32_t lost_reason, int32_t error) { 287 void CommandBufferClientImpl::Destroyed(int32_t lost_reason, int32_t error) {
289 if (destroyed_)
290 return;
291 last_state_.context_lost_reason = 288 last_state_.context_lost_reason =
292 static_cast<gpu::error::ContextLostReason>(lost_reason); 289 static_cast<gpu::error::ContextLostReason>(lost_reason);
293 last_state_.error = static_cast<gpu::error::Error>(error); 290 last_state_.error = static_cast<gpu::error::Error>(error);
294 if (gpu_control_client_) 291 delegate_->ContextLost();
295 gpu_control_client_->OnGpuControlLostContext();
296 destroyed_ = true;
297 } 292 }
298 293
299 void CommandBufferClientImpl::SignalAck(uint32_t id) { 294 void CommandBufferClientImpl::SignalAck(uint32_t id) {
300 } 295 }
301 296
302 void CommandBufferClientImpl::SwapBuffersCompleted(int32_t result) { 297 void CommandBufferClientImpl::SwapBuffersCompleted(int32_t result) {
303 } 298 }
304 299
305 void CommandBufferClientImpl::UpdateState( 300 void CommandBufferClientImpl::UpdateState(
306 const gpu::CommandBuffer::State& state) { 301 const gpu::CommandBuffer::State& state) {
(...skipping 81 matching lines...) Expand 10 before | Expand all | Expand 10 after
388 383
389 // It is also safe to wait on the same context. 384 // It is also safe to wait on the same context.
390 if (sync_token->namespace_id() == gpu::CommandBufferNamespace::MOJO && 385 if (sync_token->namespace_id() == gpu::CommandBufferNamespace::MOJO &&
391 sync_token->command_buffer_id() == GetCommandBufferID()) 386 sync_token->command_buffer_id() == GetCommandBufferID())
392 return true; 387 return true;
393 388
394 return false; 389 return false;
395 } 390 }
396 391
397 } // namespace gles2 392 } // namespace gles2
OLDNEW
« no previous file with comments | « mojo/gles2/command_buffer_client_impl.h ('k') | mojo/gles2/gles2_context.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698