1
Fork 0
mirror of https://github.com/RGBCube/serenity synced 2025-07-25 23:07:35 +00:00

LibGPU: Remove DeprecatedString usage

This commit is contained in:
Jelle Raaijmakers 2023-01-30 16:09:51 +01:00 committed by Tim Flynn
parent e3f8ac2c05
commit a8cb70c0c4

View file

@ -1,10 +1,10 @@
/*
* Copyright (c) 2022, Stephan Unverwerth <s.unverwerth@serenityos.org>
* Copyright (c) 2023, Jelle Raaijmakers <jelle@gmta.nl>
*
* SPDX-License-Identifier: BSD-2-Clause
*/
#include <AK/DeprecatedString.h>
#include <AK/HashMap.h>
#include <AK/WeakPtr.h>
#include <LibGPU/Driver.h>
@ -14,15 +14,15 @@ namespace GPU {
// 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<StringView, char const*> const s_driver_path_map
{
#if defined(AK_OS_SERENITY)
{ "softgpu", "libsoftgpu.so.serenity" },
{ "virtgpu", "libvirtgpu.so.serenity" },
{ "softgpu"sv, "libsoftgpu.so.serenity" },
{ "virtgpu"sv, "libvirtgpu.so.serenity" },
#elif defined(AK_OS_MACOS)
{ "softgpu", "liblagom-softgpu.dylib" },
{ "softgpu"sv, "liblagom-softgpu.dylib" },
#else
{ "softgpu", "liblagom-softgpu.so.0" },
{ "softgpu"sv, "liblagom-softgpu.so.0" },
#endif
};
// clang-format on
@ -41,7 +41,7 @@ ErrorOr<NonnullRefPtr<Driver>> Driver::try_create(StringView driver_name)
if (it == s_driver_path_map.end())
return Error::from_string_literal("The requested GPU driver was not found in the list of allowed driver libraries");
auto lib = dlopen(it->value.characters(), RTLD_NOW);
auto lib = dlopen(it->value, RTLD_NOW);
if (!lib)
return Error::from_string_literal("The library for the requested GPU driver could not be opened");