evas gl-x11 engine - nvidia driver - fix performance drop
authorCarsten Haitzler (Rasterman) <raster@rasterman.com>
Tue, 10 Jul 2018 07:04:01 +0000 (16:04 +0900)
committerShinwoo Kim <cinoo.kim@samsung.com>
Tue, 24 Jul 2018 05:37:17 +0000 (14:37 +0900)
this has been going on for a while. on nvidia drivers in gles mode on
x11 there is a massive perf drop to like a few fps with enough windows
if we build for egl/gles instead of opengl. it was the re-creating of
eglimages every frame. put a vendor specific workaround for this and
avoid it. it's not needed there anyway. framerate back to 60fps
smoothness afterwards.

@fix

src/modules/evas/engines/gl_x11/evas_engine.c
src/modules/evas/engines/gl_x11/evas_engine.h
src/modules/evas/engines/gl_x11/evas_x_main.c

index 9548e03..ecc1cfe 100755 (executable)
@@ -2553,6 +2553,8 @@ eng_image_native_set(void *engine, void *image, void *native)
                    n->ns_data.x11.multiple_buffer = 0;
                  else
                    n->ns_data.x11.multiple_buffer = 1;
+                 if (ob->detected.no_multi_buffer_native)
+                   n->ns_data.x11.multiple_buffer = 0;
 
                  if (!n->ns_data.x11.surface)
                    {
index c5cef71..ed72771 100644 (file)
@@ -75,6 +75,8 @@ struct _Outbuf
       unsigned char msaa;
 #ifndef GL_GLES
       Eina_Bool     loose_binding : 1;
+#else
+      Eina_Bool     no_multi_buffer_native : 1;
 #endif
    } detected;
 
index 4e00238..b8b2be5 100755 (executable)
@@ -345,6 +345,13 @@ try_gles2:
         eng_window_free(gw);
         return NULL;
      }
+   // nvidia drivers in egl/gles mode dont need re-creating of the
+   // eglimage ... and doign so is super slow on them, so avoid the
+   // multi buffer path - as it's only for nvidia and this fixes
+   // the performance regression there, it's fairly safe to do
+   // as it's not universal across all drivers.
+   if (strstr((const char *)vendor, "NVIDIA"))
+     gw->detected.no_multi_buffer_native = 1;
 
    eglGetConfigAttrib(gw->egl_disp, gw->egl_config, EGL_DEPTH_SIZE, &val);
    gw->detected.depth_buffer_size = val;