summaryrefslogtreecommitdiffstats
path: root/libs/hwui/PathCache.cpp
Commit message (Collapse)AuthorAgeFilesLines
* stop using (deprecated) SkBitmap::ConfigMike Reed2014-06-201-2/+1
| | | | Change-Id: Ic75b5fc6996578e9d95bd3a220439ec1541d7c3b
* am b1c76a1a: Merge "Tessellate on worker threads" into lmp-preview-devChris Craik2014-06-101-12/+5
|\ | | | | | | | | * commit 'b1c76a1abcfb2f33e12fef37ec71d20724863b5e': Tessellate on worker threads
| * Tessellate on worker threadsChris Craik2014-06-101-12/+5
| | | | | | | | | | | | Tessellate and cache (where possible) shadow and round rect tessellation tasks. Change-Id: I2cfda8e11d83d51ea74af871235cf26e8f831d40
* | resolved conflicts for merge of b68f5f09 to masterKenny Root2014-05-301-2/+2
|\ \ | |/ |/| | | Change-Id: Ib8dd3a353f40a3357c8dc5ac591cd5e3ab4d0a4b
| * Fix a resource race bug in PathCacheyuyang2014-05-301-2/+2
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | When enabled defer rendering, it will do precache for DrawPathOp. The paint used for creating PathTask in precache just get the address of mFilteredPaint of OpenGLRenderer. So for the following defer operation like DrawTextOp has possibility change the mFilteredPaint by getPaint while another WorkerThread in PathCache is using the paint which pointed to the same address of mFilteredPaint to generate bitmap. As a result, it will generate a wrong bitmap for generateTexture in PathCache. To fix it, do a copy of paint when creating PathTask. CRs-Fixed: 664244 Change-Id: I5516f5b143458b88d3573d15b7ebb34f688800c7
* | am 328b7ee6: am aecb8c43: am 7b4cce68: am c3bac8a0: Merge "Fix graphics ↵Chris Craik2014-02-261-1/+3
|\ \ | |/ | | | | | | | | | | corruption caused by HWUI caches" * commit '328b7ee6a2ba2dc8f162fa57dbafd4bfc89bb72e': Fix graphics corruption caused by HWUI caches
| * Fix graphics corruption caused by HWUI cachesSangkyu Lee2014-02-261-1/+3
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Some caches(PatchCache, TextureCache, PathCache) for HWUI uses deferred removal for their cache entries even though actual resource objects are immediately freed by ResourceCache. For this reason, the uniqueness of a resource address in the caches is not guaranteed in specific cases. (Because malloc() can return the same address when malloc() and free() called very frequently.) So it can be possible the cache have two cache entries for two different resources but the same memory address. (Of course one of the resources is already freed.) It also can be possible mGarbage vector in PatchCache has duplicated addresses and this can lead to duplicated free blocks in the free block list and graphics corruption. (Deferred removal was implmeneted based on an assumption of unique resource addresses.) So this patch makes sure resource objects are freed after the resources are removed from the caches to guarantee the uniqueness of a resource address and prevent graphics corruption. Change-Id: I040f033a4fc783d2c4bc04b113589657c36fb15b Signed-off-by: Sangkyu Lee <sk82.lee@lge.com>
* | Use const where possible for drawing parametersChris Craik2014-01-031-10/+10
|/ | | | | | They should never be modified by a Renderer, only read and copied. Change-Id: I9d8d55dca19115ee9dfeb2bb3f092ba2fb327cd4
* Second attempt at avoiding infinite loop in PathCache::trim()Romain Guy2013-08-211-1/+16
| | | | | | Bug #10347089 Change-Id: I70f5a3933e848632473acc6636c88be5dc6ac430
* Properly account for created paths in the cacheRomain Guy2013-08-211-0/+5
| | | | Change-Id: I47b89b3085cefab6daac9194e7bfd3c140b37fa2
* Refcount 9-patches and properly handle GC eventsRomain Guy2013-06-261-11/+14
| | | | | | | | | | | | | | | | | This change adds refcounting of Res_png_9patch instances, the native data structure used to represent 9-patches. The Dalvik NinePatch class now holds a native pointer instead of a Dalvik byte[]. This pointer is used whenever we need to draw the 9-patch (software or hardware.) Since we are now tracking garbage collection of NinePatch objects libhwui's PatchCache must keep a list of free blocks in the VBO used to store the meshes. This change also removes unnecessary instances tracking from GLES20DisplayList. Bitmaps and 9-patches are refcounted at the native level and do not need to be tracked by the Dalvik layer. Change-Id: Ib8682d573a538aaf1945f8ec5a9bd5da5d16f74b
* Assume a texture is unbound after deleting itRomain Guy2013-06-061-1/+1
| | | | | | | | | | | Bug #9316260 The GL specification indicates that deleting a bound texture has the side effect of binding the default texture (name=0). This change replaces all calls to glDeleteTextures() by Caches::deleteTexture() to properly keep track of texture bindings. Change-Id: Ifbc60ef433e0f9776a668dd5bd5f0adbc65a77a0
* Introduce Caches::bindTexture() to reduce glBindTexture callsRomain Guy2013-06-041-2/+2
| | | | Change-Id: Ic345422567c020c0a9035ff51dcf2ae2a1fc59f4
* Path precaching creates duplicate cache entriesRomain Guy2013-03-261-4/+9
| | | | | | Bug #8478275 Change-Id: Ib541ea051e42e01cc0d277790e9c09de38ef72ee
* Stop worker threads on memory trim & fix bad pointer accessRomain Guy2013-03-201-3/+4
| | | | Change-Id: I6fe7e31aeb6dd41fa65ab952caed97bc2da510d7
* Merge all shapes/paths caches to PathCacheRomain Guy2013-03-181-19/+424
| | | | | | | | | This change will greatly simplify the multi-threading of all shape types. This change also uses PathTessellator to render convex paths. Change-Id: I4e65bc95c9d24ecae2183b72204de5c2dfb6ada4
* Prevent infinite loop when trimming the path cacheRomain Guy2013-03-131-2/+3
| | | | Change-Id: I04b5fa498336068f997c68d8613b35a99f67adbe
* Add TaskManager APIRomain Guy2013-03-121-68/+41
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | This API can be used to run arbitrary tasks on a pool of worker threads. The number of threads is calculated based on the number of CPU cores available. The API is made of 3 classes: TaskManager Creates and manages the worker threads. Task Describes the work to be done and the type of the output. A task contains a future used to wait for the worker thread to be done computing the result of the task. TaskProcessor The processor dispatches tasks to the TaskManager and is responsible for performing the computation required by each task. A processor will only be asked to process tasks sent to the manager through the processor. A typical use case: class MyTask: Task<MyType> class MyProcessor: TaskProcessor<MyType> TaskManager m = new TaskManager(); MyProcessor p = new MyProcessor(m); MyTask t = new MyTask(); p.add(t); // Waits until the result is available MyType result = t->getResult(); Change-Id: I1fe845ba4c49bb0e1b0627ab147f9a861c8e0749
* Precache paths from a worker threadRomain Guy2013-03-111-23/+139
| | | | Change-Id: I3e7b53d67e0e03e403beaf55c39350ead7f1e309
* Add plumbing for better text scalingRomain Guy2013-01-081-3/+0
| | | | | | | | Fonts are now described by a transform matrix. This lead to switching from a vector to a hashmap. This change therefore adds new comparators and hash computations to Font. Change-Id: I2daffa7d6287c18554c606b8bfa06640d28b4530
* Use LruCache instead of GenerationCache in libhwuiRomain Guy2012-11-291-11/+8
| | | | Change-Id: Ic26ddc7151eb5462bcd243b21daf7187ed6d3bec
* Work-around for a Skia rasterization bugRomain Guy2012-04-271-1/+6
| | | | | | | | | Bug #6411457 Skia does not generates the bottom right pixel of a rect when drawing a rect as an SkPath into an alpha8 bitmap. Change-Id: Ifb5286ae67745c9e44ee387b6d6ad607a9a2e6ce
* Only recreate path textures when necessaryRomain Guy2012-02-231-0/+5
| | | | | | | | | | | | | | 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
* Record possible clip rejects when recording display listsRomain Guy2012-02-171-0/+20
| | | | | | | | | | | 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
* Clean up GenerationCache.Jeff Brown2011-11-111-2/+2
| | | | | | | | | | | Use const references to keys and values where appropriate to avoid copying them unnecessarily. Deleted some dead code. Simplified a few pieces that were doing unnecessary redundant work. Change-Id: Ib2145b7094a40db2d679e05dafe050fe1e87b846
* Remove the right entries from the cache when a GC happens.Romain Guy2011-02-241-1/+3
| | | | Change-Id: I4649b18c4721a5511a404299e771e675c843407b
* Fixes cache misses and extra allocations.Romain Guy2011-02-031-1/+0
| | | | | | Bug #3421454 Change-Id: If4d5c960a7e4c581a9d213073e658284b4e1c497
* Remove unnecessary code.Romain Guy2011-01-201-182/+3
| | | | Change-Id: I83eba3406c26a4028af08b4d4c95ecd02803e75a
* Solve translucency issue when drawing paths.Romain Guy2011-01-111-4/+10
| | | | Change-Id: I68ae0e2ccddaca2f76b5b2dd3e3cf1277fddaad6
* Free resources only from the GL context thread.Romain Guy2010-11-111-19/+25
| | | | | | | | | | Bug #3179882 Resources were freed following garbage collections on a worker thread. This worker thread had no EGL context, which would cause the renderer to incorrectly assume that the memory was liberated. Change-Id: Ifdb51f94ddf42641e8654522787bfac532976c7c
* Add new runtime debug flags.Romain Guy2010-11-101-0/+8
| | | | Change-Id: I07955de166a89b5053c6c13f250bb3e2936ca86e
* Correctly remove unused paths from the cache.Romain Guy2010-11-091-4/+15
| | | | Change-Id: I41d9334dcd9871634037344ab49bf69383498161
* Fix possible rendering issue when drawing a path.Romain Guy2010-11-041-1/+7
| | | | Change-Id: I25f2e609589f0dd9294bcf7930de6398c0d7e377
* Make simple paths made of lines work.Romain Guy2010-09-301-2/+2
| | | | | | Bug #3041098 Change-Id: Ife9c3f01ded10e2bb35b1cdf1a54734d8347fee4
* A Path can exist in several cache entries.Romain Guy2010-09-091-1/+0
| | | | Change-Id: I742f7425d2b6bef753ed3e04fb39ebb103b2dc00
* Purge Skia objects from GL caches as needed.Romain Guy2010-09-081-0/+27
| | | | Change-Id: I754c671cf790ad5ae8bf047ad328034217da4ecc
* Use only one GL context per process, share chaches.Romain Guy2010-08-241-4/+22
| | | | Change-Id: Ieabaa25338d2f4b8d4fd90e7401ad6e7452eae11
* Add drop shadows.Romain Guy2010-08-131-1/+1
| | | | Change-Id: Ic6a72409d4785968d1fbdff229f17ee5c00b240b
* Fix tons of bugs and add new text rendering support.Romain Guy2010-08-101-1/+2
| | | | Change-Id: I326c66b10784006f6df2f12d38e120cef94cd0d7
* Enforce maximum texture size.Romain Guy2010-08-071-2/+15
| | | | | | | | | | | | When an app tries to render a bitmap or path larger than the GPU's maximum texture size, the drawing command is ignored and a warning is logged. This change also makes texture drawing more robust by catching potential errors during texture creation. This change also fixes a crash in the FontRenderer. The destructor would sometimes try to free an uninitialized array. Change-Id: I95ae0939c52192d97b340aa02417bf6d0c962c57
* Automatically cleanup textures that don't fit in the cache.Romain Guy2010-08-061-1/+2
| | | | Change-Id: I4f29ed96ea11118b391fb957e1e4d1b8fcef1537
* Add support for paths.Romain Guy2010-08-051-0/+165
Rendering is implementing by rasterizing the paths into A8 textures. This cna be extremely inefficient if the path changes often. Change-Id: I609343f304ae38e0d319359403ee73b9b5b3c93a