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