Commit Graph

236 Commits

Author SHA1 Message Date
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
Derek Sollenberger
89f170c5ad Respect HDR/HDR10 colormodes in HWUI Vulkan backend
Test: SilkFX
Bug: 184283931
Change-Id: I724eb683a03f7ada4561c245aca5fffe7b6a5ac9
2021-04-01 16:37:16 -04:00
Mike Reed
ca556363be ColorFilter::getFlags() is deprecated
See https://skia-review.googlesource.com/c/skia/+/382702

Test: make

Bug: 178700363
Change-Id: I0ae9d19439ea577c002463145b9f8404b4201f1b
2021-03-11 19:48:11 +00:00
Mike Reed
0f9dce7ed5 Custom looper code for Android
Test: make

Bug: 178700363
Change-Id: I1d328275ab5e0c9b6b9171ef075f71274e50a3f5
2021-02-17 11:30:21 -05:00
John Reck
9a7c192ebe Remove two macros
This is colliding with ag/13519705 and causing
build issues. So replace the macros with constexpr's which are
better

Bug: 179047472
Test: make
Change-Id: Icf7c38077ef608ec97e737d47d3d6c25246190bf
2021-02-08 19:32:21 -05:00
John Reck
f42ff762f2 Allow controlling the SDR white point
Test: this
Change-Id: I9ee059afd73ca0850e41072c068c9effe8362382
2020-08-06 17:32:10 -07: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
Edgar Arriaga
1af13c8110 Optimization for isZero to reduce processor instructions
Results showed an improvement of ~0.58% of app cpu-cycles that happen
mostly within RenderNodeDrawable::onDraw hits this path every frame during view
drawing traversal. At the assembly code level, the fabsf fuction is
instrinsic and replaced by a single instruction which is the reason this
code is more optimal.

Did further benchmarking with a binary that contained a for loop
iterating on calling this function and the cpu-cycle results obtained are:

Overhead  Shared Object                                   Symbol
16.87%    /data/local/tmp/edgartest                       isZeroOld(float)
9.66%     /data/local/tmp/edgartest                       isZeroNew(float)

where isZeroNew is the proposed function, and we can see it is ~40% faster
than the old method.

Test: Ran hwuimacro benchmarks and also did some benchmarking with my
own binary

Change-Id: I68b7db1bf501a3faa669ad5b7d3807ad9cb8798e
2020-06-24 13:10:34 -07:00
Mike Reed
7ac1af37c0 switch to kDisplayP3 enum
This has the same values as kDCIP3, just a more accurate name.

See skbug.com/9792

Test: make

Change-Id: Id775857f08247c49033e8c2fe0c3255dfc44cace
2020-05-26 14:54:18 +00:00
Dheeraj Shetty
8fdfbde0c8 Merge "Revert^2 "hwui: remove FatVector"" into rvc-dev am: 21b6e912c2 am: efe501a989 am: 2d83890dc0 am: 745cfdc765
Change-Id: I1ed19bdd3f7312ecdb14f741ed7491083944fc78
2020-05-02 00:07:22 +00:00
Jagadeesh Pakaravoor
b624af3dca Revert^2 "hwui: remove FatVector"
Revert submission 10449863-revert-fatvector

Reason for revert: b/149254345

Original change (of introducing FatVector) was reverted as a stop-gap solution to fix the aforementioned bug.

The bug was caused by an ABI lock between Surface's definition (that changed with Region) and lib-imsvt prebuilt.

Enabling this change now as we have re-compiled the prebuilt with the change enabled. Doing that via a revert of the revert.

Reverted Changes:
I8ac66acb8:Revert "hwui: remove FatVector"
Ib60dbf3ef:Revert "libui: rewrite Region with FatVector"

Original changes:
I09dc2fddd:hwui: remove FatVector
I265c6c831:libui: rewrite Region with FatVector

bug: 149254345

Change-Id: I9fb5e8908434abb9a763992e922445a2dc37e865
2020-05-01 15:57:15 +00:00
Derek Sollenberger
3fedf5a7e2 Remove unecessary exported symbols from libhwui.so
Test: compiles and links
Bug: 150782769
Change-Id: Ib49c1bf914b6bfaad1fb29371115df7c9eec08d2
2020-04-09 14:26:16 -04:00
Automerger Merge Worker
b26d082710 Merge "Revert "hwui: remove FatVector"" into rvc-dev am: e3c130ac0e am: 7741b69004 am: ce5a52610f am: 5c40415287 am: 8d17a16fb8
Change-Id: I1d1da2b7caf927856fb9d91c952461b776fe1aa6
2020-03-06 02:05:40 +00:00
Tim Murray
894f132ba0 Revert "hwui: remove FatVector"
Revert "libui: rewrite Region with FatVector"

Revert submission 10248126-fatvector-region

Reason for revert: b/149254345
Reverted Changes:
I09dc2fddd:hwui: remove FatVector
I265c6c831:libui: rewrite Region with FatVector

also fix wrong license in FatVector.h

Test: boots
Bug: 149254345

Change-Id: I8ac66acb8b635324051edd41c5d4092c223157ff
2020-03-05 12:15:40 -08:00
Alec Mouri
4523801b9a [HWUI] remove libui from HWUI's dependencies
Bug: 136263238
Test: builds
Test: interact with device
Change-Id: I18540f78a4ee5ffcc30c96ff7862480e1d8fe50a
2020-03-01 05:29:54 +00:00
Tim Murray
0865f2e7b2 hwui: remove FatVector
FatVector now lives in fw/native/libs/ui.

Test: builds, boots, works
Bug: 149096186
Change-Id: I09dc2fddd2a238ef47d7853b64b0bfbf74d3f71f
2020-02-07 17:57:44 +00:00
Leon Scroggins III
d256790d13 Move ABitmap_getDataSpace into hwui to share with AImageDecoder
Bug: 135133301
Test: android.graphics.cts.BitmapTest#testNdkDataSpace

Change-Id: Ib54523a16a3ac9149a6b072489d97a39f8cc1564
2020-01-19 11:52:49 -05:00
Leon Scroggins III
700629d8c0 Support more dataspaces in DataSpaceToColorSpace
Bug: 135133301
Test: ?

Create an SkColorSpace for HAL_DATASPACE_TRANSFER_ST2084 and
HAL_DATASPACE_TRANSFER_SMPTE_170M. This allows converting
ADATASPACE_BT709, ADATASPACE_BT2020, and ADATASPACE_BT709 into
SkColorSpaces. In addition, treat HAL_DATASPACE_DCI_P3 (aka
HAL_DATASPACE_DCI_P3) specially, because its gamut does not match
SkNamedGamut::kSRGB.

This will allow Ia8ba4c17b517a05b664c6e317e235836473fd7f6 to use
DataSpaceToColorSpace, rather than its own, slightly different version.

Change-Id: I24fffd79c2bf251c28c2d0b8c3d2889dbffa772d
2020-01-16 14:21:49 -05:00
Mike Reed
15760c9db7 switch to new SkPathDirection enum
Test: make

Change-Id: If88814c12d12280d362078c1d8bc7f66558f82e2
2019-11-25 12:59:46 -05:00
John Reck
183e1380ce Improve dumping of display list memory usage
The first step of improving is measuring. So measure better.

Bug: 138856108
Test: dump
Change-Id: I076b904a1f0dfb209622c76bcb8778a10cd2b7db
2019-10-09 13:42:43 -07:00
Derek Sollenberger
c287a77d51 Continue to isolate graphics classes by introducing C API
This CL adds an initial C API to show how we should proceed
with limiting the symbols the graphics library will expose to the
framework.

Refactor Surface and TextureView to have no dependencies on the
graphics classes outside of the exposed C API.

Test: CtsUiRenderingTestCases
Bug: 137655431
Change-Id: Ic10aaba00388a47ca97f156fcaebc1ea7676dfb2
2019-08-20 14:50:40 -04:00
Derek Sollenberger
e78f7c9f48 Move GraphicBuffer back into libandroid_runtime.
Update Bitmap to store AHardwareBuffer instead of GraphicBuffer and
begin removing references to GraphicBuffer from the graphics JNI code

Test: CtsUiRenderingTestCases
Bug: 137655431
Change-Id: If533b6d87a87ae7e94a9b6f16fc52043714087df
2019-08-09 11:41:51 -04:00
Mike Reed
c2dbc03acc pass Paint not SkPaint to Canvas
Test: cts

Change-Id: I9a3314bc3f221b6e884c8c84d7b0241f7c5be600
2019-07-29 13:38:35 -04:00
Fedor Kudasov
86bd214059 Enable RenderNode and RecordingCanvas for layoutlib
Bug: 117921091
Test: all tests should pass
Change-Id: I574b12a5f7a6a54cbbcb17c35a3884368fd404e6
2019-06-26 19:24:15 +00:00
John Reck
fa93e3cefc Merge "Delete wrap_gles capability" 2019-05-31 20:48:01 +00:00
John Reck
23462d88f5 Delete wrap_gles capability
* Error enforcement doesn't work with libhwui anymore
* We can just do the real, proper thing for unit tests
  & microbenchmarks, which is arguably better anyway
* hwui doesn't have much opengl code left that was wrapped

Fixes: 128629988
Test: hwuiunit, hwuimacro, and hwuimicro all still run
Change-Id: If2568ea0745a67f83e1290860d474c1a01870376
2019-05-29 16:55:06 -07:00
Jerome Gaillard
21e7e2d9b1 Build native android graphics library for desktop
The purpose of this is to be able to use the native graphics code from
the Android platform directly in Android Studio (running on desktop) to
do layout rendering.

This creates a host library that is a subset of libandroid_runtime
including only the JNI files relevant to Android graphics. It also
includes LayoutlibLoader.cpp which is used to load the JNI when using
it as part of layoutlib (the graphics library for Android Studio).

This also creates libhwui-host, a host library that is a subset of
libhwui.

Bug: 117921091
Test: lunch sdk && m libandroid_runtime
Change-Id: I3850020d2d4c13c85e377476bc463d3eb6a01c6d
2019-05-29 15:48:53 +01:00
John Reck
db72e7aa8a Log less
These aren't really actionable logs by whatever
is producing them, so move to verbose

Bug: 131773342
Test: build
Change-Id: Icd020d889d83deae5dfd4aac3352bc9b1e1159bc
2019-05-23 14:41:32 -07:00
Leon Scroggins III
87e99a29aa Ensure that hardware Bitmap has a ColorSpace
Bug: 129355537
Test: I9e004fbb7c966bb58ae374087fecd66a1bb72346

android_view_ThreadedRenderer_createHardwareBitmapFromRenderNode in
SkiaGL could create an android::Bitmap without an SkColorSpace. Treat
HAL_DATASPACE_UNKNOWN as sRGB, as this is how we treat it internally.

Change-Id: Iad7f7d7cafce0a8759a84a4296ae5c3ce86dff4c
(cherry picked from commit 7fb4c9e4bb)
Merged-In: Iad7f7d7cafce0a8759a84a4296ae5c3ce86dff4c
2019-04-10 12:10:52 +00:00
Leon Scroggins III
1249757910 Remove references to ANDROID_ENABLE_LINEAR_BLENDING
Test: make

There is no longer any intent to turn on linear blending.

Change-Id: Ia1016f31833212da6ad4b4c6ebe03d16a509746d
2019-01-31 14:25:32 -05:00
Derek Sollenberger
6e35e63740 Don't assume all FP16 bitmaps are linearly encoded.
The bitmap.create() function that does not take a colorspace does
not enforce that the bitmap is linearly encoded and as such it is
possible for us to end up with FP16 bitmaps that are sRGB encoded.

Given that we want to remove that restriction (see b/120870651)
we update getColorSpace to report the actual colorSpace of the
underlying bitmap. This pulls a thread that causes a chain of
updates to various classes to ensure proper handling of the native
colorspace.

Bug: 120904891
Test: CtsUiRenderingTestCases
Change-Id: I27780aa603138b0e48f9320c2837bc53e22cdf95
2019-01-23 16:31:52 -05:00
Brian Osman
be8fac26d7 Switch to skcms-based factories and getters in SkColorSpace
Test: Mechanical substitution, still builds.
Change-Id: I877e4edd61e81279830ffbbcfea18d721abf6943
2019-01-15 03:17:09 +00:00
Chih-Hung Hsieh
2c9dad72bd Merge "Fix/suppress hwui google-explicit-constructor warnings" am: dcfef16295 am: 50991469e3
am: 739cf0d659

Change-Id: Id2422881831785eb9a47fda38b3fe6ce95b843cb
2019-01-09 15:34:01 -08:00
Chih-Hung Hsieh
f21b0b6d36 Fix/suppress hwui google-explicit-constructor warnings
* Add explicit to conversion constructors/operators
* Use NOLINT or NOLINTNEXTLINE to suppress warnings on intended converters

Bug: 28341362
Test: make with WITH_TIDY=1 DEFAULT_GLOBAL_TIDY_CHECKS=-*,google-explicit-constructor
Change-Id: I8c6ebb99679b0a71251024d70a13f8164e67db5e
2019-01-09 19:50:30 +00:00
Derek Sollenberger
e216948d63 Cleanup of Bitmap.h entry points.
All Bitmap constructors have been made private and the only way to
create one is through the allocate or createFrom factories.

SkColorSpace is now explicitly passed in to all the factories and is
no longer assumed to be sRGB.

Test: atest CtsGraphicsTestCases
Change-Id: I92c1c5c59df6de7fdd90e9504a2c2717cb854588
2018-12-18 14:20:24 -05:00
Chris Blume
7b8a808b7d Remove ; from closing namespaces in libs/hwui
When closing a namespace a } is sufficient. It doesn't need to be };
like closing a class or enum.

Within frameworks/base/libs/hwui there is a mix between } and }; when
closing a namespace. There are even mixes between a .h and the
corresponding .cpp files.

In a separate CL I was asked to not close with };. That was a good
comment. I adopted the style from nearby code. This CL cleans up the
nearby code.

Test: I made sure the code still built as expected.
Change-Id: Ieb314a4f48d6e33752463f3be4361fdc9be97482
2018-12-03 16:05:14 -08:00
John Reck
0aff62d12f Fix failing TextureViewTest
A tiny scaleX/scaleY is sneaking into the matrix,
throwing off the nearest/bilerp calculation.

This tiny scaleX/scaleY appears to be coming from
the inverse texture matrix necessary to workaround
skia issue https://bugs.chromium.org/p/skia/issues/detail?id=7075

So add another workaround for SkMatrix::getType()
reporting this as having a scale, even though there really
isn't one.

Bug: 119783323
Test: atest android.view.cts.TextureViewTest#testSamplingWithTransform
Change-Id: I3e675102ef99ce093f698460242c19dfe7e90345
2018-11-26 16:41:34 -08: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
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
Stan Iliev
11606ffa36 Implement WebView support for Vulkan using temporary buffer
Draw WebView in an offscreen GL buffer, then import and draw the
buffer with Vulkan.

Bug: 115610873
Test: Passed WebView CTS tests that are part of UiRendering.
Change-Id: Ida137fe9b8652d2a936ec2798b909be7e77b3462
2018-09-18 18:01:48 -04: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
John Reck
c3b7c20999 Remove dead code
This appears to have been added for use by skia, but
there are no references to this anymore. So delete it.

Test: builds
Change-Id: Iac2d25c8d50f48c38c735b2bf092d73596937f74
2018-09-07 12:59:05 -07:00
John Reck
8f45d4afd9 New DisplayList v2
First step of many

* Pulls SkLiteDL and SkLiteRecorder into HWUI

* forceDark shifted to be a sync-time transformation
instead of record time. No meaningful behavior change,
but much more flexible heuristics are possible this
way.

Test: build, poked around with forceDark on

Change-Id: I7b7cec5b7fd7c2b18823b4d92d821cf5898f9b88
2018-08-29 13:53:36 -07: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
339cf9b327 More auto-dark stuff
Initial attempt at selective bitmap inverting
Use CIE_LAB colorspace for inverting instead of HSV

Test: Manually poking around
Change-Id: I014ff31eeae471ee7f6a40a6daa4e7099c2a7ff8
2018-07-19 15:58:39 -07: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
Mike Reed
8cafcc628f remove (dead) caches from hwui
Test: make

Change-Id: I18bfe51896672272ce7d471eaead69b651399368
2018-05-03 13:23:40 -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
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
Andrew Sapperstein
8546c30fbf Revert "Revert "Update material_deep_teal_500 to #008577.""
This reverts commit 431d9d63e9.

Reason for revert: Rolling forward with a fix.

Change-Id: I5804e240535b84e0f4b2d306649b1981a9871632
Merged-In: I5804e240535b84e0f4b2d306649b1981a9871632
Bug: 74118164
Test: atest cts/hostsidetests/theme
2018-04-11 20:48:11 +00:00