diff options
author | Brian Paul <brianp@vmware.com> | 2015-06-15 19:14:42 -0600 |
---|---|---|
committer | Jose Fonseca <jfonseca@vmware.com> | 2015-11-09 11:25:59 +0000 |
commit | 75d1e363ff142b273b30d8cd236bb1c92c1b2f27 (patch) | |
tree | 087bf343f81b1a1202e6526939525a8372f7b81c /src | |
parent | 8083943e2e5b3f2a7201650a586b597dff481d43 (diff) | |
download | external_mesa3d-75d1e363ff142b273b30d8cd236bb1c92c1b2f27.zip external_mesa3d-75d1e363ff142b273b30d8cd236bb1c92c1b2f27.tar.gz external_mesa3d-75d1e363ff142b273b30d8cd236bb1c92c1b2f27.tar.bz2 |
st/wgl: fix double-present on swapbuffers bug
The stw_st_framebuffer_present_locked() function was getting called
twice per SwapBuffers. First, when st_context_iface::flush() was
called from DrvSwapBuffers() because the ST_FLUSH_FRONT flag was
given. Second, by stw_st_swap_framebuffer_locked() which does the
actual SwapBuffers.
Two code changes:
1. Pass ST_FLUSH_END_OF_FRAME, instead of ST_FLUSH_FRONT.
2. Move the implementation of stw_flush_current_locked() into
DrvSwapBuffers() since it's not called anywhere else.
Not much change in perf for benchmarks like Lightsmark, but some simple
Mesa demos are measurably faster.
Reviewed-by: José Fonseca <jfonseca@vmware.com>
Diffstat (limited to 'src')
-rw-r--r-- | src/gallium/state_trackers/wgl/stw_context.c | 12 | ||||
-rw-r--r-- | src/gallium/state_trackers/wgl/stw_context.h | 1 | ||||
-rw-r--r-- | src/gallium/state_trackers/wgl/stw_framebuffer.c | 19 |
3 files changed, 12 insertions, 20 deletions
diff --git a/src/gallium/state_trackers/wgl/stw_context.c b/src/gallium/state_trackers/wgl/stw_context.c index 19f0620..93f61e7 100644 --- a/src/gallium/state_trackers/wgl/stw_context.c +++ b/src/gallium/state_trackers/wgl/stw_context.c @@ -473,18 +473,6 @@ fail: return ret; } -/** - * Flush the current context if it is bound to the framebuffer. - */ -void -stw_flush_current_locked( struct stw_framebuffer *fb ) -{ - struct stw_context *ctx = stw_current_context(); - - if (ctx && ctx->current_framebuffer == fb) { - ctx->st->flush(ctx->st, ST_FLUSH_FRONT, NULL); - } -} /** * Notify the current context that the framebuffer has become invalid. diff --git a/src/gallium/state_trackers/wgl/stw_context.h b/src/gallium/state_trackers/wgl/stw_context.h index c66c166..6bfa715 100644 --- a/src/gallium/state_trackers/wgl/stw_context.h +++ b/src/gallium/state_trackers/wgl/stw_context.h @@ -60,7 +60,6 @@ HDC stw_get_current_dc( void ); BOOL stw_make_current( HDC hdc, DHGLRC dhglrc ); -void stw_flush_current_locked( struct stw_framebuffer *fb ); void stw_notify_current_locked( struct stw_framebuffer *fb ); #endif /* STW_CONTEXT_H */ diff --git a/src/gallium/state_trackers/wgl/stw_framebuffer.c b/src/gallium/state_trackers/wgl/stw_framebuffer.c index cd8990d..fbe77b2 100644 --- a/src/gallium/state_trackers/wgl/stw_framebuffer.c +++ b/src/gallium/state_trackers/wgl/stw_framebuffer.c @@ -605,15 +605,20 @@ DrvSwapBuffers(HDC hdc) return TRUE; } - /* Display the HUD */ ctx = stw_current_context(); - if (ctx && ctx->hud) { - struct pipe_resource *back = - stw_get_framebuffer_resource(fb->stfb, ST_ATTACHMENT_BACK_LEFT); - hud_draw(ctx->hud, back); - } + if (ctx) { + if (ctx->hud) { + /* Display the HUD */ + struct pipe_resource *back = + stw_get_framebuffer_resource(fb->stfb, ST_ATTACHMENT_BACK_LEFT); + hud_draw(ctx->hud, back); + } - stw_flush_current_locked(fb); + if (ctx->current_framebuffer == fb) { + /* flush current context */ + ctx->st->flush(ctx->st, ST_FLUSH_END_OF_FRAME, NULL); + } + } return stw_st_swap_framebuffer_locked(hdc, fb->stfb); } |