1
Fork 0
mirror of https://github.com/RGBCube/serenity synced 2025-07-27 05:57:45 +00:00

LibGPU+LibVirtGPU: Allow loading the driver and instantiating the device

This adds LibVirtGPU to the list of allowed drivers in LibGPU and adds a
factory method to create the device to libVirtGPU.
This commit is contained in:
Stephan Unverwerth 2022-12-19 15:30:23 +01:00 committed by Andreas Kling
parent c52abe0bea
commit bd7931ff23
3 changed files with 20 additions and 0 deletions

View file

@ -4,12 +4,18 @@
* SPDX-License-Identifier: BSD-2-Clause
*/
#include <AK/NonnullOwnPtr.h>
#include <LibVirtGPU/Device.h>
#include <LibVirtGPU/Image.h>
#include <LibVirtGPU/Shader.h>
namespace VirtGPU {
ErrorOr<NonnullOwnPtr<Device>> Device::create(Gfx::IntSize)
{
return make<Device>();
}
GPU::DeviceInfo Device::info() const
{
return {
@ -173,3 +179,12 @@ void Device::bind_fragment_shader(RefPtr<GPU::Shader>)
}
}
extern "C" GPU::Device* serenity_gpu_create_device(Gfx::IntSize size)
{
auto device_or_error = VirtGPU::Device::create(size);
if (device_or_error.is_error())
return nullptr;
return device_or_error.release_value().leak_ptr();
}