summaryrefslogtreecommitdiff
path: root/libs/hwui/renderthread/CanvasContext.h
AgeCommit message (Collapse)Author
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-28Better error reporting for createOrUpdateLayerStan Iliev
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
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-09-08Fix flicker from multiwindow resizeJohn Reck
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-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-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-03-27Update VectorDrawables cache at frame startStan Iliev
Draw VectorDrawables in GPU backed surface. Render VD cache at the beginning of the frame to avoid context switching. Test: CTS graphics tests pass. Change-Id: Ia14e0ec4049c3fa87f03547fbda44043bf8dd793
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-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-11-17Update pinImages to report when GPU resource limits are exceeded.Derek Sollenberger
Bug: 32691999 Test: proposed CTS test (ag/1500396) and existing UiRendering tests Change-Id: I190f888ae5499ac048569af8256fdd31d19d1285
2016-11-07Refactor pin/unpinImages to work across pipelines.Derek Sollenberger
Test: existing CTS tests still pass Change-Id: Ib2607e9853396bad42f298829b5c5da0d210af32
2016-10-26Move OpenGL specific details behind renderPipeline interface.Derek Sollenberger
Test: new and existing unit tests still pass. Change-Id: I6164f30f45ebe450788ed8d949eca5af9a44e585
2016-10-25Store GrContext on RenderThread for use by Skia-based renderers.Derek Sollenberger
Test: built and booted on device Change-Id: I4c1060ec72bc67e54e6b2d25b1f2c13aaa513f89
2016-10-13Merge "Initial refactoring to enable the addition of the SkiaOpenGLPipeline."Derek Sollenberger
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-05Initial refactoring to enable the addition of the SkiaOpenGLPipeline.Derek Sollenberger
Test: existing and new HWUI unit tests all pass. Change-Id: I4f5c1dc839a2ed15d8b0f6245fe030684501b083
2016-10-03Move Layer creation/deletion into the RenderPipeline.Derek Sollenberger
Test: refactoring. existing tests still pass. Change-Id: I032c33896a0cb74c91e2a913a584373518466b88
2016-09-02Wait on frame work fences when frames are dropped am: 06e2e9cf4c am: 7a14f5aeb9Chris Craik
am: b53c60876a Change-Id: Ib9c5be43f65379770b17260c34be90fccb360277
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-07-26Remove LayerRenderer.Derek Sollenberger
There is only one caller each for the static functions here so this CL moves the logic to the caller. Also by moving some of the code into the pipeline it makes it easier for future changes to configure how a pipeline handles a layer. Change-Id: Ib735b5154325cbb658fd151f7a19dbf434ab44b7
2016-07-21Merge \\"Change swap chain stuffed detection logic\\" into nyc-mr1-dev am: ↵Chris Craik
433a19e8bf am: 3c37412900 Change-Id: Id7e0d1d1dfb5448dd927c29361fb98aabf0cfe10
2016-07-20Change swap chain stuffed detection logicChris Craik
bug:29771461 bug:29413700 bug:30181577 Changes frame interval gap detection to look for wider gaps, as they were incorrectly firing all the time. Also adds a 500ms minimum gap between frames dropped because of stuffed swap chain, to prevent dropping too often. Change-Id: If16ed637d54bf37015704be102c5c2e3731a0824
2016-07-14Merge "Move isSkiaEnabled to the Properties class"Stan Iliev
2016-07-13Refactor CanvasContext: move OpenGL specific codeStan Iliev
Move OpenGL specific code from CanvasContext into a new class OpenGLPipeline. Change-Id: I4363053f890701a4235927b59ec588861488ea8f
2016-07-11Move isSkiaEnabled to the Properties classStan Iliev
Move CanvasContext::isSkiaEnabled to Properties:isSkiaEnabled. Change-Id: I0a62f43825cf59ba338a24a056e8c2a56d1c5315
2016-07-07Delete old rendering pipelineChris Craik
fixes: 30002246 Change-Id: I45df0e924708526cee045b14c291bd23aa1a92db
2016-07-07Merge "Implement runtime switch to select default renderer mode"TreeHugger Robot
2016-07-07Implement runtime switch to select default renderer modeStan Iliev
Add a system property debug.hwui.default_renderer, which allows to set rendering mode to OpenGL (default), Skia OpenGL or Vulkan. Change-Id: I8bca5bacc5108f77437e340ac61f2d8db8cc4c39
2016-07-07Merge \\"Consider queue & dequeue times for should draw\\" into nyc-mr1-dev ↵John Reck
am: 3a465e7a12 am: 6354336493 Change-Id: Idbe85f08c27cc6f9433badd886a1fe7d9ba73c4f
2016-07-06Consider queue & dequeue times for should drawJohn Reck
Bug: 29413700 Change-Id: I4b27b077af569e3c60c57b0e11501e9f3af70579
2016-06-29Remove unused method from RenderProxy and CanvasContext.Derek Sollenberger
Change-Id: I324bbfa40a2155d0212fa20c6bd39df5bb21d27a
2016-06-21Delete unused argsJohn Reck
Bug: 21170575 Change-Id: Icc832f70f206342557f44667ad3498405d04db78
2016-06-10Redraw if dirty during stopped when resumedJohn Reck
Change-Id: I0034d1da7704de53c4ba3da3e8ef3109445f9e6a Fixes: 28283031
2016-04-18Make getFrameNumber lazyJohn Reck
Change-Id: I783de544ad9a3636ea90f1c8c4034738997bfbc8 Fixes: 28246085
2016-04-14Revert "Revert "Make stopped state a first-class thing""John Reck
This reverts commit eab3f2658aa41d37c3b05d49a2ce4e3f4ed85399. Fixes first-frame issue, mReportNextDraw needs to override mStopped Fixes: 28118961 Fixes: 27286867 Change-Id: I5c811759637d08ba9f3b342016d1b3006986d5a2
2016-04-11Merge "Revert "Make stopped state a first-class thing"" into nyc-devJohn Reck
2016-04-11Revert "Make stopped state a first-class thing"John Reck
This reverts commit 945961f78a78eced823d5ba78505c781b079703d. Change-Id: Iebc1d49fac33380233f8785fc39bec6c30a5e714
2016-04-08Merge "Make stopped state a first-class thing" into nyc-devJohn Reck
2016-04-07Make stopped state a first-class thingJohn Reck
Bug: 27286867 WindowManager has committed to stopped state controlling the lifecycle of the Surface, so make that a first-class thing in HWUI as well. This makes it more resistent to things like a rogue updateSurface() happening while mStopped=true, leading to bad things down the line. Instead let the surface be changed/updated as often as desired, and just block any attempt to draw on that surface. Also removes some unnecessary makeCurrent()s, as EglManager ensures that we *always* have a valid GL context now (using a pbuffer surface if there is no window surface set) Change-Id: Iead78ddebc7997e8fdb0c9534836352f5e54b9bd
2016-04-07Fix some edge casesJohn Reck
Bug: 27709981 This desperately needs a refactor, but to keep the current (really needed & nice) behavior of dispatching after sync finishes would be difficult to handle cleanly without lots of ripping so... #yolo Change-Id: I831a06c6ae7412a062720d68ecbe3085190f0258
2016-03-29Support buildLayer in new pipelineChris Craik
bug:26561995 bug:27620686 Change-Id: I6c39f9a077e7e6002d3c01b8888238fd17b0f02a
2016-03-17Move updating window position off RTJohn Reck
Bug: 27385141 Change-Id: I6c75b5f1d9ef55ef64dde050f71d0e28fb8714bf
2016-02-17allow for slow FrameMetricsListenersAndres Morales
A slow listener could cause a race in the NotifyHandler where the single reference to the buffer to send would get updated when it shouldn't have been. Switch to a queue of available buffers to prevent this race. Also, stop setting and clearing the observer reference and instead incStrong/decStrong to mark temporary strong ownership without colliding with other owners in flight. Bug: 27097094 Change-Id: Iee647bfae8b80019b6d8290179eed3973230901f
2016-02-09updates to FrameStatsObserver APIAndres Morales
- Rename to FrameMetrics to avoid collision with existing android.view.FrameStats class - Make FrameMetricsObserver implementation detail, exposing FrameMetricsListener interface as public API and wrapping in FrameStatsObserver to maintain state - Remove dropped frame count call, in favor of passing as parameter to callback method. - Move away from raw timestamp access in favor of Metric IDs which represent higher-level, more stable stages in a frame lifecycle and match the categories exposed in the onscreen bars. - Support many-to-many Window<->FrameMetricsListener relationship Change-Id: I00e741d664d4c868b1b6d0131a23f8316bd8c5c2
2016-02-04Merge "Have RT drive window positioning"John Reck
2016-02-04Have RT drive window positioningJohn Reck
Bug: 22802885 Change-Id: I6beed5474d3a943b16e9097f7bd61ce3cbd37505
2016-02-02Early kickoff of shadow tasksChris Craik
bug:26562703 Change-Id: I7cdf18f2c662380bd31c7ffeefd5c3f569e5c1c6