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: Restore drm_crtc_vblank_put_...
details: https://anonhg.NetBSD.org/src/rev/d30b05a6ea89
branches: trunk
changeset: 1028706:d30b05a6ea89
user: riastradh <riastradh%NetBSD.org@localhost>
date: Sun Dec 19 11:48:42 2021 +0000
description:
drm: Restore drm_crtc_vblank_put_locked
diffstat:
sys/external/bsd/drm2/dist/drm/drm_vblank.c | 47 ++++++++++++++++++++-
sys/external/bsd/drm2/dist/include/drm/drm_vblank.h | 3 +-
2 files changed, 47 insertions(+), 3 deletions(-)
diffs (99 lines):
diff -r 092fe99da9df -r d30b05a6ea89 sys/external/bsd/drm2/dist/drm/drm_vblank.c
--- a/sys/external/bsd/drm2/dist/drm/drm_vblank.c Sun Dec 19 11:48:34 2021 +0000
+++ b/sys/external/bsd/drm2/dist/drm/drm_vblank.c Sun Dec 19 11:48:42 2021 +0000
@@ -1,4 +1,4 @@
-/* $NetBSD: drm_vblank.c,v 1.7 2021/12/19 11:08:10 riastradh Exp $ */
+/* $NetBSD: drm_vblank.c,v 1.8 2021/12/19 11:48:42 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.7 2021/12/19 11:08:10 riastradh Exp $");
+__KERNEL_RCSID(0, "$NetBSD: drm_vblank.c,v 1.8 2021/12/19 11:48:42 riastradh Exp $");
#include <linux/export.h>
#include <linux/moduleparam.h>
@@ -417,6 +417,20 @@
spin_unlock_irqrestore(&dev->vblank_time_lock, irqflags);
}
+static void
+vblank_disable_locked(struct drm_vblank_crtc *vblank, struct drm_device *dev,
+ unsigned int pipe)
+{
+
+ BUG_ON(vblank != &dev->vblank[pipe]);
+ assert_spin_locked(&dev->vbl_lock);
+
+ if (atomic_read(&vblank->refcount) == 0 && vblank->enabled) {
+ DRM_DEBUG("disabling vblank on crtc %u\n", pipe);
+ drm_vblank_disable_and_save(dev, pipe);
+ }
+}
+
static void vblank_disable_fn(struct timer_list *t)
{
struct drm_vblank_crtc *vblank = from_timer(vblank, t, disable_timer);
@@ -1086,6 +1100,30 @@
}
EXPORT_SYMBOL(drm_crtc_vblank_get);
+static void drm_vblank_put_locked(struct drm_device *dev, unsigned int pipe)
+{
+ struct drm_vblank_crtc *vblank = &dev->vblank[pipe];
+
+ assert_spin_locked(&dev->vbl_lock);
+
+ if (WARN_ON(pipe >= dev->num_crtcs))
+ return;
+
+ if (WARN_ON(atomic_read(&vblank->refcount) == 0))
+ return;
+
+ /* Last user schedules interrupt disable */
+ if (atomic_dec_and_test(&vblank->refcount)) {
+ if (drm_vblank_offdelay == 0)
+ return;
+ else if (drm_vblank_offdelay < 0)
+ vblank_disable_locked(vblank, dev, pipe);
+ else if (!dev->vblank_disable_immediate)
+ mod_timer(&vblank->disable_timer,
+ jiffies + ((drm_vblank_offdelay * HZ)/1000));
+ }
+}
+
static void drm_vblank_put(struct drm_device *dev, unsigned int pipe)
{
struct drm_vblank_crtc *vblank = &dev->vblank[pipe];
@@ -1121,6 +1159,11 @@
}
EXPORT_SYMBOL(drm_crtc_vblank_put);
+void drm_crtc_vblank_put_locked(struct drm_crtc *crtc)
+{
+ drm_vblank_put_locked(crtc->dev, drm_crtc_index(crtc));
+}
+
/**
* drm_wait_one_vblank - wait for one vblank
* @dev: DRM device
diff -r 092fe99da9df -r d30b05a6ea89 sys/external/bsd/drm2/dist/include/drm/drm_vblank.h
--- a/sys/external/bsd/drm2/dist/include/drm/drm_vblank.h Sun Dec 19 11:48:34 2021 +0000
+++ b/sys/external/bsd/drm2/dist/include/drm/drm_vblank.h Sun Dec 19 11:48:42 2021 +0000
@@ -1,4 +1,4 @@
-/* $NetBSD: drm_vblank.h,v 1.8 2021/12/19 01:58:04 riastradh Exp $ */
+/* $NetBSD: drm_vblank.h,v 1.9 2021/12/19 11:48:42 riastradh Exp $ */
/*
* Copyright 2016 Intel Corp.
@@ -236,6 +236,7 @@
bool drm_crtc_handle_vblank(struct drm_crtc *crtc);
int drm_crtc_vblank_get(struct drm_crtc *crtc);
void drm_crtc_vblank_put(struct drm_crtc *crtc);
+void drm_crtc_vblank_put_locked(struct drm_crtc *crtc);
void drm_wait_one_vblank(struct drm_device *dev, unsigned int pipe);
void drm_crtc_wait_one_vblank(struct drm_crtc *crtc);
void drm_crtc_vblank_off(struct drm_crtc *crtc);
Home |
Main Index |
Thread Index |
Old Index