blob: e077fc341862245f4b781394e37a54be19e0cfd3 (
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
|
/*
* 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 "DRMObject.h"
#include <map>
#include <drm_fourcc.h>
namespace KODI
{
namespace WINDOWING
{
namespace GBM
{
class CDRMPlane : public CDRMObject
{
public:
explicit CDRMPlane(int fd, uint32_t plane);
CDRMPlane(const CDRMPlane&) = delete;
CDRMPlane& operator=(const CDRMPlane&) = delete;
~CDRMPlane() = default;
uint32_t GetPlaneId() const { return m_plane->plane_id; }
uint32_t GetPossibleCrtcs() const { return m_plane->possible_crtcs; }
void FindModifiers();
void SetFormat(const uint32_t newFormat) { m_format = newFormat; }
uint32_t GetFormat() const { return m_format; }
std::vector<uint64_t>& GetModifiersForFormat(uint32_t format) { return m_modifiers_map[format]; }
bool SupportsFormat(uint32_t format);
bool SupportsFormatAndModifier(uint32_t format, uint64_t modifier);
private:
struct DrmModePlaneDeleter
{
void operator()(drmModePlane* p) { drmModeFreePlane(p); }
};
std::unique_ptr<drmModePlane, DrmModePlaneDeleter> m_plane;
std::map<uint32_t, std::vector<uint64_t>> m_modifiers_map;
uint32_t m_format{DRM_FORMAT_XRGB8888};
};
} // namespace GBM
} // namespace WINDOWING
} // namespace KODI
|