1
0
Fork 0
Commit graph

17 commits

Author SHA1 Message Date
Roman Stratiienko
753d107896 drm_hwcomposer: Make Planner class fully static
clang-tidy suggested to make all methods of Planner static,
since they don't use any instance members.

This makes creation of Planner instances unnecessary, therefore
remove all such cases.

Signed-off-by: Roman Stratiienko <roman.o.stratiienko@globallogic.com>
2022-01-12 10:33:55 +02:00
Roman Stratiienko
fc014f5792 drm_hwcomposer: CI: Set clang-tidy level to NORMAL for some files
Some of files require small adjustments to move into NORMAL checks list.

Signed-off-by: Roman Stratiienko <roman.o.stratiienko@globallogic.com>
2022-01-12 10:33:55 +02:00
Roman Stratiienko
5d1f5572dd drm_hwcomposer: Modify source_layers_ to be integer instead of array
It isn't used as an array. Simplify the logic.

Signed-off-by: Roman Stratiienko <roman.o.stratiienko@globallogic.com>
Tested-by: Martin Juecker <martin.juecker@gmail.com>
Reviewed-by: Matvii Zorin <matvii.zorin@globallogic.com>
2021-12-29 18:06:09 +02:00
Roman Stratiienko
67cebf5c75 drm_hwcomposer: Handle unused planes by DrmDisplayCompositor
Rationale:
1. Cleanup/Simplify DrmDisplayComposition class
2. Prepare for shared planes support

Signed-off-by: Roman Stratiienko <roman.o.stratiienko@globallogic.com>
Tested-by: Martin Juecker <martin.juecker@gmail.com>
Reviewed-by: Matvii Zorin <matvii.zorin@globallogic.com>
2021-12-29 18:03:15 +02:00
Roman Stratiienko
36a7f28516 drm_hwcomposer: Rework display Mode Setting and DPMS handling
1. Remove DPMS logic. As stated in KMS kernel docs: CRTC "activate"
   property was implemented as a simplified atomic replacement of DPMS.
   And kernel internally will just update "activate" on DPMS setting.

2. Add SetDisplayActivate(bool state) method to compositor class,
   which is now replacement for SetDpmsMode().

3. Move mode settings out of DrmComposition class to DrmCompositor class.
   From now on DrmComposition describes only layer-to-plane composition
   as it should be.

Signed-off-by: Roman Stratiienko <roman.o.stratiienko@globallogic.com>
2021-10-23 06:42:58 +03:00
Roman Stratiienko
d3a2cf4d1b drm_hwcomposer: Remove unused {DrmComposition,DrmCompositor}::Dump()
Both DrmCompositor and DrmComposition have to be reworked to account
for shared DRM planes, asynchronous atomic commit, dynamic modechange and
composition reusing between Validate/Present steps.

Current dump logic will be obsolate anyway and keeping/supporting it will
slow-down reworking process. It make sense to remove it now and create
from scrach if needed.

Test: mmma external/drm_hwcomposer

Signed-off-by: Roman Stratiienko <roman.o.stratiienko@globallogic.com>
2021-10-23 04:47:33 +03:00
Roman Stratiienko
d26619b5d0 drm_hwcomposer: CI: Upgrade clang-* to v12
- 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-08-29 15:54:17 +03:00
John Stultz
66763d5142 drm_hwcomposer: Quiet noisy errors when planes don't support various attributes
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-08-24 05:02:12 +00:00
Roman Stratiienko
5128715b42 drm_hwcomposer: cleanup hwcutils
Remove DrmHwcBuffer class. Wrap remaining logic into
DrmHwcLayer class.

Signed-off-by: Roman Stratiienko <r.stratiienko@gmail.com>
2021-05-19 19:31:29 +03:00
Matvii Zorin
f0757c21ec drm_hwcomposer: Remove ctrc from DrmCompositionPlane
CRTC is set at CreateComposition function and it matches the current
display.

Signed-off-by: Matvii Zorin <matvii.zorin@globallogic.com>
2021-04-06 12:46:22 +03:00
Matvii Zorin
704ea0e8fb drm_hwcomposer: Cleanup DrmDisplayComposition initialization
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-06 12:46:22 +03:00
Roman Stratiienko
d21071f7d5 drm_hwcomposer: CI: Increase coverage
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-04-06 12:12:17 +03:00
Roman Stratiienko
b3b5c1e937 drm_hwcomposer: clang-tidy: enable cppcoreguidelines-* checks
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-03 16:12:22 +02:00
Roman Stratiienko
6a10c4ce1f drm_hwcomposer: clang-tidy: enable clang-analyzer-* checks
+ fixed existing tidy warnings for these checks.

Signed-off-by: Roman Stratiienko <r.stratiienko@gmail.com>
2021-03-03 16:12:14 +02:00
Roman Stratiienko
e2f2c92924 drm_hwcomposer: enable code analysis using clang-tidy
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-03 16:07:25 +02:00
Roman Stratiienko
b2e9fe23cd drm_hwcomposer: refactor platform directory
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-10-20 23:19:42 +03:00
Roman Stratiienko
13cc3666c6 drm_hwcomposer: use CamelCase in source/header files related to class
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-08 22:34:52 +03:00
Renamed from compositor/drmdisplaycomposition.cpp (Browse further)