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

Side by Side Diff: content/browser/renderer_host/compositor_impl_android.cc

Issue 2629683002: Revert of android: Remove DeviceDisplayInfo usage from ComopsitorImpl (Closed)
Patch Set: Created 3 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 | « no previous file | 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 (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 #include <unordered_set> 10 #include <unordered_set>
(...skipping 48 matching lines...) Expand 10 before | Expand all | Expand 10 after
59 #include "gpu/command_buffer/client/gles2_interface.h" 59 #include "gpu/command_buffer/client/gles2_interface.h"
60 #include "gpu/ipc/client/command_buffer_proxy_impl.h" 60 #include "gpu/ipc/client/command_buffer_proxy_impl.h"
61 #include "gpu/ipc/client/gpu_channel_host.h" 61 #include "gpu/ipc/client/gpu_channel_host.h"
62 #include "gpu/ipc/common/gpu_surface_tracker.h" 62 #include "gpu/ipc/common/gpu_surface_tracker.h"
63 #include "gpu/vulkan/vulkan_surface.h" 63 #include "gpu/vulkan/vulkan_surface.h"
64 #include "services/ui/public/cpp/gpu/context_provider_command_buffer.h" 64 #include "services/ui/public/cpp/gpu/context_provider_command_buffer.h"
65 #include "third_party/khronos/GLES2/gl2.h" 65 #include "third_party/khronos/GLES2/gl2.h"
66 #include "third_party/khronos/GLES2/gl2ext.h" 66 #include "third_party/khronos/GLES2/gl2ext.h"
67 #include "third_party/skia/include/core/SkMallocPixelRef.h" 67 #include "third_party/skia/include/core/SkMallocPixelRef.h"
68 #include "ui/android/window_android.h" 68 #include "ui/android/window_android.h"
69 #include "ui/display/display.h" 69 #include "ui/gfx/android/device_display_info.h"
70 #include "ui/display/screen.h"
71 #include "ui/gfx/swap_result.h" 70 #include "ui/gfx/swap_result.h"
72 71
73 namespace gpu { 72 namespace gpu {
74 struct GpuProcessHostedCALayerTreeParamsMac; 73 struct GpuProcessHostedCALayerTreeParamsMac;
75 } 74 }
76 75
77 namespace content { 76 namespace content {
78 77
79 namespace { 78 namespace {
80 79
81 const unsigned int kMaxDisplaySwapBuffers = 1U; 80 const unsigned int kMaxDisplaySwapBuffers = 1U;
82 81
83 gpu::SharedMemoryLimits GetCompositorContextSharedMemoryLimits( 82 gpu::SharedMemoryLimits GetCompositorContextSharedMemoryLimits() {
84 gfx::NativeWindow window) {
85 constexpr size_t kBytesPerPixel = 4; 83 constexpr size_t kBytesPerPixel = 4;
86 const gfx::Size size = display::Screen::GetScreen()
87 ->GetDisplayNearestWindow(window)
88 .GetSizeInPixel();
89 const size_t full_screen_texture_size_in_bytes = 84 const size_t full_screen_texture_size_in_bytes =
90 size.width() * size.height() * kBytesPerPixel; 85 gfx::DeviceDisplayInfo().GetDisplayHeight() *
86 gfx::DeviceDisplayInfo().GetDisplayWidth() * kBytesPerPixel;
91 87
92 gpu::SharedMemoryLimits limits; 88 gpu::SharedMemoryLimits limits;
93 // This limit is meant to hold the contents of the display compositor 89 // This limit is meant to hold the contents of the display compositor
94 // drawing the scene. See discussion here: 90 // drawing the scene. See discussion here:
95 // https://codereview.chromium.org/1900993002/diff/90001/content/browser/rende rer_host/compositor_impl_android.cc?context=3&column_width=80&tab_spaces=8 91 // https://codereview.chromium.org/1900993002/diff/90001/content/browser/rende rer_host/compositor_impl_android.cc?context=3&column_width=80&tab_spaces=8
96 limits.command_buffer_size = 64 * 1024; 92 limits.command_buffer_size = 64 * 1024;
97 // These limits are meant to hold the uploads for the browser UI without 93 // These limits are meant to hold the uploads for the browser UI without
98 // any excess space. 94 // any excess space.
99 limits.start_transfer_buffer_size = 64 * 1024; 95 limits.start_transfer_buffer_size = 64 * 1024;
100 limits.min_transfer_buffer_size = 64 * 1024; 96 limits.min_transfer_buffer_size = 64 * 1024;
(...skipping 499 matching lines...) Expand 10 before | Expand all | Expand 10 after
600 case ui::ContextProviderFactory::GpuChannelHostResult::SUCCESS: 596 case ui::ContextProviderFactory::GpuChannelHostResult::SUCCESS:
601 // We don't need the context anymore if we are invisible. 597 // We don't need the context anymore if we are invisible.
602 if (!host_->IsVisible()) 598 if (!host_->IsVisible())
603 return; 599 return;
604 600
605 DCHECK(window_); 601 DCHECK(window_);
606 DCHECK_NE(surface_handle_, gpu::kNullSurfaceHandle); 602 DCHECK_NE(surface_handle_, gpu::kNullSurfaceHandle);
607 scoped_refptr<cc::ContextProvider> context_provider = 603 scoped_refptr<cc::ContextProvider> context_provider =
608 ContextProviderFactoryImpl::GetInstance() 604 ContextProviderFactoryImpl::GetInstance()
609 ->CreateDisplayContextProvider( 605 ->CreateDisplayContextProvider(
610 surface_handle_, 606 surface_handle_, GetCompositorContextSharedMemoryLimits(),
611 GetCompositorContextSharedMemoryLimits(root_window_),
612 GetCompositorContextAttributes(has_transparent_background_), 607 GetCompositorContextAttributes(has_transparent_background_),
613 false /*support_locking*/, false /*automatic_flushes*/, 608 false /*support_locking*/, false /*automatic_flushes*/,
614 std::move(gpu_channel_host)); 609 std::move(gpu_channel_host));
615 if (!context_provider->BindToCurrentThread()) { 610 if (!context_provider->BindToCurrentThread()) {
616 LOG(ERROR) << "Failed to init ContextProvider for compositor."; 611 LOG(ERROR) << "Failed to init ContextProvider for compositor.";
617 LOG_IF(FATAL, ++num_successive_context_creation_failures_ >= 2) 612 LOG_IF(FATAL, ++num_successive_context_creation_failures_ >= 2)
618 << "Too many context creation failures. Giving up... "; 613 << "Too many context creation failures. Giving up... ";
619 HandlePendingCompositorFrameSinkRequest(); 614 HandlePendingCompositorFrameSinkRequest();
620 break; 615 break;
621 } 616 }
(...skipping 110 matching lines...) Expand 10 before | Expand all | Expand 10 after
732 727
733 cc::FrameSinkId CompositorImpl::GetFrameSinkId() { 728 cc::FrameSinkId CompositorImpl::GetFrameSinkId() {
734 return frame_sink_id_; 729 return frame_sink_id_;
735 } 730 }
736 731
737 bool CompositorImpl::HavePendingReadbacks() { 732 bool CompositorImpl::HavePendingReadbacks() {
738 return !readback_layer_tree_->children().empty(); 733 return !readback_layer_tree_->children().empty();
739 } 734 }
740 735
741 } // namespace content 736 } // namespace content
OLDNEW
« no previous file with comments | « no previous file | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698