From: José Fonseca Date: Tue, 24 Feb 2009 15:49:21 +0000 (+0000) Subject: pipebuffer: Allow asymmetric guard sizes for under/overflow detection. X-Git-Url: https://git.libre-soc.org/?a=commitdiff_plain;h=0be216c526c29726a73a26a37dcd5a00cfbefc86;p=mesa.git pipebuffer: Allow asymmetric guard sizes for under/overflow detection. --- diff --git a/src/gallium/auxiliary/pipebuffer/pb_bufmgr.h b/src/gallium/auxiliary/pipebuffer/pb_bufmgr.h index fec8db91c71..74077f82774 100644 --- a/src/gallium/auxiliary/pipebuffer/pb_bufmgr.h +++ b/src/gallium/auxiliary/pipebuffer/pb_bufmgr.h @@ -200,10 +200,11 @@ pb_ondemand_manager_create(struct pb_manager *provider); /** * Debug buffer manager to detect buffer under- and overflows. * - * Band size should be a multiple of the largest alignment + * Under/overflow sizes should be a multiple of the largest alignment */ struct pb_manager * -pb_debug_manager_create(struct pb_manager *provider, size_t band_size); +pb_debug_manager_create(struct pb_manager *provider, + size_t underflow_size, size_t overflow_size); #ifdef __cplusplus diff --git a/src/gallium/auxiliary/pipebuffer/pb_bufmgr_debug.c b/src/gallium/auxiliary/pipebuffer/pb_bufmgr_debug.c index 070bf3f5173..21079b8bfd7 100644 --- a/src/gallium/auxiliary/pipebuffer/pb_bufmgr_debug.c +++ b/src/gallium/auxiliary/pipebuffer/pb_bufmgr_debug.c @@ -78,7 +78,8 @@ struct pb_debug_manager struct pb_manager *provider; - size_t band_size; + size_t underflow_size; + size_t overflow_size; }; @@ -301,7 +302,7 @@ pb_debug_manager_create_buffer(struct pb_manager *_mgr, if(!buf) return NULL; - real_size = size + 2*mgr->band_size; + real_size = mgr->underflow_size + size + mgr->overflow_size; real_desc = *desc; real_desc.usage |= PIPE_BUFFER_USAGE_CPU_WRITE; real_desc.usage |= PIPE_BUFFER_USAGE_CPU_READ; @@ -327,7 +328,7 @@ pb_debug_manager_create_buffer(struct pb_manager *_mgr, buf->base.vtbl = &pb_debug_buffer_vtbl; buf->mgr = mgr; - buf->underflow_size = mgr->band_size; + buf->underflow_size = mgr->underflow_size; buf->overflow_size = buf->buffer->base.size - buf->underflow_size - size; pb_debug_buffer_fill(buf); @@ -356,7 +357,8 @@ pb_debug_manager_destroy(struct pb_manager *_mgr) struct pb_manager * -pb_debug_manager_create(struct pb_manager *provider, size_t band_size) +pb_debug_manager_create(struct pb_manager *provider, + size_t underflow_size, size_t overflow_size) { struct pb_debug_manager *mgr; @@ -371,7 +373,8 @@ pb_debug_manager_create(struct pb_manager *provider, size_t band_size) mgr->base.create_buffer = pb_debug_manager_create_buffer; mgr->base.flush = pb_debug_manager_flush; mgr->provider = provider; - mgr->band_size = band_size; + mgr->underflow_size = underflow_size; + mgr->overflow_size = overflow_size; return &mgr->base; } @@ -381,7 +384,8 @@ pb_debug_manager_create(struct pb_manager *provider, size_t band_size) struct pb_manager * -pb_debug_manager_create(struct pb_manager *provider, size_t band_size) +pb_debug_manager_create(struct pb_manager *provider, + size_t underflow_size, size_t overflow_size) { return provider; }