Mesa (main): d3d12: Fix debug_printf format strings for cross platform builds

GitLab Mirror gitlab-mirror at kemper.freedesktop.org
Wed Jun 29 02:06:40 UTC 2022


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

Author: Sil Vilerino <sivileri at microsoft.com>
Date:   Mon Jun 27 13:46:34 2022 -0400

d3d12: Fix debug_printf format strings for cross platform builds

Reviewed-By: Jesse Natalie <jenatali at microsoft.com>
Tested-by: Andrew Falcon <bluestang2006 at gmail.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/17260>

---

 .../drivers/d3d12/d3d12_video_array_of_textures_dpb_manager.cpp     | 5 +++--
 src/gallium/drivers/d3d12/d3d12_video_dec_h264.cpp                  | 4 ++--
 src/gallium/drivers/d3d12/d3d12_video_dec_references_mgr.cpp        | 2 +-
 src/gallium/drivers/d3d12/d3d12_video_enc.cpp                       | 6 +++---
 src/gallium/drivers/d3d12/d3d12_video_enc_h264.cpp                  | 2 +-
 src/gallium/drivers/d3d12/d3d12_video_texture_array_dpb_manager.cpp | 4 ++--
 6 files changed, 12 insertions(+), 11 deletions(-)

diff --git a/src/gallium/drivers/d3d12/d3d12_video_array_of_textures_dpb_manager.cpp b/src/gallium/drivers/d3d12/d3d12_video_array_of_textures_dpb_manager.cpp
index fd24f5ee83f..dae23585b18 100644
--- a/src/gallium/drivers/d3d12/d3d12_video_array_of_textures_dpb_manager.cpp
+++ b/src/gallium/drivers/d3d12/d3d12_video_array_of_textures_dpb_manager.cpp
@@ -243,10 +243,11 @@ d3d12_array_of_textures_dpb_manager::get_new_tracked_picture_allocation()
 
    if (!bAvailableResourceInPool) {
       // Expand resources pool by one
+      assert(m_ResourcesPool.size() < UINT32_MAX);
       debug_printf(
-         "[d3d12_array_of_textures_dpb_manager] ID3D12Resource Pool capacity (%ld) exceeded - extending capacity "
+         "[d3d12_array_of_textures_dpb_manager] ID3D12Resource Pool capacity (%" PRIu32 ") exceeded - extending capacity "
          "and appending new allocation at the end",
-         m_ResourcesPool.size());
+         static_cast<uint32_t>(m_ResourcesPool.size()));
       d3d12_reusable_resource newPoolEntry = {};
       newPoolEntry.isFree                  = false;
       create_reconstructed_picture_allocations(newPoolEntry.pResource.GetAddressOf());
diff --git a/src/gallium/drivers/d3d12/d3d12_video_dec_h264.cpp b/src/gallium/drivers/d3d12/d3d12_video_dec_h264.cpp
index e0bc13c6a7c..17d77c58325 100644
--- a/src/gallium/drivers/d3d12/d3d12_video_dec_h264.cpp
+++ b/src/gallium/drivers/d3d12/d3d12_video_dec_h264.cpp
@@ -140,7 +140,7 @@ d3d12_video_decoder_prepare_dxva_slices_control_h264(struct d3d12_video_decoder
    debug_printf("[d3d12_video_decoder_h264] Upper layer reported %d slices for this frame, parsing them below...\n",
                   picture_h264->slice_count);
    size_t processedBitstreamBytes = 0u;
-   size_t sliceIdx = 0;
+   uint32_t sliceIdx = 0;
    bool sliceFound = false;
    do {
       DXVA_Slice_H264_Short currentSliceEntry = {};
@@ -156,7 +156,7 @@ d3d12_video_decoder_prepare_dxva_slices_control_h264(struct d3d12_video_decoder
             pD3D12Dec->m_stagingDecodeBitstream[currentSliceEntry.BSNALunitDataLocation +
                                                 (DXVA_H264_START_CODE_LEN_BITS / 8)] &
             0x1F);
-         debug_printf("[d3d12_video_decoder_h264] Detected slice (NALU Type %d) index %ld with size %d and offset %d "
+         debug_printf("[d3d12_video_decoder_h264] Detected slice (NALU Type %d) index %" PRIu32 " with size %d and offset %d "
                         "for frame with "
                         "fenceValue: %d\n",
                         naluType,
diff --git a/src/gallium/drivers/d3d12/d3d12_video_dec_references_mgr.cpp b/src/gallium/drivers/d3d12/d3d12_video_dec_references_mgr.cpp
index 8f170a997c0..827ee85c474 100644
--- a/src/gallium/drivers/d3d12/d3d12_video_dec_references_mgr.cpp
+++ b/src/gallium/drivers/d3d12/d3d12_video_dec_references_mgr.cpp
@@ -432,7 +432,7 @@ d3d12_video_decoder_references_manager::print_dpb()
    debug_printf("[D3D12 Video Decoder Picture Manager] Decode session information:\n"
                "\tDPB Maximum Size (max_ref_count + one_slot_curpic): %d\n"
                "\tDXGI_FORMAT: %d\n"
-               "\tTexture resolution: (%ld, %d)\n"
+               "\tTexture resolution: (%" PRIu64 ", %d)\n"
                "\tD3D12_RESOURCE_FLAG_VIDEO_DECODE_REFERENCE_ONLY enforced: %d\n"
                "\tAllocation Mode: %s\n"
                "\n ----------------------\n\tCurrent frame information:\n"
diff --git a/src/gallium/drivers/d3d12/d3d12_video_enc.cpp b/src/gallium/drivers/d3d12/d3d12_video_enc.cpp
index 8093298a04c..aea05157b18 100644
--- a/src/gallium/drivers/d3d12/d3d12_video_enc.cpp
+++ b/src/gallium/drivers/d3d12/d3d12_video_enc.cpp
@@ -645,7 +645,7 @@ bool d3d12_video_encoder_negotiate_requested_features_and_d3d12_driver_caps(stru
          bool isClientRequestingVBVSizes = ((pD3D12Enc->m_currentEncodeConfig.m_encoderRateControlDesc.m_Flags & D3D12_VIDEO_ENCODER_RATE_CONTROL_FLAG_ENABLE_VBV_SIZES) != 0);
          
          if(isClientRequestingVBVSizes && !isRequestingVBVSizesSupported) {
-            debug_printf("[d3d12_video_encoder] WARNING: Requested D3D12_VIDEO_ENCODER_RATE_CONTROL_FLAG_ENABLE_VBV_SIZES with VBVCapacity (bits): %ld and InitialVBVFullness (bits) %ld is not supported, will continue encoding unsetting this feature as fallback.\n",
+            debug_printf("[d3d12_video_encoder] WARNING: Requested D3D12_VIDEO_ENCODER_RATE_CONTROL_FLAG_ENABLE_VBV_SIZES with VBVCapacity (bits): %" PRIu64 " and InitialVBVFullness (bits) %" PRIu64 " is not supported, will continue encoding unsetting this feature as fallback.\n",
                   pD3D12Enc->m_currentEncodeConfig.m_encoderRateControlDesc.m_Config.m_Configuration_CBR.VBVCapacity,
                   pD3D12Enc->m_currentEncodeConfig.m_encoderRateControlDesc.m_Config.m_Configuration_CBR.InitialVBVFullness);
 
@@ -658,7 +658,7 @@ bool d3d12_video_encoder_negotiate_requested_features_and_d3d12_driver_caps(stru
          bool isClientRequestingPeakFrameSize = ((pD3D12Enc->m_currentEncodeConfig.m_encoderRateControlDesc.m_Flags & D3D12_VIDEO_ENCODER_RATE_CONTROL_FLAG_ENABLE_MAX_FRAME_SIZE) != 0);
 
          if(isClientRequestingPeakFrameSize && !isRequestingPeakFrameSizeSupported) {
-            debug_printf("[d3d12_video_encoder] WARNING: Requested D3D12_VIDEO_ENCODER_RATE_CONTROL_FLAG_ENABLE_MAX_FRAME_SIZE with MaxFrameBitSize %ld but the feature is not supported, will continue encoding unsetting this feature as fallback.\n",
+            debug_printf("[d3d12_video_encoder] WARNING: Requested D3D12_VIDEO_ENCODER_RATE_CONTROL_FLAG_ENABLE_MAX_FRAME_SIZE with MaxFrameBitSize %" PRIu64 " but the feature is not supported, will continue encoding unsetting this feature as fallback.\n",
                pD3D12Enc->m_currentEncodeConfig.m_encoderRateControlDesc.m_Config.m_Configuration_VBR.MaxFrameBitSize);
 
             pD3D12Enc->m_currentEncodeConfig.m_encoderRateControlDesc.m_Flags &= ~D3D12_VIDEO_ENCODER_RATE_CONTROL_FLAG_ENABLE_MAX_FRAME_SIZE;
@@ -1461,7 +1461,7 @@ d3d12_video_encoder_get_feedback(struct pipe_video_codec *codec, void *feedback,
 
    // Read metadata from encoderMetadata
    if (encoderMetadata.EncodeErrorFlags != D3D12_VIDEO_ENCODER_ENCODE_ERROR_FLAG_NO_ERROR) {
-      debug_printf("[d3d12_video_encoder] Encode GPU command failed - EncodeErrorFlags: %ld\n",
+      debug_printf("[d3d12_video_encoder] Encode GPU command failed - EncodeErrorFlags: %" PRIu64 "\n",
                       encoderMetadata.EncodeErrorFlags);
       *size = 0;
    }
diff --git a/src/gallium/drivers/d3d12/d3d12_video_enc_h264.cpp b/src/gallium/drivers/d3d12/d3d12_video_enc_h264.cpp
index 3ceceb12dae..a1fb5cb09dd 100644
--- a/src/gallium/drivers/d3d12/d3d12_video_enc_h264.cpp
+++ b/src/gallium/drivers/d3d12/d3d12_video_enc_h264.cpp
@@ -65,7 +65,7 @@ d3d12_video_encoder_update_current_rate_control_h264(struct d3d12_video_encoder
           */
          if (D3D12_VIDEO_ENC_CBR_FORCE_VBV_EQUAL_BITRATE) {
             debug_printf("[d3d12_video_encoder_h264] d3d12_video_encoder_update_current_rate_control_h264 D3D12_VIDEO_ENC_CBR_FORCE_VBV_EQUAL_BITRATE environment variable is set, "
-                       ", forcing VBV Size = Target Bitrate = %ld (bits)\n", pD3D12Enc->m_currentEncodeConfig.m_encoderRateControlDesc.m_Config.m_Configuration_CBR.TargetBitRate);
+                       ", forcing VBV Size = Target Bitrate = %" PRIu64 " (bits)\n", pD3D12Enc->m_currentEncodeConfig.m_encoderRateControlDesc.m_Config.m_Configuration_CBR.TargetBitRate);
             pD3D12Enc->m_currentEncodeConfig.m_encoderRateControlDesc.m_Flags |=
                D3D12_VIDEO_ENCODER_RATE_CONTROL_FLAG_ENABLE_VBV_SIZES;
             pD3D12Enc->m_currentEncodeConfig.m_encoderRateControlDesc.m_Config.m_Configuration_CBR.VBVCapacity =
diff --git a/src/gallium/drivers/d3d12/d3d12_video_texture_array_dpb_manager.cpp b/src/gallium/drivers/d3d12/d3d12_video_texture_array_dpb_manager.cpp
index 5564454a437..c74941731b3 100644
--- a/src/gallium/drivers/d3d12/d3d12_video_texture_array_dpb_manager.cpp
+++ b/src/gallium/drivers/d3d12/d3d12_video_texture_array_dpb_manager.cpp
@@ -252,8 +252,8 @@ d3d12_texture_array_dpb_manager::get_new_tracked_picture_allocation()
    }
 
    if (!bAvailableResourceInPool) {
-      debug_printf("[d3d12_texture_array_dpb_manager] ID3D12Resource pool is full - Pool capacity (%ld) - Returning null allocation",
-                      m_ResourcesPool.size());
+      debug_printf("[d3d12_texture_array_dpb_manager] ID3D12Resource pool is full - Pool capacity (%" PRIu32 ") - Returning null allocation",
+                      static_cast<uint32_t>(m_ResourcesPool.size()));
    }
 
    return freshAllocation;



More information about the mesa-commit mailing list