kodi
DRMPlane.h
1 /*
2  * Copyright (C) 2005-2020 Team Kodi
3  * This file is part of Kodi - https://kodi.tv
4  *
5  * SPDX-License-Identifier: GPL-2.0-or-later
6  * See LICENSES/README.md for more information.
7  */
8 
9 #pragma once
10 
11 #include "DRMObject.h"
12 
13 #include <map>
14 
15 #include <drm_fourcc.h>
16 
17 namespace KODI
18 {
19 namespace WINDOWING
20 {
21 namespace GBM
22 {
23 
24 class CDRMPlane : public CDRMObject
25 {
26 public:
27  explicit CDRMPlane(int fd, uint32_t plane);
28  CDRMPlane(const CDRMPlane&) = delete;
29  CDRMPlane& operator=(const CDRMPlane&) = delete;
30  ~CDRMPlane() = default;
31 
32  uint32_t GetPlaneId() const { return m_plane->plane_id; }
33  uint32_t GetPossibleCrtcs() const { return m_plane->possible_crtcs; }
34 
35  void FindModifiers();
36 
37  void SetFormat(const uint32_t newFormat) { m_format = newFormat; }
38  uint32_t GetFormat() const { return m_format; }
39  std::vector<uint64_t>& GetModifiersForFormat(uint32_t format) { return m_modifiers_map[format]; }
40 
41  bool SupportsFormat(uint32_t format);
42  bool SupportsFormatAndModifier(uint32_t format, uint64_t modifier);
43 
44 private:
45  struct DrmModePlaneDeleter
46  {
47  void operator()(drmModePlane* p) { drmModeFreePlane(p); }
48  };
49 
50  std::unique_ptr<drmModePlane, DrmModePlaneDeleter> m_plane;
51 
52  std::map<uint32_t, std::vector<uint64_t>> m_modifiers_map;
53  uint32_t m_format{DRM_FORMAT_XRGB8888};
54 };
55 
56 } // namespace GBM
57 } // namespace WINDOWING
58 } // namespace KODI
Definition: DRMObject.h:27
Definition: DRMPlane.h:24
Definition: AudioDecoder.h:18