diff options
| author | Ville Syrjälä <ville.syrjala@linux.intel.com> | 2014-08-06 07:49:53 -0400 |
|---|---|---|
| committer | Daniel Vetter <daniel.vetter@ffwll.ch> | 2014-08-06 16:39:28 -0400 |
| commit | 4ed0ce3d0bccd74416ba6beb33a8a79d1617e97b (patch) | |
| tree | d8898f1d518a7141d425cccae24a23b719a2df43 | |
| parent | ffe7c73a8d4f0caeebd5d220ddbf7126a4daca1f (diff) | |
drm: Disable vblank interrupt immediately when drm_vblank_offdelay<0
Make drm_vblank_put() disable the vblank interrupt immediately when the
refcount drops to zero and drm_vblank_offdelay<0.
v2: Preserve the current drm_vblank_offdelay==0 'never disable' behaviur
Reviewed-by: Matt Roper <matthew.d.roper@intel.com>
Signed-off-by: Ville Syrjälä <ville.syrjala@linux.intel.com>
Signed-off-by: Daniel Vetter <daniel.vetter@ffwll.ch>
| -rw-r--r-- | Documentation/DocBook/drm.tmpl | 1 | ||||
| -rw-r--r-- | drivers/gpu/drm/drm_drv.c | 4 | ||||
| -rw-r--r-- | drivers/gpu/drm/drm_irq.c | 11 | ||||
| -rw-r--r-- | include/drm/drmP.h | 2 |
4 files changed, 11 insertions, 7 deletions
diff --git a/Documentation/DocBook/drm.tmpl b/Documentation/DocBook/drm.tmpl index 1d3756d3176c..55923d00bd52 100644 --- a/Documentation/DocBook/drm.tmpl +++ b/Documentation/DocBook/drm.tmpl | |||
| @@ -3386,6 +3386,7 @@ void (*disable_vblank) (struct drm_device *dev, int crtc);</synopsis> | |||
| 3386 | by scheduling a timer. The delay is accessible through the vblankoffdelay | 3386 | by scheduling a timer. The delay is accessible through the vblankoffdelay |
| 3387 | module parameter or the <varname>drm_vblank_offdelay</varname> global | 3387 | module parameter or the <varname>drm_vblank_offdelay</varname> global |
| 3388 | variable and expressed in milliseconds. Its default value is 5000 ms. | 3388 | variable and expressed in milliseconds. Its default value is 5000 ms. |
| 3389 | Zero means never disable, and a negative value means disable immediately. | ||
| 3389 | </para> | 3390 | </para> |
| 3390 | <para> | 3391 | <para> |
| 3391 | When a vertical blanking interrupt occurs drivers only need to call the | 3392 | When a vertical blanking interrupt occurs drivers only need to call the |
diff --git a/drivers/gpu/drm/drm_drv.c b/drivers/gpu/drm/drm_drv.c index 92bc6b1d9646..db03e16ca817 100644 --- a/drivers/gpu/drm/drm_drv.c +++ b/drivers/gpu/drm/drm_drv.c | |||
| @@ -39,7 +39,7 @@ | |||
| 39 | unsigned int drm_debug = 0; /* 1 to enable debug output */ | 39 | unsigned int drm_debug = 0; /* 1 to enable debug output */ |
| 40 | EXPORT_SYMBOL(drm_debug); | 40 | EXPORT_SYMBOL(drm_debug); |
| 41 | 41 | ||
| 42 | unsigned int drm_vblank_offdelay = 5000; /* Default to 5000 msecs. */ | 42 | int drm_vblank_offdelay = 5000; /* Default to 5000 msecs. */ |
| 43 | 43 | ||
| 44 | unsigned int drm_timestamp_precision = 20; /* Default to 20 usecs. */ | 44 | unsigned int drm_timestamp_precision = 20; /* Default to 20 usecs. */ |
| 45 | 45 | ||
| @@ -53,7 +53,7 @@ MODULE_AUTHOR(CORE_AUTHOR); | |||
| 53 | MODULE_DESCRIPTION(CORE_DESC); | 53 | MODULE_DESCRIPTION(CORE_DESC); |
| 54 | MODULE_LICENSE("GPL and additional rights"); | 54 | MODULE_LICENSE("GPL and additional rights"); |
| 55 | MODULE_PARM_DESC(debug, "Enable debug output"); | 55 | MODULE_PARM_DESC(debug, "Enable debug output"); |
| 56 | MODULE_PARM_DESC(vblankoffdelay, "Delay until vblank irq auto-disable [msecs]"); | 56 | MODULE_PARM_DESC(vblankoffdelay, "Delay until vblank irq auto-disable [msecs] (0: never disable, <0: disable immediately)"); |
| 57 | MODULE_PARM_DESC(timestamp_precision_usec, "Max. error on timestamps [usecs]"); | 57 | MODULE_PARM_DESC(timestamp_precision_usec, "Max. error on timestamps [usecs]"); |
| 58 | MODULE_PARM_DESC(timestamp_monotonic, "Use monotonic timestamps"); | 58 | MODULE_PARM_DESC(timestamp_monotonic, "Use monotonic timestamps"); |
| 59 | 59 | ||
diff --git a/drivers/gpu/drm/drm_irq.c b/drivers/gpu/drm/drm_irq.c index b2428cb0c64d..99145c4d536b 100644 --- a/drivers/gpu/drm/drm_irq.c +++ b/drivers/gpu/drm/drm_irq.c | |||
| @@ -993,10 +993,13 @@ void drm_vblank_put(struct drm_device *dev, int crtc) | |||
| 993 | BUG_ON(atomic_read(&vblank->refcount) == 0); | 993 | BUG_ON(atomic_read(&vblank->refcount) == 0); |
| 994 | 994 | ||
| 995 | /* Last user schedules interrupt disable */ | 995 | /* Last user schedules interrupt disable */ |
| 996 | if (atomic_dec_and_test(&vblank->refcount) && | 996 | if (atomic_dec_and_test(&vblank->refcount)) { |
| 997 | (drm_vblank_offdelay > 0)) | 997 | if (drm_vblank_offdelay < 0) |
| 998 | mod_timer(&vblank->disable_timer, | 998 | vblank_disable_fn((unsigned long)vblank); |
| 999 | jiffies + ((drm_vblank_offdelay * HZ)/1000)); | 999 | else if (drm_vblank_offdelay > 0) |
| 1000 | mod_timer(&vblank->disable_timer, | ||
| 1001 | jiffies + ((drm_vblank_offdelay * HZ)/1000)); | ||
| 1002 | } | ||
| 1000 | } | 1003 | } |
| 1001 | EXPORT_SYMBOL(drm_vblank_put); | 1004 | EXPORT_SYMBOL(drm_vblank_put); |
| 1002 | 1005 | ||
diff --git a/include/drm/drmP.h b/include/drm/drmP.h index a57646382086..24b32d453c60 100644 --- a/include/drm/drmP.h +++ b/include/drm/drmP.h | |||
| @@ -1345,7 +1345,7 @@ extern void drm_put_dev(struct drm_device *dev); | |||
| 1345 | extern void drm_unplug_dev(struct drm_device *dev); | 1345 | extern void drm_unplug_dev(struct drm_device *dev); |
| 1346 | extern unsigned int drm_debug; | 1346 | extern unsigned int drm_debug; |
| 1347 | 1347 | ||
| 1348 | extern unsigned int drm_vblank_offdelay; | 1348 | extern int drm_vblank_offdelay; |
| 1349 | extern unsigned int drm_timestamp_precision; | 1349 | extern unsigned int drm_timestamp_precision; |
| 1350 | extern unsigned int drm_timestamp_monotonic; | 1350 | extern unsigned int drm_timestamp_monotonic; |
| 1351 | 1351 | ||
