|
vdr-plugin-softhddevice-drm-gles 1.6.7
|
DRM Device. More...
#include <drmdevice.h>
Private Member Functions | |
| int | CreatePropertyBlob (uint32_t *) |
| Wrapper to create a property blob. | |
| int | GetPropertyValue (uint32_t, uint32_t, const char *, uint64_t *) |
| Get a drm property value. | |
| uint32_t | GetPropertyID (uint32_t, uint32_t, const char *) |
| Get a property ID. | |
| int | SetPropertyRequest (drmModeAtomicReqPtr, uint32_t, uint32_t, const char *, uint64_t) |
| Add a drm property to an atomic modeset request. | |
| drmModeConnector * | FindDrmConnector (int, drmModeRes *, const char *) |
| Find a suitable connector, preferably a connected one. | |
| int32_t | FindCrtcForConnector (const drmModeRes *, const drmModeConnector *) |
| Find the CRTC_ID for the given connector. | |
| int | FindMode (void) |
| Find a suitable mode from the current connector. | |
| EGLConfig | GetEGLConfig (void) |
| Get a suitable EGLConfig. | |
Private Attributes | |
| cVideoRender * | m_pRender |
| pointer to cVideoRender object | |
| cSoftHdConfig * | m_pConfig |
| pointer to cSoftHdConfig object | |
| int | m_fdDrm = -1 |
| drm file descriptor | |
| uint32_t | m_connectorId |
| connector id | |
| std::string | m_connectorName |
| drm connector name | |
| drmModeModeInfo | m_drmModeInfo |
| mode info | |
| uint32_t | m_crtcId |
| current crtc ID | |
| uint32_t | m_crtcIndex |
| current crtc index | |
| uint32_t | m_hdrMetadata = 0 |
| property id of HDR_OUTPUT_METADATA | |
| drmModeCrtc * | m_drmModeCrtcSaved |
| saved CRTC infos | |
| drmEventContext | m_drmEventCtx |
| drm event context | |
| const char * | m_userDrmDevice = nullptr |
| user requested drm device | |
| const char * | m_userDrmConnector = nullptr |
| user requested drm connector | |
| int | m_userReqDisplayWidth = 0 |
| user requested display width | |
| int | m_userReqDisplayHeight |
| user requested display height | |
| double | m_userReqDisplayRefreshRate |
| user requested display refresh rate | |
| bool | m_userReqDisplayInterlaced |
| user requested display interlaced mode | |
| int | m_userReqOsdWidth = 0 |
| user requested osd width | |
| int | m_userReqOsdHeight |
| user requested osd height | |
| bool | m_useZpos = false |
| is set, if drm hardware can use zpos | |
| uint64_t | m_zposOverlay = 0 |
| zpos of overlay plane | |
| uint64_t | m_zposPrimary = 0 |
| zpos of primary plane | |
| cDrmPlane | m_videoPlane |
| the video drm plane | |
| cDrmPlane | m_osdPlane |
| the osd drm plane | |
| uint64_t | m_zposPip = 0 |
| zpos of pip plane | |
| cDrmPlane | m_pipPlane |
| the pip drm plane | |
| struct gbm_device * | m_pGbmDevice |
| pointer to the gbm device | |
| struct gbm_surface * | m_pGbmSurface |
| pointer to the gbm surface | |
| EGLSurface | m_eglSurface |
| EGL surface. | |
| EGLDisplay | m_eglDisplay |
| EGL display. | |
| EGLContext | m_eglContext |
| EGL context. | |
| bool | m_glInitiated |
| true, if OpenGL/ES context is initiated | |
DRM Device.
Definition at line 83 of file drmdevice.h.
| cDrmDevice::cDrmDevice | ( | cVideoRender * | render, |
| cSoftHdConfig * | config | ||
| ) |
Create a drm device.
| render | pointer to cVideoRender object |
| config | pointer to current plugin configuration |
Definition at line 49 of file drmdevice.cpp.
References cSoftHdConfig::ConfigOsdResolution, LOGDEBUG, m_pConfig, m_userReqDisplayHeight, m_userReqDisplayInterlaced, m_userReqDisplayRefreshRate, m_userReqDisplayWidth, m_userReqOsdHeight, m_userReqOsdWidth, cSoftHdConfig::RequestedDrmMode, cSoftHdConfig::UserSetDrmMode, and sDrmMode::width.
| cDrmDevice::~cDrmDevice | ( | void | ) |
Definition at line 74 of file drmdevice.cpp.
Definition at line 127 of file drmdevice.h.
References m_hdrMetadata.
Referenced by cVideoRender::CanHandleHdr().
Return true, if the given mode is one of the collected ones.
Definition at line 323 of file drmdevice.cpp.
References AlmostEqual(), cSoftHdConfig::CollectedDrmModes, sDrmMode::height, sDrmMode::interlaced, L_DRM, LOGDEBUG2, m_pConfig, sDrmMode::refreshRateHz, and sDrmMode::width.
Referenced by cVideoRender::CanHandleMode().
Close the drm file handle.
Definition at line 1166 of file drmdevice.cpp.
References L_DRM, LOGDEBUG2, and m_fdDrm.
Referenced by cVideoRender::Exit().
Definition at line 96 of file drmdevice.h.
References m_connectorId.
Referenced by cVideoRender::SetColorSpace().
| int cDrmDevice::CreateHdrBlob | ( | struct hdr_output_metadata * | data, |
| size_t | size, | ||
| uint32_t * | blobID | ||
| ) |
Definition at line 1420 of file drmdevice.cpp.
References L_DRM, LOGDEBUG2, and m_fdDrm.
Referenced by cVideoRender::SetHdrBlob().
Definition at line 1410 of file drmdevice.cpp.
References m_drmModeInfo, and m_fdDrm.
Referenced by cVideoRender::Init(), and cVideoRender::ReInitDisplayMode().
Wrapper to create a property blob.
Creates a property blob for the drm mode which was found during Init()
| [out] | modeID | id of the blob |
| 0 | on success |
| -errno | on error |
Definition at line 1188 of file drmdevice.cpp.
References m_drmModeInfo, and m_fdDrm.
Definition at line 103 of file drmdevice.h.
References m_crtcId.
Referenced by cVideoRender::Init(), cVideoRender::SetOsdBuffer(), cVideoRender::SetPipBuffer(), and cVideoRender::SetVideoBuffer().
Definition at line 1439 of file drmdevice.cpp.
References m_fdDrm.
Referenced by cVideoRender::SetHdrBlob().
Definition at line 1415 of file drmdevice.cpp.
References m_fdDrm.
Referenced by cVideoRender::Init(), and cVideoRender::ReInitDisplayMode().
Definition at line 99 of file drmdevice.h.
References m_drmModeInfo.
Referenced by cVideoRender::Init(), cVideoRender::InitBuffers(), OsdHeight(), cVideoRender::SetOsdBuffer(), cVideoRender::SetPipBuffer(), and cVideoRender::SetVideoBuffer().
Definition at line 98 of file drmdevice.h.
References m_drmModeInfo.
Referenced by cVideoRender::Init(), cVideoRender::InitBuffers(), OsdWidth(), cVideoRender::SetOsdBuffer(), cVideoRender::SetPipBuffer(), and cVideoRender::SetVideoBuffer().
|
inline |
Definition at line 116 of file drmdevice.h.
References m_eglContext.
Referenced by cVideoRender::EglContext().
|
inline |
Definition at line 115 of file drmdevice.h.
References m_eglDisplay.
Referenced by cVideoRender::EglDisplay(), cVideoRender::OsdClear(), and cVideoRender::OsdDrawARGB().
|
inline |
Definition at line 114 of file drmdevice.h.
References m_eglSurface.
Referenced by cVideoRender::EglSurface(), cVideoRender::OsdClear(), and cVideoRender::OsdDrawARGB().
Definition at line 92 of file drmdevice.h.
References m_fdDrm.
Referenced by cVideoRender::InitBuffers(), and cVideoRender::PushFrame().
|
private |
Find the CRTC_ID for the given connector.
| resources | drm resources |
| connector | drm connector |
Definition at line 1143 of file drmdevice.cpp.
References FindCrtcForEncoder(), and m_fdDrm.
Referenced by Init().
Find a suitable mode from the current connector.
Mode selection priority: 1) user requested 2) progressive mode with biggest width@50Hz 3) progressive mode with biggest width@60Hz 4) progressive mode with biggest width@anyHz
Definition at line 730 of file drmdevice.cpp.
References AlmostEqual(), cSoftHdConfig::AutoDetectedDrmMode, cSoftHdConfig::CurrentDrmMode, GetRefreshRateHz(), InterlacedMode(), L_DRM, LOGDEBUG2, LOGERROR, LOGWARNING, m_connectorId, m_drmModeInfo, m_fdDrm, m_pConfig, m_pRender, m_userReqDisplayHeight, m_userReqDisplayInterlaced, m_userReqDisplayRefreshRate, m_userReqDisplayWidth, cVideoRender::SetScreenSize(), and sDrmMode::width.
|
inline |
Definition at line 118 of file drmdevice.h.
References m_pGbmSurface.
Referenced by cVideoRender::OsdClear(), and cVideoRender::OsdDrawARGB().
| cDrmBuffer * cDrmDevice::GetBufFromBo | ( | struct gbm_bo * | bo | ) |
Get a drm buffer from a gbm buffer object.
| bo | gbm buffer object |
Definition at line 1030 of file drmdevice.cpp.
References drm_fb_destroy_callback(), L_DRM, LOGDEBUG2, LOGFATAL, and m_fdDrm.
Referenced by cVideoRender::OsdClear(), and cVideoRender::OsdDrawARGB().
|
private |
Get a drm property value.
| objectID | drm object ID | |
| objectType | drm object type | |
| propName | drm property name | |
| [out] | value | value for the requested property |
| 0 | value was found |
| -1 | value was not found |
Definition at line 1246 of file drmdevice.cpp.
References L_DRM, LOGDEBUG2, and m_fdDrm.
Referenced by GetVideoPlaneColorRange(), and Init().
Definition at line 1395 of file drmdevice.cpp.
References cDrmPlane::GetId(), GetPropertyValue(), and m_videoPlane.
Referenced by cVideoRender::SetHdrBlob().
Definition at line 117 of file drmdevice.h.
References m_glInitiated.
Referenced by cVideoRender::GlInitiated().
Poll for a drm event.
| 0 | if successful |
| -1 | on error |
Definition at line 1353 of file drmdevice.cpp.
References m_drmEventCtx, and m_fdDrm.
Referenced by cVideoRender::DrmHandleEvent(), and cVideoRender::PageFlip().
Definition at line 111 of file drmdevice.h.
References cDrmPlane::GetId(), and m_pipPlane.
Referenced by cVideoRender::Init().
Initiate the drm device.
1) Try to open the user requested device (with -o /dev/dri/cardX) 2) On error or if not set, find a any suitable device 3) Find a connector (priority: user requested, connected, unconnected) 4) Find a connector mode 5) Find crtc encoder 6) Find suitable planes for video (NV12), OSD (ARGB) and PiP (NV12) 7) Init GBM 8) Init EGL
| 0 | on success |
| -errno | on error |
Definition at line 366 of file drmdevice.cpp.
References cSoftHdConfig::CollectedDrmModes, ConnectorName(), Contains(), DrmModeWhitelist, cDrmPlane::FillProperties(), FindCrtcForConnector(), FindDrmConnector(), FindDrmDevice(), FindMode(), cDrmPlane::GetId(), GetPropertyID(), GetPropertyValue(), GetRefreshRateHz(), cDrmPlane::GetType(), cDrmPlane::GetZpos(), cDrmPlane::HasZpos(), InterlacedMode(), L_DRM, LOGDEBUG2, LOGERROR, LOGFATAL, LOGINFO, LOGWARNING, m_connectorId, m_connectorName, m_crtcId, m_crtcIndex, m_drmModeInfo, m_fdDrm, m_hdrMetadata, m_osdPlane, m_pConfig, m_pipPlane, m_pRender, m_userDrmConnector, m_userDrmDevice, m_useZpos, m_videoPlane, m_zposOverlay, m_zposPip, m_zposPrimary, OpenDrmDevice(), OsdHeight(), OsdWidth(), plane, cDrmPlane::SetId(), cVideoRender::SetOsdSize(), cDrmPlane::SetType(), and cDrmPlane::SetZpos().
Referenced by cVideoRender::Init().
Init EGL context.
| 0 | on success |
| -1 | on error |
Definition at line 936 of file drmdevice.cpp.
References context_attribute_list, EGL_CHECK, get_platform_display, get_platform_surface, GetEGLConfig(), L_OPENGL, LOGDEBUG2, LOGERROR, LOGINFO, m_eglContext, m_eglDisplay, m_eglSurface, m_glInitiated, m_pGbmDevice, and m_pGbmSurface.
Referenced by cVideoRender::Init().
Init the event context.
Definition at line 1361 of file drmdevice.cpp.
References m_drmEventCtx.
Referenced by cVideoRender::Init().
Init gbm device and surface.
| 0 | on success |
| -1 | on error |
Definition at line 844 of file drmdevice.cpp.
References LOGERROR, m_fdDrm, m_pGbmDevice, m_pGbmSurface, OsdHeight(), and OsdWidth().
Referenced by cVideoRender::Init().
|
inline |
Definition at line 131 of file drmdevice.h.
Referenced by cVideoRender::CommitBuffer(), cVideoRender::Init(), cVideoRender::ReInitDisplayMode(), cVideoRender::RestoreColorSpace(), and cVideoRender::SetColorSpace().
|
inline |
Definition at line 132 of file drmdevice.h.
References m_fdDrm.
Referenced by cVideoRender::CommitBuffer(), cVideoRender::Init(), cVideoRender::ReInitDisplayMode(), cVideoRender::RestoreColorSpace(), and cVideoRender::SetColorSpace().
|
inline |
Definition at line 133 of file drmdevice.h.
Referenced by cVideoRender::CommitBuffer(), cVideoRender::Init(), cVideoRender::ReInitDisplayMode(), cVideoRender::RestoreColorSpace(), and cVideoRender::SetColorSpace().
Definition at line 101 of file drmdevice.h.
References DisplayHeight(), m_userReqOsdHeight, and m_userReqOsdWidth.
Referenced by Init(), cVideoRender::InitBuffers(), and InitGbm().
Definition at line 108 of file drmdevice.h.
References m_osdPlane.
Referenced by cVideoRender::CommitBuffer(), cVideoRender::Exit(), cVideoRender::Init(), and cVideoRender::SetOsdBuffer().
Definition at line 100 of file drmdevice.h.
References DisplayWidth(), and m_userReqOsdWidth.
Referenced by Init(), cVideoRender::InitBuffers(), and InitGbm().
Definition at line 110 of file drmdevice.h.
References m_pipPlane.
Referenced by cVideoRender::CommitBuffer(), and cVideoRender::SetPipBuffer().
Re-Init the drm device with a new connector mode.
Mode selection priority: 1) selected mode from setup menu or mode depending on video resolution (RequestedDrmMode) 2) command line requested mode (UserSetDrmMode) 3) other suitable mode:
Definition at line 816 of file drmdevice.cpp.
References FindMode(), LOGDEBUG, m_pConfig, m_userReqDisplayHeight, m_userReqDisplayInterlaced, m_userReqDisplayRefreshRate, m_userReqDisplayWidth, cSoftHdConfig::RequestedDrmMode, cSoftHdConfig::UserSetDrmMode, and sDrmMode::width.
Referenced by cVideoRender::ReInitDisplayMode().
Restore information of a CRTC.
Definition at line 1338 of file drmdevice.cpp.
References m_connectorId, m_drmModeCrtcSaved, and m_fdDrm.
Referenced by cVideoRender::Exit().
Save information of a CRTC.
Definition at line 1330 of file drmdevice.cpp.
References m_crtcId, m_drmModeCrtcSaved, and m_fdDrm.
Referenced by cVideoRender::Init().
| int cDrmDevice::SetConnectorColorspace | ( | drmModeAtomicReqPtr | modeReq, |
| uint32_t | id | ||
| ) |
Definition at line 1380 of file drmdevice.cpp.
References m_connectorId, and SetPropertyRequest().
Referenced by cVideoRender::RestoreColorSpace(), and cVideoRender::SetColorSpace().
| int cDrmDevice::SetConnectorCrtcId | ( | drmModeAtomicReqPtr | modeReq | ) |
Definition at line 1370 of file drmdevice.cpp.
References m_connectorId, m_crtcId, and SetPropertyRequest().
Referenced by cVideoRender::Init(), and cVideoRender::ReInitDisplayMode().
Definition at line 1429 of file drmdevice.cpp.
References L_DRM, LOGDEBUG2, m_connectorId, m_fdDrm, and m_hdrMetadata.
Referenced by cVideoRender::SetHdrBlob().
| int cDrmDevice::SetConnectorHdrOutputMetadata | ( | drmModeAtomicReqPtr | modeReq, |
| uint32_t | id | ||
| ) |
Definition at line 1375 of file drmdevice.cpp.
References m_connectorId, and SetPropertyRequest().
Referenced by cVideoRender::RestoreColorSpace().
| int cDrmDevice::SetCrtcActive | ( | drmModeAtomicReqPtr | modeReq, |
| uint32_t | id | ||
| ) |
Definition at line 1405 of file drmdevice.cpp.
References m_crtcId, and SetPropertyRequest().
Referenced by cVideoRender::Init().
| int cDrmDevice::SetCrtcModeId | ( | drmModeAtomicReqPtr | modeReq, |
| uint32_t | id | ||
| ) |
Definition at line 1400 of file drmdevice.cpp.
References m_crtcId, and SetPropertyRequest().
Referenced by cVideoRender::Init(), and cVideoRender::ReInitDisplayMode().
|
private |
Add a drm property to an atomic modeset request.
| ModeReq | atomic request object |
| objectID | drm object id |
| objectType | drm object type |
| propName | name of the drm property to be set |
| value | the value, the drm property should get |
Definition at line 1204 of file drmdevice.cpp.
References L_DRM, LOGDEBUG2, and m_fdDrm.
Referenced by SetConnectorColorspace(), SetConnectorCrtcId(), SetConnectorHdrOutputMetadata(), SetCrtcActive(), SetCrtcModeId(), SetVideoPlaneColorEncoding(), and SetVideoPlaneColorRange().
| int cDrmDevice::SetVideoPlaneColorEncoding | ( | drmModeAtomicReqPtr | modeReq, |
| uint32_t | id | ||
| ) |
Definition at line 1385 of file drmdevice.cpp.
References cDrmPlane::GetId(), m_videoPlane, and SetPropertyRequest().
Referenced by cVideoRender::RestoreColorSpace(), and cVideoRender::SetColorSpace().
| int cDrmDevice::SetVideoPlaneColorRange | ( | drmModeAtomicReqPtr | modeReq, |
| uint32_t | id | ||
| ) |
Definition at line 1390 of file drmdevice.cpp.
References cDrmPlane::GetId(), m_videoPlane, and SetPropertyRequest().
Referenced by cVideoRender::RestoreColorSpace(), and cVideoRender::SetColorSpace().
Definition at line 104 of file drmdevice.h.
References m_useZpos.
Referenced by cVideoRender::Init(), and cVideoRender::SetOsdBuffer().
Definition at line 109 of file drmdevice.h.
References m_videoPlane.
Referenced by cVideoRender::CommitBuffer(), cVideoRender::Exit(), cVideoRender::Init(), cVideoRender::SetColorSpace(), cVideoRender::SetOsdBuffer(), and cVideoRender::SetVideoBuffer().
Definition at line 105 of file drmdevice.h.
References m_zposOverlay.
Referenced by cVideoRender::Init(), and cVideoRender::SetOsdBuffer().
Definition at line 106 of file drmdevice.h.
References m_zposPrimary.
Referenced by cVideoRender::Init(), and cVideoRender::SetOsdBuffer().
|
private |
connector id
Definition at line 153 of file drmdevice.h.
Referenced by ConnectorId(), FindMode(), Init(), RestoreCrtc(), SetConnectorColorspace(), SetConnectorCrtcId(), SetConnectorHdrBlobProperty(), and SetConnectorHdrOutputMetadata().
|
private |
|
private |
current crtc ID
Definition at line 156 of file drmdevice.h.
Referenced by CrtcId(), Init(), SaveCrtc(), SetConnectorCrtcId(), SetCrtcActive(), and SetCrtcModeId().
|
private |
|
private |
drm event context
Definition at line 160 of file drmdevice.h.
Referenced by HandleEvent(), and InitEvent().
|
private |
saved CRTC infos
Definition at line 159 of file drmdevice.h.
Referenced by RestoreCrtc(), and SaveCrtc().
|
private |
mode info
Definition at line 155 of file drmdevice.h.
Referenced by CreateModeBlob(), CreatePropertyBlob(), DisplayHeight(), DisplayWidth(), FindMode(), and Init().
|
private |
|
private |
EGL display.
Definition at line 192 of file drmdevice.h.
Referenced by EglDisplay(), GetEGLConfig(), and InitEGL().
|
private |
|
private |
drm file descriptor
Definition at line 152 of file drmdevice.h.
Referenced by Close(), CreateHdrBlob(), CreateModeBlob(), CreatePropertyBlob(), DestroyHdrBlob(), DestroyModeBlob(), Fd(), FindCrtcForConnector(), FindMode(), GetBufFromBo(), GetPropertyID(), GetPropertyValue(), HandleEvent(), Init(), InitGbm(), ModeAtomicCommit(), RestoreCrtc(), SaveCrtc(), SetConnectorHdrBlobProperty(), and SetPropertyRequest().
|
private |
true, if OpenGL/ES context is initiated
Definition at line 194 of file drmdevice.h.
Referenced by GlInitiated(), and InitEGL().
|
private |
property id of HDR_OUTPUT_METADATA
Definition at line 158 of file drmdevice.h.
Referenced by CanHandleHdr(), Init(), and SetConnectorHdrBlobProperty().
|
private |
|
private |
pointer to cSoftHdConfig object
Definition at line 150 of file drmdevice.h.
Referenced by CanHandleMode(), cDrmDevice(), FindMode(), Init(), and ReInit().
|
private |
pointer to the gbm device
Definition at line 188 of file drmdevice.h.
|
private |
pointer to the gbm surface
Definition at line 189 of file drmdevice.h.
Referenced by GbmSurface(), InitEGL(), and InitGbm().
|
private |
the pip drm plane
Definition at line 177 of file drmdevice.h.
Referenced by HasPipPlane(), Init(), and PipPlane().
|
private |
pointer to cVideoRender object
Definition at line 149 of file drmdevice.h.
Referenced by FindMode(), and Init().
|
private |
user requested display height
Definition at line 165 of file drmdevice.h.
Referenced by cDrmDevice(), FindMode(), and ReInit().
|
private |
user requested display interlaced mode
Definition at line 167 of file drmdevice.h.
Referenced by cDrmDevice(), FindMode(), and ReInit().
|
private |
user requested display refresh rate
Definition at line 166 of file drmdevice.h.
Referenced by cDrmDevice(), FindMode(), and ReInit().
|
private |
user requested display width
Definition at line 164 of file drmdevice.h.
Referenced by cDrmDevice(), FindMode(), and ReInit().
|
private |
user requested osd height
Definition at line 169 of file drmdevice.h.
Referenced by cDrmDevice(), and OsdHeight().
|
private |
user requested osd width
Definition at line 168 of file drmdevice.h.
Referenced by cDrmDevice(), OsdHeight(), and OsdWidth().
is set, if drm hardware can use zpos
Definition at line 171 of file drmdevice.h.
|
private |
the video drm plane
Definition at line 174 of file drmdevice.h.
Referenced by GetVideoPlaneColorRange(), Init(), SetVideoPlaneColorEncoding(), SetVideoPlaneColorRange(), and VideoPlane().
|
private |
zpos of overlay plane
Definition at line 172 of file drmdevice.h.
Referenced by Init(), and ZposOverlay().
|
private |
|
private |
zpos of primary plane
Definition at line 173 of file drmdevice.h.
Referenced by Init(), and ZposPrimary().