| Age | Commit message (Collapse) | Author |
|
Work towards DisplayId opaqueness by eliminating call-sites to APIs that
parse the display ID values directly. One such site is
ScreenCaptureOutput.
Replace all calls to *DisplayId::tryCast with local calls to cached
display variant.
Flag: com.android.graphics.surfaceflinger.flags.stable_edid_ids
Bug: 390690584
Test: libcompositionengine_test && libsurfaceflinger_unittest
Change-Id: Ic83a2b2bfa6fc98b1d0fccc60f450d1587c2cc34
|
|
Only a subset of display state variables are needed for a screenshot
and can be passed around in the existing ScreenshotArgs struct. This
simplifies the parameter list passed around in screenshots and is a
step toward refactoring screenshots to be cleaner and separated into
a separate class.
Ideally, once everything is split into a separate class, SF will deal
with all the main thread work and provide the subset of screenshot
arguments that are need by the yet-to-come screenshotter class.
Bug: b/377758217
Test: atest SurfaceFlinger_test, atest CompositionTest
Test: presubmit, screenshots, screen lock/unlock
Flag: EXEMPT, refactor
Change-Id: Id66d108824b5fab6f110867f2b86408928dc7519
|
|
Removes Renderarea and its child classes + builders and provides its
elements in a parameter struct. This is a step toward untangling
dependencies on legacy layer, SF state lock, and separating screenshot
logic into a separate class.
Bug: b/377758217
Test: atest SurfaceFlinger_test, atest CompositionTest
Test: presubmit, screenshots, screen lock/unlock
Flag: EXEMPT, refactor
Change-Id: Id92f2697101f07e1fac50a6f6a770ad6d762ad8b
|
|
Previously, SF generated an HDR screenshot by:
* Asking CompositionEngine to composite layers offscreen into SDR
* Asking CompositionEngine _again_ to composite layers offscreen into
HDR
* Asking RenderEngine to build a gainmap
* Sending the SDR buffer and the gainmap to the client
But, this had some problems:
* This path bit-rot, so the HDR layer list was totally empty :)
* LayerFE now has an assumption that only one *thing* will be consuming
the layer and emitting a release fence back. So, this fixing the above
caused ghost images, and undoing that assumption just for screenshots
is a bit unappetizing.
* If the above assumption *were* undone, then the release fence for the
layer would be delayed due to rendering to an additional render
target, which sucks.
* We talk to RenderEngine three times, which involves thread hops, which
sucks.
So, we solve these problems by:
* Only asking CompositionEngine to composite layers into HDR
* Then, ask RenderEngine _once_ to tonemap the HDR buffer into SDR, and
generate a gainmap.
* Send the SDR buffer and the gainmap to the client.
And now most things are solved: LayerFE is only used to render to one
render target, so it only gets one release fence back, as expected.
Moreover, compositing into HDR is expected to be very cheap, as the
local tonemapper only has to run when tonemapping from a very large HDR
range (like a PQ video) -- when the application is already adapting to
display conditions then we don't have to do anything. And, we only have
to talk to RenderEngine twice now.
We could optimize this further by moving the gainmap generation into
CompositionEngine, but that seems like adding complexity for the moment.
Note that in theory, screenshot quality for the SDR rendition could be a
little worse, since MouriMap introduces shadowing artifacts that may now
bleed across layers. But it doesn't seem to be noticeable in practice,
and it was a pre-existing issue for application-tonemapped content.
Also, we remove CaptureArgs::attachGainmap, since we don't need it at
all to safely trigger this path.
Bug: 329465218
Flag: com.android.graphics.surfaceflinger.flags.true_hdr_screenshots
Test: Trigger screencapture
Change-Id: I5a274886acb135b21096300a034aadca20eceeb5
|
|
Flag has been rolled out for several months and is safe to
remove along with any legacy methods and dead code.
Bug: b/351894825
Test: atest SurfaceFlinger_test
Flag: EXEMPT flag removal
Change-Id: Id6fdfc534a0bff6ff9dfb8727c08ff821bc4965a
|
|
Changes when release fences are attached to layers for non-threaded
RenderEngine to ensure that fences are added and fired in the same
hop to the main thread. This removes the dependency on legacy screenshot
code and prevents a deadlock where screenshot requests are blocked on
the main thread while the main thread is blocked on the previous
screenshot request finishing.
Bug: b/351894825
Test: atest SurfaceFlinger_test
Flag: EXEMPT refactor and for flag removal
Change-Id: If9d4134aba1106484f94231c5104a57a605147b8
|
|
ce_fence_promise and screenshot_fence_preservation flags
have been out for several releases. They can be deleted,
along with any obsolete code related to the flag removal.
Bug: 351894825
Test: atest SurfaceFlinger_test
Flag: EXEMPT flag removal
Change-Id: Iba6166358c96ff6cfe5c64b68640fcd992c4089f
|
|
This uses the gainmap concept from UltraHDR and ISO 21496-1 to produce
screenshots that (a) can be rendered in HDR and (b) that are perfectly
backwards-compatible on SDR displays are scenes where displaying SDR is
preferable.
The technical details of the screenshot process at a high level are:
* A client requests that they want a gainmap attached to the screenshot
result
* SurfaceFlinger asks RenderEngine to perform three render passes
* First, render the SDR base image, tonemapping using MouriMap
* Second, render an HDR rendition. This is *also* tonemapped using
MouriMap to the current display conditions. For HDR UI, this is
effectively a no-op. For PQ and HLG content, this allows for
approximating what is on-screen as closely as possible. Note that
to preserve precision as much as possible, we require an FP16
framebuffer.
* Finally, combine the SDR and HDR renditions into a gainmap
* The client now receives the base image with the gainmap, as well as an
HDR/SDR ratio. The client can use this information to generate gainmap
metadata for encoding or round-tripping to the display.
This MVP is sufficient for generating screenshots through adb screencap.
Eventually, this can be used to integrate with the applications that
want HDR screenshots, or to remove hacks that disable tonemapping during
certain system animations.
Bug: 329470026
Flag: com.android.graphics.surfaceflinger.flags.true_hdr_screenshots
Test: builds
Test: adb screencap
Change-Id: I0434059d957bb6cc38d019743619d72dda72a269
|
|
|
|
Fixes a deadlock where screenshot requests are blocked
on the main thread which inturn is blocked by the
screenshot request finishing.
Flag: EXEMPT bug fix
Bug: 349776684
Test: presubmit
Change-Id: Ibf038ad6db3e87c84508d3e101ca1eb144836d7c
|
|
Create a SF specific macro to call into atrace. This will make the
switch to perfetto for capturing atrace tags easier.
Flag: EXEMPT refactor
Bug: 349905670
Test: perfetto
Change-Id: I4d046d837f52ef78b08e3c97556f2eddb06232dd
|
|
into main
|
|
Add a trace slices for:
- for all post composition work on main thread
- transaction callbacks
- screenshot work on main thread
Flag: EXEMPT adding trace slices + trivial refactor
Bug: 333623207
Test: perfetto
Change-Id: I6ca0a80941327edc0c78decf82176459d15d4595
|
|
We were swapping a couple of boolean params when requesting
screenshots for region sampling, breaking region sampling for
secure layers in the process. Fix this by passing flags instead of
booleans in a long list of arguments and add a test to verify the
code path.
FLAG: EXEMPT bugfix
Fixes: 348944802
Test: presubmit
Change-Id: I58f12e5cf81cb59115c1b9c500ac1e18a8ec72e5
|
|
The SF main thread is accessed twice during screenshots,
which leads to possible inconsistent states between jumps
onto the main thread. Removing the double hop preserves
correctness and reduces the amount of computation taking place
on the main thread. The only time the main thread should be
accessed should be when getting layer snapshots. All other
work related to screenshots can take place in a binder thread.
Bug: b/294936197, b/285553970
Test: atest SurfaceFlinger_test
Flag: com.android.graphics.surfaceflinger.flags.single_hop_screenshot
Change-Id: If9fd36f82c2d550bc0821b52fef3ea88b8099116
|
|
Legacy path to get layer snapshots is no longer used
and the flag can be removed to clean up the code.
Also renames layer snapshot function variable for better
clarity that the function is not immediately called wherever
declared.
Bug: b/330785038
Test: presubmit
Test: atest SurfaceFlinger_test
Change-Id: I12498f2560de07d69fff93eda901f6b7c072fce6
|
|
Cleans up renderArea logic and allows all the work that needs
to be done on the main thread in the same place. This will aid
in the effort to reduce the number of hops to the SF main
thread during screenshots.
Bug: b/294936197
Test: atest SurfaceFlinger_test
Test: presubmit
Change-Id: I4234b49638aaecceb8d1fcff7f5cd43698b6c47f
|
|
Use a builder to pass around parameters used for RenderArea
creation. This allows more flexibility for when the RenderArea
is created, which aids in the overall goal of reducing the
number of SF main thread hops during screenshots. Creating a builder
will allow the render area to later be passed into
captureScreenCommon() without being wrapped in a future.
Bug: b/294936197
Test: atest SurfaceFlinger_test
Change-Id: I9545e02af42c7e6cd9b0c328e2ecce995811f2d7
|
|
Create helper functions to improve readability of what is scheduled on
the SurfaceFlinger main thread. This will allow for cleaner changes in
reducing the calls on the main thread for screenshots. Changes include
some renaming for better clarity.
Bug: b/294936197
Test: presubmit
Test: atest SurfaceFlinger_test
Change-Id: I3643b27b98e20578c51f90f6ab61d1aa2e3458bb
|
|
This reverts commit b43b58378679bf4ac8d0837047187d4509bc45d8.
Reason for revert: Appstartup regression found in b/327488235
Change-Id: I8d975b81afd2cde1d543e8bc7e730a6e42393bec
|
|
Create helper functions to improve readability of what is scheduled on
the SurfaceFlinger main thread. This will allow for cleaner changes in
reducing the calls on the main thread for screenshots. Changes include
some renaming for better clarity.
Bug: b/294936197
Test: presubmit
Test: atest SurfaceFlinger_test
Change-Id: I729b62b3fc1919b5b048b7992b4aead336e87d7f
|
|
Allow outputs to decide if they want to render protected content, not
just if they support it. The current code checks if the Output is secure
when deciding whether to render protected content. By adding a new flag,
it will allow displays to decide if they want to render secure,
protected, or both.
This code doesn't have a way to create displays with only protected and
will still rely on the isSecure flag to ensure backwards compatibility.
Test: presubmit
Fixes: 285553970
Fixes: 300492271
Change-Id: If5e65388825d37f4ddaea5190259a136cfa89264
|
|
Screenshots do not set useIdentityTransfrom to true with
a rotated display. The default value is false in
SurfaceFlinger and is not relevant for captureLayers,
which is the API that will be used for screenshots going
forward. Rotation flags are no longer relevant in
DisplayRenderArea and rotation values can be simplified
to 0 rotation by default.
Bug: 293445881
Test: atest LayerStateTest
Test: presubmit
Change-Id: Id0cce05458c3daa4078097057f00fd856df1e092
|
|
Revert submission 23423266-SF-Config
Reason for revert: UIBench Jank Regression reported in b/288665387
Reverted changes: /q/submissionid:23423266-SF-Config
Change-Id: I0942f99fec1f211e607e3ff44da2dfa0e30d34c2
|
|
This pulls out all the individual configuration constants read by
SurfaceFlinger in its constructor, and moves them to a new
surfaceflinger::Config structure which is passed to the constructor.
All the initialization is the functionally the same, a few values turned
out to not be used, so were removed (mMaxGraphicBufferProducerListSize,
mGraphicBufferProducerListSizeLogThreshold). Otherwise all properties
read for the new structure consistently use android-base/properties.h to
read them.
To keep the argument count down, the SurfaceFlinger factory argument to
the constructor was moved to be stored in the new Config structure.
As a result of the change, SurfaceFlinger now only has one constructor.
The tests were using the other constructor (passing
SurfaceFlinger::skipInitiailization) to skip over the property reads to
help ensure a hermetic configuration of SurfaceFlinger. The tests can
now instead create create a minimally configured Config structure, and
pass that the structure.
The other changes were then to switch over to using the values in the
Config structure, both internally to SurfaceFlinger, as well as in other
files including Layer.cpp and DisplayDevice.cpp. In some cases, those
changes required altering the arguments to the function being called to
obtain the values, since originally some of the values where static
member data in SurfaceFlinger.
There were similar changes required for the tests and the fuzzers, to switch over,
including how some tests mutated the configuration values so that they
overall coverage was the same.
No new tests/fuzzing was added, though it should now be easier to extend
coverage.
Test: atest libsurfaceflinger_unittest
Bug: None
Change-Id: I8dc3c2317a92b256e58ec45190e24463032c2f8e
|
|
Previously screenshots always rendered to either an SDR or a wide gamut
colorspace. For screenshotting HDR content, this is only appropriate
when the resulting screenshot (a) never leaves the device and (b) the
relevant code has workarounds for the display to appropriately handle
its luminance range.
HDR screenshots will now have two paths:
* A standard path for rendering to HLG. HLG was chosen because the OOTF
shape is less hand-wavey than PQ's, does not require metadata, and
bands less at 8-bits of color.
* A special path for "display-native" screenshots. This is for
use-cases like screen rotation where there are stricter color accuracy
requirements for round-tripping.
Skia already encodes the resulting screenshot by supplying an HLG CICP
alongside a backwards-compatible transfer function, so it's only
sufficient to change how SurfaceFlinger renders.
Bug: 242324609
Bug: 276812775
Test: screencap binary
Test: rotation animation
Test: swiping in Recents
Change-Id: Ic9edb92391d3beb38d076fba8f15e3fdcc2b8f50
|
|
Test: atest ScreenCaptureTest ScreenCaptureChildOnlyTest
Bug: 267324693
Change-Id: I6ab421e2f9e5bc0ab1422d88ddf2628776347a6f
|
|
Use the new screenshot function but add support for a
layer filter used by region sampling code.
Test: check gesture nav bar color
Test: atest libgui_test
Bug: 238781169
Change-Id: I1c9370fd59b290fd1451d5c77cd27c275c685090
|
|
This prepares us for frontend changes which do not rely on the Layer
object. Instead we change the traversal function to return
a z-ordered list of snapshots. This cl also changes some of the logic
to check the snapshot instead of the layer drawing state.
Bug: 238781169
Test: presubmit
Test: manually test hdr listeners
Change-Id: If508f9380fdef0414bbf448ece767be3e0bba9cf
|
|
Cleanup before layer refbase removal. We
can lookup the stop layer by using a unique id.
Bug: 238781169
Test: presubmit
Change-Id: I33da6899adebc33c814656591f78187f08c53e80
|
|
Captured screens for region sampling were originally rendered
upside-down, which required swapping coordinates to sample from the
correct area in the output buffer. Since then, several fixes to the
screenshot path have landed, which treat screen orientation
consistently, so the captured images are no longer upside-down. But,
the coordinate swapping was never removed. Remove it now, as sampling
during landscape is now broken.
Bug: 133849373
Bug: 241967077
Test: Split screen in landscape with settings app in dark mode,
calculator in light mode, and trigger back gestures
Change-Id: I52c65032d33d01a4407dc1b30215e7edac6eb1ea
|
|
Change-Id: I347b2cf57f1df426d11d07a84075419597d4a442
Test: presubmit
|
|
Convert the unique_fd of RenderEngineResult (and futures thereof) into
sp<Fence> such that postFramebuffer does not duplicate release/present
fences.
Remove a few copies of shared futures/pointers with std::move.
Bug: 232436803
Test: simpleperf (-33% cycles in sys_dup)
Change-Id: Ia7c6c8333a712441f3612fb5c720ea2932799636
|
|
Remove duplicates and avoid circular dependency issues when migrating to AIDL.
Bug: 211037638
Test: manual
Change-Id: I37dd03d06e7bd6346d3b93e3acc61e7d481fda9f
|
|
Expose GraphicBuffer properties via ExternalTexture class. Within
SurfaceFlinger access the buffer via this proxy interface.
This allows us to inject and mock GraphicBuffers as needed.
Specifically this will be used to recreate layer state from
transaction traces.
Test: compiles
Bug: 200284593
Change-Id: I2e7f6bee28314b70eac477cfadbf9f94c4d70339
|
|
This addresses security vulnerabilities due to hard coded binder
interface.
Bug: 195660647
Test: (1) atest RegionSamplingTest
(2) install Google I/O 2019 app, tap Agenda menu, scrolling to
examine the bottom horizontal bar color changes
Change-Id: If2d33c5168b2df5fc7fd8f55e3bca75d3f385a89
|
|
Keep the change of Second Patch for async RenderEngine and fix the
regression
- remove the vector variables which is to store futureFence locally in
BufferStateLayer to get avoid fd leaking
- screenshots initiated from the app don't wait on the SF main thread.
2109270e74a18585aceffc94d1758cee47bb4175
Bug: 202843200
Bug: 202833127
Bug: 202808760
Test: Wembley PIN setting test, NexusLauncherOutOfProcTests
Change-Id: I87847d01e2e330ddec88272cd8608f0b78c0a2cd
|
|
Define an ICompositor interface against which MessageQueue (which ought
to be an implementation detail of Scheduler) is implemented. Change the
equivocal invalidate/refresh nomenclature to commit/composite. Schedule
sampling only after composite.
Bug: 185535769
Test: libsurfaceflinger_unittest
Change-Id: I0c18f312459bae48531449f24f7b53c104fc5812
|
|
Region sampling listener accepts coordinates already in the correct orientation, no additional transforms are needed.
Bug: 178777512
Test: download Google I/O 2019 app, check system gesture navigation bar
color
Change-Id: I73f78a2a8390beb29b7ab33b2bed2b0326d367b1
|
|
Schedule the region sampling thread more wisely by estimating when
the next invalidate is going to happen. This makes the region sampling
to be scheduled often at times where the main thread is idle, without
eating the budget in an invalidate message.
Bug: 181983990
Test: SF unit tests
Test: observe systrace
Change-Id: I1faca3aa7f882ed7c69e77e6a0877c10d57f0f1c
|
|
Revert submission 14199598-revert-14086921-renderengine-external-tex-QJNBWQMQEU
Reason for revert: Prepare for relanding
Reverted Changes:
I01e65a7f4:Revert "Update WaylandRenderSurface to accomodate ...
I7d58118c1:Revert "Update Readback VTS to align with RenderEn...
I1501890f4:Revert "Add ExternalTexture class into RenderEngin...
Added the following fixes:
1. CachedSet renders to intermediate texture variable rather than
mTexture directly, since mTexture is not guaranteed to be nonnull.
2. Add null check when setting new buffer in BLAST.
Bug: 185524947
Bug: 180767535
Test: builds, boots
Test: librenderengine_test
Change-Id: I52ea82e24336b496d996bbe3e445db0affe1abb8
|
|
Revert submission 14086921-renderengine-external-tex
Reason for revert: Potential culprit for b/185361988
Reverted Changes:
I7796764e2:Update WaylandRenderSurface to accomodate interfac...
I13904eec4:Update Readback VTS to align with RenderEngine int...
I222c71e6e:Add ExternalTexture class into RenderEngine interf...
Change-Id: I1501890f4861a3df7ce273f1fe2ccdb275e2632c
|
|
ExternalTexture is an RAII structure that wraps raw GraphicBuffers that
are passed into RenderEngine. ExternalTexture's role is to help with
managing GPU resources of GraphicBuffers by mapping buffers into
textures, EGLImages, or AutoBackendTextures depending on the
RenderEngine backend. Under the hood, mapExternalTextureBuffer and
unmapExternalTextureBuffer (renamed from cacheExternalTextureBuffer and
unbindExternalTextureBuffer respectively) are used to help tie
resource management to the ExternalTexture lifetime.
The main motivation for this is that currently managing buffer
lifecycle has historically been errorprone and caused memory leaks, so
this improves code health.
As part of this:
* mapExternalTextureBuffer and unmapExternalTextureBuffer
are now protected methods, and are never called outside of RenderEngine
with the exception of creating and destroying ExternalTextures.
* Because GLESRenderEngine's output buffers are cached differently from
Skia RenderEngine, if there are output-only buffers then disable the
mapExternalTextureBuffer calls whenever GLESRenderEngine is used.
* Custom RAII classes in the Planner and in BufferLayerConsumer are now
removed since they're subsumed by ExternalTexture
* RenderSurface now controls its own management of ExternalTextures in a
small queue
* cleanFramebufferCache is now unimplemented for Skia, because
ExternalTextures are now deleted whenever a RenderSurface is deleted.
Bug: 180767535
Test: libsurfaceflinger_unittest
Test: libcompositionengine_test
Test: librenderengine_test
Test: Simulate virtual displays
Test: Screen reotation
Test: Movie playback on Google TV
Test: Force GPU composition
Test: screenshot
Change-Id: I222c71e6e1c67485cdeac49e2cb829289af9efec
|
|
Some of SF's threads are using a too long name which cause
pthread_setname_np to fail.
Fixes: 183128214
Test: systrace
Change-Id: I473342857bfa0642f99c8910020114ae37559cbb
|
|
This is only enabled when the skia threaded variant renderengine is
enabled. This essentially defers texture deletion until after
drawLayers() is invoked, which shaves off time from the main SF thread.
Bug: 179959621
Bug: 180767535
Test: perfetto trace
Change-Id: I333091d8792fdd0dc01076c73af2956da9ee73df
|
|
We're getting reports of buffers transiently missing usage bits when
allocated from SurfaceFlinger causing strange issues. Fatal logging when
there is an allocation error will hopefully aid in triaging future bug
reports.
Bug: 157562905
Bug: 179786581
Test: build, boots
Change-Id: I715295c0b6b3450e71181d93391dd99616f89d26
|
|
Added frameScaleX and frameScaleY to replace frameScale to allow callers
to specify an X and Y scale separately.
Added grayscale flag to allow the caller to take the screenshot
in grayscale.
Test: ScreenCaptureTest.CaptureWithGrayscale
Bug: 155825630
Change-Id: Iea043b7074707df897d80bf057d7cc3870afad89
|
|
* changes:
SurfaceFlinger: return DisplayStatInfo from getDisplayStatInfo
SurfaceFlinger: optimize frame rate override
|
|
Code cleanup - return the class instead of passing it as an
output parameter.
Test: SF unit tests
Change-Id: I7a995415a81f3944d93a1cb573c8e3108464bd07
|
|
Compile with -Wextra for additional conversion checks. In each file
which produces compile errors -Wextra is ignored.
Bug: 175126758
Test: m surfaceflinger && m libsurfaceflinger_unittest
Change-Id: Iec6bcc699715a99c8c65d891ab3c0481e884c728
|