diff options
author | Ben Widawsky <ben@bwidawsk.net> | 2012-05-24 18:03:10 -0400 |
---|---|---|
committer | Daniel Vetter <daniel.vetter@ffwll.ch> | 2012-05-25 08:15:46 -0400 |
commit | 23ba4fd0a42a46551041e379712e808ad496ba45 (patch) | |
tree | 53804484779f44977f60310ab8dec52c9289459e /include/drm | |
parent | f3fd37683cc406ffaccf097de0433130c85c8651 (diff) |
drm/i915: wait render timeout ioctl
This helps implement GL_ARB_sync but stops short of allowing full blown
sync objects. Finally we can use the new timed seqno waiting function
to allow userspace to wait on a buffer object with a timeout. This
implements that interface.
The IOCTL will take as input a buffer object handle, and a timeout in
nanoseconds (flags is currently optional but will likely be used for
permutations of flush operations). Users may specify 0 nanoseconds to
instantly check.
The wait ioctl with a timeout of 0 reimplements the busy ioctl. With any
non-zero timeout parameter the wait ioctl will wait for the given number
of nanoseconds on an object becoming unbusy. Since the wait itself does
so holding struct_mutex the object may become re-busied before this
completes. A similar but shorter race condition exists in the busy
ioctl.
v2: ETIME/ERESTARTSYS instead of changing to EBUSY, and EGAIN (Chris)
Flush the object from the gpu write domain (Chris + Daniel)
Fix leaked refcount in good case (Chris)
Naturally align ioctl struct (Chris)
v3: Drop lock after getting seqno to avoid ugly dance (Chris)
v4: check for 0 timeout after olr check to allow polling (Chris)
v5: Updated the comment. (Chris)
v6: Return -ETIME instead of -EBUSY when timeout_ns is 0 (Daniel)
Fix the commit message comment to be less ugly (Ben)
Add a warning to check the return timespec (Ben)
v7: Use DRM_AUTH for the ioctl. (Eugeni)
Signed-off-by: Ben Widawsky <ben@bwidawsk.net>
Signed-off-by: Daniel Vetter <daniel.vetter@ffwll.ch>
Diffstat (limited to 'include/drm')
-rw-r--r-- | include/drm/i915_drm.h | 10 |
1 files changed, 10 insertions, 0 deletions
diff --git a/include/drm/i915_drm.h b/include/drm/i915_drm.h index f3f82242bf1d..bab174334da5 100644 --- a/include/drm/i915_drm.h +++ b/include/drm/i915_drm.h | |||
@@ -200,6 +200,7 @@ typedef struct _drm_i915_sarea { | |||
200 | #define DRM_I915_GEM_EXECBUFFER2 0x29 | 200 | #define DRM_I915_GEM_EXECBUFFER2 0x29 |
201 | #define DRM_I915_GET_SPRITE_COLORKEY 0x2a | 201 | #define DRM_I915_GET_SPRITE_COLORKEY 0x2a |
202 | #define DRM_I915_SET_SPRITE_COLORKEY 0x2b | 202 | #define DRM_I915_SET_SPRITE_COLORKEY 0x2b |
203 | #define DRM_I915_GEM_WAIT 0x2c | ||
203 | 204 | ||
204 | #define DRM_IOCTL_I915_INIT DRM_IOW( DRM_COMMAND_BASE + DRM_I915_INIT, drm_i915_init_t) | 205 | #define DRM_IOCTL_I915_INIT DRM_IOW( DRM_COMMAND_BASE + DRM_I915_INIT, drm_i915_init_t) |
205 | #define DRM_IOCTL_I915_FLUSH DRM_IO ( DRM_COMMAND_BASE + DRM_I915_FLUSH) | 206 | #define DRM_IOCTL_I915_FLUSH DRM_IO ( DRM_COMMAND_BASE + DRM_I915_FLUSH) |
@@ -243,6 +244,7 @@ typedef struct _drm_i915_sarea { | |||
243 | #define DRM_IOCTL_I915_OVERLAY_ATTRS DRM_IOWR(DRM_COMMAND_BASE + DRM_I915_OVERLAY_ATTRS, struct drm_intel_overlay_attrs) | 244 | #define DRM_IOCTL_I915_OVERLAY_ATTRS DRM_IOWR(DRM_COMMAND_BASE + DRM_I915_OVERLAY_ATTRS, struct drm_intel_overlay_attrs) |
244 | #define DRM_IOCTL_I915_SET_SPRITE_COLORKEY DRM_IOWR(DRM_COMMAND_BASE + DRM_I915_SET_SPRITE_COLORKEY, struct drm_intel_sprite_colorkey) | 245 | #define DRM_IOCTL_I915_SET_SPRITE_COLORKEY DRM_IOWR(DRM_COMMAND_BASE + DRM_I915_SET_SPRITE_COLORKEY, struct drm_intel_sprite_colorkey) |
245 | #define DRM_IOCTL_I915_GET_SPRITE_COLORKEY DRM_IOWR(DRM_COMMAND_BASE + DRM_I915_SET_SPRITE_COLORKEY, struct drm_intel_sprite_colorkey) | 246 | #define DRM_IOCTL_I915_GET_SPRITE_COLORKEY DRM_IOWR(DRM_COMMAND_BASE + DRM_I915_SET_SPRITE_COLORKEY, struct drm_intel_sprite_colorkey) |
247 | #define DRM_IOCTL_I915_GEM_WAIT DRM_IOWR(DRM_COMMAND_BASE + DRM_I915_GEM_WAIT, struct drm_i915_gem_wait) | ||
246 | 248 | ||
247 | /* Allow drivers to submit batchbuffers directly to hardware, relying | 249 | /* Allow drivers to submit batchbuffers directly to hardware, relying |
248 | * on the security mechanisms provided by hardware. | 250 | * on the security mechanisms provided by hardware. |
@@ -886,4 +888,12 @@ struct drm_intel_sprite_colorkey { | |||
886 | __u32 flags; | 888 | __u32 flags; |
887 | }; | 889 | }; |
888 | 890 | ||
891 | struct drm_i915_gem_wait { | ||
892 | /** Handle of BO we shall wait on */ | ||
893 | __u32 bo_handle; | ||
894 | __u32 flags; | ||
895 | /** Number of nanoseconds to wait, Returns time remaining. */ | ||
896 | __u64 timeout_ns; | ||
897 | }; | ||
898 | |||
889 | #endif /* _I915_DRM_H_ */ | 899 | #endif /* _I915_DRM_H_ */ |