radeonsi/vcn: support unified queue in vcn4
- use unified queue only in vcn4 - implement signature and engine-info ib headers in vcn4 - implemented unified queue functions Reviewed-by: Boyuan Zhang <Boyuan.Zhang@amd.com> Reviewed-by: Mihai Preda <mhpreda@gmail.com> Signed-off-by: Ruijing Dong <ruijing.dong@amd.com> Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/16911>
This commit is contained in:
@@ -28,7 +28,6 @@
|
||||
#include "radeon_vcn_dec.h"
|
||||
|
||||
#include "pipe/p_video_codec.h"
|
||||
#include "radeon_video.h"
|
||||
#include "radeonsi/si_pipe.h"
|
||||
#include "util/u_memory.h"
|
||||
#include "util/u_video.h"
|
||||
@@ -385,7 +384,7 @@ static rvcn_dec_message_hevc_t get_h265_msg(struct radeon_decoder *dec,
|
||||
result.curr_poc = pic->CurrPicOrderCntVal;
|
||||
|
||||
for (i = 0; i < ARRAY_SIZE(dec->render_pic_list); i++) {
|
||||
for (j = 0;
|
||||
for (j = 0;
|
||||
(pic->ref[j] != NULL) && (j < ARRAY_SIZE(dec->render_pic_list));
|
||||
j++) {
|
||||
if (dec->render_pic_list[i] == pic->ref[j])
|
||||
@@ -2124,9 +2123,18 @@ static void rvcn_dec_message_feedback(struct radeon_decoder *dec)
|
||||
header->num_buffers = 0;
|
||||
}
|
||||
|
||||
static void rvcn_dec_sq_tail(struct radeon_decoder *dec)
|
||||
{
|
||||
if (dec->vcn_dec_sw_ring == false)
|
||||
return;
|
||||
|
||||
rvcn_sq_tail(&dec->cs, &dec->sq);
|
||||
}
|
||||
/* flush IB to the hardware */
|
||||
static int flush(struct radeon_decoder *dec, unsigned flags)
|
||||
{
|
||||
rvcn_dec_sq_tail(dec);
|
||||
|
||||
return dec->ws->cs_flush(&dec->cs, flags, NULL);
|
||||
}
|
||||
|
||||
@@ -2155,6 +2163,7 @@ static void send_cmd(struct radeon_decoder *dec, unsigned cmd, struct pb_buffer
|
||||
}
|
||||
|
||||
if (!dec->cs.current.cdw) {
|
||||
rvcn_sq_header(&dec->cs, &dec->sq, false);
|
||||
rvcn_decode_ib_package_t *ib_header =
|
||||
(rvcn_decode_ib_package_t *)&(dec->cs.current.buf[dec->cs.current.cdw]);
|
||||
|
||||
@@ -2770,8 +2779,13 @@ struct pipe_video_codec *radeon_create_decoder(struct pipe_context *context,
|
||||
dec->ws = ws;
|
||||
|
||||
if (u_reduce_video_profile(templ->profile) != PIPE_VIDEO_FORMAT_JPEG &&
|
||||
sctx->gfx_level >= GFX11)
|
||||
sctx->gfx_level >= GFX11) {
|
||||
dec->vcn_dec_sw_ring = true;
|
||||
ring = AMD_IP_VCN_UNIFIED;
|
||||
}
|
||||
|
||||
dec->sq.ib_total_size_in_dw = NULL;
|
||||
dec->sq.ib_checksum = NULL;
|
||||
|
||||
if (!ws->cs_create(&dec->cs, sctx->ctx, ring, NULL, NULL, false)) {
|
||||
RVID_ERR("Can't get command submission context.\n");
|
||||
|
||||
@@ -595,6 +595,10 @@ struct radeon_encoder {
|
||||
void (*input_format)(struct radeon_encoder *enc);
|
||||
void (*output_format)(struct radeon_encoder *enc);
|
||||
void (*efc_params)(struct radeon_encoder *enc);
|
||||
/* mq is used for preversing multiple queue ibs */
|
||||
void (*mq_begin)(struct radeon_encoder *enc);
|
||||
void (*mq_encode)(struct radeon_encoder *enc);
|
||||
void (*mq_destroy)(struct radeon_encoder *enc);
|
||||
|
||||
unsigned stream_handle;
|
||||
|
||||
|
||||
@@ -32,12 +32,32 @@
|
||||
#include "util/u_video.h"
|
||||
|
||||
#include "si_pipe.h"
|
||||
#include "radeon_video.h"
|
||||
#include "radeon_vcn_enc.h"
|
||||
|
||||
#define RENCODE_FW_INTERFACE_MAJOR_VERSION 1
|
||||
#define RENCODE_FW_INTERFACE_MINOR_VERSION 0
|
||||
|
||||
static void radeon_enc_sq_begin(struct radeon_encoder *enc)
|
||||
{
|
||||
rvcn_sq_header(&enc->cs, &enc->sq, true);
|
||||
enc->mq_begin(enc);
|
||||
rvcn_sq_tail(&enc->cs, &enc->sq);
|
||||
}
|
||||
|
||||
static void radeon_enc_sq_encode(struct radeon_encoder *enc)
|
||||
{
|
||||
rvcn_sq_header(&enc->cs, &enc->sq, true);
|
||||
enc->mq_encode(enc);
|
||||
rvcn_sq_tail(&enc->cs, &enc->sq);
|
||||
}
|
||||
|
||||
static void radeon_enc_sq_destroy(struct radeon_encoder *enc)
|
||||
{
|
||||
rvcn_sq_header(&enc->cs, &enc->sq, true);
|
||||
enc->mq_destroy(enc);
|
||||
rvcn_sq_tail(&enc->cs, &enc->sq);
|
||||
}
|
||||
|
||||
static void radeon_enc_session_init(struct radeon_encoder *enc)
|
||||
{
|
||||
if (u_reduce_video_profile(enc->base.profile) == PIPE_VIDEO_FORMAT_MPEG4_AVC) {
|
||||
@@ -129,6 +149,12 @@ void radeon_enc_4_0_init(struct radeon_encoder *enc)
|
||||
|
||||
enc->session_init = radeon_enc_session_init;
|
||||
enc->ctx = radeon_enc_ctx;
|
||||
enc->mq_begin = enc->begin;
|
||||
enc->mq_encode = enc->encode;
|
||||
enc->mq_destroy = enc->destroy;
|
||||
enc->begin = radeon_enc_sq_begin;
|
||||
enc->encode = radeon_enc_sq_encode;
|
||||
enc->destroy = radeon_enc_sq_destroy;
|
||||
|
||||
enc->enc_pic.session_info.interface_version =
|
||||
((RENCODE_FW_INTERFACE_MAJOR_VERSION << RENCODE_IF_MAJOR_VERSION_SHIFT) |
|
||||
|
||||
Reference in New Issue
Block a user