Skip to content

Commit b5bc35f

Browse files
mtjhrcslp
authored andcommitted
gpu: Fix GetDisplayInfo command decoding
We wrongly expected an extra virtio_gpu_ctrl_hdr for VIRTIO_GPU_CMD_GET_DISPLAY_INFO The command doesn't have any body and we have already read the ctrl_header. Signed-off-by: Matej Hrica <[email protected]>
1 parent 603c303 commit b5bc35f

File tree

2 files changed

+4
-4
lines changed

2 files changed

+4
-4
lines changed

src/devices/src/virtio/gpu/protocol.rs

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -542,7 +542,7 @@ pub const VIRTIO_GPU_FORMAT_R8G8B8X8_UNORM: u32 = 134;
542542
/// A virtio gpu command and associated metadata specific to each command.
543543
#[derive(Copy, Clone)]
544544
pub enum GpuCommand {
545-
GetDisplayInfo(virtio_gpu_ctrl_hdr),
545+
GetDisplayInfo,
546546
ResourceCreate2d(virtio_gpu_resource_create_2d),
547547
ResourceUnref(virtio_gpu_resource_unref),
548548
SetScanout(virtio_gpu_set_scanout),
@@ -591,7 +591,7 @@ impl fmt::Debug for GpuCommand {
591591
fn fmt(&self, f: &mut fmt::Formatter) -> fmt::Result {
592592
use self::GpuCommand::*;
593593
match self {
594-
GetDisplayInfo(_info) => f.debug_struct("GetDisplayInfo").finish(),
594+
GetDisplayInfo => f.debug_struct("GetDisplayInfo").finish(),
595595
ResourceCreate2d(_info) => f.debug_struct("ResourceCreate2d").finish(),
596596
ResourceUnref(_info) => f.debug_struct("ResourceUnref").finish(),
597597
SetScanout(_info) => f.debug_struct("SetScanout").finish(),
@@ -628,7 +628,7 @@ impl GpuCommand {
628628
use self::GpuCommand::*;
629629
let hdr = cmd.read_obj::<virtio_gpu_ctrl_hdr>()?;
630630
let cmd = match hdr.type_ {
631-
VIRTIO_GPU_CMD_GET_DISPLAY_INFO => GetDisplayInfo(cmd.read_obj()?),
631+
VIRTIO_GPU_CMD_GET_DISPLAY_INFO => GetDisplayInfo,
632632
VIRTIO_GPU_CMD_RESOURCE_CREATE_2D => ResourceCreate2d(cmd.read_obj()?),
633633
VIRTIO_GPU_CMD_RESOURCE_UNREF => ResourceUnref(cmd.read_obj()?),
634634
VIRTIO_GPU_CMD_SET_SCANOUT => SetScanout(cmd.read_obj()?),

src/devices/src/virtio/gpu/worker.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -100,7 +100,7 @@ impl Worker {
100100
virtio_gpu.force_ctx_0();
101101

102102
match cmd {
103-
GpuCommand::GetDisplayInfo(_) => {
103+
GpuCommand::GetDisplayInfo => {
104104
panic!("virtio_gpu: GpuCommand::GetDisplayInfo unimplemented");
105105
}
106106
GpuCommand::ResourceCreate2d(info) => {

0 commit comments

Comments
 (0)