Nothing Special   »   [go: up one dir, main page]

Dev Optimize Android

Download as pdf or txt
Download as pdf or txt
You are on page 1of 21

Developing and Optimizing Android* for Intel Atom Processor-based Mobile Devices

Dawei Cheng, Communication Application Enabling Engineer, Intel Yang Wang, Sr. Technical Consultant Engineer, Intel Ailin Yang, Technical Marketing Engineer, Intel

TABS002

Agenda
Section Developing Apps for Intel Architecture (IA)-based Android Devices Board Support Package (BSP) for Android Android Optimizations for IA Audience App Developers OEMs and ODMs App Developers, OEMs, ODMs All Device Focus Smartphones & Tablets Tablets Smartphones & Tablets All

Summary

The PDF for this Session presentation is available from our Technical Session Catalog at the end of the day at: intel.com/go/idfsessionsBJ
2

Two Types of Android* Applications


Dalvik Application

Android* NDK Application

Java* Native Library

Java Source

Compile with Javac

Compile with Javac

Dynamic Library Application File Compile and Link C Code Makefile C Source Code
3

Java Native Library Class

Android App Class

Create C header with Javah -jni

Head File

Android* Native Development Kit (NDK) Introduction


Build performance-critical portions of your apps in native codes Reuse existing native codes Intel Hardware Accelerated Execution Manager
Significantly enhances performance for a variety of Android* IA emulator functions See http://software.intel.com/enus/articles/intel-hardwareaccelerated-execution-manager/

Android developer community:


http://software.intel.com/zhcn/android/

Visit the Android Developers Zone on the Intel Software Network for more information about developing Android apps for IA devices
4

NDK Application Development and Porting for IA Devices


Create Native Codes Create Make File
APP_ABI := x86

Compile Native Codes

Call it from Java*

Debug with GDB

SDK API

Java Android* ApplicationsApplication

Java Framework
i. ii. iii. Can run in x86 directly Adjust UI resolution Adjust memory allocation for higher resolution i. ii. iii. Recompile native codes Recompile share library Porting ARM* assembly codes

JNI Native Libs C Framework NDK API

Most Android applications are Java* codes only and can run on IA devices directly; only a small number of applications contain native codes and need porting.
5

Native Codes Development Consideration


Memory alignment
Force memory alignment
struct TestStruct { int mVar1; long long mVar2; int mVar3; }; -malign-double
ARM

x86

Porting NEON instructions (ARM*) to SSE instructions (Intel)


Assembly: consider the architecture difference in big endian and little endian; Consider registers storage limits;

Narrow Q register

NEON native C libs cant be reused in Intel Atom based platforms

General Performance Optimizing


Performance tuning
Use inline functions
inline int max(int a, int b) { return a > b ? a : b; }

Use data type float instead of double Multithreaded program to make full use of Intel Hyper-Threading Technology on Intel Atom processors
More information : http://www.intel.com/content/www/us/en/architecture-and-

Make GCC build codes more effective


-march=atom

technology/hyper-threading/hyper-threading-technology.html

Add platform specific compile arguments Use specific instructions


-msse4 -mavx -maes

Options.html

More information:

http://gcc.gnu.org/onlinedocs/gcc/i386-and-x86_002d64-

Section Summary
The majority of Android* app just run on IA
Native apps should be recompiled using the Android NDK Architecture (ARM*, IA) specific assembly instructions should be appropriately coded

Make full use of IA features to improve your Android application performance


Add platform specific compile switches to make GCC build codes more effective

Agenda
Section Developing Apps for Intel Architecture (IA) based Android* Devices Board Support Package (BSP) for Android Android Optimizations for IA Audience App Developers OEMs and ODMs App Developers, OEMs, ODMs All Device Focus Smartphones & Tablets Tablets Smartphones & Tablets All

Summary

Key BSP Features at a Glance


Android* CTS / CDD Compliant
Multimedia
HW-accelerated graphics VP8 video decode optimizations HW-accelerated video decode H.264 1080p @ 30fps MPEG-4 Level L3, L5 H.263 baseline L70 WMV9 multi-level support VC1 1080p @ 30 fps HW-accelerated video encode H.264, MPEG-4, H.263 HW-accelerated audio decode HE-AACv1, HE-AACv2, MP3, PCM/Wave HW-accelerated Flash / AIR

2nd Screen
HDMI 1.3a Clone mode 2 channel LPCM audio @ 44.1kHz Hot Plug support Logo compliancy testing

Imaging
Burst mode 10 full resolution (8 MP) photos per second Front and Rear-Facing cameras, LED Flash Color correction, red eye removal Video & image stabilization Take snapshots while recording video Auto white balance / focus / exposure Geo tagging support Single-Motion Panorama Mode Zero Shutter Lag Exposure

Connectivity
Bluetooth 2.1 + EDR, 6 profiles WiFi WiFi Direct WEP; WPA/WPA2 PSK EAP-TLS, 802.1x Enterprise GPS (A-GPS & standalone)

Sensors
Accelerometer, Gyroscope Ambient Light Barometric pressure, Magnetometer, Temperature

Security / DRM / Power


HW-assisted secure boot and full disk encryption Netflix* DRM (Playready) Power and Energy Management

Intels Board Support Packages include all IA optimizations; CDD-compliance reduces time-to-market for OEMs
10

Agenda
Section Developing Apps for Intel Architecture (IA) based Android* Devices Board Support Package (BSP) for Android Android Optimizations for IA Audience App Developers OEMs and ODMs App Developers, OEMs, ODMs All Device Focus Smartphones & Tablets Tablets Smartphones & Tablets All

Summary

11

Android* Optimizations for Intel Atom Processor Based Platforms


Performance Tuning
Dalvik VM runtime optimizations
x86 Trace-based JIT Native Code Generation Enhanced memory management (garbage collection) JNI streamlining

Power Reduction
Power Management for Android OpenGL* ES 1.1/2.0 Driver HW Overlay HW Accelerated Media decode/encode Library to integrate w/ Android & reference implementation (MIX) Standard SoC drivers, middleware and applications optimized for power

Tuning of native libraries Bionic C optimizations Javascript & HTML5 optimization Linux kernel and drivers

Intel has a rich history optimizing Java for IA. Weve applied that knowledge to Dalvik Java with impressive results.
12

Intel Atom Processor Optimizations


Dalvik Runtime Optimizations
No Trace JIT1 Trace JIT enabled

Android* Native Library


No SSE2 with SSE

1.8 1.6

7
Performance
Linpack CaffeineMark*

6
Performance

1.4 1.2 1 0.8 0.6 0.4 0.2 0


HTML5 Slideshow HTML5 Zoom HTML5 HTML5 Fancy Show Animation JetBoy* Album Stress Slideshow(SA)

5 4 3 2 1 0

Up to 6x Improvement!

Source: Intel Software and Solutions Group 1 Intel Z670 reference design with Honeycomb 2 SSE = Streaming SIMD Testing on Intel Z2460 CDK with Gingerbread.

Significant improvements in both web (HTML5) and Java* workloads due to optimizations for Intel SSE instructions in Android graphics libraries.

13

Agenda
Section Developing Apps for Intel Architecture (IA) based Android* Devices Board Support Package (BSP) for Android Android Optimizations for IA Audience App Developers OEMs and ODMs App Developers, OEMs, ODMs All Device Focus Smartphones & Tablets Tablets Smartphones & Tablets All

Summary

14

Our efforts starting to gain recognition from the Android* Community


Pre-built Intel Atom Images Android* SDK manager has x86 emulation images built-in Thanks to contributions to AOSP from Intel, the emulator now supports To emulate an Intel Atom-based in virtualization mode on Windows and Mac running x86 system images Android phone, install the Intel emulator running at near native speed. OSX. This allows the Atom x86 System Image available indownloads in the first week! 34,000 the Android SDK Manager
http://software.intel.com/en-us/articles/installing-the-intelatom-tm-android-x86-emulator-image-add-on-from-theandroid-sdk-manager/

Faster Emulation Intel Hardware Accelerated Execution Manager (HAXM) for Mac and Windows Highlighted by uses Intel Virtualization Technology Google at Game emulation (Intel VT) to accelerate x86Developer Conference 1200 by an order of magnitude downloads in first week Intel VT is already supported in Linux* (KVM) for x86
http://software.intel.com/en-us/articles/intel-hardwareaccelerated-execution-manager/

15

Momentum is Building

and from the press

Intel Smartphones Coming to UK, France, China India


February 27, 2012

16

Summary
The majority of Android* apps just run on Intel Architecture (IA) Intel board support packages for Android include the latest IA optimizations and pass Android CTS, speeding time-to-market for device makers Intel has been optimizing Android for IA for many years with impressive results

17

Where to get more info

Intel Software Network (ISN) Intel Android Developer Website


Real developers sharing knowledge and offering help Dedicated communities and forums focused on your interests Worldwide reach News and insights on cutting edge technology Great content you wont find anywhere else Technical articles, tools, and How-To guides Native app porting tips & case studies Info on x86 emulator and Intel Hardware Accelerated Execution Manager Active forums and blogs written by Intel and community experts

www.intel.com/software/android
18

Legal Disclaimer
INFORMATION IN THIS DOCUMENT IS PROVIDED IN CONNECTION WITH INTEL PRODUCTS. NO LICENSE, EXPRESS OR IMPLIED, BY ESTOPPEL OR OTHERWISE, TO ANY INTELLECTUAL PROPERTY RIGHTS IS GRANTED BY THIS DOCUMENT. EXCEPT AS PROVIDED IN INTEL'S TERMS AND CONDITIONS OF SALE FOR SUCH PRODUCTS, INTEL ASSUMES NO LIABILITY WHATSOEVER AND INTEL DISCLAIMS ANY EXPRESS OR IMPLIED WARRANTY, RELATING TO SALE AND/OR USE OF INTEL PRODUCTS INCLUDING LIABILITY OR WARRANTIES RELATING TO FITNESS FOR A PARTICULAR PURPOSE, MERCHANTABILITY, OR INFRINGEMENT OF ANY PATENT, COPYRIGHT OR OTHER INTELLECTUAL PROPERTY RIGHT. A "Mission Critical Application" is any application in which failure of the Intel Product could result, directly or indirectly, in personal injury or death. SHOULD YOU PURCHASE OR USE INTEL'S PRODUCTS FOR ANY SUCH MISSION CRITICAL APPLICATION, YOU SHALL INDEMNIFY AND HOLD INTEL AND ITS SUBSIDIARIES, SUBCONTRACTORS AND AFFILIATES, AND THE DIRECTORS, OFFICERS, AND EMPLOYEES OF EACH, HARMLESS AGAINST ALL CLAIMS COSTS, DAMAGES, AND EXPENSES AND REASONABLE ATTORNEYS' FEES ARISING OUT OF, DIRECTLY OR INDIRECTLY, ANY CLAIM OF PRODUCT LIABILITY, PERSONAL INJURY, OR DEATH ARISING IN ANY WAY OUT OF SUCH MISSION CRITICAL APPLICATION, WHETHER OR NOT INTEL OR ITS SUBCONTRACTOR WAS NEGLIGENT IN THE DESIGN, MANUFACTURE, OR WARNING OF THE INTEL PRODUCT OR ANY OF ITS PARTS. Intel may make changes to specifications and product descriptions at any time, without notice. Designers must not rely on the absence or characteristics of any features or instructions marked "reserved" or "undefined". Intel reserves these for future definition and shall have no responsibility whatsoever for conflicts or incompatibilities arising from future changes to them. The information here is subject to change without notice. Do not finalize a design with this information. The products described in this document may contain design defects or errors known as errata which may cause the product to deviate from published specifications. Current characterized errata are available on request. Intel processor numbers are not a measure of performance. Processor numbers differentiate features within each processor family, not across different processor families. Go to: http://www.intel.com/products/processor_number. Contact your local Intel sales office or your distributor to obtain the latest specifications and before placing your product order. Copies of documents which have an order number and are referenced in this document, or other Intel literature, may be obtained by calling 1-800-548-4725, or go to: http://www.intel.com/design/literature.htm Medfield and other code names featured are used internally within Intel to identify products that are in development and not yet publicly announced for release. Customers, licensees and other third parties are not authorized by Intel to use code names in advertising, promotion or marketing of any product or services and any such use of Intel's internal code names is at the sole risk of the user Intel, Bluetooth, Atom, VTune, and the Intel logo are trademarks of Intel Corporation in the United States and other countries. *Other names and brands may be claimed as the property of others. Copyright 2012 Intel Corporation.

19

Legal Disclaimer

Intel Hyper-Threading Technology (Intel HT Technology) is available on select Intel Core processors. Requires an Intel HT Technology-enabled system. Consult your PC manufacturer. Performance will vary depending on the specific hardware and software used. For more information including details on which processors support Intel HT Technology, visit http://www.intel.com/info/hyperthreading.

Performance tests and ratings are measured using specific computer systems and/or components and reflect the approximate performance of Intel products as measured by those tests. Any difference in system hardware or software design or configuration may affect actual performance. Buyers should consult other sources of information to evaluate the performance of systems or components they are considering purchasing. For more information on performance tests and on the performance of Intel products, reference www.intel.com/software/products.
Optimization Notice
Intels compilers may or may not optimize to the same degree for non-Intel microprocessors for optimizations that are not unique to Intel microprocessors. These optimizations include SSE2, SSE3, and SSSE3 instruction sets and other optimizations. Intel does not guarantee the availability, functionality, or effectiveness of any optimization on microprocessors not manufactured by Intel. Microprocessor-dependent optimizations in this product are intended for use with Intel microprocessors. Certain optimizations not specific to Intel microarchitecture are reserved for Intel microprocessors. Please refer to the applicable product User and Reference Guides for more information regarding the specific instruction sets covered by this notice. Notice revision #20110804

20

The above statements and any others in this document that refer to plans and expectations for the first quarter, the year and the future are forward-looking statements that involve a number of risks and uncertainties. Words such as anticipates, expects, intends, plans, believes, seeks, estimates, may, will, should and their variations identify forward-looking statements. Statements that refer to or are based on projections, uncertain events or assumptions also identify forward-looking statements. Many factors could affect Intels actual results, and variances from Intels current expectations regarding such factors could cause actual results to differ materially from those expressed in these forward-looking statements. Intel presently considers the following to be the important factors that could cause actual results to differ materially from the companys expectations. Demand could be different from Intel's expectations due to factors including changes in business and economic conditions, including supply constraints and other disruptions affecting customers; customer acceptance of Intels and competitors products; changes in customer order patterns including order cancellations; and changes in the level of inventory at customers. Uncertainty in global economic and financial conditions poses a risk that consumers and businesses may defer purchases in response to negative financial events, which could negatively affect product demand and other related matters. Intel operates in intensely competitive industries that are characterized by a high percentage of costs that are fixed or difficult to reduce in the short term and product demand that is highly variable and difficult to forecast. Revenue and the gross margin percentage are affected by the timing of Intel product introductions and the demand for and market acceptance of Intel's products; actions taken by Intel's competitors, including product offerings and introductions, marketing programs and pricing pressures and Intels response to such actions; and Intels ability to respond quickly to technological developments and to incorporate new features into its products. Intel is in the process of transitioning to its next generation of products on 22nm process technology, and there could be execution and timing issues associated with these changes, including products defects and errata and lower than anticipated manufacturing yields. The gross margin percentage could vary significantly from expectations based on capacity utilization; variations in inventory valuation, including variations related to the timing of qualifying products for sale; changes in revenue levels; product mix and pricing; the timing and execution of the manufacturing ramp and associated costs; start-up costs; excess or obsolete inventory; changes in unit costs; defects or disruptions in the supply of materials or resources; product manufacturing quality/yields; and impairments of longlived assets, including manufacturing, assembly/test and intangible assets. The majority of Intels non-marketable equity investment portfolio balance is concentrated in companies in the flash memory market segment, and declines in this market segment or changes in managements plans with respect to Intels investments in this market segment could result in significant impairment charges, impacting restructuring charges as well as gains/losses on equity investments and interest and other. Intel's results could be affected by adverse economic, social, political and physical/infrastructure conditions in countries where Intel, its customers or its suppliers operate, including military conflict and other security risks, natural disasters, infrastructure disruptions, health concerns and fluctuations in currency exchange rates. Expenses, particularly certain marketing and compensation expenses, as well as restructuring and asset impairment charges, vary depending on the level of demand for Intel's products and the level of revenue and profits. Intels results could be affected by the timing of closing of acquisitions and divestitures. Intel's results could be affected by adverse effects associated with product defects and errata (deviations from published specifications), and by litigation or regulatory matters involving intellectual property, stockholder, consumer, antitrust and other issues, such as the litigation and regulatory matters described in Intel's SEC reports. An unfavorable ruling could include monetary damages or an injunction prohibiting us from manufacturing or selling one or more products, precluding particular business practices, impacting Intels ability to design its products, or requiring other remedies such as compulsory licensing of intellectual property. A detailed discussion of these and other factors that could affect Intels results is included in Intels SEC filings, including the report on Form 10-Q for the quarter ended Oct. 1, 2011. Rev. 1/19/12

Risk Factors

21

You might also like