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

Side by Side Diff: content/renderer/pepper/pepper_video_encoder_host.cc

Issue 2814843002: gpu: GPU service scheduler. (Closed)
Patch Set: fix test dcheck failures Created 3 years, 7 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 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 "content/renderer/pepper/pepper_video_encoder_host.h" 5 #include "content/renderer/pepper/pepper_video_encoder_host.h"
6 6
7 #include <utility> 7 #include <utility>
8 8
9 #include "base/bind.h" 9 #include "base/bind.h"
10 #include "base/memory/ptr_util.h" 10 #include "base/memory/ptr_util.h"
11 #include "base/memory/shared_memory.h" 11 #include "base/memory/shared_memory.h"
12 #include "base/numerics/safe_math.h" 12 #include "base/numerics/safe_math.h"
13 #include "base/threading/thread_task_runner_handle.h" 13 #include "base/threading/thread_task_runner_handle.h"
14 #include "build/build_config.h" 14 #include "build/build_config.h"
15 #include "content/common/gpu_stream_constants.h"
15 #include "content/common/pepper_file_util.h" 16 #include "content/common/pepper_file_util.h"
16 #include "content/public/renderer/renderer_ppapi_host.h" 17 #include "content/public/renderer/renderer_ppapi_host.h"
17 #include "content/renderer/pepper/gfx_conversion.h" 18 #include "content/renderer/pepper/gfx_conversion.h"
18 #include "content/renderer/pepper/host_globals.h" 19 #include "content/renderer/pepper/host_globals.h"
19 #include "content/renderer/pepper/video_encoder_shim.h" 20 #include "content/renderer/pepper/video_encoder_shim.h"
20 #include "content/renderer/render_thread_impl.h" 21 #include "content/renderer/render_thread_impl.h"
21 #include "gpu/command_buffer/common/gles2_cmd_utils.h" 22 #include "gpu/command_buffer/common/gles2_cmd_utils.h"
22 #include "gpu/ipc/client/command_buffer_proxy_impl.h" 23 #include "gpu/ipc/client/command_buffer_proxy_impl.h"
23 #include "media/base/bind_to_current_loop.h" 24 #include "media/base/bind_to_current_loop.h"
24 #include "media/base/video_frame.h" 25 #include "media/base/video_frame.h"
(...skipping 498 matching lines...) Expand 10 before | Expand all | Expand 10 after
523 return true; 524 return true;
524 525
525 // There is no guarantee that we have a 3D context to work with. So 526 // There is no guarantee that we have a 3D context to work with. So
526 // we create a dummy command buffer to communicate with the gpu process. 527 // we create a dummy command buffer to communicate with the gpu process.
527 scoped_refptr<gpu::GpuChannelHost> channel = 528 scoped_refptr<gpu::GpuChannelHost> channel =
528 RenderThreadImpl::current()->EstablishGpuChannelSync(); 529 RenderThreadImpl::current()->EstablishGpuChannelSync();
529 if (!channel) 530 if (!channel)
530 return false; 531 return false;
531 532
532 command_buffer_ = gpu::CommandBufferProxyImpl::Create( 533 command_buffer_ = gpu::CommandBufferProxyImpl::Create(
533 std::move(channel), gpu::kNullSurfaceHandle, nullptr, 534 std::move(channel), gpu::kNullSurfaceHandle, nullptr, kGpuStreamIdDefault,
534 gpu::GPU_STREAM_DEFAULT, gpu::GpuStreamPriority::NORMAL, 535 kGpuStreamPriorityDefault, gpu::gles2::ContextCreationAttribHelper(),
535 gpu::gles2::ContextCreationAttribHelper(), GURL::EmptyGURL(), 536 GURL::EmptyGURL(), base::ThreadTaskRunnerHandle::Get());
536 base::ThreadTaskRunnerHandle::Get());
537 if (!command_buffer_) { 537 if (!command_buffer_) {
538 Close(); 538 Close();
539 return false; 539 return false;
540 } 540 }
541 541
542 command_buffer_->SetGpuControlClient(this); 542 command_buffer_->SetGpuControlClient(this);
543 543
544 return true; 544 return true;
545 } 545 }
546 546
(...skipping 133 matching lines...) Expand 10 before | Expand all | Expand 10 after
680 } 680 }
681 681
682 uint8_t* PepperVideoEncoderHost::ShmHandleToAddress(int32_t buffer_id) { 682 uint8_t* PepperVideoEncoderHost::ShmHandleToAddress(int32_t buffer_id) {
683 DCHECK(RenderThreadImpl::current()); 683 DCHECK(RenderThreadImpl::current());
684 DCHECK_GE(buffer_id, 0); 684 DCHECK_GE(buffer_id, 0);
685 DCHECK_LT(buffer_id, static_cast<int32_t>(shm_buffers_.size())); 685 DCHECK_LT(buffer_id, static_cast<int32_t>(shm_buffers_.size()));
686 return static_cast<uint8_t*>(shm_buffers_[buffer_id]->shm->memory()); 686 return static_cast<uint8_t*>(shm_buffers_[buffer_id]->shm->memory());
687 } 687 }
688 688
689 } // namespace content 689 } // namespace content
OLDNEW
« no previous file with comments | « content/public/common/content_switches.cc ('k') | content/renderer/pepper/ppb_graphics_3d_impl.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698