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

Side by Side Diff: components/mus/gles2/command_buffer_local.cc

Issue 1610783002: mustash: gpu: implement SignalQuery in CommandBufferLocal (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Run SignalQuery's callback on the client thread. Created 4 years, 11 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 | « components/mus/gles2/command_buffer_local.h ('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 2015 The Chromium Authors. All rights reserved. 1 // Copyright 2015 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 "components/mus/gles2/command_buffer_local.h" 5 #include "components/mus/gles2/command_buffer_local.h"
6 6
7 #include "base/atomic_sequence_num.h" 7 #include "base/atomic_sequence_num.h"
8 #include "base/bind.h" 8 #include "base/bind.h"
9 #include "base/memory/shared_memory.h" 9 #include "base/memory/shared_memory.h"
10 #include "base/synchronization/waitable_event.h" 10 #include "base/synchronization/waitable_event.h"
(...skipping 44 matching lines...) Expand 10 before | Expand all | Expand 10 after
55 55
56 result = mojo::MapBuffer(handle->get(), 0, size, memory, 56 result = mojo::MapBuffer(handle->get(), 0, size, memory,
57 MOJO_MAP_BUFFER_FLAG_NONE); 57 MOJO_MAP_BUFFER_FLAG_NONE);
58 if (result != MOJO_RESULT_OK) 58 if (result != MOJO_RESULT_OK)
59 return false; 59 return false;
60 DCHECK(*memory); 60 DCHECK(*memory);
61 61
62 return true; 62 return true;
63 } 63 }
64 64
65 void PostTask(const scoped_refptr<base::SingleThreadTaskRunner>& task_runner,
66 const base::Closure& callback) {
67 task_runner->PostTask(FROM_HERE, callback);
68 }
65 } 69 }
66 70
67 const unsigned int GL_READ_WRITE_CHROMIUM = 0x78F2; 71 const unsigned int GL_READ_WRITE_CHROMIUM = 0x78F2;
68 72
69 CommandBufferLocal::CommandBufferLocal(CommandBufferLocalClient* client, 73 CommandBufferLocal::CommandBufferLocal(CommandBufferLocalClient* client,
70 gfx::AcceleratedWidget widget, 74 gfx::AcceleratedWidget widget,
71 const scoped_refptr<GpuState>& gpu_state) 75 const scoped_refptr<GpuState>& gpu_state)
72 : widget_(widget), 76 : widget_(widget),
73 gpu_state_(gpu_state), 77 gpu_state_(gpu_state),
74 client_(client), 78 client_(client),
(...skipping 226 matching lines...) Expand 10 before | Expand all | Expand 10 after
301 305
302 void CommandBufferLocal::RetireSyncPoint(uint32_t sync_point) { 306 void CommandBufferLocal::RetireSyncPoint(uint32_t sync_point) {
303 NOTREACHED(); 307 NOTREACHED();
304 } 308 }
305 309
306 void CommandBufferLocal::SignalSyncPoint(uint32_t sync_point, 310 void CommandBufferLocal::SignalSyncPoint(uint32_t sync_point,
307 const base::Closure& callback) { 311 const base::Closure& callback) {
308 NOTREACHED(); 312 NOTREACHED();
309 } 313 }
310 314
311 void CommandBufferLocal::SignalQuery(uint32_t query, 315 void CommandBufferLocal::SignalQuery(uint32_t query_id,
312 const base::Closure& callback) { 316 const base::Closure& callback) {
313 DCHECK(CalledOnValidThread()); 317 DCHECK(CalledOnValidThread());
314 // TODO(piman) 318
315 NOTIMPLEMENTED(); 319 gpu_state_->command_buffer_task_runner()->PostTask(
320 driver_.get(), base::Bind(&CommandBufferLocal::SignalQueryOnGpuThread,
321 base::Unretained(this), query_id, callback));
316 } 322 }
317 323
318 void CommandBufferLocal::SetLock(base::Lock* lock) { 324 void CommandBufferLocal::SetLock(base::Lock* lock) {
319 DCHECK(CalledOnValidThread()); 325 DCHECK(CalledOnValidThread());
320 NOTIMPLEMENTED(); 326 NOTIMPLEMENTED();
321 } 327 }
322 328
323 bool CommandBufferLocal::IsGpuChannelLost() { 329 bool CommandBufferLocal::IsGpuChannelLost() {
324 DCHECK(CalledOnValidThread()); 330 DCHECK(CalledOnValidThread());
325 // This is only possible for out-of-process command buffers. 331 // This is only possible for out-of-process command buffers.
(...skipping 191 matching lines...) Expand 10 before | Expand all | Expand 10 after
517 *state = driver_->GetLastState(); 523 *state = driver_->GetLastState();
518 event->Signal(); 524 event->Signal();
519 return true; 525 return true;
520 } 526 }
521 527
522 bool CommandBufferLocal::DeleteOnGpuThread() { 528 bool CommandBufferLocal::DeleteOnGpuThread() {
523 delete this; 529 delete this;
524 return true; 530 return true;
525 } 531 }
526 532
533 bool CommandBufferLocal::SignalQueryOnGpuThread(uint32_t query_id,
534 const base::Closure& callback) {
535 // |callback| should run on the client thread.
536 driver_->SignalQuery(
537 query_id, base::Bind(&PostTask, client_thread_task_runner_, callback));
538 return true;
539 }
540
527 void CommandBufferLocal::DidLoseContextOnClientThread(uint32_t reason) { 541 void CommandBufferLocal::DidLoseContextOnClientThread(uint32_t reason) {
528 if (client_) 542 if (client_)
529 client_->DidLoseContext(); 543 client_->DidLoseContext();
530 } 544 }
531 545
532 void CommandBufferLocal::UpdateVSyncParametersOnClientThread(int64_t timebase, 546 void CommandBufferLocal::UpdateVSyncParametersOnClientThread(int64_t timebase,
533 int64_t interval) { 547 int64_t interval) {
534 if (client_) 548 if (client_)
535 client_->UpdateVSyncParameters(timebase, interval); 549 client_->UpdateVSyncParameters(timebase, interval);
536 } 550 }
537 551
538 } // namespace mus 552 } // namespace mus
OLDNEW
« no previous file with comments | « components/mus/gles2/command_buffer_local.h ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698