• Home
  • Raw
  • Download

Lines Matching refs:enc

60 static void flush(struct rvce_encoder *enc)  in flush()  argument
62 enc->ws->cs_flush(enc->cs, PIPE_FLUSH_ASYNC, NULL); in flush()
63 enc->task_info_idx = 0; in flush()
64 enc->bs_idx = 0; in flush()
68 static void dump_feedback(struct rvce_encoder *enc, struct rvid_buffer *fb)
70 uint32_t *ptr = enc->ws->buffer_map(fb->res->buf, enc->cs, PIPE_TRANSFER_READ_WRITE);
89 enc->ws->buffer_unmap(fb->res->buf);
96 static void reset_cpb(struct rvce_encoder *enc) in reset_cpb() argument
100 LIST_INITHEAD(&enc->cpb_slots); in reset_cpb()
101 for (i = 0; i < enc->cpb_num; ++i) { in reset_cpb()
102 struct rvce_cpb_slot *slot = &enc->cpb_array[i]; in reset_cpb()
107 LIST_ADDTAIL(&slot->list, &enc->cpb_slots); in reset_cpb()
114 static void sort_cpb(struct rvce_encoder *enc) in sort_cpb() argument
118 LIST_FOR_EACH_ENTRY(i, &enc->cpb_slots, list) { in sort_cpb()
119 if (i->frame_num == enc->pic.ref_idx_l0) in sort_cpb()
122 if (i->frame_num == enc->pic.ref_idx_l1) in sort_cpb()
125 if (enc->pic.picture_type == PIPE_H264_ENC_PICTURE_TYPE_P && l0) in sort_cpb()
128 if (enc->pic.picture_type == PIPE_H264_ENC_PICTURE_TYPE_B && in sort_cpb()
135 LIST_ADD(&l1->list, &enc->cpb_slots); in sort_cpb()
140 LIST_ADD(&l0->list, &enc->cpb_slots); in sort_cpb()
147 static unsigned get_cpb_num(struct rvce_encoder *enc) in get_cpb_num() argument
149 unsigned w = align(enc->base.width, 16) / 16; in get_cpb_num()
150 unsigned h = align(enc->base.height, 16) / 16; in get_cpb_num()
153 switch (enc->base.level) { in get_cpb_num()
201 struct rvce_cpb_slot *current_slot(struct rvce_encoder *enc) in current_slot() argument
203 return LIST_ENTRY(struct rvce_cpb_slot, enc->cpb_slots.prev, list); in current_slot()
209 struct rvce_cpb_slot *l0_slot(struct rvce_encoder *enc) in l0_slot() argument
211 return LIST_ENTRY(struct rvce_cpb_slot, enc->cpb_slots.next, list); in l0_slot()
217 struct rvce_cpb_slot *l1_slot(struct rvce_encoder *enc) in l1_slot() argument
219 return LIST_ENTRY(struct rvce_cpb_slot, enc->cpb_slots.next->next, list); in l1_slot()
225 void rvce_frame_offset(struct rvce_encoder *enc, struct rvce_cpb_slot *slot, in rvce_frame_offset() argument
230 pitch = align(enc->luma->u.legacy.level[0].nblk_x * enc->luma->bpe, 128); in rvce_frame_offset()
231 vpitch = align(enc->luma->u.legacy.level[0].nblk_y, 16); in rvce_frame_offset()
243 struct rvce_encoder *enc = (struct rvce_encoder*)encoder; in rvce_destroy() local
244 if (enc->stream_handle) { in rvce_destroy()
246 rvid_create_buffer(enc->screen, &fb, 512, PIPE_USAGE_STAGING); in rvce_destroy()
247 enc->fb = &fb; in rvce_destroy()
248 enc->session(enc); in rvce_destroy()
249 enc->feedback(enc); in rvce_destroy()
250 enc->destroy(enc); in rvce_destroy()
251 flush(enc); in rvce_destroy()
254 rvid_destroy_buffer(&enc->cpb); in rvce_destroy()
255 enc->ws->cs_destroy(enc->cs); in rvce_destroy()
256 FREE(enc->cpb_array); in rvce_destroy()
257 FREE(enc); in rvce_destroy()
264 struct rvce_encoder *enc = (struct rvce_encoder*)encoder; in rvce_begin_frame() local
269 enc->pic.rate_ctrl.rate_ctrl_method != pic->rate_ctrl.rate_ctrl_method || in rvce_begin_frame()
270 enc->pic.quant_i_frames != pic->quant_i_frames || in rvce_begin_frame()
271 enc->pic.quant_p_frames != pic->quant_p_frames || in rvce_begin_frame()
272 enc->pic.quant_b_frames != pic->quant_b_frames; in rvce_begin_frame()
274 enc->pic = *pic; in rvce_begin_frame()
275 get_pic_param(enc, pic); in rvce_begin_frame()
277 enc->get_buffer(vid_buf->resources[0], &enc->handle, &enc->luma); in rvce_begin_frame()
278 enc->get_buffer(vid_buf->resources[1], NULL, &enc->chroma); in rvce_begin_frame()
281 reset_cpb(enc); in rvce_begin_frame()
284 sort_cpb(enc); in rvce_begin_frame()
286 if (!enc->stream_handle) { in rvce_begin_frame()
288 enc->stream_handle = rvid_alloc_stream_handle(); in rvce_begin_frame()
289 rvid_create_buffer(enc->screen, &fb, 512, PIPE_USAGE_STAGING); in rvce_begin_frame()
290 enc->fb = &fb; in rvce_begin_frame()
291 enc->session(enc); in rvce_begin_frame()
292 enc->create(enc); in rvce_begin_frame()
293 enc->config(enc); in rvce_begin_frame()
294 enc->feedback(enc); in rvce_begin_frame()
295 flush(enc); in rvce_begin_frame()
302 enc->session(enc); in rvce_begin_frame()
303 enc->config(enc); in rvce_begin_frame()
304 flush(enc); in rvce_begin_frame()
313 struct rvce_encoder *enc = (struct rvce_encoder*)encoder; in rvce_encode_bitstream() local
314 enc->get_buffer(destination, &enc->bs_handle, NULL); in rvce_encode_bitstream()
315 enc->bs_size = destination->width0; in rvce_encode_bitstream()
317 *fb = enc->fb = CALLOC_STRUCT(rvid_buffer); in rvce_encode_bitstream()
318 if (!rvid_create_buffer(enc->screen, enc->fb, 512, PIPE_USAGE_STAGING)) { in rvce_encode_bitstream()
322 if (!radeon_emitted(enc->cs, 0)) in rvce_encode_bitstream()
323 enc->session(enc); in rvce_encode_bitstream()
324 enc->encode(enc); in rvce_encode_bitstream()
325 enc->feedback(enc); in rvce_encode_bitstream()
332 struct rvce_encoder *enc = (struct rvce_encoder*)encoder; in rvce_end_frame() local
334 struct rvce_cpb_slot, enc->cpb_slots.prev, list); in rvce_end_frame()
336 if (!enc->dual_inst || enc->bs_idx > 1) in rvce_end_frame()
337 flush(enc); in rvce_end_frame()
340 slot->picture_type = enc->pic.picture_type; in rvce_end_frame()
341 slot->frame_num = enc->pic.frame_num; in rvce_end_frame()
342 slot->pic_order_cnt = enc->pic.pic_order_cnt; in rvce_end_frame()
343 if (!enc->pic.not_referenced) { in rvce_end_frame()
345 LIST_ADD(&slot->list, &enc->cpb_slots); in rvce_end_frame()
352 struct rvce_encoder *enc = (struct rvce_encoder*)encoder; in rvce_get_feedback() local
356 uint32_t *ptr = enc->ws->buffer_map(fb->res->buf, enc->cs, PIPE_TRANSFER_READ_WRITE); in rvce_get_feedback()
364 enc->ws->buffer_unmap(fb->res->buf); in rvce_get_feedback()
376 struct rvce_encoder *enc = (struct rvce_encoder*)encoder; in rvce_flush() local
378 flush(enc); in rvce_flush()
394 struct rvce_encoder *enc; in rvce_create_encoder() local
408 enc = CALLOC_STRUCT(rvce_encoder); in rvce_create_encoder()
409 if (!enc) in rvce_create_encoder()
413 enc->use_vm = true; in rvce_create_encoder()
416 enc->use_vui = true; in rvce_create_encoder()
418 enc->base = *templ; in rvce_create_encoder()
419 enc->base.context = context; in rvce_create_encoder()
421 enc->base.destroy = rvce_destroy; in rvce_create_encoder()
422 enc->base.begin_frame = rvce_begin_frame; in rvce_create_encoder()
423 enc->base.encode_bitstream = rvce_encode_bitstream; in rvce_create_encoder()
424 enc->base.end_frame = rvce_end_frame; in rvce_create_encoder()
425 enc->base.flush = rvce_flush; in rvce_create_encoder()
426 enc->base.get_feedback = rvce_get_feedback; in rvce_create_encoder()
427 enc->get_buffer = get_buffer; in rvce_create_encoder()
429 enc->screen = context->screen; in rvce_create_encoder()
430 enc->ws = ws; in rvce_create_encoder()
431 enc->cs = ws->cs_create(rctx->ctx, RING_VCE, rvce_cs_flush, enc); in rvce_create_encoder()
432 if (!enc->cs) { in rvce_create_encoder()
439 templat.width = enc->base.width; in rvce_create_encoder()
440 templat.height = enc->base.height; in rvce_create_encoder()
447 enc->cpb_num = get_cpb_num(enc); in rvce_create_encoder()
448 if (!enc->cpb_num) in rvce_create_encoder()
457 cpb_size = cpb_size * enc->cpb_num; in rvce_create_encoder()
458 if (enc->dual_pipe) in rvce_create_encoder()
462 if (!rvid_create_buffer(enc->screen, &enc->cpb, cpb_size, PIPE_USAGE_DEFAULT)) { in rvce_create_encoder()
467 enc->cpb_array = CALLOC(enc->cpb_num, sizeof(struct rvce_cpb_slot)); in rvce_create_encoder()
468 if (!enc->cpb_array) in rvce_create_encoder()
471 reset_cpb(enc); in rvce_create_encoder()
475 return &enc->base; in rvce_create_encoder()
478 if (enc->cs) in rvce_create_encoder()
479 enc->ws->cs_destroy(enc->cs); in rvce_create_encoder()
481 rvid_destroy_buffer(&enc->cpb); in rvce_create_encoder()
483 FREE(enc->cpb_array); in rvce_create_encoder()
484 FREE(enc); in rvce_create_encoder()
514 void rvce_add_buffer(struct rvce_encoder *enc, struct pb_buffer *buf, in rvce_add_buffer() argument
520 reloc_idx = enc->ws->cs_add_buffer(enc->cs, buf, usage | RADEON_USAGE_SYNCHRONIZED, in rvce_add_buffer()
522 if (enc->use_vm) { in rvce_add_buffer()
524 addr = enc->ws->buffer_get_virtual_address(buf); in rvce_add_buffer()
529 offset += enc->ws->buffer_get_reloc_offset(buf); in rvce_add_buffer()