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

Side by Side Diff: content/renderer/render_widget.cc

Issue 2009443002: Revert of Consolidate OutputSurface constructors into GL vs Vulkan. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Created 4 years, 6 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/renderer/render_widget.h" 5 #include "content/renderer/render_widget.h"
6 6
7 #include <memory> 7 #include <memory>
8 #include <utility> 8 #include <utility>
9 9
10 #include "base/auto_reset.h" 10 #include "base/auto_reset.h"
(...skipping 29 matching lines...) Expand all
40 #include "content/common/swapped_out_messages.h" 40 #include "content/common/swapped_out_messages.h"
41 #include "content/common/text_input_state.h" 41 #include "content/common/text_input_state.h"
42 #include "content/common/view_messages.h" 42 #include "content/common/view_messages.h"
43 #include "content/public/common/content_features.h" 43 #include "content/public/common/content_features.h"
44 #include "content/public/common/content_switches.h" 44 #include "content/public/common/content_switches.h"
45 #include "content/public/common/context_menu_params.h" 45 #include "content/public/common/context_menu_params.h"
46 #include "content/renderer/cursor_utils.h" 46 #include "content/renderer/cursor_utils.h"
47 #include "content/renderer/devtools/render_widget_screen_metrics_emulator.h" 47 #include "content/renderer/devtools/render_widget_screen_metrics_emulator.h"
48 #include "content/renderer/external_popup_menu.h" 48 #include "content/renderer/external_popup_menu.h"
49 #include "content/renderer/gpu/compositor_output_surface.h" 49 #include "content/renderer/gpu/compositor_output_surface.h"
50 #include "content/renderer/gpu/delegated_compositor_output_surface.h"
50 #include "content/renderer/gpu/frame_swap_message_queue.h" 51 #include "content/renderer/gpu/frame_swap_message_queue.h"
51 #include "content/renderer/gpu/mailbox_output_surface.h" 52 #include "content/renderer/gpu/mailbox_output_surface.h"
52 #include "content/renderer/gpu/queue_message_swap_promise.h" 53 #include "content/renderer/gpu/queue_message_swap_promise.h"
53 #include "content/renderer/gpu/render_widget_compositor.h" 54 #include "content/renderer/gpu/render_widget_compositor.h"
54 #include "content/renderer/ime_event_guard.h" 55 #include "content/renderer/ime_event_guard.h"
55 #include "content/renderer/input/input_handler_manager.h" 56 #include "content/renderer/input/input_handler_manager.h"
56 #include "content/renderer/pepper/pepper_plugin_instance_impl.h" 57 #include "content/renderer/pepper/pepper_plugin_instance_impl.h"
57 #include "content/renderer/render_frame_impl.h" 58 #include "content/renderer/render_frame_impl.h"
58 #include "content/renderer/render_frame_proxy.h" 59 #include "content/renderer/render_frame_proxy.h"
59 #include "content/renderer/render_process.h" 60 #include "content/renderer/render_process.h"
(...skipping 658 matching lines...) Expand 10 before | Expand all | Expand 10 after
718 return connection->CreateOutputSurface(); 719 return connection->CreateOutputSurface();
719 } 720 }
720 #endif 721 #endif
721 722
722 uint32_t output_surface_id = next_output_surface_id_++; 723 uint32_t output_surface_id = next_output_surface_id_++;
723 724
724 if (command_line.HasSwitch(switches::kEnableVulkan)) { 725 if (command_line.HasSwitch(switches::kEnableVulkan)) {
725 scoped_refptr<cc::VulkanContextProvider> vulkan_context_provider = 726 scoped_refptr<cc::VulkanContextProvider> vulkan_context_provider =
726 cc::VulkanInProcessContextProvider::Create(); 727 cc::VulkanInProcessContextProvider::Create();
727 if (vulkan_context_provider) { 728 if (vulkan_context_provider) {
728 return base::WrapUnique(new CompositorOutputSurface( 729 return base::WrapUnique(new DelegatedCompositorOutputSurface(
729 routing_id(), output_surface_id, vulkan_context_provider, 730 routing_id(), output_surface_id, nullptr, nullptr,
730 frame_swap_message_queue_)); 731 vulkan_context_provider, frame_swap_message_queue_));
731 } 732 }
732 } 733 }
733 734
734 // Create a gpu process channel and verify we want to use GPU compositing 735 // Create a gpu process channel and verify we want to use GPU compositing
735 // before creating any context providers. 736 // before creating any context providers.
736 scoped_refptr<gpu::GpuChannelHost> gpu_channel_host; 737 scoped_refptr<gpu::GpuChannelHost> gpu_channel_host;
737 if (!use_software) { 738 if (!use_software) {
738 gpu_channel_host = RenderThreadImpl::current()->EstablishGpuChannelSync( 739 gpu_channel_host = RenderThreadImpl::current()->EstablishGpuChannelSync(
739 CAUSE_FOR_GPU_LAUNCH_RENDERER_VERIFY_GPU_COMPOSITING); 740 CAUSE_FOR_GPU_LAUNCH_RENDERER_VERIFY_GPU_COMPOSITING);
740 if (!gpu_channel_host) { 741 if (!gpu_channel_host) {
741 // Cause the compositor to wait and try again. 742 // Cause the compositor to wait and try again.
742 return nullptr; 743 return nullptr;
743 } 744 }
744 // We may get a valid channel, but with a software renderer. In that case, 745 // We may get a valid channel, but with a software renderer. In that case,
745 // disable GPU compositing. 746 // disable GPU compositing.
746 if (gpu_channel_host->gpu_info().software_rendering) 747 if (gpu_channel_host->gpu_info().software_rendering)
747 use_software = true; 748 use_software = true;
748 } 749 }
749 750
750 if (use_software) { 751 if (use_software) {
751 return base::WrapUnique( 752 return base::WrapUnique(new DelegatedCompositorOutputSurface(
752 new CompositorOutputSurface(routing_id(), output_surface_id, nullptr, 753 routing_id(), output_surface_id, nullptr, nullptr, nullptr,
753 nullptr, frame_swap_message_queue_)); 754 frame_swap_message_queue_));
754 } 755 }
755 756
756 scoped_refptr<ContextProviderCommandBuffer> worker_context_provider = 757 scoped_refptr<ContextProviderCommandBuffer> worker_context_provider =
757 RenderThreadImpl::current()->SharedCompositorWorkerContextProvider(); 758 RenderThreadImpl::current()->SharedCompositorWorkerContextProvider();
758 if (!worker_context_provider) { 759 if (!worker_context_provider) {
759 // Cause the compositor to wait and try again. 760 // Cause the compositor to wait and try again.
760 return nullptr; 761 return nullptr;
761 } 762 }
762 763
763 // The renderer compositor context doesn't do a lot of stuff, so we don't 764 // The renderer compositor context doesn't do a lot of stuff, so we don't
(...skipping 36 matching lines...) Expand 10 before | Expand all | Expand 10 after
800 output_surface_id, 801 output_surface_id,
801 RenderThreadImpl::current()->sync_compositor_message_filter(), 802 RenderThreadImpl::current()->sync_compositor_message_filter(),
802 frame_swap_message_queue_)); 803 frame_swap_message_queue_));
803 } 804 }
804 #endif 805 #endif
805 806
806 // Composite-to-mailbox is currently used for layout tests in order to cause 807 // Composite-to-mailbox is currently used for layout tests in order to cause
807 // them to draw inside in the renderer to do the readback there. This should 808 // them to draw inside in the renderer to do the readback there. This should
808 // no longer be the case when crbug.com/311404 is fixed. 809 // no longer be the case when crbug.com/311404 is fixed.
809 if (RenderThreadImpl::current()->layout_test_mode()) { 810 if (RenderThreadImpl::current()->layout_test_mode()) {
810 return base::MakeUnique<MailboxOutputSurface>( 811 return base::WrapUnique(new MailboxOutputSurface(
811 output_surface_id, std::move(context_provider), 812 routing_id(), output_surface_id, std::move(context_provider),
812 std::move(worker_context_provider)); 813 std::move(worker_context_provider), frame_swap_message_queue_,
814 cc::RGBA_8888));
813 } 815 }
814 816
815 return base::WrapUnique(new CompositorOutputSurface( 817 return base::WrapUnique(new DelegatedCompositorOutputSurface(
816 routing_id(), output_surface_id, std::move(context_provider), 818 routing_id(), output_surface_id, std::move(context_provider),
817 std::move(worker_context_provider), frame_swap_message_queue_)); 819 std::move(worker_context_provider), nullptr, frame_swap_message_queue_));
818 } 820 }
819 821
820 std::unique_ptr<cc::BeginFrameSource> 822 std::unique_ptr<cc::BeginFrameSource>
821 RenderWidget::CreateExternalBeginFrameSource() { 823 RenderWidget::CreateExternalBeginFrameSource() {
822 return compositor_deps_->CreateExternalBeginFrameSource(routing_id_); 824 return compositor_deps_->CreateExternalBeginFrameSource(routing_id_);
823 } 825 }
824 826
825 void RenderWidget::DidCommitAndDrawCompositorFrame() { 827 void RenderWidget::DidCommitAndDrawCompositorFrame() {
826 // NOTE: Tests may break if this event is renamed or moved. See 828 // NOTE: Tests may break if this event is renamed or moved. See
827 // tab_capture_performancetest.cc. 829 // tab_capture_performancetest.cc.
(...skipping 1262 matching lines...) Expand 10 before | Expand all | Expand 10 after
2090 } 2092 }
2091 2093
2092 float RenderWidget::GetOriginalDeviceScaleFactor() const { 2094 float RenderWidget::GetOriginalDeviceScaleFactor() const {
2093 return 2095 return
2094 screen_metrics_emulator_ ? 2096 screen_metrics_emulator_ ?
2095 screen_metrics_emulator_->original_screen_info().deviceScaleFactor : 2097 screen_metrics_emulator_->original_screen_info().deviceScaleFactor :
2096 device_scale_factor_; 2098 device_scale_factor_;
2097 } 2099 }
2098 2100
2099 } // namespace content 2101 } // namespace content
OLDNEW
« no previous file with comments | « content/renderer/gpu/mailbox_output_surface.cc ('k') | ui/compositor/test/in_process_context_factory.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698