summaryrefslogtreecommitdiff
path: root/libdrm
diff options
context:
space:
mode:
authorThomas Hellstrom <thomas-at-tungstengraphics-dot-com>2006-09-18 16:02:33 +0200
committerThomas Hellstrom <thomas-at-tungstengraphics-dot-com>2006-09-18 16:02:33 +0200
commitc4fad4c96168a3dfabaa8a7e97758fefd014c8a7 (patch)
treefc99929797b17fb75d510b73d1edbfcd7abf255e /libdrm
parentf613022ceef1814cb734bb3375f01962fd3bcf10 (diff)
More verbose error reporting in some cases.
Add a buffer object waitIdle user-space function. Fix some names and minor glitches.
Diffstat (limited to 'libdrm')
-rw-r--r--libdrm/xf86drm.c34
-rw-r--r--libdrm/xf86mm.h4
2 files changed, 35 insertions, 3 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.