Skip to content

Commit

Permalink
nitpicker: alloc padded capture buffer
Browse files Browse the repository at this point in the history
This is a precondition for using Blit::back2front at the driver side.

Issue genodelabs#5428
  • Loading branch information
nfeske committed Jan 21, 2025
1 parent 59649b0 commit 459f0d6
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 3 deletions.
3 changes: 3 additions & 0 deletions repos/os/include/capture_session/capture_session.h
Original file line number Diff line number Diff line change
Expand Up @@ -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, 4),
.h = align_addr(px.h, 4) }; }
};

/**
Expand Down
6 changes: 3 additions & 3 deletions repos/os/src/server/nitpicker/capture_session.h
Original file line number Diff line number Diff line change
Expand Up @@ -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; }
Expand All @@ -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;
}
Expand All @@ -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));
Expand Down

0 comments on commit 459f0d6

Please sign in to comment.