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 DisplayImpl : public EGLImplFactory 55 { 56 public: 57 DisplayImpl(const egl::DisplayState &state); 58 ~DisplayImpl() override; 59 60 virtual egl::Error initialize(egl::Display *display) = 0; 61 virtual void terminate() = 0; 62 63 virtual egl::Error makeCurrent(egl::Surface *drawSurface, 64 egl::Surface *readSurface, 65 gl::Context *context) = 0; 66 67 virtual egl::ConfigSet generateConfigs() = 0; 68 69 virtual bool testDeviceLost() = 0; 70 virtual egl::Error restoreLostDevice(const egl::Display *display) = 0; 71 72 virtual bool isValidNativeWindow(EGLNativeWindowType window) const = 0; 73 virtual egl::Error validateClientBuffer(const egl::Config *configuration, 74 EGLenum buftype, 75 EGLClientBuffer clientBuffer, 76 const egl::AttributeMap &attribs) const; 77 virtual egl::Error validateImageClientBuffer(const gl::Context *context, 78 EGLenum target, 79 EGLClientBuffer clientBuffer, 80 const egl::AttributeMap &attribs) const; 81 82 virtual std::string getVendorString() const = 0; 83 84 virtual DeviceImpl *createDevice() = 0; 85 86 virtual egl::Error waitClient(const gl::Context *context) = 0; 87 virtual egl::Error waitNative(const gl::Context *context, EGLint engine) = 0; 88 virtual gl::Version getMaxSupportedESVersion() const = 0; 89 virtual gl::Version getMaxConformantESVersion() const = 0; 90 const egl::Caps &getCaps() const; 91 setBlobCacheFuncs(EGLSetBlobFuncANDROID set,EGLGetBlobFuncANDROID get)92 virtual void setBlobCacheFuncs(EGLSetBlobFuncANDROID set, EGLGetBlobFuncANDROID get) {} 93 94 const egl::DisplayExtensions &getExtensions() const; 95 setBlobCache(egl::BlobCache * blobCache)96 void setBlobCache(egl::BlobCache *blobCache) { mBlobCache = blobCache; } getBlobCache()97 egl::BlobCache *getBlobCache() const { return mBlobCache; } 98 initializeFrontendFeatures(angle::FrontendFeatures * features)99 virtual void initializeFrontendFeatures(angle::FrontendFeatures *features) const {} 100 101 virtual void populateFeatureList(angle::FeatureList *features) = 0; 102 getState()103 const egl::DisplayState &getState() const { return mState; } 104 105 protected: 106 const egl::DisplayState &mState; 107 108 private: 109 virtual void generateExtensions(egl::DisplayExtensions *outExtensions) const = 0; 110 virtual void generateCaps(egl::Caps *outCaps) const = 0; 111 112 mutable bool mExtensionsInitialized; 113 mutable egl::DisplayExtensions mExtensions; 114 115 mutable bool mCapsInitialized; 116 mutable egl::Caps mCaps; 117 118 egl::BlobCache *mBlobCache; 119 }; 120 121 } // namespace rx 122 123 #endif // LIBANGLE_RENDERER_DISPLAYIMPL_H_ 124