summaryrefslogtreecommitdiff
path: root/src/lib/ecore_drm2
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
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 'src/lib/ecore_drm2')
-rw-r--r--src/lib/ecore_drm2/ecore_drm2_fb.c30
-rw-r--r--src/lib/ecore_drm2/ecore_drm2_outputs.c2
-rw-r--r--src/lib/ecore_drm2/ecore_drm2_private.h2
3 files changed, 34 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
diff --git a/src/lib/ecore_drm2/ecore_drm2_outputs.c b/src/lib/ecore_drm2/ecore_drm2_outputs.c
index 557e33f5ab..a820f7d3f5 100644
--- a/src/lib/ecore_drm2/ecore_drm2_outputs.c
+++ b/src/lib/ecore_drm2/ecore_drm2_outputs.c
@@ -916,6 +916,8 @@ _output_destroy(Ecore_Drm2_Device *dev EINA_UNUSED, Ecore_Drm2_Output *output)
916 eina_stringshare_del(output->serial); 916 eina_stringshare_del(output->serial);
917 eina_stringshare_del(output->relative.to); 917 eina_stringshare_del(output->relative.to);
918 918
919 if (output->flip_timeout) ecore_timer_del(output->flip_timeout);
920
919 sym_drmModeFreeProperty(output->dpms); 921 sym_drmModeFreeProperty(output->dpms);
920 free(output->edid.blob); 922 free(output->edid.blob);
921 923
diff --git a/src/lib/ecore_drm2/ecore_drm2_private.h b/src/lib/ecore_drm2/ecore_drm2_private.h
index 490f1665e4..d1a749a871 100644
--- a/src/lib/ecore_drm2/ecore_drm2_private.h
+++ b/src/lib/ecore_drm2/ecore_drm2_private.h
@@ -252,6 +252,8 @@ struct _Ecore_Drm2_Output
252 /* unused when doing atomic */ 252 /* unused when doing atomic */
253 drmModePropertyPtr dpms; 253 drmModePropertyPtr dpms;
254 254
255 Ecore_Timer *flip_timeout;
256
255 Ecore_Drm2_Output_Mode *current_mode; 257 Ecore_Drm2_Output_Mode *current_mode;
256 Eina_List *modes; 258 Eina_List *modes;
257 259