Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(318)

Issue 896803002: Port SkRefCnt.h to new SkAtomics.h (Closed)

Created:
5 years, 10 months ago by mtklein_C
Modified:
5 years, 10 months ago
Reviewers:
bungeman-skia, mtklein
CC:
reviews_skia.org
Base URL:
https://skia.googlesource.com/skia.git@master
Target Ref:
refs/heads/master
Project:
skia
Visibility:
Public.

Description

Port SkRefCnt.h to new SkAtomics.h This adds sk_memory_barrier(), implemented using sk_atomic_fetch_add() on an uninitialized variable. If that becomes a problem we can drop this to the porting layer, using std::atomic_thread_fence() / __atomic_thread_fence() / __sync_synchronize(). The big win is that ref() doesn't generate a memory barrier any more on ARM. This is an instance of SkSafeRef() in SkPaint(const SkPaint&) after this CL: 4d0: 684a ldr r2, [r1, #4] 4d2: 6018 str r0, [r3, #0] 4d4: b13a cbz r2, 4e6 <_ZN7SkPaintC1ERKS_+0x2e> 4d6: 1d10 adds r0, r2, #4 4d8: e850 4f00 ldrex r4, [r0] 4dc: 3401 adds r4, #1 4de: e840 4500 strex r5, r4, [r0] 4e2: 2d00 cmp r5, #0 4e4: d1f8 bne.n 4d8 <_ZN7SkPaintC1ERKS_+0x20> Here's the before, pretty much the same with two memory barriers surrounding the ref(): 4d8: 684a ldr r2, [r1, #4] 4da: 6018 str r0, [r3, #0] 4dc: b15a cbz r2, 4f6 <_ZN7SkPaintC1ERKS_+0x3e> 4de: 1d10 adds r0, r2, #4 4e0: f3bf 8f5f dmb sy 4e4: e850 4f00 ldrex r4, [r0] 4e8: 3401 adds r4, #1 4ea: e840 4500 strex r5, r4, [r0] 4ee: 2d00 cmp r5, #0 4f0: d1f8 bne.n 4e4 <_ZN7SkPaintC1ERKS_+0x2c> 4f2: f3bf 8f5f dmb sy The miscellaneous files in here are just fixups to explicitly include SkMutex.h, instead of leeching it off SkRefCnt.h. No public API changes. TBR=reed@google.com Build trybots seem hosed. NOTRY=true BUG=skia: Committed: https://skia.googlesource.com/skia/+/7b274c78fbeefa3818af68099545f2839c854847

Patch Set 1 #

Patch Set 2 : small things #

Patch Set 3 : more #

Total comments: 4

Patch Set 4 : benh #

Total comments: 2

Patch Set 5 : porting layer #

Patch Set 6 : acqrel again #

Patch Set 7 : tweaks #

Patch Set 8 : rebase #

Unified diffs Side-by-side diffs Delta from patch set Stats (+21 lines, -23 lines) Patch
M include/core/SkRefCnt.h View 1 2 3 4 5 6 4 chunks +17 lines, -23 lines 0 comments Download
M include/effects/SkColorCubeFilter.h View 1 2 1 chunk +1 line, -0 lines 0 comments Download
M src/lazy/SkDiscardableMemoryPool.h View 1 1 chunk +1 line, -0 lines 0 comments Download
M src/pdf/SkPDFTypes.h View 1 2 1 chunk +1 line, -0 lines 0 comments Download
M src/utils/win/SkDWriteFontFileStream.h View 1 2 3 4 5 1 chunk +1 line, -0 lines 0 comments Download

Messages

Total messages: 27 (11 generated)
mtklein_C
5 years, 10 months ago (2015-02-03 16:50:30 UTC) #2
bungeman-skia
https://codereview.chromium.org/896803002/diff/40001/include/core/SkRefCnt.h File include/core/SkRefCnt.h (right): https://codereview.chromium.org/896803002/diff/40001/include/core/SkRefCnt.h#newcode76 include/core/SkRefCnt.h:76: // An acquire makes sure code in internal_dispose() doen't ...
5 years, 10 months ago (2015-02-03 17:14:47 UTC) #3
mtklein
https://codereview.chromium.org/896803002/diff/40001/include/core/SkRefCnt.h File include/core/SkRefCnt.h (right): https://codereview.chromium.org/896803002/diff/40001/include/core/SkRefCnt.h#newcode76 include/core/SkRefCnt.h:76: // An acquire makes sure code in internal_dispose() doen't ...
5 years, 10 months ago (2015-02-03 17:27:57 UTC) #5
bungeman-skia
This one comment aside, it seems good this caught what may have been an issue ...
5 years, 10 months ago (2015-02-03 18:48:47 UTC) #6
mtklein
https://codereview.chromium.org/896803002/diff/60001/include/core/SkRefCnt.h File include/core/SkRefCnt.h (right): https://codereview.chromium.org/896803002/diff/60001/include/core/SkRefCnt.h#newcode76 include/core/SkRefCnt.h:76: if (1 == sk_atomic_fetch_add(&fRefCnt, -1, sk_memory_order_release)) { On 2015/02/03 ...
5 years, 10 months ago (2015-02-03 19:08:27 UTC) #7
mtklein
On 2015/02/03 19:08:27, mtklein wrote: > https://codereview.chromium.org/896803002/diff/60001/include/core/SkRefCnt.h > File include/core/SkRefCnt.h (right): > > https://codereview.chromium.org/896803002/diff/60001/include/core/SkRefCnt.h#newcode76 > ...
5 years, 10 months ago (2015-02-03 19:36:59 UTC) #8
bungeman-skia
If TSAN is happy, everything must be correct, right? lgtm
5 years, 10 months ago (2015-02-03 19:41:20 UTC) #9
mtklein
On 2015/02/03 19:41:20, bungeman1 wrote: > If TSAN is happy, everything must be correct, right? ...
5 years, 10 months ago (2015-02-03 19:42:07 UTC) #10
commit-bot: I haz the power
CQ is trying da patch. Follow status at https://chromium-cq-status.appspot.com/patch-status/896803002/120001
5 years, 10 months ago (2015-02-03 19:42:50 UTC) #12
commit-bot: I haz the power
CQ is trying da patch. Follow status at https://chromium-cq-status.appspot.com/patch-status/896803002/120001
5 years, 10 months ago (2015-02-03 20:29:09 UTC) #15
commit-bot: I haz the power
CQ is trying da patch. Follow status at https://chromium-cq-status.appspot.com/patch-status/896803002/140001
5 years, 10 months ago (2015-02-03 20:29:29 UTC) #18
commit-bot: I haz the power
CQ is trying da patch. Follow status at https://chromium-cq-status.appspot.com/patch-status/896803002/140001
5 years, 10 months ago (2015-02-03 21:03:49 UTC) #21
commit-bot: I haz the power
CQ is trying da patch. Follow status at https://chromium-cq-status.appspot.com/patch-status/896803002/140001
5 years, 10 months ago (2015-02-03 21:38:51 UTC) #24
commit-bot: I haz the power
Committed patchset #8 (id:140001) as https://skia.googlesource.com/skia/+/7b274c78fbeefa3818af68099545f2839c854847
5 years, 10 months ago (2015-02-03 21:39:03 UTC) #25
mtklein
On 2015/02/03 21:39:03, I haz the power (commit-bot) wrote: > Committed patchset #8 (id:140001) as ...
5 years, 10 months ago (2015-02-03 22:58:17 UTC) #26
reed1
5 years, 10 months ago (2015-02-03 23:00:27 UTC) #27
Message was sent while issue was closed.
On 2015/02/03 22:58:17, mtklein wrote:
> On 2015/02/03 21:39:03, I haz the power (commit-bot) wrote:
> > Committed patchset #8 (id:140001) as
> >
https://skia.googlesource.com/skia/+/7b274c78fbeefa3818af68099545f2839c854847
> 
> Early numbers look like this will be a ~10% recording speedup on ARM:
> 
> https://perf.skia.org/#2150

Kick!

Powered by Google App Engine
This is Rietveld 408576698