summaryrefslogtreecommitdiff
path: root/src/lib/ecore_drm/ecore_drm_device.c
diff options
context:
space:
mode:
authorChris Michael <cp.michael@samsung.com>2015-04-07 14:07:12 -0400
committerStefan Schmidt <s.schmidt@samsung.com>2015-04-10 11:09:50 +0200
commit5858513daac086a6eb8a6a40e701de6ba4f709d2 (patch)
treeef8b7f38d924c7223e40946ebfc07865badd1dd7 /src/lib/ecore_drm/ecore_drm_device.c
parent718ce414c103edd5c27f096df1b66ab3a1cd8424 (diff)
ecore-drm: Update drm device & output code to remove per-output dumb buffers
Summary: Since we now create the dumb buffers in the ecore_drm_device structure, we don't need them on a per-output basis. This commit fixes the output & device code to adjust to this. @fix Signed-off-by: Chris Michael <cp.michael@samsung.com>
Diffstat (limited to 'src/lib/ecore_drm/ecore_drm_device.c')
-rw-r--r--src/lib/ecore_drm/ecore_drm_device.c64
1 files changed, 61 insertions, 3 deletions
diff --git a/src/lib/ecore_drm/ecore_drm_device.c b/src/lib/ecore_drm/ecore_drm_device.c
index 1ba4a2668d..0eeb7c5a68 100644
--- a/src/lib/ecore_drm/ecore_drm_device.c
+++ b/src/lib/ecore_drm/ecore_drm_device.c
@@ -18,9 +18,10 @@ _ecore_drm_device_cb_page_flip(int fd EINA_UNUSED, unsigned int frame EINA_UNUSE
18 18
19 if (output->pending_flip) 19 if (output->pending_flip)
20 { 20 {
21 ecore_drm_output_fb_release(output, output->current); 21 if (output->dev->current)
22 output->current = output->next; 22 ecore_drm_output_fb_release(output, output->dev->current);
23 output->next = NULL; 23 output->dev->current = output->dev->next;
24 output->dev->next = NULL;
24 } 25 }
25 26
26 output->pending_flip = EINA_FALSE; 27 output->pending_flip = EINA_FALSE;
@@ -83,6 +84,8 @@ _ecore_drm_device_cb_idle(void *data)
83 84
84 if (!(dev = data)) return ECORE_CALLBACK_CANCEL; 85 if (!(dev = data)) return ECORE_CALLBACK_CANCEL;
85 86
87 /* TODO: skip repaints if we are VT-switched away */
88
86 EINA_LIST_FOREACH(dev->outputs, l, output) 89 EINA_LIST_FOREACH(dev->outputs, l, output)
87 { 90 {
88 if ((!output->enabled) || (!output->need_repaint)) continue; 91 if ((!output->enabled) || (!output->need_repaint)) continue;
@@ -232,10 +235,19 @@ EAPI void
232ecore_drm_device_free(Ecore_Drm_Device *dev) 235ecore_drm_device_free(Ecore_Drm_Device *dev)
233{ 236{
234 Ecore_Drm_Output *output; 237 Ecore_Drm_Output *output;
238 unsigned int i = 0;
235 239
236 /* check for valid device */ 240 /* check for valid device */
237 if (!dev) return; 241 if (!dev) return;
238 242
243 for (; i < ALEN(dev->dumb); i++)
244 {
245 if (dev->dumb[i]) ecore_drm_fb_destroy(dev->dumb[i]);
246 dev->dumb[i] = NULL;
247 }
248
249 ecore_drm_inputs_destroy(dev);
250
239 /* free outputs */ 251 /* free outputs */
240 EINA_LIST_FREE(dev->outputs, output) 252 EINA_LIST_FREE(dev->outputs, output)
241 ecore_drm_output_free(output); 253 ecore_drm_output_free(output);
@@ -537,3 +549,49 @@ ecore_drm_device_pointer_xy_get(Ecore_Drm_Device *dev, int *x, int *y)
537 } 549 }
538 } 550 }
539} 551}
552
553EAPI Eina_Bool
554ecore_drm_device_software_setup(Ecore_Drm_Device *dev)
555{
556 unsigned int i = 0;
557 int w = 0, h = 0;
558
559 EINA_SAFETY_ON_NULL_RETURN_VAL(dev, EINA_FALSE);
560
561 /* destroy any old buffers */
562 for (; i < ALEN(dev->dumb); i++)
563 {
564 if (dev->dumb[i]) ecore_drm_fb_destroy(dev->dumb[i]);
565 dev->dumb[i] = NULL;
566 }
567
568 /* get screen size */
569 ecore_drm_outputs_geometry_get(dev, NULL, NULL, &w, &h);
570
571 /* create new buffers */
572 for (i = 0; i < ALEN(dev->dumb); i++)
573 {
574 if (!(dev->dumb[i] = ecore_drm_fb_create(dev, w, h)))
575 {
576 ERR("Could not create dumb framebuffer: %m");
577 goto err;
578 }
579
580 DBG("Ecore_Drm_Device Created Dumb Buffer");
581 DBG("\tFb: %d", dev->dumb[i]->id);
582 DBG("\tHandle: %d", dev->dumb[i]->hdl);
583 DBG("\tStride: %d", dev->dumb[i]->stride);
584 DBG("\tSize: %d", dev->dumb[i]->size);
585 DBG("\tW: %d\tH: %d", dev->dumb[i]->w, dev->dumb[i]->h);
586 }
587
588 return EINA_TRUE;
589
590err:
591 for (i = 0; i < ALEN(dev->dumb); i++)
592 {
593 if (dev->dumb[i]) ecore_drm_fb_destroy(dev->dumb[i]);
594 dev->dumb[i] = NULL;
595 }
596 return EINA_FALSE;
597}