#include <sys/stat.h>
#include <unistd.h>
+#include <fcntl.h>
#include "pipe/p_context.h"
#include "pipe/p_state.h"
#include "util/u_format.h"
static struct util_hash_table *fd_tab = NULL;
-pipe_static_mutex(nouveau_screen_mutex);
+static mtx_t nouveau_screen_mutex = _MTX_INITIALIZER_NP;
bool nouveau_drm_screen_unref(struct nouveau_screen *screen)
{
if (screen->refcount == -1)
return true;
- pipe_mutex_lock(nouveau_screen_mutex);
+ mtx_lock(&nouveau_screen_mutex);
ret = --screen->refcount;
assert(ret >= 0);
if (ret == 0)
struct nouveau_screen *screen = NULL;
int ret, dupfd;
- pipe_mutex_lock(nouveau_screen_mutex);
+ mtx_lock(&nouveau_screen_mutex);
if (!fd_tab) {
fd_tab = util_hash_table_create(hash_fd, compare_fd);
if (!fd_tab) {
* nouveau_device_wrap does not close the fd in case of a device
* creation error.
*/
- dupfd = dup(fd);
+ dupfd = fcntl(fd, F_DUPFD_CLOEXEC, 3);
ret = nouveau_drm_new(dupfd, &drm);
if (ret)
case 0x100:
case 0x110:
case 0x120:
+ case 0x130:
init = nvc0_screen_create;
break;
default: