Skip to content

Commit

Permalink
The switch to disable webrender build
Browse files Browse the repository at this point in the history
  • Loading branch information
Fedor committed Jan 7, 2024
1 parent b179cc2 commit 45b510c
Show file tree
Hide file tree
Showing 247 changed files with 4,758 additions and 1,278 deletions.
1 change: 1 addition & 0 deletions build/moz.configure/old.configure
Original file line number Diff line number Diff line change
Expand Up @@ -214,6 +214,7 @@ def old_configure_options(*options):
'--enable-system-sqlite',
'--enable-universalchardet',
'--enable-updater',
'--enable-webrender',
'--enable-xul',
'--enable-zipwriter',
'--includedir',
Expand Down
64 changes: 54 additions & 10 deletions dom/base/nsDOMWindowUtils.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -105,8 +105,10 @@
#include "mozilla/gfx/GPUProcessManager.h"
#include "mozilla/dom/TimeoutManager.h"
#include "mozilla/PreloadedStyleSheet.h"
#include "mozilla/layers/WebRenderBridgeChild.h"
#include "mozilla/layers/WebRenderLayerManager.h"
#ifdef MOZ_BUILD_WEBRENDER
# include "mozilla/layers/WebRenderBridgeChild.h"
# include "mozilla/layers/WebRenderLayerManager.h"
#endif
#include "mozilla/ResultExtensions.h"

#ifdef XP_WIN
Expand Down Expand Up @@ -244,6 +246,7 @@ LayerTransactionChild* nsDOMWindowUtils::GetLayerTransaction() {
: nullptr;
}

#ifdef MOZ_BUILD_WEBRENDER
WebRenderBridgeChild* nsDOMWindowUtils::GetWebRenderBridge() {
if (nsIWidget* widget = GetWidget()) {
if (LayerManager* lm = widget->GetLayerManager()) {
Expand All @@ -254,6 +257,7 @@ WebRenderBridgeChild* nsDOMWindowUtils::GetWebRenderBridge() {
}
return nullptr;
}
#endif

CompositorBridgeChild* nsDOMWindowUtils::GetCompositorBridge() {
if (nsIWidget* widget = GetWidget()) {
Expand Down Expand Up @@ -2131,8 +2135,11 @@ nsDOMWindowUtils::GetUsingAdvancedLayers(bool* retval) {

NS_IMETHODIMP
nsDOMWindowUtils::GetIsWebRenderRequested(bool* retval) {
#ifdef MOZ_BUILD_WEBRENDER

*retval = gfxPlatform::WebRenderPrefEnabled() ||
gfxPlatform::WebRenderEnvvarEnabled();
#endif
return NS_OK;
}

Expand Down Expand Up @@ -2242,8 +2249,10 @@ nsDOMWindowUtils::AdvanceTimeAndRefresh(int64_t aMilliseconds) {
RefPtr<LayerTransactionChild> transaction = GetLayerTransaction();
if (transaction && transaction->IPCOpen()) {
transaction->SendSetTestSampleTime(driver->MostRecentRefresh());
#ifdef MOZ_BUILD_WEBRENDER
} else if (WebRenderBridgeChild* wrbc = GetWebRenderBridge()) {
wrbc->SendSetTestSampleTime(driver->MostRecentRefresh());
#endif
}
}

Expand All @@ -2270,8 +2279,10 @@ nsDOMWindowUtils::RestoreNormalRefresh() {
RefPtr<LayerTransactionChild> transaction = GetLayerTransaction();
if (transaction && transaction->IPCOpen()) {
transaction->SendLeaveTestMode();
#ifdef MOZ_BUILD_WEBRENDER
} else if (WebRenderBridgeChild* wrbc = GetWebRenderBridge()) {
wrbc->SendLeaveTestMode();
#endif
}

if (nsPresContext* pc = GetPresContext()) {
Expand Down Expand Up @@ -2319,6 +2330,7 @@ nsDOMWindowUtils::SetAsyncScrollOffset(Element* aElement, float aX, float aY) {
if (!manager) {
return NS_ERROR_FAILURE;
}
#ifdef MOZ_BUILD_WEBRENDER
if (WebRenderLayerManager* wrlm = manager->AsWebRenderLayerManager()) {
WebRenderBridgeChild* wrbc = wrlm->WrBridge();
if (!wrbc) {
Expand All @@ -2327,6 +2339,7 @@ nsDOMWindowUtils::SetAsyncScrollOffset(Element* aElement, float aX, float aY) {
wrbc->SendSetAsyncScrollOffset(viewId, aX, aY);
return NS_OK;
}
#endif
ShadowLayerForwarder* forwarder = manager->AsShadowForwarder();
if (!forwarder || !forwarder->HasShadowManager()) {
return NS_ERROR_UNEXPECTED;
Expand All @@ -2352,6 +2365,7 @@ nsDOMWindowUtils::SetAsyncZoom(Element* aRootElement, float aValue) {
if (!manager) {
return NS_ERROR_FAILURE;
}
#ifdef MOZ_BUILD_WEBRENDER
if (WebRenderLayerManager* wrlm = manager->AsWebRenderLayerManager()) {
WebRenderBridgeChild* wrbc = wrlm->WrBridge();
if (!wrbc) {
Expand All @@ -2360,6 +2374,7 @@ nsDOMWindowUtils::SetAsyncZoom(Element* aRootElement, float aValue) {
wrbc->SendSetAsyncZoom(viewId, aValue);
return NS_OK;
}
#endif
ShadowLayerForwarder* forwarder = manager->AsShadowForwarder();
if (!forwarder || !forwarder->HasShadowManager()) {
return NS_ERROR_UNEXPECTED;
Expand All @@ -2385,6 +2400,7 @@ nsDOMWindowUtils::FlushApzRepaints(bool* aOutResult) {
*aOutResult = false;
return NS_OK;
}
#ifdef MOZ_BUILD_WEBRENDER
if (WebRenderLayerManager* wrlm = manager->AsWebRenderLayerManager()) {
WebRenderBridgeChild* wrbc = wrlm->WrBridge();
if (!wrbc) {
Expand All @@ -2394,6 +2410,7 @@ nsDOMWindowUtils::FlushApzRepaints(bool* aOutResult) {
*aOutResult = true;
return NS_OK;
}
#endif
ShadowLayerForwarder* forwarder = manager->AsShadowForwarder();
if (!forwarder || !forwarder->HasShadowManager()) {
*aOutResult = false;
Expand Down Expand Up @@ -3372,8 +3389,12 @@ static Result<nsIFrame*, nsresult> GetTargetFrame(
return frame;
}

static OMTAValue GetOMTAValue(nsIFrame* aFrame, DisplayItemType aDisplayItemKey,
WebRenderBridgeChild* aWebRenderBridgeChild) {
static OMTAValue GetOMTAValue(nsIFrame* aFrame, DisplayItemType aDisplayItemKey
#ifdef MOZ_BUILD_WEBRENDER
,
WebRenderBridgeChild* aWebRenderBridgeChild
#endif
) {
OMTAValue value = mozilla::null_t();

Layer* layer = FrameLayerBuilder::GetDedicatedLayer(aFrame, aDisplayItemKey);
Expand All @@ -3383,6 +3404,7 @@ static OMTAValue GetOMTAValue(nsIFrame* aFrame, DisplayItemType aDisplayItemKey,
forwarder->GetShadowManager()->SendGetAnimationValue(
layer->GetCompositorAnimationsId(), &value);
}
#ifdef MOZ_BUILD_WEBRENDER
} else if (aWebRenderBridgeChild) {
RefPtr<WebRenderAnimationData> animationData =
GetWebRenderUserData<WebRenderAnimationData>(aFrame,
Expand All @@ -3392,6 +3414,7 @@ static OMTAValue GetOMTAValue(nsIFrame* aFrame, DisplayItemType aDisplayItemKey,
animationData->GetAnimationInfo().GetCompositorAnimationsId(),
&value);
}
#endif
}
return value;
}
Expand All @@ -3418,8 +3441,12 @@ nsDOMWindowUtils::GetOMTAStyle(Element* aElement, const nsAString& aProperty,
}

if (aProperty.EqualsLiteral("opacity")) {
OMTAValue value = GetOMTAValue(frame, DisplayItemType::TYPE_OPACITY,
GetWebRenderBridge());
OMTAValue value = GetOMTAValue(frame, DisplayItemType::TYPE_OPACITY
#ifdef MOZ_BUILD_WEBRENDER
,
GetWebRenderBridge()
#endif
);
if (value.type() == OMTAValue::Tfloat) {
cssValue = new nsROCSSPrimitiveValue;
cssValue->SetNumber(value.get_float());
Expand All @@ -3432,14 +3459,23 @@ nsDOMWindowUtils::GetOMTAStyle(Element* aElement, const nsAString& aProperty,
aProperty.EqualsLiteral("offset-distance") ||
aProperty.EqualsLiteral("offset-rotate") ||
aProperty.EqualsLiteral("offset-anchor")) {
OMTAValue value = GetOMTAValue(frame, DisplayItemType::TYPE_TRANSFORM,
GetWebRenderBridge());
OMTAValue value = GetOMTAValue(frame, DisplayItemType::TYPE_TRANSFORM
#ifdef MOZ_BUILD_WEBRENDER
,
GetWebRenderBridge()
#endif
);
if (value.type() == OMTAValue::TMatrix4x4) {
cssValue = nsComputedDOMStyle::MatrixToCSSValue(value.get_Matrix4x4());
}
} else if (aProperty.EqualsLiteral("background-color")) {
OMTAValue value = GetOMTAValue(
frame, DisplayItemType::TYPE_BACKGROUND_COLOR, GetWebRenderBridge());
OMTAValue value =
GetOMTAValue(frame, DisplayItemType::TYPE_BACKGROUND_COLOR
#ifdef MOZ_BUILD_WEBRENDER
,
GetWebRenderBridge()
#endif
);
if (value.type() == OMTAValue::Tnscolor) {
cssValue = new nsROCSSPrimitiveValue;
nsComputedDOMStyle::SetToRGBAColor(cssValue, value.get_nscolor());
Expand All @@ -3466,9 +3502,11 @@ nsDOMWindowUtils::GetOMTCTransform(Element* aElement,
return NS_ERROR_INVALID_ARG;
}

#ifdef MOZ_BUILD_WEBRENDER
if (GetWebRenderBridge()) {
return NS_ERROR_NOT_IMPLEMENTED;
}
#endif

auto frameOrError = GetTargetFrame(aElement, aPseudoElement);
if (frameOrError.isErr()) {
Expand Down Expand Up @@ -3615,10 +3653,12 @@ nsDOMWindowUtils::GetContentAPZTestData(
if (!clm->GetAPZTestData().ToJS(aOutContentTestData, aContext)) {
return NS_ERROR_FAILURE;
}
#ifdef MOZ_BUILD_WEBRENDER
} else if (WebRenderLayerManager* wrlm = lm->AsWebRenderLayerManager()) {
if (!wrlm->GetAPZTestData().ToJS(aOutContentTestData, aContext)) {
return NS_ERROR_FAILURE;
}
#endif
}
}

Expand All @@ -3636,13 +3676,15 @@ nsDOMWindowUtils::GetCompositorAPZTestData(
APZTestData compositorSideData;
if (ClientLayerManager* clm = lm->AsClientLayerManager()) {
clm->GetCompositorSideAPZTestData(&compositorSideData);
#ifdef MOZ_BUILD_WEBRENDER
} else if (WebRenderLayerManager* wrlm = lm->AsWebRenderLayerManager()) {
if (!wrlm->WrBridge()) {
return NS_ERROR_UNEXPECTED;
}
if (!wrlm->WrBridge()->SendGetAPZTestData(&compositorSideData)) {
return NS_ERROR_FAILURE;
}
#endif
}
if (!compositorSideData.ToJS(aOutCompositorTestData, aContext)) {
return NS_ERROR_FAILURE;
Expand Down Expand Up @@ -4066,9 +4108,11 @@ nsTranslationNodeList::GetLength(uint32_t* aRetVal) {

NS_IMETHODIMP
nsDOMWindowUtils::WrCapture() {
#ifdef MOZ_BUILD_WEBRENDER
if (WebRenderBridgeChild* wrbc = GetWebRenderBridge()) {
wrbc->Capture();
}
#endif
return NS_OK;
}

Expand Down
4 changes: 4 additions & 0 deletions dom/base/nsDOMWindowUtils.h
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,9 @@ class Element;
} // namespace dom
namespace layers {
class LayerTransactionChild;
#ifdef MOZ_BUILD_WEBRENDER
class WebRenderBridgeChild;
#endif
} // namespace layers
} // namespace mozilla

Expand Down Expand Up @@ -79,7 +81,9 @@ class nsDOMWindowUtils final : public nsIDOMWindowUtils,
nsPresContext* GetPresContext();
mozilla::dom::Document* GetDocument();
mozilla::layers::LayerTransactionChild* GetLayerTransaction();
#ifdef MOZ_BUILD_WEBRENDER
mozilla::layers::WebRenderBridgeChild* GetWebRenderBridge();
#endif
mozilla::layers::CompositorBridgeChild* GetCompositorBridge();

// Until callers are annotated.
Expand Down
8 changes: 6 additions & 2 deletions dom/canvas/CanvasRenderingContext2D.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -118,8 +118,10 @@
#include "mozilla/ServoStyleSet.h"
#include "mozilla/SVGContentUtils.h"
#include "mozilla/layers/CanvasClient.h"
#include "mozilla/layers/WebRenderUserData.h"
#include "mozilla/layers/WebRenderCanvasRenderer.h"
#ifdef MOZ_BUILD_WEBRENDER
# include "mozilla/layers/WebRenderUserData.h"
# include "mozilla/layers/WebRenderCanvasRenderer.h"
#endif

#undef free // apparently defined by some windows header, clashing with a
// free() method in SkTypes.h
Expand Down Expand Up @@ -5312,6 +5314,7 @@ already_AddRefed<Layer> CanvasRenderingContext2D::GetCanvasLayer(
return canvasLayer.forget();
}

#ifdef MOZ_BUILD_WEBRENDER
bool CanvasRenderingContext2D::UpdateWebRenderCanvasData(
nsDisplayListBuilder* aBuilder, WebRenderCanvasData* aCanvasData) {
if (mOpaque) {
Expand Down Expand Up @@ -5356,6 +5359,7 @@ bool CanvasRenderingContext2D::UpdateWebRenderCanvasData(
mResetLayer = false;
return true;
}
#endif

bool CanvasRenderingContext2D::InitializeCanvasRenderer(
nsDisplayListBuilder* aBuilder, CanvasRenderer* aRenderer) {
Expand Down
2 changes: 2 additions & 0 deletions dom/canvas/CanvasRenderingContext2D.h
Original file line number Diff line number Diff line change
Expand Up @@ -431,8 +431,10 @@ class CanvasRenderingContext2D final : public nsICanvasRenderingContextInternal,
Layer* aOldLayer,
LayerManager* aManager) override;

#ifdef MOZ_BUILD_WEBRENDER
bool UpdateWebRenderCanvasData(nsDisplayListBuilder* aBuilder,
WebRenderCanvasData* aCanvasData) override;
#endif

bool InitializeCanvasRenderer(nsDisplayListBuilder* aBuilder,
CanvasRenderer* aRenderer) override;
Expand Down
18 changes: 11 additions & 7 deletions dom/canvas/WebGLContext.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -51,8 +51,10 @@
#endif
#include "mozilla/layers/ImageBridgeChild.h"
#include "mozilla/layers/TextureClientSharedSurface.h"
#include "mozilla/layers/WebRenderUserData.h"
#include "mozilla/layers/WebRenderCanvasRenderer.h"
#ifdef MOZ_BUILD_WEBRENDER
# include "mozilla/layers/WebRenderUserData.h"
# include "mozilla/layers/WebRenderCanvasRenderer.h"
#endif

// Local
#include "CanvasUtils.h"
Expand Down Expand Up @@ -1169,6 +1171,7 @@ already_AddRefed<layers::Layer> WebGLContext::GetCanvasLayer(
return canvasLayer.forget();
}

#ifdef MOZ_BUILD_WEBRENDER
bool WebGLContext::UpdateWebRenderCanvasData(nsDisplayListBuilder* aBuilder,
WebRenderCanvasData* aCanvasData) {
CanvasRenderer* renderer = aCanvasData->GetCanvasRenderer();
Expand All @@ -1188,6 +1191,7 @@ bool WebGLContext::UpdateWebRenderCanvasData(nsDisplayListBuilder* aBuilder,
mResetLayer = false;
return true;
}
#endif

bool WebGLContext::InitializeCanvasRenderer(nsDisplayListBuilder* aBuilder,
CanvasRenderer* aRenderer) {
Expand Down Expand Up @@ -2123,7 +2127,7 @@ CheckedUint32 WebGLContext::GetUnpackSize(bool isFunc3D, uint32_t width,
}

#ifdef MOZ_VR
#if defined(MOZ_WIDGET_ANDROID)
# if defined(MOZ_WIDGET_ANDROID)
already_AddRefed<layers::SharedSurfaceTextureClient>
WebGLContext::GetVRFrame() {
if (!gl) return nullptr;
Expand Down Expand Up @@ -2163,7 +2167,7 @@ WebGLContext::GetVRFrame() {

return sharedSurface.forget();
}
#else
# else
already_AddRefed<layers::SharedSurfaceTextureClient>
WebGLContext::GetVRFrame() {
if (!gl) return nullptr;
Expand All @@ -2186,7 +2190,7 @@ WebGLContext::GetVRFrame() {
return sharedSurface.forget();
}

#endif // ifdefined(MOZ_WIDGET_ANDROID)
# endif // ifdefined(MOZ_WIDGET_ANDROID)

void WebGLContext::EnsureVRReady() {
if (mVRReady) {
Expand All @@ -2208,12 +2212,12 @@ void WebGLContext::EnsureVRReady() {
auto factory =
gl::GLScreenBuffer::CreateFactory(gl, caps, imageBridge.get(), flags);
gl->Screen()->Morph(std::move(factory));
#if defined(MOZ_WIDGET_ANDROID)
# if defined(MOZ_WIDGET_ANDROID)
// On Android we are using a different GLScreenBuffer for WebVR, so we need
// a resize here because PresentScreenBuffer() may not be called for the
// gl->Screen() after we set the new factory.
gl->Screen()->Resize(DrawingBufferSize());
#endif
# endif
mVRReady = true;
}
}
Expand Down
5 changes: 3 additions & 2 deletions dom/canvas/WebGLContext.h
Original file line number Diff line number Diff line change
Expand Up @@ -480,8 +480,10 @@ class WebGLContext : public nsICanvasRenderingContextInternal,
Layer* oldLayer,
LayerManager* manager) override;

#ifdef MOZ_BUILD_WEBRENDER
bool UpdateWebRenderCanvasData(nsDisplayListBuilder* aBuilder,
WebRenderCanvasData* aCanvasData) override;
#endif

bool InitializeCanvasRenderer(nsDisplayListBuilder* aBuilder,
CanvasRenderer* aRenderer) override;
Expand Down Expand Up @@ -798,8 +800,7 @@ class WebGLContext : public nsICanvasRenderingContextInternal,

public:
explicit Arr(const viewT& view)
: elemCount(ComputeAndReturnLength(view)),
elemBytes(view.Data()) {}
: elemCount(ComputeAndReturnLength(view)), elemBytes(view.Data()) {}

explicit Arr(const dom::Sequence<elemT>& seq)
: elemCount(seq.Length()), elemBytes(seq.Elements()) {}
Expand Down
Loading

0 comments on commit 45b510c

Please sign in to comment.