gallium: extend pipe_context::flush for it to accept an END_OF_FRAME flag
[mesa.git] / src / gallium / state_trackers / vega / api_context.c
index 47db102dd2de37c4fe3b036dd089e49eb16a9f2f..055277cd76e24a46a5330fd79e621ffec5b483d7 100644 (file)
 
 #include "VG/openvg.h"
 
+#include "vg_manager.h"
 #include "vg_context.h"
+#include "api.h"
 
 #include "pipe/p_context.h"
 #include "pipe/p_screen.h"
 
-VGErrorCode vgGetError(void)
+VGErrorCode vegaGetError(void)
 {
    struct vg_context *ctx = vg_current_context();
    VGErrorCode error = VG_NO_CONTEXT_ERROR;
@@ -45,7 +47,7 @@ VGErrorCode vgGetError(void)
    return error;
 }
 
-void vgFlush(void)
+void vegaFlush(void)
 {
    struct vg_context *ctx = vg_current_context();
    struct pipe_context *pipe;
@@ -54,10 +56,12 @@ void vgFlush(void)
       return;
 
    pipe = ctx->pipe;
-   pipe->flush(pipe, PIPE_FLUSH_RENDER_CACHE, NULL);
+   pipe->flush(pipe, NULL, 0);
+
+   vg_manager_flush_frontbuffer(ctx);
 }
 
-void vgFinish(void)
+void vegaFinish(void)
 {
    struct vg_context *ctx = vg_current_context();
    struct pipe_fence_handle *fence = NULL;
@@ -68,8 +72,10 @@ void vgFinish(void)
 
    pipe = ctx->pipe;
 
-   pipe->flush(pipe, PIPE_FLUSH_RENDER_CACHE | PIPE_FLUSH_FRAME, &fence);
-
-   pipe->screen->fence_finish(pipe->screen, fence, 0);
-   pipe->screen->fence_reference(pipe->screen, &fence, NULL);
+   pipe->flush(pipe, &fence, 0);
+   if (fence) {
+      pipe->screen->fence_finish(pipe->screen, fence,
+                                 PIPE_TIMEOUT_INFINITE);
+      pipe->screen->fence_reference(pipe->screen, &fence, NULL);
+   }
 }