Lines Matching full:enc
69 static struct amdgpu_uvd_enc enc; variable
80 { "UVD ENC create", amdgpu_cs_uvd_enc_create },
81 { "UVD ENC session init", amdgpu_cs_uvd_enc_session_init },
82 { "UVD ENC encode", amdgpu_cs_uvd_enc_encode },
83 { "UVD ENC destroy", amdgpu_cs_uvd_enc_destroy },
102 printf("\n\nThe ASIC NOT support UVD ENC, suite disabled.\n"); in suite_uvd_enc_tests_enable()
246 enc.width = 160; in amdgpu_cs_uvd_enc_create()
247 enc.height = 128; in amdgpu_cs_uvd_enc_create()
250 alloc_resource(&enc.session, 128 * 1024, AMDGPU_GEM_DOMAIN_GTT); in amdgpu_cs_uvd_enc_create()
251 resources[num_resources++] = enc.session.handle; in amdgpu_cs_uvd_enc_create()
255 static void check_result(struct amdgpu_uvd_enc *enc) in check_result() argument
262 r = amdgpu_bo_cpu_map(enc->fb.handle, (void **)&enc->fb.ptr); in check_result()
264 ptr = (uint32_t *)enc->fb.ptr; in check_result()
266 r = amdgpu_bo_cpu_unmap(enc->fb.handle); in check_result()
268 r = amdgpu_bo_cpu_map(enc->bs.handle, (void **)&enc->bs.ptr); in check_result()
271 sum += enc->bs.ptr[j]; in check_result()
273 r = amdgpu_bo_cpu_unmap(enc->bs.handle); in check_result()
285 ib_cpu[len++] = enc.session.addr >> 32; in amdgpu_cs_uvd_enc_session_init()
286 ib_cpu[len++] = enc.session.addr; in amdgpu_cs_uvd_enc_session_init()
334 vbuf_size = ALIGN(enc.width, align) * ALIGN(enc.height, 16) * 1.5; in amdgpu_cs_uvd_enc_encode()
339 alloc_resource(&enc.fb, 4096, AMDGPU_GEM_DOMAIN_VRAM); in amdgpu_cs_uvd_enc_encode()
340 resources[num_resources++] = enc.fb.handle; in amdgpu_cs_uvd_enc_encode()
341 alloc_resource(&enc.bs, bs_size, AMDGPU_GEM_DOMAIN_VRAM); in amdgpu_cs_uvd_enc_encode()
342 resources[num_resources++] = enc.bs.handle; in amdgpu_cs_uvd_enc_encode()
343 alloc_resource(&enc.vbuf, vbuf_size, AMDGPU_GEM_DOMAIN_VRAM); in amdgpu_cs_uvd_enc_encode()
344 resources[num_resources++] = enc.vbuf.handle; in amdgpu_cs_uvd_enc_encode()
345 alloc_resource(&enc.cpb, cpb_size, AMDGPU_GEM_DOMAIN_VRAM); in amdgpu_cs_uvd_enc_encode()
346 resources[num_resources++] = enc.cpb.handle; in amdgpu_cs_uvd_enc_encode()
349 r = amdgpu_bo_cpu_map(enc.vbuf.handle, (void **)&enc.vbuf.ptr); in amdgpu_cs_uvd_enc_encode()
352 memset(enc.vbuf.ptr, 0, vbuf_size); in amdgpu_cs_uvd_enc_encode()
353 for (i = 0; i < enc.height; ++i) { in amdgpu_cs_uvd_enc_encode()
354 memcpy(enc.vbuf.ptr, (frame + i * enc.width), enc.width); in amdgpu_cs_uvd_enc_encode()
355 enc.vbuf.ptr += ALIGN(enc.width, align); in amdgpu_cs_uvd_enc_encode()
357 for (i = 0; i < enc.height / 2; ++i) { in amdgpu_cs_uvd_enc_encode()
358 memcpy(enc.vbuf.ptr, ((frame + enc.height * enc.width) + i * enc.width), enc.width); in amdgpu_cs_uvd_enc_encode()
359 enc.vbuf.ptr += ALIGN(enc.width, align); in amdgpu_cs_uvd_enc_encode()
362 r = amdgpu_bo_cpu_unmap(enc.vbuf.handle); in amdgpu_cs_uvd_enc_encode()
368 ib_cpu[len++] = enc.session.addr >> 32; in amdgpu_cs_uvd_enc_encode()
369 ib_cpu[len++] = enc.session.addr; in amdgpu_cs_uvd_enc_encode()
394 ib_cpu[len++] = enc.cpb.addr >> 32; in amdgpu_cs_uvd_enc_encode()
395 ib_cpu[len++] = enc.cpb.addr; in amdgpu_cs_uvd_enc_encode()
402 ib_cpu[len++] = enc.bs.addr >> 32; in amdgpu_cs_uvd_enc_encode()
403 ib_cpu[len++] = enc.bs.addr; in amdgpu_cs_uvd_enc_encode()
409 ib_cpu[len++] = enc.fb.addr >> 32; in amdgpu_cs_uvd_enc_encode()
410 ib_cpu[len++] = enc.fb.addr; in amdgpu_cs_uvd_enc_encode()
432 unsigned luma_size = ALIGN(enc.width, align) * ALIGN(enc.height, 16); in amdgpu_cs_uvd_enc_encode()
433 luma_offset = enc.vbuf.addr; in amdgpu_cs_uvd_enc_encode()
444 ib_cpu[len] = ALIGN(enc.width, align); in amdgpu_cs_uvd_enc_encode()
445 ib_cpu[len + 1] = ALIGN(enc.width, align); in amdgpu_cs_uvd_enc_encode()
457 check_result(&enc); in amdgpu_cs_uvd_enc_encode()
459 free_resource(&enc.fb); in amdgpu_cs_uvd_enc_encode()
460 free_resource(&enc.bs); in amdgpu_cs_uvd_enc_encode()
461 free_resource(&enc.vbuf); in amdgpu_cs_uvd_enc_encode()
462 free_resource(&enc.cpb); in amdgpu_cs_uvd_enc_encode()
475 ib_cpu[len++] = enc.session.addr >> 32; in amdgpu_cs_uvd_enc_destroy()
476 ib_cpu[len++] = enc.session.addr; in amdgpu_cs_uvd_enc_destroy()
490 free_resource(&enc.session); in amdgpu_cs_uvd_enc_destroy()