[PATCH 3/3] drm/irq: Make drm_vblank_pre/post_modeset internal

Daniel Vetter
2015-05-27T09:02:11Z

Now that all drivers are switched over to drm_vblank_on/off we can
relegate pre/post_modeset to the purely drm_irq.c internal role of
supporting on userspace.

As usual switch to the drm_legacy_ prefix to make it clear this is
for old drivers only.

Signed-off-by: Daniel Vetter <daniel.vetter@intel.com>
---
Documentation/DocBook/drm.tmpl | 2 --
drivers/gpu/drm/drm_irq.c | 41 ++++-------------------------------------
include/drm/drmP.h | 4 ----
3 files changed, 4 insertions(+), 43 deletions(-)

diff --git a/Documentation/DocBook/drm.tmpl b/Documentation/DocBook/drm.tmpl
index b6fc354a20e7..5eef6323dbb3 100644
--- a/Documentation/DocBook/drm.tmpl
+++ b/Documentation/DocBook/drm.tmpl
@@ -3803,8 +3803,6 @@ int num_ioctls;</synopsis>
drm_helper_connector_dpms() in reaction to fbdev blanking events. Do drivers
that don't implement (or just don't use) fbcon compatibility need to call
those functions themselves?
-- KMS drivers must call drm_vblank_pre_modeset() and drm_vblank_post_modeset()
- around mode setting. Should this be done in the DRM core?
- vblank_disable_allowed is set to 1 in the first drm_vblank_post_modeset()
call and never set back to 0. It seems to be safe to permanently set it to 1
in drm_vblank_init() for KMS driver, and it might be safe for UMS drivers as
diff --git a/drivers/gpu/drm/drm_irq.c b/drivers/gpu/drm/drm_irq.c
index 1967e7fc9805..038c8b3256da 100644
--- a/drivers/gpu/drm/drm_irq.c
+++ b/drivers/gpu/drm/drm_irq.c
@@ -1359,30 +1359,7 @@ void drm_crtc_vblank_on(struct drm_crtc *crtc)
}
EXPORT_SYMBOL(drm_crtc_vblank_on);

-/**
- * drm_vblank_pre_modeset - account for vblanks across mode sets
- * @dev: DRM device
- * @crtc: CRTC in question
- *
- * Account for vblank events across mode setting events, which will likely
- * reset the hardware frame counter.
- *
- * This is done by grabbing a temporary vblank reference to ensure that the
- * vblank interrupt keeps running across the modeset sequence. With this the
- * software-side vblank frame counting will ensure that there are no jumps or
- * discontinuities.
- *
- * Unfortunately this approach is racy and also doesn't work when the vblank
- * interrupt stops running, e.g. across system suspend resume. It is therefore
- * highly recommended that drivers use the newer drm_vblank_off() and
- * drm_vblank_on() instead. drm_vblank_pre_modeset() only works correctly when
- * using "cooked" software vblank frame counters and not relying on any hardware
- * counters.
- *
- * Drivers must call drm_vblank_post_modeset() when re-enabling the same crtc
- * again.
- */
-void drm_vblank_pre_modeset(struct drm_device *dev, int crtc)
+static void drm_legacy_vblank_pre_modeset(struct drm_device *dev, int crtc)
{
struct drm_vblank_crtc *vblank = &dev->vblank[crtc];

@@ -1406,17 +1383,8 @@ void drm_vblank_pre_modeset(struct drm_device *dev, int crtc)
vblank->inmodeset |= 0x2;
}
}
-EXPORT_SYMBOL(drm_vblank_pre_modeset);

-/**
- * drm_vblank_post_modeset - undo drm_vblank_pre_modeset changes
- * @dev: DRM device
- * @crtc: CRTC in question
- *
- * This function again drops the temporary vblank reference acquired in
- * drm_vblank_pre_modeset.
- */
-void drm_vblank_post_modeset(struct drm_device *dev, int crtc)
+static void drm_legacy_vblank_post_modeset(struct drm_device *dev, int crtc)
{
struct drm_vblank_crtc *vblank = &dev->vblank[crtc];
unsigned long irqflags;
@@ -1436,7 +1404,6 @@ void drm_vblank_post_modeset(struct drm_device *dev, int crtc)
vblank->inmodeset = 0;
}
}
-EXPORT_SYMBOL(drm_vblank_post_modeset);

/*
* drm_modeset_ctl - handle vblank event counter changes across mode switch
@@ -1469,10 +1436,10 @@ int drm_modeset_ctl(struct drm_device *dev, void *data,

switch (modeset->cmd) {
case _DRM_PRE_MODESET:
- drm_vblank_pre_modeset(dev, crtc);
+ drm_legacy_vblank_pre_modeset(dev, crtc);
break;
case _DRM_POST_MODESET:
- drm_vblank_post_modeset(dev, crtc);
+ drm_legacy_vblank_post_modeset(dev, crtc);
break;
default:
return -EINVAL;
diff --git a/include/drm/drmP.h b/include/drm/drmP.h
index df6d9970d9a4..bf22298559d1 100644
--- a/include/drm/drmP.h
+++ b/include/drm/drmP.h
@@ -962,10 +962,6 @@ static inline wait_queue_head_t *drm_crtc_vblank_waitqueue(struct drm_crtc *crtc
return &crtc->dev->vblank[drm_crtc_index(crtc)].queue;
}

-/* Modesetting support */
-extern void drm_vblank_pre_modeset(struct drm_device *dev, int crtc);
-extern void drm_vblank_post_modeset(struct drm_device *dev, int crtc);
-
/* Stub support (drm_stub.h) */
extern struct drm_master *drm_master_get(struct drm_master *master);
extern void drm_master_put(struct drm_master **master);
--
2.1.4