edith
Clone
https://git.tahinli.com/Tahinli/edith.git
0 watching0 forksRust18.3 MiBef5832fTahinli3 months ago597 commits
| 1 | //! The process that holds the video driver, and therefore the process a video |
| 2 | //! driver is allowed to kill. |
| 3 | //! |
| 4 | //! It is started by [`engine::hwproc::Remote::spawn`] with the encode session's |
| 5 | //! parameters as argv and one end of a socket pair as its standard input. It |
| 6 | //! opens the plugin's encoder in *this* address space, hands the parent a shared |
| 7 | //! anonymous file to stage pictures in, and then answers one request at a time |
| 8 | //! until the socket closes. Nothing else lives here: no project, no muxer, no |
| 9 | //! window -- so an `abort()` out of Mesa's own worker thread costs the editor a |
| 10 | //! reply and a fallback rather than the session. |
| 11 | //! |
| 12 | //! Three environment variables exist only for the tests that prove that, and |
| 13 | //! each is read here and nowhere else, so an editor without them set runs the |
| 14 | //! path it always ran: |
| 15 | //! |
| 16 | //! * `VE_HW_TEST_FAKE` -- open a stand-in seat that touches no driver, so the |
| 17 | //! containment paths can be exercised on a machine whose GPU is wedged (which |
| 18 | //! is the only machine where they matter). Refuses to open unless one of the |
| 19 | //! two below is set with it, so it can never be a silently empty encoder. |
| 20 | //! * `VE_HW_TEST_ABORT=<init|drain|N>` -- call `abort()` from a worker thread of |
| 21 | //! our own, before opening, at the first drain, or before coding picture `N`. |
| 22 | //! A foreign C thread's `abort()` is what really happened on 2026-08-13; this |
| 23 | //! is the same shape without a hung ring. |
| 24 | //! * `VE_HW_TEST_HANG=<init|drain|N>` -- stop answering at that same point, |
| 25 | //! without dying, which is the other half of a wedged ring. |
| 26 | |
| 27 | use ; |
| 28 | use ; |
| 29 | use UnixStream; |
| 30 | |
| 31 | use ; |
| 32 | use ; |
| 33 | |
| 34 | /// Where the encoder actually is: the plugin's, or the test stand-in that opens |
| 35 | /// no driver at all. |
| 36 | |
| 37 | |
| 38 | |
| 39 | |
| 40 | |
| 41 | |
| 42 | |
| 43 | |
| 44 | |
| 45 | |
| 46 | |
| 47 | |
| 48 | |
| 49 | |
| 50 | |
| 51 | |
| 52 | /// One of the three injection points, named the same way in all three variables. |
| 53 | |
| 54 | |
| 55 | |
| 56 | |
| 57 | |
| 58 | |
| 59 | |
| 60 | |
| 61 | |
| 62 | |
| 63 | |
| 64 | |
| 65 | |
| 66 | |
| 67 | |
| 68 | |
| 69 | /// The driver's own way of dying, reproduced: `abort()` called from a thread |
| 70 | /// that is not the one running the encode, because that is where |
| 71 | /// `amdgpu_ctx_set_sw_reset_status` calls it from and because a `catch_unwind` |
| 72 | /// around the encode call is exactly what cannot see it. |
| 73 | |
| 74 | |
| 75 | |
| 76 | |
| 77 | |
| 78 | |
| 79 | |
| 80 | |
| 81 | |
| 82 | |
| 83 | /// ...and the other half: alive, holding the socket open, answering nothing. |
| 84 | ! |
| 85 | |
| 86 | |
| 87 | |
| 88 | |
| 89 | |
| 90 | |
| 91 | |
| 92 | |
| 93 | |
| 94 | |
| 95 | |
| 96 | |
| 97 | |
| 98 | |
| 99 | |
| 100 | |
| 101 | |
| 102 | |
| 103 | |
| 104 | |
| 105 | |
| 106 | |
| 107 | |
| 108 | |
| 109 | |
| 110 | |
| 111 | |
| 112 | |
| 113 | |
| 114 | |
| 115 | |
| 116 | |
| 117 | |
| 118 | |
| 119 | |
| 120 | |
| 121 | |
| 122 | |
| 123 | |
| 124 | |
| 125 | |
| 126 | |
| 127 | |
| 128 | |
| 129 | |
| 130 | |
| 131 | |
| 132 | |
| 133 | |
| 134 | |
| 135 | |
| 136 | |
| 137 | |
| 138 | |
| 139 | |
| 140 | |
| 141 | |
| 142 | |
| 143 | |
| 144 | |
| 145 | |
| 146 | |
| 147 | |
| 148 | |
| 149 | |
| 150 | |
| 151 | |
| 152 | |
| 153 | |
| 154 | |
| 155 | |
| 156 | |
| 157 | |
| 158 | |
| 159 | |
| 160 | |
| 161 | |
| 162 | |
| 163 | |
| 164 | |
| 165 | |
| 166 | |
| 167 | |
| 168 | |
| 169 | |
| 170 | |
| 171 | |
| 172 | |
| 173 | |
| 174 | |
| 175 | |
| 176 | |
| 177 | |
| 178 | |
| 179 | |
| 180 | |
| 181 | |
| 182 | |
| 183 | |
| 184 | |
| 185 | |
| 186 | |
| 187 | |
| 188 | |
| 189 | |
| 190 | |
| 191 | |
| 192 | |
| 193 | |
| 194 | |
| 195 | |
| 196 | |
| 197 | |
| 198 | |
| 199 | |
| 200 | |
| 201 | |
| 202 | |
| 203 | |
| 204 | |
| 205 | |
| 206 | |
| 207 | |
| 208 | |
| 209 | |
| 210 | |
| 211 | |
| 212 | |
| 213 | |
| 214 | |
| 215 | |
| 216 | |
| 217 | |
| 218 | |
| 219 | |
| 220 | |
| 221 | |
| 222 | |
| 223 | |
| 224 | |
| 225 | |
| 226 | |
| 227 | |
| 228 | |
| 229 | |
| 230 | |
| 231 | |
| 232 | |
| 233 | |
| 234 | |
| 235 | |
| 236 | |
| 237 | |
| 238 | |
| 239 | |
| 240 | |
| 241 | |
| 242 | /// Writes one answer back. `false` means the parent is gone and this process has |
| 243 | /// nothing left to do. |
| 244 | |
| 245 | |
| 246 | |
| 247 | |
| 248 | |
| 249 | |
| 250 | |
| 251 | |
| 252 | |
| 253 | |
| 254 | |
| 255 | |
| 256 | |
| 257 | |
| 258 | |
| 259 | |
| 260 | |
| 261 | |
| 262 |