summaryrefslogtreecommitdiff
path: root/libdrm/xf86drm.c
diff options
context:
space:
mode:
Diffstat (limited to 'libdrm/xf86drm.c')
-rw-r--r--libdrm/xf86drm.c38
1 files changed, 24 insertions, 14 deletions
diff --git a/libdrm/xf86drm.c b/libdrm/xf86drm.c
index e3550de7..3317ba5c 100644
--- a/libdrm/xf86drm.c
+++ b/libdrm/xf86drm.c
@@ -2799,23 +2799,18 @@ int drmBOWaitIdle(int fd, drmBO *buf, unsigned hint)
}
return 0;
}
-
+
int drmBOBusy(int fd, drmBO *buf, int *busy)
{
- if (!(buf->flags & DRM_BO_FLAG_SHAREABLE) &&
- !(buf->replyFlags & DRM_BO_REP_BUSY)) {
- *busy = 0;
- return 0;
- }
- else {
- int ret = drmBOInfo(fd, buf);
- if (ret)
- return ret;
- *busy = (buf->replyFlags & DRM_BO_REP_BUSY);
- return 0;
- }
+ int ret = drmBOInfo(fd, buf);
+
+ if (ret)
+ return ret;
+
+ *busy = (buf->replyFlags & DRM_BO_REP_BUSY);
+ return 0;
}
-
+
int drmMMInit(int fd, unsigned long pOffset, unsigned long pSize,
unsigned memType)
{
@@ -2876,6 +2871,21 @@ int drmMMUnlock(int fd, unsigned memType, int unlockBM)
return drmIoctlTimeout(fd, DRM_IOCTL_MM_UNLOCK, &arg);
}
+int drmMMInfo(int fd, unsigned memType, uint64_t *size)
+{
+ struct drm_mm_info_arg arg;
+
+ memset(&arg, 0, sizeof(arg));
+
+ arg.mem_type = memType;
+
+ if (ioctl(fd, DRM_IOCTL_MM_INFO, &arg))
+ return -errno;
+
+ *size = arg.p_size;
+ return 0;
+}
+
int drmBOVersion(int fd, unsigned int *major,
unsigned int *minor,
unsigned int *patchlevel)