Commit Graph

567 Commits

Author SHA1 Message Date
Derek Sollenberger
17662389b9 Refactor DeviceInfo in HWUI
Remove the need for both Vulkan and EGL managers to initialize
it. Also remove unused code paths.

Test: hwui_unit_tests
Change-Id: I33ad881468eddbf91ec63207f0d82bed8d97f5ad
2018-09-18 09:30:13 -04:00
John Reck
0ee549d67b Merge "Disable GLES validation" 2018-09-15 00:31:22 +00:00
John Reck
bdc9f1bb90 Disable GLES validation
Need to disable this for SurfaceTexture users specifically
but the quickest is to just disable it globally

Bug: 115311435
Test: builds
Change-Id: I75daddf993c784238593db3d40126af0e9d0ffdc
2018-09-14 15:34:22 -07:00
Peiyong Lin
1f6aa122a5 [HWUI] Implement legacy color mode.
Previously, HWUI always produces SRGB buffers. We introduced new APIs for
SurfaceFlinger, a.k.a. the composer service to return to composition preference
for data space, and pixel format. This patch makes HWUI query composition
preference from composer service, and creates the corresponding EGL surface
with the correct attributes.

In legacy mode, HWUI will take the pixel value from source color space, and
interpret it as pixel value in destination color space.

BUG: 111436479
BUG: 113530681
Test: Build, flash, boot and check dumpsys SurfaceFlinger
Change-Id: I64562d5ea6f653076c8b448feb56b5e0624bc81c
2018-09-13 13:50:27 -07:00
Stan Iliev
1a025a7163 Refactor HWUI readback code to be backend independent
Implement readback from Surface, TextureView and HW Bitmap
for Vulkan pipeline by wrapping the graphics buffer in an SkImage.
Refactor both Vulkan and GL readback to use common code.
TextureView readback is moved from IRenderPipeline interface to
Readback class. Refactor all 3 readback flows to use common
implementation.

Test: Passed all view, uirendering and graphics CTS tests with GL
Test: Passed many CTS test with Vulkan, that require readback
Bug: 113673613
Change-Id: Ifbfd8170a5401f87a709b4b1b9fa058e8e11768d
2018-09-10 13:18:04 -04:00
Stan Iliev
564ca3e2c9 Reland "TextureView Vulkan support and optimized OpenGL draw"
Fix an issue with incorrect texture matrix, when there is 90/270 rotation.
This happened, because after refactoring SkImage has buffer width/height,
instead of layer width/height.
This reverts commit a683eb3945.

Bug: 113673613
Test: Ran TextureView CTS and lensblur in camera app
Change-Id: If3bcf9cd5195de09fd67a753708568a8e3ca3a9a
2018-09-05 01:58:34 +00:00
Yichi Chen
9f95955620 Add cache validation to ensure the validity
Create cache identity from GL_VERSION and store in ShaderCache.
In the next time ShaderCache is restored from disk, compare the
cache identity to ensure its validity. If GL_VERSION changes in
between, flush out entire FileBlobCache and start from an empty
one.

Bug: b/71800782
Test: Wrote a new unit test to save and restore ShaderCache
Test: hwui_unit_tests
Change-Id: Ie573dc4f18733eee090725be30445d879765231b
2018-09-04 04:04:58 +00:00
Stan Iliev
e6cfb09cc4 Merge "Revert "TextureView Vulkan support and optimized OpenGL draw"" 2018-08-30 18:56:41 +00:00
John Reck
867c43de05 Revert "TextureView Vulkan support and optimized OpenGL draw"
This reverts commit c8e22a6532.

Reason for revert: broke camera, b/113555199

Bug: 113555199
Change-Id: Iae9b462694d5de0cd99427afead63b567fb4d71d
2018-08-30 18:42:08 +00:00
TreeHugger Robot
54b9892f3c Merge "TextureView Vulkan support and optimized OpenGL draw" 2018-08-29 15:51:15 +00:00
Stan Iliev
c8e22a6532 TextureView Vulkan support and optimized OpenGL draw
Render TextureView as hardware bitmaps, instead of GL textures.
Cache SkImage for each observed GraphicBuffer, which is faster
even for GL.
Implement C++ SurfaceTexture, which allows Java SurfaceTexture
to be used with Vulkan HWUI render thread and application GL.
threads. Delete GLLayer and VkLayer classes and texture code
from old HWUI pipeline.

Test: Ran skiagl and skiavk pipeline with a TextureView app.
Test: TextureView CTS tests pass for GL pipeline.
Test: Ran Android NDK Native codec sample app.
Change-Id: Idc94f864ce2d34fd6ceff4be4fc7d3327e99879c
2018-08-29 10:22:03 -04:00
Greg Kaiser
f15c333ddc Merge changes Ie072511b,I6424f90c am: 9d10637e01 am: ddedd24e96
am: 57d7cabbf5

Change-Id: Ic92512281269ceedbbfb197e1d7d0a230bf2317f
2018-08-24 15:54:32 -07:00
Greg Kaiser
ddedd24e96 Merge changes Ie072511b,I6424f90c
am: 9d10637e01

Change-Id: I06ca7319633534e38b45ab960f285a072cff84da
2018-08-24 15:38:07 -07:00
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
Greg Daniel
7fd08795de Merge "Update VulkanManager to use new skia Vulkan context api." 2018-08-20 20:11:46 +00:00
Greg Daniel
a227dbb322 Update VulkanManager to use new skia Vulkan context api.
Test: manual build and run on phone.
Change-Id: Ib21f4091cf11de5655323337e86a35cb7b845b15
2018-08-20 13:23:41 -04:00
Derek Sollenberger
333a83c02f Prefer ES 2.0 with external image support vs ES 3.0 without that support
We currently attempt to use ES 3.0 shaders even if it lacks the
extension for external images.  This CL reverts back to ES 2.0 in
the event that we find that the OES_EGL_image_external_essl3 is not
present.

Test: no change in graphics output
Bug: 111220579
Change-Id: I6bd7145026d9686cfcf49393a19580208db8a367
2018-08-15 10:17:45 -04:00
Greg Daniel
22cc59dd3a Have the framework setup android defines for including vulkan.h
We're moving skia to place where it has its own vulkan header and
the clients have theirs. So this sets up the VulkanManager to be
able to handle including vulkan.h how it wants to.

Test: manual building and running

Change-Id: I0818d2fc607bf8a265bf6ddf1e2f737d1228131a
2018-07-24 13:47:48 -04:00
Jorim Jaggi
edf3e1fa2e Merge "Move allocateBuffers to RT" into pi-dev am: 2f8a3a4bb8
am: c9756c9193

Change-Id: Ieed40312fe16a54c3e1974621b53e29b23ddcdbc
2018-07-18 15:19:39 -07:00
Jorim Jaggi
c9756c9193 Merge "Move allocateBuffers to RT" into pi-dev
am: 2f8a3a4bb8

Change-Id: I6c8f84406a40fa324a4486f71fccf01f6acfe60a
2018-07-18 15:06:29 -07:00
Jorim Jaggi
7823ee73ee Move allocateBuffers to RT
Such that it gets executed after setSurface, in order that
mReqUsage has the correct flags set.

Test: Take trace, ensure that allocateBuffers actually allocates
in the right format/usage by ensuring that dequeueBuffer doesn't
trash them immediately again.
Bug: 111517695
Change-Id: I94b402d7b29d565155a77a2d09106246261712d2
2018-07-17 17:34:49 +02:00
Greg Daniel
4aa5867051 No longer create a GrVkInterface in the VulkanManger.
Test: manual

Change-Id: I5debded1f42cab60bacd3b9b9d2f10ada088c86a
2018-07-13 14:04:55 -04:00
Stan Iliev
5d03348436 Fix path rendering issues
Fix remaining battery icon. Disable CCPR, which seems to
have caused a regression.


Test: Ran SystemUI and battery icon is drawn white.
Bug: skbug.com/8127
Change-Id: Ic82bce14b760a8889ea2261c44b2631dc755288f
2018-07-03 19:50:06 +00:00
Greg Daniel
2f9d8670e3 Remove unused member in VulkanManager.
A large part of the previous change was specifically around removing
this ref counted data member, and then I just forgot to delete it...

Test: manual testing

Change-Id: Ie9a7f7495789d45a65900c08a27a9d83ad64617c
2018-06-22 11:46:18 -04:00
Greg Daniel
2ff20271a4 Manually create and manage vulkan instance and device.
Previously we were using a helper in Skia but that is being deleted
and we must manage it ourselves in android.

Test: manual building and running.
Change-Id: Ia3455507d7b07a4a2f29fd5453408dd37d9d570b
2018-06-21 15:07:41 -04:00
Yu Jia
c4d7698190 Merge "cts case com.android.server.cts.GraphicsStatsValidationTest#testDaveyDrawFrame in modue CtsIncidentHostTestCases failed" am: 2dd3d8cbef am: d490e788f1
am: 048c6751d7

Change-Id: I89d6290789324a38a28de5e03bd139e450297b23
2018-06-04 19:52:48 -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
John Reck
cc2eee89c8 Attempting to fix the black flicker
Bug: 79231206
Test: Repro steps from bug

Change-Id: I4c2810c42a7a4358f64584da3ab0cdf1499e71b6
2018-05-31 19:55:54 +00:00
John Reck
e4c1e6c5a1 Remove dead code
Test: builds
Change-Id: I57cf72ca460115463d7759097d5ba598b5ec1775
2018-05-30 16:40:07 -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
Leon Scroggins III
117f0c2833 Merge "AnimatedImageDrawable: Eliminate unnecessary calls to redraw" into pi-dev am: a2113aa4ad
am: 6353ff5bb5

Change-Id: I5258721b49834aba58e9bf19162e6a4588f68f0f
2018-05-17 13:16:13 -07: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
Jorim Jaggi
7a5addd2b7 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
2018-05-15 17:31:33 -07:00
John Reck
e170fb6686 A better HW Bitmap uploader
Move all HW bitmap upload operations off of RenderThread.
Ensure EGL context outlives all upload requests

Bug: 79250950
Test: builds, boots, systrace is good, CTS bitmap tests pass

Change-Id: I5ace6c516d33b1afdf1a407cd8b183f6b60c22c1
2018-05-09 11:39:37 -07:00
Mike Reed
e7f688bd01 remove BakedOps and much of renderstate
Test: make

Change-Id: If070b7436b848c6840abfac5f051b0f5b6cb17ce
2018-05-04 15:21:49 -04:00
John Reck
d9d7f127b5 Delete a bunch of code
This removes the duality of DisplayList, removing a small amount of
overhead

Test: buids & hwuiunit passes

Change-Id: I8bb3a20e9ead1caec4b4a8a3e9f2c08f717a7096
2018-05-03 15:25:19 -07: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
John Reck
b5fc209b35 Remove unneeded pipeline check
Test: none
Change-Id: I1123567c51efff3eef6c09f76c1624e48f71c802
2018-04-30 14:43:22 -07:00
John Reck
b90d4cb3be Move all non-GL HW Bitmap work off RT
Bug: 78288006
Test: hwuiunit passes, systrace showed work distribution as expected,
and photos using HW bitmaps still works

Change-Id: Id3285b637b5d74d3c5891ed3051ac1e44015987a
2018-04-27 12:39:45 -07:00
John Reck
1e51071240 Remove RenderThread from EglManager
Refactor to make EglManager re-usable.

Test: hwuiunit passes, hwuimacro works

Change-Id: Ie8e9398c703fada1dc5d8baca5f42485eadea202
2018-04-26 13:46:12 -07:00
John Reck
1a4a981199 Revert "Add support for render-ahead"
This reverts commit ec100976e0.

Reason for revert: b/77971494
Test: hwuiunit passes

Change-Id: I2e7dc719d2df1dd939b275496c0edc38e458c434
2018-04-18 16:18:17 -07:00
John Reck
80e73eee08 Merge changes Ie7b336ea,I36a8cb45
* changes:
  Remove Properties::isSkiaPipeline (3/!?)
  So long OpenGLPipeline & OpenGLReadback (2/??)
2018-04-17 21:18:39 +00:00
Derek Sollenberger
c5e6a080bb Merge "Unpin bitmaps but don't purge all scratch resources." into pi-dev am: 1c70ecb455
am: b22ffad7f6

Change-Id: Ib5b59f780003b30b43219288b4153b20b2db1032
2018-04-16 10:43:12 -07:00
John Reck
1072fffddb Remove Properties::isSkiaPipeline (3/!?)
Test: hwuiunit & CtsUiRenderingTestCases pass
Change-Id: Ie7b336eacdd1b8660e09653c64eb6ea0a7b4a258
2018-04-12 15:21:21 -07:00
John Reck
44627c264f So long OpenGLPipeline & OpenGLReadback (2/??)
Hello EglReadback

Test: hwuiunit & PixelCopyTests pass
Change-Id: I36a8cb45b11141b09e75a2e978ed13e336425625
2018-04-12 13:58:13 -07:00
Derek Sollenberger
92a9eb9713 Unpin bitmaps but don't purge all scratch resources.
This is a partial revert of b1f27aae89.

Test: hwui_unit_tests
Bug: 77654081
Change-Id: I5a58c156a280edfe3e9973ac3a8a30c97a2cff8b
2018-04-12 13:42:19 -04:00
Greg Daniel
1834a8cf04 Update to use new skia getBackendRenderTarget calls.
Test: manual building and running.
Change-Id: I0c38f4b9817c8e855ecc8f08cb2b297c5fbfc01a
2018-04-12 12:22:43 -04:00