summaryrefslogtreecommitdiff
path: root/drmdisplaycomposition.cpp
AgeCommit message (Collapse)AuthorFilesLines
2017-02-28drm_hwcomposer: Clean up error conditionsSean Paul1-2/+6
Clean up error checking for some failure cases. BUG=None TEST=Tested on Qemu+drm_hwcomposer Change-Id: I98bca1aef09060b5a023375dce564252a6073b96 Signed-off-by: Robert Foss <robert.foss@collabora.com>
2016-05-16drm_hwcomposer: Use Planner interface to provision planesSean Paul1-156/+61
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
2016-05-12drm_hwcomposer: Don't use Plan() in SquashAllSean Paul1-0/+9
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
2016-05-12drm_hwcomposer: Move SeparateLayers into a member functionSean Paul1-36/+48
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
2016-05-12drm_hwcomposer: Move DrmCompositionPlaneType into DrmCompositionPlaneSean Paul1-10/+10
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
2016-05-12drm_hwcomposer: Use a vector for composition source_layersSean Paul1-32/+40
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
2016-05-11drm_hwcomposer: Add type to DrmCompositionPlaneSean Paul1-41/+46
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>
2016-05-10drm_hwcomposer: Fix protected layer hole punchSean Paul1-4/+6
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>
2016-04-18drm_hwcomposer: Don't composite over protected layersSean Paul1-14/+70
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>
2015-11-20drm_hwcomposer: Allow for multiple transforms at onceSean Paul1-19/+49
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>
2015-11-13drm_hwcomposer: avoid creating release fences for invalid OutputFdZach Reizner1-0/+6
This change also adds a check for OutputFd to see if it is valid. Change-Id: If992d523c707cc5e6e660de721938a26f27477d8
2015-11-06drm_hwcomposer: always put protected layers on hardware planesZach Reizner1-17/+49
Protected layers will not work inside of the GLWorker, so we are forced to put them into planes directly. Because we can now receive display contents which can never be properly composited (e.g. 4 protected layers on hardware with only 3 planes), some compromises had to be made for the composition planning algorithm. First all protected layers are given a plane. Then the remaining planes are used by the remaining layers, pre-composite buffer, and squash buffer. In the case where there are too few planes for both a pre-composite buffer and squash buffer, everything gets pushed into the pre-composite buffer and the squash buffer will not be composited onto the screen. Another major limitation is that any unprotected layers appearing behind a protected layer will actually appear on top of that protected layer. BUG=chrome-os-partner:43674 TEST=run protected content with lots of other layers Change-Id: I94620d93f68ca14dc1966422dc89035ab84e3ff4
2015-11-02drm_hwcomposer: fix spelling of "separate".Haixia Shi1-3/+3
It is spelled "separate", not "seperate". Change-Id: Id92d12aba42989a8a72e4596d425b2a9eea4e5ec
2015-10-23drm_hwcomposer: implement squashingZach Reizner1-79/+122
Change-Id: Ifd4feaa0de303ddfd519d4415ab31d2a72f26022
2015-10-15drm_hwcomposer: reimplement Dump for DrmDisplayCompositorZach Reizner1-0/+166
Also fixes hwc_dump sometimes failing to null terminate its output buffer. TEST=dumpsys SurfaceFlinger Change-Id: Ibf93cfd496a07a9375d78a8b239c2c7876aff986
2015-10-15drm_hwcomposer: ground work for squashingZach Reizner1-166/+207
This patch rearranges things to make squashing possible. The high-level changes: - A new Plan phase that happens in QueueComposition. This is where the overlay allocation is moved to. It's also the only safe time that the composition can try to plan squashing. This is because squashing depends on the exact ordering of compositions. - GLWorker now renders regions rather than layers. A region in this case is a clipping rectange and set of layers that are to be rendered in that rectangle. This is always what GLWorker did in the end, but now the work to seperate layers into regions is done externally. This was changed because the output of SquashState is a list of stable regions that need to be put through GLWorker The Plan methods of the Compositions are responsible for updating per-display SquashState and for allocation regions/layers to squashing, pre-composition, or hardware overlay. Because of the drastic changes to how composition planning works, it was necessary to bundle it with the GLWorker change. This change also includes plenty of other refactorings that were deemed to be too painful to try and seperate into another change. Change-Id: Ie7bfe077067e936a0862a07cbe87b525eab8d4f8
2015-10-01drm_hwcomposer: Process modesets via compositorSean Paul1-0/+13
This patch queues modeset in the compositor for application on the next frame. This allows us to perform the modeset atomically with the first frame that comes in after the mode is changed. Change-Id: I6bb9edd17bbdd6dbee5c0474f2e43599781cc7a7 Signed-off-by: Sean Paul <seanpaul@chromium.org>
2015-09-25drm_hwcomposer: implement the safe handling of layersZach Reizner1-141/+34
This is a sweeping change to discard our usage of struct hwc_layer_t outside hwcomposer.cpp. That was a dangerous struct that was a source of many of our errors. Replacing it with safer RAII-style classes reduces the amount and complexity of our code. Change-Id: I580cafdf89bd1e7e6583f3073858b8e78e6018ba
2015-09-21drm_hwcomposer: Plumb frame number through display compositionSean Paul1-2/+8
Having frame number in the composition is very useful for debugging transient issues, plumb it through the drm compositor stack. Change-Id: Ibc7555c89bea79c580b3201b11db4ced6360efb9 Signed-off-by: Sean Paul <seanpaul@chromium.org>
2015-09-04drm_hwcomposer: Allow NULL crtcs in display compositionSean Paul1-1/+1
In cases where we have displays which do not have a mode, the crtc will be NULL. This shouldn't fail the composition initialization. Change-Id: I1a6acb72cd3f614b5a7c854ba61be1539efa4bea Signed-off-by: Sean Paul <seanpaul@chromium.org>
2015-08-25drm_hwcomposer: Allow layer transformsStéphane Marchesin1-2/+0
They are very much valid now. I think this is just leftover? BUG=chrome-os-partner:42717 TEST=test rotation, it doesn't lock up Change-Id: I4cd96ae91c91452ef2be3cb3b07c123ce38ed576
2015-08-13drm_hwcomposer: enhance stability using various wrapper classesZach Reizner1-61/+182
This commit contains a lot of churn because it changes code to use automatic resource lifetimes as much as possible. As more things get changed, this is essential to maintaining stability. In addition, this change changes how layers are passed through the compositor API. Before each layer was passed down one at a time. Now they are passed in all at once. This is simpler for the implementation because it makes errors more atomic and makes decisions easier for the compositors. Change-Id: Ic3e6b5d0089fb1631ea256adcce9910ed8f38366
2015-08-07drm_hwcomposer: duplicate buffer_handles before hwc_set returnsZach Reizner1-2/+83
This is needed because SF will sometimes release buffer_handles before GL gets to using them for composition. Change-Id: I01db0975cc82d6b59bf4f9521a24071baf89c38a
2015-08-07drm_hwcomposer: fix buffer leak when using the GL compositor inside ↵Zach Reizner1-0/+4
DrmDisplayCompositor Change-Id: Id3a6deea9fc0f97640b34dacb25d36f3793f2d4e
2015-08-07Revert "Revert "drm_hwcomposer: have DrmDisplayCompositor do its own OpenGL ↵Zach Reizner1-0/+22
composition"" This reverts commit cbe9c01336e23a63259db65d22d63d6a697b8813.
2015-07-30Revert "drm_hwcomposer: have DrmDisplayCompositor do its own OpenGL composition"Puneet Kumar1-22/+0
This reverts commit 2317bb19d8663efc31e6fcd8cf7fd2a73577253d. For now until we figure out a more stable SF/hwc Change-Id: Ia5ca089610a487bf036a1ddd5fb62e504e02ad98
2015-07-20drm_hwcomposer: have DrmDisplayCompositor do its own OpenGL compositionZach Reizner1-0/+22
To accomplish this a few things changed: - DrmComposition::GetRemainingLayers always returns the number of planes needed - DrmComposition::AddLayer succeeds even if no DrmPlane was found for it - DrmDisplayComposition::AddLayer has overload that imports the given buffer - GLWorkerCompositor has a function to finish its composite before returning Put together this change makes DrmComposition always accepts all layers given to it even if it means some of those layers are assigned a NULL DrmPlane. The DrmDisplayCompositor will scan its given layers for any that are missing planes. In such a case, a DrmPlane is stolen from the last layer to receive a plane. Then all layers in the DrmDisplayComposition that have no planes (including the one stolen from) are composited synchronously using a GLWorkerCompositor and a new layer is generated from the results. That layer is added to the DrmDisplayComposition using the new import AddLayer function and the stolen DrmPlane. DrmDisplayCompostior then continues as usual. Change-Id: Ia6477c210c8f1307a4e537bec46889110d79ca18
2015-07-20drm_hwcomposer: make sure all fences are released for DrmDisplayCompositionZach Reizner1-2/+12
This change will release the layers passed back to SurfaceFlinger even on an error in the compositor thread. Change-Id: I22f622855c8c953a058b4a08d0af1ae427e4cbbd
2015-07-16drm_hwcomposer: Add rotation support for hw planesSean Paul1-3/+0
This patch adds support for transformed layers by using the rotation property on drm planes. Bug: chrome-os-partner:42093 Test: On smaug using adb shell content insert --uri content://settings/system --bind name:s:user_rotation --bind value:i:<R> Change-Id: I86bb8ef2f77b5d046a5fddd57db4b87070b5801f Signed-off-by: Sean Paul <seanpaul@chromium.org>
2015-07-13drm_hwcomposer: Disable unused planesSean Paul1-1/+9
Right before queuing up a composition, go through the list of unused planes and add disable markers such that they don't remain active when the new frame is posted. BUG=chrome-os-parter:42311 TEST=Tested on smaug, turned on/off bunch of times, no dup icons Change-Id: Ic2e5e210873efb6dc41fd43682fe00db33c2a28e Signed-off-by: Sean Paul <seanpaul@chromium.org>
2015-07-13drm_hwcomposer: Process DPMS requests through compositorSean Paul1-1/+15
This patch changes the behavior of DPMS in hwcomposer from applying asynchronously/immediately, to queuing in the compositor and being processed in order. This is desirable for a couple of reasons: 1- It ensures all frames set before set_power_mode are shown on the screen before it turns off 2- We make sure we don't rmfb a framebuffer that is currently applied to a disabled crtc. The second reason above can cause the display to turn back off once it's on since the fb will dereference to zero in the kernel and it will disable the pipe without notifying us. Change-Id: I2aab9ee0353b12fecced46766ed2dbb64f0aef4b Signed-off-by: Sean Paul <seanpaul@chromium.org>
2015-07-13drm_hwcomposer: Add composition type to DrmCompositionSean Paul1-1/+17
This allows us to have different types of compositions. This will enable injection of non-frame related compositions such as dpms and mode. Change-Id: Ia62421c114c0c6bebccef3ce6ae936366b6aafe2 Signed-off-by: Sean Paul <seanpaul@chromium.org>
2015-07-13drm_hwcomposer: Split the drm compositor into per-display threadsSean Paul1-0/+107
This patch splits out the current single drm compositor with per-display compositors, each with their own thread. The per-display compositors are hidden behind a singleton drm compositor. This allows us to maintain a whole-world view of all displays involved in a frame. This becomes useful if we start switching up crtcs/encoders for the displays. This also allows us to issue one DrmComposition when the frame is being assembled. The single DrmComposition handles the plane allocation (since they might switch between displays), and contains per-display compositions which are used to store the layer->plane/crtc information for each frame. The display compositors use the per-display compositions to display the frame on their output. Each display compositor receives a shared pointer to the frame's DrmComposition on QueueComposition. As a result, both the composition, and the per-display compositions, live for as long as any one display is still using it. While this is sub-optimal (since a display might never update again), this is probably fine for now. Finally, splitting things up per-display will allow us to inject non-compositing jobs into the composite queue. An example would be turning the display off, or setting the mode. This ensures that all frames in the composite queue are displayed before the mode changes or the display is disabled. Signed-off-by: Sean Paul <seanpaul@chromium.org> Change-Id: I8a233ea64710b238f70acbcde1f6d771e297b069