On Thu, 15 Oct 2026 12:30:58 GMT, Alexander Zvegintsev <[email protected]> wrote:
> Ubuntu 26.10 may send multiple stream format events, and our screen capture > code doesn't handle it correctly: > > `onStreamParamChanged()` calls blocking `pw_thread_loop_signal(..., TRUE)` > and expects the corresponding `pw_thread_loop_accept` call. > However, `pw_thread_loop_accept` is only called while waiting for the initial > format, so a subsequent event can block PipeWire thread indefinitely. > > --- > > So the minimal fix would be to replace it with a non-blocking > `pw_thread_loop_signal(..., FALSE)` call and remove the corresponding accept > call(with some other minor changes). > > However, this alone leaves several other issues to address: > > - The `isAllDataReady` check and the wait now run under the same lock, > preventing lost wakeups. > - Added a 10s shared timeout for format negotiation and frame capture, so > missing events don't block java indefinitely. > - After capturing a frame, `onStreamProcess()` now returns any additional > buffers to PipeWire so they can be reused while the stream is still active, > e.g., while waiting for frames from other screens. > - Requeuing a PipeWire buffer allows its pixel data to be reused before we > copy it to the Java array. The `captureDataPixbuf` now always owns pixel data. > - `NULL` checks were added for pixbuf creation and scaling. > - Capture cleanup and stream deactivation now run under the same PipeWire > loop lock, preventing callbacks from observing partially reset capture state. > - Other cleanup improvements (pw context destruction, captureDataPixbuf unref) > - A valid restore token can be rejected incorrectly for uiScale other than 1 > for non standard resolutions(e.g. rounding for height on VirtualBox screen > `1359` > `680` > `1360` with uiScale 2). > Now it uses native screen bounds directly. > > > Testing looks good. > > --------- > - [x] I confirm that I make this contribution in accordance with the [OpenJDK > Interim AI Policy](https://openjdk.org/legal/ai). src/java.desktop/unix/classes/sun/awt/X11GraphicsDevice.java line 163: > 161: */ > 162: public Rectangle getNativeBounds() { > 163: return pGetBounds(getScreen()); Any reason why this data is not cached and invalidated on displaychange events(does that events actually supported by awt toolkit on wayland)? ------------- PR Review Comment: https://git.openjdk.org/jdk/pull/33384#discussion_r4301156010
