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

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

Issue 2881813002: Revert of gpu: GPU service scheduler. (Closed)
Patch Set: 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 (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 36 matching lines...) Expand 10 before | Expand all | Expand 10 after
47 #include "cc/trees/layer_tree_host.h" 47 #include "cc/trees/layer_tree_host.h"
48 #include "cc/trees/layer_tree_settings.h" 48 #include "cc/trees/layer_tree_settings.h"
49 #include "components/display_compositor/compositor_overlay_candidate_validator_a ndroid.h" 49 #include "components/display_compositor/compositor_overlay_candidate_validator_a ndroid.h"
50 #include "components/display_compositor/gl_helper.h" 50 #include "components/display_compositor/gl_helper.h"
51 #include "components/display_compositor/host_shared_bitmap_manager.h" 51 #include "components/display_compositor/host_shared_bitmap_manager.h"
52 #include "content/browser/compositor/frame_sink_manager_host.h" 52 #include "content/browser/compositor/frame_sink_manager_host.h"
53 #include "content/browser/gpu/browser_gpu_channel_host_factory.h" 53 #include "content/browser/gpu/browser_gpu_channel_host_factory.h"
54 #include "content/browser/gpu/browser_gpu_memory_buffer_manager.h" 54 #include "content/browser/gpu/browser_gpu_memory_buffer_manager.h"
55 #include "content/browser/gpu/compositor_util.h" 55 #include "content/browser/gpu/compositor_util.h"
56 #include "content/browser/renderer_host/render_widget_host_impl.h" 56 #include "content/browser/renderer_host/render_widget_host_impl.h"
57 #include "content/common/gpu_stream_constants.h"
58 #include "content/public/browser/android/compositor.h" 57 #include "content/public/browser/android/compositor.h"
59 #include "content/public/browser/android/compositor_client.h" 58 #include "content/public/browser/android/compositor_client.h"
60 #include "content/public/common/content_switches.h" 59 #include "content/public/common/content_switches.h"
61 #include "gpu/command_buffer/client/context_support.h" 60 #include "gpu/command_buffer/client/context_support.h"
62 #include "gpu/command_buffer/client/gles2_interface.h" 61 #include "gpu/command_buffer/client/gles2_interface.h"
63 #include "gpu/ipc/client/command_buffer_proxy_impl.h" 62 #include "gpu/ipc/client/command_buffer_proxy_impl.h"
64 #include "gpu/ipc/client/gpu_channel_host.h" 63 #include "gpu/ipc/client/gpu_channel_host.h"
65 #include "gpu/ipc/common/gpu_surface_tracker.h" 64 #include "gpu/ipc/common/gpu_surface_tracker.h"
66 #include "gpu/vulkan/features.h" 65 #include "gpu/vulkan/features.h"
67 #include "gpu/vulkan/vulkan_surface.h" 66 #include "gpu/vulkan/vulkan_surface.h"
(...skipping 129 matching lines...) Expand 10 before | Expand all | Expand 10 after
197 196
198 void CreateContextProviderAfterGpuChannelEstablished( 197 void CreateContextProviderAfterGpuChannelEstablished(
199 gpu::SurfaceHandle handle, 198 gpu::SurfaceHandle handle,
200 gpu::gles2::ContextCreationAttribHelper attributes, 199 gpu::gles2::ContextCreationAttribHelper attributes,
201 gpu::SharedMemoryLimits shared_memory_limits, 200 gpu::SharedMemoryLimits shared_memory_limits,
202 Compositor::ContextProviderCallback callback, 201 Compositor::ContextProviderCallback callback,
203 scoped_refptr<gpu::GpuChannelHost> gpu_channel_host) { 202 scoped_refptr<gpu::GpuChannelHost> gpu_channel_host) {
204 if (!gpu_channel_host) 203 if (!gpu_channel_host)
205 callback.Run(nullptr); 204 callback.Run(nullptr);
206 205
207 int32_t stream_id = kGpuStreamIdDefault;
208 gpu::SchedulingPriority stream_priority = kGpuStreamPriorityUI;
209
210 constexpr bool automatic_flushes = false; 206 constexpr bool automatic_flushes = false;
211 constexpr bool support_locking = false; 207 constexpr bool support_locking = false;
212
213 scoped_refptr<ui::ContextProviderCommandBuffer> context_provider = 208 scoped_refptr<ui::ContextProviderCommandBuffer> context_provider =
214 new ui::ContextProviderCommandBuffer( 209 new ui::ContextProviderCommandBuffer(
215 std::move(gpu_channel_host), stream_id, stream_priority, handle, 210 std::move(gpu_channel_host), gpu::GPU_STREAM_DEFAULT,
211 gpu::GpuStreamPriority::NORMAL, handle,
216 GURL(std::string("chrome://gpu/Compositor::CreateContextProvider")), 212 GURL(std::string("chrome://gpu/Compositor::CreateContextProvider")),
217 automatic_flushes, support_locking, shared_memory_limits, attributes, 213 automatic_flushes, support_locking, shared_memory_limits, attributes,
218 nullptr /* shared_context */, 214 nullptr /* shared_context */,
219 ui::command_buffer_metrics::CONTEXT_TYPE_UNKNOWN); 215 ui::command_buffer_metrics::CONTEXT_TYPE_UNKNOWN);
220 callback.Run(std::move(context_provider)); 216 callback.Run(std::move(context_provider));
221 } 217 }
222 218
223 class AndroidOutputSurface : public cc::OutputSurface { 219 class AndroidOutputSurface : public cc::OutputSurface {
224 public: 220 public:
225 AndroidOutputSurface( 221 AndroidOutputSurface(
(...skipping 490 matching lines...) Expand 10 before | Expand all | Expand 10 after
716 HandlePendingCompositorFrameSinkRequest(); 712 HandlePendingCompositorFrameSinkRequest();
717 return; 713 return;
718 } 714 }
719 715
720 // We don't need the context anymore if we are invisible. 716 // We don't need the context anymore if we are invisible.
721 if (!host_->IsVisible()) 717 if (!host_->IsVisible())
722 return; 718 return;
723 719
724 DCHECK(window_); 720 DCHECK(window_);
725 DCHECK_NE(surface_handle_, gpu::kNullSurfaceHandle); 721 DCHECK_NE(surface_handle_, gpu::kNullSurfaceHandle);
726
727 int32_t stream_id = kGpuStreamIdDefault;
728 gpu::SchedulingPriority stream_priority = kGpuStreamPriorityUI;
729
730 constexpr bool support_locking = false; 722 constexpr bool support_locking = false;
731 constexpr bool automatic_flushes = false; 723 constexpr bool automatic_flushes = false;
732
733 ui::ContextProviderCommandBuffer* shared_context = nullptr; 724 ui::ContextProviderCommandBuffer* shared_context = nullptr;
734 scoped_refptr<ui::ContextProviderCommandBuffer> context_provider = 725 scoped_refptr<ui::ContextProviderCommandBuffer> context_provider =
735 new ui::ContextProviderCommandBuffer( 726 new ui::ContextProviderCommandBuffer(
736 std::move(gpu_channel_host), stream_id, stream_priority, 727 std::move(gpu_channel_host), gpu::GPU_STREAM_DEFAULT,
737 surface_handle_, 728 gpu::GpuStreamPriority::NORMAL, surface_handle_,
738 GURL(std::string("chrome://gpu/CompositorImpl::") + 729 GURL(std::string("chrome://gpu/CompositorImpl::") +
739 std::string("CompositorContextProvider")), 730 std::string("CompositorContextProvider")),
740 automatic_flushes, support_locking, 731 automatic_flushes, support_locking,
741 GetCompositorContextSharedMemoryLimits(root_window_), 732 GetCompositorContextSharedMemoryLimits(root_window_),
742 GetCompositorContextAttributes(has_transparent_background_), 733 GetCompositorContextAttributes(has_transparent_background_),
743 shared_context, 734 shared_context,
744 ui::command_buffer_metrics::DISPLAY_COMPOSITOR_ONSCREEN_CONTEXT); 735 ui::command_buffer_metrics::DISPLAY_COMPOSITOR_ONSCREEN_CONTEXT);
745 if (!context_provider->BindToCurrentThread()) { 736 if (!context_provider->BindToCurrentThread()) {
746 LOG(ERROR) << "Failed to init ContextProvider for compositor."; 737 LOG(ERROR) << "Failed to init ContextProvider for compositor.";
747 LOG_IF(FATAL, ++num_successive_context_creation_failures_ >= 2) 738 LOG_IF(FATAL, ++num_successive_context_creation_failures_ >= 2)
(...skipping 134 matching lines...) Expand 10 before | Expand all | Expand 10 after
882 } 873 }
883 GetSurfaceManager()->UnregisterFrameSinkHierarchy(frame_sink_id_, 874 GetSurfaceManager()->UnregisterFrameSinkHierarchy(frame_sink_id_,
884 frame_sink_id); 875 frame_sink_id);
885 } 876 }
886 877
887 bool CompositorImpl::HavePendingReadbacks() { 878 bool CompositorImpl::HavePendingReadbacks() {
888 return !readback_layer_tree_->children().empty(); 879 return !readback_layer_tree_->children().empty();
889 } 880 }
890 881
891 } // namespace content 882 } // namespace content
OLDNEW
« no previous file with comments | « content/browser/gpu/gpu_ipc_browsertests.cc ('k') | content/browser/renderer_host/render_widget_host_view_android.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698