summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorBoyuan Zhang <[email protected]>2017-11-07 16:19:22 -0500
committerLeo Liu <[email protected]>2017-11-17 12:25:47 -0500
commitf40fe728a1fb077cf288661af7892056c7fd0169 (patch)
treee7a54d5194832fb012e08036f5ac57d336189494
parentc2448f20a32d1f9b24a093dd48d33c54cfc51e6a (diff)
radeon/vcn: add encode begin frame
Add implementation for begin_frame interface for vcn encode. Signed-off-by: Boyuan Zhang <[email protected]> Acked-by: Christian König <[email protected]>
-rw-r--r--src/gallium/drivers/radeon/radeon_vcn_enc.c23
1 files changed, 22 insertions, 1 deletions
diff --git a/src/gallium/drivers/radeon/radeon_vcn_enc.c b/src/gallium/drivers/radeon/radeon_vcn_enc.c
index 48ff8db6714..0a2c5d86de2 100644
--- a/src/gallium/drivers/radeon/radeon_vcn_enc.c
+++ b/src/gallium/drivers/radeon/radeon_vcn_enc.c
@@ -126,7 +126,28 @@ static void radeon_enc_begin_frame(struct pipe_video_codec *encoder,
struct pipe_video_buffer *source,
struct pipe_picture_desc *picture)
{
- /* TODO*/
+ struct radeon_encoder *enc = (struct radeon_encoder*)encoder;
+ struct vl_video_buffer *vid_buf = (struct vl_video_buffer *)source;
+ struct pipe_h264_enc_picture_desc *pic = (struct pipe_h264_enc_picture_desc *)picture;
+
+ radeon_vcn_enc_get_param(enc, pic);
+
+ enc->get_buffer(vid_buf->resources[0], &enc->handle, &enc->luma);
+ enc->get_buffer(vid_buf->resources[1], NULL, &enc->chroma);
+
+ enc->need_feedback = false;
+
+ if (!enc->stream_handle) {
+ struct rvid_buffer fb;
+ enc->stream_handle = si_vid_alloc_stream_handle();
+ enc->si = CALLOC_STRUCT(rvid_buffer);
+ si_vid_create_buffer(enc->screen, enc->si, 128 * 1024, PIPE_USAGE_STAGING);
+ si_vid_create_buffer(enc->screen, &fb, 4096, PIPE_USAGE_STAGING);
+ enc->fb = &fb;
+ enc->begin(enc, pic);
+ flush(enc);
+ si_vid_destroy_buffer(&fb);
+ }
}
static void radeon_enc_encode_bitstream(struct pipe_video_codec *encoder,