• 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.cpp: Implementation methods of egl::Display
8 
9 #include "libANGLE/renderer/DisplayImpl.h"
10 
11 #include "libANGLE/Display.h"
12 #include "libANGLE/Surface.h"
13 #include "libANGLE/renderer/DeviceImpl.h"
14 
15 namespace rx
16 {
17 namespace
18 {
19 // For back-ends that do not implement EGLDevice.
20 class MockDevice : public DeviceImpl
21 {
22   public:
23     MockDevice() = default;
initialize()24     egl::Error initialize() override { return egl::NoError(); }
getAttribute(const egl::Display * display,EGLint attribute,void ** outValue)25     egl::Error getAttribute(const egl::Display *display, EGLint attribute, void **outValue) override
26     {
27         UNREACHABLE();
28         return egl::EglBadAttribute();
29     }
getType()30     EGLint getType() override
31     {
32         UNREACHABLE();
33         return EGL_NONE;
34     }
generateExtensions(egl::DeviceExtensions * outExtensions) const35     void generateExtensions(egl::DeviceExtensions *outExtensions) const override
36     {
37         *outExtensions = egl::DeviceExtensions();
38     }
39 };
40 }  // anonymous namespace
41 
DisplayImpl(const egl::DisplayState & state)42 DisplayImpl::DisplayImpl(const egl::DisplayState &state)
43     : mState(state), mExtensionsInitialized(false), mCapsInitialized(false), mBlobCache(nullptr)
44 {}
45 
~DisplayImpl()46 DisplayImpl::~DisplayImpl()
47 {
48     ASSERT(mState.surfaceMap.empty());
49 }
50 
prepareForCall()51 egl::Error DisplayImpl::prepareForCall()
52 {
53     return egl::NoError();
54 }
55 
releaseThread()56 egl::Error DisplayImpl::releaseThread()
57 {
58     return egl::NoError();
59 }
60 
getExtensions() const61 const egl::DisplayExtensions &DisplayImpl::getExtensions() const
62 {
63     if (!mExtensionsInitialized)
64     {
65         generateExtensions(&mExtensions);
66         mExtensionsInitialized = true;
67     }
68 
69     return mExtensions;
70 }
71 
handleGPUSwitch()72 egl::Error DisplayImpl::handleGPUSwitch()
73 {
74     return egl::NoError();
75 }
76 
forceGPUSwitch(EGLint gpuIDHigh,EGLint gpuIDLow)77 egl::Error DisplayImpl::forceGPUSwitch(EGLint gpuIDHigh, EGLint gpuIDLow)
78 {
79     return egl::NoError();
80 }
81 
waitUntilWorkScheduled()82 egl::Error DisplayImpl::waitUntilWorkScheduled()
83 {
84     return egl::NoError();
85 }
86 
validateClientBuffer(const egl::Config * configuration,EGLenum buftype,EGLClientBuffer clientBuffer,const egl::AttributeMap & attribs) const87 egl::Error DisplayImpl::validateClientBuffer(const egl::Config *configuration,
88                                              EGLenum buftype,
89                                              EGLClientBuffer clientBuffer,
90                                              const egl::AttributeMap &attribs) const
91 {
92     UNREACHABLE();
93     return egl::EglBadDisplay() << "DisplayImpl::validateClientBuffer unimplemented.";
94 }
95 
validateImageClientBuffer(const gl::Context * context,EGLenum target,EGLClientBuffer clientBuffer,const egl::AttributeMap & attribs) const96 egl::Error DisplayImpl::validateImageClientBuffer(const gl::Context *context,
97                                                   EGLenum target,
98                                                   EGLClientBuffer clientBuffer,
99                                                   const egl::AttributeMap &attribs) const
100 {
101     UNREACHABLE();
102     return egl::EglBadDisplay() << "DisplayImpl::validateImageClientBuffer unimplemented.";
103 }
104 
validatePixmap(const egl::Config * config,EGLNativePixmapType pixmap,const egl::AttributeMap & attributes) const105 egl::Error DisplayImpl::validatePixmap(const egl::Config *config,
106                                        EGLNativePixmapType pixmap,
107                                        const egl::AttributeMap &attributes) const
108 {
109     UNREACHABLE();
110     return egl::EglBadDisplay() << "DisplayImpl::valdiatePixmap unimplemented.";
111 }
112 
getCaps() const113 const egl::Caps &DisplayImpl::getCaps() const
114 {
115     if (!mCapsInitialized)
116     {
117         generateCaps(&mCaps);
118         mCapsInitialized = true;
119     }
120 
121     return mCaps;
122 }
123 
createDevice()124 DeviceImpl *DisplayImpl::createDevice()
125 {
126     return new MockDevice();
127 }
128 
isX11() const129 bool DisplayImpl::isX11() const
130 {
131     return false;
132 }
133 
isWayland() const134 bool DisplayImpl::isWayland() const
135 {
136     return false;
137 }
138 
isGBM() const139 bool DisplayImpl::isGBM() const
140 {
141     return false;
142 }
143 
supportsDmaBufFormat(EGLint format) const144 bool DisplayImpl::supportsDmaBufFormat(EGLint format) const
145 {
146     UNREACHABLE();
147     return false;
148 }
149 
queryDmaBufFormats(EGLint max_formats,EGLint * formats,EGLint * num_formats)150 egl::Error DisplayImpl::queryDmaBufFormats(EGLint max_formats, EGLint *formats, EGLint *num_formats)
151 {
152     UNREACHABLE();
153     return egl::NoError();
154 }
155 
queryDmaBufModifiers(EGLint format,EGLint max_modifiers,EGLuint64KHR * modifiers,EGLBoolean * external_only,EGLint * num_modifiers)156 egl::Error DisplayImpl::queryDmaBufModifiers(EGLint format,
157                                              EGLint max_modifiers,
158                                              EGLuint64KHR *modifiers,
159                                              EGLBoolean *external_only,
160                                              EGLint *num_modifiers)
161 {
162     UNREACHABLE();
163     return egl::NoError();
164 }
165 }  // namespace rx
166