From cf2d569daca6954d11a796f4d110148ae2e0c827 Mon Sep 17 00:00:00 2001 From: Eric Anholt Date: Thu, 26 Jul 2007 10:14:17 -0700 Subject: 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. --- libdrm/xf86drm.c | 25 ++++++++++++++++++++++++- libdrm/xf86mm.h | 1 + 2 files changed, 25 insertions(+), 1 deletion(-) (limited to 'libdrm') 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. -- cgit v1.2.3