Bug 1449982 - Introduce pref to control async scene building. r=nical

Until all the pieces are in place, turning on this pref will probably
break horribly. But we need the pref so we can add the rest of the
pieces without enabling them by default.

MozReview-Commit-ID: 7DkcwZgXwhx

--HG--
extra : rebase_source : e1fdef2e9a682028df524f51f767a4d2187410b1
This commit is contained in:
Kartikaya Gupta 2018-04-10 12:29:55 -04:00
Родитель 7dd62afca0
Коммит 4a07281ed3
4 изменённых файлов: 24 добавлений и 5 удалений

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

@ -507,6 +507,7 @@ private:
DECL_GFX_PREF(Once, "gfx.vsync.compositor.unobserve-count", CompositorUnobserveCount, int32_t, 10);
DECL_GFX_PREF(Once, "gfx.webrender.all", WebRenderAll, bool, false);
DECL_GFX_PREF(Once, "gfx.webrender.async-scene-build", WebRenderAsyncSceneBuild, bool, false);
DECL_GFX_PREF(Once, "gfx.webrender.enabled", WebRenderEnabledDoNotUseDirectly, bool, false);
DECL_OVERRIDE_PREF(Live, "gfx.webrender.blob-images", WebRenderBlobImages, gfxPrefs::WebRenderAll());
DECL_GFX_PREF(Live, "gfx.webrender.blob.invalidation", WebRenderBlobInvalidation, bool, false);

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

@ -5,7 +5,9 @@
* file, You can obtain one at http://mozilla.org/MPL/2.0/. */
#include "WebRenderAPI.h"
#include "DisplayItemClipChain.h"
#include "gfxPrefs.h"
#include "LayersLogging.h"
#include "mozilla/webrender/RendererOGL.h"
#include "mozilla/gfx/gfxVars.h"
@ -134,8 +136,15 @@ private:
TransactionBuilder::TransactionBuilder()
{
mTxn = wr_transaction_new();
mResourceUpdates = wr_resource_updates_new();
// We need the if statement to avoid miscompilation on windows, see
// bug 1449982 comment 22.
if (gfxPrefs::WebRenderAsyncSceneBuild()) {
mTxn = wr_transaction_new(true);
mResourceUpdates = wr_resource_updates_new();
} else {
mResourceUpdates = wr_resource_updates_new();
mTxn = wr_transaction_new(false);
}
}
TransactionBuilder::~TransactionBuilder()

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

@ -863,8 +863,17 @@ pub unsafe extern "C" fn wr_api_shut_down(dh: &mut DocumentHandle) {
}
#[no_mangle]
pub extern "C" fn wr_transaction_new() -> *mut Transaction {
Box::into_raw(Box::new(Transaction::new()))
pub extern "C" fn wr_transaction_new(do_async: bool) -> *mut Transaction {
let mut transaction = Transaction::new();
// Ensure that we either use async scene building or not based on the
// gecko pref, regardless of what the default is. We can remove this once
// the scene builder thread is enabled everywhere and working well.
if do_async {
transaction.use_scene_builder_thread();
} else {
transaction.skip_scene_builder();
}
Box::into_raw(Box::new(transaction))
}
/// cbindgen:postfix=WR_DESTRUCTOR_SAFE_FUNC

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

@ -1580,7 +1580,7 @@ bool wr_transaction_is_empty(const Transaction *aTxn)
WR_FUNC;
WR_INLINE
Transaction *wr_transaction_new()
Transaction *wr_transaction_new(bool aDoAsync)
WR_FUNC;
WR_INLINE