From 237172b7670611b36d92be3b92983674846f6564 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Michel=20D=C3=A4nzer?= Date: Tue, 3 Jun 2008 11:28:10 +0200 Subject: vblank: Clean up compensation for spurious wraparounds of driver counter. Only compensate when the driver counter actually appears to have moved backwards. The compensation deltas need to be incremental instead of absolute; drop the vblank_offset field and just use atomic_sub(). --- linux-core/drmP.h | 5 ++--- 1 file changed, 2 insertions(+), 3 deletions(-) (limited to 'linux-core/drmP.h') diff --git a/linux-core/drmP.h b/linux-core/drmP.h index 69d31e14..d7b1960c 100644 --- a/linux-core/drmP.h +++ b/linux-core/drmP.h @@ -840,13 +840,12 @@ struct drm_device { atomic_t *vblank_refcount; /* number of users of vblank interrupts per crtc */ u32 *last_vblank; /* protected by dev->vbl_lock, used */ /* for wraparound handling */ - u32 *vblank_offset; /* used to track how many vblanks */ int *vblank_enabled; /* so we don't call enable more than once per disable */ - u32 *vblank_premodeset; /* were lost during modeset */ + u32 *vblank_premodeset; /* for compensation of spurious wraparounds */ struct timer_list vblank_disable_timer; - unsigned long max_vblank_count; /**< size of vblank counter register */ + u32 max_vblank_count; /**< size of vblank counter register */ spinlock_t tasklet_lock; /**< For drm_locked_tasklet */ void (*locked_tasklet_func)(struct drm_device *dev); -- cgit v1.2.3 From ba7263b8c2f8c14c647da725ecbc73fcd456d63c Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Michel=20D=C3=A4nzer?= Date: Tue, 3 Jun 2008 11:28:10 +0200 Subject: vblank: Don't wait or update the counter while the CRTC is supposedly disabled. Without kernel modesetting, this requires cooperation of the userspace modesetting driver. We may have to leave the vblank interrupt enabled otherwise to avoid problems. --- linux-core/drmP.h | 1 + 1 file changed, 1 insertion(+) (limited to 'linux-core/drmP.h') diff --git a/linux-core/drmP.h b/linux-core/drmP.h index d7b1960c..00db3000 100644 --- a/linux-core/drmP.h +++ b/linux-core/drmP.h @@ -843,6 +843,7 @@ struct drm_device { int *vblank_enabled; /* so we don't call enable more than once per disable */ u32 *vblank_premodeset; /* for compensation of spurious wraparounds */ + int *vblank_suspend; /* Don't wait while crtc is likely disabled */ struct timer_list vblank_disable_timer; u32 max_vblank_count; /**< size of vblank counter register */ -- cgit v1.2.3 From abdd523c759a5e19e733e3b544c2f1bcaa7a0b9a Mon Sep 17 00:00:00 2001 From: Dave Airlie Date: Tue, 15 Jul 2008 16:18:22 +1000 Subject: drm: add fix for PAT on radeon with 2.6.26 --- linux-core/drmP.h | 1 + 1 file changed, 1 insertion(+) (limited to 'linux-core/drmP.h') diff --git a/linux-core/drmP.h b/linux-core/drmP.h index 00db3000..331f3ac5 100644 --- a/linux-core/drmP.h +++ b/linux-core/drmP.h @@ -1255,6 +1255,7 @@ static inline struct drm_mm *drm_get_mm(struct drm_mm_node *block) } extern void drm_core_ioremap(struct drm_map *map, struct drm_device *dev); +extern void drm_core_ioremap_wc(struct drm_map *map, struct drm_device *dev); extern void drm_core_ioremapfree(struct drm_map *map, struct drm_device *dev); static __inline__ struct drm_map *drm_core_findmap(struct drm_device *dev, -- cgit v1.2.3 From 2204f926abe4da87a38955c4ecf9adb73b646666 Mon Sep 17 00:00:00 2001 From: Jesse Barnes Date: Thu, 17 Jul 2008 13:48:14 -0400 Subject: Avoid incorrect vblank wakeups The current code uses the hw vblank counter exclusively, which can lead to wakeups during the active period rather than during the vblank period if the hw counter counts displayed frames rather than vblank periods. This change coverts the code over to using the counter while interrupts are enabled, fixing that issue. It also includes a couple of related changes: one to not enable the new enable/disable behavior until the modeset ioctl is called (to preserve old client behavior) and another to account for lost events due to mode setting with the new counter scheme. BSD will require similar changes to its drm_irq.c code, but they should be straightforward. --- linux-core/drmP.h | 8 ++++++++ 1 file changed, 8 insertions(+) (limited to 'linux-core/drmP.h') diff --git a/linux-core/drmP.h b/linux-core/drmP.h index 331f3ac5..45a599b4 100644 --- a/linux-core/drmP.h +++ b/linux-core/drmP.h @@ -832,6 +832,14 @@ struct drm_device { /** \name VBLANK IRQ support */ /*@{ */ + /* + * 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. + */ + int vblank_disable_allowed; + wait_queue_head_t *vbl_queue; /**< VBLANK wait queue */ atomic_t *_vblank_count; /**< number of VBLANK interrupts (driver must alloc the right number of counters) */ spinlock_t vbl_lock; -- cgit v1.2.3 From 014935b680d12856a01c0b2fe6077a38d69d14d3 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Michel=20D=C3=A4nzer?= Date: Mon, 21 Jul 2008 08:13:45 +0200 Subject: Remove obsolete dev->vblank_suspend[crtc] tests. Caused drm_update_vblank_count() not to do its thing when called from drm_modeset_ctl() -> drm_vblank_get(). The vblank functionality no longer needs to be suspended during a modeset, so rename the field to vblank_inmodeset. --- linux-core/drmP.h | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'linux-core/drmP.h') diff --git a/linux-core/drmP.h b/linux-core/drmP.h index 45a599b4..37dd60f9 100644 --- a/linux-core/drmP.h +++ b/linux-core/drmP.h @@ -851,7 +851,7 @@ struct drm_device { int *vblank_enabled; /* so we don't call enable more than once per disable */ u32 *vblank_premodeset; /* for compensation of spurious wraparounds */ - int *vblank_suspend; /* Don't wait while crtc is likely disabled */ + int *vblank_inmodeset; /* Display driver is setting mode */ struct timer_list vblank_disable_timer; u32 max_vblank_count; /**< size of vblank counter register */ -- cgit v1.2.3 From 205aff6a5cc7b037f53b6bbcd3fa5b2d42f43f5b Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Michel=20D=C3=A4nzer?= Date: Mon, 21 Jul 2008 08:16:55 +0200 Subject: vblank-rework rework cleanups. Remove some dead/obsolete code and make drm_update_vblank_count() static. --- linux-core/drmP.h | 4 ---- 1 file changed, 4 deletions(-) (limited to 'linux-core/drmP.h') diff --git a/linux-core/drmP.h b/linux-core/drmP.h index 37dd60f9..6e4d6dda 100644 --- a/linux-core/drmP.h +++ b/linux-core/drmP.h @@ -848,9 +848,6 @@ struct drm_device { atomic_t *vblank_refcount; /* number of users of vblank interrupts per crtc */ u32 *last_vblank; /* protected by dev->vbl_lock, used */ /* for wraparound handling */ - int *vblank_enabled; /* so we don't call enable more than - once per disable */ - u32 *vblank_premodeset; /* for compensation of spurious wraparounds */ int *vblank_inmodeset; /* Display driver is setting mode */ struct timer_list vblank_disable_timer; @@ -1153,7 +1150,6 @@ extern int drm_wait_vblank(struct drm_device *dev, void *data, struct drm_file * extern int drm_vblank_wait(struct drm_device * dev, unsigned int *vbl_seq); extern void drm_locked_tasklet(struct drm_device *dev, void(*func)(struct drm_device*)); extern u32 drm_vblank_count(struct drm_device *dev, int crtc); -extern void drm_update_vblank_count(struct drm_device *dev, int crtc); extern void drm_handle_vblank(struct drm_device *dev, int crtc); extern int drm_vblank_get(struct drm_device *dev, int crtc); extern void drm_vblank_put(struct drm_device *dev, int crtc); -- cgit v1.2.3 From 4be367b84b5a6691c28d9419039ea8113ebabc92 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Michel=20D=C3=A4nzer?= Date: Mon, 21 Jul 2008 11:48:04 +0200 Subject: Reinstate dev->vblank_enabled[]. I incorrectly thought it was obsolete. --- linux-core/drmP.h | 2 ++ 1 file changed, 2 insertions(+) (limited to 'linux-core/drmP.h') diff --git a/linux-core/drmP.h b/linux-core/drmP.h index 6e4d6dda..19168cd7 100644 --- a/linux-core/drmP.h +++ b/linux-core/drmP.h @@ -848,6 +848,8 @@ struct drm_device { atomic_t *vblank_refcount; /* number of users of vblank interrupts per crtc */ u32 *last_vblank; /* protected by dev->vbl_lock, used */ /* for wraparound handling */ + int *vblank_enabled; /* so we don't call enable more than + once per disable */ int *vblank_inmodeset; /* Display driver is setting mode */ struct timer_list vblank_disable_timer; -- cgit v1.2.3