ecore_drm2: Add check for Atomic Modesetting support

This commit is contained in:
Christopher Michael 2022-08-17 12:22:10 -04:00
parent ee17764a5f
commit b69bf1a6ac
3 changed files with 34 additions and 1 deletions

View File

@ -10,6 +10,7 @@ int _ecore_drm2_log_dom = -1;
/* external drm function prototypes (for dlopen) */
void *(*sym_drmModeGetResources)(int fd) = NULL;
void (*sym_drmModeFreeResources)(drmModeResPtr ptr) = NULL;
int (*sym_drmSetClientCap)(int fd, uint64_t capability, uint64_t value) = NULL;
/* local static functions */
static Eina_Bool
@ -46,6 +47,7 @@ _ecore_drm2_link(void)
/* TODO: Sym needed libdrm functions */
SYM(_drm_lib, drmModeGetResources);
SYM(_drm_lib, drmModeFreeResources);
SYM(_drm_lib, drmSetClientCap);
if (fail)
{

View File

@ -1,6 +1,25 @@
#include "ecore_drm2_private.h"
/* external variable for using atomic */
Eina_Bool _ecore_drm2_atomic_use = EINA_FALSE;
/* local functions */
static Eina_Bool
_ecore_drm2_device_atomic_capable_get(int fd)
{
Eina_Bool ret = EINA_TRUE;
if (sym_drmSetClientCap(fd, DRM_CLIENT_CAP_UNIVERSAL_PLANES, 1) < 0)
ret = EINA_FALSE;
else
{
if (sym_drmSetClientCap(fd, DRM_CLIENT_CAP_ATOMIC, 1) < 0)
ret = EINA_FALSE;
}
return ret;
}
static Eina_Bool
_ecore_drm2_device_modeset_capable_get(int fd)
{
@ -124,7 +143,15 @@ ecore_drm2_device_open(const char *seat, unsigned int tty)
goto open_err;
}
/* TODO: elput_input_init, check atomic capable, etc */
/* TODO: elput_input_init, etc */
/* NB: For now, we will ONLY support Atomic */
_ecore_drm2_atomic_use = _ecore_drm2_device_atomic_capable_get(dev->fd);
if (!_ecore_drm2_atomic_use)
{
WRN("Could not enable Atomic Modesetting support");
goto open_err;
}
return dev;

View File

@ -31,6 +31,9 @@
/* define necessary vars/macros for ecore_drm2 log domain */
extern int _ecore_drm2_log_dom;
/* define externval variable for atomic */
extern Eina_Bool _ecore_drm2_atomic_use;
# ifdef ECORE_DRM2_DEFAULT_LOG_COLOR
# undef ECORE_DRM2_DEFAULT_LOG_COLOR
# endif
@ -72,5 +75,6 @@ struct _Ecore_Drm2_Device
/* external drm function prototypes (for dlopen) */
extern void *(*sym_drmModeGetResources)(int fd);
extern void (*sym_drmModeFreeResources)(drmModeResPtr ptr);
extern int (*sym_drmSetClientCap)(int fd, uint64_t capability, uint64_t value);
#endif