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 Appropriate ifdef goop to mak...
details: https://anonhg.NetBSD.org/src/rev/336cf87d3f82
branches: trunk
changeset: 1028229:336cf87d3f82
user: riastradh <riastradh%NetBSD.org@localhost>
date: Sun Dec 19 09:52:34 2021 +0000
description:
Appropriate ifdef goop to make this file build for us.
Use the netbsd-ified versions.
Author: Maya Rashish <maya%NetBSD.org@localhost>
diffstat:
sys/external/bsd/drm2/dist/drm/drm_vblank.c | 36 +++++++++++++++++++++++++++-
1 files changed, 34 insertions(+), 2 deletions(-)
diffs (105 lines):
diff -r 10c61edcccd4 -r 336cf87d3f82 sys/external/bsd/drm2/dist/drm/drm_vblank.c
--- a/sys/external/bsd/drm2/dist/drm/drm_vblank.c Sun Dec 19 09:52:24 2021 +0000
+++ b/sys/external/bsd/drm2/dist/drm/drm_vblank.c Sun Dec 19 09:52:34 2021 +0000
@@ -1,4 +1,4 @@
-/* $NetBSD: drm_vblank.c,v 1.4 2021/12/19 01:21:53 riastradh Exp $ */
+/* $NetBSD: drm_vblank.c,v 1.5 2021/12/19 09:52:34 riastradh Exp $ */
/*
* drm_irq.c IRQ and vblank support
@@ -27,7 +27,7 @@
*/
#include <sys/cdefs.h>
-__KERNEL_RCSID(0, "$NetBSD: drm_vblank.c,v 1.4 2021/12/19 01:21:53 riastradh Exp $");
+__KERNEL_RCSID(0, "$NetBSD: drm_vblank.c,v 1.5 2021/12/19 09:52:34 riastradh Exp $");
#include <linux/export.h>
#include <linux/moduleparam.h>
@@ -483,7 +483,11 @@
vblank->dev = dev;
vblank->pipe = i;
+#ifdef __NetBSD__
+ DRM_INIT_WAITQUEUE(&vblank->queue, "drmvblnq");
+#else
init_waitqueue_head(&vblank->queue);
+#endif
timer_setup(&vblank->disable_timer, vblank_disable_fn, 0);
seqlock_init(&vblank->seqlock);
}
@@ -519,7 +523,11 @@
* Drivers can use this to implement vblank waits using wait_event() and related
* functions.
*/
+#ifdef __NetBSD__
+drm_waitqueue_t *drm_crtc_vblank_waitqueue(struct drm_crtc *crtc)
+#else
wait_queue_head_t *drm_crtc_vblank_waitqueue(struct drm_crtc *crtc)
+#endif
{
return &crtc->dev->vblank[drm_crtc_index(crtc)].queue;
}
@@ -1131,11 +1139,20 @@
if (WARN(ret, "vblank not available on crtc %i, ret=%i\n", pipe, ret))
return;
+#ifdef __NetBSD__
+ spin_lock(&dev->vbl_lock);
+ last = drm_vblank_count(dev, pipe);
+ DRM_SPIN_TIMED_WAIT_UNTIL(ret, &vblank->queue, &dev->vbl_lock,
+ msecs_to_jiffies(100),
+ last != drm_vblank_count(dev, pipe));
+ spin_unlock(&dev->vbl_lock);
+#else
last = drm_vblank_count(dev, pipe);
ret = wait_event_timeout(vblank->queue,
last != drm_vblank_count(dev, pipe),
msecs_to_jiffies(100));
+#endif
WARN(ret == 0, "vblank wait timed out on crtc %i\n", pipe);
@@ -1193,7 +1210,11 @@
if (drm_core_check_feature(dev, DRIVER_ATOMIC) || !vblank->inmodeset)
drm_vblank_disable_and_save(dev, pipe);
+#ifdef __NetBSD__
+ DRM_SPIN_WAKEUP_ONE(&vblank->queue, &dev->vbl_lock);
+#else
wake_up(&vblank->queue);
+#endif
/*
* Prevent subsequent drm_vblank_get() from re-enabling
@@ -1712,10 +1733,17 @@
DRM_DEBUG("waiting on vblank count %"PRIu64", crtc %u\n",
req_seq, pipe);
+#ifdef __NetBSD__
+ DRM_SPIN_TIMED_WAIT_UNTIL(wait, &vblank->queue,
+ &dev->vbl_lock, msecs_to_jiffies(3000),
+ vblank_passed(drm_vblank_count(dev, pipe), req_seq) ||
+ !READ_ONCE(vblank->enabled));
+#else
wait = wait_event_interruptible_timeout(vblank->queue,
vblank_passed(drm_vblank_count(dev, pipe), req_seq) ||
!READ_ONCE(vblank->enabled),
msecs_to_jiffies(3000));
+#endif
switch (wait) {
case 0:
@@ -1815,7 +1843,11 @@
spin_unlock(&dev->vblank_time_lock);
+#ifdef __NetBSD__
+ DRM_SPIN_WAKEUP_ONE(&vblank->queue, &dev->vbl_lock);
+#else
wake_up(&vblank->queue);
+#endif
/* With instant-off, we defer disabling the interrupt until after
* we finish processing the following vblank after all events have
Home |
Main Index |
Thread Index |
Old Index