• Home
  • Line#
  • Scopes#
  • Navigate#
  • Raw
  • Download
1 //
2 // Copyright 2016 The ANGLE Project Authors. All rights reserved.
3 // Use of this source code is governed by a BSD-style license that can be
4 // found in the LICENSE file.
5 //
6 
7 // SurfaceEGL.h: common interface for EGL surfaces
8 
9 #ifndef LIBANGLE_RENDERER_GL_EGL_SURFACEEGL_H_
10 #define LIBANGLE_RENDERER_GL_EGL_SURFACEEGL_H_
11 
12 #include <EGL/egl.h>
13 
14 #include "libANGLE/renderer/gl/SurfaceGL.h"
15 #include "libANGLE/renderer/gl/egl/FunctionsEGL.h"
16 
17 namespace rx
18 {
19 
20 class SurfaceEGL : public SurfaceGL
21 {
22   public:
23     SurfaceEGL(const egl::SurfaceState &state, const FunctionsEGL *egl, EGLConfig config);
24     ~SurfaceEGL() override;
25 
26     egl::Error makeCurrent(const gl::Context *context) override;
27     egl::Error swap(const gl::Context *context) override;
28     egl::Error swapWithDamage(const gl::Context *context, EGLint *rects, EGLint n_rects) override;
29     egl::Error postSubBuffer(const gl::Context *context,
30                              EGLint x,
31                              EGLint y,
32                              EGLint width,
33                              EGLint height) override;
34     egl::Error setPresentationTime(EGLnsecsANDROID time) override;
35     egl::Error querySurfacePointerANGLE(EGLint attribute, void **value) override;
36     egl::Error bindTexImage(const gl::Context *context,
37                             gl::Texture *texture,
38                             EGLint buffer) override;
39     egl::Error releaseTexImage(const gl::Context *context, EGLint buffer) override;
40     void setSwapInterval(EGLint interval) override;
41     EGLint getWidth() const override;
42     EGLint getHeight() const override;
43     EGLint isPostSubBufferSupported() const override;
44     EGLint getSwapBehavior() const override;
45 
46     void setTimestampsEnabled(bool enabled) override;
47     egl::SupportedCompositorTimings getSupportedCompositorTimings() const override;
48     egl::Error getCompositorTiming(EGLint numTimestamps,
49                                    const EGLint *names,
50                                    EGLnsecsANDROID *values) const override;
51     egl::Error getNextFrameId(EGLuint64KHR *frameId) const override;
52     egl::SupportedTimestamps getSupportedTimestamps() const override;
53     egl::Error getFrameTimestamps(EGLuint64KHR frameId,
54                                   EGLint numTimestamps,
55                                   const EGLint *timestamps,
56                                   EGLnsecsANDROID *values) const override;
57 
58     EGLSurface getSurface() const;
59 
60   protected:
61     const FunctionsEGL *mEGL;
62     EGLConfig mConfig;
63     EGLSurface mSurface;
64 
65   private:
66     bool mHasSwapBuffersWithDamage;
67 };
68 
69 }  // namespace rx
70 
71 #endif  // LIBANGLE_RENDERER_GL_EGL_SURFACEEGL_H_
72