LibVirtGPU: Port to Core::Stream

This commit is contained in:
Lucas CHOLLET 2023-01-15 19:35:01 -05:00 committed by Sam Atkins
parent 2e52de5744
commit 0ab29cffd2
2 changed files with 7 additions and 7 deletions

View file

@ -38,15 +38,15 @@ static constexpr auto vert_shader = "VERT\n"
" 4: MOV_SAT OUT[1], IN[1]\n"
" 5: END\n"sv;
Device::Device(NonnullRefPtr<Core::File> gpu_file)
: m_gpu_file { gpu_file }
Device::Device(NonnullOwnPtr<Core::Stream::File> gpu_file)
: m_gpu_file { move(gpu_file) }
{
}
ErrorOr<NonnullOwnPtr<Device>> Device::create(Gfx::IntSize min_size)
{
auto file = TRY(Core::File::open("/dev/gpu/render0", Core::OpenMode::ReadWrite));
auto device = make<Device>(file);
auto file = TRY(Core::Stream::File::open("/dev/gpu/render0"sv, Core::Stream::OpenMode::ReadWrite));
auto device = make<Device>(move(file));
TRY(device->initialize_context(min_size));
return device;
}

View file

@ -10,7 +10,7 @@
#include <AK/NonnullRefPtr.h>
#include <AK/Vector.h>
#include <Kernel/API/VirGL.h>
#include <LibCore/File.h>
#include <LibCore/Stream.h>
#include <LibGPU/Device.h>
#include <LibVirtGPU/VirGLProtocol.h>
@ -18,7 +18,7 @@ namespace VirtGPU {
class Device final : public GPU::Device {
public:
Device(NonnullRefPtr<Core::File>);
Device(NonnullOwnPtr<Core::Stream::File>);
static ErrorOr<NonnullOwnPtr<Device>> create(Gfx::IntSize min_size);
@ -66,7 +66,7 @@ private:
ErrorOr<Protocol::ResourceID> create_virgl_resource(VirGL3DResourceSpec&);
ErrorOr<void> upload_command_buffer(Vector<u32> const&);
NonnullRefPtr<Core::File> m_gpu_file;
NonnullOwnPtr<Core::Stream::File> m_gpu_file;
Protocol::ResourceID m_vbo_resource_id { 0 };
Protocol::ResourceID m_drawtarget { 0 };