summaryrefslogtreecommitdiffstats
path: root/libs/hwui/DisplayListRenderer.h
Commit message (Collapse)AuthorAgeFilesLines
* Fix texture corruptionChet Haase2012-09-301-1/+2
| | | | | | | | | | | | | | | | | | | | | | When memory gets low on a device, activities flush everything they can. Hardware-accelerated activites, such as Launcher, flush GL resources and destroy the GL context. However, some resources were still hanging around, due to deferred destruction policies (we don't delete layers until the DisplayLists they are in are finalized, to ensure we don't deref deleted objects). This meant that we were referring to obsolete GL data in these objects. in particular, it meant that we might come around later, after a new GL context was created, and delete a texture object that was incorrect. We use the layer's "texture id" to refer to the texture underlying the layer. But if there's a new GL context, then this texture ID is no longer valid, and we may be deleting the texture that a different object (layer, icon, whatever) is referring to, because the driver may return that same ID under the new GL context. The fix is to more aggressively delete things that we know will not be used again when the GL context is destroyed. In particular, we delete all resources being used by all DisplayLists at GL context destruction time. Issue #7195815 Textures corruption on all devices, in many apps Change-Id: I52d2d208173690dbb794a83402d38f14ea4c6c22
* Don't use the QCOM_tiled_rendering extension with functorsRomain Guy2012-09-271-0/+7
| | | | | | Bug #7247880 Change-Id: I4f6c38e37b953c58e6107097c613891a49dac766
* Fix occasional crash bug with layersChet Haase2012-09-171-0/+13
| | | | | | | | | | | | | | | | | | | | Launcher occasionally crashes with a stack trace indicating that the memory of a Layer object is corrupt. It is possible for us to delete a Layer structure and then, briefly, use it to draw a DisplayList again before that DisplayList gets recreated (without the layer that got deleted). When this happens, if the memory got corrupted, it's possible to crash. The fix is to add Layer to the other objects which we currently refcount (bitmaps, shaders, etc.). Then instead of deleting a Layer, we decrement the refcount. We increment when creating it, then increment it again when it's referenced from a DisplayList. Then we decrement the refcount instead of deleting it, and decrement when we clear a DisplayList that refers to it. Then when the refcount reaches 0, we delete it. Issue #6994632 Native crash in launcher when trying to launch all apps screen Change-Id: I0627be8d49bb2f9ba8d158a84b764bb4e7df934c
* Reduce the number of locks acquired by display listsRomain Guy2012-09-071-7/+8
| | | | Change-Id: I1123aae0355de84db705bb75042c7083fc69c9f2
* Optimize interactions with glyph cacheChet Haase2012-08-141-2/+4
| | | | | | | | | | | | | | | | | There are two fixes here: - precaching: instead of caching-then-drawing whenever there is a new glyph, we cache at DisplayList record time. Then when we finally draw that DisplayList, we just upload the affected texture(s) once, instead of once per change. This is a huge savings in upload time, especially when there are larger glyphs being used by the app. - packing: Previously, glyphs would line up horizontally on each cache line, leaving potentially tons of space vertically, especially when smaller glyphs got put into cache lines intended for large glyphs (which can happen when an app uses lots of unique glyphs, a common case with, for example, chinese/japanese/korean languages). The new approach packs glyphs vertically as well as horizontally to use the space more efficiently and provide space for more glyphs in these situations. Change-Id: I84338aa25db208c7bf13f3f92b4d05ed40c33527
* Rename drawGeneralText to drawTextRomain Guy2012-07-271-2/+2
| | | | Change-Id: I5062ea5b0605fc7af27f410fafc930d10f38e926
* Hardware implementation of glyph positioning (bug 5443796)Raph Levien2012-07-231-3/+3
| | | | | | | | | | | | | | This implementation adds a drawGeneralText() method to the OpenGL Renderer, which supports both a global x, y position, an array of individual glyph positions, and also a length parameter (which enables drawing of underline and strikethrough. It also adds the method to the display list (with marshalling and unmarshalling). With this change, the existing drawText() method is removed entirely, as it's subsumed by the new method. It's easy enough to revert to the old functionality if needed by passing in a NULL positions array. Change-Id: I8c9e6ce4309fd51cc5511db85df99f6de8f4f6f5
* Track canvas clearing for swap buffers logic.Chet Haase2012-06-071-1/+1
| | | | | | | | | | | | | | | | A previous fix made it necessary for a frame to render something to GL in order to cause a call to eglSwapBuffers(). Besides the calls being tracked as part of issuing a DisplayList, there is also a potential call to clear the canvas (via glClear()) on non-opaque surfaces. This call is also good to track, since a surface that gets cleared without any other drawing operations is worth flipping to the screen (to erase old contents on that surface). This fix tracks the status of the pre-draw operations to find out whether glClear() was called and then sets the drawing status appropriately. Issue #6606422 QuickContact dismissal is janky again (Tracking) Change-Id: I5fcaccfdc9293dd46b83f2fc279730a5d2740ebf
* Skip eglSwapBuffers() call when we do not draw to GLChet Haase2012-05-311-20/+20
| | | | | | | | | | The fix is to track when we issue GL drawing commands, and to skip the call to eglSwapBuffers() when a DisplayList does not result in any actual rendering calls to GL. Issue #6364143 QuickMuni list items and buttons flicker instead of fade Change-Id: I60a02c61a58c32d92481a1e814b4c8a49c6a37a3
* Sanitize display list propertiesRomain Guy2012-05-181-9/+10
| | | | | | | | | | | The comparisons used in the various properties setters could fail badly in some specific conditions. The scale properties in particular did not use the same comparisons. This change also clamps alpha to the 0..1 range which avoids overflow issues with lowp registers in GLSL computations. Change-Id: I3e73b584e907a14e2c33d0865ca0d2d4d5bff31d
* Avoid unnecessary copy when invoking drawBitmap(int[])Romain Guy2012-05-151-22/+15
| | | | | | Bug #6483390 Change-Id: I4d2d725ef50c9401b4bd998b6160128102b40745
* Remove all Dalvik allocations from Cavnas.drawBitmap(int[], ...)Romain Guy2012-05-141-9/+29
| | | | Change-Id: Ie28538a2104d21154fdc78a56525e7403f08287d
* Merge "Fix issue where scale-animating text would jump temporarily a few ↵Chet Haase2012-05-071-1/+1
|\ | | | | | | pixels" into jb-dev
| * Fix issue where scale-animating text would jump temporarily a few pixelsChet Haase2012-05-071-1/+1
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Some logic in the native matrix code would determine that a matrix was 'pureTranslate' based on the scale values of a matrix being close-enough to 1, which was within a very small epsilon. This works in general, because screen space coordinates make that epsilon value irrelevant, so close-enough really is close-enough. However, TextView, when centering text, works in a coordinate system that is quite huge, with left/right values about 500,000. These numbers multiplied times that small epsilon value would give a result that was significant, and would cause a miscalculation of up to 4-5 pixels, causing the snap that we'd see for a couple of frames as the scale got "close enough" to 1. The fix is to remove the optimization of "close enough". What we really need the matrix to do is to identify itself as being translate-only when no scale as been set (which is the default). For the purposes of that check, it is good enough to simply check the values against 1 directly. Similarly, the bounds-check logic needs to check against 0 and 1 directly. Issue #6452687: Glitch when changing scale of a view containing text Change-Id: I167fb45d02201fb879deea0e5a7ca95e38128e17
* | Fix hang/crash in native path codeChet Haase2012-05-031-0/+11
|/ | | | | | | | | | | | | | | | An optimization for paths is to only create a texture for the original native Path object, and have all copies of that object use that texture. This works in most cases, but sometimes that original path object may get destroyed (when the SDK path object is finalized) while we are still referencing and using that object in the DisplayList code. This causes undefined errors such as crashes and hanging as we iterate through the operations of a destroyed (and garbage-filled) path object. The fix is to use the existing ResourceCache to refcount the original path until we are done with it. Issue #6414050 Analytics Dogfood App crashes reliably on Jellybean Change-Id: I5dbec5c069f7d6a1e68c13424f454976a7d188e9
* Remove USE_DISPLAY_LIST_PROPERTIES flagChet Haase2012-04-231-10/+12
| | | | | | | | | | | | | | | | This flag was still hanging around pending any need to disable DisplayList properties. But things seem stable, so it's time to clean up and simplify the code. At the same time, I reduced redundance in DisplayList dimensions. We used to call drawDisplayList() with width/height parameters that were used to do a clip reject. This is redundant with the DisplayList properties that set the bounds of the DisplayList; the left/right and top/bottom properties represent the same width/height properties formerly used in drawDisplayList(). The new approach is to not pass dimensions to drawDisplayList(), but to instead pull those dimensions directly from the DisplayList when needed. Change-Id: I8871beff03b1d4be95f7c6e079c31a71d31e0c56
* Optimization of alpha with DisplayList propertiesChet Haase2012-04-031-0/+5
| | | | | | | | | | | | Some views (such as ImageView and TextView) handle non-opaque alpha values directly. This was originally an optimization, but we can handle it faster in many cases without this optimization when DisplayList properties are enabled. Basically, if a view has non-overlapping rendering, we set the alpha value directly on the renderer (the equivalent of setting it on the Paint object) and draw each primitive with that alpha value. Doing it this way avoids re-creating DisplayLists while getting the same speedup that onSetAlpha() used to get pre-DisplayList properties. Change-Id: I0f7827f075d3b35093a882d4adbb300a1063c288
* Enabling DisplayList propertiesChet Haase2012-04-021-1/+1
| | | | | | | An earlier commit fixed problems with enabling DisplayList properties. This CL actually enables the properties. Change-Id: I5c41d0c64e9241822af53eb367de0fed7d9608e0
* Re-enable DisplayList properties.Chet Haase2012-04-021-5/+16
| | | | | | | | | | Re-enabling DisplayList properties last week caused some app errors due to the way that some transforms were being handled (specifically, those coming from the old Animations and ViewGroup's childStaticTransformation field). This change pushes *all* transform/alpha data from View.draw() into the view's DisplayList, making DisplayLists more encapsulated (and correct). Change-Id: Ia702c6aae050784bb3ed505aa87553113f8a1938
* Disable DisplayList properties pending fixes for AlphaAnimationChet Haase2012-03-291-1/+1
| | | | | | | | | The new DisplayList properties design has ordering conflicts with the way that alpha works with old animations (AlphaAnimation). This CL disables DiksplayList properties while I'm working on a fix and some more thorough tests for old animations-vs-DL properties in general. Change-Id: I8f6893138f939171491c2ec3c889214ee55d17b7
* Re-enabling DisplayList propertiesChet Haase2012-03-271-3/+1
| | | | | | | | | | | | | | | | | | | | | Several issues came up after DisplayList properties were enabled, so they were disabled pending fixes. Those issues have been fixed, so DisplayList properties are once again being enabled by default. This CL both re-enables these properties (in View.java and DisplayListRenderer.h) and fixes the various issues that enabling them caused the first time around. Related issues (all currently marked as Fixed, though that was simply because DL properties were disabled - this CL provides the real fixes now that DL properties are enabled by default): Issue #6198276 Text input broken Issue #6198472 Native crash at pc 00076428 in many different apps in JRM80 Issue #6204173 Date/time picker isn't rendering all parts of UI Issue #6203941 All Apps overscroll effect is rendered weirdly/has flickering Issue #6200058 CAB rendering issue - not drawing items? Issue #6198578 Front camera shows black screen after taking picture. Issue #6232010 Layers not recreated when children change (DisplayList properties) Change-Id: I8b5f9ec342208ecb20d3e6a60d26cf7c6112ec8b
* Use a status_t return type for GL functorsRomain Guy2012-03-261-3/+3
| | | | | | | | | WebView needs more fine-grained control over the behavior of the framework upon execution of the display lists. The new status_t allows WebView to requests its functor to be re-executed directly without causing a redraw of the entire hierarchy. Change-Id: I97a8141dc5c6eeb6805b6024cc1e76fce07d24cc
* Disable DisplayList propertiesChet Haase2012-03-221-1/+1
| | | | | | | | | | | | | | DisplayList properties are (again) disabled by default, via flags in View.java and DisplayListRenderer.h. There are various artifacts to chase down before enabling by default. Issue #6198472 Native crash at pc 00076428 in many different apps in JRM80 Issue #6204173 Date/time picker isn't rendering all parts of UI Issue #6203941 All Apps overscroll effect is rendered weirdly/has flickering Issue #6200058 CAB rendering issue - not drawing items? Issue #6198578 Front camera shows black screen after taking picture. Change-Id: I045dc82ce1d85fedbae3bb88eb2a2dfb6891d41f
* Enable DisplayList propertiesChet Haase2012-03-191-1/+1
| | | | | | | | | | | | | | | This CL simply enables DisplayList property functionality. The code for this feature is already there, but it's been disabled by default pending further testing and analysis. This change sets these build-type flags to true so that all hw-accelerated apps will now use DisplayList properties by default. In particular, this feature enables a fast-path for changes that affect the handful of View properties involved in animations (alpha, translationX, etc.). Setting these properties now gets propagated to the native DisplayList associated with the View, avoiding costly recreation of the SDK-level DisplayList and also enabling faster invalidation of the view hierarchy. Change-Id: Ic99c8f28fa9183f2e54e9e4860b333eb9c540f7c
* Set the default text length to -1, not 1Romain Guy2012-03-151-1/+1
| | | | Change-Id: Iccf6f8366c0b659ba7c90df99ae05ebc5d81fcbb
* Correctly compute the number of bytes written by each op.Romain Guy2012-03-131-5/+4
| | | | | | | | | | | | | Bug #6157792 Previously, DisplayListRenderer would compute the number of bytes written after a drawing op by looking at the difference between the start pointer of the command stream and the end pointer of the command stream. The SkWriter class used to record the commands stream allocates blocks of storage which would cause a crash when a command spanned two blocks. Change-Id: I4d79d3feeb6d72d9d4e6ab05ecebd72d004be56c
* Handle view properties at the native levelChet Haase2012-03-121-4/+268
| | | | | | | | | | | Basic functionality of handling View properties (transforms, left/right/top/bottom, and alpha) at the native DisplayList level. This logic is disabled for now (via compile-time flags in View.java and DisplayListRenderer.h) as we continue work on it (there is no advantage to the new approach until we optimize invalidation and rendering paths to use the new code path). Change-Id: I370c8d21fbd291be415f55515ab8dced6f6d51a3
* Delete display list objects and resources on the UI threadRomain Guy2012-03-051-4/+4
| | | | | | | | | | | | | | Bug #6073717 Bug #6065504 Bug #6026515 Bug #5971725 Prior to this patch, the destructor of DisplayList would always run on the finalizer thread. This could cause a race condition if the UI thread was busy rendering display lists at the same time leading to various random native crashes. Change-Id: Ie11108e3b1538d4b358a1a8b4cce1b2d33152d0c
* Remove stray logRomain Guy2012-03-011-3/+5
| | | | Change-Id: I0c1979aab395098651c8a63d0bae0198ebc3746b
* Add hooks to implement Canvas.drawTextOnPath() in GLRomain Guy2012-02-241-0/+3
| | | | Change-Id: I165c9e05facf5365aa6850605688e538640c7fcc
* Only recreate path textures when necessaryRomain Guy2012-02-231-0/+1
| | | | | | | | | | | | | | When a drawPath command is recorded in a display list, a copy of the source path is made to preserve against possible modifications of the said source path. Copies are discarded when a display list is cleared, which usually happens on invalidate(). This means that even if a path is never modified, the texture generated to draw it on screen is destroyed every time an invalidate() is issued. This change fixes this problem by introducing a reference to the source path in the copy. If both the copy and the source path have the same genID, they are the same path and can share the same texture. Change-Id: I34849311c183e06336a1391d2d1568a087f973f6
* Only copy paths, paints and shaders when we need to.Romain Guy2012-02-211-3/+6
| | | | Change-Id: Iba7a9c92c865f698821b6ff7bc4f502659642ac1
* Record possible clip rejects when recording display listsRomain Guy2012-02-171-9/+52
| | | | | | | | | | | This optimization allows us to quickly skip operations that lie entirely outside of the known bounds of a display list. Because of ViewGroup.setClipChildren, we must keep the operations recorded in the display list. setClipChildren(false) is however a very uncommon operation and we will therefore often benefit from this new optimization. Change-Id: I0942c864e55298e6dccd9977d15adefbce3ba3ad
* Add debug markers to OpenGLRendererRomain Guy2012-01-301-0/+10
| | | | | | | | These markers will be used to group the GL commands by View in the OpenGL ES debugging tool. This will help correlate individual GL calls to higher level components like Views. Change-Id: I73607ba2e7224a80ac32527968261ee008f049c6
* Add full support for Canvas.setDrawFilter()Romain Guy2012-01-231-2/+7
| | | | Change-Id: I0ad35d0603c4eeda469014803be14c1dcdde918c
* Fix the build, for realRomain Guy2012-01-191-1/+1
| | | | Change-Id: I6263f7e5e3ae2f7efe045f8b464c0ed1b87fc793
* First pass at implementing Canvas.drawPosText() in GLRomain Guy2012-01-171-0/+3
| | | | Change-Id: Ia3ac347e95d57eb86c63045156c8dbc0572b03cb
* Rename (IF_)LOGD(_IF) to (IF_)ALOGD(_IF) DO NOT MERGESteve Block2012-01-031-1/+1
| | | | | | | See https://android-git.corp.google.com/g/156016 Bug: 5449033 Change-Id: I4c4e33bb9df3e39e11cd985e193e6fbab4635298
* Clip text correctlyRomain Guy2011-12-051-1/+1
| | | | | | | | | | | | | | | | | Bug #5706056 A newly introduced optimization relied on the display list renderer to properly measure text to perform fast clipping. The paint used to measure text needs to have AA and glyph id encoding set to return the correct results. Unfortunately these properties were set by the GL renderer and not by the display list renderer. This change simply sets the properties in the display list renderer instead. This change also improves the error message printed out when the application attempts to use a bitmap larger than the max texture size. Change-Id: I4d84e1c7d194aed9ad476f69434eaa2c8f3836a8
* Faster text clippingRomain Guy2011-12-011-1/+1
| | | | Change-Id: I03a00c4261d81a416b1ad7b86ce2d432c71908b4
* Reduce the size of libhwui by 50%Romain Guy2011-10-121-48/+51
| | | | | | | | This change removes unnessary symbols. All symbols are hidden by default, public APIs with exported symbols are explicitly marked with ANDROID_API. Change-Id: I692fde432a86c12108de1cfd1f6504919a7d5f3f
* Optimize display listsRomain Guy2011-08-251-0/+14
| | | | | | Remove redundant or useless operations Change-Id: If989b4eaa9143eef4254c38b39959aeed1f2b9ab
* Reclaim more memory, more often.Romain Guy2011-07-271-0/+4
| | | | | | Yay. Change-Id: I04557ad575c307a55088549f48f0e9ad994b7275
* Destroy layers and flush layers cache when a window is destroyed.Romain Guy2011-07-271-1/+1
| | | | Change-Id: I3fa1bc3ff50fb99e3d2e490925bd6b0a0f809fff
* Decouple GLES20RecordingCanvas lifetime from GLES20DisplayList.Jeff Brown2011-07-211-3/+1
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Bug: 5062011 Previously, each GLES20DisplayList would hold onto an instance of GLES20RecordingCanvas. In turn, each GLES20RecordingCanvas held onto an SkWriter with a 16Kb buffer along with several other objects. With one display list per view and hundreds of views, the overhead could add up to a few megabytes. Ensured that the GLES20RecordingCanvas is reset as soon as the display list has been constructed, thereby promptly freeing the 16Kb buffer. Changed GLES20DisplayList so that it acquires a GLES20RecordingCanvas from a pool as needed and recycles it when done. Removed some dead code and cruft related to the construction of GLES20Canvas objects in general. Some code was written with the assumption that the underlying renderer object could change behind the scenes or might be lazily constructed, but that isn't actually the case so we can simplify things. Removed an unnecessary weak reference from GLES20DisplayList to the View. It isn't actually used anywhere. Fixed a bug in GLES20DisplayList where isValid() would return true while the display list was being recorded. This is incorrect because the native display list might not actually exist. Worse, even if the native display list does exist, it is stale and potentially refers to old Bitmaps that have been GC'd (because the mBitmaps list was cleared when recording started). Change-Id: Ib12d5483688cb253478edeb0156d34c476c2566b
* Fix another memory leak in OpenGLRendererRomain Guy2011-06-221-8/+6
| | | | Change-Id: I23ed56891452a05cf3ca13f6919c4fef90d5ff4e
* Fix memory leak in OpenGLRenderer.Romain Guy2011-06-221-1/+3
| | | | | | | | When creating a display list, matrices are duplicated locally. They were however never deleted, thus causing apps to slowly leak memory (a matrix is about 40 bytes.) Change-Id: Iac465b720d4c4c9b5ca3fce870c0c912c14a74ab
* Add ability for hierarchyviewer to output displaylist infoChet Haase2011-05-051-0/+2
| | | | | | | | | Clicking on a node in hierarchyviewer1 and hierarchyviewer2 and then clicking the new "Dump DisplayList" button will cause the display list for the selected node (including its children) to be output into logcat. Change-Id: Iad05f5f6cca0f8b465dccd962b501dc18fe6e053
* Revert "Add ability for hierarchyviewer to output displaylist info"Chet Haase2011-05-041-2/+0
| | | | This reverts commit b2a4b52e8d5e499d33e2765e8c47851bf0266299.
* Add ability for hierarchyviewer to output displaylist infoChet Haase2011-05-041-0/+2
| | | | | | | | | Clicking on a node in hierarchyviewer1 and hierarchyviewer2 and then clicking the new "Dump DisplayList" button will cause the display list for the selected node (including its children) to be output into logcat. Change-Id: Id32f62569ad1ab4d533bc62987f3a7390c1bb4e6