summary | shortlog | log | commit | commitdiff | tree
raw | patch | inline | side by side (parent: cc0a145)
raw | patch | inline | side by side (parent: cc0a145)
author | Dave Airlie <airlied@redhat.com> | |
Mon, 16 Jul 2012 01:51:37 +0000 (02:51 +0100) | ||
committer | Dave Airlie <airlied@redhat.com> | |
Thu, 19 Jul 2012 03:05:57 +0000 (13:05 +1000) |
This adds prime support to nouveau libdrm.
Signed-off-by: Dave Airlie <airlied@redhat.com>
Signed-off-by: Dave Airlie <airlied@redhat.com>
nouveau/nouveau.c | patch | blob | history | |
nouveau/nouveau.h | patch | blob | history |
diff --git a/nouveau/nouveau.c b/nouveau/nouveau.c
index 5aa41070d582f7f67057f41379b6d7ab7445fd0d..940d93396e566bef5aba643ef7c11fd005375383 100644 (file)
--- a/nouveau/nouveau.c
+++ b/nouveau/nouveau.c
#include <assert.h>
#include <errno.h>
#include <sys/mman.h>
+#include <fcntl.h>
#include <xf86drm.h>
#include <xf86atomic.h>
*pref = bo;
}
+int
+nouveau_bo_prime_handle_ref(struct nouveau_device *dev, int prime_fd,
+ struct nouveau_bo **bo)
+{
+ int ret;
+ unsigned int handle;
+
+ ret = drmPrimeFDToHandle(dev->fd, prime_fd, &handle);
+ if (ret) {
+ nouveau_bo_ref(NULL, bo);
+ return ret;
+ }
+
+ ret = nouveau_bo_wrap(dev, handle, bo);
+ if (ret) {
+ nouveau_bo_ref(NULL, bo);
+ return ret;
+ }
+
+ return 0;
+}
+
+int
+nouveau_bo_set_prime(struct nouveau_bo *bo, int *prime_fd)
+{
+ struct nouveau_bo_priv *nvbo = nouveau_bo(bo);
+ int ret;
+
+ ret = drmPrimeHandleToFD(bo->device->fd, nvbo->base.handle, DRM_CLOEXEC, prime_fd);
+ if (ret)
+ return ret;
+ return 0;
+}
+
int
nouveau_bo_wait(struct nouveau_bo *bo, uint32_t access,
struct nouveau_client *client)
diff --git a/nouveau/nouveau.h b/nouveau/nouveau.h
index 51a959814bd7c3d8c135d3d305b9f1ab58eb91d0..c42eea7a8e909d3ba33a3e25c1b249eddd04f395 100644 (file)
--- a/nouveau/nouveau.h
+++ b/nouveau/nouveau.h
struct nouveau_client *);
int nouveau_bo_wait(struct nouveau_bo *, uint32_t access,
struct nouveau_client *);
+int nouveau_bo_prime_handle_ref(struct nouveau_device *dev, int prime_fd,
+ struct nouveau_bo **);
+int nouveau_bo_set_prime(struct nouveau_bo *bo, int *prime_fd);
struct nouveau_bufref {
struct nouveau_list thead;