Lines Matching refs:enc
72 static struct amdgpu_vce_encode enc; variable
137 memset(&enc, 0, sizeof(struct amdgpu_vce_encode)); in suite_vce_tests_init()
257 enc.width = vce_create[6]; in amdgpu_cs_vce_create()
258 enc.height = vce_create[7]; in amdgpu_cs_vce_create()
261 alloc_resource(&enc.fb[0], 4096, AMDGPU_GEM_DOMAIN_GTT); in amdgpu_cs_vce_create()
262 resources[num_resources++] = enc.fb[0].handle; in amdgpu_cs_vce_create()
271 ib_cpu[len + 8] = ALIGN(enc.width, align); in amdgpu_cs_vce_create()
272 ib_cpu[len + 9] = ALIGN(enc.width, align); in amdgpu_cs_vce_create()
275 ib_cpu[len + 2] = enc.fb[0].addr >> 32; in amdgpu_cs_vce_create()
276 ib_cpu[len + 3] = enc.fb[0].addr; in amdgpu_cs_vce_create()
282 free_resource(&enc.fb[0]); in amdgpu_cs_vce_create()
310 static void amdgpu_cs_vce_encode_idr(struct amdgpu_vce_encode *enc) in amdgpu_cs_vce_encode_idr() argument
315 unsigned luma_size = ALIGN(enc->width, align) * ALIGN(enc->height, 16); in amdgpu_cs_vce_encode_idr()
318 luma_offset = enc->vbuf.addr; in amdgpu_cs_vce_encode_idr()
326 ib_cpu[len + 2] = enc->bs[0].addr >> 32; in amdgpu_cs_vce_encode_idr()
327 ib_cpu[len + 3] = enc->bs[0].addr; in amdgpu_cs_vce_encode_idr()
330 ib_cpu[len + 2] = enc->cpb.addr >> 32; in amdgpu_cs_vce_encode_idr()
331 ib_cpu[len + 3] = enc->cpb.addr; in amdgpu_cs_vce_encode_idr()
340 ib_cpu[len + 2] = enc->fb[0].addr >> 32; in amdgpu_cs_vce_encode_idr()
341 ib_cpu[len + 3] = enc->fb[0].addr; in amdgpu_cs_vce_encode_idr()
348 ib_cpu[len + 14] = ALIGN(enc->width, align); in amdgpu_cs_vce_encode_idr()
349 ib_cpu[len + 15] = ALIGN(enc->width, align); in amdgpu_cs_vce_encode_idr()
353 enc->ib_len = len; in amdgpu_cs_vce_encode_idr()
354 if (!enc->two_instance) { in amdgpu_cs_vce_encode_idr()
360 static void amdgpu_cs_vce_encode_p(struct amdgpu_vce_encode *enc) in amdgpu_cs_vce_encode_p() argument
365 unsigned luma_size = ALIGN(enc->width, align) * ALIGN(enc->height, 16); in amdgpu_cs_vce_encode_p()
367 len = (enc->two_instance) ? enc->ib_len : 0; in amdgpu_cs_vce_encode_p()
368 luma_offset = enc->vbuf.addr; in amdgpu_cs_vce_encode_p()
371 if (!enc->two_instance) { in amdgpu_cs_vce_encode_p()
378 ib_cpu[len + 2] = enc->bs[1].addr >> 32; in amdgpu_cs_vce_encode_p()
379 ib_cpu[len + 3] = enc->bs[1].addr; in amdgpu_cs_vce_encode_p()
382 ib_cpu[len + 2] = enc->cpb.addr >> 32; in amdgpu_cs_vce_encode_p()
383 ib_cpu[len + 3] = enc->cpb.addr; in amdgpu_cs_vce_encode_p()
392 ib_cpu[len + 2] = enc->fb[1].addr >> 32; in amdgpu_cs_vce_encode_p()
393 ib_cpu[len + 3] = enc->fb[1].addr; in amdgpu_cs_vce_encode_p()
401 ib_cpu[len + 14] = ALIGN(enc->width, align); in amdgpu_cs_vce_encode_p()
402 ib_cpu[len + 15] = ALIGN(enc->width, align); in amdgpu_cs_vce_encode_p()
420 static void check_result(struct amdgpu_vce_encode *enc) in check_result() argument
428 r = amdgpu_bo_cpu_map(enc->fb[i].handle, (void **)&enc->fb[i].ptr); in check_result()
430 ptr = (uint32_t *)enc->fb[i].ptr; in check_result()
432 r = amdgpu_bo_cpu_unmap(enc->fb[i].handle); in check_result()
434 r = amdgpu_bo_cpu_map(enc->bs[i].handle, (void **)&enc->bs[i].ptr); in check_result()
437 sum += enc->bs[i].ptr[j]; in check_result()
439 r = amdgpu_bo_cpu_unmap(enc->bs[i].handle); in check_result()
450 vbuf_size = ALIGN(enc.width, align) * ALIGN(enc.height, 16) * 1.5; in amdgpu_cs_vce_encode()
453 alloc_resource(&enc.fb[0], 4096, AMDGPU_GEM_DOMAIN_GTT); in amdgpu_cs_vce_encode()
454 resources[num_resources++] = enc.fb[0].handle; in amdgpu_cs_vce_encode()
455 alloc_resource(&enc.fb[1], 4096, AMDGPU_GEM_DOMAIN_GTT); in amdgpu_cs_vce_encode()
456 resources[num_resources++] = enc.fb[1].handle; in amdgpu_cs_vce_encode()
457 alloc_resource(&enc.bs[0], bs_size, AMDGPU_GEM_DOMAIN_GTT); in amdgpu_cs_vce_encode()
458 resources[num_resources++] = enc.bs[0].handle; in amdgpu_cs_vce_encode()
459 alloc_resource(&enc.bs[1], bs_size, AMDGPU_GEM_DOMAIN_GTT); in amdgpu_cs_vce_encode()
460 resources[num_resources++] = enc.bs[1].handle; in amdgpu_cs_vce_encode()
461 alloc_resource(&enc.vbuf, vbuf_size, AMDGPU_GEM_DOMAIN_VRAM); in amdgpu_cs_vce_encode()
462 resources[num_resources++] = enc.vbuf.handle; in amdgpu_cs_vce_encode()
463 alloc_resource(&enc.cpb, cpb_size, AMDGPU_GEM_DOMAIN_VRAM); in amdgpu_cs_vce_encode()
464 resources[num_resources++] = enc.cpb.handle; in amdgpu_cs_vce_encode()
467 r = amdgpu_bo_cpu_map(enc.vbuf.handle, (void **)&enc.vbuf.ptr); in amdgpu_cs_vce_encode()
470 memset(enc.vbuf.ptr, 0, vbuf_size); in amdgpu_cs_vce_encode()
471 for (i = 0; i < enc.height; ++i) { in amdgpu_cs_vce_encode()
472 memcpy(enc.vbuf.ptr, (frame + i * enc.width), enc.width); in amdgpu_cs_vce_encode()
473 enc.vbuf.ptr += ALIGN(enc.width, align); in amdgpu_cs_vce_encode()
475 for (i = 0; i < enc.height / 2; ++i) { in amdgpu_cs_vce_encode()
476 memcpy(enc.vbuf.ptr, ((frame + enc.height * enc.width) + i * enc.width), enc.width); in amdgpu_cs_vce_encode()
477 enc.vbuf.ptr += ALIGN(enc.width, align); in amdgpu_cs_vce_encode()
480 r = amdgpu_bo_cpu_unmap(enc.vbuf.handle); in amdgpu_cs_vce_encode()
487 amdgpu_cs_vce_encode_idr(&enc); in amdgpu_cs_vce_encode()
488 amdgpu_cs_vce_encode_p(&enc); in amdgpu_cs_vce_encode()
489 check_result(&enc); in amdgpu_cs_vce_encode()
493 amdgpu_cs_vce_encode_idr(&enc); in amdgpu_cs_vce_encode()
494 amdgpu_cs_vce_encode_p(&enc); in amdgpu_cs_vce_encode()
495 check_result(&enc); in amdgpu_cs_vce_encode()
499 enc.two_instance = true; in amdgpu_cs_vce_encode()
502 amdgpu_cs_vce_encode_idr(&enc); in amdgpu_cs_vce_encode()
505 amdgpu_cs_vce_encode_p(&enc); in amdgpu_cs_vce_encode()
506 check_result(&enc); in amdgpu_cs_vce_encode()
511 amdgpu_cs_vce_encode_idr(&enc); in amdgpu_cs_vce_encode()
512 amdgpu_cs_vce_encode_p(&enc); in amdgpu_cs_vce_encode()
513 check_result(&enc); in amdgpu_cs_vce_encode()
516 free_resource(&enc.fb[0]); in amdgpu_cs_vce_encode()
517 free_resource(&enc.fb[1]); in amdgpu_cs_vce_encode()
518 free_resource(&enc.bs[0]); in amdgpu_cs_vce_encode()
519 free_resource(&enc.bs[1]); in amdgpu_cs_vce_encode()
520 free_resource(&enc.vbuf); in amdgpu_cs_vce_encode()
521 free_resource(&enc.cpb); in amdgpu_cs_vce_encode()
529 alloc_resource(&enc.fb[0], 4096, AMDGPU_GEM_DOMAIN_GTT); in amdgpu_cs_vce_destroy()
530 resources[num_resources++] = enc.fb[0].handle; in amdgpu_cs_vce_destroy()
540 ib_cpu[len + 2] = enc.fb[0].addr >> 32; in amdgpu_cs_vce_destroy()
541 ib_cpu[len + 3] = enc.fb[0].addr; in amdgpu_cs_vce_destroy()
549 free_resource(&enc.fb[0]); in amdgpu_cs_vce_destroy()