no bug - Bumping Firefox l10n changesets r=release a=l10n-bump DONTBUILD CLOSED TREE
[gecko.git] / gfx / webrender_bindings / RenderCompositorEGL.h
blob8e851b2fc0dfaa97d8a90a853e2f7268db0f1040
1 /* -*- Mode: C++; tab-width: 8; indent-tabs-mode: nil; c-basic-offset: 2 -*- */
2 /* vim: set ts=8 sts=2 et sw=2 tw=80: */
3 /* This Source Code Form is subject to the terms of the Mozilla Public
4 * License, v. 2.0. If a copy of the MPL was not distributed with this
5 * file, You can obtain one at http://mozilla.org/MPL/2.0/. */
7 #ifndef MOZILLA_GFX_RENDERCOMPOSITOR_EGL_H
8 #define MOZILLA_GFX_RENDERCOMPOSITOR_EGL_H
10 #include "GLTypes.h"
11 #include "mozilla/webrender/RenderCompositor.h"
13 namespace mozilla {
15 namespace wr {
17 class RenderCompositorEGL : public RenderCompositor {
18 public:
19 static UniquePtr<RenderCompositor> Create(
20 const RefPtr<widget::CompositorWidget>& aWidget, nsACString& aError);
22 explicit RenderCompositorEGL(const RefPtr<widget::CompositorWidget>& aWidget,
23 RefPtr<gl::GLContext>&& aGL);
24 virtual ~RenderCompositorEGL();
26 bool BeginFrame() override;
27 RenderedFrameId EndFrame(const nsTArray<DeviceIntRect>& aDirtyRects) final;
28 void Pause() override;
29 bool Resume() override;
30 bool IsPaused() override;
32 gl::GLContext* gl() const override { return mGL; }
34 bool MakeCurrent() override;
36 bool UseANGLE() const override { return false; }
38 LayoutDeviceIntSize GetBufferSize() override;
40 // Interface for partial present
41 bool UsePartialPresent() override;
42 bool RequestFullRender() override;
43 uint32_t GetMaxPartialPresentRects() override;
44 bool ShouldDrawPreviousPartialPresentRegions() override;
45 size_t GetBufferAge() const override;
46 void SetBufferDamageRegion(const wr::DeviceIntRect* aRects,
47 size_t aNumRects) override;
49 ipc::FileDescriptor GetAndResetReleaseFence() override;
51 protected:
52 EGLSurface CreateEGLSurface();
54 void DestroyEGLSurface();
56 RefPtr<gl::GLContext> mGL;
58 EGLSurface mEGLSurface;
60 // Whether we are in the process of handling a NEW_SURFACE error. On Android
61 // this is used to allow the widget an opportunity to recover from the first
62 // instance, before raising a WebRenderError on subsequent occurences.
63 bool mHandlingNewSurfaceError = false;
65 // FileDescriptor of release fence.
66 // Release fence is a fence that is used for waiting until usage/composite of
67 // AHardwareBuffer is ended. The fence is delivered to client side via
68 // ImageBridge. It is used only on android.
69 ipc::FileDescriptor mReleaseFenceFd;
72 } // namespace wr
73 } // namespace mozilla
75 #endif // MOZILLA_GFX_RENDERCOMPOSITOR_EGL_H