ecore-drm: Create drmEventContext Once during device open

Summary: This changes allows us to reuse the same drmEventContext once
so that when we get drm events, we are not constantly recreating the
drmEventContext.

@fix

Signed-off-by: Chris Michael <cp.michael@samsung.com>
This commit is contained in:
Chris Michael 2015-04-07 14:30:43 -04:00 committed by Stefan Schmidt
parent e3440c4683
commit 3832cd59b8
2 changed files with 12 additions and 8 deletions

View File

@ -117,6 +117,10 @@ struct _Ecore_Drm_Device
int current_fb;
Ecore_Drm_Fb *current, *next;
Ecore_Drm_Fb *dumb[2];
drmEventContext drm_ctx;
Eina_Bool active : 1;
};
struct _Ecore_Drm_Event_Activate
@ -205,6 +209,8 @@ EAPI int ecore_drm_device_fd_get(Ecore_Drm_Device *dev);
EAPI void ecore_drm_device_window_set(Ecore_Drm_Device *dev, unsigned int window);
EAPI const char *ecore_drm_device_name_get(Ecore_Drm_Device *dev);
EAPI void ecore_drm_device_fb_set(Ecore_Drm_Device *dev, Ecore_Drm_Fb *fb);
/**
* Setup an Ecore_Drm_Device for software rendering
*

View File

@ -58,19 +58,12 @@ static Eina_Bool
_ecore_drm_device_cb_event(void *data, Ecore_Fd_Handler *hdlr EINA_UNUSED)
{
Ecore_Drm_Device *dev;
drmEventContext ctx;
if (!(dev = data)) return ECORE_CALLBACK_RENEW;
DBG("Drm Device Event");
memset(&ctx, 0, sizeof(ctx));
ctx.version = DRM_EVENT_CONTEXT_VERSION;
ctx.page_flip_handler = _ecore_drm_device_cb_page_flip;
ctx.vblank_handler = _ecore_drm_device_cb_vblank;
drmHandleEvent(dev->drm.fd, &ctx);
drmHandleEvent(dev->drm.fd, &dev->drm_ctx);
return ECORE_CALLBACK_RENEW;
}
@ -327,6 +320,11 @@ ecore_drm_device_open(Ecore_Drm_Device *dev)
return EINA_FALSE;
}
memset(&dev->drm_ctx, 0, sizeof(dev->drm_ctx));
dev->drm_ctx.version = DRM_EVENT_CONTEXT_VERSION;
dev->drm_ctx.page_flip_handler = _ecore_drm_device_cb_page_flip;
dev->drm_ctx.vblank_handler = _ecore_drm_device_cb_vblank;
events = (EEZE_UDEV_EVENT_ADD | EEZE_UDEV_EVENT_REMOVE |
EEZE_UDEV_EVENT_CHANGE);