diff options
author | David Stevens <stevensd@chromium.org> | 2020-01-22 21:17:28 +0900 |
---|---|---|
committer | Commit Bot <commit-bot@chromium.org> | 2020-04-04 13:49:16 +0000 |
commit | 11e71a1838b8417c605894ec3397f99a2ab9dd66 (patch) | |
tree | fed7f3b9365ec4a00df4fb1ac3acd572fe156f33 /devices/src/virtio/gpu/virtio_3d_backend.rs | |
parent | 4cbcc26f5c34d8254a9f98e065a923abb194ba8b (diff) | |
download | crosvm-11e71a1838b8417c605894ec3397f99a2ab9dd66.tar crosvm-11e71a1838b8417c605894ec3397f99a2ab9dd66.tar.gz crosvm-11e71a1838b8417c605894ec3397f99a2ab9dd66.tar.bz2 crosvm-11e71a1838b8417c605894ec3397f99a2ab9dd66.tar.lz crosvm-11e71a1838b8417c605894ec3397f99a2ab9dd66.tar.xz crosvm-11e71a1838b8417c605894ec3397f99a2ab9dd66.tar.zst crosvm-11e71a1838b8417c605894ec3397f99a2ab9dd66.zip |
virtio-gpu: add support for exporting virtgpu resources
BUG=b:136269340 TEST=boot ARCVM and launch play store Change-Id: I2d78ffb15dcf2dc0f245916485f5ebb636ef6e78 Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/platform/crosvm/+/2014680 Reviewed-by: David Stevens <stevensd@chromium.org> Reviewed-by: Zach Reizner <zachr@chromium.org> Tested-by: David Stevens <stevensd@chromium.org> Tested-by: kokoro <noreply+kokoro@google.com> Commit-Queue: Keiichi Watanabe <keiichiw@chromium.org>
Diffstat (limited to 'devices/src/virtio/gpu/virtio_3d_backend.rs')
-rw-r--r-- | devices/src/virtio/gpu/virtio_3d_backend.rs | 17 |
1 files changed, 17 insertions, 0 deletions
diff --git a/devices/src/virtio/gpu/virtio_3d_backend.rs b/devices/src/virtio/gpu/virtio_3d_backend.rs index 3ede8a6..692bedc 100644 --- a/devices/src/virtio/gpu/virtio_3d_backend.rs +++ b/devices/src/virtio/gpu/virtio_3d_backend.rs @@ -497,6 +497,23 @@ impl Backend for Virtio3DBackend { self.base.move_cursor(x, y) } + /// Returns a uuid for the resource. + fn resource_assign_uuid(&mut self, id: u32) -> GpuResponse { + match self.resources.entry(id) { + Entry::Vacant(_) => GpuResponse::ErrInvalidResourceId, + Entry::Occupied(_) => { + // TODO(stevensd): use real uuids once the virtio wayland protocol is updated to + // handle more than 32 bits. For now, the virtwl driver knows that the uuid is + // actually just the resource id. + let mut uuid: [u8; 16] = [0; 16]; + for (idx, byte) in id.to_be_bytes().iter().enumerate() { + uuid[12 + idx] = *byte; + } + GpuResponse::OkResourceUuid { uuid } + } + } + } + /// Gets the renderer's capset information associated with `index`. fn get_capset_info(&self, index: u32) -> GpuResponse { let id = match index { |