diff --git a/repos/libports/lib/mk/spec/x86_64/libdrm.mk b/repos/libports/lib/mk/spec/x86_64/libdrm.mk index 818348a86a..9f828d0eed 100644 --- a/repos/libports/lib/mk/spec/x86_64/libdrm.mk +++ b/repos/libports/lib/mk/spec/x86_64/libdrm.mk @@ -2,6 +2,8 @@ include $(REP_DIR)/lib/mk/libdrm.inc include $(call select_from_repositories,lib/import/import-libdrm.mk) +LIBS += vfs_gpu + SRC_CC := ioctl_iris.cc CC_CXX_WARN_STRICT = diff --git a/repos/libports/recipes/src/libdrm/used_apis b/repos/libports/recipes/src/libdrm/used_apis index 139debad25..d33079a30a 100644 --- a/repos/libports/recipes/src/libdrm/used_apis +++ b/repos/libports/recipes/src/libdrm/used_apis @@ -1,3 +1,4 @@ base gpu_session libc +vfs_gpu diff --git a/repos/libports/src/lib/libdrm/ioctl_iris.cc b/repos/libports/src/lib/libdrm/ioctl_iris.cc index 93a58888f5..eb966e0ffc 100644 --- a/repos/libports/src/lib/libdrm/ioctl_iris.cc +++ b/repos/libports/src/lib/libdrm/ioctl_iris.cc @@ -18,13 +18,14 @@ #include #include #include -#include #include #include #include #include +#include + extern "C" { #include #include @@ -522,8 +523,8 @@ class Drm_call using Cap_quota = Genode::Cap_quota; using Ram_quota = Genode::Ram_quota; - Genode::Env &_env; - Genode::Heap &_heap; + Genode::Env &_env { *vfs_gpu_env() }; + Genode::Heap _heap { _env.ram(), _env.rm() }; Gpu::Connection _gpu_session { _env }; Gpu::Info_intel const &_gpu_info { @@ -538,8 +539,6 @@ class Drm_call using Context_space = Genode::Id_space; Context_space _context_space { }; - Gpu::Connection * (*_vfs_gpu_connection)(unsigned long); - struct Resource_guard { struct Upgrade_failed : Genode::Exception { }; @@ -1099,7 +1098,7 @@ class Drm_call } /* use inode to retrieve GPU connection */ - Gpu::Connection *gpu = _vfs_gpu_connection(buf.st_ino); + Gpu::Connection *gpu = vfs_gpu_connection(buf.st_ino); if (!gpu) { Genode::error("Could not find GPU session for id: ", buf.st_ino); Libc::close(fd); @@ -1507,31 +1506,12 @@ class Drm_call public: - Drm_call(Genode::Env &env, Genode::Heap &heap) - : _env(env), _heap(heap) + Drm_call() { /* make handle id 0 unavailable, handled as invalid by iris */ drm_syncobj_create reserve_id_0 { }; if (_generic_syncobj_create(&reserve_id_0)) Genode::warning("syncobject 0 not reserved"); - - /** - * XXX: lookup 'vfs_gpu_connection' function in order to retrieve GPU - * connection from VFS plugin - */ - using Shared_object = Genode::Shared_object; - try { - Shared_object object { env, heap, "vfs_gpu.lib.so", - Shared_object::BIND_LAZY, - Shared_object::DONT_KEEP }; - - void *vfs_gpu_connection = object.lookup("_Z18vfs_gpu_connectionm"); - Genode::log("libdrm (iris): 'vfs_gpu_connection' found at: ", vfs_gpu_connection); - _vfs_gpu_connection = (Gpu::Connection * (*)(unsigned long))vfs_gpu_connection; - } catch (Shared_object::Invalid_rom_module) { - Genode::error("'vfs_gpu.lib.so' plugin not found"); - throw; - } } int lseek(int fd, off_t offset, int whence) @@ -1643,12 +1623,9 @@ class Drm_call static Genode::Constructible _call; -void drm_init(Genode::Env &env) +void drm_init() { - using namespace Genode; - - static Heap heap { env.ram(), env.rm() }; - _call.construct(env, heap); + _call.construct(); } diff --git a/repos/libports/src/lib/mesa/iris/drm_init.cc b/repos/libports/src/lib/mesa/iris/drm_init.cc index 01a640851c..29faa10ad9 100644 --- a/repos/libports/src/lib/mesa/iris/drm_init.cc +++ b/repos/libports/src/lib/mesa/iris/drm_init.cc @@ -18,9 +18,9 @@ extern "C" { #include } -extern void drm_init(Genode::Env &env); +extern void drm_init(); void genode_drm_init() { - drm_init(*genode_env); + drm_init(); }