summaryrefslogtreecommitdiff
path: root/libweston
diff options
context:
space:
mode:
authorJoshua Watt <JPEWhacker@gmail.com>2022-07-22 08:59:45 -0500
committerMarius Vlad <marius.vlad@collabora.com>2022-07-26 13:03:23 +0300
commita09f02d43af486f0b0c27f2335a7fb3c157e685a (patch)
treedfe3581f621cdcee493e98ea2171dd3731439000 /libweston
parentb047f989a59f7b5372c609b095c7d2a95c638584 (diff)
downloadweston-a09f02d43af486f0b0c27f2335a7fb3c157e685a.tar.gz
libweston: Compute output protection when head is attached
A head may have its output protection set before it is attached to an output. Recompute the output protection whenever a head is attached to make sure it correctly set in output. Signed-off-by: Joshua Watt <JPEWhacker@gmail.com>
Diffstat (limited to 'libweston')
-rw-r--r--libweston/compositor.c56
1 files changed, 29 insertions, 27 deletions
diff --git a/libweston/compositor.c b/libweston/compositor.c
index 9d7bffdf..8dfacfe7 100644
--- a/libweston/compositor.c
+++ b/libweston/compositor.c
@@ -5803,6 +5803,33 @@ weston_output_iterate_heads(struct weston_output *output,
return container_of(node, struct weston_head, output_link);
}
+static void
+weston_output_compute_protection(struct weston_output *output)
+{
+ struct weston_head *head;
+ enum weston_hdcp_protection op_protection;
+ bool op_protection_valid = false;
+ struct weston_compositor *wc = output->compositor;
+
+ wl_list_for_each(head, &output->head_list, output_link) {
+ if (!op_protection_valid) {
+ op_protection = head->current_protection;
+ op_protection_valid = true;
+ }
+ if (head->current_protection < op_protection)
+ op_protection = head->current_protection;
+ }
+
+ if (!op_protection_valid)
+ op_protection = WESTON_HDCP_DISABLE;
+
+ if (output->current_protection != op_protection) {
+ output->current_protection = op_protection;
+ weston_output_damage(output);
+ weston_schedule_surface_protection_update(wc);
+ }
+}
+
/** Attach a head to an output
*
* \param output The output to attach to.
@@ -5842,6 +5869,8 @@ weston_output_attach_head(struct weston_output *output,
head->output = output;
wl_list_insert(output->head_list.prev, &head->output_link);
+ weston_output_compute_protection(output);
+
if (output->enabled) {
weston_head_add_global(head);
@@ -6154,33 +6183,6 @@ weston_head_set_supported_eotf_mask(struct weston_head *head,
weston_head_set_device_changed(head);
}
-static void
-weston_output_compute_protection(struct weston_output *output)
-{
- struct weston_head *head;
- enum weston_hdcp_protection op_protection;
- bool op_protection_valid = false;
- struct weston_compositor *wc = output->compositor;
-
- wl_list_for_each(head, &output->head_list, output_link) {
- if (!op_protection_valid) {
- op_protection = head->current_protection;
- op_protection_valid = true;
- }
- if (head->current_protection < op_protection)
- op_protection = head->current_protection;
- }
-
- if (!op_protection_valid)
- op_protection = WESTON_HDCP_DISABLE;
-
- if (output->current_protection != op_protection) {
- output->current_protection = op_protection;
- weston_output_damage(output);
- weston_schedule_surface_protection_update(wc);
- }
-}
-
WL_EXPORT void
weston_head_set_content_protection_status(struct weston_head *head,
enum weston_hdcp_protection status)