70 Commits

Author SHA1 Message Date
John Reck
760051854e Improve picture capture debug path
* Fixes hardware bitmap capture
* Fixes mutable bitmap capture (no flickering)
* Adds basic single-frame LRU cache to avoid
  repeated readbacks of GPU resources
* Does up-front readback of GPU resources
* Moves serialization off RenderThread again thanks
  to up-front readback avoiding needing GPU access
  off-thread
* Reduces RAM usage & improves performance by serializing
  directly to output stream instead of first copying to
  a byte[]

Bug: 174223722
Test: PictureCaptureDemo mirrors the content
Change-Id: If7ec208b61d5b917e82087cc312880fc5a38c943
2021-06-11 01:52:14 +00:00
rnlee
ce9762b57f Use TraceUtils.h from gui shared library.
Test: It makes
Bug: 183120308
Change-Id: I331262dd2da59817031f0c708f4c102041dcb5e0
2021-05-22 00:12:43 +00:00
Greg Daniel
be2803a817 Remove flushAndSubit from SkiaPipeline renderFrame.
Previously we would submit a command buffer for the
frames draws and then immediately submit a second
command buffer that had no commands and just an attached
semaphore. This merges those two submit calls into Skia
into one call.

Test: manual running of system of benches
Bug: 175913056

Change-Id: If0d054960de8b459814cbfa9289756f8ee9d4a93
(cherry picked from commit f16ba6019400ec7eb6ac7a2adc05ec06ad5661a1)
2021-03-01 13:56:45 +00:00
John Reck
b36bfddb1e Wire-up colorMode="hdr"
Fow now it uses a fixed white point of 150nits
TBD if this is disabled or adjusted

Test: Demo app
Change-Id: Iac13597b3d7633fdef3feaf7ec1da0c27c87904c
2020-07-30 08:54:03 -07:00
John Reck
8ddbc59d55 Avoid excessive KGSL maps
Hook MIN_UNDEQUEUED_BUFFERS if possible to avoid thrashing kgsl
maps when render_ahead is being used

Bug: 143555869
Test: verified kgsl maps only happened once per buffer
Change-Id: I985fae0a9a7635be3a1cf6177186e5541a1169df
2020-05-07 16:47:10 -07: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
Fedor Kudasov
90df056f4d Split lighting out of SkiaPipeline
ReorderBarierDrawables includes SkiaPipeline just for the sake of
lighting, however SkiaPipeline brings much more unnecessary
dependencies. Splitting lighting our of SkiaPipeline should
make dependency resolution simpler.

Bug: 117921091
Test: all tests should pass
Change-Id: I6adf7c43555cfa3ff7090a1197fc11160d3a85ec
2019-06-19 16:37:56 +00:00
John Reck
4b5e5551ba Be quiet
Fixes: 131863240
Test: logcat
Change-Id: I0276082b949f9521a804a4c1ef8af2148b69621b
2019-05-02 17:10:46 -07: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
Brian Osman
e0cf597556 Remove use of SkColorSpace::Gamut enum
Get the gamut matrix from the color space, compare against sRGB/P3.

Test: Refactoring CL.
Change-Id: I9f5bcae8c1f637919ee9da892266ea882f16208c
2019-01-24 16:05:05 +00:00
Greg Daniel
c407678982 Add support for preTransform in Vulkan swapchain.
Test: manual building and running of apps.
Bug: 110985606
Bug: 122662274
Change-Id: Id53aa1ce028b448b1f12558eec78a60e09512166
2019-01-18 18:56:44 +00:00
Derek Sollenberger
25833d29ac Standardize the surface origin for each HWUI pipeline.
OpenGL prefers a bottom-left origin while Vulkan prefers the
top-left. Prior to this change we were inconsistent in Vulkan by
creating layers with a bottom-left origin which was different from
the primary buffer.

Test: CtsUiRenderingTestCases
Change-Id: Icfeed4085021cae941aeab58720406e3b3e37923
2019-01-14 13:55:55 -05:00
Peiyong Lin
3bff135503 [HWUI] Remove hardcoding around wide color gamut.
Previously we hardcode wide color gamut in HWUI as scRGB color space with FP16
pixel format. However, the hardware composer doesn't support this combination.
This patch plumbs wide color gamut composition preference from composer API to
HWUI such that HWUI can now pick the combination of color space and pixel
format for the surface.

BUG: 111436479
Test: Build, flash and boot, verify with a demo app.
Change-Id: I7a8b4d8deca72ef40069dba9d23a3f5e90dbfe5a
2018-12-15 09:35:25 -08:00
John Reck
848f651554 Revert "Revert "Make HWUI's surface Reliable^TM""
This reverts commit dd08224e4d75689c42bf452d44617f84072649a1.

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
Bo Hu
dd08224e4d Revert "Make HWUI's surface Reliable^TM"
This reverts commit 650bd9a7b35139354916d2522b59cc57eb5fddc3.

Reason for revert: broken emulator b/120342364

Exempt-From-Owner-Approval:

Change-Id: If05d9d87325e1d836375d7dc79ff66ef057d228d
2018-12-03 13:59:49 +00:00
John Reck
f0732618f0 Merge "Make HWUI's surface Reliable^TM" 2018-11-29 23:23:00 +00:00
John Reck
650bd9a7b3 Make HWUI's surface Reliable^TM
You won't believe this one weird trick to make
EGL_BAD_ALLOC errors never happen again! libgui
hates it!

Bug: way too many to list
Test: none - there probably should be, though
Change-Id: I8e7fc3e584f90c01e0fd932497604a1d93710ba6
2018-11-28 13:39:07 -08:00
Derek Sollenberger
5fdb83b2a3 Merge "Set the color space to sRGB on the Surface and remove colorFilter." 2018-11-28 19:40:22 +00:00
John Reck
8e539ca15c Add a sprinkle of speculative anti-crash dust
Bugs: way too many
Bug: 113367810
Test: well it builds...
Change-Id: If00bcaad1c535c4996b59c1b5a7d3a4bba849191
2018-11-15 15:22:29 -08:00
Derek Sollenberger
d01b5916d8 Set the color space to sRGB on the Surface and remove colorFilter.
Also for a canvas wrapping a bitmap the colorspace of the bitmap
will be used to correctly blend content.

Test: CtsUiRenderingTestCases
Bug: 111436479
Change-Id: I63ad7a30605a7f725cc0ef4716d42ea978fb03e3
2018-11-07 20:56:28 +00:00
Peiyong Lin
189021b408 Partially revert "[HWUI] Implement legacy color mode."
Reason for partially revert: Step back a little bit to think about how we want
to move the view system forward.

This patch removes the legacy mode we have added, as well as move color type
and color space of the surface to SkiaPipeline.

BUG: 111436479
BUG: 113530681
Test: Build, flash, boot and check dumpsys SurfaceFlinger

Change-Id: I1ab7b88d41347284d87649618e5a15f5c6bcf8fe
2018-09-27 18:00:52 -07:00
Derek Sollenberger
28a4d9935c Refactor RenderState and remove unused functionality.
Test: hwui_unit_tests still pass
Change-Id: Ie943671535ab8c5da1bac05985e815e0cb842dc1
2018-09-20 14:47:08 -04:00
Derek Sollenberger
5a5a648b69 Fix crash when EGLSurface is no longer valid.
The EGLSurface stored in the pipeline can become obsolete if the
EglManager/RenderThread has to destroy the context.  This CL enables the
RenderThread to notify all active pipelines that their surface is invalid.

Bug: 115290937
Test: hwui_unit_tests
Change-Id: Ib3054822273bc35406630b7442229a81b39a2c91
2018-09-20 13:35:19 -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 a683eb3945320f592f58705c3c31b3c044f4bd72.

Bug: 113673613
Test: Ran TextureView CTS and lensblur in camera app
Change-Id: If3bcf9cd5195de09fd67a753708568a8e3ca3a9a
2018-09-05 01:58:34 +00:00
Stan Iliev
a683eb3945 Revert "Revert "Revert "TextureView Vulkan support and optimized OpenGL draw"""
This reverts commit 85f9096b5272c9a39e592e2e97cbbe6cb0e767ab.

Reason for revert: lensblur broken.

Change-Id: I83ac163159fc537bc15936a0f8597a7512ca9d6e
2018-09-04 15:42:18 +00:00
Stan Iliev
85f9096b52 Revert "Revert "TextureView Vulkan support and optimized OpenGL draw""
This reverts commit 867c43de0544217d26c3ee18f4d6603bb2ea97ce.

Reason for revert: Fixed issue with unsupported hardware buffer formats by landing https://skia-review.googlesource.com/c/skia/+/150470 "Support more hardware buffer formats"

Bug: 113673613
Change-Id: I1f7c528f138e290160e75833c8d989d9535002ee
2018-08-31 22:13:15 +00:00
John Reck
867c43de05 Revert "TextureView Vulkan support and optimized OpenGL draw"
This reverts commit c8e22a653297837da9a80b0ba65f6854c8986c96.

Reason for revert: broke camera, b/113555199

Bug: 113555199
Change-Id: Iae9b462694d5de0cd99427afead63b567fb4d71d
2018-08-30 18:42:08 +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
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
John Reck
437f6fb15c Verify gralloc supports fp16
Bug: 77973662
Test: builds
Change-Id: Id8a53885178d698c7b2fd6fc5ea8d4e36ce2ef15
2018-05-07 08:14:43 -07:00
Derek Sollenberger
ecbb314486 Support readback of TextureView into 565 and extended sRGB. am: 2324991a77
am: 1babd54e4c

Change-Id: Idad79c50a32cdb4c65042da13d08eb68a27fcd6c
2018-05-04 12:05:59 -07:00
Derek Sollenberger
2324991a77 Support readback of TextureView into 565 and extended sRGB.
Bug: 78906699
Test: CtsViewTestCases
Change-Id: I89e8544a883dcb3eb222c164ab57d20e55a073c3
2018-05-04 18:46:52 +00: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
android-build-team Robot
635dc181ed Merge "Respect a Layer's (e.g. SurfaceTexture) colorSpace when compositing" 2018-04-30 21:05:29 +00:00
Derek Sollenberger
be3876c434 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
Change-Id: Ic0446a0d861e86a5a9d0382346b57fcc45c8a61b
2018-04-30 15:53:46 -04: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
Leon Scroggins III
9ce6bf9cc0 Merge "Fix Skia's impl for TextureView.getBitmap" into pi-dev am: 5d27097739
am: 6eb88411e6

Change-Id: I04f782a456997f6946a1ea258dea964ffd1b59f2
2018-03-30 14:36:40 +00:00
Leon Scroggins III
1a12ab26d4 Fix Skia's impl for TextureView.getBitmap
Bug: 73392905
Test: New test added with I2d4ef440f943a50b9367976ba1444f4350071bfd

When providing a width and height, getBitmap should scale to the
destination. Add a parameter to LayerDrawable::DrawLayer for a
destination rectangle to scale to. Pass the size of the bitmap in
SkiaOpenGLPipeline::copyLayerInto down to DrawLayer. The only other
caller of DrawLayer is unaffected.

Change-Id: I7aa192181c2d15bc8fd4de2fb15c4d276b05d2ac
2018-03-29 19:30:28 +00:00
Greg Daniel
c9da8e8b4b Convert Skia calls to use SkColorType/BackendFormats instead of GrPixelConfig.
Test: manual testing

Change-Id: I645bcea55f49292309cf0bb5de21891bb5b62dda
2018-03-21 18:09:59 +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
Derek Sollenberger
4170db32c0 Fix CtsViewTestCases when running on swiftshader emulators.
Test: CtsViewTestCases
Bug: 64478761
Change-Id: Ie85d25054c2f426cc88cf512c166c175b894a8fe
2017-08-09 13:58:38 -04:00
Derek Sollenberger
fb0c8fc3d5 Enable colorspace conversion while perserving legacy blending.
When requesting an SkImage from a android::Bitmap we will also
return a colorFilter that will perform the sRGB conversion at draw
time.

Bug: 62347704
Test: CtsUiRenderingTestCases, CtsGraphicsTestCases, CtsViewTestCases
Change-Id: Icc4694e2c42605e29fcc834c252bc21263bac658
2017-07-27 10:52:11 -04:00
Stan Iliev
08fc19af87 Use F16 render target when wide color rendering is enabled
Support F16 render targets in Skia pipeline. Enable readback from
F16 surface.

Test: device boots with Skia pipeline
Change-Id: Ib31e618be1a987de3736987a496c799693923594
2017-07-26 09:27:29 -04:00
Stan Iliev
0a3ff952a6 Improve color correctness for drawing bitmaps with Skia pipeline
Fix drawing of bitmaps with color profiles. This CL is making
ColorSpaceTests and Rgba16fTests CTS tests to pass with Skia
pipeline. Drawing bitmaps withs pixels outside SRGB range
may need more work (ColorSpaceTests#testDrawDisplayP3 test use a
a wider gamut, but the actual pixels fall into the SRGB range).

Test: Ran CtsUiRenderingTestCases with HWUI and Skia pipeline.
Bug: 62347704
Change-Id: I8d318076bb38f7d32bfde7e5492ae7a61f4731a5
2017-07-19 09:22:39 -04:00