summaryrefslogtreecommitdiff
path: root/src/modules/ecore_evas
diff options
context:
space:
mode:
authorDerek Foreman <derekf@osg.samsung.com>2017-08-11 17:02:23 -0500
committerDerek Foreman <derekf@osg.samsung.com>2017-08-11 17:11:12 -0500
commitcb57ea7587e7d00aa429e19996129c48619d3f11 (patch)
tree0ce48fee5d2945c6ef0f4c2ce2d15944a510608e /src/modules/ecore_evas
parente893d7de7deb54a0ef730318e3bee4cb9b754da6 (diff)
ecore_evas_drm: Tick from the animator registration callback
If we're not ticking already when a new animator is started then we have to wait for a vblank to get a tick. That's not great. If we can, use the time of the last vblank to generate an immediate tick to avoid this latency.
Diffstat (limited to 'src/modules/ecore_evas')
-rw-r--r--src/modules/ecore_evas/engines/drm/ecore_evas_drm.c37
1 files changed, 36 insertions, 1 deletions
diff --git a/src/modules/ecore_evas/engines/drm/ecore_evas_drm.c b/src/modules/ecore_evas/engines/drm/ecore_evas_drm.c
index 80d7807..0c95ec9 100644
--- a/src/modules/ecore_evas/engines/drm/ecore_evas_drm.c
+++ b/src/modules/ecore_evas/engines/drm/ecore_evas_drm.c
@@ -54,6 +54,7 @@ typedef struct _Ecore_Evas_Engine_Drm_Data
54 int depth, bpp; 54 int depth, bpp;
55 unsigned int format; 55 unsigned int format;
56 double offset; 56 double offset;
57 double tick_job_timestamp;
57 Ecore_Drm2_Context ctx; 58 Ecore_Drm2_Context ctx;
58 Ecore_Fd_Handler *hdlr; 59 Ecore_Fd_Handler *hdlr;
59 Ecore_Drm2_Device *dev; 60 Ecore_Drm2_Device *dev;
@@ -61,6 +62,7 @@ typedef struct _Ecore_Evas_Engine_Drm_Data
61 Evas_Device *seat; 62 Evas_Device *seat;
62 Eina_Bool ticking : 1; 63 Eina_Bool ticking : 1;
63 Eina_Bool once : 1; 64 Eina_Bool once : 1;
65 Ecore_Job *tick_job;
64} Ecore_Evas_Engine_Drm_Data; 66} Ecore_Evas_Engine_Drm_Data;
65 67
66static int _drm_init_count = 0; 68static int _drm_init_count = 0;
@@ -631,6 +633,18 @@ _drm_evas_changed(Ecore_Evas *ee, Eina_Bool changed)
631} 633}
632 634
633static void 635static void
636_tick_job(void *data)
637{
638 Ecore_Evas_Engine_Drm_Data *edata;
639 Ecore_Evas *ee;
640
641 ee = data;
642 edata = ee->engine.data;
643 edata->tick_job = NULL;
644 ecore_evas_animator_tick(ee, NULL, edata->tick_job_timestamp);
645}
646
647static void
634_drm_animator_register(Ecore_Evas *ee) 648_drm_animator_register(Ecore_Evas *ee)
635{ 649{
636 double t; 650 double t;
@@ -642,7 +656,6 @@ _drm_animator_register(Ecore_Evas *ee)
642 ERR("Attempt to schedule tick for manually rendered canvas"); 656 ERR("Attempt to schedule tick for manually rendered canvas");
643 657
644 edata = ee->engine.data; 658 edata = ee->engine.data;
645 edata->ticking = EINA_TRUE;
646 659
647 /* Some graphics stacks appear to lie about their clock sources 660 /* Some graphics stacks appear to lie about their clock sources
648 * so attempt to measure the difference between our clock and the 661 * so attempt to measure the difference between our clock and the
@@ -670,8 +683,24 @@ _drm_animator_register(Ecore_Evas *ee)
670 } 683 }
671 } 684 }
672 685
686 if (edata->tick_job) ERR("Double animator register");
687 else
688 if (!edata->ticking &&
689 !(ecore_drm2_output_pending_get(edata->output) || ee->in_async_render))
690 {
691 r = ecore_drm2_output_blanktime_get(edata->output, 0, &sec, &usec);
692 if (r)
693 {
694 edata->tick_job_timestamp = (double)sec
695 + ((double)usec / 1000000);
696 edata->tick_job = ecore_job_add(_tick_job, ee);
697 }
698 }
699
673 if (!ecore_drm2_output_pending_get(edata->output) && !ee->in_async_render) 700 if (!ecore_drm2_output_pending_get(edata->output) && !ee->in_async_render)
674 ecore_drm2_fb_flip(NULL, edata->output); 701 ecore_drm2_fb_flip(NULL, edata->output);
702
703 edata->ticking = EINA_TRUE;
675} 704}
676 705
677static void 706static void
@@ -681,6 +710,12 @@ _drm_animator_unregister(Ecore_Evas *ee)
681 710
682 edata = ee->engine.data; 711 edata = ee->engine.data;
683 edata->ticking = EINA_FALSE; 712 edata->ticking = EINA_FALSE;
713 if (edata->tick_job)
714 {
715 ERR("Animator unregister before first tick");
716 ecore_job_del(edata->tick_job);
717 edata->tick_job = NULL;
718 }
684} 719}
685 720
686static double 721static double