radeonsi/vcn: use PIPE_ENC_FEATURE enum
authorRuijing Dong <ruijing.dong@amd.com>
Wed, 19 Apr 2023 01:44:07 +0000 (21:44 -0400)
committerMarge Bot <emma+marge@anholt.net>
Thu, 27 Apr 2023 15:11:35 +0000 (15:11 +0000)
Merge PIPE_H265_ENC_FEATURE into PIPE_ENC_FEATURE enum
because those are common flags, and it will be
used in AV1 encoder as well.

Reviewed-by: Sil Vilerino <sivileri@microsoft.com>
Signed-off-by: Ruijing Dong <ruijing.dong@amd.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/22585>

src/gallium/drivers/d3d12/d3d12_video_screen.cpp
src/gallium/drivers/d3d12/d3d12_video_types.h
src/gallium/drivers/radeonsi/si_get.c
src/gallium/include/pipe/p_video_state.h

index d18be9e..547ae58 100644 (file)
@@ -747,36 +747,36 @@ d3d12_has_video_encode_support(struct pipe_screen *pscreen,
                if(ref_l1)
                   codecSupport.hevc_support.prediction_direction |= PIPE_H265_PRED_DIRECTION_FUTURE;
 
-               codecSupport.hevc_support.hevc_features.bits.separate_colour_planes = PIPE_H265_ENC_FEATURE_NOT_SUPPORTED;
-               codecSupport.hevc_support.hevc_features.bits.scaling_lists = PIPE_H265_ENC_FEATURE_NOT_SUPPORTED;
-               codecSupport.hevc_support.hevc_features.bits.pcm = PIPE_H265_ENC_FEATURE_NOT_SUPPORTED;
-               codecSupport.hevc_support.hevc_features.bits.temporal_mvp = PIPE_H265_ENC_FEATURE_NOT_SUPPORTED;
-               codecSupport.hevc_support.hevc_features.bits.strong_intra_smoothing = PIPE_H265_ENC_FEATURE_NOT_SUPPORTED;
-               codecSupport.hevc_support.hevc_features.bits.dependent_slices = PIPE_H265_ENC_FEATURE_NOT_SUPPORTED;
-               codecSupport.hevc_support.hevc_features.bits.sign_data_hiding = PIPE_H265_ENC_FEATURE_NOT_SUPPORTED;
-               codecSupport.hevc_support.hevc_features.bits.weighted_prediction = PIPE_H265_ENC_FEATURE_NOT_SUPPORTED;
-               codecSupport.hevc_support.hevc_features.bits.transquant_bypass = PIPE_H265_ENC_FEATURE_NOT_SUPPORTED;
-               codecSupport.hevc_support.hevc_features.bits.deblocking_filter_disable = PIPE_H265_ENC_FEATURE_NOT_SUPPORTED;
+               codecSupport.hevc_support.hevc_features.bits.separate_colour_planes = PIPE_ENC_FEATURE_NOT_SUPPORTED;
+               codecSupport.hevc_support.hevc_features.bits.scaling_lists = PIPE_ENC_FEATURE_NOT_SUPPORTED;
+               codecSupport.hevc_support.hevc_features.bits.pcm = PIPE_ENC_FEATURE_NOT_SUPPORTED;
+               codecSupport.hevc_support.hevc_features.bits.temporal_mvp = PIPE_ENC_FEATURE_NOT_SUPPORTED;
+               codecSupport.hevc_support.hevc_features.bits.strong_intra_smoothing = PIPE_ENC_FEATURE_NOT_SUPPORTED;
+               codecSupport.hevc_support.hevc_features.bits.dependent_slices = PIPE_ENC_FEATURE_NOT_SUPPORTED;
+               codecSupport.hevc_support.hevc_features.bits.sign_data_hiding = PIPE_ENC_FEATURE_NOT_SUPPORTED;
+               codecSupport.hevc_support.hevc_features.bits.weighted_prediction = PIPE_ENC_FEATURE_NOT_SUPPORTED;
+               codecSupport.hevc_support.hevc_features.bits.transquant_bypass = PIPE_ENC_FEATURE_NOT_SUPPORTED;
+               codecSupport.hevc_support.hevc_features.bits.deblocking_filter_disable = PIPE_ENC_FEATURE_NOT_SUPPORTED;
 
                /* cu_qp_delta always required to be 1 in https://github.com/microsoft/DirectX-Specs/blob/master/d3d/D3D12VideoEncoding.md */
-               codecSupport.hevc_support.hevc_features.bits.cu_qp_delta = (PIPE_H265_ENC_FEATURE_SUPPORTED | PIPE_H265_ENC_FEATURE_REQUIRED);
+               codecSupport.hevc_support.hevc_features.bits.cu_qp_delta = (PIPE_ENC_FEATURE_SUPPORTED | PIPE_ENC_FEATURE_REQUIRED);
 
                if ((codecSupport.hevc_support.d3d12_caps.SupportFlags & D3D12_VIDEO_ENCODER_CODEC_CONFIGURATION_SUPPORT_HEVC_FLAG_P_FRAMES_IMPLEMENTED_AS_LOW_DELAY_B_FRAMES) != 0)
                   codecSupport.hevc_support.prediction_direction |= PIPE_H265_PRED_DIRECTION_BI_NOT_EMPTY;
 
                if ((codecSupport.hevc_support.d3d12_caps.SupportFlags & D3D12_VIDEO_ENCODER_CODEC_CONFIGURATION_SUPPORT_HEVC_FLAG_ASYMETRIC_MOTION_PARTITION_SUPPORT) != 0)
-                  codecSupport.hevc_support.hevc_features.bits.amp = PIPE_H265_ENC_FEATURE_SUPPORTED;
+                  codecSupport.hevc_support.hevc_features.bits.amp = PIPE_ENC_FEATURE_SUPPORTED;
 
                if ((codecSupport.hevc_support.d3d12_caps.SupportFlags & D3D12_VIDEO_ENCODER_CODEC_CONFIGURATION_SUPPORT_HEVC_FLAG_ASYMETRIC_MOTION_PARTITION_REQUIRED) != 0)
-                  codecSupport.hevc_support.hevc_features.bits.amp = (PIPE_H265_ENC_FEATURE_SUPPORTED | PIPE_H265_ENC_FEATURE_REQUIRED);
+                  codecSupport.hevc_support.hevc_features.bits.amp = (PIPE_ENC_FEATURE_SUPPORTED | PIPE_ENC_FEATURE_REQUIRED);
 
                if ((codecSupport.hevc_support.d3d12_caps.SupportFlags & D3D12_VIDEO_ENCODER_CODEC_CONFIGURATION_SUPPORT_HEVC_FLAG_SAO_FILTER_SUPPORT) != 0)
-                  codecSupport.hevc_support.hevc_features.bits.sao = PIPE_H265_ENC_FEATURE_SUPPORTED;
+                  codecSupport.hevc_support.hevc_features.bits.sao = PIPE_ENC_FEATURE_SUPPORTED;
 
                if ((codecSupport.hevc_support.d3d12_caps.SupportFlags & D3D12_VIDEO_ENCODER_CODEC_CONFIGURATION_SUPPORT_HEVC_FLAG_CONSTRAINED_INTRAPREDICTION_SUPPORT) != 0)
-                  codecSupport.hevc_support.hevc_features.bits.constrained_intra_pred = PIPE_H265_ENC_FEATURE_SUPPORTED;
+                  codecSupport.hevc_support.hevc_features.bits.constrained_intra_pred = PIPE_ENC_FEATURE_SUPPORTED;
                if ((codecSupport.hevc_support.d3d12_caps.SupportFlags & D3D12_VIDEO_ENCODER_CODEC_CONFIGURATION_SUPPORT_HEVC_FLAG_TRANSFORM_SKIP_SUPPORT) != 0)
-                  codecSupport.hevc_support.hevc_features.bits.transform_skip = PIPE_H265_ENC_FEATURE_SUPPORTED;
+                  codecSupport.hevc_support.hevc_features.bits.transform_skip = PIPE_ENC_FEATURE_SUPPORTED;
 
                DXGI_FORMAT encodeFormat = d3d12_convert_pipe_video_profile_to_dxgi_format(profile);
                supportsProfile = supportsProfile &&
index 08059dd..348c3a9 100644 (file)
@@ -62,7 +62,7 @@ GetDesc(ID3D12VideoDecoderHeap *heap)
 */
 const bool D3D12_VIDEO_ENC_CBR_FORCE_VBV_EQUAL_BITRATE = debug_get_bool_option("D3D12_VIDEO_ENC_CBR_FORCE_VBV_EQUAL_BITRATE", false);
 
-// Allow encoder to continue the encoding session when aa slice mode 
+// Allow encoder to continue the encoding session when aa slice mode
 // is requested but not supported.
 //
 // If setting this OS Env variable to true, the encoder will try to adjust to the closest slice
@@ -136,16 +136,16 @@ D3D12_VIDEO_ENCODER_CODEC
 d3d12_video_encoder_convert_codec_to_d3d12_enc_codec(enum pipe_video_profile profile);
 GUID
 d3d12_video_decoder_convert_pipe_video_profile_to_d3d12_profile(enum pipe_video_profile profile);
-D3D12_VIDEO_ENCODER_CODEC_CONFIGURATION_HEVC_TUSIZE 
+D3D12_VIDEO_ENCODER_CODEC_CONFIGURATION_HEVC_TUSIZE
 d3d12_video_encoder_convert_pixel_size_hevc_to_12tusize(const uint32_t& TUSize);
 D3D12_VIDEO_ENCODER_CODEC_CONFIGURATION_HEVC_CUSIZE
 d3d12_video_encoder_convert_pixel_size_hevc_to_12cusize(const uint32_t& cuSize);
 uint8_t
 d3d12_video_encoder_convert_12cusize_to_pixel_size_hevc(const D3D12_VIDEO_ENCODER_CODEC_CONFIGURATION_HEVC_CUSIZE& cuSize);
-uint8_t 
+uint8_t
 d3d12_video_encoder_convert_12tusize_to_pixel_size_hevc(const D3D12_VIDEO_ENCODER_CODEC_CONFIGURATION_HEVC_TUSIZE& TUSize);
 
-DEFINE_ENUM_FLAG_OPERATORS(pipe_h265_enc_feature);
+DEFINE_ENUM_FLAG_OPERATORS(pipe_enc_feature);
 DEFINE_ENUM_FLAG_OPERATORS(pipe_h265_enc_pred_direction);
 
 #endif
index 26c5f2a..a943614 100644 (file)
@@ -652,13 +652,13 @@ static int si_get_video_param(struct pipe_screen *screen, enum pipe_video_profil
             union pipe_h265_enc_cap_features pipe_features;
             pipe_features.value = 0;
 
-            pipe_features.bits.amp = PIPE_H265_ENC_FEATURE_SUPPORTED;
-            pipe_features.bits.strong_intra_smoothing = PIPE_H265_ENC_FEATURE_SUPPORTED;
-            pipe_features.bits.constrained_intra_pred = PIPE_H265_ENC_FEATURE_SUPPORTED;
+            pipe_features.bits.amp = PIPE_ENC_FEATURE_SUPPORTED;
+            pipe_features.bits.strong_intra_smoothing = PIPE_ENC_FEATURE_SUPPORTED;
+            pipe_features.bits.constrained_intra_pred = PIPE_ENC_FEATURE_SUPPORTED;
             pipe_features.bits.deblocking_filter_disable
-                                                      = PIPE_H265_ENC_FEATURE_SUPPORTED;
+                                                      = PIPE_ENC_FEATURE_SUPPORTED;
             if (sscreen->info.family >= CHIP_RENOIR)
-               pipe_features.bits.sao = PIPE_H265_ENC_FEATURE_SUPPORTED;
+               pipe_features.bits.sao = PIPE_ENC_FEATURE_SUPPORTED;
 
             return pipe_features.value;
          } else
index dd36897..ac64d63 100644 (file)
@@ -127,6 +127,14 @@ enum pipe_h265_slice_type
    PIPE_H265_SLICE_TYPE_I = 0x2,
 };
 
+/* To be used on each encoding feature bit field */
+enum pipe_enc_feature
+{
+   PIPE_ENC_FEATURE_NOT_SUPPORTED = 0x0,
+   PIPE_ENC_FEATURE_SUPPORTED = 0x1,
+   PIPE_ENC_FEATURE_REQUIRED = 0x2,
+};
+
 /* Same enum for h264/h265 */
 enum pipe_h2645_enc_picture_type
 {
@@ -1294,16 +1302,6 @@ enum pipe_h265_enc_pred_direction
    PIPE_H265_PRED_DIRECTION_BI_NOT_EMPTY = 0x4,
 };
 
-/* To be used on each h265 feature bit field
-   defined in pipe_h265_enc_cap_features
-*/
-enum pipe_h265_enc_feature
-{
-   PIPE_H265_ENC_FEATURE_NOT_SUPPORTED = 0x0,
-   PIPE_H265_ENC_FEATURE_SUPPORTED = 0x1,
-   PIPE_H265_ENC_FEATURE_REQUIRED = 0x2,
-};
-
 /* To be used with PIPE_VIDEO_CAP_ENC_HEVC_FEATURE_FLAGS
    the config_supported bit is used to differenciate a supported
    config with all bits as zero and unsupported by driver with value=0