mirror of
https://github.com/moonlight-stream/moonlight-qt.git
synced 2025-07-18 10:32:38 +00:00
Pick a 10-bit DRM overlay for Main10 streaming
This commit is contained in:
parent
b85d5b8822
commit
b4665b6e5a
@ -6,6 +6,16 @@ extern "C" {
|
|||||||
|
|
||||||
#include <libdrm/drm_fourcc.h>
|
#include <libdrm/drm_fourcc.h>
|
||||||
|
|
||||||
|
// Special Rockchip type
|
||||||
|
#ifndef DRM_FORMAT_NV12_10
|
||||||
|
#define DRM_FORMAT_NV12_10 fourcc_code('N', 'A', '1', '2')
|
||||||
|
#endif
|
||||||
|
|
||||||
|
// Special Raspberry Pi type (upstreamed)
|
||||||
|
#ifndef DRM_FORMAT_P030
|
||||||
|
#define DRM_FORMAT_P030 fourcc_code('P', '0', '3', '0')
|
||||||
|
#endif
|
||||||
|
|
||||||
#include <unistd.h>
|
#include <unistd.h>
|
||||||
#include <fcntl.h>
|
#include <fcntl.h>
|
||||||
|
|
||||||
@ -236,16 +246,32 @@ bool DrmRenderer::initialize(PDECODER_PARAMETERS params)
|
|||||||
return DIRECT_RENDERING_INIT_FAILED;
|
return DIRECT_RENDERING_INIT_FAILED;
|
||||||
}
|
}
|
||||||
|
|
||||||
// Find an NV12 overlay plane to render on
|
// Find an overlay plane with the required format to render on
|
||||||
|
//
|
||||||
|
// FIXME: We should check the actual DRM format in a real AVFrame rather
|
||||||
|
// than just assuming it will be a certain hardcoded type like NV12 based
|
||||||
|
// on the chosen video format.
|
||||||
m_PlaneId = 0;
|
m_PlaneId = 0;
|
||||||
for (uint32_t i = 0; i < planeRes->count_planes && m_PlaneId == 0; i++) {
|
for (uint32_t i = 0; i < planeRes->count_planes && m_PlaneId == 0; i++) {
|
||||||
drmModePlane* plane = drmModeGetPlane(m_DrmFd, planeRes->planes[i]);
|
drmModePlane* plane = drmModeGetPlane(m_DrmFd, planeRes->planes[i]);
|
||||||
if (plane != nullptr) {
|
if (plane != nullptr) {
|
||||||
bool matchingFormat = false;
|
bool matchingFormat = false;
|
||||||
for (uint32_t j = 0; j < plane->count_formats; j++) {
|
for (uint32_t j = 0; j < plane->count_formats && !matchingFormat; j++) {
|
||||||
if (plane->formats[j] == DRM_FORMAT_NV12) {
|
if (params->videoFormat == VIDEO_FORMAT_H265_MAIN10) {
|
||||||
matchingFormat = true;
|
switch (plane->formats[j]) {
|
||||||
break;
|
case DRM_FORMAT_P010:
|
||||||
|
case DRM_FORMAT_P030:
|
||||||
|
case DRM_FORMAT_NV12_10:
|
||||||
|
matchingFormat = true;
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
else {
|
||||||
|
switch (plane->formats[j]) {
|
||||||
|
case DRM_FORMAT_NV12:
|
||||||
|
matchingFormat = true;
|
||||||
|
break;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Loading…
x
Reference in New Issue
Block a user