summaryrefslogtreecommitdiff
path: root/libs/hwui/Readback.cpp
AgeCommit message (Collapse)Author
2020-03-11Let LayerDrawable choose the best scaling filter for readback.Kazuhiro Inaba
The check used in Readback.cpp did not take the transformation matrix into account for judging whether the copy was scaling. libs/hwui/pipeline/skia/LayerDrawable.cpp already incorporates the logic to detect non-scaling copy, so we can just let it check the condition. This version regards 90-degree rotation without size change as non-scaling and disables filters. Bug: 151126720 Bug: 150839078 Test: atest android.view.cts.PixelCopyTest Change-Id: I69e987e6a2e48299c5e579f8c218c42a724dc606
2020-02-13[HWUI] use ANativeWindow_getLastQueuedBuffer apiAlec Mouri
Bug: 137012798 Test: builds Change-Id: Ic33a21a73b0579726f47c53cc102fb91b5ead0d6
2019-03-29Add missing trace pointsJohn Reck
Test: traced opening recents Change-Id: I51675f1c49f27f1bfa5b18e3d3dd7162e58b1cb8
2019-03-18Merge "Remove old TaskManager system"John Reck
2019-03-18Remove old TaskManager systemJohn Reck
Replace it with a newer, fancier, WorkQueue-inspired one that's just a global common thread pool. Test: hwuiunit passes Change-Id: Ib5d03104a08bbac9a4ec67a1bfc0db2b35d6700f
2019-03-11Remove unused include of SkToSRGBColorFilter.hBrian Osman
Change-Id: Ib4be68d9ab491fbb4eefc6103096823f9f72a7aa Test: Just deleting unused include. Code still builds.
2019-02-13Decouple VulkanManager from RenderThreadStan Iliev
This CL allows for more than one VulkanManager to exist. VulkanManager ctor are public allowing for classes other than RenderThread to instantiate it. Secondary VulkanManager can be used to render on a thread other than RT. Test: Ran HWUI unit tests and several apps Change-Id: Ibfd76c86ff67e01617a500902bba7431b928f5c0
2019-02-06Use kTopLeft_GrSurfaceOrigin when generating a GPU buffer for CPU readback.Derek Sollenberger
When attempting to read back a buffer from the GPU, Skia will perform a y-flip of the buffer in CPU memory if the buffer does not have a top-left origin. Test: CtsUiRenderingTestCases Bug: 119366261 Change-Id: I93ec93cc31209cbdd9b886b0d1020fda3aac646e
2018-11-07Set the color space to sRGB on the Surface and remove colorFilter.Derek Sollenberger
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-09-10Refactor HWUI readback code to be backend independentStan Iliev
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
2016-11-16Support Surface and Layer Readback in the SkiaPipelines.Derek Sollenberger
Test: CTS TextureViewTests and UIRendering Change-Id: I2969c8f5a975bfd9aebcbb585c64d1fcbb2487c2
2016-10-26Add target to texturesergeyv
Test: refactoring cl. bug:32413624 Change-Id: I94b1c31cd4e0712dfcfd7777a0012424c1bf0dca
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-07Add API to copy a windowJohn Reck
Change-Id: I9bb5209010db6665be4b6f8db81a6fc1b7debc45
2016-09-01Fix EGLImage memory leakJohn Reck
bug: 31247709 Change-Id: Ifb3087a6e76d0d1304f55d13e468bafbd78418da
2016-07-07Unify readback Surface/TextureView copy mechanismChris Craik
Removes last usage of old rendering pipeline. Change-Id: Ia920dec9cd726ca221e11e888562c7df39a9761e
2016-04-28Support transform'd GraphicBuffersJohn Reck
Bug: 28428955 Change-Id: I23e2fc9b96a67c7cfda42d9d7319e478194a7fa7
2016-04-26API tweaks to PixelCopy and make it publicJohn Reck
Bug: 27708453 Change-Id: I81667ce42f9ca1c1a13e1e61299927900845fc84
2016-04-22PixelCopy fixesJohn Reck
Bug: 27708453 Fixes some issues with camera sources. Previously it was using GL_TEXTURE_2D target which doesn't work properly if the source is YUV. It is critical to ensure GL_TEXTURE_EXTERNAL_OES is used throughout so the right sampler is used. Change-Id: I0dcd8941ba08331f24809467b0e828663a38e93b
2016-04-11Framework-side of SurfaceView#getBitmapJohn Reck
Bug: 27708453 Change-Id: Ie6fd7eca522d3e6549d8af587c975fd7e6053649