From 7e83c15fa01c04c12b7aab9dd2e7ab0ae193b1c3 Mon Sep 17 00:00:00 2001 From: Dave Airlie Date: Tue, 9 Oct 2007 12:18:50 +1000 Subject: i915: fixup up bufmgr to pass num buffers to kernel remove unneeded entry points --- src/mesa/drivers/dri/common/dri_bufmgr.c | 16 ++------------ src/mesa/drivers/dri/common/dri_bufmgr.h | 31 ++------------------------- src/mesa/drivers/dri/common/dri_bufmgr_fake.c | 19 ++++++++-------- 3 files changed, 14 insertions(+), 52 deletions(-) (limited to 'src/mesa/drivers/dri/common') diff --git a/src/mesa/drivers/dri/common/dri_bufmgr.c b/src/mesa/drivers/dri/common/dri_bufmgr.c index 91caa8757d..83886480dd 100644 --- a/src/mesa/drivers/dri/common/dri_bufmgr.c +++ b/src/mesa/drivers/dri/common/dri_bufmgr.c @@ -88,18 +88,6 @@ dri_bo_unmap(dri_bo *buf) return buf->bufmgr->bo_unmap(buf); } -int -dri_bo_validate(dri_bo *buf, unsigned int flags) -{ - return buf->bufmgr->bo_validate(buf, flags); -} - -dri_fence * -dri_fence_validated(dri_bufmgr *bufmgr, const char *name, GLboolean flushed) -{ - return bufmgr->fence_validated(bufmgr, name, flushed); -} - void dri_fence_wait(dri_fence *fence) { @@ -157,9 +145,9 @@ void dri_emit_reloc(dri_bo *batch_buf, GLuint flags, GLuint delta, GLuint offset batch_buf->bufmgr->emit_reloc(batch_buf, flags, delta, offset, relocatee); } -void *dri_process_relocs(dri_bo *batch_buf) +void *dri_process_relocs(dri_bo *batch_buf, GLuint *count) { - return batch_buf->bufmgr->process_relocs(batch_buf); + return batch_buf->bufmgr->process_relocs(batch_buf, count); } void dri_post_submit(dri_bo *batch_buf, dri_fence **last_fence) diff --git a/src/mesa/drivers/dri/common/dri_bufmgr.h b/src/mesa/drivers/dri/common/dri_bufmgr.h index 46e41f9bec..7dbb558949 100644 --- a/src/mesa/drivers/dri/common/dri_bufmgr.h +++ b/src/mesa/drivers/dri/common/dri_bufmgr.h @@ -116,30 +116,6 @@ struct _dri_bufmgr { /** Reduces the refcount on the userspace mapping of the buffer object. */ int (*bo_unmap)(dri_bo *buf); - /** - * Makes the buffer accessible to the graphics chip. - * - * The resulting offset of the buffer within the graphics aperture is then - * available at buf->offset until the buffer is fenced. - * - * Flags should consist of the memory types that the buffer may be validated - * into and the read/write/exe flags appropriate to the use of the buffer. - */ - int (*bo_validate)(dri_bo *buf, unsigned int flags); - - /** - * Associates the current set of validated buffers with a fence. - * - * Once fenced, the buffer manager will allow the validated buffers to be - * evicted when the graphics device's execution has passed the fence - * command. - * - * The fence object will have flags for the sum of the read/write/exe flags - * of the validated buffers associated with it. - */ - dri_fence * (*fence_validated)(dri_bufmgr *bufmgr, const char *name, - GLboolean flushed); - /** Takes a reference on a fence object */ void (*fence_reference)(dri_fence *fence); @@ -164,7 +140,7 @@ struct _dri_bufmgr { */ void (*emit_reloc)(dri_bo *batch_buf, GLuint flags, GLuint delta, GLuint offset, dri_bo *relocatee); - void *(*process_relocs)(dri_bo *batch_buf); + void *(*process_relocs)(dri_bo *batch_buf, GLuint *count); void (*post_submit)(dri_bo *batch_buf, dri_fence **fence); }; @@ -178,9 +154,6 @@ void dri_bo_reference(dri_bo *bo); void dri_bo_unreference(dri_bo *bo); int dri_bo_map(dri_bo *buf, GLboolean write_enable); int dri_bo_unmap(dri_bo *buf); -int dri_bo_validate(dri_bo *buf, unsigned int flags); -dri_fence *dri_fence_validated(dri_bufmgr *bufmgr, const char *name, - GLboolean flushed); void dri_fence_wait(dri_fence *fence); void dri_fence_reference(dri_fence *fence); void dri_fence_unreference(dri_fence *fence); @@ -205,7 +178,7 @@ dri_bo *dri_ttm_bo_create_from_handle(dri_bufmgr *bufmgr, const char *name, unsigned int handle); void dri_emit_reloc(dri_bo *batch_buf, GLuint flags, GLuint delta, GLuint offset, dri_bo *relocatee); -void *dri_process_relocs(dri_bo *batch_buf); +void *dri_process_relocs(dri_bo *batch_buf, uint32_t *count); void dri_post_process_relocs(dri_bo *batch_buf); void dri_post_submit(dri_bo *batch_buf, dri_fence **last_fence); #endif diff --git a/src/mesa/drivers/dri/common/dri_bufmgr_fake.c b/src/mesa/drivers/dri/common/dri_bufmgr_fake.c index adf0cf5ab7..bda45d921c 100644 --- a/src/mesa/drivers/dri/common/dri_bufmgr_fake.c +++ b/src/mesa/drivers/dri/common/dri_bufmgr_fake.c @@ -881,11 +881,12 @@ relocation_sort(const void *a_in, const void *b_in) { } static void * -dri_fake_process_reloc(dri_bo *batch_buf) +dri_fake_process_relocs(dri_bo *batch_buf, GLuint *count_p) { dri_bufmgr_fake *bufmgr_fake = (dri_bufmgr_fake *)batch_buf->bufmgr; GLuint i; GLuint *ptr; + GLuint count = 0; assert(batch_buf->virtual != NULL); ptr = batch_buf->virtual; @@ -926,23 +927,25 @@ dri_fake_process_reloc(dri_bo *batch_buf) /* Validate. If we fail, fence to clear the unfenced list and bail * out. */ - ret = dri_bo_validate(r->buf, validate_flags); + ret = dri_fake_bo_validate(r->buf, validate_flags); if (ret != 0) { dri_fence *fo; dri_bo_unmap(batch_buf); - fo = dri_fence_validated(batch_buf->bufmgr, - "batchbuffer failure fence", GL_TRUE); + fo = dri_fake_fence_validated(batch_buf->bufmgr, + "batchbuffer failure fence", GL_TRUE); dri_fence_unreference(fo); goto done; } + count++; } ptr[r->offset / 4] = r->buf->offset + r->delta; dri_bo_unreference(r->buf); } dri_bo_unmap(batch_buf); - dri_bo_validate(batch_buf, DRM_BO_FLAG_MEM_TT | DRM_BO_FLAG_EXE); + dri_fake_bo_validate(batch_buf, DRM_BO_FLAG_MEM_TT | DRM_BO_FLAG_EXE); + *count_p = count; bufmgr_fake->nr_relocs = 0; done: return NULL; @@ -954,7 +957,7 @@ dri_fake_post_submit(dri_bo *batch_buf, dri_fence **last_fence) dri_bufmgr_fake *bufmgr_fake = (dri_bufmgr_fake *)batch_buf->bufmgr; dri_fence *fo; - fo = dri_fence_validated(batch_buf->bufmgr, "Batch fence", GL_TRUE); + fo = dri_fake_fence_validated(batch_buf->bufmgr, "Batch fence", GL_TRUE); if (bufmgr_fake->performed_rendering) { dri_fence_unreference(*last_fence); @@ -994,14 +997,12 @@ dri_bufmgr_fake_init(unsigned long low_offset, void *low_virtual, bufmgr_fake->bufmgr.bo_unreference = dri_fake_bo_unreference; bufmgr_fake->bufmgr.bo_map = dri_fake_bo_map; bufmgr_fake->bufmgr.bo_unmap = dri_fake_bo_unmap; - bufmgr_fake->bufmgr.bo_validate = dri_fake_bo_validate; - bufmgr_fake->bufmgr.fence_validated = dri_fake_fence_validated; bufmgr_fake->bufmgr.fence_wait = dri_fake_fence_wait; bufmgr_fake->bufmgr.fence_reference = dri_fake_fence_reference; bufmgr_fake->bufmgr.fence_unreference = dri_fake_fence_unreference; bufmgr_fake->bufmgr.destroy = dri_fake_destroy; bufmgr_fake->bufmgr.emit_reloc = dri_fake_emit_reloc; - bufmgr_fake->bufmgr.process_relocs = dri_fake_process_reloc; + bufmgr_fake->bufmgr.process_relocs = dri_fake_process_relocs; bufmgr_fake->bufmgr.post_submit = dri_fake_post_submit; bufmgr_fake->fence_emit = fence_emit; bufmgr_fake->fence_wait = fence_wait; -- cgit v1.2.3