forked from enlightenment/efl
ecore-drm2: Add drm2 event for session activation
This patch adds a new Ecore_Drm2_Event_Activate that can be raised to inform Enlightenment that a session has been activated or suspended so that rendering can be paused/resumed Signed-off-by: Chris Michael <cpmichael@osg.samsung.com>
This commit is contained in:
parent
296d233f64
commit
3c332e1f88
|
@ -52,7 +52,14 @@ typedef struct _Ecore_Drm2_Event_Output_Changed
|
|||
Eina_Bool enabled : 1;
|
||||
} Ecore_Drm2_Event_Output_Changed;
|
||||
|
||||
/* structure to represent event for session state changes */
|
||||
typedef struct _Ecore_Drm2_Event_Activate
|
||||
{
|
||||
Eina_Bool active : 1;
|
||||
} Ecore_Drm2_Event_Activate;
|
||||
|
||||
EAPI extern int ECORE_DRM2_EVENT_OUTPUT_CHANGED;
|
||||
EAPI extern int ECORE_DRM2_EVENT_ACTIVATE;
|
||||
|
||||
/**
|
||||
* @file
|
||||
|
|
|
@ -5,6 +5,7 @@ static int _ecore_drm2_init_count = 0;
|
|||
int _ecore_drm2_log_dom = -1;
|
||||
|
||||
EAPI int ECORE_DRM2_EVENT_OUTPUT_CHANGED = -1;
|
||||
EAPI int ECORE_DRM2_EVENT_ACTIVATE = -1;
|
||||
|
||||
EAPI int
|
||||
ecore_drm2_init(void)
|
||||
|
@ -40,6 +41,7 @@ ecore_drm2_init(void)
|
|||
}
|
||||
|
||||
ECORE_DRM2_EVENT_OUTPUT_CHANGED = ecore_event_type_new();
|
||||
ECORE_DRM2_EVENT_ACTIVATE = ecore_event_type_new();
|
||||
|
||||
return _ecore_drm2_init_count;
|
||||
|
||||
|
@ -67,6 +69,7 @@ ecore_drm2_shutdown(void)
|
|||
if (--_ecore_drm2_init_count != 0) return _ecore_drm2_init_count;
|
||||
|
||||
ECORE_DRM2_EVENT_OUTPUT_CHANGED = -1;
|
||||
ECORE_DRM2_EVENT_ACTIVATE = -1;
|
||||
|
||||
eina_log_domain_unregister(_ecore_drm2_log_dom);
|
||||
_ecore_drm2_log_dom = -1;
|
||||
|
|
|
@ -8,6 +8,24 @@
|
|||
# define DRM_CAP_CURSOR_HEIGHT 0x9
|
||||
#endif
|
||||
|
||||
static Eina_Bool
|
||||
_cb_session_active(void *data EINA_UNUSED, int type EINA_UNUSED, void *event)
|
||||
{
|
||||
Elput_Event_Session_Active *ev;
|
||||
Ecore_Drm2_Event_Activate *ea;
|
||||
|
||||
ev = event;
|
||||
|
||||
ea = calloc(1, sizeof(Ecore_Drm2_Event_Activate));
|
||||
if (!ea) return ECORE_CALLBACK_RENEW;
|
||||
|
||||
ea->active = ev->active;
|
||||
|
||||
ecore_event_add(ECORE_DRM2_EVENT_ACTIVATE, ea, NULL, NULL);
|
||||
|
||||
return ECORE_CALLBACK_RENEW;
|
||||
}
|
||||
|
||||
static const char *
|
||||
_drm2_device_find(const char *seat)
|
||||
{
|
||||
|
@ -119,6 +137,10 @@ ecore_drm2_device_open(Ecore_Drm2_Device *device)
|
|||
DBG("Device Path: %s", device->path);
|
||||
DBG("Device Fd: %d", device->fd);
|
||||
|
||||
device->active_hdlr =
|
||||
ecore_event_handler_add(ELPUT_EVENT_SESSION_ACTIVE,
|
||||
_cb_session_active, device);
|
||||
|
||||
/* NB: Not going to enable planes if we don't support atomic */
|
||||
/* if (drmSetClientCap(device->fd, DRM_CLIENT_CAP_UNIVERSAL_PLANES, 1) < 0) */
|
||||
/* ERR("Could not set Universal Plane support: %m"); */
|
||||
|
@ -140,6 +162,9 @@ ecore_drm2_device_free(Ecore_Drm2_Device *device)
|
|||
{
|
||||
EINA_SAFETY_ON_NULL_RETURN(device);
|
||||
|
||||
if (device->active_hdlr) ecore_event_handler_del(device->active_hdlr);
|
||||
device->active_hdlr = NULL;
|
||||
|
||||
eina_stringshare_del(device->path);
|
||||
free(device);
|
||||
}
|
||||
|
|
|
@ -177,6 +177,7 @@ struct _Ecore_Drm2_Device
|
|||
} min, max;
|
||||
|
||||
Eeze_Udev_Watch *watch;
|
||||
Ecore_Event_Handler *active_hdlr;
|
||||
|
||||
Eina_List *outputs;
|
||||
};
|
||||
|
|
Loading…
Reference in New Issue