• Home
  • Line#
  • Scopes#
  • Navigate#
  • Raw
  • Download
1 /**************************************************************************
2  *
3  * Copyright 2013 Advanced Micro Devices, Inc.
4  *
5  * SPDX-License-Identifier: MIT
6  *
7  **************************************************************************/
8 
9 #include "pipe/p_video_codec.h"
10 #include "radeon_vce.h"
11 #include "radeon_video.h"
12 #include "si_pipe.h"
13 #include "util/u_memory.h"
14 #include "util/u_video.h"
15 #include "vl/vl_video_buffer.h"
16 
17 #include <stdio.h>
18 
session(struct rvce_encoder * enc)19 static void session(struct rvce_encoder *enc)
20 {
21    RVCE_BEGIN(0x00000001); // session cmd
22    RVCE_CS(enc->stream_handle);
23    RVCE_END();
24 }
25 
task_info(struct rvce_encoder * enc,uint32_t op,uint32_t dep,uint32_t fb_idx,uint32_t ring_idx)26 static void task_info(struct rvce_encoder *enc, uint32_t op, uint32_t dep, uint32_t fb_idx,
27                       uint32_t ring_idx)
28 {
29    RVCE_BEGIN(0x00000002); // task info
30    if (op == 0x3) {
31       if (enc->task_info_idx) {
32          uint32_t offs = enc->cs.current.cdw - enc->task_info_idx + 3;
33          // Update offsetOfNextTaskInfo
34          enc->cs.current.buf[enc->task_info_idx] = offs;
35       }
36       enc->task_info_idx = enc->cs.current.cdw;
37    }
38    RVCE_CS(0xffffffff); // offsetOfNextTaskInfo
39    RVCE_CS(op);         // taskOperation
40    RVCE_CS(dep);        // referencePictureDependency
41    RVCE_CS(0x00000000); // collocateFlagDependency
42    RVCE_CS(fb_idx);     // feedbackIndex
43    RVCE_CS(ring_idx);   // videoBitstreamRingIndex
44    RVCE_END();
45 }
46 
feedback(struct rvce_encoder * enc)47 static void feedback(struct rvce_encoder *enc)
48 {
49    RVCE_BEGIN(0x05000005);                                    // feedback buffer
50    RVCE_WRITE(enc->fb->res->buf, enc->fb->res->domains, 0x0); // feedbackRingAddressHi/Lo
51    RVCE_CS(0x00000001);                                       // feedbackRingSize
52    RVCE_END();
53 }
54 
create(struct rvce_encoder * enc)55 static void create(struct rvce_encoder *enc)
56 {
57    enc->task_info(enc, 0x00000000, 0, 0, 0);
58 
59    RVCE_BEGIN(0x01000001);                                            // create cmd
60    RVCE_CS(0x00000000);                                               // encUseCircularBuffer
61    RVCE_CS(u_get_h264_profile_idc(enc->base.profile));                // encProfile
62    RVCE_CS(enc->base.level);                                          // encLevel
63    RVCE_CS(0x00000000);                                               // encPicStructRestriction
64    RVCE_CS(enc->base.width);                                          // encImageWidth
65    RVCE_CS(enc->base.height);                                         // encImageHeight
66    RVCE_CS(enc->luma->u.legacy.level[0].nblk_x * enc->luma->bpe);     // encRefPicLumaPitch
67    RVCE_CS(enc->chroma->u.legacy.level[0].nblk_x * enc->chroma->bpe); // encRefPicChromaPitch
68    RVCE_CS(align(enc->luma->u.legacy.level[0].nblk_y, 16) / 8);       // encRefYHeightInQw
69    RVCE_CS(0x00000000); // encRefPic(Addr|Array)Mode, encPicStructRestriction, disableRDO
70    RVCE_END();
71 }
72 
rate_control(struct rvce_encoder * enc)73 static void rate_control(struct rvce_encoder *enc)
74 {
75    RVCE_BEGIN(0x04000005);                                 // rate control
76    RVCE_CS(enc->pic.rate_ctrl[0].rate_ctrl_method);           // encRateControlMethod
77    RVCE_CS(enc->pic.rate_ctrl[0].target_bitrate);             // encRateControlTargetBitRate
78    RVCE_CS(enc->pic.rate_ctrl[0].peak_bitrate);               // encRateControlPeakBitRate
79    RVCE_CS(enc->pic.rate_ctrl[0].frame_rate_num);             // encRateControlFrameRateNum
80    RVCE_CS(0x00000000);                                    // encGOPSize
81    RVCE_CS(enc->pic.quant_i_frames);                       // encQP_I
82    RVCE_CS(enc->pic.quant_p_frames);                       // encQP_P
83    RVCE_CS(enc->pic.quant_b_frames);                       // encQP_B
84    RVCE_CS(enc->pic.rate_ctrl[0].vbv_buffer_size);            // encVBVBufferSize
85    RVCE_CS(enc->pic.rate_ctrl[0].frame_rate_den);             // encRateControlFrameRateDen
86    RVCE_CS(0x00000000);                                    // encVBVBufferLevel
87    RVCE_CS(0x00000000);                                    // encMaxAUSize
88    RVCE_CS(0x00000000);                                    // encQPInitialMode
89    RVCE_CS(enc->pic.rate_ctrl[0].target_bits_picture);        // encTargetBitsPerPicture
90    RVCE_CS(enc->pic.rate_ctrl[0].peak_bits_picture_integer);  // encPeakBitsPerPictureInteger
91    RVCE_CS(enc->pic.rate_ctrl[0].peak_bits_picture_fraction); // encPeakBitsPerPictureFractional
92    RVCE_CS(0x00000000);                                    // encMinQP
93    RVCE_CS(0x00000033);                                    // encMaxQP
94    RVCE_CS(0x00000000);                                    // encSkipFrameEnable
95    RVCE_CS(0x00000000);                                    // encFillerDataEnable
96    RVCE_CS(0x00000000);                                    // encEnforceHRD
97    RVCE_CS(0x00000000);                                    // encBPicsDeltaQP
98    RVCE_CS(0x00000000);                                    // encReferenceBPicsDeltaQP
99    RVCE_CS(0x00000000);                                    // encRateControlReInitDisable
100    RVCE_END();
101 }
102 
config_extension(struct rvce_encoder * enc)103 static void config_extension(struct rvce_encoder *enc)
104 {
105    RVCE_BEGIN(0x04000001); // config extension
106    RVCE_CS(0x00000003);    // encEnablePerfLogging
107    RVCE_END();
108 }
109 
pic_control(struct rvce_encoder * enc)110 static void pic_control(struct rvce_encoder *enc)
111 {
112    unsigned encNumMBsPerSlice;
113 
114    encNumMBsPerSlice = align(enc->base.width, 16) / 16;
115    encNumMBsPerSlice *= align(enc->base.height, 16) / 16;
116 
117    RVCE_BEGIN(0x04000002);                                         // pic control
118    RVCE_CS(0x00000000);                                            // encUseConstrainedIntraPred
119    RVCE_CS(0x00000000);                                            // encCABACEnable
120    RVCE_CS(0x00000000);                                            // encCABACIDC
121    RVCE_CS(0x00000000);                                            // encLoopFilterDisable
122    RVCE_CS(0x00000000);                                            // encLFBetaOffset
123    RVCE_CS(0x00000000);                                            // encLFAlphaC0Offset
124    RVCE_CS(0x00000000);                                            // encCropLeftOffset
125    RVCE_CS((align(enc->base.width, 16) - enc->base.width) >> 1);   // encCropRightOffset
126    RVCE_CS(0x00000000);                                            // encCropTopOffset
127    RVCE_CS((align(enc->base.height, 16) - enc->base.height) >> 1); // encCropBottomOffset
128    RVCE_CS(encNumMBsPerSlice);                                     // encNumMBsPerSlice
129    RVCE_CS(0x00000000);                                            // encIntraRefreshNumMBsPerSlot
130    RVCE_CS(0x00000000);                                            // encForceIntraRefresh
131    RVCE_CS(0x00000000);                                            // encForceIMBPeriod
132    RVCE_CS(0x00000000);                                            // encPicOrderCntType
133    RVCE_CS(0x00000000);                            // log2_max_pic_order_cnt_lsb_minus4
134    RVCE_CS(0x00000000);                            // encSPSID
135    RVCE_CS(0x00000000);                            // encPPSID
136    RVCE_CS(0x00000040);                            // encConstraintSetFlags
137    RVCE_CS(MAX2(enc->base.max_references, 1) - 1); // encBPicPattern
138    RVCE_CS(0x00000000);                            // weightPredModeBPicture
139    RVCE_CS(MIN2(enc->base.max_references, 2));     // encNumberOfReferenceFrames
140    RVCE_CS(enc->base.max_references + 1);          // encMaxNumRefFrames
141    RVCE_CS(0x00000001);                            // encNumDefaultActiveRefL0
142    RVCE_CS(0x00000001);                            // encNumDefaultActiveRefL1
143    RVCE_CS(0x00000000);                            // encSliceMode
144    RVCE_CS(0x00000000);                            // encMaxSliceSize
145    RVCE_END();
146 }
147 
motion_estimation(struct rvce_encoder * enc)148 static void motion_estimation(struct rvce_encoder *enc)
149 {
150    RVCE_BEGIN(0x04000007); // motion estimation
151    RVCE_CS(0x00000001);    // encIMEDecimationSearch
152    RVCE_CS(0x00000001);    // motionEstHalfPixel
153    RVCE_CS(0x00000000);    // motionEstQuarterPixel
154    RVCE_CS(0x00000000);    // disableFavorPMVPoint
155    RVCE_CS(0x00000000);    // forceZeroPointCenter
156    RVCE_CS(0x00000000);    // LSMVert
157    RVCE_CS(0x00000010);    // encSearchRangeX
158    RVCE_CS(0x00000010);    // encSearchRangeY
159    RVCE_CS(0x00000010);    // encSearch1RangeX
160    RVCE_CS(0x00000010);    // encSearch1RangeY
161    RVCE_CS(0x00000000);    // disable16x16Frame1
162    RVCE_CS(0x00000000);    // disableSATD
163    RVCE_CS(0x00000000);    // enableAMD
164    RVCE_CS(0x000000fe);    // encDisableSubMode
165    RVCE_CS(0x00000000);    // encIMESkipX
166    RVCE_CS(0x00000000);    // encIMESkipY
167    RVCE_CS(0x00000000);    // encEnImeOverwDisSubm
168    RVCE_CS(0x00000000);    // encImeOverwDisSubmNo
169    RVCE_CS(0x00000001);    // encIME2SearchRangeX
170    RVCE_CS(0x00000001);    // encIME2SearchRangeY
171    RVCE_CS(0x00000000);    // parallelModeSpeedupEnable
172    RVCE_CS(0x00000000);    // fme0_encDisableSubMode
173    RVCE_CS(0x00000000);    // fme1_encDisableSubMode
174    RVCE_CS(0x00000000);    // imeSWSpeedupEnable
175    RVCE_END();
176 }
177 
rdo(struct rvce_encoder * enc)178 static void rdo(struct rvce_encoder *enc)
179 {
180    RVCE_BEGIN(0x04000008); // rdo
181    RVCE_CS(0x00000000);    // encDisableTbePredIFrame
182    RVCE_CS(0x00000000);    // encDisableTbePredPFrame
183    RVCE_CS(0x00000000);    // useFmeInterpolY
184    RVCE_CS(0x00000000);    // useFmeInterpolUV
185    RVCE_CS(0x00000000);    // useFmeIntrapolY
186    RVCE_CS(0x00000000);    // useFmeIntrapolUV
187    RVCE_CS(0x00000000);    // useFmeInterpolY_1
188    RVCE_CS(0x00000000);    // useFmeInterpolUV_1
189    RVCE_CS(0x00000000);    // useFmeIntrapolY_1
190    RVCE_CS(0x00000000);    // useFmeIntrapolUV_1
191    RVCE_CS(0x00000000);    // enc16x16CostAdj
192    RVCE_CS(0x00000000);    // encSkipCostAdj
193    RVCE_CS(0x00000000);    // encForce16x16skip
194    RVCE_CS(0x00000000);    // encDisableThresholdCalcA
195    RVCE_CS(0x00000000);    // encLumaCoeffCost
196    RVCE_CS(0x00000000);    // encLumaMBCoeffCost
197    RVCE_CS(0x00000000);    // encChromaCoeffCost
198    RVCE_END();
199 }
200 
vui(struct rvce_encoder * enc)201 static void vui(struct rvce_encoder *enc)
202 {
203    int i;
204 
205    if (!enc->pic.rate_ctrl[0].frame_rate_num)
206       return;
207 
208    RVCE_BEGIN(0x04000009);                     // vui
209    RVCE_CS(0x00000000);                        // aspectRatioInfoPresentFlag
210    RVCE_CS(0x00000000);                        // aspectRatioInfo.aspectRatioIdc
211    RVCE_CS(0x00000000);                        // aspectRatioInfo.sarWidth
212    RVCE_CS(0x00000000);                        // aspectRatioInfo.sarHeight
213    RVCE_CS(0x00000000);                        // overscanInfoPresentFlag
214    RVCE_CS(0x00000000);                        // overScanInfo.overscanAppropFlag
215    RVCE_CS(0x00000000);                        // videoSignalTypePresentFlag
216    RVCE_CS(0x00000005);                        // videoSignalTypeInfo.videoFormat
217    RVCE_CS(0x00000000);                        // videoSignalTypeInfo.videoFullRangeFlag
218    RVCE_CS(0x00000000);                        // videoSignalTypeInfo.colorDescriptionPresentFlag
219    RVCE_CS(0x00000002);                        // videoSignalTypeInfo.colorPrim
220    RVCE_CS(0x00000002);                        // videoSignalTypeInfo.transferChar
221    RVCE_CS(0x00000002);                        // videoSignalTypeInfo.matrixCoef
222    RVCE_CS(0x00000000);                        // chromaLocInfoPresentFlag
223    RVCE_CS(0x00000000);                        // chromaLocInfo.chromaLocTop
224    RVCE_CS(0x00000000);                        // chromaLocInfo.chromaLocBottom
225    RVCE_CS(0x00000001);                        // timingInfoPresentFlag
226    RVCE_CS(enc->pic.rate_ctrl[0].frame_rate_den); // timingInfo.numUnitsInTick
227    RVCE_CS(enc->pic.rate_ctrl[0].frame_rate_num * 2); // timingInfo.timeScale;
228    RVCE_CS(0x00000001);                            // timingInfo.fixedFrameRateFlag
229    RVCE_CS(0x00000000);                            // nalHRDParametersPresentFlag
230    RVCE_CS(0x00000000);                            // hrdParam.cpbCntMinus1
231    RVCE_CS(0x00000004);                            // hrdParam.bitRateScale
232    RVCE_CS(0x00000006);                            // hrdParam.cpbSizeScale
233    for (i = 0; i < 32; i++) {
234       RVCE_CS(0x00000000); // hrdParam.bitRateValueMinus
235       RVCE_CS(0x00000000); // hrdParam.cpbSizeValueMinus
236       RVCE_CS(0x00000000); // hrdParam.cbrFlag
237    }
238    RVCE_CS(0x00000017); // hrdParam.initialCpbRemovalDelayLengthMinus1
239    RVCE_CS(0x00000017); // hrdParam.cpbRemovalDelayLengthMinus1
240    RVCE_CS(0x00000017); // hrdParam.dpbOutputDelayLengthMinus1
241    RVCE_CS(0x00000018); // hrdParam.timeOffsetLength
242    RVCE_CS(0x00000000); // lowDelayHRDFlag
243    RVCE_CS(0x00000000); // picStructPresentFlag
244    RVCE_CS(0x00000000); // bitstreamRestrictionPresentFlag
245    RVCE_CS(0x00000001); // bitstreamRestrictions.motionVectorsOverPicBoundariesFlag
246    RVCE_CS(0x00000002); // bitstreamRestrictions.maxBytesPerPicDenom
247    RVCE_CS(0x00000001); // bitstreamRestrictions.maxBitsPerMbDenom
248    RVCE_CS(0x00000010); // bitstreamRestrictions.log2MaxMvLengthHori
249    RVCE_CS(0x00000010); // bitstreamRestrictions.log2MaxMvLengthVert
250    RVCE_CS(0x00000003); // bitstreamRestrictions.numReorderFrames
251    RVCE_CS(0x00000003); // bitstreamRestrictions.maxDecFrameBuffering
252    RVCE_END();
253 }
254 
config(struct rvce_encoder * enc)255 static void config(struct rvce_encoder *enc)
256 {
257    enc->task_info(enc, 0x00000002, 0, 0xffffffff, 0);
258    enc->rate_control(enc);
259    enc->config_extension(enc);
260    enc->motion_estimation(enc);
261    enc->rdo(enc);
262    if (enc->use_vui)
263       enc->vui(enc);
264    enc->pic_control(enc);
265 }
266 
encode(struct rvce_encoder * enc)267 static void encode(struct rvce_encoder *enc)
268 {
269    signed luma_offset, chroma_offset;
270    int i;
271 
272    enc->task_info(enc, 0x00000003, 0, 0, 0);
273 
274    RVCE_BEGIN(0x05000001);                                        // context buffer
275    RVCE_READWRITE(enc->cpb.res->buf, enc->cpb.res->domains, 0x0); // encodeContextAddressHi/Lo
276    RVCE_END();
277 
278    RVCE_BEGIN(0x05000004);                             // video bitstream buffer
279    RVCE_WRITE(enc->bs_handle, RADEON_DOMAIN_GTT, 0x0); // videoBitstreamRingAddressHi/Lo
280    RVCE_CS(enc->bs_size);                              // videoBitstreamRingSize
281    RVCE_END();
282 
283    RVCE_BEGIN(0x03000001); // encode
284    RVCE_CS(0x00000000);    // insertHeaders
285    RVCE_CS(0x00000000);    // pictureStructure
286    RVCE_CS(enc->bs_size);  // allowedMaxBitstreamSize
287    RVCE_CS(0x00000000);    // forceRefreshMap
288    RVCE_CS(0x00000000);    // insertAUD
289    RVCE_CS(0x00000000);    // endOfSequence
290    RVCE_CS(0x00000000);    // endOfStream
291    RVCE_READ(enc->handle, RADEON_DOMAIN_VRAM,
292              (uint64_t)enc->luma->u.legacy.level[0].offset_256B * 256); // inputPictureLumaAddressHi/Lo
293    RVCE_READ(enc->handle, RADEON_DOMAIN_VRAM,
294              (uint64_t)enc->chroma->u.legacy.level[0].offset_256B * 256);              // inputPictureChromaAddressHi/Lo
295    RVCE_CS(align(enc->luma->u.legacy.level[0].nblk_y, 16));       // encInputFrameYPitch
296    RVCE_CS(enc->luma->u.legacy.level[0].nblk_x * enc->luma->bpe); // encInputPicLumaPitch
297    RVCE_CS(enc->chroma->u.legacy.level[0].nblk_x * enc->chroma->bpe); // encInputPicChromaPitch
298    RVCE_CS(0x00000000);                                               // encInputPic(Addr|Array)Mode
299    RVCE_CS(0x00000000);                                               // encInputPicTileConfig
300    RVCE_CS(enc->pic.picture_type);                                    // encPicType
301    RVCE_CS(enc->pic.picture_type == PIPE_H2645_ENC_PICTURE_TYPE_IDR); // encIdrFlag
302    RVCE_CS(0x00000000);                                               // encIdrPicId
303    RVCE_CS(0x00000000);                                               // encMGSKeyPic
304    RVCE_CS(!enc->pic.not_referenced);                                 // encReferenceFlag
305    RVCE_CS(0x00000000);                                               // encTemporalLayerIndex
306    RVCE_CS(0x00000000); // num_ref_idx_active_override_flag
307    RVCE_CS(0x00000000); // num_ref_idx_l0_active_minus1
308    RVCE_CS(0x00000000); // num_ref_idx_l1_active_minus1
309 
310    i = enc->pic.frame_num - enc->pic.ref_idx_l0_list[0];
311    if (i > 1 && enc->pic.picture_type == PIPE_H2645_ENC_PICTURE_TYPE_P) {
312       RVCE_CS(0x00000001); // encRefListModificationOp
313       RVCE_CS(i - 1);      // encRefListModificationNum
314    } else {
315       RVCE_CS(0x00000000); // encRefListModificationOp
316       RVCE_CS(0x00000000); // encRefListModificationNum
317    }
318 
319    for (i = 0; i < 3; ++i) {
320       RVCE_CS(0x00000000); // encRefListModificationOp
321       RVCE_CS(0x00000000); // encRefListModificationNum
322    }
323    for (i = 0; i < 4; ++i) {
324       RVCE_CS(0x00000000); // encDecodedPictureMarkingOp
325       RVCE_CS(0x00000000); // encDecodedPictureMarkingNum
326       RVCE_CS(0x00000000); // encDecodedPictureMarkingIdx
327       RVCE_CS(0x00000000); // encDecodedRefBasePictureMarkingOp
328       RVCE_CS(0x00000000); // encDecodedRefBasePictureMarkingNum
329    }
330 
331    // encReferencePictureL0[0]
332    RVCE_CS(0x00000000); // pictureStructure
333    if (enc->pic.picture_type == PIPE_H2645_ENC_PICTURE_TYPE_P ||
334        enc->pic.picture_type == PIPE_H2645_ENC_PICTURE_TYPE_B) {
335       struct rvce_cpb_slot *l0 = si_l0_slot(enc);
336       si_vce_frame_offset(enc, l0, &luma_offset, &chroma_offset);
337       RVCE_CS(l0->picture_type);  // encPicType
338       RVCE_CS(l0->frame_num);     // frameNumber
339       RVCE_CS(l0->pic_order_cnt); // pictureOrderCount
340       RVCE_CS(luma_offset);       // lumaOffset
341       RVCE_CS(chroma_offset);     // chromaOffset
342    } else {
343       RVCE_CS(0x00000000); // encPicType
344       RVCE_CS(0x00000000); // frameNumber
345       RVCE_CS(0x00000000); // pictureOrderCount
346       RVCE_CS(0xffffffff); // lumaOffset
347       RVCE_CS(0xffffffff); // chromaOffset
348    }
349 
350    // encReferencePictureL0[1]
351    RVCE_CS(0x00000000); // pictureStructure
352    RVCE_CS(0x00000000); // encPicType
353    RVCE_CS(0x00000000); // frameNumber
354    RVCE_CS(0x00000000); // pictureOrderCount
355    RVCE_CS(0xffffffff); // lumaOffset
356    RVCE_CS(0xffffffff); // chromaOffset
357 
358    // encReferencePictureL1[0]
359    RVCE_CS(0x00000000); // pictureStructure
360    if (enc->pic.picture_type == PIPE_H2645_ENC_PICTURE_TYPE_B) {
361       struct rvce_cpb_slot *l1 = si_l1_slot(enc);
362       si_vce_frame_offset(enc, l1, &luma_offset, &chroma_offset);
363       RVCE_CS(l1->picture_type);  // encPicType
364       RVCE_CS(l1->frame_num);     // frameNumber
365       RVCE_CS(l1->pic_order_cnt); // pictureOrderCount
366       RVCE_CS(luma_offset);       // lumaOffset
367       RVCE_CS(chroma_offset);     // chromaOffset
368    } else {
369       RVCE_CS(0x00000000); // encPicType
370       RVCE_CS(0x00000000); // frameNumber
371       RVCE_CS(0x00000000); // pictureOrderCount
372       RVCE_CS(0xffffffff); // lumaOffset
373       RVCE_CS(0xffffffff); // chromaOffset
374    }
375 
376    si_vce_frame_offset(enc, si_current_slot(enc), &luma_offset, &chroma_offset);
377    RVCE_CS(luma_offset);            // encReconstructedLumaOffset
378    RVCE_CS(chroma_offset);          // encReconstructedChromaOffset
379    RVCE_CS(0x00000000);             // encColocBufferOffset
380    RVCE_CS(0x00000000);             // encReconstructedRefBasePictureLumaOffset
381    RVCE_CS(0x00000000);             // encReconstructedRefBasePictureChromaOffset
382    RVCE_CS(0x00000000);             // encReferenceRefBasePictureLumaOffset
383    RVCE_CS(0x00000000);             // encReferenceRefBasePictureChromaOffset
384    RVCE_CS(0x00000000);             // pictureCount
385    RVCE_CS(enc->pic.frame_num);     // frameNumber
386    RVCE_CS(enc->pic.pic_order_cnt); // pictureOrderCount
387    RVCE_CS(0x00000000);             // numIPicRemainInRCGOP
388    RVCE_CS(0x00000000);             // numPPicRemainInRCGOP
389    RVCE_CS(0x00000000);             // numBPicRemainInRCGOP
390    RVCE_CS(0x00000000);             // numIRPicRemainInRCGOP
391    RVCE_CS(0x00000000);             // enableIntraRefresh
392    RVCE_END();
393 }
394 
destroy(struct rvce_encoder * enc)395 static void destroy(struct rvce_encoder *enc)
396 {
397    enc->task_info(enc, 0x00000001, 0, 0, 0);
398 
399    feedback(enc);
400 
401    RVCE_BEGIN(0x02000001); // destroy
402    RVCE_END();
403 }
404 
si_vce_40_2_2_get_param(struct rvce_encoder * enc,struct pipe_h264_enc_picture_desc * pic)405 void si_vce_40_2_2_get_param(struct rvce_encoder *enc, struct pipe_h264_enc_picture_desc *pic)
406 {
407 }
408 
si_vce_40_2_2_init(struct rvce_encoder * enc)409 void si_vce_40_2_2_init(struct rvce_encoder *enc)
410 {
411    enc->session = session;
412    enc->task_info = task_info;
413    enc->create = create;
414    enc->feedback = feedback;
415    enc->rate_control = rate_control;
416    enc->config_extension = config_extension;
417    enc->pic_control = pic_control;
418    enc->motion_estimation = motion_estimation;
419    enc->rdo = rdo;
420    enc->vui = vui;
421    enc->config = config;
422    enc->encode = encode;
423    enc->destroy = destroy;
424    enc->si_get_pic_param = si_vce_40_2_2_get_param;
425 }
426