summaryrefslogtreecommitdiff
path: root/mozilla-1656505-2.patch
blob: 48ee37b0061af8ea5f1b926ec423ef39b4c23f0e (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
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,

bgstack15