summaryrefslogtreecommitdiffstats
path: root/meta-agl-flutter/recipes-graphics/toyota/files/0001-shell-wayland-display-Handle-flags-as-bitfield-entri.patch
blob: 6970388c443c4f39dcc7d5f57d95be3848d754a6 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
From 357634ceae6d730131b26bc3e72b4cf0b3e902ad Mon Sep 17 00:00:00 2001
From: Marius Vlad <marius.vlad@collabora.com>
Date: Mon, 19 Jun 2023 10:34:44 +0300
Subject: [PATCH] shell/wayland/display: Handle flags as bitfield entries

We can have preferred and current mode or'ed in the same time, so we
can't really check just for current mode. Make sure we do get a valid
width/height for the outputs to avoid going further.

Bug-AGL: SPEC-4841
Signed-off-by: Marius Vlad <marius.vlad@collabora.com>
---
 shell/wayland/display.cc | 4 +++-
 1 file changed, 3 insertions(+), 1 deletion(-)

diff --git a/shell/wayland/display.cc b/shell/wayland/display.cc
index 434dd05..5ace67c 100644
--- a/shell/wayland/display.cc
+++ b/shell/wayland/display.cc
@@ -258,12 +258,14 @@ void Display::display_handle_mode(void* data,
   (void)flags;
   auto* oi = static_cast<output_info_t*>(data);
 
-  if (flags == WL_OUTPUT_MODE_CURRENT) {
+  if ((flags & WL_OUTPUT_MODE_CURRENT) == WL_OUTPUT_MODE_CURRENT) {
     oi->height = static_cast<unsigned int>(height);
     oi->width = static_cast<unsigned int>(width);
     oi->refresh_rate = refresh;
   }
 
+  assert(oi->height && oi->width);
+
   FML_DLOG(INFO) << "Video mode: " << width << " x " << height << " @ "
                  << (refresh > 1000 ? refresh / 1000.0 : (double)refresh)
                  << " Hz";
-- 
2.35.1