summaryrefslogtreecommitdiffstats
path: root/tests/HwAccelerationTest
Commit message (Collapse)AuthorAgeFilesLines
* Second attempt at avoiding infinite loop in PathCache::trim()Romain Guy2013-08-211-2/+7
| | | | | | Bug #10347089 Change-Id: I70f5a3933e848632473acc6636c88be5dc6ac430
* Fix region clipping bugsRomain Guy2013-08-011-4/+2
| | | | | | See external bug #58344 Change-Id: Iecd6c41fc8076cd76add2335d3442a6dd8878f12
* Add path ops APIRomain Guy2013-07-302-1/+98
| | | | | | | | | | | | | | | | | | | | | | | | Path ops can be used to combine two paths instances in a single path object. The following operations can be used: - Difference - Reverse difference - Union - XOR - Intersection To use the API: Path p1 = createCircle(); Path p2 = createRect(); Path result = new Path(); result.op(p1, p2, Path.Op.DIFFERENCE); This code will subtract the rectangle from the circle and generate the resulting path in "result." Change-Id: Ic25244665b6691a7df0b0002a09da73d937b553b
* Remove unnecessary allocationsRomain Guy2013-06-061-5/+1
| | | | Change-Id: Ia561a0a312ca2737d5afa742184f5392bb2f29a3
* Pack preloaded framework assets in a texture atlasRomain Guy2013-05-022-0/+76
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | When the Android runtime starts, the system preloads a series of assets in the Zygote process. These assets are shared across all processes. Unfortunately, each one of these assets is later uploaded in its own OpenGL texture, once per process. This wastes memory and generates unnecessary OpenGL state changes. This CL introduces an asset server that provides an atlas to all processes. Note: bitmaps used by skia shaders are *not* sampled from the atlas. It's an uncommon use case and would require extra texture transforms in the GL shaders. WHAT IS THE ASSETS ATLAS The "assets atlas" is a single, shareable graphic buffer that contains all the system's preloaded bitmap drawables (this includes 9-patches.) The atlas is made of two distinct objects: the graphic buffer that contains the actual pixels and the map which indicates where each preloaded bitmap can be found in the atlas (essentially a pair of x and y coordinates.) HOW IS THE ASSETS ATLAS GENERATED Because we need to support a wide variety of devices and because it is easy to change the list of preloaded drawables, the atlas is generated at runtime, during the startup phase of the system process. There are several steps that lead to the atlas generation: 1. If the device is booting for the first time, or if the device was updated, we need to find the best atlas configuration. To do so, the atlas service tries a number of width, height and algorithm variations that allows us to pack as many assets as possible while using as little memory as possible. Once a best configuration is found, it gets written to disk in /data/system/framework_atlas 2. Given a best configuration (algorithm variant, dimensions and number of bitmaps that can be packed in the atlas), the atlas service packs all the preloaded bitmaps into a single graphic buffer object. 3. The packing is done using Skia in a temporary native bitmap. The Skia bitmap is then copied into the graphic buffer using OpenGL ES to benefit from texture swizzling. HOW PROCESSES USE THE ATLAS Whenever a process' hardware renderer initializes its EGL context, it queries the atlas service for the graphic buffer and the map. It is important to remember that both the context and the map will be valid for the lifetime of the hardware renderer (if the system process goes down, all apps get killed as well.) Every time the hardware renderer needs to render a bitmap, it first checks whether the bitmap can be found in the assets atlas. When the bitmap is part of the atlas, texture coordinates are remapped appropriately before rendering. Change-Id: I8eaecf53e7f6a33d90da3d0047c5ceec89ea3af0
* Apply ComposeShader's local matrix to childrenRomain Guy2013-03-181-2/+11
| | | | Change-Id: Idf9b8e7d7b30f8fcd8ba1fd4bfe8991e9ca148e2
* Merge all shapes/paths caches to PathCacheRomain Guy2013-03-181-6/+25
| | | | | | | | | This change will greatly simplify the multi-threading of all shape types. This change also uses PathTessellator to render convex paths. Change-Id: I4e65bc95c9d24ecae2183b72204de5c2dfb6ada4
* Add TaskManager APIRomain Guy2013-03-121-0/+17
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | 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-2/+2
| | | | Change-Id: I3e7b53d67e0e03e403beaf55c39350ead7f1e309
* Take text scale/skew into account only when rendering into a layerRomain Guy2013-03-041-6/+24
| | | | | | | | | | | | 3D rotations can undo scale/skew transforms; since FreeType only accepts 2x2 matrices we can end up generating very large glyphs that are drawn at a 1:1 scale on screen. For instance, if the current transform has a scale of 2000 set on both X and Y axis and a perspective Z factor set to Z, the actual scale factor on screen ends up being 1. We would however generate glyphs with a scale factor of 2000 causing the font renderer to blow up. Change-Id: Ia5c3618d36644e817825cb9c89e2f53aece2074e
* Support 3D rotations when drawing textRomain Guy2013-02-282-0/+74
| | | | | | | | | | | | | If a perspective transform is set on the Canvas, drawText() should not attempt to rasterize glyphs in screen space. This change uses the old behavior instead (i.e. rasterize the glyphs at the native font size and apply the transform on the resulting mesh.) This change also adds an optimization: empty glyphs (spaces) do not generate vertices anymore. This saves a lot of vertices in text heavy applications such as Gmail. Change-Id: Ib531384163f5165b5785501612a7b1474f3ff599
* Reorganize OpenGL renderer testsRomain Guy2013-02-282-170/+331
| | | | | | | | | | | The new UI works just like ApiDemos. The label of the activities declared in the manifest defines where they go in the UI. For instance Draw/Circles will create an entry called Draw in the first screen of the test app. Click the "Draw" item will launch a new activity containing an item called "Circles". Change-Id: I98a4442ee3d992598af440b2078ae1925214da20
* Properly scale textRomain Guy2013-02-272-3/+22
| | | | | | | | | | | | | | | This change does not apply to drawPosText() and drawTextOnPath() yet. Prior to this change, glyphs were always rasterized based on the font size specified in the paint. All transforms were then applied on the resulting texture. This creates rather ugly results when text is scaled and/or rotated. With this change, the font renderer will apply the current transform matrix to the glyph before they are rasterized. This generates much better looking results. Change-Id: I0141b6ff18db35e1213e7a3ab9db1ecaf03d7a9c
* Implement support for drawBitmapMesh's colors arrayRomain Guy2013-02-131-1/+1
| | | | Change-Id: I3d901f6267c2918771ac30ff55c8d80c3ab5b725
* Fix Snapshot::resetClip to also reset the clip regionRomain Guy2013-02-062-0/+91
| | | | Change-Id: I979151e73f64ff9d45f8a5232d8700361b09fbc7
* Add support for non-antialiased textRomain Guy2013-02-052-0/+66
| | | | Change-Id: I17c073955ab94abc9b409e5fcfbc675faa07c5ba
* Fix graphical corruption on QCOM GPURomain Guy2013-01-291-0/+1
| | | | | | | | | Bug #7146141 The GL_QCOM_tiled_rendering extension requires careful use of start/endTiling when attaching a renderbuffer dynamically. Change-Id: I20036683ed3909ffaf40cc3d57a25257e35b6fa2
* Allow layers with a stencil buffer to be resized on the flyRomain Guy2013-01-182-11/+79
| | | | | | | | | Bug #7146141 This change moves the resizeLayer() from LayerCache (where it should never have been anyway) to Layer. This makes a little more sense. Change-Id: I8b2f9c19c558e738405a58b9e71ec5799fc6be88
* Implement clipRect with a transform, clipRegion & clipPathRomain Guy2013-01-173-13/+147
| | | | | | | | | | | | | | | | | | | | | Bug #7146141 When non-rectangular clipping occurs in a layer the render buffer used as the stencil buffer is not cached. If this happens on a View's hardware layer the render buffer will live for as long as the layer is bound to the view. When a stencil buffer is required because of a call to Canvas.saveLayer() it will be allocated on every frame. A future change will address this problem. If "show GPU overdraw" is enabled, non-rectangular clips are not supported anymore and we fall back to rectangular clips instead. This is a limitation imposed by OpenGL ES that cannot be worked around at this time. This change also improves the Matrix4 implementation to easily detect when a rect remains a rect after transform. Change-Id: I0e69fb901792d38bc0c4ca1bf9fdb02d7db415b9
* Preliminary Support for region clippingRomain Guy2013-01-141-7/+3
| | | | | | | | | | | | | | | | | | | | Region clipping, using Canvas.clipPath or Canvas.clipRegion, requires a stencil buffer to be always present. In addition, extra wiring is required in JNI and display lists. This change only adds the necessary JNI/C++ APIs and some extra plumbing to start the real work on properly supporting region clipping. A new debug define called DEBUG_CLIP_REGIONS can be used to draw the current clip region. It is off by default, as is region clipping. The default implementation of clipPath() and clipRegion(), now in native, mimics the previous Dalvik implementation to prevent regressions. Change-Id: I7903e7cfd7412b9b9b622566d4dbfce7bdcec00c
* Cleanup 9patch mesh matching codeRomain Guy2013-01-091-0/+0
| | | | | | | | | Bug #7970966 The bug described in #7970966 should normally never happen but just in case, change the detection code to be more robust. Change-Id: I7040a6087590e34abe8803cb8f83f051d77f3944
* Add plumbing for better text scalingRomain Guy2013-01-082-6/+49
| | | | | | | | 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
* Add more tests for libhwuiRomain Guy2013-01-073-0/+189
| | | | | | These tests verify the behavior when scaling paths and text Change-Id: I0f3259175bcee93186e30296759996e0447cba99
* Properly support ALPHA_8 bitmaps in all drawBitmap() methodsRomain Guy2013-01-043-0/+106
| | | | Change-Id: I869993c59e0a0d76f369c09acbae711753908f48
* Merge "Add API to enable mipmaps on Bitmap Bug #7353771" into jb-mr1-devRomain Guy2012-10-163-0/+86
|\
| * Add API to enable mipmaps on BitmapRomain Guy2012-10-163-0/+86
| | | | | | | | | | | | | | | | | | Bug #7353771 This API can be used when scaling large images down to a small size to get nicer looking results. Change-Id: If09087eed36077eee5355f6047a3ca67747d7d9e
* | Support clipping in Canvas.drawBitmapMesh()Romain Guy2012-10-161-0/+7
|/ | | | | | Bug #7354162 Change-Id: Ifd1d0b365e8a4d88e0ff0629c9ee13f27e1a7331
* Merge "Fix bug #7206086 NumberPicker widget should use locale digits" into ↵Fabrice Di Meglio2012-09-231-2/+2
|\ | | | | | | jb-mr1-dev
| * Fix bug #7206086 NumberPicker widget should use locale digitsFabrice Di Meglio2012-09-211-2/+2
| | | | | | | | | | | | | | - fix for having the TwoDigitFormatter being able to be recreated if the locale is changed - accept now also the Arabic and Persian digits Change-Id: Ifbf7e274d971008f4a5782402d4b76d9472b68fc
* | Optimize tiling managementRomain Guy2012-09-201-2/+2
| | | | | | | | | | | | Bug #7186819 Change-Id: Iebc42a6e9c96ad5605fbbe1539aa887695d2e829
* | Add support for QCOM_tiled_renderingRomain Guy2012-09-193-0/+9
|/ | | | | | | | | Bug #7186819 This optional OpenGL extension can be used by tiled renderers to optimize copies from main memory to tiles memory. Change-Id: Id4a5d64e61ad17f50e773e8104b9bf584bb65077
* Add test for layer updates optimizationsRomain Guy2012-09-182-0/+84
| | | | | | Optimizations are following. Change-Id: I120e1d0c08d8068fcac46515f37a4ae510e5f3a3
* Merge "Fix memory corruption in LayerRenderer::copyLayer" into jb-mr1-devRomain Guy2012-09-072-0/+90
|\
| * Fix memory corruption in LayerRenderer::copyLayerRomain Guy2012-09-072-0/+90
| | | | | | | | | | | | | | | | The pixel store pack alignment was not set for the source texture, causing a write to occur outside of the destination bitmap's bounds. Change-Id: Iaa5767acf7b5943fbc2765c3810a142f06b1a796
* | Handle different x, y scales in drawLines AA pathChris Craik2012-09-071-0/+8
|/ | | | | | | | | | | bug:7114630 Fixes different x, y scales, and fixes boundaryWidthProportion to be from center, not edge. Also adds drawLine tests that previously drew blurry. Change-Id: I2b648a60361ad3931eac67647b9b27909525ee1e
* Merge "Varying-based AA rect drawing" into jb-mr1-devChris Craik2012-09-061-0/+6
|\
| * Varying-based AA rect drawingChris Craik2012-09-051-0/+6
| | | | | | | | | | | | | | | | | | | | | | | | Instead of calculating opacity from relative position in the shader, use a shader varying to do this computation for us. bug:5045101 Also adds a test to HwAccelerationTest to show incorrect antialiasing in scaled drawAARect / boundarySize calculation. Change-Id: Icdc41acb01dc10ce354834f8389a5aed2f439162
* | Add new hw acceleration testRomain Guy2012-09-042-0/+76
|/ | | | Change-Id: Id2b94286cf62ab77d8c843cffaba09b3070a6332
* Optimize interactions with glyph cacheChet Haase2012-08-142-0/+84
| | | | | | | | | | | | | | | | | 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
* Reduce gradients textures size whenever possibleRomain Guy2012-08-082-0/+86
| | | | Change-Id: Ifd58625ee62edac3b5d20b77553cb98b6fa2b46e
* Draw an empty border around glyphs to avoid sampling issuesRomain Guy2012-08-071-0/+6
| | | | | | | | | | Bug #6942209 The font renderer was preserving a 1 px border around each glyph to ensure bilinear filtering would work nicely. Unfortunately, this border was not set to 0 when glyphs were added in the cache to replace old evicted glyphs. Change-Id: Ib85afca7ebad5cb63f960dc0e87ae162333dbfe8
* Add dithering to gradientsRomain Guy2012-08-011-0/+9
| | | | Change-Id: Ic1208855bde3a254eca2fd7cef43e0f1318ce419
* Improve gradientsRomain Guy2012-07-312-0/+125
| | | | | | Avoid using textures for common gradients (two stops from 0.0 to 1.0) Change-Id: Iff55d21b126c8cfc4cfb701669f2339c8f6b131a
* Make HardwareRenderer able to target generic Surface objectsRomain Guy2012-07-241-5/+4
| | | | Change-Id: I4b7199a1eb30e0df354ae12c4819adc69db5df40
* Make gradients look slightly betterRomain Guy2012-07-202-0/+59
| | | | Change-Id: Ib12c628a88b9ec6af1214ce6e5cb14cfde40485e
* Removing setChildrenLayersEnabledMichael Jurka2012-06-285-210/+32
| | | | Change-Id: I88d8228eadb59160648f2c4e131fcd85945f2109
* Fix TextureView OpenGL sampleRomain Guy2012-05-161-13/+16
| | | | | | | The sample was doing something dumb: instead of binding the texture unit to the shader's sampler, it was binding the texture name. Oops. Change-Id: I13450dacbbd2dad362a2573aebb95e8eb87b25f0
* Remove all Dalvik allocations from Cavnas.drawBitmap(int[], ...)Romain Guy2012-05-141-1/+6
| | | | Change-Id: Ie28538a2104d21154fdc78a56525e7403f08287d
* Fix hang/crash in native path codeChet Haase2012-05-032-0/+110
| | | | | | | | | | | | | | | | 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
* Corrects invalidation logic for layered viewsChet Haase2012-05-023-0/+269
| | | | | | | | | | | | | A bug in the invalidation logic meant that changes to a view would not cause parents in the view hiearchy that were set to have a layer (e.g., View.LAYER_TYPE_HARDWARE) to get invalidated properly. So even though the child view was all set to recreate its display list according to the property change, the layer in the tree above it would stay as-is, meaning that the change would not show up on the screen. Issue #5887530 DropTarget text does not change color with the icon Change-Id: Ie6eac4f406d172cb437822d9fe76340ab2afaf1c