diff options
author | Stephan Unverwerth <s.unverwerth@serenityos.org> | 2022-12-22 15:08:40 +0100 |
---|---|---|
committer | Andreas Kling <kling@serenityos.org> | 2022-12-26 09:39:20 +0100 |
commit | 086c7c4c8879ce811a922cc6052ff4b5d39f8570 (patch) | |
tree | b01b0e60ded79664e97ccc631890ba748b80585a /Userland/Libraries/LibVirtGPU/Device.cpp | |
parent | 4b792cb7be89bd946f52709a6db26f1783ba6dae (diff) | |
download | serenity-086c7c4c8879ce811a922cc6052ff4b5d39f8570.zip |
LibVirtGPU: Create and initialize device from file descriptor
Diffstat (limited to 'Userland/Libraries/LibVirtGPU/Device.cpp')
-rw-r--r-- | Userland/Libraries/LibVirtGPU/Device.cpp | 9 |
1 files changed, 8 insertions, 1 deletions
diff --git a/Userland/Libraries/LibVirtGPU/Device.cpp b/Userland/Libraries/LibVirtGPU/Device.cpp index 68c25adda4..7709f1390d 100644 --- a/Userland/Libraries/LibVirtGPU/Device.cpp +++ b/Userland/Libraries/LibVirtGPU/Device.cpp @@ -11,9 +11,16 @@ namespace VirtGPU { +Device::Device(NonnullRefPtr<Core::File> gpu_file) + : m_gpu_file { gpu_file } +{ +} + ErrorOr<NonnullOwnPtr<Device>> Device::create(Gfx::IntSize) { - return make<Device>(); + auto file = TRY(Core::File::open("/dev/gpu/render0", Core::OpenMode::ReadWrite)); + auto device = make<Device>(file); + return device; } GPU::DeviceInfo Device::info() const |