drm: Stop using drm_vblank_count() as the hw frame counter
authorVille Syrjälä <ville.syrjala@linux.intel.com>
Wed, 30 Sep 2015 13:46:48 +0000 (16:46 +0300)
committerDaniel Vetter <daniel.vetter@ffwll.ch>
Wed, 7 Oct 2015 14:13:52 +0000 (16:13 +0200)
drm_vblank_count() returns the software counter. We should not pretend
it's the hw counter since we use the hw counter to figuere out what the
software counter value should be. So instead provide a new function
drm_vblank_no_hw_counter() for drivers that don't have a real hw
counter. The new function simply returns 0, which is about the only
thing it can do.

Cc: Vincent Abriou <vincent.abriou@st.com>
Cc: Thierry Reding <treding@nvidia.com>
Signed-off-by: Ville Syrjälä <ville.syrjala@linux.intel.com>
Reviewed-by: Vincent Abriou <vincent.abriou@st.com>
[danvet: s/int pipe/unsigned int pipe/ to follow Thierry's interface
change.]
Signed-off-by: Daniel Vetter <daniel.vetter@ffwll.ch>
15 files changed:
drivers/gpu/drm/armada/armada_drv.c
drivers/gpu/drm/atmel-hlcdc/atmel_hlcdc_dc.c
drivers/gpu/drm/drm_irq.c
drivers/gpu/drm/exynos/exynos_drm_drv.c
drivers/gpu/drm/fsl-dcu/fsl_dcu_drm_drv.c
drivers/gpu/drm/imx/imx-drm-core.c
drivers/gpu/drm/msm/msm_drv.c
drivers/gpu/drm/nouveau/nouveau_drm.c
drivers/gpu/drm/omapdrm/omap_drv.c
drivers/gpu/drm/rcar-du/rcar_du_drv.c
drivers/gpu/drm/rockchip/rockchip_drm_drv.c
drivers/gpu/drm/shmobile/shmob_drm_drv.c
drivers/gpu/drm/sti/sti_drv.c
drivers/gpu/drm/tilcdc/tilcdc_drv.c
include/drm/drmP.h

index a438886fcdb60330a6230a5853a2df06b71110da..f91a496fcdcb95c7e3ca9009b7f986e06f403dee 100644 (file)
@@ -300,7 +300,7 @@ static struct drm_driver armada_drm_driver = {
        .lastclose              = armada_drm_lastclose,
        .unload                 = armada_drm_unload,
        .set_busid              = drm_platform_set_busid,
-       .get_vblank_counter     = drm_vblank_count,
+       .get_vblank_counter     = drm_vblank_no_hw_counter,
        .enable_vblank          = armada_drm_enable_vblank,
        .disable_vblank         = armada_drm_disable_vblank,
 #ifdef CONFIG_DEBUG_FS
index 6dfb63ab54d2351b555bfb0df713653961ea8676..244df0a440b730a71ba0d21c3f746569b4b81b36 100644 (file)
@@ -699,7 +699,7 @@ static struct drm_driver atmel_hlcdc_dc_driver = {
        .irq_preinstall = atmel_hlcdc_dc_irq_uninstall,
        .irq_postinstall = atmel_hlcdc_dc_irq_postinstall,
        .irq_uninstall = atmel_hlcdc_dc_irq_uninstall,
-       .get_vblank_counter = drm_vblank_count,
+       .get_vblank_counter = drm_vblank_no_hw_counter,
        .enable_vblank = atmel_hlcdc_dc_enable_vblank,
        .disable_vblank = atmel_hlcdc_dc_disable_vblank,
        .gem_free_object = drm_gem_cma_free_object,
index 0659d9956b7c676b03a767f7ed68285140ec4aa4..7bdf247b9681b59421b73cce7bb6c5e015073928 100644 (file)
@@ -1798,3 +1798,20 @@ bool drm_crtc_handle_vblank(struct drm_crtc *crtc)
        return drm_handle_vblank(crtc->dev, drm_crtc_index(crtc));
 }
 EXPORT_SYMBOL(drm_crtc_handle_vblank);
+
+/**
+ * drm_vblank_no_hw_counter - "No hw counter" implementation of .get_vblank_counter()
+ * @dev: DRM device
+ * @pipe: CRTC for which to read the counter
+ *
+ * Drivers can plug this into the .get_vblank_counter() function if
+ * there is no useable hardware frame counter available.
+ *
+ * Returns:
+ * 0
+ */
+u32 drm_vblank_no_hw_counter(struct drm_device *dev, unsigned int pipe)
+{
+       return 0;
+}
+EXPORT_SYMBOL(drm_vblank_no_hw_counter);
index f0a5839bd226477b40ca6ce29e39aaca8328c4b3..fb9cfc50b373a1aa928a14ba09b2f1ed00f55f85 100644 (file)
@@ -447,7 +447,7 @@ static struct drm_driver exynos_drm_driver = {
        .lastclose              = exynos_drm_lastclose,
        .postclose              = exynos_drm_postclose,
        .set_busid              = drm_platform_set_busid,
-       .get_vblank_counter     = drm_vblank_count,
+       .get_vblank_counter     = drm_vblank_no_hw_counter,
        .enable_vblank          = exynos_drm_crtc_enable_vblank,
        .disable_vblank         = exynos_drm_crtc_disable_vblank,
        .gem_free_object        = exynos_drm_gem_free_object,
index f1fd986ca3323b711b9aa3654b3d7fc1c10a7414..1930234ba5f13596f3b998d737c88e987b3370e7 100644 (file)
@@ -193,7 +193,7 @@ static struct drm_driver fsl_dcu_drm_driver = {
        .unload                 = fsl_dcu_unload,
        .preclose               = fsl_dcu_drm_preclose,
        .irq_handler            = fsl_dcu_drm_irq,
-       .get_vblank_counter     = drm_vblank_count,
+       .get_vblank_counter     = drm_vblank_no_hw_counter,
        .enable_vblank          = fsl_dcu_drm_enable_vblank,
        .disable_vblank         = fsl_dcu_drm_disable_vblank,
        .gem_free_object        = drm_gem_cma_free_object,
index b880c12c652113de522030775e3196c6c3927bac..de00a6c31ab69e7a41584bfd2e155cda6d6a52ce 100644 (file)
@@ -487,7 +487,7 @@ static struct drm_driver imx_drm_driver = {
        .gem_prime_vmap         = drm_gem_cma_prime_vmap,
        .gem_prime_vunmap       = drm_gem_cma_prime_vunmap,
        .gem_prime_mmap         = drm_gem_cma_prime_mmap,
-       .get_vblank_counter     = drm_vblank_count,
+       .get_vblank_counter     = drm_vblank_no_hw_counter,
        .enable_vblank          = imx_drm_enable_vblank,
        .disable_vblank         = imx_drm_disable_vblank,
        .ioctls                 = imx_drm_ioctls,
index 7e44511d095155bfaa3c6e471aa2918640bbd3d3..a06ec71e109da96742827803643f87f7b031b7ac 100644 (file)
@@ -978,7 +978,7 @@ static struct drm_driver msm_driver = {
        .irq_preinstall     = msm_irq_preinstall,
        .irq_postinstall    = msm_irq_postinstall,
        .irq_uninstall      = msm_irq_uninstall,
-       .get_vblank_counter = drm_vblank_count,
+       .get_vblank_counter = drm_vblank_no_hw_counter,
        .enable_vblank      = msm_enable_vblank,
        .disable_vblank     = msm_disable_vblank,
        .gem_free_object    = msm_gem_free_object,
index ccefb645fd55dfd4e93f3461021e3bb845a9da29..2416c7dddd5bba35e46a73be0badfe6b90d23d91 100644 (file)
@@ -934,7 +934,7 @@ driver_stub = {
        .debugfs_cleanup = nouveau_debugfs_takedown,
 #endif
 
-       .get_vblank_counter = drm_vblank_count,
+       .get_vblank_counter = drm_vblank_no_hw_counter,
        .enable_vblank = nouveau_display_vblank_enable,
        .disable_vblank = nouveau_display_vblank_disable,
        .get_scanout_position = nouveau_display_scanoutpos,
index d685e23449cee8efb0280f44003495ec79bf30a1..4d5893473f7828dbbc1499106e54a3294917c6d8 100644 (file)
@@ -839,7 +839,7 @@ static struct drm_driver omap_drm_driver = {
        .preclose = dev_preclose,
        .postclose = dev_postclose,
        .set_busid = drm_platform_set_busid,
-       .get_vblank_counter = drm_vblank_count,
+       .get_vblank_counter = drm_vblank_no_hw_counter,
        .enable_vblank = omap_irq_enable_vblank,
        .disable_vblank = omap_irq_disable_vblank,
 #ifdef CONFIG_DEBUG_FS
index bb806c4c2e650385cbb490825009bc7e241db4c1..feddda0aaea22f6d04750255cbce94838e2666a3 100644 (file)
@@ -259,7 +259,7 @@ static struct drm_driver rcar_du_driver = {
        .preclose               = rcar_du_preclose,
        .lastclose              = rcar_du_lastclose,
        .set_busid              = drm_platform_set_busid,
-       .get_vblank_counter     = drm_vblank_count,
+       .get_vblank_counter     = drm_vblank_no_hw_counter,
        .enable_vblank          = rcar_du_enable_vblank,
        .disable_vblank         = rcar_du_disable_vblank,
        .gem_free_object        = drm_gem_cma_free_object,
index 32c6098a99d18a5cb46bb7eee11050c43282601a..f22e1e1ee64aae52a1e3efb657a78790bd6ba573 100644 (file)
@@ -279,7 +279,7 @@ static struct drm_driver rockchip_drm_driver = {
        .load                   = rockchip_drm_load,
        .unload                 = rockchip_drm_unload,
        .lastclose              = rockchip_drm_lastclose,
-       .get_vblank_counter     = drm_vblank_count,
+       .get_vblank_counter     = drm_vblank_no_hw_counter,
        .enable_vblank          = rockchip_drm_crtc_enable_vblank,
        .disable_vblank         = rockchip_drm_crtc_disable_vblank,
        .gem_vm_ops             = &rockchip_drm_vm_ops,
index ca2f918a6587902bf7d1c51b4760cea4aa804bd8..04e66e3751b49859c93bc66d1c85f518f564038e 100644 (file)
@@ -269,7 +269,7 @@ static struct drm_driver shmob_drm_driver = {
        .preclose               = shmob_drm_preclose,
        .set_busid              = drm_platform_set_busid,
        .irq_handler            = shmob_drm_irq,
-       .get_vblank_counter     = drm_vblank_count,
+       .get_vblank_counter     = drm_vblank_no_hw_counter,
        .enable_vblank          = shmob_drm_enable_vblank,
        .disable_vblank         = shmob_drm_disable_vblank,
        .gem_free_object        = drm_gem_cma_free_object,
index 9f85988a43cee8d8f5cd0f294ee0712bd02497be..f8469967a0bfbb43dcf5faee539ac9b5d5b5f328 100644 (file)
@@ -201,7 +201,7 @@ static struct drm_driver sti_driver = {
        .dumb_destroy = drm_gem_dumb_destroy,
        .fops = &sti_driver_fops,
 
-       .get_vblank_counter = drm_vblank_count,
+       .get_vblank_counter = drm_vblank_no_hw_counter,
        .enable_vblank = sti_crtc_enable_vblank,
        .disable_vblank = sti_crtc_disable_vblank,
 
index a5b8f5d393115da86cbe1fdd2d3ed4e0a0175767..876cad58b1f9ee1863d8de1bccf737b75b597ec6 100644 (file)
@@ -563,7 +563,7 @@ static struct drm_driver tilcdc_driver = {
        .irq_preinstall     = tilcdc_irq_preinstall,
        .irq_postinstall    = tilcdc_irq_postinstall,
        .irq_uninstall      = tilcdc_irq_uninstall,
-       .get_vblank_counter = drm_vblank_count,
+       .get_vblank_counter = drm_vblank_no_hw_counter,
        .enable_vblank      = tilcdc_enable_vblank,
        .disable_vblank     = tilcdc_disable_vblank,
        .gem_free_object    = drm_gem_cma_free_object,
index 1cb1e842e64dd7ef812bff631ed87bdeceb7673b..3dc56d3413b760e2580da8ccf7a6778309e72f43 100644 (file)
@@ -953,6 +953,7 @@ extern void drm_crtc_vblank_off(struct drm_crtc *crtc);
 extern void drm_crtc_vblank_reset(struct drm_crtc *crtc);
 extern void drm_crtc_vblank_on(struct drm_crtc *crtc);
 extern void drm_vblank_cleanup(struct drm_device *dev);
+extern u32 drm_vblank_no_hw_counter(struct drm_device *dev, unsigned int pipe);
 
 extern int drm_calc_vbltimestamp_from_scanoutpos(struct drm_device *dev,
                                                 unsigned int pipe, int *max_error,