From 3e284558a1af2a8735d754d5ed20a6edc8c00691 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Josef=20S=C3=B6ntgen?= Date: Tue, 5 Sep 2017 14:05:49 +0200 Subject: [PATCH] drm: account for guard page This makes the rendering issue with mesa gears disappear. Issue #4148 --- repos/os/src/drivers/gpu/intel/main.cc | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/repos/os/src/drivers/gpu/intel/main.cc b/repos/os/src/drivers/gpu/intel/main.cc index b364741852..8b42a77718 100644 --- a/repos/os/src/drivers/gpu/intel/main.cc +++ b/repos/os/src/drivers/gpu/intel/main.cc @@ -1493,12 +1493,16 @@ class Gpu::Session_component : public Genode::Session_object Genode::Dataspace_capability alloc_buffer(Genode::size_t size) override { /* - * XXX size might not be page aligned, allocator overhead is not + * XXX allocator overhead is not * included, mapping costs are not included and we throw at * different locations... * * => better construct Buffer object as whole */ + + /* roundup to next page size and add guarding page */ + size = ((size + 0xffful) & ~0xffful) + 0x1000; + Genode::size_t const need = size + sizeof(Genode::Registered); Genode::size_t const avail = _guard.quota() - _guard.consumed(); if (need > avail) { throw Gpu::Session_component::Out_of_ram(); }