513 Commits

Author SHA1 Message Date
Greg Kaiser
a95435b836 RenderThread: Make ~IFrameCallback() virtual
IFrameCallback has a pure virtual method, but its destructor was
non-virtual.  While CanvasContext, which inherits from
IFrameCallback, declares its own destructor virtual, this is not
sufficient when accessing via an IFrameCallback pointer.

We fix this by making the base destructor virtual.

Test: Treehugger
Change-Id: I6424f90c16caea417b5f80b60d76a7ca7c7ef97c
2018-08-23 17:07:56 -07:00
Yu Jia
048c6751d7 Merge "cts case com.android.server.cts.GraphicsStatsValidationTest#testDaveyDrawFrame in modue CtsIncidentHostTestCases failed" am: 2dd3d8cbef
am: d490e788f1

Change-Id: I6e3507cfb5b6501dd28fb2b6019fdbb74fb745f0
2018-06-04 19:42:29 -07:00
John Reck
5b02c629bd Attempting to fix the black flicker
Bug: 79231206
Test: Repro steps from bug

Merged-In: I4c2810c42a7a4358f64584da3ab0cdf1499e71b6
Change-Id: I4c2810c42a7a4358f64584da3ab0cdf1499e71b6
2018-05-31 12:56:28 -07:00
Yu Jia
e57493ab19 cts case
com.android.server.cts.GraphicsStatsValidationTest#testDaveyDrawFrame in
modue CtsIncidentHostTestCases failed

This cts case design 20 frames, every 4 frames include 700ms frame and
150ms frame

When activity launched, first 3 frames need allocate buffer during
dequeue buffer, bug some low-end platform took too long (>6ms), so
it will skip the fourth frame(150ms) and post a new draw callback that will cause cts failed
2018-05-30 13:34:19 +08:00
Jorim Jaggi
e4a8d4c7e9 Merge changes I608d4b61,Ia7900e75 into pi-dev
* changes:
  Follow up to Ia7900e753b29187a7a7b81f393666687e8b8e04b
  Apply surface parameters in sync with RenderThread
2018-05-18 11:49:56 +00:00
Jorim Jaggi
64be98d5d2 Apply surface parameters in sync with RenderThread
Otherwise it could lead to parameters applied in the wrong frame,
leading to jank.

Test: Open notification
Bug: 78611607
Change-Id: Ia7900e753b29187a7a7b81f393666687e8b8e04b
Merged-In: Ia7900e753b29187a7a7b81f393666687e8b8e04b
2018-05-17 01:57:31 +00:00
Leon Scroggins III
4afdd1caa4 AnimatedImageDrawable: Eliminate unnecessary calls to redraw
Bug: 78866720
Test: Manual + systrace; existing CTS

Previously, we set hasAnimations to true when the AnimatedImageDrawable,
so that we would get a call to redraw. But if the image does not need to
show its next frame yet, the redraw was unnecessary.

Instead, add a new field to TreeInfo::Out, representing the delay time
until the image will need to be redrawn - i.e. when the duration of the
current frame has passed. Each call to prepareTree will post at most one
message to redraw, in time for the earliest animated image to be
redrawn. Post the message for one rendered frame ahead of time, so that
when it is time to show the next frame, the image has already gotten the
message to update.

On a screen with a single animated image, this drops the number of calls
to dispatchFrameCallbacks to as infrequent as possible. It is called
only when we need to draw a new frame of the image. On a screen with
multiple animated images, the calls may be redundant, but they will not
be more frequent than they would be without this change.

Switch to nsecs_t and systemTime internally, matching the rest of HWUI.

Remove mDidDraw and related. Its purpose was to prevent advancing the
animation while the image is not being drawn. But it isn't really
necessary. If it's not drawn, onDraw is not called, which is where we
trigger decoding. And onDraw already has a defense against getting too
far ahead - if its timer indicates that it should skip a frame or show
it very briefly, it will back up its timer. More importantly, mDidDraw
caused a bug, when combined with less frequent redraws. If the display
list containing the drawable doesn't need to be redrawn for other
reasons, the drawable's timer never advanced, so its animation stopped.

Fix software drawing. Compute the milliseconds in the future to draw the
next frame, and add that to SystemClock.uptimeMillis() to compute the
time to pass to scheduleSelf.

Change-Id: I13aab49922fa300f73b327be25561d7120c09ec4
2018-05-16 18:51:07 -04:00
Derek Sollenberger
551d08e2d5 Respect a Layer's (e.g. SurfaceTexture) colorSpace when compositing
This CL extracts the android_dataspace from the GLConsumer and converts
it to a SkColorSpace.  HWUI always expects to composite into an sRGB
destination so when we draw the layer we run the draw through a
colorFilter that converts the input colorSpace into that of the
destination.

Test: CtsViewTestCases
Bug: 78016220
Merged-In: Ic0446a0d861e86a5a9d0382346b57fcc45c8a61b
Change-Id: Ic0446a0d861e86a5a9d0382346b57fcc45c8a61b
2018-05-01 02:45:43 +00:00
Derek Sollenberger
92a9eb9713 Unpin bitmaps but don't purge all scratch resources.
This is a partial revert of b1f27aae89a9da9fbf3cb15a47f1a401db5a7974.

Test: hwui_unit_tests
Bug: 77654081
Change-Id: I5a58c156a280edfe3e9973ac3a8a30c97a2cff8b
2018-04-12 13:42:19 -04:00
Jorim Jaggi
767e25ed61 Add ability to change context priority of RT GL context
Test: Use method, observe GPU preemption behavior
Bug: 75985430
Change-Id: Idc08d37f8c95f52c5aab7edf09c0cbff72b8482d
2018-04-06 12:12:07 +00:00
Derek Sollenberger
b1f27aae89 Free up all scratch resources when the app's UI is hidden
Bug: 73808481
Test: hwui_unit_tests
Change-Id: I9f191c776a936c1be40702ff0924c7ad054526d5
2018-04-03 11:53:43 -04:00
Derek Sollenberger
0057db22fe Print detailed memory usage of Skia for dumpsys gfxinfo
Bug: 74435803
Test: adb shell dumpsys gfxinfo [package_name]
Change-Id: I1f2bcab500fb47c5e0b50c7459d4a876b063916b
2018-04-02 15:37:06 -04:00
Stan Iliev
216b1572b4 Better error reporting for createOrUpdateLayer
Pass error handler down to the pipeline object, which allows
skia pipelines to print cache memory usage.
In case of an error, print arguments that were used to invoke
SkSurface::MakeRenderTarget.

Test: Ran android build on a device
Bug: 76115654
Change-Id: I5baddfa66debd505eddc3117cf94aa6ae69bedaa
2018-03-28 13:49:21 -04:00
John Reck
6f75da0474 Remove old workaround for display issues
Bug: 76086140
Test: A bunch of systraces, things looked OK
Change-Id: I447e976a937160c0bb3b52afd57661e7ffa0c9ec
2018-03-21 14:43:40 -07:00
John Reck
564284759f Don't use IPC in isolateProcess
Fixes: 74395652
Test: hwuiunit passes in 'shell stop' state (pseudo-isolated process),
      manually checked non-isolated processes still have working vsync
      via systrace of RT animations demo

Change-Id: I630ea011dc7eb2efa265b25673d3304b3b2510d3
2018-03-16 17:34:02 -07:00
Stan Iliev
6c4b6e8b0e Fix a crash when grContext was deleted
Fix a crash when trimMemory has occurred and then a java
VectorDrawable object is deleted.

Test: Ran Camera app
Bug: 72837472
Change-Id: I4bdc5975a9ceccc09af17edd9905345f97c2660f
2018-03-02 14:41:08 +00:00
TreeHugger Robot
255ed5cbdc Merge "[Magnifier-26] Wire up frame callback for realsies" 2018-02-27 02:13:46 +00:00
Mihai Popa
9568800d90 [Magnifier-26] Wire up frame callback for realsies
Test: none yet
Bug: 73810478
Bug: 72041926
Change-Id: I7154ed4b3d2cd820dc8c8ff55eed130be87d1606
2018-02-26 11:23:27 -08:00
Greg Daniel
c9a8945477 Update call to null out GrVkAlloc in VulkanManager
Test: manual testing

Change-Id: Ia0af7526cad2dc4614afc73c31bf07e25890c677
2018-02-23 13:16:59 -05:00
Stan Iliev
a31973fe3a Create an empty stub for Vulkan readback
Create a stub for Vulkan readback. This avoids crashing,
because OpenGL readback does not work for Vulkan.

Test: Ran calc and gmail apps with skiavk pipeline.
Change-Id: I11cddde0a1efae1aa549e7a47d01051ec975f470
2018-01-12 11:50:29 -05:00
Rob Herring
4ee4d20908 renderthread: relax error handling for wide gamut EGL configs
It is valid to advertise EGL_EXT_pixel_format_float, but not have a
the requested EGL config. Instead of aborting, fallback to the default
behavior.

Change-Id: I6c602233b627dc2070364434fece57d3d0aab435
Cc: Romain Guy <romainguy@google.com>
Signed-off-by: Rob Herring <robh@kernel.org>
2017-12-13 14:30:21 +00:00
Rob Herring
74883abde3 renderthread: relax error handling for wide gamut EGL configs
It is valid to advertise EGL_EXT_pixel_format_float, but not have a
the requested EGL config. Instead of aborting, fallback to the default
behavior.

Change-Id: I6c602233b627dc2070364434fece57d3d0aab435
Cc: Romain Guy <romainguy@google.com>
Signed-off-by: Rob Herring <robh@kernel.org>
2017-12-12 16:41:27 -08:00
Greg Daniel
660d6eca99 Update GrContext creation calls to use sk_sp
Test: manual testing

Change-Id: I68d8706ffa7bc7c6622ea0b8c45d7297a131f6bf
2017-12-11 09:39:16 -05:00
John Reck
9f51644abf Extreme battery saver: Allow lowering framerate for experiments.
Bug: 68769804
Test: manual
Change-Id: Ic0c95f32c7ba6d86a997997e480e6d8a5f228f25
2017-12-06 13:59:19 -08:00
TreeHugger Robot
a18d357251 Merge "Switch RenderThread to a Java daemon thread" 2017-12-04 19:43:44 +00:00
John Reck
259b25a310 Switch RenderThread to a Java daemon thread
Bug: 69962494
Test: device boots, hwui unit tests pass
Change-Id: I9d5f2fccebf845328914c82aa97285cf605a4354
2017-12-01 16:35:06 -08:00
Stan Iliev
e75ef1fb3f Enable Skia shader cache
Enable Skia shader cache after fix for image and text drawing
issues were landed in Skia.

Test: Ran Hangouts, Settings, CNN, Drive, GMail, Calendar, Clock
Test: Maps, Docs, Play store, YouTube apps.
Change-Id: I94cd07e95b704bc164894aa8b8c63f49ded198f5
2017-11-29 18:28:47 -05:00
Stan Iliev
01b439475c Disable skia shader cache
Disable skia shader cache, which is causing image rendering
issues.

Test: Ran CNN app and images are OK.
Bug: 69264347
Change-Id: Ie81f3398074f28ac1670333f1fd3c95267b2beb3
2017-11-14 13:42:42 -05:00
John Reck
47f5c3a234 Fix leak of FILE* in dumping
Avoid fdopen as fclose, which frees the FILE*, will close
the FD which we don't want. Just normalize on dprintf instead,
and we can add buffering if it turns out to matter at some point

Test: ran 'dumpsys gfxinfo framestats' in a loop while observing PSS
Change-Id: I7808753641aa1055cfdf570c3e017017f11f1dee
2017-11-13 11:32:39 -08:00
Greg Daniel
74ea201548 Initialize pointer members in VulkanManager to null
Test: manual local testing

Change-Id: If81db17858354844b96677137cf67449dd91854b
2017-11-10 11:34:22 -05:00
Stan Iliev
d495f43992 Implement SkSL cache
Implement SkSL cache by reusing code and logic from egl_cache_t.

Test: Improves startup times for gmail by 15ms and 10ms for calc app.
Bug: 66740665
Change-Id: I9ba479c649ba97a2c29a48d40579ba001264c957
2017-11-08 18:55:41 +00:00
John Reck
1bcacfdcab Format the world (or just HWUI)
Test: No code changes, just ran through clang-format
Change-Id: Id23aa4ec7eebc0446fe3a30260f33e7fd455bb8c
2017-11-03 10:57:44 -07:00
John Reck
f8441e6552 Switch to a fancy new queue
Test: unit tests & benchmarks pass/faster

Change-Id: I9521432172d6dd6039c5280b1265479a36a86247
2017-10-27 13:39:55 -07:00
Stan Iliev
47fed6ba6a Fix crash in "Tree::updateBitmapCache"
Fix crash caused by updating vectordrawable cache for objects
from previous frames, which may have been deleted.

Bug: 67940327
Test: Ran CtsUiRenderingTestCases test
Change-Id: I4466235e78e9b7937a0d4428240574d9e3d0989f
2017-10-20 16:03:25 -04:00
Derek Sollenberger
843fb74ab5 Merge "Enable multi-threading of cpu intensive tasks when using Skia pipelines" 2017-09-14 20:58:01 +00:00
John Reck
91cf84cda2 Merge "Fix flicker from multiwindow resize" into oc-mr1-dev am: facdce3ab2
am: a0c211120a

Change-Id: I701b817d0109c650069d445548280bec4193729d
2017-09-11 22:00:02 +00:00
John Reck
f138b174fd Fix flicker from multiwindow resize
Move content bounds into DrawFrameTask. This ensures
that changes in bounds are synchronized with changes in
rendering commands, avoiding potential underdraw.

Bug: 64200212
Test: Repro steps in bug. Drag up/down on resize handle, verify
no flicker.

Change-Id: I3109acf262e23c2a7d8904f1dcbfc8273aaed65b
2017-09-08 11:00:42 -07:00
Derek Sollenberger
8ec9e88cda Enable multi-threading of cpu intensive tasks when using Skia pipelines
Test: CtsUiRenderingTestCases
Change-Id: Ifa36371f55d3f2d78faf0a23fb283c904ff1af5f
2017-09-08 10:24:27 -04:00
Brian Osman
da6ad83507 Change how distance field paths are disabled
The path renderer bitfield will soon be private (for Skia testing
only), so switch to using the public flag.

Test: Simple refactoring change, still builds
Change-Id: I6715ba8addd0e104a46842f2398320d1904bb187
2017-08-30 09:33:44 -04:00
Stan Iliev
6b894d7746 Release VectorDrawable cache surface on render thread
Release VectorDrawable cache surface on render thread.
This is fixing an assert in skia GrSingleOwner.h:33.

Test: Ran gmail before and after the change.
Bug: 64842607
Change-Id: I46e0c2557ac5b2fc3be2cc2d35abf96f6d6c9399
2017-08-25 10:25:11 -04:00
Stan Iliev
dd098e8d78 Disable VD shared atlas surface
Using a shared atlas surface is causing a variance in AA pixels
when drawing the same content. This is causing some CTS tests in
CtsPreference2TestCases to fail because of up to RGB(1,1,1)
difference in AA pixels in screenshots of a recreated activity.
Another effect is reducing memory usage ("GL mtrack" down by
10MB for clock app).

Test: Ran CtsPreference2TestCases tests.
Bug: 64487466
Change-Id: I1e5a547285c885136b6885d129d566d5b0c2ed76
2017-08-09 14:55:36 -04:00
Stan Iliev
3310fb1b24 Cache VectorDrawables in an atlas
Optimize VectorDrawables for Skia pipeline: draw small VectorDrawables
in a GPU atlas instead of seprate offscreen buffers.
This implementation is using CacheManger and allows for the atlas to
be released if there is a memory pressure.

Test: A new unit test for VectorDrawableAtlas is passing. Systrace shows
0.5ms faster DrawFrame for fling in Settings app main screen.
Change-Id: Ide3884eefae777e1547f1dfdb67b807185839fb4
2017-07-18 19:00:15 -04:00
Greg Daniel
ac2d232f21 Update to use GrBackendTexture/RT instead of Descriptors
Test: manual testing

Change-Id: Ide727a39e2c49f226c8d432608e0072214249451
2017-07-12 11:48:00 -04:00
Romain Guy
26b6a64953 Use EGL_EXT_gl_colorspace_scrgb instead of *_linear
Since hwui output non-linear scRGB data in wide-gamut, use
the scRGB-nl extension instead of scRGB.

Bug: 62951776
Test: Manual, CtsGraphicsTestCases
Change-Id: Ifdb288e777d12b790b93624ccea9b4f1f6966e52
2017-07-11 09:48:28 -07:00
John Reck
34781b2530 Move frame history into jank tracker
Test: hwui_unit_tests & manual
Change-Id: If761947652750640268217cd8cd97c8382441b44
2017-07-05 16:48:09 -07:00
Derek Sollenberger
c970184c15 Merge "Revert buffer age workaround for Adreno GPUs." 2017-06-15 12:54:23 +00:00
TreeHugger Robot
9ae7bb7aa3 Merge "Use RGBA16F layers when wide color gamut rendering is on" into oc-dr1-dev 2017-06-14 22:50:43 +00:00
Romain Guy
07ae505d40 Use RGBA16F layers when wide color gamut rendering is on
Layers created using View.setLayerType() or Canvas.saveLayer() need
to be RGBA16F/scRGB-nl when within a window that requested wide color
gamut rendering.

Bug: 29940137
Test: CtsUiRenderingTestCases, CtsGraphicsTestCases, hwui_unit_tests
Change-Id: I42fd6355448c92041491a7109e3ac8a153d38bf9
2017-06-14 13:44:08 -07:00
John Reck
94ed3c84d6 Merge "Add a workaround for simulate secondary display" into oc-dev
am: 31443a17e8

Change-Id: Ib248882df61f0d45b7687726c1a57de6c289a9b5
2017-06-14 20:27:09 +00:00
Derek Sollenberger
b5a12bd1b9 Revert buffer age workaround for Adreno GPUs.
We now have a fix in the driver so we don't need this workaround
any more.

Test: hwuimacro savelayer2 --onscreen
Bug: 31957043
Change-Id: I8d8a4abcfa809d0cdab3bf63d7f8255febf2aa06
2017-06-14 15:23:19 -04:00