1
0
Fork 0
Commit graph

14 commits

Author SHA1 Message Date
Andrew Wolfers
185f909299 Cleanup includes in compositor/ per IWYU style
Change-Id: I4362a5ff4228b1a30812ec564f6a0c81e1f5cf08
2025-11-11 19:14:32 +00:00
Andrew Wolfers
2261f81762 drm_hwcomposer: Add Rect utility type
This change refactors the IRect and FRect types into a single
templated type Rect<T>, which allows the implementation to be
shared across both variants. This change also adds convenience
getters for the rect widths and heights, and updates callsites
accordingly.

Change-Id: I38509631d57706266186a7b7fa21bd43c0860890
2025-09-10 13:41:51 +00:00
Andrew Wolfers
9255d0d10b drm_hwcomposer: Migrate to android::drm_hwcomposer namespace
Change-Id: I2859aa8f55532d88231389724956fc77b0625339
2025-09-08 18:53:00 +00:00
Drew Davenport
a5fb437d37 drm_hwcomposer: Move CompositionType out of HwcLayer struct
Moving this paves the way for reducing dependency on HwcLayer from the
Backend class

Change-Id: I62f057a0efcb7afc3c9a04cff3bd53b5c56c5ad9
2025-08-19 09:16:22 -06:00
Andrew Wolfers
a2a1092e33 drm_hwcomposer: Plumb damage into Hwc layer data
This change adds a damage property to LayerData which is populated
from the damage provided via the layer command.

Change-Id: Ie6c069a1c2c81a8dc588a518f553ff087b0299dd
Signed-off-by: Andrew Wolfers <aswolfers@google.com>
2025-04-08 15:31:28 +00:00
Roman Stratiienko
ee6d843ef8 drm_hwcomposer: Rework CreateLayer/DestroyLayer
- Make HwcDisplay CreateLayer/DestroyLayer frontend-agnostic.
- Provide LayerId as an input for CreateLayer. It is necessary to add
  the HWC3 LayerLifecycleBatchCommand feature, where layer ID is
  generated by the client.

Change-Id: I317dcf22461fe4390ced9f0c0c780cffaa3b8f5d
Signed-off-by: Roman Stratiienko <r.stratiienko@gmail.com>
2025-02-18 22:58:58 +02:00
Roman Stratiienko
fb9fed5389 drm_hwcomposer: Use float type to store alpha internally
0.0-1.0F range is a natural way to store alpha value internally,
to be converted later to DRM-specific 0-0xFFFF fixed point type at
DRM layer.

Change-Id: Iedf2b11e53bf38efd08cd4eda1346647b9ff721f
Signed-off-by: Roman Stratiienko <r.stratiienko@gmail.com>
2025-02-05 22:39:35 +02:00
Roman Stratiienko
4e15bfc948 drm_hwcomposer: Support default values for Rect structures
This commit introduces two improvements:
1. Introduces frontend-agnostic structures for rects.
2. Support default values in them so that the backend can handle
   cases where rects are not specified by the client, like
   the client layer display frame, etc.
   This reduces the complexity of the Internal layer, making it
   feasible to use a single Frontend<->Internal layer API for
   regular layers, as well as for the Client and Output layers.

Change-Id: Iab5030ad523d36ea4c5af142f6f628952467d6ab
Signed-off-by: Roman Stratiienko <r.stratiienko@gmail.com>
2025-02-05 22:39:35 +02:00
Roman Stratiienko
da2fcf6676 drm_hwcomposer: Simplify LayerTransform
Fixes clang-analyzer-optin.core.EnumCastOutOfRange clang tidy check.

Change-Id: I0a88d1ef084848c924198e8bd3831533b6578675
Signed-off-by: Roman Stratiienko <r.stratiienko@gmail.com>
2025-01-24 23:33:35 +02:00
Roman Stratiienko
b9bd2712fb drm_hwcomposer: Fix DRM and HWC rotation direction misalignment
[DRM API][1] uses a counter-clockwise direction, while [HWC API][2] uses
a clockwise.

[1]: https://elixir.bootlin.com/linux/v6.5.7/source/include/uapi/drm/drm_mode.h#L172
[2]: https://cs.android.com/android/platform/superproject/main/+/main:hardware/libhardware/include_all/hardware/hwcomposer_defs.h;l=96;drc=e9d7337d9d1edc0d8e3ece246ecde747e345e876
Closes: https://gitlab.freedesktop.org/drm-hwcomposer/drm-hwcomposer/-/issues/78
Signed-off-by: Roman Stratiienko <r.stratiienko@gmail.com>
2023-10-15 02:16:45 +03:00
Roman Stratiienko
359a9d3971 drm_hwcomposer: Propagate acquire fence for test/validate cycle as well
Since acquire_fence is now std::shared_ptr, struct LayerData has default
copy constructor and LayerData::Clone() function is no longer required.
Also we can now remove 'test' argument from HwcLayer::PopulateLayerData
function, since copy operation for acquire_fence is now available.

Signed-off-by: Roman Stratiienko <r.stratiienko@gmail.com>
2023-01-18 14:59:55 +02:00
Roman Stratiienko
76892784ac drm_hwcomposer: Introduce SharedFd, use standard c++ RAII for UniqueFd
We use too much dup() system calls for present fence propagating.
Also when propagating acquire fence we use additional logic for
skipping such propagation for the validate/test cycle.

Both issues can be solved by introducing SharedFd, which will track
reference count of fd object.

After that the UniqueFd is used very rarely and can be simplified by
wrapping it into std::unique_ptr without caring too much of adding
an extra malloc/free operation.

Signed-off-by: Roman Stratiienko <r.stratiienko@gmail.com>
2023-01-16 20:13:58 +02:00
Roman Stratiienko
a7913de518 drm_hwcomposer: CI: Bump-up clang toolchain to v15
Address new clang-tidy findings, in most cases 'misc-const-correctness'
check was addressed by adding 'const' modifier, or in some cases changed
to 'auto' (where it's better for formatting).

Signed-off-by: Roman Stratiienko <r.stratiienko@gmail.com>
2022-10-20 14:14:33 +03:00
Roman Stratiienko
4b2cc484f9 drm_hwcomposer: Reorganize struct DrmHwcLayer
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-17 11:20:44 +03:00