aboutsummaryrefslogtreecommitdiffstats
path: root/src/gallium/winsys/nouveau
diff options
context:
space:
mode:
authorBen Skeggs <[email protected]>2015-11-26 12:59:13 +1000
committerBen Skeggs <[email protected]>2015-12-22 13:24:08 +1000
commit791a3e18508c851177488fe88ffdaabc8f1a6284 (patch)
tree163fe98831f7e2ea1cd1698b007769fa41a8e06e /src/gallium/winsys/nouveau
parent323d4da372298900ce02293a682ba563ac29f4cb (diff)
nouveau: remove use of deprecated nouveau_device_wrap()
Switching to the newer libdrm entry-points tells libdrm that it's OK to make use of newer kernel interfaces. We want to be able to isolate any bugs to either the interfaces changes, or the use of NVIF itself. As such, this commit has a slight hack which forces libdrm to continue using the older kernel interfaces. Signed-off-by: Ben Skeggs <[email protected]> Reviewed-by: Emil Velikov <[email protected]> Reviewed-by: Samuel Pitoiset <[email protected]> Tested-by: Samuel Pitoiset <[email protected]>
Diffstat (limited to 'src/gallium/winsys/nouveau')
-rw-r--r--src/gallium/winsys/nouveau/drm/nouveau_drm_winsys.c31
1 files changed, 23 insertions, 8 deletions
diff --git a/src/gallium/winsys/nouveau/drm/nouveau_drm_winsys.c b/src/gallium/winsys/nouveau/drm/nouveau_drm_winsys.c
index 456530d7427..ff017e45386 100644
--- a/src/gallium/winsys/nouveau/drm/nouveau_drm_winsys.c
+++ b/src/gallium/winsys/nouveau/drm/nouveau_drm_winsys.c
@@ -13,6 +13,9 @@
#include "nouveau/nouveau_winsys.h"
#include "nouveau/nouveau_screen.h"
+#include <nvif/class.h>
+#include <nvif/cl0080.h>
+
static struct util_hash_table *fd_tab = NULL;
pipe_static_mutex(nouveau_screen_mutex);
@@ -57,16 +60,19 @@ static int compare_fd(void *key1, void *key2)
PUBLIC struct pipe_screen *
nouveau_drm_screen_create(int fd)
{
+ struct nouveau_drm *drm = NULL;
struct nouveau_device *dev = NULL;
struct nouveau_screen *(*init)(struct nouveau_device *);
struct nouveau_screen *screen = NULL;
- int ret, dupfd = -1;
+ int ret, dupfd;
pipe_mutex_lock(nouveau_screen_mutex);
if (!fd_tab) {
fd_tab = util_hash_table_create(hash_fd, compare_fd);
- if (!fd_tab)
- goto err;
+ if (!fd_tab) {
+ pipe_mutex_unlock(nouveau_screen_mutex);
+ return NULL;
+ }
}
screen = util_hash_table_get(fd_tab, intptr_to_pointer(fd));
@@ -86,7 +92,17 @@ nouveau_drm_screen_create(int fd)
* creation error.
*/
dupfd = dup(fd);
- ret = nouveau_device_wrap(dupfd, 1, &dev);
+
+ ret = nouveau_drm_new(dupfd, &drm);
+ if (ret)
+ goto err;
+
+ drm->nvif = false;
+
+ ret = nouveau_device_new(&drm->client, NV_DEVICE,
+ &(struct nv_device_v0) {
+ .device = ~0ULL,
+ }, sizeof(struct nv_device_v0), &dev);
if (ret)
goto err;
@@ -133,10 +149,9 @@ err:
if (screen) {
screen->base.destroy(&screen->base);
} else {
- if (dev)
- nouveau_device_del(&dev);
- else if (dupfd >= 0)
- close(dupfd);
+ nouveau_device_del(&dev);
+ nouveau_drm_del(&drm);
+ close(dupfd);
}
pipe_mutex_unlock(nouveau_screen_mutex);
return NULL;