OLD | NEW |
---|---|
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 "content/browser/renderer_host/compositor_impl_android.h" | 5 #include "content/browser/renderer_host/compositor_impl_android.h" |
6 | 6 |
7 #include <android/bitmap.h> | 7 #include <android/bitmap.h> |
8 #include <android/native_window_jni.h> | 8 #include <android/native_window_jni.h> |
9 #include <stdint.h> | 9 #include <stdint.h> |
10 | 10 |
(...skipping 17 matching lines...) Expand all Loading... | |
28 #include "base/threading/simple_thread.h" | 28 #include "base/threading/simple_thread.h" |
29 #include "base/threading/thread.h" | 29 #include "base/threading/thread.h" |
30 #include "base/threading/thread_checker.h" | 30 #include "base/threading/thread_checker.h" |
31 #include "cc/base/switches.h" | 31 #include "cc/base/switches.h" |
32 #include "cc/input/input_handler.h" | 32 #include "cc/input/input_handler.h" |
33 #include "cc/layers/layer.h" | 33 #include "cc/layers/layer.h" |
34 #include "cc/output/compositor_frame.h" | 34 #include "cc/output/compositor_frame.h" |
35 #include "cc/output/context_provider.h" | 35 #include "cc/output/context_provider.h" |
36 #include "cc/output/output_surface.h" | 36 #include "cc/output/output_surface.h" |
37 #include "cc/output/output_surface_client.h" | 37 #include "cc/output/output_surface_client.h" |
38 #include "cc/output/vulkan_in_process_context_provider.h" | |
38 #include "cc/raster/single_thread_task_graph_runner.h" | 39 #include "cc/raster/single_thread_task_graph_runner.h" |
39 #include "cc/scheduler/begin_frame_source.h" | 40 #include "cc/scheduler/begin_frame_source.h" |
40 #include "cc/surfaces/onscreen_display_client.h" | 41 #include "cc/surfaces/onscreen_display_client.h" |
41 #include "cc/surfaces/surface_display_output_surface.h" | 42 #include "cc/surfaces/surface_display_output_surface.h" |
42 #include "cc/surfaces/surface_id_allocator.h" | 43 #include "cc/surfaces/surface_id_allocator.h" |
43 #include "cc/surfaces/surface_manager.h" | 44 #include "cc/surfaces/surface_manager.h" |
44 #include "cc/trees/layer_tree_host.h" | 45 #include "cc/trees/layer_tree_host.h" |
45 #include "cc/trees/layer_tree_settings.h" | 46 #include "cc/trees/layer_tree_settings.h" |
46 #include "components/display_compositor/gl_helper.h" | 47 #include "components/display_compositor/gl_helper.h" |
47 #include "content/browser/android/child_process_launcher_android.h" | 48 #include "content/browser/android/child_process_launcher_android.h" |
48 #include "content/browser/compositor/browser_compositor_overlay_candidate_valida tor_android.h" | 49 #include "content/browser/compositor/browser_compositor_overlay_candidate_valida tor_android.h" |
49 #include "content/browser/gpu/browser_gpu_channel_host_factory.h" | 50 #include "content/browser/gpu/browser_gpu_channel_host_factory.h" |
50 #include "content/browser/gpu/browser_gpu_memory_buffer_manager.h" | 51 #include "content/browser/gpu/browser_gpu_memory_buffer_manager.h" |
51 #include "content/browser/gpu/compositor_util.h" | 52 #include "content/browser/gpu/compositor_util.h" |
52 #include "content/browser/gpu/gpu_surface_tracker.h" | 53 #include "content/browser/gpu/gpu_surface_tracker.h" |
53 #include "content/browser/renderer_host/render_widget_host_impl.h" | 54 #include "content/browser/renderer_host/render_widget_host_impl.h" |
54 #include "content/common/gpu/client/context_provider_command_buffer.h" | 55 #include "content/common/gpu/client/context_provider_command_buffer.h" |
55 #include "content/common/gpu/client/webgraphicscontext3d_command_buffer_impl.h" | 56 #include "content/common/gpu/client/webgraphicscontext3d_command_buffer_impl.h" |
56 #include "content/common/gpu_process_launch_causes.h" | 57 #include "content/common/gpu_process_launch_causes.h" |
57 #include "content/common/host_shared_bitmap_manager.h" | 58 #include "content/common/host_shared_bitmap_manager.h" |
58 #include "content/public/browser/android/compositor.h" | 59 #include "content/public/browser/android/compositor.h" |
59 #include "content/public/browser/android/compositor_client.h" | 60 #include "content/public/browser/android/compositor_client.h" |
60 #include "content/public/common/content_switches.h" | 61 #include "content/public/common/content_switches.h" |
61 #include "gpu/command_buffer/client/context_support.h" | 62 #include "gpu/command_buffer/client/context_support.h" |
62 #include "gpu/command_buffer/client/gles2_interface.h" | 63 #include "gpu/command_buffer/client/gles2_interface.h" |
63 #include "gpu/ipc/client/command_buffer_proxy_impl.h" | 64 #include "gpu/ipc/client/command_buffer_proxy_impl.h" |
64 #include "gpu/ipc/client/gpu_channel_host.h" | 65 #include "gpu/ipc/client/gpu_channel_host.h" |
66 #include "gpu/vulkan/vulkan_surface.h" | |
65 #include "third_party/khronos/GLES2/gl2.h" | 67 #include "third_party/khronos/GLES2/gl2.h" |
66 #include "third_party/khronos/GLES2/gl2ext.h" | 68 #include "third_party/khronos/GLES2/gl2ext.h" |
67 #include "third_party/skia/include/core/SkMallocPixelRef.h" | 69 #include "third_party/skia/include/core/SkMallocPixelRef.h" |
68 #include "ui/android/window_android.h" | 70 #include "ui/android/window_android.h" |
69 #include "ui/gfx/android/device_display_info.h" | 71 #include "ui/gfx/android/device_display_info.h" |
70 #include "ui/gfx/swap_result.h" | 72 #include "ui/gfx/swap_result.h" |
71 | 73 |
74 namespace gpu { | |
75 class VulkanSurface; | |
David Yen
2016/05/02 18:44:10
nit: This is not necessary since you included the
sohanjg
2016/05/04 05:19:26
Done.
| |
76 } | |
77 | |
72 namespace content { | 78 namespace content { |
73 | 79 |
74 namespace { | 80 namespace { |
75 | 81 |
76 const unsigned int kMaxDisplaySwapBuffers = 1U; | 82 const unsigned int kMaxDisplaySwapBuffers = 1U; |
77 | 83 |
78 class ExternalBeginFrameSource : public cc::BeginFrameSourceBase, | 84 class ExternalBeginFrameSource : public cc::BeginFrameSourceBase, |
79 public CompositorImpl::VSyncObserver { | 85 public CompositorImpl::VSyncObserver { |
80 public: | 86 public: |
81 ExternalBeginFrameSource(CompositorImpl* compositor) | 87 ExternalBeginFrameSource(CompositorImpl* compositor) |
(...skipping 132 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
214 private: | 220 private: |
215 CompositorImpl* compositor_; | 221 CompositorImpl* compositor_; |
216 base::Callback<void(gpu::Capabilities)> populate_gpu_capabilities_callback_; | 222 base::Callback<void(gpu::Capabilities)> populate_gpu_capabilities_callback_; |
217 base::CancelableCallback<void(const std::vector<ui::LatencyInfo>&, | 223 base::CancelableCallback<void(const std::vector<ui::LatencyInfo>&, |
218 gfx::SwapResult)> | 224 gfx::SwapResult)> |
219 swap_buffers_completion_callback_; | 225 swap_buffers_completion_callback_; |
220 std::unique_ptr<cc::OverlayCandidateValidator> overlay_candidate_validator_; | 226 std::unique_ptr<cc::OverlayCandidateValidator> overlay_candidate_validator_; |
221 std::unique_ptr<ExternalBeginFrameSource> begin_frame_source_; | 227 std::unique_ptr<ExternalBeginFrameSource> begin_frame_source_; |
222 }; | 228 }; |
223 | 229 |
230 #if defined(ENABLE_VULKAN) | |
231 class VulkanOutputSurface : public cc::OutputSurface { | |
232 public: | |
233 VulkanOutputSurface( | |
234 scoped_refptr<cc::VulkanContextProvider> vulkan_context_provider) | |
235 : OutputSurface(nullptr, | |
236 nullptr, | |
237 std::move(vulkan_context_provider), | |
238 nullptr) {} | |
239 | |
240 ~VulkanOutputSurface() override { Destroy(); } | |
241 | |
242 bool Initialize(gfx::AcceleratedWidget widget) { | |
243 DCHECK(!surface_); | |
244 std::unique_ptr<gpu::VulkanSurface> surface( | |
245 gpu::VulkanSurface::CreateViewSurface(widget)); | |
246 if (!surface->Initialize(vulkan_context_provider()->GetDeviceQueue(), | |
247 gpu::VulkanSurface::DEFAULT_SURFACE_FORMAT)) { | |
248 return false; | |
249 } | |
250 surface_ = std::move(surface); | |
251 | |
252 return true; | |
253 } | |
254 | |
255 void SwapBuffers(cc::CompositorFrame* frame) override { | |
256 surface_->SwapBuffers(); | |
257 PostSwapBuffersComplete(); | |
258 client_->DidSwapBuffers(); | |
259 } | |
260 | |
261 void Destroy() { | |
262 if (surface_) { | |
263 surface_->Destroy(); | |
264 surface_.reset(); | |
265 } | |
266 } | |
267 | |
268 void OnSwapBuffersCompleted(const std::vector<ui::LatencyInfo>& latency_info, | |
269 gfx::SwapResult result) { | |
270 RenderWidgetHostImpl::CompositorFrameDrawn(latency_info); | |
271 OutputSurface::OnSwapBuffersComplete(); | |
272 } | |
273 | |
274 private: | |
275 std::unique_ptr<gpu::VulkanSurface> surface_; | |
276 | |
277 DISALLOW_COPY_AND_ASSIGN(VulkanOutputSurface); | |
278 }; | |
279 #endif | |
280 | |
224 static bool g_initialized = false; | 281 static bool g_initialized = false; |
225 | 282 |
226 base::LazyInstance<cc::SurfaceManager> g_surface_manager = | 283 base::LazyInstance<cc::SurfaceManager> g_surface_manager = |
227 LAZY_INSTANCE_INITIALIZER; | 284 LAZY_INSTANCE_INITIALIZER; |
228 | 285 |
229 int g_surface_id_namespace = 0; | 286 int g_surface_id_namespace = 0; |
230 | 287 |
231 class SingleThreadTaskGraphRunner : public cc::SingleThreadTaskGraphRunner { | 288 class SingleThreadTaskGraphRunner : public cc::SingleThreadTaskGraphRunner { |
232 public: | 289 public: |
233 SingleThreadTaskGraphRunner() { | 290 SingleThreadTaskGraphRunner() { |
(...skipping 52 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
286 device_scale_factor_(1), | 343 device_scale_factor_(1), |
287 window_(NULL), | 344 window_(NULL), |
288 surface_id_(0), | 345 surface_id_(0), |
289 client_(client), | 346 client_(client), |
290 root_window_(root_window), | 347 root_window_(root_window), |
291 needs_animate_(false), | 348 needs_animate_(false), |
292 pending_swapbuffers_(0U), | 349 pending_swapbuffers_(0U), |
293 num_successive_context_creation_failures_(0), | 350 num_successive_context_creation_failures_(0), |
294 output_surface_request_pending_(false), | 351 output_surface_request_pending_(false), |
295 needs_begin_frames_(false), | 352 needs_begin_frames_(false), |
353 shared_vulkan_context_provider_android_(NULL), | |
296 weak_factory_(this) { | 354 weak_factory_(this) { |
297 DCHECK(client); | 355 DCHECK(client); |
298 DCHECK(root_window); | 356 DCHECK(root_window); |
299 root_window->AttachCompositor(this); | 357 root_window->AttachCompositor(this); |
300 CreateLayerTreeHost(); | 358 CreateLayerTreeHost(); |
301 resource_manager_.Init(host_.get()); | 359 resource_manager_.Init(host_.get()); |
302 } | 360 } |
303 | 361 |
304 CompositorImpl::~CompositorImpl() { | 362 CompositorImpl::~CompositorImpl() { |
305 root_window_->DetachCompositor(); | 363 root_window_->DetachCompositor(); |
(...skipping 194 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
500 RequestNewOutputSurface(); | 558 RequestNewOutputSurface(); |
501 } | 559 } |
502 | 560 |
503 void CompositorImpl::CreateOutputSurface() { | 561 void CompositorImpl::CreateOutputSurface() { |
504 // We might have had a request from a LayerTreeHost that was then | 562 // We might have had a request from a LayerTreeHost that was then |
505 // hidden (and hidden means we don't have a native surface). | 563 // hidden (and hidden means we don't have a native surface). |
506 // Also make sure we only handle this once. | 564 // Also make sure we only handle this once. |
507 if (!output_surface_request_pending_ || !host_->visible()) | 565 if (!output_surface_request_pending_ || !host_->visible()) |
508 return; | 566 return; |
509 | 567 |
510 // This is used for the browser compositor (offscreen) and for the display | 568 scoped_refptr<ContextProviderCommandBuffer> context_provider; |
511 // compositor (onscreen), so ask for capabilities needed by either one. | 569 scoped_refptr<cc::VulkanInProcessContextProvider> vulkan_context_provider = |
512 // The default framebuffer for an offscreen context is not used, so it does | 570 SharedVulkanContextProviderAndroid(); |
513 // not need alpha, stencil, depth, antialiasing. The display compositor does | 571 std::unique_ptr<cc::OutputSurface> real_output_surface; |
514 // not use these things either, except for alpha when it has a transparent | 572 #if defined(ENABLE_VULKAN) |
515 // background. | 573 std::unique_ptr<VulkanOutputSurface> vulkan_surface; |
516 gpu::gles2::ContextCreationAttribHelper attributes; | 574 if (vulkan_context_provider) { |
517 attributes.alpha_size = -1; | 575 vulkan_surface.reset( |
518 attributes.stencil_size = 0; | 576 new VulkanOutputSurface(std::move(vulkan_context_provider))); |
519 attributes.depth_size = 0; | 577 if (!vulkan_surface->Initialize(window_)) { |
520 attributes.samples = 0; | 578 vulkan_surface->Destroy(); |
521 attributes.sample_buffers = 0; | 579 vulkan_surface.reset(); |
522 attributes.bind_generates_resource = false; | 580 } else { |
581 real_output_surface = std::move(vulkan_surface); | |
582 } | |
583 } | |
584 #endif | |
523 | 585 |
524 if (has_transparent_background_) { | 586 if (!real_output_surface) { |
525 attributes.alpha_size = 8; | 587 // This is used for the browser compositor (offscreen) and for the display |
526 } else if (base::SysInfo::IsLowEndDevice()) { | 588 // compositor (onscreen), so ask for capabilities needed by either one. |
527 // In this case we prefer to use RGB565 format instead of RGBA8888 if | 589 // The default framebuffer for an offscreen context is not used, so it does |
528 // possible. | 590 // not need alpha, stencil, depth, antialiasing. The display compositor does |
529 // TODO(danakj): GpuCommandBufferStub constructor checks for alpha == 0 in | 591 // not use these things either, except for alpha when it has a transparent |
530 // order to enable 565, but it should avoid using 565 when -1s are specified | 592 // background. |
531 // (IOW check that a <= 0 && rgb > 0 && rgb <= 565) then alpha should be -1. | 593 gpu::gles2::ContextCreationAttribHelper attributes; |
532 attributes.alpha_size = 0; | 594 attributes.alpha_size = -1; |
533 attributes.red_size = 5; | 595 attributes.stencil_size = 0; |
534 attributes.green_size = 6; | 596 attributes.depth_size = 0; |
535 attributes.blue_size = 5; | 597 attributes.samples = 0; |
598 attributes.sample_buffers = 0; | |
599 attributes.bind_generates_resource = false; | |
600 | |
601 if (has_transparent_background_) { | |
602 attributes.alpha_size = 8; | |
603 } else if (base::SysInfo::IsLowEndDevice()) { | |
604 // In this case we prefer to use RGB565 format instead of RGBA8888 if | |
605 // possible. | |
606 // TODO(danakj): GpuCommandBufferStub constructor checks for alpha == 0 in | |
607 // order to enable 565, but it should avoid using 565 when -1s are | |
608 // specified | |
609 // (IOW check that a <= 0 && rgb > 0 && rgb <= 565) then alpha should be | |
610 // -1. | |
611 attributes.alpha_size = 0; | |
612 attributes.red_size = 5; | |
613 attributes.green_size = 6; | |
614 attributes.blue_size = 5; | |
615 } | |
616 | |
617 pending_swapbuffers_ = 0; | |
618 | |
619 DCHECK(window_); | |
620 DCHECK(surface_id_); | |
621 | |
622 BrowserGpuChannelHostFactory* factory = | |
623 BrowserGpuChannelHostFactory::instance(); | |
624 // This channel might be lost (and even if it isn't right now, it might | |
625 // still get marked as lost from the IO thread, at any point in time | |
626 // really). | |
627 // But from here on just try and always lead to either | |
628 // DidInitializeOutputSurface() or DidFailToInitializeOutputSurface(). | |
629 scoped_refptr<gpu::GpuChannelHost> gpu_channel_host( | |
630 factory->GetGpuChannel()); | |
631 | |
632 GURL url("chrome://gpu/CompositorImpl::CreateOutputSurface"); | |
633 gpu::SurfaceHandle surface_handle = | |
634 GpuSurfaceTracker::Get()->GetSurfaceHandle(surface_id_); | |
635 constexpr bool share_resources = false; | |
636 constexpr bool automatic_flushes = false; | |
637 | |
638 constexpr size_t kBytesPerPixel = 4; | |
639 const size_t full_screen_texture_size_in_bytes = | |
640 gfx::DeviceDisplayInfo().GetDisplayHeight() * | |
641 gfx::DeviceDisplayInfo().GetDisplayWidth() * kBytesPerPixel; | |
642 | |
643 gpu::SharedMemoryLimits limits; | |
644 // This limit is meant to hold the contents of the display compositor | |
645 // drawing the scene. See discussion here: | |
646 // https://codereview.chromium.org/1900993002/diff/90001/content/browser/ren derer_host/compositor_impl_android.cc?context=3&column_width=80&tab_spaces=8 | |
647 limits.command_buffer_size = 64 * 1024; | |
648 // These limits are meant to hold the uploads for the browser UI without | |
649 // any excess space. | |
650 limits.start_transfer_buffer_size = 64 * 1024; | |
651 limits.min_transfer_buffer_size = 64 * 1024; | |
652 limits.max_transfer_buffer_size = full_screen_texture_size_in_bytes; | |
653 // Texture uploads may use mapped memory so give a reasonable limit for | |
654 // them. | |
655 limits.mapped_memory_reclaim_limit = full_screen_texture_size_in_bytes; | |
656 | |
657 context_provider = new ContextProviderCommandBuffer( | |
658 base::WrapUnique(new WebGraphicsContext3DCommandBufferImpl( | |
659 surface_handle, url, gpu_channel_host.get(), attributes, | |
660 gfx::PreferIntegratedGpu, share_resources, automatic_flushes, | |
661 nullptr)), | |
662 limits, DISPLAY_COMPOSITOR_ONSCREEN_CONTEXT); | |
663 DCHECK(context_provider.get()); | |
664 | |
665 real_output_surface = base::WrapUnique(new OutputSurfaceWithoutParent( | |
666 this, context_provider, | |
667 base::Bind(&CompositorImpl::PopulateGpuCapabilities, | |
668 base::Unretained(this)), | |
669 base::WrapUnique(new ExternalBeginFrameSource(this)))); | |
536 } | 670 } |
537 | 671 |
538 pending_swapbuffers_ = 0; | |
539 | |
540 DCHECK(window_); | |
541 DCHECK(surface_id_); | |
542 | |
543 BrowserGpuChannelHostFactory* factory = | |
544 BrowserGpuChannelHostFactory::instance(); | |
545 // This channel might be lost (and even if it isn't right now, it might | |
546 // still get marked as lost from the IO thread, at any point in time really). | |
547 // But from here on just try and always lead to either | |
548 // DidInitializeOutputSurface() or DidFailToInitializeOutputSurface(). | |
549 scoped_refptr<gpu::GpuChannelHost> gpu_channel_host(factory->GetGpuChannel()); | |
550 | |
551 GURL url("chrome://gpu/CompositorImpl::CreateOutputSurface"); | |
552 gpu::SurfaceHandle surface_handle = | |
553 GpuSurfaceTracker::Get()->GetSurfaceHandle(surface_id_); | |
554 constexpr bool share_resources = false; | |
555 constexpr bool automatic_flushes = false; | |
556 | |
557 constexpr size_t kBytesPerPixel = 4; | |
558 const size_t full_screen_texture_size_in_bytes = | |
559 gfx::DeviceDisplayInfo().GetDisplayHeight() * | |
560 gfx::DeviceDisplayInfo().GetDisplayWidth() * kBytesPerPixel; | |
561 | |
562 gpu::SharedMemoryLimits limits; | |
563 // This limit is meant to hold the contents of the display compositor | |
564 // drawing the scene. See discussion here: | |
565 // https://codereview.chromium.org/1900993002/diff/90001/content/browser/rende rer_host/compositor_impl_android.cc?context=3&column_width=80&tab_spaces=8 | |
566 limits.command_buffer_size = 64 * 1024; | |
567 // These limits are meant to hold the uploads for the browser UI without | |
568 // any excess space. | |
569 limits.start_transfer_buffer_size = 64 * 1024; | |
570 limits.min_transfer_buffer_size = 64 * 1024; | |
571 limits.max_transfer_buffer_size = full_screen_texture_size_in_bytes; | |
572 // Texture uploads may use mapped memory so give a reasonable limit for them. | |
573 limits.mapped_memory_reclaim_limit = full_screen_texture_size_in_bytes; | |
574 | |
575 scoped_refptr<ContextProviderCommandBuffer> context_provider( | |
576 new ContextProviderCommandBuffer( | |
577 base::WrapUnique(new WebGraphicsContext3DCommandBufferImpl( | |
578 surface_handle, url, gpu_channel_host.get(), attributes, | |
579 gfx::PreferIntegratedGpu, share_resources, automatic_flushes, | |
580 nullptr)), | |
581 limits, DISPLAY_COMPOSITOR_ONSCREEN_CONTEXT)); | |
582 DCHECK(context_provider.get()); | |
583 | |
584 std::unique_ptr<cc::OutputSurface> real_output_surface( | |
585 new OutputSurfaceWithoutParent( | |
586 this, context_provider, | |
587 base::Bind(&CompositorImpl::PopulateGpuCapabilities, | |
588 base::Unretained(this)), | |
589 base::WrapUnique(new ExternalBeginFrameSource(this)))); | |
590 | |
591 cc::SurfaceManager* manager = GetSurfaceManager(); | 672 cc::SurfaceManager* manager = GetSurfaceManager(); |
592 display_client_.reset(new cc::OnscreenDisplayClient( | 673 display_client_.reset(new cc::OnscreenDisplayClient( |
593 std::move(real_output_surface), manager, | 674 std::move(real_output_surface), manager, |
594 HostSharedBitmapManager::current(), | 675 HostSharedBitmapManager::current(), |
595 BrowserGpuMemoryBufferManager::current(), | 676 BrowserGpuMemoryBufferManager::current(), |
596 host_->settings().renderer_settings, base::ThreadTaskRunnerHandle::Get(), | 677 host_->settings().renderer_settings, base::ThreadTaskRunnerHandle::Get(), |
597 surface_id_allocator_->id_namespace())); | 678 surface_id_allocator_->id_namespace())); |
679 | |
598 std::unique_ptr<cc::SurfaceDisplayOutputSurface> surface_output_surface( | 680 std::unique_ptr<cc::SurfaceDisplayOutputSurface> surface_output_surface( |
599 new cc::SurfaceDisplayOutputSurface(manager, surface_id_allocator_.get(), | 681 vulkan_context_provider |
600 context_provider, nullptr)); | 682 ? new cc::SurfaceDisplayOutputSurface( |
683 manager, surface_id_allocator_.get(), | |
684 static_cast<scoped_refptr<cc::VulkanContextProvider>>( | |
685 vulkan_context_provider)) | |
686 : new cc::SurfaceDisplayOutputSurface(manager, | |
687 surface_id_allocator_.get(), | |
688 context_provider, nullptr)); | |
601 | 689 |
602 display_client_->set_surface_output_surface(surface_output_surface.get()); | 690 display_client_->set_surface_output_surface(surface_output_surface.get()); |
603 surface_output_surface->set_display_client(display_client_.get()); | 691 surface_output_surface->set_display_client(display_client_.get()); |
604 display_client_->display()->Resize(size_); | 692 display_client_->display()->Resize(size_); |
605 host_->SetOutputSurface(std::move(surface_output_surface)); | 693 host_->SetOutputSurface(std::move(surface_output_surface)); |
606 } | 694 } |
607 | 695 |
608 void CompositorImpl::PopulateGpuCapabilities( | 696 void CompositorImpl::PopulateGpuCapabilities( |
609 gpu::Capabilities gpu_capabilities) { | 697 gpu::Capabilities gpu_capabilities) { |
610 gpu_capabilities_ = gpu_capabilities; | 698 gpu_capabilities_ = gpu_capabilities; |
(...skipping 72 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
683 | 771 |
684 void CompositorImpl::SetNeedsAnimate() { | 772 void CompositorImpl::SetNeedsAnimate() { |
685 needs_animate_ = true; | 773 needs_animate_ = true; |
686 if (!host_->visible()) | 774 if (!host_->visible()) |
687 return; | 775 return; |
688 | 776 |
689 TRACE_EVENT0("compositor", "Compositor::SetNeedsAnimate"); | 777 TRACE_EVENT0("compositor", "Compositor::SetNeedsAnimate"); |
690 host_->SetNeedsAnimate(); | 778 host_->SetNeedsAnimate(); |
691 } | 779 } |
692 | 780 |
781 scoped_refptr<cc::VulkanInProcessContextProvider> | |
782 CompositorImpl::SharedVulkanContextProviderAndroid() { | |
piman
2016/05/02 22:19:43
I don't think this shares anything across Composit
sohanjg
2016/05/03 12:38:53
Hmm, if we are to make a lazyinstance (leaky or ot
piman
2016/05/03 14:53:26
I was thinking LazyInstance<scoped_refptr<VulkanIn
sohanjg
2016/05/04 05:19:26
Done.
I was trying to use the cxt provider w/o sc
| |
783 if (!shared_vulkan_context_provider_android_) { | |
784 if (base::CommandLine::ForCurrentProcess()->HasSwitch( | |
785 switches::kEnableVulkan)) { | |
786 shared_vulkan_context_provider_android_ = | |
787 cc::VulkanInProcessContextProvider::Create(); | |
788 } | |
789 } | |
790 return shared_vulkan_context_provider_android_; | |
791 } | |
792 | |
693 } // namespace content | 793 } // namespace content |
OLD | NEW |