Source-Changes-HG archive

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index][Old Index]

[src/trunk]: src/sys/external/bsd/drm2/dist/drm drm: Allow drm_atomic_helper_...



details:   https://anonhg.NetBSD.org/src/rev/2636bf355271
branches:  trunk
changeset: 1029019:2636bf355271
user:      riastradh <riastradh%NetBSD.org@localhost>
date:      Sun Dec 19 12:43:52 2021 +0000

description:
drm: Allow drm_atomic_helper_wait_for_vblanks while cold.

This enables us to do a mode-switch before interrupts are running.

diffstat:

 sys/external/bsd/drm2/dist/drm/drm_atomic_helper.c |  32 +++++++++++++++------
 1 files changed, 23 insertions(+), 9 deletions(-)

diffs (53 lines):

diff -r cdabeb848c6a -r 2636bf355271 sys/external/bsd/drm2/dist/drm/drm_atomic_helper.c
--- a/sys/external/bsd/drm2/dist/drm/drm_atomic_helper.c        Sun Dec 19 12:43:45 2021 +0000
+++ b/sys/external/bsd/drm2/dist/drm/drm_atomic_helper.c        Sun Dec 19 12:43:52 2021 +0000
@@ -1,4 +1,4 @@
-/*     $NetBSD: drm_atomic_helper.c,v 1.9 2021/12/19 12:05:08 riastradh Exp $  */
+/*     $NetBSD: drm_atomic_helper.c,v 1.10 2021/12/19 12:43:52 riastradh Exp $ */
 
 /*
  * Copyright (C) 2014 Red Hat
@@ -28,7 +28,7 @@
  */
 
 #include <sys/cdefs.h>
-__KERNEL_RCSID(0, "$NetBSD: drm_atomic_helper.c,v 1.9 2021/12/19 12:05:08 riastradh Exp $");
+__KERNEL_RCSID(0, "$NetBSD: drm_atomic_helper.c,v 1.10 2021/12/19 12:43:52 riastradh Exp $");
 
 #include <linux/dma-fence.h>
 #include <linux/ktime.h>
@@ -1466,13 +1466,27 @@
                        continue;
 
 #ifdef __NetBSD__
-               spin_lock(&dev->event_lock);
-               DRM_SPIN_WAIT_ON(ret, &dev->vblank[i].queue,
-                   &dev->event_lock,
-                   msecs_to_jiffies(50),
-                   (old_state->crtcs[i].last_vblank_count !=
-                       drm_crtc_vblank_count(crtc)));
-               spin_unlock(&dev->event_lock);
+               if (cold) {
+                       unsigned timo = 100;
+
+                       ret = -ETIMEDOUT;
+                       while (timo --> 0 && ret) {
+                               spin_lock(&dev->event_lock);
+                               if (old_state->crtcs[i].last_vblank_count !=
+                                   drm_crtc_vblank_count(crtc)) {
+                                       ret = 0;
+                               }
+                               spin_unlock(&dev->event_lock);
+                       }
+               } else {
+                       spin_lock(&dev->event_lock);
+                       DRM_SPIN_WAIT_ON(ret, &dev->vblank[i].queue,
+                           &dev->event_lock,
+                           msecs_to_jiffies(100),
+                           (old_state->crtcs[i].last_vblank_count !=
+                               drm_crtc_vblank_count(crtc)));
+                       spin_unlock(&dev->event_lock);
+               }
 #else
                ret = wait_event_timeout(dev->vblank[i].queue,
                                old_state->crtcs[i].last_vblank_count !=



Home | Main Index | Thread Index | Old Index