summaryrefslogtreecommitdiff
path: root/libdrm
diff options
context:
space:
mode:
Diffstat (limited to 'libdrm')
-rw-r--r--libdrm/xf86drm.c26
-rw-r--r--libdrm/xf86mm.h1
2 files changed, 26 insertions, 1 deletions
diff --git a/libdrm/xf86drm.c b/libdrm/xf86drm.c
index 8cee4fbc..0849f896 100644
--- a/libdrm/xf86drm.c
+++ b/libdrm/xf86drm.c
@@ -2874,6 +2874,7 @@ int drmBOUnmap(int fd, drmBO *buf)
if (ioctl(fd, DRM_IOCTL_BO_UNMAP, &arg)) {
return -errno;
}
+ buf->mapCount--;
return 0;
}
@@ -2975,7 +2976,30 @@ int drmBOWaitIdle(int fd, drmBO *buf, unsigned hint)
}
return 0;
}
-
+
+int drmBOSetPin(int fd, drmBO *buf, int pin)
+{
+ struct drm_bo_set_pin_arg arg;
+ struct drm_bo_set_pin_req *req = &arg.d.req;
+ struct drm_bo_info_rep *rep = &arg.d.rep;
+ int ret = 0;
+
+ memset(&arg, 0, sizeof(arg));
+ req->handle = buf->handle;
+ req->pin = pin;
+
+ do {
+ ret = ioctl(fd, DRM_IOCTL_BO_SET_PIN, &arg);
+ } while (ret && errno == EAGAIN);
+
+ if (ret)
+ return -errno;
+
+ drmBOCopyReply(rep, buf);
+
+ return 0;
+}
+
int drmBOBusy(int fd, drmBO *buf, int *busy)
{
if (!(buf->flags & DRM_BO_FLAG_SHAREABLE) &&
diff --git a/libdrm/xf86mm.h b/libdrm/xf86mm.h
index d1e0b28f..d86644ca 100644
--- a/libdrm/xf86mm.h
+++ b/libdrm/xf86mm.h
@@ -201,6 +201,7 @@ extern int drmAddValidateItem(drmBOList *list, drmBO *buf, unsigned flags,
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);
+int drmBOSetPin(int fd, drmBO *buf, int pin);
/*
* Initialization functions.