diff --git a/client/include/egl_dynprocs.h b/client/include/egl_dynprocs.h index 43190ce1..a021388d 100644 --- a/client/include/egl_dynprocs.h +++ b/client/include/egl_dynprocs.h @@ -38,6 +38,8 @@ struct EGLDynProcs PFNGLDEBUGMESSAGECALLBACKKHRPROC glDebugMessageCallback; PFNGLDEBUGMESSAGECALLBACKKHRPROC glDebugMessageCallbackKHR; PFNGLBUFFERSTORAGEEXTPROC glBufferStorageEXT; + PFNEGLCREATEIMAGEPROC eglCreateImage; + PFNEGLDESTROYIMAGEPROC eglDestroyImage; }; extern struct EGLDynProcs g_egl_dynProcs; diff --git a/client/renderers/EGL/egl.c b/client/renderers/EGL/egl.c index 05a08bb7..a9db8cd6 100644 --- a/client/renderers/EGL/egl.c +++ b/client/renderers/EGL/egl.c @@ -781,15 +781,16 @@ static bool egl_renderStartup(LG_Renderer * renderer, bool useDMA) if (!this->hasBufferAge) DEBUG_WARN("GL_EXT_buffer_age is not supported, will not perform as well."); - if (g_egl_dynProcs.glEGLImageTargetTexture2DOES) - { - if (util_hasGLExt(client_exts, "EGL_EXT_image_dma_buf_import")) - this->dmaSupport = true; - else - DEBUG_INFO("EGL_EXT_image_dma_buf_import unavailable, DMA support disabled"); - } - else + if (!g_egl_dynProcs.glEGLImageTargetTexture2DOES) DEBUG_INFO("glEGLImageTargetTexture2DOES unavilable, DMA support disabled"); + else if (!g_egl_dynProcs.eglCreateImage || !g_egl_dynProcs.eglDestroyImage) + DEBUG_INFO("eglCreateImage or eglDestroyImage unavailable, DMA support disabled"); + else if (!util_hasGLExt(client_exts, "EGL_EXT_image_dma_buf_import")) + DEBUG_INFO("EGL_EXT_image_dma_buf_import unavailable, DMA support disabled"); + else if ((maj < 1 || (maj == 1 && min < 5)) && !util_hasGLExt(client_exts, "EGL_KHR_image_base")) + DEBUG_INFO("Need EGL 1.5+ or EGL_KHR_image_base for eglCreateImage(KHR)"); + else + this->dmaSupport = true; if (!this->dmaSupport) useDMA = false; diff --git a/client/renderers/EGL/texture_dmabuf.c b/client/renderers/EGL/texture_dmabuf.c index 84333c4a..931beb92 100644 --- a/client/renderers/EGL/texture_dmabuf.c +++ b/client/renderers/EGL/texture_dmabuf.c @@ -132,7 +132,7 @@ static bool egl_texDMABUFUpdate(EGL_Texture * texture, EGL_NONE , EGL_NONE }; - image = eglCreateImage( + image = g_egl_dynProcs.eglCreateImage( this->display, EGL_NO_CONTEXT, EGL_LINUX_DMA_BUF_EXT, @@ -151,7 +151,7 @@ static bool egl_texDMABUFUpdate(EGL_Texture * texture, })) { DEBUG_ERROR("Failed to store EGLImage"); - eglDestroyImage(this->display, image); + g_egl_dynProcs.eglDestroyImage(this->display, image); return false; } } diff --git a/client/src/egl_dynprocs.c b/client/src/egl_dynprocs.c index 804f503f..00c04a9f 100644 --- a/client/src/egl_dynprocs.c +++ b/client/src/egl_dynprocs.c @@ -42,6 +42,17 @@ void egl_dynProcsInit(void) eglGetProcAddress("glDebugMessageCallbackKHR"); g_egl_dynProcs.glBufferStorageEXT = (PFNGLBUFFERSTORAGEEXTPROC) eglGetProcAddress("glBufferStorageEXT"); + g_egl_dynProcs.eglCreateImage = (PFNEGLCREATEIMAGEPROC) + eglGetProcAddress("eglCreateImage"); + g_egl_dynProcs.eglDestroyImage = (PFNEGLDESTROYIMAGEPROC) + eglGetProcAddress("eglDestroyImage"); + + if (!g_egl_dynProcs.eglCreateImage) + g_egl_dynProcs.eglCreateImage = (PFNEGLCREATEIMAGEPROC) + eglGetProcAddress("eglCreateImageKHR"); + if (!g_egl_dynProcs.eglDestroyImage) + g_egl_dynProcs.eglDestroyImage = (PFNEGLDESTROYIMAGEPROC) + eglGetProcAddress("eglDestroyImageKHR"); }; #endif