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

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

Issue 212103005: Retry gpu compositing when fallback is not true. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: retry-gpu-compositing: Created 6 years, 9 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 | Annotate | Revision Log
« 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/renderer/render_widget.h" 5 #include "content/renderer/render_widget.h"
6 6
7 #include "base/bind.h" 7 #include "base/bind.h"
8 #include "base/command_line.h" 8 #include "base/command_line.h"
9 #include "base/debug/trace_event.h" 9 #include "base/debug/trace_event.h"
10 #include "base/debug/trace_event_synthetic_delay.h" 10 #include "base/debug/trace_event_synthetic_delay.h"
(...skipping 890 matching lines...) Expand 10 before | Expand all | Expand 10 after
901 901
902 scoped_ptr<cc::OutputSurface> RenderWidget::CreateOutputSurface(bool fallback) { 902 scoped_ptr<cc::OutputSurface> RenderWidget::CreateOutputSurface(bool fallback) {
903 903
904 #if defined(OS_ANDROID) 904 #if defined(OS_ANDROID)
905 if (SynchronousCompositorFactory* factory = 905 if (SynchronousCompositorFactory* factory =
906 SynchronousCompositorFactory::GetInstance()) { 906 SynchronousCompositorFactory::GetInstance()) {
907 return factory->CreateOutputSurface(routing_id()); 907 return factory->CreateOutputSurface(routing_id());
908 } 908 }
909 #endif 909 #endif
910 910
911 // Explicitly disable antialiasing for the compositor. As of the time of 911 const CommandLine& command_line = *CommandLine::ForCurrentProcess();
912 // this writing, the only platform that supported antialiasing for the 912 bool use_software = fallback;
913 // compositor was Mac OS X, because the on-screen OpenGL context creation 913 if (command_line.HasSwitch(switches::kDisableGpuCompositing))
914 // code paths on Windows and Linux didn't yet have multisampling support. 914 use_software = true;
915 // Mac OS X essentially always behaves as though it's rendering offscreen.
916 // Multisampling has a heavy cost especially on devices with relatively low
917 // fill rate like most notebooks, and the Mac implementation would need to
918 // be optimized to resolve directly into the IOSurface shared between the
919 // GPU and browser processes. For these reasons and to avoid platform
920 // disparities we explicitly disable antialiasing.
921 blink::WebGraphicsContext3D::Attributes attributes;
922 attributes.antialias = false;
923 attributes.shareResources = true;
924 attributes.noAutomaticFlushes = true;
925 attributes.depth = false;
926 attributes.stencil = false;
927 915
928 const CommandLine& command_line = *CommandLine::ForCurrentProcess();
929 scoped_refptr<ContextProviderCommandBuffer> context_provider; 916 scoped_refptr<ContextProviderCommandBuffer> context_provider;
930 if (!fallback) { 917 if (!use_software) {
918 // Explicitly disable antialiasing for the compositor. As of the time of
919 // this writing, the only platform that supported antialiasing for the
920 // compositor was Mac OS X, because the on-screen OpenGL context creation
921 // code paths on Windows and Linux didn't yet have multisampling support.
922 // Mac OS X essentially always behaves as though it's rendering offscreen.
923 // Multisampling has a heavy cost especially on devices with relatively low
924 // fill rate like most notebooks, and the Mac implementation would need to
925 // be optimized to resolve directly into the IOSurface shared between the
926 // GPU and browser processes. For these reasons and to avoid platform
927 // disparities we explicitly disable antialiasing.
928 blink::WebGraphicsContext3D::Attributes attributes;
929 attributes.antialias = false;
930 attributes.shareResources = true;
931 attributes.noAutomaticFlushes = true;
932 attributes.depth = false;
933 attributes.stencil = false;
931 context_provider = ContextProviderCommandBuffer::Create( 934 context_provider = ContextProviderCommandBuffer::Create(
932 CreateGraphicsContext3D(attributes), 935 CreateGraphicsContext3D(attributes),
933 "RenderCompositor"); 936 "RenderCompositor");
934 } 937 }
938 if (!context_provider.get() && !fallback) {
jbauman 2014/03/26 17:17:26 We should check for use_software here, because if
danakj 2014/03/26 17:21:22 Oh, that's what I was going for but didn't capture
danakj 2014/03/26 17:22:39 Done.
939 // Cause the compositor to wait and try again.
940 return scoped_ptr<cc::OutputSurface>();
jbauman 2014/03/26 17:17:26 Does this always cause it to retry, even with the
danakj 2014/03/26 17:21:22 Yes. https://code.google.com/p/chromium/codesearch
941 }
935 942
936 uint32 output_surface_id = next_output_surface_id_++; 943 uint32 output_surface_id = next_output_surface_id_++;
937 if (command_line.HasSwitch(switches::kEnableDelegatedRenderer) && 944 if (command_line.HasSwitch(switches::kEnableDelegatedRenderer) &&
938 !command_line.HasSwitch(switches::kDisableDelegatedRenderer)) { 945 !command_line.HasSwitch(switches::kDisableDelegatedRenderer)) {
939 DCHECK(is_threaded_compositing_enabled_); 946 DCHECK(is_threaded_compositing_enabled_);
940 return scoped_ptr<cc::OutputSurface>( 947 return scoped_ptr<cc::OutputSurface>(
941 new DelegatedCompositorOutputSurface( 948 new DelegatedCompositorOutputSurface(
942 routing_id(), 949 routing_id(),
943 output_surface_id, 950 output_surface_id,
944 context_provider)); 951 context_provider));
(...skipping 1917 matching lines...) Expand 10 before | Expand all | Expand 10 after
2862 2869
2863 void RenderWidget::RegisterSwappedOutChildFrame(RenderFrameImpl* frame) { 2870 void RenderWidget::RegisterSwappedOutChildFrame(RenderFrameImpl* frame) {
2864 swapped_out_frames_.AddObserver(frame); 2871 swapped_out_frames_.AddObserver(frame);
2865 } 2872 }
2866 2873
2867 void RenderWidget::UnregisterSwappedOutChildFrame(RenderFrameImpl* frame) { 2874 void RenderWidget::UnregisterSwappedOutChildFrame(RenderFrameImpl* frame) {
2868 swapped_out_frames_.RemoveObserver(frame); 2875 swapped_out_frames_.RemoveObserver(frame);
2869 } 2876 }
2870 2877
2871 } // namespace content 2878 } // 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