mirror of
https://github.com/genodelabs/genode.git
synced 2024-12-23 15:32:25 +00:00
e37792ce94
The current info implementation (as RPC) is limited in a few ways: * The amount of data that may be transferred is constrained by the underlying base platform * Most information never changes during run time but is copied nonetheless * The information differs depending on the used GPU device and in its current implementation only contains Intel GPU specific details With this commit the 'info' RPC call is replaced with the 'info_dataspace' call that transfers the capability for the dataspace containing the information only. This is complemented by a client local 'attached_info' call that allows for getting typed access to the information. The layout of the information is moved to its own and GPU-specific header file, e.g., 'gpu/info_intel.h' Issue #4265.
73 lines
1.7 KiB
C++
73 lines
1.7 KiB
C++
/*
|
|
* \brief Connection to Gpu service
|
|
* \author Josef Soentgen
|
|
* \date 2017-04-28
|
|
*/
|
|
|
|
/*
|
|
* Copyright (C) 2017-2021 Genode Labs GmbH
|
|
*
|
|
* This file is part of the Genode OS framework, which is distributed
|
|
* under the terms of the GNU Affero General Public License version 3.
|
|
*/
|
|
|
|
#ifndef _INCLUDE__GPU_SESSION__CONNECTION_H_
|
|
#define _INCLUDE__GPU_SESSION__CONNECTION_H_
|
|
|
|
#include <gpu_session/client.h>
|
|
#include <base/connection.h>
|
|
#include <base/allocator.h>
|
|
#include <base/attached_dataspace.h>
|
|
|
|
namespace Gpu { struct Connection; }
|
|
|
|
struct Gpu::Connection : Genode::Connection<Session>, Session_client
|
|
{
|
|
/**
|
|
* Attached GPU information dataspace
|
|
*
|
|
* \noapi
|
|
*/
|
|
Genode::Attached_dataspace _info_dataspace;
|
|
|
|
/**
|
|
* Issue session request
|
|
*
|
|
* \noapi
|
|
*/
|
|
Genode::Capability<Gpu::Session> _session(Genode::Parent &parent,
|
|
char const *label, Genode::size_t quota)
|
|
{
|
|
return session(parent, "ram_quota=%ld, cap_quota=%ld, label=\"%s\"",
|
|
quota, CAP_QUOTA, label);
|
|
}
|
|
|
|
/**
|
|
* Constructor
|
|
*
|
|
* \param quota initial amount of quota used for allocating Gpu
|
|
* memory
|
|
*/
|
|
Connection(Genode::Env &env,
|
|
Genode::size_t quota = Session::REQUIRED_QUOTA,
|
|
const char *label = "")
|
|
:
|
|
Genode::Connection<Session>(env, _session(env.parent(), label, quota)),
|
|
Session_client(cap()),
|
|
_info_dataspace(env.rm(), info_dataspace())
|
|
{ }
|
|
|
|
/**
|
|
* Get typed pointer to the information dataspace
|
|
*
|
|
* \return typed pointer
|
|
*/
|
|
template <typename T>
|
|
T const *attached_info() const
|
|
{
|
|
return _info_dataspace.local_addr<T>();
|
|
}
|
|
};
|
|
|
|
#endif /* _INCLUDE__GPU_SESSION__CONNECTION_H_ */
|