summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorMarek Olšák <marek.olsak@amd.com>2020-01-22 19:14:50 -0500
committerMarek Olšák <marek.olsak@amd.com>2020-03-09 21:26:55 -0400
commit7b0e043d486d06a17329b38f41a8e3703c85d356 (patch)
tree9c39e9e2abfca45d9813a075e7d9b124fed59e29
parent45d4665dc749fa52cc165d8d22356c8d8b5b3e22 (diff)
st/mesa: flush the bitmap cache before st/dri and vbo flushes
Reviewed-by: Dave Airlie <airlied@redhat.com> Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/3986>
-rw-r--r--src/mesa/state_tracker/st_cb_flush.c5
-rw-r--r--src/mesa/state_tracker/st_manager.c4
2 files changed, 7 insertions, 2 deletions
diff --git a/src/mesa/state_tracker/st_cb_flush.c b/src/mesa/state_tracker/st_cb_flush.c
index 36f7f2320c8..08b645433ac 100644
--- a/src/mesa/state_tracker/st_cb_flush.c
+++ b/src/mesa/state_tracker/st_cb_flush.c
@@ -52,8 +52,6 @@ st_flush(struct st_context *st,
struct pipe_fence_handle **fence,
unsigned flags)
{
- st_flush_bitmap_cache(st);
-
/* We want to call this function periodically.
* Typically, it has nothing to do so it shouldn't be expensive.
*/
@@ -71,6 +69,7 @@ st_finish(struct st_context *st)
{
struct pipe_fence_handle *fence = NULL;
+ st_flush_bitmap_cache(st);
st_flush(st, &fence, PIPE_FLUSH_ASYNC | PIPE_FLUSH_HINT_FINISH);
if (fence) {
@@ -92,6 +91,8 @@ st_glFlush(struct gl_context *ctx)
{
struct st_context *st = st_context(ctx);
+ st_flush_bitmap_cache(st);
+
/* Don't call st_finish() here. It is not the state tracker's
* responsibilty to inject sleeps in the hope of avoiding buffer
* synchronization issues. Calling finish() here will just hide
diff --git a/src/mesa/state_tracker/st_manager.c b/src/mesa/state_tracker/st_manager.c
index f3954039feb..99404015c32 100644
--- a/src/mesa/state_tracker/st_manager.c
+++ b/src/mesa/state_tracker/st_manager.c
@@ -661,6 +661,10 @@ st_context_flush(struct st_context_iface *stctxi, unsigned flags,
if (flags & ST_FLUSH_FENCE_FD)
pipe_flags |= PIPE_FLUSH_FENCE_FD;
+ /* If both the bitmap cache is dirty and there are unflushed vertices,
+ * it means that glBitmap was called first and then glBegin.
+ */
+ st_flush_bitmap_cache(st);
FLUSH_VERTICES(st->ctx, 0);
/* Notify the caller that we're ready to flush */