119 Commits

Author SHA1 Message Date
Derek Sollenberger
c4fbada76a Support Surface and Layer Readback in the SkiaPipelines.
Test: CTS TextureViewTests and UIRendering
Change-Id: I2969c8f5a975bfd9aebcbb585c64d1fcbb2487c2
2016-11-16 13:30:00 -05:00
Sergei Vasilinetc
97cc85fd4b Merge "Routine to upload hardware bitmaps" 2016-11-01 19:32:19 +00:00
sergeyv
694d499662 Routine to upload hardware bitmaps
Change-Id: Id8283a0975325e6830d55fd1e33c5f292a1e9be0
Test: refactoring cl.
bug:30999911
2016-10-31 16:11:21 -07:00
Derek Sollenberger
daf7229047 Move OpenGL specific details behind renderPipeline interface.
Test: new and existing unit tests still pass.
Change-Id: I6164f30f45ebe450788ed8d949eca5af9a44e585
2016-10-26 12:46:57 +00:00
sergeyv
ec4a4b13ea Use Bitmap in DisplayList & RecordedOps instead of SkBitmap
Test: refactoring cl.
bug:32216791

Change-Id: I1d8a9a6e772e2176b6c2409409a910478b45f8db
2016-10-21 12:11:44 -07:00
Romain Guy
253f2c213f Linear blending, step 1
NOTE: Linear blending is currently disabled in this CL as the
      feature is still a work in progress

Android currently performs all blending (any kind of linear math
on colors really) on gamma-encoded colors. Since Android assumes
that the default color space is sRGB, all bitmaps and colors
are encoded with the sRGB Opto-Electronic Conversion Function
(OECF, which can be approximated with a power function). Since
the power curve is not linear, our linear math is incorrect.
The result is that we generate colors that tend to be too dark;
this affects blending but also anti-aliasing, gradients, blurs,
etc.

The solution is to convert gamma-encoded colors back to linear
space before doing any math on them, using the sRGB Electo-Optical
Conversion Function (EOCF). This is achieved in different
ways in different parts of the pipeline:

- Using hardware conversions when sampling from OpenGL textures
  or writing into OpenGL frame buffers
- Using software conversion functions, to translate app-supplied
  colors to and from sRGB
- Using Skia's color spaces

Any type of processing on colors must roughly ollow these steps:

[sRGB input]->EOCF->[linear data]->[processing]->OECF->[sRGB output]

For the sRGB color space, the conversion functions are defined as
follows:

OECF(linear) :=
linear <= 0.0031308 ? linear * 12.92 : (pow(linear, 1/2.4) * 1.055) - 0.055

EOCF(srgb) :=
srgb <= 0.04045 ? srgb / 12.92 : pow((srgb + 0.055) / 1.055, 2.4)

The EOCF is simply the reciprocal of the OECF.
While it is highly recommended to use the exact sRGB conversion
functions everywhere possible, it is sometimes useful or beneficial
to rely on approximations:

- pow(x,2.2) and pow(x,1/2.2)
- x^2 and sqrt(x)

The latter is particularly useful in fragment shaders (for instance
to apply dithering in sRGB space), especially if the sqrt() can be
replaced with an inversesqrt().

Here is a fairly exhaustive list of modifications implemented
in this CL:

- Set TARGET_ENABLE_LINEAR_BLENDING := false in BoardConfig.mk
  to disable linear blending. This is only for GLES 2.0 GPUs
  with no hardware sRGB support. This flag is currently assumed
  to be false (see note above)
- sRGB writes are disabled when entering a functor (WebView).
  This will need to be fixed at some point
- Skia bitmaps are created with the sRGB color space
- Bitmaps using a 565 config are expanded to 888
- Linear blending is disabled when entering a functor
- External textures are not properly sampled (see below)
- Gradients are interpolated in linear space
- Texture-based dithering was replaced with analytical dithering
- Dithering is done in the quantization color space, which is
  why we must do EOCF(OECF(color)+dither)
- Text is now gamma corrected differently depending on the luminance
  of the source pixel. The asumption is that a bright pixel will be
  blended on a dark background and the other way around. The source
  alpha is gamma corrected to thicken dark on bright and thin
  bright on dark to match the intended design of fonts. This also
  matches the behavior of popular design/drawing applications
- Removed the asset atlas. It did not contain anything useful and
  could not be sampled in sRGB without a yet-to-be-defined GL
  extension
- The last column of color matrices is converted to linear space
  because its value are added to linear colors

Missing features:
- Resource qualifier?
- Regeneration of goldeng images for automated tests
- Handle alpha8/grey8 properly
- Disable sRGB write for layers with external textures

Test: Manual testing while work in progress
Bug: 29940137

Change-Id: I6a07b15ab49b554377cd33a36b6d9971a15e9a0b
2016-10-11 17:47:58 -07:00
John Reck
9580146f50 Add API to copy a window
Change-Id: I9bb5209010db6665be4b6f8db81a6fc1b7debc45
2016-09-07 11:41:15 -07:00
John Reck
712765ff34 resolve merge conflicts of 1d7ee6b to master
Change-Id: I2ed0f2c3233151e890bd8bde825d306ec8f0d8fd
2016-08-10 11:04:39 -07:00
John Reck
cd68212f08 Make updateSurface non-blocking
Bug: 30442298

We already do this for initialize(), fix
it so that update() is parallel with the
UI thread as well.

Shaves ~7ms off of the 99th percentile on
NotificationShade open & close

Change-Id: I1791df495453fb9e1e12362c68e3d20e837e62be
2016-08-09 12:11:13 -07:00
John Reck
8b9a1fa084 Eliminate recents upload jank am: 4387190d8e am: 021a952150
am: 897b9effb7

Change-Id: Iab2f01b5b3a9be6946e36169209c281a3320ed14
2016-08-02 02:57:27 +00:00
John Reck
4387190d8e Eliminate recents upload jank
Bug: 30342017

Upload recents thumbnails in the
dead gaps between frames instead of
at the start of a frame. This eliminates
jank caused by the large texture
upload.

Change-Id: I507cd286d199109c7a9a1511d68ba5ab5d28069f
2016-08-01 16:36:14 -07:00
Derek Sollenberger
56ad6ec42f Remove LayerRenderer.
There is only one caller each for the static functions here so this
CL moves the logic to the caller.  Also by moving some of the code
into the pipeline it makes it easier for future changes to configure
how a pipeline handles a layer.

Change-Id: Ib735b5154325cbb658fd151f7a19dbf434ab44b7
2016-07-26 13:05:13 -04:00
Chris Craik
5e00c7ce06 Delete old rendering pipeline
fixes: 30002246

Change-Id: I45df0e924708526cee045b14c291bd23aa1a92db
2016-07-07 15:53:50 -07:00
Tim Murray
aa1735370b Merge changes from topic \\'fifo\\' into nyc-mr1-dev am: a96d445aef
am: 03b34e402c

Change-Id: If3104889f659aef9a6d7035e18ab839544c9ecb3
2016-07-07 20:59:09 +00:00
Tim Murray
33eb07f575 Add new mode for SCHED_FIFO on UI and RenderThreads.
Add a new mode, controlled by sys.use_fifo_ui property, that enables the
top app's UI and RenderThread to be SCHED_FIFO. This eliminates almost
all jank due to scheduling competition with non-UI critical
threads. This mode may not be suitable for all devices.

bug 24503801

Change-Id: I7b8a31830ad80f7efa00236928d5476998ed4e00
2016-07-07 12:55:31 -07:00
Stan Iliev
03de074d05 Implement runtime switch to select default renderer mode
Add a system property debug.hwui.default_renderer, which allows
to set rendering mode to OpenGL (default), Skia OpenGL or Vulkan.

Change-Id: I8bca5bacc5108f77437e340ac61f2d8db8cc4c39
2016-07-07 14:27:20 -04:00
John Reck
f1480761c1 Benchmark-mode for macrobench
Adds googlebench output format support
Adds offscreen rendering for >60fps benchmarking
Adds 'all' alias to run all registered TestScenes

Change-Id: I2579e40f2f4c941bfbd90c75efbee384c08a116b
2016-07-06 10:50:21 -07:00
Derek Sollenberger
05357641d3 Remove unused method from RenderProxy and CanvasContext.
Change-Id: I324bbfa40a2155d0212fa20c6bd39df5bb21d27a
2016-06-29 11:12:04 -04:00
John Reck
ab1080c4d0 Delete unused args
Bug: 21170575
Change-Id: Icc832f70f206342557f44667ad3498405d04db78
2016-06-21 16:24:20 -07:00
John Reck
e94cbc76d5 API tweaks to PixelCopy and make it public
Bug: 27708453
Change-Id: I81667ce42f9ca1c1a13e1e61299927900845fc84
2016-04-26 15:41:43 -07:00
John Reck
8afcc76920 Revert "Revert "Make stopped state a first-class thing""
This reverts commit eab3f2658aa41d37c3b05d49a2ce4e3f4ed85399.

Fixes first-frame issue, mReportNextDraw needs to override
mStopped

Fixes: 28118961
Fixes: 27286867

Change-Id: I5c811759637d08ba9f3b342016d1b3006986d5a2
2016-04-14 10:39:03 -07:00
John Reck
d2eec0efb2 Merge "Framework-side of SurfaceView#getBitmap" into nyc-dev 2016-04-12 14:36:11 +00:00
John Reck
10dd0585c1 Framework-side of SurfaceView#getBitmap
Bug: 27708453

Change-Id: Ie6fd7eca522d3e6549d8af587c975fd7e6053649
2016-04-11 16:00:22 -07:00
John Reck
825fa4d5ae Merge "Revert "Make stopped state a first-class thing"" into nyc-dev 2016-04-11 20:54:36 +00:00
John Reck
eab3f2658a Revert "Make stopped state a first-class thing"
This reverts commit 945961f78a78eced823d5ba78505c781b079703d.

Change-Id: Iebc1d49fac33380233f8785fc39bec6c30a5e714
2016-04-11 20:49:28 +00:00
John Reck
c724dcf23c Merge "Make stopped state a first-class thing" into nyc-dev 2016-04-08 15:09:42 +00:00
John Reck
4a735441e8 Merge "Fix a derp" into nyc-dev 2016-04-08 15:09:26 +00:00
John Reck
a41f244515 Fix a derp
Fixes: 28074465

I knew I added that flag for a reason...

Change-Id: I6e28237dcd50191769a828bf2646c3a00c14387c
2016-04-07 16:36:57 -07:00
John Reck
945961f78a Make stopped state a first-class thing
Bug: 27286867

WindowManager has committed to stopped state
controlling the lifecycle of the Surface, so
make that a first-class thing in HWUI as well.

This makes it more resistent to things like
a rogue updateSurface() happening while mStopped=true,
leading to bad things down the line. Instead let
the surface be changed/updated as often as desired,
and just block any attempt to draw on that surface.

Also removes some unnecessary makeCurrent()s, as
EglManager ensures that we *always* have a valid
GL context now (using a pbuffer surface if there is
no window surface set)

Change-Id: Iead78ddebc7997e8fdb0c9534836352f5e54b9bd
2016-04-07 16:02:33 -07:00
John Reck
51f2d606dc Fix some edge cases
Bug: 27709981

This desperately needs a refactor, but to keep
the current (really needed & nice) behavior of
dispatching after sync finishes would be difficult
to handle cleanly without lots of ripping so... #yolo

Change-Id: I831a06c6ae7412a062720d68ecbe3085190f0258
2016-04-07 14:10:43 -07:00
John Reck
660108075e Expand JankTracker
Bug: 27922347

* Dump the full histogram
* Expand the histogram to have a slow-frame section with
  large 50ms buckets to raise the cap to 5s to give more
  insight into system-health
* Stop excluding first-frame metrics as we want to include
  those in our global tracking. Automated tests already filter
  these out by doing resets before running anyway.

Change-Id: Idaba8aad591f59d10a6477b11efc0767ff715083
2016-03-31 08:40:23 -07:00
Andres Morales
910beb8f5d updates to FrameStatsObserver API
- Rename to FrameMetrics to avoid collision with existing
  android.view.FrameStats class
- Make FrameMetricsObserver implementation detail,
  exposing FrameMetricsListener interface as public API
  and wrapping in FrameStatsObserver to maintain state
- Remove dropped frame count call, in favor of passing as
  parameter to callback method.
- Move away from raw timestamp access in favor of Metric IDs
  which represent higher-level, more stable stages in a frame
  lifecycle and match the categories exposed in the onscreen
  bars.
- Support many-to-many Window<->FrameMetricsListener relationship

Change-Id: I00e741d664d4c868b1b6d0131a23f8316bd8c5c2
2016-02-09 10:40:01 -08:00
John Reck
f648108f83 Have RT drive window positioning
Bug: 22802885

Change-Id: I6beed5474d3a943b16e9097f7bd61ce3cbd37505
2016-02-04 11:23:49 -08:00
Andres Morales
06f5bc70a6 expose hwui frame stats through FrameStatsObserver
Change-Id: I88884bafc8e2f6d7f67a36d3609490e83cf8afd5
2016-01-22 12:58:51 -08:00
John Reck
465eefb9f3 Merge "fix race condition between HWUI cache and renderThread" am: 2c2b5e8514
am: 4354ae9883

* commit '4354ae9883ae1282ac457539f46d529bdfa89fec':
  fix race condition between HWUI cache and renderThread
2016-01-19 18:42:21 +00:00
Thomas Buhot
c0a0e1a66d fix race condition between HWUI cache and renderThread
getMaximumBitmapWidth() and getMaximumBitmapHeight() of DisplayListCanvas
need HWUI cache instance. Since the initialization of the cache is
asynchronous it may crash if not yet ready. Add a staticFence() call
to guarantee the cache has been created prior issuing the call.

Change-Id: I5ed9e5cc084444c8d1872a77fef50e294ae14e93
Signed-off-by: Thomas Buhot <thomas.buhot@intel.com>
Signed-off-by: Zhiquan Liu <zhiquan.liu@intel.com>
2016-01-19 15:00:42 +08:00
Chris Craik
ff3edce12d Log render pipeline in gfxinfo dump
Change-Id: Ia50c445b29d918f274ec45632d61d8b8479c72eb
2016-01-14 10:29:38 -08:00
John Reck
bf4b31f7b2 resolve merge conflicts of 04ce46db64 to master.
Change-Id: I935bb47718f0e7d5fb48945dd8de6e28dac136e5
2015-12-16 11:07:53 -08:00
Thomas Buhot
0bcd0cb6b1 libhwui: make setSurface asynchronous
On the critical path of the cold launch of applications
the main thread of the started application tells the RenderThread
to create a surface. This process is synchronous and blocks
the main thread of the application until the creation
of the EGLContext is complete.
As a consequence the launch time of the application is delayed
by time spent allocating the EGL Context in the RenderThread.

With this optimization the launch time of any application
is improved (for example settings by 20 to 40 ms).

Change-Id: Ibf47aaa0abb8dedf7aa00693073db3785d9d6b08
Signed-off-by: Thomas Buhot <thomas.buhot@intel.com>
Signed-off-by: Zhiquan Liu <zhiquan.liu@intel.com>
2015-12-10 14:51:58 +08:00
John Reck
cba287b971 Fix threading issues
Bug: 25584167
Change-Id: I413ef9e0c86f7cca1f7d085e0071745ca0192853
2015-11-10 13:41:32 -08:00
John Reck
6b50780363 Remove almost-all android::Singleton users
Bug: 25426213
Change-Id: I88e6206e8915cce95c3a8a8a82a4bb8fbf668141
2015-11-03 10:09:59 -08:00
Chris Craik
0a24b146cd Add initial OpReorderer benchmarks
Change-Id: I6ca8ea89be2159331b2ad7031769c65f54161918
2015-10-20 17:19:33 -07:00
Skuhne
b816087962 Rendering the window frame with a second thread
Using a multi threaded render node to render the window frame
asynchronously from the application relayout.

Bug: 22527834
Bug: 24400680
Bug: 24459827
Bug: 24409773
Bug: 24537510
Change-Id: I1010fc6a8b6e38424178140afa3ca124433ab7e4
2015-10-02 07:11:45 -07:00
Skuhne
ea7a7fb75a MultiThreaded rendering of different renderNodes
This is adding the renderer side infrastructure to allow
rendering multiple render nodes with different threads.
This is a pre-step for decoupling a non client decor
resize reder from a content resize render.

Multiple render nodes can be added to be drawn, and to
prevent overdrawing, a content bounds area can be set

Bug: 22527834

Change-Id: Ie7271e20895bf38957e5a84aeefc883e282039ad
2015-09-21 07:18:00 -07:00
John Reck
e248bd1b2c Serializing display lists
This is a WIP prototype

Change-Id: Id4bfcf2b7bf905221c3734b7b6887c9b2efd37e6
2015-08-26 16:29:15 -07:00
John Reck
c36df95229 Re-enable -Werror on clang
Change-Id: I582bd0665752c7a9deb4f9de094d0dd0a50cda6a
2015-07-29 10:09:36 -07:00
Chris Craik
53e51e4aa9 Handle shader matrix correctly when ignoring canvas transform
bug:20063841

Restores old SkShader matrix behavior from before the Glop refactor.

Many drawing operations draw without sending the canvas transform to
the GL shader. In such cases, we need to adapt the matrix sent to the
SkShader logic to invert the canvas transform that's built into
the mesh.

Change-Id: I42b6f59df36ce46436322b95bf9ad2140795ee58
2015-06-02 16:28:39 -07:00
Alan Viverette
50210d9129 Adjust light source for window position
Bug: 16523629
Change-Id: I2f3fed1edcac0a3cfd5034aded45e08ececfebaf
2015-05-14 18:05:36 -07:00
Chih-Hung Hsieh
9eb9dd326a Fix clang warnings on unused variable, mismatched tag, print format.
BUG: 20890093
Change-Id: I91588f481d80b69823bc9d104b8bd09167ee5373
2015-05-07 12:30:13 -07:00
Chris Craik
356b177709 Merge "Cleanup properties" into mnc-dev 2015-05-05 21:30:08 +00:00