diff --git a/src/gallium/drivers/d3d12/d3d12_video_enc.cpp b/src/gallium/drivers/d3d12/d3d12_video_enc.cpp index c9521406bab..cf4f87d311a 100644 --- a/src/gallium/drivers/d3d12/d3d12_video_enc.cpp +++ b/src/gallium/drivers/d3d12/d3d12_video_enc.cpp @@ -387,14 +387,14 @@ d3d12_video_encoder_update_move_rects(struct d3d12_video_encoder *pD3D12Enc, void d3d12_video_encoder_update_dirty_rects(struct d3d12_video_encoder *pD3D12Enc, - const struct pipe_enc_dirty_rects& rects) + const struct pipe_enc_dirty_info& rects) { #if D3D12_VIDEO_USE_NEW_ENCODECMDLIST4_INTERFACE pD3D12Enc->m_currentEncodeConfig.m_DirtyRectsDesc.SourceDPBFrameReference = rects.dpb_reference_index; pD3D12Enc->m_currentEncodeConfig.m_DirtyRectsDesc.FullFrameIdentical = rects.full_frame_skip; pD3D12Enc->m_currentEncodeConfig.m_DirtyRectsDesc.MapValuesType = - (rects.rects_type == PIPE_ENC_DIRTY_RECT_TYPE_DIRTY) ? D3D12_VIDEO_ENCODER_DIRTY_REGIONS_MAP_VALUES_MODE_DIRTY : - D3D12_VIDEO_ENCODER_DIRTY_REGIONS_MAP_VALUES_MODE_SKIP; + (rects.dirty_info_type == PIPE_ENC_DIRTY_INFO_TYPE_DIRTY) ? D3D12_VIDEO_ENCODER_DIRTY_REGIONS_MAP_VALUES_MODE_DIRTY : + D3D12_VIDEO_ENCODER_DIRTY_REGIONS_MAP_VALUES_MODE_SKIP; assert(rects.num_rects <= PIPE_ENC_DIRTY_RECTS_NUM_MAX); pD3D12Enc->m_currentEncodeConfig.m_DirtyRectsDesc.NumDirtyRects = std::min(rects.num_rects, static_cast(PIPE_ENC_DIRTY_RECTS_NUM_MAX)); @@ -1741,7 +1741,7 @@ d3d12_video_encoder_update_current_encoder_config_state(struct d3d12_video_encod ((struct pipe_h264_enc_picture_desc *)picture)->gpu_stats_rc_bitallocation_map); d3d12_video_encoder_update_move_rects(pD3D12Enc, ((struct pipe_h264_enc_picture_desc *)picture)->move_rects); - d3d12_video_encoder_update_dirty_rects(pD3D12Enc, ((struct pipe_h264_enc_picture_desc *)picture)->dirty_rects); + d3d12_video_encoder_update_dirty_rects(pD3D12Enc, ((struct pipe_h264_enc_picture_desc *)picture)->dirty_info); // ...encoder_config_state_h264 calls encoder support cap, set any state before this call bCodecUpdatesSuccess = d3d12_video_encoder_update_current_encoder_config_state_h264(pD3D12Enc, srcTextureDesc, picture); } break; @@ -1755,7 +1755,7 @@ d3d12_video_encoder_update_current_encoder_config_state(struct d3d12_video_encod ((struct pipe_h265_enc_picture_desc *)picture)->gpu_stats_rc_bitallocation_map); d3d12_video_encoder_update_move_rects(pD3D12Enc, ((struct pipe_h265_enc_picture_desc *)picture)->move_rects); - d3d12_video_encoder_update_dirty_rects(pD3D12Enc, ((struct pipe_h265_enc_picture_desc *)picture)->dirty_rects); + d3d12_video_encoder_update_dirty_rects(pD3D12Enc, ((struct pipe_h265_enc_picture_desc *)picture)->dirty_info); // ...encoder_config_state_hevc calls encoder support cap, set any state before this call bCodecUpdatesSuccess = d3d12_video_encoder_update_current_encoder_config_state_hevc(pD3D12Enc, srcTextureDesc, picture); } break; diff --git a/src/gallium/drivers/d3d12/d3d12_video_enc.h b/src/gallium/drivers/d3d12/d3d12_video_enc.h index b418e4da7b6..23a03ebd64c 100644 --- a/src/gallium/drivers/d3d12/d3d12_video_enc.h +++ b/src/gallium/drivers/d3d12/d3d12_video_enc.h @@ -633,7 +633,7 @@ bool d3d12_video_encoder_uses_direct_dpb(enum pipe_video_format codec); void d3d12_video_encoder_update_dirty_rects(struct d3d12_video_encoder *pD3D12Enc, - const struct pipe_enc_dirty_rects& rects); + const struct pipe_enc_dirty_info& rects); void d3d12_video_encoder_update_move_rects(struct d3d12_video_encoder *pD3D12Enc, const struct pipe_enc_move_rects& rects); diff --git a/src/gallium/drivers/d3d12/d3d12_video_screen.cpp b/src/gallium/drivers/d3d12/d3d12_video_screen.cpp index b354e2e937a..b53b1e59ecf 100644 --- a/src/gallium/drivers/d3d12/d3d12_video_screen.cpp +++ b/src/gallium/drivers/d3d12/d3d12_video_screen.cpp @@ -894,7 +894,7 @@ static d3d12_video_encode_get_hevc_codec_support ( const D3D12_VIDEO_ENCODER_COD #if D3D12_VIDEO_USE_NEW_ENCODECMDLIST4_INTERFACE static -union pipe_enc_cap_dirty_rect +union pipe_enc_cap_dirty_info get_dirty_rects_support(D3D12_VIDEO_ENCODER_INPUT_MAP_SESSION_INFO sessionInfo, ID3D12VideoDevice3* pD3D12VideoDevice) { @@ -913,18 +913,18 @@ get_dirty_rects_support(D3D12_VIDEO_ENCODER_INPUT_MAP_SESSION_INFO sessionInfo, 0u }; - union pipe_enc_cap_dirty_rect dirty_rects_support = {}; + union pipe_enc_cap_dirty_info dirty_rects_support = {}; if (SUCCEEDED(pD3D12VideoDevice->CheckFeatureSupport(D3D12_FEATURE_VIDEO_ENCODER_DIRTY_REGIONS, &capDirtyRegions, sizeof(capDirtyRegions)))) { dirty_rects_support.bits.supports_full_frame_skip = (capDirtyRegions.SupportFlags & D3D12_VIDEO_ENCODER_DIRTY_REGIONS_SUPPORT_FLAG_REPEAT_FRAME) ? 1u : 0u; - dirty_rects_support.bits.supports_rect_type_dirty = (capDirtyRegions.SupportFlags & D3D12_VIDEO_ENCODER_DIRTY_REGIONS_SUPPORT_FLAG_DIRTY_REGIONS) ? 1u : 0u; - dirty_rects_support.bits.supports_require_full_row_rects = (capDirtyRegions.SupportFlags & D3D12_VIDEO_ENCODER_DIRTY_REGIONS_SUPPORT_FLAG_DIRTY_REGIONS_REQUIRE_FULL_ROW) ? 1u : 0u; + dirty_rects_support.bits.supports_info_type_dirty = (capDirtyRegions.SupportFlags & D3D12_VIDEO_ENCODER_DIRTY_REGIONS_SUPPORT_FLAG_DIRTY_REGIONS) ? 1u : 0u; + dirty_rects_support.bits.supports_require_full_row = (capDirtyRegions.SupportFlags & D3D12_VIDEO_ENCODER_DIRTY_REGIONS_SUPPORT_FLAG_DIRTY_REGIONS_REQUIRE_FULL_ROW) ? 1u : 0u; } capDirtyRegions.MapValuesType = D3D12_VIDEO_ENCODER_DIRTY_REGIONS_MAP_VALUES_MODE_SKIP; if (SUCCEEDED(pD3D12VideoDevice->CheckFeatureSupport(D3D12_FEATURE_VIDEO_ENCODER_DIRTY_REGIONS, &capDirtyRegions, sizeof(capDirtyRegions)))) { - dirty_rects_support.bits.supports_rect_type_skip = (capDirtyRegions.SupportFlags & D3D12_VIDEO_ENCODER_DIRTY_REGIONS_SUPPORT_FLAG_DIRTY_REGIONS) ? 1u : 0u; + dirty_rects_support.bits.supports_info_type_skip = (capDirtyRegions.SupportFlags & D3D12_VIDEO_ENCODER_DIRTY_REGIONS_SUPPORT_FLAG_DIRTY_REGIONS) ? 1u : 0u; } return dirty_rects_support; @@ -1083,7 +1083,7 @@ d3d12_has_video_encode_support(struct pipe_screen *pscreen, uint32_t &maxIRDuration, union pipe_enc_cap_roi &roi_support, bool &bVideoEncodeRequiresTextureArray, - union pipe_enc_cap_dirty_rect &dirty_rects_support, + union pipe_enc_cap_dirty_info &dirty_rects_support, union pipe_enc_cap_move_rect &move_rects_support, union pipe_enc_cap_gpu_stats_map &gpu_stats_qp, union pipe_enc_cap_gpu_stats_map &gpu_stats_satd, @@ -2107,7 +2107,7 @@ d3d12_screen_get_video_param_encode(struct pipe_screen *pscreen, uint32_t max_tile_cols = 0u; uint32_t maxIRDuration = 0u; union pipe_enc_cap_roi roi_support = {}; - union pipe_enc_cap_dirty_rect dirty_rects_support = {}; + union pipe_enc_cap_dirty_info dirty_rects_support = {}; union pipe_enc_cap_move_rect move_rects_support = {}; struct d3d12_encode_codec_support codec_specific_support; union pipe_enc_cap_gpu_stats_map gpu_stats_qp = {}; @@ -2372,7 +2372,7 @@ d3d12_video_encode_requires_texture_array_dpb(struct d3d12_screen* pScreen, enum union pipe_enc_cap_roi roi_support = {}; struct d3d12_encode_codec_support codec_specific_support; memset(&codec_specific_support, 0, sizeof(codec_specific_support)); - union pipe_enc_cap_dirty_rect dirty_rects_support = {}; + union pipe_enc_cap_dirty_info dirty_rects_support = {}; union pipe_enc_cap_move_rect move_rects_support = {}; union pipe_enc_cap_gpu_stats_map gpu_stats_qp = {}; union pipe_enc_cap_gpu_stats_map gpu_stats_satd = {}; diff --git a/src/gallium/include/pipe/p_video_enums.h b/src/gallium/include/pipe/p_video_enums.h index b1c85887da8..0282b0b406f 100644 --- a/src/gallium/include/pipe/p_video_enums.h +++ b/src/gallium/include/pipe/p_video_enums.h @@ -182,7 +182,7 @@ enum pipe_video_cap */ PIPE_VIDEO_CAP_ENC_MAX_DPB_CAPACITY = 56, /* - * Support for dirty rects in encoder picture params pipe_enc_cap_dirty_rect + * Support for dirty rects in encoder picture params pipe_enc_cap_dirty_info */ PIPE_VIDEO_CAP_ENC_DIRTY_RECTS = 57, /* @@ -227,6 +227,10 @@ enum pipe_video_cap * The returned value is pipe_enc_cap_sliced_notifications */ PIPE_VIDEO_CAP_ENC_SLICED_NOTIFICATIONS = 62, + /* + * Support for dirty maps in encoder picture params pipe_enc_cap_dirty_info + */ + PIPE_VIDEO_CAP_ENC_DIRTY_MAPS = 63, }; enum pipe_video_h264_enc_dbk_filter_mode_flags diff --git a/src/gallium/include/pipe/p_video_state.h b/src/gallium/include/pipe/p_video_state.h index 28f35733388..3c2831a7d84 100644 --- a/src/gallium/include/pipe/p_video_state.h +++ b/src/gallium/include/pipe/p_video_state.h @@ -524,17 +524,30 @@ struct pipe_enc_roi struct pipe_enc_region_in_roi region[PIPE_ENC_ROI_REGION_NUM_MAX]; }; -enum pipe_enc_dirty_rect_type +enum pipe_enc_dirty_info_type { - PIPE_ENC_DIRTY_RECT_TYPE_DIRTY = 0, - PIPE_ENC_DIRTY_RECT_TYPE_SKIP = 1, + PIPE_ENC_DIRTY_INFO_TYPE_DIRTY = 0, + PIPE_ENC_DIRTY_INFO_TYPE_SKIP = 1, }; -struct pipe_enc_dirty_rects +enum pipe_enc_dirty_info_input_mode { - uint8_t dpb_reference_index; /* index in dpb for the recon pic the rects refer to */ + /* Requires PIPE_VIDEO_CAP_ENC_DIRTY_RECTS */ + PIPE_ENC_DIRTY_INFO_INPUT_MODE_RECTS = 0, + /* Requires PIPE_VIDEO_CAP_ENC_DIRTY_MAPS */ + PIPE_ENC_DIRTY_INFO_INPUT_MODE_MAP = 1, +}; + +struct pipe_enc_dirty_info +{ + uint8_t dpb_reference_index; /* index in dpb for the recon pic the info refers to */ bool full_frame_skip; - enum pipe_enc_dirty_rect_type rects_type; + enum pipe_enc_dirty_info_type dirty_info_type; + + /* Selects the input mode and app sets different params below */ + enum pipe_enc_dirty_info_input_mode input_mode; + + /* Used with PIPE_ENC_DIRTY_INFO_INPUT_MODE_RECTS */ unsigned int num_rects; struct { @@ -543,6 +556,9 @@ struct pipe_enc_dirty_rects uint32_t right; uint32_t bottom; } rects[PIPE_ENC_DIRTY_RECTS_NUM_MAX]; + + /* Used with PIPE_ENC_DIRTY_INFO_INPUT_MODE_MAP */ + struct pipe_resource *map; }; enum pipe_enc_move_rects_precision_unit @@ -854,7 +870,7 @@ struct pipe_h264_enc_picture_desc struct pipe_enc_quality_modes quality_modes; struct pipe_enc_intra_refresh intra_refresh; struct pipe_enc_roi roi; - struct pipe_enc_dirty_rects dirty_rects; + struct pipe_enc_dirty_info dirty_info; struct pipe_enc_move_rects move_rects; /* See PIPE_VIDEO_CAP_ENC_GPU_STATS_QP_MAP */ @@ -1246,7 +1262,7 @@ struct pipe_h265_enc_picture_desc struct pipe_enc_quality_modes quality_modes; struct pipe_enc_intra_refresh intra_refresh; struct pipe_enc_roi roi; - struct pipe_enc_dirty_rects dirty_rects; + struct pipe_enc_dirty_info dirty_info; struct pipe_enc_move_rects move_rects; /* See PIPE_VIDEO_CAP_ENC_GPU_STATS_QP_MAP */ @@ -2592,24 +2608,25 @@ union pipe_h265_enc_cap_range_extension_flags { }; /* Used with PIPE_VIDEO_CAP_ENC_DIRTY_RECTS */ -union pipe_enc_cap_dirty_rect { +/* Used with PIPE_VIDEO_CAP_ENC_DIRTY_MAPS */ +union pipe_enc_cap_dirty_info { struct { /* - * Driver Output. Indicates support values for setting pipe_enc_dirty_rects.full_frame_skip + * Driver Output. Indicates support values for setting pipe_enc_dirty_info.full_frame_skip */ uint32_t supports_full_frame_skip: 1; /* - * Driver Output. Indicates support values for setting pipe_enc_dirty_rects.rects_type = PIPE_ENC_DIRTY_RECT_TYPE_SKIP + * Driver Output. Indicates support values for setting pipe_enc_dirty_info.dirty_info_type = PIPE_ENC_DIRTY_INFO_TYPE_SKIP */ - uint32_t supports_rect_type_skip: 1; + uint32_t supports_info_type_skip: 1; /* - * Driver Output. Indicates support values for setting pipe_enc_dirty_rects.rects_type = PIPE_ENC_DIRTY_RECT_TYPE_DIRTY + * Driver Output. Indicates support values for setting pipe_enc_dirty_info.dirty_info_type = PIPE_ENC_DIRTY_INFO_TYPE_DIRTY */ - uint32_t supports_rect_type_dirty: 1; + uint32_t supports_info_type_dirty: 1; /* - * Driver Output. Indicates pipe_enc_dirty_rects.rects must cover an entire row of the frame + * Driver Output. Indicates pipe_enc_dirty_info.rects/input_map must cover an entire row of the frame */ - uint32_t supports_require_full_row_rects: 1; + uint32_t supports_require_full_row: 1; } bits; uint32_t value; };