• Home
  • Raw
  • Download

Lines Matching refs:screen

43 bool lima_bo_table_init(struct lima_screen *screen)  in lima_bo_table_init()  argument
45 screen->bo_handles = util_hash_table_create_ptr_keys(); in lima_bo_table_init()
46 if (!screen->bo_handles) in lima_bo_table_init()
49 screen->bo_flink_names = util_hash_table_create_ptr_keys(); in lima_bo_table_init()
50 if (!screen->bo_flink_names) in lima_bo_table_init()
53 mtx_init(&screen->bo_table_lock, mtx_plain); in lima_bo_table_init()
57 _mesa_hash_table_destroy(screen->bo_handles, NULL); in lima_bo_table_init()
61 bool lima_bo_cache_init(struct lima_screen *screen) in lima_bo_cache_init() argument
63 mtx_init(&screen->bo_cache_lock, mtx_plain); in lima_bo_cache_init()
64 list_inithead(&screen->bo_cache_time); in lima_bo_cache_init()
66 list_inithead(&screen->bo_cache_buckets[i]); in lima_bo_cache_init()
71 void lima_bo_table_fini(struct lima_screen *screen) in lima_bo_table_fini() argument
73 mtx_destroy(&screen->bo_table_lock); in lima_bo_table_fini()
74 _mesa_hash_table_destroy(screen->bo_handles, NULL); in lima_bo_table_fini()
75 _mesa_hash_table_destroy(screen->bo_flink_names, NULL); in lima_bo_table_fini()
85 static void lima_close_kms_handle(struct lima_screen *screen, uint32_t handle) in lima_close_kms_handle() argument
91 drmIoctl(screen->fd, DRM_IOCTL_GEM_CLOSE, &args); in lima_close_kms_handle()
97 struct lima_screen *screen = bo->screen; in lima_bo_free() local
103 mtx_lock(&screen->bo_table_lock); in lima_bo_free()
104 _mesa_hash_table_remove_key(screen->bo_handles, in lima_bo_free()
107 _mesa_hash_table_remove_key(screen->bo_flink_names, in lima_bo_free()
109 mtx_unlock(&screen->bo_table_lock); in lima_bo_free()
114 lima_close_kms_handle(screen, bo->handle); in lima_bo_free()
118 void lima_bo_cache_fini(struct lima_screen *screen) in lima_bo_cache_fini() argument
120 mtx_destroy(&screen->bo_cache_lock); in lima_bo_cache_fini()
123 &screen->bo_cache_time, time_list) { in lima_bo_cache_fini()
135 if(drmIoctl(bo->screen->fd, DRM_IOCTL_LIMA_GEM_INFO, &req)) in lima_bo_get_info()
160 lima_bo_cache_get_bucket(struct lima_screen *screen, unsigned size) in lima_bo_cache_get_bucket() argument
162 return &screen->bo_cache_buckets[lima_bucket_index(size)]; in lima_bo_cache_get_bucket()
166 lima_bo_cache_free_stale_bos(struct lima_screen *screen, time_t time) in lima_bo_cache_free_stale_bos() argument
170 &screen->bo_cache_time, time_list) { in lima_bo_cache_free_stale_bos()
184 lima_bo_cache_print_stats(struct lima_screen *screen) in lima_bo_cache_print_stats() argument
190 struct list_head *bucket = &screen->bo_cache_buckets[i]; in lima_bo_cache_print_stats()
209 struct lima_screen *screen = bo->screen; in lima_bo_cache_put() local
211 mtx_lock(&screen->bo_cache_lock); in lima_bo_cache_put()
212 struct list_head *bucket = lima_bo_cache_get_bucket(screen, bo->size); in lima_bo_cache_put()
215 mtx_unlock(&screen->bo_cache_lock); in lima_bo_cache_put()
223 list_addtail(&bo->time_list, &screen->bo_cache_time); in lima_bo_cache_put()
224 lima_bo_cache_free_stale_bos(screen, time.tv_sec); in lima_bo_cache_put()
227 lima_bo_cache_print_stats(screen); in lima_bo_cache_put()
229 mtx_unlock(&screen->bo_cache_lock); in lima_bo_cache_put()
235 lima_bo_cache_get(struct lima_screen *screen, uint32_t size, uint32_t flags) in lima_bo_cache_get() argument
242 mtx_lock(&screen->bo_cache_lock); in lima_bo_cache_get()
243 struct list_head *bucket = lima_bo_cache_get_bucket(screen, size); in lima_bo_cache_get()
246 mtx_unlock(&screen->bo_cache_lock); in lima_bo_cache_get()
268 lima_bo_cache_print_stats(screen); in lima_bo_cache_get()
274 mtx_unlock(&screen->bo_cache_lock); in lima_bo_cache_get()
279 struct lima_bo *lima_bo_create(struct lima_screen *screen, in lima_bo_create() argument
287 bo = lima_bo_cache_get(screen, size, flags); in lima_bo_create()
302 if (drmIoctl(screen->fd, DRM_IOCTL_LIMA_GEM_CREATE, &req)) in lima_bo_create()
305 bo->screen = screen; in lima_bo_create()
323 lima_close_kms_handle(screen, bo->handle); in lima_bo_create()
345 MAP_SHARED, bo->screen->fd, bo->offset); in lima_bo_map()
363 struct lima_screen *screen = bo->screen; in lima_bo_export() local
375 if (drmIoctl(screen->fd, DRM_IOCTL_GEM_FLINK, &flink)) in lima_bo_export()
380 mtx_lock(&screen->bo_table_lock); in lima_bo_export()
381 _mesa_hash_table_insert(screen->bo_flink_names, in lima_bo_export()
383 mtx_unlock(&screen->bo_table_lock); in lima_bo_export()
389 mtx_lock(&screen->bo_table_lock); in lima_bo_export()
390 _mesa_hash_table_insert(screen->bo_handles, in lima_bo_export()
392 mtx_unlock(&screen->bo_table_lock); in lima_bo_export()
398 if (drmPrimeHandleToFD(screen->fd, bo->handle, DRM_CLOEXEC, in lima_bo_export()
402 mtx_lock(&screen->bo_table_lock); in lima_bo_export()
403 _mesa_hash_table_insert(screen->bo_handles, in lima_bo_export()
405 mtx_unlock(&screen->bo_table_lock); in lima_bo_export()
413 struct lima_bo *lima_bo_import(struct lima_screen *screen, in lima_bo_import() argument
421 mtx_lock(&screen->bo_table_lock); in lima_bo_import()
429 if (drmPrimeFDToHandle(screen->fd, h, &prime_handle)) { in lima_bo_import()
430 mtx_unlock(&screen->bo_table_lock); in lima_bo_import()
437 mtx_unlock(&screen->bo_table_lock); in lima_bo_import()
438 lima_close_kms_handle(screen, prime_handle); in lima_bo_import()
449 bo = util_hash_table_get(screen->bo_flink_names, in lima_bo_import()
454 bo = util_hash_table_get(screen->bo_handles, in lima_bo_import()
458 mtx_unlock(&screen->bo_table_lock); in lima_bo_import()
466 mtx_unlock(&screen->bo_table_lock); in lima_bo_import()
471 mtx_unlock(&screen->bo_table_lock); in lima_bo_import()
473 lima_close_kms_handle(screen, h); in lima_bo_import()
481 bo->screen = screen; in lima_bo_import()
487 if (drmIoctl(screen->fd, DRM_IOCTL_GEM_OPEN, &req)) { in lima_bo_import()
488 mtx_unlock(&screen->bo_table_lock); in lima_bo_import()
507 _mesa_hash_table_insert(screen->bo_flink_names, in lima_bo_import()
509 _mesa_hash_table_insert(screen->bo_handles, in lima_bo_import()
513 lima_close_kms_handle(screen, bo->handle); in lima_bo_import()
518 mtx_unlock(&screen->bo_table_lock); in lima_bo_import()
541 return drmIoctl(bo->screen->fd, DRM_IOCTL_LIMA_GEM_WAIT, &req) == 0; in lima_bo_wait()