SquashFrame previously didn't run if there was only one overlay
layer in the layer stack. This would cause false failures when
the incoming composition was composed of one or more layers with
a precomposition or squash layer.
To fix this, count all layers which are not disabled, and only
skip squashing if there is just one content layer.
BUG=b/29122961
TEST=Tested on smaug with vertical multi-window YouTube
Change-Id: Icb175b7701928136730442a39c4717a780d34cfd
Signed-off-by: Sean Paul <seanpaul@chromium.org>
If we drop a frame while compositing, free the active composition.
Assume a frame pipeline of A->B->A. If we drop frame B, it will become
the active composition, which means the fences for A will not be released,
causing us to block A on A --> DEADLOCK.
BUG=b/29122961
TEST=Tested on smaug, no longer hangs
Change-Id: I98817bb361f1d0669395ddac5d96cf4f19d4b26a
Signed-off-by: Sean Paul <seanpaul@chromium.org>
Use the new Planner interface to handle the layer->plane mapping.
This allows us to simplify the Plan() function by offloading the
plane provisioning to the platform specific code.
BUG=b/28117135
TEST=Tested on ryu with a variety of window layouts/workloads
Signed-off-by: Sean Paul <seanpaul@chromium.org>
Change-Id: I75a0c5d87a9096e7a83ecbc848c75fee42ee1131
This patch introduces a new Planner interface to the platform specific
code. This new interface will allow for platform-specific plane provisioning
decisions to cover various hardware quirks.
Each platform must provide a Planner with one or more PlanStage steps. These
stages are run in order and are used to move the given layers onto composition
planes.
There are two generic stages provided by the platform:
- Protected: Places layers on dedicated planes
- Greedy: Provisions as many layers to planes and sticks the rest in precomp
There is also one platform-specific stage included:
- ProtectedRotated: Places any protected & rotated layer on the primary plane
BUG=b/28117135
TEST=Tested on ryu with a variety of window layouts
Signed-off-by: Sean Paul <seanpaul@chromium.org>
Change-Id: Ib6062ab4779166753afaf122450bb63126bf9161
Simplify the SquashAll() function by generating the composition
without using Plan(). This allows us to specify exactly what we
want on the screen without involving the normal plane provisioning
code.
BUG=b/28117135
TEST=Tested on ryu, squashing still works
Signed-off-by: Sean Paul <seanpaul@chromium.org>
Change-Id: Ieec9c323941e2a80252b33d14563c4d218d38dfb
Instead of passing a bunch of member data to a static function, make
SeparateLayers a member of DrmDisplayComposition. This will be simplified
further once the Planner interface is implemented.
BUG=b/28117135
TEST=Tested on ryu
Signed-off-by: Sean Paul <seanpaul@chromium.org>
Change-Id: Ia4e15aa20b6dc14b044ee1dec7b5fce514278be7
Now that DrmCompositionPlane is classified, move the type into it
as a subclass.
BUG=b/28117135
TEST=Tested on ryu
Signed-off-by: Sean Paul <seanpaul@chromium.org>
Change-Id: I774f477e75b3a2e2916c5d98931730dac46d3877
Instead of a 1:1 mapping of layer:plane, use a vector to store
source layers for a composition plane. This will allow us to
represent squash compositions more easily by adding all source
layers to the vector.
This should also facilitate hardware which allows multiple fbs per plane.
BUG=b/28117135
TEST=Tested on ryu
Signed-off-by: Sean Paul <seanpaul@chromium.org>
Change-Id: I5d4bfc6e9da022eaab047f948cc874d6a8a25746
Instead of encoding the plane/composition type in source_layer,
move it to its own explicit type. This will allow us to expand
source_layer to include more than one layer.
BUG=b/28117135
TEST=compiles and runs on smaug
Change-Id: I19b1ed8e395347bbefb0fb6a0ab02d6ac0e5c1c1
Signed-off-by: Sean Paul <seanpaul@chromium.org>
So they now say "platform" instead of "importer"
BUG=b/28117135
TEST=None
Change-Id: I7fe6bc7d31ca448ef561d78f7806fa487eb612f6
Signed-off-by: Sean Paul <seanpaul@chromium.org>
Final step in the platform renaming, move the drmgeneric and
nvimporter files to their new place.
BUG=b/28117135
TEST=compiles
Change-Id: Ied60a82526f42f13a64192373cb49f3dfffef74f
Signed-off-by: Sean Paul <seanpaul@chromium.org>
Rename the guards in the platform headers to match their
filename. This wasn't done in the previous commits so the
diff remained clean.
BUG=b/28117135
TEST=compiles
Change-Id: Ie495bd8e00784da1d48f200c6981f23448b7c6d2
Signed-off-by: Sean Paul <seanpaul@chromium.org>
Now that importer.h is platform.h, move the platform-specific
headers to match.
BUG=b/28117135
TEST=compiles
Change-Id: I08563505b77529257892841845ef4117d2992bb0
Signed-off-by: Sean Paul <seanpaul@chromium.org>
We're going to need more platform-specific stuff, so lump it
all in the same header.
BUG=b/28117135
TEST=compiles
Change-Id: Idfe82e9a29a0bcd284a02b2e58af0e620fdc542b
Signed-off-by: Sean Paul <seanpaul@chromium.org>
The old code didn't dereference the layer index from the
bitmask which caused it to subtract layers it shouldn't
have. In order to do this right, we need to look at the
layer index corresponding to the bit in the id_set to
ensure we're excluding the correct layers.
BUG=None
TEST=Precomposition doesn't draw over dedicated layers
Change-Id: I8531e1ef3b2beb4674041145e2b38ce4b3dbe346
Signed-off-by: Sean Paul <seanpaul@chromium.org>
So scaled layer transitions between hw plane and gl plane look better.
BUG=b/28431632
TEST=Tested on low resolution paused YouTube video
Change-Id: I507722c28c5b8ec4e8d16ae436a04afc8cffaa0f
Signed-off-by: Sean Paul <seanpaul@chromium.org>
This patch changes two things with respect to protected layers:
1- It provisions the HW plane in the correct position. ie: if
the background layer is slated for a HW plane, it will be
placed on the primary layer and the protected layer will be
placed on top of it.
2- It punches a hole through the precomposite and squash layers
such that when they are placed on top of the protected layer,
they do not obstruct it.
BUG=b/27502957
TEST=Tested on smaug with multi-window with a variety of different
layouts and visible layers
Change-Id: Ie30939f2bb750dbe3faa558ddb094b677f41f45e
Signed-off-by: Sean Paul <seanpaul@chromium.org>
gralloc_bo is not used anywhere and depending on it pulls in unnecessary
dependencies from drm_gralloc, so remove it.
Change-Id: I81b9dc88124ea6a0e66e188656d44215e735d177
Signed-off-by: Rob Herring <robh@kernel.org>
A cleanup patch to fix the build warnings that have surfaced
from the new build system.
BUG=None
TEST=Builds without warnings
Change-Id: I2ad898e627d451f87705d2bdf06a315b8e1c7a1c
Signed-off-by: Sean Paul <seanpaul@chromium.org>
Add a hotplug event handler to handle hotplug events. Upon
hotplug, the handler is responsible for finding and setting
the preferred mode of the new display.
BUG=chrome-os-partner:41682
TEST=Tested on ryu with DP
Change-Id: Ide57382624c7839ed81a712bc29ea2e1cc19dcae
Signed-off-by: Sean Paul <seanpaul@chromium.org>
Ensure we turn the connector on after we set the active mode.
BUG=chrome-os-partner:41682
TEST=Tested on smaug with DP
Change-Id: I3410a1ac261fb0848d668c5baef2d77eb860017b
Signed-off-by: Sean Paul <seanpaul@chromium.org>
This patch adds a worker which listens to drm events. If the
drm event has a handler associated with it, the listener will
call the handler.
BUG=chrome-os-partner:41682
TEST=Tested on ryu with DP
Change-Id: I5d691d191425604766a00be3e72111095d025d06
Signed-off-by: Sean Paul <seanpaul@chromium.org>
So we don't end up redeclaring its classes.
BUG=None
TEST=Compiles
Change-Id: Ic15ba4412f11bad8ef7ec4f68af6ad87e0d674cc
Signed-off-by: Sean Paul <seanpaul@chromium.org>
So we can determine if it's connected or not.
BUG=chrome-os-partner:41682
TEST=Tested on ryu with DP
Change-Id: Ie0dadb2737d3a98257fb6e4fa02f17d7dae44f6c
Signed-off-by: Sean Paul <seanpaul@chromium.org>
drm_hwcomposer is currently using preliminary version of the atomic API.
The final version merged upstream is slightly different. Convert it to the
upstream API.
The most significant change is positive return values for
drmModeAtomicAddProperty are not a failure, so we need to test for
negative return values instead of non-zero.
BUG=none
TEST=Tested with 4.4 kernel on virtio-gpu and freedreno
Change-Id: I0b1f4bcd7766a3053a484f55e01c8b2ba56d716d
Signed-off-by: Rob Herring <robh@kernel.org>
Allow virtual connector type in order to support virtio-gpu.
BUG=none
TEST=Tested with virtio-gpu on QEMU
Change-Id: I7ae5091d3587bcae75da6bff23d7bc85aa6164f1
Signed-off-by: Rob Herring <robh@kernel.org>
Increase the fence wait value each time by a factor of 2.
Bug: chrome-os-partner:48289
Test: Run apps and see no frame drops
Change-Id: I9b7b910e5a8c9d287ea69b13dca0d4c1194ac86c
Signed-off-by: David Ung <davidu@nvidia.com>
So people know who to bug for reviews.
BUG=None
TEST=None
Change-Id: I20bb80929a7fac59ca2137b415c9d0e000d79c54
Signed-off-by: Sean Paul <seanpaul@chromium.org>
Previously this was not called for compositions which were known to
fail the atomic test. Unfortunately this left the composition in a
state which could not be processed by SquashFrame (only one layer and
source_layer was still set to kSourceSquash).
So call PrepareFrame() on every composition so SquashFrame stays happy.
Change-Id: I976e344ce4970370d9ca4307c2f2c45025199b64
Signed-off-by: Sean Paul <seanpaul@chromium.org>
Previously, we would only test the first frame when the geometry
changed. However, if SF sent us the same composition with different
FBs, we could end up sending invalid frames to the kernel.
This change saves the result of the atomic_test between geometry
changes so we avoid using hw composition for all invalid frames.
Bug: 25866352
Test: Tested on smaug, observed squashes between geometry changes
Change-Id: I3b5d9e83a870481bf2e6869900eafaf0ca66a0d5
Signed-off-by: Sean Paul <seanpaul@chromium.org>
Do not check the composition with kernel for every frame. We are currently
using synchronous atomic ioctl calls, so all test-only calls are serialized
with the actual commits.
BUG=25866352
TEST=same test procedure as crosbug.com/p/47206
Change-Id: Ia423243c279fc677ff6213115a8f20efa40c235e
Don't composite layers whose bounds are entirely off screen, or
which have width or height of 0.
Bug: chrome-os-partner:47938
Test: Swipe between videos in Google Photos
Change-Id: I29671db6763caf3cb764b06d1ff955276ebecd80
Signed-off-by: Sean Paul <seanpaul@chromium.org>
The correct blending mode for the GL output is actually premult, because
regardless of the original layer blending mode, the result RGB components
are always pre-multiplied with alpha already.
This prevents the result of a SquashAll() from getting multiplied by
alpha twice.
BUG=25838542
TEST=verify the blinking is fixed on the status bar icons
Change-Id: Ie5bbc53110c342576b81818da6069cba201db609
Because sometimes one just ain't enough, allow more than
one transform at a time.
Bug: chrome-os-partner:46710
Test: Tested with the CTS Verifier "Camera Orientation" test
Change-Id: Ie5f9bbbc7c89964feafc78150e18512861c85b69
Signed-off-by: Sean Paul <seanpaul@chromium.org>
Before we send a composition to the frame worker and display, run it
through the kernel to test whether it can be put on hardware. If the
kernel rejects the composition, use the squashing code to flatten it
on one layer and send the result to the frame worker.
Bug: 25379136
Test: Tested on smaug, frames were squashed, fun was had
Change-Id: Icac3c034d0eb4c0becbdc0f8ace1de75ab8ae2b8
Signed-off-by: Sean Paul <seanpaul@chromium.org>
Split the SquashAll function into SquashAll and SquashFrame. This
will allow us to squash arbitrary compositions without using the
active composition or applying it to the screen.
Bug: 25379136
Test: Tested on smaug
Change-Id: I1767f731e14f36540151556ce07373848b604030
Signed-off-by: Sean Paul <seanpaul@chromium.org>
Allow the caller of CommitFrame to run the commit in "test only" mode
which will send the frame to the kernel, but won't actually change any
registers.
Bug: 25379136
Test: Tested on smaug
Change-Id: I831b5f17d433bc60d9f107689feb1d7672c100a9
Signed-off-by: Sean Paul <seanpaul@chromium.org>
Instead of creating the mode blob right before doing the modeset,
create it as soon as the modeset is queued. This will allow us to
use the blob for both atomic test as well as commit.
In addition to keeping the blob around, store the blob's id while
the mode is active so we don't need to look it up when/if the next
modeset comes in.
Bug: 25379136
Test: Tested on smaug
Change-Id: I60e6f83310ea0601388bb31b63d25c6fd7b8fc4d
Signed-off-by: Sean Paul <seanpaul@chromium.org>
This complicates returning layers to the active composition on failure. They
will not go back in the correct order and this will confuse all subsequent
attempts to use the active composition.
Change-Id: Iab6fae7b4a88f97206bac08237d574ff1bfd802f
DrmDisplayCompositor::SquashAll is triggered after a constant timeout in
DrmCompositorWorker::Routine. It will not be triggered more than one time
between genuine hwc_set calls. SquashAll has no effect if there are protected
layers, only one layer, or any errors. On success, SquashAll produces a new
DrmDisplayComposition that owns the layers in the planes of the active
composition and makes that the new active composition. SquashAll has no effect
on SquashState.
Change-Id: I975edb21847dcf2d93245f92a6e53a4e366c6a3b