Compare commits

...
Author SHA1 Message Date
Vindicus999 2388095747 Merge remote-tracking branch 'upstream/master' 2025-10-23 11:17:34 +00:00
Alexander Afanasenko 61c5c871c1 Reflect in docs support for 10-bit on NVENC (#548)
* docs on 10-bit using nvenc

* docs: note on supported codecs for nvidia gpus
2025-10-23 12:24:30 +02:00
Alexander Afanasenko 50e1ecab37 10-bit encoding on NVENC (#532) 2025-10-23 09:42:33 +02:00
Vindicus999 61253cbd6f Merge remote-tracking branch 'upstream/master' 2025-10-21 23:19:12 +00:00
Guillaume Meunier b1ee9bad47 List missing translations in issue body 2025-10-21 22:00:02 +02:00
Vindicus999 de59f31ace Merge remote-tracking branch 'upstream/master' 2025-10-21 17:18:28 +00:00
aomiki 0e5b339b68 update ru locale 2025-10-21 13:57:36 +02:00
Vindicus999 1f6ef49f1a Merge remote-tracking branch 'upstream/master' 2025-10-21 11:17:04 +00:00
mitsuami-megane 219d251d1b update ja locale 2025-10-21 09:45:47 +02:00
BlackCherryCat ab2671633a Update es locale 2025-10-21 09:45:28 +02:00
7 changed files with 187 additions and 73 deletions
+3 -1
View File
@@ -41,7 +41,7 @@ Bitrate of the video, in bit/s. Split among decoders based on size and codecs.
## `bit-depth`
Default value: `8` (bits)
Bit depth of the video. 8-bit is supported by all encoders. 10-bit is supported by `vaapi` encoders using `h265` or `av1`.
Bit depth of the video. 8-bit is supported by all encoders. 10-bit is supported by `vaapi` and `nvenc` encoders using `h265` or `av1`.
## `encoders`
A list of encoders to use.
@@ -66,6 +66,8 @@ Default value: first supported by both headset and encoder of `av1`, `h264`, `h2
One of `h264`, `h265`, `av1`, `raw`.
Not all encoders support every codec, `x264` and `vulkan` only support `h264`. For `raw` codec, only `raw` encoder can be used.
If `nvenc` encoder is in use, you can refer to [nvidia website](https://developer.nvidia.com/video-encode-decode-support-matrix) to make sure that your GPU supports encoding with the desired codec.
### `width`, `height`, `offset_x`, `offset_y` (advanced)
Default values: full image (`width` = 1, `height` = 1, `offset_x` = 0, `offset_y` = 0)
+13 -5
View File
@@ -8,8 +8,8 @@ msgid ""
msgstr ""
"Project-Id-Version: WiVRn-dashboard\n"
"Report-Msgid-Bugs-To: \n"
"POT-Creation-Date: 2025-10-11 19:53+0200\n"
"PO-Revision-Date: 2025-10-11 20:58+0200\n"
"POT-Creation-Date: 2025-10-20 20:55+0200\n"
"PO-Revision-Date: 2025-10-21 01:28+0200\n"
"Last-Translator: Álvaro De Quinta <blackcherry@danwin1210.de>\n"
"Language-Team: Spanish\n"
"Language: es\n"
@@ -927,11 +927,11 @@ msgstr "Solución de problemas"
#: dashboard/qml/WizardPage.qml:393
#, kde-format
msgid ""
"If the server is not visible or the connection fails, check that port 5353 "
"If the server is not visible or the connection fails, check that ports 5353 "
"(UDP) and 9757 (TCP and UDP) are open in your firewall."
msgstr ""
"Si el servidor no es visible o la conexión falla, verifica que el puerto "
"5353 (UDP) y el 9757 (TCP y UDP) estén abiertos en tu firewall."
"Si el servidor no es visible o la conexión falla, comprueba que los puertos "
"5353 (UDP) y 9757 (TCP y UDP) estén abiertos en tu firewall."
#: dashboard/qml/WizardPage.qml:406
#, kde-format
@@ -976,3 +976,11 @@ msgstr "xrizer"
#, kde-format
msgid "Open Composite"
msgstr "Open Composite"
#, kde-format
#~ msgid ""
#~ "If the server is not visible or the connection fails, check that port "
#~ "5353 (UDP) and 9757 (TCP and UDP) are open in your firewall."
#~ msgstr ""
#~ "Si el servidor no es visible o la conexión falla, verifica que el puerto "
#~ "5353 (UDP) y el 9757 (TCP y UDP) estén abiertos en tu firewall."
+4 -4
View File
@@ -2,7 +2,7 @@ msgid ""
msgstr ""
"Project-Id-Version: WiVRn-dashboard\n"
"Report-Msgid-Bugs-To: \n"
"POT-Creation-Date: 2025-10-12 09:30+0900\n"
"POT-Creation-Date: 2025-10-21 11:44+0900\n"
"PO-Revision-Date: 2025-04-10 07:14+0900\n"
"Last-Translator: Mitsuami Megane <hello@mitsua.me>\n"
"Language-Team: Japanese <>\n"
@@ -900,11 +900,11 @@ msgstr "問題解決"
#: dashboard/qml/WizardPage.qml:393
#, kde-format
msgid ""
"If the server is not visible or the connection fails, check that port 5353 "
"If the server is not visible or the connection fails, check that ports 5353 "
"(UDP) and 9757 (TCP and UDP) are open in your firewall."
msgstr ""
"サーバーが見えない・サーバーに接続できない場合、ファイアウォールのポート5353"
"(UDP)と9757(TCPとUDPの両方)が開いていることを確認しましょう。"
"サーバーが見えない・サーバーに接続できない場合、ファイアウォールのポート"
"5353(UDP)と9757(TCPとUDPの両方)が開いていることを確認しましょう。"
#: dashboard/qml/WizardPage.qml:406
#, kde-format
+2 -2
View File
@@ -8,7 +8,7 @@ msgid ""
msgstr ""
"Project-Id-Version: WiVRn-dashboard\n"
"Report-Msgid-Bugs-To: \n"
"POT-Creation-Date: 2025-10-11 21:53+0400\n"
"POT-Creation-Date: 2025-10-20 22:55+0400\n"
"PO-Revision-Date: 2025-10-06 14:57+0400\n"
"Last-Translator: Alexander Afanasenko <aomiki.iki@gmail.com>\n"
"Language-Team: Russian <>\n"
@@ -925,7 +925,7 @@ msgstr "Устранение неполадок"
#: dashboard/qml/WizardPage.qml:393
#, kde-format
msgid ""
"If the server is not visible or the connection fails, check that port 5353 "
"If the server is not visible or the connection fails, check that ports 5353 "
"(UDP) and 9757 (TCP and UDP) are open in your firewall."
msgstr ""
"Если сервер не виден или не удается установить соединение, проверьте что "
+147 -55
View File
@@ -18,12 +18,20 @@
*/
#include "video_encoder_nvenc.h"
#include "encoder_settings.h"
#include "util/u_logging.h"
#include "utils/wivrn_vk_bundle.h"
bool operator==(const GUID & l, const GUID & r)
{
return l.Data1 == r.Data1 and
l.Data2 == r.Data2 and
l.Data3 == r.Data3 and
std::ranges::equal(l.Data4, r.Data4);
}
#include <algorithm>
#include <stdexcept>
#define NVENC_CHECK_NOENCODER(x) \
@@ -80,6 +88,48 @@ static auto encode_guid(video_codec codec)
throw std::out_of_range("Invalid codec " + std::to_string(codec));
}
static void check_encode_guid_supported(std::shared_ptr<video_encoder_nvenc_shared_state> shared_state, void * session_handle, GUID encode_guid)
{
uint32_t count;
NVENC_CHECK(shared_state->fn.nvEncGetEncodeGUIDCount(session_handle, &count));
std::vector<GUID> encodeGUIDs(count);
NVENC_CHECK(shared_state->fn.nvEncGetEncodeGUIDs(session_handle, encodeGUIDs.data(), count, &count));
if (!std::ranges::contains(encodeGUIDs, encode_guid))
{
throw std::runtime_error("nvenc: GPU doesn't support selected codec.");
}
}
static void check_preset_guid_supported(std::shared_ptr<video_encoder_nvenc_shared_state> shared_state, void * session_handle, GUID encode_guid, GUID preset_guid)
{
uint32_t count;
NVENC_CHECK(shared_state->fn.nvEncGetEncodePresetCount(session_handle, encode_guid, &count));
std::vector<GUID> presetGUIDs(count);
NVENC_CHECK(shared_state->fn.nvEncGetEncodePresetGUIDs(session_handle, encode_guid, presetGUIDs.data(), count, &count));
if (!std::ranges::contains(presetGUIDs, preset_guid))
{
throw std::runtime_error("nvenc: Internal error. GPU doesn't support selected encoder preset.");
}
}
static void check_profile_guid_supported(std::shared_ptr<video_encoder_nvenc_shared_state> shared_state, void * session_handle, GUID encodeGUID, GUID profileGUID, std::string err_msg = "GPU doesn't support selected encoding profile.")
{
uint32_t count;
NVENC_CHECK(shared_state->fn.nvEncGetEncodeProfileGUIDCount(session_handle, encodeGUID, &count));
std::vector<GUID> profileGUIDs(count);
NVENC_CHECK(shared_state->fn.nvEncGetEncodeProfileGUIDs(session_handle, encodeGUID, profileGUIDs.data(), count, &count));
if (!std::ranges::contains(profileGUIDs, profileGUID))
{
throw std::runtime_error("nvenc: " + err_msg);
}
}
video_encoder_nvenc::video_encoder_nvenc(
wivrn_vk_bundle & vk,
encoder_settings & settings,
@@ -91,8 +141,8 @@ video_encoder_nvenc::video_encoder_nvenc(
fps(fps),
bitrate(settings.bitrate)
{
if (settings.bit_depth != 8)
throw std::runtime_error("nvenc encoder only supports 8-bit encoding");
if (settings.bit_depth != 8 && settings.bit_depth != 10)
throw std::runtime_error("nvenc encoder only supports 8-bit and 10-bit encoding");
assert(settings.width % 32 == 0);
assert(settings.height % 32 == 0);
@@ -107,7 +157,6 @@ video_encoder_nvenc::video_encoder_nvenc(
},
};
auto encodeGUID = encode_guid(settings.codec);
NV_ENC_OPEN_ENCODE_SESSION_EX_PARAMS params_ex = {
.version = NV_ENC_OPEN_ENCODE_SESSION_EX_PARAMS_VER,
.deviceType = NV_ENC_DEVICE_TYPE_CUDA,
@@ -116,15 +165,14 @@ video_encoder_nvenc::video_encoder_nvenc(
};
NVENC_CHECK_NOENCODER(shared_state->fn.nvEncOpenEncodeSessionEx(&params_ex, &session_handle));
uint32_t count;
std::vector<GUID> presets;
NVENC_CHECK(shared_state->fn.nvEncGetEncodePresetCount(session_handle, encodeGUID, &count));
presets.resize(count);
NVENC_CHECK(shared_state->fn.nvEncGetEncodePresetGUIDs(session_handle, encodeGUID, presets.data(), count, &count));
auto encodeGUID = encode_guid(settings.codec);
check_encode_guid_supported(shared_state, session_handle, encodeGUID);
#pragma GCC diagnostic push
#pragma GCC diagnostic ignored "-Wdeprecated-declarations"
auto presetGUID = NV_ENC_PRESET_P4_GUID;
GUID presetGUID = NV_ENC_PRESET_P4_GUID;
check_preset_guid_supported(shared_state, session_handle, encodeGUID, presetGUID);
NV_ENC_TUNING_INFO tuningInfo = NV_ENC_TUNING_INFO_ULTRA_LOW_LATENCY;
#pragma GCC diagnostic pop
NV_ENC_PRESET_CONFIG preset_config{
@@ -147,24 +195,70 @@ video_encoder_nvenc::video_encoder_nvenc(
params.gopLength = NVENC_INFINITE_GOPLENGTH;
params.frameIntervalP = 1;
NV_ENC_BIT_DEPTH bitDepth = NV_ENC_BIT_DEPTH_8;
if (settings.bit_depth == 10)
{
NV_ENC_CAPS_PARAM cap_param{
.version = NV_ENC_CAPS_PARAM_VER,
.capsToQuery = NV_ENC_CAPS_SUPPORT_10BIT_ENCODE,
};
int res = 0;
NVENC_CHECK(shared_state->fn.nvEncGetEncodeCaps(session_handle, encodeGUID, &cap_param, &res));
if (res == 1)
{
bitDepth = NV_ENC_BIT_DEPTH_10;
bytesPerPixel = 2;
}
else
{
throw std::runtime_error("nvenc: 10-bit encoding requested, but GPU doesn't support it");
}
}
switch (settings.codec)
{
case video_codec::h264:
if (bitDepth != NV_ENC_BIT_DEPTH_8)
throw std::runtime_error("nvenc: selected codec only supports 8-bit encoding");
params.encodeCodecConfig.h264Config.repeatSPSPPS = 1;
params.encodeCodecConfig.h264Config.maxNumRefFrames = 0;
params.encodeCodecConfig.h264Config.idrPeriod = NVENC_INFINITE_GOPLENGTH;
params.encodeCodecConfig.h264Config.h264VUIParameters.videoFullRangeFlag = 1;
break;
case video_codec::h265:
if (bitDepth == NV_ENC_BIT_DEPTH_10)
{
params.profileGUID = NV_ENC_HEVC_PROFILE_MAIN10_GUID;
check_profile_guid_supported(shared_state, session_handle, encodeGUID, params.profileGUID, "GPU doesn't support 10-bit depth with H.265 codec.");
}
params.encodeCodecConfig.hevcConfig.inputBitDepth = bitDepth;
params.encodeCodecConfig.hevcConfig.outputBitDepth = bitDepth;
params.encodeCodecConfig.hevcConfig.repeatSPSPPS = 1;
params.encodeCodecConfig.hevcConfig.maxNumRefFramesInDPB = 0;
params.encodeCodecConfig.hevcConfig.idrPeriod = NVENC_INFINITE_GOPLENGTH;
params.encodeCodecConfig.hevcConfig.hevcVUIParameters.videoFullRangeFlag = 1;
break;
case video_codec::av1:
if (bitDepth == NV_ENC_BIT_DEPTH_10)
{
params.profileGUID = NV_ENC_AV1_PROFILE_MAIN_GUID;
check_profile_guid_supported(shared_state, session_handle, encodeGUID, params.profileGUID, "GPU doesn't support 10-bit depth with AV1 codec.");
}
params.encodeCodecConfig.av1Config.inputBitDepth = bitDepth;
params.encodeCodecConfig.av1Config.outputBitDepth = bitDepth;
params.encodeCodecConfig.av1Config.repeatSeqHdr = 1;
params.encodeCodecConfig.av1Config.maxNumRefFramesInDPB = 0;
params.encodeCodecConfig.av1Config.idrPeriod = NVENC_INFINITE_GOPLENGTH;
break;
case video_codec::raw:
throw std::runtime_error("raw codec not supported for nvenc");
@@ -192,7 +286,7 @@ video_encoder_nvenc::video_encoder_nvenc(
NVENC_CHECK(shared_state->fn.nvEncCreateBitstreamBuffer(session_handle, &params3));
bitstreamBuffer = params3.bitstreamBuffer;
vk::DeviceSize buffer_size = rect.extent.width * settings.video_height * 3 / 2;
vk::DeviceSize buffer_size = rect.extent.width * settings.video_height * bytesPerPixel * 3 / 2;
vk::StructureChain buffer_create_info{
vk::BufferCreateInfo{
@@ -256,9 +350,9 @@ video_encoder_nvenc::video_encoder_nvenc(
.resourceType = NV_ENC_INPUT_RESOURCE_TYPE_CUDADEVICEPTR,
.width = settings.video_width,
.height = settings.video_height,
.pitch = rect.extent.width,
.pitch = rect.extent.width * bytesPerPixel,
.resourceToRegister = (void *)frame,
.bufferFormat = NV_ENC_BUFFER_FORMAT_NV12,
.bufferFormat = (bitDepth == NV_ENC_BIT_DEPTH_10 ? NV_ENC_BUFFER_FORMAT_YUV420_10BIT : NV_ENC_BUFFER_FORMAT_NV12),
.bufferUsage = NV_ENC_INPUT_IMAGE,
};
NVENC_CHECK(shared_state->fn.nvEncRegisterResource(session_handle, &param3));
@@ -279,43 +373,38 @@ std::pair<bool, vk::Semaphore> video_encoder_nvenc::present_image(vk::Image y_cb
y_cbcr,
vk::ImageLayout::eTransferSrcOptimal,
*in[slot].yuv,
vk::BufferImageCopy{
.bufferRowLength = rect.extent.width,
.imageSubresource = {
.aspectMask = vk::ImageAspectFlagBits::ePlane0,
.baseArrayLayer = uint32_t(channels),
.layerCount = 1,
},
.imageOffset = {
.x = rect.offset.x,
.y = rect.offset.y,
},
.imageExtent = {
.width = rect.extent.width,
.height = rect.extent.height,
.depth = 1,
}});
cmd_buf.copyImageToBuffer(
y_cbcr,
vk::ImageLayout::eTransferSrcOptimal,
*in[slot].yuv,
vk::BufferImageCopy{
.bufferOffset = rect.extent.width * rect.extent.height,
.bufferRowLength = uint32_t(rect.extent.width / 2),
.imageSubresource = {
.aspectMask = vk::ImageAspectFlagBits::ePlane1,
.baseArrayLayer = uint32_t(channels),
.layerCount = 1,
},
.imageOffset = {
.x = rect.offset.x / 2,
.y = rect.offset.y / 2,
},
.imageExtent = {
.width = rect.extent.width / 2,
.height = rect.extent.height / 2,
.depth = 1,
}});
std::array{
vk::BufferImageCopy{
.bufferRowLength = rect.extent.width,
.imageSubresource = {
.aspectMask = vk::ImageAspectFlagBits::ePlane0,
.baseArrayLayer = uint32_t(channels),
.layerCount = 1,
},
.imageOffset = {
.x = rect.offset.x,
.y = rect.offset.y,
},
.imageExtent = {
.width = rect.extent.width,
.height = rect.extent.height,
.depth = 1,
}},
vk::BufferImageCopy{.bufferOffset = rect.extent.width * rect.extent.height * bytesPerPixel, .bufferRowLength = uint32_t(rect.extent.width / 2), .imageSubresource = {
.aspectMask = vk::ImageAspectFlagBits::ePlane1,
.baseArrayLayer = uint32_t(channels),
.layerCount = 1,
},
.imageOffset = {
.x = rect.offset.x / 2,
.y = rect.offset.y / 2,
},
.imageExtent = {
.width = rect.extent.width / 2,
.height = rect.extent.height / 2,
.depth = 1,
}}});
return {false, nullptr};
}
@@ -364,15 +453,15 @@ std::optional<video_encoder::data> video_encoder_nvenc::encode(bool idr, std::ch
std::array<int, 2> video_encoder_nvenc::get_max_size(video_codec codec)
{
video_encoder_nvenc_shared_state state;
std::shared_ptr<video_encoder_nvenc_shared_state> state = video_encoder_nvenc_shared_state::get();
void * session_handle = nullptr;
NV_ENC_OPEN_ENCODE_SESSION_EX_PARAMS params_ex = {
.version = NV_ENC_OPEN_ENCODE_SESSION_EX_PARAMS_VER,
.deviceType = NV_ENC_DEVICE_TYPE_CUDA,
.device = state.cuda,
.device = state->cuda,
.apiVersion = NVENCAPI_VERSION,
};
if (state.fn.nvEncOpenEncodeSessionEx(&params_ex, &session_handle) != NV_ENC_SUCCESS)
if (state->fn.nvEncOpenEncodeSessionEx(&params_ex, &session_handle) != NV_ENC_SUCCESS)
{
throw std::runtime_error("nvenc get_max_size: Failed to open session");
}
@@ -390,7 +479,10 @@ std::array<int, 2> video_encoder_nvenc::get_max_size(video_codec codec)
.version = NV_ENC_CAPS_PARAM_VER,
.capsToQuery = NV_ENC_CAPS_WIDTH_MAX,
};
NVENCSTATUS status = state.fn.nvEncGetEncodeCaps(session_handle, encodeGUID, &cap_param, res);
check_encode_guid_supported(state, session_handle, encodeGUID);
NVENCSTATUS status = state->fn.nvEncGetEncodeCaps(session_handle, encodeGUID, &cap_param, res);
if (status != NV_ENC_SUCCESS)
{
throw std::runtime_error("nvenc get_max_size: failed to get caps");
@@ -403,7 +495,7 @@ std::array<int, 2> video_encoder_nvenc::get_max_size(video_codec codec)
}
if (session_handle)
{
state.fn.nvEncDestroyEncoder(session_handle);
state->fn.nvEncDestroyEncoder(session_handle);
}
if (ex)
std::rethrow_exception(ex);
+1
View File
@@ -52,6 +52,7 @@ private:
float fps;
int bitrate;
int bytesPerPixel = 1;
public:
video_encoder_nvenc(wivrn_vk_bundle & vk, encoder_settings & settings, float fps, uint8_t stream_idx);
+17 -6
View File
@@ -77,7 +77,7 @@ if __name__ == "__main__":
dashboard_ref = polib.pofile(dashboard_pot)
for lang in args.lang:
lang_issues = 0
lang_issues = dict()
for po_ref, po in ((client_ref, os.path.join(locale_dir, lang, "wivrn.po")),
(dashboard_ref, os.path.join(locale_dir, lang, "wivrn-dashboard.po"))):
if not os.path.exists(po):
@@ -92,22 +92,33 @@ if __name__ == "__main__":
if not i.msgid in entries:
missing = missing + 1
print(f"::notice file={po}::{lang} translation for {repr(i.msgid)} is missing")
lang_issues += missing
if not po in lang_issues:
lang_issues[po] = []
lang_issues[po].append(repr(i.msgid))
if missing > 0:
print(f"::warning file={po}::{lang} {missing} translations missing")
if args.manage_issues:
issues = [i for i in repo.get_issues(state="all", labels = [ISSUE_LABEL]) if i.title == ISSUE_TITLE.format(lang=lang)]
if lang_issues > 0:
issue_body = 'The following translations are missing:\n'
for po in lang_issues:
issue_body += '\n## ' + pathlib.Path(po).name + '\n'
for msg in lang_issues[po]:
issue_body += '- ' + msg + '\n'
if len(lang_issues) > 0:
if issues:
for issue in issues:
if issue.state != "open":
issue.edit(state="open")
if issue.state != "open" or issue.body != issue_body:
issue.edit(state="open", body=issue_body)
else:
try:
repo.create_issue(
title=ISSUE_TITLE.format(lang=lang),
body=issue_body,
labels=[ISSUE_LABEL]
)
except GithubException as e:
@@ -116,4 +127,4 @@ if __name__ == "__main__":
raise
else:
for issue in issues:
issue.edit(state="closed")
issue.edit(state="closed", body="All translations are up to date")