Go to the documentation of this file.
13 #include "libavutil/hwcontext_drm.h"
14 #include "libavutil/pixdesc.h"
17 #define LOC QString("DRMInterop: ")
27 #ifdef USING_DRM_VIDEO
42 std::vector<MythVideoTextureOpenGL*> textures = it.value();
43 for (
auto & texture : textures)
48 texture->m_data =
nullptr;
53 LOG(VB_PLAYBACK, LOG_INFO,
LOC + QString(
"Deleted %1 EGL images in %2 groups")
71 auto it = std::find_if(drm->second.cbegin(), drm->second.cend(), matchType);
72 if (it != drm->second.cend())
82 #ifdef USING_DRM_VIDEO
90 if (!drmtypes.empty())
96 AVDRMFrameDescriptor* result =
nullptr;
101 LOG(VB_GENERAL, LOG_ERR,
LOC + QString(
"Invalid DRM PRIME buffer %1 %2 %3 %4")
102 .arg(
Frame->m_buffer !=
nullptr).arg(
Frame->m_priv[0] !=
nullptr)
104 av_get_pix_fmt_name(
static_cast<AVPixelFormat
>(
Frame->m_pixFmt))));
111 LOG(VB_GENERAL, LOG_ERR,
LOC +
"Mismatched OpenGL contexts!");
116 QSize surfacesize(
Frame->m_width,
Frame->m_height);
120 LOG(VB_GENERAL, LOG_WARNING,
LOC +
"Video texture size changed!");
124 return reinterpret_cast<AVDRMFrameDescriptor*
>(
Frame->m_buffer);
127 std::vector<MythVideoTextureOpenGL*>
133 std::vector<MythVideoTextureOpenGL*> result;
141 #ifdef USING_DRM_VIDEO
142 if (HandleDRMVideo(ColourSpace,
Frame, drmdesc))
149 auto id =
reinterpret_cast<unsigned long long>(drmdesc);
151 auto Separate = [
this, id, drmdesc,
Frame, firstpass, ColourSpace]()
153 std::vector<MythVideoTextureOpenGL*> textures;
186 bool doublerate =
false;
197 LOG(VB_PLAYBACK, LOG_INFO,
LOC +
"Clearing progessive frame cache");
202 LOG(VB_PLAYBACK, LOG_INFO,
LOC +
"Clearing interlaced field cache");
219 LOG(VB_GENERAL, LOG_INFO,
LOC +
"YUV composition failed. Trying separate textures.");
233 Frame->m_deinterlaceInuse2x = doublerate;
234 bool tff =
Frame->m_interlacedReverse ? !
Frame->m_topFieldFirst :
Frame->m_topFieldFirst;
246 #ifdef USING_DRM_VIDEO
248 AVDRMFrameDescriptor* DRMDesc)
258 if (m_drm->IsValid())
261 if (m_drm->RenderFrame(DRMDesc,
Frame))
266 if (!m_drm->IsValid())
268 LOG(VB_GENERAL, LOG_INFO,
LOC +
"Disabling DRM video");
269 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