gfx-rs/wgpu · error

Failed to get display modes

Error message

Failed to get display modes

What it means

A panic from .expect() in create_surface_from_drm when vkGetDisplayModePropertiesKHR (VK_KHR_display) fails or returns an error result while enumerating the supported modes of the acquired DRM display. This happens after the display was successfully acquired, so it indicates the driver/display could not report its mode list at all (driver bug, display disconnected between acquire and query, or unsupported KHR_display usage) rather than merely a missing requested resolution. The panic aborts the process; no mode matching (width/height/refresh rate) has been attempted yet.

Source

Thrown at wgpu-hal/src/vulkan/drm.rs:216

        let display = unsafe {
            acquire_drm_display_instance
                .get_drm_display(physical_device, fd, connector_id)
                .expect("Failed to get drm display")
        };

        unsafe {
            acquire_drm_display_instance
                .acquire_drm_display(physical_device, fd, display)
                .expect("Failed to acquire drm display")
        }

        let display_instance = khr::display::Instance::new(&self.shared.entry, &self.shared.raw);

        let modes = unsafe {
            display_instance
                .get_display_mode_properties(physical_device, display)
                .expect("Failed to get display modes")
        };

        let mut mode = None;

        for current_mode in modes {
            log::trace!(
                "Comparing mode {}x{}@{} with {width}x{height}@{refresh_rate}",
                current_mode.parameters.visible_region.width,
                current_mode.parameters.visible_region.height,
                current_mode.parameters.refresh_rate
            );
            if current_mode.parameters.refresh_rate == refresh_rate
                && current_mode.parameters.visible_region.width == width
                && current_mode.parameters.visible_region.height == height
            {
                mode = Some(current_mode)
            }
        }

View on GitHub (pinned to 3e11ff59bf)

Solutions

  1. Retry after the display connection settles; verify the connector has an active mode
  2. Use a different output/connector on the DRM device
Defensive patterns

Strategy: retry

When it happens

Trigger: Thrown at wgpu-hal/src/vulkan/drm.rs:216 when the library encounters an invalid state.

Common situations: See trigger scenarios.


AI-assisted analysis of gfx-rs/wgpu@3e11ff59bf (2026-09-03). Data as JSON: /api/errors/430607b21a1d1dd9. Report an issue: GitHub.