xref: /aosp_15_r20/external/angle/src/libANGLE/renderer/vulkan/linux/xcb/DisplayVkXcb.h (revision 8975f5c5ed3d1c378011245431ada316dfb6f244)
1 //
2 // Copyright 2016 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 // DisplayVkXcb.h:
7 //    Defines the class interface for DisplayVkXcb, implementing DisplayVk for X via XCB.
8 //
9 
10 #ifndef LIBANGLE_RENDERER_VULKAN_XCB_DISPLAYVKXCB_H_
11 #define LIBANGLE_RENDERER_VULKAN_XCB_DISPLAYVKXCB_H_
12 
13 #include "libANGLE/renderer/vulkan/linux/DisplayVkLinux.h"
14 
15 struct xcb_connection_t;
16 
17 namespace rx
18 {
19 
20 class DisplayVkXcb : public DisplayVkLinux
21 {
22   public:
23     DisplayVkXcb(const egl::DisplayState &state);
24 
25     egl::Error initialize(egl::Display *display) override;
26     void terminate() override;
27 
28     bool isValidNativeWindow(EGLNativeWindowType window) const override;
29 
30     SurfaceImpl *createWindowSurfaceVk(const egl::SurfaceState &state,
31                                        EGLNativeWindowType window) override;
32 
33     egl::ConfigSet generateConfigs() override;
34     void checkConfigSupport(egl::Config *config) override;
35 
36     const char *getWSIExtension() const override;
37     angle::Result waitNativeImpl() override;
38 
getWindowSystem()39     angle::NativeWindowSystem getWindowSystem() const override
40     {
41         return angle::NativeWindowSystem::X11;
42     }
43 
44   private:
45     xcb_connection_t *mXcbConnection;
46     // If there is no X Display, obviously it's impossible to connect to it with Xcb,
47     // so rendering to windows is not supported, but rendering to pbuffers is still supported.
48     // This mode is used in headless ozone testing.
49     bool mHasXDisplay;
50 };
51 
52 }  // namespace rx
53 
54 #endif  // LIBANGLE_RENDERER_VULKAN_XCB_DISPLAYVKXCB_H_
55