From 0be216c526c29726a73a26a37dcd5a00cfbefc86 Mon Sep 17 00:00:00 2001 From: =?utf8?q?Jos=C3=A9=20Fonseca?= Date: Tue, 24 Feb 2009 15:49:21 +0000 Subject: [PATCH] pipebuffer: Allow asymmetric guard sizes for under/overflow detection. --- src/gallium/auxiliary/pipebuffer/pb_bufmgr.h | 5 +++-- .../auxiliary/pipebuffer/pb_bufmgr_debug.c | 16 ++++++++++------ 2 files changed, 13 insertions(+), 8 deletions(-) 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; } -- 2.30.2