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

Side by Side Diff: services/gfx/compositor/backend/gpu_rasterizer.h

Issue 1552963002: Initial checkin of the new Mozart compositor. (Closed) Base URL: git@github.com:domokit/mojo.git@moz-11
Patch Set: Created 4 years, 11 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 2015 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 #ifndef SERVICES_GFX_COMPOSITOR_BACKEND_GPU_RASTERIZER_H_
6 #define SERVICES_GFX_COMPOSITOR_BACKEND_GPU_RASTERIZER_H_
7
8 #include <memory>
9
10 #include "base/callback.h"
11 #include "base/macros.h"
12 #include "base/memory/ref_counted.h"
13 #include "base/memory/weak_ptr.h"
14 #include "base/task_runner.h"
15 #include "mojo/gpu/gl_context.h"
16 #include "mojo/public/cpp/bindings/binding.h"
17 #include "mojo/public/cpp/system/functions.h"
18 #include "mojo/services/gpu/interfaces/context_provider.mojom.h"
19 #include "mojo/skia/ganesh_context.h"
20 #include "mojo/skia/ganesh_framebuffer_surface.h"
21 #include "services/gfx/compositor/render/painting.h"
22
23 namespace compositor {
24
25 class RenderFrame;
26 class VsyncScheduler;
27
28 // Ganesh-based rasterizer which runs on a separate thread from the compositor.
29 // Calls into this object, including its creation, must be posted to the
30 // correct message loop by the output.
31 class GpuRasterizer : public mojo::ViewportParameterListener,
32 public mojo::GLContext::Observer {
33 public:
34 GpuRasterizer(mojo::ContextProviderPtr context_provider,
35 const std::shared_ptr<VsyncScheduler>& scheduler,
36 const scoped_refptr<base::TaskRunner>& task_runner,
37 const base::Closure& error_callback);
38 ~GpuRasterizer() override;
39
40 void SubmitFrame(const std::shared_ptr<RenderFrame>& frame);
41
42 private:
43 // |ViewportParameterListener|:
44 void OnVSyncParametersUpdated(int64_t timebase, int64_t interval) override;
45
46 // |GLContext::Observer|:
47 void OnContextLost() override;
48
49 void CreateContext();
50 void InitContext(mojo::CommandBufferPtr command_buffer);
51 void DestroyContext();
52 void OnContextProviderConnectionError();
53
54 void Draw();
55
56 void PostErrorCallback();
57
58 mojo::ContextProviderPtr context_provider_;
59 std::shared_ptr<VsyncScheduler> scheduler_;
60 scoped_refptr<base::TaskRunner> task_runner_;
61 base::Closure error_callback_;
62
63 base::WeakPtr<mojo::GLContext> gl_context_;
64 std::unique_ptr<mojo::skia::GaneshContext> ganesh_context_;
65 std::unique_ptr<mojo::skia::GaneshFramebufferSurface> ganesh_surface_;
66 PaintingCache painting_cache_;
67
68 std::shared_ptr<RenderFrame> current_frame_;
69
70 mojo::Binding<ViewportParameterListener> viewport_parameter_listener_binding_;
71
72 DISALLOW_COPY_AND_ASSIGN(GpuRasterizer);
73 };
74
75 } // namespace compositor
76
77 #endif // SERVICES_GFX_COMPOSITOR_BACKEND_GPU_RASTERIZER_H_
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698