YaGL/VIGS: Return glFinish 61/12761/1
authorStanislav Vorobiov <s.vorobiov@samsung.com>
Thu, 21 Nov 2013 10:36:07 +0000 (14:36 +0400)
committerStanislav Vorobiov <s.vorobiov@samsung.com>
Thu, 21 Nov 2013 10:36:07 +0000 (14:36 +0400)
Though we use single host thread for all OpenGL operations
it's still not guaranteed that commands in different contexts will
be processed in order, thus, single glFinish in VIGS will not wait
for GL commands to be processed in YaGL. Because of this contents
of windows on target may appear incomplete, this was observed on
Mac OS X in particular. glFinish will reduce performance, but it'll
ensure correct rendering. Later we'll implement another approach
that'll use GL fences in order not to wait for rendering to be
completed

Change-Id: I4eae90b73f4d66cd8c7fa1939db1c18ad9751051

hw/vigs/vigs_gl_backend.c
hw/yagl/yagl_backends/egl_onscreen/yagl_egl_onscreen_surface.c

index f0f94bf841a0ea416783656565faa1523a5ebfd6..dc50908c8941ffc3920e3b2eb079136e3cd723f5 100644 (file)
@@ -326,14 +326,6 @@ static void vigs_gl_backend_batch_start(struct vigs_backend *backend)
     if (!gl_backend->make_current(gl_backend, true)) {
         VIGS_LOG_CRITICAL("make_current failed");
     }
-
-    /*
-     * Wait until previous rendering is finished. If we don't do this
-     * then in case if vsync is off many frames will be batched together and
-     * then flushed once the display is finally updated. This can cause lags
-     * on some GPUs.
-     */
-    gl_backend->Finish();
 }
 
 /*
@@ -836,6 +828,7 @@ static void vigs_gl_backend_batch_end(struct vigs_backend *backend)
 {
     struct vigs_gl_backend *gl_backend = (struct vigs_gl_backend*)backend;
 
+    gl_backend->Finish();
     gl_backend->make_current(gl_backend, false);
 }
 
index 428f7857c579423a51b8c95d1aa5378091ba4245..bd9f2c35348c1c260f43f9c8dc8a9a8aa5149883 100644 (file)
@@ -111,6 +111,10 @@ static bool yagl_egl_onscreen_surface_swap_buffers(struct yagl_eglb_surface *sfc
 {
     struct yagl_egl_onscreen_surface *osfc =
         (struct yagl_egl_onscreen_surface*)sfc;
+    struct yagl_egl_onscreen *egl_onscreen =
+        (struct yagl_egl_onscreen*)sfc->dpy->backend;
+
+    egl_onscreen->gles_driver->Finish();
 
     osfc->ws_sfc->base.set_dirty(&osfc->ws_sfc->base);
 
@@ -121,6 +125,10 @@ static bool yagl_egl_onscreen_surface_copy_buffers(struct yagl_eglb_surface *sfc
 {
     struct yagl_egl_onscreen_surface *osfc =
         (struct yagl_egl_onscreen_surface*)sfc;
+    struct yagl_egl_onscreen *egl_onscreen =
+        (struct yagl_egl_onscreen*)sfc->dpy->backend;
+
+    egl_onscreen->gles_driver->Finish();
 
     osfc->ws_sfc->base.set_dirty(&osfc->ws_sfc->base);
 
@@ -131,10 +139,10 @@ static void yagl_egl_onscreen_surface_wait_gl(struct yagl_eglb_surface *sfc)
 {
     struct yagl_egl_onscreen_surface *osfc =
         (struct yagl_egl_onscreen_surface*)sfc;
+    struct yagl_egl_onscreen *egl_onscreen =
+        (struct yagl_egl_onscreen*)sfc->dpy->backend;
 
-    /*
-     * M.b. glFinish here ?
-     */
+    egl_onscreen->gles_driver->Finish();
 
     osfc->ws_sfc->base.set_dirty(&osfc->ws_sfc->base);
 }