From b9e2cde6006b557a3a23a82384899f4d5a5ac7b8 Mon Sep 17 00:00:00 2001 From: Marek Olšák Date: Tue, 15 Feb 2011 05:43:44 +0100 Subject: r300g: offload the CS ioctl to another thread This is a multi-threading optimization which hides the kernel overhead behind a thread. It improves performance in CPU-limited apps by 2-15%. Of course you must have at least 2 cores for it to make any difference. It can be disabled with: export RADEON_THREAD=0 --- src/gallium/drivers/r300/r300_flush.c | 4 ++++ src/gallium/drivers/r300/r300_winsys.h | 11 +++++++++-- 2 files changed, 13 insertions(+), 2 deletions(-) (limited to 'src/gallium/drivers/r300') diff --git a/src/gallium/drivers/r300/r300_flush.c b/src/gallium/drivers/r300/r300_flush.c index bfc15ceae7..c4bb332aec 100644 --- a/src/gallium/drivers/r300/r300_flush.c +++ b/src/gallium/drivers/r300/r300_flush.c @@ -94,6 +94,10 @@ static void r300_flush(struct pipe_context* pipe, r300->rws->cs_flush(r300->cs); } } + + if (flags & PIPE_FLUSH_FRAME) { + r300->rws->cs_sync_flush(r300->cs); + } } void r300_init_flush_functions(struct r300_context* r300) diff --git a/src/gallium/drivers/r300/r300_winsys.h b/src/gallium/drivers/r300/r300_winsys.h index bf1dd5c980..6733253ccc 100644 --- a/src/gallium/drivers/r300/r300_winsys.h +++ b/src/gallium/drivers/r300/r300_winsys.h @@ -45,8 +45,8 @@ struct r300_winsys_screen; struct r300_winsys_cs_handle; /* for write_reloc etc. */ struct r300_winsys_cs { - unsigned cdw; /* Number of used dwords. */ - uint32_t buf[R300_MAX_CMDBUF_DWORDS]; /* The command buffer. */ + unsigned cdw; /* Number of used dwords. */ + uint32_t *buf; /* The command buffer. */ }; enum r300_value_id { @@ -268,6 +268,13 @@ struct r300_winsys_screen { */ void (*cs_flush)(struct r300_winsys_cs *cs); + /** + * Wait until the last flush is completed. + * + * \param cs A command stream. + */ + void (*cs_sync_flush)(struct r300_winsys_cs *cs); + /** * Set a flush callback which is called from winsys when flush is * required. -- cgit v1.2.3