mirror of
https://github.com/LizardByte/Sunshine.git
synced 2026-10-23 03:28:06 +09:00
refactor: resolve Sonar cpp:S5416 findings (#5906)
This commit is contained in:
1 parent
5c2fd0321a
commit
73a8a58be7
18 files changed
+176
-72
No files matched your search
+1
-1
@@ -109,7 +109,7 @@ namespace input {
|
||||
/**
|
||||
* @brief Packed identifier for a pressed key and its modifier flags.
|
||||
*/
|
||||
typedef uint32_t key_press_id_t;
|
||||
using key_press_id_t = uint32_t;
|
||||
|
||||
/**
|
||||
* @brief Create a key-press identifier from the virtual-key code and flags.
|
||||
|
||||
+1
-1
@@ -21,7 +21,7 @@ namespace move_by_copy_util {
|
||||
/**
|
||||
* @brief Wrapped type moved through copy-shaped APIs.
|
||||
*/
|
||||
typedef T move_type;
|
||||
using move_type = T;
|
||||
|
||||
private:
|
||||
move_type _to_move;
|
||||
|
||||
@@ -63,7 +63,7 @@ namespace boost {
|
||||
/**
|
||||
* @brief Map of environment variable names to values.
|
||||
*/
|
||||
typedef basic_environment<char> environment;
|
||||
using environment = basic_environment<char>;
|
||||
} // namespace process::v1
|
||||
} // namespace boost
|
||||
#endif
|
||||
@@ -398,7 +398,7 @@ namespace platf {
|
||||
/**
|
||||
* @brief Bitset containing platform capability flags.
|
||||
*/
|
||||
typedef uint32_t caps_t;
|
||||
using caps_t = uint32_t;
|
||||
|
||||
/**
|
||||
* @brief Capability bit indicating native pen and touch support.
|
||||
@@ -1223,7 +1223,7 @@ namespace platf {
|
||||
/**
|
||||
* @brief Per-client input context allocated by a platform backend.
|
||||
*/
|
||||
typedef deinit_t client_input_t;
|
||||
using client_input_t = deinit_t;
|
||||
|
||||
/**
|
||||
* @brief Allocate a context to store per-client input data.
|
||||
|
||||
@@ -358,11 +358,11 @@ namespace gbm {
|
||||
/**
|
||||
* @brief Function pointer used to destroy a GBM device.
|
||||
*/
|
||||
typedef void (*device_destroy_fn)(device *gbm);
|
||||
using device_destroy_fn = void (*)(device *gbm);
|
||||
/**
|
||||
* @brief Function pointer used to create a GBM device from a file descriptor.
|
||||
*/
|
||||
typedef device *(*create_device_fn)(int fd);
|
||||
using create_device_fn = device *(*)(int fd);
|
||||
|
||||
extern device_destroy_fn device_destroy;
|
||||
extern create_device_fn create_device;
|
||||
|
||||
@@ -43,7 +43,7 @@ namespace dyn {
|
||||
/**
|
||||
* @brief Generic GLX procedure pointer returned by the loader.
|
||||
*/
|
||||
typedef void (*apiproc)(void);
|
||||
using apiproc = void (*)(void);
|
||||
|
||||
int load(void *handle, const std::vector<std::tuple<apiproc *, const char *>> &funcs, bool strict = true);
|
||||
void *handle(const std::vector<const char *> &libs);
|
||||
|
||||
@@ -169,43 +169,43 @@ namespace avahi {
|
||||
/**
|
||||
* @brief Avahi client state-change callback signature.
|
||||
*/
|
||||
typedef void (*ClientCallback)(Client *, ClientState, void *userdata);
|
||||
using ClientCallback = void (*)(Client *, ClientState, void *userdata);
|
||||
/**
|
||||
* @brief Avahi entry-group state-change callback signature.
|
||||
*/
|
||||
typedef void (*EntryGroupCallback)(EntryGroup *g, EntryGroupState state, void *userdata);
|
||||
using EntryGroupCallback = void (*)(EntryGroup *g, EntryGroupState state, void *userdata);
|
||||
|
||||
/**
|
||||
* @brief Function pointer used to free Avahi-allocated memory.
|
||||
*/
|
||||
typedef void (*free_fn)(void *);
|
||||
using free_fn = void (*)(void *);
|
||||
|
||||
/**
|
||||
* @brief Function pointer used to create an Avahi client.
|
||||
*/
|
||||
typedef Client *(*client_new_fn)(const Poll *poll_api, ClientFlags flags, ClientCallback callback, void *userdata, int *error);
|
||||
using client_new_fn = Client *(*)(const Poll *poll_api, ClientFlags flags, ClientCallback callback, void *userdata, int *error);
|
||||
/**
|
||||
* @brief Function pointer used to destroy an Avahi client.
|
||||
*/
|
||||
typedef void (*client_free_fn)(Client *);
|
||||
using client_free_fn = void (*)(Client *);
|
||||
/**
|
||||
* @brief Function pointer used to request an alternative Avahi service name.
|
||||
*/
|
||||
typedef char *(*alternative_service_name_fn)(char *);
|
||||
using alternative_service_name_fn = char *(*)(char *);
|
||||
|
||||
/**
|
||||
* @brief Function pointer used to get an Avahi client from an entry group.
|
||||
*/
|
||||
typedef Client *(*entry_group_get_client_fn)(EntryGroup *);
|
||||
using entry_group_get_client_fn = Client *(*)(EntryGroup *);
|
||||
|
||||
/**
|
||||
* @brief Function pointer used to create an Avahi entry group.
|
||||
*/
|
||||
typedef EntryGroup *(*entry_group_new_fn)(Client *, EntryGroupCallback, void *userdata);
|
||||
using entry_group_new_fn = EntryGroup *(*)(Client *, EntryGroupCallback, void *userdata);
|
||||
/**
|
||||
* @brief Function pointer used to add a service to an Avahi entry group.
|
||||
*/
|
||||
typedef int (*entry_group_add_service_fn)(
|
||||
using entry_group_add_service_fn = int (*)(
|
||||
EntryGroup *group,
|
||||
IfIndex interface,
|
||||
Protocol protocol,
|
||||
@@ -221,49 +221,49 @@ namespace avahi {
|
||||
/**
|
||||
* @brief Function pointer used to test whether an Avahi entry group is empty.
|
||||
*/
|
||||
typedef int (*entry_group_is_empty_fn)(EntryGroup *);
|
||||
using entry_group_is_empty_fn = int (*)(EntryGroup *);
|
||||
/**
|
||||
* @brief Function pointer used to reset an Avahi entry group.
|
||||
*/
|
||||
typedef int (*entry_group_reset_fn)(EntryGroup *);
|
||||
using entry_group_reset_fn = int (*)(EntryGroup *);
|
||||
/**
|
||||
* @brief Function pointer used to publish an Avahi entry group.
|
||||
*/
|
||||
typedef int (*entry_group_commit_fn)(EntryGroup *);
|
||||
using entry_group_commit_fn = int (*)(EntryGroup *);
|
||||
|
||||
/**
|
||||
* @brief Function pointer used to duplicate Avahi strings.
|
||||
*/
|
||||
typedef char *(*strdup_fn)(const char *);
|
||||
using strdup_fn = char *(*)(const char *);
|
||||
/**
|
||||
* @brief Function pointer used to format Avahi error codes.
|
||||
*/
|
||||
typedef char *(*strerror_fn)(int);
|
||||
using strerror_fn = char *(*)(int);
|
||||
/**
|
||||
* @brief Function pointer used to read the last Avahi client error.
|
||||
*/
|
||||
typedef int (*client_errno_fn)(Client *);
|
||||
using client_errno_fn = int (*)(Client *);
|
||||
|
||||
/**
|
||||
* @brief Function pointer used to get the Avahi simple-poll API.
|
||||
*/
|
||||
typedef Poll *(*simple_poll_get_fn)(SimplePoll *);
|
||||
using simple_poll_get_fn = Poll *(*)(SimplePoll *);
|
||||
/**
|
||||
* @brief Function pointer used to run the Avahi simple-poll loop.
|
||||
*/
|
||||
typedef int (*simple_poll_loop_fn)(SimplePoll *);
|
||||
using simple_poll_loop_fn = int (*)(SimplePoll *);
|
||||
/**
|
||||
* @brief Function pointer used to stop the Avahi simple-poll loop.
|
||||
*/
|
||||
typedef void (*simple_poll_quit_fn)(SimplePoll *);
|
||||
using simple_poll_quit_fn = void (*)(SimplePoll *);
|
||||
/**
|
||||
* @brief Function pointer used to allocate an Avahi simple-poll instance.
|
||||
*/
|
||||
typedef SimplePoll *(*simple_poll_new_fn)();
|
||||
using simple_poll_new_fn = SimplePoll *(*)();
|
||||
/**
|
||||
* @brief Function pointer used to free an Avahi simple-poll instance.
|
||||
*/
|
||||
typedef void (*simple_poll_free_fn)(SimplePoll *);
|
||||
using simple_poll_free_fn = void (*)(SimplePoll *);
|
||||
|
||||
free_fn free; ///< Free.
|
||||
client_new_fn client_new; ///< Client new.
|
||||
|
||||
@@ -628,26 +628,25 @@ namespace va {
|
||||
};
|
||||
|
||||
/**
|
||||
* This is a private structure of FFmpeg, I need this to manually create
|
||||
* a VAAPI hardware context
|
||||
* @brief FFmpeg-private device data used to create a VA-API hardware context.
|
||||
*
|
||||
* xdisplay will not be used internally by FFmpeg
|
||||
* The X11 display pointer is not used internally by FFmpeg.
|
||||
*/
|
||||
typedef struct VAAPIDevicePriv {
|
||||
struct VAAPIDevicePriv {
|
||||
union {
|
||||
void *xdisplay; ///< Native X11 display handle for display-backed contexts.
|
||||
int fd; ///< DRM file descriptor for device-backed contexts.
|
||||
} drm; ///< Native display or DRM fd passed to FFmpeg's VA-API context.
|
||||
|
||||
int drm_fd; ///< DRM fd.
|
||||
} VAAPIDevicePriv;
|
||||
};
|
||||
|
||||
/**
|
||||
* VAAPI connection details.
|
||||
* @brief VA-API connection details allocated as AVHWDeviceContext.hwctx.
|
||||
*
|
||||
* Allocated as AVHWDeviceContext.hwctx
|
||||
* The layout must match the corresponding FFmpeg hardware context.
|
||||
*/
|
||||
typedef struct AVVAAPIDeviceContext {
|
||||
struct AVVAAPIDeviceContext {
|
||||
/**
|
||||
* The VADisplay handle, to be filled by the user.
|
||||
*/
|
||||
@@ -660,7 +659,7 @@ namespace va {
|
||||
* operations using VAAPI with the same VADisplay.
|
||||
*/
|
||||
unsigned int driver_quirks;
|
||||
} AVVAAPIDeviceContext;
|
||||
};
|
||||
|
||||
static void __log(void *level, const char *msg) {
|
||||
BOOST_LOG(*(boost::log::sources::severity_logger<int> *) level) << msg;
|
||||
|
||||
@@ -20,7 +20,7 @@ namespace platf::publish {
|
||||
namespace {
|
||||
/** @brief Custom deleter intended to be used for `std::unique_ptr<DNSServiceRef>`. */
|
||||
struct ServiceRefDeleter {
|
||||
typedef DNSServiceRef pointer; ///< Type of object to be deleted.
|
||||
using pointer = DNSServiceRef; ///< DNS service handle released by the deleter.
|
||||
|
||||
void operator()(pointer serviceRef) {
|
||||
DNSServiceRefDeallocate(serviceRef);
|
||||
|
||||
@@ -359,32 +359,36 @@ namespace platf::dxgi {
|
||||
/**
|
||||
* @brief Enumerates supported d3 DKMT SCHEDULINGPRIORITYCLASS options.
|
||||
*/
|
||||
typedef enum _D3DKMT_SCHEDULINGPRIORITYCLASS {
|
||||
enum _D3DKMT_SCHEDULINGPRIORITYCLASS {
|
||||
D3DKMT_SCHEDULINGPRIORITYCLASS_IDLE, ///< Idle priority class
|
||||
D3DKMT_SCHEDULINGPRIORITYCLASS_BELOW_NORMAL, ///< Below normal priority class
|
||||
D3DKMT_SCHEDULINGPRIORITYCLASS_NORMAL, ///< Normal priority class
|
||||
D3DKMT_SCHEDULINGPRIORITYCLASS_ABOVE_NORMAL, ///< Above normal priority class
|
||||
D3DKMT_SCHEDULINGPRIORITYCLASS_HIGH, ///< High priority class
|
||||
D3DKMT_SCHEDULINGPRIORITYCLASS_REALTIME ///< Realtime priority class
|
||||
} D3DKMT_SCHEDULINGPRIORITYCLASS; ///< Alias for D3 DKMT SCHEDULINGPRIORITYCLASS.
|
||||
};
|
||||
|
||||
using D3DKMT_SCHEDULINGPRIORITYCLASS = _D3DKMT_SCHEDULINGPRIORITYCLASS; ///< Process scheduling priority class passed to D3DKMT.
|
||||
|
||||
/**
|
||||
* @brief Kernel-mode D3DKMT adapter handle.
|
||||
*/
|
||||
typedef UINT D3DKMT_HANDLE;
|
||||
using D3DKMT_HANDLE = UINT;
|
||||
|
||||
/**
|
||||
* @brief Win32 D3DKMT adapter-open request structure.
|
||||
*/
|
||||
typedef struct _D3DKMT_OPENADAPTERFROMLUID {
|
||||
struct _D3DKMT_OPENADAPTERFROMLUID {
|
||||
LUID AdapterLuid; ///< Adapter luid.
|
||||
D3DKMT_HANDLE hAdapter; ///< D3DKMT adapter handle used for low-level display queries.
|
||||
} D3DKMT_OPENADAPTERFROMLUID; ///< Alias for D3 DKMT OPENADAPTERFROMLUID.
|
||||
};
|
||||
|
||||
using D3DKMT_OPENADAPTERFROMLUID = _D3DKMT_OPENADAPTERFROMLUID; ///< Adapter-open request passed to D3DKMT.
|
||||
|
||||
/**
|
||||
* @brief Win32 D3DKMT WDDM 2.7 capability flags.
|
||||
*/
|
||||
typedef struct _D3DKMT_WDDM_2_7_CAPS {
|
||||
struct _D3DKMT_WDDM_2_7_CAPS {
|
||||
union {
|
||||
struct
|
||||
{
|
||||
@@ -397,43 +401,49 @@ namespace platf::dxgi {
|
||||
|
||||
UINT Value; ///< Packed representation of the WDDM 2.7 capability flags.
|
||||
};
|
||||
} D3DKMT_WDDM_2_7_CAPS; ///< Alias for D3 DKMT WDDM 2 7 CAPS.
|
||||
};
|
||||
|
||||
using D3DKMT_WDDM_2_7_CAPS = _D3DKMT_WDDM_2_7_CAPS; ///< WDDM 2.7 capability flags returned by D3DKMT.
|
||||
|
||||
/**
|
||||
* @brief Win32 D3DKMT adapter information query.
|
||||
*/
|
||||
typedef struct _D3DKMT_QUERYADAPTERINFO {
|
||||
struct _D3DKMT_QUERYADAPTERINFO {
|
||||
D3DKMT_HANDLE hAdapter; ///< D3DKMT adapter handle used for low-level display queries.
|
||||
UINT Type; ///< Type.
|
||||
VOID *pPrivateDriverData; ///< P private driver data.
|
||||
UINT PrivateDriverDataSize; ///< Private driver data size.
|
||||
} D3DKMT_QUERYADAPTERINFO; ///< Alias for D3 DKMT QUERYADAPTERINFO.
|
||||
};
|
||||
|
||||
using D3DKMT_QUERYADAPTERINFO = _D3DKMT_QUERYADAPTERINFO; ///< Adapter-information query passed to D3DKMT.
|
||||
|
||||
const UINT KMTQAITYPE_WDDM_2_7_CAPS = 70; ///< Protocol or platform constant for kmtqaitype wddm 2 7 caps.
|
||||
|
||||
/**
|
||||
* @brief Win32 D3DKMT adapter-close request structure.
|
||||
*/
|
||||
typedef struct _D3DKMT_CLOSEADAPTER {
|
||||
struct _D3DKMT_CLOSEADAPTER {
|
||||
D3DKMT_HANDLE hAdapter; ///< D3DKMT adapter handle used for low-level display queries.
|
||||
} D3DKMT_CLOSEADAPTER; ///< Alias for D3 DKMT CLOSEADAPTER.
|
||||
};
|
||||
|
||||
using D3DKMT_CLOSEADAPTER = _D3DKMT_CLOSEADAPTER; ///< Adapter-close request passed to D3DKMT.
|
||||
|
||||
/**
|
||||
* @brief Function pointer for setting D3DKMT process scheduling priority.
|
||||
*/
|
||||
typedef NTSTATUS(WINAPI *PD3DKMTSetProcessSchedulingPriorityClass)(HANDLE, D3DKMT_SCHEDULINGPRIORITYCLASS);
|
||||
using PD3DKMTSetProcessSchedulingPriorityClass = NTSTATUS(WINAPI *)(HANDLE, D3DKMT_SCHEDULINGPRIORITYCLASS);
|
||||
/**
|
||||
* @brief Function pointer for opening a D3DKMT adapter by LUID.
|
||||
*/
|
||||
typedef NTSTATUS(WINAPI *PD3DKMTOpenAdapterFromLuid)(D3DKMT_OPENADAPTERFROMLUID *);
|
||||
using PD3DKMTOpenAdapterFromLuid = NTSTATUS(WINAPI *)(D3DKMT_OPENADAPTERFROMLUID *);
|
||||
/**
|
||||
* @brief Function pointer for querying D3DKMT adapter information.
|
||||
*/
|
||||
typedef NTSTATUS(WINAPI *PD3DKMTQueryAdapterInfo)(D3DKMT_QUERYADAPTERINFO *);
|
||||
using PD3DKMTQueryAdapterInfo = NTSTATUS(WINAPI *)(D3DKMT_QUERYADAPTERINFO *);
|
||||
/**
|
||||
* @brief Function pointer for closing a D3DKMT adapter handle.
|
||||
*/
|
||||
typedef NTSTATUS(WINAPI *PD3DKMTCloseAdapter)(D3DKMT_CLOSEADAPTER *);
|
||||
using PD3DKMTCloseAdapter = NTSTATUS(WINAPI *)(D3DKMT_CLOSEADAPTER *);
|
||||
|
||||
/**
|
||||
* @brief Report whether the active display mode is HDR.
|
||||
|
||||
@@ -25,20 +25,22 @@
|
||||
/**
|
||||
* @brief Windows NT status code returned by native APIs.
|
||||
*/
|
||||
typedef long NTSTATUS;
|
||||
using NTSTATUS = long;
|
||||
|
||||
// Definition from the WDK's d3dkmthk.h
|
||||
/**
|
||||
* @brief Enumerates supported d3 DKMT GPU PREFERENCE QUERY STATE options.
|
||||
*/
|
||||
typedef enum _D3DKMT_GPU_PREFERENCE_QUERY_STATE : DWORD {
|
||||
enum _D3DKMT_GPU_PREFERENCE_QUERY_STATE : DWORD {
|
||||
D3DKMT_GPU_PREFERENCE_STATE_UNINITIALIZED, ///< The GPU preference isn't initialized.
|
||||
D3DKMT_GPU_PREFERENCE_STATE_HIGH_PERFORMANCE, ///< The highest performing GPU is preferred.
|
||||
D3DKMT_GPU_PREFERENCE_STATE_MINIMUM_POWER, ///< The minimum-powered GPU is preferred.
|
||||
D3DKMT_GPU_PREFERENCE_STATE_UNSPECIFIED, ///< A GPU preference isn't specified.
|
||||
D3DKMT_GPU_PREFERENCE_STATE_NOT_FOUND, ///< A GPU preference isn't found.
|
||||
D3DKMT_GPU_PREFERENCE_STATE_USER_SPECIFIED_GPU ///< A specific GPU is preferred.
|
||||
} D3DKMT_GPU_PREFERENCE_QUERY_STATE; ///< Alias for D3 DKMT GPU PREFERENCE QUERY STATE.
|
||||
};
|
||||
|
||||
using D3DKMT_GPU_PREFERENCE_QUERY_STATE = _D3DKMT_GPU_PREFERENCE_QUERY_STATE; ///< GPU preference query state reported by D3DKMT.
|
||||
|
||||
#include "display.h"
|
||||
#include "misc.h"
|
||||
@@ -456,7 +458,7 @@ namespace platf::dxgi {
|
||||
std::call_once(windows_cpp_once_flag, []() {
|
||||
DECLARE_HANDLE(DPI_AWARENESS_CONTEXT);
|
||||
|
||||
typedef BOOL (*User32_SetProcessDpiAwarenessContext)(DPI_AWARENESS_CONTEXT value);
|
||||
using User32_SetProcessDpiAwarenessContext = BOOL (*)(DPI_AWARENESS_CONTEXT value);
|
||||
|
||||
{
|
||||
auto user32 = LoadLibraryA("user32.dll");
|
||||
|
||||
+1
-1
@@ -38,7 +38,7 @@ namespace proc {
|
||||
/**
|
||||
* @brief Parsed command arguments used when launching a child process.
|
||||
*/
|
||||
typedef config::prep_cmd_t cmd_t;
|
||||
using cmd_t = config::prep_cmd_t;
|
||||
|
||||
/**
|
||||
* pre_cmds -- guaranteed to be executed unless any of the commands fail.
|
||||
|
||||
+2
-2
@@ -51,11 +51,11 @@ namespace round_robin_util {
|
||||
/**
|
||||
* @brief Concrete iterator type supplied by the CRTP child.
|
||||
*/
|
||||
typedef T iterator;
|
||||
using iterator = T;
|
||||
/**
|
||||
* @brief Signed offset type used when moving through the range.
|
||||
*/
|
||||
typedef std::ptrdiff_t diff_t;
|
||||
using diff_t = std::ptrdiff_t;
|
||||
|
||||
/**
|
||||
* @brief Advance this iterator by repeatedly wrapping at the end of the range.
|
||||
|
||||
+7
-2
@@ -289,7 +289,7 @@ namespace stream {
|
||||
/**
|
||||
* @brief Packed encrypted control-channel envelope.
|
||||
*/
|
||||
typedef struct control_encrypted_t {
|
||||
struct control_encrypted_t {
|
||||
std::uint16_t encryptedHeaderType; ///< Always LE 0x0001.
|
||||
std::uint16_t length; ///< Size of seq, tag, secondary header, and data.
|
||||
|
||||
@@ -306,7 +306,12 @@ namespace stream {
|
||||
}
|
||||
|
||||
// encrypted control_header_v2 and payload data follow
|
||||
} *control_encrypted_p; ///< Alias for control encrypted p.
|
||||
};
|
||||
|
||||
/**
|
||||
* @brief Pointer to a packed encrypted control-channel envelope.
|
||||
*/
|
||||
using control_encrypted_p = control_encrypted_t *;
|
||||
|
||||
/**
|
||||
* @brief Packed RTP and FEC headers for an audio recovery packet.
|
||||
|
||||
+3
-3
@@ -69,16 +69,16 @@ namespace task_pool_util {
|
||||
/**
|
||||
* @brief Type-erased task owned by the task pool.
|
||||
*/
|
||||
typedef std::unique_ptr<_ImplBase> __task;
|
||||
using __task = std::unique_ptr<_ImplBase>;
|
||||
/**
|
||||
* @brief Stable pointer used to identify a queued task.
|
||||
*/
|
||||
typedef _ImplBase *task_id_t;
|
||||
using task_id_t = _ImplBase *;
|
||||
|
||||
/**
|
||||
* @brief Steady-clock timestamp used to schedule delayed tasks.
|
||||
*/
|
||||
typedef std::chrono::steady_clock::time_point __time_point;
|
||||
using __time_point = std::chrono::steady_clock::time_point;
|
||||
|
||||
/**
|
||||
* @brief Queued delayed task identifier paired with its future result.
|
||||
|
||||
+1
-1
@@ -20,7 +20,7 @@ namespace thread_pool_util {
|
||||
/**
|
||||
* @brief Callable unit executed by a worker thread.
|
||||
*/
|
||||
typedef TaskPool::__task __task;
|
||||
using __task = TaskPool::__task;
|
||||
|
||||
private:
|
||||
std::vector<std::jthread> _thread;
|
||||
|
||||
+5
-5
@@ -41,7 +41,7 @@ struct argument_type<T(U)> {
|
||||
/**
|
||||
* @brief Type extracted from the matched function signature.
|
||||
*/
|
||||
typedef U type;
|
||||
using type = U;
|
||||
};
|
||||
|
||||
/**
|
||||
@@ -413,7 +413,7 @@ namespace util {
|
||||
/**
|
||||
* @brief Integral type used for one formatted hex element.
|
||||
*/
|
||||
typedef T elem_type;
|
||||
using elem_type = T;
|
||||
|
||||
private:
|
||||
const std::array<char, 16> _bits {
|
||||
@@ -1628,9 +1628,9 @@ namespace util {
|
||||
template<class ReturnType, class... Args>
|
||||
struct Function {
|
||||
/**
|
||||
* @brief Type extracted from the matched function signature.
|
||||
* @brief Pointer type for a function with the specified return and argument types.
|
||||
*/
|
||||
typedef ReturnType (*type)(Args...);
|
||||
using type = ReturnType (*)(Args...);
|
||||
};
|
||||
|
||||
/**
|
||||
@@ -1641,7 +1641,7 @@ namespace util {
|
||||
/**
|
||||
* @brief Pointer type accepted by this deleter.
|
||||
*/
|
||||
typedef T pointer;
|
||||
using pointer = T;
|
||||
|
||||
/**
|
||||
* @brief Invoke the configured destroy function on a pointer.
|
||||
|
||||
+1
-1
@@ -3507,7 +3507,7 @@ namespace video {
|
||||
/**
|
||||
* @brief Callback signature for VA-API AVCodec hardware input initialization.
|
||||
*/
|
||||
typedef int (*vaapi_init_avcodec_hardware_input_buffer_fn)(platf::avcodec_encode_device_t *encode_device, AVBufferRef **hw_device_buf);
|
||||
using vaapi_init_avcodec_hardware_input_buffer_fn = int (*)(platf::avcodec_encode_device_t *encode_device, AVBufferRef **hw_device_buf);
|
||||
|
||||
/**
|
||||
* @brief Initialize AVCodec hardware input buffers for VA-API.
|
||||
|
||||
@@ -0,0 +1,88 @@
|
||||
/**
|
||||
* @file tests/unit/platform/windows/test_display_abi.cpp
|
||||
* @brief Verify the Windows kernel ABI of Sunshine's D3DKMT declarations.
|
||||
*/
|
||||
|
||||
// test includes
|
||||
#include "../../../tests_common.h"
|
||||
|
||||
#ifdef _WIN32
|
||||
// standard includes
|
||||
#include <bit>
|
||||
#include <cstddef>
|
||||
#include <type_traits>
|
||||
|
||||
// local includes
|
||||
#include <src/platform/windows/display.h>
|
||||
|
||||
/**
|
||||
* @brief Adapter requests retain the sizes and field offsets expected by D3DKMT.
|
||||
*/
|
||||
TEST(D3dkmtAbiTests, AdapterRequestsMatchKernelLayouts) {
|
||||
using display = platf::dxgi::display_base_t;
|
||||
using open_request = display::D3DKMT_OPENADAPTERFROMLUID;
|
||||
using query_request = display::D3DKMT_QUERYADAPTERINFO;
|
||||
using close_request = display::D3DKMT_CLOSEADAPTER;
|
||||
|
||||
EXPECT_TRUE(std::is_standard_layout_v<open_request>);
|
||||
EXPECT_EQ(sizeof(open_request), 12U);
|
||||
EXPECT_EQ(alignof(open_request), 4U);
|
||||
EXPECT_EQ(offsetof(open_request, AdapterLuid), 0U);
|
||||
EXPECT_EQ(offsetof(open_request, hAdapter), 8U);
|
||||
|
||||
EXPECT_TRUE(std::is_standard_layout_v<query_request>);
|
||||
EXPECT_EQ(sizeof(query_request), sizeof(void *) == 8 ? 24U : 16U);
|
||||
EXPECT_EQ(alignof(query_request), alignof(void *));
|
||||
EXPECT_EQ(offsetof(query_request, hAdapter), 0U);
|
||||
EXPECT_EQ(offsetof(query_request, Type), 4U);
|
||||
EXPECT_EQ(offsetof(query_request, pPrivateDriverData), 8U);
|
||||
EXPECT_EQ(offsetof(query_request, PrivateDriverDataSize), 8U + sizeof(void *));
|
||||
|
||||
EXPECT_TRUE(std::is_standard_layout_v<close_request>);
|
||||
EXPECT_EQ(sizeof(close_request), 4U);
|
||||
EXPECT_EQ(alignof(close_request), 4U);
|
||||
EXPECT_EQ(offsetof(close_request, hAdapter), 0U);
|
||||
}
|
||||
|
||||
/**
|
||||
* @brief WDDM 2.7 capability fields map to their documented kernel flag bits.
|
||||
*
|
||||
* Inspect the object representation without reading an inactive union member.
|
||||
*/
|
||||
TEST(D3dkmtAbiTests, WddmCapabilitiesUseKernelBitPositions) {
|
||||
using capabilities = platf::dxgi::display_base_t::D3DKMT_WDDM_2_7_CAPS;
|
||||
EXPECT_TRUE(std::is_standard_layout_v<capabilities>);
|
||||
EXPECT_EQ(sizeof(capabilities), 4U);
|
||||
EXPECT_EQ(alignof(capabilities), 4U);
|
||||
|
||||
capabilities caps {};
|
||||
caps.HwSchSupported = 1;
|
||||
EXPECT_EQ(std::bit_cast<UINT>(caps), 0x01U);
|
||||
|
||||
caps = {};
|
||||
caps.HwSchEnabled = 1;
|
||||
EXPECT_EQ(std::bit_cast<UINT>(caps), 0x02U);
|
||||
|
||||
caps = {};
|
||||
caps.HwSchEnabledByDefault = 1;
|
||||
EXPECT_EQ(std::bit_cast<UINT>(caps), 0x04U);
|
||||
|
||||
caps = {};
|
||||
caps.IndependentVidPnVSyncControl = 1;
|
||||
EXPECT_EQ(std::bit_cast<UINT>(caps), 0x08U);
|
||||
}
|
||||
|
||||
/**
|
||||
* @brief Scheduling priority values retain the representation expected by D3DKMT.
|
||||
*/
|
||||
TEST(D3dkmtAbiTests, SchedulingPrioritiesMatchKernelValues) {
|
||||
using display = platf::dxgi::display_base_t;
|
||||
EXPECT_EQ(sizeof(display::D3DKMT_SCHEDULINGPRIORITYCLASS), 4U);
|
||||
EXPECT_EQ(display::D3DKMT_SCHEDULINGPRIORITYCLASS_IDLE, 0);
|
||||
EXPECT_EQ(display::D3DKMT_SCHEDULINGPRIORITYCLASS_BELOW_NORMAL, 1);
|
||||
EXPECT_EQ(display::D3DKMT_SCHEDULINGPRIORITYCLASS_NORMAL, 2);
|
||||
EXPECT_EQ(display::D3DKMT_SCHEDULINGPRIORITYCLASS_ABOVE_NORMAL, 3);
|
||||
EXPECT_EQ(display::D3DKMT_SCHEDULINGPRIORITYCLASS_HIGH, 4);
|
||||
EXPECT_EQ(display::D3DKMT_SCHEDULINGPRIORITYCLASS_REALTIME, 5);
|
||||
}
|
||||
#endif
|
||||
Reference in new issue
Block a user