Lines Matching full:clc
98 open_clc_data(struct clc_data *clc, unsigned ptr_bit_size) in open_clc_data() argument
100 memset(clc, 0, sizeof(*clc)); in open_clc_data()
101 clc->file = get_libclc_file(ptr_bit_size); in open_clc_data()
102 clc->fd = -1; in open_clc_data()
104 if (clc->file->static_data) { in open_clc_data()
105 snprintf((char *)clc->cache_key, sizeof(clc->cache_key), in open_clc_data()
111 if (clc->file->sys_path != NULL) { in open_clc_data()
112 int fd = open(clc->file->sys_path, O_RDONLY); in open_clc_data()
119 fprintf(stderr, "fstat failed on %s: %m\n", clc->file->sys_path); in open_clc_data()
126 _mesa_sha1_update(&ctx, clc->file->sys_path, strlen(clc->file->sys_path)); in open_clc_data()
132 _mesa_sha1_final(&ctx, clc->cache_key); in open_clc_data()
134 clc->fd = fd; in open_clc_data()
146 map_clc_data(struct clc_data *clc) in map_clc_data() argument
148 if (clc->file->static_data) { in map_clc_data()
151 ZSTD_getFrameContentSize(clc->file->static_data, in map_clc_data()
152 clc->file->static_data_size); in map_clc_data()
161 ZSTD_findFrameCompressedSize(clc->file->static_data, in map_clc_data()
162 clc->file->static_data_size); in map_clc_data()
171 size_t size = ZSTD_decompress(dest, cmp_size, clc->file->static_data, in map_clc_data()
180 clc->data = dest; in map_clc_data()
181 clc->size = size; in map_clc_data()
183 clc->data = clc->file->static_data; in map_clc_data()
184 clc->size = clc->file->static_data_size; in map_clc_data()
190 if (clc->file->sys_path != NULL) { in map_clc_data()
191 off_t len = lseek(clc->fd, 0, SEEK_END); in map_clc_data()
196 clc->size = len; in map_clc_data()
198 clc->data = mmap(NULL, len, PROT_READ, MAP_PRIVATE, clc->fd, 0); in map_clc_data()
199 if (clc->data == MAP_FAILED) { in map_clc_data()
212 close_clc_data(struct clc_data *clc) in close_clc_data() argument
214 if (clc->file->static_data) { in close_clc_data()
216 free((void *)clc->data); in close_clc_data()
222 if (clc->file->sys_path != NULL) { in close_clc_data()
223 if (clc->data) in close_clc_data()
224 munmap((void *)clc->data, clc->size); in close_clc_data()
225 close(clc->fd); in close_clc_data()
238 struct clc_data clc; in nir_can_find_libclc() local
239 if (open_clc_data(&clc, ptr_bit_size)) { in nir_can_find_libclc()
240 close_clc_data(&clc); in nir_can_find_libclc()
316 struct clc_data clc; in nir_load_libclc_shader() local
317 if (!open_clc_data(&clc, ptr_bit_size)) in nir_load_libclc_shader()
323 disk_cache_compute_key(disk_cache, clc.cache_key, in nir_load_libclc_shader()
324 sizeof(clc.cache_key), cache_key); in nir_load_libclc_shader()
333 close_clc_data(&clc); in nir_load_libclc_shader()
339 if (!map_clc_data(&clc)) { in nir_load_libclc_shader()
340 close_clc_data(&clc); in nir_load_libclc_shader()
347 assert(clc.size % SPIRV_WORD_SIZE == 0); in nir_load_libclc_shader()
348 nir_shader *nir = spirv_to_nir(clc.data, clc.size / SPIRV_WORD_SIZE, in nir_load_libclc_shader()
404 close_clc_data(&clc); in nir_load_libclc_shader()