wine-staging/patches/winecfg-Staging/0002-winecfg-Add-checkbox-to-enable-disable-vaapi-GPU-dec.patch
2023-06-21 08:23:37 +10:00

81 lines
2.9 KiB
Diff

From f9e74e7d75b84f1831e49f7be9197e3a6db6e428 Mon Sep 17 00:00:00 2001
From: Sebastian Lackner <sebastian@fds-team.de>
Date: Sat, 21 Feb 2015 23:37:26 +0100
Subject: [PATCH] winecfg: Add checkbox to enable/disable vaapi GPU decoder.
---
programs/winecfg/resource.h | 1 +
programs/winecfg/staging.c | 20 ++++++++++++++++++++
programs/winecfg/winecfg.rc | 1 +
3 files changed, 22 insertions(+)
diff --git a/programs/winecfg/resource.h b/programs/winecfg/resource.h
index 582c5c967e4..17378655db6 100644
--- a/programs/winecfg/resource.h
+++ b/programs/winecfg/resource.h
@@ -214,6 +214,7 @@
/* Staging tab */
#define IDC_ENABLE_CSMT 9001
+#define IDC_ENABLE_VAAPI 9002
/* About tab */
#define IDC_ABT_OWNER 8432
diff --git a/programs/winecfg/staging.c b/programs/winecfg/staging.c
index a2a2117a56d..3ba1e618bb3 100644
--- a/programs/winecfg/staging.c
+++ b/programs/winecfg/staging.c
@@ -42,10 +42,26 @@ static void csmt_set(BOOL status)
set_reg_key_dword(config_key, L"Direct3D", L"csmt", status);
}
+/*
+ * DXVA2
+ */
+static BOOL vaapi_get(void)
+{
+ BOOL ret;
+ WCHAR *value = get_reg_key(config_key, keypath(L"DXVA2"), L"backend", NULL);
+ ret = (value && !wcscmp(value, L"va"));
+ free(value);
+ return ret;
+}
+static void vaapi_set(BOOL status)
+{
+ set_reg_key(config_key, keypath(L"DXVA2"), L"backend", status ? L"va" : NULL);
+}
static void load_staging_settings(HWND dialog)
{
CheckDlgButton(dialog, IDC_ENABLE_CSMT, csmt_get() ? BST_CHECKED : BST_UNCHECKED);
+ CheckDlgButton(dialog, IDC_ENABLE_VAAPI, vaapi_get() ? BST_CHECKED : BST_UNCHECKED);
}
INT_PTR CALLBACK StagingDlgProc(HWND hDlg, UINT uMsg, WPARAM wParam, LPARAM lParam)
@@ -75,6 +91,10 @@ INT_PTR CALLBACK StagingDlgProc(HWND hDlg, UINT uMsg, WPARAM wParam, LPARAM lPar
csmt_set(IsDlgButtonChecked(hDlg, IDC_ENABLE_CSMT) == BST_CHECKED);
SendMessageW(GetParent(hDlg), PSM_CHANGED, 0, 0);
return TRUE;
+ case IDC_ENABLE_VAAPI:
+ vaapi_set(IsDlgButtonChecked(hDlg, IDC_ENABLE_VAAPI) == BST_CHECKED);
+ SendMessageW(GetParent(hDlg), PSM_CHANGED, 0, 0);
+ return TRUE;
}
break;
}
diff --git a/programs/winecfg/winecfg.rc b/programs/winecfg/winecfg.rc
index 895f68c1237..eafbdd6cd67 100644
--- a/programs/winecfg/winecfg.rc
+++ b/programs/winecfg/winecfg.rc
@@ -318,6 +318,7 @@ BEGIN
GROUPBOX "Staging settings",IDC_STATIC,8,4,244,210
LTEXT "The following settings are experimental and may break stuff!\nMake sure to reset them again in case of a problem.",IDC_STATIC,16,16,230,16
CONTROL "Enable &CSMT for better graphic performance (deprecated)",IDC_ENABLE_CSMT,"Button",BS_AUTOCHECKBOX | WS_TABSTOP,16,40,230,8
+ CONTROL "Enable &VAAPI as backend for DXVA2 GPU decoding",IDC_ENABLE_VAAPI,"Button",BS_AUTOCHECKBOX | WS_TABSTOP,16,55,230,8
END
LANGUAGE LANG_NEUTRAL, SUBLANG_NEUTRAL
--
2.33.0