1 Star 0 Fork 44

konglidong/xorg-x11-server

加入 Gitee
与超过 1200万 开发者一起发现、参与优秀开源项目,私有仓库也完全免费 :)
免费加入
该仓库未声明开源许可证文件(LICENSE),使用请关注具体项目描述及其代码上游依赖。
克隆/下载
0001-xfree86-use-modesetting-driver-by-default-on-GeForce.patch 1.64 KB
一键复制 编辑 原始数据 按行查看 历史
t.feng 提交于 2020-03-16 22:51 . patch init
From aa2f34d80ef3118eae0cce73b610c36cdcb978fe Mon Sep 17 00:00:00 2001
From: Ben Skeggs <bskeggs@redhat.com>
Date: Sat, 22 Apr 2017 02:26:28 +1000
Subject: [PATCH xserver] xfree86: use modesetting driver by default on GeForce
8 and newer
Signed-off-by: Ben Skeggs <bskeggs@redhat.com>
---
hw/xfree86/common/xf86pciBus.c | 20 ++++++++++++++++++++
1 file changed, 20 insertions(+)
diff --git a/hw/xfree86/common/xf86pciBus.c b/hw/xfree86/common/xf86pciBus.c
index 8158c2b62..78d1c947d 100644
--- a/hw/xfree86/common/xf86pciBus.c
+++ b/hw/xfree86/common/xf86pciBus.c
@@ -37,6 +37,7 @@
#include <unistd.h>
#include <X11/X.h>
#include <pciaccess.h>
+#include <xf86drm.h>
#include "os.h"
#include "Pci.h"
#include "xf86.h"
@@ -1190,6 +1191,25 @@ xf86VideoPtrToDriverList(struct pci_device *dev,
int idx = 0;
#if defined(__linux__) || defined(__NetBSD__)
+ char busid[32];
+ int fd;
+
+ snprintf(busid, sizeof(busid), "pci:%04x:%02x:%02x.%d",
+ dev->domain, dev->bus, dev->dev, dev->func);
+
+ /* 'modesetting' is preferred for GeForce 8 and newer GPUs */
+ fd = drmOpenWithType("nouveau", busid, DRM_NODE_RENDER);
+ if (fd >= 0) {
+ uint64_t args[] = { 11 /* NOUVEAU_GETPARAM_CHIPSET_ID */, 0 };
+ int ret = drmCommandWriteRead(fd, 0 /* DRM_NOUVEAU_GETPARAM */,
+ &args, sizeof(args));
+ drmClose(fd);
+ if (ret == 0) {
+ if (args[1] == 0x050 || args[1] >= 0x80)
+ break;
+ }
+ }
+
driverList[idx++] = "nouveau";
#endif
driverList[idx++] = "nv";
--
2.12.2
马建仓 AI 助手
尝试更多
代码解读
代码找茬
代码优化
1
https://gitee.com/konglidong/xorg-x11-server.git
git@gitee.com:konglidong/xorg-x11-server.git
konglidong
xorg-x11-server
xorg-x11-server
master

搜索帮助