diff options
author | Gurchetan Singh <gurchetansingh@chromium.org> | 2019-06-06 17:34:07 -0700 |
---|---|---|
committer | Commit Bot <commit-bot@chromium.org> | 2019-07-16 17:21:39 +0000 |
commit | ed88b0ef5eff1845fe266b620b1866fe85ba2532 (patch) | |
tree | e052af5cce035ea2212390f5da29e5591e6f7c03 | |
parent | e33b55c4298c8f0d3dff7f04343e765559463d3a (diff) | |
download | crosvm-ed88b0ef5eff1845fe266b620b1866fe85ba2532.tar crosvm-ed88b0ef5eff1845fe266b620b1866fe85ba2532.tar.gz crosvm-ed88b0ef5eff1845fe266b620b1866fe85ba2532.tar.bz2 crosvm-ed88b0ef5eff1845fe266b620b1866fe85ba2532.tar.lz crosvm-ed88b0ef5eff1845fe266b620b1866fe85ba2532.tar.xz crosvm-ed88b0ef5eff1845fe266b620b1866fe85ba2532.tar.zst crosvm-ed88b0ef5eff1845fe266b620b1866fe85ba2532.zip |
devices: gpu: advertise support for capset 3
Useful for prototyping new features. BUG=chromium:924405 TEST=compile Change-Id: Ibdc4a70761493939ca96b92540b9e0cca88c17a8 Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/platform/crosvm/+/1650290 Tested-by: Gurchetan Singh <gurchetansingh@chromium.org> Tested-by: kokoro <noreply+kokoro@google.com> Reviewed-by: Zach Reizner <zachr@chromium.org> Commit-Queue: Gurchetan Singh <gurchetansingh@chromium.org> Auto-Submit: Gurchetan Singh <gurchetansingh@chromium.org>
-rw-r--r-- | devices/src/virtio/gpu/backend.rs | 5 | ||||
-rw-r--r-- | devices/src/virtio/gpu/mod.rs | 2 | ||||
-rw-r--r-- | devices/src/virtio/gpu/protocol.rs | 1 | ||||
-rw-r--r-- | gpu_renderer/src/lib.rs | 5 |
4 files changed, 11 insertions, 2 deletions
diff --git a/devices/src/virtio/gpu/backend.rs b/devices/src/virtio/gpu/backend.rs index 475cb10..8f693cc 100644 --- a/devices/src/virtio/gpu/backend.rs +++ b/devices/src/virtio/gpu/backend.rs @@ -25,7 +25,8 @@ use gpu_renderer::{ }; use super::protocol::{ - GpuResponse, GpuResponsePlaneInfo, VIRTIO_GPU_CAPSET_VIRGL, VIRTIO_GPU_CAPSET_VIRGL2, + GpuResponse, GpuResponsePlaneInfo, VIRTIO_GPU_CAPSET3, VIRTIO_GPU_CAPSET_VIRGL, + VIRTIO_GPU_CAPSET_VIRGL2, }; use crate::virtio::resource_bridge::*; use vm_control::VmMemoryControlRequestSocket; @@ -631,8 +632,10 @@ impl Backend { let id = match index { 0 => VIRTIO_GPU_CAPSET_VIRGL, 1 => VIRTIO_GPU_CAPSET_VIRGL2, + 2 => VIRTIO_GPU_CAPSET3, _ => return GpuResponse::ErrInvalidParameter, }; + let (version, size) = self.renderer.get_cap_set_info(id); GpuResponse::OkCapsetInfo { id, version, size } } diff --git a/devices/src/virtio/gpu/mod.rs b/devices/src/virtio/gpu/mod.rs index 0031b73..0ab83fd 100644 --- a/devices/src/virtio/gpu/mod.rs +++ b/devices/src/virtio/gpu/mod.rs @@ -643,7 +643,7 @@ impl Gpu { events_read: Le32::from(events_read), events_clear: Le32::from(0), num_scanouts: Le32::from(1), - num_capsets: Le32::from(2), + num_capsets: Le32::from(3), } } } diff --git a/devices/src/virtio/gpu/protocol.rs b/devices/src/virtio/gpu/protocol.rs index 008283b..3649e10 100644 --- a/devices/src/virtio/gpu/protocol.rs +++ b/devices/src/virtio/gpu/protocol.rs @@ -377,6 +377,7 @@ unsafe impl DataInit for virtio_gpu_cmd_submit {} pub const VIRTIO_GPU_CAPSET_VIRGL: u32 = 1; pub const VIRTIO_GPU_CAPSET_VIRGL2: u32 = 2; +pub const VIRTIO_GPU_CAPSET3: u32 = 3; /* VIRTIO_GPU_CMD_GET_CAPSET_INFO */ #[derive(Copy, Clone, Debug)] diff --git a/gpu_renderer/src/lib.rs b/gpu_renderer/src/lib.rs index 726f912..270dc93 100644 --- a/gpu_renderer/src/lib.rs +++ b/gpu_renderer/src/lib.rs @@ -41,6 +41,7 @@ pub use crate::generated::virglrenderer::{ virgl_renderer_resource_create_args, virgl_renderer_resource_info, VIRGL_RES_BIND_SCANOUT, VIRGL_RES_BIND_SHARED, }; +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`.. @@ -421,6 +422,10 @@ impl Renderer { /// Gets the version and size for the given capability set ID. pub fn get_cap_set_info(&self, id: u32) -> (u32, u32) { + if id == 3 { + return (0 as u32, size_of::<virtgpu_caps>() as u32); + } + let mut version = 0; let mut size = 0; // Safe because virglrenderer is initialized by now and properly size stack variables are |