2017-04-26 09:10:52 +00:00
|
|
|
/*
|
|
|
|
* \brief Connection to Gpu service
|
|
|
|
* \author Josef Soentgen
|
|
|
|
* \date 2017-04-28
|
|
|
|
*/
|
|
|
|
|
|
|
|
/*
|
2021-09-23 14:36:48 +00:00
|
|
|
* Copyright (C) 2017-2021 Genode Labs GmbH
|
2017-04-26 09:10:52 +00:00
|
|
|
*
|
|
|
|
* 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>
|
2021-09-23 14:36:48 +00:00
|
|
|
#include <base/attached_dataspace.h>
|
2017-04-26 09:10:52 +00:00
|
|
|
|
|
|
|
namespace Gpu { struct Connection; }
|
|
|
|
|
2023-03-03 11:07:28 +00:00
|
|
|
|
2017-04-26 09:10:52 +00:00
|
|
|
struct Gpu::Connection : Genode::Connection<Session>, Session_client
|
|
|
|
{
|
2021-09-23 14:36:48 +00:00
|
|
|
/**
|
|
|
|
* Attached GPU information dataspace
|
|
|
|
*
|
|
|
|
* \noapi
|
|
|
|
*/
|
|
|
|
Genode::Attached_dataspace _info_dataspace;
|
|
|
|
|
2017-04-26 09:10:52 +00:00
|
|
|
/**
|
|
|
|
* Constructor
|
|
|
|
*
|
2023-03-03 11:07:28 +00:00
|
|
|
* \param quota initial amount of quota used for allocating GPU memory
|
2017-04-26 09:10:52 +00:00
|
|
|
*/
|
2023-03-03 11:07:28 +00:00
|
|
|
Connection(Genode::Env &env,
|
|
|
|
Genode::size_t quota = Session::REQUIRED_QUOTA,
|
|
|
|
Label const &label = Label())
|
2017-04-26 09:10:52 +00:00
|
|
|
:
|
2023-03-03 11:07:28 +00:00
|
|
|
Genode::Connection<Session>(env, label, Ram_quota { quota }, Args()),
|
2021-09-23 14:36:48 +00:00
|
|
|
Session_client(cap()),
|
|
|
|
_info_dataspace(env.rm(), info_dataspace())
|
2017-04-26 09:10:52 +00:00
|
|
|
{ }
|
2021-09-23 14:36:48 +00:00
|
|
|
|
|
|
|
/**
|
|
|
|
* Get typed pointer to the information dataspace
|
|
|
|
*
|
|
|
|
* \return typed pointer
|
|
|
|
*/
|
|
|
|
template <typename T>
|
|
|
|
T const *attached_info() const
|
|
|
|
{
|
|
|
|
return _info_dataspace.local_addr<T>();
|
|
|
|
}
|
2017-04-26 09:10:52 +00:00
|
|
|
};
|
|
|
|
|
|
|
|
#endif /* _INCLUDE__GPU_SESSION__CONNECTION_H_ */
|