diff options
author | Daniel Baumann <daniel.baumann@progress-linux.org> | 2024-04-10 18:07:22 +0000 |
---|---|---|
committer | Daniel Baumann <daniel.baumann@progress-linux.org> | 2024-04-10 18:07:22 +0000 |
commit | c04dcc2e7d834218ef2d4194331e383402495ae1 (patch) | |
tree | 7333e38d10d75386e60f336b80c2443c1166031d /xbmc/windowing/gbm/drm/DRMObject.h | |
parent | Initial commit. (diff) | |
download | kodi-c04dcc2e7d834218ef2d4194331e383402495ae1.tar.xz kodi-c04dcc2e7d834218ef2d4194331e383402495ae1.zip |
Adding upstream version 2:20.4+dfsg.upstream/2%20.4+dfsg
Signed-off-by: Daniel Baumann <daniel.baumann@progress-linux.org>
Diffstat (limited to 'xbmc/windowing/gbm/drm/DRMObject.h')
-rw-r--r-- | xbmc/windowing/gbm/drm/DRMObject.h | 71 |
1 files changed, 71 insertions, 0 deletions
diff --git a/xbmc/windowing/gbm/drm/DRMObject.h b/xbmc/windowing/gbm/drm/DRMObject.h new file mode 100644 index 0000000..e2ae326 --- /dev/null +++ b/xbmc/windowing/gbm/drm/DRMObject.h @@ -0,0 +1,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 |