drm_hwcomposer: allow to force mode by a property (v5) The desired resolution can be set by property debug.drm.mode.force. The other modes are ignored. (v2) Resolve conflict after commit 13cc366 "drm_hwcomposer: use CamelCase in source/header files related to class" (v3) Changes due to commit a148f21 "drm_hwcomposer: Rework display modes handling" (v4) Changes due to commit 650299a2 "drm_hwcomposer: Tidy-up DrmConnector class" (v5) Changes due to commit 7d89911c "drm_hwcomposer: Tidy-up DrmDevice class"]]>
drm_hwcomposer: Rework HwcDisplay disposal to avoid races The code prior to this commit has a flaw: HwcDisplay::~HwcDisplay() { ... auto &main_lock = hwc2_->GetResMan().GetMainLock(); /* Unlock to allow pending vsync callbacks to finish */ main_lock.unlock(); At this point display is no longer in displays_[] list. After lock is released, hwc2 API thread starts to process transactions which may fail with BAD_SIAPLAY responce and cause SF to crash. vsync_worker_.VSyncControl(false); vsync_worker_.Exit(); main_lock.lock(); } 1. Rework the logic in order to avoid such scenariuos: 1.a. Temporary switch non-primary unplugged displays to headless state allowing remaining transactions to succeed without impacting the pipeline. 1.b. Give 100mSec delay before destroying / removing display from the displays_[] list to allow all pending hwc2 transactions to complete. 2. Support hotswap of the DrmDisplayPipeline, which makes primary display reattaching process smoother. Now SF should be able to gracefully remove all layers. Signed-off-by: Roman Stratiienko]]>
drm_hwcomposer: Add test utility to listen for uevents Dumping uevents is useful for debugging purposes. 1. Extract logic related to uevent socket into utils/UEvent.h class. 2. Use it by both UEventListener.cpp and tests/uevent_print.cpp. Bump clang-tidy level of UEventListener.cpp to normal. Signed-off-by: Roman Stratiienko]]>
drm_hwcomposer: Define DRM_FORMAT_XYUV8888 if missing Fixes drm_hwcomposer build for Android-9. Signed-off-by: Roman Stratiienko]]>Change-Id: I14e931c37c3d09284dfd338e6482a27cf21e0e10
drm_hwcomposer: fix sign-compare building error in uevent listener d26619b5 ("drm_hwcomposer: CI: Upgrade clang-* to v12") declared 'ret' as ssize_t but after commit 1e053b4e ("drm_hwcomposer: Make uevent listener standalone") drm/UEventListener.cpp is affected by the following builing error: external/drm_hwcomposer/drm/UEventListener.cpp:82:28: error: comparison of integers of different signs: 'uint32_t' (aka 'unsigned int') and 'ssize_t' (aka 'int') [-Werror,-Wsign-compare] for (uint32_t i = 0; i < ret;) { ~ ^ ~~~ 1 error generated. Fixes: 1e053b4e ("drm_hwcomposer: Make uevent listener standalone") Signed-off-by: Mauro Rossi]]>[RomanS: Fixed CI nitpicks] Signed-off-by: Roman Stratiienko Change-Id: Ia97d9019c21ac68be386a627cb101f6e423bbfc7
drm_hwcomposer: build with -std=c++17 cppflag Fixes the following building error: external/drm_hwcomposer/DrmHwcTwo.cpp:985:14: error: decomposition declarations are a C++17 extension [-Werror,-Wc++17-extensions] for (auto &[handle, layer] : layers_) { ^~~~~~~~~~~~~~~ 1 error generated. Signed-off-by: Mauro Rossi]]>Signed-off-by: Roman Stratiienko Change-Id: I236f16969e4500ff2efb79c06500bc4d3a3d810c
drm_hwcomposer: Rename DrmDisplayCompositor->DrmAtomicStateManager Primary responsibilities of this class are: 1. Send composition/mode/active state over DRM atomic commit IOCTL to the kernel 2. Track commit state and keep planes owned by the Pipeline while they are either displayed or staged for displaying. 3. Keep framebuffers alive while they are in use or staged. Not much related to composition itself, therefore rename it to DrmAtomicStateManager and move it to drm folder. Bump clang-tidy level of DrmAtomicStateManager.c to normal by fixing minor clang-tidy findings. Signed-off-by: Roman Stratiienko]]>
drm_hwcomposer: Remove AtomicCommitArgs::clear_active_composition field Now we can use empty DrmKmsPlan to achieve the same goal. + Remove unused HwcDisplay::ClearDisplay() Signed-off-by: Roman Stratiienko]]>
drm_hwcomposer: Remove RCAR-DU specific code. We are not testing it for more than year, therefore it's better to use generic logic for 'rcar-du' instead. Signed-off-by: Roman Stratiienko]]>
drm_hwcomposer: Rework KMS composition planner + plane sharing support Rewrite Layer-to-Plane planner. Get rid of ~200 redundant lines of code + added plane sharing functionality. Closes: https://gitlab.freedesktop.org/drm-hwcomposer/drm-hwcomposer/-/issues/11 Signed-off-by: Roman Stratiienko]]>
drm_hwcomposer: Implement SetActiveConfigWithConstraints Enough to get 100% passes in Composer 2.4 VTS. Some SOCs require a VTS fix to pass [1] [1]: https://android-review.googlesource.com/c/platform/hardware/interfaces/+/1954544 Signed-off-by: Roman Stratiienko]]>
drm_hwcomposer: Use single VSyncWorker per display Composer 2.4 will require another vsyncworker callback to send VsyncPeriodTimingChanged event. It makes sence to use single VSyncWorker and flags to indicate which actions are required to perform. This should also save some runtime resources. Signed-off-by: Roman Stratiienko]]>
drm_hwcomposer: Dynamic DrmDisplayPipeline to HwcDisplay bindings The following use scenarios are now possible: 1. When no display connected, primary HwcDisplay is created in headless mode. 2. When user connects first display, it binds to primary slot, replacing headless HwcDisplay. 3. When user connects another display it binds to the new HwcDisplay slot, creating new display for the framework. 4. When user disconnects first (Primary) display, drm_hwc detaches second display and attaches it to the Primary slot. In this case framework is notified as Primary display resolution updated (Plugged->Plugged transition). And second display is disconnected (Plugged->Unplugged transition). DrmDisplayPipeline is now created on demand (after hotplug event). HwcDisplay class is now destructed on connector unplug, which will give us ability to destroy any resource caches (will be required for FB caching logic). Signed-off-by: Roman Stratiienko]]>
drm_hwcomposer: Initialize HwcDisplay using DrmDisplayPIpeline HwcDisplay can now take all necessary objects from DrmDisplayPipeline. Signed-off-by: Roman Stratiienko]]>
drm_hwcomposer: Fix PipelineBindable::BindPipeline We should assign weak pointer object to really take ownership. Fixes: cad8e0ca57c2 ("drm_hwcomposer: Introduce DrmDisplayPipeline class") Signed-off-by: Roman Stratiienko]]>
drm_hwcomposer: Introduce DrmDisplayPipeline class Create systematic way of binding DRM objects (Crtc,Encoder,Planes...) to the pipeline using RAII. Use it to create the pipeline. + Allow pipeline creation to fail. Closes: https://gitlab.freedesktop.org/drm-hwcomposer/drm-hwcomposer/-/issues/14 Signed-off-by: Roman Stratiienko]]>
drm_hwcomposer: Tidy-up DrmDevice class 1. Move drm/DrmConnector.h to Normal clang-tidy checks list by fixing clang-tidy findings. 2. Remove DrmDevice self-reference. 3. Replace shared_ptr reference to DrmDevice in DrmFbImporter with a pointer, making ResourceManager only owner of DrmDevice and its chilren. Signed-off-by: Roman Stratiienko]]>
drm_hwcomposer: Tidy-up DrmConnector class Implement DrmConnector instantiation through CreateInstance() static method, which helps to reduce complexity of DrmDevice::Init() function. Move Connector-to-CRTC binding information to the DrmDevice class. Move drm/DrmConnector.h to Normal clang-tidy checks list by fixing clang-tidy findings. Signed-off-by: Roman Stratiienko]]>
drm_hwcomposer: Tidy-up DrmEncoder class Implement DrmEncoder instantiation through CreateInstance() static method, which helps to reduce complexity of DrmDevice::Init() function. Move Encoder-to-CRTC binding information to the DrmDevice class. Move drm/DrmEncoder.h to Normal clang-tidy checks list by fixing clang-tidy findings. Signed-off-by: Roman Stratiienko]]>
drm_hwcomposer: Tidy-up DrmCrtc class Implement DrmCrtc instantiation through CreateInstance() static method, which helps to reduce complexity of DrmDevice::Init() function. Move CRTC-to-Display binding information to the DrmDevice class. Move drm/DrmCrtc.h to Normal clang-tidy checks list by fixing clang-tidy findings. Signed-off-by: Roman Stratiienko]]>
drm_hwcomposer: Remove ability to prioritize primary display This feature isn't correctly fits hwc2 and SF requirements. Primary display prioritization shall be done by introducing ability to override internal/external connector type for any connector. 'vendor.hwc.drm.primary_display_order' property is no longer relevant. Signed-off-by: Roman Stratiienko]]>
drm_hwcomposer: Handle primary display in GetDisplayConnectionType() Primary display should always be internal. Closes: https://gitlab.freedesktop.org/drm-hwcomposer/drm-hwcomposer/-/issues/58 Signed-off-by: Roman Stratiienko]]>
drm_hwcomposer: Tidy-up DrmPlane class This allow to throw away few lines from DrmDevice::Init() making it less complicated. Signed-off-by: Roman Stratiienko]]>
drm_hwcomposer: Simplify DrmHwcTwo::GetDisplay() Cosmetic change: make GetDisplay() non-static class method + use deduced return type. Signed-off-by: Roman Stratiienko]]>
drm_hwcomposer: Fix build_deploy.sh script Composer service has to be started again. Signed-off-by: Roman Stratiienko]]>
drm_hwcomposer: Remove utils/autolock.* AutoLock class is no longer used. Signed-off-by: Roman Stratiienko]]>
drm_hwcomposer: Remove write-back related helpers from DrmDevice class Remove unused functionality. Signed-off-by: Roman Stratiienko]]>
drm_hwcomposer: Remove DrmDisplayCompositor:CreateInitializedComposition Remove unused functionality. Signed-off-by: Roman Stratiienko]]>
drm_hwcomposer: Add headless mode support Headless mode required to keep SurfaceFlinger alive when all displays are disconnected, Without headless mode Android will continuously crash. Only single internal (primary) display is required to be in HEADLESS mode to prevent the crash. See [1]. [1]: https://source.android.com/devices/graphics/hotplug#handling-common-scenarios Closes: https://gitlab.freedesktop.org/drm-hwcomposer/drm-hwcomposer/-/issues/57 Signed-off-by: Roman Stratiienko]]>
drm_hwcomposer: Configuring Composer HAL to use sequential IDs Implement Google guidelines from [1] 1. The supported display config IDs are: id=1, 1080x1920 60hz id=2, 1080x1920 50hz 2. When a change of display configs is processed, the next set of config IDs are assigned starting from the next unused integer, shown as follows: id=3, 2160x3840 60hz id=4, 2160x3840 50hz id=5, 1080x1920 60hz id=6, 1080x1920 50hz + Don't update modes in GetDisplayConfigs() . Modes is now updated at init or after every hotplug event. [1]: https://source.android.com/devices/graphics/hotplug#configuring-composer-hal-sequential-ids Signed-off-by: Roman Stratiienko]]>