summary refs log tree commit diff
path: root/devices/src/virtio/gpu/mod.rs
diff options
context:
space:
mode:
authorGurchetan Singh <gurchetansingh@chromium.org>2019-08-02 14:39:36 -0700
committerCommit Bot <commit-bot@chromium.org>2019-08-20 17:46:26 +0000
commit5ce68e42ca69d145bf32d7861c7d8715ab1da987 (patch)
treef0c22fe467474c26eff8e4c96aac151ce36a366f /devices/src/virtio/gpu/mod.rs
parent593dc3b34e4c23178fa4a8abd6c2d53b89e051a1 (diff)
downloadcrosvm-5ce68e42ca69d145bf32d7861c7d8715ab1da987.tar
crosvm-5ce68e42ca69d145bf32d7861c7d8715ab1da987.tar.gz
crosvm-5ce68e42ca69d145bf32d7861c7d8715ab1da987.tar.bz2
crosvm-5ce68e42ca69d145bf32d7861c7d8715ab1da987.tar.lz
crosvm-5ce68e42ca69d145bf32d7861c7d8715ab1da987.tar.xz
crosvm-5ce68e42ca69d145bf32d7861c7d8715ab1da987.tar.zst
crosvm-5ce68e42ca69d145bf32d7861c7d8715ab1da987.zip
devices: gpu: remove BackedBuffer/GpuRendererResource distinction
We always advertise VIRTIO_GPU_F_VIRGL and don't activate the
worker thread if Renderer::init fails.  We're unlikely to
encounter an platform where we can initialize a GBM device, but
can't initialize virglrenderer.

Since our virtio-gpu implementation depends on virglrenderer, we can
pipe 2D hypercalls to virglrenderer (QEMU does this too, when built
with the --enable-virglrenderer option).

Also remove virgl_renderer_resource_info since it's unlikely to work
with non-Mesa drivers.

BUG=chromium:906811
TEST=kmscube renders correctly (though there's a prior bug in closing
the rendering window -- see chromium:991830)

Change-Id: I7851cd0837fd226f523f81c5b4a3389dc85f3e4f
Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/platform/crosvm/+/1743219
Tested-by: Gurchetan Singh <gurchetansingh@chromium.org>
Tested-by: kokoro <noreply+kokoro@google.com>
Commit-Queue: Gurchetan Singh <gurchetansingh@chromium.org>
Reviewed-by: Zach Reizner <zachr@chromium.org>
Auto-Submit: Gurchetan Singh <gurchetansingh@chromium.org>
Diffstat (limited to 'devices/src/virtio/gpu/mod.rs')
-rw-r--r--devices/src/virtio/gpu/mod.rs30
1 files changed, 1 insertions, 29 deletions
diff --git a/devices/src/virtio/gpu/mod.rs b/devices/src/virtio/gpu/mod.rs
index 135732d..49787fb 100644
--- a/devices/src/virtio/gpu/mod.rs
+++ b/devices/src/virtio/gpu/mod.rs
@@ -24,7 +24,6 @@ use sys_util::{
     debug, error, warn, Error, EventFd, GuestAddress, GuestMemory, PollContext, PollToken,
 };
 
-use gpu_buffer::Device;
 use gpu_display::*;
 use gpu_renderer::{Renderer, RendererFlags};
 
@@ -622,32 +621,12 @@ impl DisplayBackend {
     }
 }
 
-/// Builds a Device for doing buffer allocation and sharing via dmabuf.
-fn build_buffer_device() -> Option<Device> {
-    const UNDESIRED_CARDS: &[&str] = &["vgem", "pvr"];
-    let drm_card = match gpu_buffer::rendernode::open_device(UNDESIRED_CARDS) {
-        Ok(f) => f,
-        Err(()) => {
-            error!("failed to open render node for GBM");
-            return None;
-        }
-    };
-    match Device::new(drm_card) {
-        Ok(d) => Some(d),
-        Err(()) => {
-            error!("failed to create GBM device from render node");
-            None
-        }
-    }
-}
-
 // Builds a gpu backend with one of the given possible display backends, or None if they all
 // failed.
 fn build_backend(
     possible_displays: &[DisplayBackend],
     gpu_device_socket: VmMemoryControlRequestSocket,
 ) -> Option<Backend> {
-    let mut buffer_device = None;
     let mut renderer_flags = RendererFlags::default();
     let mut display_opt = None;
     for display in possible_displays {
@@ -660,8 +639,6 @@ fn build_backend(
                 // more configurable
                 if display.is_x() {
                     renderer_flags = RendererFlags::new().use_glx(true);
-                } else {
-                    buffer_device = build_buffer_device();
                 }
                 display_opt = Some(c);
                 break;
@@ -692,12 +669,7 @@ fn build_backend(
         }
     };
 
-    Some(Backend::new(
-        buffer_device,
-        display,
-        renderer,
-        gpu_device_socket,
-    ))
+    Some(Backend::new(display, renderer, gpu_device_socket))
 }
 
 pub struct Gpu {