svga: flush our command buffer after the 8th distinct render target

This helps improve the surface cache behaviour in the face of the
large number of single-use render targets generated by EXA and the xorg
state tracker.  Without this we can reference hundreds of individual
render targets from a command buffer, which leaves little scope for
sharing or reuse of those targets.

Flushing early means we can start reusing textures much sooner.

This shouldn't have much effect on normal 3d rendering as it's pretty
rare to have a command buffer with >8 different render targets in that
world.
This commit is contained in:
Keith Whitwell
2009-11-27 12:19:28 +00:00
parent b911688b87
commit b84b7f19df
3 changed files with 11 additions and 1 deletions

View File

@@ -231,6 +231,8 @@ void svga_context_flush( struct svga_context *svga,
{
struct svga_screen *svgascreen = svga_screen(svga->pipe.screen);
svga->curr.nr_fbs = 0;
/* Unmap upload manager buffers:
*/
u_upload_flush(svga->upload_vb);

View File

@@ -191,6 +191,11 @@ struct svga_state
struct pipe_framebuffer_state framebuffer;
float depthscale;
/* Hack to limit the number of different render targets between
* flushes. Helps avoid blowing out our surface cache in EXA.
*/
int nr_fbs;
struct pipe_poly_stipple poly_stipple;
struct pipe_scissor_state scissor;
struct pipe_blend_color blend_color;

View File

@@ -54,6 +54,9 @@ static int emit_framebuffer( struct svga_context *svga,
for(i = 0; i < PIPE_MAX_COLOR_BUFS; ++i) {
if (curr->cbufs[i] != hw->cbufs[i]) {
if (svga->curr.nr_fbs++ > 8)
return PIPE_ERROR_OUT_OF_MEMORY;
ret = SVGA3D_SetRenderTarget(svga->swc, SVGA3D_RT_COLOR0 + i, curr->cbufs[i]);
if (ret != PIPE_OK)
return ret;