Select GL transport and draw call flush interval based on prop

bug: 140112486

Normally, different graphics methods would be communicated over the pipe
in the GL extension string, but if the transport medium itself is in
question, we need another method. Thus, we use Android's property_get
with the following property keys:

ro.kernel.qemu.gltransport # to control the transport type
ro.kernel.qemu.gltransport.drawFlushInterval # control draw call flush
interval

The default is to use goldfish pipe and have a flush interval of 800
draw calls.

Change-Id: Id1911e194d04f83379b576de01c93f7c2c680a4c
diff --git a/system/GLESv2_enc/GL2Encoder.cpp b/system/GLESv2_enc/GL2Encoder.cpp
index 208173e..478b823 100755
--- a/system/GLESv2_enc/GL2Encoder.cpp
+++ b/system/GLESv2_enc/GL2Encoder.cpp
@@ -101,6 +101,7 @@
     m_ssbo_offset_align = 0;
     m_ubo_offset_align = 0;
 
+    m_drawCallFlushInterval = 800;
     m_drawCallFlushCount = 0;
     m_primitiveRestartEnabled = false;
     m_primitiveRestartIndex = 0;
@@ -1302,11 +1303,7 @@
 }
 
 void GL2Encoder::flushDrawCall() {
-    // This used to be every other draw call, but
-    // now that we are using real GPU buffers on host,
-    // set this to every 200 draw calls
-    // (tuned on z840 linux NVIDIA Quadro K2200)
-    if (m_drawCallFlushCount % 200 == 0) {
+    if (m_drawCallFlushCount % m_drawCallFlushInterval == 0) {
         m_stream->flush();
     }
     m_drawCallFlushCount++;
@@ -1463,6 +1460,7 @@
         ctx->sendVertexAttributes(0, count, false);
         ctx->m_glDrawArraysNullAEMU_enc(ctx, mode, first, count);
     }
+    ctx->flushDrawCall();
 }
 
 void GL2Encoder::s_glDrawElementsNullAEMU(void *self, GLenum mode, GLsizei count, GLenum type, const void *indices)