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

Unified 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, 12 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 side-by-side diff with in-line comments
Download patch
Index: services/gfx/compositor/backend/gpu_rasterizer.h
diff --git a/services/gfx/compositor/backend/gpu_rasterizer.h b/services/gfx/compositor/backend/gpu_rasterizer.h
new file mode 100644
index 0000000000000000000000000000000000000000..3e2e9e2ef67f6ea78219ecc6b0c491e1e8d6c7c2
--- /dev/null
+++ b/services/gfx/compositor/backend/gpu_rasterizer.h
@@ -0,0 +1,77 @@
+// Copyright 2015 The Chromium Authors. All rights reserved.
+// Use of this source code is governed by a BSD-style license that can be
+// found in the LICENSE file.
+
+#ifndef SERVICES_GFX_COMPOSITOR_BACKEND_GPU_RASTERIZER_H_
+#define SERVICES_GFX_COMPOSITOR_BACKEND_GPU_RASTERIZER_H_
+
+#include <memory>
+
+#include "base/callback.h"
+#include "base/macros.h"
+#include "base/memory/ref_counted.h"
+#include "base/memory/weak_ptr.h"
+#include "base/task_runner.h"
+#include "mojo/gpu/gl_context.h"
+#include "mojo/public/cpp/bindings/binding.h"
+#include "mojo/public/cpp/system/functions.h"
+#include "mojo/services/gpu/interfaces/context_provider.mojom.h"
+#include "mojo/skia/ganesh_context.h"
+#include "mojo/skia/ganesh_framebuffer_surface.h"
+#include "services/gfx/compositor/render/painting.h"
+
+namespace compositor {
+
+class RenderFrame;
+class VsyncScheduler;
+
+// Ganesh-based rasterizer which runs on a separate thread from the compositor.
+// Calls into this object, including its creation, must be posted to the
+// correct message loop by the output.
+class GpuRasterizer : public mojo::ViewportParameterListener,
+ public mojo::GLContext::Observer {
+ public:
+ GpuRasterizer(mojo::ContextProviderPtr context_provider,
+ const std::shared_ptr<VsyncScheduler>& scheduler,
+ const scoped_refptr<base::TaskRunner>& task_runner,
+ const base::Closure& error_callback);
+ ~GpuRasterizer() override;
+
+ void SubmitFrame(const std::shared_ptr<RenderFrame>& frame);
+
+ private:
+ // |ViewportParameterListener|:
+ void OnVSyncParametersUpdated(int64_t timebase, int64_t interval) override;
+
+ // |GLContext::Observer|:
+ void OnContextLost() override;
+
+ void CreateContext();
+ void InitContext(mojo::CommandBufferPtr command_buffer);
+ void DestroyContext();
+ void OnContextProviderConnectionError();
+
+ void Draw();
+
+ void PostErrorCallback();
+
+ mojo::ContextProviderPtr context_provider_;
+ std::shared_ptr<VsyncScheduler> scheduler_;
+ scoped_refptr<base::TaskRunner> task_runner_;
+ base::Closure error_callback_;
+
+ base::WeakPtr<mojo::GLContext> gl_context_;
+ std::unique_ptr<mojo::skia::GaneshContext> ganesh_context_;
+ std::unique_ptr<mojo::skia::GaneshFramebufferSurface> ganesh_surface_;
+ PaintingCache painting_cache_;
+
+ std::shared_ptr<RenderFrame> current_frame_;
+
+ mojo::Binding<ViewportParameterListener> viewport_parameter_listener_binding_;
+
+ DISALLOW_COPY_AND_ASSIGN(GpuRasterizer);
+};
+
+} // namespace compositor
+
+#endif // SERVICES_GFX_COMPOSITOR_BACKEND_GPU_RASTERIZER_H_

Powered by Google App Engine
This is Rietveld 408576698