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