firefox/mozilla-1656505-2.patch
2020-09-15 19:27:27 +02:00

114 lines
4.4 KiB
Diff

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,