radeon/vcn: add encode destroy
authorBoyuan Zhang <boyuan.zhang@amd.com>
Tue, 7 Nov 2017 21:20:53 +0000 (16:20 -0500)
committerLeo Liu <leo.liu@amd.com>
Fri, 17 Nov 2017 17:25:47 +0000 (12:25 -0500)
Add implementation for destroy 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 05e7e8362462c369d48909f95245214bc21e78f2..219f8706f50905cf9b41813d80231668b7c89316 100644 (file)
@@ -180,7 +180,21 @@ static void radeon_enc_end_frame(struct pipe_video_codec *encoder,
 
 static void radeon_enc_destroy(struct pipe_video_codec *encoder)
 {
-       /* TODO*/
+       struct radeon_encoder *enc = (struct radeon_encoder*)encoder;
+
+       if (enc->stream_handle) {
+               struct rvid_buffer fb;
+               enc->need_feedback = false;
+               si_vid_create_buffer(enc->screen, &fb, 512, PIPE_USAGE_STAGING);
+               enc->fb = &fb;
+               enc->destroy(enc);
+               flush(enc);
+               si_vid_destroy_buffer(&fb);
+       }
+
+       si_vid_destroy_buffer(&enc->cpb);
+       enc->ws->cs_destroy(enc->cs);
+       FREE(enc);
 }
 
 static void radeon_enc_get_feedback(struct pipe_video_codec *encoder,