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

#include <mythnvdecinterop.h>

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

Public Member Functions

bool IsValid (void)
 
CUcontext GetCUDAContext (void)
 
vector< MythVideoTexture * > Acquire (MythRenderOpenGL *Context, VideoColourSpace *ColourSpace, VideoFrame *Frame, FrameScanType Scan) override
 Map CUDA video memory to OpenGL textures. More...
 
- Public Member Functions inherited from MythOpenGLInterop
 ~MythOpenGLInterop () override
 
Type GetType (void)
 
MythPlayerGetPlayer (void)
 
void SetPlayer (MythPlayer *Player)
 
void SetDefaultFree (FreeAVHWDeviceContext FreeContext)
 
void SetDefaultUserOpaque (void *UserOpaque)
 
FreeAVHWDeviceContext GetDefaultFree (void)
 
void * GetDefaultUserOpaque (void)
 
- 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 MythNVDECInteropCreate (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 QStringList GetAllowedRenderers (VideoFrameType Format)
 
static Type GetInteropType (VideoFrameType Format, MythPlayer *Player)
 Check whether we support direct rendering for the given VideoFrameType. More...
 
static void GetInteropTypeCallback (void *Wait, void *Format, void *Result)
 
static vector< MythVideoTexture * > Retrieve (MythRenderOpenGL *Context, VideoColourSpace *ColourSpace, VideoFrame *Frame, FrameScanType Scan)
 
static QString TypeToString (Type InteropType)
 
static MythOpenGLInteropCreateDummy (void)
 
- 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 (MythRenderOpenGL *Context)
 
 ~MythNVDECInterop () override
 
- Protected Member Functions inherited from MythOpenGLInterop
 MythOpenGLInterop (MythRenderOpenGL *Context, Type InteropType)
 
- Protected Member Functions inherited from ReferenceCounter
virtual ~ReferenceCounter (void)
 Called on destruction, will warn if object deleted with references in place. More...
 

Static Protected Member Functions

static Type GetInteropType (VideoFrameType Format)
 

Private Member Functions

bool InitialiseCuda (void)
 Initialise a CUDA context. More...
 
void DeleteTextures (void) 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
 

Friends

class MythOpenGLInterop
 

Additional Inherited Members

- Public Types inherited from MythOpenGLInterop
enum  Type {
  Unsupported = 0, VAAPIGLXCOPY, VAAPIGLXPIX, VAAPIEGLDRM,
  VTBOPENGL, VTBSURFACE, MEDIACODEC, VDPAU,
  NVDEC, MMAL, DRMPRIME, DUMMY
}
 
- Protected Attributes inherited from MythOpenGLInterop
MythRenderOpenGLm_context
 
Type m_type
 
QHash< unsigned long long, vector< MythVideoTexture * > > m_openglTextures
 
QSize m_openglTextureSize { }
 
long long m_discontinuityCounter { 0 }
 
FreeAVHWDeviceContext m_defaultFree { nullptr }
 
void * m_defaultUserOpaque { nullptr }
 
MythPlayerm_player { nullptr }
 
- 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 13 of file mythnvdecinterop.h.

Constructor & Destructor Documentation

◆ MythNVDECInterop()

MythNVDECInterop::MythNVDECInterop ( MythRenderOpenGL Context)
explicitprotected

Definition at line 23 of file mythnvdecinterop.cpp.

Referenced by Create().

◆ ~MythNVDECInterop()

MythNVDECInterop::~MythNVDECInterop ( )
overrideprotected

Definition at line 30 of file mythnvdecinterop.cpp.

Member Function Documentation

◆ Create()

MythNVDECInterop * MythNVDECInterop::Create ( MythRenderOpenGL Context)
static

Definition at line 78 of file mythnvdecinterop.cpp.

Referenced by MythNVDECContext::InitialiseDecoder().

◆ CreateCUDAContext()

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

Definition at line 369 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 ( void  )

Definition at line 68 of file mythnvdecinterop.cpp.

Referenced by MythNVDECContext::InitialiseDecoder().

◆ GetCUDAContext()

CUcontext MythNVDECInterop::GetCUDAContext ( void  )

Definition at line 73 of file mythnvdecinterop.cpp.

Referenced by MythNVDECContext::InitialiseDecoder().

◆ Acquire()

vector< MythVideoTexture * > MythNVDECInterop::Acquire ( MythRenderOpenGL Context,
VideoColourSpace ColourSpace,
VideoFrame 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 102 of file mythnvdecinterop.cpp.

◆ GetInteropType()

MythOpenGLInterop::Type MythNVDECInterop::GetInteropType ( VideoFrameType  Format)
staticprotected

Definition at line 85 of file mythnvdecinterop.cpp.

Referenced by MythOpenGLInterop::GetInteropType().

◆ InitialiseCuda()

bool MythNVDECInterop::InitialiseCuda ( void  )
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 309 of file mythnvdecinterop.cpp.

Referenced by MythNVDECInterop().

◆ DeleteTextures()

void MythNVDECInterop::DeleteTextures ( void  )
overrideprivatevirtual

Reimplemented from MythOpenGLInterop.

Definition at line 37 of file mythnvdecinterop.cpp.

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

◆ RotateReferenceFrames()

void MythNVDECInterop::RotateReferenceFrames ( CUdeviceptr  Buffer)
private

Definition at line 408 of file mythnvdecinterop.cpp.

Referenced by Acquire().

◆ CreateCUDAPriv()

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

Definition at line 314 of file mythnvdecinterop.cpp.

Referenced by CreateCUDAContext().

Friends And Related Function Documentation

◆ MythOpenGLInterop

friend class MythOpenGLInterop
friend

Definition at line 15 of file mythnvdecinterop.h.

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 42 of file mythnvdecinterop.h.

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


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