mirror of
https://github.com/RGBCube/serenity
synced 2025-07-26 21:27:34 +00:00
LibVirtGPU: Create and initialize device from file descriptor
This commit is contained in:
parent
4b792cb7be
commit
086c7c4c88
2 changed files with 16 additions and 1 deletions
|
@ -11,9 +11,16 @@
|
||||||
|
|
||||||
namespace VirtGPU {
|
namespace VirtGPU {
|
||||||
|
|
||||||
|
Device::Device(NonnullRefPtr<Core::File> gpu_file)
|
||||||
|
: m_gpu_file { gpu_file }
|
||||||
|
{
|
||||||
|
}
|
||||||
|
|
||||||
ErrorOr<NonnullOwnPtr<Device>> Device::create(Gfx::IntSize)
|
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
|
GPU::DeviceInfo Device::info() const
|
||||||
|
|
|
@ -6,12 +6,17 @@
|
||||||
|
|
||||||
#pragma once
|
#pragma once
|
||||||
|
|
||||||
|
#include <AK/NonnullOwnPtr.h>
|
||||||
|
#include <AK/NonnullRefPtr.h>
|
||||||
|
#include <LibCore/File.h>
|
||||||
#include <LibGPU/Device.h>
|
#include <LibGPU/Device.h>
|
||||||
|
|
||||||
namespace VirtGPU {
|
namespace VirtGPU {
|
||||||
|
|
||||||
class Device final : public GPU::Device {
|
class Device final : public GPU::Device {
|
||||||
public:
|
public:
|
||||||
|
Device(NonnullRefPtr<Core::File>);
|
||||||
|
|
||||||
static ErrorOr<NonnullOwnPtr<Device>> create(Gfx::IntSize min_size);
|
static ErrorOr<NonnullOwnPtr<Device>> create(Gfx::IntSize min_size);
|
||||||
|
|
||||||
virtual GPU::DeviceInfo info() const override;
|
virtual GPU::DeviceInfo info() const override;
|
||||||
|
@ -48,6 +53,9 @@ public:
|
||||||
virtual void set_raster_position(FloatVector4 const& position, FloatMatrix4x4 const& model_view_transform, FloatMatrix4x4 const& projection_transform) override;
|
virtual void set_raster_position(FloatVector4 const& position, FloatMatrix4x4 const& model_view_transform, FloatMatrix4x4 const& projection_transform) override;
|
||||||
|
|
||||||
virtual void bind_fragment_shader(RefPtr<GPU::Shader>) override;
|
virtual void bind_fragment_shader(RefPtr<GPU::Shader>) override;
|
||||||
|
|
||||||
|
private:
|
||||||
|
NonnullRefPtr<Core::File> m_gpu_file;
|
||||||
};
|
};
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue