drm: Nuke ->vblank_disable_allowed
authorDaniel Vetter <daniel.vetter@ffwll.ch>
Wed, 18 May 2016 19:47:38 +0000 (21:47 +0200)
committerDave Airlie <airlied@redhat.com>
Fri, 20 May 2016 21:03:31 +0000 (07:03 +1000)
This was added in

commit 0a3e67a4caac273a3bfc4ced3da364830b1ab241
Author: Jesse Barnes <jbarnes@virtuousgeek.org>
Date:   Tue Sep 30 12:14:26 2008 -0700

    drm: Rework vblank-wait handling to allow interrupt reduction.

to stay backwards-compatible with old UMS code that didn't even tell
the kernel when it did a modeset, so that the kernel could
save/restore vblank counters. At worst this means vblanks will be
somewhat funky on a setup that very likely no one still runs.

So let's just nuke it.

Plan B would be to set it unconditionally in drm_vblank_init for kms
drivers, instead of in each driver separately. So if this patch breaks
anything please only restore the hunks in drmP.h and drm_irq.c, plus
add a check for DRIVER_MODESET in drm_vblank_init.

Stumbled over this in a discussion on irc with Chris.

Cc: Chris Wilson <chris@chris-wilson.co.uk>
Cc: Alex Deucher <alexander.deucher@amd.com>
Cc: Liviu Dudau <liviu.dudau@arm.com>
Cc: Russell King <rmk+kernel@arm.linux.org.uk>
Cc: Thierry Reding <thierry.reding@gmail.com>
Cc: Eric Anholt <eric@anholt.net>
Cc: Laurent Pinchart <laurent.pinchart+renesas@ideasonboard.com>
Cc: Inki Dae <inki.dae@samsung.com>
Cc: Tomi Valkeinen <tomi.valkeinen@ti.com>
Cc: Mark Yao <mark.yao@rock-chips.com>
Cc: Sascha Hauer <s.hauer@pengutronix.de>
Cc: Philipp Zabel <p.zabel@pengutronix.de>
Signed-off-by: Daniel Vetter <daniel.vetter@intel.com>
Reviewed-by: Alex Deucher <alexander.deucher@amd.com>
Acked-by: Liviu Dudau <Liviu.Dudau@arm.com>
Acked-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com>
Tested-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com>
Signed-off-by: Dave Airlie <airlied@redhat.com>
14 files changed:
drivers/gpu/drm/amd/amdgpu/amdgpu_irq.c
drivers/gpu/drm/arm/hdlcd_drv.c
drivers/gpu/drm/armada/armada_drv.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/gma500/psb_drv.c
drivers/gpu/drm/i915/i915_dma.c
drivers/gpu/drm/imx/imx-drm-core.c
drivers/gpu/drm/radeon/radeon_irq_kms.c
drivers/gpu/drm/rockchip/rockchip_drm_drv.c
drivers/gpu/drm/tegra/drm.c
drivers/gpu/drm/vc4/vc4_kms.c
include/drm/drmP.h

index 9266c7b6980852be51e879c24402e2548e4d2dff..835a3fa8d8dfde320d73ba3af8f8fa306bd758e1 100644 (file)
@@ -219,7 +219,6 @@ int amdgpu_irq_init(struct amdgpu_device *adev)
        if (r) {
                return r;
        }
-       adev->ddev->vblank_disable_allowed = true;
 
        /* enable msi */
        adev->irq.msi_enabled = false;
index 734899c4e4bb60e9c9bca90654d9189fe0ee65ac..b987c63ba8d6a63612f7d14ab56ad5e82c15b05a 100644 (file)
@@ -379,7 +379,6 @@ static int hdlcd_drm_bind(struct device *dev)
                DRM_ERROR("failed to initialise vblank\n");
                goto err_vblank;
        }
-       drm->vblank_disable_allowed = true;
 
        drm_mode_config_reset(drm);
        drm_kms_helper_poll_init(drm);
index 82043c204b76be3f105d6c57eac7ec2979d16ef3..439824a61aa5276e465975a8ae79e8ab6da7c552 100644 (file)
@@ -113,7 +113,6 @@ static int armada_drm_load(struct drm_device *dev, unsigned long flags)
                goto err_comp;
 
        dev->irq_enabled = true;
-       dev->vblank_disable_allowed = 1;
 
        ret = armada_fbdev_init(dev);
        if (ret)
index 3c1a6f18e71c2b8972b5092c0f1087ed8fbe96af..0fac801c18fe941f7114ed141a336e92f90108c2 100644 (file)
@@ -348,9 +348,6 @@ static void vblank_disable_fn(unsigned long arg)
        unsigned int pipe = vblank->pipe;
        unsigned long irqflags;
 
-       if (!dev->vblank_disable_allowed)
-               return;
-
        spin_lock_irqsave(&dev->vbl_lock, irqflags);
        if (atomic_read(&vblank->refcount) == 0 && vblank->enabled) {
                DRM_DEBUG("disabling vblank on crtc %u\n", pipe);
@@ -437,8 +434,6 @@ int drm_vblank_init(struct drm_device *dev, unsigned int num_crtcs)
                         "get_vblank_timestamp == NULL\n");
        }
 
-       dev->vblank_disable_allowed = false;
-
        return 0;
 
 err:
@@ -1585,7 +1580,6 @@ void drm_vblank_post_modeset(struct drm_device *dev, unsigned int pipe)
 
        if (vblank->inmodeset) {
                spin_lock_irqsave(&dev->vbl_lock, irqflags);
-               dev->vblank_disable_allowed = true;
                drm_reset_vblank_timestamp(dev, pipe);
                spin_unlock_irqrestore(&dev->vbl_lock, irqflags);
 
index 21c719e8e02b7c43792a881327499b71fa0fdc26..2dd820e23b0cb43b45f047798d2e5e69b141b4a1 100644 (file)
@@ -212,13 +212,6 @@ static int exynos_drm_load(struct drm_device *dev, unsigned long flags)
         */
        dev->irq_enabled = true;
 
-       /*
-        * with vblank_disable_allowed = true, vblank interrupt will be disabled
-        * by drm timer once a current process gives up ownership of
-        * vblank event.(after drm_vblank_put function is called)
-        */
-       dev->vblank_disable_allowed = true;
-
        /* init kms poll for handling hpd */
        drm_kms_helper_poll_init(dev);
 
index 44f6f262d75a8cdded7bfe745d5630e620f7c467..0ec1ad961e0dbee6bf50de70cf05f23592241f51 100644 (file)
@@ -80,7 +80,6 @@ static int fsl_dcu_load(struct drm_device *dev, unsigned long flags)
                dev_err(dev->dev, "failed to initialize vblank\n");
                goto done;
        }
-       dev->vblank_disable_allowed = true;
 
        ret = fsl_dcu_drm_irq_init(dev);
        if (ret < 0)
index 4e1c6850520ee50bd024fb3da610a0f5ab8c754d..82b8ce418b276bae50b94c75f1b2b8f40af6b417 100644 (file)
@@ -374,7 +374,6 @@ static int psb_driver_load(struct drm_device *dev, unsigned long flags)
 
        drm_irq_install(dev, dev->pdev->irq);
 
-       dev->vblank_disable_allowed = true;
        dev->max_vblank_count = 0xffffff; /* only 24 bits of frame count */
        dev->driver->get_vblank_counter = psb_get_vblank_counter;
 
index 5c7615041b31b9e60c72549f3dda994a0f6474d4..15615fb9bde6a8bc5b2320da5a0b4d5bf5186542 100644 (file)
@@ -476,9 +476,6 @@ static int i915_load_modeset_init(struct drm_device *dev)
 
        intel_modeset_gem_init(dev);
 
-       /* Always safe in the mode setting case. */
-       /* FIXME: do pre/post-mode set stuff in core KMS code */
-       dev->vblank_disable_allowed = true;
        if (INTEL_INFO(dev)->num_pipes == 0)
                return 0;
 
index 2453fb1c68a79b1cded35538c57d1d347b9687f5..1080019e7b17ad8062d188060effcc901454227d 100644 (file)
@@ -252,13 +252,6 @@ static int imx_drm_driver_load(struct drm_device *drm, unsigned long flags)
        if (ret)
                goto err_kms;
 
-       /*
-        * with vblank_disable_allowed = true, vblank interrupt will be
-        * disabled by drm timer once a current process gives up ownership
-        * of vblank event. (after drm_vblank_put function is called)
-        */
-       drm->vblank_disable_allowed = true;
-
        platform_set_drvdata(drm->platformdev, drm);
 
        /* Now try and bind all our sub-components */
index 1e9304d1c88fd4e844ee9c5bd36300ed992e0f29..c084cadcbf2156f8f51b05d21b5ae79407bc6853 100644 (file)
@@ -291,7 +291,6 @@ int radeon_irq_kms_init(struct radeon_device *rdev)
        if (r) {
                return r;
        }
-       rdev->ddev->vblank_disable_allowed = true;
 
        /* enable msi */
        rdev->msi_enabled = 0;
index 399adf3c4224dd7fa75bdb56b0f9a62af9c853ee..a409d1f703cb2b0dd7ab3767244872c44b9076e8 100644 (file)
@@ -216,13 +216,6 @@ static int rockchip_drm_load(struct drm_device *drm_dev, unsigned long flags)
        if (ret)
                goto err_kms_helper_poll_fini;
 
-       /*
-        * with vblank_disable_allowed = true, vblank interrupt will be disabled
-        * by drm timer once a current process gives up ownership of
-        * vblank event.(after drm_vblank_put function is called)
-        */
-       drm_dev->vblank_disable_allowed = true;
-
        drm_mode_config_reset(drm_dev);
 
        ret = rockchip_drm_fbdev_init(drm_dev);
index 67990554418142c070c7be72e1cdd9e240ab6710..b59c3bf0df4443420a236f032d8af0c6345482d6 100644 (file)
@@ -180,7 +180,6 @@ static int tegra_drm_load(struct drm_device *drm, unsigned long flags)
 
        /* syncpoints are used for full 32-bit hardware VBLANK counters */
        drm->max_vblank_count = 0xffffffff;
-       drm->vblank_disable_allowed = true;
 
        err = drm_vblank_init(drm, drm->mode_config.num_crtc);
        if (err < 0)
index d423ba10239aa0835991ec7fbefca0b01e3598b4..cb37751bc99fcfe8976ced75f16ce4bd332c2406 100644 (file)
@@ -207,8 +207,6 @@ int vc4_kms_load(struct drm_device *dev)
        dev->mode_config.preferred_depth = 24;
        dev->mode_config.async_page_flip = true;
 
-       dev->vblank_disable_allowed = true;
-
        drm_mode_config_reset(dev);
 
        vc4->fbdev = drm_fbdev_cma_init(dev, 32,
index 360b2a74e1ef8a49648ed5ae38124e20a03b6d3c..84f1a8eefbdbc8ae89925aff3dafaaccdf99b4b4 100644 (file)
@@ -814,14 +814,6 @@ struct drm_device {
        bool irq_enabled;
        int irq;
 
-       /*
-        * At load time, disabling the vblank interrupt won't be allowed since
-        * old clients may not call the modeset ioctl and therefore misbehave.
-        * Once the modeset ioctl *has* been called though, we can safely
-        * disable them when unused.
-        */
-       bool vblank_disable_allowed;
-
        /*
         * If true, vblank interrupt will be disabled immediately when the
         * refcount drops to zero, as opposed to via the vblank disable