mirror of
https://github.com/RGBCube/serenity
synced 2025-07-27 03:17:35 +00:00
LibGL+LibGPU+LibSoftGPU: Load SoftGPU driver dynamically
This loads libsoftgpu.so during GLContext creation and instantiates the device class which is then passed into the GLContext constructor.
This commit is contained in:
parent
211d24a218
commit
5bb76e9b63
11 changed files with 165 additions and 9 deletions
42
Userland/Libraries/LibGPU/Driver.h
Normal file
42
Userland/Libraries/LibGPU/Driver.h
Normal file
|
@ -0,0 +1,42 @@
|
|||
/*
|
||||
* Copyright (c) 2022, Stephan Unverwerth <s.unverwerth@serenityos.org>
|
||||
*
|
||||
* SPDX-License-Identifier: BSD-2-Clause
|
||||
*/
|
||||
|
||||
#pragma once
|
||||
|
||||
#include <AK/Error.h>
|
||||
#include <AK/NonnullOwnPtr.h>
|
||||
#include <AK/NonnullRefPtr.h>
|
||||
#include <AK/RefCounted.h>
|
||||
#include <AK/StringView.h>
|
||||
#include <AK/Weakable.h>
|
||||
#include <LibGPU/Device.h>
|
||||
#include <LibGfx/Size.h>
|
||||
|
||||
namespace GPU {
|
||||
|
||||
class Driver final
|
||||
: public RefCounted<Driver>
|
||||
, public Weakable<Driver> {
|
||||
public:
|
||||
static ErrorOr<NonnullRefPtr<Driver>> try_create(StringView driver_name);
|
||||
~Driver();
|
||||
|
||||
ErrorOr<NonnullOwnPtr<Device>> try_create_device(Gfx::IntSize size);
|
||||
|
||||
private:
|
||||
Driver(void* dlopen_result, serenity_gpu_create_device_t device_creation_function)
|
||||
: m_dlopen_result { dlopen_result }
|
||||
, m_serenity_gpu_create_device { device_creation_function }
|
||||
{
|
||||
VERIFY(dlopen_result);
|
||||
VERIFY(device_creation_function);
|
||||
}
|
||||
|
||||
void* const m_dlopen_result { nullptr };
|
||||
serenity_gpu_create_device_t m_serenity_gpu_create_device { nullptr };
|
||||
};
|
||||
|
||||
}
|
Loading…
Add table
Add a link
Reference in a new issue