mirror of
https://gitlab.freedesktop.org/mesa/mesa.git
synced 2025-12-20 22:30:12 +01:00
radeonsi/vcn: Stop using rvid_buffer
Acked-by: Pierre-Eric Pelloux-Prayer <pierre-eric.pelloux-prayer@amd.com> Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/37884>
This commit is contained in:
parent
a25db1c53c
commit
a0324576aa
10 changed files with 204 additions and 221 deletions
|
|
@ -1617,18 +1617,14 @@ static struct pb_buffer_lean *rvcn_dec_message_decode(struct radeon_decoder *dec
|
||||||
|
|
||||||
if (dec->dpb_type < DPB_DYNAMIC_TIER_2) {
|
if (dec->dpb_type < DPB_DYNAMIC_TIER_2) {
|
||||||
bool r;
|
bool r;
|
||||||
if (!dec->dpb.res && dec->dpb_size) {
|
if (!dec->dpb && dec->dpb_size) {
|
||||||
if (encrypted) {
|
unsigned bind = encrypted ? PIPE_BIND_PROTECTED : 0;
|
||||||
r = si_vid_create_tmz_buffer(dec->screen, &dec->dpb, dec->dpb_size, PIPE_USAGE_DEFAULT);
|
dec->dpb = si_resource(pipe_buffer_create(dec->screen, bind, PIPE_USAGE_DEFAULT, dec->dpb_size));
|
||||||
} else {
|
if (!dec->dpb) {
|
||||||
r = si_vid_create_buffer(dec->screen, &dec->dpb, dec->dpb_size, PIPE_USAGE_DEFAULT);
|
|
||||||
}
|
|
||||||
assert(encrypted == (bool)(dec->dpb.res->flags & RADEON_FLAG_ENCRYPTED));
|
|
||||||
if (!r) {
|
|
||||||
RADEON_DEC_ERR("Can't allocate dpb.\n");
|
RADEON_DEC_ERR("Can't allocate dpb.\n");
|
||||||
return NULL;
|
return NULL;
|
||||||
}
|
}
|
||||||
} else if (dec->dpb_type == DPB_DYNAMIC_TIER_1 && dec->dpb.res &&
|
} else if (dec->dpb_type == DPB_DYNAMIC_TIER_1 && dec->dpb &&
|
||||||
(dec->max_width < dec->base.width || dec->max_height < dec->base.height)) {
|
(dec->max_width < dec->base.width || dec->max_height < dec->base.height)) {
|
||||||
struct rvid_buf_offset_info buf_offset_info;
|
struct rvid_buf_offset_info buf_offset_info;
|
||||||
|
|
||||||
|
|
@ -1639,7 +1635,7 @@ static struct pb_buffer_lean *rvcn_dec_message_decode(struct radeon_decoder *dec
|
||||||
align(dec->base.height, dec->db_alignment) * 3 / 2);
|
align(dec->base.height, dec->db_alignment) * 3 / 2);
|
||||||
|
|
||||||
dec->dpb_size = calc_dpb_size(dec);
|
dec->dpb_size = calc_dpb_size(dec);
|
||||||
r = si_vid_resize_buffer(dec->base.context, &dec->dpb.res, dec->dpb_size, &buf_offset_info);
|
r = si_vid_resize_buffer(dec->base.context, &dec->dpb, dec->dpb_size, &buf_offset_info);
|
||||||
if (!r) {
|
if (!r) {
|
||||||
RADEON_DEC_ERR("Can't resize dpb.\n");
|
RADEON_DEC_ERR("Can't resize dpb.\n");
|
||||||
return NULL;
|
return NULL;
|
||||||
|
|
@ -1650,26 +1646,22 @@ static struct pb_buffer_lean *rvcn_dec_message_decode(struct radeon_decoder *dec
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
if (!dec->ctx.res) {
|
if (!dec->ctx) {
|
||||||
enum pipe_video_format fmt = u_reduce_video_profile(picture->profile);
|
enum pipe_video_format fmt = u_reduce_video_profile(picture->profile);
|
||||||
if (dec->stream_type == RDECODE_CODEC_H264_PERF) {
|
if (dec->stream_type == RDECODE_CODEC_H264_PERF) {
|
||||||
unsigned ctx_size = calc_ctx_size_h264_perf(dec);
|
unsigned ctx_size = calc_ctx_size_h264_perf(dec);
|
||||||
bool r;
|
unsigned bind = 0;
|
||||||
if (encrypted && dec->tmz_ctx) {
|
if (encrypted && dec->tmz_ctx)
|
||||||
r = si_vid_create_tmz_buffer(dec->screen, &dec->ctx, ctx_size, PIPE_USAGE_DEFAULT);
|
bind |= PIPE_BIND_PROTECTED;
|
||||||
} else {
|
dec->ctx = si_resource(pipe_buffer_create(dec->screen, bind, PIPE_USAGE_DEFAULT, ctx_size));
|
||||||
r = si_vid_create_buffer(dec->screen, &dec->ctx, ctx_size, PIPE_USAGE_DEFAULT);
|
if (!dec->ctx) {
|
||||||
}
|
|
||||||
assert((encrypted && dec->tmz_ctx) == (bool)(dec->ctx.res->flags & RADEON_FLAG_ENCRYPTED));
|
|
||||||
|
|
||||||
if (!r) {
|
|
||||||
RADEON_DEC_ERR("Can't allocate context buffer.\n");
|
RADEON_DEC_ERR("Can't allocate context buffer.\n");
|
||||||
return NULL;
|
return NULL;
|
||||||
}
|
}
|
||||||
|
assert((encrypted && dec->tmz_ctx) == (bool)(dec->ctx->flags & RADEON_FLAG_ENCRYPTED));
|
||||||
} else if (fmt == PIPE_VIDEO_FORMAT_VP9) {
|
} else if (fmt == PIPE_VIDEO_FORMAT_VP9) {
|
||||||
unsigned ctx_size;
|
unsigned ctx_size;
|
||||||
uint8_t *ptr;
|
uint8_t *ptr;
|
||||||
bool r;
|
|
||||||
|
|
||||||
/* default probability + probability data */
|
/* default probability + probability data */
|
||||||
ctx_size = 2304 * 5;
|
ctx_size = 2304 * 5;
|
||||||
|
|
@ -1690,36 +1682,33 @@ static struct pb_buffer_lean *rvcn_dec_message_decode(struct radeon_decoder *dec
|
||||||
if (dec->base.profile == PIPE_VIDEO_PROFILE_VP9_PROFILE2)
|
if (dec->base.profile == PIPE_VIDEO_PROFILE_VP9_PROFILE2)
|
||||||
ctx_size += 8 * 2 * 4096;
|
ctx_size += 8 * 2 * 4096;
|
||||||
|
|
||||||
if (encrypted && dec->tmz_ctx) {
|
unsigned bind = 0;
|
||||||
r = si_vid_create_tmz_buffer(dec->screen, &dec->ctx, ctx_size, PIPE_USAGE_DEFAULT);
|
if (encrypted && dec->tmz_ctx)
|
||||||
} else {
|
bind |= PIPE_BIND_PROTECTED;
|
||||||
r = si_vid_create_buffer(dec->screen, &dec->ctx, ctx_size, PIPE_USAGE_DEFAULT);
|
dec->ctx = si_resource(pipe_buffer_create(dec->screen, bind, PIPE_USAGE_DEFAULT, ctx_size));
|
||||||
}
|
if (!dec->ctx) {
|
||||||
if (!r) {
|
|
||||||
RADEON_DEC_ERR("Can't allocate context buffer.\n");
|
RADEON_DEC_ERR("Can't allocate context buffer.\n");
|
||||||
return NULL;
|
return NULL;
|
||||||
}
|
}
|
||||||
|
|
||||||
/* ctx needs probs table */
|
/* ctx needs probs table */
|
||||||
ptr = dec->ws->buffer_map(dec->ws, dec->ctx.res->buf, NULL,
|
ptr = dec->ws->buffer_map(dec->ws, dec->ctx->buf, NULL,
|
||||||
PIPE_MAP_WRITE | RADEON_MAP_TEMPORARY);
|
PIPE_MAP_WRITE | RADEON_MAP_TEMPORARY);
|
||||||
ac_vcn_vp9_fill_probs_table(ptr);
|
ac_vcn_vp9_fill_probs_table(ptr);
|
||||||
dec->ws->buffer_unmap(dec->ws, dec->ctx.res->buf);
|
dec->ws->buffer_unmap(dec->ws, dec->ctx->buf);
|
||||||
dec->bs_ptr = NULL;
|
dec->bs_ptr = NULL;
|
||||||
} else if (fmt == PIPE_VIDEO_FORMAT_HEVC) {
|
} else if (fmt == PIPE_VIDEO_FORMAT_HEVC) {
|
||||||
unsigned ctx_size;
|
unsigned ctx_size;
|
||||||
bool r;
|
|
||||||
if (dec->base.profile == PIPE_VIDEO_PROFILE_HEVC_MAIN_10)
|
if (dec->base.profile == PIPE_VIDEO_PROFILE_HEVC_MAIN_10)
|
||||||
ctx_size = calc_ctx_size_h265_main10(dec, (struct pipe_h265_picture_desc *)picture);
|
ctx_size = calc_ctx_size_h265_main10(dec, (struct pipe_h265_picture_desc *)picture);
|
||||||
else
|
else
|
||||||
ctx_size = calc_ctx_size_h265_main(dec);
|
ctx_size = calc_ctx_size_h265_main(dec);
|
||||||
|
|
||||||
if (encrypted && dec->tmz_ctx) {
|
unsigned bind = 0;
|
||||||
r = si_vid_create_tmz_buffer(dec->screen, &dec->ctx, ctx_size, PIPE_USAGE_DEFAULT);
|
if (encrypted && dec->tmz_ctx)
|
||||||
} else {
|
bind |= PIPE_BIND_PROTECTED;
|
||||||
r = si_vid_create_buffer(dec->screen, &dec->ctx, ctx_size, PIPE_USAGE_DEFAULT);
|
dec->ctx = si_resource(pipe_buffer_create(dec->screen, bind, PIPE_USAGE_DEFAULT, ctx_size));
|
||||||
}
|
if (!dec->ctx) {
|
||||||
if (!r) {
|
|
||||||
RADEON_DEC_ERR("Can't allocate context buffer.\n");
|
RADEON_DEC_ERR("Can't allocate context buffer.\n");
|
||||||
return NULL;
|
return NULL;
|
||||||
}
|
}
|
||||||
|
|
@ -1733,7 +1722,7 @@ static struct pb_buffer_lean *rvcn_dec_message_decode(struct radeon_decoder *dec
|
||||||
set_drm_keyblob(drm_keyblob, secure_buf);
|
set_drm_keyblob(drm_keyblob, secure_buf);
|
||||||
}
|
}
|
||||||
|
|
||||||
decode->dpb_size = (dec->dpb_type < DPB_DYNAMIC_TIER_2) ? dec->dpb.res->buf->size : 0;
|
decode->dpb_size = (dec->dpb_type < DPB_DYNAMIC_TIER_2) ? dec->dpb->buf->size : 0;
|
||||||
|
|
||||||
/* When texture being created, the bo will be created with total size of planes,
|
/* When texture being created, the bo will be created with total size of planes,
|
||||||
* and all planes point to the same buffer */
|
* and all planes point to the same buffer */
|
||||||
|
|
@ -1779,15 +1768,15 @@ static struct pb_buffer_lean *rvcn_dec_message_decode(struct radeon_decoder *dec
|
||||||
decode->db_pitch_uv = chroma->surface.u.gfx9.surf_pitch * chroma->surface.blk_w;
|
decode->db_pitch_uv = chroma->surface.u.gfx9.surf_pitch * chroma->surface.blk_w;
|
||||||
|
|
||||||
if (picture->cenc) {
|
if (picture->cenc) {
|
||||||
if (!dec->subsample.res && !si_vid_create_buffer(dec->screen, &dec->subsample,
|
if (!dec->subsample)
|
||||||
RDECODE_MAX_SUBSAMPLE_SIZE,
|
dec->subsample = si_resource(pipe_buffer_create(dec->screen, 0, PIPE_USAGE_DEFAULT, RDECODE_MAX_SUBSAMPLE_SIZE));
|
||||||
PIPE_USAGE_DEFAULT)) {
|
if (!dec->subsample) {
|
||||||
RADEON_DEC_ERR("Can't allocate subsample buffer.\n");
|
RADEON_DEC_ERR("Can't allocate subsample buffer.\n");
|
||||||
return NULL;
|
return NULL;
|
||||||
}
|
}
|
||||||
int ss_length = MIN2(secure_buf->desc.subsamples_length, MAX_SUBSAMPLES);
|
int ss_length = MIN2(secure_buf->desc.subsamples_length, MAX_SUBSAMPLES);
|
||||||
int total_ss_size = 0;
|
int total_ss_size = 0;
|
||||||
uint32_t *ss_ptr = dec->ws->buffer_map(dec->ws, dec->subsample.res->buf, &dec->cs,
|
uint32_t *ss_ptr = dec->ws->buffer_map(dec->ws, dec->subsample->buf, &dec->cs,
|
||||||
PIPE_MAP_WRITE | RADEON_MAP_TEMPORARY);
|
PIPE_MAP_WRITE | RADEON_MAP_TEMPORARY);
|
||||||
if (!ss_ptr) {
|
if (!ss_ptr) {
|
||||||
RADEON_DEC_ERR("Failed to map subsample buffer memory.\n");
|
RADEON_DEC_ERR("Failed to map subsample buffer memory.\n");
|
||||||
|
|
@ -1802,7 +1791,7 @@ static struct pb_buffer_lean *rvcn_dec_message_decode(struct radeon_decoder *dec
|
||||||
ss_ptr[ss_length * 2 - 1] += (decode->bsd_size - total_ss_size);
|
ss_ptr[ss_length * 2 - 1] += (decode->bsd_size - total_ss_size);
|
||||||
else
|
else
|
||||||
ss_ptr[ss_length * 2 - 2] += (decode->bsd_size - total_ss_size);
|
ss_ptr[ss_length * 2 - 2] += (decode->bsd_size - total_ss_size);
|
||||||
dec->ws->buffer_unmap(dec->ws, dec->subsample.res->buf);
|
dec->ws->buffer_unmap(dec->ws, dec->subsample->buf);
|
||||||
}
|
}
|
||||||
|
|
||||||
if (encrypted) {
|
if (encrypted) {
|
||||||
|
|
@ -1901,17 +1890,21 @@ static struct pb_buffer_lean *rvcn_dec_message_decode(struct radeon_decoder *dec
|
||||||
index_codec->message_id = RDECODE_MESSAGE_AV1;
|
index_codec->message_id = RDECODE_MESSAGE_AV1;
|
||||||
index_codec->size = sizeof(rvcn_dec_message_av1_t);
|
index_codec->size = sizeof(rvcn_dec_message_av1_t);
|
||||||
|
|
||||||
if (dec->ctx.res == NULL) {
|
if (!dec->ctx) {
|
||||||
unsigned ctx_size = ac_vcn_dec_calc_ctx_size_av1(dec->av1_version);
|
unsigned ctx_size = ac_vcn_dec_calc_ctx_size_av1(dec->av1_version);
|
||||||
uint8_t *ptr;
|
uint8_t *ptr;
|
||||||
|
|
||||||
if (!si_vid_create_buffer(dec->screen, &dec->ctx, ctx_size, PIPE_USAGE_DEFAULT))
|
unsigned bind = 0;
|
||||||
RADEON_DEC_ERR("Can't allocate context buffer.\n");
|
if (encrypted && dec->tmz_ctx)
|
||||||
|
bind |= PIPE_BIND_PROTECTED;
|
||||||
ptr = dec->ws->buffer_map(dec->ws, dec->ctx.res->buf, NULL, PIPE_MAP_WRITE | RADEON_MAP_TEMPORARY);
|
dec->ctx = si_resource(pipe_buffer_create(dec->screen, bind, PIPE_USAGE_DEFAULT, ctx_size));
|
||||||
|
if (dec->ctx) {
|
||||||
|
ptr = dec->ws->buffer_map(dec->ws, dec->ctx->buf, NULL, PIPE_MAP_WRITE | RADEON_MAP_TEMPORARY);
|
||||||
ac_vcn_av1_init_probs(dec->av1_version, ptr);
|
ac_vcn_av1_init_probs(dec->av1_version, ptr);
|
||||||
dec->ws->buffer_unmap(dec->ws, dec->ctx.res->buf);
|
dec->ws->buffer_unmap(dec->ws, dec->ctx->buf);
|
||||||
|
} else {
|
||||||
|
RADEON_DEC_ERR("Can't allocate context buffer.\n");
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
break;
|
break;
|
||||||
|
|
@ -1923,8 +1916,8 @@ static struct pb_buffer_lean *rvcn_dec_message_decode(struct radeon_decoder *dec
|
||||||
|
|
||||||
header->total_size += index_codec->size;
|
header->total_size += index_codec->size;
|
||||||
|
|
||||||
if (dec->ctx.res)
|
if (dec->ctx)
|
||||||
decode->hw_ctxt_size = dec->ctx.res->buf->size;
|
decode->hw_ctxt_size = dec->ctx->buf->size;
|
||||||
|
|
||||||
if (dec->dpb_type == DPB_DYNAMIC_TIER_2) {
|
if (dec->dpb_type == DPB_DYNAMIC_TIER_2) {
|
||||||
if (rvcn_dec_dynamic_dpb_t2_message(dec, decode, dynamic_dpb_t2, encrypted))
|
if (rvcn_dec_dynamic_dpb_t2_message(dec, decode, dynamic_dpb_t2, encrypted))
|
||||||
|
|
@ -2103,15 +2096,15 @@ static bool have_probs(struct radeon_decoder *dec)
|
||||||
/* map the next available message/feedback/itscaling buffer */
|
/* map the next available message/feedback/itscaling buffer */
|
||||||
static void map_msg_fb_it_probs_buf(struct radeon_decoder *dec)
|
static void map_msg_fb_it_probs_buf(struct radeon_decoder *dec)
|
||||||
{
|
{
|
||||||
struct rvid_buffer *buf;
|
struct si_resource *buf;
|
||||||
uint8_t *ptr;
|
uint8_t *ptr;
|
||||||
|
|
||||||
/* grab the current message/feedback buffer */
|
/* grab the current message/feedback buffer */
|
||||||
buf = &dec->msg_fb_it_probs_buffers[dec->cur_buffer];
|
buf = dec->msg_fb_it_probs_buffers[dec->cur_buffer];
|
||||||
|
|
||||||
/* and map it for CPU access */
|
/* and map it for CPU access */
|
||||||
ptr =
|
ptr =
|
||||||
dec->ws->buffer_map(dec->ws, buf->res->buf, NULL, PIPE_MAP_WRITE | RADEON_MAP_TEMPORARY);
|
dec->ws->buffer_map(dec->ws, buf->buf, NULL, PIPE_MAP_WRITE | RADEON_MAP_TEMPORARY);
|
||||||
|
|
||||||
/* calc buffer offsets */
|
/* calc buffer offsets */
|
||||||
dec->msg = ptr;
|
dec->msg = ptr;
|
||||||
|
|
@ -2126,28 +2119,28 @@ static void map_msg_fb_it_probs_buf(struct radeon_decoder *dec)
|
||||||
/* unmap and send a message command to the VCPU */
|
/* unmap and send a message command to the VCPU */
|
||||||
static void send_msg_buf(struct radeon_decoder *dec)
|
static void send_msg_buf(struct radeon_decoder *dec)
|
||||||
{
|
{
|
||||||
struct rvid_buffer *buf;
|
struct si_resource *buf;
|
||||||
|
|
||||||
/* ignore the request if message/feedback buffer isn't mapped */
|
/* ignore the request if message/feedback buffer isn't mapped */
|
||||||
if (!dec->msg || !dec->fb)
|
if (!dec->msg || !dec->fb)
|
||||||
return;
|
return;
|
||||||
|
|
||||||
/* grab the current message buffer */
|
/* grab the current message buffer */
|
||||||
buf = &dec->msg_fb_it_probs_buffers[dec->cur_buffer];
|
buf = dec->msg_fb_it_probs_buffers[dec->cur_buffer];
|
||||||
|
|
||||||
/* unmap the buffer */
|
/* unmap the buffer */
|
||||||
dec->ws->buffer_unmap(dec->ws, buf->res->buf);
|
dec->ws->buffer_unmap(dec->ws, buf->buf);
|
||||||
dec->bs_ptr = NULL;
|
dec->bs_ptr = NULL;
|
||||||
dec->msg = NULL;
|
dec->msg = NULL;
|
||||||
dec->fb = NULL;
|
dec->fb = NULL;
|
||||||
dec->it = NULL;
|
dec->it = NULL;
|
||||||
dec->probs = NULL;
|
dec->probs = NULL;
|
||||||
|
|
||||||
send_cmd(dec, RDECODE_CMD_SESSION_CONTEXT_BUFFER, dec->sessionctx.res->buf, 0,
|
send_cmd(dec, RDECODE_CMD_SESSION_CONTEXT_BUFFER, dec->sessionctx->buf, 0,
|
||||||
RADEON_USAGE_READWRITE, RADEON_DOMAIN_VRAM);
|
RADEON_USAGE_READWRITE, RADEON_DOMAIN_VRAM);
|
||||||
|
|
||||||
/* and send it to the hardware */
|
/* and send it to the hardware */
|
||||||
send_cmd(dec, RDECODE_CMD_MSG_BUFFER, buf->res->buf, 0, RADEON_USAGE_READ, RADEON_DOMAIN_GTT);
|
send_cmd(dec, RDECODE_CMD_MSG_BUFFER, buf->buf, 0, RADEON_USAGE_READ, RADEON_DOMAIN_GTT);
|
||||||
}
|
}
|
||||||
|
|
||||||
/* cycle to the next set of buffers */
|
/* cycle to the next set of buffers */
|
||||||
|
|
@ -2360,12 +2353,12 @@ static void radeon_dec_destroy(struct pipe_video_codec *decoder)
|
||||||
assert(decoder);
|
assert(decoder);
|
||||||
|
|
||||||
if (dec->bs_ptr) {
|
if (dec->bs_ptr) {
|
||||||
dec->ws->buffer_unmap(dec->ws, dec->bs_buffers[dec->cur_buffer].res->buf);
|
dec->ws->buffer_unmap(dec->ws, dec->bs_buffers[dec->cur_buffer]->buf);
|
||||||
dec->bs_ptr = NULL;
|
dec->bs_ptr = NULL;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (dec->msg) {
|
if (dec->msg) {
|
||||||
dec->ws->buffer_unmap(dec->ws, dec->msg_fb_it_probs_buffers[dec->cur_buffer].res->buf);
|
dec->ws->buffer_unmap(dec->ws, dec->msg_fb_it_probs_buffers[dec->cur_buffer]->buf);
|
||||||
dec->msg = NULL;
|
dec->msg = NULL;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
@ -2394,26 +2387,26 @@ static void radeon_dec_destroy(struct pipe_video_codec *decoder)
|
||||||
|
|
||||||
if (dec->msg_fb_it_probs_buffers && dec->bs_buffers) {
|
if (dec->msg_fb_it_probs_buffers && dec->bs_buffers) {
|
||||||
for (i = 0; i < dec->num_dec_bufs; ++i) {
|
for (i = 0; i < dec->num_dec_bufs; ++i) {
|
||||||
si_vid_destroy_buffer(&dec->msg_fb_it_probs_buffers[i]);
|
si_resource_reference(&dec->msg_fb_it_probs_buffers[i], NULL);
|
||||||
si_vid_destroy_buffer(&dec->bs_buffers[i]);
|
si_resource_reference(&dec->bs_buffers[i], NULL);
|
||||||
}
|
}
|
||||||
FREE(dec->msg_fb_it_probs_buffers);
|
FREE(dec->msg_fb_it_probs_buffers);
|
||||||
FREE(dec->bs_buffers);
|
FREE(dec->bs_buffers);
|
||||||
}
|
}
|
||||||
dec->num_dec_bufs = 0;
|
dec->num_dec_bufs = 0;
|
||||||
|
|
||||||
if (dec->dpb_type != DPB_DYNAMIC_TIER_2) {
|
si_resource_reference(&dec->dpb, NULL);
|
||||||
si_vid_destroy_buffer(&dec->dpb);
|
|
||||||
} else {
|
if (dec->dpb_type == DPB_DYNAMIC_TIER_2) {
|
||||||
list_for_each_entry_safe(struct rvcn_dec_dynamic_dpb_t2, d, &dec->dpb_ref_list, list) {
|
list_for_each_entry_safe(struct rvcn_dec_dynamic_dpb_t2, d, &dec->dpb_ref_list, list) {
|
||||||
list_del(&d->list);
|
list_del(&d->list);
|
||||||
pipe_resource_reference(&d->buf, NULL);
|
pipe_resource_reference(&d->buf, NULL);
|
||||||
FREE(d);
|
FREE(d);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
si_vid_destroy_buffer(&dec->ctx);
|
si_resource_reference(&dec->ctx, NULL);
|
||||||
si_vid_destroy_buffer(&dec->sessionctx);
|
si_resource_reference(&dec->sessionctx, NULL);
|
||||||
si_vid_destroy_buffer(&dec->subsample);
|
si_resource_reference(&dec->subsample, NULL);
|
||||||
|
|
||||||
FREE(dec->jcs);
|
FREE(dec->jcs);
|
||||||
FREE(dec->jctx);
|
FREE(dec->jctx);
|
||||||
|
|
@ -2459,7 +2452,7 @@ static void radeon_dec_begin_frame(struct pipe_video_codec *decoder,
|
||||||
}
|
}
|
||||||
|
|
||||||
dec->bs_size = 0;
|
dec->bs_size = 0;
|
||||||
dec->bs_ptr = dec->ws->buffer_map(dec->ws, dec->bs_buffers[dec->cur_buffer].res->buf, NULL,
|
dec->bs_ptr = dec->ws->buffer_map(dec->ws, dec->bs_buffers[dec->cur_buffer]->buf, NULL,
|
||||||
PIPE_MAP_WRITE | RADEON_MAP_TEMPORARY);
|
PIPE_MAP_WRITE | RADEON_MAP_TEMPORARY);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
@ -2501,27 +2494,29 @@ static void radeon_dec_decode_bitstream(struct pipe_video_codec *decoder,
|
||||||
for (i = 0; i < num_buffers; ++i)
|
for (i = 0; i < num_buffers; ++i)
|
||||||
total_bs_size += sizes[i];
|
total_bs_size += sizes[i];
|
||||||
|
|
||||||
struct rvid_buffer *buf = &dec->bs_buffers[dec->cur_buffer];
|
struct si_resource *buf = dec->bs_buffers[dec->cur_buffer];
|
||||||
|
|
||||||
if (total_bs_size > buf->res->buf->size) {
|
if (total_bs_size > buf->buf->size) {
|
||||||
dec->ws->buffer_unmap(dec->ws, buf->res->buf);
|
dec->ws->buffer_unmap(dec->ws, buf->buf);
|
||||||
dec->bs_ptr = NULL;
|
dec->bs_ptr = NULL;
|
||||||
|
|
||||||
total_bs_size = align(total_bs_size, 128);
|
total_bs_size = align(total_bs_size, 128);
|
||||||
|
|
||||||
if (!dec->bs_size) {
|
if (!dec->bs_size) {
|
||||||
struct rvid_buffer old_buf = *buf;
|
buf = si_resource(pipe_buffer_create(dec->screen, buf->b.b.bind, buf->b.b.usage, total_bs_size));
|
||||||
if (!si_vid_create_buffer(dec->screen, buf, total_bs_size, buf->usage)) {
|
if (!buf) {
|
||||||
RADEON_DEC_ERR("Can't create bitstream buffer!");
|
RADEON_DEC_ERR("Can't create bitstream buffer!");
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
si_vid_destroy_buffer(&old_buf);
|
si_resource_reference(&dec->bs_buffers[dec->cur_buffer], NULL);
|
||||||
} else if (!si_vid_resize_buffer(dec->base.context, &buf->res, total_bs_size, NULL)) {
|
dec->bs_buffers[dec->cur_buffer] = buf;
|
||||||
|
} else if (!si_vid_resize_buffer(dec->base.context, &dec->bs_buffers[dec->cur_buffer], total_bs_size, NULL)) {
|
||||||
RADEON_DEC_ERR("Can't resize bitstream buffer!");
|
RADEON_DEC_ERR("Can't resize bitstream buffer!");
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
dec->bs_ptr = dec->ws->buffer_map(dec->ws, buf->res->buf, NULL,
|
buf = dec->bs_buffers[dec->cur_buffer];
|
||||||
|
dec->bs_ptr = dec->ws->buffer_map(dec->ws, buf->buf, NULL,
|
||||||
PIPE_MAP_WRITE | RADEON_MAP_TEMPORARY);
|
PIPE_MAP_WRITE | RADEON_MAP_TEMPORARY);
|
||||||
if (!dec->bs_ptr)
|
if (!dec->bs_ptr)
|
||||||
return;
|
return;
|
||||||
|
|
@ -2615,13 +2610,13 @@ bool send_cmd_dec(struct radeon_decoder *dec, struct pipe_video_buffer *target,
|
||||||
struct pipe_picture_desc *picture)
|
struct pipe_picture_desc *picture)
|
||||||
{
|
{
|
||||||
struct pb_buffer_lean *dt;
|
struct pb_buffer_lean *dt;
|
||||||
struct rvid_buffer *msg_fb_it_probs_buf, *bs_buf;
|
struct si_resource *msg_fb_it_probs_buf, *bs_buf;
|
||||||
|
|
||||||
msg_fb_it_probs_buf = &dec->msg_fb_it_probs_buffers[dec->cur_buffer];
|
msg_fb_it_probs_buf = dec->msg_fb_it_probs_buffers[dec->cur_buffer];
|
||||||
bs_buf = &dec->bs_buffers[dec->cur_buffer];
|
bs_buf = dec->bs_buffers[dec->cur_buffer];
|
||||||
|
|
||||||
memset(dec->bs_ptr, 0, align(dec->bs_size, 128) - dec->bs_size);
|
memset(dec->bs_ptr, 0, align(dec->bs_size, 128) - dec->bs_size);
|
||||||
dec->ws->buffer_unmap(dec->ws, bs_buf->res->buf);
|
dec->ws->buffer_unmap(dec->ws, bs_buf->buf);
|
||||||
dec->bs_ptr = NULL;
|
dec->bs_ptr = NULL;
|
||||||
|
|
||||||
map_msg_fb_it_probs_buf(dec);
|
map_msg_fb_it_probs_buf(dec);
|
||||||
|
|
@ -2632,24 +2627,24 @@ bool send_cmd_dec(struct radeon_decoder *dec, struct pipe_video_buffer *target,
|
||||||
send_msg_buf(dec);
|
send_msg_buf(dec);
|
||||||
|
|
||||||
if (dec->dpb_type < DPB_DYNAMIC_TIER_2)
|
if (dec->dpb_type < DPB_DYNAMIC_TIER_2)
|
||||||
send_cmd(dec, RDECODE_CMD_DPB_BUFFER, dec->dpb.res->buf, 0, RADEON_USAGE_READWRITE,
|
send_cmd(dec, RDECODE_CMD_DPB_BUFFER, dec->dpb->buf, 0, RADEON_USAGE_READWRITE,
|
||||||
RADEON_DOMAIN_VRAM);
|
RADEON_DOMAIN_VRAM);
|
||||||
if (dec->ctx.res)
|
if (dec->ctx)
|
||||||
send_cmd(dec, RDECODE_CMD_CONTEXT_BUFFER, dec->ctx.res->buf, 0, RADEON_USAGE_READWRITE,
|
send_cmd(dec, RDECODE_CMD_CONTEXT_BUFFER, dec->ctx->buf, 0, RADEON_USAGE_READWRITE,
|
||||||
RADEON_DOMAIN_VRAM);
|
RADEON_DOMAIN_VRAM);
|
||||||
send_cmd(dec, RDECODE_CMD_BITSTREAM_BUFFER, bs_buf->res->buf, 0, RADEON_USAGE_READ,
|
send_cmd(dec, RDECODE_CMD_BITSTREAM_BUFFER, bs_buf->buf, 0, RADEON_USAGE_READ,
|
||||||
RADEON_DOMAIN_GTT);
|
RADEON_DOMAIN_GTT);
|
||||||
send_cmd(dec, RDECODE_CMD_DECODING_TARGET_BUFFER, dt, 0, RADEON_USAGE_WRITE, RADEON_DOMAIN_VRAM);
|
send_cmd(dec, RDECODE_CMD_DECODING_TARGET_BUFFER, dt, 0, RADEON_USAGE_WRITE, RADEON_DOMAIN_VRAM);
|
||||||
send_cmd(dec, RDECODE_CMD_FEEDBACK_BUFFER, msg_fb_it_probs_buf->res->buf, FB_BUFFER_OFFSET,
|
send_cmd(dec, RDECODE_CMD_FEEDBACK_BUFFER, msg_fb_it_probs_buf->buf, FB_BUFFER_OFFSET,
|
||||||
RADEON_USAGE_WRITE, RADEON_DOMAIN_GTT);
|
RADEON_USAGE_WRITE, RADEON_DOMAIN_GTT);
|
||||||
if (have_it(dec))
|
if (have_it(dec))
|
||||||
send_cmd(dec, RDECODE_CMD_IT_SCALING_TABLE_BUFFER, msg_fb_it_probs_buf->res->buf,
|
send_cmd(dec, RDECODE_CMD_IT_SCALING_TABLE_BUFFER, msg_fb_it_probs_buf->buf,
|
||||||
FB_BUFFER_OFFSET + FB_BUFFER_SIZE, RADEON_USAGE_READ, RADEON_DOMAIN_GTT);
|
FB_BUFFER_OFFSET + FB_BUFFER_SIZE, RADEON_USAGE_READ, RADEON_DOMAIN_GTT);
|
||||||
else if (have_probs(dec))
|
else if (have_probs(dec))
|
||||||
send_cmd(dec, RDECODE_CMD_PROB_TBL_BUFFER, msg_fb_it_probs_buf->res->buf,
|
send_cmd(dec, RDECODE_CMD_PROB_TBL_BUFFER, msg_fb_it_probs_buf->buf,
|
||||||
FB_BUFFER_OFFSET + FB_BUFFER_SIZE, RADEON_USAGE_READ, RADEON_DOMAIN_GTT);
|
FB_BUFFER_OFFSET + FB_BUFFER_SIZE, RADEON_USAGE_READ, RADEON_DOMAIN_GTT);
|
||||||
if (picture->cenc)
|
if (picture->cenc)
|
||||||
send_cmd(dec, RDECODE_CMD_SUBSAMPLE, dec->subsample.res->buf, 0, RADEON_USAGE_READ,
|
send_cmd(dec, RDECODE_CMD_SUBSAMPLE, dec->subsample->buf, 0, RADEON_USAGE_READ,
|
||||||
RADEON_DOMAIN_VRAM);
|
RADEON_DOMAIN_VRAM);
|
||||||
|
|
||||||
if (dec->dpb_type == DPB_DYNAMIC_TIER_3)
|
if (dec->dpb_type == DPB_DYNAMIC_TIER_3)
|
||||||
|
|
@ -2955,8 +2950,8 @@ struct pipe_video_codec *radeon_create_decoder(struct pipe_context *context,
|
||||||
dec->num_dec_bufs = NUM_BUFFERS;
|
dec->num_dec_bufs = NUM_BUFFERS;
|
||||||
|
|
||||||
bs_buf_size = align(width * height / 32, 128);
|
bs_buf_size = align(width * height / 32, 128);
|
||||||
dec->msg_fb_it_probs_buffers = (struct rvid_buffer *) CALLOC(dec->num_dec_bufs, sizeof(struct rvid_buffer));
|
dec->msg_fb_it_probs_buffers = CALLOC(dec->num_dec_bufs, sizeof(struct si_resource *));
|
||||||
dec->bs_buffers = (struct rvid_buffer *) CALLOC(dec->num_dec_bufs, sizeof(struct rvid_buffer));
|
dec->bs_buffers = CALLOC(dec->num_dec_bufs, sizeof(struct si_resource *));
|
||||||
if(!dec->msg_fb_it_probs_buffers || !dec->bs_buffers)
|
if(!dec->msg_fb_it_probs_buffers || !dec->bs_buffers)
|
||||||
goto error;
|
goto error;
|
||||||
|
|
||||||
|
|
@ -2969,28 +2964,29 @@ struct pipe_video_codec *radeon_create_decoder(struct pipe_context *context,
|
||||||
VP9_PROBS_TABLE_SIZE :
|
VP9_PROBS_TABLE_SIZE :
|
||||||
sizeof(rvcn_dec_av1_segment_fg_t);
|
sizeof(rvcn_dec_av1_segment_fg_t);
|
||||||
/* use vram to improve performance, workaround an unknown bug */
|
/* use vram to improve performance, workaround an unknown bug */
|
||||||
if (!si_vid_create_buffer(dec->screen, &dec->msg_fb_it_probs_buffers[i], msg_fb_it_probs_size,
|
dec->msg_fb_it_probs_buffers[i] = si_resource(pipe_buffer_create(dec->screen, PIPE_BIND_CUSTOM,
|
||||||
PIPE_USAGE_DEFAULT)) {
|
PIPE_USAGE_DEFAULT, msg_fb_it_probs_size));
|
||||||
|
if (!dec->msg_fb_it_probs_buffers[i]) {
|
||||||
RADEON_DEC_ERR("Can't allocate message buffers.\n");
|
RADEON_DEC_ERR("Can't allocate message buffers.\n");
|
||||||
goto error;
|
goto error;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (!si_vid_create_buffer(dec->screen, &dec->bs_buffers[i], bs_buf_size,
|
dec->bs_buffers[i] = si_resource(pipe_buffer_create(dec->screen, 0, PIPE_USAGE_STAGING, bs_buf_size));
|
||||||
PIPE_USAGE_STAGING)) {
|
if (!dec->bs_buffers[i]) {
|
||||||
RADEON_DEC_ERR("Can't allocate bitstream buffers.\n");
|
RADEON_DEC_ERR("Can't allocate bitstream buffers.\n");
|
||||||
goto error;
|
goto error;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (have_probs(dec) && dec->stream_type == RDECODE_CODEC_VP9) {
|
if (have_probs(dec) && dec->stream_type == RDECODE_CODEC_VP9) {
|
||||||
struct rvid_buffer *buf;
|
struct si_resource *buf;
|
||||||
void *ptr;
|
void *ptr;
|
||||||
|
|
||||||
buf = &dec->msg_fb_it_probs_buffers[i];
|
buf = dec->msg_fb_it_probs_buffers[i];
|
||||||
ptr = dec->ws->buffer_map(dec->ws, buf->res->buf, NULL,
|
ptr = dec->ws->buffer_map(dec->ws, buf->buf, NULL,
|
||||||
PIPE_MAP_WRITE | RADEON_MAP_TEMPORARY);
|
PIPE_MAP_WRITE | RADEON_MAP_TEMPORARY);
|
||||||
ptr += FB_BUFFER_OFFSET + FB_BUFFER_SIZE;
|
ptr += FB_BUFFER_OFFSET + FB_BUFFER_SIZE;
|
||||||
ac_vcn_vp9_fill_probs_table(ptr);
|
ac_vcn_vp9_fill_probs_table(ptr);
|
||||||
dec->ws->buffer_unmap(dec->ws, buf->res->buf);
|
dec->ws->buffer_unmap(dec->ws, buf->buf);
|
||||||
dec->bs_ptr = NULL;
|
dec->bs_ptr = NULL;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
@ -3020,8 +3016,9 @@ struct pipe_video_codec *radeon_create_decoder(struct pipe_context *context,
|
||||||
if (dec->dpb_type < DPB_DYNAMIC_TIER_2)
|
if (dec->dpb_type < DPB_DYNAMIC_TIER_2)
|
||||||
dec->dpb_size = calc_dpb_size(dec);
|
dec->dpb_size = calc_dpb_size(dec);
|
||||||
|
|
||||||
if (!si_vid_create_buffer(dec->screen, &dec->sessionctx, RDECODE_SESSION_CONTEXT_SIZE,
|
dec->sessionctx = si_resource(pipe_buffer_create(dec->screen, 0, PIPE_USAGE_DEFAULT,
|
||||||
PIPE_USAGE_DEFAULT)) {
|
RDECODE_SESSION_CONTEXT_SIZE));
|
||||||
|
if (!dec->sessionctx) {
|
||||||
RADEON_DEC_ERR("Can't allocate session ctx.\n");
|
RADEON_DEC_ERR("Can't allocate session ctx.\n");
|
||||||
goto error;
|
goto error;
|
||||||
}
|
}
|
||||||
|
|
@ -3173,17 +3170,16 @@ error:
|
||||||
|
|
||||||
if (dec->msg_fb_it_probs_buffers && dec->bs_buffers) {
|
if (dec->msg_fb_it_probs_buffers && dec->bs_buffers) {
|
||||||
for (i = 0; i < dec->num_dec_bufs; ++i) {
|
for (i = 0; i < dec->num_dec_bufs; ++i) {
|
||||||
si_vid_destroy_buffer(&dec->msg_fb_it_probs_buffers[i]);
|
si_resource_reference(&dec->msg_fb_it_probs_buffers[i], NULL);
|
||||||
si_vid_destroy_buffer(&dec->bs_buffers[i]);
|
si_resource_reference(&dec->bs_buffers[i], NULL);
|
||||||
}
|
}
|
||||||
FREE(dec->msg_fb_it_probs_buffers);
|
FREE(dec->msg_fb_it_probs_buffers);
|
||||||
FREE(dec->bs_buffers);
|
FREE(dec->bs_buffers);
|
||||||
}
|
}
|
||||||
|
|
||||||
if (dec->dpb_type < DPB_DYNAMIC_TIER_2)
|
si_resource_reference(&dec->dpb, NULL);
|
||||||
si_vid_destroy_buffer(&dec->dpb);
|
si_resource_reference(&dec->ctx, NULL);
|
||||||
si_vid_destroy_buffer(&dec->ctx);
|
si_resource_reference(&dec->sessionctx, NULL);
|
||||||
si_vid_destroy_buffer(&dec->sessionctx);
|
|
||||||
|
|
||||||
err:
|
err:
|
||||||
FREE(dec->jcs);
|
FREE(dec->jcs);
|
||||||
|
|
|
||||||
|
|
@ -88,13 +88,13 @@ struct radeon_decoder {
|
||||||
bool vcn_dec_sw_ring;
|
bool vcn_dec_sw_ring;
|
||||||
struct rvcn_sq_var sq;
|
struct rvcn_sq_var sq;
|
||||||
|
|
||||||
struct rvid_buffer *msg_fb_it_probs_buffers;
|
struct si_resource **msg_fb_it_probs_buffers;
|
||||||
unsigned num_dec_bufs;
|
unsigned num_dec_bufs;
|
||||||
struct rvid_buffer *bs_buffers;
|
struct si_resource **bs_buffers;
|
||||||
struct rvid_buffer dpb;
|
struct si_resource *dpb;
|
||||||
struct rvid_buffer ctx;
|
struct si_resource *ctx;
|
||||||
struct rvid_buffer sessionctx;
|
struct si_resource *sessionctx;
|
||||||
struct rvid_buffer subsample;
|
struct si_resource *subsample;
|
||||||
|
|
||||||
unsigned bs_size;
|
unsigned bs_size;
|
||||||
unsigned cur_buffer;
|
unsigned cur_buffer;
|
||||||
|
|
|
||||||
|
|
@ -414,21 +414,21 @@ bool send_cmd_jpeg(struct radeon_decoder *dec, struct pipe_video_buffer *target,
|
||||||
struct pipe_picture_desc *picture)
|
struct pipe_picture_desc *picture)
|
||||||
{
|
{
|
||||||
struct pb_buffer_lean *dt;
|
struct pb_buffer_lean *dt;
|
||||||
struct rvid_buffer *bs_buf;
|
struct si_resource *bs_buf;
|
||||||
|
|
||||||
bs_buf = &dec->bs_buffers[dec->cur_buffer];
|
bs_buf = dec->bs_buffers[dec->cur_buffer];
|
||||||
|
|
||||||
memset(dec->bs_ptr, 0, align(dec->bs_size, 128) - dec->bs_size);
|
memset(dec->bs_ptr, 0, align(dec->bs_size, 128) - dec->bs_size);
|
||||||
dec->ws->buffer_unmap(dec->ws, bs_buf->res->buf);
|
dec->ws->buffer_unmap(dec->ws, bs_buf->buf);
|
||||||
dec->bs_ptr = NULL;
|
dec->bs_ptr = NULL;
|
||||||
|
|
||||||
dt = radeon_jpeg_get_decode_param(dec, target, picture);
|
dt = radeon_jpeg_get_decode_param(dec, target, picture);
|
||||||
|
|
||||||
if (dec->jpg_reg.version == RDECODE_JPEG_REG_VER_V1) {
|
if (dec->jpg_reg.version == RDECODE_JPEG_REG_VER_V1) {
|
||||||
send_cmd_bitstream(dec, bs_buf->res->buf, 0, RADEON_USAGE_READ, RADEON_DOMAIN_GTT);
|
send_cmd_bitstream(dec, bs_buf->buf, 0, RADEON_USAGE_READ, RADEON_DOMAIN_GTT);
|
||||||
send_cmd_target(dec, dt, 0, RADEON_USAGE_WRITE, RADEON_DOMAIN_VRAM);
|
send_cmd_target(dec, dt, 0, RADEON_USAGE_WRITE, RADEON_DOMAIN_VRAM);
|
||||||
} else {
|
} else {
|
||||||
send_cmd_bitstream_direct(dec, bs_buf->res->buf, 0, RADEON_USAGE_READ, RADEON_DOMAIN_GTT);
|
send_cmd_bitstream_direct(dec, bs_buf->buf, 0, RADEON_USAGE_READ, RADEON_DOMAIN_GTT);
|
||||||
send_cmd_target_direct(dec, dt, 0, RADEON_USAGE_WRITE, RADEON_DOMAIN_VRAM, target->buffer_format);
|
send_cmd_target_direct(dec, dt, 0, RADEON_USAGE_WRITE, RADEON_DOMAIN_VRAM, target->buffer_format);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -1205,24 +1205,22 @@ static int setup_cdf(struct radeon_encoder *enc)
|
||||||
{
|
{
|
||||||
unsigned char *p_cdf = NULL;
|
unsigned char *p_cdf = NULL;
|
||||||
|
|
||||||
if (!enc->cdf ||
|
enc->cdf = si_resource(pipe_buffer_create(enc->screen, 0, PIPE_USAGE_DEFAULT,
|
||||||
!si_vid_create_buffer(enc->screen,
|
VCN_ENC_AV1_DEFAULT_CDF_SIZE));
|
||||||
enc->cdf,
|
if (!enc->cdf) {
|
||||||
VCN_ENC_AV1_DEFAULT_CDF_SIZE,
|
|
||||||
PIPE_USAGE_DYNAMIC)) {
|
|
||||||
RADEON_ENC_ERR("Can't create CDF buffer.\n");
|
RADEON_ENC_ERR("Can't create CDF buffer.\n");
|
||||||
goto error;
|
goto error;
|
||||||
}
|
}
|
||||||
|
|
||||||
p_cdf = enc->ws->buffer_map(enc->ws,
|
p_cdf = enc->ws->buffer_map(enc->ws,
|
||||||
enc->cdf->res->buf,
|
enc->cdf->buf,
|
||||||
NULL,
|
NULL,
|
||||||
PIPE_MAP_READ_WRITE | RADEON_MAP_TEMPORARY);
|
PIPE_MAP_READ_WRITE | RADEON_MAP_TEMPORARY);
|
||||||
if (!p_cdf)
|
if (!p_cdf)
|
||||||
goto error;
|
goto error;
|
||||||
|
|
||||||
memcpy(p_cdf, rvcn_av1_cdf_default_table, VCN_ENC_AV1_DEFAULT_CDF_SIZE);
|
memcpy(p_cdf, rvcn_av1_cdf_default_table, VCN_ENC_AV1_DEFAULT_CDF_SIZE);
|
||||||
enc->ws->buffer_unmap(enc->ws, enc->cdf->res->buf);
|
enc->ws->buffer_unmap(enc->ws, enc->cdf->buf);
|
||||||
|
|
||||||
return 0;
|
return 0;
|
||||||
|
|
||||||
|
|
@ -1463,7 +1461,7 @@ static int generate_roi_map(struct radeon_encoder *enc)
|
||||||
radeon_vcn_enc_blocks_in_frame(enc, &width_in_block, &height_in_block);
|
radeon_vcn_enc_blocks_in_frame(enc, &width_in_block, &height_in_block);
|
||||||
|
|
||||||
p_roi = enc->ws->buffer_map(enc->ws,
|
p_roi = enc->ws->buffer_map(enc->ws,
|
||||||
enc->roi->res->buf,
|
enc->roi->buf,
|
||||||
NULL,
|
NULL,
|
||||||
PIPE_MAP_READ_WRITE | RADEON_MAP_TEMPORARY);
|
PIPE_MAP_READ_WRITE | RADEON_MAP_TEMPORARY);
|
||||||
if (!p_roi)
|
if (!p_roi)
|
||||||
|
|
@ -1477,7 +1475,7 @@ static int generate_roi_map(struct radeon_encoder *enc)
|
||||||
arrange_qp_map(p_roi, region, &enc->enc_pic.enc_qp_map);
|
arrange_qp_map(p_roi, region, &enc->enc_pic.enc_qp_map);
|
||||||
}
|
}
|
||||||
|
|
||||||
enc->ws->buffer_unmap(enc->ws, enc->roi->res->buf);
|
enc->ws->buffer_unmap(enc->ws, enc->roi->buf);
|
||||||
return 0;
|
return 0;
|
||||||
error:
|
error:
|
||||||
return -1;
|
return -1;
|
||||||
|
|
@ -1546,34 +1544,27 @@ static void radeon_enc_begin_frame(struct pipe_video_codec *encoder,
|
||||||
(enc->enc_pic.rc_per_pic.max_au_size_i != pic->rc[0].max_au_size) ||
|
(enc->enc_pic.rc_per_pic.max_au_size_i != pic->rc[0].max_au_size) ||
|
||||||
(enc->enc_pic.rc_per_pic.qvbr_quality_level != pic->rc[0].vbr_quality_factor);
|
(enc->enc_pic.rc_per_pic.qvbr_quality_level != pic->rc[0].vbr_quality_factor);
|
||||||
|
|
||||||
if (!enc->cdf) {
|
if (!enc->cdf && setup_cdf(enc)) {
|
||||||
enc->cdf = CALLOC_STRUCT(rvid_buffer);
|
|
||||||
if (setup_cdf(enc)) {
|
|
||||||
RADEON_ENC_ERR("Can't create cdf buffer.\n");
|
RADEON_ENC_ERR("Can't create cdf buffer.\n");
|
||||||
goto error;
|
goto error;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
|
||||||
|
|
||||||
if (enc->dpb_type == DPB_TIER_2)
|
if (enc->dpb_type == DPB_TIER_2)
|
||||||
dpb_slots = 0;
|
dpb_slots = 0;
|
||||||
|
|
||||||
radeon_vcn_enc_get_param(enc, picture);
|
radeon_vcn_enc_get_param(enc, picture);
|
||||||
|
if (dpb_slots && !enc->dpb && setup_dpb(enc, dpb_slots)) {
|
||||||
|
enc->dpb = si_resource(pipe_buffer_create(enc->screen, 0, PIPE_USAGE_DEFAULT, enc->dpb_size));
|
||||||
if (!enc->dpb) {
|
if (!enc->dpb) {
|
||||||
enc->dpb = CALLOC_STRUCT(rvid_buffer);
|
|
||||||
if (setup_dpb(enc, dpb_slots)) {
|
|
||||||
if (!enc->dpb ||
|
|
||||||
!si_vid_create_buffer(enc->screen, enc->dpb, enc->dpb_size, PIPE_USAGE_DEFAULT)) {
|
|
||||||
RADEON_ENC_ERR("Can't create DPB buffer.\n");
|
RADEON_ENC_ERR("Can't create DPB buffer.\n");
|
||||||
goto error;
|
goto error;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
|
||||||
|
|
||||||
if ((sscreen->info.vcn_ip_version >= VCN_5_0_0) && enc->metadata_size && !enc->meta) {
|
if ((sscreen->info.vcn_ip_version >= VCN_5_0_0) && enc->metadata_size && !enc->meta) {
|
||||||
enc->meta = CALLOC_STRUCT(rvid_buffer);
|
enc->meta = si_resource(pipe_buffer_create(enc->screen, 0, PIPE_USAGE_DEFAULT, enc->metadata_size));
|
||||||
if (!enc->meta ||
|
if (!enc->meta) {
|
||||||
!si_vid_create_buffer(enc->screen, enc->meta, enc->metadata_size, PIPE_USAGE_DEFAULT)) {
|
|
||||||
RADEON_ENC_ERR("Can't create meta buffer.\n");
|
RADEON_ENC_ERR("Can't create meta buffer.\n");
|
||||||
goto error;
|
goto error;
|
||||||
}
|
}
|
||||||
|
|
@ -1581,12 +1572,12 @@ static void radeon_enc_begin_frame(struct pipe_video_codec *encoder,
|
||||||
|
|
||||||
if (dpb_slots > enc->dpb_slots) {
|
if (dpb_slots > enc->dpb_slots) {
|
||||||
setup_dpb(enc, dpb_slots);
|
setup_dpb(enc, dpb_slots);
|
||||||
if (!si_vid_resize_buffer(enc->base.context, &enc->dpb->res, enc->dpb_size, NULL)) {
|
if (!si_vid_resize_buffer(enc->base.context, &enc->dpb, enc->dpb_size, NULL)) {
|
||||||
RADEON_ENC_ERR("Can't resize DPB buffer.\n");
|
RADEON_ENC_ERR("Can't resize DPB buffer.\n");
|
||||||
goto error;
|
goto error;
|
||||||
}
|
}
|
||||||
if (sscreen->info.vcn_ip_version >= VCN_5_0_0 && enc->metadata_size &&
|
if (sscreen->info.vcn_ip_version >= VCN_5_0_0 && enc->metadata_size &&
|
||||||
!si_vid_resize_buffer(enc->base.context, &enc->meta->res, enc->metadata_size, NULL)) {
|
!si_vid_resize_buffer(enc->base.context, &enc->meta, enc->metadata_size, NULL)) {
|
||||||
RADEON_ENC_ERR("Can't resize meta buffer.\n");
|
RADEON_ENC_ERR("Can't resize meta buffer.\n");
|
||||||
goto error;
|
goto error;
|
||||||
}
|
}
|
||||||
|
|
@ -1595,10 +1586,9 @@ static void radeon_enc_begin_frame(struct pipe_video_codec *encoder,
|
||||||
/* qp map buffer could be created here, and release at the end */
|
/* qp map buffer could be created here, and release at the end */
|
||||||
if (enc->enc_pic.enc_qp_map.qp_map_type != RENCODE_QP_MAP_TYPE_NONE) {
|
if (enc->enc_pic.enc_qp_map.qp_map_type != RENCODE_QP_MAP_TYPE_NONE) {
|
||||||
if (!enc->roi) {
|
if (!enc->roi) {
|
||||||
enc->roi = CALLOC_STRUCT(rvid_buffer);
|
|
||||||
enc->roi_size = roi_buffer_size(enc);
|
enc->roi_size = roi_buffer_size(enc);
|
||||||
if (!enc->roi || !enc->roi_size ||
|
enc->roi = si_resource(pipe_buffer_create(enc->screen, 0, PIPE_USAGE_STAGING, enc->roi_size));
|
||||||
!si_vid_create_buffer(enc->screen, enc->roi, enc->roi_size, PIPE_USAGE_DYNAMIC)) {
|
if (!enc->roi) {
|
||||||
RADEON_ENC_ERR("Can't create ROI buffer.\n");
|
RADEON_ENC_ERR("Can't create ROI buffer.\n");
|
||||||
goto error;
|
goto error;
|
||||||
}
|
}
|
||||||
|
|
@ -1625,9 +1615,8 @@ static void radeon_enc_begin_frame(struct pipe_video_codec *encoder,
|
||||||
enc->need_feedback = false;
|
enc->need_feedback = false;
|
||||||
|
|
||||||
if (!enc->si) {
|
if (!enc->si) {
|
||||||
enc->si = CALLOC_STRUCT(rvid_buffer);
|
enc->si = si_resource(pipe_buffer_create(enc->screen, 0, PIPE_USAGE_DEFAULT, 128 * 1024));
|
||||||
if (!enc->si ||
|
if (!enc->si) {
|
||||||
!si_vid_create_buffer(enc->screen, enc->si, 128 * 1024, PIPE_USAGE_DEFAULT)) {
|
|
||||||
RADEON_ENC_ERR("Can't create session buffer.\n");
|
RADEON_ENC_ERR("Can't create session buffer.\n");
|
||||||
goto error;
|
goto error;
|
||||||
}
|
}
|
||||||
|
|
@ -1640,11 +1629,11 @@ static void radeon_enc_begin_frame(struct pipe_video_codec *encoder,
|
||||||
return;
|
return;
|
||||||
|
|
||||||
error:
|
error:
|
||||||
RADEON_ENC_DESTROY_VIDEO_BUFFER(enc->dpb);
|
si_resource_reference(&enc->dpb, NULL);
|
||||||
RADEON_ENC_DESTROY_VIDEO_BUFFER(enc->si);
|
si_resource_reference(&enc->si, NULL);
|
||||||
RADEON_ENC_DESTROY_VIDEO_BUFFER(enc->cdf);
|
si_resource_reference(&enc->cdf, NULL);
|
||||||
RADEON_ENC_DESTROY_VIDEO_BUFFER(enc->roi);
|
si_resource_reference(&enc->roi, NULL);
|
||||||
RADEON_ENC_DESTROY_VIDEO_BUFFER(enc->meta);
|
si_resource_reference(&enc->meta, NULL);
|
||||||
}
|
}
|
||||||
|
|
||||||
static uint32_t radeon_vcn_enc_encode_h264_header(struct radeon_encoder *enc,
|
static uint32_t radeon_vcn_enc_encode_h264_header(struct radeon_encoder *enc,
|
||||||
|
|
@ -1788,14 +1777,15 @@ static void radeon_enc_encode_bitstream(struct pipe_video_codec *encoder,
|
||||||
enc->bs_size = destination->width0;
|
enc->bs_size = destination->width0;
|
||||||
enc->bs_offset = 0;
|
enc->bs_offset = 0;
|
||||||
|
|
||||||
*fb = enc->fb = CALLOC_STRUCT(rvid_buffer);
|
*fb = enc->fb = CALLOC_STRUCT(radeon_enc_fb_buffer);
|
||||||
|
|
||||||
if (!si_vid_create_buffer(enc->screen, enc->fb, 4096, PIPE_USAGE_STAGING)) {
|
enc->fb->res = si_resource(pipe_buffer_create(enc->screen, 0, PIPE_USAGE_STAGING, 4096));
|
||||||
|
if (!enc->fb->res) {
|
||||||
RADEON_ENC_ERR("Can't create feedback buffer.\n");
|
RADEON_ENC_ERR("Can't create feedback buffer.\n");
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
enc->fb->user_data = radeon_vcn_enc_encode_headers(enc);
|
enc->fb->data = radeon_vcn_enc_encode_headers(enc);
|
||||||
|
|
||||||
if (vid_buf->base.statistics_data) {
|
if (vid_buf->base.statistics_data) {
|
||||||
enc->get_buffer(vid_buf->base.statistics_data, &enc->stats, NULL);
|
enc->get_buffer(vid_buf->base.statistics_data, &enc->stats, NULL);
|
||||||
|
|
@ -1945,13 +1935,13 @@ static void radeon_enc_destroy(struct pipe_video_codec *encoder)
|
||||||
enc->need_feedback = false;
|
enc->need_feedback = false;
|
||||||
enc->destroy(enc);
|
enc->destroy(enc);
|
||||||
flush(enc, PIPE_FLUSH_ASYNC, NULL);
|
flush(enc, PIPE_FLUSH_ASYNC, NULL);
|
||||||
RADEON_ENC_DESTROY_VIDEO_BUFFER(enc->si);
|
si_resource_reference(&enc->si, NULL);
|
||||||
}
|
}
|
||||||
|
|
||||||
RADEON_ENC_DESTROY_VIDEO_BUFFER(enc->dpb);
|
si_resource_reference(&enc->dpb, NULL);
|
||||||
RADEON_ENC_DESTROY_VIDEO_BUFFER(enc->cdf);
|
si_resource_reference(&enc->cdf, NULL);
|
||||||
RADEON_ENC_DESTROY_VIDEO_BUFFER(enc->roi);
|
si_resource_reference(&enc->roi, NULL);
|
||||||
RADEON_ENC_DESTROY_VIDEO_BUFFER(enc->meta);
|
si_resource_reference(&enc->meta, NULL);
|
||||||
enc->ws->cs_destroy(&enc->cs);
|
enc->ws->cs_destroy(&enc->cs);
|
||||||
if (enc->ectx)
|
if (enc->ectx)
|
||||||
enc->ectx->destroy(enc->ectx);
|
enc->ectx->destroy(enc->ectx);
|
||||||
|
|
@ -1963,7 +1953,7 @@ static void radeon_enc_get_feedback(struct pipe_video_codec *encoder, void *feed
|
||||||
unsigned *size, struct pipe_enc_feedback_metadata *metadata)
|
unsigned *size, struct pipe_enc_feedback_metadata *metadata)
|
||||||
{
|
{
|
||||||
struct radeon_encoder *enc = (struct radeon_encoder *)encoder;
|
struct radeon_encoder *enc = (struct radeon_encoder *)encoder;
|
||||||
struct rvid_buffer *fb = feedback;
|
struct radeon_enc_fb_buffer *fb = feedback;
|
||||||
|
|
||||||
uint32_t *ptr = enc->ws->buffer_map(enc->ws, fb->res->buf, NULL,
|
uint32_t *ptr = enc->ws->buffer_map(enc->ws, fb->res->buf, NULL,
|
||||||
PIPE_MAP_READ_WRITE | RADEON_MAP_TEMPORARY);
|
PIPE_MAP_READ_WRITE | RADEON_MAP_TEMPORARY);
|
||||||
|
|
@ -1975,8 +1965,8 @@ static void radeon_enc_get_feedback(struct pipe_video_codec *encoder, void *feed
|
||||||
|
|
||||||
metadata->present_metadata = PIPE_VIDEO_FEEDBACK_METADATA_TYPE_CODEC_UNIT_LOCATION;
|
metadata->present_metadata = PIPE_VIDEO_FEEDBACK_METADATA_TYPE_CODEC_UNIT_LOCATION;
|
||||||
|
|
||||||
if (fb->user_data) {
|
if (fb->data) {
|
||||||
struct rvcn_enc_feedback_data *data = fb->user_data;
|
struct rvcn_enc_feedback_data *data = fb->data;
|
||||||
metadata->codec_unit_metadata_count = data->num_segments;
|
metadata->codec_unit_metadata_count = data->num_segments;
|
||||||
for (unsigned i = 0; i < data->num_segments; i++) {
|
for (unsigned i = 0; i < data->num_segments; i++) {
|
||||||
metadata->codec_unit_metadata[i].offset = data->segments[i].offset;
|
metadata->codec_unit_metadata[i].offset = data->segments[i].offset;
|
||||||
|
|
@ -1988,8 +1978,8 @@ static void radeon_enc_get_feedback(struct pipe_video_codec *encoder, void *feed
|
||||||
metadata->codec_unit_metadata[i].flags = PIPE_VIDEO_CODEC_UNIT_LOCATION_FLAG_SINGLE_NALU;
|
metadata->codec_unit_metadata[i].flags = PIPE_VIDEO_CODEC_UNIT_LOCATION_FLAG_SINGLE_NALU;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
FREE(fb->user_data);
|
FREE(fb->data);
|
||||||
fb->user_data = NULL;
|
fb->data = NULL;
|
||||||
} else {
|
} else {
|
||||||
metadata->codec_unit_metadata_count = 1;
|
metadata->codec_unit_metadata_count = 1;
|
||||||
metadata->codec_unit_metadata[0].offset = 0;
|
metadata->codec_unit_metadata[0].offset = 0;
|
||||||
|
|
@ -1997,7 +1987,8 @@ static void radeon_enc_get_feedback(struct pipe_video_codec *encoder, void *feed
|
||||||
metadata->codec_unit_metadata[0].flags = 0;
|
metadata->codec_unit_metadata[0].flags = 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
RADEON_ENC_DESTROY_VIDEO_BUFFER(fb);
|
si_resource_reference(&fb->res, NULL);
|
||||||
|
FREE(fb);
|
||||||
}
|
}
|
||||||
|
|
||||||
static int radeon_enc_fence_wait(struct pipe_video_codec *encoder,
|
static int radeon_enc_fence_wait(struct pipe_video_codec *encoder,
|
||||||
|
|
@ -2054,8 +2045,8 @@ void radeon_enc_create_dpb_aux_buffers(struct radeon_encoder *enc, struct radeon
|
||||||
|
|
||||||
uint32_t fcb_size = radeon_enc_frame_context_buffer_size(enc);
|
uint32_t fcb_size = radeon_enc_frame_context_buffer_size(enc);
|
||||||
|
|
||||||
buf->fcb = CALLOC_STRUCT(rvid_buffer);
|
buf->fcb = si_resource(pipe_buffer_create(enc->screen, 0, PIPE_USAGE_DEFAULT, fcb_size));
|
||||||
if (!buf->fcb || !si_vid_create_buffer(enc->screen, buf->fcb, fcb_size, PIPE_USAGE_DEFAULT)) {
|
if (!buf->fcb) {
|
||||||
RADEON_ENC_ERR("Can't create fcb buffer!\n");
|
RADEON_ENC_ERR("Can't create fcb buffer!\n");
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
@ -2069,8 +2060,8 @@ void radeon_enc_create_dpb_aux_buffers(struct radeon_encoder *enc, struct radeon
|
||||||
buf->pre_luma = (struct si_texture *)((struct vl_video_buffer *)buf->pre)->resources[0];
|
buf->pre_luma = (struct si_texture *)((struct vl_video_buffer *)buf->pre)->resources[0];
|
||||||
buf->pre_chroma = (struct si_texture *)((struct vl_video_buffer *)buf->pre)->resources[1];
|
buf->pre_chroma = (struct si_texture *)((struct vl_video_buffer *)buf->pre)->resources[1];
|
||||||
|
|
||||||
buf->pre_fcb = CALLOC_STRUCT(rvid_buffer);
|
buf->pre_fcb = si_resource(pipe_buffer_create(enc->screen, 0, PIPE_USAGE_DEFAULT, fcb_size));
|
||||||
if (!buf->pre_fcb || !si_vid_create_buffer(enc->screen, buf->pre_fcb, fcb_size, PIPE_USAGE_DEFAULT)) {
|
if (!buf->pre_fcb) {
|
||||||
RADEON_ENC_ERR("Can't create preenc fcb buffer!\n");
|
RADEON_ENC_ERR("Can't create preenc fcb buffer!\n");
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
@ -2084,8 +2075,8 @@ static void radeon_enc_destroy_dpb_buffer(void *data)
|
||||||
if (dpb->pre)
|
if (dpb->pre)
|
||||||
dpb->pre->destroy(dpb->pre);
|
dpb->pre->destroy(dpb->pre);
|
||||||
|
|
||||||
RADEON_ENC_DESTROY_VIDEO_BUFFER(dpb->fcb);
|
si_resource_reference(&dpb->fcb, NULL);
|
||||||
RADEON_ENC_DESTROY_VIDEO_BUFFER(dpb->pre_fcb);
|
si_resource_reference(&dpb->pre_fcb, NULL);
|
||||||
FREE(dpb);
|
FREE(dpb);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -39,15 +39,6 @@
|
||||||
*high = temp; \
|
*high = temp; \
|
||||||
} while(0)
|
} while(0)
|
||||||
|
|
||||||
#define RADEON_ENC_DESTROY_VIDEO_BUFFER(buf) \
|
|
||||||
do { \
|
|
||||||
if (buf) { \
|
|
||||||
si_vid_destroy_buffer(buf); \
|
|
||||||
FREE(buf); \
|
|
||||||
(buf) = NULL; \
|
|
||||||
} \
|
|
||||||
} while(0)
|
|
||||||
|
|
||||||
#define RADEON_ENC_ERR(fmt, args...) \
|
#define RADEON_ENC_ERR(fmt, args...) \
|
||||||
do { \
|
do { \
|
||||||
enc->error = true; \
|
enc->error = true; \
|
||||||
|
|
@ -67,10 +58,15 @@ struct radeon_enc_dpb_buffer {
|
||||||
|
|
||||||
struct si_texture *luma; /* recon luma */
|
struct si_texture *luma; /* recon luma */
|
||||||
struct si_texture *chroma; /* recon chroma */
|
struct si_texture *chroma; /* recon chroma */
|
||||||
struct rvid_buffer *fcb; /* frame context buffer*/
|
struct si_resource *fcb; /* frame context buffer*/
|
||||||
struct si_texture *pre_luma; /* preenc recon luma */
|
struct si_texture *pre_luma; /* preenc recon luma */
|
||||||
struct si_texture *pre_chroma;/* preenc recon chroma */
|
struct si_texture *pre_chroma;/* preenc recon chroma */
|
||||||
struct rvid_buffer *pre_fcb; /* preenc frame context buffer */
|
struct si_resource *pre_fcb; /* preenc frame context buffer */
|
||||||
|
};
|
||||||
|
|
||||||
|
struct radeon_enc_fb_buffer {
|
||||||
|
struct si_resource *res;
|
||||||
|
void *data;
|
||||||
};
|
};
|
||||||
|
|
||||||
struct radeon_enc_pic {
|
struct radeon_enc_pic {
|
||||||
|
|
@ -240,12 +236,12 @@ struct radeon_encoder {
|
||||||
unsigned bs_size;
|
unsigned bs_size;
|
||||||
unsigned bs_offset;
|
unsigned bs_offset;
|
||||||
|
|
||||||
struct rvid_buffer *si;
|
struct si_resource *si;
|
||||||
struct rvid_buffer *fb;
|
struct radeon_enc_fb_buffer *fb;
|
||||||
struct rvid_buffer *dpb;
|
struct si_resource *dpb;
|
||||||
struct rvid_buffer *cdf;
|
struct si_resource *cdf;
|
||||||
struct rvid_buffer *roi;
|
struct si_resource *roi;
|
||||||
struct rvid_buffer *meta;
|
struct si_resource *meta;
|
||||||
struct radeon_enc_pic enc_pic;
|
struct radeon_enc_pic enc_pic;
|
||||||
struct pb_buffer_lean *stats;
|
struct pb_buffer_lean *stats;
|
||||||
rvcn_enc_cmd_t cmd;
|
rvcn_enc_cmd_t cmd;
|
||||||
|
|
|
||||||
|
|
@ -21,7 +21,7 @@ static void radeon_enc_session_info(struct radeon_encoder *enc)
|
||||||
{
|
{
|
||||||
RADEON_ENC_BEGIN(enc->cmd.session_info);
|
RADEON_ENC_BEGIN(enc->cmd.session_info);
|
||||||
RADEON_ENC_CS(enc->enc_pic.session_info.interface_version);
|
RADEON_ENC_CS(enc->enc_pic.session_info.interface_version);
|
||||||
RADEON_ENC_READWRITE(enc->si->res->buf, enc->si->res->domains, 0x0);
|
RADEON_ENC_READWRITE(enc->si->buf, enc->si->domains, 0x0);
|
||||||
RADEON_ENC_CS(RENCODE_ENGINE_TYPE_ENCODE);
|
RADEON_ENC_CS(RENCODE_ENGINE_TYPE_ENCODE);
|
||||||
RADEON_ENC_END();
|
RADEON_ENC_END();
|
||||||
}
|
}
|
||||||
|
|
@ -942,7 +942,7 @@ static void radeon_enc_ctx(struct radeon_encoder *enc)
|
||||||
enc->enc_pic.ctx_buf.two_pass_search_center_map_offset = 0;
|
enc->enc_pic.ctx_buf.two_pass_search_center_map_offset = 0;
|
||||||
|
|
||||||
RADEON_ENC_BEGIN(enc->cmd.ctx);
|
RADEON_ENC_BEGIN(enc->cmd.ctx);
|
||||||
RADEON_ENC_READWRITE(enc->dpb->res->buf, enc->dpb->res->domains, 0);
|
RADEON_ENC_READWRITE(enc->dpb->buf, enc->dpb->domains, 0);
|
||||||
RADEON_ENC_CS(enc->enc_pic.ctx_buf.swizzle_mode);
|
RADEON_ENC_CS(enc->enc_pic.ctx_buf.swizzle_mode);
|
||||||
RADEON_ENC_CS(enc->enc_pic.ctx_buf.rec_luma_pitch);
|
RADEON_ENC_CS(enc->enc_pic.ctx_buf.rec_luma_pitch);
|
||||||
RADEON_ENC_CS(enc->enc_pic.ctx_buf.rec_chroma_pitch);
|
RADEON_ENC_CS(enc->enc_pic.ctx_buf.rec_chroma_pitch);
|
||||||
|
|
@ -1102,7 +1102,7 @@ static void radeon_enc_qp_map(struct radeon_encoder *enc)
|
||||||
RADEON_ENC_BEGIN(enc->cmd.enc_qp_map);
|
RADEON_ENC_BEGIN(enc->cmd.enc_qp_map);
|
||||||
RADEON_ENC_CS(enc->enc_pic.enc_qp_map.qp_map_type);
|
RADEON_ENC_CS(enc->enc_pic.enc_qp_map.qp_map_type);
|
||||||
if (enc->enc_pic.enc_qp_map.qp_map_type != RENCODE_QP_MAP_TYPE_NONE)
|
if (enc->enc_pic.enc_qp_map.qp_map_type != RENCODE_QP_MAP_TYPE_NONE)
|
||||||
RADEON_ENC_READWRITE(enc->roi->res->buf, enc->roi->res->domains, 0);
|
RADEON_ENC_READWRITE(enc->roi->buf, enc->roi->domains, 0);
|
||||||
else {
|
else {
|
||||||
RADEON_ENC_CS(0); /* use null for roi buffer */
|
RADEON_ENC_CS(0); /* use null for roi buffer */
|
||||||
RADEON_ENC_CS(0); /* use null for roi buffer */
|
RADEON_ENC_CS(0); /* use null for roi buffer */
|
||||||
|
|
|
||||||
|
|
@ -98,7 +98,7 @@ static void radeon_enc_ctx(struct radeon_encoder *enc)
|
||||||
enc->enc_pic.ctx_buf.two_pass_search_center_map_offset = 0;
|
enc->enc_pic.ctx_buf.two_pass_search_center_map_offset = 0;
|
||||||
|
|
||||||
RADEON_ENC_BEGIN(enc->cmd.ctx);
|
RADEON_ENC_BEGIN(enc->cmd.ctx);
|
||||||
RADEON_ENC_READWRITE(enc->dpb->res->buf, enc->dpb->res->domains, 0);
|
RADEON_ENC_READWRITE(enc->dpb->buf, enc->dpb->domains, 0);
|
||||||
RADEON_ENC_CS(enc->enc_pic.ctx_buf.swizzle_mode);
|
RADEON_ENC_CS(enc->enc_pic.ctx_buf.swizzle_mode);
|
||||||
RADEON_ENC_CS(enc->enc_pic.ctx_buf.rec_luma_pitch);
|
RADEON_ENC_CS(enc->enc_pic.ctx_buf.rec_luma_pitch);
|
||||||
RADEON_ENC_CS(enc->enc_pic.ctx_buf.rec_chroma_pitch);
|
RADEON_ENC_CS(enc->enc_pic.ctx_buf.rec_chroma_pitch);
|
||||||
|
|
|
||||||
|
|
@ -23,7 +23,7 @@ static void radeon_enc_session_info(struct radeon_encoder *enc)
|
||||||
{
|
{
|
||||||
RADEON_ENC_BEGIN(enc->cmd.session_info);
|
RADEON_ENC_BEGIN(enc->cmd.session_info);
|
||||||
RADEON_ENC_CS(enc->enc_pic.session_info.interface_version);
|
RADEON_ENC_CS(enc->enc_pic.session_info.interface_version);
|
||||||
RADEON_ENC_READWRITE(enc->si->res->buf, enc->si->res->domains, 0x0);
|
RADEON_ENC_READWRITE(enc->si->buf, enc->si->domains, 0x0);
|
||||||
RADEON_ENC_CS(0); /* padding 0, not used for vcn3 */
|
RADEON_ENC_CS(0); /* padding 0, not used for vcn3 */
|
||||||
RADEON_ENC_END();
|
RADEON_ENC_END();
|
||||||
}
|
}
|
||||||
|
|
@ -130,7 +130,7 @@ static void radeon_enc_ctx(struct radeon_encoder *enc)
|
||||||
enc->enc_pic.ctx_buf.two_pass_search_center_map_offset = 0;
|
enc->enc_pic.ctx_buf.two_pass_search_center_map_offset = 0;
|
||||||
|
|
||||||
RADEON_ENC_BEGIN(enc->cmd.ctx);
|
RADEON_ENC_BEGIN(enc->cmd.ctx);
|
||||||
RADEON_ENC_READWRITE(enc->dpb->res->buf, enc->dpb->res->domains, 0);
|
RADEON_ENC_READWRITE(enc->dpb->buf, enc->dpb->domains, 0);
|
||||||
RADEON_ENC_CS(enc->enc_pic.ctx_buf.swizzle_mode);
|
RADEON_ENC_CS(enc->enc_pic.ctx_buf.swizzle_mode);
|
||||||
RADEON_ENC_CS(enc->enc_pic.ctx_buf.rec_luma_pitch);
|
RADEON_ENC_CS(enc->enc_pic.ctx_buf.rec_luma_pitch);
|
||||||
RADEON_ENC_CS(enc->enc_pic.ctx_buf.rec_chroma_pitch);
|
RADEON_ENC_CS(enc->enc_pic.ctx_buf.rec_chroma_pitch);
|
||||||
|
|
|
||||||
|
|
@ -149,7 +149,7 @@ static void radeon_enc_cdf_default_table(struct radeon_encoder *enc)
|
||||||
|
|
||||||
RADEON_ENC_BEGIN(enc->cmd.cdf_default_table_av1);
|
RADEON_ENC_BEGIN(enc->cmd.cdf_default_table_av1);
|
||||||
RADEON_ENC_CS(enc->enc_pic.av1_cdf_default_table.use_cdf_default);
|
RADEON_ENC_CS(enc->enc_pic.av1_cdf_default_table.use_cdf_default);
|
||||||
RADEON_ENC_READWRITE(enc->cdf->res->buf, enc->cdf->res->domains, 0);
|
RADEON_ENC_READWRITE(enc->cdf->buf, enc->cdf->domains, 0);
|
||||||
RADEON_ENC_ADDR_SWAP();
|
RADEON_ENC_ADDR_SWAP();
|
||||||
RADEON_ENC_END();
|
RADEON_ENC_END();
|
||||||
}
|
}
|
||||||
|
|
@ -658,7 +658,7 @@ static void radeon_enc_ctx(struct radeon_encoder *enc)
|
||||||
enc->enc_pic.ctx_buf.two_pass_search_center_map_offset = 0;
|
enc->enc_pic.ctx_buf.two_pass_search_center_map_offset = 0;
|
||||||
|
|
||||||
RADEON_ENC_BEGIN(enc->cmd.ctx);
|
RADEON_ENC_BEGIN(enc->cmd.ctx);
|
||||||
RADEON_ENC_READWRITE(enc->dpb->res->buf, enc->dpb->res->domains, 0);
|
RADEON_ENC_READWRITE(enc->dpb->buf, enc->dpb->domains, 0);
|
||||||
RADEON_ENC_CS(enc->enc_pic.ctx_buf.swizzle_mode);
|
RADEON_ENC_CS(enc->enc_pic.ctx_buf.swizzle_mode);
|
||||||
RADEON_ENC_CS(enc->enc_pic.ctx_buf.rec_luma_pitch);
|
RADEON_ENC_CS(enc->enc_pic.ctx_buf.rec_luma_pitch);
|
||||||
RADEON_ENC_CS(enc->enc_pic.ctx_buf.rec_chroma_pitch);
|
RADEON_ENC_CS(enc->enc_pic.ctx_buf.rec_chroma_pitch);
|
||||||
|
|
|
||||||
|
|
@ -28,7 +28,7 @@ static void radeon_enc_cdf_default_table(struct radeon_encoder *enc)
|
||||||
|
|
||||||
RADEON_ENC_BEGIN(enc->cmd.cdf_default_table_av1);
|
RADEON_ENC_BEGIN(enc->cmd.cdf_default_table_av1);
|
||||||
RADEON_ENC_CS(enc->enc_pic.av1_cdf_default_table.use_cdf_default);
|
RADEON_ENC_CS(enc->enc_pic.av1_cdf_default_table.use_cdf_default);
|
||||||
RADEON_ENC_READWRITE(enc->cdf->res->buf, enc->cdf->res->domains, 0);
|
RADEON_ENC_READWRITE(enc->cdf->buf, enc->cdf->domains, 0);
|
||||||
RADEON_ENC_END();
|
RADEON_ENC_END();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
@ -181,20 +181,20 @@ static void radeon_enc_ctx(struct radeon_encoder *enc)
|
||||||
== PIPE_VIDEO_FORMAT_AV1;
|
== PIPE_VIDEO_FORMAT_AV1;
|
||||||
|
|
||||||
RADEON_ENC_BEGIN(enc->cmd.ctx);
|
RADEON_ENC_BEGIN(enc->cmd.ctx);
|
||||||
RADEON_ENC_READWRITE(enc->dpb->res->buf, enc->dpb->res->domains, 0);
|
RADEON_ENC_READWRITE(enc->dpb->buf, enc->dpb->domains, 0);
|
||||||
RADEON_ENC_CS(enc->enc_pic.ctx_buf.num_reconstructed_pictures);
|
RADEON_ENC_CS(enc->enc_pic.ctx_buf.num_reconstructed_pictures);
|
||||||
|
|
||||||
for (i = 0; i < RENCODE_MAX_NUM_RECONSTRUCTED_PICTURES; i++) {
|
for (i = 0; i < RENCODE_MAX_NUM_RECONSTRUCTED_PICTURES; i++) {
|
||||||
rvcn_enc_reconstructed_picture_t *pic =
|
rvcn_enc_reconstructed_picture_t *pic =
|
||||||
&enc->enc_pic.ctx_buf.reconstructed_pictures[i];
|
&enc->enc_pic.ctx_buf.reconstructed_pictures[i];
|
||||||
RADEON_ENC_READWRITE(enc->dpb->res->buf, enc->dpb->res->domains, 0);
|
RADEON_ENC_READWRITE(enc->dpb->buf, enc->dpb->domains, 0);
|
||||||
RADEON_ENC_CS(enc->enc_pic.ctx_buf.rec_luma_pitch);
|
RADEON_ENC_CS(enc->enc_pic.ctx_buf.rec_luma_pitch);
|
||||||
RADEON_ENC_READWRITE(enc->dpb->res->buf, enc->dpb->res->domains, 0);
|
RADEON_ENC_READWRITE(enc->dpb->buf, enc->dpb->domains, 0);
|
||||||
RADEON_ENC_CS(enc->enc_pic.ctx_buf.rec_chroma_pitch);
|
RADEON_ENC_CS(enc->enc_pic.ctx_buf.rec_chroma_pitch);
|
||||||
RADEON_ENC_READWRITE(enc->dpb->res->buf, enc->dpb->res->domains, 0);
|
RADEON_ENC_READWRITE(enc->dpb->buf, enc->dpb->domains, 0);
|
||||||
RADEON_ENC_CS(0);
|
RADEON_ENC_CS(0);
|
||||||
RADEON_ENC_CS(swizzle_mode);
|
RADEON_ENC_CS(swizzle_mode);
|
||||||
RADEON_ENC_READWRITE(enc->meta->res->buf, enc->meta->res->domains,
|
RADEON_ENC_READWRITE(enc->meta->buf, enc->meta->domains,
|
||||||
pic->frame_context_buffer_offset);
|
pic->frame_context_buffer_offset);
|
||||||
if (is_h264) {
|
if (is_h264) {
|
||||||
RADEON_ENC_CS(pic->h264.colloc_buffer_offset);
|
RADEON_ENC_CS(pic->h264.colloc_buffer_offset);
|
||||||
|
|
@ -212,14 +212,14 @@ static void radeon_enc_ctx(struct radeon_encoder *enc)
|
||||||
for (int i = 0; i < RENCODE_MAX_NUM_RECONSTRUCTED_PICTURES; i++) {
|
for (int i = 0; i < RENCODE_MAX_NUM_RECONSTRUCTED_PICTURES; i++) {
|
||||||
rvcn_enc_reconstructed_picture_t *pic =
|
rvcn_enc_reconstructed_picture_t *pic =
|
||||||
&enc->enc_pic.ctx_buf.pre_encode_reconstructed_pictures[i];
|
&enc->enc_pic.ctx_buf.pre_encode_reconstructed_pictures[i];
|
||||||
RADEON_ENC_READWRITE(enc->dpb->res->buf, enc->dpb->res->domains, 0);
|
RADEON_ENC_READWRITE(enc->dpb->buf, enc->dpb->domains, 0);
|
||||||
RADEON_ENC_CS(enc->enc_pic.ctx_buf.rec_luma_pitch);
|
RADEON_ENC_CS(enc->enc_pic.ctx_buf.rec_luma_pitch);
|
||||||
RADEON_ENC_READWRITE(enc->dpb->res->buf, enc->dpb->res->domains, 0);
|
RADEON_ENC_READWRITE(enc->dpb->buf, enc->dpb->domains, 0);
|
||||||
RADEON_ENC_CS(enc->enc_pic.ctx_buf.rec_chroma_pitch);
|
RADEON_ENC_CS(enc->enc_pic.ctx_buf.rec_chroma_pitch);
|
||||||
RADEON_ENC_READWRITE(enc->dpb->res->buf, enc->dpb->res->domains, 0);
|
RADEON_ENC_READWRITE(enc->dpb->buf, enc->dpb->domains, 0);
|
||||||
RADEON_ENC_CS(0);
|
RADEON_ENC_CS(0);
|
||||||
RADEON_ENC_CS(swizzle_mode);
|
RADEON_ENC_CS(swizzle_mode);
|
||||||
RADEON_ENC_READWRITE(enc->meta->res->buf, enc->meta->res->domains,
|
RADEON_ENC_READWRITE(enc->meta->buf, enc->meta->domains,
|
||||||
pic->frame_context_buffer_offset);
|
pic->frame_context_buffer_offset);
|
||||||
if (is_h264) {
|
if (is_h264) {
|
||||||
RADEON_ENC_CS(pic->h264.colloc_buffer_offset);
|
RADEON_ENC_CS(pic->h264.colloc_buffer_offset);
|
||||||
|
|
@ -259,8 +259,8 @@ static void radeon_enc_ctx_tier2(struct radeon_encoder *enc)
|
||||||
}
|
}
|
||||||
|
|
||||||
RADEON_ENC_BEGIN(enc->cmd.ctx);
|
RADEON_ENC_BEGIN(enc->cmd.ctx);
|
||||||
if (enc->dpb->res) {
|
if (enc->dpb) {
|
||||||
RADEON_ENC_READWRITE(enc->dpb->res->buf, enc->dpb->res->domains, 0);
|
RADEON_ENC_READWRITE(enc->dpb->buf, enc->dpb->domains, 0);
|
||||||
} else {
|
} else {
|
||||||
RADEON_ENC_CS(0);
|
RADEON_ENC_CS(0);
|
||||||
RADEON_ENC_CS(0);
|
RADEON_ENC_CS(0);
|
||||||
|
|
@ -275,7 +275,7 @@ static void radeon_enc_ctx_tier2(struct radeon_encoder *enc)
|
||||||
}
|
}
|
||||||
struct si_texture *luma = enc->enc_pic.dpb_bufs[i]->luma;
|
struct si_texture *luma = enc->enc_pic.dpb_bufs[i]->luma;
|
||||||
struct si_texture *chroma = enc->enc_pic.dpb_bufs[i]->chroma;
|
struct si_texture *chroma = enc->enc_pic.dpb_bufs[i]->chroma;
|
||||||
struct rvid_buffer *fcb = enc->enc_pic.dpb_bufs[i]->fcb;
|
struct si_resource *fcb = enc->enc_pic.dpb_bufs[i]->fcb;
|
||||||
RADEON_ENC_READWRITE(luma->buffer.buf, luma->buffer.domains, luma->surface.u.gfx9.surf_offset);
|
RADEON_ENC_READWRITE(luma->buffer.buf, luma->buffer.domains, luma->surface.u.gfx9.surf_offset);
|
||||||
RADEON_ENC_CS(luma->surface.u.gfx9.surf_pitch);
|
RADEON_ENC_CS(luma->surface.u.gfx9.surf_pitch);
|
||||||
RADEON_ENC_READWRITE(chroma->buffer.buf, chroma->buffer.domains, chroma->surface.u.gfx9.surf_offset);
|
RADEON_ENC_READWRITE(chroma->buffer.buf, chroma->buffer.domains, chroma->surface.u.gfx9.surf_offset);
|
||||||
|
|
@ -284,7 +284,7 @@ static void radeon_enc_ctx_tier2(struct radeon_encoder *enc)
|
||||||
RADEON_ENC_CS(0);
|
RADEON_ENC_CS(0);
|
||||||
RADEON_ENC_CS(0);
|
RADEON_ENC_CS(0);
|
||||||
RADEON_ENC_CS(luma->surface.u.gfx9.swizzle_mode);
|
RADEON_ENC_CS(luma->surface.u.gfx9.swizzle_mode);
|
||||||
RADEON_ENC_READWRITE(fcb->res->buf, fcb->res->domains, 0);
|
RADEON_ENC_READWRITE(fcb->buf, fcb->domains, 0);
|
||||||
if (is_h264) {
|
if (is_h264) {
|
||||||
RADEON_ENC_CS(enc->enc_pic.fcb_offset.h264.colloc_buffer_offset);
|
RADEON_ENC_CS(enc->enc_pic.fcb_offset.h264.colloc_buffer_offset);
|
||||||
RADEON_ENC_CS(0);
|
RADEON_ENC_CS(0);
|
||||||
|
|
@ -307,7 +307,7 @@ static void radeon_enc_ctx_tier2(struct radeon_encoder *enc)
|
||||||
}
|
}
|
||||||
struct si_texture *luma = enc->enc_pic.dpb_bufs[i]->pre_luma;
|
struct si_texture *luma = enc->enc_pic.dpb_bufs[i]->pre_luma;
|
||||||
struct si_texture *chroma = enc->enc_pic.dpb_bufs[i]->pre_chroma;
|
struct si_texture *chroma = enc->enc_pic.dpb_bufs[i]->pre_chroma;
|
||||||
struct rvid_buffer *fcb = enc->enc_pic.dpb_bufs[i]->pre_fcb;
|
struct si_resource *fcb = enc->enc_pic.dpb_bufs[i]->pre_fcb;
|
||||||
RADEON_ENC_READWRITE(luma->buffer.buf, luma->buffer.domains, luma->surface.u.gfx9.surf_offset);
|
RADEON_ENC_READWRITE(luma->buffer.buf, luma->buffer.domains, luma->surface.u.gfx9.surf_offset);
|
||||||
RADEON_ENC_CS(luma->surface.u.gfx9.surf_pitch);
|
RADEON_ENC_CS(luma->surface.u.gfx9.surf_pitch);
|
||||||
RADEON_ENC_READWRITE(chroma->buffer.buf, chroma->buffer.domains, chroma->surface.u.gfx9.surf_offset);
|
RADEON_ENC_READWRITE(chroma->buffer.buf, chroma->buffer.domains, chroma->surface.u.gfx9.surf_offset);
|
||||||
|
|
@ -316,7 +316,7 @@ static void radeon_enc_ctx_tier2(struct radeon_encoder *enc)
|
||||||
RADEON_ENC_CS(0);
|
RADEON_ENC_CS(0);
|
||||||
RADEON_ENC_CS(0);
|
RADEON_ENC_CS(0);
|
||||||
RADEON_ENC_CS(luma->surface.u.gfx9.swizzle_mode);
|
RADEON_ENC_CS(luma->surface.u.gfx9.swizzle_mode);
|
||||||
RADEON_ENC_READWRITE(fcb->res->buf, fcb->res->domains, 0);
|
RADEON_ENC_READWRITE(fcb->buf, fcb->domains, 0);
|
||||||
if (is_h264) {
|
if (is_h264) {
|
||||||
RADEON_ENC_CS(enc->enc_pic.fcb_offset.h264.colloc_buffer_offset);
|
RADEON_ENC_CS(enc->enc_pic.fcb_offset.h264.colloc_buffer_offset);
|
||||||
RADEON_ENC_CS(0);
|
RADEON_ENC_CS(0);
|
||||||
|
|
@ -367,7 +367,7 @@ static void radeon_enc_metadata(struct radeon_encoder *enc)
|
||||||
enc->enc_pic.metadata.two_pass_search_center_map_offset =
|
enc->enc_pic.metadata.two_pass_search_center_map_offset =
|
||||||
enc->enc_pic.ctx_buf.two_pass_search_center_map_offset;
|
enc->enc_pic.ctx_buf.two_pass_search_center_map_offset;
|
||||||
RADEON_ENC_BEGIN(enc->cmd.metadata);
|
RADEON_ENC_BEGIN(enc->cmd.metadata);
|
||||||
RADEON_ENC_READWRITE(enc->meta->res->buf, enc->meta->res->domains, 0);
|
RADEON_ENC_READWRITE(enc->meta->buf, enc->meta->domains, 0);
|
||||||
RADEON_ENC_CS(enc->enc_pic.metadata.two_pass_search_center_map_offset);
|
RADEON_ENC_CS(enc->enc_pic.metadata.two_pass_search_center_map_offset);
|
||||||
RADEON_ENC_END();
|
RADEON_ENC_END();
|
||||||
}
|
}
|
||||||
|
|
|
||||||
Loading…
Add table
Reference in a new issue