• Home
  • Line#
  • Scopes#
  • Navigate#
  • Raw
  • Download
1 //
2 // Copyright 2014 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 // SurfaceImpl.h: Implementation methods of egl::Surface
8 
9 #ifndef LIBANGLE_RENDERER_SURFACEIMPL_H_
10 #define LIBANGLE_RENDERER_SURFACEIMPL_H_
11 
12 #include <EGL/egl.h>
13 #include <EGL/eglext.h>
14 
15 #include "common/angleutils.h"
16 #include "libANGLE/Error.h"
17 #include "libANGLE/FramebufferAttachment.h"
18 #include "libANGLE/renderer/FramebufferAttachmentObjectImpl.h"
19 
20 namespace angle
21 {
22 struct Format;
23 }
24 
25 namespace gl
26 {
27 class Context;
28 class FramebufferState;
29 }  // namespace gl
30 
31 namespace egl
32 {
33 class Display;
34 struct Config;
35 struct SurfaceState;
36 class Thread;
37 
38 using SupportedTimestamps        = angle::PackedEnumBitSet<Timestamp>;
39 using SupportedCompositorTimings = angle::PackedEnumBitSet<CompositorTiming>;
40 }  // namespace egl
41 
42 namespace rx
43 {
44 class FramebufferImpl;
45 
46 class SurfaceImpl : public FramebufferAttachmentObjectImpl
47 {
48   public:
49     SurfaceImpl(const egl::SurfaceState &surfaceState);
50     ~SurfaceImpl() override;
destroy(const egl::Display * display)51     virtual void destroy(const egl::Display *display) {}
52 
53     virtual egl::Error initialize(const egl::Display *display)                           = 0;
54     virtual FramebufferImpl *createDefaultFramebuffer(const gl::Context *context,
55                                                       const gl::FramebufferState &state) = 0;
56     virtual egl::Error makeCurrent(const gl::Context *context);
57     virtual egl::Error unMakeCurrent(const gl::Context *context);
58     virtual egl::Error swap(const gl::Context *context) = 0;
59     virtual egl::Error swapWithDamage(const gl::Context *context, EGLint *rects, EGLint n_rects);
60     virtual egl::Error postSubBuffer(const gl::Context *context,
61                                      EGLint x,
62                                      EGLint y,
63                                      EGLint width,
64                                      EGLint height) = 0;
65     virtual egl::Error setPresentationTime(EGLnsecsANDROID time);
66     virtual egl::Error querySurfacePointerANGLE(EGLint attribute, void **value)               = 0;
67     virtual egl::Error bindTexImage(const gl::Context *context,
68                                     gl::Texture *texture,
69                                     EGLint buffer)                                            = 0;
70     virtual egl::Error releaseTexImage(const gl::Context *context, EGLint buffer)             = 0;
71     virtual egl::Error getSyncValues(EGLuint64KHR *ust, EGLuint64KHR *msc, EGLuint64KHR *sbc) = 0;
72     virtual void setSwapInterval(EGLint interval)                                             = 0;
73     virtual void setFixedWidth(EGLint width);
74     virtual void setFixedHeight(EGLint height);
75 
76     // width and height can change with client window resizing
77     virtual EGLint getWidth() const  = 0;
78     virtual EGLint getHeight() const = 0;
79 
80     virtual EGLint isPostSubBufferSupported() const = 0;
81     virtual EGLint getSwapBehavior() const          = 0;
82 
83     // Used to query color format from pbuffers created from D3D textures.
84     virtual const angle::Format *getD3DTextureColorFormat() const;
85 
86     // EGL_ANDROID_get_frame_timestamps
87     virtual void setTimestampsEnabled(bool enabled);
88     virtual egl::SupportedCompositorTimings getSupportedCompositorTimings() const;
89     virtual egl::Error getCompositorTiming(EGLint numTimestamps,
90                                            const EGLint *names,
91                                            EGLnsecsANDROID *values) const;
92     virtual egl::Error getNextFrameId(EGLuint64KHR *frameId) const;
93     virtual egl::SupportedTimestamps getSupportedTimestamps() const;
94     virtual egl::Error getFrameTimestamps(EGLuint64KHR frameId,
95                                           EGLint numTimestamps,
96                                           const EGLint *timestamps,
97                                           EGLnsecsANDROID *values) const;
98 
99   protected:
100     const egl::SurfaceState &mState;
101 };
102 
103 }  // namespace rx
104 
105 #endif  // LIBANGLE_RENDERER_SURFACEIMPL_H_
106