Commit Graph

336 Commits

Author SHA1 Message Date
Alec Mouri
026106f6d6 [HWUI] Add null check for CanvasContext
If ReliableSurface is forced to acquire a fallback buffer then the
Surface may be abandoned. When getting frame timestamps we need to check
that the Surface still exists.

Bug: 152262035
Test: builds, boots
Test: dumpsys gfxinfo
Change-Id: Ifdb198ebf74cc9dc681c4ab51c4901176a7f5fc9
2020-03-26 18:09:53 -07:00
Alec Mouri
43fe6fcde5 [HWUI] Remove references to gui/Surface.
ANativeWindow usage now has enough feature parity so that we can use
that instead.

Bug: 137012798
Test: builds
Test: Scroll through settings
Change-Id: I0054315058b28bcb5e779a6f71a3cfb164625a5f
2020-02-14 15:24:16 -08:00
Alec Mouri
c9d5f3d952 [ANativeWindow] Rename allocateBuffers to tryAllocateBuffers
Renaming was done in response to API feedback.

Bug: 148962594
Test: builds
Change-Id: I05b3e99800d967dda243b6e7af48f1b645909bdd
2020-02-13 13:58:50 -08:00
Derek Sollenberger
3109b4cc47 Merge "Ensure SkiaPipeline always has a valid colorspace." 2020-02-06 19:47:24 +00:00
Alec Mouri
ff07c8fd76 [HWUI] use native_window timestamp apis
These aren't finalized as stable yet until we sort out some BufferQueue
challenges.

Bug: 137012798
Test: builds
Change-Id: Icd5eb02afc4cf16a2be485e6710f71818b300b9d
2020-02-06 08:09:30 -08:00
Derek Sollenberger
1863d94e9a Ensure SkiaPipeline always has a valid colorspace.
Previously we didn't assign a colorspace to the pipeline until it
was provided a surface to render into.  This resulted in undefined
behavior if the application attempted to render an offscreen layer
before the OS provided the main window with its surface. Now instead
of deferring setting whether or not the application is wide gamut we
do initialize it to a default setting when the pipeline is created.

Bug: 148042673
Test: apct/device_boot_health_check_extra_postsubmit
Change-Id: I84d743511e949ac977486470bb14eec936de7f88
2020-02-06 07:41:50 -05:00
John Reck
869cb2ad7e Merge "Adjust present time calculation" 2020-02-05 20:39:54 +00:00
John Reck
56cffe5b6a Adjust present time calculation
Adjust the target present time when using
render_ahead to better fit in the gaps between
vsync pulses. This prevents small clock
drifts from causing jank.

Bug: 143540628
Test: manual, looked at systrace
Change-Id: I26ae6ebf16a3dea48dfd8e1c420d9e5e43e42bcb
2020-02-03 16:47:12 -08:00
Alec Mouri
80c7ef17db [HWUI] Use ANativeWindow_getNextFrameId api.
This is part of the work to move away from gui/Surface and onto
ANativeWindow in HWUI.

Bug: 137012798
Test: builds
Change-Id: I5862d7833b583b8295d1677e725ed58d97808b27
2020-02-03 10:25:24 -08:00
Alec Mouri
c2a6537fb9 [HWUI] Hook up ANativeWindow_allocateBuffers
Bug: 137012798
Test: builds
Change-Id: Iefe7b73470cb6229fc72d1a1aa33eceb827f527c
2020-01-30 18:28:48 -08:00
Alec Mouri
f023a323de [HWUI] Use ANativeWindow inteception methods in ReliableSurface
Test: boots
Test: manually test with opening and scrolling through settings app
Change-Id: I8d7a44d3ead0b2350318e1514153e256f97ccca5
2020-01-30 18:26:41 -08:00
Stan Iliev
e0fae2356b Add memory tracing in HWUI
Add ATRACE memory counters to track memory usage at the end
of each frame in HWUI.
There are 3 catagories: CPU, GPU and Texture memory.
There are 3 more counters for memory that can be purged.
This CL deletes GpuMemoryTracker class, which implemented
similar function for Android O HWUI renderer.

Test: Collected systrace with gmail and setting.
Test: memory tracing adds ~0.1ms per frame when ATRACE is enabled
Bug: 146580770
Change-Id: Icbcc0478bc426dff578e83726fe7c95df171ed93
2020-01-10 16:14:39 +00:00
John Reck
cd18c2271d Fix for Surface#lockHardwareCanvas lockups
By avoiding setting a dequeue buffer timeout we avoid
hitting a different path in BufferQueue that prevents
async behavior from happening. This restores P's
behavior in this path.

Bug: 143860379
Test: repro app in bug
Change-Id: Iffbd9f9e6689a40876ff3aa74c10020e3f09fc6a
2019-11-21 15:16:08 -08:00
Stan Iliev
10689992cf Fix an issue with GPU stats not enabled
Invoke Surface::enableFrameTimestamps after eglDestroySurface.
eglDestroySurface internally disables time stats. Order is
important, when CanvasContext::setSurface is invoked with
a surface, that is already current (which happens all the time).

Test: ran UiBench microbenchmark tests
Change-Id: I3d023c3a87da6329c556426d553c744e541b9dff
2019-11-13 11:48:04 -05:00
Alec Mouri
05955610a0 Merge "[HWUI] Get DeviceInfo through stable ABI" 2019-11-07 17:15:47 +00:00
Nick Desaulniers
b451d87468 [frameworks][base][hwui] re-fix -Wimplicit-int-float-conversion
A new instance snuck in since I haven't completed the platform toolchain
upgrade yet. There was imprecision in this call; accept it by making the
implicit cast explicit.

Bug: 139945549
Test: mm
Change-Id: Id704d9741b480eba4cf3955e70119d935776faf6
Signed-off-by: Nick Desaulniers <ndesaulniers@google.com>
2019-11-04 17:18:51 -08:00
John Reck
4145919ef9 Fix wrong surfaceRequiresRedraw check
We only need to redraw if the size /changed/ not
if it was the same. Also fix damageId to not use
frameNumber as repeated redraws of the same frame
would toggle.

Bug: 143711430
Test: systrace
Change-Id: I8ac4629c9ff4fd51de33d1be7aa46ccc995ba342
2019-10-31 15:04:58 -07:00
TreeHugger Robot
b051671aa3 Merge "[HWUI] Use ANativeWindow_get{Height, Width}" 2019-10-29 09:39:18 +00:00
Alec Mouri
da819e47f1 [HWUI] Use ANativeWindow_get{Height, Width}
gui/Surface will eventually be removed since HWUI needs to depend on a
stable ABI, so use the NDK methods for querying width and height that
operates on ANativeWindow instead.

Bug: 137012798
Test: builds
Change-Id: I1309e31992190e7b44c6ea83f962f372b6b0afcf
2019-10-25 16:18:16 -07:00
Alec Mouri
22d753f74d [HWUI] Get DeviceInfo through stable ABI
This also removes the dependency on ui/DeviceInfo other than in test
code.

Bug: 136263392
Bug: 136263238
Test: builds, boots
Change-Id: I6a4687e981359f0e6beb83be8a5501ed7fd16f15
2019-10-25 13:30:42 -07:00
John Reck
83161dcd6a Delete VectorDrawableAtlas
Poking around in a few apps it doesn't appear that
the VectorDrawableAtlas is achieving sufficient
utilization to justify its existence. The potential for
draw call merging doesn't seem warranted for the
RAM cost of the atlas.

Bug: 137853925
Test: builds
Change-Id: Id2419bc6dccb6316636d50c568f8fac75a2d563f
2019-10-04 14:49:20 -07:00
John Reck
8a207962ec Drop all caches in UI_HIDDEN
Bug: 137853925
Test: none
Change-Id: Idf7002d9b07cc6b71b38ce76e7b6382100279a99
2019-10-04 13:30:51 -07:00
Alec Mouri
6e1271be3f [HWUI] Remove nanosecond conversion from duration queries.
Now that they return nanoseconds, there's no reason to lose precision.

Bug: 137012798
Test: builds
Change-Id: I52ca20cb010b4f1829596e0a765b7013ae3665ca
2019-09-06 11:45:01 -07:00
Alec Mouri
672e9b0ce6 [HWUI] Use ANativeWindow_setDequeueTimeout
Don't use the ReliableSurface version now that we have an APEX stub.

Bug: 137012798
Test: builds
Change-Id: I63d1d9d2ff60b54a75d5b4865a63eb22ac347208
2019-09-06 11:44:52 -07:00
Alec Mouri
8d0c5bd200 [HWUI] hook in ANativeWindow_getLastDequeueStartTime
Bug: 137012798
Test: builds
Change-Id: I37fd2a7c40398053082f606f0a085db0a239e2e0
2019-09-06 11:44:42 -07:00
Alec Mouri
7ea41b6975 [HWUI] use ANativeWindow_getLastQueueDuration api
Replaces the query call with an abi-stable one.

Bug: 137012798
Test: builds
Change-Id: Ia8f01c3be0b79037cef88782913af55f6d00a6a2
2019-09-05 13:00:48 -07:00
TreeHugger Robot
85e6ff9b77 Merge "[HWUI] use ANativeWindow_getLastDequeueDuration api" 2019-09-04 18:54:34 +00:00
Mike Reed
39adc88fef use rect version of join, the other is deprecated
Test: make

Change-Id: I29f4ff6cea209ac5c053a525ff06cd1bfea6c9c0
2019-08-29 13:39:43 -04:00
Alec Mouri
8d45174361 [HWUI] use ANativeWindow_getLastDequeueDuration api
Replaces the query() call for getting the duration of the internal
dequeue() call a call that will be abi stable.

Bug: 137012798
Test: builds
Change-Id: I6d2118a7c093dd2ecc4ebfb4b4ee8556f7e709a7
2019-08-20 10:28:42 -07:00
Stan Iliev
7203e1f55a Add GPU draw stats to gfxinfo and GraphicsStatsService
Test: ran dumpsys with gfxinfo and graphicsstats
Change-Id: Id9950de87dc4343c6878baa6a6dd42fbc8aeddef
2019-08-01 18:53:21 +00:00
John Reck
59dd2ea974 Fix ReliableSurface to be more reliable
Handle TIMED_OUT better by rescheduling (TODO: give up after N
attempts?)

Fix SYNC_SURFACE_LOST_REWARD_IF_FOUND path to actually go fetch
a new surface.

Bug: 137509524
Test: Injected errors randomly, verified nothing got permanently dead.
Change-Id: Id30f8ad1dd7196041ee84c16c8cf5c814002a6ce
2019-07-26 16:58:37 -07:00
John Reck
296c5ef20e Merge "Increase dequeueBuffer timeout" into qt-r1-dev am: 5ab5cd7aa2
am: 6769f25c17

Change-Id: I13931cd14fead1141acbea5cef8deb61a6c9119e
2019-07-22 12:51:21 -07:00
John Reck
3f333d6d72 Increase dequeueBuffer timeout
Timeout recovery isn't working properly, so increase it
to avoid any false-positives from something like a
slow screen-on

Bug: 137509524
Test: none
Change-Id: Ic4fae04b41f71600479f9557e334f67c27851db4
2019-07-18 10:48:49 -07:00
Fedor Kudasov
6bdd90f70d Remove unused (mostly GL-related) headers
Bug: 117921091
Test: all tests should pass
Change-Id: I419aafd30bfc19f2180eedf924bbd55d5cd36170
2019-06-27 17:11:37 +00:00
Jerome Gaillard
e218c69285 Replace CLOCK_MONOTONIC with SYSTEM_TIME_MONOTONIC
Using SYSTEM_TIME_MONOTONIC works for Android (where it translates to
CLOCK_MONOTONIC) and host targets, while CLOCK_MONOTONIC is not defined
on macOS.

Bug: 117921091
Test: existing tests should pass
Change-Id: I1fad472881830fb0701a320cf37319e083932ad4
2019-06-14 12:07:36 +00:00
Miguel de Dios
509627ba33 Revert "hwui: ro.hwui.render_ahead=0 queue on high FPS"
This reverts commit f802abe47f.

Reason for revert: We're seeing jank increase after this patch.

Change-Id: Ic8d77df3fbbeeedeed4b8f31737454d9c056f8b0
Bug: 132733305
2019-05-14 23:56:21 +00:00
Kevin DuBois
f802abe47f hwui: ro.hwui.render_ahead=0 queue on high FPS
ro.hwui.render_ahead was behaving the same as -1 when it was set
to zero. Correct it so that ro.hwui.render_ahead will queue frames
when set to zero on any display rate FPS.

Fixes: 131340980
Test: Test presence or not of timestamps with -1,0,1,2 settings
Change-Id: Ibd1974253e947130fb03a0b86f599e0e5f5eac38
2019-04-25 16:05:01 -07:00
John Reck
cf185f5b0d Dynamically adjust renderahead
Tracks refresh rate changes and adjusts renderahead
based off of the active refresh rate.

Default is 60hz = 0 render ahead & > 70hz is render ahead 1

Bug: 127822449
Test: systraced stuff

Change-Id: I9849aa065262f21f7602d44cd1761373279dc28d
2019-04-18 14:20:56 -07:00
Leon Scroggins
949305fe52 Merge "Do not cache AVDs that are off screen" into qt-dev 2019-04-16 12:15:16 +00:00
John Reck
0fa0cbcade Support render-ahead in vulkan
Bug: 127822449
Test: verified render_ahead working with skiavk
Change-Id: Iae1b227a763f6def035057f38cca4b0ab65c7e82
2019-04-12 13:33:25 -07:00
Leon Scroggins III
6c5864c098 Do not cache AVDs that are off screen
Bug: 128805564
Test: Manual + systrace; hwui_unit_tests; CtsUiRenderingTestCases

Only update a VectorDrawable's cache if it is onscreen. This fixes a
Twitter use case where the app has a ProgressBar that is exactly one
pixel offscreen. Prior to this CL, we repeatedly drew the ProgressBar's
AVD to a GPU surface, even though we clip it out later and never draw
that GPU surface. Now, we recognize that the AVD is outside of the
bounds of the screen, so we never draw to the GPU surface.

TreeInfo:
- store the size of the screen, retrieved from
  CanvasContext::getNextFrameSize.
SkiaDisplayList:
- Store the matrix at the time of recording a VectorDrawable. Concat
  that with the current matrix to determine whether the VD is on screen,
  based on the TreeInfo. If it is offscreen, do not add it to the list
  of AVDs that need to be updated ahead of rendering.
- In addition, if it is offscreen (or not dirty), do not call
  setPropertyChangeWillBeConsumed(true). This prevents triggering
  dispatchFrameCallbacks to update on the RenderThread when there is no
  need to. This also mimics what would happen if the View/RenderNode had
  been completely offscreen.
- Add a method to append an AVD to mVectorDrawables. Now that the vector
  is of Pairs, this simplifies the call sites. Add a second helper to
  just add an AVD without a matrix, for use in tests.
SkiaRecordingCanvas:
- get the current matrix and store it in the display list along with the
  AVD.
CanvasContext:
- add getNextFrameSize, for reporting the size of the next frame without
  dequeuing it
VectorDrawable.cpp:
- call quickReject to potentially short circuit drawing. This is for a
  hypothetical use case (verified in a test app) where the containing
  RenderNode is partially onscreen, but the AVD itself is not. Even
  without the change to VectorDrawable.cpp, we skip uploading to the GPU
  cache, the SkiaDisplayList still attempts to draw it. This change
  keeps us from drawing it at all.
SkiaDisplayListTests.cpp:
- Now that I've hidden mVectorDrawables, call the new public APIs.
- prepareListAndChildren test
  - for the clean VD, assert that getPropertyChangeWillBeConsumed
    returns FALSE. This is due to the behavior change that we do not
    set it unless the VD is dirty.
  - set the bounds, so our onscreen check works.
- Add another test for prepareListAndChildren, which puts VDs offscreen.

Change-Id: Iae0a07adcf58e7884e0854720de644e7b2faf2bf
2019-04-12 14:31:31 -04:00
John Reck
4d527226fd Add back render-ahead support
Currently only supported in the EGL path.
Vulkan support Coming Soon

Bug: 127822449
Test: trace of hwuimacro
Change-Id: Iac2b039e11d964aab5b8ca1bdf2a5430b187e2ea
2019-04-04 18:03:35 +00:00
John Reck
09e2fbe605 Merge "Remove old TaskManager system" 2019-03-18 20:31:22 +00:00
John Reck
322b8ab774 Remove old TaskManager system
Replace it with a newer, fancier, WorkQueue-inspired
one that's just a global common thread pool.

Test: hwuiunit passes
Change-Id: Ib5d03104a08bbac9a4ec67a1bfc0db2b35d6700f
2019-03-18 09:34:11 -07:00
John Reck
3c0f563786 Fix profile gpu bars to use display fps
Also adds a 'good' bar at 80% threshold
and a 'bad' bar at 150% threshold (where triple
buffering would start to get iffy)

Fixes: 127371028
Test: eyeball'd it

Change-Id: I109cd293f87f8cb9c8f1e66d49fb8fb2188b0bec
2019-03-15 16:49:25 -07:00
John Reck
0b19a7370a Re-enable empty damage drop optimization
Fixes: 113796161
Test: device seemed to behave correctly?
Change-Id: Id43e1eaad29d07c06c1003c0653e5d1ee7084cfe
2019-03-07 17:18:25 -08:00
John Reck
283bb46846 New WebViewFunctor API
Should function alongside existing functor API.

Bug: 120997728
Test: hwuiunit passes
Change-Id: I8f6143d0be1111431b55016f34de319f6b8c8910
2018-12-14 14:07:18 -08:00
John Reck
848f651554 Revert "Revert "Make HWUI's surface Reliable^TM""
This reverts commit dd08224e4d.

Bug: 120097554
Bug: 120342364
Bug: 120421537

Test: verified emulator can boot OK, with no log warnings
Test: verified keyboard works in landscape

Change-Id: Iae2cd1140d81755b126adfb21ec885181f3bc6b6
2018-12-06 15:18:27 -08:00
John Reck
46045217e3 Remove dead code
No longer needed

Test: none
Change-Id: Id260e4a2b1026b9ccd853f277f5e527fb7568f69
2018-12-03 14:58:28 -08:00
Bo Hu
dd08224e4d Revert "Make HWUI's surface Reliable^TM"
This reverts commit 650bd9a7b3.

Reason for revert: broken emulator b/120342364

Exempt-From-Owner-Approval:

Change-Id: If05d9d87325e1d836375d7dc79ff66ef057d228d
2018-12-03 13:59:49 +00:00