MythTV  master
Public Member Functions | Static Public Member Functions | Protected Member Functions | Private Member Functions | Static Private Member Functions | Private Attributes | List of all members
MythNVDECInterop Class Reference

#include <libmythtv/opengl/mythnvdecinterop.h>

Inheritance diagram for MythNVDECInterop:
[legend]
Collaboration diagram for MythNVDECInterop:
[legend]

Public Member Functions

bool IsValid ()
 
CUcontext GetCUDAContext ()
 
std::vector< MythVideoTextureOpenGL * > Acquire (MythRenderOpenGL *Context, MythVideoColourSpace *ColourSpace, MythVideoFrame *Frame, FrameScanType Scan) override
 Map CUDA video memory to OpenGL textures. More...
 
- Public Member Functions inherited from MythOpenGLInterop
 ~MythOpenGLInterop () override
 
- Public Member Functions inherited from MythInteropGPU
 MythInteropGPU (MythRender *Context, InteropType Type, MythPlayerUI *Player=nullptr)
 
 ~MythInteropGPU () override
 
InteropType GetType ()
 
MythPlayerUIGetPlayer ()
 
void SetDefaultFree (FreeAVHWDeviceContext FreeContext)
 
void SetDefaultUserOpaque (void *UserOpaque)
 
FreeAVHWDeviceContext GetDefaultFree ()
 
void * GetDefaultUserOpaque ()
 
- Public Member Functions inherited from ReferenceCounter
 ReferenceCounter (const QString &debugName, bool logDebug=true)
 Creates reference counter with an initial value of 1. More...
 
virtual int IncrRef (void)
 Increments reference count. More...
 
virtual int DecrRef (void)
 Decrements reference count and deletes on 0. More...
 

Static Public Member Functions

static void GetNVDECTypes (MythRenderOpenGL *Render, MythInteropGPU::InteropMap &Types)
 
static MythNVDECInteropCreateNVDEC (MythPlayerUI *Player, MythRenderOpenGL *Context)
 
static bool CreateCUDAContext (MythRenderOpenGL *GLContext, CudaFunctions *&CudaFuncs, CUcontext &CudaContext)
 
static void CleanupContext (MythRenderOpenGL *GLContext, CudaFunctions *&CudaFuncs, CUcontext &CudaContext)
 
- Static Public Member Functions inherited from MythOpenGLInterop
static void GetTypes (MythRender *Render, MythInteropGPU::InteropMap &Types)
 
static std::vector< MythVideoTextureOpenGL * > Retrieve (MythRenderOpenGL *Context, MythVideoColourSpace *ColourSpace, MythVideoFrame *Frame, FrameScanType Scan)
 
- Static Public Member Functions inherited from MythInteropGPU
static InteropMap GetTypes (MythRender *Render)
 
static QString TypeToString (InteropType Type)
 
static QString TypesToString (const InteropMap &Types)
 
static MythInteropGPUCreateDummy ()
 
- Static Public Member Functions inherited from ReferenceCounter
static void PrintDebug (void)
 Print out any leaks if that level of debugging is enabled. More...
 

Protected Member Functions

 MythNVDECInterop (MythPlayerUI *Player, MythRenderOpenGL *Context)
 
 ~MythNVDECInterop () override
 
- Protected Member Functions inherited from MythOpenGLInterop
 MythOpenGLInterop (MythRenderOpenGL *Context, InteropType Type, MythPlayerUI *Player=nullptr)
 
- Protected Member Functions inherited from ReferenceCounter
virtual ~ReferenceCounter (void)
 Called on destruction, will warn if object deleted with references in place. More...
 

Private Member Functions

bool InitialiseCuda ()
 Initialise a CUDA context. More...
 
void DeleteTextures () override
 
void RotateReferenceFrames (CUdeviceptr Buffer)
 

Static Private Member Functions

static bool CreateCUDAPriv (MythRenderOpenGL *GLContext, CudaFunctions *&CudaFuncs, CUcontext &CudaContext, bool &Retry)
 

Private Attributes

CUcontext m_cudaContext {}
 
CudaFunctions * m_cudaFuncs { nullptr }
 
QVector< CUdeviceptr > m_referenceFrames
 

Additional Inherited Members

- Public Types inherited from MythInteropGPU
enum  InteropType : std::uint8_t {
  Unsupported = 0, GL_VAAPIGLXCOPY, GL_VAAPIGLXPIX, GL_VAAPIEGLDRM,
  GL_VTB, GL_VTBSURFACE, GL_MEDIACODEC, GL_VDPAU,
  GL_NVDEC, GL_MMAL, GL_DRMPRIME, DRM_DRMPRIME,
  DUMMY
}
 
using InteropTypes = std::vector< InteropType >
 
using InteropMap = std::map< VideoFrameType, InteropTypes >
 
- Protected Attributes inherited from MythOpenGLInterop
MythRenderOpenGLm_openglContext { nullptr }
 
QHash< unsigned long long, std::vector< MythVideoTextureOpenGL * > > m_openglTextures
 
- Protected Attributes inherited from MythInteropGPU
MythRenderm_context { nullptr }
 
QSize m_textureSize
 
uint64_t m_discontinuityCounter { 0 }
 
FreeAVHWDeviceContext m_defaultFree { nullptr }
 
void * m_defaultUserOpaque { nullptr }
 
MythPlayerUIm_player { nullptr }
 
InteropType m_type { Unsupported }
 
- Protected Attributes inherited from ReferenceCounter
bool m_logDebug
 This is used to suppress creating LoggingItem classes for LoggingItem reference count changes. More...
 
QAtomicInt m_referenceCount {1}
 

Detailed Description

Definition at line 12 of file mythnvdecinterop.h.

Constructor & Destructor Documentation

◆ MythNVDECInterop()

MythNVDECInterop::MythNVDECInterop ( MythPlayerUI Player,
MythRenderOpenGL Context 
)
protected

Definition at line 31 of file mythnvdecinterop.cpp.

Referenced by CreateNVDEC().

◆ ~MythNVDECInterop()

MythNVDECInterop::~MythNVDECInterop ( )
overrideprotected

Definition at line 37 of file mythnvdecinterop.cpp.

Member Function Documentation

◆ GetNVDECTypes()

void MythNVDECInterop::GetNVDECTypes ( MythRenderOpenGL Render,
MythInteropGPU::InteropMap Types 
)
static

Definition at line 101 of file mythnvdecinterop.cpp.

Referenced by CreateNVDEC(), and MythOpenGLInterop::GetTypes().

◆ CreateNVDEC()

MythNVDECInterop * MythNVDECInterop::CreateNVDEC ( MythPlayerUI Player,
MythRenderOpenGL Context 
)
static

Definition at line 85 of file mythnvdecinterop.cpp.

Referenced by MythNVDECContext::InitialiseDecoder().

◆ CreateCUDAContext()

bool MythNVDECInterop::CreateCUDAContext ( MythRenderOpenGL GLContext,
CudaFunctions *&  CudaFuncs,
CUcontext &  CudaContext 
)
static

Definition at line 380 of file mythnvdecinterop.cpp.

Referenced by MythNVDECContext::GetProfiles(), and InitialiseCuda().

◆ CleanupContext()

void MythNVDECInterop::CleanupContext ( MythRenderOpenGL GLContext,
CudaFunctions *&  CudaFuncs,
CUcontext &  CudaContext 
)
static

◆ IsValid()

bool MythNVDECInterop::IsValid ( )

Definition at line 75 of file mythnvdecinterop.cpp.

◆ GetCUDAContext()

CUcontext MythNVDECInterop::GetCUDAContext ( )

Definition at line 80 of file mythnvdecinterop.cpp.

◆ Acquire()

std::vector< MythVideoTextureOpenGL * > MythNVDECInterop::Acquire ( MythRenderOpenGL Context,
MythVideoColourSpace ColourSpace,
MythVideoFrame Frame,
FrameScanType  Scan 
)
overridevirtual

Map CUDA video memory to OpenGL textures.

Note
This is not zero copy - although the copy will be extremely fast. It may be marginally quicker to implement a custom FFmpeg buffer pool that allocates textures and maps the texture storage to a CUdeviceptr (if that is possible). Alternatively EGL interopability may also be useful.

Reimplemented from MythOpenGLInterop.

Definition at line 115 of file mythnvdecinterop.cpp.

◆ InitialiseCuda()

bool MythNVDECInterop::InitialiseCuda ( )
private

Initialise a CUDA context.

Note
We do not use the FFmpeg internal context creation as the created context is deleted before we have a chance to cleanup our own CUDA resources.

Definition at line 320 of file mythnvdecinterop.cpp.

Referenced by MythNVDECInterop().

◆ DeleteTextures()

void MythNVDECInterop::DeleteTextures ( )
overrideprivatevirtual

Reimplemented from MythOpenGLInterop.

Definition at line 44 of file mythnvdecinterop.cpp.

Referenced by Acquire(), and ~MythNVDECInterop().

◆ RotateReferenceFrames()

void MythNVDECInterop::RotateReferenceFrames ( CUdeviceptr  Buffer)
private

Definition at line 419 of file mythnvdecinterop.cpp.

Referenced by Acquire().

◆ CreateCUDAPriv()

bool MythNVDECInterop::CreateCUDAPriv ( MythRenderOpenGL GLContext,
CudaFunctions *&  CudaFuncs,
CUcontext &  CudaContext,
bool Retry 
)
staticprivate

Definition at line 325 of file mythnvdecinterop.cpp.

Referenced by CreateCUDAContext().

Member Data Documentation

◆ m_cudaContext

CUcontext MythNVDECInterop::m_cudaContext {}
private

◆ m_cudaFuncs

CudaFunctions* MythNVDECInterop::m_cudaFuncs { nullptr }
private

◆ m_referenceFrames

QVector<CUdeviceptr> MythNVDECInterop::m_referenceFrames
private

Definition at line 41 of file mythnvdecinterop.h.

Referenced by Acquire(), RotateReferenceFrames(), and ~MythNVDECInterop().


The documentation for this class was generated from the following files: