RADEON_ENC_DESTROY_VIDEO_BUFFER(enc->dpb);
enc->ws->cs_destroy(&enc->cs);
+ if (enc->ectx)
+ enc->ectx->destroy(enc->ectx);
+
FREE(enc);
}
if (!enc)
return NULL;
+ if (sctx->vcn_has_ctx) {
+ enc->ectx = pipe_create_multimedia_context(context->screen);
+ if (!enc->ectx)
+ sctx->vcn_has_ctx = false;
+ }
+
enc->alignment = 256;
enc->base = *templ;
- enc->base.context = context;
+ enc->base.context = (sctx->vcn_has_ctx)? enc->ectx : context;
enc->base.destroy = radeon_enc_destroy;
enc->base.begin_frame = radeon_enc_begin_frame;
enc->base.encode_bitstream = radeon_enc_encode_bitstream;
enc->screen = context->screen;
enc->ws = ws;
- if (!ws->cs_create(&enc->cs, sctx->ctx, AMD_IP_VCN_ENC, radeon_enc_cs_flush, enc, false)) {
+ if (!ws->cs_create(&enc->cs,
+ (sctx->vcn_has_ctx) ? ((struct si_context *)enc->ectx)->ctx : sctx->ctx,
+ AMD_IP_VCN_ENC, radeon_enc_cs_flush, enc, false)) {
RVID_ERR("Can't get command submission context.\n");
goto error;
}
unsigned dpb_size;
rvcn_enc_picture_info_t dpb_info[RENCODE_MAX_NUM_RECONSTRUCTED_PICTURES];
unsigned max_ltr_idx;
+
+ struct pipe_context *ectx;
};
void radeon_enc_add_buffer(struct radeon_encoder *enc, struct pb_buffer *buf,
}
}
+ if (ctx->family == CHIP_GFX1100)
+ ctx->vcn_has_ctx = true;
+
return (vcn) ? radeon_create_decoder(context, templ)
: si_common_uvd_create_decoder(context, templ, si_uvd_set_dtb);
}