1
0
Fork 0
Commit graph

80 commits

Author SHA1 Message Date
Roman Stratiienko
4e994055a3 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 <roman.o.stratiienko@globallogic.com>
2022-02-09 17:40:35 +02:00
Roman Stratiienko
71f196fce0 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 <roman.o.stratiienko@globallogic.com>
2022-02-04 12:27:55 +02:00
Roman Stratiienko
9362cef4c3 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 <roman.o.stratiienko@globallogic.com>
2022-02-04 11:19:40 +02:00
Roman Stratiienko
cad8e0ca57 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 <roman.o.stratiienko@globallogic.com>
2022-01-31 21:48:40 +02:00
Roman Stratiienko
f377ff7bd6 drm_hwcomposer: Remove utils/autolock.*
AutoLock class is no longer used.

Signed-off-by: Roman Stratiienko <roman.o.stratiienko@globallogic.com>
2022-01-20 17:21:46 +02:00
Roman Stratiienko
0137f867df drm_hwcomposer: Move HwcDisplayConfigs out of HwcDisplay class
To reduce complexity of HwcDisplay class.

Signed-off-by: Roman Stratiienko <roman.o.stratiienko@globallogic.com>
2022-01-12 11:28:09 +02:00
Roman Stratiienko
3e1689054d drm_hwcomposer: Move DrmHwcTwo.{cpp|h} to hwc2_device/ directory
To keep all frontend-related files in a single directory.

Signed-off-by: Roman Stratiienko <roman.o.stratiienko@globallogic.com>
2022-01-12 11:27:09 +02:00
Roman Stratiienko
3627bebf7b drm_hwcomposer: Move HwcDisplay out of DrmHwcTwo class
Reduces code complexity.

Closes: https://gitlab.freedesktop.org/drm-hwcomposer/drm-hwcomposer/-/issues/35
Signed-off-by: Roman Stratiienko <roman.o.stratiienko@globallogic.com>
2022-01-12 11:27:07 +02:00
Roman Stratiienko
03fd35cdfa drm_hwcomposer: Move HwcLayer out of DrmHwcTwo class
... to reduce complexity of DrmHwcTwo.* files.

Bump-up tidy level of new files to NORMAL (fix function naming,
add NOLINT, etc.)

Signed-off-by: Roman Stratiienko <roman.o.stratiienko@globallogic.com>
2022-01-12 11:17:41 +02:00
Roman Stratiienko
26fd2b2606 drm_hwcomposer: Move hw_module related code out of DrmHwcTwo.* files
... to reduce complexity of DrmHwcTwo class.

Create "hwc2_device" directory that will be later used to fit
all frontend-related code.

Signed-off-by: Roman Stratiienko <roman.o.stratiienko@globallogic.com>
2022-01-12 11:17:41 +02:00
Roman Stratiienko
5621f5fd4c drm_hwcomposer: Use gralloc0::perform API by minigbm bufferinfo getter
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-06 13:22:34 +02:00
Roman Stratiienko
0ee8f58b93 drm_hwcomposer: Don't use Mapper@4 metadata API for legacy getters
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-10 19:30:54 +02:00
Roman Stratiienko
1e053b4e19 drm_hwcomposer: Make uevent listener standalone
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-11-10 19:30:24 +02:00
Roman Stratiienko
8666dc9c58 drm_hwcomposer: Tracking of the DRM FB objects using RAII
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-05-19 19:31:29 +03:00
Roman Stratiienko
d665998333 drm_hwcomposer: CI: Use bpfmt to check Android.bp files style
Fix available errors by executing:
$ find -name "*.bp" -exec bpfmt -d -s -w {} \;

Suggested-by: Marijn Suijten <marijn.suijten@somainline.org>
Signed-off-by: Roman Stratiienko <r.stratiienko@gmail.com>
2021-03-03 12:14:14 +02:00
Roman Stratiienko
add24cb745 drm_hwcomposer: stop using pixel_stride
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-31 19:08:19 +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
946126c9b3 drm_hwcomposer: extract platform-libdrm code from platform-generic
Signed-off-by: Roman Stratiienko <r.stratiienko@gmail.com>
2020-10-07 19:24:54 +03:00
Mattijs Korpershoek
5284c7e970 drm_hwcomposer: Add MediaTek platform support
This platform handler is dedicated for the i500 MediaTek SoC [1].
i500 has a Mali-G72 MP3 GPU.

OpenGL/Mali integration is based on ARM Gralloc module, version
BX304L01B-SW-99005-r20p0-01rel0, without additional patches.

This platformmediatek is based on platformmeson, without the additional
usage flag in the private_handle_t.
AFBC support has also been removed as it's unsupported.

External Android.bp file should be created in order to build this
module:

```
cc_library_shared {
    name: "hwcomposer.drm_mediatek",
    defaults: ["hwcomposer.drm_defaults"],
    srcs: [":drm_hwcomposer_platformmediatek"],
    whole_static_libs: ["drm_hwcomposer"],
}
```

[1] https://www.mediatek.com/products/AIoT/i500
Change-Id: I3ea7a980d76ba5c5ff583b5d4f21e1989875bafb
Signed-off-by: Mattijs Korpershoek <mkorpershoek@baylibre.com>
2020-09-23 10:22:23 +02: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
Roman Stratiienko
aa3cd54562 drm_hwcomposer: move header files into source directory
... to improve navigation between source/header file.
Unnecessary dependencies also removed.

Signed-off-by: Roman Stratiienko <r.stratiienko@gmail.com>
Change-Id: I2c3bf993b8c5f356490433fd94e90011487a1276
2020-09-08 22:34:52 +03:00
Matvii Zorin
51a0e0d30c drm_hwcomposer: Add rcar-du display backend
ABGR8888 pixel format and layer scaling are unsupported for rcar-du
platform.

Handle and filter out the layers by overriding the IsClientLayer method
for additional checks. That will force layers that require scaling or have
the unsupported pixel format to be merged by GPU, and allow other layers
to be merged by DRM.

Signed-off-by: Matvii Zorin <matvii.zorin@globallogic.com>
2020-08-26 14:43:23 +03:00
Matvii Zorin
7f7efd80b5 drm_hwcomposer: Add composition skipping backend
This display backend may be chosen by setting the hwc.backend_override
system property to the "client" value.

Suggested-by: Andrii Chepurnyi <andrii_chepurnyi@epam.com>
Signed-off-by: Matvii Zorin <matvii.zorin@globallogic.com>
2020-08-26 14:43:23 +03:00
Matvii Zorin
ef3c797daf drm_hwcomposer: Add backend-dependent validation for HwcDisplay class
Different DRM/KMS backends have a variable set of limitations, which is
not always exposed via DRM ioctls.

This implementation of backend-dependent validation provides a register
of platform-specific inherited backend class to the map by BackendManager
class. ValidateDisplay function is moved to generic backend
implementantion and separated into 2 additional methods.

The map key is a string that contains the corresponding DRM driver name.
During DrmHwcTwo class initialization the vendor.hwc.backend_override
system property and driver name will be checked and a backend will be set
for the appropriate display. If the map does not have any backend for the
named driver, the generic backend will be used.

Signed-off-by: Matvii Zorin <matvii.zorin@globallogic.com>
2020-08-26 14:43:23 +03:00
Andrii Chepurnyi
a63d66c7bb drm_hwcomposer: Propagate PLATFORM_SDK_VERSION to cflags
PLATFORM_SDK_VERSION is needed for already present
code (GetDisplayIdentificationData/GetDisplayCapabilities),
which implements some of the android.hardware.graphics.composer@2.3 API.

Signed-off-by: Andrii Chepurnyi <andrii_chepurnyi@epam.com>
Signed-off-by: John Stultz <john.stultz@linaro.org>
Change-Id: I1a5019e9d8ae327db41f55cee0ba3636f913928f
2020-06-26 18:44:41 +00:00
Roman Stratiienko
e3ed48d728 drm_hwcomposer: Add Imagination platform support
External Android.bp file should be created in order to build this module:
```
cc_library_shared {
    name: "hwcomposer.drm_imagination",
    defaults: ["hwcomposer.drm_defaults"],
    srcs: [":drm_hwcomposer_platformimagination"],
    whole_static_libs: ["drm_hwcomposer"],
    shared_libs: ["libion"],
    include_dirs: [
        "path/to/imgtec/include/files",
    ],
}
```
libion is needed to make ion.h header visible `linux/ion.h`.

Signed-off-by: Roman Stratiienko <roman.stratiienko@globallogic.com>
2019-11-11 15:59:16 +02:00
Sean Paul
27cd480501 drm_hwcomposer: Organize files into subdirs
This is way overdue

Signed-off-by: Sean Paul <seanpaul@chromium.org>

Change-Id: I1bcbd8fdb0bb03feafd76bc41f6f11c03cdf9c25
2019-06-11 09:38:11 -04:00
Neil Armstrong
17d3c8bba6 drm_hwcomposer: Add platformmeson for Amlogic SoC support
This specific platform handler is dedicated for the Amlogic SoC,
and more precisely for the Amlogic G12A family.

OpenGL/Mali allocation is done via a slightly modified ARM Gralloc
module, thus needing a custom platform handler to handle the custom
private_handle_t structure.

This platformmeson is based on platformhisi without the AFBC YUV
management (not handled by the Amlogic SoCs).

Signed-off-by: Neil Armstrong <narmstrong@baylibre.com>

Change-Id: I1a1d20b0a84b0e17aa3417c8e9633712f258523d
2019-06-11 13:24:42 +00:00
Colin Cross
cce1278a89 drm_hwcomposer: Move hwcomposer.drm_hikey and hwcomposer.drm_hikey960
Prevent external/drm_hwcomposer from referencing device/linaro/hikey,
which may not exist in all trees, by compiling most of drm_hwcomposer
as a static library and then compiling just the source files that
are affected by device-specific #defines and #includes in
device/linary/hikey/gralloc*.

Fixes: 129543119
Test: m hwcomposer.drm_hikey hwcomposer.drm_hikey960 MODULES-IN-external-drm_hwcomposer
Change-Id: I800b147a40c4e368ce1a74273728f5941f6b63c4
Signed-off-by: Colin Cross <ccross@android.com>
Signed-off-by: John Stultz <john.stultz@linaro.org>
2019-04-10 09:36:29 -07:00
Colin Cross
cdf4b49d3f drm_hwcomposer: Convert external/drm_hwcomposer to Android.bp
See build/soong/README.md for more information.

This replaces the product and BoardConfig.mk variable conditionals
with different versions of the HAL for each product, which will
also allow checkbuild to verify that they build even on products
that don't use them.

Fixes: 122332597
Test: mma
Change-Id: I8d2c8ac1bb58dcbc81ae75c2bb2c97d4485909b4
Signed-off-by: Colin Cross <ccross@android.com>
Signed-off-by: John Stultz <john.stultz@linaro.org>
2019-04-10 09:36:23 -07:00