mirror of
https://github.com/tiagovignatti/intel-gpu-tools.git
synced 2025-06-21 23:06:29 +00:00
lib: Implement gem_sync() using WAIT
When synchronising to rendering, we only want to wait for it to complete and avoid the cache-domain side-effects of SET_DOMAIN if possible. This has the advantage of speeding up a few tests (and thereby making the actual test more explicit in terms of kernel operations). Of course some tests may be reliant on the side-effects... Signed-off-by: Chris Wilson <chris@chris-wilson.co.uk> Reviewed-by: Daniel Vetter <daniel.vetter@ffwll.ch>
This commit is contained in:
parent
9fd6e07369
commit
41fe1d1a44
@ -371,12 +371,22 @@ void gem_set_domain(int fd, uint32_t handle,
|
|||||||
* @fd: open i915 drm file descriptor
|
* @fd: open i915 drm file descriptor
|
||||||
* @handle: gem buffer object handle
|
* @handle: gem buffer object handle
|
||||||
*
|
*
|
||||||
* This is a wrapper around gem_set_domain() which simply blocks for any
|
* This functions waits for outstanding rendering to complete.
|
||||||
* outstanding rendering to complete.
|
|
||||||
*/
|
*/
|
||||||
void gem_sync(int fd, uint32_t handle)
|
void gem_sync(int fd, uint32_t handle)
|
||||||
{
|
{
|
||||||
gem_set_domain(fd, handle, I915_GEM_DOMAIN_GTT, I915_GEM_DOMAIN_GTT);
|
struct drm_i915_gem_wait wait;
|
||||||
|
|
||||||
|
memset(&wait, 0, sizeof(wait));
|
||||||
|
wait.bo_handle = handle;
|
||||||
|
wait.timeout_ns =-1;
|
||||||
|
if (drmIoctl(fd, DRM_IOCTL_I915_GEM_WAIT, &wait) == 0) {
|
||||||
|
errno = 0;
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
gem_set_domain(fd, handle,
|
||||||
|
I915_GEM_DOMAIN_GTT, I915_GEM_DOMAIN_GTT);
|
||||||
}
|
}
|
||||||
|
|
||||||
uint32_t __gem_create(int fd, int size)
|
uint32_t __gem_create(int fd, int size)
|
||||||
|
Loading…
x
Reference in New Issue
Block a user