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

Side by Side Diff: content/browser/compositor/gpu_surfaceless_browser_compositor_output_surface.cc

Issue 781683005: Ozone: Avoid blocking in Swapbuffer Call. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Remove unintended changes. Created 6 years 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 "content/browser/compositor/gpu_surfaceless_browser_compositor_output_s urface.h" 5 #include "content/browser/compositor/gpu_surfaceless_browser_compositor_output_s urface.h"
6 6
7 #include "cc/output/compositor_frame.h" 7 #include "cc/output/compositor_frame.h"
8 #include "content/browser/compositor/buffer_queue.h" 8 #include "content/browser/compositor/buffer_queue.h"
9 #include "content/browser/compositor/reflector_impl.h" 9 #include "content/browser/compositor/reflector_impl.h"
10 #include "content/browser/gpu/gpu_surface_tracker.h" 10 #include "content/browser/gpu/gpu_surface_tracker.h"
(...skipping 12 matching lines...) Expand all
23 const scoped_refptr<ui::CompositorVSyncManager>& vsync_manager, 23 const scoped_refptr<ui::CompositorVSyncManager>& vsync_manager,
24 scoped_ptr<cc::OverlayCandidateValidator> overlay_candidate_validator, 24 scoped_ptr<cc::OverlayCandidateValidator> overlay_candidate_validator,
25 unsigned internalformat, 25 unsigned internalformat,
26 bool use_own_gl_helper) 26 bool use_own_gl_helper)
27 : GpuBrowserCompositorOutputSurface(context, 27 : GpuBrowserCompositorOutputSurface(context,
28 surface_id, 28 surface_id,
29 output_surface_map, 29 output_surface_map,
30 vsync_manager, 30 vsync_manager,
31 overlay_candidate_validator.Pass()), 31 overlay_candidate_validator.Pass()),
32 internalformat_(internalformat), 32 internalformat_(internalformat),
33 use_own_gl_helper_(use_own_gl_helper) { 33 use_own_gl_helper_(use_own_gl_helper),
34 page_flip_completion_callback_(
35 base::Bind(&GpuSurfacelessBrowserCompositorOutputSurface::
36 OnPageFlipCompleted, base::Unretained(this))) {
34 capabilities_.uses_default_gl_framebuffer = false; 37 capabilities_.uses_default_gl_framebuffer = false;
35 capabilities_.flipped_output_surface = true; 38 capabilities_.flipped_output_surface = true;
36 } 39 }
37 40
38 GpuSurfacelessBrowserCompositorOutputSurface:: 41 GpuSurfacelessBrowserCompositorOutputSurface::
39 ~GpuSurfacelessBrowserCompositorOutputSurface() { 42 ~GpuSurfacelessBrowserCompositorOutputSurface() {
alexst (slow to review) 2014/12/10 23:19:25 Should the callback be reset here?
40 } 43 }
41 44
42 void GpuSurfacelessBrowserCompositorOutputSurface::SwapBuffers( 45 void GpuSurfacelessBrowserCompositorOutputSurface::SwapBuffers(
43 cc::CompositorFrame* frame) { 46 cc::CompositorFrame* frame) {
44 DCHECK(output_surface_); 47 DCHECK(output_surface_);
45 48
46 GLuint texture = output_surface_->current_texture_id(); 49 GLuint texture = output_surface_->current_texture_id();
47 output_surface_->SwapBuffers(frame->gl_frame_data->sub_buffer_rect); 50 output_surface_->SwapBuffers(frame->gl_frame_data->sub_buffer_rect);
48 const gfx::Size& size = frame->gl_frame_data->size; 51 const gfx::Size& size = frame->gl_frame_data->size;
49 context_provider_->ContextGL()->ScheduleOverlayPlaneCHROMIUM( 52 context_provider_->ContextGL()->ScheduleOverlayPlaneCHROMIUM(
50 0, 53 0,
51 GL_OVERLAY_TRANSFORM_NONE_CHROMIUM, 54 GL_OVERLAY_TRANSFORM_NONE_CHROMIUM,
52 texture, 55 texture,
53 0, 56 0,
54 0, 57 0,
55 size.width(), 58 size.width(),
56 size.height(), 59 size.height(),
57 0, 60 0,
58 0, 61 0,
59 1.0f, 62 1.0f,
60 1.0f); 63 1.0f);
61 GpuBrowserCompositorOutputSurface::SwapBuffers(frame); 64 GpuBrowserCompositorOutputSurface::SwapBuffers(frame);
62 } 65 }
63 66
64 void GpuSurfacelessBrowserCompositorOutputSurface::OnSwapBuffersComplete() { 67 void GpuSurfacelessBrowserCompositorOutputSurface::OnSwapBuffersComplete() {
65 DCHECK(output_surface_); 68 DCHECK(output_surface_);
66 output_surface_->PageFlipComplete();
67 GpuBrowserCompositorOutputSurface::OnSwapBuffersComplete(); 69 GpuBrowserCompositorOutputSurface::OnSwapBuffersComplete();
68 } 70 }
69 71
70 void GpuSurfacelessBrowserCompositorOutputSurface::BindFramebuffer() { 72 void GpuSurfacelessBrowserCompositorOutputSurface::BindFramebuffer() {
71 DCHECK(output_surface_); 73 DCHECK(output_surface_);
72 output_surface_->BindFramebuffer(); 74 output_surface_->BindFramebuffer();
73 } 75 }
74 76
75 void GpuSurfacelessBrowserCompositorOutputSurface::Reshape( 77 void GpuSurfacelessBrowserCompositorOutputSurface::Reshape(
76 const gfx::Size& size, 78 const gfx::Size& size,
(...skipping 13 matching lines...) Expand all
90 context_provider_->ContextSupport())); 92 context_provider_->ContextSupport()));
91 helper = gl_helper_.get(); 93 helper = gl_helper_.get();
92 } else { 94 } else {
93 helper = ImageTransportFactory::GetInstance()->GetGLHelper(); 95 helper = ImageTransportFactory::GetInstance()->GetGLHelper();
94 } 96 }
95 if (!helper) 97 if (!helper)
96 return false; 98 return false;
97 99
98 output_surface_.reset( 100 output_surface_.reset(
99 new BufferQueue(context_provider_, internalformat_, helper)); 101 new BufferQueue(context_provider_, internalformat_, helper));
102
103 GetCommandBufferProxy()->SetPageFlipCompletionCallback(
104 page_flip_completion_callback_.callback());
alexst (slow to review) 2014/12/10 23:19:25 Why not base::Bind(&BufferQueue::PageFlipComplete,
kalyank 2014/12/11 12:55:58 Done.
105
100 return output_surface_->Initialize(); 106 return output_surface_->Initialize();
101 } 107 }
102 108
109 void GpuSurfacelessBrowserCompositorOutputSurface::OnPageFlipCompleted() {
110 output_surface_->PageFlipComplete();
111 }
112
103 } // namespace content 113 } // namespace content
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698