- U_nouveau-Do-not-add-most-bo-s-to-the-global-bo-list.patch
U_nouveau-make-nouveau-importing-global-buffers-comple.patch * reverse apply these patches in order to fix a regression in 2.4.60 triggered by new legacy tray in GNOME 3.16.0 (fdo#89842) OBS-URL: https://build.opensuse.org/package/show/X11:XOrg/libdrm?expand=0&rev=192
This commit is contained in:
parent
97e3f8a5b6
commit
3f384f5ec0
137
U_nouveau-Do-not-add-most-bo-s-to-the-global-bo-list.patch
Normal file
137
U_nouveau-Do-not-add-most-bo-s-to-the-global-bo-list.patch
Normal file
@ -0,0 +1,137 @@
|
||||
From ba5a0b6274ad9c493ed3ddaf4e13559b9ff55ac1 Mon Sep 17 00:00:00 2001
|
||||
From: Maarten Lankhorst <maarten.lankhorst@ubuntu.com>
|
||||
Date: Thu, 26 Feb 2015 11:54:04 +0100
|
||||
Subject: [PATCH] nouveau: Do not add most bo's to the global bo list.
|
||||
|
||||
Only add wrapped bo's and bo's that have been exported through flink or dma-buf.
|
||||
This avoids a lock in the common case, and decreases traversal needed for importing
|
||||
a dma-buf or flink.
|
||||
|
||||
Signed-off-by: Maarten Lankhorst <maarten.lankhorst@ubuntu.com>
|
||||
Tested-By: Emil Velikov <emil.l.velikov@gmail.com>
|
||||
---
|
||||
nouveau/nouveau.c | 46 ++++++++++++++++++++++------------------------
|
||||
1 file changed, 22 insertions(+), 24 deletions(-)
|
||||
|
||||
diff --git a/nouveau/nouveau.c b/nouveau/nouveau.c
|
||||
index 1c723b9..2d95b74 100644
|
||||
--- a/nouveau/nouveau.c
|
||||
+++ b/nouveau/nouveau.c
|
||||
@@ -349,8 +349,8 @@ nouveau_bo_del(struct nouveau_bo *bo)
|
||||
struct nouveau_bo_priv *nvbo = nouveau_bo(bo);
|
||||
struct drm_gem_close req = { bo->handle };
|
||||
|
||||
- pthread_mutex_lock(&nvdev->lock);
|
||||
- if (nvbo->name) {
|
||||
+ if (nvbo->head.next) {
|
||||
+ pthread_mutex_lock(&nvdev->lock);
|
||||
if (atomic_read(&nvbo->refcnt) == 0) {
|
||||
DRMLISTDEL(&nvbo->head);
|
||||
/*
|
||||
@@ -365,8 +365,6 @@ nouveau_bo_del(struct nouveau_bo *bo)
|
||||
}
|
||||
pthread_mutex_unlock(&nvdev->lock);
|
||||
} else {
|
||||
- DRMLISTDEL(&nvbo->head);
|
||||
- pthread_mutex_unlock(&nvdev->lock);
|
||||
drmIoctl(bo->device->fd, DRM_IOCTL_GEM_CLOSE, &req);
|
||||
}
|
||||
if (bo->map)
|
||||
@@ -379,7 +377,6 @@ nouveau_bo_new(struct nouveau_device *dev, uint32_t flags, uint32_t align,
|
||||
uint64_t size, union nouveau_bo_config *config,
|
||||
struct nouveau_bo **pbo)
|
||||
{
|
||||
- struct nouveau_device_priv *nvdev = nouveau_device(dev);
|
||||
struct nouveau_bo_priv *nvbo = calloc(1, sizeof(*nvbo));
|
||||
struct nouveau_bo *bo = &nvbo->base;
|
||||
int ret;
|
||||
@@ -397,10 +394,6 @@ nouveau_bo_new(struct nouveau_device *dev, uint32_t flags, uint32_t align,
|
||||
return ret;
|
||||
}
|
||||
|
||||
- pthread_mutex_lock(&nvdev->lock);
|
||||
- DRMLISTADD(&nvbo->head, &nvdev->bo_list);
|
||||
- pthread_mutex_unlock(&nvdev->lock);
|
||||
-
|
||||
*pbo = bo;
|
||||
return 0;
|
||||
}
|
||||
@@ -457,6 +450,18 @@ nouveau_bo_wrap_locked(struct nouveau_device *dev, uint32_t handle,
|
||||
return -ENOMEM;
|
||||
}
|
||||
|
||||
+static void
|
||||
+nouveau_bo_make_global(struct nouveau_bo_priv *nvbo)
|
||||
+{
|
||||
+ if (!nvbo->head.next) {
|
||||
+ struct nouveau_device_priv *nvdev = nouveau_device(nvbo->base.device);
|
||||
+ pthread_mutex_lock(&nvdev->lock);
|
||||
+ if (!nvbo->head.next)
|
||||
+ DRMLISTADD(&nvbo->head, &nvdev->bo_list);
|
||||
+ pthread_mutex_unlock(&nvdev->lock);
|
||||
+ }
|
||||
+}
|
||||
+
|
||||
drm_public int
|
||||
nouveau_bo_wrap(struct nouveau_device *dev, uint32_t handle,
|
||||
struct nouveau_bo **pbo)
|
||||
@@ -494,13 +499,16 @@ nouveau_bo_name_get(struct nouveau_bo *bo, uint32_t *name)
|
||||
struct nouveau_bo_priv *nvbo = nouveau_bo(bo);
|
||||
|
||||
*name = nvbo->name;
|
||||
- if (!*name || *name == ~0U) {
|
||||
+ if (!*name) {
|
||||
int ret = drmIoctl(bo->device->fd, DRM_IOCTL_GEM_FLINK, &req);
|
||||
+
|
||||
if (ret) {
|
||||
*name = 0;
|
||||
return ret;
|
||||
}
|
||||
nvbo->name = *name = req.name;
|
||||
+
|
||||
+ nouveau_bo_make_global(nvbo);
|
||||
}
|
||||
return 0;
|
||||
}
|
||||
@@ -533,16 +541,6 @@ nouveau_bo_prime_handle_ref(struct nouveau_device *dev, int prime_fd,
|
||||
ret = drmPrimeFDToHandle(dev->fd, prime_fd, &handle);
|
||||
if (ret == 0) {
|
||||
ret = nouveau_bo_wrap_locked(dev, handle, bo, 0);
|
||||
- if (!ret) {
|
||||
- struct nouveau_bo_priv *nvbo = nouveau_bo(*bo);
|
||||
- if (!nvbo->name) {
|
||||
- /*
|
||||
- * XXX: Force locked DRM_IOCTL_GEM_CLOSE
|
||||
- * to rule out race conditions
|
||||
- */
|
||||
- nvbo->name = ~0;
|
||||
- }
|
||||
- }
|
||||
}
|
||||
pthread_mutex_unlock(&nvdev->lock);
|
||||
return ret;
|
||||
@@ -557,8 +555,8 @@ nouveau_bo_set_prime(struct nouveau_bo *bo, int *prime_fd)
|
||||
ret = drmPrimeHandleToFD(bo->device->fd, nvbo->base.handle, DRM_CLOEXEC, prime_fd);
|
||||
if (ret)
|
||||
return ret;
|
||||
- if (!nvbo->name)
|
||||
- nvbo->name = ~0;
|
||||
+
|
||||
+ nouveau_bo_make_global(nvbo);
|
||||
return 0;
|
||||
}
|
||||
|
||||
@@ -578,8 +576,8 @@ nouveau_bo_wait(struct nouveau_bo *bo, uint32_t access,
|
||||
if (push && push->channel)
|
||||
nouveau_pushbuf_kick(push, push->channel);
|
||||
|
||||
- if (!nvbo->name && !(nvbo->access & NOUVEAU_BO_WR) &&
|
||||
- !( access & NOUVEAU_BO_WR))
|
||||
+ if (!nvbo->head.next && !(nvbo->access & NOUVEAU_BO_WR) &&
|
||||
+ !(access & NOUVEAU_BO_WR))
|
||||
return 0;
|
||||
|
||||
req.handle = bo->handle;
|
||||
--
|
||||
1.8.4.5
|
||||
|
374
U_nouveau-make-nouveau-importing-global-buffers-comple.patch
Normal file
374
U_nouveau-make-nouveau-importing-global-buffers-comple.patch
Normal file
@ -0,0 +1,374 @@
|
||||
From 5ea6f1c32628887c9df0c53bc8c199eb12633fec Mon Sep 17 00:00:00 2001
|
||||
From: Maarten Lankhorst <maarten.lankhorst@ubuntu.com>
|
||||
Date: Thu, 26 Feb 2015 11:54:03 +0100
|
||||
Subject: [PATCH] nouveau: make nouveau importing global buffers completely
|
||||
thread-safe, with tests
|
||||
|
||||
While I've closed off most races in a previous patch, a small race still existed
|
||||
where importing then unreffing cound cause an invalid bo. Add a test for this case.
|
||||
|
||||
Racing sequence fixed:
|
||||
|
||||
- thread 1 releases bo, refcount drops to zero, blocks on acquiring nvdev->lock.
|
||||
- thread 2 increases refcount to 1.
|
||||
- thread 2 decreases refcount to zero, blocks on acquiring nvdev->lock.
|
||||
|
||||
At this point the 2 threads will clean up the same bo.
|
||||
|
||||
Signed-off-by: Maarten Lankhorst <maarten.lankhorst@ubuntu.com>
|
||||
Reviewed-By: Emil Velikov <emil.l.velikov@gmail.com>
|
||||
---
|
||||
configure.ac | 1 +
|
||||
nouveau/nouveau.c | 69 ++++++++++----------
|
||||
tests/Makefile.am | 4 ++
|
||||
tests/nouveau/Makefile.am | 16 +++++
|
||||
tests/nouveau/threaded.c | 156 ++++++++++++++++++++++++++++++++++++++++++++++
|
||||
6 files changed, 210 insertions(+), 37 deletions(-)
|
||||
create mode 100644 tests/nouveau/Makefile.am
|
||||
create mode 100644 tests/nouveau/threaded.c
|
||||
|
||||
diff --git a/configure.ac b/configure.ac
|
||||
index 437f4da..106d970 100644
|
||||
--- a/configure.ac
|
||||
+++ b/configure.ac
|
||||
@@ -454,6 +454,7 @@ AC_CONFIG_FILES([
|
||||
tests/vbltest/Makefile
|
||||
tests/exynos/Makefile
|
||||
tests/tegra/Makefile
|
||||
+ tests/nouveau/Makefile
|
||||
man/Makefile
|
||||
libdrm.pc])
|
||||
AC_OUTPUT
|
||||
diff --git a/nouveau/nouveau.c b/nouveau/nouveau.c
|
||||
index c6c153a..1c723b9 100644
|
||||
--- a/nouveau/nouveau.c
|
||||
+++ b/nouveau/nouveau.c
|
||||
@@ -351,29 +351,18 @@ nouveau_bo_del(struct nouveau_bo *bo)
|
||||
|
||||
pthread_mutex_lock(&nvdev->lock);
|
||||
if (nvbo->name) {
|
||||
- if (atomic_read(&nvbo->refcnt)) {
|
||||
+ if (atomic_read(&nvbo->refcnt) == 0) {
|
||||
+ DRMLISTDEL(&nvbo->head);
|
||||
/*
|
||||
- * bo has been revived by a race with
|
||||
- * nouveau_bo_prime_handle_ref, or nouveau_bo_name_ref.
|
||||
- *
|
||||
- * In theory there's still a race possible with
|
||||
- * nouveau_bo_wrap, but when using this function
|
||||
- * the lifetime of the handle is probably already
|
||||
- * handled in another way. If there are races
|
||||
- * you're probably using nouveau_bo_wrap wrong.
|
||||
+ * This bo has to be closed with the lock held because
|
||||
+ * gem handles are not refcounted. If a shared bo is
|
||||
+ * closed and re-opened in another thread a race
|
||||
+ * against DRM_IOCTL_GEM_OPEN or drmPrimeFDToHandle
|
||||
+ * might cause the bo to be closed accidentally while
|
||||
+ * re-importing.
|
||||
*/
|
||||
- pthread_mutex_unlock(&nvdev->lock);
|
||||
- return;
|
||||
+ drmIoctl(bo->device->fd, DRM_IOCTL_GEM_CLOSE, &req);
|
||||
}
|
||||
- DRMLISTDEL(&nvbo->head);
|
||||
- /*
|
||||
- * This bo has to be closed with the lock held because gem
|
||||
- * handles are not refcounted. If a shared bo is closed and
|
||||
- * re-opened in another thread a race against
|
||||
- * DRM_IOCTL_GEM_OPEN or drmPrimeFDToHandle might cause the
|
||||
- * bo to be closed accidentally while re-importing.
|
||||
- */
|
||||
- drmIoctl(bo->device->fd, DRM_IOCTL_GEM_CLOSE, &req);
|
||||
pthread_mutex_unlock(&nvdev->lock);
|
||||
} else {
|
||||
DRMLISTDEL(&nvbo->head);
|
||||
@@ -418,7 +407,7 @@ nouveau_bo_new(struct nouveau_device *dev, uint32_t flags, uint32_t align,
|
||||
|
||||
static int
|
||||
nouveau_bo_wrap_locked(struct nouveau_device *dev, uint32_t handle,
|
||||
- struct nouveau_bo **pbo)
|
||||
+ struct nouveau_bo **pbo, int name)
|
||||
{
|
||||
struct nouveau_device_priv *nvdev = nouveau_device(dev);
|
||||
struct drm_nouveau_gem_info req = { .handle = handle };
|
||||
@@ -427,8 +416,24 @@ nouveau_bo_wrap_locked(struct nouveau_device *dev, uint32_t handle,
|
||||
|
||||
DRMLISTFOREACHENTRY(nvbo, &nvdev->bo_list, head) {
|
||||
if (nvbo->base.handle == handle) {
|
||||
- *pbo = NULL;
|
||||
- nouveau_bo_ref(&nvbo->base, pbo);
|
||||
+ if (atomic_inc_return(&nvbo->refcnt) == 1) {
|
||||
+ /*
|
||||
+ * Uh oh, this bo is dead and someone else
|
||||
+ * will free it, but because refcnt is
|
||||
+ * now non-zero fortunately they won't
|
||||
+ * call the ioctl to close the bo.
|
||||
+ *
|
||||
+ * Remove this bo from the list so other
|
||||
+ * calls to nouveau_bo_wrap_locked will
|
||||
+ * see our replacement nvbo.
|
||||
+ */
|
||||
+ DRMLISTDEL(&nvbo->head);
|
||||
+ if (!name)
|
||||
+ name = nvbo->name;
|
||||
+ break;
|
||||
+ }
|
||||
+
|
||||
+ *pbo = &nvbo->base;
|
||||
return 0;
|
||||
}
|
||||
}
|
||||
@@ -443,6 +448,7 @@ nouveau_bo_wrap_locked(struct nouveau_device *dev, uint32_t handle,
|
||||
atomic_set(&nvbo->refcnt, 1);
|
||||
nvbo->base.device = dev;
|
||||
abi16_bo_info(&nvbo->base, &req);
|
||||
+ nvbo->name = name;
|
||||
DRMLISTADD(&nvbo->head, &nvdev->bo_list);
|
||||
*pbo = &nvbo->base;
|
||||
return 0;
|
||||
@@ -458,7 +464,7 @@ nouveau_bo_wrap(struct nouveau_device *dev, uint32_t handle,
|
||||
struct nouveau_device_priv *nvdev = nouveau_device(dev);
|
||||
int ret;
|
||||
pthread_mutex_lock(&nvdev->lock);
|
||||
- ret = nouveau_bo_wrap_locked(dev, handle, pbo);
|
||||
+ ret = nouveau_bo_wrap_locked(dev, handle, pbo, 0);
|
||||
pthread_mutex_unlock(&nvdev->lock);
|
||||
return ret;
|
||||
}
|
||||
@@ -468,24 +474,13 @@ nouveau_bo_name_ref(struct nouveau_device *dev, uint32_t name,
|
||||
struct nouveau_bo **pbo)
|
||||
{
|
||||
struct nouveau_device_priv *nvdev = nouveau_device(dev);
|
||||
- struct nouveau_bo_priv *nvbo;
|
||||
struct drm_gem_open req = { .name = name };
|
||||
int ret;
|
||||
|
||||
pthread_mutex_lock(&nvdev->lock);
|
||||
- DRMLISTFOREACHENTRY(nvbo, &nvdev->bo_list, head) {
|
||||
- if (nvbo->name == name) {
|
||||
- *pbo = NULL;
|
||||
- nouveau_bo_ref(&nvbo->base, pbo);
|
||||
- pthread_mutex_unlock(&nvdev->lock);
|
||||
- return 0;
|
||||
- }
|
||||
- }
|
||||
-
|
||||
ret = drmIoctl(dev->fd, DRM_IOCTL_GEM_OPEN, &req);
|
||||
if (ret == 0) {
|
||||
- ret = nouveau_bo_wrap_locked(dev, req.handle, pbo);
|
||||
- nouveau_bo((*pbo))->name = name;
|
||||
+ ret = nouveau_bo_wrap_locked(dev, req.handle, pbo, name);
|
||||
}
|
||||
|
||||
pthread_mutex_unlock(&nvdev->lock);
|
||||
@@ -537,7 +532,7 @@ nouveau_bo_prime_handle_ref(struct nouveau_device *dev, int prime_fd,
|
||||
pthread_mutex_lock(&nvdev->lock);
|
||||
ret = drmPrimeFDToHandle(dev->fd, prime_fd, &handle);
|
||||
if (ret == 0) {
|
||||
- ret = nouveau_bo_wrap_locked(dev, handle, bo);
|
||||
+ ret = nouveau_bo_wrap_locked(dev, handle, bo, 0);
|
||||
if (!ret) {
|
||||
struct nouveau_bo_priv *nvbo = nouveau_bo(*bo);
|
||||
if (!nvbo->name) {
|
||||
diff --git a/tests/Makefile.am b/tests/Makefile.am
|
||||
index d5269f9..94fcc08 100644
|
||||
--- a/tests/Makefile.am
|
||||
+++ b/tests/Makefile.am
|
||||
@@ -31,6 +31,10 @@ check_PROGRAMS = \
|
||||
dristat \
|
||||
drmstat
|
||||
|
||||
+if HAVE_NOUVEAU
|
||||
+SUBDIRS += nouveau
|
||||
+endif
|
||||
+
|
||||
if HAVE_LIBUDEV
|
||||
|
||||
check_LTLIBRARIES = libdrmtest.la
|
||||
diff --git a/tests/nouveau/Makefile.am b/tests/nouveau/Makefile.am
|
||||
new file mode 100644
|
||||
index 0000000..c4f6e29
|
||||
--- /dev/null
|
||||
+++ b/tests/nouveau/Makefile.am
|
||||
@@ -0,0 +1,16 @@
|
||||
+AM_CPPFLAGS = \
|
||||
+ -I$(top_srcdir)/include/drm \
|
||||
+ -I$(top_srcdir)/nouveau \
|
||||
+ -I$(top_srcdir)
|
||||
+
|
||||
+AM_CFLAGS = $(WARN_CFLAGS)
|
||||
+
|
||||
+LDADD = \
|
||||
+ ../../nouveau/libdrm_nouveau.la \
|
||||
+ ../../libdrm.la \
|
||||
+ -ldl -lpthread
|
||||
+
|
||||
+TESTS = threaded
|
||||
+
|
||||
+check_PROGRAMS = $(TESTS)
|
||||
+
|
||||
diff --git a/tests/nouveau/threaded.c b/tests/nouveau/threaded.c
|
||||
new file mode 100644
|
||||
index 0000000..281af46
|
||||
--- /dev/null
|
||||
+++ b/tests/nouveau/threaded.c
|
||||
@@ -0,0 +1,156 @@
|
||||
+/*
|
||||
+ * Copyright © 2015 Canonical Ltd. (Maarten Lankhorst)
|
||||
+ *
|
||||
+ * Permission is hereby granted, free of charge, to any person obtaining a
|
||||
+ * copy of this software and associated documentation files (the "Software"),
|
||||
+ * to deal in the Software without restriction, including without limitation
|
||||
+ * the rights to use, copy, modify, merge, publish, distribute, sublicense,
|
||||
+ * and/or sell copies of the Software, and to permit persons to whom the
|
||||
+ * Software is furnished to do so, subject to the following conditions:
|
||||
+ *
|
||||
+ * The above copyright notice and this permission notice shall be included in
|
||||
+ * all copies or substantial portions of the Software.
|
||||
+ *
|
||||
+ * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
||||
+ * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
||||
+ * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL
|
||||
+ * THE COPYRIGHT HOLDER(S) OR AUTHOR(S) BE LIABLE FOR ANY CLAIM, DAMAGES OR
|
||||
+ * OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE,
|
||||
+ * ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR
|
||||
+ * OTHER DEALINGS IN THE SOFTWARE.
|
||||
+ */
|
||||
+
|
||||
+#ifdef HAVE_CONFIG_H
|
||||
+# include "config.h"
|
||||
+#endif
|
||||
+
|
||||
+#include <sys/ioctl.h>
|
||||
+#include <dlfcn.h>
|
||||
+#include <fcntl.h>
|
||||
+#include <stdio.h>
|
||||
+#include <unistd.h>
|
||||
+#include <errno.h>
|
||||
+#include <pthread.h>
|
||||
+
|
||||
+#include "xf86drm.h"
|
||||
+#include "nouveau.h"
|
||||
+
|
||||
+static typeof(ioctl) *old_ioctl;
|
||||
+static int failed;
|
||||
+
|
||||
+static int import_fd;
|
||||
+
|
||||
+int ioctl(int fd, unsigned long request, ...)
|
||||
+{
|
||||
+ va_list va;
|
||||
+ int ret;
|
||||
+ void *arg;
|
||||
+
|
||||
+ va_start(va, request);
|
||||
+ arg = va_arg(va, void *);
|
||||
+ ret = old_ioctl(fd, request, arg);
|
||||
+ va_end(va);
|
||||
+
|
||||
+ if (ret < 0 && request == DRM_IOCTL_GEM_CLOSE && errno == EINVAL)
|
||||
+ failed = 1;
|
||||
+
|
||||
+ return ret;
|
||||
+}
|
||||
+
|
||||
+static void *
|
||||
+openclose(void *dev)
|
||||
+{
|
||||
+ struct nouveau_device *nvdev = dev;
|
||||
+ struct nouveau_bo *bo = NULL;
|
||||
+ int i;
|
||||
+
|
||||
+ for (i = 0; i < 100000; ++i) {
|
||||
+ if (!nouveau_bo_prime_handle_ref(nvdev, import_fd, &bo))
|
||||
+ nouveau_bo_ref(NULL, &bo);
|
||||
+ }
|
||||
+ return NULL;
|
||||
+}
|
||||
+
|
||||
+int main(int argc, char *argv[])
|
||||
+{
|
||||
+ drmVersionPtr version;
|
||||
+ const char *device = NULL;
|
||||
+ int err, fd, fd2;
|
||||
+ struct nouveau_device *nvdev, *nvdev2;
|
||||
+ struct nouveau_bo *bo;
|
||||
+ pthread_t t1, t2;
|
||||
+
|
||||
+ old_ioctl = dlsym(RTLD_NEXT, "ioctl");
|
||||
+
|
||||
+ if (argc < 2) {
|
||||
+ fd = drmOpenWithType("nouveau", NULL, DRM_NODE_RENDER);
|
||||
+ if (fd >= 0)
|
||||
+ fd2 = drmOpenWithType("nouveau", NULL, DRM_NODE_RENDER);
|
||||
+ } else {
|
||||
+ device = argv[1];
|
||||
+
|
||||
+ fd = open(device, O_RDWR);
|
||||
+ if (fd >= 0)
|
||||
+ fd2 = open(device, O_RDWR);
|
||||
+ else
|
||||
+ fd2 = fd = -errno;
|
||||
+ }
|
||||
+
|
||||
+ if (fd < 0) {
|
||||
+ fprintf(stderr, "Opening nouveau render node failed with %i\n", fd);
|
||||
+ return device ? -fd : 77;
|
||||
+ }
|
||||
+
|
||||
+ if (fd2 < 0) {
|
||||
+ fprintf(stderr, "Opening second nouveau render node failed with %i\n", -errno);
|
||||
+ return errno;
|
||||
+ }
|
||||
+
|
||||
+ version = drmGetVersion(fd);
|
||||
+ if (version) {
|
||||
+ printf("Version: %d.%d.%d\n", version->version_major,
|
||||
+ version->version_minor, version->version_patchlevel);
|
||||
+ printf(" Name: %s\n", version->name);
|
||||
+ printf(" Date: %s\n", version->date);
|
||||
+ printf(" Description: %s\n", version->desc);
|
||||
+
|
||||
+ drmFreeVersion(version);
|
||||
+ }
|
||||
+
|
||||
+ err = nouveau_device_wrap(fd, 0, &nvdev);
|
||||
+ if (!err)
|
||||
+ err = nouveau_device_wrap(fd2, 0, &nvdev2);
|
||||
+ if (err < 0)
|
||||
+ return 1;
|
||||
+
|
||||
+ err = nouveau_bo_new(nvdev2, NOUVEAU_BO_GART, 0, 4096, NULL, &bo);
|
||||
+ if (!err)
|
||||
+ err = nouveau_bo_set_prime(bo, &import_fd);
|
||||
+
|
||||
+ if (!err) {
|
||||
+ pthread_create(&t1, NULL, openclose, nvdev);
|
||||
+ pthread_create(&t2, NULL, openclose, nvdev);
|
||||
+ }
|
||||
+
|
||||
+ pthread_join(t1, NULL);
|
||||
+ pthread_join(t2, NULL);
|
||||
+
|
||||
+ close(import_fd);
|
||||
+ nouveau_bo_ref(NULL, &bo);
|
||||
+
|
||||
+ nouveau_device_del(&nvdev2);
|
||||
+ nouveau_device_del(&nvdev);
|
||||
+ if (device) {
|
||||
+ close(fd2);
|
||||
+ close(fd);
|
||||
+ } else {
|
||||
+ drmClose(fd2);
|
||||
+ drmClose(fd);
|
||||
+ }
|
||||
+
|
||||
+ if (failed)
|
||||
+ fprintf(stderr, "DRM_IOCTL_GEM_CLOSE failed with EINVAL,\n"
|
||||
+ "race in opening/closing bo is likely.\n");
|
||||
+
|
||||
+ return failed;
|
||||
+}
|
||||
--
|
||||
1.8.4.5
|
||||
|
@ -1,3 +1,11 @@
|
||||
-------------------------------------------------------------------
|
||||
Wed Apr 29 08:17:19 UTC 2015 - sndirsch@suse.com
|
||||
|
||||
- U_nouveau-Do-not-add-most-bo-s-to-the-global-bo-list.patch
|
||||
U_nouveau-make-nouveau-importing-global-buffers-comple.patch
|
||||
* reverse apply these patches in order to fix a regression in
|
||||
2.4.60 triggered by new legacy tray in GNOME 3.16.0 (fdo#89842)
|
||||
|
||||
-------------------------------------------------------------------
|
||||
Wed Apr 8 16:04:17 UTC 2015 - schwab@suse.de
|
||||
|
||||
|
@ -37,6 +37,8 @@ Group: System/Libraries
|
||||
# Source URL: http://dri.freedesktop.org/libdrm/
|
||||
Source: %{name}-%{version}.tar.bz2
|
||||
Source2: baselibs.conf
|
||||
Patch0: U_nouveau-Do-not-add-most-bo-s-to-the-global-bo-list.patch
|
||||
Patch1: U_nouveau-make-nouveau-importing-global-buffers-comple.patch
|
||||
# PATCH-FIX-UPSTREAM libdrm-implicit-defs.diff fdo#48599 -- Fix compiler warnings in tests/radeon/radeon_ttm.c
|
||||
Patch2: u_Fix-compilation-on-systems-that-don-t-provide-O_CLOE.patch
|
||||
|
||||
@ -170,6 +172,9 @@ Group: System/Libraries
|
||||
|
||||
%prep
|
||||
%setup -q
|
||||
# reverse apply (fdo#89842)
|
||||
%patch0 -p1 -R
|
||||
%patch1 -p1 -R
|
||||
%patch2 -p1
|
||||
|
||||
%build
|
||||
|
Loading…
x
Reference in New Issue
Block a user