• 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 // DisplayImpl.h: Implementation methods of egl::Display
8 
9 #ifndef LIBANGLE_RENDERER_DISPLAYIMPL_H_
10 #define LIBANGLE_RENDERER_DISPLAYIMPL_H_
11 
12 #include "common/angleutils.h"
13 #include "libANGLE/Caps.h"
14 #include "libANGLE/Config.h"
15 #include "libANGLE/Error.h"
16 #include "libANGLE/Stream.h"
17 #include "libANGLE/Version.h"
18 #include "libANGLE/renderer/EGLImplFactory.h"
19 #include "platform/Feature.h"
20 
21 #include <set>
22 #include <vector>
23 
24 namespace angle
25 {
26 struct FrontendFeatures;
27 }  // namespace angle
28 
29 namespace egl
30 {
31 class AttributeMap;
32 class BlobCache;
33 class Display;
34 struct DisplayState;
35 struct Config;
36 class Surface;
37 class ImageSibling;
38 class Thread;
39 }  // namespace egl
40 
41 namespace gl
42 {
43 class Context;
44 }  // namespace gl
45 
46 namespace rx
47 {
48 class SurfaceImpl;
49 class ImageImpl;
50 struct ConfigDesc;
51 class DeviceImpl;
52 class StreamProducerImpl;
53 
54 class ShareGroupImpl : angle::NonCopyable
55 {
56   public:
ShareGroupImpl()57     ShareGroupImpl() {}
~ShareGroupImpl()58     virtual ~ShareGroupImpl() {}
59 };
60 
61 class DisplayImpl : public EGLImplFactory
62 {
63   public:
64     DisplayImpl(const egl::DisplayState &state);
65     ~DisplayImpl() override;
66 
67     virtual egl::Error initialize(egl::Display *display) = 0;
68     virtual void terminate()                             = 0;
69 
70     virtual egl::Error makeCurrent(egl::Surface *drawSurface,
71                                    egl::Surface *readSurface,
72                                    gl::Context *context) = 0;
73 
74     virtual egl::ConfigSet generateConfigs() = 0;
75 
76     virtual bool testDeviceLost()                                     = 0;
77     virtual egl::Error restoreLostDevice(const egl::Display *display) = 0;
78 
79     virtual bool isValidNativeWindow(EGLNativeWindowType window) const = 0;
80     virtual egl::Error validateClientBuffer(const egl::Config *configuration,
81                                             EGLenum buftype,
82                                             EGLClientBuffer clientBuffer,
83                                             const egl::AttributeMap &attribs) const;
84     virtual egl::Error validateImageClientBuffer(const gl::Context *context,
85                                                  EGLenum target,
86                                                  EGLClientBuffer clientBuffer,
87                                                  const egl::AttributeMap &attribs) const;
88 
89     virtual std::string getVendorString() const = 0;
90 
91     virtual DeviceImpl *createDevice() = 0;
92 
93     virtual egl::Error waitClient(const gl::Context *context)                = 0;
94     virtual egl::Error waitNative(const gl::Context *context, EGLint engine) = 0;
95     virtual gl::Version getMaxSupportedESVersion() const                     = 0;
96     virtual gl::Version getMaxConformantESVersion() const                    = 0;
97     const egl::Caps &getCaps() const;
98 
setBlobCacheFuncs(EGLSetBlobFuncANDROID set,EGLGetBlobFuncANDROID get)99     virtual void setBlobCacheFuncs(EGLSetBlobFuncANDROID set, EGLGetBlobFuncANDROID get) {}
100 
101     const egl::DisplayExtensions &getExtensions() const;
102 
setBlobCache(egl::BlobCache * blobCache)103     void setBlobCache(egl::BlobCache *blobCache) { mBlobCache = blobCache; }
getBlobCache()104     egl::BlobCache *getBlobCache() const { return mBlobCache; }
105 
initializeFrontendFeatures(angle::FrontendFeatures * features)106     virtual void initializeFrontendFeatures(angle::FrontendFeatures *features) const {}
107 
108     virtual void populateFeatureList(angle::FeatureList *features) = 0;
109 
getState()110     const egl::DisplayState &getState() const { return mState; }
111 
112   protected:
113     const egl::DisplayState &mState;
114 
115   private:
116     virtual void generateExtensions(egl::DisplayExtensions *outExtensions) const = 0;
117     virtual void generateCaps(egl::Caps *outCaps) const                          = 0;
118 
119     mutable bool mExtensionsInitialized;
120     mutable egl::DisplayExtensions mExtensions;
121 
122     mutable bool mCapsInitialized;
123     mutable egl::Caps mCaps;
124 
125     egl::BlobCache *mBlobCache;
126 };
127 
128 }  // namespace rx
129 
130 #endif  // LIBANGLE_RENDERER_DISPLAYIMPL_H_
131