vdr-plugin-softhddevice-drm-gles 1.6.7
drmdevice.cpp File Reference

DRM Device. More...

#include <cerrno>
#include <cstdint>
#include <cstdio>
#include <cstring>
#include <cinttypes>
#include <string>
#include <vector>
#include <fcntl.h>
#include <unistd.h>
#include <assert.h>
#include <EGL/egl.h>
#include <EGL/eglext.h>
#include <drm_fourcc.h>
#include <xf86drm.h>
#include <xf86drmMode.h>
#include "config.h"
#include "drmdevice.h"
#include "drmplane.h"
#include "logger.h"
#include "videorender.h"

Go to the source code of this file.

Functions

static int get_resources (int fd, drmModeRes **resources)
 
static int TestCaps (int fd)
 Test drm capabilities.
 
static int OpenDrmDevice (const char *device, drmModeRes **resources)
 Open the given device.
 
static int FindDrmDevice (drmModeRes **resources)
 Find and open a suitable device with the wanted capabilities.
 
static std::string ConnectorName (drmModeConnector *connector)
 Returns the connector type name if available.
 
static double GetRefreshRateHz (drmModeModeInfo *modeInfo)
 Calculate the refresh rate of the given mode to get the precise value and don't use m_drmModeInfo.vrefresh.
 
static bool InterlacedMode (uint32_t flags)
 Returns true, if the interlaced flag of the mode is set.
 
static bool AlmostEqual (double a, double b)
 Return true, if both values are equivalent within a tolerance.
 
static bool Contains (drmModeModeInfo *mode, std::vector< sDrmMode > modes)
 Test, if the given mode is included in the given array.
 
static void drm_fb_destroy_callback (struct gbm_bo *bo, void *data)
 Callback function to destroy a drm buffer which stays in the gbm_bo's user data.
 
 __attribute__ ((weak)) union gbm_bo_handle gbm_bo_get_handle_for_plane(struct gbm_bo *bo
 
static int32_t FindCrtcForEncoder (const drmModeRes *resources, const drmModeEncoder *encoder)
 Find the CRTC_ID for the given encoder.
 

Variables

PFNEGLGETPLATFORMDISPLAYEXTPROC get_platform_display = NULL
 
PFNEGLCREATEPLATFORMWINDOWSURFACEEXTPROC get_platform_surface = NULL
 
static const EGLint context_attribute_list []
 
int plane
 

Detailed Description

DRM Device.

This file defines cDrmDevice, which keeps some functions to interact with the DRM (display) system.

Definition in file drmdevice.cpp.

Function Documentation

◆ __attribute__()

__attribute__ ( (weak )

◆ AlmostEqual()

static bool AlmostEqual ( double  a,
double  b 
)
inlinestatic

Return true, if both values are equivalent within a tolerance.

Definition at line 282 of file drmdevice.cpp.

Referenced by cDrmDevice::CanHandleMode(), Contains(), and cDrmDevice::FindMode().

◆ ConnectorName()

static std::string ConnectorName ( drmModeConnector connector)
static

Returns the connector type name if available.

Definition at line 199 of file drmdevice.cpp.

Referenced by cDrmDevice::FindDrmConnector(), and cDrmDevice::Init().

◆ GetRefreshRateHz()

static double GetRefreshRateHz ( drmModeModeInfo modeInfo)
static

Calculate the refresh rate of the given mode to get the precise value and don't use m_drmModeInfo.vrefresh.

Parameters
modeInfodrm mode info

Definition at line 266 of file drmdevice.cpp.

Referenced by Contains(), cDrmDevice::FindMode(), and cDrmDevice::Init().

◆ InterlacedMode()

static bool InterlacedMode ( uint32_t  flags)
inlinestatic

Returns true, if the interlaced flag of the mode is set.

Definition at line 274 of file drmdevice.cpp.

Referenced by Contains(), cDrmDevice::FindMode(), and cDrmDevice::Init().

◆ TestCaps()

static int TestCaps ( int  fd)
static

Test drm capabilities.

Return values
0if all needed caps match
1on mismatch

Definition at line 96 of file drmdevice.cpp.

Referenced by FindDrmDevice(), and OpenDrmDevice().

Variable Documentation

◆ get_platform_display

PFNEGLGETPLATFORMDISPLAYEXTPROC get_platform_display = NULL

Definition at line 866 of file drmdevice.cpp.

Referenced by cDrmDevice::InitEGL().

◆ get_platform_surface

Definition at line 867 of file drmdevice.cpp.

Referenced by cDrmDevice::InitEGL().

◆ plane