diff --git a/gfx/context/drm_egl_ctx.c b/gfx/context/drm_egl_ctx.c index 07e160f5f1..fbf5289ea9 100644 --- a/gfx/context/drm_egl_ctx.c +++ b/gfx/context/drm_egl_ctx.c @@ -30,6 +30,8 @@ #include #include #include +#include +#include #include #include @@ -236,6 +238,37 @@ void gfx_ctx_get_video_size(unsigned *width, unsigned *height) *height = g_fb_height; } +static void reschedule_process(void) +{ + struct sched_param param = {0}; + + // All-out real-time. Why not? :D + param.sched_priority = sched_get_priority_max(SCHED_FIFO); + if (sched_setscheduler(0, SCHED_FIFO, ¶m) < 0) + RARCH_ERR("[KMS/EGL]: Failed to set SCHED_FIFO priority.\n"); + + int sched = sched_getscheduler(getpid()); + + const char *scheduler; + switch (sched) + { + case SCHED_OTHER: + scheduler = "SCHED_OTHER"; + break; + + case SCHED_FIFO: + scheduler = "SCHED_FIFO"; + break; + + default: + scheduler = "Unrelated"; + } + + RARCH_LOG("[KMS/EGL]: Current scheduler: %s\n", scheduler); + if (sched == SCHED_FIFO) + RARCH_LOG("[KMS/EGL]: SCHED_FIFO prio: %d\n", param.sched_priority); +} + bool gfx_ctx_init(void) { if (g_inited) @@ -244,6 +277,8 @@ bool gfx_ctx_init(void) return false; } + reschedule_process(); + static const char *modules[] = { "i915", "radeon", "nouveau", "vmwgfx", "omapdrm", "exynos", NULL };