操作系统在做硬件适配时,经常会检查系统内核是否支持硬件的显卡;如果不支持,则一般是通过升级内核或者该型号对应品牌的显卡驱动来解决(开源或者闭源);
操作流程如下
1> 查询本机的显卡型号
因显卡一般是PCI接口,可以通过lspci查询显卡相关信息,下图可以看出有两张显卡,
集成显卡 硬件厂商 Intel 名称型号: Xeon E3-1200 v3/4th Gen Core Processor PCI ID: 8086:0412
独立显卡 硬件厂商 NAVIDA 名称型号:GF119(GeForce GT 705) PCI ID: 10de:104c
notes:
lspci
-v Be verbose and display detailed information about all device 显示所有PCI设备的信息
-nn Show PCI vendor and device codes as both numbers and names. 显示PCI设备的厂商号和设备码
grep Context Line Control
-A NUM, --after-context=NUM 显示目标关键字之后的Num行,控制显示段落大小以便阅读 Print NUM lines of trailing context after matching lines. Places a line containing a group separator (described under --group-separator) between contiguous groups of matches. With the -o or --only-matching option, this has no effect and a warning is given.
|
同时可以使用另外一个软件lshw, 它是一款硬件信息查看的小工具,不仅可以清晰列出硬件设备的具体信息,而且可以将这些输出信息以json、xml、html形式进行输出。具体用法:man lshw
使用前要安装改软件,以Fedora25安装方法: sudo dnf install lshw
EXAMPLES
lshw -short
Lists hardware in a compact format.
lshw -class disk -class storage
Lists all disks and storage controllers in the system.
lshw -html -class network
Lists all network interfaces in HTML.
lshw -disable dmi
Don\'t use DMI to detect hardware.
2> 如何确认本机显卡驱动是否正常加载,同样可以使用lshw进行查看
注意上图中的configuration字段,如果driver=“驱动名称”字段后不为空,说明系统支持改显卡的驱动;
3> 如何查看显卡驱动的具体内容,可以利用 modinfo 驱动名称, 以NAVIDA独立显卡为例,显卡驱动名称为nouveau
[cxy@localhost-live 桌面]$ modinfo nouveau filename: /lib/modules/4.11.12-200.fc25.x86_64/kernel/drivers/gpu/drm/nouveau/nouveau.ko.xz firmware: nvidia/gp100/gr/sw_method_init.bin firmware: nvidia/gp100/gr/sw_bundle_init.bin …… 方便浏览期间,中间省略多行 firmware: nvidia/gm20b/gr/fecs_sig.bin firmware: nvidia/gm20b/gr/fecs_data.bin firmware: nvidia/gm20b/gr/fecs_inst.bin firmware: nvidia/gm20b/gr/fecs_bl.bin firmware: nvidia/gm20b/acr/ucode_load.bin firmware: nvidia/gm20b/acr/bl.bin license: GPL and additional rights description: nVidia Riva/TNT/GeForce/Quadro/Tesla author: Nouveau Project alias: pci:v000012D2d*sv*sd*bc03sc*i* alias: pci:v000010DEd*sv*sd*bc03sc*i* depends: drm,drm_kms_helper,ttm,mxm-wmi,wmi,video,i2c-algo-bit intree: Y vermagic: 4.11.12-200.fc25.x86_64 SMP mod_unload signat: PKCS#7 signer: sig_key: sig_hashalgo: md4 parm: tv_norm:Default TV norm. Supported: PAL, PAL-M, PAL-N, PAL-Nc, NTSC-M, NTSC-J, hd480i, hd480p, hd576i, hd576p, hd720p, hd1080i. Default: PAL *NOTE* Ignored for cards with external TV encoders. (charp) parm: vram_pushbuf:Create DMA push buffers in VRAM (int) parm: nofbaccel:Disable fbcon acceleration (int) parm: mst:Enable DisplayPort multi-stream (default: enabled) (int) parm: atomic:Expose atomic ioctl (default: disabled) (int) parm: tv_disable:Disable TV-out detection (int) parm: ignorelid:Ignore ACPI lid status (int) parm: duallink:Allow dual-link TMDS (default: enabled) (int) parm: hdmimhz:Force a maximum HDMI pixel clock (in MHz) (int) parm: config:option string to pass to driver core (charp) parm: debug:debug string to pass to driver core (charp) parm: noaccel:disable kernel/abi16 acceleration (int) parm: modeset:enable driver (default: auto, 0 = disabled, 1 = enabled, 2 = headless) (int) parm: runpm:disable (0), force enable (1), optimus only default (-1) (int)
|
4>拓展:如何确定显卡是否支持硬件加速
可以使用工具gxlinfo查询,如果可以查到OpenGL信息说明显卡支持硬件加速且正常加载;
gxlinfo属于glx-utils包,如果没有该指令,需要先安装这个包
[cxy@localhost-live 桌面]$ rpm -qf `which glxinfo`
glx-utils-8.3.0-6.fc25.x86_64