23 Commits

Author SHA1 Message Date
Chris Craik
0e87f00f8c Initialize MergingDrawBatch clip with viewport bounds
This allows merged, clipped operations to behave correctly within a
savelayer, even if the base viewport has a large offset.

Additionally, disregard opaqueness when within a
complexclip/savelayer, as the coverage can't be trusted.

Change-Id: Ic908b82a4bb410bc7fac1b4295f4874ed166efc5
2013-06-21 13:16:31 -07:00
Chris Craik
36d38cb904 Merge "Better handle op size edge cases" 2013-06-17 21:02:56 +00:00
Chris Craik
d72b73cea4 Better handle op size edge cases
bug:9464358

Previously, empty and unknown sized ops are assumed to fully cover
their clip. This is now corrected such that empty sized ops are
pre-rejected before defer. Additionally, unknown sized ops disable
overdraw avoidance.

Change-Id: Icf2ce24f98be5ea6299e24ffcf826790373564a1
2013-06-17 13:52:06 -07:00
Chris Craik
a02c4ed885 Fix clip merging behavior
Previously, a new op with a clipped side could be added to a
MergingDrawBatch without considering the batch's current bounds.

Change-Id: I1b873ecf821bad7cda6630c3f311edd90ac5cc8c
2013-06-14 13:43:58 -07:00
Chris Craik
f70119cd77 Reset batching state when overlap batch deletion occurs
Change-Id: Ifdbee9baaa734e27d15d2b54aa3b3abfffbce1e9
2013-06-13 11:28:45 -07:00
Chris Craik
28ce94a4ff Overdraw avoidance and merging of clipped ops
bug:8951267

If an opaque op, or group of opaque ops covers the invalidate region,
skip draw operations that precede it.

Clipped operations may now be merged, but only if they share a
clipRect - this is a very case for e.g. ListView, where all background
elements may now be a part of the same MergingDrawBatch.

It is this more aggressive merging that groups together clipped
background elements in the ListView case, enabling the overdraw
avoidance skipping the window background.

Change-Id: Ib0961977e272c5ac37f59e4c67d828467422d259
2013-06-12 14:46:52 -07:00
Romain Guy
7f77736599 Merge "Merge scaled bitmaps with translated bitmaps" 2013-05-22 00:43:48 +00:00
Romain Guy
2db5e993b6 Merge scaled bitmaps with translated bitmaps
Change-Id: I03089f48f97b69fcb4a0171984d3ff548d41c4a8
2013-05-21 17:42:43 -07:00
Chris Craik
41541825bc Use individual glyph positions to determine text bounds.
bug:8766924

Previously text bounds were calculated to be from 0 to totalAdvance in
the X, and from the font's top to bottom. These are incorrect,
especially in light of the font fallback mechanism.

Now, we calculate the bounds of the text as we layout each glyph.
Since these are much tighter bounds in the common case, this
significantly reduces the amount of clipping required (which in turn
enables more aggressive text merging).

Change-Id: I172e5466bf5975bf837af894a9964c41db538746
2013-05-21 23:04:05 +00:00
Chris Craik
d4b43b3cf3 Fix off by one error in log tracking
bug:8875715

Additionally moves op logging before the op is executed, to print
correctly, in pre-order traversal

Change-Id: I4e9566261f8363c73739d183e6d82b854f72ffad
2013-05-09 17:00:46 -07:00
Chris Craik
527a3aace1 Draw Operation merging
Merge simple bitmap draw operations and text operations to avoid
issuing individual gl draws for each operation. Merging other ops to
be done eventually.

The methods are different - the bitmap merging generates a single
mesh for reused, unclipped images (esp. repeated images in a listview)

The text approach queries just defers the normal font rendering until
the last drawText in the sequence that can share the same shader.

Patches are sorted and merged, but don't yet have a multiDraw
implementation. For now, the pretending-to-merge gives better sorting
behavior by keeping similar patches together.

Change-Id: Ic300cdab0a53814cf7b09c58bf54b1bf0f58ccd6
2013-04-15 13:53:02 -07:00
Romain Guy
cf51a41998 Introduce PixelBuffer API to enable PBOs
PBOs (Pixel Buffer Objects) can be used on OpenGL ES 3.0 to perform
asynchronous texture uploads to free up the CPU. This change does not
enable the use of PBOs unless a specific property is set (Adreno drivers
have issues with PBOs at the moment, Mali drivers work just fine.)

This change also cleans up Font/FontRenderer a little bit and improves
performance of drop shadows generations by using memcpy() instead of
a manual byte-by-byte copy.

On GL ES 2.0 devices, or when PBOs are disabled, a PixelBuffer instance
behaves like a simple byte array. The extra APIs introduced for PBOs
(map/unmap and bind/unbind) are pretty much no-ops for CPU pixel
buffers and won't introduce any significant overhead.

This change also fixes a bug with text drop shadows: if the drop
shadow is larger than the max texture size, the renderer would leave
the GL context in a bad state and generate 0x501 errors. This change
simply skips drop shadows if they are too large.

Change-Id: I2700aadb0c6093431dc5dee3d587d689190c4e23
2013-04-11 14:07:34 -07:00
Chris Craik
1ed30c907f Correct save/restore match up
bug:8480642

With the additional save/restore around the operations in flush, the
stored restore batches weren't matching up to the correct saves.

Change-Id: I2f48f19009bd97289b6973283f43dc8d3e35affd
2013-04-03 12:37:35 -07:00
Chris Craik
7273daace9 Fix issues related to saveLayer/restore deferral
bug:8464795

Changes drawModifiers and alpha to be restored for all operations,
since saveLayer/restore use these values, not just draw operations

Also forces a renderer state restoration before a deferred restore op
is played back, in case it is associated with a saveLayer that
doesn't have the save_clip flag set

Change-Id: I9da5d44fefbfffdee164c98f4f139843dacf85df
2013-03-28 11:33:13 -07:00
Chris Craik
a4e16c58c9 Restore final canvas state after deferred flush
bug:8450062

- Fixes overdraw indication with DeferredDisplayList
- Fixes drawHardwareLayer called after flush

Additionally changes drawLayer to pass its paint to native via setLayerPaint

Wrap flush in save/restore so that reordering doesn't affect final
transform

Change-Id: I08befa42c28500da6387699eefd4be28aedf9f4c
2013-03-22 11:54:51 -07:00
Chris Craik
d90144db52 Update snapshot upon saveLayer deferral
bug:8409891

In order to defer fbo-targetting saveLayer operations, it's necessary
to update the snapshot at defer time so that deferred display state
(namely, clip and transform) are fbo relative.

Re-enables deferring, as the issues with saveLayer are fixed.

Change-Id: I74b0779bc732675c747208f0757c3ea85f6dfbed
2013-03-20 16:32:53 -07:00
Chris Craik
4494599e5a Merge "Use snapshot alpha for layers" into jb-mr2-dev 2013-03-20 22:22:44 +00:00
Romain Guy
c46d07a29e Merge all shapes/paths caches to PathCache
This change will greatly simplify the multi-threading of all
shape types.

This change also uses PathTessellator to render convex paths.

Change-Id: I4e65bc95c9d24ecae2183b72204de5c2dfb6ada4
2013-03-18 18:32:17 -07:00
Chris Craik
d0afeac6df Reset draw modifiers after flushing
bug:8401910

This avoids leaving the renderer in a state with stale pointers (to,
e.g., shaders or color filters)

Change-Id: Idf8b63657041352e70e34e91ea416fe4385d4bc2
2013-03-15 18:48:41 -07:00
Chris Craik
a08f95cfec Use snapshot alpha for layers
Removes mMultipliedAlpha, using the snapshot alpha for all
non-overlapping display list alpha control.

Additionally, fixes opacity issues where children of
hasOverlappingRendering=false displaylists (both hw layer sublists and
other sublists with hasOverlappingRendering=false)

Change-Id: I6adc16da855835f9f518f8967628e5d0135c789b
2013-03-15 17:29:27 -07:00
Chris Craik
ff78583d8a Fully deferred displaylist replay
bug:8037003

A recursive drawDisplayList call is now entirely deferred before
playing back to the screen and issuing GL commands. This way, the
entire stream can be inspected, optimized, and batch work (such as
uploading textures) before issuing commands.

Additionally, this fixes an issue where operations draw could move
across restores corresponding to saveLayer(alpha). Those and other
similar cases (such as complex clipping, requiring the stencil) are
now treated as batching barriers, with the operations that change
renderer state in a way that's difficult to defer are just re-issued
at flush time.

Change-Id: Ie7348166662a5ad89fb9b1e87558334fb826b01e
2013-03-15 14:48:18 -07:00
Romain Guy
0f6675332c Precache glyphs at final raster size
The deferred display lists model now allows us to precache glyphs
at their exact size on screen.

This change also removes debug markers when the renderer defers
and reorders display lists. It also adds a flush event marker.

Change-Id: I66ec5216dc12b93ecfdad52a7146b1cfb31fbeb4
2013-03-01 16:04:53 -08:00
Chris Craik
c3566d0642 DisplayList draw operation reordering
bug:8037003

The reordering enables similar operations to draw together, minimizing the
OpenGL state change operations that go inbetween draws. Eventually, multiple
complete canvas draw operations will be merged (into a single glDrawArrays call,
for example)

Reorders DisplayList draw operations when:

-They can move backwards in the command stream to be after similar
operations without violating draw ordering

-The OpenGLRenderer is in a simple, replayable state (no complex clip,
or filter/shadow etc)

Also adds two system properties to control the deferral/reordering:
    "debug.hwui.disable_draw_defer"
    "debug.hwui.disable_draw_reorder"
which can be set to "true" to control the display list manipulation

Change-Id: I5e89f3cb0ea2d2afd3e15c64d7f32b8406777a32
2013-02-15 13:30:09 -08:00