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
This commit is contained in:
Carsten Haitzler 2020-02-06 19:47:04 +00:00
parent 14576d282d
commit 57e8805005
1 changed files with 36 additions and 32 deletions

View File

@ -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);
}
}