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 531 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
542 | 542 |
543 BrowserGpuChannelHostFactory* factory = | 543 BrowserGpuChannelHostFactory* factory = |
544 BrowserGpuChannelHostFactory::instance(); | 544 BrowserGpuChannelHostFactory::instance(); |
545 // This channel might be lost (and even if it isn't right now, it might | 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). | 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 | 547 // But from here on just try and always lead to either |
548 // DidInitializeOutputSurface() or DidFailToInitializeOutputSurface(). | 548 // DidInitializeOutputSurface() or DidFailToInitializeOutputSurface(). |
549 scoped_refptr<gpu::GpuChannelHost> gpu_channel_host(factory->GetGpuChannel()); | 549 scoped_refptr<gpu::GpuChannelHost> gpu_channel_host(factory->GetGpuChannel()); |
550 | 550 |
551 GURL url("chrome://gpu/CompositorImpl::CreateOutputSurface"); | 551 GURL url("chrome://gpu/CompositorImpl::CreateOutputSurface"); |
552 constexpr bool share_resources = false; | |
553 constexpr bool automatic_flushes = false; | 552 constexpr bool automatic_flushes = false; |
554 | 553 |
555 constexpr size_t kBytesPerPixel = 4; | 554 constexpr size_t kBytesPerPixel = 4; |
556 const size_t full_screen_texture_size_in_bytes = | 555 const size_t full_screen_texture_size_in_bytes = |
557 gfx::DeviceDisplayInfo().GetDisplayHeight() * | 556 gfx::DeviceDisplayInfo().GetDisplayHeight() * |
558 gfx::DeviceDisplayInfo().GetDisplayWidth() * kBytesPerPixel; | 557 gfx::DeviceDisplayInfo().GetDisplayWidth() * kBytesPerPixel; |
559 | 558 |
560 gpu::SharedMemoryLimits limits; | 559 gpu::SharedMemoryLimits limits; |
561 // This limit is meant to hold the contents of the display compositor | 560 // This limit is meant to hold the contents of the display compositor |
562 // drawing the scene. See discussion here: | 561 // drawing the scene. See discussion here: |
563 // https://codereview.chromium.org/1900993002/diff/90001/content/browser/rende
rer_host/compositor_impl_android.cc?context=3&column_width=80&tab_spaces=8 | 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 |
564 limits.command_buffer_size = 64 * 1024; | 563 limits.command_buffer_size = 64 * 1024; |
565 // These limits are meant to hold the uploads for the browser UI without | 564 // These limits are meant to hold the uploads for the browser UI without |
566 // any excess space. | 565 // any excess space. |
567 limits.start_transfer_buffer_size = 64 * 1024; | 566 limits.start_transfer_buffer_size = 64 * 1024; |
568 limits.min_transfer_buffer_size = 64 * 1024; | 567 limits.min_transfer_buffer_size = 64 * 1024; |
569 limits.max_transfer_buffer_size = full_screen_texture_size_in_bytes; | 568 limits.max_transfer_buffer_size = full_screen_texture_size_in_bytes; |
570 // Texture uploads may use mapped memory so give a reasonable limit for them. | 569 // Texture uploads may use mapped memory so give a reasonable limit for them. |
571 limits.mapped_memory_reclaim_limit = full_screen_texture_size_in_bytes; | 570 limits.mapped_memory_reclaim_limit = full_screen_texture_size_in_bytes; |
572 | 571 |
573 scoped_refptr<ContextProviderCommandBuffer> context_provider( | 572 scoped_refptr<ContextProviderCommandBuffer> context_provider( |
574 new ContextProviderCommandBuffer( | 573 new ContextProviderCommandBuffer( |
575 base::WrapUnique(new WebGraphicsContext3DCommandBufferImpl( | 574 base::WrapUnique(new WebGraphicsContext3DCommandBufferImpl( |
576 surface_handle_, url, gpu_channel_host.get(), attributes, | 575 surface_handle_, url, gpu_channel_host.get(), attributes, |
577 gfx::PreferIntegratedGpu, share_resources, automatic_flushes, | 576 gfx::PreferIntegratedGpu, automatic_flushes)), |
578 nullptr)), | 577 limits, nullptr, DISPLAY_COMPOSITOR_ONSCREEN_CONTEXT)); |
579 limits, DISPLAY_COMPOSITOR_ONSCREEN_CONTEXT)); | |
580 DCHECK(context_provider.get()); | 578 DCHECK(context_provider.get()); |
581 | 579 |
582 std::unique_ptr<cc::OutputSurface> real_output_surface( | 580 std::unique_ptr<cc::OutputSurface> real_output_surface( |
583 new OutputSurfaceWithoutParent( | 581 new OutputSurfaceWithoutParent( |
584 this, context_provider, | 582 this, context_provider, |
585 base::Bind(&CompositorImpl::PopulateGpuCapabilities, | 583 base::Bind(&CompositorImpl::PopulateGpuCapabilities, |
586 base::Unretained(this)), | 584 base::Unretained(this)), |
587 base::WrapUnique(new ExternalBeginFrameSource(this)))); | 585 base::WrapUnique(new ExternalBeginFrameSource(this)))); |
588 | 586 |
589 cc::SurfaceManager* manager = GetSurfaceManager(); | 587 cc::SurfaceManager* manager = GetSurfaceManager(); |
(...skipping 92 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
682 void CompositorImpl::SetNeedsAnimate() { | 680 void CompositorImpl::SetNeedsAnimate() { |
683 needs_animate_ = true; | 681 needs_animate_ = true; |
684 if (!host_->visible()) | 682 if (!host_->visible()) |
685 return; | 683 return; |
686 | 684 |
687 TRACE_EVENT0("compositor", "Compositor::SetNeedsAnimate"); | 685 TRACE_EVENT0("compositor", "Compositor::SetNeedsAnimate"); |
688 host_->SetNeedsAnimate(); | 686 host_->SetNeedsAnimate(); |
689 } | 687 } |
690 | 688 |
691 } // namespace content | 689 } // namespace content |
OLD | NEW |