goldfish-opengl: nuke VirtioGpuStream

The VirtioGpuStream was used for the original bring-up of the
pipe_virglrenderer.  All users have now transitioned to the
VirtioGpuPipeStream and virtio ASG.

BUG=239639751
TEST=compile

Change-Id: Ifae199b3d04bae09ef094f1aa4823e1ac4c49890
diff --git a/system/OpenglSystemCommon/Android.mk b/system/OpenglSystemCommon/Android.mk
index 0a1f74f..f586915 100644
--- a/system/OpenglSystemCommon/Android.mk
+++ b/system/OpenglSystemCommon/Android.mk
@@ -40,7 +40,6 @@
 
 LOCAL_CFLAGS += -DVIRTIO_GPU
 LOCAL_SRC_FILES += \
-    VirtioGpuStream.cpp \
     VirtioGpuPipeStream.cpp \
 
 LOCAL_C_INCLUDES += external/libdrm external/minigbm/cros_gralloc
diff --git a/system/OpenglSystemCommon/CMakeLists.txt b/system/OpenglSystemCommon/CMakeLists.txt
index e8ff5e7..04d2893 100644
--- a/system/OpenglSystemCommon/CMakeLists.txt
+++ b/system/OpenglSystemCommon/CMakeLists.txt
@@ -1,7 +1,7 @@
 # This is an autogenerated file! Do not edit!
 # instead run make from .../device/generic/goldfish-opengl
 # which will re-generate this file.
-android_validate_sha256("${GOLDFISH_DEVICE_ROOT}/system/OpenglSystemCommon/Android.mk" "e69a0b6cfcfacd5680dad8e0f18420ac7c5e2a794db5fb7d6fc16def3906109a")
+android_validate_sha256("${GOLDFISH_DEVICE_ROOT}/system/OpenglSystemCommon/Android.mk" "5086200ad090dcbd2e94e4d253914680c8f0b5feea92776c0f64cbdd7fe4e4fa")
 set(OpenglSystemCommon_src FormatConversions.cpp HostConnection.cpp QemuPipeStream.cpp ProcessPipe.cpp ThreadInfo.cpp AddressSpaceStream.cpp)
 android_add_library(TARGET OpenglSystemCommon SHARED LICENSE Apache-2.0 SRC FormatConversions.cpp HostConnection.cpp QemuPipeStream.cpp ProcessPipe.cpp ThreadInfo.cpp AddressSpaceStream.cpp)
 target_include_directories(OpenglSystemCommon PRIVATE ${GOLDFISH_DEVICE_ROOT}/system/OpenglSystemCommon ${GOLDFISH_DEVICE_ROOT}/bionic/libc/platform ${GOLDFISH_DEVICE_ROOT}/bionic/libc/private ${GOLDFISH_DEVICE_ROOT}/system/OpenglSystemCommon/bionic-include ${GOLDFISH_DEVICE_ROOT}/system/vulkan_enc ${GOLDFISH_DEVICE_ROOT}/shared/gralloc_cb/include ${GOLDFISH_DEVICE_ROOT}/shared/GoldfishAddressSpace/include ${GOLDFISH_DEVICE_ROOT}/platform/include ${GOLDFISH_DEVICE_ROOT}/system/renderControl_enc ${GOLDFISH_DEVICE_ROOT}/system/GLESv2_enc ${GOLDFISH_DEVICE_ROOT}/system/GLESv1_enc ${GOLDFISH_DEVICE_ROOT}/shared/OpenglCodecCommon ${GOLDFISH_DEVICE_ROOT}/android-emu ${GOLDFISH_DEVICE_ROOT}/shared/qemupipe/include-types ${GOLDFISH_DEVICE_ROOT}/shared/qemupipe/include ${GOLDFISH_DEVICE_ROOT}/./host/include/libOpenglRender ${GOLDFISH_DEVICE_ROOT}/./system/include ${GOLDFISH_DEVICE_ROOT}/./../../../external/qemu/android/android-emugl/guest)
diff --git a/system/OpenglSystemCommon/EmulatorFeatureInfo.h b/system/OpenglSystemCommon/EmulatorFeatureInfo.h
index 8a243c2..67799eb 100644
--- a/system/OpenglSystemCommon/EmulatorFeatureInfo.h
+++ b/system/OpenglSystemCommon/EmulatorFeatureInfo.h
@@ -204,10 +204,9 @@
 enum HostConnectionType {
     HOST_CONNECTION_TCP = 0,
     HOST_CONNECTION_QEMU_PIPE = 1,
-    HOST_CONNECTION_VIRTIO_GPU = 2,
-    HOST_CONNECTION_ADDRESS_SPACE = 3,
-    HOST_CONNECTION_VIRTIO_GPU_PIPE = 4,
-    HOST_CONNECTION_VIRTIO_GPU_ADDRESS_SPACE = 5,
+    HOST_CONNECTION_ADDRESS_SPACE = 2,
+    HOST_CONNECTION_VIRTIO_GPU_PIPE = 3,
+    HOST_CONNECTION_VIRTIO_GPU_ADDRESS_SPACE = 4,
 };
 
 enum GrallocType {
diff --git a/system/OpenglSystemCommon/HostConnection.cpp b/system/OpenglSystemCommon/HostConnection.cpp
index 26854d5..3c179f6 100644
--- a/system/OpenglSystemCommon/HostConnection.cpp
+++ b/system/OpenglSystemCommon/HostConnection.cpp
@@ -86,7 +86,6 @@
 #ifdef VIRTIO_GPU
 
 #include "VirtGpu.h"
-#include "VirtioGpuStream.h"
 #include "VirtioGpuPipeStream.h"
 #include "virtgpu_drm.h"
 
@@ -126,7 +125,6 @@
 
     if (!strcmp("tcp", transportValue)) return HOST_CONNECTION_TCP;
     if (!strcmp("pipe", transportValue)) return HOST_CONNECTION_QEMU_PIPE;
-    if (!strcmp("virtio-gpu", transportValue)) return HOST_CONNECTION_VIRTIO_GPU;
     if (!strcmp("asg", transportValue)) return HOST_CONNECTION_ADDRESS_SPACE;
     if (!strcmp("virtio-gpu-pipe", transportValue)) return HOST_CONNECTION_VIRTIO_GPU_PIPE;
     if (!strcmp("virtio-gpu-asg", transportValue)) return HOST_CONNECTION_VIRTIO_GPU_ADDRESS_SPACE;
@@ -492,27 +490,6 @@
 #endif
         }
 #if defined(VIRTIO_GPU) && !defined(HOST_BUILD)
-        case HOST_CONNECTION_VIRTIO_GPU: {
-            auto stream = new VirtioGpuStream(STREAM_BUFFER_SIZE);
-            if (!stream) {
-                ALOGE("Failed to create VirtioGpu for host connection\n");
-                return nullptr;
-            }
-            if (stream->connect() < 0) {
-                ALOGE("Failed to connect to host (VirtioGpu)\n");
-                return nullptr;
-            }
-            con->m_connectionType = HOST_CONNECTION_VIRTIO_GPU;
-            con->m_grallocType = GRALLOC_TYPE_MINIGBM;
-            auto rendernodeFd = stream->getRendernodeFd();
-            con->m_processPipe = stream->getProcessPipe();
-            con->m_stream = stream;
-            con->m_rendernodeFd = rendernodeFd;
-            MinigbmGralloc* m = new MinigbmGralloc;
-            m->setFd(rendernodeFd);
-            con->m_grallocHelper = m;
-            break;
-        }
         case HOST_CONNECTION_VIRTIO_GPU_PIPE: {
             auto stream = new VirtioGpuPipeStream(STREAM_BUFFER_SIZE);
             if (!stream) {
diff --git a/system/OpenglSystemCommon/ProcessPipe.cpp b/system/OpenglSystemCommon/ProcessPipe.cpp
index 5198d57..c02bd5f 100644
--- a/system/OpenglSystemCommon/ProcessPipe.cpp
+++ b/system/OpenglSystemCommon/ProcessPipe.cpp
@@ -189,7 +189,6 @@
         case HOST_CONNECTION_QEMU_PIPE:
         case HOST_CONNECTION_ADDRESS_SPACE:
         case HOST_CONNECTION_TCP:
-        case HOST_CONNECTION_VIRTIO_GPU:
             sQemuPipeInit();
             break;
         case HOST_CONNECTION_VIRTIO_GPU_PIPE:
@@ -231,7 +230,6 @@
         case HOST_CONNECTION_QEMU_PIPE:
         case HOST_CONNECTION_ADDRESS_SPACE:
         case HOST_CONNECTION_TCP:
-        case HOST_CONNECTION_VIRTIO_GPU:
             isPipe = true;
             break;
         case HOST_CONNECTION_VIRTIO_GPU_PIPE:
diff --git a/system/OpenglSystemCommon/VirtioGpuStream.cpp b/system/OpenglSystemCommon/VirtioGpuStream.cpp
deleted file mode 100644
index 21a76e9..0000000
--- a/system/OpenglSystemCommon/VirtioGpuStream.cpp
+++ /dev/null
@@ -1,422 +0,0 @@
-/*
- * Copyright (C) 2018 The Android Open Source Project
- *
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-
-#include "VirtioGpuStream.h"
-#include "virtgpu_drm.h"
-
-#include <xf86drm.h>
-
-#include <sys/types.h>
-#include <sys/mman.h>
-
-#include <errno.h>
-#include <unistd.h>
-
-#ifndef PAGE_SIZE
-#define PAGE_SIZE 0x1000
-#endif
-
-// In a virtual machine, there should only be one GPU
-#define RENDERNODE_MINOR 128
-
-// Maximum size of readback / response buffer in bytes
-#define MAX_CMDRESPBUF_SIZE (10*PAGE_SIZE)
-
-// Attributes use to allocate our response buffer
-// Similar to virgl's fence objects
-#define PIPE_BUFFER             0
-#define VIRGL_FORMAT_R8_UNORM   64
-#define VIRGL_BIND_CUSTOM       (1 << 17)
-
-// Conservative; see virgl_winsys.h
-#define VIRGL_MAX_CMDBUF_DWORDS (16*1024)
-#define VIRGL_MAX_CMDBUF_SIZE   (4*VIRGL_MAX_CMDBUF_DWORDS)
-
-struct VirtioGpuCmd {
-    uint32_t op;
-    uint32_t cmdSize;
-    unsigned char buf[0];
-} __attribute__((packed));
-
-union process_pipe_info {
-    uint64_t proto;
-    struct {
-       int pid;
-       int tid;
-      } id;
-};
-
-bool VirtioGpuProcessPipe::processPipeInit(int stream_handle, HostConnectionType, renderControl_encoder_context_t *rcEnc)
-{
-  union process_pipe_info info;
-
-  info.id.pid = getpid();
-  info.id.tid = gettid();
-  rcEnc->rcSetPuid(rcEnc, info.proto);
-  return true;
-}
-
-VirtioGpuStream::VirtioGpuStream(size_t bufSize) :
-    IOStream(0U),
-    m_fd(-1),
-    m_bufSize(bufSize),
-    m_buf(nullptr),
-    m_cmdResp_rh(0U),
-    m_cmdResp_bo(0U),
-    m_cmdResp(nullptr),
-    m_cmdRespPos(0U),
-    m_cmdPos(0U),
-    m_flushPos(0U),
-    m_allocSize(0U),
-    m_allocFlushSize(0U)
-{
-}
-
-VirtioGpuStream::~VirtioGpuStream()
-{
-    if (m_cmdResp) {
-        munmap(m_cmdResp, MAX_CMDRESPBUF_SIZE);
-    }
-
-    if (m_cmdResp_bo > 0U) {
-        drm_gem_close gem_close = {
-            .handle = m_cmdResp_bo,
-        };
-        drmIoctl(m_fd, DRM_IOCTL_GEM_CLOSE, &gem_close);
-    }
-
-    if (m_fd >= 0) {
-        close(m_fd);
-    }
-
-    free(m_buf);
-}
-
-int VirtioGpuStream::connect()
-{
-    if (m_fd < 0) {
-        m_fd = drmOpenRender(RENDERNODE_MINOR);
-        if (m_fd < 0) {
-            ERR("%s: failed with fd %d (%s)", __func__, m_fd, strerror(errno));
-            return -1;
-        }
-    }
-
-    if (!m_cmdResp_bo) {
-        drm_virtgpu_resource_create create = {
-            .target     = PIPE_BUFFER,
-            .format     = VIRGL_FORMAT_R8_UNORM,
-            .bind       = VIRGL_BIND_CUSTOM,
-            .width      = MAX_CMDRESPBUF_SIZE,
-            .height     = 1U,
-            .depth      = 1U,
-            .array_size = 0U,
-            .size       = MAX_CMDRESPBUF_SIZE,
-            .stride     = MAX_CMDRESPBUF_SIZE,
-        };
-        int ret = drmIoctl(m_fd, DRM_IOCTL_VIRTGPU_RESOURCE_CREATE, &create);
-        if (ret) {
-            ERR("%s: failed with %d allocating command response buffer (%s)",
-                __func__, ret, strerror(errno));
-            return -1;
-        }
-        m_cmdResp_bo = create.bo_handle;
-        if (!m_cmdResp_bo) {
-            ERR("%s: no handle when allocating command response buffer",
-                __func__);
-            return -1;
-        }
-        m_cmdResp_rh = create.res_handle;
-        if (create.size != MAX_CMDRESPBUF_SIZE) {
-	    ERR("%s: command response buffer wrongly sized, create.size=%zu "
-		"!= %zu", __func__,
-		static_cast<size_t>(create.size),
-		static_cast<size_t>(MAX_CMDRESPBUF_SIZE));
-	    abort();
-	}
-    }
-
-    if (!m_cmdResp) {
-        drm_virtgpu_map map;
-        memset(&map, 0, sizeof(map));
-        map.handle = m_cmdResp_bo;
-
-        int ret = drmIoctl(m_fd, DRM_IOCTL_VIRTGPU_MAP, &map);
-        if (ret) {
-            ERR("%s: failed with %d mapping command response buffer (%s)",
-                __func__, ret, strerror(errno));
-            return -1;
-        }
-        m_cmdResp = static_cast<VirtioGpuCmd *>(mmap64(nullptr,
-                                                       MAX_CMDRESPBUF_SIZE,
-                                                       PROT_READ, MAP_SHARED,
-                                                       m_fd, map.offset));
-        if (m_cmdResp == MAP_FAILED) {
-            ERR("%s: failed with %d mmap'ing command response buffer (%s)",
-                __func__, ret, strerror(errno));
-            return -1;
-        }
-    }
-
-    return 0;
-}
-
-int VirtioGpuStream::flush()
-{
-    int ret = commitBuffer(m_allocSize - m_allocFlushSize);
-    if (ret)
-        return ret;
-    m_allocFlushSize = m_allocSize;
-    return 0;
-}
-
-void *VirtioGpuStream::allocBuffer(size_t minSize)
-{
-    if (m_buf) {
-        // Try to model the alloc() calls being made by the user. They should be
-        // obeying the protocol and using alloc() for anything they don't write
-        // with writeFully(), so we can know if this alloc() is for part of a
-        // command, or not. If it is not for part of a command, we are starting
-        // a new command, and should increment m_cmdPos.
-        VirtioGpuCmd *cmd = reinterpret_cast<VirtioGpuCmd *>(&m_buf[m_cmdPos]);
-        if (m_allocSize + minSize > cmd->cmdSize) {
-            m_allocFlushSize = 0U;
-            m_allocSize = 0U;
-            // This might also be a convenient point to flush commands
-            if (m_cmdPos + cmd->cmdSize + minSize > m_bufSize) {
-                if (commitAll() < 0) {
-                    ERR("%s: command flush failed", __func__);
-                    m_flushPos = 0U;
-                    m_bufSize = 0U;
-                    m_cmdPos = 0U;
-                    free(m_buf);
-                    m_buf = nullptr;
-                    return nullptr;
-                }
-            } else {
-                m_cmdPos += cmd->cmdSize;
-                m_flushPos = m_cmdPos;
-            }
-        }
-    }
-
-    // Update m_allocSize here, before minSize is tampered with below
-    m_allocSize += minSize;
-
-    // Make sure anything we already have written to the buffer is retained
-    minSize += m_flushPos;
-
-    size_t allocSize = (m_bufSize < minSize ? minSize : m_bufSize);
-    if (!m_buf) {
-        m_buf = static_cast<unsigned char *>(malloc(allocSize));
-    } else if (m_bufSize < allocSize) {
-        unsigned char *p = static_cast<unsigned char *>(realloc(m_buf, allocSize));
-        if (!p) {
-            free(m_buf);
-        }
-        m_buf = p;
-    }
-    if (!m_buf) {
-        ERR("%s: alloc (%zu) failed\n", __func__, allocSize);
-        m_allocFlushSize = 0U;
-        m_allocSize = 0U;
-        m_flushPos = 0U;
-        m_bufSize = 0U;
-        m_cmdPos = 0U;
-    } else {
-        m_bufSize = allocSize;
-    }
-    if (m_flushPos == 0 && m_cmdPos == 0) {
-      // During initialization, HostConnection will send an empty command
-      // packet to check the connection is good, but it doesn't obey the usual
-      // line protocol. This is a 4 byte write to [0], which is our 'op' field,
-      // and we don't have an op=0 so it's OK. We fake up a valid length, and
-      // overload this workaround by putting the res_handle for the readback
-      // buffer in the command payload, patched in just before we submit.
-      VirtioGpuCmd *cmd = reinterpret_cast<VirtioGpuCmd *>(&m_buf[m_cmdPos]);
-      cmd->op = 0U;
-      cmd->cmdSize = sizeof(*cmd) + sizeof(__u32);
-    }
-    return m_buf + m_cmdPos;
-}
-
-// For us, writeFully() means to write a command without any header, directly
-// into the buffer stream. We can use the packet frame written directly to the
-// stream to verify this write is within bounds, then update the counter.
-
-int VirtioGpuStream::writeFully(const void *buf, size_t len)
-{
-    if (!valid())
-        return -1;
-
-    if (!buf) {
-        if (len > 0) {
-            // If len is non-zero, buf must not be NULL. Otherwise the pipe would
-            // be in a corrupted state, which is lethal for the emulator.
-            ERR("%s: failed, buf=NULL, len %zu, lethal error, exiting",
-                __func__, len);
-            abort();
-        }
-        return 0;
-    }
-
-    VirtioGpuCmd *cmd = reinterpret_cast<VirtioGpuCmd *>(&m_buf[m_cmdPos]);
-
-    if (m_flushPos < sizeof(*cmd)) {
-        ERR("%s: writeFully len %zu would overwrite command header, "
-            "cmd_pos=%zu, flush_pos=%zu, lethal error, exiting", __func__,
-            len, m_cmdPos, m_flushPos);
-        abort();
-    }
-
-    if (m_flushPos + len > cmd->cmdSize) {
-        ERR("%s: writeFully len %zu would overflow the command bounds, "
-            "cmd_pos=%zu, flush_pos=%zu, cmdsize=%" PRIu32 ", lethal error, exiting",
-            __func__, len, m_cmdPos, m_flushPos, cmd->cmdSize);
-        abort();
-    }
-
-    if (len > VIRGL_MAX_CMDBUF_SIZE) {
-        ERR("%s: Large command (%zu bytes) exceeds virgl limits",
-            __func__, len);
-        /* Fall through */
-    }
-
-    memcpy(&m_buf[m_flushPos], buf, len);
-    commitBuffer(len);
-    m_allocSize += len;
-    return 0;
-}
-
-const unsigned char *VirtioGpuStream::readFully(void *buf, size_t len)
-{
-    if (!valid())
-        return nullptr;
-
-    if (!buf) {
-        if (len > 0) {
-            // If len is non-zero, buf must not be NULL. Otherwise the pipe would
-            // be in a corrupted state, which is lethal for the emulator.
-            ERR("%s: failed, buf=NULL, len %zu, lethal error, exiting.",
-                __func__, len);
-            abort();
-        }
-        return nullptr;
-    }
-
-    // Read is too big for current architecture
-    if (len > MAX_CMDRESPBUF_SIZE - sizeof(*m_cmdResp)) {
-        ERR("%s: failed, read too large, len %zu, lethal error, exiting.",
-            __func__, len);
-        abort();
-    }
-
-    // Commit all outstanding write commands (if any)
-    if (commitAll() < 0) {
-        ERR("%s: command flush failed", __func__);
-        return nullptr;
-    }
-
-    if (len > 0U && m_cmdRespPos == 0U) {
-        // When we are about to read for the first time, wait for the virtqueue
-        // to drain to this command, otherwise the data could be stale
-        drm_virtgpu_3d_wait wait = {
-            .handle = m_cmdResp_bo,
-        };
-        int ret = drmIoctl(m_fd, DRM_IOCTL_VIRTGPU_WAIT, &wait);
-        if (ret) {
-            ERR("%s: failed with %d waiting for response buffer (%s)",
-                __func__, ret, strerror(errno));
-            // Fall through, hope for the best
-        }
-    }
-
-    // Most likely a protocol implementation error
-    if (m_cmdResp->cmdSize - sizeof(*m_cmdResp) < m_cmdRespPos + len) {
-        ERR("%s: failed, op %" PRIu32 ", len %zu, cmdSize %" PRIu32 ", pos %zu, lethal "
-            "error, exiting.", __func__, m_cmdResp->op, len,
-            m_cmdResp->cmdSize, m_cmdRespPos);
-        abort();
-    }
-
-    memcpy(buf, &m_cmdResp->buf[m_cmdRespPos], len);
-
-    if (m_cmdRespPos + len == m_cmdResp->cmdSize - sizeof(*m_cmdResp)) {
-        m_cmdRespPos = 0U;
-    } else {
-        m_cmdRespPos += len;
-    }
-
-    return reinterpret_cast<const unsigned char *>(buf);
-}
-
-int VirtioGpuStream::commitBuffer(size_t size)
-{
-    if (m_flushPos + size > m_bufSize) {
-        ERR("%s: illegal commit size %zu, flushPos %zu, bufSize %zu",
-            __func__, size, m_flushPos, m_bufSize);
-        return -1;
-    }
-    m_flushPos += size;
-    return 0;
-}
-
-int VirtioGpuStream::commitAll()
-{
-    size_t pos = 0U, numFlushed = 0U;
-    while (pos < m_flushPos) {
-        VirtioGpuCmd *cmd = reinterpret_cast<VirtioGpuCmd *>(&m_buf[pos]);
-
-        // Should never happen
-        if (pos + cmd->cmdSize > m_bufSize) {
-            ERR("%s: failed, pos %zu, cmdSize %" PRIu32 ", bufSize %zu, lethal "
-                "error, exiting.", __func__, pos, cmd->cmdSize, m_bufSize);
-            abort();
-        }
-
-        // Saw dummy command; patch it with res handle
-        if (cmd->op == 0) {
-            *(uint32_t *)cmd->buf = m_cmdResp_rh;
-        }
-
-        // Flush a single command
-        drm_virtgpu_execbuffer execbuffer = {
-            .size           = cmd->cmdSize,
-            .command        = reinterpret_cast<__u64>(cmd),
-            .bo_handles     = reinterpret_cast<__u64>(&m_cmdResp_bo),
-            .num_bo_handles = 1U,
-        };
-        int ret = drmIoctl(m_fd, DRM_IOCTL_VIRTGPU_EXECBUFFER, &execbuffer);
-        if (ret) {
-            ERR("%s: failed with %d executing command buffer (%s)",  __func__,
-                ret, strerror(errno));
-            return -1;
-        }
-
-        pos += cmd->cmdSize;
-        numFlushed++;
-    }
-
-    if (pos > m_flushPos) {
-        ERR("%s: aliasing, flushPos %zu, pos %zu, probably ok", __func__,
-            m_flushPos, pos);
-        /* Fall through */
-    }
-
-    m_flushPos = 0U;
-    m_cmdPos = 0U;
-    return 0;
-}
diff --git a/system/OpenglSystemCommon/VirtioGpuStream.h b/system/OpenglSystemCommon/VirtioGpuStream.h
deleted file mode 100644
index 4f2c2dc..0000000
--- a/system/OpenglSystemCommon/VirtioGpuStream.h
+++ /dev/null
@@ -1,111 +0,0 @@
-/*
- * Copyright (C) 2018 The Android Open Source Project
- *
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-
-#pragma once
-
-#include "HostConnection.h"
-#include "IOStream.h"
-
-#include <stdlib.h>
-
-/* This file implements an IOStream that uses VIRTGPU_EXECBUFFER ioctls on a
- * virtio-gpu DRM rendernode device to communicate with the host.
- */
-
-struct VirtioGpuCmd;
-
-class VirtioGpuProcessPipe : public ProcessPipe
-{
-public:
-    virtual bool processPipeInit(int stream_handle, HostConnectionType connType, renderControl_encoder_context_t *rcEnc);
-};
-
-class VirtioGpuStream : public IOStream
-{
-public:
-    explicit VirtioGpuStream(size_t bufSize);
-    ~VirtioGpuStream();
-
-    int connect();
-    ProcessPipe *getProcessPipe() { return &m_processPipe; }
-
-    // override IOStream so we can see non-rounded allocation sizes
-    virtual unsigned char *alloc(size_t len)
-    {
-        return static_cast<unsigned char *>(allocBuffer(len));
-    }
-
-    // override IOStream so we can model the caller's writes
-    virtual int flush();
-
-    virtual void *allocBuffer(size_t minSize);
-    virtual int writeFully(const void *buf, size_t len);
-    virtual const unsigned char *readFully(void *buf, size_t len);
-    virtual int commitBuffer(size_t size);
-    virtual const unsigned char* commitBufferAndReadFully(size_t size, void *buf, size_t len)
-    {
-        return commitBuffer(size) ? nullptr : readFully(buf, len);
-    }
-    virtual const unsigned char *read(void *buf, size_t *inout_len) final
-    {
-        return readFully(buf, *inout_len);
-    }
-
-    bool valid()
-    {
-        return m_fd >= 0 && m_cmdResp_bo > 0 && m_cmdResp;
-    }
-
-    int getRendernodeFd() { return m_fd; }
-
-private:
-    // rendernode fd
-    int m_fd;
-
-    // command memory buffer
-    size_t m_bufSize;
-    unsigned char *m_buf;
-
-    // response buffer res handle
-    uint32_t m_cmdResp_rh;
-
-    // response buffer ttm buffer object
-    uint32_t m_cmdResp_bo;
-
-    // user mapping of response buffer object
-    VirtioGpuCmd *m_cmdResp;
-
-    // byte offset to read cursor for last response
-    size_t m_cmdRespPos;
-
-    // byte offset to command being assembled
-    size_t m_cmdPos;
-
-    // byte offset to flush cursor
-    size_t m_flushPos;
-
-    // byte counter of allocs since last command boundary
-    size_t m_allocSize;
-
-    // bytes of an alloc flushed through flush() API
-    size_t m_allocFlushSize;
-
-    // Fake process pipe implementation
-    VirtioGpuProcessPipe m_processPipe;
-
-    // commits all commands, resets buffer offsets
-    int commitAll();
-};
diff --git a/system/OpenglSystemCommon/meson.build b/system/OpenglSystemCommon/meson.build
index 3a903bb..2b834d9 100644
--- a/system/OpenglSystemCommon/meson.build
+++ b/system/OpenglSystemCommon/meson.build
@@ -7,7 +7,6 @@
   'ProcessPipe.cpp',
   'QemuPipeStream.cpp',
   'ThreadInfo.cpp',
-  'VirtioGpuStream.cpp',
   'VirtioGpuPipeStream.cpp',
 )