From f6d845e6309da5e774174d32d45756298a6341ac Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Josef=20S=C3=B6ntgen?= Date: Mon, 4 Oct 2021 18:29:21 +0200 Subject: [PATCH] gpu: reflect CAP shortage during buffer management Allocating and mapping buffers not only consumes RAM quota, it consumes CAP quota as well. Extended the Gpu session to allow for dealing with that on the client side. On a side note, the amount of initial CAP quota needed to establish a connection is increased to cover the current costs of the Intel GPU multiplexer. Issue #4284. --- repos/os/include/gpu_session/gpu_session.h | 11 +++++++---- 1 file changed, 7 insertions(+), 4 deletions(-) diff --git a/repos/os/include/gpu_session/gpu_session.h b/repos/os/include/gpu_session/gpu_session.h index 0df7f45ffd..0008ddbef9 100644 --- a/repos/os/include/gpu_session/gpu_session.h +++ b/repos/os/include/gpu_session/gpu_session.h @@ -72,7 +72,7 @@ struct Gpu::Session : public Genode::Session struct Conflicting_id : Genode::Exception { }; struct Mapping_buffer_failed : Genode::Exception { }; - enum { REQUIRED_QUOTA = 1024 * 1024, CAP_QUOTA = 8, }; + enum { REQUIRED_QUOTA = 1024 * 1024, CAP_QUOTA = 256, }; static const char *service_name() { return "Gpu"; } @@ -145,6 +145,8 @@ struct Gpu::Session : public Genode::Session * \param attrs specify how the buffer is mapped * * \throw Mapping_buffer_failed + * \throw Out_of_caps + * \throw Out_of_ram */ virtual Genode::Dataspace_capability map_buffer(Buffer_id id, bool aperture, @@ -164,6 +166,7 @@ struct Gpu::Session : public Genode::Session * \param va virtual address * * \throw Mapping_buffer_failed + * \throw Out_of_caps * \throw Out_of_ram */ virtual bool map_buffer_ppgtt(Buffer_id id, Gpu::addr_t va) = 0; @@ -196,16 +199,16 @@ struct Gpu::Session : public Genode::Session GENODE_RPC(Rpc_completion_sigh, void, completion_sigh, Genode::Signal_context_capability); GENODE_RPC_THROW(Rpc_alloc_buffer, Genode::Dataspace_capability, alloc_buffer, - GENODE_TYPE_LIST(Out_of_ram), + GENODE_TYPE_LIST(Out_of_caps, Out_of_ram), Gpu::Buffer_id, Genode::size_t); GENODE_RPC(Rpc_free_buffer, void, free_buffer, Gpu::Buffer_id); GENODE_RPC_THROW(Rpc_map_buffer, Genode::Dataspace_capability, map_buffer, - GENODE_TYPE_LIST(Mapping_buffer_failed, Out_of_ram), + GENODE_TYPE_LIST(Mapping_buffer_failed, Out_of_caps, Out_of_ram), Gpu::Buffer_id, bool, Gpu::Mapping_attributes); GENODE_RPC(Rpc_unmap_buffer, void, unmap_buffer, Gpu::Buffer_id); GENODE_RPC_THROW(Rpc_map_buffer_ppgtt, bool, map_buffer_ppgtt, - GENODE_TYPE_LIST(Mapping_buffer_failed, Out_of_ram), + GENODE_TYPE_LIST(Mapping_buffer_failed, Out_of_caps, Out_of_ram), Gpu::Buffer_id, Gpu::addr_t); GENODE_RPC(Rpc_unmap_buffer_ppgtt, void, unmap_buffer_ppgtt, Gpu::Buffer_id, Gpu::addr_t);