Commit graph

26 commits

Author SHA1 Message Date
Veeresh Kadasani c0f3cb87be backend-drm: Pass view alpha to plane state and commit
We map view alpha(0.0-1.0) to plane state's alpha
by using the max plane alpha value got from drm.

Signed-off-by: Hsuan-Yu Lin <hlin@jp.adit-jv.com>
Signed-off-by: Veeresh Kadasani <external.vkadasani@jp.adit-jv.com>
Signed-off-by: Vinh Nguyen Trong <Vinh.NguyenTrong@vn.bosch.com>
2023-03-30 17:29:57 +01:00
Veeresh Kadasani f35eccc6fa backend-drm: Add plane alpha DRM-property
This checks whether plane alpha is supported.
We get range of alpha value supported for plane
which is required for mapping view's alpha(0.0-1.0)
with drm plane alpha. No functional change.

Signed-off-by: Hsuan-Yu Lin <hlin@jp.adit-jv.com>
Signed-off-by: Veeresh Kadasani <external.vkadasani@jp.adit-jv.com>
Signed-off-by: Vinh Nguyen Trong <Vinh.NguyenTrong@vn.bosch.com>
2023-03-30 17:29:07 +01:00
Michael Olbrich d5e5428478 backend-drm: don't copy the fence fd when duplicating the plane state
The state does not own the fd. This is usually not a problem, because the
in_fence_fd of the state is assigned during drm_assign_planes() and then
immediately used in drm_repaint_flush(). It cannot be closed in-between.

However, in the fallback path in drm_output_start_repaint_loop(), the state is
duplicated. At this point in time, the in_fence_fd may be invalid because it was
replaced in a new commit of the corresponding surface.

The plane state was already committed to the kernel when it is copied, so the
fence is no longer needed. So just clear it.

Signed-off-by: Michael Olbrich <m.olbrich@pengutronix.de>
2023-03-22 11:41:56 +00:00
Derek Foreman e471edb33d drm-backend: Enable plane rotations
Search for planes that support the rotation required to properly display
a paint node, and properly set coordinates and rotation properties.

Signed-off-by: Derek Foreman <derek.foreman@collabora.com>
2023-02-02 12:25:56 -06:00
Derek Foreman b0f23dc09d backend-drm: Set rotation property on planes when possible
For now we just always set the plane up to have a "normal" rotation, so
no new features are added with this commit.

Signed-off-by: Derek Foreman <derek.foreman@collabora.com>
2023-02-02 12:25:56 -06:00
Derek Foreman 64d9270804 libweston: Use weston_coord space conversion functions
Update users of the old coordinate space conversion functions that take
x, y pairs to the new weston_coord versions.

Signed-off-by: Derek Foreman <derek.foreman@collabora.com>
2023-02-01 07:27:05 -06:00
Derek Foreman f31c81dce7 backend-drm: Use output to buffer matrix for plane setup
We can save a bit of work by using the output_to_buffer_matrix we've
already calculated for the paint node to transform the destination
rectangle, instead of starting over from global regions and doing
individual steps.

Signed-off-by: Derek Foreman <derek.foreman@collabora.com>
2023-01-16 17:56:36 +00:00
Derek Foreman 56cf553a63 drm: Don't try to correct flipped buffer coordinates
We should never hit this because drm_view_transform_supported() filters
out any transforms where it would occur.

Signed-off-by: Derek Foreman <derek.foreman@collabora.com>
2023-01-16 17:56:36 +00:00
Derek Foreman 05eee6eaef drm: Pass paint node to drm_view_transform_supported
Rename it as well.

By passing the paint node we'll have access to the cached buffer to output
matrix later.

Signed-off-by: Derek Foreman <derek.foreman@collabora.com>
2023-01-09 21:58:19 +00:00
Derek Foreman 7c7489fe79 drm: Pass paint node to drm_plane_state_coords_for_view
Rename the function as well, as it no longer takes a view.

Signed-off-by: Derek Foreman <derek.foreman@collabora.com>
2023-01-09 21:58:19 +00:00
Derek Foreman 21deaee6a9 libweston: use weston_region_global_to_output more often
Use this anywhere we used weston_matrix_transform_region with an output
matrix.

Signed-off-by: Derek Foreman <derek.foreman@collabora.com>
2022-09-23 11:41:59 +00:00
Derek Foreman df96fd435c backend-drm: Use weston_matrix_transform_region for plane setup
Signed-off-by: Derek Foreman <derek.foreman@collabora.com>
2022-09-23 11:41:59 +00:00
Michael Tretter 345e705e33 backend-drm: move drm objects from backend to drm device
The outputs, heads, crtcs, and connectors are specific to a drm device and not
the backend in general.

Link them to the device that they belong to to be able to retrieve the
respective device.

Signed-off-by: Michael Tretter <m.tretter@pengutronix.de>
2022-06-03 09:17:15 +02:00
Michael Tretter c4685d9463 backend-drm: attach device to pending state
The commits happen per device instead of per backend. The pending state is
therefore per device as well. Allow to retrieve the device from the pending
state.

Signed-off-by: Michael Tretter <m.tretter@pengutronix.de>
2022-06-03 09:14:11 +02:00
Michael Tretter 0d967bd7f4 backend-drm: extract device from backend
Extract the kms device from the backend to allow a better separation of the
backend and the kms device. This will allow to handle multiple kms devices with
a single drm backend.

Signed-off-by: Michael Tretter <m.tretter@pengutronix.de>
2022-06-03 09:12:57 +02:00
Daniel Stone fdc7b9c352 weston_buffer: Add mode to weston_buffer_reference
Add a mode argument to weston_buffer_reference which indicates whether a
buffer's storage may/will be accessed, or whether the underlying storage
will no longer be accessed, e.g. because it has been copied. This will
be used to retain a pointer to the weston_buffer whilst being able to
send a release event to the client.

Signed-off-by: Daniel Stone <daniels@collabora.com>
2022-04-25 14:27:08 +00:00
Daniel Stone 2ecc38b042 backend-drm: Move fb -> buffer reference to plane state
Currently each drm_fb takes a reference on a client buffer it wraps.
This prevents us from being able to reuse a drm_fb in multiple places
(e.g. two views of the same client buffer) simultaneously, or even back
to back.

Move the buffer reference to the plane state, as preparation for
allowing drm_fb to be cached inside the weston_buffer.

Signed-off-by: Daniel Stone <daniels@collabora.com>
2021-12-08 13:38:18 +00:00
Pekka Paalanen 4b301fe7f2 Add weston-drm-fourcc.h
This header is for sharing fallback definitions for drm_fourcc.h. A new
test in tests/yuv-buffer-test.c is going to be needing XYUV8888 format,
and more new formats will be expected with HDR supports.

Share these fallback definitions in one place instead of copying them
all over.

All users of drm_fourcc.h are converted to include weston-drm-fourcc.h
instead for consistency: have the same definitions available everywhere.

Signed-off-by: Pekka Paalanen <pekka.paalanen@collabora.com>
2021-02-25 14:35:03 +02:00
Alexandros Frantzis 9975134593 drm: Introduce drm_plane_reset_state() helper function
Introduce a helper function to reset the current state of a drm_plane.

Signed-off-by: Alexandros Frantzis <alexandros.frantzis@collabora.com>
2020-08-17 09:44:45 +00:00
Scott Anderson 15c603caa6 drm: Fix leak of damage blob id
This moves the creation of the blob to be earlier, to when the damage is
calculated. It replaces the damage tracked inside of the plane state
with the blob id itself.

This should stop creating new blob ids for TEST_ONLY commits, and them
being leaked in general, as the blob ids are now freed with the plane
state.

The FB_DAMAGE_CLIPS property is now always set if it's supported, and
will be 0 in the case that we have no damage information, which
signifies full damage to the kernel.

Signed-off-by: Scott Anderson <scott.anderson@collabora.com>
2020-06-04 09:52:16 +00:00
Marius Vlad 2538aaccc7 backend-drm: Construct a zpos candidate list of planes
In order to better optimize view assignment to HW planes, we construct
an intermediary zpos candidate list which is used aggregate all suitable
planes for handling scan-out capable client buffers.

We go over it twice: once to construct it and once to pick-and-choose a
suitable plane based its highest zpos position.

In order to maintain the view order correctly we track current zpos
value being applied to the plane state and use it when trying to place
a view into a plane.

Pass the computed zpos value to be applied to the plane state.

Signed-off-by: Marius Vlad <marius.vlad@collabora.com>
Suggested-by: Daniel Stone <daniel.stone@collabora.com>
2019-11-11 16:51:48 +00:00
Marius Vlad cdd6fa2717 backend-drm: Add zpos DRM-property
Functional no change, as nobody makes use of it. Only apply the zpos
value if the zpos property is mutable (that is, zpos_max and zpos_min
are not the same).

Signed-off-by: Marius Vlad <marius.vlad@collabora.com>
2019-11-11 16:51:48 +00:00
Daniel Stone 2cb926c558 Revert "backend-drm: Teach drm_property_info_populate() to retrieve range values"
Due to an error in driving GitLab, this commit erroneously contained the
entirety of !267 (zpos support in the KMS backend) squashed into one
single commit, pushed into master.

In order to keep the history clean, this is being reverted; a rebased
version of !267 with the clear individual commits which were already
present will be applied in its place.

This reverts commit 95e3b0deae.
2019-11-11 16:48:54 +00:00
Marius Vlad 95e3b0deae backend-drm: Teach drm_property_info_populate() to retrieve range values
Useful for zpos range values.

Signed-off-by: Marius Vlad <marius.vlad@collabora.com>
Suggested-by: Daniel Stone <daniel.stone@collabora.com>
2019-11-11 15:24:25 +00:00
Ankit Nautiyal a344fe3245 backend-drm: Add support for content-protection
Currently drm-layer supports HDCP1.4 using connector property:
Content Protection. This property if available for a platform, can be
read and set for requesting content-protection.
Also, the patch series [1] adds HDCP2.2 support in drm, and patch [2]
adds support to send udev events for change in connector properties,
made by the kernel.

This patch adds these HDCP connector properties in weston, and exposes
the content-protection support to the client for drm-backend.

It adds the enums to represent 'Content Protection' and 'Content Type'
connector properties exposed by drm layer. It adds a member
'protection' in drm_output_state, to store the desired protection
from the weston_output in the drm-backend output-repaint cycle. This
is then used to write the HDCP connector properties for the drm_heads
attached to the drm_output.

The kernel sends uevents to the user-space for any change made by it
in the "Content Protection" connector property. No event is sent in
case of change in the property made by the user-space.
It means, when there is a change of the property value from "DESIRED"
to "ENABLE" i.e. successful authentication by the kernel, a uevent
will be generated, but in case of userspace requesting for disabling
the protection by writing "UNDESIRED" into the property, no uevent
will be generated.

This patch also adds support for handling new udev events for HDCP
connector property changes. Any such change, triggers change in the
weston_head's current_protection.

[1] https://patchwork.freedesktop.org/series/57233/#rev7
[2] https://patchwork.freedesktop.org/patch/303903/?series=57233&rev=7

Signed-off-by: Ankit Nautiyal <ankit.k.nautiyal@intel.com>
2019-08-26 16:18:22 +05:30
Daniel Stone 6b466f25af compositor-drm: Move state helpers to separate file
Most of the state helpers (create, destroy, duplicate, etc) state, are
relatively straightforward and can live in a separate file.

Signed-off-by: Daniel Stone <daniels@collabora.com>
2019-06-26 23:08:36 +01:00