How about some Android graphics true facts?
I get tired of seeing so much misinformation posted and repeated all over the place about how graphics rendering works on Android. Here is some truth:
• Android has always used some hardware accelerated drawing. Since before 1.0 all window compositing to the display has been done with hardware.
• This means that many of the animations you see have always been hardware accelerated: menus being shown, sliding the notification shade, transitions between activities, pop-ups and dialogs showing and hiding, etc.
• Android did historically use software to render the contents of each window. For example in a UI like http://www.simplemobilereview.com/wp-content/uploads/2010/12/2-home-menu.png there are four windows: the status bar, the wallpaper, the launcher on top of the wallpaper, and the menu. If one of the windows updates its contents, such as highlighting a menu item, then (prior to 3.0) software is used to draw the new contents of that window; however none of the other windows are redrawn at all, and the re-composition of the windows is done in hardware. Likewise, any movement of the windows such as the menu going up and down is all hardware rendering.
• Looking at drawing inside of a window, you don’t necessarily need to do this in hardware to achieve full 60fps rendering. This depends very much on the number of pixels in your display and the speed of your CPU. For example, Nexus S has no trouble doing 60fps rendering of all the normal stuff you see in the Android UI like scrolling lists on its 800x480 screen. The original Droid however struggled with a similar screen resolution.
• "Full" hardware accelerated drawing within a window was added in Android 3.0. The implementation in Android 4.0 is not any more full than in 3.0. Starting with 3.0, if you set the flag in your app saying that hardware accelerated drawing is allowed, then all drawing to the application’s windows will be done with the GPU. The main change in this regard in Android 4.0 is that now apps that are explicitly targeting 4.0 or higher will have acceleration enabled by default rather than having to put android:handwareAccelerated="true" in their manifest. (And the reason this isn’t just turned on for all existing applications is that some types of drawing operations can’t be supported well in hardware and it also impacts the behavior when an application asks to have a part of its UI updated. Forcing hardware accelerated drawing upon existing apps will break a significant number of them, from subtly to significantly.)
• Hardware accelerated drawing is not all full of win. For example on the PVR drivers of devices like the Nexus S and Galaxy Nexus, simply starting to use OpenGL in a process eats about 8MB of RAM. Given that our process overhead is about 2MB, this is pretty huge. That RAM takes away from other things, such as the number of background processes that can be kept running, potentially slowing down things like app switching.
• Because of the overhead of OpenGL, one may very well not want to use it for drawing. For example some of the work we are doing to make Android 4.0 run well on the Nexus S has involved turning off hardware accelerated drawing in parts of the UI so we don’t lose 8MB of RAM in the system process, another 8MB in the phone process, another 8MB in the system UI process, etc. Trust me, you won’t notice -- there is just no benefit on that device in using OpenGL to draw something like the status bar, even with fancy animations going on in there.
• Hardware accelerated drawing is not a magical silver bullet to butter-smooth UI. There are many different efforts that have been going on towards this, such as improved scheduling of foreground vs. background threads in 1.6, rewriting the input system in 2.3, strict mode, concurrent garbage collection, loaders, etc. If you want to achieve 60fps, you have 20 milliseconds to handle each frame. This is not a lot of time. Just touching the flash storage system in the thread that is running the UI can in some cases introduce a delay that puts you out of that timing window, especially if you are writing to storage.
• A recent example of the kinds of interesting things that impact UI smoothness: we noticed that ICS on Nexus S was actually less smooth when scrolling through lists than it was on Gingerbread. It turned out that the reason for this was due to subtle changes in timing, so that sometimes in ICS as the app was retrieving touch events and drawing the screen, it would go to get the next event slightly before it was ready, causing it to visibly miss a frame while tracking the finger even though it was drawing the screen at a solid 60fps.
• When people have historically compared web browser scrolling between Android and iOS, most of the differences they are seeing are not due to hardware accelerated drawing. Originally Android went a different route for its web page rendering and made different compromises: the web page is turned in to a display list, which is continually rendered to the screen, instead of using tiles. This has the benefit that scrolling and zooming never have artifacts of tiles that haven’t yet been drawn. Its downside is that as the graphics on the web page get more complicated to draw the frame rate goes down. As of Android 3.0, the browser now uses tiles, so it can maintain a consistent frame rate as you scroll or zoom, with the negative of having artifacts when newly needed tiles can’t be rendered quickly enough. The tiles themselves are rendered in software, which I believe is the case for iOS as well. (And this tile-based approach could be used prior to 3.0 without hardware accelerated drawing; as mentioned previously, the Nexus S CPU can easily draw the tiles to the window at 60fps.)
• Hardware accleration does not magically make drawing performance problems disappear. There is still a limit to how much the GPU can do. A recent interesting example of this is tablets built with Tegra 2 -- that GPU can touch every pixel of a 1024x800 screen about 2.5 times at 60fps. Now consider the Android 3.0 tablet home screen where you are switching to the all apps list: you need to draw the background (1x all pixels), then the layer of shortcuts and widgets (let’s be nice and say this is .5x all pixels), then the black background of all apps (1x all pixels), and the icons and labels of all apps (.5x all pixels). We’ve already blown our per-pixel budget, and we haven’t even composited the separate windows to the final display yet. To get 60fps animation, Android 3.0 and later use a number of tricks. A big one is that it tries to put all windows into overlays instead of having to copy them to the framebuffer with the GPU. In the case here even with that we are still over-budget, but we have another trick: because the wallpaper on Android is in a separate window, we can make this window larger than the screen to hold the entire bitmap. Now, as you scroll, the movement of the background doesn’t require any drawing, just moving its window... and because this window is in an overlay, it doesn’t even need to be composited to the screen with the GPU.
• As device screen resolution goes up, achieving a 60fps UI is closely related to GPU speed and especially the GPU’s memory bus bandwidth. In fact, if you want to get an idea of the performance of a piece of hardware, always pay close attention to the memory bus bandwidth. There are plenty of times where the CPU (especially with those wonderful NEON instructions) can go a lot faster than the memory bus.
分享到:
相关推荐
How many more minutes will it take for the train to arrive? - **含义**:还需要多少分钟火车才能到达? - **应用场景**:当你等待火车或其他交通工具时,希望了解剩余等待时间。 - **例句**:“请问还需要多少...
HVDC and FACTS Controllers: Applications of Static Converters in Power Systems focuses on the technical advances and developments that have taken place in the past ten years or so in the fields of ...
语言:English (United States) 查看关于您新闻来源的事实。 很难知道哪个网站和新闻网络信任。那里有一个工具试图告诉我们什么是值得信赖的,什么是假新闻,但我们如何知道我们可以信任这些工具的来源?...
here is uploaded "facts placement" codes and report.
This little Java project uploads the freebase-easy facts.txt (after transforming) to Apache Cassandra (3.x). This uploads transformed FreeBase data into a set of indexes and a set of tuples with IDs. ...
本资料“facts-and-figures-2016-fr_FACT_”重点关注了2016年全球可再生能源的发展情况,提供了丰富的数据和事实,旨在帮助我们深入理解这一领域的现状、挑战以及未来趋势。 首先,可再生能源是环保和可持续发展的...
在本项目"Vanilla-JS-Numbers-Facts-App---AJAX-Fetch"中,我们主要探讨的是如何使用纯JavaScript(Vanilla JS)构建一个数字事实应用,它利用AJAX和Fetch API从远程服务器获取数据并展示在网页上。这个应用展示了...
While reading Facts and Fallacies of Software Engineering, you may experience moments of "Oh, yes, I had forgotten that," alongside some "Is that really true?" thoughts. The author of this book ...
- **事实**(Facts):像`father("Bill", "John")`这样的陈述是事实,它们表示已知的信息。 - **规则**(Rules):例如`grandFather(Person, GrandFather) :- father(Person, Father), father(Father, GrandFather)`...
每个维基百科文章的末尾添加了一句话 ...基于本文:http://www.clickhole.com/article/man-mission-man-adding-and-thems-facts-end-every-w-2182并应/ u / OgodHOWdisGE的要求。 支持语言:English
标题中的"PyPI 官网下载 | facts_generator-0.0.5.tar.gz"表明这是一个在Python Package Index(PyPI)官方源上发布的软件包,名为`facts_generator`,版本号为0.0.5,其打包格式为tar.gz。PyPI是Python社区广泛使用...
Quick Facts Port of the actions-on-google SDK to Kotlin. Kotlin and Java developers can quickly start building Actions for Google Assistant. Used in production for the Ticketmaster Assistant Action ...
对于"Cat-Facts-Website-Source",开发者可以从中学到实际的Web开发技巧,如前后端交互、数据库管理等。同时,社区成员可以提交改进或新增功能,推动项目不断发展。这种共享和协作的精神也是开源软件生态系统的一大...
---- name : converge hosts : all become : yes gather_facts : yes roles : - role : robertdebock.facts facts : - key : datacenter value : Amsterdam - key : availability_zone value : west 机器需要用CI...
三维曲线在微分几何中是研究空间轨迹的重要对象,它们由参数方程或者向量方程来描述。这里我们深入探讨这些概念。 1. **可视化**:为了理解三维曲线,可以采用以下方法: - 消去参数t,得到x、y、z之间的关系式,...
一个简单的扩展,将“替代事实”的所有引用更新为“谎言” 一个简单的扩展程序,将所有“替代事实”的所有引用更新为http://emojione.com免费提供的“谎言”图标表情符号 支持语言:English
Repustar | Facts Matter是一款专为提升网络信息真实性而设计的Chrome浏览器插件。这款插件的核心功能是帮助用户鉴别并挑战互联网上的错误信息,确保用户接收到的信息基于可靠的数据和文档支持。在当前信息爆炸的...
"facts_generator-0.0.6.tar.gz"是一个从PyPI(Python Package Index)官网上下载的压缩包,它包含了名为"facts_generator"的Python库的版本0.0.6。PyPI是Python社区的主要软件仓库,开发者可以在这里发布自己的...
Just Facts以清晰,大胆的颜色突出显示关键信息(引号,名称,数字,日期),使休闲新闻阅读器和铁杆新闻迷都可以一目了然地掌握网页的要旨。切掉杂物,直接了解冷酷的事实。默认情况下,Just the Facts被激活以选择...
语言:English (UK) 营养成分标签 此扩展使食品博主能够在其食谱帖子中添加营养成分标签,并具有营养见解。 ... 这是我们为真棒WordPress社区做出贡献的动力的一部分。 我们发布此扩展程序的动机是基于在美食主题网站上...