summaryrefslogtreecommitdiff
path: root/libdrm/xf86drm.c
diff options
context:
space:
mode:
authorEric Anholt <eric@anholt.net>2007-09-21 17:05:21 -0700
committerEric Anholt <eric@anholt.net>2007-09-21 17:12:19 -0700
commit24e33627c5dfb92324a9faf1c7d366e7f33e622a (patch)
treead03240f73433518b42eeabd4fad14e8ee34184e /libdrm/xf86drm.c
parent7587e9682c1b70930c015915d588b42ccd00c7c4 (diff)
parente7bfeb3031374653f7e55d67cc1b5c823849359f (diff)
Merge branch 'bo-set-pin'
This branch replaces the NO_MOVE/NO_EVICT flags to buffer validation with a separate privileged ioctl to pin buffers like NO_EVICT meant before. The functionality that was supposed to be covered by NO_MOVE may be reintroduced later, possibly in a different way, after the superioctl branch is merged.
Diffstat (limited to 'libdrm/xf86drm.c')
-rw-r--r--libdrm/xf86drm.c26
1 files changed, 25 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) &&