diff options
-rw-r--r-- | libdrm/xf86drm.c | 34 | ||||
-rw-r--r-- | libdrm/xf86mm.h | 4 | ||||
-rw-r--r-- | linux-core/drm_fence.c | 6 |
3 files changed, 39 insertions, 5 deletions
diff --git a/libdrm/xf86drm.c b/libdrm/xf86drm.c index 2df74d14..606f098b 100644 --- a/libdrm/xf86drm.c +++ b/libdrm/xf86drm.c @@ -2407,6 +2407,10 @@ int drmFenceWait(int fd, unsigned flags, drmFence *fence, unsigned flush_type) drm_fence_arg_t arg; int ret; + if (flush_type == 0) { + flush_type = fence->type; + } + if (!(fence->flags & DRM_FENCE_FLAG_SHAREABLE)) { if ((flush_type & fence->signaled) == flush_type) { return 0; @@ -2964,8 +2968,36 @@ int drmBOInfo(int fd, drmBO *buf) drmBOCopyReply(rep, buf); return 0; } + +int drmBOWaitIdle(int fd, drmBO *buf, unsigned hint) +{ + drm_bo_arg_t arg; + drm_bo_arg_request_t *req = &arg.d.req; + drm_bo_arg_reply_t *rep = &arg.d.rep; + int ret = 0; + + if ((buf->flags & DRM_BO_FLAG_SHAREABLE) || + (buf->replyFlags & DRM_BO_REP_BUSY)) { + arg.handled = 0; + req->handle = buf->handle; + req->op = drm_bo_wait_idle; + req->hint = hint; + arg.next = 0; + + ret = ioctl(fd, DRM_IOCTL_BUFOBJ, &arg); + + if (ret) + return ret; + if (!arg.handled) + return -EFAULT; + if (rep->ret) + return rep->ret; + drmBOCopyReply(rep, buf); + } + return 0; +} -int drmBufBusy(int fd, drmBO *buf, int *busy) +int drmBOBusy(int fd, drmBO *buf, int *busy) { if (!(buf->flags & DRM_BO_FLAG_SHAREABLE) && !(buf->replyFlags & DRM_BO_REP_BUSY)) { diff --git a/libdrm/xf86mm.h b/libdrm/xf86mm.h index 4cb37e23..a62aef47 100644 --- a/libdrm/xf86mm.h +++ b/libdrm/xf86mm.h @@ -202,7 +202,7 @@ extern int drmBOValidate(int fd, drmBO *buf, unsigned flags, unsigned mask, unsigned hint); extern int drmBOFence(int fd, drmBO *buf, unsigned flags, unsigned fenceHandle); extern int drmBOInfo(int fd, drmBO *buf); -extern int drmBufBusy(int fd, drmBO *buf, int *busy); +extern int drmBOBusy(int fd, drmBO *buf, int *busy); extern int drmAddValidateItem(drmBOList *list, drmBO *buf, unsigned flags, @@ -210,7 +210,7 @@ extern int drmAddValidateItem(drmBOList *list, drmBO *buf, unsigned flags, int *newItem); extern int drmBOValidateList(int fd, drmBOList *list); extern int drmBOFenceList(int fd, drmBOList *list, unsigned fenceHandle); - +extern int drmBOWaitIdle(int fd, drmBO *buf, unsigned hint); /* * Initialization functions. diff --git a/linux-core/drm_fence.c b/linux-core/drm_fence.c index 5d051d4a..41fe62a8 100644 --- a/linux-core/drm_fence.c +++ b/linux-core/drm_fence.c @@ -207,7 +207,8 @@ int drm_fence_object_flush(drm_device_t * dev, unsigned long flags; if (type & ~fence->type) { - DRM_ERROR("Flush trying to extend fence type\n"); + DRM_ERROR("Flush trying to extend fence type, " + "0x%x, 0x%x\n", type, fence->type); return -EINVAL; } @@ -269,7 +270,8 @@ int drm_fence_object_wait(drm_device_t * dev, drm_fence_object_t * fence, int signaled; if (mask & ~fence->type) { - DRM_ERROR("Wait trying to extend fence type\n"); + DRM_ERROR("Wait trying to extend fence type" + " 0x%08x 0x%08x\n", mask, fence->type); return -EINVAL; } |