mesa/etnaviv: use VFS Gpu plugin to acquire Env

Issue #4559.
This commit is contained in:
Josef Söntgen
2022-07-15 11:49:03 +02:00
committed by Christian Helmuth
parent 02f3b965b9
commit 1f819a26e5
3 changed files with 18 additions and 10 deletions

View File

@ -1,5 +1,7 @@
include $(REP_DIR)/lib/mk/libdrm.inc
LIBS += vfs_gpu
include $(call select_from_repositories,lib/import/import-libdrm.mk)
SRC_CC := ioctl_etnaviv.cc

View File

@ -21,6 +21,8 @@
#include <gpu/info_etnaviv.h>
#include <util/string.h>
#include <vfs_gpu.h>
extern "C" {
#include <errno.h>
#include <fcntl.h>
@ -320,14 +322,14 @@ class Gpu::Call
Call(Call const &) = delete;
Call &operator=(Call const &) = delete;
Genode::Env &_env;
Genode::Env &_env { *vfs_gpu_env() };
Genode::Heap _heap { _env.ram(), _env.rm() };
/*****************
** Gpu session **
*****************/
Gpu::Connection _gpu_session;
Gpu::Connection _gpu_session { _env };
Gpu::Info_etnaviv const &_gpu_info {
*_gpu_session.attached_info<Gpu::Info_etnaviv>() };
@ -629,10 +631,7 @@ class Gpu::Call
public:
Call(Env &env)
:
_env { env },
_gpu_session { _env }
Call()
{
try {
_exec_buffer.construct(_gpu_session,
@ -677,9 +676,16 @@ class Gpu::Call
static Genode::Constructible<Gpu::Call> _drm;
void drm_init(Genode::Env &env)
void drm_init()
{
_drm.construct(env);
struct ::stat buf;
if (stat("/dev/gpu", &buf) < 0) {
Genode::error("'/dev/gpu' not accessible: ",
"try configure '<gpu>' in 'dev' directory of VFS'");
return;
}
_drm.construct();
}

View File

@ -19,9 +19,9 @@ extern "C" {
#include <platform.h>
}
extern void drm_init(Genode::Env &env);
extern void drm_init();
void genode_drm_init()
{
drm_init(*genode_env);
drm_init();
}