xref: /aosp_15_r20/external/angle/src/libANGLE/renderer/DisplayImpl.cpp (revision 8975f5c5ed3d1c378011245431ada316dfb6f244)
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     }
generateExtensions(egl::DeviceExtensions * outExtensions) const30     void generateExtensions(egl::DeviceExtensions *outExtensions) const override
31     {
32         *outExtensions = egl::DeviceExtensions();
33     }
34 };
35 }  // anonymous namespace
36 
DisplayImpl(const egl::DisplayState & state)37 DisplayImpl::DisplayImpl(const egl::DisplayState &state)
38     : mState(state), mExtensionsInitialized(false), mCapsInitialized(false), mBlobCache(nullptr)
39 {}
40 
~DisplayImpl()41 DisplayImpl::~DisplayImpl()
42 {
43     ASSERT(mState.surfaceMap.empty());
44 }
45 
prepareForCall()46 egl::Error DisplayImpl::prepareForCall()
47 {
48     return egl::NoError();
49 }
50 
releaseThread()51 egl::Error DisplayImpl::releaseThread()
52 {
53     return egl::NoError();
54 }
55 
getExtensions() const56 const egl::DisplayExtensions &DisplayImpl::getExtensions() const
57 {
58     if (!mExtensionsInitialized)
59     {
60         generateExtensions(&mExtensions);
61         mExtensionsInitialized = true;
62     }
63 
64     return mExtensions;
65 }
66 
handleGPUSwitch()67 egl::Error DisplayImpl::handleGPUSwitch()
68 {
69     return egl::NoError();
70 }
71 
forceGPUSwitch(EGLint gpuIDHigh,EGLint gpuIDLow)72 egl::Error DisplayImpl::forceGPUSwitch(EGLint gpuIDHigh, EGLint gpuIDLow)
73 {
74     return egl::NoError();
75 }
76 
waitUntilWorkScheduled()77 egl::Error DisplayImpl::waitUntilWorkScheduled()
78 {
79     return egl::NoError();
80 }
81 
validateClientBuffer(const egl::Config * configuration,EGLenum buftype,EGLClientBuffer clientBuffer,const egl::AttributeMap & attribs) const82 egl::Error DisplayImpl::validateClientBuffer(const egl::Config *configuration,
83                                              EGLenum buftype,
84                                              EGLClientBuffer clientBuffer,
85                                              const egl::AttributeMap &attribs) const
86 {
87     UNREACHABLE();
88     return egl::EglBadDisplay() << "DisplayImpl::validateClientBuffer unimplemented.";
89 }
90 
validateImageClientBuffer(const gl::Context * context,EGLenum target,EGLClientBuffer clientBuffer,const egl::AttributeMap & attribs) const91 egl::Error DisplayImpl::validateImageClientBuffer(const gl::Context *context,
92                                                   EGLenum target,
93                                                   EGLClientBuffer clientBuffer,
94                                                   const egl::AttributeMap &attribs) const
95 {
96     UNREACHABLE();
97     return egl::EglBadDisplay() << "DisplayImpl::validateImageClientBuffer unimplemented.";
98 }
99 
validatePixmap(const egl::Config * config,EGLNativePixmapType pixmap,const egl::AttributeMap & attributes) const100 egl::Error DisplayImpl::validatePixmap(const egl::Config *config,
101                                        EGLNativePixmapType pixmap,
102                                        const egl::AttributeMap &attributes) const
103 {
104     UNREACHABLE();
105     return egl::EglBadDisplay() << "DisplayImpl::valdiatePixmap unimplemented.";
106 }
107 
getCaps() const108 const egl::Caps &DisplayImpl::getCaps() const
109 {
110     if (!mCapsInitialized)
111     {
112         generateCaps(&mCaps);
113         mCapsInitialized = true;
114     }
115 
116     return mCaps;
117 }
118 
createDevice()119 DeviceImpl *DisplayImpl::createDevice()
120 {
121     return new MockDevice();
122 }
123 
getWindowSystem() const124 angle::NativeWindowSystem DisplayImpl::getWindowSystem() const
125 {
126     return angle::NativeWindowSystem::Other;
127 }
128 
supportsDmaBufFormat(EGLint format) const129 bool DisplayImpl::supportsDmaBufFormat(EGLint format) const
130 {
131     UNREACHABLE();
132     return false;
133 }
134 
queryDmaBufFormats(EGLint max_formats,EGLint * formats,EGLint * num_formats)135 egl::Error DisplayImpl::queryDmaBufFormats(EGLint max_formats, EGLint *formats, EGLint *num_formats)
136 {
137     UNREACHABLE();
138     return egl::NoError();
139 }
140 
queryDmaBufModifiers(EGLint format,EGLint max_modifiers,EGLuint64KHR * modifiers,EGLBoolean * external_only,EGLint * num_modifiers)141 egl::Error DisplayImpl::queryDmaBufModifiers(EGLint format,
142                                              EGLint max_modifiers,
143                                              EGLuint64KHR *modifiers,
144                                              EGLBoolean *external_only,
145                                              EGLint *num_modifiers)
146 {
147     UNREACHABLE();
148     return egl::NoError();
149 }
150 }  // namespace rx
151