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.
This commit is contained in:
Josef Söntgen 2021-10-04 18:29:21 +02:00 committed by Norman Feske
parent 27e55dab3e
commit f6d845e630

View File

@ -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);