Added WebGL dmabuf fixes

This commit is contained in:
Martin Stransky 2020-09-15 19:27:27 +02:00
parent 74f97a94b1
commit 096b8b8fb5
4 changed files with 133 additions and 3 deletions

View File

@ -34,6 +34,4 @@ pref("spellchecker.dictionary_path","/usr/share/myspell");
pref("network.trr.mode", 5);
/* Enable per-user policy dir, see mozbz#1583466 */
pref("browser.policies.perUserDir", true);
pref("browser.gnome-search-provider.enabled",true);
/* We're not ready yet */
pref("widget.dmabuf-webgl.enabled", false);
pref("browser.gnome-search-provider.enabled",true);

View File

@ -179,6 +179,8 @@ Patch227: firefox-locale-debug.patch
# Upstream patches
Patch402: mozilla-1196777.patch
Patch403: mozilla-1656505-1.patch
Patch404: mozilla-1656505-2.patch
# Wayland specific upstream patches
Patch574: firefox-pipewire-0-2.patch
@ -380,6 +382,8 @@ This package contains results of tests executed during build.
%patch227 -p1 -b .locale-debug
%patch402 -p1 -b .1196777
%patch403 -p1 -b .1656505-1
%patch404 -p1 -b .1656505-2
# Wayland specific upstream patches
%if 0%{?fedora} < 32

15
mozilla-1656505-1.patch Normal file
View File

@ -0,0 +1,15 @@
diff --git a/widget/gtk/DMABufLibWrapper.cpp b/widget/gtk/DMABufLibWrapper.cpp
--- a/widget/gtk/DMABufLibWrapper.cpp
+++ b/widget/gtk/DMABufLibWrapper.cpp
@@ -149,8 +149,8 @@
}
nsDMABufDevice::nsDMABufDevice()
- : mXRGBFormat({true, false, GBM_FORMAT_ARGB8888, nullptr, 0}),
- mARGBFormat({true, true, GBM_FORMAT_XRGB8888, nullptr, 0}),
+ : mXRGBFormat({true, false, GBM_FORMAT_XRGB8888, nullptr, 0}),
+ mARGBFormat({true, true, GBM_FORMAT_ARGB8888, nullptr, 0}),
mGbmDevice(nullptr),
mGbmFd(-1),
mGdmConfigured(false),

113
mozilla-1656505-2.patch Normal file
View File

@ -0,0 +1,113 @@
diff -up firefox-81.0/gfx/gl/SharedSurfaceDMABUF.cpp.1656505-2 firefox-81.0/gfx/gl/SharedSurfaceDMABUF.cpp
--- firefox-81.0/gfx/gl/SharedSurfaceDMABUF.cpp.1656505-2 2020-09-15 03:48:28.000000000 +0200
+++ firefox-81.0/gfx/gl/SharedSurfaceDMABUF.cpp 2020-09-15 18:13:03.683458125 +0200
@@ -63,6 +63,8 @@ UniquePtr<SurfaceFactory_DMABUF> Surface
return dmabufFactory;
}
+ LOGDMABUF(
+ ("SurfaceFactory_DMABUF::Create() failed, fallback to SW buffers.\n"));
gfxPlatformGtk::GetPlatform()->DisableDMABufWebGL();
return nullptr;
}
diff -up firefox-81.0/widget/gtk/DMABufSurface.cpp.1656505-2 firefox-81.0/widget/gtk/DMABufSurface.cpp
--- firefox-81.0/widget/gtk/DMABufSurface.cpp.1656505-2 2020-09-15 03:48:38.000000000 +0200
+++ firefox-81.0/widget/gtk/DMABufSurface.cpp 2020-09-15 18:13:03.683458125 +0200
@@ -26,6 +26,7 @@
#include "GLContextTypes.h" // for GLContext, etc
#include "GLContextEGL.h"
#include "GLContextProvider.h"
+#include "ScopedGLHelpers.h"
#include "mozilla/layers/LayersSurfaces.h"
@@ -320,6 +321,9 @@ bool DMABufSurfaceRGBA::Create(int aWidt
mWidth = aWidth;
mHeight = aHeight;
+ LOGDMABUF(("DMABufSurfaceRGBA::Create() UID %d size %d x %d\n", mUID, mWidth,
+ mHeight));
+
mGmbFormat = GetDMABufDevice()->GetGbmFormat(mSurfaceFlags & DMABUF_ALPHA);
if (!mGmbFormat) {
// Requested DRM format is not supported.
@@ -329,6 +333,7 @@ bool DMABufSurfaceRGBA::Create(int aWidt
bool useModifiers = (aDMABufSurfaceFlags & DMABUF_USE_MODIFIERS) &&
mGmbFormat->mModifiersCount > 0;
if (useModifiers) {
+ LOGDMABUF((" Creating with modifiers\n"));
mGbmBufferObject[0] = nsGbmLib::CreateWithModifiers(
GetDMABufDevice()->GetGbmDevice(), mWidth, mHeight, mGmbFormat->mFormat,
mGmbFormat->mModifiers, mGmbFormat->mModifiersCount);
@@ -360,6 +365,7 @@ bool DMABufSurfaceRGBA::Create(int aWidt
}
if (!mGbmBufferObject[0]) {
+ LOGDMABUF((" Failed to create GbmBufferObject\n"));
return false;
}
@@ -429,6 +435,8 @@ void DMABufSurfaceRGBA::ImportSurfaceDes
if (desc.refCount().Length() > 0) {
GlobalRefCountImport(desc.refCount()[0].ClonePlatformHandle().release());
}
+
+ LOGDMABUF(("DMABufSurfaceRGBA::Import() UID %d\n", mUID));
}
bool DMABufSurfaceRGBA::Create(const SurfaceDescriptor& aDesc) {
@@ -448,6 +456,8 @@ bool DMABufSurfaceRGBA::Serialize(
AutoTArray<ipc::FileDescriptor, 1> fenceFDs;
AutoTArray<ipc::FileDescriptor, 1> refCountFDs;
+ LOGDMABUF(("DMABufSurfaceRGBA::Serialize() UID %d\n", mUID));
+
width.AppendElement(mWidth);
height.AppendElement(mHeight);
format.AppendElement(mGmbFormat->mFormat);
@@ -469,7 +479,6 @@ bool DMABufSurfaceRGBA::Serialize(
SurfaceDescriptorDMABuf(mSurfaceType, mBufferModifier, mGbmBufferFlags,
fds, width, height, format, strides, offsets,
GetYUVColorSpace(), fenceFDs, mUID, refCountFDs);
-
return true;
}
@@ -556,7 +565,7 @@ bool DMABufSurfaceRGBA::CreateTexture(GL
aGLContext->MakeCurrent();
aGLContext->fGenTextures(1, &mTexture);
- aGLContext->fBindTexture(LOCAL_GL_TEXTURE_2D, mTexture);
+ const ScopedBindTexture savedTex(aGLContext, mTexture);
aGLContext->fTexParameteri(LOCAL_GL_TEXTURE_2D, LOCAL_GL_TEXTURE_WRAP_S,
LOCAL_GL_CLAMP_TO_EDGE);
aGLContext->fTexParameteri(LOCAL_GL_TEXTURE_2D, LOCAL_GL_TEXTURE_WRAP_T,
@@ -567,6 +576,7 @@ bool DMABufSurfaceRGBA::CreateTexture(GL
LOCAL_GL_LINEAR);
aGLContext->fEGLImageTargetTexture2D(LOCAL_GL_TEXTURE_2D, mEGLImage);
mGL = aGLContext;
+
return true;
}
@@ -611,6 +621,10 @@ void* DMABufSurface::MapInternal(uint32_
return nullptr;
}
+ LOGDMABUF(
+ ("DMABufSurfaceRGBA::MapInternal() UID %d size %d x %d -> %d x %d\n",
+ mUID, aX, aY, aWidth, aHeight));
+
mMappedRegionStride[aPlane] = 0;
mMappedRegionData[aPlane] = nullptr;
mMappedRegion[aPlane] = nsGbmLib::Map(
@@ -988,7 +1002,7 @@ bool DMABufSurfaceYUV::CreateTexture(GLC
aGLContext->MakeCurrent();
aGLContext->fGenTextures(1, &mTexture[aPlane]);
- aGLContext->fBindTexture(LOCAL_GL_TEXTURE_2D, mTexture[aPlane]);
+ const ScopedBindTexture savedTex(aGLContext, mTexture[aPlane]);
aGLContext->fTexParameteri(LOCAL_GL_TEXTURE_2D, LOCAL_GL_TEXTURE_WRAP_S,
LOCAL_GL_CLAMP_TO_EDGE);
aGLContext->fTexParameteri(LOCAL_GL_TEXTURE_2D, LOCAL_GL_TEXTURE_WRAP_T,