WIP: Add virtio-gpu backend to OpenglSystem.

This change switches device OpenGL emulation over to using virtio-gpu
instead of qemu pipes. The feature is enabled at compile time, and only
if BOARD_GPU_DRIVERS contains "virgl", which is used by other projects
to trigger support for virtio-gpu 3d.

Control stream writes are passed through the existing virtio-gpu 3d
ioctls, and they can be processed in batches, so long as no response is
required. Because responses cannot be sent from kernel->usermode in the
same way socket data can, a "response page" is configured, which is
written to by a qemu driver.

Bug: 77276633
Test: foo
Change-Id: I7ee8b6db815b35d708630dda417039b80d2dfddf
diff --git a/system/OpenglSystemCommon/HostConnection.h b/system/OpenglSystemCommon/HostConnection.h
index 2b49857..e3dbe80 100644
--- a/system/OpenglSystemCommon/HostConnection.h
+++ b/system/OpenglSystemCommon/HostConnection.h
@@ -21,6 +21,7 @@
 #include "ChecksumCalculator.h"
 #include "goldfish_dma.h"
 
+#include <cutils/native_handle.h>
 #include <string>
 
 class GLEncoder;
@@ -110,6 +111,21 @@
     GLESMaxVersion m_glesMaxVersion;
 };
 
+// Abstraction for gralloc handle conversion
+class Gralloc {
+public:
+    virtual uint32_t getHostHandle(native_handle_t const* handle) = 0;
+    virtual int getFormat(native_handle_t const* handle) = 0;
+    virtual ~Gralloc() {}
+};
+
+// Abstraction for process pipe helper
+class ProcessPipe {
+public:
+    virtual bool processPipeInit(renderControl_encoder_context_t *rcEnc) = 0;
+    virtual ~ProcessPipe() {}
+};
+
 struct EGLThreadInfo;
 
 class HostConnection
@@ -124,6 +140,7 @@
     GL2Encoder *gl2Encoder();
     ExtendedRCEncoderContext *rcEncoder();
     ChecksumCalculator *checksumHelper() { return &m_checksumHelper; }
+    Gralloc *grallocHelper() { return m_grallocHelper; }
 
     void flush() {
         if (m_stream) {
@@ -159,6 +176,8 @@
     GL2Encoder  *m_gl2Enc;
     ExtendedRCEncoderContext *m_rcEnc;
     ChecksumCalculator m_checksumHelper;
+    Gralloc *m_grallocHelper;
+    ProcessPipe *m_processPipe;
     std::string m_glExtensions;
     bool m_grallocOnly;
     int m_pipeFd;