aboutsummaryrefslogtreecommitdiff
path: root/bufferinfo
AgeCommit message (Collapse)Author
2022-08-25drm_hwcomposer: fix BufferInfoImagination buildAndrii Chepurnyi
Commit e9fbd8d626a2 ("drm_hwcomposer: Set return type to std::optional for BufferInfoGetters") changed the BufferInfo variable name, but missed the case defined under HAL_PIXEL_FORMAT_BGRX_8888. This results in build failures. This patch fixes the build issue by completing the variable renaming. Fixes: e9fbd8d626a2 ("drm_hwcomposer: Set return type to std::optional for BufferInfoGetters") Signed-off-by: Andrii Chepurnyi <andrii_chepurnyi@epam.com>
2022-07-07drm_hwcomposer: Fix BufferInfoMaliMesonJohn Stultz
In commit e9fbd8d626a2 ("drm_hwcomposer: Set return type to std::optional for BufferInfoGetters") the final return for BufferInfoMaliMeson::GetBoInfo() erroneously was changed to return {} instead of the calculated BufferInfo object. This simply fixes the issue, returning the BufferInfo. Change-Id: I03789b48dc4a0df64432f7ff31661746163a96b8 Signed-off-by: John Stultz <jstultz@google.com>
2022-05-17drm_hwcomposer: Add unique handle ID getter into buffergetter classRoman Stratiienko
dmabuf stats inode field can be used as unique buffer id. Signed-off-by: Roman Stratiienko <roman.o.stratiienko@globallogic.com>
2022-05-17drm_hwcomposer: Reorganize struct DrmHwcLayerRoman Stratiienko
1. Move BlendMode, ColorSpace, SampleRange fields to the struct BufferInfo, allowing extraction of the data from native_handle using Metadata@4 API. Use it when data from HWC2 API can't be used (Currently it's a BlendMode case for CLIENT layer) 2. Rename DrmHwcLayer to LayerData and move it to compositor/ directory. (I was confused in the past because of similarity of names DrmHwcLayer vs HwcLayer, so this step should meke it easier for newcomers to understand the code) 3. Allow clonning of the LayerData to propagate it through the composition pipeline. Thus LayerData can be used by both HwcLayer to track state and by the compositor. Signed-off-by: Roman Stratiienko <roman.o.stratiienko@globallogic.com>
2022-05-17drm_hwcomposer: Set return type to std::optional for BufferInfoGettersRoman Stratiienko
This is a bit of code modernization. Further changes will require indication that buffer_info is valid, and using std::optional is the most correct approach to do that. Signed-off-by: Roman Stratiienko <roman.o.stratiienko@globallogic.com>
2022-05-17drm_hwcomposer: Move include/drmhwcgralloc.h to bufferinfo/BufferInfo.hRoman Stratiienko
... to emphasize its purpose. - Rename struct HwcDrmBo -> struct BufferInfo - Remove unused BufferInfo::acquire_fence, BufferInfo::hal_format and BufferInfo::usage fields Signed-off-by: Roman Stratiienko <roman.o.stratiienko@globallogic.com>
2022-02-15drm_hwcomposer: Define DRM_FORMAT_XYUV8888 if missingRoman Stratiienko
Fixes drm_hwcomposer build for Android-9. Signed-off-by: Roman Stratiienko <r.stratiienko@gmail.com> Change-Id: I14e931c37c3d09284dfd338e6482a27cf21e0e10
2022-01-12drm_hwcomposer: CI: Remove -readability-use-anyofallof from COARSE listRoman Stratiienko
We have single fail case of -readability-use-anyofallof. Use NOLINTNEXTLINE comment instead. Signed-off-by: Roman Stratiienko <roman.o.stratiienko@globallogic.com>
2022-01-12drm_hwcomposer: CI: Set clang-tidy level to NORMAL for some filesRoman Stratiienko
Some of files require small adjustments to move into NORMAL checks list. Signed-off-by: Roman Stratiienko <roman.o.stratiienko@globallogic.com>
2022-01-12drm_hwcomposer: CI: Raise clang-tidy level from NONE to COARSE for *.hRoman Stratiienko
To improve CI coverage. Signed-off-by: Roman Stratiienko <roman.o.stratiienko@globallogic.com>
2021-12-07drm_hwcomposer: Fix all cases which triggers an error on -Wsign-compareRoman Stratiienko
Android-9 has -Wsign-compare enabled by default and it causes build issues. Enable -Wsign-compare option in CI, so we won't introduce such issues anymore. Signed-off-by: Roman Stratiienko <roman.o.stratiienko@globallogic.com>
2021-12-06drm_hwcomposer: Use gralloc0::perform API by minigbm bufferinfo getterRoman Stratiienko
Using of internals of cros_gralloc_handle isn't recommended, since it can be changed at any time. Meanwhile minigbm provides another API to access buffer information based on gralloc0 perform() call. ChromiumOS are using this API by mesa3d and other related projects. Signed-off-by: Roman Stratiienko <roman.o.stratiienko@globallogic.com>
2021-12-06drm_hwcomposer: Validate gralloc0 name for minigbm and libdrm gettersRoman Stratiienko
Using of incorrect gralloc0 results in a runtime issues, with logs like "Cannot convert hal format to drm format <VALUE>" or other. Validate gralloc name and exit gracefully in case it doesnt't match the one we are expecting. Signed-off-by: Roman Stratiienko <roman.o.stratiienko@globallogic.com>
2021-11-10drm_hwcomposer: Don't use Mapper@4 metadata API for legacy gettersRoman Stratiienko
As it turned out Mapper@4 metadata API calls are slow. Allow using legacy getters again. Closes: https://gitlab.freedesktop.org/drm-hwcomposer/drm-hwcomposer/-/issues/56 Signed-off-by: Roman Stratiienko <roman.o.stratiienko@globallogic.com>
2021-11-10drm_hwcomposer: Make uevent listener standaloneRoman Stratiienko
1. DRM event listener doesn't work in this conditions, uevent blocks the thread and non-blocking select() doesn't make any sense. Remove DRM event handling for now. 2. UEvent listeren is common for all DrmDevices, therefore put it into ResourceManager class. Signed-off-by: Roman Stratiienko <roman.o.stratiienko@globallogic.com>
2021-10-22drm_hwcomposer: Improve Mapper@4 metadata API fds index guessing logicRoman Stratiienko
Unfortunately Mapper@4.0 metadata API doesn't allow to query fd index or getting fd another way for every layout plane, therefore users have to provide their custom additional metadata API. We are doing all our best to minimize custom per-platform logic in drm_hwcomposer. So it was decided to implement primitive guessing logic, allowing users to extend it with out-of-tree code if necessary. As was reported by John Stultz in [1] our primitive logic has some flaws. New guessing logic are using inputs from layout data (offsets, sizes), and should be more precise. [1]: https://gitlab.freedesktop.org/drm-hwcomposer/drm-hwcomposer/-/merge_requests/159 Signed-off-by: Roman Stratiienko <roman.o.stratiienko@globallogic.com>
2021-08-29drm_hwcomposer: CI: Upgrade clang-* to v12Roman Stratiienko
- Enabling readability-ientifier-naming tidy check does require to specify MacroDefinitionIgnoredRegexp key, which is available only in clang-tidy-12. - Clang-12 isn't available on ubuntu 20.10, therefore upgrade to 21.04. - "DEBIAN_FRONTEND: noninteractive" is required to prevent ubuntu 21.04 from hanging, presumably due to waiting for the user input. - A positive side effect of upgrading to clang-12 is new clang-tidy-12, which exposed new issues in the code which is also fixed by this commit, e.g: Failed cppcoreguidelines-narrowing-conversions check with error: error: narrowing conversion from 'uint32_t' (aka 'unsigned int') to 'float' require explicit casting to pass the check, while some of such fails are caused by incorrect variable type and fixed by changing the type to correct one. Signed-off-by: Roman Stratiienko <r.stratiienko@gmail.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-16drm_hwcomposer: add missing HAL pixel formatRiadh Ghaddab
using Android-11 (android-11.0.0_r27 )on i500 MediaTek SoC we can see some log floods with the following trace: E hwc-platform-drm-generic: Cannot convert hal format to drm format 43 Adding the conversion of this format : HAL_PIXEL_FORMAT_RGBA_1010102 resolves the log flood Signed-off-by: Riadh Ghaddab <rghaddab@baylibre.com>
2021-03-03drm_hwcomposer: CI: Add more source files to the buildRoman Stratiienko
Build bufferinfo/BufferInfoGetter.cpp and drm/DrmPlane.cpp 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: 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-03-01drm_hwcomposer: Create make target to test filegroupsRoman Stratiienko
Android.bp contains filegroups that are not built by default (e.g. using $ mmma external/drm_hwcomposer) Fix it. To ensure build will work on wide range of Android versions, pull depended headers from AOSP-11 tree: 1. Mali: "device/linaro/hikey/gralloc960" 2. Imagination: "hardware/ti/am57x/libhwcomposer" and put it into ./tests/test_include directory. Signed-off-by: Roman Stratiienko <r.stratiienko@gmail.com>
2021-01-16drm_hwcomposer: Add minigbm video and format_modifier supportRoman Stratiienko
Signed-off-by: Roman Stratiienko <r.stratiienko@gmail.com>
2020-12-03drm_hwcomposer: Reorganize modifiers handling logicRoman Stratiienko
Reasons for this change: 1. Remove redundant code lines. 2. Workaround for cases when DRM_FORMAT_MOD_INVALID is set by gralloc. Signed-off-by: Roman Stratiienko <r.stratiienko@gmail.com>
2020-11-03drm_hwcomposer: libdrmgetter: fix RGB565 format translationRoman Stratiienko
FOSS graphic components (gbm_gralloc, mesa3d) are translating HAL_PIXEL_FORMAT_RGB_565 to DRM_FORMAT_RGB565 without swapping the R and B components. Same must be done here. Fixes wrong colors in some games (i.e. Pixel Wheels). Signed-off-by: Roman Stratiienko <r.stratiienko@gmail.com>
2020-11-02drm_hwcomposer: implement Gralloc 4 BufferInfoMapperMetadataDennis Tsiang
Implements the BufferInfoMapperMetadata that uses the GraphicBufferMapper to set the fields of the hwc_drm_bo_t struct. New class function GetFds created to obtain the file descriptors from the native_handle_t. Function is marked weak so that vendors can override it to match their system if required. Change-Id: I74445487dec6bda2915b21f4b63804832bfead23 Signed-off-by: Dennis Tsiang <dennis.tsiang@arm.com> Reviewed-by: Roman Stratiienko <r.stratiienko@gmail.com>
2020-10-31drm_hwcomposer: stop using pixel_strideRoman Stratiienko
pixel_stride is used only to validate buffer when importing using GraphicBufferMapper::importBuffer() method. The problem is we can't always get this value from buffer_handle_t. Libdrm and MapperMetadata getters can only calculate this value based on byte stride and buffer format. But this calculation isn't always possible, which causes importBuffer() to fail. Instead we can use GrallocMapper::importBuffer() method, which doesn't require to validate the buffer. This commit is not compatible with Android-P. Signed-off-by: Roman Stratiienko <r.stratiienko@gmail.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>