History log of /frameworks/minikin/libs/minikin/MinikinInternal.h
Revision Date Author Comments (<<< Hide modified files) (Show modified files >>>)
7d8c4ed5b7683e16e6205a6b52b1910f8ff6b51b 09-Feb-2018 Seigo Nonaka <nona@google.com> Remove global mutex lock from minikin

All modules are now free from gMinikinLock.

This increases the performance of parallel text layout in background thread.

Here is a raw performance score on walleye-userdebug

StaticLayout creation time in parallel:
RandomText Thread 1 : 7,348,118 -> 7,327,542: (-0.3%)
RandomText Thread 2 : 13,872,214 -> 7,402,398: (-46.6%)
RandomText Thread 4 : 24,999,986 -> 8,185,263: (-67.3%)

StaticLayout creation time:
MeasuredText Balanced Hyphenation : 774,245 -> 781,534: (+0.9%)
MeasuredText Balanced NoHyphenation: 587,157 -> 574,882: (-2.1%)
MeasuredText Greedy Hyphenation : 535,843 -> 523,630: (-2.3%)
MeasuredText Greedy NoHyphenation : 534,965 -> 522,259: (-2.4%)
RandomText Balanced Hyphenation : 17,886,651 -> 17,814,108: (-0.4%)
RandomText Balanced NoHyphenation : 7,385,288 -> 7,410,588: (+0.3%)
RandomText Greedy Hyphenation : 7,380,350 -> 7,296,407: (-1.1%)
RandomText Greedy NoHyphenation : 7,358,680 -> 7,320,040: (-0.5%)

MeasuredText creation time
NoStyled Hyphenation : 17,587,451 -> 17,544,350: (-0.2%)
NoStyled Hyphenation WidthOnly : 17,112,258 -> 17,092,507: (-0.1%)
NoStyled NoHyphenation : 7,307,064 -> 7,296,519: (-0.1%)
NoStyled NoHyphenation WidthOnly : 6,880,721 -> 6,848,543: (-0.5%)
Styled Hyphenation : 14,753,919 -> 14,659,049: (-0.6%)
Styled Hyphenation WidthOnly : 13,767,908 -> 13,755,623: (-0.1%)
Styled NoHyphenation : 14,368,118 -> 14,337,125: (-0.2%)
Styled NoHyphenation WidthOnly : 13,414,942 -> 13,375,858: (-0.3%)

StaticLayout draw time:
MeasuredText NoStyled : 676,438 -> 678,795: (+0.3%)
MeasuredText NoStyled WithoutCache : 663,041 -> 654,687: (-1.3%)
MeasuredText Styled : 885,574 -> 890,281: (+0.5%)
MeasuredText Styled WithoutCache : 944,259 -> 928,675: (-1.7%)
RandomText NoStyled : 562,361 -> 553,651: (-1.5%)
RandomText NoStyled WithoutCache : 6,678,968 -> 6,696,637: (+0.3%)
RandomText Styled : 2,970,369 -> 2,933,900: (-1.2%)
RandomText Styled WithoutCache : 3,408,554 -> 3,387,260: (-0.6%)

Bug: 37567215
Test: minikin_tests
Test: minikin_stress_tests
Test: atest CtsWidgetTestCases:EditTextTest
CtsWidgetTestCases:TextViewFadingEdgeTest
FrameworksCoreTests:TextViewFallbackLineSpacingTest
FrameworksCoreTests:TextViewTest FrameworksCoreTests:TypefaceTest
CtsGraphicsTestCases:TypefaceTest CtsWidgetTestCases:TextViewTest
CtsTextTestCases CtsGraphicsTestCases:PaintTest
Test: bit FrameworksCoreTests:android.text.
Change-Id: I6aab090be6bfa65f1205b26b77c6c65823a3d94e
/frameworks/minikin/libs/minikin/MinikinInternal.h
a22996e31226e3dcbfb0c57d03ca9ac54028fc28 01-Feb-2018 Seigo Nonaka <nona@google.com> Remove HbFontCache

This is 2nd attempt of the If86840fcf9.

HbFontCache was introduced for saving hb_font_t creation cost, but it
turned out that creating hb_font_t from another hb_font_t is cheap.

Instead of computing hb_font_t from buffer, compute hb_font_t in Zygote
process and store it in Font class.

By this change, mutex lock is no longer necessary for all HarfBuzz
related function calls.

StaticLayout creation time (w/o -> w/ patch, N=10, walleye-userdebug):
MeasuredText Balanced Hyphenation : 712,896 -> 705,864: (-1.0%)
MeasuredText Balanced NoHyphenation: 548,745 -> 535,891: (-2.3%)
MeasuredText Greedy Hyphenation : 486,093 -> 479,541: (-1.3%)
MeasuredText Greedy NoHyphenation : 491,053 -> 480,571: (-2.1%)
RandomText Balanced Hyphenation : 17,749,025 -> 17,426,362: (-1.8%)
RandomText Balanced NoHyphenation : 7,433,576 -> 7,401,203: (-0.4%)
RandomText Greedy Hyphenation : 7,388,658 -> 7,327,291: (-0.8%)
RandomText Greedy NoHyphenation : 7,375,390 -> 7,381,066: (+0.1%)

MeasuredText creation time (w/o -> w/ patch, N=10, walleye-userdebug)
Styled Hyphenation : 14,364,510 -> 14,430,830: (+0.5%)
Styled Hyphenation WidthOnly : 13,629,489 -> 13,446,345: (-1.3%)
Styled NoHyphenation : 14,104,669 -> 13,873,049: (-1.6%)
Styled NoHyphenation WidthOnly : 13,304,362 -> 13,091,473: (-1.6%)
NoStyled Hyphenation : 17,512,424 -> 17,368,559: (-0.8%)
NoStyled Hyphenation WidthOnly : 17,095,872 -> 16,985,377: (-0.6%)
NoStyled NoHyphenation : 7,371,994 -> 7,344,223: (-0.4%)
NoStyled NoHyphenation WidthOnly : 6,932,519 -> 6,950,149: (+0.3%)

StaticLayout draw time (w/o -> w/ patch, N=10, walleye-userdebug)
MeasuredText NoStyled : 661,017 -> 657,547: (-0.5%)
MeasuredText NoStyled WithoutCache : 660,506 -> 651,035: (-1.4%)
MeasuredText Styled : 868,116 -> 854,418: (-1.6%)
MeasuredText Styled WithoutCache : 916,078 -> 880,388: (-3.9%)
RandomText NoStyled : 561,192 -> 547,528: (-2.4%)
RandomText NoStyled WithoutCache : 6,758,025 -> 6,695,065: (-0.9%)
RandomText Styled : 2,886,462 -> 2,843,580: (-1.5%)
RandomText Styled WithoutCache : 3,319,513 -> 3,276,261: (-1.3%)

Bug: 37567215
Test: minikin_tests
Test: hwui_unit_tests
Test: atest CtsTextTestCases \
CtsWidgetTestCases:EditTextTest \
CtsWidgetTestCases:TextViewFadingEdgeTest \
FrameworksCoreTests:TextViewFallbackLineSpacingTest \
FrameworksCoreTests:TextViewTest FrameworksCoreTests:TypefaceTest \
CtsGraphicsTestCases:TypefaceTest CtsWidgetTestCases:TextViewTest
Test: bit FrameworksCoreTests:android.text.

Change-Id: If523fce5ce3747b03a1d3bad8c5938a4e2901792
/frameworks/minikin/libs/minikin/MinikinInternal.h
4de86391218f9fa2d1ba15d78cd80514fb5ce43d 07-Feb-2018 Seigo Nonaka <nona@google.com> Revert "Remove HbFontCache"

This causes a regression for some characters.

This reverts commit 6c6954b40f7a6bd6dcf8a3d01c78600437c2e011.

Bug: 73054061
Change-Id: I010754474eebd55e43666893c4f7af9de12b22f3
/frameworks/minikin/libs/minikin/MinikinInternal.h
6c6954b40f7a6bd6dcf8a3d01c78600437c2e011 01-Feb-2018 Seigo Nonaka <nona@google.com> Remove HbFontCache

HbFontCache was introduced for saving hb_font_t creation cost, but it
turned out that creating hb_font_t from another hb_font_t is cheap.

Instead of computing hb_font_t from buffer, compute hb_font_t in Zygote
process and store it in Font class.

By this change, mutex lock is no longer necessary for all HarfBuzz
related function calls.

StaticLayout creation time (w/o -> w/ patch, N=10, walleye-userdebug):
MeasuredText Balanced Hyphenation : 712,896 -> 705,864: (-1.0%)
MeasuredText Balanced NoHyphenation: 548,745 -> 535,891: (-2.3%)
MeasuredText Greedy Hyphenation : 486,093 -> 479,541: (-1.3%)
MeasuredText Greedy NoHyphenation : 491,053 -> 480,571: (-2.1%)
RandomText Balanced Hyphenation : 17,749,025 -> 17,426,362: (-1.8%)
RandomText Balanced NoHyphenation : 7,433,576 -> 7,401,203: (-0.4%)
RandomText Greedy Hyphenation : 7,388,658 -> 7,327,291: (-0.8%)
RandomText Greedy NoHyphenation : 7,375,390 -> 7,381,066: (+0.1%)

MeasuredText creation time (w/o -> w/ patch, N=10, walleye-userdebug)
Styled Hyphenation : 14,364,510 -> 14,430,830: (+0.5%)
Styled Hyphenation WidthOnly : 13,629,489 -> 13,446,345: (-1.3%)
Styled NoHyphenation : 14,104,669 -> 13,873,049: (-1.6%)
Styled NoHyphenation WidthOnly : 13,304,362 -> 13,091,473: (-1.6%)
NoStyled Hyphenation : 17,512,424 -> 17,368,559: (-0.8%)
NoStyled Hyphenation WidthOnly : 17,095,872 -> 16,985,377: (-0.6%)
NoStyled NoHyphenation : 7,371,994 -> 7,344,223: (-0.4%)
NoStyled NoHyphenation WidthOnly : 6,932,519 -> 6,950,149: (+0.3%)

StaticLayout draw time (w/o -> w/ patch, N=10, walleye-userdebug)
MeasuredText NoStyled : 661,017 -> 657,547: (-0.5%)
MeasuredText NoStyled WithoutCache : 660,506 -> 651,035: (-1.4%)
MeasuredText Styled : 868,116 -> 854,418: (-1.6%)
MeasuredText Styled WithoutCache : 916,078 -> 880,388: (-3.9%)
RandomText NoStyled : 561,192 -> 547,528: (-2.4%)
RandomText NoStyled WithoutCache : 6,758,025 -> 6,695,065: (-0.9%)
RandomText Styled : 2,886,462 -> 2,843,580: (-1.5%)
RandomText Styled WithoutCache : 3,319,513 -> 3,276,261: (-1.3%)

Bug: 37567215
Test: minikin_tests
Test: hwui_unit_tests
Test: atest CtsTextTestCases \
CtsWidgetTestCases:EditTextTest \
CtsWidgetTestCases:TextViewFadingEdgeTest \
FrameworksCoreTests:TextViewFallbackLineSpacingTest \
FrameworksCoreTests:TextViewTest FrameworksCoreTests:TypefaceTest \
CtsGraphicsTestCases:TypefaceTest CtsWidgetTestCases:TextViewTest
Test: bit FrameworksCoreTests:android.text.

Change-Id: If86840fcf957ca16e3a821204b79156fc23f1596
/frameworks/minikin/libs/minikin/MinikinInternal.h
6c8722e217ff5238f0b849152d7936959a728103 30-Nov-2017 Seigo Nonaka <nona@google.com> Apply clang-format

Bug: 65125938
Test: m
Change-Id: I4a4319cc34c186aa0a3ce1d0301af1cd4e0feb81
/frameworks/minikin/libs/minikin/MinikinInternal.h
78aadd58c4500d73f266d34f1f2c1f88309987a6 26-Oct-2017 Seigo Nonaka <nona@google.com> Use enum class for Bidi flags

This is a mechanical refactoring of changing type definition of bidi flag.

Bug: 65024629
Test: checkbuild
Change-Id: I9304636899360cd730411e842c8eb432fb23f8e0
/frameworks/minikin/libs/minikin/MinikinInternal.h
1d461589869ee5b7102f96271b0ef0a776ab513c 20-Oct-2017 Seigo Nonaka <nona@google.com> Style cleanup.

This CL contains following cleanups:
- Rename the following classes and corresponding file names:
FontLanguage -> Locale
FontLanguages -> LocaleList
FontLanguageListCache -> LocaleListCache
- Remove unnecessary #include lines.
- Define the Minikin's header include ordering and follow that style.
See doc/minikin_style.md for details.
- Always use std::string and std::vector instead of string and vector
with using-declaration.
- Replace LOG_ALWAYS_FATAL_IF with MINIKIN_ASSERT so that the assertion
is removed on build configuration for user.

This CL does not change any behavior.

Bug: 65024629
Test: make checkbuild
Change-Id: If41bb3c3389303053bbe95e349eb2dd4b619257c
/frameworks/minikin/libs/minikin/MinikinInternal.h
8fbcbda6f9a2ee254ad8d22a5fe025e094fd6ff0 04-Oct-2017 Seigo Nonaka <nona@google.com> Introduce HyphenatorMap for managing hyphenator in Minikin

The motivation of this map is porting Hyphenator.java to Minikin.
Since our locale is fully expanded by ICU, we need to search with
dropping some components from locale. See the comments in
HyphenatorMap::lookup for more details.

This CL only introduces HyphenatorMap. Nobody uses this class at this
moment. Hyphenator.java will be replaced with this class in subsequent
CLs.

Bug: 65024629
Test: minikin_tests

Change-Id: Ib6ff6101a011a9d1099b9d4e371fab0542c161a0
/frameworks/minikin/libs/minikin/MinikinInternal.h
722841005f805a5023fd7edefc4016968d1fae10 18-Mar-2017 Seigo Nonaka <nona@google.com> Compute SparseBitSet for cmap format 14 subtables.

By computing cmap format 14 subtables similar to cmap format 4 or 12,
there are following benefits:
- FontCollection::hasVariationSelector becomes 70x faster for the worst
case, 10x faster for the normal case.
- FontFamily::hasGlyph becomes lock-free.
- FontCollection::itemize becomes 2x faster than before for some cases.

On the other hand, following negative things happen:
- Initial FontFamily construction takes 2.5x longer than before, but this
only happens in Zygote and should not happen at application launch time.
- FontFamily construction from buffer takes longer time than before but
it is still around 800µs.
- Consumes additionally memory (about 30kB for NotoSansCJK-Regular.ttc
of ttc index 0, 2.5kB for NotoColorEmoji.ttf), but this is shared across
all applications. No additional memory is necessary if the font doesn't
support variation sequences.

Bug: 36401726
Test: minikin_tests passed
Test: minikin_stress_tests passed
Test: android.graphics.cts.PaintTest passed
Change-Id: I3ebc9ad5050fb9ab6283810d31ae8d13af168ec5
/frameworks/minikin/libs/minikin/MinikinInternal.h
818fbee83a72ca86f64527eb90b2f15ec9b28504 14-Apr-2017 Seigo Nonaka <nona@google.com> Reduce heap memory in minikin.

This patch reduces about 73 kB memory.
The original SparseBitSet could contain full 32bit integers, but all of
that is not necessary for Unicode code points. By reducing the supported
range to up to Unicode maximum, U+10FFFF, we can save extra memory.

SparseBitSet holds 256-bit sliced pages and indices of them.
Previously, we needed to hold up to 2^24-1 pages for keeping 32-bit
integers.

This CL limits the number of pages to 2^16-1 (65535), so that
SparseBitSet only supports 24-bit integers now, but this is sufficient
for keeping all Unicode code points. With this change, we can change the
index integer type from uint32_t to uint16_t.

Bug: 37357593
Test: minikin_tests passes
Change-Id: I462cc27927752c942ac5da0bf303a5afb81b87a3
/frameworks/minikin/libs/minikin/MinikinInternal.h
bab3b98ceb29fa3fc5d8832284312859d7f32cc7 31-Mar-2017 Roozbeh Pournader <roozbeh@google.com> Override the bidi properties of new emojis

Test: new Minikin tests are added, and pass
Bug: 32952475
Change-Id: Ibcae60d18d0cd5efd7556aaf58a716b6b59c8ee0
/frameworks/minikin/libs/minikin/MinikinInternal.h
fd4124c53399581dd94eac5a9749bc07b474a294 14-Mar-2017 Seigo Nonaka <nona@google.com> Revert "Use std::mutex instead of android::Mutex"

This reverts commit 62ad565335d4774bc5b31ced462e92566b48d197.

Bug: 36208043
Test: N/A

Change-Id: I165ab7a0718ea50a8034adb6277809e271fd762c
/frameworks/minikin/libs/minikin/MinikinInternal.h
62ad565335d4774bc5b31ced462e92566b48d197 21-Feb-2017 Seigo Nonaka <nona@google.com> Use std::mutex instead of android::Mutex

This CL includes:
- Stop using utils/Mutex and use std::mutex instead.
- Stop using utils/Singleton.

Test: minikin_tests passed
Change-Id: Ib3f75b83397a546472bb5f91e066e44506e78263
/frameworks/minikin/libs/minikin/MinikinInternal.h
dfbc6e374259f9d81940b5195ac013b02429af27 10-Feb-2017 Seigo Nonaka <nona@google.com> Remove MinikinRefCounted and use shared_ptr instead

Let's use shared_ptr since manual ref counting can be a bug-prone and
using the global mutex inside destructor is not useful for some time.

To remove raw pointer manipulation, needed to change Layout
constructors. Layout is no longer copyable and need to pass
FontCollection to constructor.

Bug: 28119474
Test: minikin_tests passed
Test: hwui_unit_tests passed
Test: No performance regression in minikin_perftest.
Change-Id: I8824593206ecba74cbc9731e298f045e1ae442a3
/frameworks/minikin/libs/minikin/MinikinInternal.h
58ee6af0c3f5ccef659119c8ffbeb8536fbb59e0 04-Dec-2016 Seigo Nonaka <nona@google.com> Use HarfBuzz metric implementation for emoji font.

To avoid lock contention in Skia, use HarfBuzz implementation
for retrieving boundary box and advance information from font.

Bug: 21705974
Test: Manually done

Change-Id: Ia88cb670ca9e0bb352bccef22c5ea3a789bcc1da
/frameworks/minikin/libs/minikin/MinikinInternal.h
47b905f6840ea6776d6f6778915e7408a1ff8be4 15-Aug-2016 Chih-Hung Hsieh <chh@google.com> Fix google-explicit-constructor warnings in minikin

* Add explicit keyword to conversion constructors,
or add NOLINT(implicit) for implicit converters.
Bug: 28341362
Test: build with WITH_TIDY=1

Change-Id: I0c7b90f9bb953a9f2e4f0fb2032fa65ac604b9ca
/frameworks/minikin/libs/minikin/MinikinInternal.h
14e2d136aaef271ba131f917cf5f27baa31ae5ad 09-Jun-2016 Seigo Nonaka <nona@google.com> Always use minikin namespace.

Here is a new policy of the namespace of minikin.
- All components should be in minikin namespace.
- All tests are also in minikin namespace and no anonymous namespace.

Bug: 29233740
Change-Id: I71a8a35049bb8d624f7a78797231e90fed1e2b8c
/frameworks/minikin/libs/minikin/MinikinInternal.h
77f488345316fba46c271fc04bea470819ae1712 19-Apr-2016 Seigo Nonaka <nona@google.com> Do not break before and after ZWJ.

The emoji list is generated from external/unicode/emoji-data.txt

Bug: 28248662
Change-Id: Ie49b3782505665d62c24371ca23d317ae5e9c5f7
/frameworks/minikin/libs/minikin/MinikinInternal.h
aaa4e3470270496e6eb80704eadecb2cb7c56bf0 07-Apr-2016 Raph Levien <raph@google.com> Avoid copying of font table data

The hb_font_t object holds on to tables of font data, acquired through
the MinikinFont::GetTable interface, which is based on copying data
into caller-owned buffers. Now that we're caching lots of hb_font_t's,
the cost of these buffers is significant.

This patch moves to a different interface, inspired by HarfBuzz's
hb_reference_table API, where the font can provide a pointer to the
actual font data (which will often be mmap'ed, so it doesn't even
consume physical RAM).

Bug: 27860101
Change-Id: Id766ab16a8d342bf7322a90e076e801271d527d4
/frameworks/minikin/libs/minikin/MinikinInternal.h
0036da164e3b25f1ac29c840c1fe15b03dc6677f 25-Feb-2016 Seigo Nonaka <nona@google.com> Use color font if skin tone is specified.

If skin tone is specified, the base emoji should be emoji style even
if it is text presentation default emoji.

This patch also removes wrong test case which expects default emoji
presentation but it is controlled by family order in /etc/fonts.xml
and there is no special logic for default presentation in minikin.
Thus the default presentation unit test should not be in minikin.

Bug: 27342346

Change-Id: I74a2b2feab4d559535049e368cfd833063cce81c
/frameworks/minikin/libs/minikin/MinikinInternal.h
fb0d396929e534a3686469b474d4f670864aa5ac 17-Sep-2015 Seigo Nonaka <nona@google.com> Extract hb_face_t object cache mechanism from Layout.cpp.

This CL does following things:
- Extract hb_face_t object cache mechanism from Layout.cpp to be able to
use it from other cpp file, especially from FontFamily.cpp.
To address Bug 11256006 and Bug 17759267, need to touch
hb_face_t from FontFamily.
- Make hb_face_t cache mechanism thread-safe.
- Add unit tests for HbFaceCache test cases.

Bug: 11256006
Bug: 17759267
Change-Id: Ic183634ef34326793bd9a32167236611d0af34d6
/frameworks/minikin/libs/minikin/MinikinInternal.h
b80c1f19c58b927820a8a24bf2218e5645724608 06-May-2014 Raph Levien <raph@google.com> Better refcounting and locking

All major externally accessible objects (especially FontFamily and
FontCollection) are now reference counted. In addition, there is a
global lock intended to make operations thread-safe.

WIP notice: in this version of the patch, not all external API entry
points are protected by the lock. That should be fixed.

Change-Id: I14106196e99eb101e8bf1bcb4b81359759d2086c
/frameworks/minikin/libs/minikin/MinikinInternal.h