forked from enlightenment/efl
ecore-drm Add hooks for updating wl_output when outputs are hotplugged
Summary: This provides callbacks to any bound wl_output listeners when a display is hotplugged. NOTE: Currently we don't receive hotplug events ANOTHER NOTE: We don't yet handle display removal Reviewers: devilhorns, zmike Reviewed By: devilhorns, zmike Subscribers: cedric Maniphest Tasks: T2131 Differential Revision: https://phab.enlightenment.org/D2006
This commit is contained in:
parent
5184ffec63
commit
0d69422cca
|
@ -116,6 +116,19 @@ struct _Ecore_Drm_Event_Activate
|
|||
Eina_Bool active;
|
||||
};
|
||||
|
||||
struct _Ecore_Drm_Event_Output
|
||||
{
|
||||
int x, y;
|
||||
int w, h;
|
||||
int phys_width, phys_height;
|
||||
unsigned int refresh;
|
||||
int subpixel_order;
|
||||
int transform;
|
||||
const char *make;
|
||||
const char *model;
|
||||
Eina_Bool plug : 1;
|
||||
};
|
||||
|
||||
/* opaque structure to represent a drm device */
|
||||
typedef struct _Ecore_Drm_Device Ecore_Drm_Device;
|
||||
|
||||
|
@ -140,8 +153,14 @@ typedef struct _Ecore_Drm_Sprite Ecore_Drm_Sprite;
|
|||
/* structure to inform drm activation state */
|
||||
typedef struct _Ecore_Drm_Event_Activate Ecore_Drm_Event_Activate;
|
||||
|
||||
/* structure to inform drm output plug events */
|
||||
/** @since 1.14 */
|
||||
typedef struct _Ecore_Drm_Event_Output Ecore_Drm_Event_Output;
|
||||
|
||||
EAPI extern int ECORE_DRM_EVENT_ACTIVATE;
|
||||
|
||||
EAPI extern int ECORE_DRM_EVENT_OUTPUT; /**< @since 1.14 */
|
||||
|
||||
/**
|
||||
* @file
|
||||
* @brief Ecore functions for dealing with drm, virtual terminals
|
||||
|
|
|
@ -89,6 +89,7 @@ ecore_drm_init(void)
|
|||
if (!eeze_init()) goto eeze_err;
|
||||
|
||||
ECORE_DRM_EVENT_ACTIVATE = ecore_event_type_new();
|
||||
ECORE_DRM_EVENT_OUTPUT = ecore_event_type_new();
|
||||
|
||||
/* return init count */
|
||||
return _ecore_drm_init_count;
|
||||
|
|
|
@ -13,6 +13,8 @@ static const char *conn_types[] =
|
|||
"DP", "HDMI", "HDMI", "TV", "eDP",
|
||||
};
|
||||
|
||||
EAPI int ECORE_DRM_EVENT_OUTPUT = 0;
|
||||
|
||||
/* local functions */
|
||||
|
||||
static Eina_Bool
|
||||
|
@ -359,6 +361,8 @@ _ecore_drm_output_create(Ecore_Drm_Device *dev, drmModeRes *res, drmModeConnecto
|
|||
output->backlight =
|
||||
_ecore_drm_output_backlight_init(output, conn->connector_type);
|
||||
|
||||
_ecore_drm_event_output_send(output, EINA_TRUE);
|
||||
|
||||
return output;
|
||||
|
||||
mode_err:
|
||||
|
@ -580,6 +584,41 @@ _ecore_drm_output_event(const char *device EINA_UNUSED, Eeze_Udev_Event event EI
|
|||
_ecore_drm_update_outputs(output);
|
||||
}
|
||||
|
||||
static void
|
||||
_ecore_drm_event_output_free(void *data EINA_UNUSED, void *event)
|
||||
{
|
||||
Ecore_Drm_Event_Output *e = event;
|
||||
|
||||
eina_stringshare_del(e->make);
|
||||
eina_stringshare_del(e->model);
|
||||
free(event);
|
||||
}
|
||||
|
||||
void
|
||||
_ecore_drm_event_output_send(const Ecore_Drm_Output *output, Eina_Bool plug)
|
||||
{
|
||||
Ecore_Drm_Event_Output *e;
|
||||
|
||||
if (!(e = calloc(1, sizeof(Ecore_Drm_Event_Output)))) return;
|
||||
e->plug = plug;
|
||||
if (plug)
|
||||
{
|
||||
e->w = output->current_mode->width;
|
||||
e->h = output->current_mode->height;
|
||||
e->x = output->x;
|
||||
e->y = output->y;
|
||||
e->phys_width = 0;
|
||||
e->phys_height = 0;
|
||||
e->refresh = output->current_mode->refresh;
|
||||
e->subpixel_order = output->subpixel;
|
||||
e->make = eina_stringshare_ref(output->make);
|
||||
e->model = eina_stringshare_ref(output->model);
|
||||
e->transform = 0;
|
||||
}
|
||||
ecore_event_add(ECORE_DRM_EVENT_OUTPUT, e,
|
||||
_ecore_drm_event_output_free, NULL);
|
||||
}
|
||||
|
||||
/* public functions */
|
||||
|
||||
/**
|
||||
|
|
|
@ -234,6 +234,7 @@ struct _Ecore_Drm_Sprite
|
|||
typedef void (*Ecore_Drm_Open_Cb)(void *data, int fd, Eina_Bool b);
|
||||
|
||||
void _ecore_drm_event_activate_send(Eina_Bool active);
|
||||
void _ecore_drm_event_output_send(const Ecore_Drm_Output *output, Eina_Bool plug);
|
||||
|
||||
Eina_Bool _ecore_drm_launcher_device_open(const char *device, Ecore_Drm_Open_Cb callback, void *data, int flags);
|
||||
int _ecore_drm_launcher_device_open_no_pending(const char *device, int flags);
|
||||
|
|
Loading…
Reference in New Issue