ecore-drm: Greatly improve drm rendering speed

Summary: This greatly improves rendering speed in evas drm engine.
Previously we would always call drmModeSetCrtc regardless if it was
needed or not. These changes greatly improve rendering speed in drm as
we now only call drmModeSetCrtc if it is needed.

@fix

Signed-off-by: Chris Michael <cp.michael@samsung.com>
This commit is contained in:
Chris Michael 2015-05-13 14:33:08 -04:00
parent 3aaa9f2f9f
commit 443010b465
3 changed files with 34 additions and 6 deletions

View File

@ -24,6 +24,9 @@ _ecore_drm_device_cb_page_flip(int fd EINA_UNUSED, unsigned int frame EINA_UNUSE
flip_count++;
if (flip_count < cb->count) return;
cb->dev->current = cb->dev->next;
cb->dev->next = NULL;
flip_count = 0;
if (cb->func) cb->func(cb->data);
/* free(cb); */

View File

@ -183,22 +183,39 @@ ecore_drm_fb_set(Ecore_Drm_Device *dev, Ecore_Drm_Fb *fb)
return;
}
if (!dev->next) dev->next = fb;
if (!dev->next) return;
EINA_LIST_FOREACH(dev->outputs, l, output)
{
int x = 0, y = 0;
if ((!output->enabled) || (!output->current_mode)) continue;
if (!output->cloned)
{
x = output->x;
y = output->y;
}
if (drmModeSetCrtc(dev->drm.fd, output->crtc_id, fb->id, x, y,
&output->conn_id, 1, &output->current_mode->info))
if ((!dev->current) ||
(dev->current->stride != dev->next->stride))
{
ERR("Failed to set Mode %dx%d for Output %s: %m",
output->current_mode->width, output->current_mode->height,
output->name);
DBG("Set Framebuffer %d For Output %s - %d %d",
dev->next->id, output->name, x, y);
DBG("\tOutput Geom: %d %d", output->x, output->y);
DBG("\tOutput Crtc Buffer: %d", output->crtc->buffer_id);
if (drmModeSetCrtc(dev->drm.fd, output->crtc_id, dev->next->id,
x, y, &output->conn_id, 1,
&output->current_mode->info))
{
ERR("Failed to set Mode %dx%d for Output %s: %m",
output->current_mode->width, output->current_mode->height,
output->name);
}
/* TODO: set dpms on ?? */
}
}
}
@ -219,12 +236,19 @@ ecore_drm_fb_send(Ecore_Drm_Device *dev, Ecore_Drm_Fb *fb, Ecore_Drm_Pageflip_Cb
if (!(cb = calloc(1, sizeof(Ecore_Drm_Pageflip_Callback))))
return;
cb->dev = dev;
cb->func = func;
cb->data = data;
cb->count = eina_list_count(dev->outputs);
EINA_LIST_FOREACH(dev->outputs, l, output)
if (output->enabled) cb->count++;
/* cb->count = eina_list_count(dev->outputs); */
EINA_LIST_FOREACH(dev->outputs, l, output)
{
if ((!output->enabled) || (!output->current_mode)) continue;
if (drmModePageFlip(dev->drm.fd, output->crtc_id, fb->id,
DRM_MODE_PAGE_FLIP_EVENT, cb) < 0)
{

View File

@ -82,6 +82,7 @@ extern int _ecore_drm_log_dom;
typedef struct _Ecore_Drm_Pageflip_Callback
{
Ecore_Drm_Device *dev;
Ecore_Drm_Pageflip_Cb func;
void *data;
int count;