Skip to content

Commit

Permalink
Fix optional neon support
Browse files Browse the repository at this point in the history
On Android, we detect neon support at runtime and switch implementations
based on that. This requires that some parts of skia are compiled with
-mfpu=neon.

To support this, the -mfpu flag is moved out of the 'compiler' config
and into its own config. A target can then remove this config and supply
its own -mfpu flag (without having to duplicate all the other stuff in
the 'compiler' config).

BUG=359249

Review URL: https://codereview.chromium.org/371853007

git-svn-id: svn://svn.chromium.org/chrome/trunk/src@286038 0039d316-1c4b-4281-b951-d872f2087c98
  • Loading branch information
cjhopman@chromium.org committed Jul 29, 2014
1 parent 6111004 commit 0ac572b
Show file tree
Hide file tree
Showing 4 changed files with 25 additions and 10 deletions.
1 change: 1 addition & 0 deletions build/config/BUILDCONFIG.gn
Original file line number Diff line number Diff line change
Expand Up @@ -310,6 +310,7 @@ _native_compiler_configs = [
"//build/config:feature_flags",

"//build/config/compiler:compiler",
"//build/config/compiler:compiler_arm_fpu",
"//build/config/compiler:chromium_code",
"//build/config/compiler:default_include_dirs",
"//build/config/compiler:default_warnings",
Expand Down
2 changes: 1 addition & 1 deletion build/config/arm.gni
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@ if (cpu_arch == "arm") {

if (is_android) {
arm_use_neon = false
arm_optionally_use_neon = false
arm_optionally_use_neon = true
} else {
arm_use_neon = true
arm_optionally_use_neon = true
Expand Down
9 changes: 8 additions & 1 deletion build/config/compiler/BUILD.gn
Original file line number Diff line number Diff line change
Expand Up @@ -134,7 +134,6 @@ config("compiler") {
if (!is_android_webview_build) {
cflags += [
"-march=$arm_arch",
"-mfpu=$arm_fpu",
"-mfloat-abi=$arm_float_abi",
]
if (arm_tune != "") {
Expand Down Expand Up @@ -314,6 +313,14 @@ config("compiler") {
}
}

config("compiler_arm_fpu") {
if (cpu_arch == "arm" && !is_android_webview_build) {
cflags = [
"-mfpu=$arm_fpu",
]
}
}

# runtime_library -------------------------------------------------------------
#
# Sets the runtime library and associated options.
Expand Down
23 changes: 15 additions & 8 deletions skia/BUILD.gn
Original file line number Diff line number Diff line change
Expand Up @@ -180,6 +180,15 @@ config("skia_library_config") {
"SK_USE_DISCARDABLE_SCALEDIMAGECACHE",
]

if (cpu_arch == "arm") {
if (arm_use_neon) {
defines += [ "__ARM_HAVE_NEON" ]
}
if (arm_optionally_use_neon) {
defines += [ "__ARM_HAVE_OPTIONAL_NEON_SUPPORT" ]
}
}

# Settings for text blitting, chosen to approximate the system browser.
if (is_linux) {
defines += [
Expand Down Expand Up @@ -626,20 +635,18 @@ source_set("skia_opts") {

# Root build config sets -mfpu=$arm_fpu, which we expect to be neon
# when running this.
assert(arm_fpu == "neon")
if (!arm_use_neon) {
configs -= [ "//build/config/compiler:compiler_arm_fpu" ]
cflags += [
"-mfpu=neon"
]
}

#ldflags = [
# "-march=armv7-a",
# "-Wl,--fix-cortex-a8",
#]
}

if (arm_use_neon) {
defines += [ "__ARM_HAVE_NEON" ]
}
if (arm_optionally_use_neon) {
defines += [ "__ARM_HAVE_OPTIONAL_NEON_SUPPORT" ]
}
}

# Non-Neon ARM code.
Expand Down

0 comments on commit 0ac572b

Please sign in to comment.