IDEA-144261 IDE is unusably slow when using a 4K display on OS X

Performed glTextureBarrierNV() call to separate read/write  from/to the same texture per glyph list not per every single glyph
diff --git a/src/share/native/sun/java2d/opengl/OGLTextRenderer.c b/src/share/native/sun/java2d/opengl/OGLTextRenderer.c
index 6ec6653..2aca1f0 100644
--- a/src/share/native/sun/java2d/opengl/OGLTextRenderer.c
+++ b/src/share/native/sun/java2d/opengl/OGLTextRenderer.c
@@ -797,8 +797,6 @@
 
         dty1 = ((GLfloat)dyadj + gh) / dstOps->textureHeight;
         dty2 = ((GLfloat)dyadj) / dstOps->textureHeight;
-
-        j2d_glTextureBarrierNV();
     }
 
     // render composed texture to the destination surface
@@ -953,8 +951,6 @@
 
                 dty1 = ((GLfloat)dyadj + sh) / dstOps->textureHeight;
                 dty2 = ((GLfloat)dyadj) / dstOps->textureHeight;
-
-                j2d_glTextureBarrierNV();
             }
 
             // render composed texture to the destination surface
@@ -991,6 +987,7 @@
 {
     int glyphCounter;
     GLuint dstTextureID = 0;
+    jboolean hasLCDGlyphs = JNI_FALSE;
 
     J2dTraceLn(J2D_TRACE_INFO, "OGLTR_DrawGlyphList");
 
@@ -1073,6 +1070,7 @@
             }
         } else {
             // LCD-optimized glyph data
+            hasLCDGlyphs = JNI_TRUE;
             jint rowBytesOffset = 0;
 
             if (subPixPos) {
@@ -1106,6 +1104,10 @@
         }
     }
 
+    if (dstTextureID != 0 && hasLCDGlyphs) {
+        j2d_glTextureBarrierNV();
+    }
+
     OGLTR_DisableGlyphModeState();
 }