mirror of
https://github.com/RGBCube/serenity
synced 2025-07-27 01:17:35 +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:
parent
c52abe0bea
commit
bd7931ff23
3 changed files with 20 additions and 0 deletions
|
@ -13,16 +13,19 @@
|
||||||
namespace GPU {
|
namespace GPU {
|
||||||
|
|
||||||
// FIXME: Think of a better way to configure these paths. Maybe use ConfigServer?
|
// FIXME: Think of a better way to configure these paths. Maybe use ConfigServer?
|
||||||
|
// clang-format off
|
||||||
static HashMap<DeprecatedString, DeprecatedString> const s_driver_path_map
|
static HashMap<DeprecatedString, DeprecatedString> const s_driver_path_map
|
||||||
{
|
{
|
||||||
#if defined(AK_OS_SERENITY)
|
#if defined(AK_OS_SERENITY)
|
||||||
{ "softgpu", "libsoftgpu.so.serenity" },
|
{ "softgpu", "libsoftgpu.so.serenity" },
|
||||||
|
{ "virtgpu", "libvirtgpu.so.serenity" },
|
||||||
#elif defined(AK_OS_MACOS)
|
#elif defined(AK_OS_MACOS)
|
||||||
{ "softgpu", "liblagom-softgpu.dylib" },
|
{ "softgpu", "liblagom-softgpu.dylib" },
|
||||||
#else
|
#else
|
||||||
{ "softgpu", "liblagom-softgpu.so.0" },
|
{ "softgpu", "liblagom-softgpu.so.0" },
|
||||||
#endif
|
#endif
|
||||||
};
|
};
|
||||||
|
// clang-format on
|
||||||
|
|
||||||
static HashMap<DeprecatedString, WeakPtr<Driver>> s_loaded_drivers;
|
static HashMap<DeprecatedString, WeakPtr<Driver>> s_loaded_drivers;
|
||||||
|
|
||||||
|
|
|
@ -4,12 +4,18 @@
|
||||||
* SPDX-License-Identifier: BSD-2-Clause
|
* SPDX-License-Identifier: BSD-2-Clause
|
||||||
*/
|
*/
|
||||||
|
|
||||||
|
#include <AK/NonnullOwnPtr.h>
|
||||||
#include <LibVirtGPU/Device.h>
|
#include <LibVirtGPU/Device.h>
|
||||||
#include <LibVirtGPU/Image.h>
|
#include <LibVirtGPU/Image.h>
|
||||||
#include <LibVirtGPU/Shader.h>
|
#include <LibVirtGPU/Shader.h>
|
||||||
|
|
||||||
namespace VirtGPU {
|
namespace VirtGPU {
|
||||||
|
|
||||||
|
ErrorOr<NonnullOwnPtr<Device>> Device::create(Gfx::IntSize)
|
||||||
|
{
|
||||||
|
return make<Device>();
|
||||||
|
}
|
||||||
|
|
||||||
GPU::DeviceInfo Device::info() const
|
GPU::DeviceInfo Device::info() const
|
||||||
{
|
{
|
||||||
return {
|
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();
|
||||||
|
}
|
||||||
|
|
|
@ -12,6 +12,8 @@ namespace VirtGPU {
|
||||||
|
|
||||||
class Device final : public GPU::Device {
|
class Device final : public GPU::Device {
|
||||||
public:
|
public:
|
||||||
|
static ErrorOr<NonnullOwnPtr<Device>> create(Gfx::IntSize min_size);
|
||||||
|
|
||||||
virtual GPU::DeviceInfo info() const override;
|
virtual GPU::DeviceInfo info() const override;
|
||||||
|
|
||||||
virtual void draw_primitives(GPU::PrimitiveType, FloatMatrix4x4 const& model_view_transform, FloatMatrix4x4 const& projection_transform, Vector<GPU::Vertex>& vertices) override;
|
virtual void draw_primitives(GPU::PrimitiveType, FloatMatrix4x4 const& model_view_transform, FloatMatrix4x4 const& projection_transform, Vector<GPU::Vertex>& vertices) override;
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue