summaryrefslogtreecommitdiff
path: root/libs/hwui/renderthread/EglManager.cpp
AgeCommit message (Collapse)Author
2017-01-09Support EGL_KHR_partial_update without EGL_EXT_buffer_ageJohn Reck
Bug: 31334677 Test: manual && hwuimacro --onscreen partialdamage Change-Id: I9b346b4053ec12c8a78a143a4dc0e708c44888a2
2016-12-09Make buffer age work in VulkanGreg Daniel
Test: manual testing in skiavk mode Change-Id: I5b9d8af7d9cecf2f022ef104ec33a5b7477e9e0c
2016-11-07Enable SkiaPipelines to interoperate with existing GlesDriver configs.Derek Sollenberger
Test: hwui unit tests Change-Id: Icd94d0e21130d86fb5514801f999d0018a69e151
2016-11-01Merge "Routine to upload hardware bitmaps"Sergei Vasilinetc
2016-10-31Routine to upload hardware bitmapssergeyv
Change-Id: Id8283a0975325e6830d55fd1e33c5f292a1e9be0 Test: refactoring cl. bug:30999911
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-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-09-27Support EGL_KHR_partial_update without EGL_EXT_buffer_ageJohn Reck
Bug: 31334677 Test: manual && hwuimacro --onscreen partialdamage Change-Id: I9b346b4053ec12c8a78a143a4dc0e708c44888a2
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-11Revert "Make stopped state a first-class thing"John Reck
This reverts commit 945961f78a78eced823d5ba78505c781b079703d. Change-Id: Iebc1d49fac33380233f8785fc39bec6c30a5e714
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-02-26Switch to pbuffer surface soonerJohn Reck
Bug: 27286867 If the system/app is slow, it might take too long to stop drawing. Switch the ordering of destroying stuff so that we switch to the pbuffer surface first, then do cleanup Change-Id: If64a3dbb71bb9fd53567231590436a89b2f1a09e
2016-02-26Always swap buffers if using partial update extensionJohn Reck
Bug: 27379093 Change-Id: Ifda18287248e4ae07d4bf2ae9642a9d23039e81f
2016-02-05resolve merge conflicts of 9ea5295597 to master.John Reck
Change-Id: I68b883e8a1bb17abd4cf151d057dd07e53a80f50
2016-02-05hwui: set buffer destroyed swap mode explicitlyChristian Poetzsch
Not using EGL_SWAP_BEHAVIOR_PRESERVED_BIT as config attribute for eglChooseConfig doesn't automatically mean the swap behavior is buffer destroyed. This is driver implementation specific and on some hw this can still be buffer preserved. Make sure it is buffer destroyed by explicitly setting it for every new surface when requested. Change-Id: Ie2c7c89b0d20e35832b488c6263bb4d9dd844a75 Signed-off-by: Christian Poetzsch <christian.potzsch@imgtec.com>
2016-02-02libhwui: handle eglSwapBuffers with EGL_BAD_NATIVE_WINDOW error caseZhang Dongsheng
If eglSwapBuffers is called but the under surface was destroyed, the EGL_BAD_NATIVE_WINDOW error may also be generated according to the EGL spec 1.4. This really shouldn't happen from the upper, but add the graceful handling of this case also. Change-Id: Ic0a599808b72f401d2a01c3dc40f9e6ea0e0a564 Signed-off-by: Zhang Dongsheng <dongsheng.zhang@intel.com> Signed-off-by: Zhiquan Liu <zhiquan.liu@intel.com>
2015-12-16Add some options to macrobenchJohn Reck
Change-Id: If8d5f5d3ace050577986a554182b2b66fd2257e1
2015-11-05add DeviceInfoJohn Reck
This reverts commit 096895550b9d5430d7a001d491566decf4f9791b. Change-Id: Ib2ed1e96d8f7f88302f5e27fe735687194553104
2015-11-05Revert "add DeviceInfo"John Reck
This reverts commit b2442896e3a226c7ebe9d47fa80b257e98a6a34d. Change-Id: I50f6555451f71067505245333c8e558b5e3b2b3b
2015-11-04add DeviceInfoJohn Reck
Change-Id: I4c122278a7e88b6f47c4dd3c5fc553df7d3c900d
2015-10-26eglSwapBuffers can also return EGL_BAD_NATIVE_WINDOWJohn Reck
Bug: 25017107 Change-Id: I545a746ba89d577de5769bc3e7dd335a100638c0
2015-10-22Add assert for required EGL extensionsJohn Reck
Bug: 25149700 Change-Id: I535ead7c1f8ba8766dff85fcf26a9cfe76647fb8
2015-10-22Remove obsolete debug optionJohn Reck
Bug: 25149700 Change-Id: I9280e2414255fb01e672094cd8d173efadac1681
2015-09-21Unify extensions parsing behaviorChris Craik
Removes remnants of EGL extension support, and persistence of GL extension list. Change-Id: I35aec12d900bdb33549ea47654bb8146f350ef48
2015-08-12Support new EGL extensionsJohn Reck
Bug: 21753739 Includes a revert of 13d1b4ab10fbee5e81a2ba1ac59cfae1e51d3ef0 as that only supported EGL_EXT_buffer_age Change-Id: Ia86a47d19e3355c067934d7764c330b640c6958d
2015-08-04renderthread: add EGL_EXT_buffer_age supportSeason Li
EGL_EXT_buffer_age is better than EGL_BUFFER_PRESERVED because it can save memory bandwidth used to blit back buffer into front buffer. Change-Id: I2fea0ee08dc7dd66e348b04dd694d075d509d01b
2015-07-16Don't crash on makeCurrent failJohn Reck
Bug: 22444755 WindowManager may decide to yank the surface at any point, so attempt to kinda handle this Change-Id: Id2f665d2f0f93bccd4ec977fbf52dca4dc1ec891
2015-05-27Enable swapBuffersWithDamage by defaultJohn Reck
Bug: 20761426 Change-Id: I520e60ca4f182dea590bc86eebd522e1db7a018a
2015-05-20Eliminate requireGlContextJohn Reck
Bug: 20297820 Change-Id: I37c63bab6f6c0d2337c8c6002046d2ef17e74097
2015-05-08Add eglSwapBuffersWithDamageKHR supportJohn Reck
BUG: 20761426 Disabled temporarily Change-Id: I0b6b6f0eebab886145e13fa35aefe76826965cf5
2015-01-30Merge "Add a WAIT_FOR_GPU_COMPLETION option"John Reck
2015-01-30Add a WAIT_FOR_GPU_COMPLETION optionJohn Reck
Change-Id: I18d526120651676109200bfd5da87cafcd7e3d13
2015-01-30Refactor blending and texture gl stateChris Craik
Change-Id: Ia6b3c8b2afd3dfcee7f3ce401d846b789612054a
2015-01-27Move scissor state to RenderStateChris Craik
Change-Id: I1227a3886fb24e4d9fad79fca469794f06cfb15e
2015-01-05Add overrides and switch to nullptr keyword for all filesChris Craik
Adds remaining missing overrides and nullptr usages, missed due to an extreme failure in tool usage. Change-Id: I56abd72975a3999ad13330003c348db40f59aebf
2014-12-11resolved conflicts for merge of d67bb501 to masterYohann Roussel
Change-Id: I40698ce1e382cb41eec7af5ea49ac0e2f997d555
2014-12-10Don't preload textures for AssetAtlasJohn Reck
Bug: 18317479 RenderNode::prepareSubTree calls prefetchAndMarkInUse on every bitmapResoruce in the DisplayList. However, this resulted in textures being uploaded for bitmaps that would be drawn from the AssetAtlas instead. To fix this we teach TextureCache about the AssetAtlas so that calls to TextureCache return the Texture from AssetAtlas if it exists. Thus usage of AssetAtlas is now purely to allow for further optimizations via draw merging instead of a requirement to get any benefit at all. Change-Id: I65282fa05bac46f4e93822b3467ffa0261ccf200
2014-11-18am 842697a3: am decc26df: am f0f68117: Merge "Trace some interesting events" ↵John Reck
into lmp-mr1-dev * commit '842697a3602204036e991cfea8b74da3df6e7f14': Trace some interesting events
2014-11-17Trace some interesting eventsJohn Reck
Bug: 18337099 Change-Id: Ie2e60da2b9f06e0368061c944d8123ab6903355c
2014-10-31am e05575e9: am a8d83d63: Merge "Layer changes" into lmp-mr1-dev automerge: ↵John Reck
a51fba0 * commit 'e05575e9c36850d8cfe49396ac9a1372511b12bf': Layer changes
2014-10-31Layer changesJohn Reck
Bug: 17208461 * Switch Layer to be VirtualLightRefBase instead of Caches' side-channel ref-counting * Include active layers in gfxinfo dump * Run gfxinfo dump on the correct thread * Dump gfxinfo on Layer creation failure Change-Id: I28d195699e2334518e215ab28c7a17355aee9678
2014-10-30am 97054254: am 141823ec: Merge "Be more conservative about current buffer" ↵John Reck
into lmp-mr1-dev automerge: a27e1a3 * commit '97054254d4c8eef66538814e1d5def776ceba97a': Be more conservative about current buffer
2014-10-27Be more conservative about current bufferJohn Reck
Bug: 18065565 Change-Id: I0b9c85ecf384ebe525e3a38803ab77d7ee37f33a
2014-10-23am b64e4372: am 82572cc4: am badac04d: Merge "Add some free zoom to ↵John Reck
lockHardwareCanvas" into lmp-mr1-dev * commit 'b64e4372bb60bdce75e2af7d0b94efe92d94ac6a': Add some free zoom to lockHardwareCanvas
2014-10-23Add some free zoom to lockHardwareCanvasJohn Reck
Bug: 18099195 Don't use EGL_SWAP_BUFFER_PRESERVED on surfaces that will never benefit. Also clean up some confusing naming Change-Id: I674ca64e0464a3282cff79e5ecd350d08f47c014
2014-10-15Clean up physical couplingTom Hudson
Narrow the use of #include directives in hwui, replacing with forward declarations where straightforward. Speeds compiles; doesn't do any restructuring of code. Change-Id: Icac2baffb5896f55d8c6718e9bd9d4bfa02d3ca0
2014-09-17Special case EGL_BAD_SURFACEJohn Reck
Bug: 17516789 Change-Id: I3dcb10360c2aef6326f7dbbff6815866d4c143b6
2014-08-28Track buildLayer calls, destroy if unusedJohn Reck
Bug: 17208461 Change-Id: Ibdb104a493285d77a6891c5e74e38a52c7014da9
2014-08-26Crash instead of leaking layers/textures between GL contextsChris Craik
bug:17208461 Change-Id: I4d58f301cf0f5e8145e808a5d6ade4de7801970b
2014-06-23No-fail invokeFunctorJohn Reck
Bug: 15513308 Bug: 15449247 Change-Id: I13a29f9c8d4975cdda6dcb33b6332c2555ff0f7c