101 lines
4.2 KiB
Diff
101 lines
4.2 KiB
Diff
diff -up firefox-101.0.1/gfx/config/gfxVars.h.D149238.diff firefox-101.0.1/gfx/config/gfxVars.h
|
|
--- firefox-101.0.1/gfx/config/gfxVars.h.D149238.diff 2022-06-14 14:28:15.301514131 +0200
|
|
+++ firefox-101.0.1/gfx/config/gfxVars.h 2022-06-14 14:29:32.221087732 +0200
|
|
@@ -91,7 +91,8 @@ class gfxVarReceiver;
|
|
_(AllowWebGPU, bool, false) \
|
|
_(UseVP8HwDecode, bool, false) \
|
|
_(UseVP9HwDecode, bool, false) \
|
|
- _(HwDecodedVideoNoCopy, bool, false)
|
|
+ _(HwDecodedVideoNoCopy, bool, false) \
|
|
+ _(UseDMABufSurfaceExport, bool, true)
|
|
|
|
/* Add new entries above this line. */
|
|
|
|
diff -up firefox-101.0.1/gfx/gl/SharedSurfaceDMABUF.cpp.D149238.diff firefox-101.0.1/gfx/gl/SharedSurfaceDMABUF.cpp
|
|
--- firefox-101.0.1/gfx/gl/SharedSurfaceDMABUF.cpp.D149238.diff 2022-06-14 14:28:15.297513997 +0200
|
|
+++ firefox-101.0.1/gfx/gl/SharedSurfaceDMABUF.cpp 2022-06-14 14:28:15.301514131 +0200
|
|
@@ -9,6 +9,7 @@
|
|
#include "GLContextEGL.h"
|
|
#include "MozFramebuffer.h"
|
|
#include "mozilla/layers/LayersSurfaces.h" // for SurfaceDescriptor, etc
|
|
+#include "mozilla/gfx/gfxVars.h"
|
|
|
|
namespace mozilla::gl {
|
|
|
|
@@ -27,22 +28,39 @@ UniquePtr<SharedSurface_DMABUF> SharedSu
|
|
const auto& context = gle->mContext;
|
|
const auto& egl = *(gle->mEgl);
|
|
|
|
- if (!HasDmaBufExtensions(gle)) {
|
|
- return nullptr;
|
|
- }
|
|
-
|
|
- auto fb = MozFramebuffer::Create(desc.gl, desc.size, 0, false);
|
|
- if (!fb) return nullptr;
|
|
-
|
|
- const auto buffer = reinterpret_cast<EGLClientBuffer>(fb->ColorTex());
|
|
- const auto image =
|
|
- egl.fCreateImage(context, LOCAL_EGL_GL_TEXTURE_2D, buffer, nullptr);
|
|
- if (!image) return nullptr;
|
|
-
|
|
- const RefPtr<DMABufSurface> surface = DMABufSurfaceRGBA::CreateDMABufSurface(
|
|
- desc.gl, image, desc.size.width, desc.size.height);
|
|
- if (!surface) return nullptr;
|
|
+ RefPtr<DMABufSurface> surface;
|
|
+ UniquePtr<MozFramebuffer> fb;
|
|
|
|
+ if (!HasDmaBufExtensions(gle) || !gfx::gfxVars::UseDMABufSurfaceExport()) {
|
|
+ // Use MESA_image_dma_buf_export is not supported or it's broken.
|
|
+ // Create dmabuf surface directly via. GBM and create
|
|
+ // EGLImage/framebuffer over it.
|
|
+ const auto flags = static_cast<DMABufSurfaceFlags>(
|
|
+ DMABUF_TEXTURE | DMABUF_USE_MODIFIERS | DMABUF_ALPHA);
|
|
+ surface = DMABufSurfaceRGBA::CreateDMABufSurface(desc.size.width,
|
|
+ desc.size.height, flags);
|
|
+ if (!surface || !surface->CreateTexture(desc.gl)) {
|
|
+ return nullptr;
|
|
+ }
|
|
+ const auto tex = surface->GetTexture();
|
|
+ fb = MozFramebuffer::CreateForBacking(desc.gl, desc.size, 0, false,
|
|
+ LOCAL_GL_TEXTURE_2D, tex);
|
|
+ if (!fb) return nullptr;
|
|
+ } else {
|
|
+ // Use MESA_image_dma_buf_export so create EGLImage/framebuffer directly
|
|
+ // and derive dmabuf from it.
|
|
+ fb = MozFramebuffer::Create(desc.gl, desc.size, 0, false);
|
|
+ if (!fb) return nullptr;
|
|
+
|
|
+ const auto buffer = reinterpret_cast<EGLClientBuffer>(fb->ColorTex());
|
|
+ const auto image =
|
|
+ egl.fCreateImage(context, LOCAL_EGL_GL_TEXTURE_2D, buffer, nullptr);
|
|
+ if (!image) return nullptr;
|
|
+
|
|
+ surface = DMABufSurfaceRGBA::CreateDMABufSurface(
|
|
+ desc.gl, image, desc.size.width, desc.size.height);
|
|
+ if (!surface) return nullptr;
|
|
+ }
|
|
return AsUnique(new SharedSurface_DMABUF(desc, std::move(fb), surface));
|
|
}
|
|
|
|
diff -up firefox-101.0.1/gfx/thebes/gfxPlatform.cpp.D149238.diff firefox-101.0.1/gfx/thebes/gfxPlatform.cpp
|
|
--- firefox-101.0.1/gfx/thebes/gfxPlatform.cpp.D149238.diff 2022-06-08 23:06:36.000000000 +0200
|
|
+++ firefox-101.0.1/gfx/thebes/gfxPlatform.cpp 2022-06-14 14:28:15.302514165 +0200
|
|
@@ -2851,6 +2851,17 @@ void gfxPlatform::InitWebGLConfig() {
|
|
gfxVars::SetAllowEglRbab(false);
|
|
}
|
|
}
|
|
+
|
|
+ if (kIsWayland || kIsX11) {
|
|
+ // Disable EGL_MESA_image_dma_buf_export on mesa/radeonsi due to
|
|
+ // https://gitlab.freedesktop.org/mesa/mesa/-/issues/6666
|
|
+ nsString adapterDriverVendor;
|
|
+ gfxInfo->GetAdapterDriverVendor(adapterDriverVendor);
|
|
+ if (adapterDriverVendor.Find("mesa") != -1 &&
|
|
+ adapterDriverVendor.Find("radeonsi") != -1) {
|
|
+ gfxVars::SetUseDMABufSurfaceExport(false);
|
|
+ }
|
|
+ }
|
|
}
|
|
|
|
void gfxPlatform::InitWebGPUConfig() {
|