Commit 3f6af9e
3
files
+29
added
-3
deleted
@@ -233,6 +233,7 @@ fn composite_layer(
233
233
let out_idx = ld.output.unwrap_or(0);
234
234
let (ox, oy, out_w, out_h) = output_rect(state, out_idx);
235
235
let buffer = data.buffer.lock_or_recover().clone();
236
+ let debug = std::env::var("SELENE_STATS").is_ok();
236
237
// Pierwszy `commit` (zwykle bez bufora) → wyślij `configure` z rozmiarem.
237
238
if !*ld.configured.lock_or_recover() {
238
239
let st = *ld.state.lock_or_recover();
@@ -244,6 +245,9 @@ fn composite_layer(
244
245
height: ch.max(0) as u32,
245
246
});
246
247
*ld.configured.lock_or_recover() = true;
248
+ if debug {
249
+ eprintln!("selene/layer: configure {}x{}", cw.max(0), ch.max(0));
250
+ }
247
251
if buffer.is_none() {
248
252
return;
249
253
}
@@ -252,17 +256,26 @@ fn composite_layer(
252
256
return;
253
257
};
254
258
let Some(buf_data) = buffer.data::<BufferData>() else {
259
+ if debug {
260
+ eprintln!("selene/layer: commit bez BufferData");
261
+ }
255
262
return;
256
263
};
257
264
let (w, h) = (buf_data.width, buf_data.height);
258
265
let Some(rgba) = buf_data.to_rgba() else {
266
+ if debug {
267
+ eprintln!(
268
+ "selene/layer: bufor odrzucony (to_rgba None) {}x{} stride={} offset={}",
269
+ buf_data.width, buf_data.height, buf_data.stride, buf_data.offset
270
+ );
271
+ }
259
272
return;
260
273
};
261
274
let image = std::sync::Arc::new(ImageData::new(w as u32, h as u32, rgba));
262
275
let st = *ld.state.lock_or_recover();
263
276
let (rx, ry) = st.position(out_w, out_h, w as f64, h as f64);
264
277
let z = crate::layer::layer_z(st.layer);
265
- upsert_window(
278
+ let (_, created) = upsert_window(
266
279
state,
267
280
surface,
268
281
data,
@@ -277,6 +290,16 @@ fn composite_layer(
277
290
true,
278
291
image,
279
292
);
293
+ if debug && created {
294
+ eprintln!(
295
+ "selene/layer: okno utworzone {}x{} @ ({:.0},{:.0}), z={}",
296
+ w,
297
+ h,
298
+ ox + rx,
299
+ oy + ry,
300
+ z
301
+ );
302
+ }
280
303
let _ = buffer.send_event(wl_buffer::Event::Release);
281
304
}
282
305
@@ -171,6 +171,9 @@ impl Dispatch<layer_shell::ZwlrLayerShellV1, ()> for State {
171
171
};
172
172
// Indeks monitora niesiony przez zasób `wl_output`.
173
173
let output = output.and_then(|o| o.data::<usize>().copied());
174
+ if std::env::var("SELENE_STATS").is_ok() {
175
+ eprintln!("selene/layer: get_layer_surface (layer={layer}, output={output:?})");
176
+ }
174
177
let ls = data_init.init(id, LayerData::new(surface.clone(), layer, output));
175
178
// Zapamiętaj powiązanie po stronie `wl_surface` (potrzebne przy `commit`).
176
179
if let Some(sd) = surface.data::<SurfaceData>() {
@@ -170,8 +170,8 @@ pub fn spawn_drm(model: WindowModel, cursor: CursorModel) {
170
170
backend.wait_flip();
171
171
ms_wait += t.elapsed().as_secs_f64() * 1000.0;
172
172
}
173
- // Bez wejścia w trybie DRM odświeżamy w stałym rytmie (~60 Hz).
174
- std::thread::sleep(Duration::from_millis(16));
173
+ // `wait_flip` i tak synchronizuje z vblankiem, więc nie dosypujemy snu
174
+ // (wcześniejsze 16 ms samo ograniczało do ~20 fps).
175
175
frames += 1;
176
176
177
177
if stats && report.elapsed().as_secs_f64() >= 2.0 {