radeon/vcn: add encode bitstream
authorBoyuan Zhang <boyuan.zhang@amd.com>
Tue, 7 Nov 2017 21:20:05 +0000 (16:20 -0500)
committerLeo Liu <leo.liu@amd.com>
Fri, 17 Nov 2017 17:25:47 +0000 (12:25 -0500)
Add implementation for encode_bitstream interface for vcn encode.

Signed-off-by: Boyuan Zhang <boyuan.zhang@amd.com>
Acked-by: Christian König <christian.koenig@amd.com>
src/gallium/drivers/radeon/radeon_vcn_enc.c

index 0a2c5d86de276968f13428a300c6d19e4777b8aa..f78672a1b1ae5c55d8fac46f1801b4e960d3ab65 100644 (file)
@@ -155,7 +155,19 @@ static void radeon_enc_encode_bitstream(struct pipe_video_codec *encoder,
                                                                  struct pipe_resource *destination,
                                                                  void **fb)
 {
-       /* TODO*/
+       struct radeon_encoder *enc = (struct radeon_encoder*)encoder;
+       enc->get_buffer(destination, &enc->bs_handle, NULL);
+       enc->bs_size = destination->width0;
+
+       *fb = enc->fb = CALLOC_STRUCT(rvid_buffer);
+
+       if (!si_vid_create_buffer(enc->screen, enc->fb, 4096, PIPE_USAGE_STAGING)) {
+               RVID_ERR("Can't create feedback buffer.\n");
+               return;
+       }
+
+       enc->need_feedback = true;
+       enc->encode(enc);
 }
 
 static void radeon_enc_end_frame(struct pipe_video_codec *encoder,