[PATCH v3 1/4] drm: Add drm_crtc_has_vblank()

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

 



The new interface drm_crtc_has_vblank() return true if vblanking has
been initialized for a certain CRTC, or false otherwise. This function
will be useful for initializing CRTC state.

Signed-off-by: Thomas Zimmermann <tzimmermann@xxxxxxx>
---
 drivers/gpu/drm/drm_vblank.c | 21 +++++++++++++++++++++
 include/drm/drm_vblank.h     |  1 +
 2 files changed, 22 insertions(+)

diff --git a/drivers/gpu/drm/drm_vblank.c b/drivers/gpu/drm/drm_vblank.c
index 1659b13b178c..c20102899411 100644
--- a/drivers/gpu/drm/drm_vblank.c
+++ b/drivers/gpu/drm/drm_vblank.c
@@ -501,6 +501,27 @@ int drm_vblank_init(struct drm_device *dev, unsigned int num_crtcs)
 }
 EXPORT_SYMBOL(drm_vblank_init);
 
+/**
+ * drm_crtc_has_vblank - test if vblanking has been initialized for
+ *                       a CRTC
+ * @crtc: the CRTC
+ *
+ * Drivers may call this function to test if vblank support is
+ * initialized for a CRTC. For most hardware this means that vblanking
+ * can also be enabled on the CRTC.
+ *
+ * Returns:
+ * True if vblanking has been initialized for the given CRTC, false
+ * otherwise.
+ */
+bool drm_crtc_has_vblank(const struct drm_crtc *crtc)
+{
+	struct drm_device *dev = crtc->dev;
+
+	return crtc->index < dev->num_crtcs;
+}
+EXPORT_SYMBOL(drm_crtc_has_vblank);
+
 /**
  * drm_crtc_vblank_waitqueue - get vblank waitqueue for the CRTC
  * @crtc: which CRTC's vblank waitqueue to retrieve
diff --git a/include/drm/drm_vblank.h b/include/drm/drm_vblank.h
index c16c44052b3d..531a6bc12b7e 100644
--- a/include/drm/drm_vblank.h
+++ b/include/drm/drm_vblank.h
@@ -206,6 +206,7 @@ struct drm_vblank_crtc {
 };
 
 int drm_vblank_init(struct drm_device *dev, unsigned int num_crtcs);
+bool drm_crtc_has_vblank(const struct drm_crtc *crtc);
 u64 drm_crtc_vblank_count(struct drm_crtc *crtc);
 u64 drm_crtc_vblank_count_and_time(struct drm_crtc *crtc,
 				   ktime_t *vblanktime);
-- 
2.24.1

_______________________________________________
Virtualization mailing list
Virtualization@xxxxxxxxxxxxxxxxxxxxxxxxxx
https://lists.linuxfoundation.org/mailman/listinfo/virtualization



[Index of Archives]     [KVM Development]     [Libvirt Development]     [Libvirt Users]     [CentOS Virtualization]     [Netdev]     [Ethernet Bridging]     [Linux Wireless]     [Kernel Newbies]     [Security]     [Linux for Hams]     [Netfilter]     [Bugtraq]     [Yosemite Forum]     [MIPS Linux]     [ARM Linux]     [Linux RAID]     [Linux Admin]     [Samba]

  Powered by Linux