diff options
author | Jonathan Gray <jsg@cvs.openbsd.org> | 2020-08-26 06:03:18 +0000 |
---|---|---|
committer | Jonathan Gray <jsg@cvs.openbsd.org> | 2020-08-26 06:03:18 +0000 |
commit | af5e8f5366b05c3d4f8521f318c143a5c5dc3ea9 (patch) | |
tree | c5691445908b1beca9facf0e5e3c5d7f35f74228 /lib/mesa/src/gallium/auxiliary/pipebuffer | |
parent | 27c93456b58343162f7c4ad20ca6bea0c9a91646 (diff) |
Merge Mesa 20.1.6
Diffstat (limited to 'lib/mesa/src/gallium/auxiliary/pipebuffer')
5 files changed, 50 insertions, 48 deletions
diff --git a/lib/mesa/src/gallium/auxiliary/pipebuffer/pb_buffer_fenced.c b/lib/mesa/src/gallium/auxiliary/pipebuffer/pb_buffer_fenced.c index ec1819119..cae875200 100644 --- a/lib/mesa/src/gallium/auxiliary/pipebuffer/pb_buffer_fenced.c +++ b/lib/mesa/src/gallium/auxiliary/pipebuffer/pb_buffer_fenced.c @@ -250,7 +250,7 @@ fenced_buffer_destroy_locked(struct fenced_manager *fenced_mgr, assert(!fenced_buf->fence); assert(fenced_buf->head.prev); assert(fenced_buf->head.next); - LIST_DEL(&fenced_buf->head); + list_del(&fenced_buf->head); assert(fenced_mgr->num_unfenced); --fenced_mgr->num_unfenced; @@ -276,10 +276,10 @@ fenced_buffer_add_locked(struct fenced_manager *fenced_mgr, p_atomic_inc(&fenced_buf->base.reference.count); - LIST_DEL(&fenced_buf->head); + list_del(&fenced_buf->head); assert(fenced_mgr->num_unfenced); --fenced_mgr->num_unfenced; - LIST_ADDTAIL(&fenced_buf->head, &fenced_mgr->fenced); + list_addtail(&fenced_buf->head, &fenced_mgr->fenced); ++fenced_mgr->num_fenced; } @@ -305,11 +305,11 @@ fenced_buffer_remove_locked(struct fenced_manager *fenced_mgr, assert(fenced_buf->head.prev); assert(fenced_buf->head.next); - LIST_DEL(&fenced_buf->head); + list_del(&fenced_buf->head); assert(fenced_mgr->num_fenced); --fenced_mgr->num_fenced; - LIST_ADDTAIL(&fenced_buf->head, &fenced_mgr->unfenced); + list_addtail(&fenced_buf->head, &fenced_mgr->unfenced); ++fenced_mgr->num_unfenced; if (p_atomic_dec_zero(&fenced_buf->base.reference.count)) { @@ -939,7 +939,7 @@ fenced_bufmgr_create_buffer(struct pb_manager *mgr, assert(fenced_buf->buffer || fenced_buf->data); - LIST_ADDTAIL(&fenced_buf->head, &fenced_mgr->unfenced); + list_addtail(&fenced_buf->head, &fenced_mgr->unfenced); ++fenced_mgr->num_unfenced; mtx_unlock(&fenced_mgr->mutex); @@ -1027,10 +1027,10 @@ fenced_bufmgr_create(struct pb_manager *provider, fenced_mgr->max_buffer_size = max_buffer_size; fenced_mgr->max_cpu_total_size = max_cpu_total_size; - LIST_INITHEAD(&fenced_mgr->fenced); + list_inithead(&fenced_mgr->fenced); fenced_mgr->num_fenced = 0; - LIST_INITHEAD(&fenced_mgr->unfenced); + list_inithead(&fenced_mgr->unfenced); fenced_mgr->num_unfenced = 0; (void) mtx_init(&fenced_mgr->mutex, mtx_plain); diff --git a/lib/mesa/src/gallium/auxiliary/pipebuffer/pb_bufmgr_debug.c b/lib/mesa/src/gallium/auxiliary/pipebuffer/pb_bufmgr_debug.c index 3f501c298..8e54e8114 100644 --- a/lib/mesa/src/gallium/auxiliary/pipebuffer/pb_bufmgr_debug.c +++ b/lib/mesa/src/gallium/auxiliary/pipebuffer/pb_bufmgr_debug.c @@ -236,7 +236,7 @@ pb_debug_buffer_destroy(struct pb_buffer *_buf) pb_debug_buffer_check(buf); mtx_lock(&mgr->mutex); - LIST_DEL(&buf->head); + list_del(&buf->head); mtx_unlock(&mgr->mutex); mtx_destroy(&buf->mutex); @@ -391,7 +391,7 @@ pb_debug_manager_create_buffer(struct pb_manager *_mgr, #if 0 mtx_lock(&mgr->mutex); debug_printf("%s: failed to create buffer\n", __FUNCTION__); - if(!LIST_IS_EMPTY(&mgr->list)) + if(!list_is_empty(&mgr->list)) pb_debug_manager_dump_locked(mgr); mtx_unlock(&mgr->mutex); #endif @@ -421,7 +421,7 @@ pb_debug_manager_create_buffer(struct pb_manager *_mgr, (void) mtx_init(&buf->mutex, mtx_plain); mtx_lock(&mgr->mutex); - LIST_ADDTAIL(&buf->head, &mgr->list); + list_addtail(&buf->head, &mgr->list); mtx_unlock(&mgr->mutex); return &buf->base; @@ -444,7 +444,7 @@ pb_debug_manager_destroy(struct pb_manager *_mgr) struct pb_debug_manager *mgr = pb_debug_manager(_mgr); mtx_lock(&mgr->mutex); - if(!LIST_IS_EMPTY(&mgr->list)) { + if(!list_is_empty(&mgr->list)) { debug_printf("%s: unfreed buffers\n", __FUNCTION__); pb_debug_manager_dump_locked(mgr); } @@ -477,7 +477,7 @@ pb_debug_manager_create(struct pb_manager *provider, mgr->overflow_size = overflow_size; (void) mtx_init(&mgr->mutex, mtx_plain); - LIST_INITHEAD(&mgr->list); + list_inithead(&mgr->list); return &mgr->base; } diff --git a/lib/mesa/src/gallium/auxiliary/pipebuffer/pb_bufmgr_slab.c b/lib/mesa/src/gallium/auxiliary/pipebuffer/pb_bufmgr_slab.c index 8a3b28761..c93609621 100644 --- a/lib/mesa/src/gallium/auxiliary/pipebuffer/pb_bufmgr_slab.c +++ b/lib/mesa/src/gallium/auxiliary/pipebuffer/pb_bufmgr_slab.c @@ -204,17 +204,18 @@ pb_slab_buffer_destroy(struct pb_buffer *_buf) buf->mapCount = 0; - LIST_DEL(list); - LIST_ADDTAIL(list, &slab->freeBuffers); + list_del(list); + list_addtail(list, &slab->freeBuffers); slab->numFree++; if (slab->head.next == &slab->head) - LIST_ADDTAIL(&slab->head, &mgr->slabs); + list_addtail(&slab->head, &mgr->slabs); /* If the slab becomes totally empty, free it */ if (slab->numFree == slab->numBuffers) { list = &slab->head; - LIST_DELINIT(list); + list_delinit(list); + pb_unmap(slab->bo); pb_reference(&slab->bo, NULL); FREE(slab->buffers); FREE(slab); @@ -315,15 +316,16 @@ pb_slab_create(struct pb_slab_manager *mgr) } /* Note down the slab virtual address. All mappings are accessed directly - * through this address so it is required that the buffer is pinned. */ + * through this address so it is required that the buffer is mapped + * persistent */ slab->virtual = pb_map(slab->bo, PB_USAGE_CPU_READ | - PB_USAGE_CPU_WRITE, NULL); + PB_USAGE_CPU_WRITE | + PB_USAGE_PERSISTENT, NULL); if(!slab->virtual) { ret = PIPE_ERROR_OUT_OF_MEMORY; goto out_err1; } - pb_unmap(slab->bo); numBuffers = slab->bo->size / mgr->bufSize; @@ -333,8 +335,8 @@ pb_slab_create(struct pb_slab_manager *mgr) goto out_err1; } - LIST_INITHEAD(&slab->head); - LIST_INITHEAD(&slab->freeBuffers); + list_inithead(&slab->head); + list_inithead(&slab->freeBuffers); slab->numBuffers = numBuffers; slab->numFree = 0; slab->mgr = mgr; @@ -350,13 +352,13 @@ pb_slab_create(struct pb_slab_manager *mgr) buf->start = i* mgr->bufSize; buf->mapCount = 0; cnd_init(&buf->event); - LIST_ADDTAIL(&buf->head, &slab->freeBuffers); + list_addtail(&buf->head, &slab->freeBuffers); slab->numFree++; buf++; } /* Add this slab to the list of partial slabs */ - LIST_ADDTAIL(&slab->head, &mgr->slabs); + list_addtail(&slab->head, &mgr->slabs); return PIPE_OK; @@ -412,10 +414,10 @@ pb_slab_manager_create_buffer(struct pb_manager *_mgr, /* If totally full remove from the partial slab list */ if (--slab->numFree == 0) - LIST_DELINIT(list); + list_delinit(list); list = slab->freeBuffers.next; - LIST_DELINIT(list); + list_delinit(list); mtx_unlock(&mgr->mutex); buf = LIST_ENTRY(struct pb_slab_buffer, list, head); @@ -470,7 +472,7 @@ pb_slab_manager_create(struct pb_manager *provider, mgr->slabSize = slabSize; mgr->desc = *desc; - LIST_INITHEAD(&mgr->slabs); + list_inithead(&mgr->slabs); (void) mtx_init(&mgr->mutex, mtx_plain); diff --git a/lib/mesa/src/gallium/auxiliary/pipebuffer/pb_cache.c b/lib/mesa/src/gallium/auxiliary/pipebuffer/pb_cache.c index 2b9ad4980..ec878202f 100644 --- a/lib/mesa/src/gallium/auxiliary/pipebuffer/pb_cache.c +++ b/lib/mesa/src/gallium/auxiliary/pipebuffer/pb_cache.c @@ -42,7 +42,7 @@ destroy_buffer_locked(struct pb_cache_entry *entry) assert(!pipe_is_referenced(&buf->reference)); if (entry->head.next) { - LIST_DEL(&entry->head); + list_del(&entry->head); assert(mgr->num_buffers); --mgr->num_buffers; mgr->cache_size -= buf->size; @@ -104,7 +104,7 @@ pb_cache_add_buffer(struct pb_cache_entry *entry) entry->start = os_time_get(); entry->end = entry->start + mgr->usecs; - LIST_ADDTAIL(&entry->head, cache); + list_addtail(&entry->head, cache); ++mgr->num_buffers; mgr->cache_size += buf->size; mtx_unlock(&mgr->mutex); @@ -208,7 +208,7 @@ pb_cache_reclaim_buffer(struct pb_cache *mgr, pb_size size, struct pb_buffer *buf = entry->buffer; mgr->cache_size -= buf->size; - LIST_DEL(&entry->head); + list_del(&entry->head); --mgr->num_buffers; mtx_unlock(&mgr->mutex); /* Increase refcount */ @@ -290,7 +290,7 @@ pb_cache_init(struct pb_cache *mgr, uint num_heaps, return; for (i = 0; i < num_heaps; i++) - LIST_INITHEAD(&mgr->buckets[i]); + list_inithead(&mgr->buckets[i]); (void) mtx_init(&mgr->mutex, mtx_plain); mgr->cache_size = 0; diff --git a/lib/mesa/src/gallium/auxiliary/pipebuffer/pb_slab.c b/lib/mesa/src/gallium/auxiliary/pipebuffer/pb_slab.c index 270229708..d84686961 100644 --- a/lib/mesa/src/gallium/auxiliary/pipebuffer/pb_slab.c +++ b/lib/mesa/src/gallium/auxiliary/pipebuffer/pb_slab.c @@ -55,18 +55,18 @@ pb_slab_reclaim(struct pb_slabs *slabs, struct pb_slab_entry *entry) { struct pb_slab *slab = entry->slab; - LIST_DEL(&entry->head); /* remove from reclaim list */ - LIST_ADD(&entry->head, &slab->free); + list_del(&entry->head); /* remove from reclaim list */ + list_add(&entry->head, &slab->free); slab->num_free++; /* Add slab to the group's list if it isn't already linked. */ if (!slab->head.next) { struct pb_slab_group *group = &slabs->groups[entry->group_index]; - LIST_ADDTAIL(&slab->head, &group->slabs); + list_addtail(&slab->head, &group->slabs); } if (slab->num_free >= slab->num_entries) { - LIST_DEL(&slab->head); + list_del(&slab->head); slabs->slab_free(slabs->priv, slab); } } @@ -74,7 +74,7 @@ pb_slab_reclaim(struct pb_slabs *slabs, struct pb_slab_entry *entry) static void pb_slabs_reclaim_locked(struct pb_slabs *slabs) { - while (!LIST_IS_EMPTY(&slabs->reclaim)) { + while (!list_is_empty(&slabs->reclaim)) { struct pb_slab_entry *entry = LIST_ENTRY(struct pb_slab_entry, slabs->reclaim.next, head); @@ -114,20 +114,20 @@ pb_slab_alloc(struct pb_slabs *slabs, unsigned size, unsigned heap) /* If there is no candidate slab at all, or the first slab has no free * entries, try reclaiming entries. */ - if (LIST_IS_EMPTY(&group->slabs) || - LIST_IS_EMPTY(&LIST_ENTRY(struct pb_slab, group->slabs.next, head)->free)) + if (list_is_empty(&group->slabs) || + list_is_empty(&LIST_ENTRY(struct pb_slab, group->slabs.next, head)->free)) pb_slabs_reclaim_locked(slabs); /* Remove slabs without free entries. */ - while (!LIST_IS_EMPTY(&group->slabs)) { + while (!list_is_empty(&group->slabs)) { slab = LIST_ENTRY(struct pb_slab, group->slabs.next, head); - if (!LIST_IS_EMPTY(&slab->free)) + if (!list_is_empty(&slab->free)) break; - LIST_DEL(&slab->head); + list_del(&slab->head); } - if (LIST_IS_EMPTY(&group->slabs)) { + if (list_is_empty(&group->slabs)) { /* Drop the mutex temporarily to prevent a deadlock where the allocation * calls back into slab functions (most likely to happen for * pb_slab_reclaim if memory is low). @@ -141,11 +141,11 @@ pb_slab_alloc(struct pb_slabs *slabs, unsigned size, unsigned heap) return NULL; mtx_lock(&slabs->mutex); - LIST_ADD(&slab->head, &group->slabs); + list_add(&slab->head, &group->slabs); } entry = LIST_ENTRY(struct pb_slab_entry, slab->free.next, head); - LIST_DEL(&entry->head); + list_del(&entry->head); slab->num_free--; mtx_unlock(&slabs->mutex); @@ -163,7 +163,7 @@ void pb_slab_free(struct pb_slabs* slabs, struct pb_slab_entry *entry) { mtx_lock(&slabs->mutex); - LIST_ADDTAIL(&entry->head, &slabs->reclaim); + list_addtail(&entry->head, &slabs->reclaim); mtx_unlock(&slabs->mutex); } @@ -212,7 +212,7 @@ pb_slabs_init(struct pb_slabs *slabs, slabs->slab_alloc = slab_alloc; slabs->slab_free = slab_free; - LIST_INITHEAD(&slabs->reclaim); + list_inithead(&slabs->reclaim); num_groups = slabs->num_orders * slabs->num_heaps; slabs->groups = CALLOC(num_groups, sizeof(*slabs->groups)); @@ -221,7 +221,7 @@ pb_slabs_init(struct pb_slabs *slabs, for (i = 0; i < num_groups; ++i) { struct pb_slab_group *group = &slabs->groups[i]; - LIST_INITHEAD(&group->slabs); + list_inithead(&group->slabs); } (void) mtx_init(&slabs->mutex, mtx_plain); @@ -241,7 +241,7 @@ pb_slabs_deinit(struct pb_slabs *slabs) /* Reclaim all slab entries (even those that are still in flight). This * implicitly calls slab_free for everything. */ - while (!LIST_IS_EMPTY(&slabs->reclaim)) { + while (!list_is_empty(&slabs->reclaim)) { struct pb_slab_entry *entry = LIST_ENTRY(struct pb_slab_entry, slabs->reclaim.next, head); pb_slab_reclaim(slabs, entry); |