Commit Graph

680 Commits

Author SHA1 Message Date
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
Ady Abraham
9c501aad4b DisplayEventDispatcher: use eConfigChangedDispatch
In order to get DISPLAY_EVENT_CONFIG_CHANGED, eConfigChangedDispatch needs
to be used when creating DisplayEventDispatcher.

Bug: 131688378
Test: adb shell /data/nativetest64/libsurfaceflinger_unittest/libsurfaceflinger_unittest
Test: trigger config change and observe logcat
Change-Id: I0de8037ee5b024b7d9729750f582be919087be41
2019-06-07 10:26:47 -07:00
Miguel de Dios
515e7a7464 Merge "Revert "hwui: ro.hwui.render_ahead=0 queue on high FPS"" into qt-dev 2019-05-15 21:06:07 +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
Greg Daniel
13a31b2648 Merge "Remove workaround in VulkanSurface for missing vendor flag." into qt-dev 2019-05-14 21:32:29 +00:00
Greg Daniel
cdfc90231c Remove workaround in VulkanSurface for missing vendor flag.
Test: manual building and testing
Bug: b/128923272
Change-Id: I6be67fddbbf06d4eb7efe316f7e6fd12157e2852
2019-05-14 09:25:41 -04:00
Kevin DuBois
1a4bce9917 Merge "hwui: ro.hwui.render_ahead=0 queue on high FPS" into qt-dev 2019-05-10 15:08:10 +00:00
John Reck
4b5e5551ba Be quiet
Fixes: 131863240
Test: logcat
Change-Id: I0276082b949f9521a804a4c1ef8af2148b69621b
2019-05-02 17:10:46 -07:00
John Reck
8538ceba82 Merge "Fix some force_dark prop behaviors" into qt-dev 2019-04-25 23:37:05 +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
8915167a88 Fix some force_dark prop behaviors
* Make it persist.hwui.force_dark so the dev option
  survices reboots.

* Remove the internal super-override behavior it applied
  using only the intended ViewRootImpl theme-aware behavior.

Fixes: 127350499
Fixes: 130354206
Test: set dev option, verified nothing went dark. Set dark
theme, verified non-dark apps were force-darked. Rebooted
and verified property still set.

Change-Id: I43adcbc25320669510fb03b162c98cbd14612f55
2019-04-25 10:59:23 -07:00
Greg Daniel
f58e51b4e3 Merge "Fix deletion of VkSemaphores in VulkanManager." into qt-dev 2019-04-24 23:30:35 +00:00
Greg Daniel
d92a9b158e Fix deletion of VkSemaphores in VulkanManager.
We were deleting the VkSemaphore objects too quickly when
importing/exporting the semaphores. Even though the semaphore payload
gets reset on these operations the VkSemaphore still needs to be
finished its use in Vulkan before being deleted.

Test: manual build and testing of vulkan apps and vulakn ImageConsumer
Bug: b/130643604
Change-Id: I7f03087e477d812c0174ede3a10f12dc1df72ee1
2019-04-23 14:36:37 -04:00
Greg Daniel
68406a2dd5 Merge "Make sure to sync GPU after deleting memory in trimMemory." into qt-dev 2019-04-23 16:52:06 +00:00
John Reck
eecc52d796 Merge "Dynamically adjust renderahead" into qt-dev 2019-04-22 19:18:53 +00:00
Greg Daniel
1d857f03f7 Make sure to sync GPU after deleting memory in trimMemory.
On GL some devices may not delete gpu memory immediately after calling
delete and instead will just queue it up. We must call glFinish to
make sure the memory is deleted when we want it.

More importantly Vulkan memory will not be freed until the GPU is done
with all the work. Thus we require an additional flush to make sure the
previous gpu work we submitted has finished and we can delete the
memory.

Test: manual testing on device
Bug: b/130440975
Change-Id: I2a9202dd7d15d97b365120a8caf9e10b4100efc3
2019-04-22 13:43:06 +00:00
Derek Sollenberger
b9e296e18f Update the CPU text cache sizes to be the same as their GPU equivalents
Bug: 130684261
Test: uibench jank tests
Change-Id: Ieb837afd76d1990c796baa9794ba54a83b8cd46f
2019-04-19 15:29:48 -04: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
TreeHugger Robot
8d8d704cf7 Merge "Fix set_buffers_damage in VulkanSurface" into qt-dev 2019-04-15 21:00:08 +00:00
John Reck
08ca2a2560 Merge "Support render-ahead in vulkan" into qt-dev 2019-04-15 18:20:28 +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
John Reck
321d8e538d Fix set_buffers_damage in VulkanSurface
Fixes: 130363483
Test: `setprop debug.hwui.renderer skiavk` and ensure
      surface damage in dumpsys surfaceflinger is expected
      in portrait & landscape orientations.

Change-Id: I973c47038e534c86f38112de7b863477d982d150
2019-04-12 13:06:11 -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
Derek Sollenberger
4670126b86 Respect the hardware buffer usage flags set by the consumer.
Test: CtsUiRenderingTestCases
Bug: 130121294
Change-Id: Ie77dee104fa8935978dfd6c0c506d2995f20cd79
2019-04-08 20:31:16 +00: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
TreeHugger Robot
0c682d04bd Merge "Add workaround for qualcomm vulkan AHDARDWAREBUFFER_USAGE_VENDER_0" 2019-04-02 13:37:05 +00:00
Greg Daniel
2173f1890c Add workaround for qualcomm vulkan AHDARDWAREBUFFER_USAGE_VENDER_0
Test: manual building and testing on device. Bugs related to lack of
flag go away.
Bug: 128923272
Change-Id: I2457988c097d73020162947c346a8716d373185e
2019-04-02 13:21:28 +00:00
TreeHugger Robot
d91a716cf3 Merge "Don't load EGL driver always" 2019-04-01 17:32:35 +00:00
TreeHugger Robot
b51fda1bc3 Merge "Invalidate Skia shader cache if Vulkan driver has changed" 2019-04-01 16:49:26 +00:00
Stan Iliev
30b9096352 Don't load EGL driver always
EGL driver is preloaded only if HWUI renders with GL.

Test: Ran several apps, passed CtsGraphics and CtsUiRendering
Change-Id: Ib38d6f51a19a2ee3631c7d9c99283286c389e476
2019-04-01 15:20:06 +00:00
TreeHugger Robot
4cb02be4c8 Merge "Fix NATIVE_WINDOW_MIN_UNDEQUEUED_BUFFERS handling" 2019-03-30 00:31:22 +00:00
John Reck
fbeac3c39c Add missing trace points
Test: traced opening recents
Change-Id: I51675f1c49f27f1bfa5b18e3d3dd7162e58b1cb8
2019-03-29 11:24:56 -07:00
Stan Iliev
bf99c4450b Invalidate Skia shader cache if Vulkan driver has changed
Test: Ran apps several time and observed shader cache validation
Change-Id: I7c2620b9a0eefcb7acedc86647ecf44805518b2f
2019-03-29 11:18:21 -04:00
John Reck
ac513c2fde Fix NATIVE_WINDOW_MIN_UNDEQUEUED_BUFFERS handling
Fixes: 123541940
Test: CTS HardwareRendererTests#testLotsOfBuffers
Change-Id: I5d96e615f552c4faa0e6dcaaaa828c871eaf6c8e
2019-03-28 16:57:38 -07:00
Stan Iliev
bc5f06bdaa Fix crash after dequeueNativeBuffer fails
Anytime dequeueNativeBuffer fails, it sets mDequeuedIndex to -1.
This is causing a crash latter, when getCurrentSkSurface tries
to index mNativeBuffers[mDequeuedIndex].
This CL removes mDequeuedIndex and improves Vulkan swapchain
error handling.

Test: Ran Camera app
Bug: 129024275
Change-Id: Ieeb685c3a1b33f23ce2334d286199a44ace53165
2019-03-26 15:14:34 -04:00
TreeHugger Robot
8f8deb20b3 Merge "Use VkAndroidHardwareBufferUsageANDROID to compute HWUI usage flags" 2019-03-22 04:19:44 +00:00
Derek Sollenberger
31c1b82ad7 Use VkAndroidHardwareBufferUsageANDROID to compute HWUI usage flags
Bug: 128923272
Test: atest CtsUiRenderingTestCases
Change-Id: I27db1a35b77fb654ab738520bee6734f6a62cc4f
2019-03-21 13:24:26 -04:00
Stan Iliev
197843d031 Block GPU on dequeue fence only if it has not signalled already
When Vulkan pipeline dequeues next frame at the beginning of
DrawFrame, the dequeue fence has been signalled in most cases.
This CL avoids additional work and saves about 0.3ms per frame.
There is no need to create VkSemaphore and commit an empty command
buffer to the queue if the fence has already signalled.

Bug: 128998567
Test: Ran systrace on SelfieCity and observed better performance
Change-Id: I3532b785fae90308d922a29f1698f5dbcbd79079
2019-03-21 12:25:08 -04:00
Stan Iliev
3e99fa7a27 Block GPU on release fence from dequeueBuffer earlier
If dequeueBuffer fence has not fired yet, then submit to the queue
and block GPU on VkSemaphore immediatelly.
It is not clear why this CL makes a difference, because semaphore
was already waited on.

Fixes: 128805387
Fixes: 128806388
Fixes: 128807485
Fixes: 128879779
Fixes: 128417453
Bug: 128998567
Test: Ran SelfieCity, Camera360, Settings app
Change-Id: I880ba6fa65509ba4c6faca0dc933551efcee423b
2019-03-21 12:21:08 -04:00
Stan Iliev
ee3754ab24 Fix TextureView glitch and memory leak
Keep EglImage/VkImage alive until the last SkImage object using
it is destroyed.
Fix memory leak with GL pipeline only, caused by destroying
EGLImage on the wrong thread.
Make sure cached SkImage dtor is invoked on RenderThread.

Bug: 128523183
Bug: 128688107
Test: Ran settings app, systrace and CTS
Change-Id: I32c14c7174a2a97e54fbfaa49dffb4e9a160f90d
2019-03-20 03:23:22 +00:00
Greg Daniel
c073252f76 Add support for uploading to AHBs using Vulkan.
Test: manual build and testing on blueline.

Change-Id: I240a5f1e3ba34677b03131eba36ffd8783d99041
2019-03-19 10:09:53 -04: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
TreeHugger Robot
51d6f3d498 Merge "Fix profile gpu bars to use display fps" 2019-03-16 03:05:47 +00: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
TreeHugger Robot
f296a878bf Merge "Copy extension names to an owning container to prevent use-after-free" 2019-03-12 03:58:01 +00:00
Roman Kiryanov
74ace839e0 Copy extension names to an owning container to prevent use-after-free
Bug: 127660235
Test: make -j
Change-Id: I3748b7b4b51f99acf59748675223cef02c22bee2
Signed-off-by: Roman Kiryanov <rkir@google.com>
2019-03-11 16:07:20 -07:00
Derek Sollenberger
3b049dec9f Merge "Directly manage buffer presentation in Vulkan using AHardwareBuffers." 2019-03-11 12:50:13 +00:00
Derek Sollenberger
a19b71a54a Directly manage buffer presentation in Vulkan using AHardwareBuffers.
Instead of relying on Vulkan swapchains this CL enables HWUI to directly
manage the native window.  This allows us to preallocate buffers using
our own strategy as well as having no longer having to jump through an
unecessary translation layer that resulted in code that was hard to
reason about and also introduced inefficiencies.

Bug: 123541940
Bug: 119687951
Test: CtsUiRenderingTestCases and CtsGraphicsTestCases
Change-Id: I7e5930748795e7ca4a998ab2c608c3c9b6363037
2019-03-08 09:25:35 -05:00