mirror of
https://gitlab.freedesktop.org/mesa/mesa.git
synced 2025-12-23 19:50:11 +01:00
radeon/vce: add dual pipe support for VI
Signed-off-by: Leo Liu <leo.liu@amd.com> Reviewed-by: Christian König <christian.koenig@amd.com>
This commit is contained in:
parent
468fcdcb4f
commit
fa80c1fe20
4 changed files with 21 additions and 22 deletions
|
|
@ -403,7 +403,7 @@ struct pipe_video_codec *rvce_create_encoder(struct pipe_context *context,
|
||||||
if ((rscreen->info.drm_major > 2) || (rscreen->info.drm_minor >= 42))
|
if ((rscreen->info.drm_major > 2) || (rscreen->info.drm_minor >= 42))
|
||||||
enc->use_vui = true;
|
enc->use_vui = true;
|
||||||
if (rscreen->info.family >= CHIP_TONGA)
|
if (rscreen->info.family >= CHIP_TONGA)
|
||||||
enc->use_2p = true;
|
enc->dual_pipe = true;
|
||||||
|
|
||||||
enc->base = *templ;
|
enc->base = *templ;
|
||||||
enc->base.context = context;
|
enc->base.context = context;
|
||||||
|
|
@ -443,9 +443,9 @@ struct pipe_video_codec *rvce_create_encoder(struct pipe_context *context,
|
||||||
cpb_size = cpb_size * align(tmp_surf->npix_y, 16);
|
cpb_size = cpb_size * align(tmp_surf->npix_y, 16);
|
||||||
cpb_size = cpb_size * 3 / 2;
|
cpb_size = cpb_size * 3 / 2;
|
||||||
cpb_size = cpb_size * enc->cpb_num;
|
cpb_size = cpb_size * enc->cpb_num;
|
||||||
if (enc->use_2p)
|
if (enc->dual_pipe)
|
||||||
cpb_size += RVCE_MAX_AUX_BUFFER_NUM *
|
cpb_size += RVCE_MAX_AUX_BUFFER_NUM *
|
||||||
RVCE_MAX_BITSTREAM_OUTPUT_ROW_SIZE;
|
RVCE_MAX_BITSTREAM_OUTPUT_ROW_SIZE * 2;
|
||||||
tmp_buf->destroy(tmp_buf);
|
tmp_buf->destroy(tmp_buf);
|
||||||
if (!rvid_create_buffer(enc->screen, &enc->cpb, cpb_size, PIPE_USAGE_DEFAULT)) {
|
if (!rvid_create_buffer(enc->screen, &enc->cpb, cpb_size, PIPE_USAGE_DEFAULT)) {
|
||||||
RVID_ERR("Can't create CPB buffer.\n");
|
RVID_ERR("Can't create CPB buffer.\n");
|
||||||
|
|
|
||||||
|
|
@ -104,7 +104,7 @@ struct rvce_encoder {
|
||||||
struct pipe_h264_enc_picture_desc pic;
|
struct pipe_h264_enc_picture_desc pic;
|
||||||
bool use_vm;
|
bool use_vm;
|
||||||
bool use_vui;
|
bool use_vui;
|
||||||
bool use_2p;
|
bool dual_pipe;
|
||||||
};
|
};
|
||||||
|
|
||||||
/* CPB handling functions */
|
/* CPB handling functions */
|
||||||
|
|
|
||||||
|
|
@ -287,23 +287,6 @@ static void encode(struct rvce_encoder *enc)
|
||||||
RVCE_CS(enc->bs_size); // videoBitstreamRingSize
|
RVCE_CS(enc->bs_size); // videoBitstreamRingSize
|
||||||
RVCE_END();
|
RVCE_END();
|
||||||
|
|
||||||
if (enc->use_2p) {
|
|
||||||
unsigned aux_offset = enc->cpb.res->buf->size -
|
|
||||||
RVCE_MAX_AUX_BUFFER_NUM * RVCE_MAX_BITSTREAM_OUTPUT_ROW_SIZE;
|
|
||||||
RVCE_BEGIN(0x05000002); // auxiliary buffer
|
|
||||||
for (i = 0; i < 4; ++i) {
|
|
||||||
RVCE_CS(aux_offset);
|
|
||||||
aux_offset += RVCE_MAX_BITSTREAM_OUTPUT_ROW_SIZE;
|
|
||||||
}
|
|
||||||
for (i = 0; i < 4; ++i)
|
|
||||||
RVCE_CS(0x00000000);
|
|
||||||
for (i = 0; i < 4; ++i)
|
|
||||||
RVCE_CS(RVCE_MAX_BITSTREAM_OUTPUT_ROW_SIZE);
|
|
||||||
for (i = 0; i < 4; ++i)
|
|
||||||
RVCE_CS(0x00000000);
|
|
||||||
RVCE_END();
|
|
||||||
}
|
|
||||||
|
|
||||||
RVCE_BEGIN(0x03000001); // encode
|
RVCE_BEGIN(0x03000001); // encode
|
||||||
RVCE_CS(0x00000000); // insertHeaders
|
RVCE_CS(0x00000000); // insertHeaders
|
||||||
RVCE_CS(0x00000000); // pictureStructure
|
RVCE_CS(0x00000000); // pictureStructure
|
||||||
|
|
|
||||||
|
|
@ -106,6 +106,19 @@ static void encode(struct rvce_encoder *enc)
|
||||||
RVCE_CS(enc->bs_size); // videoBitstreamRingSize
|
RVCE_CS(enc->bs_size); // videoBitstreamRingSize
|
||||||
RVCE_END();
|
RVCE_END();
|
||||||
|
|
||||||
|
if (enc->dual_pipe) {
|
||||||
|
unsigned aux_offset = enc->cpb.res->buf->size -
|
||||||
|
RVCE_MAX_AUX_BUFFER_NUM * RVCE_MAX_BITSTREAM_OUTPUT_ROW_SIZE * 2;
|
||||||
|
RVCE_BEGIN(0x05000002); // auxiliary buffer
|
||||||
|
for (i = 0; i < 8; ++i) {
|
||||||
|
RVCE_CS(aux_offset);
|
||||||
|
aux_offset += RVCE_MAX_BITSTREAM_OUTPUT_ROW_SIZE;
|
||||||
|
}
|
||||||
|
for (i = 0; i < 8; ++i)
|
||||||
|
RVCE_CS(RVCE_MAX_BITSTREAM_OUTPUT_ROW_SIZE);
|
||||||
|
RVCE_END();
|
||||||
|
}
|
||||||
|
|
||||||
RVCE_BEGIN(0x03000001); // encode
|
RVCE_BEGIN(0x03000001); // encode
|
||||||
RVCE_CS(enc->pic.frame_num ? 0x0 : 0x11); // insertHeaders
|
RVCE_CS(enc->pic.frame_num ? 0x0 : 0x11); // insertHeaders
|
||||||
RVCE_CS(0x00000000); // pictureStructure
|
RVCE_CS(0x00000000); // pictureStructure
|
||||||
|
|
@ -121,7 +134,10 @@ static void encode(struct rvce_encoder *enc)
|
||||||
RVCE_CS(align(enc->luma->npix_y, 16)); // encInputFrameYPitch
|
RVCE_CS(align(enc->luma->npix_y, 16)); // encInputFrameYPitch
|
||||||
RVCE_CS(enc->luma->level[0].pitch_bytes); // encInputPicLumaPitch
|
RVCE_CS(enc->luma->level[0].pitch_bytes); // encInputPicLumaPitch
|
||||||
RVCE_CS(enc->chroma->level[0].pitch_bytes); // encInputPicChromaPitch
|
RVCE_CS(enc->chroma->level[0].pitch_bytes); // encInputPicChromaPitch
|
||||||
RVCE_CS(0x00010000); // encInputPic(Addr|Array)Mode,encDisable(TwoPipeMode|MBOffloading)
|
if (enc->dual_pipe)
|
||||||
|
RVCE_CS(0x00000000); // encInputPic(Addr|Array)Mode,encDisable(TwoPipeMode|MBOffloading)
|
||||||
|
else
|
||||||
|
RVCE_CS(0x00010000); // encInputPic(Addr|Array)Mode,encDisable(TwoPipeMode|MBOffloading)
|
||||||
RVCE_CS(0x00000000); // encInputPicTileConfig
|
RVCE_CS(0x00000000); // encInputPicTileConfig
|
||||||
RVCE_CS(enc->pic.picture_type); // encPicType
|
RVCE_CS(enc->pic.picture_type); // encPicType
|
||||||
RVCE_CS(enc->pic.picture_type == PIPE_H264_ENC_PICTURE_TYPE_IDR); // encIdrFlag
|
RVCE_CS(enc->pic.picture_type == PIPE_H264_ENC_PICTURE_TYPE_IDR); // encIdrFlag
|
||||||
|
|
|
||||||
Loading…
Add table
Reference in a new issue