From 57e8805005ef1dae6d4f252a77be09d491d8f81a Mon Sep 17 00:00:00 2001 From: "Carsten Haitzler (Rasterman)" Date: Thu, 6 Feb 2020 19:47:04 +0000 Subject: [PATCH] ddc - fix animation blocked by slow ddc response with multi screen just by luck the queue "play catchup" happens to have a classic scheduling issue. one screen always wins, the other always loses as we play catch-up in the request queue so one is starved of "scheduling slots" while the othe rgets them all. this fixes that by moving the entire request queue into the thread work queue in one go so they all get an equal chance. now botjh my desktop monitors dim smoothly on idle like my laptop... smooooooooood --- src/bin/system/e_system_ddc.c | 68 ++++++++++++++++++----------------- 1 file changed, 36 insertions(+), 32 deletions(-) diff --git a/src/bin/system/e_system_ddc.c b/src/bin/system/e_system_ddc.c index 7290b7a2d..dac507c89 100644 --- a/src/bin/system/e_system_ddc.c +++ b/src/bin/system/e_system_ddc.c @@ -492,44 +492,48 @@ _cb_worker(void *data EINA_UNUSED, Ecore_Thread *th) for (;;) { + Eina_List *local_req; + // wait for requests eina_semaphore_lock(&_worker_sem); + local_req = NULL; eina_lock_take(&_devices_lock); if (_req) { - r = _req->data; - if (r) - { - _req = eina_list_remove_list(_req, _req); - eina_lock_release(&_devices_lock); - if (!strcmp(r->req, "list")) - { - _do_list(th); - } - else if (!strcmp(r->req, "refresh")) - { - _ddc_probe(); - _do_list(th); - } - else if (!strcmp(r->req, "val-set")) - { - int id, val; - char edid[257]; - if (sscanf(r->params, "%256s %i %i", edid, &id, &val) == 3) - _do_val_set(th, edid, id, val); - } - else if (!strcmp(r->req, "val-get")) - { - int id; - char edid[257]; - if (sscanf(r->params, "%256s %i", edid, &id) == 2) - _do_val_get(th, edid, id); - } - free(r); - } - else eina_lock_release(&_devices_lock); + local_req = _req; + _req = NULL; + } + eina_lock_release(&_devices_lock); + while (local_req) + { + r = local_req->data; + local_req = eina_list_remove_list(local_req, local_req); + if (!r) continue; + if (!strcmp(r->req, "list")) + { + _do_list(th); + } + else if (!strcmp(r->req, "refresh")) + { + _ddc_probe(); + _do_list(th); + } + else if (!strcmp(r->req, "val-set")) + { + int id, val; + char edid[257]; + if (sscanf(r->params, "%256s %i %i", edid, &id, &val) == 3) + _do_val_set(th, edid, id, val); + } + else if (!strcmp(r->req, "val-get")) + { + int id; + char edid[257]; + if (sscanf(r->params, "%256s %i", edid, &id) == 2) + _do_val_get(th, edid, id); + } + free(r); } - else eina_lock_release(&_devices_lock); } }