Chromium Code Reviews| 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/compositor_overlay_candidate_validator_a ndroid.h" | 47 #include "components/display_compositor/compositor_overlay_candidate_validator_a ndroid.h" |
| 47 #include "components/display_compositor/gl_helper.h" | 48 #include "components/display_compositor/gl_helper.h" |
| 48 #include "content/browser/android/child_process_launcher_android.h" | 49 #include "content/browser/android/child_process_launcher_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_process_launch_causes.h" | 56 #include "content/common/gpu_process_launch_causes.h" |
| 56 #include "content/common/host_shared_bitmap_manager.h" | 57 #include "content/common/host_shared_bitmap_manager.h" |
| 57 #include "content/public/browser/android/compositor.h" | 58 #include "content/public/browser/android/compositor.h" |
| 58 #include "content/public/browser/android/compositor_client.h" | 59 #include "content/public/browser/android/compositor_client.h" |
| 59 #include "content/public/common/content_switches.h" | 60 #include "content/public/common/content_switches.h" |
| 60 #include "gpu/command_buffer/client/context_support.h" | 61 #include "gpu/command_buffer/client/context_support.h" |
| 61 #include "gpu/command_buffer/client/gles2_interface.h" | 62 #include "gpu/command_buffer/client/gles2_interface.h" |
| 62 #include "gpu/ipc/client/command_buffer_proxy_impl.h" | 63 #include "gpu/ipc/client/command_buffer_proxy_impl.h" |
| 63 #include "gpu/ipc/client/gpu_channel_host.h" | 64 #include "gpu/ipc/client/gpu_channel_host.h" |
| 65 #include "gpu/vulkan/vulkan_surface.h" | |
| 64 #include "third_party/khronos/GLES2/gl2.h" | 66 #include "third_party/khronos/GLES2/gl2.h" |
| 65 #include "third_party/khronos/GLES2/gl2ext.h" | 67 #include "third_party/khronos/GLES2/gl2ext.h" |
| 66 #include "third_party/skia/include/core/SkMallocPixelRef.h" | 68 #include "third_party/skia/include/core/SkMallocPixelRef.h" |
| 67 #include "ui/android/window_android.h" | 69 #include "ui/android/window_android.h" |
| 68 #include "ui/gfx/android/device_display_info.h" | 70 #include "ui/gfx/android/device_display_info.h" |
| 69 #include "ui/gfx/swap_result.h" | 71 #include "ui/gfx/swap_result.h" |
| 70 | 72 |
| 71 namespace content { | 73 namespace content { |
| 72 | 74 |
| 73 namespace { | 75 namespace { |
| (...skipping 140 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 214 private: | 216 private: |
| 215 CompositorImpl* compositor_; | 217 CompositorImpl* compositor_; |
| 216 base::Callback<void(gpu::Capabilities)> populate_gpu_capabilities_callback_; | 218 base::Callback<void(gpu::Capabilities)> populate_gpu_capabilities_callback_; |
| 217 base::CancelableCallback<void(const std::vector<ui::LatencyInfo>&, | 219 base::CancelableCallback<void(const std::vector<ui::LatencyInfo>&, |
| 218 gfx::SwapResult)> | 220 gfx::SwapResult)> |
| 219 swap_buffers_completion_callback_; | 221 swap_buffers_completion_callback_; |
| 220 std::unique_ptr<cc::OverlayCandidateValidator> overlay_candidate_validator_; | 222 std::unique_ptr<cc::OverlayCandidateValidator> overlay_candidate_validator_; |
| 221 std::unique_ptr<ExternalBeginFrameSource> begin_frame_source_; | 223 std::unique_ptr<ExternalBeginFrameSource> begin_frame_source_; |
| 222 }; | 224 }; |
| 223 | 225 |
| 226 #if defined(ENABLE_VULKAN) | |
| 227 class VulkanOutputSurface : public cc::OutputSurface { | |
| 228 public: | |
| 229 VulkanOutputSurface( | |
| 230 scoped_refptr<cc::VulkanContextProvider> vulkan_context_provider) | |
| 231 : OutputSurface(nullptr, | |
| 232 nullptr, | |
| 233 std::move(vulkan_context_provider), | |
| 234 nullptr) {} | |
| 235 | |
| 236 ~VulkanOutputSurface() override { Destroy(); } | |
| 237 | |
| 238 bool Initialize(gfx::AcceleratedWidget widget) { | |
| 239 DCHECK(!surface_); | |
| 240 std::unique_ptr<gpu::VulkanSurface> surface( | |
| 241 gpu::VulkanSurface::CreateViewSurface(widget)); | |
| 242 if (!surface->Initialize(vulkan_context_provider()->GetDeviceQueue(), | |
| 243 gpu::VulkanSurface::DEFAULT_SURFACE_FORMAT)) { | |
| 244 return false; | |
| 245 } | |
| 246 surface_ = std::move(surface); | |
| 247 | |
| 248 return true; | |
| 249 } | |
| 250 | |
| 251 void SwapBuffers(cc::CompositorFrame* frame) override { | |
| 252 surface_->SwapBuffers(); | |
| 253 PostSwapBuffersComplete(); | |
| 254 client_->DidSwapBuffers(); | |
| 255 } | |
| 256 | |
| 257 void Destroy() { | |
| 258 if (surface_) { | |
| 259 surface_->Destroy(); | |
| 260 surface_.reset(); | |
| 261 } | |
| 262 } | |
| 263 | |
| 264 void OnSwapBuffersCompleted(const std::vector<ui::LatencyInfo>& latency_info, | |
| 265 gfx::SwapResult result) { | |
| 266 RenderWidgetHostImpl::CompositorFrameDrawn(latency_info); | |
| 267 OutputSurface::OnSwapBuffersComplete(); | |
| 268 } | |
| 269 | |
| 270 private: | |
| 271 std::unique_ptr<gpu::VulkanSurface> surface_; | |
| 272 | |
| 273 DISALLOW_COPY_AND_ASSIGN(VulkanOutputSurface); | |
| 274 }; | |
| 275 #endif | |
| 276 | |
| 277 base::LazyInstance<scoped_refptr<cc::VulkanInProcessContextProvider>> | |
| 278 g_shared_vulkan_context_provider_android_ = LAZY_INSTANCE_INITIALIZER; | |
| 279 | |
| 224 static bool g_initialized = false; | 280 static bool g_initialized = false; |
| 225 | 281 |
| 226 base::LazyInstance<cc::SurfaceManager> g_surface_manager = | 282 base::LazyInstance<cc::SurfaceManager> g_surface_manager = |
| 227 LAZY_INSTANCE_INITIALIZER; | 283 LAZY_INSTANCE_INITIALIZER; |
| 228 | 284 |
| 229 int g_surface_id_namespace = 0; | 285 int g_surface_id_namespace = 0; |
| 230 | 286 |
| 231 class SingleThreadTaskGraphRunner : public cc::SingleThreadTaskGraphRunner { | 287 class SingleThreadTaskGraphRunner : public cc::SingleThreadTaskGraphRunner { |
| 232 public: | 288 public: |
| 233 SingleThreadTaskGraphRunner() { | 289 SingleThreadTaskGraphRunner() { |
| (...skipping 36 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 270 std::unique_ptr<cc::SurfaceIdAllocator> | 326 std::unique_ptr<cc::SurfaceIdAllocator> |
| 271 CompositorImpl::CreateSurfaceIdAllocator() { | 327 CompositorImpl::CreateSurfaceIdAllocator() { |
| 272 std::unique_ptr<cc::SurfaceIdAllocator> allocator( | 328 std::unique_ptr<cc::SurfaceIdAllocator> allocator( |
| 273 new cc::SurfaceIdAllocator(++g_surface_id_namespace)); | 329 new cc::SurfaceIdAllocator(++g_surface_id_namespace)); |
| 274 cc::SurfaceManager* manager = GetSurfaceManager(); | 330 cc::SurfaceManager* manager = GetSurfaceManager(); |
| 275 DCHECK(manager); | 331 DCHECK(manager); |
| 276 allocator->RegisterSurfaceIdNamespace(manager); | 332 allocator->RegisterSurfaceIdNamespace(manager); |
| 277 return allocator; | 333 return allocator; |
| 278 } | 334 } |
| 279 | 335 |
| 336 // static | |
| 337 scoped_refptr<cc::VulkanInProcessContextProvider> | |
| 338 CompositorImpl::SharedVulkanContextProviderAndroid() { | |
| 339 if (base::CommandLine::ForCurrentProcess()->HasSwitch( | |
| 340 switches::kEnableVulkan)) { | |
| 341 scoped_refptr<cc::VulkanInProcessContextProvider>* context_provider = | |
| 342 g_shared_vulkan_context_provider_android_.Pointer(); | |
| 343 if (*context_provider == NULL) | |
| 344 *context_provider = cc::VulkanInProcessContextProvider::Create(); | |
| 345 return *context_provider; | |
| 346 } | |
| 347 return nullptr; | |
| 348 } | |
| 349 | |
| 280 CompositorImpl::CompositorImpl(CompositorClient* client, | 350 CompositorImpl::CompositorImpl(CompositorClient* client, |
| 281 gfx::NativeWindow root_window) | 351 gfx::NativeWindow root_window) |
| 282 : root_layer_(cc::Layer::Create()), | 352 : root_layer_(cc::Layer::Create()), |
| 283 surface_id_allocator_(CreateSurfaceIdAllocator()), | 353 surface_id_allocator_(CreateSurfaceIdAllocator()), |
| 284 resource_manager_(root_window), | 354 resource_manager_(root_window), |
| 285 has_transparent_background_(false), | 355 has_transparent_background_(false), |
| 286 device_scale_factor_(1), | 356 device_scale_factor_(1), |
| 287 window_(NULL), | 357 window_(NULL), |
| 288 surface_handle_(gpu::kNullSurfaceHandle), | 358 surface_handle_(gpu::kNullSurfaceHandle), |
| 289 client_(client), | 359 client_(client), |
| (...skipping 210 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 500 RequestNewOutputSurface(); | 570 RequestNewOutputSurface(); |
| 501 } | 571 } |
| 502 | 572 |
| 503 void CompositorImpl::CreateOutputSurface() { | 573 void CompositorImpl::CreateOutputSurface() { |
| 504 // We might have had a request from a LayerTreeHost that was then | 574 // We might have had a request from a LayerTreeHost that was then |
| 505 // hidden (and hidden means we don't have a native surface). | 575 // hidden (and hidden means we don't have a native surface). |
| 506 // Also make sure we only handle this once. | 576 // Also make sure we only handle this once. |
| 507 if (!output_surface_request_pending_ || !host_->visible()) | 577 if (!output_surface_request_pending_ || !host_->visible()) |
| 508 return; | 578 return; |
| 509 | 579 |
| 510 // This is used for the browser compositor (offscreen) and for the display | 580 scoped_refptr<ContextProviderCommandBuffer> context_provider; |
| 511 // compositor (onscreen), so ask for capabilities needed by either one. | 581 scoped_refptr<cc::VulkanInProcessContextProvider> vulkan_context_provider = |
| 512 // The default framebuffer for an offscreen context is not used, so it does | 582 SharedVulkanContextProviderAndroid(); |
| 513 // not need alpha, stencil, depth, antialiasing. The display compositor does | 583 std::unique_ptr<cc::OutputSurface> real_output_surface; |
| 514 // not use these things either, except for alpha when it has a transparent | 584 #if defined(ENABLE_VULKAN) |
| 515 // background. | 585 std::unique_ptr<VulkanOutputSurface> vulkan_surface; |
| 516 gpu::gles2::ContextCreationAttribHelper attributes; | 586 if (vulkan_context_provider) { |
| 517 attributes.alpha_size = -1; | 587 vulkan_surface.reset( |
| 518 attributes.stencil_size = 0; | 588 new VulkanOutputSurface(std::move(vulkan_context_provider))); |
| 519 attributes.depth_size = 0; | 589 if (!vulkan_surface->Initialize(window_)) { |
| 520 attributes.samples = 0; | 590 vulkan_surface->Destroy(); |
| 521 attributes.sample_buffers = 0; | 591 vulkan_surface.reset(); |
| 522 attributes.bind_generates_resource = false; | 592 } else { |
| 593 real_output_surface = std::move(vulkan_surface); | |
| 594 } | |
| 595 } | |
| 596 #endif | |
| 523 | 597 |
| 524 if (has_transparent_background_) { | 598 if (!real_output_surface) { |
| 525 attributes.alpha_size = 8; | 599 // This is used for the browser compositor (offscreen) and for the display |
| 526 } else if (base::SysInfo::IsLowEndDevice()) { | 600 // compositor (onscreen), so ask for capabilities needed by either one. |
| 527 // In this case we prefer to use RGB565 format instead of RGBA8888 if | 601 // The default framebuffer for an offscreen context is not used, so it does |
| 528 // possible. | 602 // not need alpha, stencil, depth, antialiasing. The display compositor does |
| 529 // TODO(danakj): GpuCommandBufferStub constructor checks for alpha == 0 in | 603 // 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 | 604 // background. |
| 531 // (IOW check that a <= 0 && rgb > 0 && rgb <= 565) then alpha should be -1. | 605 gpu::gles2::ContextCreationAttribHelper attributes; |
| 532 attributes.alpha_size = 0; | 606 attributes.alpha_size = -1; |
| 533 attributes.red_size = 5; | 607 attributes.stencil_size = 0; |
| 534 attributes.green_size = 6; | 608 attributes.depth_size = 0; |
| 535 attributes.blue_size = 5; | 609 attributes.samples = 0; |
| 610 attributes.sample_buffers = 0; | |
| 611 attributes.bind_generates_resource = false; | |
| 612 | |
| 613 if (has_transparent_background_) { | |
| 614 attributes.alpha_size = 8; | |
| 615 } else if (base::SysInfo::IsLowEndDevice()) { | |
| 616 // In this case we prefer to use RGB565 format instead of RGBA8888 if | |
| 617 // possible. | |
| 618 // TODO(danakj): GpuCommandBufferStub constructor checks for alpha == 0 in | |
| 619 // order to enable 565, but it should avoid using 565 when -1s are | |
| 620 // specified | |
| 621 // (IOW check that a <= 0 && rgb > 0 && rgb <= 565) then alpha should be | |
| 622 // -1. | |
| 623 attributes.alpha_size = 0; | |
| 624 attributes.red_size = 5; | |
| 625 attributes.green_size = 6; | |
| 626 attributes.blue_size = 5; | |
| 627 } | |
| 628 | |
| 629 DCHECK(window_); | |
| 630 DCHECK_NE(surface_handle_, gpu::kNullSurfaceHandle); | |
| 631 | |
| 632 BrowserGpuChannelHostFactory* factory = | |
| 633 BrowserGpuChannelHostFactory::instance(); | |
| 634 // This channel might be lost (and even if it isn't right now, it might | |
| 635 // still get marked as lost from the IO thread, at any point in time | |
| 636 // really). | |
| 637 // But from here on just try and always lead to either | |
| 638 // DidInitializeOutputSurface() or DidFailToInitializeOutputSurface(). | |
| 639 scoped_refptr<gpu::GpuChannelHost> gpu_channel_host( | |
| 640 factory->GetGpuChannel()); | |
| 641 | |
| 642 GURL url("chrome://gpu/CompositorImpl::CreateOutputSurface"); | |
| 643 constexpr bool automatic_flushes = false; | |
| 644 | |
| 645 constexpr size_t kBytesPerPixel = 4; | |
| 646 const size_t full_screen_texture_size_in_bytes = | |
| 647 gfx::DeviceDisplayInfo().GetDisplayHeight() * | |
| 648 gfx::DeviceDisplayInfo().GetDisplayWidth() * kBytesPerPixel; | |
| 649 | |
| 650 gpu::SharedMemoryLimits limits; | |
| 651 // This limit is meant to hold the contents of the display compositor | |
| 652 // drawing the scene. See discussion here: | |
| 653 // https://codereview.chromium.org/1900993002/diff/90001/content/browser/ren derer_host/compositor_impl_android.cc?context=3&column_width=80&tab_spaces=8 | |
| 654 limits.command_buffer_size = 64 * 1024; | |
| 655 // These limits are meant to hold the uploads for the browser UI without | |
| 656 // any excess space. | |
| 657 limits.start_transfer_buffer_size = 64 * 1024; | |
| 658 limits.min_transfer_buffer_size = 64 * 1024; | |
| 659 limits.max_transfer_buffer_size = full_screen_texture_size_in_bytes; | |
| 660 // Texture uploads may use mapped memory so give a reasonable limit for | |
| 661 // them. | |
| 662 limits.mapped_memory_reclaim_limit = full_screen_texture_size_in_bytes; | |
| 663 | |
| 664 context_provider = new ContextProviderCommandBuffer( | |
| 665 std::move(gpu_channel_host), surface_handle_, url, | |
| 666 gfx::PreferIntegratedGpu, automatic_flushes, limits, attributes, | |
| 667 nullptr, command_buffer_metrics::DISPLAY_COMPOSITOR_ONSCREEN_CONTEXT); | |
| 668 DCHECK(context_provider.get()); | |
| 669 | |
| 670 real_output_surface = base::WrapUnique(new OutputSurfaceWithoutParent( | |
| 671 this, context_provider, | |
| 672 base::Bind(&CompositorImpl::PopulateGpuCapabilities, | |
| 673 base::Unretained(this)), | |
| 674 base::WrapUnique(new ExternalBeginFrameSource(this)))); | |
| 536 } | 675 } |
| 537 | 676 |
| 538 pending_swapbuffers_ = 0; | |
|
piman
2016/05/06 17:17:29
I think this was lost in the rebase.
sohanjg
2016/05/09 05:37:07
Done.
| |
| 539 | |
| 540 DCHECK(window_); | |
| 541 DCHECK_NE(surface_handle_, gpu::kNullSurfaceHandle); | |
| 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 constexpr bool automatic_flushes = false; | |
| 553 | |
| 554 constexpr size_t kBytesPerPixel = 4; | |
| 555 const size_t full_screen_texture_size_in_bytes = | |
| 556 gfx::DeviceDisplayInfo().GetDisplayHeight() * | |
| 557 gfx::DeviceDisplayInfo().GetDisplayWidth() * kBytesPerPixel; | |
| 558 | |
| 559 gpu::SharedMemoryLimits limits; | |
| 560 // This limit is meant to hold the contents of the display compositor | |
| 561 // drawing the scene. See discussion here: | |
| 562 // https://codereview.chromium.org/1900993002/diff/90001/content/browser/rende rer_host/compositor_impl_android.cc?context=3&column_width=80&tab_spaces=8 | |
| 563 limits.command_buffer_size = 64 * 1024; | |
| 564 // These limits are meant to hold the uploads for the browser UI without | |
| 565 // any excess space. | |
| 566 limits.start_transfer_buffer_size = 64 * 1024; | |
| 567 limits.min_transfer_buffer_size = 64 * 1024; | |
| 568 limits.max_transfer_buffer_size = full_screen_texture_size_in_bytes; | |
| 569 // Texture uploads may use mapped memory so give a reasonable limit for them. | |
| 570 limits.mapped_memory_reclaim_limit = full_screen_texture_size_in_bytes; | |
| 571 | |
| 572 scoped_refptr<ContextProviderCommandBuffer> context_provider( | |
| 573 new ContextProviderCommandBuffer( | |
| 574 std::move(gpu_channel_host), surface_handle_, url, | |
| 575 gfx::PreferIntegratedGpu, automatic_flushes, limits, attributes, | |
| 576 nullptr, | |
| 577 command_buffer_metrics::DISPLAY_COMPOSITOR_ONSCREEN_CONTEXT)); | |
| 578 DCHECK(context_provider.get()); | |
| 579 | |
| 580 std::unique_ptr<cc::OutputSurface> real_output_surface( | |
| 581 new OutputSurfaceWithoutParent( | |
| 582 this, context_provider, | |
| 583 base::Bind(&CompositorImpl::PopulateGpuCapabilities, | |
| 584 base::Unretained(this)), | |
| 585 base::WrapUnique(new ExternalBeginFrameSource(this)))); | |
| 586 | |
| 587 cc::SurfaceManager* manager = GetSurfaceManager(); | 677 cc::SurfaceManager* manager = GetSurfaceManager(); |
| 588 display_client_.reset(new cc::OnscreenDisplayClient( | 678 display_client_.reset(new cc::OnscreenDisplayClient( |
| 589 std::move(real_output_surface), manager, | 679 std::move(real_output_surface), manager, |
| 590 HostSharedBitmapManager::current(), | 680 HostSharedBitmapManager::current(), |
| 591 BrowserGpuMemoryBufferManager::current(), | 681 BrowserGpuMemoryBufferManager::current(), |
| 592 host_->settings().renderer_settings, base::ThreadTaskRunnerHandle::Get(), | 682 host_->settings().renderer_settings, base::ThreadTaskRunnerHandle::Get(), |
| 593 surface_id_allocator_->id_namespace())); | 683 surface_id_allocator_->id_namespace())); |
| 684 | |
| 594 std::unique_ptr<cc::SurfaceDisplayOutputSurface> surface_output_surface( | 685 std::unique_ptr<cc::SurfaceDisplayOutputSurface> surface_output_surface( |
| 595 new cc::SurfaceDisplayOutputSurface(manager, surface_id_allocator_.get(), | 686 vulkan_context_provider |
| 596 context_provider, nullptr)); | 687 ? new cc::SurfaceDisplayOutputSurface( |
| 688 manager, surface_id_allocator_.get(), | |
| 689 static_cast<scoped_refptr<cc::VulkanContextProvider>>( | |
| 690 vulkan_context_provider)) | |
| 691 : new cc::SurfaceDisplayOutputSurface(manager, | |
| 692 surface_id_allocator_.get(), | |
| 693 context_provider, nullptr)); | |
| 597 | 694 |
| 598 display_client_->set_surface_output_surface(surface_output_surface.get()); | 695 display_client_->set_surface_output_surface(surface_output_surface.get()); |
| 599 surface_output_surface->set_display_client(display_client_.get()); | 696 surface_output_surface->set_display_client(display_client_.get()); |
| 600 display_client_->display()->Resize(size_); | 697 display_client_->display()->Resize(size_); |
| 601 host_->SetOutputSurface(std::move(surface_output_surface)); | 698 host_->SetOutputSurface(std::move(surface_output_surface)); |
| 602 } | 699 } |
| 603 | 700 |
| 604 void CompositorImpl::PopulateGpuCapabilities( | 701 void CompositorImpl::PopulateGpuCapabilities( |
| 605 gpu::Capabilities gpu_capabilities) { | 702 gpu::Capabilities gpu_capabilities) { |
| 606 gpu_capabilities_ = gpu_capabilities; | 703 gpu_capabilities_ = gpu_capabilities; |
| (...skipping 73 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 680 void CompositorImpl::SetNeedsAnimate() { | 777 void CompositorImpl::SetNeedsAnimate() { |
| 681 needs_animate_ = true; | 778 needs_animate_ = true; |
| 682 if (!host_->visible()) | 779 if (!host_->visible()) |
| 683 return; | 780 return; |
| 684 | 781 |
| 685 TRACE_EVENT0("compositor", "Compositor::SetNeedsAnimate"); | 782 TRACE_EVENT0("compositor", "Compositor::SetNeedsAnimate"); |
| 686 host_->SetNeedsAnimate(); | 783 host_->SetNeedsAnimate(); |
| 687 } | 784 } |
| 688 | 785 |
| 689 } // namespace content | 786 } // namespace content |
| OLD | NEW |