Skip to main content

Direct Python bindings for AMD, NVIDIA, and Intel DisplayPort AUX access

Project description

gpu_aux

Windows x64 纯 Python GPU AUX 包。Python 使用 ctypes 直接加载系统 AMDatiadlxx.dll、NVIDIA nvapi64.dll 或 Intel IGCL ControlLib.dll,不包含或依赖C/C++ 中间 DLL

实现了AUX DPCD读写、IIC OVER AUX读写,以方便eDP&DP面板调试;

完整接口说明见 API.md

安装

通过 PyPI 安装:

python -m pip install gpu-aux

从本地源码目录安装:

python -m pip install .

支持:

  • 按 PCI 地址合并 ADL 重复项,枚举物理 AMD GPU 和每个已连接 DP/eDP 端口
  • 枚举 NVIDIA 物理 GPU 和已连接 DP 端口
  • 枚举 Intel IGCL GPU 和已连接 DP/eDP 端口
  • AMD DPCD 读写:ADL_Display_NativeAUXChannel_Access
  • AMD I2C-over-AUX 读写:ADL_Display_DDCBlockAccess_Get
  • NVIDIA DPCD/I2C-over-AUX 读写:NvAPI_Disp_DpAuxChannelControl
  • Intel DPCD/I2C-over-AUX 读写:ctlAUXAccess
  • 以 backend、GPU index 和显示目标 ID 区分多个 DP/eDP 端口

公开 GPU API 参考:

直接构造一个端口对象:

from gpu_aux import AuxPort

with AuxPort("DP", index=0, gpu_index=0, backend="NVIDIA") as dp:
    print(dp.read_dpcd(0x00000, 16).hex(" "))
    edid = dp.i2c_read(0x50, 0, 128)

GPU 与端口枚举是两个独立的模块级函数,不需要先创建 AuxPort

from gpu_aux import enumerate_gpus, enumerate_ports

for gpu_index, gpu in enumerate(enumerate_gpus("NVIDIA")):
    print(gpu_index, gpu.backend, gpu.name)
    for port in enumerate_ports("NVIDIA", gpu_index):
        print(port.kind, port.identity, port.name)

index 是同一 GPU、同一端口类型内的序号,例如第二个外接 DP 使用AuxPort("DP", index=1, gpu_index=0, backend="NVIDIA")

多个同后端 AuxPort对象共享同一 context,并在最后一个对象关闭时释放。后端必须由调用方显式指定,不会自动选择。

测试

从项目根目录运行只读测试:

python .\tests\smoke_test.py NVIDIA
python .\tests\smoke_test.py INTEL

读写硬件测试会向 DPCD 0x00102 写入 C0、回读并恢复原值,同时通过 I2C 地址 0x30/0x50 读取 EDID:

python .\tests\hardware_aux_test_nvidia.py

AMD 写测试使用独立入口:

python .\tests\hardware_aux_test_amd.py

Intel 写测试也使用独立入口:

python .\tests\hardware_aux_test_intel.py

私有 ADL/NVAPI AUX 接口可能随显卡驱动变化;Intel 路径使用公开 IGCL ctlAUXAccess。当前实现要求 Windows x64、64 位 Python、AMD/NVIDIA/Intel DP/eDP 链路;包内会串行化 AUX 事务。

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

gpu_aux-1.2.1.tar.gz (18.6 kB view details)

Uploaded Source

Built Distribution

If you're not sure about the file name format, learn more about wheel file names.

gpu_aux-1.2.1-py3-none-any.whl (17.5 kB view details)

Uploaded Python 3

File details

Details for the file gpu_aux-1.2.1.tar.gz.

File metadata

  • Download URL: gpu_aux-1.2.1.tar.gz
  • Upload date:
  • Size: 18.6 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.2.0 CPython/3.9.13

File hashes

Hashes for gpu_aux-1.2.1.tar.gz
Algorithm Hash digest
SHA256 bd2e40a6853a8c092dba080b9b7a45aa7139ab51bf6dbb7fc5261a579cc2a7ce
MD5 30bcdc30f9f53ae4afafa0e4165dfa91
BLAKE2b-256 f9c723979a4d5fc92df9c98b0dfb0ff840038e321f9a5c40f21a50f68313af6b

See more details on using hashes here.

File details

Details for the file gpu_aux-1.2.1-py3-none-any.whl.

File metadata

  • Download URL: gpu_aux-1.2.1-py3-none-any.whl
  • Upload date:
  • Size: 17.5 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.2.0 CPython/3.9.13

File hashes

Hashes for gpu_aux-1.2.1-py3-none-any.whl
Algorithm Hash digest
SHA256 b0a6d6351441e4c493b215ee52ab2b770237ba0b3cea1160afc1f2e5b3575fd0
MD5 fae93a87d95f30dd119b4acfe870e900
BLAKE2b-256 980e4a92435495aafa06c0d8edca0b149978960fc7d1464f982b3f5043c862ec

See more details on using hashes here.

Supported by

AWS Cloud computing and Security Sponsor Datadog Monitoring Depot Continuous Integration Fastly CDN Google Download Analytics Pingdom Monitoring Sentry Error logging StatusPage Status page