Linux command
modetest 命令
文本
复制后可按需替换文件名、目录或参数。
常用示例
List connectors
modetest -M [driver] -c
List all DRM objects
modetest -M [i915]
Set resolution
sudo modetest -M [driver] -s [connector_id]:[1920x1080]
Test a specific plane
sudo modetest -M [driver] -P [plane_id]@[crtc_id]:[WxH]+[X]+[Y]@[format]
Set a DRM property
sudo modetest -M [driver] -w [obj_id]:[prop_name]:[value]
Use atomic mode setting
sudo modetest -M [driver] -a -s [connector_id]:[1920x1080]
说明
modetest is a diagnostic tool for testing and debugging Kernel Mode Setting (KMS) functionality of Direct Rendering Manager (DRM) drivers. It enumerates DRM objects including connectors, encoders, CRTCs, and planes, and can set display modes directly. The tool is part of libdrm and provides low-level access to the graphics subsystem for testing display configurations, pixel formats, and plane overlays. When no query or test options are given, it dumps all available DRM information. It displays an SMPTE color bar test pattern when setting modes.
参数
- -M _module_
- Use the given DRM driver module (e.g., i915, amdgpu, nouveau)
- -D _device_
- Use the given DRM device node
- -c
- List connectors and their available modes
- -e
- List encoders
- -f
- List framebuffers
- -p
- List CRTCs and planes
- -s _connector_id,connector_id@crtc_id:mode-vrefresh@format_
- Set a mode on one or more connectors
- **-P _plane_id@crtc_id:WxH+X+Y*scale@format_**
- Test a plane with specified configuration
- -C
- Test hardware cursor
- -v
- Test vsynced page flipping
- -w _obj_id:prop_name:value_
- Set a property on a DRM object
- -a
- Use atomic mode setting API
- -F _pattern1,pattern2_
- Specify fill patterns for test image
- -d
- Drop DRM master after mode set
FAQ
What is the modetest command used for?
modetest is a diagnostic tool for testing and debugging Kernel Mode Setting (KMS) functionality of Direct Rendering Manager (DRM) drivers. It enumerates DRM objects including connectors, encoders, CRTCs, and planes, and can set display modes directly. The tool is part of libdrm and provides low-level access to the graphics subsystem for testing display configurations, pixel formats, and plane overlays. When no query or test options are given, it dumps all available DRM information. It displays an SMPTE color bar test pattern when setting modes.
How do I run a basic modetest example?
Run `modetest -M [driver] -c` in a terminal, then adjust file names, paths, flags, or remote targets for your system.
What does -M _module_ do in modetest?
Use the given DRM driver module (e.g., i915, amdgpu, nouveau)