author | Kartikaya Gupta <kgupta@mozilla.com> |
Thu, 10 May 2018 13:05:22 -0400 | |
changeset 417830 | 4e38ca9aaa48420fcb44df9e1a41e29ce53af267 |
parent 417829 | 6327e477e665de347ce5d281d36e8cf94fe53749 |
child 417831 | f365bf91369c4f1327738cd4a4fb27ccdf05f274 |
push id | 33980 |
push user | ebalazs@mozilla.com |
push date | Fri, 11 May 2018 09:35:12 +0000 |
treeherder | mozilla-central@8e9a4a323f0c [default view] [failures only] |
perfherder | [talos] [build metrics] [platform microbench] (compared to previous push) |
reviewers | sotaro |
bugs | 1460495 |
milestone | 62.0a1 |
first release with | nightly linux32
nightly linux64
nightly mac
nightly win32
nightly win64
|
last release without | nightly linux32
nightly linux64
nightly mac
nightly win32
nightly win64
|
--- a/gfx/webrender_bindings/WebRenderAPI.cpp +++ b/gfx/webrender_bindings/WebRenderAPI.cpp @@ -129,26 +129,20 @@ public: } private: layers::SynchronousTask* mTask; }; TransactionBuilder::TransactionBuilder() + : mUseSceneBuilderThread(gfxPrefs::WebRenderAsyncSceneBuild()) { - // 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); - } + mTxn = wr_transaction_new(mUseSceneBuilderThread); + mResourceUpdates = wr_resource_updates_new(); } TransactionBuilder::~TransactionBuilder() { wr_transaction_delete(mTxn); wr_resource_updates_delete(mResourceUpdates); } @@ -361,17 +355,17 @@ WebRenderAPI::~WebRenderAPI() wr_api_delete(mDocHandle); } void WebRenderAPI::SendTransaction(TransactionBuilder& aTxn) { wr_transaction_update_resources(aTxn.Raw(), aTxn.RawUpdates()); - wr_api_send_transaction(mDocHandle, aTxn.Raw()); + wr_api_send_transaction(mDocHandle, aTxn.Raw(), aTxn.UseSceneBuilderThread()); } bool WebRenderAPI::HitTest(const wr::WorldPoint& aPoint, wr::WrPipelineId& aOutPipelineId, layers::FrameMetrics::ViewID& aOutScrollId, gfx::CompositorHitTestInfo& aOutHitInfo) {
--- a/gfx/webrender_bindings/WebRenderAPI.h +++ b/gfx/webrender_bindings/WebRenderAPI.h @@ -133,19 +133,21 @@ public: const wr::FontInstanceOptions* aOptions, const wr::FontInstancePlatformOptions* aPlatformOptions, wr::Vec<uint8_t>& aVariations); void DeleteFontInstance(wr::FontInstanceKey aKey); void Clear(); + bool UseSceneBuilderThread() const { return mUseSceneBuilderThread; } Transaction* Raw() { return mTxn; } wr::ResourceUpdates* RawUpdates() { return mResourceUpdates; } protected: + bool mUseSceneBuilderThread; Transaction* mTxn; wr::ResourceUpdates* mResourceUpdates; }; class TransactionWrapper { public: explicit TransactionWrapper(Transaction* aTxn);
--- a/gfx/webrender_bindings/src/bindings.rs +++ b/gfx/webrender_bindings/src/bindings.rs @@ -976,28 +976,32 @@ pub unsafe extern "C" fn wr_api_delete(d } /// cbindgen:postfix=WR_DESTRUCTOR_SAFE_FUNC #[no_mangle] pub unsafe extern "C" fn wr_api_shut_down(dh: &mut DocumentHandle) { dh.api.shut_down(); } -#[no_mangle] -pub extern "C" fn wr_transaction_new(do_async: bool) -> *mut Transaction { +fn make_transaction(do_async: bool) -> 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)) + transaction +} + +#[no_mangle] +pub extern "C" fn wr_transaction_new(do_async: bool) -> *mut Transaction { + Box::into_raw(Box::new(make_transaction(do_async))) } /// cbindgen:postfix=WR_DESTRUCTOR_SAFE_FUNC #[no_mangle] pub extern "C" fn wr_transaction_delete(txn: *mut Transaction) { unsafe { let _ = Box::from_raw(txn); } } @@ -1285,22 +1289,24 @@ pub extern "C" fn wr_resource_updates_de key: WrImageKey ) { resources.delete_image(key); } #[no_mangle] pub extern "C" fn wr_api_send_transaction( dh: &mut DocumentHandle, - transaction: &mut Transaction + transaction: &mut Transaction, + is_async: bool ) { if transaction.is_empty() { return; } - let txn = mem::replace(transaction, Transaction::new()); + let new_txn = make_transaction(is_async); + let txn = mem::replace(transaction, new_txn); dh.api.send_transaction(dh.document_id, txn); } #[no_mangle] pub unsafe extern "C" fn wr_transaction_clear_display_list( txn: &mut Transaction, epoch: WrEpoch, pipeline_id: WrPipelineId,
--- a/gfx/webrender_bindings/webrender_ffi_generated.h +++ b/gfx/webrender_bindings/webrender_ffi_generated.h @@ -1068,17 +1068,18 @@ WR_FUNC; WR_INLINE void wr_api_send_external_event(DocumentHandle *aDh, uintptr_t aEvt) WR_DESTRUCTOR_SAFE_FUNC; WR_INLINE void wr_api_send_transaction(DocumentHandle *aDh, - Transaction *aTransaction) + Transaction *aTransaction, + bool aIsAsync) WR_FUNC; WR_INLINE void wr_api_shut_down(DocumentHandle *aDh) WR_DESTRUCTOR_SAFE_FUNC; WR_INLINE void wr_api_wake_scene_builder(DocumentHandle *aDh)