From: kettenis Date: Thu, 13 Sep 2018 09:32:27 +0000 (+0000) Subject: In drm_wait_one_vblank() add a delay when we're "cold". Interrupts aren't X-Git-Url: http://artulab.com/gitweb/?a=commitdiff_plain;h=a7d85a90615128cd35aa341990485181fd361e50;p=openbsd In drm_wait_one_vblank() add a delay when we're "cold". Interrupts aren't enabled at that point, so we cannot wait for one to happen. But having no delay at all breaks detection of some output connectors. Thanks to Philippe Meunier for tracking down the issue. ok millert@, jsg@ --- diff --git a/sys/dev/pci/drm/drm_irq.c b/sys/dev/pci/drm/drm_irq.c index dd8474fc4a0..cbb80424abc 100644 --- a/sys/dev/pci/drm/drm_irq.c +++ b/sys/dev/pci/drm/drm_irq.c @@ -1317,8 +1317,21 @@ void drm_wait_one_vblank(struct drm_device *dev, unsigned int pipe) int ret; u32 last; - if (WARN_ON(pipe >= dev->num_crtcs) || cold) + if (WARN_ON(pipe >= dev->num_crtcs)) + return; + +#ifdef __OpenBSD__ + /* + * If we're cold, vblank interrupts won't happen even if + * they're turned on by the driver. Just stall long enough + * for a vblank to pass. This assumes a vrefresh of at least + * 25 Hz. + */ + if (cold) { + delay(40000); return; + } +#endif ret = drm_vblank_get(dev, pipe); if (WARN(ret, "vblank not available on crtc %i, ret=%i\n", pipe, ret))