chiark / gitweb /
terminal: fix mode sync for connectors
authorDavid Herrmann <dh.herrmann@gmail.com>
Sat, 20 Sep 2014 09:43:32 +0000 (11:43 +0200)
committerDavid Herrmann <dh.herrmann@gmail.com>
Sat, 20 Sep 2014 09:46:49 +0000 (11:46 +0200)
commit0fbd4d113e0d2123e896e8005d1b7fe407c28c05
tree157351076fb34fc9f767fa3fc5e673063c436d35
parentf919ad9d3dc3e25f6eed268fe7eb5e922bcdb3b6
terminal: fix mode sync for connectors

The GETXY ioctls of DRM are usually called twice by libdrm: Once to
retrieve the number of objects, a second time with suitably sized buffers
to actually retrieve all objects. In grdrm, we avoid these excessive calls
and instead just call ioctls with cached buffers and resize them if they
were too small.

However, connectors need to read the mode list via EDID, which is horribly
slow. As the kernel still cannot do that asynchronously (seriously, we
need to fix this!), it has a hack to only do it if count_modes==0. This is
fine with libdrm, as it calls every ioctl twice, anyway. However, we fail
horribly with this as we usually never pass 0.

Fix this by calling into GETCONNECTOR ioctls twice in case we received an
hotplug event. Only in those cases, we need to re-read modes, so this
should be totally fine.
src/libsystemd-terminal/grdev-drm.c