summaryrefslogtreecommitdiff
path: root/libdrm
diff options
context:
space:
mode:
authorEric Anholt <eric@anholt.net>2007-07-26 10:14:17 -0700
committerEric Anholt <eric@anholt.net>2007-07-26 10:15:11 -0700
commitcf2d569daca6954d11a796f4d110148ae2e0c827 (patch)
treea90aa9eed7d107671af12a0c4d3886e4f51c0fc3 /libdrm
parent03e932e32be6ae3de6994c6893c813a34623ad7d (diff)
Replace NO_MOVE/NO_EVICT flags to buffer objects with an ioctl to set pinning.
This cleans up the create/validate interfaces for this very uncommon path, and makes pinned object creation much easier to use for the X Server.
Diffstat (limited to 'libdrm')
-rw-r--r--libdrm/xf86drm.c25
-rw-r--r--libdrm/xf86mm.h1
2 files changed, 25 insertions, 1 deletions
diff --git a/libdrm/xf86drm.c b/libdrm/xf86drm.c
index 8cee4fbc..63242bce 100644
--- a/libdrm/xf86drm.c
+++ b/libdrm/xf86drm.c
@@ -2975,7 +2975,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.