-
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy path0001-xf86-dri2-Use-va_gl-as-vdpau_driver-for-Intel-i965-G.patch
153 lines (138 loc) · 6.17 KB
/
0001-xf86-dri2-Use-va_gl-as-vdpau_driver-for-Intel-i965-G.patch
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
From acf5a0100c98a040e5e07a79ecf4a83627da770e Mon Sep 17 00:00:00 2001
From: Hans de Goede <[email protected]>
Date: Thu, 23 Mar 2017 12:54:07 +0100
Subject: [PATCH xserver] xf86: dri2: Use va_gl as vdpau_driver for Intel i965
GPUs
The modesetting driver (which now often is used with Intel GPUs),
relies on dri2_probe_driver_name() to get the dri and vdpau driver
names, before this commit it would always assign the same name to
the 2 names. But the vdpau driver for i965 GPUs should be va_gl
(i915 does not support vdpau at all).
This commit modifies the used lookup table and dri2_probe_driver_name()
to set the vdpau_driver to va_gl for i965 GPUs, it leaves the 2
names the same for all other GPUs.
Note this commit adds a FIXME comment for a memory leak in
dri2_probe_driver_name(), that leak was already present and fixing
it falls outside of the scope of this commit.
BugLink: https://bugzilla.redhat.com/show_bug.cgi?id=1413733
Signed-off-by: Hans de Goede <[email protected]>
---
hw/xfree86/dri2/dri2.c | 31 +++++++++++++--------
hw/xfree86/dri2/pci_ids/pci_id_driver_map.h | 21 +++++++-------
2 files changed, 31 insertions(+), 21 deletions(-)
diff --git a/hw/xfree86/dri2/dri2.c b/hw/xfree86/dri2/dri2.c
index 6619e3aa7..1f8ad14bc 100644
--- a/hw/xfree86/dri2/dri2.c
+++ b/hw/xfree86/dri2/dri2.c
@@ -1437,14 +1437,18 @@ get_prime_id(void)
#include "pci_ids/pci_id_driver_map.h"
-static char *
-dri2_probe_driver_name(ScreenPtr pScreen, DRI2InfoPtr info)
+static void
+dri2_probe_driver_name(ScreenPtr pScreen, DRI2InfoPtr info,
+ const char **dri_driver_ret,
+ const char **vdpau_driver_ret)
{
#ifdef WITH_LIBDRM
int i, j;
- char *driver = NULL;
drmDevicePtr dev;
+ *dri_driver_ret = NULL;
+ *vdpau_driver_ret = NULL;
+
/* For non-PCI devices and drmGetDevice fail, just assume that
* the 3D driver is named the same as the kernel driver. This is
* currently true for vc4 and msm (freedreno).
@@ -1454,12 +1458,14 @@ dri2_probe_driver_name(ScreenPtr pScreen, DRI2InfoPtr info)
xf86DrvMsg(pScreen->myNum, X_ERROR,
"[DRI2] Couldn't drmGetVersion() on non-PCI device, "
"no driver name found.\n");
- return NULL;
+ return;
}
- driver = strndup(version->name, version->name_len);
+ /* FIXME this gets leaked */
+ *dri_driver_ret = strndup(version->name, version->name_len);
+ *vdpau_driver_ret = *dri_driver_ret;
drmFreeVersion(version);
- return driver;
+ return;
}
for (i = 0; driver_map[i].driver; i++) {
@@ -1467,13 +1473,15 @@ dri2_probe_driver_name(ScreenPtr pScreen, DRI2InfoPtr info)
continue;
if (driver_map[i].num_chips_ids == -1) {
- driver = strdup(driver_map[i].driver);
+ *dri_driver_ret = driver_map[i].driver;
+ *vdpau_driver_ret = driver_map[i].vdpau_driver;
goto out;
}
for (j = 0; j < driver_map[i].num_chips_ids; j++) {
if (driver_map[i].chip_ids[j] == dev->deviceinfo.pci->device_id) {
- driver = strdup(driver_map[i].driver);
+ *dri_driver_ret = driver_map[i].driver;
+ *vdpau_driver_ret = driver_map[i].vdpau_driver;
goto out;
}
}
@@ -1485,9 +1493,9 @@ dri2_probe_driver_name(ScreenPtr pScreen, DRI2InfoPtr info)
dev->deviceinfo.pci->vendor_id, dev->deviceinfo.pci->device_id);
out:
drmFreeDevice(&dev);
- return driver;
#else
- return NULL;
+ *dri_driver_ret = NULL;
+ *vdpau_driver_ret = NULL;
#endif
}
@@ -1604,7 +1612,8 @@ DRI2ScreenInit(ScreenPtr pScreen, DRI2InfoPtr info)
} else {
/* FIXME dri2_probe_driver_name() returns a strdup-ed string,
* currently this gets leaked */
- ds->driverNames[0] = ds->driverNames[1] = dri2_probe_driver_name(pScreen, info);
+ dri2_probe_driver_name(pScreen, info,
+ &ds->driverNames[0], &ds->driverNames[1]);
if (!ds->driverNames[0])
return FALSE;
diff --git a/hw/xfree86/dri2/pci_ids/pci_id_driver_map.h b/hw/xfree86/dri2/pci_ids/pci_id_driver_map.h
index da7ea1c1e..7036d1003 100644
--- a/hw/xfree86/dri2/pci_ids/pci_id_driver_map.h
+++ b/hw/xfree86/dri2/pci_ids/pci_id_driver_map.h
@@ -60,23 +60,24 @@ static const int vmwgfx_chip_ids[] = {
static const struct {
int vendor_id;
const char *driver;
+ const char *vdpau_driver;
const int *chip_ids;
int num_chips_ids;
} driver_map[] = {
- { 0x8086, "i915", i915_chip_ids, ARRAY_SIZE(i915_chip_ids) },
- { 0x8086, "i965", i965_chip_ids, ARRAY_SIZE(i965_chip_ids) },
- { 0x8086, "i965", NULL, -1 },
+ { 0x8086, "i915", "i915", i915_chip_ids, ARRAY_SIZE(i915_chip_ids) },
+ { 0x8086, "i965", "va_gl", i965_chip_ids, ARRAY_SIZE(i965_chip_ids) },
+ { 0x8086, "i965", "va_gl", NULL, -1 },
#ifndef DRIVER_MAP_GALLIUM_ONLY
- { 0x1002, "radeon", r100_chip_ids, ARRAY_SIZE(r100_chip_ids) },
- { 0x1002, "r200", r200_chip_ids, ARRAY_SIZE(r200_chip_ids) },
+ { 0x1002, "radeon", "radeon", r100_chip_ids, ARRAY_SIZE(r100_chip_ids) },
+ { 0x1002, "r200", "r200", r200_chip_ids, ARRAY_SIZE(r200_chip_ids) },
#endif
- { 0x1002, "r300", r300_chip_ids, ARRAY_SIZE(r300_chip_ids) },
- { 0x1002, "r600", r600_chip_ids, ARRAY_SIZE(r600_chip_ids) },
- { 0x1002, "radeonsi", NULL, -1 },
- { 0x10de, "nouveau", NULL, -1 },
- { 0x1af4, "virtio_gpu", virtio_gpu_chip_ids, ARRAY_SIZE(virtio_gpu_chip_ids) },
- { 0x15ad, "vmwgfx", vmwgfx_chip_ids, ARRAY_SIZE(vmwgfx_chip_ids) },
- { 0x0000, NULL, NULL, 0 },
+ { 0x1002, "r300", "r300", r300_chip_ids, ARRAY_SIZE(r300_chip_ids) },
+ { 0x1002, "r600", "r600", r600_chip_ids, ARRAY_SIZE(r600_chip_ids) },
+ { 0x1002, "radeonsi", "radeonsi", NULL, -1 },
+ { 0x10de, "nouveau", "nouveau", NULL, -1 },
+ { 0x1af4, "virtio_gpu", "virtio_gpu", virtio_gpu_chip_ids, ARRAY_SIZE(virtio_gpu_chip_ids) },
+ { 0x15ad, "vmwgfx", "vmwgfx", vmwgfx_chip_ids, ARRAY_SIZE(vmwgfx_chip_ids) },
+ { 0x0000, NULL, NULL, NULL, 0 },
};
#endif /* _PCI_ID_DRIVER_MAP_H_ */