From ef3cc09373bbe7d844b8a66ba3ba95299373b498 Mon Sep 17 00:00:00 2001 From: Norman Feske Date: Mon, 20 Jan 2025 16:34:39 +0100 Subject: [PATCH] nitpicker: alloc padded capture buffer This is a precondition for using Blit::back2front at the driver side. Issue #5428 --- repos/os/include/capture_session/capture_session.h | 3 +++ repos/os/src/server/nitpicker/capture_session.h | 6 +++--- 2 files changed, 6 insertions(+), 3 deletions(-) diff --git a/repos/os/include/capture_session/capture_session.h b/repos/os/include/capture_session/capture_session.h index 4313c88b9ae..30bd7e93893 100644 --- a/repos/os/include/capture_session/capture_session.h +++ b/repos/os/include/capture_session/capture_session.h @@ -81,6 +81,9 @@ struct Capture::Session : Genode::Session { Area px; /* buffer area in pixels */ Area mm; /* physical size in millimeters */ + + Area padded_px() const { return { .w = align_addr(px.w, 3), + .h = align_addr(px.h, 3) }; } }; /** diff --git a/repos/os/src/server/nitpicker/capture_session.h b/repos/os/src/server/nitpicker/capture_session.h index b5915063585..fa357e547bc 100644 --- a/repos/os/src/server/nitpicker/capture_session.h +++ b/repos/os/src/server/nitpicker/capture_session.h @@ -234,7 +234,7 @@ class Nitpicker::Capture_session : public Session_object } try { - _buffer.construct(_ram, _env.rm(), buffer_bytes(attr.px)); + _buffer.construct(_ram, _env.rm(), buffer_bytes(attr.padded_px())); _buffer_attr = attr; } catch (Out_of_ram) { result = Buffer_result::OUT_OF_RAM; } @@ -243,7 +243,7 @@ class Nitpicker::Capture_session : public Session_object _handler.capture_buffer_size_changed(); /* report complete buffer as dirty on next call of 'capture_at' */ - mark_as_damaged({ _anchor_point(), attr.px }); + mark_as_damaged({ _anchor_point(), attr.padded_px() }); return result; } @@ -266,7 +266,7 @@ class Nitpicker::Capture_session : public Session_object Point const anchor = _anchor_point() + pos; Canvas canvas { _buffer->local_addr(), - anchor, _buffer_attr.px }; + anchor, _buffer_attr.padded_px() }; if (_policy_changed) { canvas.draw_box({ anchor, canvas.size() }, Color::rgb(0, 0, 0));