mirror of
https://gitlab.freedesktop.org/mesa/mesa.git
synced 2025-12-28 08:10:09 +01:00
pipe: Add support for (GPU Input) motion maps
Reviewed-By: Pohsiang Hsu <pohhsu@microsoft.com> Reviewed-by: Ruijing Dong <ruijing.dong@amd.com> Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/34844>
This commit is contained in:
parent
2c193547ca
commit
7312db4827
4 changed files with 91 additions and 21 deletions
|
|
@ -339,7 +339,7 @@ d3d12_video_encoder_friendly_frame_type_h264(D3D12_VIDEO_ENCODER_FRAME_TYPE_H264
|
|||
|
||||
void
|
||||
d3d12_video_encoder_update_move_rects(struct d3d12_video_encoder *pD3D12Enc,
|
||||
const struct pipe_enc_move_rects& rects)
|
||||
const struct pipe_enc_move_info& rects)
|
||||
{
|
||||
#if D3D12_VIDEO_USE_NEW_ENCODECMDLIST4_INTERFACE
|
||||
assert(rects.num_rects <= PIPE_ENC_MOVE_RECTS_NUM_MAX);
|
||||
|
|
@ -365,21 +365,21 @@ d3d12_video_encoder_update_move_rects(struct d3d12_video_encoder *pD3D12Enc,
|
|||
|
||||
switch (rects.precision)
|
||||
{
|
||||
case PIPE_ENC_MOVE_RECTS_PRECISION_UNIT_FULL_PIXEL:
|
||||
case PIPE_ENC_MOVE_INFO_PRECISION_UNIT_FULL_PIXEL:
|
||||
{
|
||||
pD3D12Enc->m_currentEncodeConfig.m_MoveRectsDesc.MotionUnitPrecision = D3D12_VIDEO_ENCODER_FRAME_INPUT_MOTION_UNIT_PRECISION_FULL_PIXEL;
|
||||
} break;
|
||||
case PIPE_ENC_MOVE_RECTS_PRECISION_UNIT_HALF_PIXEL:
|
||||
case PIPE_ENC_MOVE_INFO_PRECISION_UNIT_HALF_PIXEL:
|
||||
{
|
||||
pD3D12Enc->m_currentEncodeConfig.m_MoveRectsDesc.MotionUnitPrecision = D3D12_VIDEO_ENCODER_FRAME_INPUT_MOTION_UNIT_PRECISION_HALF_PIXEL;
|
||||
} break;
|
||||
case PIPE_ENC_MOVE_RECTS_PRECISION_UNIT_QUARTER_PIXEL:
|
||||
case PIPE_ENC_MOVE_INFO_PRECISION_UNIT_QUARTER_PIXEL:
|
||||
{
|
||||
pD3D12Enc->m_currentEncodeConfig.m_MoveRectsDesc.MotionUnitPrecision = D3D12_VIDEO_ENCODER_FRAME_INPUT_MOTION_UNIT_PRECISION_QUARTER_PIXEL;
|
||||
} break;
|
||||
default:
|
||||
{
|
||||
unreachable("Unsupported pipe_enc_move_rects");
|
||||
unreachable("Unsupported pipe_enc_move_info");
|
||||
} break;
|
||||
}
|
||||
#endif
|
||||
|
|
@ -1936,7 +1936,7 @@ d3d12_video_encoder_update_current_encoder_config_state(struct d3d12_video_encod
|
|||
((struct pipe_h264_enc_picture_desc *)picture)->gpu_stats_satd_map,
|
||||
((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_move_rects(pD3D12Enc, ((struct pipe_h264_enc_picture_desc *)picture)->move_info);
|
||||
d3d12_video_encoder_update_dirty_rects(pD3D12Enc, ((struct pipe_h264_enc_picture_desc *)picture)->dirty_info);
|
||||
d3d12_video_encoder_update_qpmap_input(pD3D12Enc, ((struct pipe_h264_enc_picture_desc *)picture)->input_gpu_qpmap,
|
||||
((struct pipe_h264_enc_picture_desc *)picture)->roi,
|
||||
|
|
@ -1953,7 +1953,7 @@ d3d12_video_encoder_update_current_encoder_config_state(struct d3d12_video_encod
|
|||
((struct pipe_h265_enc_picture_desc *)picture)->gpu_stats_satd_map,
|
||||
((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_move_rects(pD3D12Enc, ((struct pipe_h265_enc_picture_desc *)picture)->move_info);
|
||||
d3d12_video_encoder_update_dirty_rects(pD3D12Enc, ((struct pipe_h265_enc_picture_desc *)picture)->dirty_info);
|
||||
d3d12_video_encoder_update_qpmap_input(pD3D12Enc, ((struct pipe_h265_enc_picture_desc *)picture)->input_gpu_qpmap,
|
||||
((struct pipe_h265_enc_picture_desc *)picture)->roi,
|
||||
|
|
|
|||
|
|
@ -664,7 +664,7 @@ d3d12_video_encoder_update_dirty_rects(struct d3d12_video_encoder *pD3D12Enc,
|
|||
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);
|
||||
const struct pipe_enc_move_info& rects);
|
||||
void
|
||||
d3d12_video_encoder_update_output_stats_resources(struct d3d12_video_encoder *pD3D12Enc,
|
||||
struct pipe_resource* qpmap,
|
||||
|
|
|
|||
|
|
@ -235,6 +235,10 @@ enum pipe_video_cap
|
|||
* Support for QP maps in encoder picture params pipe_enc_cap_qpmap
|
||||
*/
|
||||
PIPE_VIDEO_CAP_ENC_QP_MAPS = 64,
|
||||
/*
|
||||
* Support for motion vector maps in encoder picture params pipe_enc_cap_motion_vector_map
|
||||
*/
|
||||
PIPE_VIDEO_CAP_ENC_MOTION_VECTOR_MAPS = 65,
|
||||
};
|
||||
|
||||
enum pipe_video_h264_enc_dbk_filter_mode_flags
|
||||
|
|
|
|||
|
|
@ -561,15 +561,35 @@ struct pipe_enc_dirty_info
|
|||
struct pipe_resource *map;
|
||||
};
|
||||
|
||||
enum pipe_enc_move_rects_precision_unit
|
||||
enum pipe_enc_move_info_precision_unit
|
||||
{
|
||||
PIPE_ENC_MOVE_RECTS_PRECISION_UNIT_FULL_PIXEL = 0,
|
||||
PIPE_ENC_MOVE_RECTS_PRECISION_UNIT_HALF_PIXEL = 1,
|
||||
PIPE_ENC_MOVE_RECTS_PRECISION_UNIT_QUARTER_PIXEL = 2,
|
||||
PIPE_ENC_MOVE_INFO_PRECISION_UNIT_FULL_PIXEL = 0,
|
||||
PIPE_ENC_MOVE_INFO_PRECISION_UNIT_HALF_PIXEL = 1,
|
||||
PIPE_ENC_MOVE_INFO_PRECISION_UNIT_QUARTER_PIXEL = 2,
|
||||
};
|
||||
|
||||
struct pipe_enc_move_rects
|
||||
enum pipe_enc_move_info_input_mode
|
||||
{
|
||||
PIPE_ENC_MOVE_INFO_INPUT_MODE_DISABLED = 0,
|
||||
/* Requires PIPE_VIDEO_CAP_ENC_MOVE_RECTS */
|
||||
PIPE_ENC_MOVE_INFO_INPUT_MODE_RECTS = 1,
|
||||
/* Requires PIPE_VIDEO_CAP_ENC_MOTION_VECTOR_MAPS */
|
||||
PIPE_ENC_MOVE_INFO_INPUT_MODE_MAP = 2,
|
||||
};
|
||||
|
||||
struct pipe_enc_move_info
|
||||
{
|
||||
enum pipe_enc_move_info_input_mode input_mode;
|
||||
|
||||
/* Used with PIPE_ENC_MOVE_INFO_INPUT_MODE_MAP */
|
||||
/* Contains the motion hints */
|
||||
struct pipe_resource *gpu_motion_vectors_map[PIPE_ENC_MOVE_MAP_MAX_HINTS];
|
||||
/* contains the DPB index the motion hints apply to, or 255 if no motion hint */
|
||||
struct pipe_resource *gpu_motion_metadata_map[PIPE_ENC_MOVE_MAP_MAX_HINTS];
|
||||
/* Indicates how many entries to gpu_motion_vectors_map and gpu_motion_metadata_map */
|
||||
uint32_t num_hints;
|
||||
|
||||
/* Used with PIPE_ENC_MOVE_INFO_INPUT_MODE_RECTS */
|
||||
unsigned int num_rects;
|
||||
struct
|
||||
{
|
||||
|
|
@ -585,7 +605,7 @@ struct pipe_enc_move_rects
|
|||
} dest_rect;
|
||||
} rects[PIPE_ENC_MOVE_RECTS_NUM_MAX];
|
||||
uint8_t dpb_reference_index; /* index in dpb for the recon pic the rects refer to */
|
||||
enum pipe_enc_move_rects_precision_unit precision;
|
||||
enum pipe_enc_move_info_precision_unit precision;
|
||||
bool overlapping_rects;
|
||||
};
|
||||
|
||||
|
|
@ -871,7 +891,7 @@ struct pipe_h264_enc_picture_desc
|
|||
struct pipe_enc_intra_refresh intra_refresh;
|
||||
struct pipe_enc_roi roi;
|
||||
struct pipe_enc_dirty_info dirty_info;
|
||||
struct pipe_enc_move_rects move_rects;
|
||||
struct pipe_enc_move_info move_info;
|
||||
|
||||
/* See PIPE_VIDEO_CAP_ENC_GPU_STATS_QP_MAP */
|
||||
struct pipe_resource *gpu_stats_qp_map;
|
||||
|
|
@ -1266,7 +1286,7 @@ struct pipe_h265_enc_picture_desc
|
|||
struct pipe_enc_intra_refresh intra_refresh;
|
||||
struct pipe_enc_roi roi;
|
||||
struct pipe_enc_dirty_info dirty_info;
|
||||
struct pipe_enc_move_rects move_rects;
|
||||
struct pipe_enc_move_info move_info;
|
||||
|
||||
/* See PIPE_VIDEO_CAP_ENC_GPU_STATS_QP_MAP */
|
||||
struct pipe_resource *gpu_stats_qp_map;
|
||||
|
|
@ -2643,23 +2663,23 @@ union pipe_enc_cap_dirty_info {
|
|||
union pipe_enc_cap_move_rect {
|
||||
struct {
|
||||
/*
|
||||
* Driver Output. Indicates support for setting up to max_motion_hints in pipe_enc_move_rects.rects when max_motion_hints > 0.
|
||||
* Driver Output. Indicates support for setting up to max_motion_hints in pipe_enc_move_info.rects when max_motion_hints > 0.
|
||||
*/
|
||||
uint32_t max_motion_hints: 16;
|
||||
/*
|
||||
* Driver Output. Indicates support for sending overlapped rects in pipe_enc_move_rects.rects
|
||||
* Driver Output. Indicates support for sending overlapped rects in pipe_enc_move_info.rects
|
||||
*/
|
||||
uint32_t supports_overlapped_rects: 1;
|
||||
/*
|
||||
* Driver Output. Indicates support for setting in pipe_enc_move_rects.precision = PIPE_ENC_MOVE_RECTS_PRECISION_UNIT_FULL_PIXEL
|
||||
* Driver Output. Indicates support for setting in pipe_enc_move_info.precision = PIPE_ENC_MOVE_INFO_PRECISION_UNIT_FULL_PIXEL
|
||||
*/
|
||||
uint32_t supports_precision_full_pixel: 1;
|
||||
/*
|
||||
* Driver Output. Indicates support for setting in pipe_enc_move_rects.precision = PIPE_ENC_MOVE_RECTS_PRECISION_UNIT_HALF_PIXEL
|
||||
* Driver Output. Indicates support for setting in pipe_enc_move_info.precision = PIPE_ENC_MOVE_INFO_PRECISION_UNIT_HALF_PIXEL
|
||||
*/
|
||||
uint32_t supports_precision_half_pixel: 1;
|
||||
/*
|
||||
* Driver Output. Indicates support for setting in pipe_enc_move_rects.precision = PIPE_ENC_MOVE_RECTS_PRECISION_UNIT_QUARTER_PIXEL
|
||||
* Driver Output. Indicates support for setting in pipe_enc_move_info.precision = PIPE_ENC_MOVE_INFO_PRECISION_UNIT_QUARTER_PIXEL
|
||||
*/
|
||||
uint32_t supports_precision_quarter_pixel: 1;
|
||||
} bits;
|
||||
|
|
@ -2742,6 +2762,52 @@ union pipe_enc_cap_qpmap {
|
|||
uint32_t value;
|
||||
};
|
||||
|
||||
/* Used with PIPE_VIDEO_CAP_ENC_MOTION_VECTOR_MAPS */
|
||||
union pipe_enc_cap_motion_vector_map {
|
||||
struct {
|
||||
/*
|
||||
* Driver Output. Indicates how many hint maps are supported in the
|
||||
* motion maps array. Zero indicates no support
|
||||
* for the feature.
|
||||
*/
|
||||
uint32_t max_motion_hints: 5; /* Max 31 hints. */
|
||||
/*
|
||||
* Driver Output. Indicates the precision of the motion vectors passed in the motion vectors map
|
||||
*/
|
||||
/*
|
||||
* Driver Output. Indicates support for setting in pipe_enc_move_info.precision = PIPE_ENC_MOVE_INFO_PRECISION_UNIT_FULL_PIXEL
|
||||
*/
|
||||
uint32_t supports_precision_full_pixel: 1;
|
||||
/*
|
||||
* Driver Output. Indicates support for setting in pipe_enc_move_info.precision = PIPE_ENC_MOVE_INFO_PRECISION_UNIT_HALF_PIXEL
|
||||
*/
|
||||
uint32_t supports_precision_half_pixel: 1;
|
||||
/*
|
||||
* Driver Output. Indicates support for setting in pipe_enc_move_info.precision = PIPE_ENC_MOVE_INFO_PRECISION_UNIT_QUARTER_PIXEL
|
||||
*/
|
||||
uint32_t supports_precision_quarter_pixel: 1;
|
||||
/*
|
||||
* Driver Output. Indicates if the different motion vectors
|
||||
* in the maps can point to different references in the DPB
|
||||
* or all must point to the same one on a given frame.
|
||||
*/
|
||||
uint32_t support_multiple_dpb_refs: 1;
|
||||
/*
|
||||
* Driver Output. Indicates the pipe_format required for
|
||||
* the pipe_resource allocation with the motion vectors map
|
||||
* passed to the driver
|
||||
*/
|
||||
uint32_t pipe_pixel_vectors_map_format: 9; /* 9 bits for pipe_format < PIPE_FORMAT_COUNT */
|
||||
/*
|
||||
* Driver Output. Indicates the pipe_format required for
|
||||
* the pipe_resource allocation with the motion vectors metadata map
|
||||
* passed to the driver
|
||||
*/
|
||||
uint32_t pipe_pixel_vectors_metadata_map_format: 9; /* 9 bits for pipe_format < PIPE_FORMAT_COUNT */
|
||||
} bits;
|
||||
uint32_t value;
|
||||
};
|
||||
|
||||
#ifdef __cplusplus
|
||||
}
|
||||
#endif
|
||||
|
|
|
|||
Loading…
Add table
Reference in a new issue