TrumanWong

modetest

Mode testing tools in DRM/KMS driver libdrm

Supplementary instructions

modetest is a command line tool used to test and verify DRM (Direct Rendering Manager) driver functionality.

Install

Compile

./configure --prefix=/opt/ --host=aarch64-linux-gnu
make && make install
## Compile and delete
make distclean

Reference: libdrm debugging preparation - short book

grammar

modetest [option]

Options

# Query options
-c list connectors
-e list encoders
-f list framebuffer
-p list CRTCs and planes

# Test options
-P <plane_id>@<crtc_id>:<w>x<h>[+<x>+<y>][*<scale>][@<format>] Set a plane
-s <connector_id>[,<connector_id>][@<crtc_id>]:<mode>[-<vrefresh>][@<format>] Set a display mode
-C test hardware cursor
-v tests vertical sync page flipping
-w <obj_id>:<prop_name>:<value> Set properties

# Common options
-a enables atomic mode settings
-d relinquishes master control after mode is set
-M <module> specifies the driver module to use
-D <device> specifies the device to use

Parameters

<modele> driver module

  • i915: Intel integrated graphics driver module
  • amdgpu: AMD Radeon graphics driver module
  • radeon: legacy AMD Radeon graphics driver module
  • nouveau: NVIDIA open source graphics driver module
  • vmwgfx: VMware graphics driver module
  • omapdrm: TI OMAP graphics card driver module
  • exynos: Samsung Exynos graphics card driver module
  • tilcdc: TI LCD controller graphics driver module
  • msm: Qualcomm MSM graphics driver module
  • sti: STMicroelectronics graphics card driver module
  • tegra: NVIDIA Tegra graphics card driver module
  • imx-drm: Freescale i.MX graphics card driver module
  • rockchip: Rockchip graphics card driver module

Example

Use modetest to view relevant information

~# modetest
Encoders: # A lot is omitted
id crtc type possible crtcs possible clones
194 0 Virtual 0x0000000f 0x00000001
196 88 TMDS 0x00000002 0x00000002
210 0 DSI 0x00000004 0x00000004
213 0TMDS 0x00000001 0x00000008

Connectors: # Many are omitted
id encoder status name size (mm) modes encoders
197 196 connected HDMI-A-1 530x300 10 196
   mode # A lot of bala bala a long list
211 210 connected DSI-1 184x114 1 210
214 0 disconnected DP-1 0x0 0 213

CRTCs: # Omitted a lot of ****
id fb pos size
68 0 (0,0) (0x0)
   0 0 0 0 0 0 0 0 0 0 flags: ; type:
88 0 (0,0) (0x0)
    0 0 0 0 0 0 0 0 0 0 flags: ; type:
108 219 (0,0) (1200x1920)
   1200x1920 60 1200 1280 1284 1344 1920 1955 1956 1981 159400 flags: ; type:
128 0 (0,0) (0x0)
    0 0 0 0 0 0 0 0 0 0 flags: ; type:

Planes: # A lot is omitted
id crtc fb CRTC x,y x,y gamma size possible crtcs
54 0 0 0,0 0,0 0 0x0000000f
   formats: XR24 AR24
74 0 0 0,0 0,0 0 0x0000000f
   formats: XR24 AR24
94 108 219 0,0 0,0 0 0x0000000f
   formats: XR24 AR24

Use the Rockchip graphics driver test on the MIPI-DSI display device based on the above information

~# modetest -M rockchip -s 211@108:1200x1920 -v
freq: 59.90Hz
freq: 59.87Hz
freq: 59.87Hz
freq: 59.87Hz
freq: 59.87Hz
freq: 59.87Hz
freq: 59.87Hz
freq: 59.87Hz
freq: 59.87Hz

You will see flashing colored blocks on the MIPI screen.


~# modetest -M rockchip -s 211@108:1200x1920 -C
setting mode 1200x1920-60Hz@XR24 on connectors 211, crtc 108
starting cursor

You will see static blocks of color on the MIPI screen.