Module: Mesa
Branch: main
Commit: 23f07f494204c8b3d58895fcee6b47750f83e1cd
URL:    
http://cgit.freedesktop.org/mesa/mesa/commit/?id=23f07f494204c8b3d58895fcee6b47750f83e1cd

Author: Sil Vilerino <[email protected]>
Date:   Fri Dec  8 09:28:18 2023 -0500

d3d12: Check video encode codec cap before checking encode profile/level cap

Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/26598>

---

 src/gallium/drivers/d3d12/d3d12_video_screen.cpp | 12 ++++++++++++
 1 file changed, 12 insertions(+)

diff --git a/src/gallium/drivers/d3d12/d3d12_video_screen.cpp 
b/src/gallium/drivers/d3d12/d3d12_video_screen.cpp
index 6b4a5cb21c1..07d163da4a0 100644
--- a/src/gallium/drivers/d3d12/d3d12_video_screen.cpp
+++ b/src/gallium/drivers/d3d12/d3d12_video_screen.cpp
@@ -198,6 +198,18 @@ d3d12_video_encode_max_supported_level_for_profile(const 
D3D12_VIDEO_ENCODER_COD
                                                    
D3D12_VIDEO_ENCODER_LEVEL_SETTING &maxLvl,
                                                    ID3D12VideoDevice3 
*pD3D12VideoDevice)
 {
+   D3D12_FEATURE_DATA_VIDEO_ENCODER_CODEC capCodecData = {};
+   capCodecData.NodeIndex = 0;
+   capCodecData.Codec = argCodec;
+   capCodecData.IsSupported = false;
+
+   if 
((FAILED(pD3D12VideoDevice->CheckFeatureSupport(D3D12_FEATURE_VIDEO_ENCODER_CODEC,
+                                                     &capCodecData,
+                                                     sizeof(capCodecData))))
+                                                     || 
!capCodecData.IsSupported) {
+      return false;
+   }
+
    D3D12_FEATURE_DATA_VIDEO_ENCODER_PROFILE_LEVEL capLevelData = {};
    capLevelData.NodeIndex = 0;
    capLevelData.Codec = argCodec;

Reply via email to