Lines Matching defs:enc

69 static struct amdgpu_uvd_enc enc;
246 enc.width = 160;
247 enc.height = 128;
250 alloc_resource(&enc.session, 128 * 1024, AMDGPU_GEM_DOMAIN_GTT);
251 resources[num_resources++] = enc.session.handle;
255 static void check_result(struct amdgpu_uvd_enc *enc)
262 r = amdgpu_bo_cpu_map(enc->fb.handle, (void **)&enc->fb.ptr);
264 ptr = (uint32_t *)enc->fb.ptr;
266 r = amdgpu_bo_cpu_unmap(enc->fb.handle);
268 r = amdgpu_bo_cpu_map(enc->bs.handle, (void **)&enc->bs.ptr);
271 sum += enc->bs.ptr[j];
273 r = amdgpu_bo_cpu_unmap(enc->bs.handle);
285 ib_cpu[len++] = enc.session.addr >> 32;
286 ib_cpu[len++] = enc.session.addr;
334 vbuf_size = ALIGN(enc.width, align) * ALIGN(enc.height, 16) * 1.5;
339 alloc_resource(&enc.fb, 4096, AMDGPU_GEM_DOMAIN_VRAM);
340 resources[num_resources++] = enc.fb.handle;
341 alloc_resource(&enc.bs, bs_size, AMDGPU_GEM_DOMAIN_VRAM);
342 resources[num_resources++] = enc.bs.handle;
343 alloc_resource(&enc.vbuf, vbuf_size, AMDGPU_GEM_DOMAIN_VRAM);
344 resources[num_resources++] = enc.vbuf.handle;
345 alloc_resource(&enc.cpb, cpb_size, AMDGPU_GEM_DOMAIN_VRAM);
346 resources[num_resources++] = enc.cpb.handle;
349 r = amdgpu_bo_cpu_map(enc.vbuf.handle, (void **)&enc.vbuf.ptr);
352 memset(enc.vbuf.ptr, 0, vbuf_size);
353 for (i = 0; i < enc.height; ++i) {
354 memcpy(enc.vbuf.ptr, (frame + i * enc.width), enc.width);
355 enc.vbuf.ptr += ALIGN(enc.width, align);
357 for (i = 0; i < enc.height / 2; ++i) {
358 memcpy(enc.vbuf.ptr, ((frame + enc.height * enc.width) + i * enc.width), enc.width);
359 enc.vbuf.ptr += ALIGN(enc.width, align);
362 r = amdgpu_bo_cpu_unmap(enc.vbuf.handle);
368 ib_cpu[len++] = enc.session.addr >> 32;
369 ib_cpu[len++] = enc.session.addr;
394 ib_cpu[len++] = enc.cpb.addr >> 32;
395 ib_cpu[len++] = enc.cpb.addr;
402 ib_cpu[len++] = enc.bs.addr >> 32;
403 ib_cpu[len++] = enc.bs.addr;
409 ib_cpu[len++] = enc.fb.addr >> 32;
410 ib_cpu[len++] = enc.fb.addr;
432 unsigned luma_size = ALIGN(enc.width, align) * ALIGN(enc.height, 16);
433 luma_offset = enc.vbuf.addr;
444 ib_cpu[len] = ALIGN(enc.width, align);
445 ib_cpu[len + 1] = ALIGN(enc.width, align);
457 check_result(&enc);
459 free_resource(&enc.fb);
460 free_resource(&enc.bs);
461 free_resource(&enc.vbuf);
462 free_resource(&enc.cpb);
475 ib_cpu[len++] = enc.session.addr >> 32;
476 ib_cpu[len++] = enc.session.addr;
490 free_resource(&enc.session);