X-Git-Url: https://git.libre-soc.org/?a=blobdiff_plain;f=src%2Fgallium%2Fdrivers%2Fsvga%2Fsvga_context.c;h=436961b1ecd591c8690625e2503cd532fd308c31;hb=1691e29e62a6a0b5fa7a5f53b308b2a327a11eab;hp=ffecef59eb9e1525f8503af463d6432ab5b3cc6f;hpb=2781d603753148771c1a706150b7a9a54592befe;p=mesa.git diff --git a/src/gallium/drivers/svga/svga_context.c b/src/gallium/drivers/svga/svga_context.c index ffecef59eb9..436961b1ecd 100644 --- a/src/gallium/drivers/svga/svga_context.c +++ b/src/gallium/drivers/svga/svga_context.c @@ -50,7 +50,6 @@ DEBUG_GET_ONCE_BOOL_OPTION(no_swtnl, "SVGA_NO_SWTNL", FALSE) DEBUG_GET_ONCE_BOOL_OPTION(force_swtnl, "SVGA_FORCE_SWTNL", FALSE); DEBUG_GET_ONCE_BOOL_OPTION(use_min_mipmap, "SVGA_USE_MIN_MIPMAP", FALSE); -DEBUG_GET_ONCE_NUM_OPTION(disable_shader, "SVGA_DISABLE_SHADER", ~0); DEBUG_GET_ONCE_BOOL_OPTION(no_line_width, "SVGA_NO_LINE_WIDTH", FALSE); DEBUG_GET_ONCE_BOOL_OPTION(force_hw_line_stipple, "SVGA_FORCE_HW_LINE_STIPPLE", FALSE); @@ -102,6 +101,7 @@ static void svga_destroy( struct pipe_context *pipe ) util_bitmask_destroy(svga->stream_output_id_bm); util_bitmask_destroy(svga->query_id_bm); u_upload_destroy(svga->const0_upload); + svga_texture_transfer_map_upload_destroy(svga); /* free user's constant buffers */ for (shader = 0; shader < PIPE_SHADER_TYPES; ++shader) { @@ -162,7 +162,6 @@ struct pipe_context *svga_context_create(struct pipe_screen *screen, svga->debug.no_swtnl = debug_get_option_no_swtnl(); svga->debug.force_swtnl = debug_get_option_force_swtnl(); svga->debug.use_min_mipmap = debug_get_option_use_min_mipmap(); - svga->debug.disable_shader = debug_get_option_disable_shader(); svga->debug.no_line_width = debug_get_option_no_line_width(); svga->debug.force_hw_line_stipple = debug_get_option_force_hw_line_stipple(); @@ -214,6 +213,9 @@ struct pipe_context *svga_context_create(struct pipe_screen *screen, if (!svga->const0_upload) goto cleanup; + if (!svga_texture_transfer_map_upload_create(svga)) + goto cleanup; + /* Avoid shortcircuiting state with initial value of zero. */ memset(&svga->state.hw_clear, 0xcd, sizeof(svga->state.hw_clear)); @@ -229,6 +231,8 @@ struct pipe_context *svga_context_create(struct pipe_screen *screen, memset(svga->state.hw_draw.sampler_views, 0, sizeof(svga->state.hw_draw.sampler_views)); svga->state.hw_draw.num_views = 0; + svga->state.hw_draw.num_rendertargets = 0; + svga->state.hw_draw.dsv = NULL; /* Initialize the shader pointers */ svga->state.hw_draw.vs = NULL; @@ -246,6 +250,8 @@ struct pipe_context *svga_context_create(struct pipe_screen *screen, svga->state.hw_draw.num_vbuffers = 0; memset(svga->state.hw_draw.vbuffers, 0, sizeof(svga->state.hw_draw.vbuffers)); + svga->state.hw_draw.const0_buffer = NULL; + svga->state.hw_draw.const0_handle = NULL; /* Create a no-operation blend state which we will bind whenever the * requested blend state is impossible (e.g. due to having an integer @@ -267,6 +273,7 @@ struct pipe_context *svga_context_create(struct pipe_screen *screen, } svga->dirty = ~0; + svga->pred.query_id = SVGA3D_INVALID_ID; return &svga->pipe; @@ -275,6 +282,7 @@ cleanup: if (svga->const0_upload) u_upload_destroy(svga->const0_upload); + svga_texture_transfer_map_upload_destroy(svga); if (svga->hwtnl) svga_hwtnl_destroy(svga->hwtnl); if (svga->swc) @@ -305,6 +313,17 @@ void svga_context_flush( struct svga_context *svga, svga->curr.nr_fbs = 0; + /* Unmap the 0th/default constant buffer. The u_upload_unmap() function + * will call pipe_context::transfer_flush_region() to indicate the + * region of the buffer which was modified (and needs to be uploaded). + */ + if (svga->state.hw_draw.const0_handle) { + assert(svga->state.hw_draw.const0_buffer); + u_upload_unmap(svga->const0_upload); + pipe_resource_reference(&svga->state.hw_draw.const0_buffer, NULL); + svga->state.hw_draw.const0_handle = NULL; + } + /* Ensure that texture dma uploads are processed * before submitting commands. */ @@ -323,6 +342,8 @@ void svga_context_flush( struct svga_context *svga, svga_screen_cache_flush(svgascreen, fence); + SVGA3D_ResetLastCommand(svga->swc); + /* To force the re-emission of rendertargets and texture sampler bindings on * the next command buffer. */ @@ -365,9 +386,13 @@ svga_context_finish(struct svga_context *svga) struct pipe_screen *screen = svga->pipe.screen; struct pipe_fence_handle *fence = NULL; + SVGA_STATS_TIME_PUSH(svga_sws(svga), SVGA_STATS_TIME_CONTEXTFINISH); + svga_context_flush(svga, &fence); screen->fence_finish(screen, NULL, fence, PIPE_TIMEOUT_INFINITE); screen->fence_reference(screen, &fence, NULL); + + SVGA_STATS_TIME_POP(svga_sws(svga)); } @@ -408,24 +433,15 @@ void svga_hwtnl_flush_buffer( struct svga_context *svga, */ void svga_surfaces_flush(struct svga_context *svga) { - struct svga_screen *svgascreen = svga_screen(svga->pipe.screen); - unsigned i; - SVGA_STATS_TIME_PUSH(svga_sws(svga), SVGA_STATS_TIME_SURFACEFLUSH); /* Emit buffered drawing commands. */ svga_hwtnl_flush_retry( svga ); - /* Emit back-copy from render target view to texture. + /* Emit back-copy from render target views to textures. */ - for (i = 0; i < svgascreen->max_color_buffers; i++) { - if (svga->curr.framebuffer.cbufs[i]) - svga_propagate_surface(svga, svga->curr.framebuffer.cbufs[i]); - } - - if (svga->curr.framebuffer.zsbuf) - svga_propagate_surface(svga, svga->curr.framebuffer.zsbuf); + svga_propagate_rendertargets(svga); SVGA_STATS_TIME_POP(svga_sws(svga)); }