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

Side by Side Diff: services/ui/surfaces/direct_output_surface.cc

Issue 2352963002: cc: Make most of cc::OutputSurface abstract. (Closed)
Patch Set: outputsurface-cleanup: rebase Created 4 years, 2 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 2014 The Chromium Authors. All rights reserved. 1 // Copyright 2014 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 "services/ui/surfaces/direct_output_surface.h" 5 #include "services/ui/surfaces/direct_output_surface.h"
6 6
7 #include <stdint.h> 7 #include <stdint.h>
8 8
9 #include "base/bind.h" 9 #include "base/bind.h"
10 #include "base/memory/ptr_util.h" 10 #include "base/memory/ptr_util.h"
(...skipping 21 matching lines...) Expand all
32 if (!cc::OutputSurface::BindToClient(client)) 32 if (!cc::OutputSurface::BindToClient(client))
33 return false; 33 return false;
34 34
35 if (capabilities_.uses_default_gl_framebuffer) { 35 if (capabilities_.uses_default_gl_framebuffer) {
36 capabilities_.flipped_output_surface = 36 capabilities_.flipped_output_surface =
37 context_provider()->ContextCapabilities().flips_vertically; 37 context_provider()->ContextCapabilities().flips_vertically;
38 } 38 }
39 return true; 39 return true;
40 } 40 }
41 41
42 void DirectOutputSurface::OnVSyncParametersUpdated( 42 void DirectOutputSurface::EnsureBackbuffer() {}
43 const base::TimeTicks& timebase, 43
44 const base::TimeDelta& interval) { 44 void DirectOutputSurface::DiscardBackbuffer() {
45 // TODO(brianderson): We should not be receiving 0 intervals. 45 context_provider()->ContextGL()->DiscardBackbufferCHROMIUM();
46 synthetic_begin_frame_source_->OnUpdateVSyncParameters( 46 }
47 timebase, 47
48 interval.is_zero() ? cc::BeginFrameArgs::DefaultInterval() : interval); 48 void DirectOutputSurface::BindFramebuffer() {
49 context_provider()->ContextGL()->BindFramebuffer(GL_FRAMEBUFFER, 0);
49 } 50 }
50 51
51 void DirectOutputSurface::SwapBuffers(cc::CompositorFrame frame) { 52 void DirectOutputSurface::SwapBuffers(cc::CompositorFrame frame) {
52 DCHECK(context_provider_); 53 DCHECK(context_provider_);
53 DCHECK(frame.gl_frame_data); 54 DCHECK(frame.gl_frame_data);
54 if (frame.gl_frame_data->sub_buffer_rect == 55 if (frame.gl_frame_data->sub_buffer_rect ==
55 gfx::Rect(frame.gl_frame_data->size)) { 56 gfx::Rect(frame.gl_frame_data->size)) {
56 context_provider_->ContextSupport()->Swap(); 57 context_provider_->ContextSupport()->Swap();
57 } else { 58 } else {
58 context_provider_->ContextSupport()->PartialSwapBuffers( 59 context_provider_->ContextSupport()->PartialSwapBuffers(
59 frame.gl_frame_data->sub_buffer_rect); 60 frame.gl_frame_data->sub_buffer_rect);
60 } 61 }
61 62
62 gpu::gles2::GLES2Interface* gl = context_provider_->ContextGL(); 63 gpu::gles2::GLES2Interface* gl = context_provider_->ContextGL();
63 const GLuint64 fence_sync = gl->InsertFenceSyncCHROMIUM(); 64 const GLuint64 fence_sync = gl->InsertFenceSyncCHROMIUM();
64 gl->ShallowFlushCHROMIUM(); 65 gl->ShallowFlushCHROMIUM();
65 66
66 gpu::SyncToken sync_token; 67 gpu::SyncToken sync_token;
67 gl->GenUnverifiedSyncTokenCHROMIUM(fence_sync, sync_token.GetData()); 68 gl->GenUnverifiedSyncTokenCHROMIUM(fence_sync, sync_token.GetData());
68 69
69 context_provider_->ContextSupport()->SignalSyncToken( 70 context_provider_->ContextSupport()->SignalSyncToken(
70 sync_token, base::Bind(&OutputSurface::OnSwapBuffersComplete, 71 sync_token, base::Bind(&DirectOutputSurface::OnSwapBuffersComplete,
71 weak_ptr_factory_.GetWeakPtr())); 72 weak_ptr_factory_.GetWeakPtr()));
72 } 73 }
73 74
74 uint32_t DirectOutputSurface::GetFramebufferCopyTextureFormat() { 75 uint32_t DirectOutputSurface::GetFramebufferCopyTextureFormat() {
75 // TODO(danakj): What attributes are used for the default framebuffer here? 76 // TODO(danakj): What attributes are used for the default framebuffer here?
76 // Can it have alpha? SurfacesContextProvider doesn't take any attributes. 77 // Can it have alpha? SurfacesContextProvider doesn't take any attributes.
77 return GL_RGB; 78 return GL_RGB;
78 } 79 }
79 80
81 cc::OverlayCandidateValidator*
82 DirectOutputSurface::GetOverlayCandidateValidator() const {
83 return nullptr;
84 }
85
86 bool DirectOutputSurface::IsDisplayedAsOverlayPlane() const {
87 return false;
88 }
89
90 unsigned DirectOutputSurface::GetOverlayTextureId() const {
91 return 0;
92 }
93
94 bool DirectOutputSurface::SurfaceIsSuspendForRecycle() const {
95 return false;
96 }
97
98 bool DirectOutputSurface::HasExternalStencilTest() const {
99 return false;
100 }
101
102 void DirectOutputSurface::ApplyExternalStencil() {}
103
104 void DirectOutputSurface::OnVSyncParametersUpdated(
105 const base::TimeTicks& timebase,
106 const base::TimeDelta& interval) {
107 // TODO(brianderson): We should not be receiving 0 intervals.
108 synthetic_begin_frame_source_->OnUpdateVSyncParameters(
109 timebase,
110 interval.is_zero() ? cc::BeginFrameArgs::DefaultInterval() : interval);
111 }
112
113 void DirectOutputSurface::OnSwapBuffersComplete() {
114 client_->DidSwapBuffersComplete();
115 }
116
80 } // namespace ui 117 } // namespace ui
OLDNEW
« no previous file with comments | « services/ui/surfaces/direct_output_surface.h ('k') | services/ui/surfaces/direct_output_surface_ozone.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698