Lines Matching refs:dev
43 struct fd_device *dev; in fd_device_new() local
58 dev = NULL; in fd_device_new()
62 dev = msm_device_new(fd); in fd_device_new()
63 dev->version = version->version_minor; in fd_device_new()
67 dev = kgsl_device_new(fd); in fd_device_new()
71 dev = NULL; in fd_device_new()
77 if (!dev) in fd_device_new()
80 p_atomic_set(&dev->refcnt, 1); in fd_device_new()
81 dev->fd = fd; in fd_device_new()
82 dev->handle_table = _mesa_hash_table_create(NULL, _mesa_hash_u32, _mesa_key_u32_equal); in fd_device_new()
83 dev->name_table = _mesa_hash_table_create(NULL, _mesa_hash_u32, _mesa_key_u32_equal); in fd_device_new()
84 fd_bo_cache_init(&dev->bo_cache, false); in fd_device_new()
85 fd_bo_cache_init(&dev->ring_cache, true); in fd_device_new()
87 return dev; in fd_device_new()
96 struct fd_device *dev = fd_device_new(dup_fd); in fd_device_new_dup() local
97 if (dev) in fd_device_new_dup()
98 dev->closefd = 1; in fd_device_new_dup()
101 return dev; in fd_device_new_dup()
104 struct fd_device * fd_device_ref(struct fd_device *dev) in fd_device_ref() argument
106 p_atomic_inc(&dev->refcnt); in fd_device_ref()
107 return dev; in fd_device_ref()
110 static void fd_device_del_impl(struct fd_device *dev) in fd_device_del_impl() argument
112 int close_fd = dev->closefd ? dev->fd : -1; in fd_device_del_impl()
113 fd_bo_cache_cleanup(&dev->bo_cache, 0); in fd_device_del_impl()
114 fd_bo_cache_cleanup(&dev->ring_cache, 0); in fd_device_del_impl()
115 _mesa_hash_table_destroy(dev->handle_table, NULL); in fd_device_del_impl()
116 _mesa_hash_table_destroy(dev->name_table, NULL); in fd_device_del_impl()
117 dev->funcs->destroy(dev); in fd_device_del_impl()
122 void fd_device_del_locked(struct fd_device *dev) in fd_device_del_locked() argument
124 if (!atomic_dec_and_test(&dev->refcnt)) in fd_device_del_locked()
126 fd_device_del_impl(dev); in fd_device_del_locked()
129 void fd_device_del(struct fd_device *dev) in fd_device_del() argument
131 if (!atomic_dec_and_test(&dev->refcnt)) in fd_device_del()
134 fd_device_del_impl(dev); in fd_device_del()
138 int fd_device_fd(struct fd_device *dev) in fd_device_fd() argument
140 return dev->fd; in fd_device_fd()
143 enum fd_version fd_device_version(struct fd_device *dev) in fd_device_version() argument
145 return dev->version; in fd_device_version()
158 bool fd_has_syncobj(struct fd_device *dev) in fd_has_syncobj() argument
161 if (drmGetCap(dev->fd, DRM_CAP_SYNCOBJ, &value)) in fd_has_syncobj()
163 return value && dev->version >= FD_VERSION_FENCE_FD; in fd_has_syncobj()