[Mesa-dev] [PATCH 2/5] st/mesa: remove redundant flushes from st_flush
Nicolai Hähnle
nhaehnle at gmail.com
Sun Oct 22 19:18:09 UTC 2017
From: Nicolai Hähnle <nicolai.haehnle at amd.com>
st_flush should flush state tracker-internal state and the pipe, but
not mesa/main state. Of the four callers:
- glFlush/glFinish already call FLUSH_{VERTICES,STATE}.
- st_vdpau doesn't need to call them.
- st_manager will now call them explicitly.
---
src/mesa/state_tracker/st_cb_flush.c | 3 ---
src/mesa/state_tracker/st_manager.c | 3 +++
src/mesa/state_tracker/st_vdpau.c | 3 +++
3 files changed, 6 insertions(+), 3 deletions(-)
diff --git a/src/mesa/state_tracker/st_cb_flush.c b/src/mesa/state_tracker/st_cb_flush.c
index d9ec0a846a7..c8452d0e6f7 100644
--- a/src/mesa/state_tracker/st_cb_flush.c
+++ b/src/mesa/state_tracker/st_cb_flush.c
@@ -43,23 +43,20 @@
#include "pipe/p_context.h"
#include "pipe/p_defines.h"
#include "pipe/p_screen.h"
#include "util/u_gen_mipmap.h"
void st_flush(struct st_context *st,
struct pipe_fence_handle **fence,
unsigned flags)
{
- FLUSH_VERTICES(st->ctx, 0);
- FLUSH_CURRENT(st->ctx, 0);
-
st_flush_bitmap_cache(st);
st->pipe->flush(st->pipe, fence, flags);
}
/**
* Flush, and wait for completion.
*/
void st_finish( struct st_context *st )
diff --git a/src/mesa/state_tracker/st_manager.c b/src/mesa/state_tracker/st_manager.c
index eebde621837..a63bcd89d4f 100644
--- a/src/mesa/state_tracker/st_manager.c
+++ b/src/mesa/state_tracker/st_manager.c
@@ -38,20 +38,21 @@
#include "main/fbobject.h"
#include "main/renderbuffer.h"
#include "main/version.h"
#include "util/hash_table.h"
#include "st_texture.h"
#include "st_context.h"
#include "st_debug.h"
#include "st_extensions.h"
#include "st_format.h"
+#include "st_cb_bitmap.h"
#include "st_cb_fbo.h"
#include "st_cb_flush.h"
#include "st_manager.h"
#include "state_tracker/st_gl_api.h"
#include "pipe/p_context.h"
#include "pipe/p_screen.h"
#include "util/u_format.h"
#include "util/u_pointer.h"
@@ -627,20 +628,22 @@ static void
st_context_flush(struct st_context_iface *stctxi, unsigned flags,
struct pipe_fence_handle **fence)
{
struct st_context *st = (struct st_context *) stctxi;
unsigned pipe_flags = 0;
if (flags & ST_FLUSH_END_OF_FRAME) {
pipe_flags |= PIPE_FLUSH_END_OF_FRAME;
}
+ FLUSH_VERTICES(st->ctx, 0);
+ FLUSH_CURRENT(st->ctx, 0);
st_flush(st, fence, pipe_flags);
if ((flags & ST_FLUSH_WAIT) && fence && *fence) {
st->pipe->screen->fence_finish(st->pipe->screen, NULL, *fence,
PIPE_TIMEOUT_INFINITE);
st->pipe->screen->fence_reference(st->pipe->screen, fence, NULL);
}
if (flags & ST_FLUSH_FRONT)
st_manager_flush_frontbuffer(st);
diff --git a/src/mesa/state_tracker/st_vdpau.c b/src/mesa/state_tracker/st_vdpau.c
index 19611e719a1..e0126cc03d8 100644
--- a/src/mesa/state_tracker/st_vdpau.c
+++ b/src/mesa/state_tracker/st_vdpau.c
@@ -255,20 +255,23 @@ st_vdpau_unmap_surface(struct gl_context *ctx, GLenum target, GLenum access,
pipe_resource_reference(&stObj->pt, NULL);
st_texture_release_all_sampler_views(st, stObj);
pipe_resource_reference(&stImage->pt, NULL);
stObj->level_override = 0;
stObj->layer_override = 0;
_mesa_dirty_texobj(ctx, texObj);
+ /* NV_vdpau_interop does not specify an explicit synchronization mechanism
+ * between the GL and VDPAU contexts. Provide automatic synchronization here.
+ */
st_flush(st, NULL, 0);
}
#endif
void
st_init_vdpau_functions(struct dd_function_table *functions)
{
#ifdef HAVE_ST_VDPAU
functions->VDPAUMapSurface = st_vdpau_map_surface;
--
2.11.0
More information about the mesa-dev
mailing list