Skip to content

Commit fdeca4c

Browse files
committed
x11: don't do DRI3 with Intel drivers
Unfortunately i965 and iHD drivers lack DRI3 support. It's unknown when/if they will gain support, so explicitly disable DRI3 for them - it's not perfect, alas better than asking every affected user to manually set the environment override. v2: - drop by default, can still use them with LIBVA_DISABLE_DRI3=0 Signed-off-by: Emil Velikov <[email protected]>
1 parent 984dfee commit fdeca4c

File tree

1 file changed

+30
-1
lines changed

1 file changed

+30
-1
lines changed

va/x11/va_x11.c

Lines changed: 30 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -77,8 +77,37 @@ static VAStatus va_DisplayContextGetDriverNames(
7777
{
7878
VAStatus vaStatus = VA_STATUS_ERROR_UNKNOWN;
7979

80-
if (!getenv("LIBVA_DRI3_DISABLE"))
80+
const char* dri3_disable = getenv("LIBVA_DRI3_DISABLE");
81+
if (!dri3_disable || !atoi(dri3_disable)) {
82+
unsigned old_num_drivers = *num_drivers;
83+
8184
vaStatus = va_DRI3_GetDriverNames(pDisplayContext, drivers, num_drivers);
85+
/* As of 8 July 2023, i965 and iHD drivers lack DRI3 support.
86+
*
87+
* Requests by the community were raised as early as 29 July 2017,
88+
* with DRI3 support landing in libva on the 27 September 2022. At of
89+
* time of writing it's unknown if/when that would materialise.
90+
*
91+
* To handle this on libva level, we are explicitly disabling DRI3
92+
* support on said drivers - it scales better than having every user
93+
* to set the environment override listed above.
94+
*
95+
* Omit them by default, set LIBVA_DRI3_DISABLE=0 to bypass.
96+
*/
97+
if (vaStatus == VA_STATUS_SUCCESS && dri3_disable && !atoi(dri3_disable)) {
98+
for (unsigned i = 0; i < *num_drivers; i++) {
99+
if (drivers[i] && (!strcmp(drivers[i], "iHD") ||
100+
!strcmp(drivers[i], "i965")))
101+
vaStatus = VA_STATUS_ERROR_UNKNOWN;
102+
}
103+
if (vaStatus == VA_STATUS_ERROR_UNKNOWN) {
104+
for (unsigned i = 0; i < *num_drivers; i++)
105+
free(drivers[i]);
106+
*num_drivers = old_num_drivers;
107+
}
108+
}
109+
}
110+
82111
if (vaStatus != VA_STATUS_SUCCESS)
83112
vaStatus = va_DRI2_GetDriverNames(pDisplayContext, drivers, num_drivers);
84113
#ifdef HAVE_NVCTRL

0 commit comments

Comments
 (0)