4625 Commits

Author SHA1 Message Date
Romain Guy
8a1374946a Deleting objects on the wrong thread is a silly idea
Bug #7195815

Turns out that multi-threading is hard.

Change-Id: Ib0b4bd6dc3caea27f7ced22cbb363bb955fe58ab
2012-09-25 15:49:03 -07:00
Romain Guy
ef09a210dd Don't destroy the same texture twice
Bug #7221449

SurfaceTexture already deletes the GL texture when detachFromContext
is invoked. The newly introduced refcount would casue the Layer
object to be destroyed later and attempt to delete the GL texture
again. By the time the second cleanup occurs, the texture name
might have been reused by somebody else, resulting in erroneous
behaviors.

Change-Id: I257c589fea64b34c00f46fbfaa7732e6854a5e41
2012-09-25 12:22:21 -07:00
Romain Guy
e83221c547 Fix alpha channel computation with ColorMatrixColorFilter
Bug #7222476

There were two issues:
- Blending was ignored with color filters
- The addition vector of a color filter was treated as integer values
  instead of float values

Change-Id: Id94065704a30ee8aaaa5724a9f3a3cff7c50ced7
2012-09-25 09:33:22 -07:00
Jean-Baptiste Queru
908a43234a Merge into jb-mr1-dev
Change-Id: I7b777c7a4818d699582419d2eb4fc1f5cc0f4f46
2012-09-25 09:26:09 -07:00
Romain Guy
87e2f757be Add a property to disable libhwui's scissor optimization
Bug #7158326

When scissor optimization is enabled, OpenGLRenderer will attempt to
minimize the use of scissor by selectively enabling and disabling the
GL scissor test.
When the optimization is disabled, OpenGLRenderer will keep the GL
scissor test enabled and change the scissor rect as needed.
Some GPUs (for instance the SGX 540) perform better when changing
the scissor rect often than when enabling/disabling the scissor test
often.

Change-Id: Idb68862e287a23358f9188d577ae0f86161902fd
2012-09-24 11:47:52 -07:00
Romain Guy
6b3292ce5b Merge "Avoid deadlock when deleting layers Bug #7217459" into jb-mr1-dev 2012-09-23 17:50:06 -07:00
Romain Guy
97dc9172b0 Avoid deadlock when deleting layers
Bug #7217459

Change-Id: I12bfa6c30c5030bd1b23ea6a3ce64240ab1dfba3
2012-09-23 17:49:24 -07:00
Romain Guy
d392b87e3d Merge changes Ib0a0b7d1,Ibec4b2aa into jb-mr1-dev
* changes:
  Fix overdraw debug on QCOM
  Make sure we never bind to texture #0 Bug #7195815
2012-09-23 15:00:46 -07:00
Romain Guy
4285de3c8b Fix overdraw debug on QCOM
Disable the use of the tiling extension when overdraw debug is
turned on.

Change-Id: Ib0a0b7d1998146aa0c7efef2d3822f9997efb123
2012-09-23 14:46:35 -07:00
Romain Guy
574cf6070d Make sure we never bind to texture #0
Bug #7195815

Change-Id: Ibec4b2aa4c580419eb5eb61adae6c9c960694d0c
2012-09-23 14:45:31 -07:00
Chet Haase
b92d8f7979 Optimize glyph cache texture uploads
Only upload the changed area of the glyph cache, not the entire
bitmap. Note that we can't do the full-on optimization here of copying a sub-rect
of the bitmap because of GL ES 2 limitations, but we can at least copy the
horizontal stripe containing the dirty rect, which can still be a big
savings over uploading the entire bitmap.

Issue #7158326 Bad framerates on MR1 (Mako, Manta, Prime)

Change-Id: Iab38d53202650f757ead4658cf4287bdad2b3cb9
2012-09-23 12:16:02 -07:00
Romain Guy
8e586f61dd Merge "Add support for a new developer setting: overdraw debugging" into jb-mr1-dev 2012-09-21 19:28:06 -07:00
Romain Guy
7c450aaa3c Add support for a new developer setting: overdraw debugging
Change-Id: I350ba4486577c3289f82c20938f7a35138778727
2012-09-21 19:15:00 -07:00
Chet Haase
dbb261455b Merge "Optimize shaders for dithered gradients" into jb-mr1-dev 2012-09-21 17:12:48 -07:00
Chet Haase
a1d12dd619 Optimize shaders for dithered gradients
It's faster to compute a dither calculation in the vertex shader and use
a varying (letting the GPU interpolate the fragment values) than to perform
that calculation in the fragment shader as part of a texture lookup.

Issue #7207600 Prime mr1 shader performance issues
Issue #7158326 Bad framerates on MR1 (Mako, Manta, Prime)

Change-Id: I15789582a6e9e2d8b9dd22aa5b0f72f0ba1cce7f
2012-09-21 16:20:57 -07:00
Romain Guy
059aedf808 Merge "Finish this bit before I forget." into jb-mr1-dev 2012-09-21 15:08:12 -07:00
Romain Guy
f7e52d92b4 Finish this bit before I forget.
This code is not enabled in current builds.

Change-Id: I488ec9e94889efbf2c8f3312abfed4298a76b7f1
2012-09-21 15:06:52 -07:00
Chris Craik
61d37041ac Merge "Polygonal rendering of simple fill shapes" into jb-mr1-dev 2012-09-21 11:03:59 -07:00
Romain Guy
11cb642756 Update layers in a single batch at the beginning of a frame
Bug #7186819

Change-Id: Ice5926dfedfb3be3a3064e65008dafa2852407da
2012-09-21 00:39:43 -07:00
Romain Guy
57b5268708 Optimize tiling management
Bug #7186819

Change-Id: Iebc42a6e9c96ad5605fbbe1539aa887695d2e829
2012-09-20 17:38:46 -07:00
Chris Craik
710f46d9d6 Polygonal rendering of simple fill shapes
bug:4419017

Change-Id: If0428e1732139786cba15f54b285d880e4a56b89
2012-09-20 13:08:20 -07:00
Romain Guy
2b7028eaba Add support for QCOM_tiled_rendering
Bug #7186819

This optional OpenGL extension can be used by tiled renderers to optimize
copies from main memory to tiles memory.

Change-Id: Id4a5d64e61ad17f50e773e8104b9bf584bb65077
2012-09-19 21:10:09 -07:00
Romain Guy
35643ddc68 Minimize state changes when updating layers
Change-Id: I407fcc80bd3178f9f09a3b379ceb7f7ce0749e08
2012-09-18 15:41:16 -07:00
Chet Haase
0990ffbc4d Fix GL shader bugs
Fixing errors in emitted shader code that caused GL errors
at runtime

Change-Id: I267a84398a81329a6688b292505f8779bd750ad1
2012-09-18 14:10:10 -07:00
Chet Haase
a8a402f8ad Merge "Fix bad shader code" into jb-mr1-dev 2012-09-17 17:12:03 -07:00
Chet Haase
1c5c206953 Fix bad shader code
Shader code missing "=" in a couple of cases.

Change-Id: Iff8a99a0ccb2903c30e2bdb2f698ef9b2e03d5d1
2012-09-17 17:09:21 -07:00
Chet Haase
f74d2f2fe8 Merge "Fix occasional crash bug with layers" into jb-mr1-dev 2012-09-17 13:29:03 -07:00
Chet Haase
603f6de35f Fix occasional crash bug with layers
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
2012-09-17 11:21:34 -07:00
Romain Guy
a938f569ce Fix modulation and gamma correction issues
Modulation is normally enabled in a shader when drawing with an alpha
mask (A8 texture.) Modulation is used to do one of two things:

- Colorize the primitive (to draw text in red for instance)
- Apply extra translucency (50% translucent circle filled with a bitmap)

The current implementation has four issues:

1. Unnecessary work is performed by assigning the modulation color
   to vec4 fragColor early in the shader
2. The modulation color's alpha is applied twice when the primitive
   is drawn with an SkShader
3. The decision to modulate is wrong and triggers when any of the
   RGB channels is < 1.0. Only the alpha channel needs to be taken
   into account to make the decision
4. Gamma correction is not applied properly

This change addresses all four issues above.

Change-Id: I73fcc74efc4b094bf2d1b835f10ffaa2ea4b9eb9
2012-09-14 10:50:51 -07:00
Romain Guy
494ac35c27 Merge "Multiply alpha for AA as late as possible" into jb-mr1-dev 2012-09-14 10:34:47 -07:00
Romain Guy
85ef80d890 Foundation for tiling optimization
Change-Id: I4db32a4749f196472ba0dde7e102439d2ba4a3a7
2012-09-13 20:26:50 -07:00
Chris Craik
9f44a13a12 Multiply alpha for AA as late as possible
Should be done after all color computation

Change-Id: Iaadd565f7d2263f111f6841a00e7c341025833d3
2012-09-13 18:34:55 -07:00
Romain Guy
45e4c3df6c Discard framebuffer commands when we redraw the entire buffer
Change-Id: I32e3014832cbd3bdbace8c3d2206eb20a2002d64
2012-09-11 17:30:43 -07:00
Romain Guy
df46c63755 Merge "Prevent degenerate 9-patches from drawing out of bounds Bug #7137292" into jb-mr1-dev 2012-09-10 17:43:21 -07:00
Romain Guy
70561df470 Prevent degenerate 9-patches from drawing out of bounds
Bug #7137292

Change-Id: I371e94899445d2f3c6794d5c0aee8faa514d3c2c
2012-09-10 17:40:18 -07:00
Chet Haase
beb8bd0db2 Reset GL buffer state after functor invocation
Functors in WebView were binding to different buffers than we
assumed in the toolkit, eventually causing a crash due to improper
dereferencing in the currently bound buffer. Fix is to reset state
after invoking functors.

Issue #6666279 Native crash in Currents, mostly on Nakasi

Change-Id: I3697812d83613fffc9193daa99beea4dbf26474a
2012-09-10 08:56:55 -07:00
Romain Guy
4aacf93d40 Merge "Fix memory corruption in LayerRenderer::copyLayer" into jb-mr1-dev 2012-09-07 18:44:40 -07:00
Romain Guy
e49d7ec361 Fix memory corruption in LayerRenderer::copyLayer
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
2012-09-07 18:42:38 -07:00
Chris Craik
dc531fa7d4 Merge "Handle different x, y scales in drawLines AA path" into jb-mr1-dev 2012-09-07 15:27:05 -07:00
Chris Craik
75040f8a77 Handle different x, y scales in drawLines AA path
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
2012-09-07 15:20:38 -07:00
Chet Haase
89b3f48fa3 Merge "Enable changing properties of layer paint" into jb-mr1-dev 2012-09-07 14:44:43 -07:00
Romain Guy
55e6b77bda Merge "Reduce the number of locks acquired by display lists" into jb-mr1-dev 2012-09-07 14:01:31 -07:00
Romain Guy
58ecc204fb Reduce the number of locks acquired by display lists
Change-Id: I1123aae0355de84db705bb75042c7083fc69c9f2
2012-09-07 14:01:09 -07:00
Chet Haase
d15ebf25c5 Enable changing properties of layer paint
Previously, to draw a layered view with a changed Paint object for the
drawLayer operation, you'd have to invalidate the parent view, to get the
native DisplayList to pick up the new Paint properties. This change adds
API and functionality so that the developer can call setLayerPaint(), which
does the proper invalidation (lightweight, doesn't cause redrawing the view).

Issue #6923810 Make it easy to efficiently animate a layer's Paint

Change-Id: I7fea79788d50f6d9c86dd5e5b2a4490cb95142bb
2012-09-07 13:27:02 -07:00
Fabrice Di Meglio
01fcb72894 Merge "Use "ldrtl" and "ldltr" config qualifiers for RTL / LTR resources" into jb-mr1-dev 2012-09-07 10:17:55 -07:00
Chris Craik
9147cd4ac5 Fix m11 to be Y scale instead of X
bug:7114630

Fixes different X and Y values resulting in blurry lines/rects.

Change-Id: I3eb244e0cf769efa6b38d08741cf37d0bf62b786
2012-09-06 16:44:51 -07:00
Fabrice Di Meglio
8a802dbdab Use "ldrtl" and "ldltr" config qualifiers for RTL / LTR resources
- we cannot use "rtl" / "ltr" qualifiers as they can conflict with ISO-639 Alpha-3
codespace which uses 3 letters for identifying a language code (and could use either
"rtl" or "ltr" strings for defining a language in the future).

- we are using instead "ldrtl" for RTL and "ldltr" for LTR resources. Those qualifiers
are defined by more than 3 chars and outside of what is defined into ISO-639. They
are also more understandable as "ld" prefix is for "layoutdirection"

Change-Id: Id43e948103707e09bef63ebd54ac1779dde58e72
2012-09-06 11:13:24 -07:00
Chris Craik
378d131e65 Merge "Varying-based AA rect drawing" into jb-mr1-dev 2012-09-06 10:52:14 -07:00
Chris Craik
6ebdc114e0 Varying-based AA rect drawing
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
2012-09-05 16:45:03 -07:00
Romain Guy
521dc51fd4 Don't invalidate all the glyphs when flushing large textures
FontRenderer::flushLargeCaches identifies the large textures used to
cache glyphs and visits all the known fonts to mark their glyphs
invalid if they belong to one of these large textures.

Unfortunately, Font::invalidateTextureCache had a logic error
which would make it mark *all glyphs* as invalid, not matter
what texture they belong to. This means that any large cache
flush would cause all glyphs to be invalidate, thus forcing
the rendering system to recreate them on the next draw.

Font::invalidateTextureCache is supposed to behave this way:
- If the specified cacheTexture is NULL (default value), mark
all glyphs as invalid (see FontRenderer::flushAllAndInvalidate())
- If cacheTexture is *not* NULL, invalidate only the glyphs for
which glyph.cacheTexture == cacheTexture.

The previous condition read:

if (cacheTexture || glyph.cacheTexture == cacheTexture)

This test *always* passes.

Change-Id: I418886cb594c81c6178d0f9e9953d975e991cf22
2012-09-04 19:20:06 -07:00