• 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,
29                               const EGLint *rects,
30                               EGLint n_rects) override;
31     egl::Error postSubBuffer(const gl::Context *context,
32                              EGLint x,
33                              EGLint y,
34                              EGLint width,
35                              EGLint height) override;
36     egl::Error setPresentationTime(EGLnsecsANDROID time) override;
37     egl::Error querySurfacePointerANGLE(EGLint attribute, void **value) override;
38     egl::Error bindTexImage(const gl::Context *context,
39                             gl::Texture *texture,
40                             EGLint buffer) override;
41     egl::Error releaseTexImage(const gl::Context *context, EGLint buffer) override;
42     void setSwapInterval(EGLint interval) override;
43     EGLint getWidth() const override;
44     EGLint getHeight() const override;
45     EGLint isPostSubBufferSupported() const override;
46     EGLint getSwapBehavior() const override;
47 
48     void setTimestampsEnabled(bool enabled) override;
49     egl::SupportedCompositorTimings getSupportedCompositorTimings() const override;
50     egl::Error getCompositorTiming(EGLint numTimestamps,
51                                    const EGLint *names,
52                                    EGLnsecsANDROID *values) const override;
53     egl::Error getNextFrameId(EGLuint64KHR *frameId) const override;
54     egl::SupportedTimestamps getSupportedTimestamps() const override;
55     egl::Error getFrameTimestamps(EGLuint64KHR frameId,
56                                   EGLint numTimestamps,
57                                   const EGLint *timestamps,
58                                   EGLnsecsANDROID *values) const override;
59 
60     EGLSurface getSurface() const;
61     virtual bool isExternal() const;
62 
63   protected:
64     const FunctionsEGL *mEGL;
65     EGLConfig mConfig;
66     EGLSurface mSurface;
67 
68   private:
69     bool mHasSwapBuffersWithDamage;
70 };
71 
72 }  // namespace rx
73 
74 #endif  // LIBANGLE_RENDERER_GL_EGL_SURFACEEGL_H_
75