加载论坛时出错,请强制刷新页面重试。

loongnix 内核代码漫游:龙芯桥片集显的驱动

bexsder

内核代码下载

# 需要在apt的sources.list中加入 deb-src 行,告诉apt源码仓库的具体位置等信息
sudo apt update    # 需要系统权限,更新仓库数据库
apt source linux     # 不需要系统权限,用户目录下运行,命令下载源代码包并解压

龙芯桥片集成显卡的一些信息收集

  • 截止目前,龙芯公开发售的桥片有两个,7A1000 和 7A2000
  • 桥片内置的集成显卡内核驱动分成两部分,一部分是显示控制,一部分是GPU控制
  • 显示控制的驱动源码目录: src/drivers/gpu/drm/loongson 和 src/drivers/gpu/drm/lsdc
  • 显示控制驱动支持 7A1000&2000,主要功能是KMS(内核态的显示模式控制)和 TTM(内核态的显存管理)
  • 这个驱动支持桥片外置显存的管理,和GPU配合,支持3D加速功能
  • 图形处理单元GPU驱动,提供3D硬件加速功能,
  • 7A1000的GPU是atnaviv的GC1000 ip
  • 驱动源码目录: src/drivers/gpu/drm/etnaviv
  • 7A2000的GPU是龙芯LG100系列图形处理核心
  • 内核驱动源码目录: src/drivers/gpu/gsgpu
  • 这两个图形处理核心的dri驱动可以在loongnix仓库中找到 apt source mesa
  • 可以使用 lsmod 查看这两个驱动的加载情况,也可以通过访问 /dev/dri 查看一些细节

代码漫游

内核配置选项

# 7A1000 GPU内核驱动
CONFIG_DRM_ETNAVIV=m
CONFIG_DRM_ETNAVIV_PCI_DRIVER=y
CONFIG_DRM_ETNAVIV_THERMAL=y

# 桥片显示控制内核驱动
CONFIG_DRM_LOONGSON_VGA=m

# amd显卡的内核驱动
CONFIG_DRM_RADEON=m
CONFIG_DRM_RADEON_USERPTR=y
CONFIG_DRM_AMDGPU=m
CONFIG_DRM_AMDGPU_SI=y
CONFIG_DRM_AMDGPU_CIK=y
CONFIG_DRM_AMDGPU_USERPTR=y

src/drivers/gpu/drm/loongson

config DRM_LOONGSON_VGA
	tristate "DRM support for loongson chipset and soc"
	depends on DRM && PCI
	select FB_SYS_FILLRECT
	select FB_SYS_COPYAREA
	select FB_SYS_IMAGEBLIT
	select DRM_KMS_HELPER
	select DRM_KMS_FB_HELPER
	select DRM_TTM
	select REGMAP_I2C
	select VIDEOMODE_HELPERS
	default n
	help
	  DRM display driver for loongson vga control.

config DRM_LOONGSON_VGA_PLATFORM
	bool "use platfrom device"
	depends on DRM_LOONGSON_VGA && CPU_LOONGSON2K
	help
	  This option selects CONFIG_MMU_NOTIFIER if it isn't already
	  selected to enabled full userptr support.

src/drivers/gpu/drm/lsdc

config DRM_LSDC
	tristate "Kernel modesetting driver for loongson display controller"
	depends on DRM
	depends on MACH_LOONGSON64 || LOONGARCH || COMPILE_TEST
	select OF
	select CMA if HAVE_DMA_CONTIGUOUS
	select DMA_CMA if HAVE_DMA_CONTIGUOUS
	select DRM_KMS_HELPER
	select DRM_KMS_FB_HELPER
	select DRM_GEM_CMA_HELPER
	select DRM_KMS_CMA_HELPER
	select VIDEOMODE_HELPERS
	select BACKLIGHT_PWM
	select REGULATOR
	select REGULATOR_FIXED_VOLTAGE
	select DRM_PANEL_SIMPLE
	select DRM_DUMB_VGA_DAC
	select DRM_SII902X
	select DRM_LT8618
	select DRM_TI_TFP410
	select I2C_GPIO
	select I2C_LS2X
	default m
	help
	  This is a KMS driver for the display controller in the LS7A1000
	  bridge chip and LS2K1000 SoC.

	  Note that this driver is different from the loongson KMS
	  driver (loongson.ko), the loongson KMS driver using TTM
	  memory manager and its framebuffer is allocated from VRAM.
	  This driver is based-on CMA and DMA_CMA, its framebuffer
	  is located from system memory. By default, this driver is
	  not enabled on LS7A1000 + LS3A3000/LS3A4000 platform.
	  Pass the following parameter to the kernel commnad line
	  if you would like to have a try.

	    loongson.enable=0 lsdc.modeset=1

	  If "M" is selected, the module will be called lsdc.

	  If in doubt, say "Y".

config DRM_LSDC_PCI_DRIVER
	bool "Enable pci device driver support for DC in LS7A1000 Bridge"
	depends on DRM_LSDC
	depends on PCI
	default y
	help
	  Choose this if you want to build CMA-base KMS driver
	  for the display controller in LS7A1000.

	  DRM_LSDC_PCI_DRIVER will be defined on when the dc is a pci device

	  If in doubt, say "Y".


xen0n

yxd-ym 这是显示控制器驱动,不包含3D加速功能



TSiNGKONG

xen0n 嗯,不支持 DRIVER_RENDER


杜比

更新了一点gsgpu和dri驱动相关信息


子扉

“驱动源码目录: src/drivers/gpu/drm/atnaviv”

应该是:

驱动源码目录: src/drivers/gpu/drm/etnaviv


杜比

子扉 感谢指正,已修改


知识共享许可协议
本站文章除其作者特殊声明外,一律采用CC BY-NC-SA 4.0许可协议进行授权。
进行转载或二次创作时务必以相同协议进行共享,严禁用于商业用途