• 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 swapWithFrameToken(const gl::Context *context,
61                                           EGLFrameTokenANGLE frameToken);
62     virtual egl::Error postSubBuffer(const gl::Context *context,
63                                      EGLint x,
64                                      EGLint y,
65                                      EGLint width,
66                                      EGLint height) = 0;
67     virtual egl::Error setPresentationTime(EGLnsecsANDROID time);
68     virtual egl::Error querySurfacePointerANGLE(EGLint attribute, void **value)               = 0;
69     virtual egl::Error bindTexImage(const gl::Context *context,
70                                     gl::Texture *texture,
71                                     EGLint buffer)                                            = 0;
72     virtual egl::Error releaseTexImage(const gl::Context *context, EGLint buffer)             = 0;
73     virtual egl::Error getSyncValues(EGLuint64KHR *ust, EGLuint64KHR *msc, EGLuint64KHR *sbc) = 0;
74     virtual egl::Error getMscRate(EGLint *numerator, EGLint *denominator)                     = 0;
75     virtual void setSwapInterval(EGLint interval)                                             = 0;
76     virtual void setFixedWidth(EGLint width);
77     virtual void setFixedHeight(EGLint height);
78 
79     // width and height can change with client window resizing
80     virtual EGLint getWidth() const  = 0;
81     virtual EGLint getHeight() const = 0;
82 
83     virtual EGLint isPostSubBufferSupported() const = 0;
84     virtual EGLint getSwapBehavior() const          = 0;
85 
86     // Used to query color format from pbuffers created from D3D textures.
87     virtual const angle::Format *getD3DTextureColorFormat() const;
88 
89     // EGL_ANDROID_get_frame_timestamps
90     virtual void setTimestampsEnabled(bool enabled);
91     virtual egl::SupportedCompositorTimings getSupportedCompositorTimings() const;
92     virtual egl::Error getCompositorTiming(EGLint numTimestamps,
93                                            const EGLint *names,
94                                            EGLnsecsANDROID *values) const;
95     virtual egl::Error getNextFrameId(EGLuint64KHR *frameId) const;
96     virtual egl::SupportedTimestamps getSupportedTimestamps() const;
97     virtual egl::Error getFrameTimestamps(EGLuint64KHR frameId,
98                                           EGLint numTimestamps,
99                                           const EGLint *timestamps,
100                                           EGLnsecsANDROID *values) const;
101 
102   protected:
103     const egl::SurfaceState &mState;
104 };
105 
106 }  // namespace rx
107 
108 #endif  // LIBANGLE_RENDERER_SURFACEIMPL_H_
109