Commit Graph

34 Commits

Author SHA1 Message Date
Andrew Hsieh
3598d53b42 Drop clang version check for __builtin_isinf and __builtin_isnan
This CL unconditionally removes the existance of __builtin_isinf and
__builtin_isnan from math.h for clang, because (unlike other math functions)
clang doesn't like those to be declared.

See LLVM bugzilla entry: http://llvm.org/bugs/show_bug.cgi?id=20958

The reason for decorating all math functions with __attribute__((pcs("aapcs")))
is to offer developers the ability to compile their code with hardfp and still
link Android's libm.so which follows softfp calling convention.

Before issue 20958 is fixed, those who want clang to compile their code with
hardfp in NDK has to go all the way hard, ie.
1) LOCAL_CFLAGS += -mhard-float -D_NDK_MATH_NO_SOFTFP=1
   Note that _NDK_MATH_NO_SOFTFP=1 remove __attribute__((pcs("aapcs"))) for all math functions
2) LOCAL_LDLIBS += -lm_hard  # link libm_hard.a recompiled with -mhard-float instead of bionic libm.so

Change-Id: Ie2f95e73e58e1574e8cadbcab92a5209d94448e1
2015-01-16 14:24:04 -08:00
Andrew Hsieh
ec2d5674a8 Merge "Bump up clang vesion accepting __builtin_isnan __attribute__((pcs("aapcs")))" 2014-09-29 01:20:12 +00:00
Andrew Hsieh
70319d4de1 Add posix_memalign to libc.so for API 17,18,19
note that arch-x86 has it in 797351fd3b

Change-Id: I34c5d0b6887bdc7bd3411a837f90e6788bdf7ff4
2014-09-26 16:28:36 +08:00
Andrew Hsieh
3dbef8fe11 Bump up clang vesion accepting __builtin_isnan __attribute__((pcs("aapcs")))
Upstream clang3.6 still doesn't allow change of calling convension of
__builtin_isnan from the default to "softfp" (via __attribute__((pcs("aapcs"))))
as required by bionic libm.so for 32-bit ARM.  Let's hope clang3.7
fix that.  See upstream bug http://llvm.org/bugs/show_bug.cgi?id=20958

Change-Id: Ibdcc1783ffa7cf2f36e733983bd6d912ad38df70
2014-09-26 16:20:56 +08:00
Varvara Rainchik
797351fd3b Add missing posix_memalign function in x86 libc.so.functions.txt.
(See b.android.com/28834)

android-17,-18,-19
	posix_memalign

Change-Id: I9e0632f9fa8cabd17a66ded2dc6f3553261c4054
Signed-off-by: Varvara Rainchik <varvara.rainchik@intel.com>
2014-09-18 12:06:03 +04:00
Andrew Hsieh
36dea383df Fix gl3stub.h
Only define the following before android-L (where new headers define
them already)

  typedef khronos_int64_t  GLint64;
  typedef khronos_uint64_t GLuint64;
  typedef struct __GLsync *GLsync;

Also define L to 9999 for crtbrand.c which needs it to be an integer

Change-Id: I9ed957d70b85cd1cdfeacf11f77203b39c93023d
2014-07-17 16:32:05 +08:00
Andrew Hsieh
458300640f Fix samples for 64-bit ABIs
1. Set APP_ABI:=all in almost all samples
2. Enhance hello-jni to report more ABIs
3. Fix warnings

Change-Id: I2851c42b77ef8225e32143d225edcf973633e782
2014-06-20 16:42:08 -07:00
Andrew Hsieh
67dc50cbbb Merge changes Ie67acf11,Ia9c03558
* changes:
  Remove non-existanec functions/variables from libc.so
  Restore stdint.h for android-3..19 to the original headers
2014-05-16 03:17:19 +00:00
Andrew Hsieh
1e61663835 Remove non-existanec functions/variables from libc.so
See b.android.com/69319

android-9+
  __evOptMonoTime
  _nres
  __p_default_section_syms
  __p_update_section_syms
  _rand48_add
  _rand48_mult
  _rand48_seed
  _res_opcodes
  __sFext

android-12+
  copy_tm_to_TM
  copy_TM_to_tm
  __dtoa
  _endhtent
  __fremovelock
  _gethtbyaddr
  _gethtbyname
  _gethtbyname2
  _gethtent
  __libc_android_abort
  _mktemp                 # mktemp already exist in header
  __pread64               # add pread64, pwrite64 and ftruncate64 to API >= 12
  __pwrite64
  res_need_init
  __res_ourserver_p
  _sethtent
  __set_syscall_errno
  __sfvwrite
  __timer_table_start_stop
  valid_tm_mon
  valid_tm_wday

android-14+
  __libc_android_log_assert
  __libc_android_log_print
  __libc_android_log_vprint

android-17+
  dlmalloc_walk_free_pages
  dlmalloc_walk_heap
  __get_pc

android-18+
  __get_res_cache
  __libc_init_common
  __libc_preinit

Change-Id: Ie67acf115427e808dde0e33411671b07a888a9b6
2014-05-12 19:22:17 +08:00
Andrew Hsieh
7986b0872e Fixes samples Teapot/MoreTeapots armeabi-v7a-hard; native-audio debug build
Fixes two issues:
1. Remove redundant check for hard-float in Teapot/MoreTeapots and ndk_helper
   they depend.  The ndk-build system add those flags already for armeabi-v7a-hard
2. native-audio in debug build: assert on the non-existance var

Change-Id: Id6b2d38a264c2f2d0e0c7fe625991fcee1762800
2014-05-12 15:53:37 +08:00
Andrew Hsieh
b280e72a97 Bump __clang_minor__ check to 6 for __builtin_isnan
It appears that upstream 3.5 still can't accept __builtin_isnan redeclared
with calling convention, eg.

cat > isnan.c <<EOF
int __builtin_isnan(double) __attribute__((pcs("aapcs")));
EOF

  clang  -target armv5te-none-linux-androideabi -c isnan.c
  isnan.c:1:5: error: function declared 'aapcs' here was previously declared without calling convention
  int __builtin_isnan(double) __attribute__((pcs("aapcs")));
      ^
  isnan.c:1:5: note: previous declaration is here

Change-Id: Iff466fd913c3deec27aa3ff355a208543028d368
2014-04-25 09:55:31 -07:00
Andrew Hsieh
a49155bc36 Add scalbln, scalblnf, and scalblnl to x86 libm.so for API>=18
Change-Id: Ib22eead27b8f82cfa0e1b7eb429e2c76d068120f
2014-02-26 10:38:31 +08:00
Andrew Hsieh
3bf77d0608 Add missing __NDK_FPABI__ to function taking/returning float/double
See 5881b5cbe7 (which missed
android-18 input.h) for details.

Change-Id: Ib23d85b676177b0a3e15bae957fc48f6ef0ededb
2014-02-05 11:30:29 +08:00
David Friedman
3b601c6550 Fixed apparent copy/paste mistake
Bug: 11634373

Change-Id: I44766217f414988bfd3be68043a4b80dd21554d8
2014-02-05 11:18:32 +08:00
Andrew Hsieh
f242723e9d Fixed API18 math.h for clang3.4
Clang3.4 can take __builtin_nexttoward and __builtin_nexttowardf.
Also fix a minor typo in comment

Change-Id: If98a35e2e38c45ebd619b0ceb6c5ee41acc4e415
2013-12-30 14:14:09 +08:00
Hak Matsuda
78bf635170 Restore immersive mode when volume button has been pressed.
Workaround issue where SYSTEM_UI_FLAG_IMMERSIVE_STICKY is invalidated
when a volume button is pressed (internal bug ref b/11986621)

Immersive mode still does not recover when the screen has been
rotated, due to onSystemUiVisibilityChange is not triggered
when screen is rotated (internal bug ref b/11990702)

Change-Id: Ifdfe9b24d5c3c208441aeca0fbb2b1eaee39da95
2013-12-30 13:49:54 +08:00
Hak Matsuda
2a0781b43d Fix rendering issue in Tegra2/3.
Now having medium precision for specular variable, so that specular power can be <1.0

Change-Id: I15459d34e269ba7d31bc899460540fe390e5e294
2013-12-30 13:49:23 +08:00
Logan Chien
ad40d952a1 Workaround the __builtin_isnan() type error for clang 3.4.
Similar to clang 3.3, it seems that clang 3.4 declares an incompatible
function prototypes for __builtin_isnan().  To workaround this issue,
we should not declare the function prototype for __builtin_isnan().

Note: Though it may be good to fix this in clang type checker, like
__builtin_nexttoward(), however it seems non-trivial since __builtin_isnsn()
might be overloaded.  We can revert this after we have fixed the
clang builtin definition.

Change-Id: I329b56225f3d229b0c141bb8414c4369f154efda
2013-12-25 01:59:29 +00:00
Andrew Hsieh
2a571fda2b Fix -mhard-float for calling __builtin_* math functions
Annotate __builtin math functions with __NDK_FPABI_MATH__ too.
1. __attribute__((pcs("aapcs"))) has no effect on codegen when __buitlin
   function is emitted inlined.
2. When __builtin call into regular function in Android's libm, it has
   proper attribute which observes soft float-abi

Change-Id: I11e8b74fc22f3072b9ce849193e4a56e98c92d64
2013-12-04 11:45:04 +08:00
Hak Matsuda
cc69f210a7 - Using hard-fp
- Immersive mode in android-19
- Fixed local reference release in JNI helper
- Misc fixes
Change-Id: I3ab19c2b66648bb7a011c462d9d98e75bc136ce6
2013-11-21 16:06:02 +08:00
Andrew Hsieh
c0567b54c5 Rename modules NativeActivity
To TeapotNativeActivity and MoreTeapotsNativeActivity, respectively

Change-Id: Iddbb326ef246232e64a9c30138edb55efe86230d
2013-11-05 08:12:46 +08:00
Hak Matsuda
13754d53c3 Addressed feedbacks
- Now they are in ndkHelper:: name space
- Changed module name to ndk_helper
- Changed some static members to class var or stand alone function
- Added syncronization for JNIHelper.cpp
- For a documentation, I will work with doc writer for future improvement

Change-Id: I0055061a4f53b1904cde2e0339550ee277b35fc5

Addressed most of feedbacks,
- Switched coding standard to Chrome style
- Update JNI helper, and documented
- Fixed other issues that is pointed out

Change-Id: Icc729a55ed8dd613759f34a3fc35cb4949d2d205
2013-11-05 08:09:19 +08:00
Hak Matsuda
5d1c91fb75 cleaned code, added pinch gesture detector, better opengl context handling, fixed issues
Change-Id: I26a28374ae74391204586b4584d03cf0c58772c2
2013-10-28 11:41:58 +08:00
Andrew Hsieh
5881b5cbe7 Add __NDK_FPABI__ to function taking/returning float/double
Allow user code to be compiled with "-mhard-float" for armeabi-v7a
(which implies -mfloat-abi=hard), and either link with
1. Android native APIs which use softfp, or
2. A customized libm_hard.a which is compiled with -mhard-float. Need
   -D_NDK_MATH_NO_SOFTFP=1

See tests/device/hard-float/jni/Android.mk for details and restriction
on Clang

Change-Id: I773a842c73368e08b9a6cda0441e95a96fa303b2
2013-10-17 19:15:22 +08:00
Andrew Hsieh
0df3e70b99 Add missing math functions
1. Add sincos, sincosf, and sincosl to API >= 9 (for ARM only,
   because X86 and MIPS have it already)
2. Add nan, nanf, nanl, and tgammaf to API >= 13 (11 actually,
   but we don't want to add another API which is not released)
3. Add log2, log2f, log2l, logbl, nexttoward, and nexttowardl to
   API >= 18

See b.android.com/38423

Change-Id: I0a756aeeddafc3862f3c0ae38218cb3301608231
2013-10-15 15:55:12 +08:00
Andrew Hsieh
1b8ffe3331 Move Teapot to android-17 and set APP_ABI := all
For the default configuration to run on more devices: ARM/Intel/MIPS >= API17

Change-Id: I52145374d0c51624c7a295dc8092f8492e591dee
2013-09-16 10:32:55 +08:00
Iceberg Fu
f74a8b0a63 Fixed array-index-out-of-bound in Teapot sample
Fix issue used to crash on MIPS/X86 device.  ARM device works by accident

Change-Id: I401f4954841b6f59d3ea001e5e6a70c46045a7e1
2013-09-16 10:17:17 +08:00
Andrew Hsieh
99da728a3d Fix error about multiple unsequenced modifications
The evaluation order of function args aren't gaurenteed in C++

jni/NDKSupport/vecmath.h:869:32: warning: multiple unsequenced modifications to 'i' [-Wunsequenced]
        LOGI("%f %f %f %f", f[i++], f[i++], f[i++], f[i++]);

Change-Id: Ibf69978dd3abf57a7042624aad3d416a0f6f5e01
2013-09-13 17:47:47 +08:00
Hak Matsuda
f39a078023 Add NDK sample to demonstrate more OpenGL&Gaming related technologies.
Change-Id: I0fb56c1fd1aa82d5a7c4da5010e00e103146ba78
2013-09-13 15:12:22 +08:00
Michael Wright
f3c3a93bc4 Update NDK's android headers
Change-Id: I2ae3b42dcbbdccbcae018f768dc7b56723416d21
2013-08-29 18:17:46 -07:00
Andrew Hsieh
80c93fbede Fix gles3jni build with clang at android-11
jni/gl3stub.c:21:5: error: implicit declaration of function 'eglGetProcAddress' is invalid in C99
    FIND_PROC(glReadBuffer);
    ^
jni/gl3stub.c:20:37: note: expanded from macro 'FIND_PROC'
    #define FIND_PROC(s) s = (void*)eglGetProcAddress(#s)
                                    ^
1 error generated.

Change-Id: I907f33e3d88f3e96bf7958102e90bf15529748b9
2013-07-31 13:27:23 +08:00
Jesse Hall
b7a2e33c11 Load ES3 functions with eglGetProcAddress, not dlsym
Using dlopen/dlsym works, but eglGetProcAddress is a little easier and
more consistent with how GL extension functions (rather than these
non-extension functions) are loaded.

Change-Id: I082c193f08f7d5456389ab783a06cd38a9632d53
2013-07-09 11:31:33 -07:00
Jesse Hall
a451b018f6 Add a sample showing how to use OpenGL ES 3.0
Change-Id: If834a23ad3ad2164e6fdc40f865ee28cfa93de7e
2013-06-24 11:12:42 -07:00
Jesse Hall
c05863dac1 Add GLESv3 to future NDK release
* Headers were copied from frameworks/native/opengl/include/GLES3/.
* Symbol lists were generated with ndk/build/tools/gen-system-symbols.sh.
* Symbols are identical between architectures

Change-Id: I011094ea3b479cf166ffb6bef3778cde683fc502
2013-06-18 10:19:36 -07:00