From: José Fonseca Date: Wed, 16 Mar 2011 15:43:00 +0000 (+0000) Subject: svga: Hardcode SVGA_COMBINE_USERBUFFERS to 1. X-Git-Url: https://git.libre-soc.org/?a=commitdiff_plain;h=74651f5738032466fceede8b8f0c3ce29a770551;p=mesa.git svga: Hardcode SVGA_COMBINE_USERBUFFERS to 1. The code no longer supports otherwise -- it relies on buffers being uploaded via u_upload_mgr -- so make this clear. Also, there's no need to flush after draws from user buffers, given all user content should have been copied by then. --- diff --git a/src/gallium/drivers/svga/svga_pipe_draw.c b/src/gallium/drivers/svga/svga_pipe_draw.c index fda5c28433c..2093bcae101 100644 --- a/src/gallium/drivers/svga/svga_pipe_draw.c +++ b/src/gallium/drivers/svga/svga_pipe_draw.c @@ -73,12 +73,6 @@ retry_draw_range_elements( struct svga_context *svga, if (ret) goto retry; - if (svga->curr.any_user_vertex_buffers) { - ret = svga_hwtnl_flush( svga->hwtnl ); - if (ret) - goto retry; - } - return PIPE_OK; retry: @@ -122,12 +116,6 @@ retry_draw_arrays( struct svga_context *svga, if (ret) goto retry; - if (svga->curr.any_user_vertex_buffers) { - ret = svga_hwtnl_flush( svga->hwtnl ); - if (ret) - goto retry; - } - return 0; retry: diff --git a/src/gallium/drivers/svga/svga_resource_buffer.h b/src/gallium/drivers/svga/svga_resource_buffer.h index a689fcb3bb7..95032213fa5 100644 --- a/src/gallium/drivers/svga/svga_resource_buffer.h +++ b/src/gallium/drivers/svga/svga_resource_buffer.h @@ -90,7 +90,9 @@ struct svga_buffer * Host surface handle. * * This is a platform independent abstraction for host SID. We create when - * trying to bind + * trying to bind. + * + * Only set for non-user buffers. */ struct svga_winsys_surface *handle; @@ -135,6 +137,8 @@ struct svga_buffer * A piece of GMR memory, with the same size of the buffer. It is created * when mapping the buffer, and will be used to upload vertex data to the * host. + * + * Only set for non-user buffers. */ struct svga_winsys_buffer *hwbuf; diff --git a/src/gallium/drivers/svga/svga_resource_buffer_upload.c b/src/gallium/drivers/svga/svga_resource_buffer_upload.c index 0bfa8a14a6f..e1cff3219bd 100644 --- a/src/gallium/drivers/svga/svga_resource_buffer_upload.c +++ b/src/gallium/drivers/svga/svga_resource_buffer_upload.c @@ -131,6 +131,8 @@ enum pipe_error svga_buffer_create_host_surface(struct svga_screen *ss, struct svga_buffer *sbuf) { + assert(!sbuf->user); + if(!sbuf->handle) { sbuf->key.flags = 0; @@ -665,6 +667,9 @@ svga_redefine_user_buffer(struct pipe_context *pipe, struct svga_buffer *sbuf = svga_buffer(resource); assert(sbuf->user); + assert(!sbuf->dma.pending); + assert(!sbuf->handle); + assert(!sbuf->hwbuf); /* * Release any uploaded user buffer. @@ -677,26 +682,7 @@ svga_redefine_user_buffer(struct pipe_context *pipe, pipe_mutex_lock(ss->swc_mutex); - if (offset + size > resource->width0) { - /* - * User buffers shouldn't have DMA directly, unless - * SVGA_COMBINE_USERBUFFERS is not set. - */ - - if (sbuf->dma.pending) { - svga_buffer_upload_flush(svga, sbuf); - } - - if (sbuf->handle) { - svga_buffer_destroy_host_surface(ss, sbuf); - } - - if (sbuf->hwbuf) { - svga_buffer_destroy_hw_storage(ss, sbuf); - } - - sbuf->key.size.width = sbuf->b.b.width0 = offset + size; - } + sbuf->key.size.width = sbuf->b.b.width0 = offset + size; pipe_mutex_unlock(ss->swc_mutex); diff --git a/src/gallium/drivers/svga/svga_screen.h b/src/gallium/drivers/svga/svga_screen.h index 7ef627f928d..6d8d287ce95 100644 --- a/src/gallium/drivers/svga/svga_screen.h +++ b/src/gallium/drivers/svga/svga_screen.h @@ -39,8 +39,6 @@ struct svga_winsys_screen; struct svga_winsys_context; struct SVGACmdMemory; -#define SVGA_COMBINE_USERBUFFERS 1 - /** * Subclass of pipe_screen */ diff --git a/src/gallium/drivers/svga/svga_state_vdecl.c b/src/gallium/drivers/svga/svga_state_vdecl.c index 2f85f9488f9..d65c6f66c1e 100644 --- a/src/gallium/drivers/svga/svga_state_vdecl.c +++ b/src/gallium/drivers/svga/svga_state_vdecl.c @@ -149,9 +149,7 @@ static int emit_hw_vdecl( struct svga_context *svga, * userbuffers now and try to combine multiple userbuffers from * multiple draw calls into a single host buffer for performance. */ - if (svga->curr.any_user_vertex_buffers && - SVGA_COMBINE_USERBUFFERS) - { + if (svga->curr.any_user_vertex_buffers) { ret = upload_user_buffers( svga ); if (ret) return ret;