Kodi Documentation 22.0
Kodi is an open source media player and entertainment hub.
Loading...
Searching...
No Matches
IBufferObject Class Referenceabstract

Interface to describe CBufferObjects. More...

#include <IBufferObject.h>

Inheritance diagram for IBufferObject:
CBufferObject CDMAHeapBufferObject CDumbBufferObject CGBMBufferObject CUDMABufferObject

Public Member Functions

virtual ~IBufferObject ()=default
 
virtual bool CreateBufferObject (uint32_t format, uint32_t width, uint32_t height)=0
 Create a BufferObject based on the format, width, and height of the desired buffer.
 
virtual bool CreateBufferObject (uint64_t size)=0
 Create a BufferObject based only on the size of the desired buffer. Not all CBufferObject implementations may support this. This method is required for use with the CAddonVideoCodec as it only knows the decoded buffer size.
 
virtual void DestroyBufferObject ()=0
 Destroy a BufferObject.
 
virtual uint8_tGetMemory ()=0
 Get the Memory location of the BufferObject. This method needs to be called to be able to copy data into the BufferObject.
 
virtual void ReleaseMemory ()=0
 Release the mapped memory of the BufferObject. After calling this the memory location pointed to by GetMemory() will be invalid.
 
virtual int GetFd ()=0
 Get the File Descriptor of the BufferObject. The fd is guaranteed to be available after calling CreateBufferObject().
 
virtual uint32_t GetStride ()=0
 Get the Stride of the BufferObject. The stride is guaranteed to be available after calling GetMemory().
 
virtual uint64_t GetModifier ()=0
 Get the Modifier of the BufferObject. Format Modifiers further describe the buffer's format such as for tiling or compression. see https://github.com/torvalds/linux/blob/master/include/uapi/drm/drm_fourcc.h.
 
virtual void SyncStart ()=0
 Must be called before reading/writing data to the BufferObject.
 
virtual void SyncEnd ()=0
 Must be called after reading/writing data to the BufferObject.
 
virtual std::string GetName () const =0
 Get the Name of the BufferObject type in use.
 

Detailed Description

Interface to describe CBufferObjects.

   BufferObjects are used to abstract various memory types and present them
   with a generic interface. Typically on a posix system exists the concept
   of Direct Memory Access (DMA) which allows various systems to interact
   with a memory location directly without having to copy the data into
   userspace (ie. from kernel space). These DMA buffers are presented as
   file descriptors (fds) which can be passed around to gain access to
   the buffers memory location.

   In order to write to these buffer types typically the memory location has
   to be mapped into userspace via a call to mmap (or similar). This presents
   userspace with a memory location that can be initially written to (ie. by
   using memcpy or similar). Depending on the underlying implementation a
   stride might be specified if the memory type requires padding to a certain
   size (such as page size). The stride must be used when copying into the buffer.

   Some memory implementation may provide special memory layouts in which case
   modifiers are provided that describe tiling or compression. This should be
   transparent to the caller as the data copied into a BufferObject will likely
   be linear. The modifier will be needed when presenting the buffer via DRM or
   EGL even if it is linear.

Constructor & Destructor Documentation

◆ ~IBufferObject()

virtual IBufferObject::~IBufferObject ( )
virtualdefault

Member Function Documentation

◆ CreateBufferObject() [1/2]

virtual bool IBufferObject::CreateBufferObject ( uint32_t format,
uint32_t width,
uint32_t height )
pure virtual

Create a BufferObject based on the format, width, and height of the desired buffer.

Parameters
formatframebuffer pixel formats are described using the fourcc codes defined in https://github.com/torvalds/linux/blob/master/include/uapi/drm/drm_fourcc.h
widthwidth of the requested buffer.
heightheight of the requested buffer.
Returns
true BufferObject creation was successful.
false BufferObject creation was unsuccessful.

Implemented in CBufferObject, CDMAHeapBufferObject, CDumbBufferObject, CGBMBufferObject, and CUDMABufferObject.

◆ CreateBufferObject() [2/2]

virtual bool IBufferObject::CreateBufferObject ( uint64_t size)
pure virtual

Create a BufferObject based only on the size of the desired buffer. Not all CBufferObject implementations may support this. This method is required for use with the CAddonVideoCodec as it only knows the decoded buffer size.

Parameters
sizeof the requested buffer.
Returns
true BufferObject creation was successful.
false BufferObject creation was unsuccessful.

Implemented in CBufferObject, CDMAHeapBufferObject, and CUDMABufferObject.

◆ DestroyBufferObject()

virtual void IBufferObject::DestroyBufferObject ( )
pure virtual

Destroy a BufferObject.

Implemented in CDMAHeapBufferObject, CDumbBufferObject, CGBMBufferObject, and CUDMABufferObject.

◆ GetFd()

virtual int IBufferObject::GetFd ( )
pure virtual

Get the File Descriptor of the BufferObject. The fd is guaranteed to be available after calling CreateBufferObject().

Returns
int fd for the BufferObject. Invalid if -1.

Implemented in CBufferObject.

◆ GetMemory()

virtual uint8_t * IBufferObject::GetMemory ( )
pure virtual

Get the Memory location of the BufferObject. This method needs to be called to be able to copy data into the BufferObject.

Returns
uint8_t* pointer to the memory location of the BufferObject.

Implemented in CDMAHeapBufferObject, CDumbBufferObject, CGBMBufferObject, and CUDMABufferObject.

◆ GetModifier()

virtual uint64_t IBufferObject::GetModifier ( )
pure virtual

Get the Modifier of the BufferObject. Format Modifiers further describe the buffer's format such as for tiling or compression. see https://github.com/torvalds/linux/blob/master/include/uapi/drm/drm_fourcc.h.

Returns
uint64_t modifier of the BufferObject. 0 means the layout is linear (default).

Implemented in CBufferObject, and CGBMBufferObject.

◆ GetName()

virtual std::string IBufferObject::GetName ( ) const
pure virtual

Get the Name of the BufferObject type in use.

Returns
std::string name of the BufferObject type in use

Implemented in CDMAHeapBufferObject, CDumbBufferObject, CGBMBufferObject, and CUDMABufferObject.

◆ GetStride()

virtual uint32_t IBufferObject::GetStride ( )
pure virtual

Get the Stride of the BufferObject. The stride is guaranteed to be available after calling GetMemory().

Returns
uint32_t stride of the BufferObject.

Implemented in CBufferObject.

◆ ReleaseMemory()

virtual void IBufferObject::ReleaseMemory ( )
pure virtual

Release the mapped memory of the BufferObject. After calling this the memory location pointed to by GetMemory() will be invalid.

Implemented in CDMAHeapBufferObject, CDumbBufferObject, CGBMBufferObject, and CUDMABufferObject.

◆ SyncEnd()

virtual void IBufferObject::SyncEnd ( )
pure virtual

Must be called after reading/writing data to the BufferObject.

Implemented in CBufferObject.

◆ SyncStart()

virtual void IBufferObject::SyncStart ( )
pure virtual

Must be called before reading/writing data to the BufferObject.

Implemented in CBufferObject.


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