This commit is contained in:
Martin Stransky 2022-06-28 18:18:25 +02:00
parent 386d29543d
commit ba25b2cbc3
17 changed files with 121 additions and 1010 deletions

2
.gitignore vendored
View File

@ -515,3 +515,5 @@ firefox-3.6.4.source.tar.bz2
/firefox-langpacks-101.0-20220530.tar.xz
/firefox-101.0.1.source.tar.xz
/firefox-langpacks-101.0.1-20220609.tar.xz
/firefox-102.0.source.tar.xz
/firefox-langpacks-102.0-20220628.tar.xz

View File

@ -1,77 +0,0 @@
diff --git a/gfx/layers/DMABUFSurfaceImage.cpp b/gfx/layers/DMABUFSurfaceImage.cpp
--- a/gfx/layers/DMABUFSurfaceImage.cpp
+++ b/gfx/layers/DMABUFSurfaceImage.cpp
@@ -39,20 +39,20 @@
StaticRefPtr<GLContext> sSnapshotContext;
static StaticMutex sSnapshotContextMutex MOZ_UNANNOTATED;
already_AddRefed<gfx::SourceSurface> DMABUFSurfaceImage::GetAsSourceSurface() {
+ StaticMutexAutoLock lock(sSnapshotContextMutex);
if (!sSnapshotContext) {
nsCString discardFailureId;
sSnapshotContext = GLContextProvider::CreateHeadless({}, &discardFailureId);
if (!sSnapshotContext) {
gfxCriticalError() << "Failed to create snapshot GLContext.";
return nullptr;
}
}
- StaticMutexAutoLock lock(sSnapshotContextMutex);
sSnapshotContext->MakeCurrent();
auto releaseTextures =
mozilla::MakeScopeExit([&] { mSurface->ReleaseTextures(); });
diff --git a/widget/gtk/DMABufSurface.cpp b/widget/gtk/DMABufSurface.cpp
--- a/widget/gtk/DMABufSurface.cpp
+++ b/widget/gtk/DMABufSurface.cpp
@@ -53,24 +53,13 @@
using namespace mozilla::layers;
#define BUFFER_FLAGS 0
static RefPtr<GLContext> sSnapshotContext;
+static StaticMutex sSnapshotContextMutex MOZ_UNANNOTATED;
static Atomic<int> gNewSurfaceUID(1);
-bool EnsureSnapshotGLContext() {
- if (!sSnapshotContext) {
- nsCString discardFailureId;
- sSnapshotContext = GLContextProvider::CreateHeadless({}, &discardFailureId);
- if (!sSnapshotContext) {
- NS_WARNING("Failed to create snapshot GLContext");
- return false;
- }
- }
- return true;
-}
-
bool DMABufSurface::IsGlobalRefSet() const {
if (!mGlobalRefCountFd) {
return false;
}
struct pollfd pfd;
@@ -1263,13 +1252,18 @@
}
bool DMABufSurfaceYUV::VerifyTextureCreation() {
LOGDMABUF(("DMABufSurfaceYUV::VerifyTextureCreation() UID %d", mUID));
- if (!EnsureSnapshotGLContext()) {
- LOGDMABUF((" failed to create GL context!"));
- return false;
+ StaticMutexAutoLock lock(sSnapshotContextMutex);
+ if (!sSnapshotContext) {
+ nsCString discardFailureId;
+ sSnapshotContext = GLContextProvider::CreateHeadless({}, &discardFailureId);
+ if (!sSnapshotContext) {
+ NS_WARNING("Failed to create snapshot GLContext");
+ return false;
+ }
}
auto release = MakeScopeExit([&] { ReleaseEGLImages(sSnapshotContext); });
for (int i = 0; i < mBufferPlaneCount; i++) {

View File

@ -1,132 +0,0 @@
diff --git a/dom/media/platforms/ffmpeg/FFmpegVideoDecoder.h b/dom/media/platforms/ffmpeg/FFmpegVideoDecoder.h
--- a/dom/media/platforms/ffmpeg/FFmpegVideoDecoder.h
+++ b/dom/media/platforms/ffmpeg/FFmpegVideoDecoder.h
@@ -106,10 +106,11 @@
bool IsHardwareAccelerated(nsACString& aFailureReason) const override;
bool IsHardwareAccelerated() const {
nsAutoCString dummy;
return IsHardwareAccelerated(dummy);
}
+ void UpdateDecodeTimes(TimeStamp aDecodeStart);
#if LIBAVCODEC_VERSION_MAJOR >= 57 && LIBAVUTIL_VERSION_MAJOR >= 56
layers::TextureClient* AllocateTextureClientForImage(
struct AVCodecContext* aCodecContext, layers::PlanarYCbCrImage* aImage);
@@ -142,10 +143,15 @@
static nsTArray<AVCodecID> mAcceleratedFormats;
#endif
RefPtr<KnowsCompositor> mImageAllocator;
RefPtr<ImageContainer> mImageContainer;
VideoInfo mInfo;
+ int mDecodedFrames;
+#if LIBAVCODEC_VERSION_MAJOR >= 58
+ int mDecodedFramesLate;
+#endif
+ float mAverangeDecodeTime;
class PtsCorrectionContext {
public:
PtsCorrectionContext();
int64_t GuessCorrectPts(int64_t aPts, int64_t aDts);
diff --git a/dom/media/platforms/ffmpeg/FFmpegVideoDecoder.cpp b/dom/media/platforms/ffmpeg/FFmpegVideoDecoder.cpp
--- a/dom/media/platforms/ffmpeg/FFmpegVideoDecoder.cpp
+++ b/dom/media/platforms/ffmpeg/FFmpegVideoDecoder.cpp
@@ -383,10 +383,15 @@
mDisplay(nullptr),
#endif
mImageAllocator(aAllocator),
mImageContainer(aImageContainer),
mInfo(aConfig),
+ mDecodedFrames(0),
+#if LIBAVCODEC_VERSION_MAJOR >= 58
+ mDecodedFramesLate(0),
+#endif
+ mAverangeDecodeTime(0),
mLowLatency(aLowLatency) {
FFMPEG_LOG("FFmpegVideoDecoder::FFmpegVideoDecoder MIME %s Codec ID %d",
aConfig.mMimeType.get(), mCodecID);
// Use a new MediaByteBuffer as the object will be modified during
// initialization.
@@ -769,17 +774,41 @@
#else
return aFrame->pkt_pts;
#endif
}
+void FFmpegVideoDecoder<LIBAV_VER>::UpdateDecodeTimes(TimeStamp aDecodeStart) {
+ mDecodedFrames++;
+ float decodeTime = (TimeStamp::Now() - aDecodeStart).ToMilliseconds();
+ mAverangeDecodeTime =
+ (mAverangeDecodeTime * (mDecodedFrames - 1) + decodeTime) /
+ mDecodedFrames;
+ FFMPEG_LOG(" averange frame decode time %.2f ms decoded frames %d\n",
+ mAverangeDecodeTime, mDecodedFrames);
+#if LIBAVCODEC_VERSION_MAJOR >= 58
+ int frameDuration = mFrame->pkt_duration;
+ if (frameDuration > 0 && frameDuration / 1000.0 < decodeTime) {
+ mDecodedFramesLate++;
+ FFMPEG_LOG(
+ " slow decode: failed to decode in time, frame duration %.2f ms, "
+ "decode time %.2f\n",
+ frameDuration / 1000.0, decodeTime);
+ FFMPEG_LOG(" all decoded frames / late decoded frames %d/%d\n",
+ mDecodedFrames, mDecodedFramesLate);
+ }
+#endif
+}
+
MediaResult FFmpegVideoDecoder<LIBAV_VER>::DoDecode(
MediaRawData* aSample, uint8_t* aData, int aSize, bool* aGotFrame,
MediaDataDecoder::DecodedData& aResults) {
MOZ_ASSERT(mTaskQueue->IsOnCurrentThread());
AVPacket packet;
mLib->av_init_packet(&packet);
+ TimeStamp decodeStart = TimeStamp::Now();
+
packet.data = aData;
packet.size = aSize;
packet.dts = aSample->mTimecode.ToMicroseconds();
packet.pts = aSample->mTime.ToMicroseconds();
packet.flags = aSample->mKeyframe ? AV_PKT_FLAG_KEY : 0;
@@ -794,11 +823,10 @@
// at a time, and we immediately call avcodec_receive_frame right after.
FFMPEG_LOG("avcodec_send_packet error: %d", res);
return MediaResult(NS_ERROR_DOM_MEDIA_DECODE_ERR,
RESULT_DETAIL("avcodec_send_packet error: %d", res));
}
-
if (aGotFrame) {
*aGotFrame = false;
}
do {
if (!PrepareFrame()) {
@@ -831,10 +859,13 @@
FFMPEG_LOG(" avcodec_receive_frame error: %d", res);
return MediaResult(NS_ERROR_DOM_MEDIA_DECODE_ERR,
RESULT_DETAIL("avcodec_receive_frame error: %d", res));
}
+ UpdateDecodeTimes(decodeStart);
+ decodeStart = TimeStamp::Now();
+
MediaResult rv;
# ifdef MOZ_WAYLAND_USE_VAAPI
if (IsHardwareAccelerated()) {
rv = CreateImageVAAPI(mFrame->pkt_pos, GetFramePts(mFrame),
mFrame->pkt_duration, aResults);
@@ -898,10 +929,12 @@
*aGotFrame = false;
}
return NS_OK;
}
+ UpdateDecodeTimes(decodeStart);
+
// If we've decoded a frame then we need to output it
int64_t pts =
mPtsContext.GuessCorrectPts(GetFramePts(mFrame), mFrame->pkt_dts);
// Retrieve duration from dts.
// We use the first entry found matching this dts (this is done to

View File

@ -1,17 +0,0 @@
diff --git a/gfx/layers/ipc/LayersSurfaces.ipdlh b/gfx/layers/ipc/LayersSurfaces.ipdlh
--- a/gfx/layers/ipc/LayersSurfaces.ipdlh
+++ b/gfx/layers/ipc/LayersSurfaces.ipdlh
@@ -57,10 +57,12 @@
uint64_t[] modifier;
uint32_t flags;
FileDescriptor[] fds;
uint32_t[] width;
uint32_t[] height;
+ uint32_t[] widthAligned;
+ uint32_t[] heightAligned;
uint32_t[] format;
uint32_t[] strides;
uint32_t[] offsets;
YUVColorSpace yUVColorSpace;
ColorRange colorRange;

View File

@ -1,205 +0,0 @@
diff --git a/widget/gtk/DMABufSurface.h b/widget/gtk/DMABufSurface.h
--- a/widget/gtk/DMABufSurface.h
+++ b/widget/gtk/DMABufSurface.h
@@ -275,11 +275,11 @@
static already_AddRefed<DMABufSurfaceYUV> CreateYUVSurface(
int aWidth, int aHeight, void** aPixelData = nullptr,
int* aLineSizes = nullptr);
static already_AddRefed<DMABufSurfaceYUV> CreateYUVSurface(
- const VADRMPRIMESurfaceDescriptor& aDesc);
+ const VADRMPRIMESurfaceDescriptor& aDesc, int aWidth, int aHeight);
bool Serialize(mozilla::layers::SurfaceDescriptor& aOutDescriptor);
DMABufSurfaceYUV* GetAsDMABufSurfaceYUV() { return this; };
@@ -304,11 +304,12 @@
mozilla::gfx::YUVColorSpace GetYUVColorSpace() { return mColorSpace; }
DMABufSurfaceYUV();
bool UpdateYUVData(void** aPixelData, int* aLineSizes);
- bool UpdateYUVData(const VADRMPRIMESurfaceDescriptor& aDesc);
+ bool UpdateYUVData(const VADRMPRIMESurfaceDescriptor& aDesc, int aWidth,
+ int aHeight);
bool VerifyTextureCreation();
private:
~DMABufSurfaceYUV();
@@ -329,10 +330,15 @@
bool CreateEGLImage(mozilla::gl::GLContext* aGLContext, int aPlane);
void ReleaseEGLImages(mozilla::gl::GLContext* aGLContext);
int mWidth[DMABUF_BUFFER_PLANES];
int mHeight[DMABUF_BUFFER_PLANES];
+ // Aligned size of the surface imported from VADRMPRIMESurfaceDescriptor.
+ // It's used only internally to create EGLImage as some GL drivers
+ // needs that (Bug 1724385).
+ int mWidthAligned[DMABUF_BUFFER_PLANES];
+ int mHeightAligned[DMABUF_BUFFER_PLANES];
EGLImageKHR mEGLImage[DMABUF_BUFFER_PLANES];
GLuint mTexture[DMABUF_BUFFER_PLANES];
mozilla::gfx::YUVColorSpace mColorSpace =
mozilla::gfx::YUVColorSpace::Default;
};
diff --git a/widget/gtk/DMABufSurface.cpp b/widget/gtk/DMABufSurface.cpp
--- a/widget/gtk/DMABufSurface.cpp
+++ b/widget/gtk/DMABufSurface.cpp
@@ -479,13 +479,13 @@
if (mGlobalRefCountFd) {
refCountFDs.AppendElement(ipc::FileDescriptor(mGlobalRefCountFd));
}
aOutDescriptor = SurfaceDescriptorDMABuf(
- mSurfaceType, modifiers, mGbmBufferFlags, fds, width, height, format,
- strides, offsets, GetYUVColorSpace(), mColorRange, fenceFDs, mUID,
- refCountFDs);
+ mSurfaceType, modifiers, mGbmBufferFlags, fds, width, height, width,
+ height, format, strides, offsets, GetYUVColorSpace(), mColorRange,
+ fenceFDs, mUID, refCountFDs);
return true;
}
bool DMABufSurfaceRGBA::CreateTexture(GLContext* aGLContext, int aPlane) {
MOZ_ASSERT(!mEGLImage && !mTexture, "EGLImage is already created!");
@@ -807,15 +807,15 @@
}
return surf.forget();
}
already_AddRefed<DMABufSurfaceYUV> DMABufSurfaceYUV::CreateYUVSurface(
- const VADRMPRIMESurfaceDescriptor& aDesc) {
+ const VADRMPRIMESurfaceDescriptor& aDesc, int aWidth, int aHeight) {
RefPtr<DMABufSurfaceYUV> surf = new DMABufSurfaceYUV();
LOGDMABUF(("DMABufSurfaceYUV::CreateYUVSurface() UID %d from desc\n",
surf->GetUID()));
- if (!surf->UpdateYUVData(aDesc)) {
+ if (!surf->UpdateYUVData(aDesc, aWidth, aHeight)) {
return nullptr;
}
return surf.forget();
}
@@ -829,11 +829,16 @@
}
return surf.forget();
}
DMABufSurfaceYUV::DMABufSurfaceYUV()
- : DMABufSurface(SURFACE_NV12), mWidth(), mHeight(), mTexture() {
+ : DMABufSurface(SURFACE_NV12),
+ mWidth(),
+ mHeight(),
+ mWidthAligned(),
+ mHeightAligned(),
+ mTexture() {
for (int i = 0; i < DMABUF_BUFFER_PLANES; i++) {
mEGLImage[i] = LOCAL_EGL_NO_IMAGE;
}
}
@@ -870,11 +875,12 @@
close(mDmabufFds[aPlane]);
mDmabufFds[aPlane] = -1;
}
}
-bool DMABufSurfaceYUV::UpdateYUVData(const VADRMPRIMESurfaceDescriptor& aDesc) {
+bool DMABufSurfaceYUV::UpdateYUVData(const VADRMPRIMESurfaceDescriptor& aDesc,
+ int aWidth, int aHeight) {
if (aDesc.num_layers > DMABUF_BUFFER_PLANES ||
aDesc.num_objects > DMABUF_BUFFER_PLANES) {
return false;
}
@@ -907,12 +913,14 @@
mBufferModifiers[i] = aDesc.objects[object].drm_format_modifier;
mDrmFormats[i] = aDesc.layers[i].drm_format;
mOffsets[i] = aDesc.layers[i].offset[0];
mStrides[i] = aDesc.layers[i].pitch[0];
- mWidth[i] = aDesc.width >> i;
- mHeight[i] = aDesc.height >> i;
+ mWidthAligned[i] = aDesc.width >> i;
+ mHeightAligned[i] = aDesc.height >> i;
+ mWidth[i] = aWidth >> i;
+ mHeight[i] = aHeight >> i;
LOGDMABUF((" plane %d size %d x %d format %x", i, mWidth[i], mHeight[i],
mDrmFormats[i]));
}
@@ -1044,10 +1052,12 @@
strerror(errno)));
return false;
}
mWidth[i] = aDesc.width()[i];
mHeight[i] = aDesc.height()[i];
+ mWidthAligned[i] = aDesc.widthAligned()[i];
+ mHeightAligned[i] = aDesc.heightAligned()[i];
mDrmFormats[i] = aDesc.format()[i];
mStrides[i] = aDesc.strides()[i];
mOffsets[i] = aDesc.offsets()[i];
mBufferModifiers[i] = aDesc.modifier()[i];
LOGDMABUF((" plane %d fd %d size %d x %d format %x", i, mDmabufFds[i],
@@ -1072,10 +1082,12 @@
bool DMABufSurfaceYUV::Serialize(
mozilla::layers::SurfaceDescriptor& aOutDescriptor) {
AutoTArray<uint32_t, DMABUF_BUFFER_PLANES> width;
AutoTArray<uint32_t, DMABUF_BUFFER_PLANES> height;
+ AutoTArray<uint32_t, DMABUF_BUFFER_PLANES> widthBytes;
+ AutoTArray<uint32_t, DMABUF_BUFFER_PLANES> heightBytes;
AutoTArray<uint32_t, DMABUF_BUFFER_PLANES> format;
AutoTArray<ipc::FileDescriptor, DMABUF_BUFFER_PLANES> fds;
AutoTArray<uint32_t, DMABUF_BUFFER_PLANES> strides;
AutoTArray<uint32_t, DMABUF_BUFFER_PLANES> offsets;
AutoTArray<uint64_t, DMABUF_BUFFER_PLANES> modifiers;
@@ -1090,10 +1102,12 @@
}
for (int i = 0; i < mBufferPlaneCount; i++) {
width.AppendElement(mWidth[i]);
height.AppendElement(mHeight[i]);
+ widthBytes.AppendElement(mWidthAligned[i]);
+ heightBytes.AppendElement(mHeightAligned[i]);
format.AppendElement(mDrmFormats[i]);
fds.AppendElement(ipc::FileDescriptor(mDmabufFds[i]));
strides.AppendElement(mStrides[i]);
offsets.AppendElement(mOffsets[i]);
modifiers.AppendElement(mBufferModifiers[i]);
@@ -1108,12 +1122,13 @@
if (mGlobalRefCountFd) {
refCountFDs.AppendElement(ipc::FileDescriptor(mGlobalRefCountFd));
}
aOutDescriptor = SurfaceDescriptorDMABuf(
- mSurfaceType, modifiers, 0, fds, width, height, format, strides, offsets,
- GetYUVColorSpace(), mColorRange, fenceFDs, mUID, refCountFDs);
+ mSurfaceType, modifiers, 0, fds, width, height, widthBytes, heightBytes,
+ format, strides, offsets, GetYUVColorSpace(), mColorRange, fenceFDs, mUID,
+ refCountFDs);
return true;
}
bool DMABufSurfaceYUV::CreateEGLImage(GLContext* aGLContext, int aPlane) {
LOGDMABUF(
@@ -1131,13 +1146,13 @@
return false;
}
nsTArray<EGLint> attribs;
attribs.AppendElement(LOCAL_EGL_WIDTH);
- attribs.AppendElement(mWidth[aPlane]);
+ attribs.AppendElement(mWidthAligned[aPlane]);
attribs.AppendElement(LOCAL_EGL_HEIGHT);
- attribs.AppendElement(mHeight[aPlane]);
+ attribs.AppendElement(mHeightAligned[aPlane]);
attribs.AppendElement(LOCAL_EGL_LINUX_DRM_FOURCC_EXT);
attribs.AppendElement(mDrmFormats[aPlane]);
#define ADD_PLANE_ATTRIBS_NV12(plane_idx) \
attribs.AppendElement(LOCAL_EGL_DMA_BUF_PLANE##plane_idx##_FD_EXT); \
attribs.AppendElement(mDmabufFds[aPlane]); \

View File

@ -1,65 +0,0 @@
diff --git a/dom/media/platforms/ffmpeg/FFmpegVideoFramePool.h b/dom/media/platforms/ffmpeg/FFmpegVideoFramePool.h
--- a/dom/media/platforms/ffmpeg/FFmpegVideoFramePool.h
+++ b/dom/media/platforms/ffmpeg/FFmpegVideoFramePool.h
@@ -112,12 +112,13 @@
public:
VideoFramePool();
~VideoFramePool();
RefPtr<VideoFrameSurface<LIBAV_VER>> GetVideoFrameSurface(
- VADRMPRIMESurfaceDescriptor& aVaDesc, AVCodecContext* aAVCodecContext,
- AVFrame* aAVFrame, FFmpegLibWrapper* aLib);
+ VADRMPRIMESurfaceDescriptor& aVaDesc, int aWidth, int aHeight,
+ AVCodecContext* aAVCodecContext, AVFrame* aAVFrame,
+ FFmpegLibWrapper* aLib);
void ReleaseUnusedVAAPIFrames();
private:
RefPtr<VideoFrameSurface<LIBAV_VER>> GetFreeVideoFrameSurface();
diff --git a/dom/media/platforms/ffmpeg/FFmpegVideoFramePool.cpp b/dom/media/platforms/ffmpeg/FFmpegVideoFramePool.cpp
--- a/dom/media/platforms/ffmpeg/FFmpegVideoFramePool.cpp
+++ b/dom/media/platforms/ffmpeg/FFmpegVideoFramePool.cpp
@@ -111,12 +111,13 @@
return nullptr;
}
RefPtr<VideoFrameSurface<LIBAV_VER>>
VideoFramePool<LIBAV_VER>::GetVideoFrameSurface(
- VADRMPRIMESurfaceDescriptor& aVaDesc, AVCodecContext* aAVCodecContext,
- AVFrame* aAVFrame, FFmpegLibWrapper* aLib) {
+ VADRMPRIMESurfaceDescriptor& aVaDesc, int aWidth, int aHeight,
+ AVCodecContext* aAVCodecContext, AVFrame* aAVFrame,
+ FFmpegLibWrapper* aLib) {
if (aVaDesc.fourcc != VA_FOURCC_NV12 && aVaDesc.fourcc != VA_FOURCC_YV12 &&
aVaDesc.fourcc != VA_FOURCC_P010) {
FFMPEG_LOG("Unsupported VA-API surface format %d", aVaDesc.fourcc);
return nullptr;
}
@@ -124,11 +125,11 @@
MutexAutoLock lock(mSurfaceLock);
RefPtr<VideoFrameSurface<LIBAV_VER>> videoSurface =
GetFreeVideoFrameSurface();
if (!videoSurface) {
RefPtr<DMABufSurfaceYUV> surface =
- DMABufSurfaceYUV::CreateYUVSurface(aVaDesc);
+ DMABufSurfaceYUV::CreateYUVSurface(aVaDesc, aWidth, aHeight);
if (!surface) {
return nullptr;
}
FFMPEG_LOG("Created new VA-API DMABufSurface UID = %d", surface->GetUID());
RefPtr<VideoFrameSurface<LIBAV_VER>> surf =
@@ -142,11 +143,11 @@
}
videoSurface = surf;
mDMABufSurfaces.AppendElement(std::move(surf));
} else {
RefPtr<DMABufSurfaceYUV> surface = videoSurface->GetDMABufSurface();
- if (!surface->UpdateYUVData(aVaDesc)) {
+ if (!surface->UpdateYUVData(aVaDesc, aWidth, aHeight)) {
return nullptr;
}
FFMPEG_LOG("Reusing VA-API DMABufSurface UID = %d", surface->GetUID());
}
videoSurface->LockVAAPIData(aAVCodecContext, aAVFrame, aLib);

View File

@ -1,19 +0,0 @@
diff --git a/dom/media/platforms/ffmpeg/FFmpegVideoDecoder.cpp b/dom/media/platforms/ffmpeg/FFmpegVideoDecoder.cpp
--- a/dom/media/platforms/ffmpeg/FFmpegVideoDecoder.cpp
+++ b/dom/media/platforms/ffmpeg/FFmpegVideoDecoder.cpp
@@ -1164,12 +1164,12 @@
NS_ERROR_DOM_MEDIA_DECODE_ERR,
RESULT_DETAIL("Unable to get frame by vaExportSurfaceHandle()"));
}
MOZ_ASSERT(mTaskQueue->IsOnCurrentThread());
- auto surface = mVideoFramePool->GetVideoFrameSurface(vaDesc, mCodecContext,
- mFrame, mLib);
+ auto surface = mVideoFramePool->GetVideoFrameSurface(
+ vaDesc, mFrame->width, mFrame->height, mCodecContext, mFrame, mLib);
if (!surface) {
return MediaResult(NS_ERROR_DOM_MEDIA_DECODE_ERR,
RESULT_DETAIL("VAAPI dmabuf allocation error"));
}
surface->SetYUVColorSpace(GetFrameColorSpace());

View File

@ -1,31 +0,0 @@
diff --git a/widget/gtk/nsWindow.cpp b/widget/gtk/nsWindow.cpp
--- a/widget/gtk/nsWindow.cpp
+++ b/widget/gtk/nsWindow.cpp
@@ -1430,20 +1430,20 @@
}
#endif
if (popup->mPopupContextMenu && !popup->mPopupAnchored) {
LOG(" popup [%p] is first context menu", popup);
popup->mRelativePopupPosition = popup->mPopupPosition;
- } else if (popup->mPopupAnchored) {
- LOG(" popup [%p] is anchored", popup);
- if (!popup->mPopupMatchesLayout) {
- NS_WARNING("Anchored popup does not match layout!");
- }
- popup->mRelativePopupPosition = popup->mPopupPosition;
} else if (popup->mWaylandPopupPrev->mWaylandToplevel == nullptr) {
LOG(" popup [%p] has toplevel as parent", popup);
popup->mRelativePopupPosition = popup->mPopupPosition;
} else {
+ if (popup->mPopupAnchored) {
+ LOG(" popup [%p] is anchored", popup);
+ if (!popup->mPopupMatchesLayout) {
+ NS_WARNING("Anchored popup does not match layout!");
+ }
+ }
GdkPoint parent = WaylandGetParentPosition();
LOG(" popup [%p] uses transformed coordinates\n", popup);
LOG(" parent position [%d, %d]\n", parent.x, parent.y);
LOG(" popup position [%d, %d]\n", popup->mPopupPosition.x,

View File

@ -1,19 +0,0 @@
diff -up firefox-100.0.2/widget/gtk/nsWindow.cpp.D147267 firefox-100.0.2/widget/gtk/nsWindow.cpp
--- firefox-100.0.2/widget/gtk/nsWindow.cpp.D147267 2022-05-25 11:46:48.291005415 +0200
+++ firefox-100.0.2/widget/gtk/nsWindow.cpp 2022-05-25 11:50:11.447736538 +0200
@@ -2359,11 +2359,12 @@ void nsWindow::WaylandPopupMove() {
LOG(" popup use move to rect %d\n", mPopupUseMoveToRect);
if (!mPopupUseMoveToRect) {
- if (mNeedsShow && mPopupType != ePopupTypeTooltip) {
+ if (mPopupHint == ePopupTypeMenu) {
// Workaround for https://gitlab.gnome.org/GNOME/gtk/-/issues/4308
- // Tooltips are created as subsurfaces with relative position.
+ // Tooltips/Utility popus are created as subsurfaces with relative position.
+ // Menu uses absolute positions.
LOG(" use gtk_window_move(%d, %d) for hidden widget\n", mPopupPosition.x,
- mPopupPosition.y);
+ mPopupPosition.y);
gtk_window_move(GTK_WINDOW(mShell), mPopupPosition.x, mPopupPosition.y);
} else {
LOG(" use gtk_window_move(%d, %d) for visible widget\n",

View File

@ -1,179 +0,0 @@
diff -up firefox-101.0/gfx/gl/GLContextEGL.h.D147420.diff firefox-101.0/gfx/gl/GLContextEGL.h
--- firefox-101.0/gfx/gl/GLContextEGL.h.D147420.diff 2022-05-27 01:16:54.000000000 +0200
+++ firefox-101.0/gfx/gl/GLContextEGL.h 2022-06-07 09:01:17.487787806 +0200
@@ -106,6 +106,9 @@ class GLContextEGL final : public GLCont
static RefPtr<GLContextEGL> CreateEGLPBufferOffscreenContextImpl(
std::shared_ptr<EglDisplay>, const GLContextCreateDesc&,
const gfx::IntSize& size, bool aUseGles, nsACString* const out_FailureId);
+ static RefPtr<GLContextEGL> CreateEGLSurfacelessContext(
+ const std::shared_ptr<EglDisplay> display,
+ const GLContextCreateDesc& desc, nsACString* const out_failureId);
static EGLSurface CreateEGLSurfaceForCompositorWidget(
widget::CompositorWidget* aCompositorWidget, const EGLConfig aConfig);
diff -up firefox-101.0/gfx/gl/GLContextProviderEGL.cpp.D147420.diff firefox-101.0/gfx/gl/GLContextProviderEGL.cpp
--- firefox-101.0/gfx/gl/GLContextProviderEGL.cpp.D147420.diff 2022-05-27 01:16:54.000000000 +0200
+++ firefox-101.0/gfx/gl/GLContextProviderEGL.cpp 2022-06-07 09:01:17.487787806 +0200
@@ -1190,16 +1190,42 @@ RefPtr<GLContextEGL> GLContextEGL::Creat
}
/*static*/
+RefPtr<GLContextEGL> GLContextEGL::CreateEGLSurfacelessContext(
+ const std::shared_ptr<EglDisplay> display, const GLContextCreateDesc& desc,
+ nsACString* const out_failureId) {
+ const EGLConfig config = {};
+ auto fullDesc = GLContextDesc{desc};
+ fullDesc.isOffscreen = true;
+ RefPtr<GLContextEGL> gl = GLContextEGL::CreateGLContext(
+ display, fullDesc, config, EGL_NO_SURFACE, false, out_failureId);
+ if (!gl) {
+ NS_WARNING("Failed to create surfaceless GL context");
+ return nullptr;
+ }
+ return gl;
+}
+
+/*static*/
already_AddRefed<GLContext> GLContextProviderEGL::CreateHeadless(
const GLContextCreateDesc& desc, nsACString* const out_failureId) {
const auto display = DefaultEglDisplay(out_failureId);
if (!display) {
return nullptr;
}
- mozilla::gfx::IntSize dummySize = mozilla::gfx::IntSize(16, 16);
- auto ret = GLContextEGL::CreateEGLPBufferOffscreenContext(
- display, desc, dummySize, out_failureId);
- return ret.forget();
+ RefPtr<GLContextEGL> gl;
+#ifdef MOZ_WAYLAND
+ if (!gdk_display_get_default() &&
+ display->IsExtensionSupported(EGLExtension::MESA_platform_surfaceless)) {
+ gl =
+ GLContextEGL::CreateEGLSurfacelessContext(display, desc, out_failureId);
+ } else
+#endif
+ {
+ mozilla::gfx::IntSize dummySize = mozilla::gfx::IntSize(16, 16);
+ gl = GLContextEGL::CreateEGLPBufferOffscreenContext(
+ display, desc, dummySize, out_failureId);
+ }
+ return gl.forget();
}
// Don't want a global context on Android as 1) share groups across 2 threads
diff -up firefox-101.0/gfx/gl/GLDefs.h.D147420.diff firefox-101.0/gfx/gl/GLDefs.h
--- firefox-101.0/gfx/gl/GLDefs.h.D147420.diff 2022-05-27 01:16:54.000000000 +0200
+++ firefox-101.0/gfx/gl/GLDefs.h 2022-06-07 09:01:17.487787806 +0200
@@ -104,6 +104,9 @@ bool CheckContextLost(const GLContext* g
// EGL_ANGLE_image_d3d11_texture
#define LOCAL_EGL_D3D11_TEXTURE_ANGLE 0x3484
+// EGL_MESA_platform_surfaceless
+#define LOCAL_EGL_PLATFORM_SURFACELESS_MESA 0x31DD
+
// clang-format on
#endif
diff -up firefox-101.0/gfx/gl/GLLibraryEGL.cpp.D147420.diff firefox-101.0/gfx/gl/GLLibraryEGL.cpp
--- firefox-101.0/gfx/gl/GLLibraryEGL.cpp.D147420.diff 2022-05-27 01:16:54.000000000 +0200
+++ firefox-101.0/gfx/gl/GLLibraryEGL.cpp 2022-06-07 09:03:04.077349997 +0200
@@ -82,7 +82,8 @@ static const char* sEGLExtensionNames[]
"EGL_KHR_swap_buffers_with_damage",
"EGL_EXT_buffer_age",
"EGL_KHR_partial_update",
- "EGL_NV_robustness_video_memory_purge"};
+ "EGL_NV_robustness_video_memory_purge",
+ "EGL_MESA_platform_surfaceless"};
PRLibrary* LoadApitraceLibrary() {
const char* path = nullptr;
@@ -151,6 +152,19 @@ static std::shared_ptr<EglDisplay> GetAn
return EglDisplay::Create(egl, display, false, aProofOfLock);
}
+#ifdef MOZ_WAYLAND
+static std::shared_ptr<EglDisplay> GetAndInitSurfacelessDisplay(
+ GLLibraryEGL& egl, const StaticMutexAutoLock& aProofOfLock) {
+ const EGLAttrib attrib_list[] = {LOCAL_EGL_NONE};
+ const EGLDisplay display = egl.fGetPlatformDisplay(
+ LOCAL_EGL_PLATFORM_SURFACELESS_MESA, EGL_DEFAULT_DISPLAY, attrib_list);
+ if (display == EGL_NO_DISPLAY) {
+ return nullptr;
+ }
+ return EglDisplay::Create(egl, display, true, aProofOfLock);
+}
+#endif
+
static std::shared_ptr<EglDisplay> GetAndInitWARPDisplay(
GLLibraryEGL& egl, void* displayType,
const StaticMutexAutoLock& aProofOfLock) {
@@ -629,6 +643,11 @@ bool GLLibraryEGL::Init(nsACString* cons
END_OF_SYMBOLS};
(void)fnLoadSymbols(symbols);
}
+ {
+ const SymLoadStruct symbols[] = {SYMBOL(GetPlatformDisplay),
+ END_OF_SYMBOLS};
+ (void)fnLoadSymbols(symbols);
+ }
return true;
}
@@ -806,7 +825,9 @@ std::shared_ptr<EglDisplay> GLLibraryEGL
#ifdef MOZ_WAYLAND
// Some drivers doesn't support EGL_DEFAULT_DISPLAY
GdkDisplay* gdkDisplay = gdk_display_get_default();
- if (widget::GdkIsWaylandDisplay(gdkDisplay)) {
+ if (!gdkDisplay) {
+ ret = GetAndInitSurfacelessDisplay(*this, aProofOfLock);
+ } else if (widget::GdkIsWaylandDisplay(gdkDisplay)) {
nativeDisplay = widget::WaylandDisplayGetWLDisplay(gdkDisplay);
if (!nativeDisplay) {
NS_WARNING("Failed to get wl_display.");
@@ -814,7 +835,9 @@ std::shared_ptr<EglDisplay> GLLibraryEGL
}
}
#endif
- ret = GetAndInitDisplay(*this, nativeDisplay, aProofOfLock);
+ if (!ret) {
+ ret = GetAndInitDisplay(*this, nativeDisplay, aProofOfLock);
+ }
}
if (!ret) {
diff -up firefox-101.0/gfx/gl/GLLibraryEGL.h.D147420.diff firefox-101.0/gfx/gl/GLLibraryEGL.h
--- firefox-101.0/gfx/gl/GLLibraryEGL.h.D147420.diff 2022-05-27 01:16:54.000000000 +0200
+++ firefox-101.0/gfx/gl/GLLibraryEGL.h 2022-06-07 09:01:17.487787806 +0200
@@ -107,6 +107,7 @@ enum class EGLExtension {
EXT_buffer_age,
KHR_partial_update,
NV_robustness_video_memory_purge,
+ MESA_platform_surfaceless,
Max
};
diff -up firefox-101.0/widget/gtk/DMABufSurface.cpp.D147420.diff firefox-101.0/widget/gtk/DMABufSurface.cpp
--- firefox-101.0/widget/gtk/DMABufSurface.cpp.D147420.diff 2022-06-07 09:01:17.486787773 +0200
+++ firefox-101.0/widget/gtk/DMABufSurface.cpp 2022-06-07 09:01:17.487787806 +0200
@@ -1259,7 +1259,7 @@ bool DMABufSurfaceYUV::VerifyTextureCrea
nsCString discardFailureId;
sSnapshotContext = GLContextProvider::CreateHeadless({}, &discardFailureId);
if (!sSnapshotContext) {
- NS_WARNING("Failed to create snapshot GLContext");
+ LOGDMABUF((" failed to create snapshot GLContext"));
return false;
}
}
@@ -1268,10 +1268,12 @@ bool DMABufSurfaceYUV::VerifyTextureCrea
for (int i = 0; i < mBufferPlaneCount; i++) {
if (!CreateEGLImage(sSnapshotContext, i)) {
+ LOGDMABUF((" failed to create EGL image!"));
return false;
}
}
+ LOGDMABUF((" success"));
return true;
}

View File

@ -1,7 +1,11 @@
diff -up firefox-101.0/gfx/gl/SharedSurfaceDMABUF.cpp.D147637.diff firefox-101.0/gfx/gl/SharedSurfaceDMABUF.cpp
--- firefox-101.0/gfx/gl/SharedSurfaceDMABUF.cpp.D147637.diff 2022-05-27 01:16:54.000000000 +0200
+++ firefox-101.0/gfx/gl/SharedSurfaceDMABUF.cpp 2022-06-07 09:37:29.361992695 +0200
@@ -12,22 +12,37 @@
diff -up firefox-102.0/gfx/gl/SharedSurfaceDMABUF.cpp.D147637.diff firefox-102.0/gfx/gl/SharedSurfaceDMABUF.cpp
--- firefox-102.0/gfx/gl/SharedSurfaceDMABUF.cpp.D147637.diff 2022-06-23 09:08:46.000000000 +0200
+++ firefox-102.0/gfx/gl/SharedSurfaceDMABUF.cpp 2022-06-28 16:37:52.264835137 +0200
@@ -9,25 +9,58 @@
#include "GLContextEGL.h"
#include "MozFramebuffer.h"
#include "mozilla/layers/LayersSurfaces.h" // for SurfaceDescriptor, etc
+#include "mozilla/gfx/gfxVars.h"
namespace mozilla::gl {
@ -21,33 +25,54 @@ diff -up firefox-101.0/gfx/gl/SharedSurfaceDMABUF.cpp.D147637.diff firefox-101.0
- const RefPtr<DMABufSurface> surface = DMABufSurfaceRGBA::CreateDMABufSurface(
- desc.size.width, desc.size.height, flags);
- if (!surface || !surface->CreateTexture(desc.gl)) {
- return nullptr;
+ const auto& gle = GLContextEGL::Cast(desc.gl);
+ const auto& context = gle->mContext;
+ const auto& egl = *(gle->mEgl);
+
+ if (!HasDmaBufExtensions(gle)) {
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;
}
-
- const auto tex = surface->GetTexture();
- auto fb = MozFramebuffer::CreateForBacking(desc.gl, desc.size, 0, false,
- LOCAL_GL_TEXTURE_2D, tex);
+ 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;
+
- if (!fb) return nullptr;
-
return AsUnique(new SharedSurface_DMABUF(desc, std::move(fb), surface));
}
@@ -61,7 +76,7 @@ UniquePtr<SurfaceFactory_DMABUF> Surface
@@ -61,7 +94,7 @@ UniquePtr<SurfaceFactory_DMABUF> Surface
}
auto dmabufFactory = MakeUnique<SurfaceFactory_DMABUF>(gl);
@ -56,13 +81,13 @@ diff -up firefox-101.0/gfx/gl/SharedSurfaceDMABUF.cpp.D147637.diff firefox-101.0
return dmabufFactory;
}
@@ -71,8 +86,38 @@ UniquePtr<SurfaceFactory_DMABUF> Surface
@@ -71,8 +104,38 @@ UniquePtr<SurfaceFactory_DMABUF> Surface
return nullptr;
}
+bool SurfaceFactory_DMABUF::CanCreateSurface(GLContext& gl) {
+ UniquePtr<SharedSurface> test =
+ CreateShared(gfx::IntSize(1, 1));
+ CreateShared(gfx::IntSize(1, 1), gfx::ColorSpace2::SRGB);
+ if (!test) {
+ LOGDMABUF((
+ "SurfaceFactory_DMABUF::CanCreateSurface() failed to create surface."));
@ -96,15 +121,16 @@ diff -up firefox-101.0/gfx/gl/SharedSurfaceDMABUF.cpp.D147637.diff firefox-101.0
layers::TextureType::DMABUF, true}) {}
-
} // namespace mozilla::gl
diff -up firefox-101.0/gfx/gl/SharedSurfaceDMABUF.h.D147637.diff firefox-101.0/gfx/gl/SharedSurfaceDMABUF.h
--- firefox-101.0/gfx/gl/SharedSurfaceDMABUF.h.D147637.diff 2022-06-07 09:31:23.678228010 +0200
+++ firefox-101.0/gfx/gl/SharedSurfaceDMABUF.h 2022-06-07 09:36:39.691512555 +0200
@@ -59,10 +59,7 @@ class SurfaceFactory_DMABUF : public Sur
diff -up firefox-102.0/gfx/gl/SharedSurfaceDMABUF.h.D147637.diff firefox-102.0/gfx/gl/SharedSurfaceDMABUF.h
--- firefox-102.0/gfx/gl/SharedSurfaceDMABUF.h.D147637.diff 2022-06-23 09:08:47.000000000 +0200
+++ firefox-102.0/gfx/gl/SharedSurfaceDMABUF.h 2022-06-28 15:00:20.339991965 +0200
@@ -59,11 +59,7 @@ class SurfaceFactory_DMABUF : public Sur
return SharedSurface_DMABUF::Create(desc);
}
- bool CanCreateSurface() {
- UniquePtr<SharedSurface> test = CreateShared(gfx::IntSize(1, 1));
- UniquePtr<SharedSurface> test =
- CreateShared(gfx::IntSize(1, 1), gfx::ColorSpace2::SRGB);
- return test != nullptr;
- }
+ bool CanCreateSurface(GLContext& gl);

View File

@ -1,73 +0,0 @@
diff --git a/widget/gtk/DMABufSurface.h b/widget/gtk/DMABufSurface.h
--- a/widget/gtk/DMABufSurface.h
+++ b/widget/gtk/DMABufSurface.h
@@ -146,11 +146,16 @@
DMABufSurface(SurfaceType aSurfaceType);
protected:
virtual bool Create(const mozilla::layers::SurfaceDescriptor& aDesc) = 0;
+ // Import global ref count from IPC by file descriptor.
void GlobalRefCountImport(int aFd);
+ // Export global ref count by file descriptor. This adds global ref count
+ // reference to the surface.
+ // It's used when dmabuf surface is shared with another process via. IPC.
+ int GlobalRefCountExport();
void GlobalRefCountDelete();
void ReleaseDMABuf();
void* MapInternal(uint32_t aX, uint32_t aY, uint32_t aWidth, uint32_t aHeight,
diff --git a/widget/gtk/DMABufSurface.cpp b/widget/gtk/DMABufSurface.cpp
--- a/widget/gtk/DMABufSurface.cpp
+++ b/widget/gtk/DMABufSurface.cpp
@@ -105,11 +105,21 @@
}
void DMABufSurface::GlobalRefCountImport(int aFd) {
MOZ_ASSERT(!mGlobalRefCountFd);
mGlobalRefCountFd = aFd;
- GlobalRefAdd();
+ MOZ_DIAGNOSTIC_ASSERT(IsGlobalRefSet(),
+ "We're importing unreferenced surface!");
+}
+
+int DMABufSurface::GlobalRefCountExport() {
+ if (mGlobalRefCountFd) {
+ MOZ_DIAGNOSTIC_ASSERT(IsGlobalRefSet(),
+ "We're exporting unreferenced surface!");
+ GlobalRefAdd();
+ }
+ return mGlobalRefCountFd;
}
void DMABufSurface::GlobalRefCountDelete() {
if (mGlobalRefCountFd) {
GlobalRefRelease();
@@ -475,11 +485,11 @@
if (mSync) {
fenceFDs.AppendElement(ipc::FileDescriptor(mSyncFd));
}
if (mGlobalRefCountFd) {
- refCountFDs.AppendElement(ipc::FileDescriptor(mGlobalRefCountFd));
+ refCountFDs.AppendElement(ipc::FileDescriptor(GlobalRefCountExport()));
}
aOutDescriptor = SurfaceDescriptorDMABuf(
mSurfaceType, modifiers, mGbmBufferFlags, fds, width, height, width,
height, format, strides, offsets, GetYUVColorSpace(), mColorRange,
@@ -1118,11 +1128,11 @@
if (mSync) {
fenceFDs.AppendElement(ipc::FileDescriptor(mSyncFd));
}
if (mGlobalRefCountFd) {
- refCountFDs.AppendElement(ipc::FileDescriptor(mGlobalRefCountFd));
+ refCountFDs.AppendElement(ipc::FileDescriptor(GlobalRefCountExport()));
}
aOutDescriptor = SurfaceDescriptorDMABuf(
mSurfaceType, modifiers, 0, fds, width, height, widthBytes, heightBytes,
format, strides, offsets, GetYUVColorSpace(), mColorRange, fenceFDs, mUID,

View File

@ -1,7 +1,7 @@
diff -up firefox-101.0.1/gfx/gl/GLContextProviderEGL.cpp.D148946.diff firefox-101.0.1/gfx/gl/GLContextProviderEGL.cpp
--- firefox-101.0.1/gfx/gl/GLContextProviderEGL.cpp.D148946.diff 2022-06-14 14:25:07.290229683 +0200
+++ firefox-101.0.1/gfx/gl/GLContextProviderEGL.cpp 2022-06-14 14:25:07.313230450 +0200
@@ -1190,42 +1190,16 @@ RefPtr<GLContextEGL> GLContextEGL::Creat
diff -up firefox-102.0/gfx/gl/GLContextProviderEGL.cpp.D148946.diff firefox-102.0/gfx/gl/GLContextProviderEGL.cpp
--- firefox-102.0/gfx/gl/GLContextProviderEGL.cpp.D148946.diff 2022-06-23 09:08:47.000000000 +0200
+++ firefox-102.0/gfx/gl/GLContextProviderEGL.cpp 2022-06-28 14:47:40.904700050 +0200
@@ -1182,42 +1182,16 @@ RefPtr<GLContextEGL> GLContextEGL::Creat
}
/*static*/
@ -48,9 +48,9 @@ diff -up firefox-101.0.1/gfx/gl/GLContextProviderEGL.cpp.D148946.diff firefox-10
}
// Don't want a global context on Android as 1) share groups across 2 threads
diff -up firefox-101.0.1/gfx/gl/GLDefs.h.D148946.diff firefox-101.0.1/gfx/gl/GLDefs.h
--- firefox-101.0.1/gfx/gl/GLDefs.h.D148946.diff 2022-06-14 14:25:07.290229683 +0200
+++ firefox-101.0.1/gfx/gl/GLDefs.h 2022-06-14 14:25:07.313230450 +0200
diff -up firefox-102.0/gfx/gl/GLDefs.h.D148946.diff firefox-102.0/gfx/gl/GLDefs.h
--- firefox-102.0/gfx/gl/GLDefs.h.D148946.diff 2022-06-23 09:08:47.000000000 +0200
+++ firefox-102.0/gfx/gl/GLDefs.h 2022-06-28 14:47:40.904700050 +0200
@@ -104,9 +104,6 @@ bool CheckContextLost(const GLContext* g
// EGL_ANGLE_image_d3d11_texture
#define LOCAL_EGL_D3D11_TEXTURE_ANGLE 0x3484
@ -61,10 +61,10 @@ diff -up firefox-101.0.1/gfx/gl/GLDefs.h.D148946.diff firefox-101.0.1/gfx/gl/GLD
// clang-format on
#endif
diff -up firefox-101.0.1/gfx/gl/GLLibraryEGL.cpp.D148946.diff firefox-101.0.1/gfx/gl/GLLibraryEGL.cpp
--- firefox-101.0.1/gfx/gl/GLLibraryEGL.cpp.D148946.diff 2022-06-14 14:25:07.307230250 +0200
+++ firefox-101.0.1/gfx/gl/GLLibraryEGL.cpp 2022-06-14 14:27:03.477110994 +0200
@@ -53,9 +53,15 @@ StaticRefPtr<GLLibraryEGL> GLLibraryEGL:
diff -up firefox-102.0/gfx/gl/GLLibraryEGL.cpp.D148946.diff firefox-102.0/gfx/gl/GLLibraryEGL.cpp
--- firefox-102.0/gfx/gl/GLLibraryEGL.cpp.D148946.diff 2022-06-28 14:47:40.900699918 +0200
+++ firefox-102.0/gfx/gl/GLLibraryEGL.cpp 2022-06-28 14:49:47.810911199 +0200
@@ -54,9 +54,15 @@ StaticRefPtr<GLLibraryEGL> GLLibraryEGL:
// should match the order of EGLExtensions, and be null-terminated.
static const char* sEGLLibraryExtensionNames[] = {
@ -83,7 +83,7 @@ diff -up firefox-101.0.1/gfx/gl/GLLibraryEGL.cpp.D148946.diff firefox-101.0.1/gf
// should match the order of EGLExtensions, and be null-terminated.
static const char* sEGLExtensionNames[] = {
@@ -83,7 +89,6 @@ static const char* sEGLExtensionNames[]
@@ -84,7 +90,6 @@ static const char* sEGLExtensionNames[]
"EGL_EXT_buffer_age",
"EGL_KHR_partial_update",
"EGL_NV_robustness_video_memory_purge",
@ -91,7 +91,7 @@ diff -up firefox-101.0.1/gfx/gl/GLLibraryEGL.cpp.D148946.diff firefox-101.0.1/gf
"EGL_EXT_image_dma_buf_import",
"EGL_EXT_image_dma_buf_import_modifiers",
"EGL_MESA_image_dma_buf_export"};
@@ -156,8 +161,52 @@ static std::shared_ptr<EglDisplay> GetAn
@@ -157,8 +162,52 @@ static std::shared_ptr<EglDisplay> GetAn
}
#ifdef MOZ_WAYLAND
@ -144,7 +144,7 @@ diff -up firefox-101.0.1/gfx/gl/GLLibraryEGL.cpp.D148946.diff firefox-101.0.1/gf
const EGLAttrib attrib_list[] = {LOCAL_EGL_NONE};
const EGLDisplay display = egl.fGetPlatformDisplay(
LOCAL_EGL_PLATFORM_SURFACELESS_MESA, EGL_DEFAULT_DISPLAY, attrib_list);
@@ -610,9 +659,9 @@ bool GLLibraryEGL::Init(nsACString* cons
@@ -611,9 +660,9 @@ bool GLLibraryEGL::Init(nsACString* cons
(void)fnLoadSymbols(symbols);
}
{
@ -157,7 +157,7 @@ diff -up firefox-101.0.1/gfx/gl/GLLibraryEGL.cpp.D148946.diff firefox-101.0.1/gf
(void)fnLoadSymbols(symbols);
}
{
@@ -657,6 +706,10 @@ bool GLLibraryEGL::Init(nsACString* cons
@@ -658,6 +707,10 @@ bool GLLibraryEGL::Init(nsACString* cons
END_OF_SYMBOLS};
(void)fnLoadSymbols(symbols);
}
@ -169,7 +169,7 @@ diff -up firefox-101.0.1/gfx/gl/GLLibraryEGL.cpp.D148946.diff firefox-101.0.1/gf
return true;
}
@@ -835,7 +888,10 @@ std::shared_ptr<EglDisplay> GLLibraryEGL
// Some drivers doesn't support EGL_DEFAULT_DISPLAY
#ifdef MOZ_WAYLAND
GdkDisplay* gdkDisplay = gdk_display_get_default();
if (!gdkDisplay) {
- ret = GetAndInitSurfacelessDisplay(*this, aProofOfLock);
@ -178,11 +178,11 @@ diff -up firefox-101.0.1/gfx/gl/GLLibraryEGL.cpp.D148946.diff firefox-101.0.1/gf
+ ret = GetAndInitSurfacelessDisplay(*this, aProofOfLock);
+ }
} else if (widget::GdkIsWaylandDisplay(gdkDisplay)) {
// Wayland does not support EGL_DEFAULT_DISPLAY
nativeDisplay = widget::WaylandDisplayGetWLDisplay(gdkDisplay);
if (!nativeDisplay) {
diff -up firefox-101.0.1/gfx/gl/GLLibraryEGL.h.D148946.diff firefox-101.0.1/gfx/gl/GLLibraryEGL.h
--- firefox-101.0.1/gfx/gl/GLLibraryEGL.h.D148946.diff 2022-06-14 14:25:07.307230250 +0200
+++ firefox-101.0.1/gfx/gl/GLLibraryEGL.h 2022-06-14 14:25:07.313230450 +0200
diff -up firefox-102.0/gfx/gl/GLLibraryEGL.h.D148946.diff firefox-102.0/gfx/gl/GLLibraryEGL.h
--- firefox-102.0/gfx/gl/GLLibraryEGL.h.D148946.diff 2022-06-28 14:47:40.899699885 +0200
+++ firefox-102.0/gfx/gl/GLLibraryEGL.h 2022-06-28 14:47:40.904700050 +0200
@@ -71,7 +71,10 @@ enum class EGLLibExtension {
ANGLE_device_creation_d3d11,
ANGLE_platform_angle,

View File

@ -1,86 +1,20 @@
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
diff -up firefox-102.0/gfx/config/gfxVars.h.D149238.diff firefox-102.0/gfx/config/gfxVars.h
--- firefox-102.0/gfx/config/gfxVars.h.D149238.diff 2022-06-23 09:08:47.000000000 +0200
+++ firefox-102.0/gfx/config/gfxVars.h 2022-06-28 16:40:54.130895063 +0200
@@ -91,7 +91,8 @@ class gfxVarReceiver;
_(AllowWebGPU, bool, false) \
_(UseVP8HwDecode, bool, false) \
_(UseVP9HwDecode, bool, false) \
- _(HwDecodedVideoNoCopy, bool, false)
+ _(HwDecodedVideoNoCopy, bool, false) \
- _(HwDecodedVideoZeroCopy, bool, false)
+ _(HwDecodedVideoZeroCopy, 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() {
diff -up firefox-102.0/gfx/thebes/gfxPlatform.cpp.D149238.diff firefox-102.0/gfx/thebes/gfxPlatform.cpp
--- firefox-102.0/gfx/thebes/gfxPlatform.cpp.D149238.diff 2022-06-23 09:08:47.000000000 +0200
+++ firefox-102.0/gfx/thebes/gfxPlatform.cpp 2022-06-28 16:40:54.130895063 +0200
@@ -2861,6 +2861,17 @@ void gfxPlatform::InitWebGLConfig() {
gfxVars::SetAllowEglRbab(false);
}
}

View File

@ -139,6 +139,12 @@ ExcludeArch: aarch64
%bcond_without langpacks
%if %{with langpacks}
%if 0%{?fedora} >= 37
%bcond_without langpacks_subpkg
%endif
%endif
%if !%{release_build}
%global pre_tag .npgo
%endif
@ -162,13 +168,13 @@ ExcludeArch: aarch64
Summary: Mozilla Firefox Web browser
Name: firefox
Version: 101.0.1
Release: 7%{?pre_tag}%{?dist}
Version: 102.0
Release: 1%{?pre_tag}%{?dist}
URL: https://www.mozilla.org/firefox/
License: MPLv1.1 or GPLv2+ or LGPLv2+
Source0: https://archive.mozilla.org/pub/firefox/releases/%{version}%{?pre_version}/source/firefox-%{version}%{?pre_version}.source.tar.xz
%if %{with langpacks}
Source1: firefox-langpacks-%{version}%{?pre_version}-20220609.tar.xz
Source1: firefox-langpacks-%{version}%{?pre_version}-20220628.tar.xz
%endif
Source2: cbindgen-vendor.tar.xz
Source10: firefox-mozconfig
@ -217,8 +223,6 @@ Patch55: firefox-testing.patch
Patch61: firefox-glibc-dynstack.patch
Patch62: build-python.patch
Patch71: 0001-GLIBCXX-fix-for-GCC-12.patch
Patch73: D147266.diff
Patch74: D147267.diff
Patch75: mozilla-1773336.patch
# Test patches
@ -243,25 +247,9 @@ Patch402: mozilla-1196777.patch
Patch407: mozilla-1667096.patch
Patch408: mozilla-1663844.patch
Patch415: mozilla-1670333.patch
Patch418: mozilla-1767946-profilemanagersize.patch
# VA-API fixes
Patch420: D144284.diff
Patch421: D147420.diff
Patch422: D147720.diff
Patch423: D147874.diff
Patch424: D146084.diff
Patch425: D146085.diff
Patch426: D146086.diff
Patch427: D146087.diff
Patch428: D145725.diff
Patch429: D145966.diff
Patch430: D145871.diff
Patch431: D146271.diff
Patch432: D146272.diff
Patch433: D146273.diff
Patch434: D146274.diff
Patch435: D146275.diff
# NVIDIA mzbz#1735929
Patch440: D147635.diff
@ -336,6 +324,11 @@ BuildRequires: icu
Requires: mozilla-filesystem
Recommends: mozilla-openh264 >= 2.1.1
%if %{with langpacks_subpkg}
Recommends: firefox-langpacks = %{version}-%{release}
%else
Obsoletes: firefox-langpacks < %{version}-%{release}
%endif
Recommends: libva
Requires: p11-kit-trust
Requires: pciutils-libs
@ -436,6 +429,17 @@ Provides: webclient
Mozilla Firefox is an open-source web browser, designed for standards
compliance, performance and portability.
%if %{with langpacks_subpkg}
%package langpacks
Summary: Firefox langpacks
Requires: %{name} = %{version}-%{release}
%description langpacks
The firefox-langpacks package contains all the localization
and translations langpack add-ons.
%files langpacks -f %{name}.lang
%dir %{langpackdir}
%endif
%package x11
Summary: Firefox X11 launcher.
Requires: %{name}
@ -491,8 +495,6 @@ This package contains results of tests executed during build.
%patch53 -p1 -b .firefox-gcc-build
%patch54 -p1 -b .1669639
%patch71 -p1 -b .0001-GLIBCXX-fix-for-GCC-12
%patch73 -p1 -b .D147266
%patch74 -p1 -b .D147267
# Needs for new cbindgen only
%patch75 -p1 -b .1773336
@ -516,24 +518,9 @@ This package contains results of tests executed during build.
%patch407 -p1 -b .1667096
%patch408 -p1 -b .1663844
%patch415 -p1 -b .1670333
%patch418 -p1 -b .mozilla-1767946-profilemanagersize
# VA-API fixes
%patch420 -p1 -b .D144284.diff
%patch421 -p1 -b .D147420.diff
%patch423 -p1 -b .D147874.diff
%patch424 -p1 -b .D146084.diff
%patch425 -p1 -b .D146085.diff
%patch426 -p1 -b .D146086.diff
%patch427 -p1 -b .D146087.diff
%patch428 -p1 -b .D145725.diff
%patch429 -p1 -b .D145966.diff
%patch430 -p1 -b .D145871.diff
%patch431 -p1 -b .D146271.diff
%patch432 -p1 -b .D146272.diff
%patch433 -p1 -b .D146273.diff
%patch434 -p1 -b .D146274.diff
%patch435 -p1 -b .D146275.diff
# NVIDIA mzbz#1735929
%patch440 -p1 -b .D147635.diff
@ -542,7 +529,6 @@ This package contains results of tests executed during build.
%patch443 -p1 -b .D149135.diff
# More VA-API fixes
%patch422 -p1 -b .D147720.diff
%patch444 -p1 -b .D148946.diff
%patch445 -p1 -b .D149238.diff
%patch446 -p1 -b .mozbz#1758948
@ -1055,7 +1041,11 @@ fi
%posttrans
gtk-update-icon-cache %{_datadir}/icons/hicolor &>/dev/null || :
%if %{with langpacks_subpkg}
%files
%else
%files -f %{name}.lang
%endif
%{_bindir}/firefox
%{mozappdir}/firefox
%{mozappdir}/firefox-bin
@ -1075,9 +1065,11 @@ gtk-update-icon-cache %{_datadir}/icons/hicolor &>/dev/null || :
%{mozappdir}/distribution/distribution.ini
# That's Windows only
%ghost %{mozappdir}/browser/features/aushelper@mozilla.org.xpi
%if %{without langpacks_subpkg}
%if %{with langpacks}
%dir %{langpackdir}
%endif
%endif
%{mozappdir}/browser/omni.ja
%{mozappdir}/run-mozilla.sh
%{mozappdir}/application.ini
@ -1120,6 +1112,10 @@ gtk-update-icon-cache %{_datadir}/icons/hicolor &>/dev/null || :
#---------------------------------------------------------------------
%changelog
* Tue Jun 28 2022 Martin Stransky <stransky@redhat.com>- 102.0-1
- Updated to 102.0
- Applied patch from https://src.fedoraproject.org/rpms/firefox/pull-request/43
* Mon Jun 27 2022 Martin Stransky <stransky@redhat.com>- 101.0.1-7
- Rebuild

View File

@ -1,30 +0,0 @@
diff --git a/widget/gtk/nsWindow.cpp b/widget/gtk/nsWindow.cpp
--- a/widget/gtk/nsWindow.cpp
+++ b/widget/gtk/nsWindow.cpp
@@ -3787,11 +3787,12 @@
mPendingConfigures--;
}
// Don't fire configure event for scale changes, we handle that
// OnScaleChanged event. Skip that for toplevel windows only.
- if (mWindowType == eWindowType_toplevel) {
+ if (mWindowType == eWindowType_toplevel ||
+ mWindowType == eWindowType_dialog) {
MOZ_DIAGNOSTIC_ASSERT(mGdkWindow,
"Getting configure for invisible window?");
if (mWindowScaleFactor != gdk_window_get_scale_factor(mGdkWindow)) {
LOG(" scale factor changed to %d,return early",
gdk_window_get_scale_factor(mGdkWindow));
@@ -4864,10 +4865,11 @@
// Force scale factor recalculation
if (!mGdkWindow) {
mWindowScaleFactorChanged = true;
return;
}
+ LOG("OnScaleChanged -> %d\n", gdk_window_get_scale_factor(mGdkWindow));
// Gtk supply us sometimes with doubled events so stay calm in such case.
if (gdk_window_get_scale_factor(mGdkWindow) == mWindowScaleFactor) {
return;
}

View File

@ -1,4 +1,4 @@
SHA512 (mochitest-python.tar.gz) = 18e1aeb475df5fbf1fe3838897d5ac2f3114aa349030713fc2be27af087b1b12f57642621b87bd052f324a7cb7fbae5f36b21502191d85692f62c8cdd69c8bf2
SHA512 (firefox-101.0.1.source.tar.xz) = 435a7f6013582933e75c41e554a45beda30b5affd7d3ed7d2876026609ba7f17b2c20b507d9d0c9ce2379e335ec09b021257ba30ac55fabf02dca54b03ea70b4
SHA512 (firefox-langpacks-101.0.1-20220609.tar.xz) = 54c93a0fbded6a42948fd578e5577987186ca04695f9c0648718780d3a491b540187addf1239b13c53e532052888bd2ed76788a06c3a2422a060fb0da303ec58
SHA512 (cbindgen-vendor.tar.xz) = d681ca855f3779553b4a452f9dc1e3acea6253b7ef33a65948ab2d32d9848e8c06f0b3f3504ef237d6b9adb4813bdad990f7a79fa9f89333ce0d4e8da7e12d94
SHA512 (firefox-102.0.source.tar.xz) = c7dd6d8d74c46573b16d097a5e5d230669e5778cd680b3b6f30510e989d21543138ced3bb013998b76614aa380b28efd8542450c591d8b724e03bd163d012057
SHA512 (firefox-langpacks-102.0-20220628.tar.xz) = 2e67c06dda372077be087c65778a109070a27bc2e28e347c75ad240a67c57803e315858198273330d931091bf849cfe3d6003d9106d497049090eaf0a4af718c