- /* Retrieve modes only if we have none. This avoids expensive
- * EDID reads in the kernel, that can slow down resyncs
- * considerably! */
- if (connector->kern.n_modes == 0) {
- res.modes_ptr = PTR_TO_UINT64(connector->kern.modes);
- res.count_modes = connector->kern.max_modes;
+ /* The kernel reads modes from the EDID information only if we
+ * pass count_modes==0. This is a legacy hack for libdrm (which
+ * called every ioctl twice). Now we have to adopt.. *sigh*.
+ * If we never received an hotplug event, there's no reason to
+ * sync modes. EDID reads are heavy, so skip that if not
+ * required. */
+ if (card->hotplug) {
+ if (tries > 0) {
+ res.modes_ptr = PTR_TO_UINT64(connector->kern.modes);
+ res.count_modes = connector->kern.max_modes;
+ } else {
+ resized = true;
+ }