Backed out changeset 4364b684a6bd (bug 1727661) for causinG bustages in nsWindow.cpp. CLOSED TREE

This commit is contained in:
criss 2021-08-26 16:21:34 +03:00
Родитель 167800069c
Коммит 1adda87dcc
5 изменённых файлов: 156 добавлений и 0 удалений

Просмотреть файл

@ -0,0 +1,79 @@
/* -*- Mode: C++; tab-width: 8; indent-tabs-mode: nil; c-basic-offset: 2 -*- */
/* vim: set ts=8 sts=2 et sw=2 tw=80: */
/* This Source Code Form is subject to the terms of the Mozilla Public
* License, v. 2.0. If a copy of the MPL was not distributed with this
* file, You can obtain one at http://mozilla.org/MPL/2.0/. */
#include "RenderTrace.h"
// If rendertrace is off let's no compile this code
#ifdef MOZ_RENDERTRACE
# include "Layers.h"
# include "TreeTraversal.h" // for ForEachNode
namespace mozilla {
namespace layers {
static gfx::Matrix4x4 GetRootTransform(Layer* aLayer) {
gfx::Matrix4x4 layerTrans = aLayer->GetTransform();
layerTrans.ProjectTo2D();
if (aLayer->GetParent() != nullptr) {
return GetRootTransform(aLayer->GetParent()) * layerTrans;
}
return layerTrans;
}
void RenderTraceLayers(Layer* aLayer, const char* aColor,
const gfx::Matrix4x4 aRootTransform) {
int colorId = 0;
ForEachNode<ForwardIterator>(aLayer, [&colorId](Layer* layer) {
gfx::Matrix4x4 trans = aRootTransform * layer->GetTransform();
trans.ProjectTo2D();
gfx::IntRect clipRect = layer->GetLocalVisibleRegion().GetBounds();
Rect rect(clipRect.x, clipRect.y, clipRect.width, clipRect.height);
trans.TransformBounds(rect);
if (strcmp(layer->Name(), "ContainerLayer") != 0 &&
strcmp(layer->Name(), "ContainerLayerComposite") != 0) {
printf_stderr("%s RENDERTRACE %u rect #%02X%s %i %i %i %i\n",
layer->Name(), (int)PR_IntervalNow(), colorId, aColor,
(int)rect.x, (int)rect.y, (int)rect.width,
(int)rect.height);
}
colorId++;
});
}
void RenderTraceInvalidateStart(Layer* aLayer, const char* aColor,
const gfx::IntRect aRect) {
gfx::Matrix4x4 trans = GetRootTransform(aLayer);
gfx::Rect rect(aRect.x, aRect.y, aRect.width, aRect.height);
trans.TransformBounds(rect);
printf_stderr("%s RENDERTRACE %u fillrect #%s %i %i %i %i\n", aLayer->Name(),
(int)PR_IntervalNow(), aColor, (int)rect.x, (int)rect.y,
(int)rect.width, (int)rect.height);
}
void RenderTraceInvalidateEnd(Layer* aLayer, const char* aColor) {
// Clear with an empty rect
RenderTraceInvalidateStart(aLayer, aColor, gfx::IntRect());
}
void renderTraceEventStart(const char* aComment, const char* aColor) {
printf_stderr("%s RENDERTRACE %u fillrect #%s 0 0 10 10\n", aComment,
(int)PR_IntervalNow(), aColor);
}
void renderTraceEventEnd(const char* aComment, const char* aColor) {
printf_stderr("%s RENDERTRACE %u fillrect #%s 0 0 0 0\n", aComment,
(int)PR_IntervalNow(), aColor);
}
void renderTraceEventEnd(const char* aColor) {
renderTraceEventEnd("", aColor);
}
} // namespace layers
} // namespace mozilla
#endif

73
gfx/layers/RenderTrace.h Normal file
Просмотреть файл

@ -0,0 +1,73 @@
/* -*- Mode: C++; tab-width: 8; indent-tabs-mode: nil; c-basic-offset: 2 -*- */
/* vim: set ts=8 sts=2 et sw=2 tw=80: */
/* This Source Code Form is subject to the terms of the Mozilla Public
* License, v. 2.0. If a copy of the MPL was not distributed with this
* file, You can obtain one at http://mozilla.org/MPL/2.0/. */
// This is a general tool that will let you visualize platform operation.
// Currently used for the layer system, the general syntax allows this
// tools to be adapted to trace other operations.
//
// For the front end see: https://github.com/staktrace/rendertrace
// Uncomment this line to enable RENDERTRACE
//#define MOZ_RENDERTRACE
#ifndef GFX_RENDERTRACE_H
#define GFX_RENDERTRACE_H
#include "nsRect.h"
#include "mozilla/gfx/Matrix.h"
namespace mozilla {
namespace layers {
class Layer;
void RenderTraceLayers(Layer* aLayer, const char* aColor,
const gfx::Matrix4x4 aRootTransform = gfx::Matrix4x4(),
bool aReset = true);
void RenderTraceInvalidateStart(Layer* aLayer, const char* aColor,
const gfx::IntRect aRect);
void RenderTraceInvalidateEnd(Layer* aLayer, const char* aColor);
void renderTraceEventStart(const char* aComment, const char* aColor);
void renderTraceEventEnd(const char* aComment, const char* aColor);
void renderTraceEventEnd(const char* aColor);
struct RenderTraceScope {
public:
RenderTraceScope(const char* aComment, const char* aColor)
: mComment(aComment), mColor(aColor) {
renderTraceEventStart(mComment, mColor);
}
~RenderTraceScope() { renderTraceEventEnd(mComment, mColor); }
private:
const char* mComment;
const char* mColor;
};
#ifndef MOZ_RENDERTRACE
inline void RenderTraceLayers(Layer* aLayer, const char* aColor,
const gfx::Matrix4x4 aRootTransform,
bool aReset) {}
inline void RenderTraceInvalidateStart(Layer* aLayer, const char* aColor,
const gfx::IntRect aRect) {}
inline void RenderTraceInvalidateEnd(Layer* aLayer, const char* aColor) {}
inline void renderTraceEventStart(const char* aComment, const char* aColor) {}
inline void renderTraceEventEnd(const char* aComment, const char* aColor) {}
inline void renderTraceEventEnd(const char* aColor) {}
#endif // MOZ_RENDERTRACE
} // namespace layers
} // namespace mozilla
#endif // GFX_RENDERTRACE_H

Просмотреть файл

@ -9,6 +9,7 @@
#include "CompositorBridgeParent.h" // for CompositorBridgeParent
#include "GLContext.h" // for GLContext
#include "Layers.h" // for Layer
#include "RenderTrace.h" // for RenderTraceInvalidateEnd, etc
#include "mozilla/Assertions.h" // for MOZ_ASSERT, etc
#include "mozilla/RefPtr.h" // for RefPtr
#include "mozilla/layers/CompositorTypes.h"

Просмотреть файл

@ -12,6 +12,7 @@
#include <utility> // for pair
#include "apz/src/APZCTreeManager.h" // for APZCTreeManager
#include "RenderTrace.h" // for RenderTraceLayers
#include "base/process.h" // for ProcessId
#include "gfxContext.h" // for gfxContext
#include "gfxPlatform.h" // for gfxPlatform

Просмотреть файл

@ -210,6 +210,7 @@ EXPORTS.mozilla.layers += [
"opengl/TextureHostOGL.h",
"PersistentBufferProvider.h",
"ProfilerScreenshots.h",
"RenderTrace.h",
"RepaintRequest.h",
"SampleTime.h",
"ScreenshotGrabber.h",
@ -450,6 +451,7 @@ UNIFIED_SOURCES += [
"opengl/TextureHostOGL.cpp",
"ProfilerScreenshots.cpp",
"ReadbackProcessor.cpp",
"RenderTrace.cpp",
"RepaintRequest.cpp",
"SampleTime.cpp",
"ScreenshotGrabber.cpp",