summary refs log tree commit diff
path: root/gpu_renderer
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 /gpu_renderer
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 'gpu_renderer')
-rw-r--r--gpu_renderer/src/lib.rs12
-rw-r--r--gpu_renderer/src/pipe_format_fourcc.rs26
2 files changed, 0 insertions, 38 deletions
diff --git a/gpu_renderer/src/lib.rs b/gpu_renderer/src/lib.rs
index e551331..8c42e9f 100644
--- a/gpu_renderer/src/lib.rs
+++ b/gpu_renderer/src/lib.rs
@@ -6,7 +6,6 @@
 
 mod command_buffer;
 mod generated;
-mod pipe_format_fourcc;
 
 use std::cell::RefCell;
 use std::fmt::{self, Display};
@@ -31,12 +30,9 @@ use crate::generated::virglrenderer::*;
 
 pub use crate::command_buffer::CommandBufferBuilder;
 pub use crate::generated::virtgpu_hw::virtgpu_caps;
-pub use crate::pipe_format_fourcc::pipe_format_fourcc as format_fourcc;
 
 /// Arguments used in `Renderer::create_resource`..
 pub type ResourceCreateArgs = virgl_renderer_resource_create_args;
-/// Information returned from `Resource::get_info`.
-pub type ResourceInfo = virgl_renderer_resource_info;
 /// Some of the information returned from `Resource::export_query`.
 pub type Query = virgl_renderer_export_query;
 
@@ -469,14 +465,6 @@ impl Resource {
         self.id
     }
 
-    /// Retrieves metadata about this resource.
-    pub fn get_info(&self) -> Result<ResourceInfo> {
-        let mut res_info = Default::default();
-        let ret = unsafe { virgl_renderer_resource_get_info(self.id as i32, &mut res_info) };
-        ret_to_res(ret)?;
-        Ok(res_info)
-    }
-
     /// Retrieves metadata suitable for export about this resource. If "export_fd" is true,
     /// performs an export of this resource so that it may be imported by other processes.
     fn export_query(&self, export_fd: bool) -> Result<Query> {
diff --git a/gpu_renderer/src/pipe_format_fourcc.rs b/gpu_renderer/src/pipe_format_fourcc.rs
deleted file mode 100644
index 5a93167..0000000
--- a/gpu_renderer/src/pipe_format_fourcc.rs
+++ /dev/null
@@ -1,26 +0,0 @@
-// Copyright 2018 The Chromium OS Authors. All rights reserved.
-// Use of this source code is governed by a BSD-style license that can be
-// found in the LICENSE file.
-
-use crate::generated::p_format;
-
-macro_rules! fourcc {
-    ($a:expr, $b:expr, $c:expr, $d:expr) => {
-        Some($a as u32 | ($b as u32) << 8 | ($c as u32) << 16 | ($d as u32) << 24)
-    };
-}
-
-/// Gets the fourcc that corresponds to the given pipe format, or `None` if the format is
-/// unrecognized.
-pub fn pipe_format_fourcc(f: p_format::pipe_format) -> Option<u32> {
-    match f {
-        p_format::PIPE_FORMAT_B8G8R8A8_UNORM => fourcc!('A', 'R', '2', '4'),
-        p_format::PIPE_FORMAT_B8G8R8X8_UNORM => fourcc!('X', 'R', '2', '4'),
-        p_format::PIPE_FORMAT_R8G8B8A8_UNORM => fourcc!('A', 'B', '2', '4'),
-        p_format::PIPE_FORMAT_R8G8B8X8_UNORM => fourcc!('X', 'B', '2', '4'),
-        p_format::PIPE_FORMAT_B5G6R5_UNORM => fourcc!('R', 'G', '1', '6'),
-        // p_format::PIPE_FORMAT_R8_UNORM => fourcc!('R', '8', ' ', ' '),
-        // p_format::PIPE_FORMAT_G8R8_UNORM => fourcc!('R', 'G', '8', '8'),
-        _ => None,
-    }
-}