aboutsummaryrefslogtreecommitdiff
path: root/hwcomposer.cpp
AgeCommit message (Collapse)Author
2015-10-12drm_hwcomposer: improve logging and reliability of some error pathsZach Reizner
Change-Id: I4a955c6261a9674009eec2264eb2ef4a161da9c4
2015-10-12drm_hwcomposer: fix small class consistency issuesZach Reizner
This also fixes a typo in an error message. Change-Id: Ie6c369f5eb2496ac3ebb342dbdcdd70f3a176495
2015-10-07drm_hwcomposer: support virtual displaysmarshmallow-dr-devHaixia Shi
Virtual display support is mandatory for HWC version 1.4. As a minimal implementation, we use frambuffer target and let SF take care of GLES composition. We still need to handle the acquire and release fences for both the virtual display and all layers in a separate worker thread. BUG=24609829 TEST=screen casting to chromecast Change-Id: Idb962f4b5bb852c9ec9ebcaa1679a653c01737fb
2015-10-07drm_hwcomposer: fill hwc_display_contents retireFenceFdZach Reizner
This restores the behavior of "drm_hwcomposer: Populate retireFenceFd" The retire fence is triggered when all releaseFenceFd's of the display's layers are triggered. Change-Id: Id06f2df03dcb9638ccbae23f46c42b05551fae6d
2015-09-30drm_hwcomposer: fix crash in hwc_set()Haixia Shi
For each display context we need to unconditionally call emplace_back() on layers_indices to ensure that entries in layers_indices correspond to the correct display. BUG=24506167 TEST=still builds and boots ok Change-Id: I6bc0858471c9ec51615c8ed7d8613529f77cb1ab
2015-09-25drm_hwcomposer: implement the safe handling of layersZach Reizner
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-09drm_hwcomposer: use HWC_FRAMEBUFFER_TARGET if all HWC_OVERLAY layers are skippedHaixia Shi
Apparently there are cases (such as during rotation) where SF will put content in framebuffer target and set HWC_SKIP_LAYER on all other layers. In this case we need to use the HWC_FRAMEBUFFER_TARGET layer. BUG=23936827 TEST=verify on ryu that rotation works Change-Id: Ice8ee5a023a92fc286dbf837a822fa6f6c0fde6b
2015-08-17drm_hwcomposer: add properties to disable overlays or to use HWC_FRAMEBUFFERZach Reizner
To use SurfaceFlinger's GL compositor, use the setprop command: $ adb shell setprop hwc.drm.use_framebuffer_target 1 A side effect of using the above property is that drm_hwcomposer will only be compositing one primary plane. To disable overlays (to force the GL compositor to be used more often): $ adb shell setprop hwc.drm.use_overlay_planes 0 The default behavior is the opposite of the above properties. Change-Id: I86afb533c10a8caa15931e8c292f52bb94e5f6c5
2015-08-13drm_hwcomposer: enhance stability using various wrapper classesZach Reizner
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-13drm_hwcomposer: style fixesZach Reizner
Change-Id: Id04a088a895f8372a32623713589d43d5e0495ef
2015-08-07Revert "Revert "drm_hwcomposer: remove compositor interface""Zach Reizner
This reverts commit 1c5e55680d9165d8f9bb2bc6e2c4261574b5d41d.
2015-08-07Revert "Revert "drm_hwcomposer: remove GLCompositor and the GLWorker thread""Zach Reizner
This reverts commit d078e4cab78f81057cd25355199caba5a147342e.
2015-07-30Revert "drm_hwcomposer: remove GLCompositor and the GLWorker thread"Puneet Kumar
This reverts commit abebc7a78fe8a4df6495c8e5064719dc92b04004. For now until we figure out a more stable solution for SF/hwc Change-Id: I7a505fc67873f943704e8b48db4167b9beca7691
2015-07-22drm_hwcomposer: remove GLCompositor and the GLWorker threadZach Reizner
They are dead code now that DrmDisplayCompositor uses GL directly. Change-Id: Ie4beeab60440a51bd87486847b5453e20288d1d8
2015-07-21drm_hwcomposer: Populate retireFenceFdSean Paul
Join all layer releaseFenceFd fences together to get the retireFenceFd for the display. Change-Id: I431ee227a62397b1900adb0caaf8b16b319a99cd Signed-off-by: Sean Paul <seanpaul@chromium.org>
2015-07-13drm_hwcomposer: Free failed composition in QueueCompositionSean Paul
Rather than maintaining ownership of the composition in the caller, free the DrmComposition in QueueComposition on failure. Change-Id: Id70e98ae1a8eef400bc29460bfc5a89c4707d617 Signed-off-by: Sean Paul <seanpaul@chromium.org>
2015-06-23drm_hwcomposer: Add tracing for the main functionsStéphane Marchesin
This will help the profiling efforts, now that all the low-hanging fruit is gone. BUG=none TEST=run systrace, see tracing Change-Id: I9a149afdea8b84837c19f8e224ce8a7e2db1dd9a
2015-06-19drm_hwcomposer: Switch to triple bufferingStéphane Marchesin
This increases the performance of the UI (30->40 fps). BUG=none TEST=boot to UI, swipe between desktops, measure fps Change-Id: Ie0ff4b51c3db402a40c9676d3f09d48d85097bce
2015-06-15drm_hwcomposer: Use atomic modeset to set crtc timingSean Paul
Use the new drm blob ioctl and atomic modeset properties to do atomic modesetting, as opposed to the old setCrtc call. This allows us to set timing as soon as the system layer requests a new active config, as opposed to delaying it until we have an fb. Aside from reducing complexity, this should help with event control requests as we'll be able to service them with hw vblanks instead of synthesized sleeps. Change-Id: I9c80d44f52f52881a3a25b2ae518973d468bc110 Signed-off-by: Sean Paul <seanpaul@chromium.org>
2015-06-12Merge "drm_hwcomposer: integrate GLCompositor with hwcomposer" into mnc-devZach Reizner
2015-06-11drm_hwcomposer: integrate GLCompositor with hwcomposerZach Reizner
This patch makes it such that HWC will always composite all layers even if there are too few HW planes. Any layers that do not fit in a plane get rendered into a screen sized buffer by GLCompositor, the result of which uses up one of the available HW planes. Change-Id: Ibd560ae4c536632ac32d965152ceacd92bbba39f
2015-06-10drm_hwcomposer: Add Dump() to the Compositor interfaceSean Paul
Add a Dump() function to the Compositor base class and pipe it through hwcomposer. This can be invoked from the shell by running "dumpsys SurfaceFlinger". Change-Id: I87646f4e926ac6d52a04ba130957abdfab99c491 Signed-off-by: Sean Paul <seanpaul@chromium.org>
2015-06-04drm_hwcomposer: Move event worker into VSyncWorkerSean Paul
Using the new Worker interface, split out the event worker now that it just handles vsyncs. Change-Id: I7ebc6237b10411fdba3b8826935921b8c83c4b6c Signed-off-by: Sean Paul <seanpaul@chromium.org>
2015-06-04drm_hwcomposer: Use hw planes + drm atomic interfaceSean Paul
Replace the basic, single overlay, modeset/flip implementation with a new Compositor instantiation for drm. The new compositor uses the drm atomic interface to composite layers to multiple hardware planes. This change also introduces an importer argument in Compositor::CreateComposition. By specifying the importer, Compositor instances are responsible for cleaning up buffer objects submitted via Composition::AddLayer. Change-Id: Ic292829cd93475d754294b00428de132301092b2 Signed-off-by: Sean Paul <seanpaul@chromium.org>
2015-06-04drm_hwcomposer: Wrap the importers in a classSean Paul
This will allow us to move the importer functionality into the drmcompositor. Change-Id: I4274ebd1776c4d7879342c54a2b7c4095ebc50f4 Signed-off-by: Sean Paul <seanpaul@chromium.org>
2015-05-13drm_hwcomposer: Set requires_modeset() to false after modesetSean Paul
Reset requires_modeset on a crtc once the initial modeset is completed. Without this, we'll just do modesets instead of flips. Change-Id: I998914c914ccb97346ed194a993c703f387bf93b Signed-off-by: Sean Paul <seanpaul@chromium.org>
2015-05-11drm_hwcomposer: Store displays in std::mapSean Paul
Instead of a fixed length array, use a std::map for displays. Change-Id: I77a4893f3051d6af4030e3208d096b5796796c84 Signed-off-by: Sean Paul <seanpaul@chromium.org>
2015-05-11drm_hwcomposer: Fix up #include orderingSean Paul
Change-Id: I9d808389c60b9d77c8e03a09aeaf3f309353cde8 Signed-off-by: Sean Paul <seanpaul@chromium.org>
2015-05-11Merge "drm_hwcomposer: Wrap libdrm ops (minus modeset/flip) in C++ classes" ↵Sean Paul
into mnc-dev
2015-05-11drm_hwcomposer: Wrap libdrm ops (minus modeset/flip) in C++ classesSean Paul
This allows us to compartmentalize a bunch of code/logic from hwcomposer.cpp into drm classes. Signed-off-by: Sean Paul <seanpaul@chromium.org> Change-Id: Id3f912126f1fdcd44d32c3eb4fba646f77590278
2015-05-07Add missing include for calloc/free.Dan Albert
Bug: http://b/15193147 Change-Id: Ibb2fb6fef4ca6a23eb2f53111c4b01847fe468b2
2015-05-04drm_hwcomposer: Update style to conform with Google Style GuideSean Paul
Change-Id: I9b1a7dbcb9b8c6b0a6eb3c6416b5e4898a5097d8 Signed-off-by: Sean Paul <seanpaul@chromium.org>
2015-03-20drm_hwcomposer: Introduce a new event worker to handle vblanks/flipsSean Paul
Instead of having a dedicated vsync worker for each display, factor out the drm fd wait from the set workers into a global event worker. This worker will dispatch vsync() callbacks to SurfaceFlinger, as well as unblock the appropriate set worker when flips complete. Change-Id: I169132b2a93a2c9feabcab116aab4e61861166e1 Signed-off-by: Sean Paul <seanpaul@chromium.org>
2015-02-26drm_hwcomposer: Cache FB and gem in gralloc bufferLauri Peltonen
Move drm fb object creation to the importer. In NV importer, use GRALLOC_MODULE_PERFORM_SET_IMPORTER_PRIVATE and GRALLOC_MODULE_PERFORM_GET_IMPORTER_PRIVATE to cache the hwc_drm_bo in the gralloc buffer. This avoids the need to recreate fb objects again each frame, and also greatly simplifies managing the lifetime of the gem handles. The drm_gralloc importer does not support caching at this point. In an attempt to keep it somewhat working, add hwc_import_bo_release function that hwc calls when it's ok to rm fb. If hwc_import_bo_release returns true, then hwc will clean up gem handles as it did before. We should consider doing a follow-up patch that adds fb/gem caching to drm_gralloc importer also. Then some of the code that is kept in this patch for backwards compatibility can be removed. Change-Id: I92857dcaddf8cea219ebc041e16ef76087a1b696 Reviewed-on: https://chrome-internal-review.googlesource.com/200895 Reviewed-by: Stéphane Marchesin <marcheu@google.com> Commit-Queue: Stéphane Marchesin <marcheu@google.com> Tested-by: Stéphane Marchesin <marcheu@google.com>
2015-02-23drm_hwcomposer: Initialize timeline_next to 1Sean Paul
Initialize timeline_next to 1, because point 0 will be the very first set operation. Since we increment every time set() is called, initializing to 0 would cause an off-by-one error where surfaceflinger would always composite on the front buffer. Change-Id: I1e67c36864716595eb489286a7db3f1dcb04f67e Signed-off-by: Sean Paul <seanpaul@chromium.org> Reviewed-on: https://chrome-internal-review.googlesource.com/200735 Tested-by: Alexandre Courbot <acourbot@nvidia.com> Reviewed-by: Alexandre Courbot <acourbot@nvidia.com> Reviewed-by: Allen Martin <amartin@nvidia.com> Reviewed-by: Sean Paul <seanpaul@google.com>
2015-02-22drm_hwcomposer: initialize timeline_nextAllen Martin
Initialize timeline_next to 0 Change-Id: I5d9f051ac659b06be19f5e5eaaab8a665f10832c Reviewed-on: https://chrome-internal-review.googlesource.com/200646 Reviewed-by: Sean Paul <seanpaul@google.com> Commit-Queue: Sean Paul <seanpaul@google.com> Tested-by: Sean Paul <seanpaul@google.com>
2015-02-22drm_hwcomposer: move AddFb/RmFb to reference gem handlesAllen Martin
Move drmModeAddFB2 and drmModeRmFB to ensure a reference to the gem handles are taken while the buffer is in use. Change-Id: Ib9afdb91144850480ecaac9d73601d887af5fa12 Reviewed-on: https://chrome-internal-review.googlesource.com/200686 Reviewed-by: Stéphane Marchesin <marcheu@google.com> Commit-Queue: Stéphane Marchesin <marcheu@google.com> Tested-by: Stéphane Marchesin <marcheu@google.com>
2015-02-22drm_hwcomposer: Check against gem handles for popped bufferAllen Martin
Add check before closing gem handle for most recently popped buffer in addition to buffers in queue. Change-Id: Icb096bd4db439b1195a123e28468142829fc61ea Reviewed-on: https://chrome-internal-review.googlesource.com/200725 Reviewed-by: Stéphane Marchesin <marcheu@google.com> Commit-Queue: Stéphane Marchesin <marcheu@google.com> Tested-by: Stéphane Marchesin <marcheu@google.com>
2015-02-22drm_hwcomposer: Do not close gem handle if queuedAllen Martin
Fix an issue where if the same gem handle was queued twice we would close the handle when the first one came out of the queue, leading to a failure when calling drmModeAddFB2() on the second buffer. Change-Id: I0bd35158215f74b51111d2e259bca3ba5125b203 Reviewed-on: https://chrome-internal-review.googlesource.com/200715 Tested-by: Allen Martin <amartin@nvidia.com> Reviewed-by: Stéphane Marchesin <marcheu@google.com>
2015-02-14drm_hwcomposer: Support other drm nodes than card0Lauri Peltonen
On dragon, card0 = Nouveau, card1 = TegraDRM. Change-Id: Ie69639e40162ceb4ab99025dd9406ae44b7204c8 Reviewed-on: https://chrome-internal-review.googlesource.com/196021 Reviewed-by: Stéphane Marchesin <marcheu@google.com> Commit-Queue: Stéphane Marchesin <marcheu@google.com> Tested-by: Stéphane Marchesin <marcheu@google.com>
2015-02-13drm_hwcomposer: Fix fence leakLauri Peltonen
Hwcomposer is responsible for closing the acquire fences passed in during hwc_set. Make sure that it does so, even if there is an error condition. Change-Id: I5c9096804c2613ec317c306dd361cb5f1a2ba5b2 Signed-off-by: Lauri Peltonen <lpeltonen@nvidia.com> Reviewed-on: https://chrome-internal-review.googlesource.com/198356 Tested-by: Stéphane Marchesin <marcheu@google.com> Commit-Queue: Stéphane Marchesin <marcheu@google.com> Reviewed-by: Stéphane Marchesin <marcheu@google.com>
2015-02-10drm_hwcomposer: Remove drmSetMaster callSean Paul
Now that gralloc is using a render node, we can remove this call. This allows us to run as a non-root user as well. Change-Id: I46c9c16c7a9a169378e567d4973172f8392d441b Signed-off-by: Sean Paul <seanpaul@chromium.org>
2015-02-09drm_hwcomposer: Use prime to import gem handlesSean Paul
Change-Id: Id5d5f9a61f092f33130fed4d8b8d00fcaf401dea Signed-off-by: Sean Paul <seanpaul@chromium.org>
2015-02-04drm_hwcomposer: Set display config on initializationSean Paul
We shouldn't wait for surfaceflinger to set active config, initialize the display with a config. For now we just choose the first config in the list. This should change to a more sane choice, such as the preferred mode or something similar. Signed-off-by: Sean Paul <seanpaul@chromium.org> Change-Id: Ib063080c282cec28c9b0218c0ba5151d48b367ce
2015-02-04drm_hwcomposer: Ignore NULL display_contentsSean Paul
surfaceflinger will send in NULL display_contents in prepare/set, make sure we don't blow up. Signed-off-by: Sean Paul <seanpaul@chromium.org> Change-Id: Ia5085d4bd5e5928b52d81d14d027d0a162995946
2015-02-04drm_hwcomposer: Don't try to get configs for a disconnected connectorSean Paul
Short circuit getting the configs for connectors which are disconnected. Signed-off-by: Sean Paul <seanpaul@chromium.org> Change-Id: Ieabbf08f4d4a6c8b03f948399113e3ad04a2d93a
2015-02-04drm_hwcomposer: Store active mode instead of config indexSean Paul
Since the config indices can change out from under us, store the actual mode instead of an index. This avoids having to reset active_config when we get a new list from the driver. Signed-off-by: Sean Paul <seanpaul@chromium.org> Change-Id: I09a1ffbdde16c44ccc8a1d2865f09a5da22c2e26
2015-02-04drm_hwcomposer: Always perform a setcrtc initiallySean Paul
Always do a setcrtc on the first set(), this ensures things are set up the way we expect them to be. Signed-off-by: Sean Paul <seanpaul@chromium.org> Change-Id: I4279d4de64339e72f0e7f9b315b2b9695704c78c
2015-02-04drm_hwcomposer: Implement eventControl with vsync workerSean Paul
Adds a new worker to handle events requested by eventControl. Signed-off-by: Sean Paul <seanpaul@chromium.org> Change-Id: I6d63bb43b5f112e2efb0c426e7fd59910fc98953
2015-02-04drm_hwcomposer: Implement release and retire fences using sw_syncSean Paul
Once drm supports passing sync through, we'll move onto that. Signed-off-by: Sean Paul <seanpaul@chromium.org> Change-Id: I78bd5d380212b4aaec4b41dcba6cc882f1e5cc20