xref: /aosp_15_r20/external/angle/src/libANGLE/renderer/vulkan/linux/DisplayVkLinux.h (revision 8975f5c5ed3d1c378011245431ada316dfb6f244)
1 //
2 // Copyright 2021 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 // DisplayVkLinux.h:
7 //    Defines the class interface for DisplayVkLinux, which is the base of DisplayVkSimple,
8 //    DisplayVkHeadless, DisplayVkXcb and DisplayVkWayland.  This base class implements the
9 //    common functionality of handling Linux dma-bufs.
10 //
11 
12 #ifndef LIBANGLE_RENDERER_VULKAN_DISPLAY_DISPLAYVKLINUX_H_
13 #define LIBANGLE_RENDERER_VULKAN_DISPLAY_DISPLAYVKLINUX_H_
14 
15 #include "libANGLE/renderer/vulkan/DisplayVk.h"
16 
17 namespace rx
18 {
19 class DisplayVkLinux : public DisplayVk
20 {
21   public:
22     DisplayVkLinux(const egl::DisplayState &state);
23 
24     DeviceImpl *createDevice() override;
25 
26     ExternalImageSiblingImpl *createExternalImageSibling(const gl::Context *context,
27                                                          EGLenum target,
28                                                          EGLClientBuffer buffer,
29                                                          const egl::AttributeMap &attribs) override;
30     std::vector<VkDrmFormatModifierPropertiesEXT> GetDrmModifiers(const DisplayVk *displayVk,
31                                                                   VkFormat vkFormat);
32     bool SupportsDrmModifiers(VkPhysicalDevice device, VkFormat vkFormat);
33     std::vector<VkFormat> GetVkFormatsWithDrmModifiers(const vk::Renderer *renderer);
34     std::vector<EGLint> GetDrmFormats(const vk::Renderer *renderer);
35     bool supportsDmaBufFormat(EGLint format) const override;
36     egl::Error queryDmaBufFormats(EGLint maxFormats, EGLint *formats, EGLint *numFormats) override;
37     egl::Error queryDmaBufModifiers(EGLint format,
38                                     EGLint maxModifiers,
39                                     EGLuint64KHR *modifiers,
40                                     EGLBoolean *externalOnly,
41                                     EGLint *numModifiers) override;
42 
43   private:
44     // Supported DRM formats
45     std::vector<EGLint> mDrmFormats;
46 
47     bool mDrmFormatsInitialized;
48 };
49 
50 }  // namespace rx
51 
52 #endif  // LIBANGLE_RENDERER_VULKAN_DISPLAY_DISPLAYVKLINUX_H_
53