7#define LOC QString("DRMPlane: ")
16 if (Type == DRM_PLANE_TYPE_OVERLAY)
return "Overlay";
17 if (Type == DRM_PLANE_TYPE_CURSOR)
return "Cursor";
18 if (Type == DRM_PLANE_TYPE_PRIMARY)
return "Primary";
25 if (
auto plane = std::shared_ptr<MythDRMPlane>(
new MythDRMPlane(FD, Id, Index)); plane && plane->m_id)
33 if (
auto * plane = drmModeGetPlane(FD, Id); plane)
35 auto id = plane->plane_id;
42 for (uint32_t j = 0; j < plane->count_formats; ++j)
44 m_formats.emplace_back(plane->formats[j]);
71 drmModeFreePlane(plane);
77 return QString(
"Plane #%1 %2 Index: %3 FB: %4 CRTC: %5 Formats: %6")
85 auto * planes = drmModeGetPlaneResources(FD);
88 LOG(VB_GENERAL, LOG_ERR, QString(drmGetDeviceNameFromFd2(FD)) +
": Failed to retrieve planes");
92 for (uint32_t index = 0; index < planes->count_planes; ++index)
96 if ((CRTCFilter > -1) && !(plane->m_possibleCrtcs & (1 << CRTCFilter)))
98 result.emplace_back(plane);
102 drmModeFreePlaneResources(planes);
109 for (
const auto & plane : Planes)
110 if ((plane->m_type == DRM_PLANE_TYPE_PRIMARY) && !plane->m_videoFormats.empty())
111 result.emplace_back(plane);
119 for (
const auto & plane : Planes)
120 if ((plane->m_type == DRM_PLANE_TYPE_OVERLAY) &&
HasOverlayFormat(plane->m_formats))
121 result.emplace_back(plane);
132 case DRM_FORMAT_RGB565:
return "RGB565";
133 case DRM_FORMAT_XRGB8888:
return "XRGB8888";
134 case DRM_FORMAT_XBGR8888:
return "XBGR8888";
135 case DRM_FORMAT_ARGB8888:
return "ARGB8888";
136 case DRM_FORMAT_RGBA8888:
return "RGBA8888";
137 case DRM_FORMAT_ABGR8888:
return "ABGR8888";
138 case DRM_FORMAT_BGRA8888:
return "BGRA8888";
139 case DRM_FORMAT_XRGB2101010:
return "XRGB2101010";
140 case DRM_FORMAT_XBGR2101010:
return "XBGR2101010";
141 case DRM_FORMAT_ARGB2101010:
return "ARGB2101010";
142 case DRM_FORMAT_ABGR2101010:
return "ABGR2101010";
156 for (
auto format : Formats)
171 DRM_FORMAT_YUV410, DRM_FORMAT_YVU410, DRM_FORMAT_YUV411, DRM_FORMAT_YVU411,
173 DRM_FORMAT_YUV444, DRM_FORMAT_YVU444,
175 DRM_FORMAT_YUYV, DRM_FORMAT_YVYU, DRM_FORMAT_UYVY, DRM_FORMAT_VYUY
178#ifdef __cpp_lib_ranges_contains
179 return std::ranges::contains(s_yuvFormats,
Format);
192 DRM_FORMAT_XRGB8888, DRM_FORMAT_XRGB8888, DRM_FORMAT_XBGR8888,
193 DRM_FORMAT_ARGB8888, DRM_FORMAT_ABGR8888, DRM_FORMAT_RGB565,
194 DRM_FORMAT_BGR565, DRM_FORMAT_XRGB2101010, DRM_FORMAT_XBGR2101010,
195 DRM_FORMAT_ARGB2101010, DRM_FORMAT_ABGR2101010
198 return std::ranges::any_of(Formats,
199 [](uint32_t format) {
200#ifdef __cpp_lib_ranges_contains
201 return std::ranges::contains(s_rgbFormats, format);
203 return std::ranges::any_of(s_rgbFormats,
214 DRM_FORMAT_ARGB8888, DRM_FORMAT_ABGR8888, DRM_FORMAT_ARGB2101010, DRM_FORMAT_ABGR2101010
217 for (
auto format : s_alphaFormats)
219#ifdef __cpp_lib_ranges_contains
220 if (std::ranges::contains(Formats, format))
222 if (std::ranges::any_of(Formats,
static const std::array< const std::string, 8 > formats
static QString FormatsToString(const FOURCCVec &Formats)
static bool FormatIsVideo(uint32_t Format)
QString Description() const
static DRMPlanes GetPlanes(int FD, int CRTCFilter=-1)
static bool HasOverlayFormat(const FOURCCVec &Formats)
Enusure list of supplied formats contains a format that is suitable for OpenGL/Vulkan.
static QString FormatToString(uint32_t Format)
static QString PlaneTypeToString(uint64_t Type)
static uint32_t GetAlphaFormat(const FOURCCVec &Formats)
static DRMPlanes FilterPrimaryPlanes(const DRMPlanes &Planes)
MythDRMPlane(int FD, uint32_t Id, uint32_t Index)
static DRMPlane Create(int FD, uint32_t Id, uint32_t Index)
static DRMPlanes FilterOverlayPlanes(const DRMPlanes &Planes)
static DRMProp GetProperty(const QString &Name, const DRMProps &Properties)
static DRMProps GetProperties(int FD, uint32_t ObjectId, uint32_t ObjectType)
static pid_list_t::iterator find(const PIDInfoMap &map, pid_list_t &list, pid_list_t::iterator begin, pid_list_t::iterator end, bool find_open)
#define DRM_FORMAT_INVALID
std::vector< DRMPlane > DRMPlanes
#define DRM_FORMAT_XRGB16161616F
#define DRM_FORMAT_ARGB16161616F
std::shared_ptr< class MythDRMPlane > DRMPlane
#define DRM_FORMAT_XBGR16161616F
std::vector< uint32_t > FOURCCVec
#define DRM_FORMAT_ABGR16161616F
static constexpr uint32_t DRM_FORMAT_NV12
static constexpr uint32_t DRM_FORMAT_NV21
static constexpr uint32_t DRM_FORMAT_YVU420
static constexpr uint32_t DRM_FORMAT_YUV420
#define LOG(_MASK_, _LEVEL_, _QSTRING_)