diff options
Diffstat (limited to 'src/codec_query')
-rw-r--r-- | src/codec_query/cuda.c | 14 | ||||
-rw-r--r-- | src/codec_query/vaapi.c | 51 | ||||
-rw-r--r-- | src/codec_query/vulkan.c | 3 |
3 files changed, 38 insertions, 30 deletions
diff --git a/src/codec_query/cuda.c b/src/codec_query/cuda.c index 690e7d4..4692b1d 100644 --- a/src/codec_query/cuda.c +++ b/src/codec_query/cuda.c @@ -101,16 +101,16 @@ static bool encoder_get_supported_profiles(const NV_ENCODE_API_FUNCTION_LIST *fu for(uint32_t i = 0; i < profile_guid_count; ++i) { if(profile_is_h264(&profile_guids[i])) { - supported_video_codecs->h264 = true; + supported_video_codecs->h264 = (gsr_supported_video_codec){ true, false }; } else if(profile_is_hevc(&profile_guids[i])) { - supported_video_codecs->hevc = true; + supported_video_codecs->hevc = (gsr_supported_video_codec){ true, false }; } else if(profile_is_hevc_10bit(&profile_guids[i])) { - supported_video_codecs->hevc_hdr = true; - supported_video_codecs->hevc_10bit = true; + supported_video_codecs->hevc_hdr = (gsr_supported_video_codec){ true, false }; + supported_video_codecs->hevc_10bit = (gsr_supported_video_codec){ true, false }; } else if(profile_is_av1(&profile_guids[i])) { - supported_video_codecs->av1 = true; - supported_video_codecs->av1_hdr = true; - supported_video_codecs->av1_10bit = true; + supported_video_codecs->av1 = (gsr_supported_video_codec){ true, false }; + supported_video_codecs->av1_hdr = (gsr_supported_video_codec){ true, false }; + supported_video_codecs->av1_10bit = (gsr_supported_video_codec){ true, false }; } } diff --git a/src/codec_query/vaapi.c b/src/codec_query/vaapi.c index d9f3497..f919131 100644 --- a/src/codec_query/vaapi.c +++ b/src/codec_query/vaapi.c @@ -77,7 +77,8 @@ static bool profile_is_vp9(VAProfile profile) { } } -static bool profile_supports_video_encoding(VADisplay va_dpy, VAProfile profile) { +static bool profile_supports_video_encoding(VADisplay va_dpy, VAProfile profile, bool *low_power) { + *low_power = false; int num_entrypoints = vaMaxNumEntrypoints(va_dpy); if(num_entrypoints <= 0) return false; @@ -86,18 +87,22 @@ static bool profile_supports_video_encoding(VADisplay va_dpy, VAProfile profile) if(!entrypoint_list) return false; - bool supported = false; + bool supports_encoding = false; + bool supports_low_power_encoding = false; if(vaQueryConfigEntrypoints(va_dpy, profile, entrypoint_list, &num_entrypoints) == VA_STATUS_SUCCESS) { for(int i = 0; i < num_entrypoints; ++i) { - if(entrypoint_list[i] == VAEntrypointEncSlice) { - supported = true; - break; - } + if(entrypoint_list[i] == VAEntrypointEncSlice) + supports_encoding = true; + else if(entrypoint_list[i] == VAEntrypointEncSliceLP) + supports_low_power_encoding = true; } } + if(!supports_encoding && supports_low_power_encoding) + *low_power = true; + free(entrypoint_list); - return supported; + return supports_encoding || supports_low_power_encoding; } static bool get_supported_video_codecs(VADisplay va_dpy, gsr_supported_video_codecs *video_codecs, bool cleanup) { @@ -123,29 +128,31 @@ static bool get_supported_video_codecs(VADisplay va_dpy, gsr_supported_video_cod goto fail; for(int i = 0; i < num_profiles; ++i) { + bool low_power = false; if(profile_is_h264(profile_list[i])) { - if(profile_supports_video_encoding(va_dpy, profile_list[i])) - video_codecs->h264 = true; + if(profile_supports_video_encoding(va_dpy, profile_list[i], &low_power)) { + video_codecs->h264 = (gsr_supported_video_codec){ true, low_power }; + } } else if(profile_is_hevc_8bit(profile_list[i])) { - if(profile_supports_video_encoding(va_dpy, profile_list[i])) - video_codecs->hevc = true; + if(profile_supports_video_encoding(va_dpy, profile_list[i], &low_power)) + video_codecs->hevc = (gsr_supported_video_codec){ true, low_power }; } else if(profile_is_hevc_10bit(profile_list[i])) { - if(profile_supports_video_encoding(va_dpy, profile_list[i])) { - video_codecs->hevc_hdr = true; - video_codecs->hevc_10bit = true; + if(profile_supports_video_encoding(va_dpy, profile_list[i], &low_power)) { + video_codecs->hevc_hdr = (gsr_supported_video_codec){ true, low_power }; + video_codecs->hevc_10bit = (gsr_supported_video_codec){ true, low_power }; } } else if(profile_is_av1(profile_list[i])) { - if(profile_supports_video_encoding(va_dpy, profile_list[i])) { - video_codecs->av1 = true; - video_codecs->av1_hdr = true; - video_codecs->av1_10bit = true; + if(profile_supports_video_encoding(va_dpy, profile_list[i], &low_power)) { + video_codecs->av1 = (gsr_supported_video_codec){ true, low_power }; + video_codecs->av1_hdr = (gsr_supported_video_codec){ true, low_power }; + video_codecs->av1_10bit = (gsr_supported_video_codec){ true, low_power }; } } else if(profile_is_vp8(profile_list[i])) { - if(profile_supports_video_encoding(va_dpy, profile_list[i])) - video_codecs->vp8 = true; + if(profile_supports_video_encoding(va_dpy, profile_list[i], &low_power)) + video_codecs->vp8 = (gsr_supported_video_codec){ true, low_power }; } else if(profile_is_vp9(profile_list[i])) { - if(profile_supports_video_encoding(va_dpy, profile_list[i])) - video_codecs->vp9 = true; + if(profile_supports_video_encoding(va_dpy, profile_list[i], &low_power)) + video_codecs->vp9 = (gsr_supported_video_codec){ true, low_power }; } } diff --git a/src/codec_query/vulkan.c b/src/codec_query/vulkan.c index c19c4f7..5e0abe2 100644 --- a/src/codec_query/vulkan.c +++ b/src/codec_query/vulkan.c @@ -147,7 +147,8 @@ bool gsr_get_supported_video_codecs_vulkan(gsr_supported_video_codecs *video_cod free(device_extensions); return success; #else - video_codecs->h264 = true; + // TODO: Low power query + video_codecs->h264 = (gsr_supported_video_codec){ true, false }; return true; #endif } |