xbmc
DRMObject.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 <cstddef>
12 #include <cstdint>
13 #include <memory>
14 #include <vector>
15 
16 #include <xf86drmMode.h>
17 
18 namespace KODI
19 {
20 namespace WINDOWING
21 {
22 namespace GBM
23 {
24 
26 {
27 public:
28  CDRMObject(const CDRMObject&) = delete;
29  CDRMObject& operator=(const CDRMObject&) = delete;
30  virtual ~CDRMObject() = default;
31 
32  std::string GetTypeName() const;
33  std::string GetPropertyName(uint32_t propertyId) const;
34 
35  uint32_t GetId() const { return m_id; }
36  uint32_t GetPropertyId(const std::string& name) const;
37  std::tuple<bool, uint64_t> GetPropertyValue(const std::string& name,
38  const std::string& valueName) const;
39 
40  bool SetProperty(const std::string& name, uint64_t value);
41  bool SupportsProperty(const std::string& name);
42 
43 protected:
44  explicit CDRMObject(int fd);
45 
46  bool GetProperties(uint32_t id, uint32_t type);
47 
49  {
50  void operator()(drmModeObjectProperties* p) { drmModeFreeObjectProperties(p); }
51  };
52 
53  std::unique_ptr<drmModeObjectProperties, DrmModeObjectPropertiesDeleter> m_props;
54 
56  {
57  void operator()(drmModePropertyRes* p) { drmModeFreeProperty(p); }
58  };
59 
60  std::vector<std::unique_ptr<drmModePropertyRes, DrmModePropertyResDeleter>> m_propsInfo;
61 
62  int m_fd{-1};
63 
64 private:
65  uint32_t m_id{0};
66  uint32_t m_type{0};
67 };
68 
69 } // namespace GBM
70 } // namespace WINDOWING
71 } // namespace KODI
Definition: DRMObject.h:25
std::tuple< bool, uint64_t > GetPropertyValue(const std::string &name, const std::string &valueName) const
Definition: DRMObject.cpp:84
Controller configuration window.
Definition: AudioDecoder.h:18