aboutsummaryrefslogtreecommitdiff
path: root/compositor
AgeCommit message (Collapse)Author
2021-08-24drm_hwcomposer: Quiet noisy errors when planes don't support various attributesJohn Stultz
If a plane doesn't support alpha or rotation, and IsValidForLayer() fails, we see lots of logcat noise to the effect of: 08-24 04:45:42.957 453 453 E hwc-platform: Failed to emplace layer 0, dropping it 08-24 04:45:42.957 453 453 E hwc-platform: Failed provision stage with ret -22 08-24 04:45:42.957 453 453 E hwc-drm-display-composition: Planner failed provisioning planes ret=-22 08-24 04:45:42.957 453 453 E hwc-drm-two: Failed to plan the composition ret=-22 This noise is unneccessarily worrisome, as they don't really help explain why things fail, and we still fall back to client composing and frames are correctly composited. Thus, this patch switches the errors to verbose-level warnings, which match the level in IsValidForLayer() which explain what actually is going wrong. Change-Id: I7ed06906b8d9e02e6ec0ac50a94346e9f9c05ac6 Signed-off-by: John Stultz <john.stultz@linaro.org>
2021-07-24drm_hwcomposer: Rework autofdRoman Stratiienko
Motivation: Current implementation of UniqueFd can be used in a different ways, making analytical tracking of FD lifecycle much harder than it may be. Keep this part clean is very important, since any wrong code may open a hard-to-detect runtime bugs and fd leaks, which may accidentally slip into the production. Implementation: 1. Combine UniqueFd anf OutputFd into single class. 2. Reduce the API to be minimal and sufficient. 3. Document the API and use cases. 4. Move to utils/UniqueFd.h. 5. dup(fd) was replaced with fcntl(fd, F_DUPFD_CLOEXEC)) to address clang-tidy findings. Find more information at [1] [1]: https://clang.llvm.org/extra/clang-tidy/checks/android-cloexec-dup.html Signed-off-by: Roman Stratiienko <r.stratiienko@gmail.com>
2021-05-19drm_hwcomposer: cleanup hwcutilsRoman Stratiienko
Remove DrmHwcBuffer class. Wrap remaining logic into DrmHwcLayer class. Signed-off-by: Roman Stratiienko <r.stratiienko@gmail.com>
2021-05-19drm_hwcomposer: Tracking of the DRM FB objects using RAIIRoman Stratiienko
DRM framebuffer objects must be kept registered in DRM/KMS while used for scanning-out (After atomic commit applied for processing by display controller and until next atomic commit is applied for processing). Existing logic for tracking current state is overcomplicated and needs to be redesigned. Also further developing of drm_hwc will require migration to asynchronous atomic commit, so additional asynchronous FB cleanup logic must be created. Buffer caching logic will also benefit from this. With the RAII all further changes will be less painful and more robust. By this commit I also renamed DrmGenericImporter to DrmFbImporter: 'Fb' word is present in most of existing composers (android and linux) so it will be easier to compare different implementations. Signed-off-by: Roman Stratiienko <r.stratiienko@gmail.com>
2021-04-06drm_hwcomposer: Move ValidatePlane method into DrmPlaneMatvii Zorin
It is more common to validate the layer for the proper object. Signed-off-by: Matvii Zorin <matvii.zorin@globallogic.com>
2021-04-06drm_hwcomposer: Remove ctrc from DrmCompositionPlaneMatvii Zorin
CRTC is set at CreateComposition function and it matches the current display. Signed-off-by: Matvii Zorin <matvii.zorin@globallogic.com>
2021-04-06drm_hwcomposer: Remove SquashState class declarationMatvii Zorin
There is no use of SquashState class, so the declaration could be removed in the scope of cleanup. Signed-off-by: Matvii Zorin <matvii.zorin@globallogic.com>
2021-04-06drm_hwcomposer: Remove DrmCompositionDisplayLayersMapMatvii Zorin
The structure is used only at the CreateComposition function. Data consolidation is unnecessary in this case. Signed-off-by: Matvii Zorin <matvii.zorin@globallogic.com>
2021-04-06drm_hwcomposer: Remove DrmCompositionRegion structMatvii Zorin
The structure is currently unused. Signed-off-by: Matvii Zorin <matvii.zorin@globallogic.com>
2021-04-06drm_hwcomposer: Cleanup DrmDisplayComposition initializationMatvii Zorin
Remove unused members (drm, importer, frame_no). Move initialization from the proper function to the constructor. Signed-off-by: Matvii Zorin <matvii.zorin@globallogic.com>
2021-04-06drm_hwcomposer: CI: Increase coverageRoman Stratiienko
Add the following files to the build: backend/BackendClient.cpp backend/Backend.cpp backend/BackendManager.cpp backend/BackendRCarDu.cpp bufferinfo/legacy/BufferInfoImagination.cpp bufferinfo/legacy/BufferInfoLibdrm.cpp bufferinfo/legacy/BufferInfoMaliHisi.cpp bufferinfo/legacy/BufferInfoMaliMediatek.cpp bufferinfo/legacy/BufferInfoMaliMeson.cpp bufferinfo/legacy/BufferInfoMinigbm.cpp compositor/DrmDisplayComposition.cpp compositor/DrmDisplayCompositor.cpp compositor/Planner.cpp drm/DrmGenericImporter.cpp DrmHwcTwo.cpp drm/ResourceManager.cpp drm/VSyncWorker.cpp tests/worker_test.cpp utils/autolock.cpp Files 'bufferinfo/BufferInfoMapperMetadata.cpp' and 'utils/hwcutils.cpp' require a lot of additional headers, therefore move them out of the scope of this commit. 'utils/gralloc.h' isn't planned to use in pure-linux builds, therefore remove it from 'utils' and put it into '.ci/android_headers/hardware/' Fix minor tidy fails. Fix linux build fails (missing includes) due to differences between libc and bionic. Comment-out some sections in 'tests/test_include' which aren't used by drm_hwc but causing build failures for CI due to missing dependencies. Signed-off-by: Roman Stratiienko <r.stratiienko@gmail.com> Reviewed-by: Matvii Zorin <matvii.zorin@globallogic.com>
2021-03-19drm_hwcomposer: Remove writeback-based flattening logicRoman Stratiienko
Writeback Pros: a. Very tiny reduction in power consumption required for rendering the composition compared to CLIENT-based flattening. Writeback Cons: a. A lot of extra code. High maintenance cost(effort). Nobody tests it as for now. b. Writeback isn't implemented by the set of KMS drivers c. Require separate memory buffer to be allocated Part of: https://gitlab.freedesktop.org/drm-hwcomposer/drm-hwcomposer/-/issues/47 Signed-off-by: Roman Stratiienko <r.stratiienko@gmail.com>
2021-03-03drm_hwcomposer: clang-tidy: enable cppcoreguidelines-* checksRoman Stratiienko
Our code isn't ready for the following checks therefore keep disabled -cppcoreguidelines-pro-bounds-array-to-pointer-decay -cppcoreguidelines-pro-bounds-constant-array-index -cppcoreguidelines-pro-bounds-pointer-arithmetic -cppcoreguidelines-pro-type-cstyle-cast -cppcoreguidelines-pro-type-vararg -cppcoreguidelines-avoid-magic-numbers -cppcoreguidelines-macro-usage -cppcoreguidelines-avoid-c-arrays + fixed existing tidy warnings for these checks. Signed-off-by: Roman Stratiienko <r.stratiienko@gmail.com>
2021-03-03drm_hwcomposer: clang-tidy: enable clang-analyzer-* checksRoman Stratiienko
+ fixed existing tidy warnings for these checks. Signed-off-by: Roman Stratiienko <r.stratiienko@gmail.com>
2021-03-03drm_hwcomposer: enable code analysis using clang-tidyRoman Stratiienko
Drm hwcomposer project has some code-style inconsistencies. This is the initial step to unify code-style of the code. Clang-tidy is a great tool which can not only suggest correct styling, but also allow predicting the errors in the code and suggest correct coding approaches to avoid potential weaknesses. CI was tuned to check clang-tidy recommendation for some part of the code which is ready ATM (can be built outside AOSP tree). For this part a limited set of clang-tidy checks has applied (coarse check). Header files aren't checked at all. Starting from now new code files must be included into the list that is checked by almost all clang-tidy checks (fine checklist). New header files should be also included into this list. See '.gitlab-ci-clang-tidy-fine.sh'. Signed-off-by: Roman Stratiienko <r.stratiienko@gmail.com>
2021-01-30drm_hwcomposer: Add support for color encoding and range propertiesMatvii Zorin
Starting from the linux-v4.17, the DRM module has support for different non-RGB color encodings that are controlled through plane-specific COLOR_ENCODING and COLOR_RANGE properties. This patch creates a matching between the HWC layer dataspace which is supported by DRM driver and DRM plane properties. Signed-off-by: Matvii Zorin <matvii.zorin@globallogic.com>
2020-10-20drm_hwcomposer: refactor platform directoryRoman Stratiienko
Motivation: Platform term meaning used in drm_hwcomposer does not correspond to the content of the platform directory. Platform directory consists of: 1. Buffer information getters for different gralloc (currently called platform). 2. Composition planner logic (which has flaws and should be reworked into layer->plane mapping during validation stage logic). 3. DrmGenericImpoter with reference counting logic. Android-11 IMapper@4 metadata API offers a generic way to access buffer information which makes other gralloc buffer information getters obsolete. Legacy getters should be maintained for some time until all known users will migrate to Mapper@4 API. Implementation: 1. Split 'PlatformImporter' logic to 'Importer' only and 'Buffer Getter' logic. a. Remove buffer_handle_t parameter from ImportBuffer(). Instead user should get BufferInfo using ConvertBoInfo to struct hwc_drm_bo_t, then use it for ImportBuffer(). b. Move DrmGenericImporter.{cpp/h} into the drm directory. 2. Isolate planner code in single file and move it to compositor directory as compositor/Planner.{cpp/h} 3. Rename platform definition a. Rename platform directory to bufferinfo. b. Rename/move bufferinfo/platorm*.{cpp,h} getters to bufferinfo/legacy/BufferInfo*.{cpp,h}. Align class names/includes. 4. Split legacy/metadata getters logic. a. Apply existing bufferinfogetter base class only for legacy getters. b. Combine legacy/generic gettera under new base class. c. Create a placeholder for generic(metadata) getter. Signed-off-by: Roman Stratiienko <r.stratiienko@gmail.com>
2020-09-28drm_hwcomposer: Fix RegisterCallback() functionRoman Stratiienko
- Fixes segfault during client switch. - Allows to run VTS on Android-11. VTS Results: ============================================ arm64-v8a VtsHalGraphicsComposerV2_1TargetTest: [53 tests / 42808 msec] armeabi-v7a VtsHalGraphicsComposerV2_1TargetTest: [53 tests / 33353 msec] =============== Summary =============== 2/2 modules completed Total Tests : 106 PASSED : 106 FAILED : 0 ============================================ Signed-off-by: Roman Stratiienko <r.stratiienko@gmail.com>
2020-09-08drm_hwcomposer: use CamelCase in source/header files related to classRoman Stratiienko
Main goal is to increase readability of file names. AOSP uses camelcase for files in many projects. Lets do the same for drm_hwcomposer. Keep platform/ directory as is, since class names is different from file names. Signed-off-by: Roman Stratiienko <r.stratiienko@gmail.com> Change-Id: I7e992357851c2a86711f4da1241c4d507359e56b
2020-09-08drm_hwcomposer: move header files into source directoryRoman Stratiienko
... to improve navigation between source/header file. Unnecessary dependencies also removed. Signed-off-by: Roman Stratiienko <r.stratiienko@gmail.com> Change-Id: I2c3bf993b8c5f356490433fd94e90011487a1276
2020-02-19drm_hwcomposer: Add statistics on flattening to dump messageRoman Kovalivskyi
We need some way to verify that current composition is not failed to compose, but instead sent to flatten on GPU. Dump message shows current flattening state. It also displays how often do compositor switches into flattening. Signed-off-by: Roman Kovalivskyi <roman.kovalivskyi@globallogic.com>
2020-02-19drm_hwcomposer: Add fallback to client for layers flatteningRoman Kovalivskyi
Google recommends to delegate composition to GLES instead of HWC when screen isn't updating to conserve power, as stated on page https://source.android.com/devices/graphics/implement-hwc. Current implementation of hwcomposer has flattening of layers if after some time there were no updates of frames, but it uses writeback connector. Not every device has a support of writeback feature, so some sort of fallback should be provided. It is possible to fallback to client composition in case if writeback isn't available. This is used to reduce power consumption since squashing layers into a single layer on GPU and then using that buffer is more efficient than loading drm device. Signed-off-by: Roman Kovalivskyi <roman.kovalivskyi@globallogic.com>
2019-06-11drm_hwcomposer: Organize files into subdirsSean Paul
This is way overdue Signed-off-by: Sean Paul <seanpaul@chromium.org> Change-Id: I1bcbd8fdb0bb03feafd76bc41f6f11c03cdf9c25