Skip to content

Commit 65defc4

Browse files
committed
drm/vblank: add return value to drm_crtc_wait_one_vblank()
Let drivers deal with the vblank wait failures if they so desire. If the current warning backtrace gets toned down to a simple warning message, the drivers may wish to add the backtrace themselves. Reviewed-by: Thomas Zimmermann <tzimmermann@suse.de> Link: https://patch.msgid.link/7f2de4dd170771991756073f037c7ca043c3e746.1765290097.git.jani.nikula@intel.com Signed-off-by: Jani Nikula <jani.nikula@intel.com>
1 parent 04f0aa5 commit 65defc4

2 files changed

Lines changed: 7 additions & 3 deletions

File tree

drivers/gpu/drm/drm_vblank.c

Lines changed: 6 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1293,8 +1293,10 @@ EXPORT_SYMBOL(drm_crtc_vblank_put);
12931293
* This waits for one vblank to pass on @crtc, using the irq driver interfaces.
12941294
* It is a failure to call this when the vblank irq for @crtc is disabled, e.g.
12951295
* due to lack of driver support or because the crtc is off.
1296+
*
1297+
* Returns: 0 on success, negative error on failures.
12961298
*/
1297-
void drm_crtc_wait_one_vblank(struct drm_crtc *crtc)
1299+
int drm_crtc_wait_one_vblank(struct drm_crtc *crtc)
12981300
{
12991301
struct drm_device *dev = crtc->dev;
13001302
int pipe = drm_crtc_index(crtc);
@@ -1305,7 +1307,7 @@ void drm_crtc_wait_one_vblank(struct drm_crtc *crtc)
13051307
ret = drm_vblank_get(dev, pipe);
13061308
if (drm_WARN(dev, ret, "vblank not available on crtc %i, ret=%i\n",
13071309
pipe, ret))
1308-
return;
1310+
return ret;
13091311

13101312
last = drm_vblank_count(dev, pipe);
13111313

@@ -1316,6 +1318,8 @@ void drm_crtc_wait_one_vblank(struct drm_crtc *crtc)
13161318
drm_WARN(dev, ret == 0, "vblank wait timed out on crtc %i\n", pipe);
13171319

13181320
drm_vblank_put(dev, pipe);
1321+
1322+
return ret ? 0 : -ETIMEDOUT;
13191323
}
13201324
EXPORT_SYMBOL(drm_crtc_wait_one_vblank);
13211325

include/drm/drm_vblank.h

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -302,7 +302,7 @@ bool drm_handle_vblank(struct drm_device *dev, unsigned int pipe);
302302
bool drm_crtc_handle_vblank(struct drm_crtc *crtc);
303303
int drm_crtc_vblank_get(struct drm_crtc *crtc);
304304
void drm_crtc_vblank_put(struct drm_crtc *crtc);
305-
void drm_crtc_wait_one_vblank(struct drm_crtc *crtc);
305+
int drm_crtc_wait_one_vblank(struct drm_crtc *crtc);
306306
void drm_crtc_vblank_off(struct drm_crtc *crtc);
307307
void drm_crtc_vblank_reset(struct drm_crtc *crtc);
308308
void drm_crtc_vblank_on_config(struct drm_crtc *crtc,

0 commit comments

Comments
 (0)