blob: e2ae32652cae1b6b8721f2d4a585b411531a690a (
plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
|
/*
* Copyright (C) 2005-2020 Team Kodi
* This file is part of Kodi - https://kodi.tv
*
* SPDX-License-Identifier: GPL-2.0-or-later
* See LICENSES/README.md for more information.
*/
#pragma once
#include <cstddef>
#include <cstdint>
#include <memory>
#include <vector>
#include <xf86drmMode.h>
namespace KODI
{
namespace WINDOWING
{
namespace GBM
{
class CDRMObject
{
public:
CDRMObject(const CDRMObject&) = delete;
CDRMObject& operator=(const CDRMObject&) = delete;
virtual ~CDRMObject() = default;
std::string GetTypeName() const;
std::string GetPropertyName(uint32_t propertyId) const;
uint32_t GetId() const { return m_id; }
uint32_t GetPropertyId(const std::string& name) const;
std::tuple<bool, uint64_t> GetPropertyValue(const std::string& name,
const std::string& valueName) const;
bool SetProperty(const std::string& name, uint64_t value);
bool SupportsProperty(const std::string& name);
protected:
explicit CDRMObject(int fd);
bool GetProperties(uint32_t id, uint32_t type);
struct DrmModeObjectPropertiesDeleter
{
void operator()(drmModeObjectProperties* p) { drmModeFreeObjectProperties(p); }
};
std::unique_ptr<drmModeObjectProperties, DrmModeObjectPropertiesDeleter> m_props;
struct DrmModePropertyResDeleter
{
void operator()(drmModePropertyRes* p) { drmModeFreeProperty(p); }
};
std::vector<std::unique_ptr<drmModePropertyRes, DrmModePropertyResDeleter>> m_propsInfo;
int m_fd{-1};
private:
uint32_t m_id{0};
uint32_t m_type{0};
};
} // namespace GBM
} // namespace WINDOWING
} // namespace KODI
|