Blob Blame History Raw
diff --git a/gfx/gl/GLLibraryEGL.h b/gfx/gl/GLLibraryEGL.h
--- a/gfx/gl/GLLibraryEGL.h
+++ b/gfx/gl/GLLibraryEGL.h
@@ -106,10 +106,13 @@
   KHR_swap_buffers_with_damage,
   EXT_buffer_age,
   KHR_partial_update,
   NV_robustness_video_memory_purge,
   MESA_platform_surfaceless,
+  EXT_image_dma_buf_import,
+  EXT_image_dma_buf_import_modifiers,
+  MESA_image_dma_buf_export,
   Max
 };
 
 // -
 
@@ -461,10 +464,23 @@
   // EGL_KHR_partial_update
   EGLBoolean fSetDamageRegion(EGLDisplay dpy, EGLSurface surface,
                               const EGLint* rects, EGLint n_rects) {
     WRAP(fSetDamageRegion(dpy, surface, rects, n_rects));
   }
+  // EGL_MESA_image_dma_buf_export
+  EGLBoolean fExportDMABUFImageQuery(EGLDisplay dpy, EGLImage image,
+                                     int* fourcc, int* num_planes,
+                                     uint64_t* modifiers) {
+    WRAP(
+        fExportDMABUFImageQueryMESA(dpy, image, fourcc, num_planes, modifiers));
+  }
+  EGLBoolean fExportDMABUFImage(EGLDisplay dpy, EGLImage image, int* fds,
+                                EGLint* strides, EGLint* offsets) {
+    WRAP(fExportDMABUFImageMESA(dpy, image, fds, strides, offsets));
+  }
+
+#undef WRAP
 
 #undef WRAP
 #undef PROFILE_CALL
 #undef BEFORE_CALL
 #undef AFTER_CALL
@@ -593,10 +609,22 @@
     EGLBoolean(GLAPIENTRY* fSetDamageRegion)(EGLDisplay dpy, EGLSurface surface,
                                              const EGLint* rects,
                                              EGLint n_rects);
     EGLClientBuffer(GLAPIENTRY* fGetNativeClientBufferANDROID)(
         const struct AHardwareBuffer* buffer);
+
+    // EGL_MESA_image_dma_buf_export
+    EGLBoolean(GLAPIENTRY* fExportDMABUFImageQueryMESA)(EGLDisplay dpy,
+                                                        EGLImage image,
+                                                        int* fourcc,
+                                                        int* num_planes,
+                                                        uint64_t* modifiers);
+    EGLBoolean(GLAPIENTRY* fExportDMABUFImageMESA)(EGLDisplay dpy,
+                                                   EGLImage image, int* fds,
+                                                   EGLint* strides,
+                                                   EGLint* offsets);
+
   } mSymbols = {};
 };
 
 class EglDisplay final {
  public:
@@ -852,10 +880,23 @@
   EGLBoolean fSetDamageRegion(EGLSurface surface, const EGLint* rects,
                               EGLint n_rects) {
     MOZ_ASSERT(IsExtensionSupported(EGLExtension::KHR_partial_update));
     return mLib->fSetDamageRegion(mDisplay, surface, rects, n_rects);
   }
+
+  EGLBoolean fExportDMABUFImageQuery(EGLImage image, int* fourcc,
+                                     int* num_planes,
+                                     uint64_t* modifiers) const {
+    MOZ_ASSERT(IsExtensionSupported(EGLExtension::MESA_image_dma_buf_export));
+    return mLib->fExportDMABUFImageQuery(mDisplay, image, fourcc, num_planes,
+                                         modifiers);
+  }
+  EGLBoolean fExportDMABUFImage(EGLImage image, int* fds, EGLint* strides,
+                                EGLint* offsets) const {
+    MOZ_ASSERT(IsExtensionSupported(EGLExtension::MESA_image_dma_buf_export));
+    return mLib->fExportDMABUFImage(mDisplay, image, fds, strides, offsets);
+  }
 };
 
 } /* namespace gl */
 } /* namespace mozilla */
 
diff --git a/gfx/gl/GLLibraryEGL.cpp b/gfx/gl/GLLibraryEGL.cpp
--- a/gfx/gl/GLLibraryEGL.cpp
+++ b/gfx/gl/GLLibraryEGL.cpp
@@ -82,11 +82,14 @@
     "EGL_EXT_swap_buffers_with_damage",
     "EGL_KHR_swap_buffers_with_damage",
     "EGL_EXT_buffer_age",
     "EGL_KHR_partial_update",
     "EGL_NV_robustness_video_memory_purge",
-    "EGL_MESA_platform_surfaceless"};
+    "EGL_MESA_platform_surfaceless",
+    "EGL_EXT_image_dma_buf_import",
+    "EGL_EXT_image_dma_buf_import_modifiers",
+    "EGL_MESA_image_dma_buf_export"};
 
 PRLibrary* LoadApitraceLibrary() {
   const char* path = nullptr;
 
 #ifdef ANDROID
@@ -647,10 +650,16 @@
   {
     const SymLoadStruct symbols[] = {SYMBOL(GetPlatformDisplay),
                                      END_OF_SYMBOLS};
     (void)fnLoadSymbols(symbols);
   }
+  {
+    const SymLoadStruct symbols[] = {SYMBOL(ExportDMABUFImageQueryMESA),
+                                     SYMBOL(ExportDMABUFImageMESA),
+                                     END_OF_SYMBOLS};
+    (void)fnLoadSymbols(symbols);
+  }
 
   return true;
 }
 
 // -