summaryrefslogtreecommitdiff
path: root/src/lib/ecore_drm2/ecore_drm2_fb.c
diff options
context:
space:
mode:
authorCarsten Haitzler (Rasterman) <raster@rasterman.com>2019-02-17 13:33:25 +0000
committerCarsten Haitzler (Rasterman) <raster@rasterman.com>2019-02-21 09:52:31 +0000
commit39f224b3a65f10f3957d240582c63fafd7d2d524 (patch)
tree2583250cc2526461df674fe0b388cf4d3b30ecaa /src/lib/ecore_drm2/ecore_drm2_fb.c
parent2c259edd9f6ed1d07e18eae0a2c6d0a8ce9bc6f3 (diff)
ecore drm2 - work around kms/drm bug seemingly when no flip event comes
so we request a flip so we can do vsync events. the flip event never comes. i am not sure why it never comes, but we ask and nothing arrives, and this basically halts all rendering in wayland compositor mode as we are syncing rendering to vsync (of course). put in a timeout of 0.05s (50ms) to try ask again if the event never comes and log the error. this is a pretty useful workaround becauswe having your entire display freeze is a ... bad thing. @fix
Diffstat (limited to '')
-rw-r--r--src/lib/ecore_drm2/ecore_drm2_fb.c30
1 files changed, 30 insertions, 0 deletions
diff --git a/src/lib/ecore_drm2/ecore_drm2_fb.c b/src/lib/ecore_drm2/ecore_drm2_fb.c
index 33c0e27570..6888a3c2c1 100644
--- a/src/lib/ecore_drm2/ecore_drm2_fb.c
+++ b/src/lib/ecore_drm2/ecore_drm2_fb.c
@@ -263,6 +263,11 @@ ecore_drm2_fb_flip_complete(Ecore_Drm2_Output *output)
263 263
264 EINA_SAFETY_ON_NULL_RETURN_VAL(output, EINA_FALSE); 264 EINA_SAFETY_ON_NULL_RETURN_VAL(output, EINA_FALSE);
265 265
266 if (output->flip_timeout)
267 {
268 ecore_timer_del(output->flip_timeout);
269 output->flip_timeout = NULL;
270 }
266 if (output->current.fb && (output->current.fb != output->pending.fb)) 271 if (output->current.fb && (output->current.fb != output->pending.fb))
267 _ecore_drm2_fb_buffer_release(output, &output->current); 272 _ecore_drm2_fb_buffer_release(output, &output->current);
268 273
@@ -428,6 +433,21 @@ err:
428 return EINA_FALSE; 433 return EINA_FALSE;
429} 434}
430 435
436static int _fb_atomic_flip(Ecore_Drm2_Output *output);
437static int _fb_flip(Ecore_Drm2_Output *output);
438
439static Eina_Bool
440_cb_flip_timeout(void *data)
441{
442 Ecore_Drm2_Output *output = data;
443
444 output->flip_timeout = NULL;
445 ERR("flip event callback timout 0.05sec - try again");
446 if (_ecore_drm2_use_atomic) _fb_atomic_flip(output);
447 else _fb_flip(output);
448 return EINA_FALSE;
449}
450
431static int 451static int
432_fb_atomic_flip(Ecore_Drm2_Output *output) 452_fb_atomic_flip(Ecore_Drm2_Output *output)
433{ 453{
@@ -453,6 +473,11 @@ _fb_atomic_flip(Ecore_Drm2_Output *output)
453 ERR("Failed Atomic Commit: %m"); 473 ERR("Failed Atomic Commit: %m");
454 return -1; 474 return -1;
455 } 475 }
476 else
477 {
478 if (output->flip_timeout) ecore_timer_del(output->flip_timeout);
479 output->flip_timeout = ecore_timer_add(0.05, _cb_flip_timeout, output);
480 }
456 481
457 return 0; 482 return 0;
458} 483}
@@ -526,6 +551,11 @@ _fb_flip(Ecore_Drm2_Output *output)
526 } 551 }
527 usleep(100); 552 usleep(100);
528 } 553 }
554 else
555 {
556 if (output->flip_timeout) ecore_timer_del(output->flip_timeout);
557 output->flip_timeout = ecore_timer_add(0.05, _cb_flip_timeout, output);
558 }
529 } 559 }
530 while (repeat); 560 while (repeat);
531 561