mirror of
https://gitlab.freedesktop.org/mesa/mesa.git
synced 2026-01-05 09:00:08 +01:00
ac/vcn: allow sq signature package to be skipped
This is preparing for radv event support on pre-VCN4 encode queues. Reviewed-by: Dave Airlie <airlied@redhat.com> Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/32400>
This commit is contained in:
parent
25c0a11cf7
commit
152b06acd8
6 changed files with 49 additions and 34 deletions
|
|
@ -38,8 +38,9 @@
|
|||
#define RADEON_VCN_IB_COMMON_OP_WRITEMEMORY (0x33000001)
|
||||
|
||||
struct rvcn_sq_var {
|
||||
unsigned int *ib_total_size_in_dw;
|
||||
unsigned int *ib_checksum;
|
||||
unsigned int *signature_ib_checksum;
|
||||
unsigned int *signature_ib_total_size_in_dw;
|
||||
unsigned int *engine_ib_size_of_packages;
|
||||
};
|
||||
|
||||
struct rvcn_cmn_engine_ib_package {
|
||||
|
|
|
|||
|
|
@ -61,20 +61,26 @@ radv_vid_buffer_upload_alloc(struct radv_cmd_buffer *cmd_buffer, unsigned size,
|
|||
|
||||
/* vcn unified queue (sq) ib header */
|
||||
void
|
||||
radv_vcn_sq_header(struct radeon_cmdbuf *cs, struct rvcn_sq_var *sq, unsigned type)
|
||||
radv_vcn_sq_header(struct radeon_cmdbuf *cs, struct rvcn_sq_var *sq, unsigned type, bool skip_signature)
|
||||
{
|
||||
/* vcn ib signature */
|
||||
radeon_emit(cs, RADEON_VCN_SIGNATURE_SIZE);
|
||||
radeon_emit(cs, RADEON_VCN_SIGNATURE);
|
||||
sq->ib_checksum = &cs->buf[cs->cdw];
|
||||
radeon_emit(cs, 0);
|
||||
sq->ib_total_size_in_dw = &cs->buf[cs->cdw];
|
||||
radeon_emit(cs, 0);
|
||||
if (!skip_signature) {
|
||||
/* vcn ib signature */
|
||||
radeon_emit(cs, RADEON_VCN_SIGNATURE_SIZE);
|
||||
radeon_emit(cs, RADEON_VCN_SIGNATURE);
|
||||
sq->signature_ib_checksum = &cs->buf[cs->cdw];
|
||||
radeon_emit(cs, 0);
|
||||
sq->signature_ib_total_size_in_dw = &cs->buf[cs->cdw];
|
||||
radeon_emit(cs, 0);
|
||||
} else {
|
||||
sq->signature_ib_checksum = NULL;
|
||||
sq->signature_ib_total_size_in_dw = NULL;
|
||||
}
|
||||
|
||||
/* vcn ib engine info */
|
||||
radeon_emit(cs, RADEON_VCN_ENGINE_INFO_SIZE);
|
||||
radeon_emit(cs, RADEON_VCN_ENGINE_INFO);
|
||||
radeon_emit(cs, type);
|
||||
sq->engine_ib_size_of_packages = &cs->buf[cs->cdw];
|
||||
radeon_emit(cs, 0);
|
||||
}
|
||||
|
||||
|
|
@ -85,18 +91,24 @@ radv_vcn_sq_tail(struct radeon_cmdbuf *cs, struct rvcn_sq_var *sq)
|
|||
uint32_t size_in_dw;
|
||||
uint32_t checksum = 0;
|
||||
|
||||
if (sq->ib_checksum == NULL || sq->ib_total_size_in_dw == NULL)
|
||||
return;
|
||||
|
||||
end = &cs->buf[cs->cdw];
|
||||
size_in_dw = end - sq->ib_total_size_in_dw - 1;
|
||||
*sq->ib_total_size_in_dw = size_in_dw;
|
||||
*(sq->ib_total_size_in_dw + 4) = size_in_dw * sizeof(uint32_t);
|
||||
|
||||
for (int i = 0; i < size_in_dw; i++)
|
||||
checksum += *(sq->ib_checksum + 2 + i);
|
||||
if (sq->signature_ib_checksum == NULL && sq->signature_ib_total_size_in_dw == NULL) {
|
||||
if (sq->engine_ib_size_of_packages == NULL)
|
||||
return;
|
||||
|
||||
*sq->ib_checksum = checksum;
|
||||
size_in_dw = end - sq->engine_ib_size_of_packages + 3; /* package_size, package_type, engine_type */
|
||||
*sq->engine_ib_size_of_packages = size_in_dw * sizeof(uint32_t);
|
||||
} else {
|
||||
size_in_dw = end - sq->signature_ib_total_size_in_dw - 1;
|
||||
*sq->signature_ib_total_size_in_dw = size_in_dw;
|
||||
|
||||
for (int i = 0; i < size_in_dw; i++)
|
||||
checksum += *(sq->signature_ib_checksum + 2 + i);
|
||||
|
||||
*sq->signature_ib_checksum = checksum;
|
||||
*sq->engine_ib_size_of_packages = size_in_dw * sizeof(uint32_t);
|
||||
}
|
||||
}
|
||||
|
||||
void
|
||||
|
|
@ -114,7 +126,7 @@ radv_vcn_write_event(struct radv_cmd_buffer *cmd_buffer, struct radv_event *even
|
|||
uint64_t va = radv_buffer_get_va(event->bo);
|
||||
|
||||
radeon_check_space(device->ws, cs, 256);
|
||||
radv_vcn_sq_header(cs, &sq, RADEON_VCN_ENGINE_TYPE_COMMON);
|
||||
radv_vcn_sq_header(cs, &sq, RADEON_VCN_ENGINE_TYPE_COMMON, false);
|
||||
struct rvcn_cmn_engine_ib_package *ib_header = (struct rvcn_cmn_engine_ib_package *)&(cs->buf[cs->cdw]);
|
||||
ib_header->package_size = sizeof(struct rvcn_cmn_engine_ib_package) + sizeof(struct rvcn_cmn_engine_op_writememory);
|
||||
cs->cdw++;
|
||||
|
|
@ -136,7 +148,7 @@ radv_vcn_sq_start(struct radv_cmd_buffer *cmd_buffer)
|
|||
struct radv_device *device = radv_cmd_buffer_device(cmd_buffer);
|
||||
|
||||
radeon_check_space(device->ws, cmd_buffer->cs, 256);
|
||||
radv_vcn_sq_header(cmd_buffer->cs, &cmd_buffer->video.sq, RADEON_VCN_ENGINE_TYPE_DECODE);
|
||||
radv_vcn_sq_header(cmd_buffer->cs, &cmd_buffer->video.sq, RADEON_VCN_ENGINE_TYPE_DECODE, false);
|
||||
rvcn_decode_ib_package_t *ib_header = (rvcn_decode_ib_package_t *)&(cmd_buffer->cs->buf[cmd_buffer->cs->cdw]);
|
||||
ib_header->package_size = sizeof(struct rvcn_decode_buffer_s) + sizeof(struct rvcn_decode_ib_package_s);
|
||||
cmd_buffer->cs->cdw++;
|
||||
|
|
|
|||
|
|
@ -71,8 +71,7 @@ void radv_init_physical_device_decoder(struct radv_physical_device *pdev);
|
|||
void radv_video_get_profile_alignments(struct radv_physical_device *pdev, const VkVideoProfileListInfoKHR *profile_list,
|
||||
uint32_t *width_align_out, uint32_t *height_align_out);
|
||||
|
||||
void radv_vcn_sq_header(struct radeon_cmdbuf *cs, struct rvcn_sq_var *sq, unsigned type);
|
||||
|
||||
void radv_vcn_sq_header(struct radeon_cmdbuf *cs, struct rvcn_sq_var *sq, unsigned type, bool skip_signature);
|
||||
void radv_vcn_sq_tail(struct radeon_cmdbuf *cs, struct rvcn_sq_var *sq);
|
||||
void radv_vcn_write_event(struct radv_cmd_buffer *cmd_buffer, struct radv_event *event, unsigned value);
|
||||
|
||||
|
|
|
|||
|
|
@ -2029,7 +2029,7 @@ radv_video_enc_begin_coding(struct radv_cmd_buffer *cmd_buffer)
|
|||
radeon_check_space(device->ws, cmd_buffer->cs, 1024);
|
||||
|
||||
if (pdev->enc_hw_ver >= RADV_VIDEO_ENC_HW_4)
|
||||
radv_vcn_sq_header(cmd_buffer->cs, &cmd_buffer->video.sq, RADEON_VCN_ENGINE_TYPE_ENCODE);
|
||||
radv_vcn_sq_header(cmd_buffer->cs, &cmd_buffer->video.sq, RADEON_VCN_ENGINE_TYPE_ENCODE, false);
|
||||
}
|
||||
|
||||
void
|
||||
|
|
|
|||
|
|
@ -14,9 +14,9 @@ void rvcn_sq_header(struct radeon_cmdbuf *cs,
|
|||
/* vcn ib signature */
|
||||
radeon_emit(cs, RADEON_VCN_SIGNATURE_SIZE);
|
||||
radeon_emit(cs, RADEON_VCN_SIGNATURE);
|
||||
sq->ib_checksum = &cs->current.buf[cs->current.cdw];
|
||||
sq->signature_ib_checksum = &cs->current.buf[cs->current.cdw];
|
||||
radeon_emit(cs, 0);
|
||||
sq->ib_total_size_in_dw = &cs->current.buf[cs->current.cdw];
|
||||
sq->signature_ib_total_size_in_dw = &cs->current.buf[cs->current.cdw];
|
||||
radeon_emit(cs, 0);
|
||||
|
||||
/* vcn ib engine info */
|
||||
|
|
@ -24,6 +24,7 @@ void rvcn_sq_header(struct radeon_cmdbuf *cs,
|
|||
radeon_emit(cs, RADEON_VCN_ENGINE_INFO);
|
||||
radeon_emit(cs, enc ? RADEON_VCN_ENGINE_TYPE_ENCODE
|
||||
: RADEON_VCN_ENGINE_TYPE_DECODE);
|
||||
sq->engine_ib_size_of_packages = &cs->current.buf[cs->current.cdw];
|
||||
radeon_emit(cs, 0);
|
||||
}
|
||||
|
||||
|
|
@ -34,16 +35,17 @@ void rvcn_sq_tail(struct radeon_cmdbuf *cs,
|
|||
uint32_t size_in_dw;
|
||||
uint32_t checksum = 0;
|
||||
|
||||
if (sq->ib_checksum == NULL || sq->ib_total_size_in_dw == NULL)
|
||||
if (sq->signature_ib_checksum == NULL || sq->signature_ib_total_size_in_dw == NULL ||
|
||||
sq->engine_ib_size_of_packages == NULL)
|
||||
return;
|
||||
|
||||
end = &cs->current.buf[cs->current.cdw];
|
||||
size_in_dw = end - sq->ib_total_size_in_dw - 1;
|
||||
*sq->ib_total_size_in_dw = size_in_dw;
|
||||
*(sq->ib_total_size_in_dw + 4) = size_in_dw * sizeof(uint32_t);
|
||||
size_in_dw = end - sq->signature_ib_total_size_in_dw - 1;
|
||||
*sq->signature_ib_total_size_in_dw = size_in_dw;
|
||||
*sq->engine_ib_size_of_packages = size_in_dw * sizeof(uint32_t);
|
||||
|
||||
for (int i = 0; i < size_in_dw; i++)
|
||||
checksum += *(sq->ib_checksum + 2 + i);
|
||||
checksum += *(sq->signature_ib_checksum + 2 + i);
|
||||
|
||||
*sq->ib_checksum = checksum;
|
||||
*sq->signature_ib_checksum = checksum;
|
||||
}
|
||||
|
|
|
|||
|
|
@ -2772,8 +2772,9 @@ struct pipe_video_codec *radeon_create_decoder(struct pipe_context *context,
|
|||
ring = AMD_IP_VCN_UNIFIED;
|
||||
}
|
||||
|
||||
dec->sq.ib_total_size_in_dw = NULL;
|
||||
dec->sq.ib_checksum = NULL;
|
||||
dec->sq.signature_ib_total_size_in_dw = NULL;
|
||||
dec->sq.signature_ib_checksum = NULL;
|
||||
dec->sq.engine_ib_size_of_packages = NULL;
|
||||
|
||||
if (!ws->cs_create(&dec->cs,
|
||||
(sctx->vcn_has_ctx) ? ((struct si_context *)dec->ectx)->ctx : sctx->ctx,
|
||||
|
|
|
|||
Loading…
Add table
Reference in a new issue