From 19db67cfe50adc8250596e487546e2133c9e7ee2 Mon Sep 17 00:00:00 2001 From: Geoffrey McRae Date: Sat, 9 Jan 2021 21:25:41 +1100 Subject: [PATCH] [client] egl: detect the NVIDIA driver and disable DMA support DMA suport for NVIDIA is advertised as available by the presense of the extension `EGL_EXT_image_dma_buf_import`, however it is completely broken. Until this is fixed refuse to use DMA support even if VM->VM support is possible. See: https://forums.developer.nvidia.com/t/egl-ext-image-dma-buf-import-broken-egl-bad-alloc-with-tons-of-free-ram/165552 --- client/renderers/EGL/egl.c | 18 ++++++++++++++++-- 1 file changed, 16 insertions(+), 2 deletions(-) diff --git a/client/renderers/EGL/egl.c b/client/renderers/EGL/egl.c index a4b00a97..5839bddd 100644 --- a/client/renderers/EGL/egl.c +++ b/client/renderers/EGL/egl.c @@ -565,16 +565,30 @@ bool egl_render_startup(void * opaque, SDL_Window * window) eglMakeCurrent(this->display, this->surface, this->surface, this->context); const char *client_exts = eglQueryString(this->display, EGL_EXTENSIONS); + const char *vendor = (const char *)glGetString(GL_VENDOR); DEBUG_INFO("EGL : %d.%d", maj, min); - DEBUG_INFO("Vendor : %s", glGetString(GL_VENDOR )); + DEBUG_INFO("Vendor : %s", vendor); DEBUG_INFO("Renderer : %s", glGetString(GL_RENDERER)); DEBUG_INFO("Version : %s", glGetString(GL_VERSION )); DEBUG_INFO("EGL APIs : %s", eglQueryString(this->display, EGL_CLIENT_APIS)); DEBUG_INFO("Extensions: %s", client_exts); if (strstr(client_exts, "EGL_EXT_image_dma_buf_import") != NULL) - this->dmaSupport = true; + { + /* + * As of version 455.45.01 NVidia started advertising support for this + * feature, however even on the latest version 460.27.04 this is still + * broken and does not work, until this is fixed and we have way to detect + * this early just disable dma for all NVIDIA devices. + * + * ref: https://forums.developer.nvidia.com/t/egl-ext-image-dma-buf-import-broken-egl-bad-alloc-with-tons-of-free-ram/165552 + */ + if (strstr(vendor, "NVIDIA") != NULL) + DEBUG_WARN("NVIDIA driver detected, ignoring broken DMA support"); + else + this->dmaSupport = true; + } eglSwapInterval(this->display, this->opt.vsync ? 1 : 0);