diff --git a/Cargo.lock b/Cargo.lock
index 0e65aefa..a524fa81 100644
--- a/Cargo.lock
+++ b/Cargo.lock
@@ -84,6 +84,24 @@ version = "1.5.1"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "983cd8b9d4b02a6dc6ffa557262eb5858a27a0038ffffe21a0f133eaa819a164"
+[[package]]
+name = "arrayref"
+version = "0.3.6"
+source = "registry+https://github.com/rust-lang/crates.io-index"
+checksum = "a4c527152e37cf757a3f78aae5a06fbeefdb07ccc535c980a3208ee3060dd544"
+
+[[package]]
+name = "arrayvec"
+version = "0.5.2"
+source = "registry+https://github.com/rust-lang/crates.io-index"
+checksum = "23b62fc65de8e4e7f52534fb52b0f3ed04746ae267519eef2a83941e8085068b"
+
+[[package]]
+name = "arrayvec"
+version = "0.7.2"
+source = "registry+https://github.com/rust-lang/crates.io-index"
+checksum = "8da52d66c7071e2e3fa2a1e5c6d088fec47b593032b254f5e980de8ea54454d6"
+
[[package]]
name = "atomic_refcell"
version = "0.1.8"
@@ -176,13 +194,19 @@ dependencies = [
]
[[package]]
-name = "calloop"
-version = "0.10.2"
+name = "byteorder"
+version = "1.4.3"
source = "registry+https://github.com/rust-lang/crates.io-index"
-checksum = "595eb0438b3c6d262395fe30e6de9a61beb57ea56290b00a07f227fe6e20cbf2"
+checksum = "14c189c53d098945499cdfa7ecc63567cf3886b3332b312a5b4585d8d3a6a610"
+
+[[package]]
+name = "calloop"
+version = "0.10.3"
+source = "registry+https://github.com/rust-lang/crates.io-index"
+checksum = "5bcf530afb40e45e14440701e5e996d7fd139e84a912a4d83a8d6a0fb3e58663"
dependencies = [
"log",
- "nix 0.24.2",
+ "nix 0.25.0",
"slotmap",
"thiserror",
"vec_map",
@@ -241,6 +265,12 @@ dependencies = [
"objc",
]
+[[package]]
+name = "color_quant"
+version = "1.1.0"
+source = "registry+https://github.com/rust-lang/crates.io-index"
+checksum = "3d7b894f5411737b7867f4827955924d7c254fc9f4d91a6aad6b097804b1018b"
+
[[package]]
name = "core-foundation"
version = "0.9.3"
@@ -418,10 +448,19 @@ dependencies = [
]
[[package]]
-name = "digest"
-version = "0.10.5"
+name = "data-url"
+version = "0.1.1"
source = "registry+https://github.com/rust-lang/crates.io-index"
-checksum = "adfbc57365a37acbd2ebf2b64d7e69bb766e2fea813521ed536f5d0520dcf86c"
+checksum = "3a30bfce702bcfa94e906ef82421f2c0e61c076ad76030c16ee5d2e9a32fe193"
+dependencies = [
+ "matches",
+]
+
+[[package]]
+name = "digest"
+version = "0.10.6"
+source = "registry+https://github.com/rust-lang/crates.io-index"
+checksum = "8168378f4e5023e7218c89c891c0fd8ecdb5e5e4f18cb78f38cf245dd021e76f"
dependencies = [
"block-buffer",
"crypto-common",
@@ -545,6 +584,18 @@ dependencies = [
"nohash-hasher",
]
+[[package]]
+name = "egui_extras"
+version = "0.19.0"
+source = "registry+https://github.com/rust-lang/crates.io-index"
+checksum = "f698f685bb0ad39e87109e2f695ded0bccde77d5d40bbf7590cb5561c1e3039d"
+dependencies = [
+ "egui",
+ "resvg",
+ "tiny-skia",
+ "usvg",
+]
+
[[package]]
name = "egui_glow"
version = "0.19.0"
@@ -624,12 +675,39 @@ dependencies = [
"miniz_oxide 0.5.4",
]
+[[package]]
+name = "float-cmp"
+version = "0.9.0"
+source = "registry+https://github.com/rust-lang/crates.io-index"
+checksum = "98de4bbd547a563b716d8dfa9aad1cb19bfab00f4fa09a6a4ed21dbcf44ce9c4"
+
[[package]]
name = "fnv"
version = "1.0.7"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "3f9eec918d3f24069decb9af1554cad7c880e2da24a9afd88aca000531ab82c1"
+[[package]]
+name = "fontconfig-parser"
+version = "0.5.1"
+source = "registry+https://github.com/rust-lang/crates.io-index"
+checksum = "2be17a530a842f8a7a60f4397a08e8f08872849a5e31b20c7bd7301dac483296"
+dependencies = [
+ "roxmltree 0.15.1",
+]
+
+[[package]]
+name = "fontdb"
+version = "0.9.3"
+source = "registry+https://github.com/rust-lang/crates.io-index"
+checksum = "d52186a39c335aa6f79fc0bf1c3cf854870b6ad4e50a7bb8a59b4ba1331f478a"
+dependencies = [
+ "fontconfig-parser",
+ "log",
+ "memmap2",
+ "ttf-parser 0.17.1",
+]
+
[[package]]
name = "foreign-types"
version = "0.3.2"
@@ -698,6 +776,16 @@ dependencies = [
"wasi",
]
+[[package]]
+name = "gif"
+version = "0.11.4"
+source = "registry+https://github.com/rust-lang/crates.io-index"
+checksum = "3edd93c6756b4dfaf2709eafcc345ba2636565295c198a9cfbf75fa5e3e00b06"
+dependencies = [
+ "color_quant",
+ "weezl",
+]
+
[[package]]
name = "gimli"
version = "0.26.2"
@@ -767,10 +855,23 @@ source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "b9e0384b61958566e926dc50660321d12159025e767c18e043daf26b70104c39"
[[package]]
-name = "indexmap"
-version = "1.9.1"
+name = "image"
+version = "0.24.5"
source = "registry+https://github.com/rust-lang/crates.io-index"
-checksum = "10a35a97730320ffe8e2d410b5d3b69279b98d2c14bdb8b70ea89ecf7888d41e"
+checksum = "69b7ea949b537b0fd0af141fff8c77690f2ce96f4f41f042ccb6c69c6c965945"
+dependencies = [
+ "bytemuck",
+ "byteorder",
+ "color_quant",
+ "num-rational",
+ "num-traits",
+]
+
+[[package]]
+name = "indexmap"
+version = "1.9.2"
+source = "registry+https://github.com/rust-lang/crates.io-index"
+checksum = "1885e79c1fc4b10f0e172c475f458b7f7b93061064d98c3293e98c5ba0c8b399"
dependencies = [
"autocfg",
"hashbrown",
@@ -831,6 +932,12 @@ version = "0.3.0"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "8eaf4bc02d17cbdd7ff4c7438cafcdf7fb9a4613313ad11b4f8fefe7d3fa0130"
+[[package]]
+name = "jpeg-decoder"
+version = "0.2.6"
+source = "registry+https://github.com/rust-lang/crates.io-index"
+checksum = "9478aa10f73e7528198d75109c8be5cd7d15fb530238040148d5f9a22d4c5b3b"
+
[[package]]
name = "js-sys"
version = "0.3.60"
@@ -846,6 +953,15 @@ version = "3.1.0"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "e2db585e1d738fc771bf08a151420d3ed193d9d895a36df7f6f8a9456b911ddc"
+[[package]]
+name = "kurbo"
+version = "0.8.3"
+source = "registry+https://github.com/rust-lang/crates.io-index"
+checksum = "7a53776d271cfb873b17c618af0298445c88afc52837f3e948fa3fafd131f449"
+dependencies = [
+ "arrayvec 0.7.2",
+]
+
[[package]]
name = "lazy_static"
version = "1.4.0"
@@ -946,6 +1062,12 @@ dependencies = [
"libc",
]
+[[package]]
+name = "matches"
+version = "0.1.9"
+source = "registry+https://github.com/rust-lang/crates.io-index"
+checksum = "a3e378b66a060d48947b590737b30a1be76706c8dd7b8ba0f2fe3989c68a853f"
+
[[package]]
name = "memchr"
version = "2.5.0"
@@ -1118,6 +1240,27 @@ dependencies = [
"minimal-lexical",
]
+[[package]]
+name = "num-integer"
+version = "0.1.45"
+source = "registry+https://github.com/rust-lang/crates.io-index"
+checksum = "225d3389fb3509a24c93f5c29eb6bde2586b98d9f016636dff58d7c6f7569cd9"
+dependencies = [
+ "autocfg",
+ "num-traits",
+]
+
+[[package]]
+name = "num-rational"
+version = "0.4.1"
+source = "registry+https://github.com/rust-lang/crates.io-index"
+checksum = "0638a1c9d0a3c0914158145bc76cff373a75a627e6ecbfb71cbe6f453a5a19b0"
+dependencies = [
+ "autocfg",
+ "num-integer",
+ "num-traits",
+]
+
[[package]]
name = "num-traits"
version = "0.2.15"
@@ -1187,7 +1330,7 @@ version = "0.17.1"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "18904d3c65493a9f0d7542293d1a7f69bfdc309a6b9ef4f46dc3e58b0577edc5"
dependencies = [
- "ttf-parser",
+ "ttf-parser 0.17.1",
]
[[package]]
@@ -1219,6 +1362,12 @@ version = "2.2.0"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "478c572c3d73181ff3c2539045f6eb99e5491218eae919370993b890cdbdd98e"
+[[package]]
+name = "pico-args"
+version = "0.5.0"
+source = "registry+https://github.com/rust-lang/crates.io-index"
+checksum = "5be167a7af36ee22fe3115051bc51f6e6c7054c9348e28deb4f49bd6f705a315"
+
[[package]]
name = "pin-project-lite"
version = "0.2.9"
@@ -1335,6 +1484,12 @@ dependencies = [
"cty",
]
+[[package]]
+name = "rctree"
+version = "0.4.0"
+source = "registry+https://github.com/rust-lang/crates.io-index"
+checksum = "9ae028b272a6e99d9f8260ceefa3caa09300a8d6c8d2b2001316474bc52122e9"
+
[[package]]
name = "redox_syscall"
version = "0.2.16"
@@ -1381,6 +1536,33 @@ dependencies = [
"winapi",
]
+[[package]]
+name = "resvg"
+version = "0.23.0"
+source = "registry+https://github.com/rust-lang/crates.io-index"
+checksum = "34489194784b86c03c3d688258e2ba73f3c82700ba4673ee2ecad5ae540b9438"
+dependencies = [
+ "gif",
+ "jpeg-decoder",
+ "log",
+ "pico-args",
+ "png",
+ "rgb",
+ "svgfilters",
+ "svgtypes",
+ "tiny-skia",
+ "usvg",
+]
+
+[[package]]
+name = "rgb"
+version = "0.8.34"
+source = "registry+https://github.com/rust-lang/crates.io-index"
+checksum = "3603b7d71ca82644f79b5a06d1220e9a58ede60bd32255f698cb1af8838b8db3"
+dependencies = [
+ "bytemuck",
+]
+
[[package]]
name = "ron"
version = "0.7.1"
@@ -1392,6 +1574,24 @@ dependencies = [
"serde",
]
+[[package]]
+name = "roxmltree"
+version = "0.14.1"
+source = "registry+https://github.com/rust-lang/crates.io-index"
+checksum = "921904a62e410e37e215c40381b7117f830d9d89ba60ab5236170541dd25646b"
+dependencies = [
+ "xmlparser",
+]
+
+[[package]]
+name = "roxmltree"
+version = "0.15.1"
+source = "registry+https://github.com/rust-lang/crates.io-index"
+checksum = "6b9de9831a129b122e7e61f242db509fa9d0838008bf0b29bb0624669edfe48a"
+dependencies = [
+ "xmlparser",
+]
+
[[package]]
name = "rustc-demangle"
version = "0.1.21"
@@ -1404,12 +1604,37 @@ version = "1.0.9"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "97477e48b4cf8603ad5f7aaf897467cf42ab4218a38ef76fb14c2d6773a6d6a8"
+[[package]]
+name = "rustybuzz"
+version = "0.5.1"
+source = "registry+https://github.com/rust-lang/crates.io-index"
+checksum = "a617c811f5c9a7060fe511d35d13bf5b9f0463ce36d63ce666d05779df2b4eba"
+dependencies = [
+ "bitflags",
+ "bytemuck",
+ "smallvec",
+ "ttf-parser 0.15.2",
+ "unicode-bidi-mirroring",
+ "unicode-ccc",
+ "unicode-general-category",
+ "unicode-script",
+]
+
[[package]]
name = "ryu"
version = "1.0.11"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "4501abdff3ae82a1c1b477a17252eb69cee9e66eb915c1abaa4f44d873df9f09"
+[[package]]
+name = "safe_arch"
+version = "0.5.2"
+source = "registry+https://github.com/rust-lang/crates.io-index"
+checksum = "c1ff3d6d9696af502cc3110dacce942840fb06ff4514cad92236ecc455f2ce05"
+dependencies = [
+ "bytemuck",
+]
+
[[package]]
name = "scan_fmt"
version = "0.2.6"
@@ -1459,9 +1684,9 @@ dependencies = [
[[package]]
name = "serde_json"
-version = "1.0.87"
+version = "1.0.88"
source = "registry+https://github.com/rust-lang/crates.io-index"
-checksum = "6ce777b7b150d76b9cf60d28b55f5847135a003f7d7350c6be7a773508ce7d45"
+checksum = "8e8b3801309262e8184d9687fb697586833e939767aea0dda89f5a8e650e8bd7"
dependencies = [
"itoa",
"ryu",
@@ -1479,6 +1704,21 @@ dependencies = [
"digest",
]
+[[package]]
+name = "simplecss"
+version = "0.2.1"
+source = "registry+https://github.com/rust-lang/crates.io-index"
+checksum = "a11be7c62927d9427e9f40f3444d5499d868648e2edbc4e2116de69e7ec0e89d"
+dependencies = [
+ "log",
+]
+
+[[package]]
+name = "siphasher"
+version = "0.3.10"
+source = "registry+https://github.com/rust-lang/crates.io-index"
+checksum = "7bd3e3206899af3f8b12af284fafc038cc1dc2b41d1b89dd17297221c5d225de"
+
[[package]]
name = "slog"
version = "2.7.0"
@@ -1615,11 +1855,13 @@ dependencies = [
[[package]]
name = "smithay-egui"
version = "0.1.0"
-source = "git+https://github.com/Smithay/smithay-egui.git?rev=7334d0c53#7334d0c533ad307b3359cd4931bfb1ad4c34b178"
+source = "git+https://github.com/Smithay/smithay-egui.git?branch=feature/image#9fcb589d5c99ac8143f0a967504cdbf691d6cea4"
dependencies = [
"cgmath",
"egui",
+ "egui_extras",
"egui_glow",
+ "image",
"memoffset",
"smithay",
"xkbcommon 0.4.1",
@@ -1643,6 +1885,25 @@ version = "2.4.1"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "6bdef32e8150c2a081110b42772ffe7d7c9032b606bc226c8260fd97e0976601"
+[[package]]
+name = "svgfilters"
+version = "0.4.0"
+source = "registry+https://github.com/rust-lang/crates.io-index"
+checksum = "639abcebc15fdc2df179f37d6f5463d660c1c79cd552c12343a4600827a04bce"
+dependencies = [
+ "float-cmp",
+ "rgb",
+]
+
+[[package]]
+name = "svgtypes"
+version = "0.8.2"
+source = "registry+https://github.com/rust-lang/crates.io-index"
+checksum = "22975e8a2bac6a76bb54f898a6b18764633b00e780330f0b689f65afb3975564"
+dependencies = [
+ "siphasher",
+]
+
[[package]]
name = "syn"
version = "1.0.103"
@@ -1743,6 +2004,20 @@ dependencies = [
"time-core",
]
+[[package]]
+name = "tiny-skia"
+version = "0.6.6"
+source = "registry+https://github.com/rust-lang/crates.io-index"
+checksum = "d049bfef0eaa2521e75d9ffb5ce86ad54480932ae19b85f78bec6f52c4d30d78"
+dependencies = [
+ "arrayref",
+ "arrayvec 0.5.2",
+ "bytemuck",
+ "cfg-if",
+ "png",
+ "safe_arch",
+]
+
[[package]]
name = "toml"
version = "0.5.9"
@@ -1772,6 +2047,12 @@ dependencies = [
"once_cell",
]
+[[package]]
+name = "ttf-parser"
+version = "0.15.2"
+source = "registry+https://github.com/rust-lang/crates.io-index"
+checksum = "7b3e06c9b9d80ed6b745c7159c40b311ad2916abb34a49e9be2653b90db0d8dd"
+
[[package]]
name = "ttf-parser"
version = "0.17.1"
@@ -1795,12 +2076,75 @@ dependencies = [
"pkg-config",
]
+[[package]]
+name = "unicode-bidi"
+version = "0.3.8"
+source = "registry+https://github.com/rust-lang/crates.io-index"
+checksum = "099b7128301d285f79ddd55b9a83d5e6b9e97c92e0ea0daebee7263e932de992"
+
+[[package]]
+name = "unicode-bidi-mirroring"
+version = "0.1.0"
+source = "registry+https://github.com/rust-lang/crates.io-index"
+checksum = "56d12260fb92d52f9008be7e4bca09f584780eb2266dc8fecc6a192bec561694"
+
+[[package]]
+name = "unicode-ccc"
+version = "0.1.2"
+source = "registry+https://github.com/rust-lang/crates.io-index"
+checksum = "cc2520efa644f8268dce4dcd3050eaa7fc044fca03961e9998ac7e2e92b77cf1"
+
+[[package]]
+name = "unicode-general-category"
+version = "0.4.0"
+source = "registry+https://github.com/rust-lang/crates.io-index"
+checksum = "07547e3ee45e28326cc23faac56d44f58f16ab23e413db526debce3b0bfd2742"
+
[[package]]
name = "unicode-ident"
version = "1.0.4"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "dcc811dc4066ac62f84f11307873c4850cb653bfa9b1719cee2bd2204a4bc5dd"
+[[package]]
+name = "unicode-script"
+version = "0.5.5"
+source = "registry+https://github.com/rust-lang/crates.io-index"
+checksum = "7d817255e1bed6dfd4ca47258685d14d2bdcfbc64fdc9e3819bd5848057b8ecc"
+
+[[package]]
+name = "unicode-vo"
+version = "0.1.0"
+source = "registry+https://github.com/rust-lang/crates.io-index"
+checksum = "b1d386ff53b415b7fe27b50bb44679e2cc4660272694b7b6f3326d8480823a94"
+
+[[package]]
+name = "usvg"
+version = "0.23.0"
+source = "registry+https://github.com/rust-lang/crates.io-index"
+checksum = "28a82565b5c96dcbb58c9bdbb6aa3642abd395a6a6b480658532c6f74c3c4b7a"
+dependencies = [
+ "base64",
+ "data-url",
+ "flate2",
+ "float-cmp",
+ "fontdb",
+ "kurbo",
+ "log",
+ "pico-args",
+ "rctree",
+ "roxmltree 0.14.1",
+ "rustybuzz",
+ "simplecss",
+ "siphasher",
+ "svgtypes",
+ "ttf-parser 0.15.2",
+ "unicode-bidi",
+ "unicode-script",
+ "unicode-vo",
+ "xmlwriter",
+]
+
[[package]]
name = "uuid"
version = "0.8.2"
@@ -2068,6 +2412,12 @@ dependencies = [
"wasm-bindgen",
]
+[[package]]
+name = "weezl"
+version = "0.1.7"
+source = "registry+https://github.com/rust-lang/crates.io-index"
+checksum = "9193164d4de03a926d909d3bc7c30543cecb35400c02114792c2cae20d5e2dbb"
+
[[package]]
name = "winapi"
version = "0.3.9"
@@ -2306,3 +2656,15 @@ name = "xml-rs"
version = "0.8.4"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "d2d7d3948613f75c98fd9328cfdcc45acc4d360655289d0a7d4ec931392200a3"
+
+[[package]]
+name = "xmlparser"
+version = "0.13.5"
+source = "registry+https://github.com/rust-lang/crates.io-index"
+checksum = "4d25c75bf9ea12c4040a97f829154768bbbce366287e2dc044af160cd79a13fd"
+
+[[package]]
+name = "xmlwriter"
+version = "0.1.0"
+source = "registry+https://github.com/rust-lang/crates.io-index"
+checksum = "ec7a2a501ed189703dba8b08142f057e887dfc4b2cc4db2d343ac6376ba3e0b9"
diff --git a/Cargo.toml b/Cargo.toml
index 954ec444..064b52e4 100644
--- a/Cargo.toml
+++ b/Cargo.toml
@@ -42,7 +42,9 @@ features = ["backend_drm", "backend_gbm", "backend_egl", "backend_libinput", "ba
[dependencies.smithay-egui]
git = "https://github.com/Smithay/smithay-egui.git"
-rev = "7334d0c53"
+#rev = "ee25d401ac"
+branch = "feature/image"
+features = ["svg"]
optional = true
[features]
diff --git a/resources/icons/amd.svg b/resources/icons/amd.svg
new file mode 100644
index 00000000..59275eda
--- /dev/null
+++ b/resources/icons/amd.svg
@@ -0,0 +1 @@
+
\ No newline at end of file
diff --git a/resources/icons/intel.svg b/resources/icons/intel.svg
new file mode 100644
index 00000000..b7253316
--- /dev/null
+++ b/resources/icons/intel.svg
@@ -0,0 +1,12 @@
+
+
+
\ No newline at end of file
diff --git a/resources/icons/nvidia.svg b/resources/icons/nvidia.svg
new file mode 100644
index 00000000..2b25de27
--- /dev/null
+++ b/resources/icons/nvidia.svg
@@ -0,0 +1 @@
+
\ No newline at end of file
diff --git a/src/backend/kms/mod.rs b/src/backend/kms/mod.rs
index d8eb8856..4eedaf78 100644
--- a/src/backend/kms/mod.rs
+++ b/src/backend/kms/mod.rs
@@ -504,22 +504,32 @@ impl State {
let outputs = device.enumerate_surfaces()?.added; // There are no removed outputs on newly added devices
let mut wl_outputs = Vec::new();
let mut w = self.common.shell.global_space().size.w;
- for (crtc, conn) in outputs {
- match device.setup_surface(crtc, conn, (w, 0)) {
- Ok(output) => {
- w += output
- .user_data()
- .get::>()
- .unwrap()
- .borrow()
- .mode_size()
- .w;
- wl_outputs.push(output);
- }
- Err(err) => slog_scope::warn!("Failed to initialize output: {}", err),
- };
+ {
+ let backend = self.backend.kms();
+ for (crtc, conn) in outputs {
+ let mut renderer = match backend.api.renderer(&render_node, &render_node) {
+ Ok(renderer) => renderer,
+ Err(err) => {
+ slog_scope::warn!("Failed to initialize output: {}", err);
+ continue;
+ }
+ };
+ match device.setup_surface(crtc, conn, (w, 0), &mut renderer) {
+ Ok(output) => {
+ w += output
+ .user_data()
+ .get::>()
+ .unwrap()
+ .borrow()
+ .mode_size()
+ .w;
+ wl_outputs.push(output);
+ }
+ Err(err) => slog_scope::warn!("Failed to initialize output: {}", err),
+ };
+ }
+ backend.devices.insert(drm_node, device);
}
- self.backend.kms().devices.insert(drm_node, device);
self.common
.output_configuration_state
@@ -542,32 +552,45 @@ impl State {
let drm_node = DrmNode::from_dev_id(dev)?;
let mut outputs_removed = Vec::new();
let mut outputs_added = Vec::new();
- if let Some(device) = self.backend.kms().devices.get_mut(&drm_node) {
- let changes = device.enumerate_surfaces()?;
- let mut w = self.common.shell.global_space().size.w;
- for crtc in changes.removed {
- if let Some(surface) = device.surfaces.remove(&crtc) {
- if let Some(token) = surface.render_timer_token {
- self.common.event_loop_handle.remove(token);
+ {
+ let backend = self.backend.kms();
+ if let Some(device) = backend.devices.get_mut(&drm_node) {
+ let changes = device.enumerate_surfaces()?;
+ let mut w = self.common.shell.global_space().size.w;
+ for crtc in changes.removed {
+ if let Some(surface) = device.surfaces.remove(&crtc) {
+ if let Some(token) = surface.render_timer_token {
+ self.common.event_loop_handle.remove(token);
+ }
+ w -= surface.output.current_mode().map(|m| m.size.w).unwrap_or(0);
+ outputs_removed.push(surface.output.clone());
}
- w -= surface.output.current_mode().map(|m| m.size.w).unwrap_or(0);
- outputs_removed.push(surface.output.clone());
}
- }
- for (crtc, conn) in changes.added {
- match device.setup_surface(crtc, conn, (w, 0)) {
- Ok(output) => {
- w += output
- .user_data()
- .get::>()
- .unwrap()
- .borrow()
- .mode_size()
- .w;
- outputs_added.push(output);
- }
- Err(err) => slog_scope::warn!("Failed to initialize output: {}", err),
- };
+ for (crtc, conn) in changes.added {
+ let mut renderer = match backend
+ .api
+ .renderer(&device.render_node, &device.render_node)
+ {
+ Ok(renderer) => renderer,
+ Err(err) => {
+ slog_scope::warn!("Failed to initialize output: {}", err);
+ continue;
+ }
+ };
+ match device.setup_surface(crtc, conn, (w, 0), &mut renderer) {
+ Ok(output) => {
+ w += output
+ .user_data()
+ .get::>()
+ .unwrap()
+ .borrow()
+ .mode_size()
+ .w;
+ outputs_added.push(output);
+ }
+ Err(err) => slog_scope::warn!("Failed to initialize output: {}", err),
+ };
+ }
}
}
@@ -671,6 +694,7 @@ impl Device {
crtc: crtc::Handle,
conn: connector::Handle,
position: (i32, i32),
+ renderer: &mut GlMultiRenderer<'_>,
) -> Result