summaryrefslogtreecommitdiff
path: root/D147635.diff
blob: 1d4bb5802372e0266c4b56b56608e5107874aea7 (plain)
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
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;
 }
 
 // -

bgstack15