Go to the documentation of this file.
15 #include "libavutil/hwcontext_drm.h"
16 #include "libavutil/pixdesc.h"
19 #define LOC QString("DRMInterop: ")
29 #ifdef USING_DRM_VIDEO
44 std::vector<MythVideoTextureOpenGL*> textures = it.value();
45 for (
auto & texture : textures)
50 texture->m_data =
nullptr;
55 LOG(VB_PLAYBACK, LOG_INFO,
LOC + QString(
"Deleted %1 EGL images in %2 groups")
73 auto it = std::find_if(drm->second.cbegin(), drm->second.cend(), matchType);
74 if (it != drm->second.cend())
84 #ifdef USING_DRM_VIDEO
92 if (!drmtypes.empty())
98 AVDRMFrameDescriptor* result =
nullptr;
103 LOG(VB_GENERAL, LOG_ERR,
LOC + QString(
"Invalid DRM PRIME buffer %1 %2 %3 %4")
104 .arg(
Frame->m_buffer !=
nullptr).arg(
Frame->m_priv[0] !=
nullptr)
106 av_get_pix_fmt_name(
static_cast<AVPixelFormat
>(
Frame->m_pixFmt))));
113 LOG(VB_GENERAL, LOG_ERR,
LOC +
"Mismatched OpenGL contexts!");
118 QSize surfacesize(
Frame->m_width,
Frame->m_height);
122 LOG(VB_GENERAL, LOG_WARNING,
LOC +
"Video texture size changed!");
126 return reinterpret_cast<AVDRMFrameDescriptor*
>(
Frame->m_buffer);
129 std::vector<MythVideoTextureOpenGL*>
135 std::vector<MythVideoTextureOpenGL*> result;
143 #ifdef USING_DRM_VIDEO
144 if (HandleDRMVideo(ColourSpace,
Frame, drmdesc))
151 auto id =
reinterpret_cast<unsigned long long>(drmdesc);
153 auto Separate = [
this, id, drmdesc,
Frame, firstpass, ColourSpace]()
155 std::vector<MythVideoTextureOpenGL*> textures;
188 bool doublerate =
false;
199 LOG(VB_PLAYBACK, LOG_INFO,
LOC +
"Clearing progessive frame cache");
204 LOG(VB_PLAYBACK, LOG_INFO,
LOC +
"Clearing interlaced field cache");
221 LOG(VB_GENERAL, LOG_INFO,
LOC +
"YUV composition failed. Trying separate textures.");
235 Frame->m_deinterlaceInuse2x = doublerate;
236 bool tff =
Frame->m_interlacedReverse ? !
Frame->m_topFieldFirst :
Frame->m_topFieldFirst;
248 #ifdef USING_DRM_VIDEO
250 AVDRMFrameDescriptor* DRMDesc)
260 if (m_drm->IsValid())
263 if (m_drm->RenderFrame(DRMDesc,
Frame))
268 if (!m_drm->IsValid())
270 LOG(VB_GENERAL, LOG_INFO,
LOC +
"Disabling DRM video");
271 m_drmTriedAndFailed =
true;
static MythDRMPRIMEInterop * CreateDRM(MythRenderOpenGL *Context, MythPlayerUI *Player)
Create a DRM PRIME interop instance.
static void GetDRMTypes(MythRenderOpenGL *Render, MythInteropGPU::InteropMap &Types)
void * GetEGLDisplay(void)
void DeleteTextures(void) override
bool UpdateColourSpace(const MythVideoFrame *Frame)
Set the current colourspace to use.
static const struct wl_interface * types[]
void SetSupportedAttributes(PictureAttributeSupported Supported)
Enable the given set of picture attributes.
#define LOG(_MASK_, _LEVEL_, _QSTRING_)
static bool HaveDMABuf(MythRenderOpenGL *Context)
void eglDestroyImageKHR(void *Disp, void *Image)
std::map< VideoFrameType, InteropTypes > InteropMap
static bool YUVFormat(VideoFrameType Type)
std::vector< MythVideoTextureOpenGL * > CreateTextures(AVDRMFrameDescriptor *Desc, MythRenderOpenGL *Context, MythVideoFrame *Frame, bool UseSeparate, FrameScanType Scan=kScan_Progressive)
MythRenderOpenGL * m_openglContext
#define ALL_PICTURE_ATTRIBUTES
QHash< unsigned long long, std::vector< MythVideoTextureOpenGL * > > m_openglTextures
@ kPictureAttributeSupported_None
static bool DirectRenderingAvailable()
static QString FormatDescription(VideoFrameType Type)
virtual void DeleteTextures()
std::vector< MythVideoTextureOpenGL * > Acquire(MythRenderOpenGL *Context, MythVideoColourSpace *ColourSpace, MythVideoFrame *Frame, FrameScanType Scan) override
AVDRMFrameDescriptor * VerifyBuffer(MythRenderOpenGL *Context, MythVideoFrame *Frame)
~MythDRMPRIMEInterop() override
bool is_interlaced(FrameScanType Scan)
MythDRMPRIMEInterop(MythRenderOpenGL *Context, MythPlayerUI *Player, InteropType Type)
MythVideoColourSpace contains a QMatrix4x4 that can convert YCbCr data to RGB.
std::vector< InteropType > InteropTypes