drm: account for guard page

This makes the rendering issue with mesa gears disappear.

Issue #4148
This commit is contained in:
Josef Söntgen 2017-09-05 14:05:49 +02:00 committed by Christian Helmuth
parent 04d8e03ecb
commit 3e284558a1

View File

@ -1493,12 +1493,16 @@ class Gpu::Session_component : public Genode::Session_object<Gpu::Session>
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<Buffer>);
Genode::size_t const avail = _guard.quota() - _guard.consumed();
if (need > avail) { throw Gpu::Session_component::Out_of_ram(); }