virtio-gpu: fix reporting of VIRTIO_F_VERSION_1

The virtio 1.0 feature flag is defined as a shift count, not a mask.

While we're at it, change the virtio gpu features() function to the
avail_features style used in other devices for consistency.

BUG=None
TEST=None

Change-Id: I704d9676cfe5f13d9a2f83eb9160937e94070d1e
Signed-off-by: Daniel Verkamp <dverkamp@chromium.org>
Reviewed-on: https://chromium-review.googlesource.com/1198224
Reviewed-by: Zach Reizner <zachr@chromium.org>
This commit is contained in:
Daniel Verkamp 2018-08-30 16:29:00 -07:00 committed by chrome-bot
parent 9c7cd86325
commit 8a4a13d48d

View file

@ -635,9 +635,10 @@ impl VirtioDevice for Gpu {
}
fn features(&self, page: u32) -> u32 {
let avail_features: u64 = 1 << VIRTIO_GPU_F_VIRGL | 1 << VIRTIO_F_VERSION_1;
match page {
0 => (1 << VIRTIO_GPU_F_VIRGL),
1 => VIRTIO_F_VERSION_1,
0 => avail_features as u32,
1 => (avail_features >> 32) as u32,
_ => 0,
}
}