Linux kernel mirror (for testing) git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
kernel os linux

drm: Nuke ->vblank_disable_allowed

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>

authored by

Daniel Vetter and committed by
Dave Airlie
fcee5906 fc7fedc2

-47
-1
drivers/gpu/drm/amd/amdgpu/amdgpu_irq.c
··· 219 219 if (r) { 220 220 return r; 221 221 } 222 - adev->ddev->vblank_disable_allowed = true; 223 222 224 223 /* enable msi */ 225 224 adev->irq.msi_enabled = false;
-1
drivers/gpu/drm/arm/hdlcd_drv.c
··· 379 379 DRM_ERROR("failed to initialise vblank\n"); 380 380 goto err_vblank; 381 381 } 382 - drm->vblank_disable_allowed = true; 383 382 384 383 drm_mode_config_reset(drm); 385 384 drm_kms_helper_poll_init(drm);
-1
drivers/gpu/drm/armada/armada_drv.c
··· 113 113 goto err_comp; 114 114 115 115 dev->irq_enabled = true; 116 - dev->vblank_disable_allowed = 1; 117 116 118 117 ret = armada_fbdev_init(dev); 119 118 if (ret)
-6
drivers/gpu/drm/drm_irq.c
··· 348 348 unsigned int pipe = vblank->pipe; 349 349 unsigned long irqflags; 350 350 351 - if (!dev->vblank_disable_allowed) 352 - return; 353 - 354 351 spin_lock_irqsave(&dev->vbl_lock, irqflags); 355 352 if (atomic_read(&vblank->refcount) == 0 && vblank->enabled) { 356 353 DRM_DEBUG("disabling vblank on crtc %u\n", pipe); ··· 433 436 DRM_INFO("Setting vblank_disable_immediate to false because " 434 437 "get_vblank_timestamp == NULL\n"); 435 438 } 436 - 437 - dev->vblank_disable_allowed = false; 438 439 439 440 return 0; 440 441 ··· 1580 1585 1581 1586 if (vblank->inmodeset) { 1582 1587 spin_lock_irqsave(&dev->vbl_lock, irqflags); 1583 - dev->vblank_disable_allowed = true; 1584 1588 drm_reset_vblank_timestamp(dev, pipe); 1585 1589 spin_unlock_irqrestore(&dev->vbl_lock, irqflags); 1586 1590
-7
drivers/gpu/drm/exynos/exynos_drm_drv.c
··· 212 212 */ 213 213 dev->irq_enabled = true; 214 214 215 - /* 216 - * with vblank_disable_allowed = true, vblank interrupt will be disabled 217 - * by drm timer once a current process gives up ownership of 218 - * vblank event.(after drm_vblank_put function is called) 219 - */ 220 - dev->vblank_disable_allowed = true; 221 - 222 215 /* init kms poll for handling hpd */ 223 216 drm_kms_helper_poll_init(dev); 224 217
-1
drivers/gpu/drm/fsl-dcu/fsl_dcu_drm_drv.c
··· 80 80 dev_err(dev->dev, "failed to initialize vblank\n"); 81 81 goto done; 82 82 } 83 - dev->vblank_disable_allowed = true; 84 83 85 84 ret = fsl_dcu_drm_irq_init(dev); 86 85 if (ret < 0)
-1
drivers/gpu/drm/gma500/psb_drv.c
··· 374 374 375 375 drm_irq_install(dev, dev->pdev->irq); 376 376 377 - dev->vblank_disable_allowed = true; 378 377 dev->max_vblank_count = 0xffffff; /* only 24 bits of frame count */ 379 378 dev->driver->get_vblank_counter = psb_get_vblank_counter; 380 379
-3
drivers/gpu/drm/i915/i915_dma.c
··· 476 476 477 477 intel_modeset_gem_init(dev); 478 478 479 - /* Always safe in the mode setting case. */ 480 - /* FIXME: do pre/post-mode set stuff in core KMS code */ 481 - dev->vblank_disable_allowed = true; 482 479 if (INTEL_INFO(dev)->num_pipes == 0) 483 480 return 0; 484 481
-7
drivers/gpu/drm/imx/imx-drm-core.c
··· 252 252 if (ret) 253 253 goto err_kms; 254 254 255 - /* 256 - * with vblank_disable_allowed = true, vblank interrupt will be 257 - * disabled by drm timer once a current process gives up ownership 258 - * of vblank event. (after drm_vblank_put function is called) 259 - */ 260 - drm->vblank_disable_allowed = true; 261 - 262 255 platform_set_drvdata(drm->platformdev, drm); 263 256 264 257 /* Now try and bind all our sub-components */
-1
drivers/gpu/drm/radeon/radeon_irq_kms.c
··· 291 291 if (r) { 292 292 return r; 293 293 } 294 - rdev->ddev->vblank_disable_allowed = true; 295 294 296 295 /* enable msi */ 297 296 rdev->msi_enabled = 0;
-7
drivers/gpu/drm/rockchip/rockchip_drm_drv.c
··· 216 216 if (ret) 217 217 goto err_kms_helper_poll_fini; 218 218 219 - /* 220 - * with vblank_disable_allowed = true, vblank interrupt will be disabled 221 - * by drm timer once a current process gives up ownership of 222 - * vblank event.(after drm_vblank_put function is called) 223 - */ 224 - drm_dev->vblank_disable_allowed = true; 225 - 226 219 drm_mode_config_reset(drm_dev); 227 220 228 221 ret = rockchip_drm_fbdev_init(drm_dev);
-1
drivers/gpu/drm/tegra/drm.c
··· 180 180 181 181 /* syncpoints are used for full 32-bit hardware VBLANK counters */ 182 182 drm->max_vblank_count = 0xffffffff; 183 - drm->vblank_disable_allowed = true; 184 183 185 184 err = drm_vblank_init(drm, drm->mode_config.num_crtc); 186 185 if (err < 0)
-2
drivers/gpu/drm/vc4/vc4_kms.c
··· 207 207 dev->mode_config.preferred_depth = 24; 208 208 dev->mode_config.async_page_flip = true; 209 209 210 - dev->vblank_disable_allowed = true; 211 - 212 210 drm_mode_config_reset(dev); 213 211 214 212 vc4->fbdev = drm_fbdev_cma_init(dev, 32,
-8
include/drm/drmP.h
··· 815 815 int irq; 816 816 817 817 /* 818 - * At load time, disabling the vblank interrupt won't be allowed since 819 - * old clients may not call the modeset ioctl and therefore misbehave. 820 - * Once the modeset ioctl *has* been called though, we can safely 821 - * disable them when unused. 822 - */ 823 - bool vblank_disable_allowed; 824 - 825 - /* 826 818 * If true, vblank interrupt will be disabled immediately when the 827 819 * refcount drops to zero, as opposed to via the vblank disable 828 820 * timer.