summaryrefslogtreecommitdiff
path: root/libs/hwui/renderthread/CanvasContext.cpp
AgeCommit message (Collapse)Author
2018-08-29TextureView Vulkan support and optimized OpenGL drawStan Iliev
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-06-04Merge "cts case ↵Yu Jia
com.android.server.cts.GraphicsStatsValidationTest#testDaveyDrawFrame in modue CtsIncidentHostTestCases failed" am: 2dd3d8cbef am: d490e788f1 am: 048c6751d7 Change-Id: I89d6290789324a38a28de5e03bd139e450297b23
2018-06-04Merge "cts case ↵Yu Jia
com.android.server.cts.GraphicsStatsValidationTest#testDaveyDrawFrame in modue CtsIncidentHostTestCases failed" am: 2dd3d8cbef am: d490e788f1 Change-Id: I6e3507cfb5b6501dd28fb2b6019fdbb74fb745f0
2018-05-31Attempting to fix the black flickerJohn Reck
Bug: 79231206 Test: Repro steps from bug Merged-In: I4c2810c42a7a4358f64584da3ab0cdf1499e71b6 Change-Id: I4c2810c42a7a4358f64584da3ab0cdf1499e71b6
2018-05-31Attempting to fix the black flickerJohn Reck
Bug: 79231206 Test: Repro steps from bug Change-Id: I4c2810c42a7a4358f64584da3ab0cdf1499e71b6
2018-05-30cts caseYu Jia
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-17Merge "AnimatedImageDrawable: Eliminate unnecessary calls to redraw" into ↵Leon Scroggins III
pi-dev am: a2113aa4ad am: 6353ff5bb5 Change-Id: I5258721b49834aba58e9bf19162e6a4588f68f0f
2018-05-16AnimatedImageDrawable: Eliminate unnecessary calls to redrawLeon Scroggins III
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-04remove BakedOps and much of renderstateMike Reed
Test: make Change-Id: If070b7436b848c6840abfac5f051b0f5b6cb17ce
2018-04-26Remove RenderThread from EglManagerJohn Reck
Refactor to make EglManager re-usable. Test: hwuiunit passes, hwuimacro works Change-Id: Ie8e9398c703fada1dc5d8baca5f42485eadea202
2018-04-18Revert "Add support for render-ahead"John Reck
This reverts commit ec100976e0655acaa204c8800dfb83dadae20cc8. Reason for revert: b/77971494 Test: hwuiunit passes Change-Id: I2e7dc719d2df1dd939b275496c0edc38e458c434
2018-04-12So long OpenGLPipeline & OpenGLReadback (2/??)John Reck
Hello EglReadback Test: hwuiunit & PixelCopyTests pass Change-Id: I36a8cb45b11141b09e75a2e978ed13e336425625
2018-04-11Merge "Remove RenderPipelineType::OpenGL (1/many)"John Reck
2018-04-11Remove RenderPipelineType::OpenGL (1/many)John Reck
Just removes the define & all things referencing the define. Test: hwui_unit passes Change-Id: I3f98c271e23ef696c40addf260abdc0fb149a70d
2018-04-10Merge "Remove dead code"TreeHugger Robot
2018-04-09Remove dead codeJohn Reck
Remove an old protobuf serialization experiement, skp capture does this better Test: builds Change-Id: Icd875eabee6b517729f901841e48e579d0e8de4d
2018-04-09Add support for render-aheadJohn Reck
For periods of time during which latency is less important allow a client to request a deeper render-ahead pipeline. The latency tradeoff results in less overall visual jank Test: none, only used by macrobench Change-Id: I516203b70bdc75b6415fa08bf9c4fb1b598b0102
2018-03-21Remove old workaround for display issuesJohn Reck
Bug: 76086140 Test: A bunch of systraces, things looked OK Change-Id: I447e976a937160c0bb3b52afd57661e7ffa0c9ec
2017-12-06Extreme battery saver: Allow lowering framerate for experiments.John Reck
Bug: 68769804 Test: manual Change-Id: Ic0c95f32c7ba6d86a997997e480e6d8a5f228f25
2017-11-03Format the world (or just HWUI)John Reck
Test: No code changes, just ran through clang-format Change-Id: Id23aa4ec7eebc0446fe3a30260f33e7fd455bb8c
2017-10-27Switch to a fancy new queueJohn Reck
Test: unit tests & benchmarks pass/faster Change-Id: I9521432172d6dd6039c5280b1265479a36a86247
2017-10-20Fix crash in "Tree::updateBitmapCache"Stan Iliev
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-07-05Move frame history into jank trackerJohn Reck
Test: hwui_unit_tests & manual Change-Id: If761947652750640268217cd8cd97c8382441b44
2017-06-14Use RGBA16F layers when wide color gamut rendering is onRomain Guy
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-06Implement CacheManager for the Skia pipelines.Derek Sollenberger
The core of the implementation is complete and provides heuristic cache sizing based on the size of the surface being used. This CL will also be used to add the following features in the future... 1) Support Vulkan pipeline reporting on the size of the surface. 2) Complete the VectorDrawableAtlas stub code 3) Automatic purging of stale resources for low memory devices. Test: hwui_unit_tests (new test added) and CtsUiRendering Bug: 62260637 Change-Id: Ib85159cca28b646fe249f2190b07f1b7e0f50d8f
2017-06-02Merge "Enable wide color gamut rendering"TreeHugger Robot
2017-06-02Enable wide color gamut renderingRomain Guy
When wide color gamut rendering is requested, hwui will now use an rgba16f scRGB-nl surface for rendering. This change also fixes the way screenshots are handled in the platform to behave properly with wide gamut rendering. This change does not affect hardware layers. They also need to use rgba16f scRGB-nl; this will be addressed in another CL. Bug: 29940137 Test: CtsUiRenderingTestCases, CtsGraphicsTestCases Change-Id: I68fd96c451652136c566ec48fb0e97c2a7a257c5
2017-06-01Fix ANR & Crash on RyuJohn Reck
Fixes impossible dequeue crash as the wrong start point of the frame was used. We need to use the start point for RT, not the start point for the frame. Workaround for sysui ANR caused by what appears to be a driver bug. Drivers with the bug will have transiently higher memory usage. Drivers without the bug will be unaffected. Bug: 62213889 Bug: 62250550 Test: Manual Change-Id: I9992b224f84bc1c40834bafff7e0013b38270ae0
2017-05-31Fix dequeus outside of frame drawingJohn Reck
Bug: 62213889 Test: Repro steps in bug Change-Id: I8fc407b280ba82c669fc2bb03750cab139adb965
2017-02-21Overhaul GraphicsStatsServiceJohn Reck
* LRU cache of recently-used is dead, replaced disk storage * ASHMEM size is read from native by the system service, no longer requires keeping a sizeof() in sync with a constant in Java * Supports dumping in proto format by passing --proto * Rotates logs on a daily basis * Keeps a history of the most recent 3 days Bug: 33705836 Test: Manual. Verified log rotating works by setting it up to rotate every minute instead of day. Confirmed /data/system/graphicsstats only has the most recent 3 entries after several minutes Change-Id: Ib84bafb26c58701cc86f123236de4fff01aaa4aa
2017-02-06Clean up deferredLayers only onGpuContextDestroyed.sergeyv
Test: manual bug:34919311 Change-Id: I5488b0845ec3922424f5893943e4f42675dfc9fd
2017-01-30Explicitly destroy Layer in DeferredLayerUpdater on destroyHardwareResources()sergeyv
Change-Id: I0987104eabda9a2a302b9e765213aad48f93aea4 Test: refactoring CL. Existing tests still pass bug:33753499
2017-01-25Overhaul RenderNode's DisplayList managementJohn Reck
* Move mValid to native * Have destroyHardwareResources destroy everything * Remove flaky mParentCount checks in setStaging * All tree updates have an internal observer to ensure onRemovedFromTree() is a reliable signal * onRemovedFromTree() immediately releases resources to avoid displaylist "leaks" Test: Unit tests for validity added & pass, manually verified that b/34072929 doesn't repro Bug: 34072929 Change-Id: I856534b4ed1b7f009fc4b7cd13209b97fa42a71c
2016-12-09Make buffer age work in VulkanGreg Daniel
Test: manual testing in skiavk mode Change-Id: I5b9d8af7d9cecf2f022ef104ec33a5b7477e9e0c
2016-11-03Implement Skia pipelines for OpenGL and Vulkan.Stan Iliev
Implement Skia pipelines for OpenGL and Vulkan: base SkiaPipeline, SkiaOpenGLPipeline and SkiaVulkanPipeline. Write unit tests for SkiaPipeline. Test: Built and run manually on angler-eng. Change-Id: Ie02583426cb3547541ad9bf91700602a6163ff58
2016-10-28Minor cleanup of unused headers and overly described functions.Derek Sollenberger
Test: local compile Change-Id: I5b794c9473f6d3a9e1d4f9365c951c7ce9dade50
2016-10-26Move OpenGL specific details behind renderPipeline interface.Derek Sollenberger
Test: new and existing unit tests still pass. Change-Id: I6164f30f45ebe450788ed8d949eca5af9a44e585
2016-10-11Linear blending, step 1Romain Guy
NOTE: Linear blending is currently disabled in this CL as the feature is still a work in progress Android currently performs all blending (any kind of linear math on colors really) on gamma-encoded colors. Since Android assumes that the default color space is sRGB, all bitmaps and colors are encoded with the sRGB Opto-Electronic Conversion Function (OECF, which can be approximated with a power function). Since the power curve is not linear, our linear math is incorrect. The result is that we generate colors that tend to be too dark; this affects blending but also anti-aliasing, gradients, blurs, etc. The solution is to convert gamma-encoded colors back to linear space before doing any math on them, using the sRGB Electo-Optical Conversion Function (EOCF). This is achieved in different ways in different parts of the pipeline: - Using hardware conversions when sampling from OpenGL textures or writing into OpenGL frame buffers - Using software conversion functions, to translate app-supplied colors to and from sRGB - Using Skia's color spaces Any type of processing on colors must roughly ollow these steps: [sRGB input]->EOCF->[linear data]->[processing]->OECF->[sRGB output] For the sRGB color space, the conversion functions are defined as follows: OECF(linear) := linear <= 0.0031308 ? linear * 12.92 : (pow(linear, 1/2.4) * 1.055) - 0.055 EOCF(srgb) := srgb <= 0.04045 ? srgb / 12.92 : pow((srgb + 0.055) / 1.055, 2.4) The EOCF is simply the reciprocal of the OECF. While it is highly recommended to use the exact sRGB conversion functions everywhere possible, it is sometimes useful or beneficial to rely on approximations: - pow(x,2.2) and pow(x,1/2.2) - x^2 and sqrt(x) The latter is particularly useful in fragment shaders (for instance to apply dithering in sRGB space), especially if the sqrt() can be replaced with an inversesqrt(). Here is a fairly exhaustive list of modifications implemented in this CL: - Set TARGET_ENABLE_LINEAR_BLENDING := false in BoardConfig.mk to disable linear blending. This is only for GLES 2.0 GPUs with no hardware sRGB support. This flag is currently assumed to be false (see note above) - sRGB writes are disabled when entering a functor (WebView). This will need to be fixed at some point - Skia bitmaps are created with the sRGB color space - Bitmaps using a 565 config are expanded to 888 - Linear blending is disabled when entering a functor - External textures are not properly sampled (see below) - Gradients are interpolated in linear space - Texture-based dithering was replaced with analytical dithering - Dithering is done in the quantization color space, which is why we must do EOCF(OECF(color)+dither) - Text is now gamma corrected differently depending on the luminance of the source pixel. The asumption is that a bright pixel will be blended on a dark background and the other way around. The source alpha is gamma corrected to thicken dark on bright and thin bright on dark to match the intended design of fonts. This also matches the behavior of popular design/drawing applications - Removed the asset atlas. It did not contain anything useful and could not be sampled in sRGB without a yet-to-be-defined GL extension - The last column of color matrices is converted to linear space because its value are added to linear colors Missing features: - Resource qualifier? - Regeneration of goldeng images for automated tests - Handle alpha8/grey8 properly - Disable sRGB write for layers with external textures Test: Manual testing while work in progress Bug: 29940137 Change-Id: I6a07b15ab49b554377cd33a36b6d9971a15e9a0b
2016-10-03Move Layer creation/deletion into the RenderPipeline.Derek Sollenberger
Test: refactoring. existing tests still pass. Change-Id: I032c33896a0cb74c91e2a913a584373518466b88
2016-09-14resolve merge conflicts of 0ec2fd7 to mastersergeyv
Change-Id: I113ede26ab42e3f9a36a52a756c38d365731e16d
2016-09-12HWUI: track upload & recent usage in font cachesergeyv
FontCacheHistoryTracker should be turned off before shipping: b/31438876 bug:30427106 Change-Id: Ic26b25e790d4ee69e484ca0cb23dc9cc522b2ed3
2016-09-02Merge "Fix texture leak"TreeHugger Robot
2016-09-02Wait on frame work fences when frames are dropped am: 06e2e9cf4c am: 7a14f5aeb9Chris Craik
am: b53c60876a Change-Id: Ib9c5be43f65379770b17260c34be90fccb360277
2016-09-02Fix texture leakJohn Reck
Bug: 31251593 Change-Id: Ic86729eb6089239134213588d80459d14227ade6
2016-08-31Wait on frame work fences when frames are droppedChris Craik
bug:30895941 Prevents a race where frame work could interleave between frames, causing SurfaceView position updates to be delivered out of order. Change-Id: I01e4cc557b69dcf33e877a0e16c0d115ec95e4cc
2016-08-08Ensure Dequeue/Queue duration is always set am: 70e89c9c37 am: ed343def3eJohn Reck
am: 77e5333520 Change-Id: I0c51b04c0dd7bafecf03c42417c4247fd281c325
2016-08-05Ensure Dequeue/Queue duration is always setJohn Reck
Bug: 30662749 Change-Id: I35a4c26ce78536fc7a506ec2f92a8b9eecb12ec2
2016-08-02Put VD animators on paused list when RT stops drawing am: c82e879e56 am: ↵Doris Liu
70b6080cd7 am: 4ec05be535 Change-Id: I22e66e33aa51064230351f1fd24e5fb200511213
2016-08-02Put VD animators on paused list when RT stops drawingDoris Liu
am: c82e879e56 Change-Id: I9f0202c8e69e681014253842b2a2de75d372616b
2016-08-02Merge "Put VD animators on paused list when RT stops drawing" into nyc-mr1-devDoris Liu