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

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

Issue 516663003: Surfaceless OutputSurface implementation. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: add release call Created 6 years, 3 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
(Empty)
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
3 // found in the LICENSE file.
4
5 #include "content/browser/compositor/gpu_surfaceless_browser_compositor_output_s urface.h"
6
7 #include "cc/output/compositor_frame.h"
8 #include "content/browser/compositor/buffered_output_surface.h"
9 #include "content/browser/compositor/reflector_impl.h"
10 #include "content/browser/gpu/gpu_surface_tracker.h"
11 #include "content/common/gpu/client/context_provider_command_buffer.h"
12 #include "gpu/GLES2/gl2extchromium.h"
13 #include "gpu/command_buffer/client/gles2_interface.h"
14
15 namespace content {
16
17 GpuSurfacelessBrowserCompositorOutputSurface::
18 GpuSurfacelessBrowserCompositorOutputSurface(
19 const scoped_refptr<ContextProviderCommandBuffer>& context,
20 int surface_id,
21 IDMap<BrowserCompositorOutputSurface>* output_surface_map,
22 const scoped_refptr<ui::CompositorVSyncManager>& vsync_manager,
23 scoped_ptr<cc::OverlayCandidateValidator> overlay_candidate_validator,
24 unsigned internalformat)
25 : GpuBrowserCompositorOutputSurface(context,
26 surface_id,
27 output_surface_map,
28 vsync_manager,
29 overlay_candidate_validator.Pass()),
30 internalformat_(internalformat) {
31 }
32
33 GpuSurfacelessBrowserCompositorOutputSurface::
34 ~GpuSurfacelessBrowserCompositorOutputSurface() {
35 }
36
37 void GpuSurfacelessBrowserCompositorOutputSurface::SwapBuffers(
38 cc::CompositorFrame* frame) {
39 DCHECK(output_surface_);
40
41 const gfx::Size& size = frame->gl_frame_data->size;
42 gpu::gles2::GLES2Interface* gl = context_provider_->ContextGL();
43 gl->Finish(); // This will eventually be replaced by sync fences.
piman 2014/09/11 20:25:29 I don't think the client should do this. This impl
piman 2014/09/12 21:58:29 ping?
achaulk 2014/09/15 16:31:42 Done.
44 gl->ScheduleOverlayPlaneCHROMIUM(0,
45 GL_OVERLAY_TRANSFORM_NONE_CHROMIUM,
46 output_surface_->current_tex_id(),
47 0,
48 0,
49 size.width(),
50 size.height(),
51 0,
52 0,
53 1.0f,
54 1.0f);
55 output_surface_->SwapBuffers();
56 GpuBrowserCompositorOutputSurface::SwapBuffers(frame);
57 }
58
59 void GpuSurfacelessBrowserCompositorOutputSurface::OnSwapBuffersComplete() {
60 DCHECK(output_surface_);
61 output_surface_->PageFlipComplete();
62 GpuBrowserCompositorOutputSurface::OnSwapBuffersComplete();
63 }
64
65 void GpuSurfacelessBrowserCompositorOutputSurface::BindFramebuffer() {
66 DCHECK(output_surface_);
67 output_surface_->BindFramebuffer();
68 }
69
70 void GpuSurfacelessBrowserCompositorOutputSurface::Reshape(
71 const gfx::Size& size,
72 float scale_factor) {
73 GpuBrowserCompositorOutputSurface::Reshape(size, scale_factor);
74 DCHECK(output_surface_);
75 output_surface_->Reshape(SurfaceSize(), scale_factor);
76 }
77
78 bool GpuSurfacelessBrowserCompositorOutputSurface::BindToClient(
79 cc::OutputSurfaceClient* client) {
80 DCHECK(output_surface_);
piman 2014/09/11 20:25:29 This DCHECK looks wrong. The only place you're ass
81 if (!GpuBrowserCompositorOutputSurface::BindToClient(client))
82 return false;
83 if (!output_surface_) {
84 output_surface_.reset(
85 new BufferedOutputSurface(context_provider_, internalformat_));
86 }
87 return true;
88 }
89
90 } // namespace content
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698