diff options
author | Leo Liu <[email protected]> | 2014-04-03 16:53:30 -0400 |
---|---|---|
committer | Christian König <[email protected]> | 2014-04-04 12:35:55 +0200 |
commit | de1a59b7a71583ae4fb09f9e4ee049895f14ca5f (patch) | |
tree | 875e977158e8e7bfcad52cd2234b7aa96b1f30e7 /src/gallium/drivers/radeon/radeon_vce.c | |
parent | 6c59be7776e4da17119a3fca21a0a568c5c11ea7 (diff) |
radeon/vce: cleanup cpb handling
v2: fix whitespace errors, minor coding style changes
Signed-off-by: Leo Liu <[email protected]>
Signed-off-by: Christian König <[email protected]>
Diffstat (limited to 'src/gallium/drivers/radeon/radeon_vce.c')
-rw-r--r-- | src/gallium/drivers/radeon/radeon_vce.c | 22 |
1 files changed, 19 insertions, 3 deletions
diff --git a/src/gallium/drivers/radeon/radeon_vce.c b/src/gallium/drivers/radeon/radeon_vce.c index 0d3fe080867..4b824f9ef10 100644 --- a/src/gallium/drivers/radeon/radeon_vce.c +++ b/src/gallium/drivers/radeon/radeon_vce.c @@ -45,8 +45,6 @@ #include "radeon_video.h" #include "radeon_vce.h" -#define CPB_SIZE (40 * 1024 * 1024) - /** * flush commands to the hardware */ @@ -213,6 +211,9 @@ struct pipe_video_codec *rvce_create_encoder(struct pipe_context *context, { struct r600_common_screen *rscreen = (struct r600_common_screen *)context->screen; struct rvce_encoder *enc; + struct pipe_video_buffer *tmp_buf, templat = {}; + struct radeon_surface *tmp_surf; + unsigned pitch, vpitch; if (!rscreen->info.vce_fw_version) { RVID_ERR("Kernel doesn't supports VCE!\n"); @@ -246,8 +247,23 @@ struct pipe_video_codec *rvce_create_encoder(struct pipe_context *context, } enc->ws->cs_set_flush_callback(enc->cs, rvce_cs_flush, enc); + templat.buffer_format = PIPE_FORMAT_NV12; + templat.chroma_format = PIPE_VIDEO_CHROMA_FORMAT_420; + templat.width = enc->base.width; + templat.height = enc->base.height; + templat.interlaced = false; + if (!(tmp_buf = context->create_video_buffer(context, &templat))) { + RVID_ERR("Can't create video buffer.\n"); + goto error; + } - if (!rvid_create_buffer(enc->ws, &enc->cpb, CPB_SIZE, RADEON_DOMAIN_VRAM)) { + get_buffer(((struct vl_video_buffer *)tmp_buf)->resources[0], NULL, &tmp_surf); + pitch = align(tmp_surf->level[0].pitch_bytes, 128); + vpitch = align(tmp_surf->npix_y, 16); + tmp_buf->destroy(tmp_buf); + if (!rvid_create_buffer(enc->ws, &enc->cpb, + pitch * vpitch * 1.5 * (RVCE_NUM_CPB_FRAMES + RVCE_NUM_CPB_EXTRA_FRAMES), + RADEON_DOMAIN_VRAM)) { RVID_ERR("Can't create CPB buffer.\n"); goto error; } |