nitpicker: alloc padded capture buffer

This is a precondition for using Blit::back2front at the driver side.

Issue #5428
This commit is contained in:
Norman Feske 2025-01-20 16:34:39 +01:00 committed by Christian Helmuth
parent dc9ff4b3e3
commit ea811a3217
2 changed files with 6 additions and 3 deletions

View File

@ -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) }; }
};
/**

View File

@ -234,7 +234,7 @@ class Nitpicker::Capture_session : public Session_object<Capture::Session>
}
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<Capture::Session>
_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<Capture::Session>
Point const anchor = _anchor_point() + pos;
Canvas<Pixel_rgb888> canvas { _buffer->local_addr<Pixel_rgb888>(),
anchor, _buffer_attr.px };
anchor, _buffer_attr.padded_px() };
if (_policy_changed) {
canvas.draw_box({ anchor, canvas.size() }, Color::rgb(0, 0, 0));